bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
From: Collin Funk <collin.funk1@gmail.com>
To: bug-gnulib@gnu.org
Subject: gnulib-tool.py: Fix incorrect type hint.
Date: Sun, 14 Apr 2024 13:47:45 -0700	[thread overview]
Message-ID: <a84c8969-30dd-4ad7-81d8-c622c87b6e10@gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 458 bytes --]

When adding type hints I made a mistake. The 'filelist' passed to
'filter_filelist' should be marked 'list[str]' and not 'str'.

You can see this in GLModuleSystem.py with mypy [1]:

pygnulib/GLModuleSystem.py:595: error: Argument 2 has incompatible type "list[str]"; expected "str"  [arg-type]
pygnulib/GLModuleSystem.py:612: error: Argument 2 has incompatible type "list[str]"; expected "str"  [arg-type]

[1] https://mypy.readthedocs.io/en/stable/

Collin

[-- Attachment #2: 0001-gnulib-tool.py-Fix-incorrect-type-hint.patch --]
[-- Type: text/x-patch, Size: 1535 bytes --]

From bbedce3f21422bfd9058f33bfaab3d4eac421631 Mon Sep 17 00:00:00 2001
From: Collin Funk <collin.funk1@gmail.com>
Date: Sun, 14 Apr 2024 13:41:17 -0700
Subject: [PATCH] gnulib-tool.py: Fix incorrect type hint.

* pygnulib/constants.py (filter_filelist): Correct the type hint on the
'filelist' argument. It is a list of strings, not a string.
---
 ChangeLog             | 6 ++++++
 pygnulib/constants.py | 2 +-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index 80e361f04f..00512cd70b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2024-04-14  Collin Funk  <collin.funk1@gmail.com>
+
+	gnulib-tool.py: Fix incorrect type hint.
+	* pygnulib/constants.py (filter_filelist): Correct the type hint on the
+	'filelist' argument. It is a list of strings, not a string.
+
 2024-04-14  Collin Funk  <collin.funk1@gmail.com>
 
 	gnulib-tool.py: Write newlines consistently.
diff --git a/pygnulib/constants.py b/pygnulib/constants.py
index 899ba46efd..81f9b660f7 100644
--- a/pygnulib/constants.py
+++ b/pygnulib/constants.py
@@ -464,7 +464,7 @@ def rmtree(dest: str) -> None:
             pass
 
 
-def filter_filelist(separator: str, filelist: str, prefix: str, suffix: str,
+def filter_filelist(separator: str, filelist: list[str], prefix: str, suffix: str,
                     removed_prefix: str, removed_suffix: str,
                     added_prefix: str = '', added_suffix: str = '') -> str:
     '''Filter the given list of files. Filtering: Only the elements starting with
-- 
2.44.0


             reply	other threads:[~2024-04-14 20:47 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-14 20:47 Collin Funk [this message]
2024-04-14 22:19 ` gnulib-tool.py: Fix incorrect type hint Bruno Haible

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://lists.gnu.org/mailman/listinfo/bug-gnulib

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a84c8969-30dd-4ad7-81d8-c622c87b6e10@gmail.com \
    --to=collin.funk1@gmail.com \
    --cc=bug-gnulib@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).