Ignore type of shlex.join

Mypy throws an error for any reference to a module member that doesn't
exist, even with a clear hasattr check like in this code.

https://github.com/python/mypy/issues/5059
This commit is contained in:
Paul O'Leary McCann 2022-09-02 14:42:57 +09:00
parent 5cfd601697
commit 0a0b9714c0

View File

@ -975,7 +975,7 @@ def run_command(
# As above, this will usually but not always be correct on Windows, but
# is only used for debugging purposes.
if hasattr(shlex, "join"):
cmd_str = shlex.join(command)
cmd_str = shlex.join(command) # type: ignore
else:
# shlex.join is more correct, but is only available in 3.8+
cmd_str = " ".join(command)