Check python/uv/ folder with mypy (#7891)

It used to report:

```
» mypy 
python/uv/_build_backend.py:40: error: Incompatible types in assignment (expression has type "list[str]", variable has type "CompletedProcess[bytes]")  [assignment]
python/uv/_build_backend.py:41: error: Value of type "CompletedProcess[bytes]" is not indexable  [index]
python/uv/_build_backend.py:46: error: Value of type "CompletedProcess[bytes]" is not indexable  [index]
Found 3 errors in 1 file (checked 6 source files)
```

So, I had to fix this problem by renaming the `result` var.
This commit is contained in:
sobolevn 2024-10-03 15:05:01 +03:00 committed by GitHub
parent c07cdc6161
commit d5c5a29490
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 5 deletions

View file

@ -37,13 +37,13 @@ def call(args: "list[str]", config_settings: "dict | None" = None) -> str:
if result.returncode != 0:
sys.exit(result.returncode)
# If there was extra stdout, forward it (there should not be extra stdout)
result = result.stdout.decode("utf-8").strip().splitlines(keepends=True)
sys.stdout.writelines(result[:-1])
stdout = result.stdout.decode("utf-8").strip().splitlines(keepends=True)
sys.stdout.writelines(stdout[:-1])
# Fail explicitly instead of an irrelevant stacktrace
if not result:
if not stdout:
print("uv subprocess did not return a filename on stdout", file=sys.stderr)
sys.exit(1)
return result[-1].strip()
return stdout[-1].strip()
def build_sdist(sdist_directory: str, config_settings: "dict | None" = None):