Skip to content

mypy: Fix all str-bytes-safe #365

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions distutils/cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion distutils/tests/test_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 6 additions & 5 deletions mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,21 @@ 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.*]
Expand Down
Loading