-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Fix: Handle Trailing Commas and Empty Strings in File Paths #18728
base: master
Are you sure you want to change the base?
Conversation
- Modified `split_and_match_files_list` to handle trailing commas correctly. - Ensured empty string entries result in an error to match CLI behavior. - Updated unit tests to cover various edge cases. - Improved test coverage for config parsing with different file list formats.
for more information, see https://pre-commit.ci
Diff from mypy_primer, showing the effect of this PR on open source code: kornia (https://github.com/kornia/kornia)
+ Traceback (most recent call last):
+ File "/tmp/mypy_primer/new_mypy/venv/bin/mypy", line 10, in <module>
+ sys.exit(console_entry())
+ ~~~~~~~~~~~~~^^
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.13/site-packages/mypy/__main__.py", line 15, in console_entry
+ main()
+ ~~~~^^
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.13/site-packages/mypy/main.py", line 88, in main
+ sources, options = process_options(args, stdout=stdout, stderr=stderr, fscache=fscache)
+ ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.13/site-packages/mypy/main.py", line 1317, in process_options
+ parse_config_file(options, set_strict_flags, config_file, stdout, stderr)
+ ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.13/site-packages/mypy/config_parser.py", line 326, in parse_config_file
+ raw_files = section["files"].strip()
+ ^^^^^^^^^^^^^^^^^^^^^^
+ AttributeError: 'list' object has no attribute 'strip'
- kornia/grad_estimator/ste.py:63: error: Unused "type: ignore" comment [unused-ignore]
- kornia/core/mixin/image_module.py:201: error: Unused "type: ignore" comment [unused-ignore]
- kornia/core/module.py:203: error: Unused "type: ignore" comment [unused-ignore]
- kornia/core/mixin/onnx.py:133: error: Unused "type: ignore" comment [unused-ignore]
- kornia/core/mixin/onnx.py:134: error: Unused "type: ignore" comment [unused-ignore]
- kornia/core/mixin/onnx.py:135: error: Unused "type: ignore" comment [unused-ignore]
- kornia/feature/sold2/backbones.py:152: error: Unused "type: ignore" comment [unused-ignore]
- kornia/feature/sold2/backbones.py:154: error: Unused "type: ignore" comment [unused-ignore]
- kornia/feature/sold2/backbones.py:159: error: Unused "type: ignore" comment [unused-ignore]
- kornia/feature/sold2/backbones.py:160: error: Unused "type: ignore" comment [unused-ignore]
- kornia/feature/dedode/utils.py:41: error: Unused "type: ignore" comment [unused-ignore]
- kornia/feature/dedode/utils.py:42: error: Unused "type: ignore" comment [unused-ignore]
- kornia/enhance/histogram.py:234: error: Item "None" of "Any | None" has no attribute "device" [union-attr]
- kornia/enhance/histogram.py:234: error: Item "None" of "Any | None" has no attribute "dtype" [union-attr]
- kornia/enhance/histogram.py:237: error: Item "None" of "Any | None" has no attribute "unsqueeze" [union-attr]
- kornia/enhance/histogram.py:258: error: Item "None" of "Any | None" has no attribute "dim" [union-attr]
- kornia/enhance/histogram.py:261: error: Item "None" of "Any | None" has no attribute "dim" [union-attr]
- kornia/enhance/histogram.py:266: error: Item "None" of "Any | None" has no attribute "dim" [union-attr]
- kornia/enhance/histogram.py:268: error: Item "None" of "Any | None" has no attribute "dim" [union-attr]
- kornia/utils/draw.py:368: error: Invalid type 'Any' for *expr (iterable expected) [misc]
- kornia/utils/draw.py:368: error: Need more than 1 value to unpack (5 expected) [misc]
- kornia/utils/draw.py:371: error: Invalid type 'Any' for *expr (iterable expected) [misc]
- kornia/utils/draw.py:371: error: Need more than 2 values to unpack (5 expected) [misc]
- kornia/utils/draw.py:373: error: Cannot determine type of "b_i" [has-type]
- kornia/utils/draw.py:373: error: Cannot determine type of "c_i" [has-type]
- kornia/utils/draw.py:374: error: Invalid type 'Any' for *expr (iterable expected) [misc]
- kornia/utils/draw.py:374: error: Need more than 1 value to unpack (3 expected) [misc]
- kornia/utils/draw.py:375: error: Cannot determine type of "xy" [has-type]
- kornia/utils/draw.py:376: error: Cannot determine type of "b_i" [has-type]
- kornia/utils/draw.py:376: error: Cannot determine type of "b_p" [has-type]
- kornia/utils/draw.py:376: error: Cannot determine type of "b_c" [has-type]
- kornia/utils/draw.py:377: error: Cannot determine type of "device" [has-type]
- kornia/utils/draw.py:377: error: Cannot determine type of "device_p" [has-type]
- kornia/utils/draw.py:377: error: Cannot determine type of "device_c" [has-type]
- kornia/utils/draw.py:379: error: Cannot determine type of "h_i" [has-type]
- kornia/utils/draw.py:379: error: Cannot determine type of "w_i" [has-type]
- kornia/utils/draw.py:380: error: Cannot determine type of "w_i" [has-type]
- kornia/utils/draw.py:380: error: Cannot determine type of "device" [has-type]
- kornia/utils/draw.py:380: error: Cannot determine type of "dtype_p" [has-type]
- kornia/feature/dedode/encoder.py:31: error: Unused "type: ignore" comment [unused-ignore]
- kornia/feature/lightglue_onnx/lightglue.py:33: error: Unused "type: ignore" comment [unused-ignore]
- kornia/feature/lightglue_onnx/lightglue.py:69: error: Unused "type: ignore" comment [unused-ignore]
- kornia/feature/lightglue_onnx/lightglue.py:72: error: Item "str" of "str | Any" has no attribute "type" [union-attr]
- kornia/feature/lightglue_onnx/lightglue.py:74: error: Item "str" of "str | Any" has no attribute "type" [union-attr]
- kornia/feature/lightglue_onnx/lightglue.py:80: error: Item "str" of "str | Any" has no attribute "type" [union-attr]
- kornia/feature/lightglue_onnx/lightglue.py:84: error: Item "str" of "str | Any" has no attribute "type" [union-attr]
- kornia/feature/lightglue_onnx/lightglue.py:87: error: Item "str" of "str | Any" has no attribute "type" [union-attr]
- kornia/feature/lightglue_onnx/lightglue.py:138: error: Item "str" of "str | Any" has no attribute "type" [union-attr]
- kornia/feature/lightglue_onnx/lightglue.py:150: error: Unused "type: ignore" comment [unused-ignore]
- kornia/feature/lightglue_onnx/lightglue.py:151: error: Unused "type: ignore" comment [unused-ignore]
- kornia/feature/lightglue_onnx/lightglue.py:153: error: Unused "type: ignore" comment [unused-ignore]
- kornia/feature/lightglue_onnx/lightglue.py:154: error: Unused "type: ignore" comment [unused-ignore]
- kornia/feature/lightglue_onnx/lightglue.py:156: error: Unused "type: ignore" comment [unused-ignore]
- kornia/feature/lightglue_onnx/lightglue.py:157: error: Unused "type: ignore" comment [unused-ignore]
- kornia/feature/lightglue_onnx/lightglue.py:167: error: Item "str" of "str | Any" has no attribute "type" [union-attr]
- kornia/feature/lightglue_onnx/lightglue.py:175: error: Item "str" of "str | Any" has no attribute "type" [union-attr]
- kornia/contrib/models/rt_detr/model.py:255: error: Unused "type: ignore" comment [unused-ignore]
- kornia/models/detection/base.py:234: error: Unused "type: ignore" comment [unused-ignore]
- kornia/enhance/adjust.py:726: error: Item "float" of "float | Any" has no attribute "__iter__" (not iterable) [union-attr]
- kornia/geometry/liegroup/so3.py:176: error: Unused "type: ignore" comment [unused-ignore]
- kornia/feature/lightglue.py:148: error: Unused "type: ignore" comment [unused-ignore]
- kornia/feature/lightglue.py:157: error: Unused "type: ignore" comment [unused-ignore]
- kornia/feature/lightglue.py:432: error: Unused "type: ignore" comment [unused-ignore]
- kornia/feature/lightglue.py:492: error: Unused "type: ignore" comment [unused-ignore]
- kornia/feature/lightglue.py:535: error: Unused "type: ignore" comment [unused-ignore]
- kornia/feature/lightglue.py:536: error: Unused "type: ignore" comment [unused-ignore]
- kornia/feature/lightglue.py:613: error: Unused "type: ignore" comment [unused-ignore]
- kornia/feature/lightglue.py:621: error: Unused "type: ignore" comment [unused-ignore]
- kornia/models/depth_estimation/base.py:33: error: Unused "type: ignore" comment [unused-ignore]
- kornia/feature/loftr/loftr.py:208: error: Unused "type: ignore" comment [unused-ignore]
- kornia/augmentation/random_generator/base.py:111: error: Unused "type: ignore" comment [unused-ignore]
- kornia/augmentation/random_generator/base.py:117: error: Unused "type: ignore" comment [unused-ignore]
- kornia/augmentation/container/ops.py:141: error: Unused "type: ignore" comment [unused-ignore]
- kornia/augmentation/container/ops.py:496: error: Unused "type: ignore" comment [unused-ignore]
- kornia/augmentation/_2d/mix/transplantation.py:182: error: Item "Sequence[int]" of "Sequence[int] | Any" has no attribute "ndim" [union-attr]
- kornia/augmentation/_2d/mix/transplantation.py:183: error: Item "Sequence[int]" of "Sequence[int] | Any" has no attribute "ndim" [union-attr]
- kornia/augmentation/_2d/mix/transplantation.py:194: error: Unused "type: ignore" comment [unused-ignore]
- kornia/augmentation/_2d/mix/transplantation.py:200: error: Unused "type: ignore" comment [unused-ignore]
- kornia/augmentation/_2d/mix/transplantation.py:296: error: Unused "type: ignore" comment [unused-ignore]
- kornia/augmentation/container/video.py:265: error: Unused "type: ignore" comment [unused-ignore]
- kornia/augmentation/container/video.py:285: error: Unused "type: ignore" comment [unused-ignore]
- kornia/augmentation/container/video.py:305: error: Unused "type: ignore" comment [unused-ignore]
- kornia/augmentation/container/video.py:325: error: Unused "type: ignore" comment [unused-ignore]
- kornia/augmentation/container/augment.py:449: error: Unsupported right operand type for in ("list[DataKey] | None") [operator]
- kornia/augmentation/container/augment.py:450: error: Item "None" of "list[DataKey] | None" has no attribute "index" [union-attr]
- kornia/augmentation/container/augment.py:465: error: Unused "type: ignore" comment [unused-ignore]
- kornia/contrib/visual_prompter.py:357: error: Unused "type: ignore" comment [unused-ignore]
- kornia/contrib/visual_prompter.py:388: error: Unused "type: ignore" comment [unused-ignore]
- kornia/contrib/visual_prompter.py:397: error: Unused "type: ignore" comment [unused-ignore]
mitmproxy (https://github.com/mitmproxy/mitmproxy)
+ Traceback (most recent call last):
+ File "/tmp/mypy_primer/new_mypy/venv/bin/mypy", line 10, in <module>
+ sys.exit(console_entry())
+ ~~~~~~~~~~~~~^^
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.13/site-packages/mypy/__main__.py", line 15, in console_entry
+ main()
+ ~~~~^^
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.13/site-packages/mypy/main.py", line 88, in main
+ sources, options = process_options(args, stdout=stdout, stderr=stderr, fscache=fscache)
+ ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.13/site-packages/mypy/main.py", line 1317, in process_options
+ parse_config_file(options, set_strict_flags, config_file, stdout, stderr)
+ ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.13/site-packages/mypy/config_parser.py", line 326, in parse_config_file
+ raw_files = section["files"].strip()
+ ^^^^^^^^^^^^^^^^^^^^^^
+ AttributeError: 'list' object has no attribute 'strip'
- mitmproxy/io/tnetstring.py:217: error: Unused "type: ignore" comment [unused-ignore]
- mitmproxy/io/tnetstring.py:224: error: Unused "type: ignore" comment [unused-ignore]
- mitmproxy/coretypes/serializable.py:94: error: Unused "type: ignore" comment [unused-ignore]
- mitmproxy/coretypes/serializable.py:137: error: Unused "type: ignore" comment [unused-ignore]
- mitmproxy/coretypes/serializable.py:145: error: Unused "type: ignore" comment [unused-ignore]
- mitmproxy/coretypes/serializable.py:151: error: Unused "type: ignore" comment [unused-ignore]
- mitmproxy/coretypes/serializable.py:158: error: Unused "type: ignore" comment [unused-ignore]
- mitmproxy/coretypes/serializable.py:164: error: Unused "type: ignore" comment [unused-ignore]
- mitmproxy/coretypes/serializable.py:170: error: Unused "type: ignore" comment [unused-ignore]
- mitmproxy/coretypes/serializable.py:176: error: Unused "type: ignore" comment [unused-ignore]
- mitmproxy/coretypes/serializable.py:182: error: Unused "type: ignore" comment [unused-ignore]
- mitmproxy/coretypes/serializable.py:185: error: Unused "type: ignore" comment [unused-ignore]
- mitmproxy/utils/vt_codes.py:10: error: Unused "type: ignore" comment [unused-ignore]
- mitmproxy/net/encoding.py:122: error: Unused "type: ignore" comment [unused-ignore]
- mitmproxy/coretypes/multidict.py:153: error: Unused "type: ignore" comment [unused-ignore]
- mitmproxy/coretypes/multidict.py:167: error: Unused "type: ignore" comment [unused-ignore]
- mitmproxy/certs.py:16: error: Library stubs not installed for "OpenSSL" [import-untyped]
- mitmproxy/certs.py:85: error: Unused "type: ignore" comment [unused-ignore]
- mitmproxy/certs.py:112: error: Unused "type: ignore" comment [unused-ignore]
- mitmproxy/certs.py:120: error: Unused "type: ignore" comment [unused-ignore]
- mitmproxy/certs.py:212: error: Unused "type: ignore" comment [unused-ignore]
- mitmproxy/certs.py:250: error: Unused "type: ignore" comment [unused-ignore]
- mitmproxy/certs.py:340: error: Unused "type: ignore" comment [unused-ignore]
- mitmproxy/certs.py:412: error: Unused "type: ignore" comment [unused-ignore]
- mitmproxy/certs.py:415: error: Unused "type: ignore" comment [unused-ignore]
- mitmproxy/certs.py:416: error: Unused "type: ignore" comment [unused-ignore]
- mitmproxy/certs.py:417: error: Unused "type: ignore" comment [unused-ignore]
- mitmproxy/certs.py:419: error: Unused "type: ignore" comment [unused-ignore]
- mitmproxy/certs.py:420: error: Unused "type: ignore" comment [unused-ignore]
- mitmproxy/certs.py:421: error: Unused "type: ignore" comment [unused-ignore]
- mitmproxy/certs.py:423: error: Unused "type: ignore" comment [unused-ignore]
- mitmproxy/certs.py:499: error: Unused "type: ignore" comment [unused-ignore]
- mitmproxy/certs.py:518: error: Unused "type: ignore" comment [unused-ignore]
- mitmproxy/certs.py:643: error: Unused "type: ignore" comment [unused-ignore]
- mitmproxy/proxy/mode_specs.py:46: error: Unused "type: ignore" comment [unused-ignore]
- mitmproxy/connection.py:175: error: Unused "type: ignore" comment [unused-ignore]
- mitmproxy/connection.py:266: error: Unused "type: ignore" comment [unused-ignore]
- mitmproxy/net/tls.py:13: error: Library stubs not installed for "OpenSSL" [import-untyped]
- mitmproxy/net/tls.py:15: error: Library stubs not installed for "OpenSSL.crypto" [import-untyped]
- mitmproxy/net/tls.py:31: error: Unused "type: ignore" comment [unused-ignore]
- mitmproxy/net/tls.py:32: error: Unused "type: ignore" comment [unused-ignore]
- mitmproxy/net/tls.py:36: error: Unused "type: ignore" comment [unused-ignore]
- mitmproxy/net/tls.py:134: error: Unused "type: ignore" comment [unused-ignore]
- mitmproxy/net/tls.py:135: error: Unused "type: ignore" comment [unused-ignore]
- mitmproxy/net/tls.py:261: error: Unused "type: ignore" comment [unused-ignore]
- mitmproxy/net/tls.py:262: error: Unused "type: ignore" comment [unused-ignore]
- web/gen/web_columns.py:22: error: Item "None" of "Match[str] | None" has no attribute "group" [union-attr]
- mitmproxy/utils/asyncio_utils.py:96: error: Unused "type: ignore" comment [unused-ignore]
- mitmproxy/http.py:49: error: Unused "type: ignore" comment [unused-ignore]
- mitmproxy/http.py:740: error: Unused "type: ignore" comment [unused-ignore]
- mitmproxy/utils/debug.py:13: error: Library stubs not installed for "OpenSSL" [import-untyped]
- mitmproxy/utils/debug.py:72: error: "Thread" has no attribute "_thread_started" [attr-defined]
- mitmproxy/utils/emoji.py:1860: error: Library stubs not installed for "requests" [import-untyped]
- mitmproxy/utils/emoji.py:1860: note: Hint: "python3 -m pip install types-requests"
- examples/addons/http-modify-form.py:13: error: Unused "type: ignore" comment [unused-ignore]
- mitmproxy/types.py:128: error: Unused "type: ignore" comment [unused-ignore]
- mitmproxy/command.py:37: error: Unused "type: ignore" comment [unused-ignore]
- mitmproxy/tls.py:5: error: Library stubs not installed for "OpenSSL" [import-untyped]
- mitmproxy/addons/mapremote.py:68: error: Unused "type: ignore" comment [unused-ignore]
- mitmproxy/proxy/layers/quic/_client_hello_parser.py:85: error: Unused "type: ignore" comment [unused-ignore]
- mitmproxy/proxy/layers/quic/_client_hello_parser.py:87: error: Unused "type: ignore" comment [unused-ignore]
- mitmproxy/addons/core.py:139: error: Unused "type: ignore" comment [unused-ignore]
- mitmproxy/proxy/layers/quic/_raw_layers.py:47: error: Unused "type: ignore" comment [unused-ignore]
- mitmproxy/proxy/layers/tls.py:11: error: Library stubs not installed for "OpenSSL" [import-untyped]
- mitmproxy/proxy/layers/tls.py:243: error: Unused "type: ignore" comment [unused-ignore]
- mitmproxy/proxy/layers/tls.py:318: error: Unused "type: ignore" comment [unused-ignore]
- mitmproxy/proxy/layers/tls.py:319: error: Unused "type: ignore" comment [unused-ignore]
- mitmproxy/proxy/layers/tls.py:320: error: Unused "type: ignore" comment [unused-ignore]
- mitmproxy/proxy/layers/quic/_stream_layers.py:588: error: Unused "type: ignore" comment [unused-ignore]
- mitmproxy/proxy/layers/quic/_stream_layers.py:625: error: Unused "type: ignore" comment [unused-ignore]
- mitmproxy/proxy/layers/http/_http_h3.py:131: error: Unused "type: ignore" comment [unused-ignore]
- mitmproxy/proxy/server.py:23: error: Library stubs not installed for "OpenSSL" [import-untyped]
- mitmproxy/addons/tlsconfig.py:13: error: Library stubs not installed for "OpenSSL" [import-untyped]
- mitmproxy/addons/tlsconfig.py:13: note: Hint: "python3 -m pip install types-pyOpenSSL"
- mitmproxy/addons/tlsconfig.py:13: note: (or run "mypy --install-types" to install all missing stub packages)
- mitmproxy/addons/tlsconfig.py:13: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
- mitmproxy/addons/tlsconfig.py:80: error: Unused "type: ignore" comment [unused-ignore]
- mitmproxy/addons/tlsconfig.py:81: error: Unused "type: ignore" comment [unused-ignore]
- mitmproxy/addons/tlsconfig.py:352: error: Unused "type: ignore" comment [unused-ignore]
- mitmproxy/addons/tlsconfig.py:356: error: Unused "type: ignore" comment [unused-ignore]
- mitmproxy/addons/tlsconfig.py:363: error: Unused "type: ignore" comment [unused-ignore]
- mitmproxy/addons/tlsconfig.py:365: error: Unused "type: ignore" comment [unused-ignore]
- mitmproxy/addons/tlsconfig.py:366: error: Unused "type: ignore" comment [unused-ignore]
- mitmproxy/addons/tlsconfig.py:370: error: Unused "type: ignore" comment [unused-ignore]
- mitmproxy/addons/tlsconfig.py:371: error: Unused "type: ignore" comment [unused-ignore]
- mitmproxy/tools/web/app.py:809: error: Unused "type: ignore" comment [unused-ignore]
- mitmproxy/tools/console/master.py:234: error: Unused "type: ignore" comment [unused-ignore]
- mitmproxy/tools/console/keymap.py:197: error: Unused "type: ignore" comment [unused-ignore]
- mitmproxy/tools/console/consoleaddons.py:553: error: Unused "type: ignore" comment [unused-ignore]
- mitmproxy/tools/console/grideditor/base.py:168: error: Unused "type: ignore" comment [unused-ignore]
- mitmproxy/addons/dumper.py:326: error: Unused "type: ignore" comment [unused-ignore]
- web/gen/tflow_js.py:31: error: Item "None" of "Response | None" has no attribute "trailers" [union-attr]
- web/gen/state_js.py:23: error: Need type annotation for "si1" [var-annotated]
- web/gen/state_js.py:30: error: "ServerInstance[Any]" has no attribute "_servers" [attr-defined]
- web/gen/state_js.py:31: error: Need type annotation for "si2" [var-annotated]
- web/gen/state_js.py:33: error: Need type annotation for "si3" [var-annotated]
- web/gen/state_js.py:34: error: Need type annotation for "si4" [var-annotated]
- web/gen/state_js.py:35: error: "ServerInstance[Any]" has no attribute "_server" [attr-defined]
- web/gen/state_js.py:36: error: "ServerInstance[Any]" has no attribute "_server" [attr-defined]
pybind11 (https://github.com/pybind/pybind11)
- setup.py:17: error: Library stubs not installed for "setuptools.command.sdist" [import-untyped]
- setup.py:17: error: Library stubs not installed for "setuptools.command" [import-untyped]
- setup.py:17: error: Library stubs not installed for "setuptools" [import-untyped]
- setup.py:98: error: Class cannot subclass "sdist" (has type "Any") [misc]
- pybind11/setup_helpers.py:66: error: Library stubs not installed for "setuptools" [import-untyped]
- pybind11/setup_helpers.py:67: error: Library stubs not installed for "setuptools.command.build_ext" [import-untyped]
- pybind11/setup_helpers.py:67: note: Hint: "python3 -m pip install types-setuptools"
- pybind11/setup_helpers.py:67: note: (or run "mypy --install-types" to install all missing stub packages)
- pybind11/setup_helpers.py:67: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
- pybind11/setup_helpers.py:69: error: Unused "type: ignore" comment [unused-ignore]
- pybind11/setup_helpers.py:72: error: Unused "type: ignore" comment [unused-ignore]
- pybind11/setup_helpers.py:89: error: Class cannot subclass "_Extension" (has type "Any") [misc]
- pybind11/setup_helpers.py:271: error: Class cannot subclass "_build_ext" (has type "Any") [misc]
+ Traceback (most recent call last):
+ File "/tmp/mypy_primer/new_mypy/venv/bin/mypy", line 10, in <module>
+ sys.exit(console_entry())
+ ~~~~~~~~~~~~~^^
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.13/site-packages/mypy/__main__.py", line 15, in console_entry
+ main()
+ ~~~~^^
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.13/site-packages/mypy/main.py", line 88, in main
+ sources, options = process_options(args, stdout=stdout, stderr=stderr, fscache=fscache)
+ ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.13/site-packages/mypy/main.py", line 1317, in process_options
+ parse_config_file(options, set_strict_flags, config_file, stdout, stderr)
+ ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.13/site-packages/mypy/config_parser.py", line 326, in parse_config_file
+ raw_files = section["files"].strip()
+ ^^^^^^^^^^^^^^^^^^^^^^
+ AttributeError: 'list' object has no attribute 'strip'
werkzeug (https://github.com/pallets/werkzeug)
+ Traceback (most recent call last):
+ File "/tmp/mypy_primer/new_mypy/venv/bin/mypy", line 10, in <module>
+ sys.exit(console_entry())
+ ~~~~~~~~~~~~~^^
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.13/site-packages/mypy/__main__.py", line 15, in console_entry
+ main()
+ ~~~~^^
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.13/site-packages/mypy/main.py", line 88, in main
+ sources, options = process_options(args, stdout=stdout, stderr=stderr, fscache=fscache)
+ ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.13/site-packages/mypy/main.py", line 1317, in process_options
+ parse_config_file(options, set_strict_flags, config_file, stdout, stderr)
+ ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.13/site-packages/mypy/config_parser.py", line 326, in parse_config_file
+ raw_files = section["files"].strip()
+ ^^^^^^^^^^^^^^^^^^^^^^
+ AttributeError: 'list' object has no attribute 'strip'
- Warning: unused section(s) in pyproject.toml: module = ['xprocess.*']
- src/werkzeug/_reloader.py:327: error: Class cannot subclass "PatternMatchingEventHandler" (has type "Any") [misc]
- src/werkzeug/_reloader.py:341: error: Unused "type: ignore" comment [unused-ignore]
- src/werkzeug/sansio/response.py:137: error: Unused "type: ignore" comment [unused-ignore]
- src/werkzeug/sansio/response.py:149: error: Unused "type: ignore" comment [unused-ignore]
- src/werkzeug/debug/tbtools.py:261: error: Incompatible types in assignment (expression has type "Optional[TracebackException]", variable has type "TracebackException") [assignment]
- src/werkzeug/wrappers/response.py:700: error: Unused "type: ignore" comment [unused-ignore]
- src/werkzeug/test.py:329: error: Unused "type: ignore" comment [unused-ignore]
- src/werkzeug/debug/__init__.py:303: error: Incompatible types in assignment (expression has type "None", variable has type "str") [assignment]
- tests/test_internal.py:6: error: Function is missing a return type annotation [no-untyped-def]
- tests/test_internal.py:6: note: Use "-> None" if function does not return a value
- tests/middleware/test_shared_data.py:9: error: Function is missing a return type annotation [no-untyped-def]
- tests/middleware/test_shared_data.py:9: note: Use "-> None" if function does not return a value
- tests/middleware/test_shared_data.py:10: error: Argument 1 to "SharedDataMiddleware" has incompatible type "None"; expected "Callable[[dict[str, Any], StartResponse], Iterable[bytes]]" [arg-type]
- tests/middleware/test_shared_data.py:14: error: Function is missing a type annotation [no-untyped-def]
- tests/middleware/test_shared_data.py:15: error: Function is missing a type annotation [no-untyped-def]
- tests/middleware/test_shared_data.py:45: error: Value of type variable "_SupportsCloseT" of "closing" cannot be "Iterable[bytes]" [type-var]
- tests/middleware/test_shared_data.py:54: error: Value of type variable "_SupportsCloseT" of "closing" cannot be "Iterable[bytes]" [type-var]
- tests/middleware/test_profiler.py:7: error: Module "werkzeug.middleware.profiler" does not explicitly export attribute "Profile" [attr-defined]
- tests/middleware/test_profiler.py:12: error: Function is missing a type annotation [no-untyped-def]
- tests/middleware/test_profiler.py:17: error: Function is missing a return type annotation [no-untyped-def]
- tests/middleware/test_profiler.py:21: error: Function is missing a type annotation [no-untyped-def]
- tests/middleware/test_profiler.py:37: error: Argument "filename_format" to "ProfilerMiddleware" has incompatible type "Callable[[Any], Any]"; expected "str" [arg-type]
- tests/middleware/test_dispatcher.py:6: error: Function is missing a return type annotation [no-untyped-def]
- tests/middleware/test_dispatcher.py:6: note: Use "-> None" if function does not return a value
- tests/middleware/test_dispatcher.py:7: error: Function is missing a type annotation [no-untyped-def]
- tests/middleware/test_dispatcher.py:11: error: Function is missing a type annotation [no-untyped-def]
- tests/live_apps/streaming_app.py:6: error: Function is missing a type annotation [no-untyped-def]
- tests/live_apps/streaming_app.py:7: error: Function is missing a return type annotation [no-untyped-def]
- tests/live_apps/streaming_app.py:14: error: Call to untyped function "gen" in typed context [no-untyped-call]
- tests/live_apps/standard_app.py:8: error: Function is missing a type annotation [no-untyped-def]
- tests/live_apps/run.py:16: error: Function is missing a type annotation [no-untyped-def]
- tests/live_apps/run.py:35: error: Cannot assign to a method [method-assign]
- tests/live_apps/run.py:35: error: Incompatible types in assignment (expression has type "Callable[[Arg(WSGIRequestHandler, '_')], Any]", variable has type "Callable[[Arg(WSGIRequestHandler, 'self')], str]") [assignment]
- tests/live_apps/reloader_app.py:17: error: Function is missing a type annotation [no-untyped-def]
- tests/test_wsgi.py:60: error: Function is missing a type annotation [no-untyped-def]
- tests/test_wsgi.py:65: error: Function is missing a return type annotation [no-untyped-def]
- tests/test_wsgi.py:65: note: Use "-> None" if function does not return a value
- tests/test_wsgi.py:77: error: Function is missing a return type annotation [no-untyped-def]
- tests/test_wsgi.py:78: error: Function is missing a type annotation [no-untyped-def]
- tests/test_wsgi.py:87: error: Function is missing a return type annotation [no-untyped-def]
- tests/test_wsgi.py:87: note: Use "-> None" if function does not return a value
- tests/test_wsgi.py:92: error: Function is missing a return type annotation [no-untyped-def]
- tests/test_wsgi.py:92: note: Use "-> None" if function does not return a value
- tests/test_wsgi.py:94: error: Function is missing a return type annotation [no-untyped-def]
- tests/test_wsgi.py:94: note: Use "-> None" if function does not return a value
- tests/test_wsgi.py:114: error: Incompatible types in assignment (expression has type "LimitedStream", variable has type "RaisingLimitedStream") [assignment]
- tests/test_wsgi.py:119: error: Incompatible types in assignment (expression has type "LimitedStream", variable has type "RaisingLimitedStream") [assignment]
- tests/test_wsgi.py:123: error: Incompatible types in assignment (expression has type "LimitedStream", variable has type "RaisingLimitedStream") [assignment]
- tests/test_wsgi.py:128: error: Incompatible types in assignment (expression has type "LimitedStream", variable has type "RaisingLimitedStream") [assignment]
- tests/test_wsgi.py:132: error: Incompatible types in assignment (expression has type "LimitedStream", variable has type "RaisingLimitedStream") [assignment]
- tests/test_wsgi.py:136: error: Incompatible types in assignment (expression has type "LimitedStream", variable has type "RaisingLimitedStream") [assignment]
- tests/test_wsgi.py:143: error: Incompatible types in assignment (expression has type "LimitedStream", variable has type "RaisingLimitedStream") [assignment]
- tests/test_wsgi.py:147: error: Incompatible types in assignment (expression has type "LimitedStream", variable has type "RaisingLimitedStream") [assignment]
- tests/test_wsgi.py:150: error: Incompatible types in assignment (expression has type "LimitedStream", variable has type "RaisingLimitedStream") [assignment]
- tests/test_wsgi.py:154: error: Function is missing a return type annotation [no-untyped-def]
- tests/test_wsgi.py:154: note: Use "-> None" if function does not return a value
- tests/test_wsgi.py:158: error: Incompatible types in assignment (expression has type "TextIOWrapper[BufferedReader]", variable has type "LimitedStream") [assignment]
- tests/test_wsgi.py:163: error: Function is missing a return type annotation [no-untyped-def]
- tests/test_wsgi.py:163: note: Use "-> None" if function does not return a value
- tests/test_wsgi.py:178: error: Function is missing a return type annotation [no-untyped-def]
- tests/test_wsgi.py:197: error: Cannot instantiate abstract class "OneByteStream" with abstract attributes "__enter__", "__exit__", ... and "writelines" (15 methods suppressed) [abstract]
- tests/test_wsgi.py:207: error: Cannot instantiate abstract class "OneByteStream" with abstract attributes "__enter__", "__exit__", ... and "writelines" (15 methods suppressed) [abstract]
- tests/test_wsgi.py:214: error: Cannot instantiate abstract class "OneByteStream" with abstract attributes "__enter__", "__exit__", ... and "writelines" (15 methods suppressed) [abstract]
- tests/test_wsgi.py:217: error: Cannot instantiate abstract class "OneByteStream" with abstract attributes "__enter__", "__exit__", ... and "writelines" (15 methods suppressed) [abstract]
- tests/test_wsgi.py:221: error: Function is missing a return type annotation [no-untyped-def]
- tests/test_wsgi.py:221: note: Use "-> None" if function does not return a value
- tests/test_wsgi.py:244: error: Function is missing a return type annotation [no-untyped-def]
- tests/test_wsgi.py:244: note: Use "-> None" if function does not return a value
- tests/test_wsgi.py:250: error: Function is missing a return type annotation [no-untyped-def]
- tests/test_wsgi.py:250: note: Use "-> None" if function does not return a value
- tests/test_wsgi.py:259: error: Function is missing a return type annotation [no-untyped-def]
- tests/test_wsgi.py:259: note: Use "-> None" if function does not return a value
- tests/test_wsgi.py:261: error: Argument 1 to "_RangeWrapper" has incompatible type "Union[Iterable[str], Iterable[bytes]]"; expected "Union[Iterable[bytes], IO[bytes]]" [arg-type]
- tests/test_wsgi.py:265: error: Argument 1 to "_RangeWrapper" has incompatible type "Union[Iterable[str], Iterable[bytes]]"; expected "Union[Iterable[bytes], IO[bytes]]" [arg-type]
- tests/test_wsgi.py:270: error: Argument 1 to "_RangeWrapper" has incompatible type "Union[Iterable[str], Iterable[bytes]]"; expected "Union[Iterable[bytes], IO[bytes]]" [arg-type]
- tests/test_wsgi.py:274: error: Argument 1 to "_RangeWrapper" has incompatible type "Union[Iterable[str], Iterable[bytes]]"; expected "Union[Iterable[bytes], IO[bytes]]" [arg-type]
- tests/test_wsgi.py:280: error: Argument 1 to "_RangeWrapper" has incompatible type "Union[Iterable[str], Iterable[bytes]]"; expected "Union[Iterable[bytes], IO[bytes]]" [arg-type]
- tests/test_wsgi.py:288: error: Argument 1 to "_RangeWrapper" has incompatible type "Union[Iterable[str], Iterable[bytes]]"; expected "Union[Iterable[bytes], IO[bytes]]" [arg-type]
- tests/test_wsgi.py:297: error: Argument 1 to "_RangeWrapper" has incompatible type "Union[Iterable[str], Iterable[bytes]]"; expected "Union[Iterable[bytes], IO[bytes]]" [arg-type]
- tests/test_wsgi.py:305: error: Argument 1 to "_RangeWrapper" has incompatible type "Union[Iterable[str], Iterable[bytes]]"; expected "Union[Iterable[bytes], IO[bytes]]" [arg-type]
- tests/test_wsgi.py:311: error: Function is missing a return type annotation [no-untyped-def]
- tests/test_wsgi.py:317: error: Function is missing a type annotation [no-untyped-def]
- tests/test_wsgi.py:323: error: Function is missing a type annotation [no-untyped-def]
- tests/test_wsgi.py:327: error: Function is missing a return type annotation [no-untyped-def]
- tests/test_wsgi.py:327: note: Use "-> None" if function does not return a value
- tests/test_wsgi.py:330: error: Function is missing a return type annotation [no-untyped-def]
- tests/test_wsgi.py:330: note: Use "-> None" if function does not return a value
- tests/test_wsgi.py:333: error: Function is missing a type annotation [no-untyped-def]
- tests/test_wsgi.py:334: error: Call to untyped function "Response" in typed context [no-untyped-call]
- tests/test_wsgi.py:338: error: Argument 1 to "join" of "str" has incompatible type "Iterable[bytes]"; expected "Iterable[str]" [arg-type]
- tests/test_wrappers.py:39: error: Function is missing a type annotation [no-untyped-def]
- tests/test_wrappers.py:44: error: Function is missing a type annotation [no-untyped-def]
- tests/test_wrappers.py:53: error: Function is missing a return type annotation [no-untyped-def]
- tests/test_wrappers.py:53: note: Use "-> None" if function does not return a value
- tests/test_wrappers.py:62: error: Call to untyped function "assert_environ" in typed context [no-untyped-call]
- tests/test_wrappers.py:77: error: Call to untyped function "assert_environ" in typed context [no-untyped-call]
- tests/test_wrappers.py:89: error: Call to untyped function "assert_environ" in typed context [no-untyped-call]
- tests/test_wrappers.py:100: error: Function is missing a return type annotation [no-untyped-def]
- tests/test_wrappers.py:100: note: Use "-> None" if function does not return a value
- tests/test_wrappers.py:105: error: Function is missing a return type annotation [no-untyped-def]
- tests/test_wrappers.py:105: note: Use "-> None" if function does not return a value
- tests/test_wrappers.py:112: error: Function is missing a return type annotation [no-untyped-def]
- tests/test_wrappers.py:112: note: Use "-> None" if function does not return a value
- tests/test_wrappers.py:124: error: Function is missing a return type annotation [no-untyped-def]
- tests/test_wrappers.py:124: note: Use "-> None" if function does not return a value
- tests/test_wrappers.py:140: error: Function is missing a return type annotation [no-untyped-def]
- tests/test_wrappers.py:140: note: Use "-> None" if function does not return a value
- tests/test_wrappers.py:149: error: Function is missing a return type annotation [no-untyped-def]
- tests/test_wrappers.py:174: error: Function is missing a return type annotation [no-untyped-def]
- tests/test_wrappers.py:174: note: Use "-> None" if function does not return a value
- tests/test_wrappers.py:179: error: Item "None" of "Optional[Authorization]" has no attribute "type" [union-attr]
- tests/test_wrappers.py:180: error: Item "None" of "Optional[Authorization]" has no attribute "username" [union-attr]
- tests/test_wrappers.py:181: error: Item "None" of "Optional[Authorization]" has no attribute "password" [union-attr]
- tests/test_wrappers.py:184: error: Function is missing a return type annotation [no-untyped-def]
- tests/test_wrappers.py:184: note: Use "-> None" if function does not return a value
- tests/test_wrappers.py:189: error: Item "None" of "Optional[Authorization]" has no attribute "type" [union-attr]
- tests/test_wrappers.py:190: error: Item "None" of "Optional[Authorization]" has no attribute "username" [union-attr]
- tests/test_wrappers.py:191: error: Item "None" of "Optional[Authorization]" has no attribute "password" [union-attr]
- tests/test_wrappers.py:194: error: Function is missing a return type annotation [no-untyped-def]
- tests/test_wrappers.py:196: error: Function is missing a type annotation [no-untyped-def]
- tests/test_wrappers.py:200: error: Function is missing a type annotation [no-untyped-def]
- tests/test_wrappers.py:212: error: Function is missing a return type annotation [no-untyped-def]
- tests/test_wrappers.py:212: note: Use "-> None" if function does not return a value
- tests/test_wrappers.py:221: error: Non-overlapping equality check (left operand type: "HeaderSet", right operand type: "set[str]") [comparison-overlap]
- tests/test_wrappers.py:225: error: Function is missing a return type annotation [no-untyped-def]
- tests/test_wrappers.py:225: note: Use "-> None" if function does not return a value
- tests/test_wrappers.py:229: error: Incompatible types in assignment (expression has type "list[str]", variable has type "HeaderSet") [assignment]
- tests/test_wrappers.py:237: error: Function is missing a return type annotation [no-untyped-def]
- tests/test_wrappers.py:243: error: Argument 1 to "write" of "ResponseStream" has incompatible type "str"; expected "bytes" [arg-type]
- tests/test_wrappers.py:282: error: Function is missing a return type annotation [no-untyped-def]
- tests/test_wrappers.py:282: note: Use "-> None" if function does not return a value
- tests/test_wrappers.py:285: error: Function is missing a type annotation [no-untyped-def]
- tests/test_wrappers.py:288: error: Function is missing a return type annotation [no-untyped-def]
- tests/test_wrappers.py:288: note: Use "-> None" if function does not return a value
... (truncated 1293 lines) ...
typeshed-stats (https://github.com/AlexWaygood/typeshed-stats)
+ Traceback (most recent call last):
+ File "/tmp/mypy_primer/new_mypy/venv/bin/mypy", line 10, in <module>
+ sys.exit(console_entry())
+ ~~~~~~~~~~~~~^^
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.13/site-packages/mypy/__main__.py", line 15, in console_entry
+ main()
+ ~~~~^^
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.13/site-packages/mypy/main.py", line 88, in main
+ sources, options = process_options(args, stdout=stdout, stderr=stderr, fscache=fscache)
+ ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.13/site-packages/mypy/main.py", line 1317, in process_options
+ parse_config_file(options, set_strict_flags, config_file, stdout, stderr)
+ ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.13/site-packages/mypy/config_parser.py", line 326, in parse_config_file
+ raw_files = section["files"].strip()
+ ^^^^^^^^^^^^^^^^^^^^^^
+ AttributeError: 'list' object has no attribute 'strip'
- src/typeshed_stats/__init__.py:14: error: Cannot find implementation or library stub for module named "typeshed_stats._version" [import-not-found]
- src/typeshed_stats/__init__.py:14: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
- website_macros.py:17: error: Library stubs not installed for "markdown" [import-untyped]
- tests/test_serialize.py:7: error: Library stubs not installed for "markdown" [import-untyped]
- tests/test_serialize.py:9: error: Library stubs not installed for "bs4" [import-untyped]
- tests/test_serialize.py:9: note: Hint: "python3 -m pip install types-beautifulsoup4"
- tests/test_gather.py:23: error: Cannot find implementation or library stub for module named "pytest_mock" [import-not-found]
- tests/test_gather.py:24: error: Cannot find implementation or library stub for module named "pytest_subtests" [import-not-found]
- src/typeshed_stats/_cli.py:80: error: Cannot find implementation or library stub for module named "rich" [import-not-found]
- src/typeshed_stats/_cli.py:80: error: Name "pprint" already defined on line 78 [no-redef]
- src/typeshed_stats/_cli.py:105: error: Cannot find implementation or library stub for module named "rich_argparse" [import-not-found]
- src/typeshed_stats/_cli.py:107: error: Unused "type: ignore" comment [unused-ignore]
- src/typeshed_stats/_cli.py:115: error: Returning Any from function declared to return "type[HelpFormatter]" [no-any-return]
- tests/test__cli.py:16: error: Library stubs not installed for "markdown" [import-untyped]
- tests/test__cli.py:16: note: Hint: "python3 -m pip install types-Markdown"
- tests/test__cli.py:16: note: (or run "mypy --install-types" to install all missing stub packages)
- tests/test__cli.py:18: error: Cannot find implementation or library stub for module named "pytest_mock" [import-not-found]
- tests/test__cli.py:19: error: Cannot find implementation or library stub for module named "pytest_subtests" [import-not-found]
- tests/test__cli.py:447: error: Returning Any from function declared to return "MagicMock" [no-any-return]
- tests/test__cli.py:531: error: Cannot find implementation or library stub for module named "rich" [import-not-found]
pandas (https://github.com/pandas-dev/pandas)
+ Traceback (most recent call last):
+ File "/tmp/mypy_primer/new_mypy/venv/bin/mypy", line 10, in <module>
+ sys.exit(console_entry())
+ ~~~~~~~~~~~~~^^
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.13/site-packages/mypy/__main__.py", line 15, in console_entry
+ main()
+ ~~~~^^
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.13/site-packages/mypy/main.py", line 88, in main
+ sources, options = process_options(args, stdout=stdout, stderr=stderr, fscache=fscache)
+ ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.13/site-packages/mypy/main.py", line 1317, in process_options
+ parse_config_file(options, set_strict_flags, config_file, stdout, stderr)
+ ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.13/site-packages/mypy/config_parser.py", line 326, in parse_config_file
+ raw_files = section["files"].strip()
+ ^^^^^^^^^^^^^^^^^^^^^^
+ AttributeError: 'list' object has no attribute 'strip'
- pandas/core/arrays/arrow/_arrow_utils.py:47: error: Incompatible types in assignment (expression has type "ndarray[tuple[int, ...], dtype[Any]]", variable has type "ndarray[tuple[int], dtype[Any]]") [assignment]
- pandas/compat/numpy/__init__.py:39: error: Unused "type: ignore" comment [unused-ignore]
- pandas/compat/numpy/__init__.py:40: error: Unused "type: ignore" comment [unused-ignore]
- pandas/_libs/tslibs/dtypes.pyi:31: error: Detected enum "pandas._libs.tslibs.dtypes.FreqGroup" in a type stub with zero members. There is a chance this is due to a recent change in the semantics of enum membership. If so, use `member = value` to mark an enum member, instead of `member: type` [misc]
- pandas/_libs/tslibs/dtypes.pyi:31: note: See https://typing.readthedocs.io/en/latest/spec/enums.html#defining-members
- pandas/_libs/tslibs/dtypes.pyi:48: error: Detected enum "pandas._libs.tslibs.dtypes.Resolution" in a type stub with zero members. There is a chance this is due to a recent change in the semantics of enum membership. If so, use `member = value` to mark an enum member, instead of `member: type` [misc]
- pandas/_libs/tslibs/dtypes.pyi:48: note: See https://typing.readthedocs.io/en/latest/spec/enums.html#defining-members
- pandas/_libs/tslibs/dtypes.pyi:70: error: Detected enum "pandas._libs.tslibs.dtypes.NpyDatetimeUnit" in a type stub with zero members. There is a chance this is due to a recent change in the semantics of enum membership. If so, use `member = value` to mark an enum member, instead of `member: type` [misc]
- pandas/_libs/tslibs/dtypes.pyi:70: note: See https://typing.readthedocs.io/en/latest/spec/enums.html#defining-members
- pandas/io/formats/printing.py:264: error: Unused "type: ignore" comment [unused-ignore]
- pandas/core/_numba/executor.py:90: error: Incompatible redefinition (redefinition with type "Callable[[ndarray[Any, Any], ndarray[Any, Any], ndarray[Any, Any], int, VarArg(Any)], Any]", original type "Callable[[ndarray[Any, Any], ndarray[Any, Any], int, int, VarArg(Any)], Any]") [misc]
- pandas/io/common.py:956: error: Unused "type: ignore" comment [unused-ignore]
- pandas/core/util/hashing.py:347: error: Incompatible return value type (got "Any | ndarray[tuple[int, ...], dtype[signedinteger[Any]]]", expected "ndarray[tuple[int, ...], dtype[unsignedinteger[_64Bit]]]") [return-value]
- pandas/core/nanops.py:641: error: Incompatible return value type (got "ndarray[Any, Any] | float | NaTType", expected "float") [return-value]
- pandas/core/array_algos/quantile.py:105: error: Incompatible types in assignment (expression has type "ndarray[tuple[int, ...], dtype[Any]]", variable has type "ndarray[tuple[int, int], dtype[Any]]") [assignment]
- pandas/core/array_algos/quantile.py:199: error: Argument 2 to "_nanquantile_1d" has incompatible type "numpy.bool[builtins.bool]"; expected "ndarray[tuple[int, ...], dtype[numpy.bool[builtins.bool]]]" [arg-type]
- pandas/core/arrays/period.py:378: error: Unused "type: ignore" comment [unused-ignore]
- pandas/core/arrays/period.py:379: error: Cannot override writeable attribute with read-only property [override]
- pandas/_testing/_io.py:84: error: Unused "type: ignore" comment [unused-ignore]
- pandas/_testing/_io.py:85: error: Unused "type: ignore" comment [unused-ignore]
- pandas/_testing/_io.py:141: error: No overload variant of "ZipFile" matches argument types "Any", "str" [call-overload]
- pandas/_testing/_io.py:141: note: Possible overload variants:
- pandas/_testing/_io.py:141: note: def __init__(self, file: str | PathLike[str] | IO[bytes], mode: Literal['r', 'w', 'x', 'a'] = ..., compression: int = ..., allowZip64: bool = ..., compresslevel: int | None = ..., *, strict_timestamps: bool = ..., metadata_encoding: str | None = ...) -> ZipFile
- pandas/_testing/_io.py:141: note: def __init__(self, file: str | PathLike[str] | _ZipReadable, mode: Literal['r'] = ..., compression: int = ..., allowZip64: bool = ..., compresslevel: int | None = ..., *, strict_timestamps: bool = ..., metadata_encoding: str | None = ...) -> ZipFile
- pandas/_testing/_io.py:141: note: def __init__(self, file: str | PathLike[str] | _ZipWritable, mode: Literal['w', 'x'] = ..., compression: int = ..., allowZip64: bool = ..., compresslevel: int | None = ..., *, strict_timestamps: bool = ..., metadata_encoding: None = ...) -> ZipFile
- pandas/_testing/_io.py:141: note: def __init__(self, file: str | PathLike[str] | _ZipReadableTellable, mode: Literal['a'] = ..., compression: int = ..., allowZip64: bool = ..., compresslevel: int | None = ..., *, strict_timestamps: bool = ..., metadata_encoding: None = ...) -> ZipFile
- pandas/_testing/_io.py:141: error: No overload variant of "BZ2File" matches argument types "Any", "str" [call-overload]
- pandas/_testing/_io.py:141: note: def __init__(self, filename: _WritableFileobj, mode: Literal['w', 'wb', 'x', 'xb', 'a', 'ab'], *, compresslevel: int = ...) -> BZ2File
- pandas/_testing/_io.py:141: note: def __init__(self, filename: _ReadableFileobj, mode: Literal['', 'r', 'rb'] = ..., *, compresslevel: int = ...) -> BZ2File
- pandas/_testing/_io.py:141: note: def __init__(self, filename: str | bytes | PathLike[str] | PathLike[bytes], mode: Literal['', 'r', 'rb'] | Literal['w', 'wb', 'x', 'xb', 'a', 'ab'] = ..., *, compresslevel: int = ...) -> BZ2File
- pandas/_testing/_io.py:141: error: Argument "mode" to "TarFile" has incompatible type "str"; expected "Literal['r', 'a', 'w', 'x']" [arg-type]
- pandas/core/computation/expr.py:679: error: Unused "type: ignore" comment [unused-ignore]
- pandas/core/computation/expr.py:679: error: Item "Attribute" of "Attribute | Name" has no attribute "id" [union-attr]
- pandas/core/computation/expr.py:679: note: Error code "union-attr" not covered by "type: ignore" comment
- pandas/core/computation/expr.py:701: error: Unused "type: ignore" comment [unused-ignore]
- pandas/core/computation/expr.py:701: error: Item "Attribute" of "Attribute | Name" has no attribute "id" [union-attr]
... (truncated 734 lines) ...``` |
Hi @webknjaz, mind taking a look at this PR? Also, not sure what mypy_primer wants to say if that's good or bad :) |
@x612skm it's trying to run mypy from your pull request against some other open source projects. The fact that it tracebacks shows that you have a bug in your code. Look closer into that trace: File "/tmp/mypy_primer/new_mypy/venv/lib/python3.13/site-packages/mypy/config_parser.py", line 326, in parse_config_file
raw_files = section["files"].strip()
^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'list' object has no attribute 'strip' It's failing on the line you added — https://github.com/hauntsaninja/mypy_primer/blob/8cf0437/mypy_primer/projects.py#L830C23-L830C36 suggests that the command that's executed is |
@Prabhat-Thapa45 — if you still want to collaborate, this is the new PR. |
if "files" in section: | ||
raw_files = section["files"].strip() | ||
files_split = [file.strip() for file in raw_files.split(",")] | ||
|
||
# Remove trailing empty entry if present | ||
if files_split and files_split[-1] == "": | ||
files_split.pop() | ||
|
||
# Raise an error if there are any remaining empty strings | ||
if "" in files_split: | ||
raise ValueError( | ||
"Invalid config: Empty filenames are not allowed except for trailing commas." | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's best to move this out into a helper function so it's not nested so much.
if files_split and files_split[-1] == "": | ||
files_split.pop() | ||
|
||
# Raise an error if there are any remaining empty strings |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code comments mustn't repeat what's already communicated in code. Their purpose is to provide justification where needed.
class TestConfigParser(TestCase): | ||
def test_parse_config_file_with_single_file(self) -> None: | ||
"""A single file should be correctly parsed.""" | ||
with tempfile.TemporaryDirectory() as tmpdirname: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You shouldn't normally manage temporary dirs manually in pytest. It provides a built-in tmp_path
fixture. Use it instead.
def test_parse_config_file_with_single_file(self) -> None: | ||
"""A single file should be correctly parsed.""" | ||
with tempfile.TemporaryDirectory() as tmpdirname: | ||
config_path = os.path.join(tmpdirname, "test_config.ini") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of using old string-based APIs, use pathlib
. Although, in the context of pytest, tmp_path
is what you're looking for.
with open(config_path, "w") as f: | ||
f.write( | ||
""" | ||
[mypy] | ||
files = file1.py | ||
""" | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here. pathlib has Path.write_text()
which is a more straightforward API. It'll also remove the need to stick f
s into places where you don't know how to name variables.
|
||
parse_config_file(options, lambda: None, config_path, stdout=None, stderr=None) | ||
|
||
self.assertEqual(options.files, ["file1.py"]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unittest-style checks aren't really common in the world of pytest. Let's avoid javisms.
self.assertEqual(options.files, ["file1.py"]) | |
assert options.files == ["file1.py"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(unless it doesn't work here for some reason)
|
||
self.assertEqual(options.files, ["file1.py"]) | ||
|
||
def test_parse_config_file_with_no_spaces(self) -> None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like you're repeating the same logic multiple times with the same data. It's best to use @pytest.mark.parametrize
to collapse them into one test method. Although, it doesn't seem to be a common practice in this project. So check if it works.
If it doesn't, you can use the subTest()
context manager instead: https://docs.python.org/3/library/unittest.html#distinguishing-test-iterations-using-subtests.
files = file1.py, | ||
file2.py, | ||
file3.py |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd also add cases for
[mypy]
files = file1.py,
file2.py,
file3.py,
[mypy]
files =
file1.py,
file2.py,
file3.py,
[mypy]
files =
file1.py,
file2.py,
file3.py
if __name__ == "__main__": | ||
main() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do any other tests do this?
from mypy.options import Options | ||
|
||
|
||
class TestConfigParser(TestCase): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
try composing a docstring here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a docstring here could also be useful
if not path: | ||
continue |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this necessary, provided that the input validation would take care of violations and normalize the paths?
NOTE: This replaces PR #18472, as it was closed due to a push issue.
Fixes #11171