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
From bbedce3f21422bfd9058f33bfaab3d4eac421631 Mon Sep 17 00:00:00 2001
From: Collin Funk <collin.fu...@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.fu...@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.fu...@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 via email to