Skip to content

Commit 837f7e0

Browse files
authored
stubtest: correct type annotations in _Arguments (#16897)
Two fields in the `_Arguments` class, `mypy_config_file` and `custom_typeshed_dir`, can take on a None value, but they are not marked as such. Calling `stubtest.parse_options` on an empty list of arguments reproduces the situation where these two fields are None.
1 parent 996544f commit 837f7e0

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

mypy/stubtest.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1878,8 +1878,8 @@ class _Arguments:
18781878
allowlist: list[str]
18791879
generate_allowlist: bool
18801880
ignore_unused_allowlist: bool
1881-
mypy_config_file: str
1882-
custom_typeshed_dir: str
1881+
mypy_config_file: str | None
1882+
custom_typeshed_dir: str | None
18831883
check_typeshed: bool
18841884
version: str
18851885

@@ -1922,7 +1922,7 @@ def test_stubs(args: _Arguments, use_builtins_fixtures: bool = False) -> int:
19221922
options.incremental = False
19231923
options.custom_typeshed_dir = args.custom_typeshed_dir
19241924
if options.custom_typeshed_dir:
1925-
options.abs_custom_typeshed_dir = os.path.abspath(args.custom_typeshed_dir)
1925+
options.abs_custom_typeshed_dir = os.path.abspath(options.custom_typeshed_dir)
19261926
options.config_file = args.mypy_config_file
19271927
options.use_builtins_fixtures = use_builtins_fixtures
19281928

0 commit comments

Comments
 (0)