From f22869da20ecc3553fa76bb1a293b027b38e1918 Mon Sep 17 00:00:00 2001 From: samxif Date: Fri, 9 Feb 2024 16:46:43 -0500 Subject: [PATCH 1/3] Correct type annotations on two fields in _Arguments that are optional but are not marked as such --- mypy/stubtest.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mypy/stubtest.py b/mypy/stubtest.py index c2f82c98d089..2e372fd7f174 100644 --- a/mypy/stubtest.py +++ b/mypy/stubtest.py @@ -1878,8 +1878,8 @@ class _Arguments: allowlist: list[str] generate_allowlist: bool ignore_unused_allowlist: bool - mypy_config_file: str - custom_typeshed_dir: str + mypy_config_file: str | None + custom_typeshed_dir: str | None check_typeshed: bool version: str From 6f595032bcf5b464366b145c282a89062db76130 Mon Sep 17 00:00:00 2001 From: samxif Date: Fri, 9 Feb 2024 17:12:18 -0500 Subject: [PATCH 2/3] Change if condition to equivalent that resolves type checking error --- mypy/stubtest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mypy/stubtest.py b/mypy/stubtest.py index 2e372fd7f174..261a305f2f40 100644 --- a/mypy/stubtest.py +++ b/mypy/stubtest.py @@ -1921,7 +1921,7 @@ def test_stubs(args: _Arguments, use_builtins_fixtures: bool = False) -> int: options = Options() options.incremental = False options.custom_typeshed_dir = args.custom_typeshed_dir - if options.custom_typeshed_dir: + if args.custom_typeshed_dir: options.abs_custom_typeshed_dir = os.path.abspath(args.custom_typeshed_dir) options.config_file = args.mypy_config_file options.use_builtins_fixtures = use_builtins_fixtures From be346f4aee09024c00cf6e9c89bea2a0866ae29f Mon Sep 17 00:00:00 2001 From: samxif Date: Fri, 9 Feb 2024 17:21:30 -0500 Subject: [PATCH 3/3] Restore options.custom_typeshed_dir if condition and change argument to os.path.abspath --- mypy/stubtest.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mypy/stubtest.py b/mypy/stubtest.py index 261a305f2f40..dd43c472d67f 100644 --- a/mypy/stubtest.py +++ b/mypy/stubtest.py @@ -1921,8 +1921,8 @@ def test_stubs(args: _Arguments, use_builtins_fixtures: bool = False) -> int: options = Options() options.incremental = False options.custom_typeshed_dir = args.custom_typeshed_dir - if args.custom_typeshed_dir: - options.abs_custom_typeshed_dir = os.path.abspath(args.custom_typeshed_dir) + if options.custom_typeshed_dir: + options.abs_custom_typeshed_dir = os.path.abspath(options.custom_typeshed_dir) options.config_file = args.mypy_config_file options.use_builtins_fixtures = use_builtins_fixtures