From 248ee131d9223848853bacb4df11b1d1e1f826e9 Mon Sep 17 00:00:00 2001 From: Avasam Date: Sun, 4 May 2025 11:48:10 -0400 Subject: [PATCH 1/2] Re-organize mypy errors --- mypy.ini | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/mypy.ini b/mypy.ini index 146222a5..5244a0e9 100644 --- a/mypy.ini +++ b/mypy.ini @@ -16,20 +16,22 @@ disable_error_code = # local + # Code that is too dynamic using variable command names; + # and code that uses platform checks mypy doesn't understand + attr-defined, + # These reveal issues in distutils/_modified.py that should be fixed + return-value, + type-var, # TODO: Resolve and re-enable these gradually operator, - attr-defined, arg-type, assignment, call-overload, - return-value, index, - type-var, func-returns-value, union-attr, str-bytes-safe, misc, - has-type, # stdlib's test module is not typed on typeshed [mypy-test.*] From 608a480b76934651d2c05bb1692c95507c830b82 Mon Sep 17 00:00:00 2001 From: Avasam Date: Sun, 4 May 2025 12:14:56 -0400 Subject: [PATCH 2/2] mypy: Fix all str-bytes-safe --- distutils/cmd.py | 4 ++-- distutils/tests/test_cmd.py | 2 +- mypy.ini | 1 - 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/distutils/cmd.py b/distutils/cmd.py index 241621bd..10b1f42a 100644 --- a/distutils/cmd.py +++ b/distutils/cmd.py @@ -533,7 +533,7 @@ def make_file( timestamp checks. """ if skip_msg is None: - skip_msg = f"skipping {outfile} (inputs unchanged)" + skip_msg = f"skipping {outfile!r} (inputs unchanged)" # Allow 'infiles' to be a single string if isinstance(infiles, str): @@ -542,7 +542,7 @@ def make_file( raise TypeError("'infiles' must be a string, or a list or tuple of strings") if exec_msg is None: - exec_msg = "generating {} from {}".format(outfile, ', '.join(infiles)) + exec_msg = f"generating {outfile!r} from {', '.join(infiles)!r}" # If 'outfile' must be regenerated (either because it doesn't # exist, is out-of-date, or the 'force' flag is true) then diff --git a/distutils/tests/test_cmd.py b/distutils/tests/test_cmd.py index 76e8f598..85056229 100644 --- a/distutils/tests/test_cmd.py +++ b/distutils/tests/test_cmd.py @@ -52,7 +52,7 @@ def test_make_file(self, cmd): # making sure execute gets called properly def _execute(func, args, exec_msg, level): - assert exec_msg == 'generating out from in' + assert exec_msg == "generating 'out' from 'in'" cmd.force = True cmd.execute = _execute diff --git a/mypy.ini b/mypy.ini index 5244a0e9..29d8e5d2 100644 --- a/mypy.ini +++ b/mypy.ini @@ -30,7 +30,6 @@ disable_error_code = index, func-returns-value, union-attr, - str-bytes-safe, misc, # stdlib's test module is not typed on typeshed