Implement support for "mypy: ignore" comments
Fixes #12358
[needs tests. also, I think I can fix it to make it almost "the right way"]
Appendix A: the original text of this pr, before I radically improved it.
This change implements, #12358, `# mypy: ignore` comments that are analogous to `# type: ignore` comments, but specific only to mypy (or, one supposes, any other program that decides to honor them. While I was investigating this issue, it occurred to me that the only thing we need to do is make `# mypy: ignore` comments _appear_ to mypy as `# type: ignore` comments. And so, this PR implements that in what I think everyone will agree is "the wrong way", by **simply doing a re.sub on source code** before it is passed to the ast-parser. Because mypy is a typechecker, and therefore operates on the types of python programs instead of their values, it should almost never make a difference that we are making this change in the code in a textual way.Let us briefly review why this might be a good idea:
- Currently, mypy uses
ast.parseto get the syntax tree of the python program it is analyzing.ast.parseis just a helper function wrapper over the python built-incompile. This means we unfortunately cannot(?) monkey-patch the desired behavior into our parser, which was my first instinct. It also means we can't just copy and modify the parser to suit our needs (or, we would have to use C FFI, or something, to do this, which would be inconvenient), which was my second instinct. So, if mypy wants to continue using ast.parse as its ast-parser, the "right way" to do this is for ast.parse to also tell us about other comments or directives, such as proposed in https://github.com/python/cpython/issues/101494. I think this is a great idea and should be done. However, even it if was done immediately, it would only get into CPython for 3.13, which I think means we would need to wait until 3.13 was the minimum supported version of mypy for us to use this strategy. Which might be in the year 2028? There must be a better way! - Alternatively, we could:
- Just parse the ast using a different parser, one which also gives us comments or the right comments. This is conceptually simple, and probably even doable, but is probably a lot of work.
- Parse and apply the
# mypy: ignorecomments ourselves, in another pass orthogonal to the ast-parsing. For instance,util.get_mypy_commentsdoes something like this (although that problem is easier because you can count on those comments being at the start of the line). Possibly using Python's tokenize. This is a more-realistic "right way" option.- You could also do this parsing just to make sure that the find-and-replace on
# mypy: ignorefrom our original strategy is really in a comment, and then enact a compromise of the two strategies.
- You could also do this parsing just to make sure that the find-and-replace on
Some of those alternatives are not ridiculous. But I already have this feature done this way. Actually now that I'm typing this I'm thinking, you know, I should just also do the tokenize thing. Oh, wait, ok, that's actually hard again because the only thing separating a #mypy: ignore from #mypy: ignore_errors is its position at the start of the line. Oh, wait, actually, you can use a (?![-_]), good.
As it stands, this pr
Breaks:
Literals of strings that would be matched by the regex .*#\s*mypy:\s*ignore.*
For instance, now this does not raise a type error, as it should:
from typing import Literal
literal_boy: Literal["# mypy: ignore"] = "# type: ignore" # My one weakness...
it's quite possible none of these have ever been used in the history of python.
(Incidentally, about that regex: I have discovered that there is no arbitrary whitespace allowed between the type and the : in type-ignore comments. So, neither is there in mypy-ignore comments.)
Does not break: --pretty output. That's handled by another system, so the source code is not changed in that output. Which will make the problem with Literals more of a problem if it ever comes up, come to think of it.
Other downside: presumably a slight penalty hit, since we're doing another scan over each file. This is not a huge concern, I think, given that, eg, I discovered that util.get_mypy_comments does multiple passes even though it isn't strictly necessary.
Diff from mypy_primer, showing the effect of this PR on open source code:
sockeye (https://github.com/awslabs/sockeye)
+ sockeye/layers.py:642: error: Unused "type: ignore" comment [unused-ignore]
@github-actions
https://github.com/awslabs/sockeye/blob/e42fbb30be9bca1f5073f092b687966636370092/sockeye/layers.py#L642
projected_memory_kv: Optional[pt.Tensor] = None) -> pt.Tensor: # mypy: ignore
Incredible... looks like this PR already has a consumer :)
The demand of the people for this feature is overwhelming.
OK... more like "1" than "overwhelming"... but anyway....
Note to self: go PR to remove that line over there after this PR, if they don't notice it themselves...
Diff from mypy_primer, showing the effect of this PR on open source code:
sockeye (https://github.com/awslabs/sockeye)
+ sockeye/layers.py:642: error: Unused "type: ignore" comment [unused-ignore]
Diff from mypy_primer, showing the effect of this PR on open source code:
setuptools (https://github.com/pypa/setuptools): 15.65x faster (34.2s -> 2.2s in a single noisy sample)
+ setuptools/warnings.py:19: error: f-string: single '}' is not allowed [syntax]
- setuptools/_itertools.py:1: error: Cannot find implementation or library stub for module named "more_itertools" [import-not-found]
- setuptools/_path.py:12: error: Cannot find implementation or library stub for module named "more_itertools" [import-not-found]
- setuptools/tests/environment.py:7: error: Cannot find implementation or library stub for module named "jaraco" [import-not-found]
- setuptools/msvc.py:18: error: Cannot find implementation or library stub for module named "more_itertools" [import-not-found]
- setuptools/msvc.py:1421: error: Argument 1 to "filter" has incompatible type "Callable[[int | str | bytes | PathLike[str] | PathLike[bytes]], bool]"; expected "Callable[[str], TypeGuard[str | None]]" [arg-type]
- setuptools/_entry_points.py:5: error: Cannot find implementation or library stub for module named "jaraco.functools" [import-not-found]
- setuptools/_entry_points.py:7: error: Cannot find implementation or library stub for module named "more_itertools" [import-not-found]
- pkg_resources/__init__.py:96: error: Cannot find implementation or library stub for module named "platformdirs" [import-not-found]
- pkg_resources/__init__.py:2651: error: Value of type variable "AnyStr" of "abspath" cannot be "Sequence[object]" [type-var]
- setuptools/_reqs.py:6: error: Cannot find implementation or library stub for module named "jaraco" [import-not-found]
- setuptools/tests/test_glob.py:2: error: Cannot find implementation or library stub for module named "jaraco" [import-not-found]
- setuptools/tests/test_build_meta.py:15: error: Cannot find implementation or library stub for module named "jaraco" [import-not-found]
- setuptools/config/expand.py:120: error: Cannot find implementation or library stub for module named "more_itertools" [import-not-found]
- setuptools/config/setupcfg.py:303: error: "Callable[[str, Any], None] | Any" not callable [misc]
- setuptools/config/pyprojecttoml.py:285: error: Cannot find implementation or library stub for module named "more_itertools" [import-not-found]
- setuptools/dist.py:13: error: Cannot find implementation or library stub for module named "more_itertools" [import-not-found]
- setuptools/package_index.py:23: error: Cannot find implementation or library stub for module named "more_itertools" [import-not-found]
- setuptools/build_meta.py:422: error: List item 1 has incompatible type "str | PathLike[str]"; expected "str" [list-item]
- setuptools/tests/test_wheel.py:18: error: Cannot find implementation or library stub for module named "jaraco" [import-not-found]
- setuptools/tests/test_sdist.py:16: error: Cannot find implementation or library stub for module named "jaraco" [import-not-found]
- setuptools/tests/test_egg_info.py:14: error: Cannot find implementation or library stub for module named "jaraco" [import-not-found]
- setuptools/tests/test_build_py.py:8: error: Cannot find implementation or library stub for module named "jaraco" [import-not-found]
- setuptools/tests/test_bdist_wheel.py:17: error: Cannot find implementation or library stub for module named "jaraco" [import-not-found]
- setuptools/tests/fixtures.py:7: error: Cannot find implementation or library stub for module named "path" [import-not-found]
- setuptools/tests/config/test_pyprojecttoml_dynamic_deps.py:4: error: Cannot find implementation or library stub for module named "jaraco" [import-not-found]
- setuptools/tests/config/test_pyprojecttoml.py:5: error: Cannot find implementation or library stub for module named "jaraco" [import-not-found]
- setuptools/tests/config/test_pyprojecttoml.py:8: error: Cannot find implementation or library stub for module named "path" [import-not-found]
- setuptools/command/build_py.py:13: error: Cannot find implementation or library stub for module named "more_itertools" [import-not-found]
- setuptools/command/build_py.py:13: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
- setuptools/tests/test_config_discovery.py:7: error: Cannot find implementation or library stub for module named "jaraco" [import-not-found]
- setuptools/tests/test_config_discovery.py:9: error: Cannot find implementation or library stub for module named "path" [import-not-found]
- setuptools/tests/test_build_ext.py:6: error: Cannot find implementation or library stub for module named "jaraco" [import-not-found]
- setuptools/tests/test_build_ext.py:186: error: Unused "type: ignore" comment [unused-ignore]
- setuptools/tests/test_easy_install.py:23: error: Cannot find implementation or library stub for module named "jaraco" [import-not-found]
- setuptools/tests/test_editable_install.py:14: error: Cannot find implementation or library stub for module named "jaraco" [import-not-found]
- setuptools/tests/test_editable_install.py:17: error: Cannot find implementation or library stub for module named "path" [import-not-found]
altair (https://github.com/vega/altair): 8.74x faster (116.2s -> 13.3s in a single noisy sample)
- tests/vegalite/v5/test_theme.py:984: error: Redundant cast to "str" [redundant-cast]
- tests/vegalite/v5/test_renderers.py:20: error: Unused "type: ignore" comment [unused-ignore]
+ /tmp/mypy_primer/projects/_altair_venv/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:1095: error: f-string: single '}' is not allowed [syntax]
- tools/schemapi/utils.py:30: error: Cannot find implementation or library stub for module named "mistune" [import-not-found]
- tools/schemapi/utils.py:31: error: Cannot find implementation or library stub for module named "mistune.renderers.rst" [import-not-found]
stone (https://github.com/dropbox/stone)
- stone/ir/data_types.py:1653: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
+ stone/ir/data_types.py:1650: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
- stone/backends/python_rsrc/stone_serializers.py:324: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
+ stone/backends/python_rsrc/stone_serializers.py:323: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
- stone/backends/python_rsrc/stone_serializers.py:420: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
+ stone/backends/python_rsrc/stone_serializers.py:414: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
psycopg (https://github.com/psycopg/psycopg): 6.74x faster (56.0s -> 8.3s in a single noisy sample)
- tests/dbapi20_tpc.py:36: error: "TwoPhaseCommitTests" has no attribute "assertEquals" [attr-defined]
- tests/dbapi20_tpc.py:37: error: "TwoPhaseCommitTests" has no attribute "assertEquals" [attr-defined]
- tests/dbapi20_tpc.py:38: error: "TwoPhaseCommitTests" has no attribute "assertEquals" [attr-defined]
- tests/dbapi20_tpc.py:42: error: "TwoPhaseCommitTests" has no attribute "assertEquals" [attr-defined]
- tests/dbapi20_tpc.py:44: error: "TwoPhaseCommitTests" has no attribute "assertEquals" [attr-defined]
- tests/dbapi20.py:175: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:184: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:194: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:195: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:197: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:197: note: Error code "attr-defined" not covered by "type: ignore" comment
- tests/dbapi20.py:198: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:198: note: Error code "attr-defined" not covered by "type: ignore" comment
- tests/dbapi20.py:200: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:203: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:206: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:209: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:212: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:215: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:218: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:231: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:232: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:233: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:234: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:235: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:236: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:237: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:238: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:239: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:333: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:338: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:403: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:432: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:484: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:519: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:539: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:595: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:608: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:613: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:630: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:639: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:663: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:679: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:684: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:706: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:780: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:849: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:854: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:859: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:864: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:869: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- psycopg/psycopg/waiting.py:67: error: Incompatible types in assignment (expression has type "Any | None", variable has type "RV") [assignment]
- psycopg/psycopg/waiting.py:102: error: Incompatible types in assignment (expression has type "Any | None", variable has type "RV") [assignment]
- psycopg/psycopg/waiting.py:163: error: Incompatible types in assignment (expression has type "Any | None", variable has type "RV") [assignment]
- psycopg/psycopg/waiting.py:221: error: Incompatible types in assignment (expression has type "Any | None", variable has type "RV") [assignment]
- psycopg/psycopg/waiting.py:258: error: Incompatible types in assignment (expression has type "Any | None", variable has type "RV") [assignment]
- psycopg/psycopg/waiting.py:314: error: Incompatible types in assignment (expression has type "Any | None", variable has type "RV") [assignment]
- psycopg/psycopg/waiting.py:362: error: Incompatible types in assignment (expression has type "Any | None", variable has type "RV") [assignment]
- tests/test_psycopg_dbapi20.py:45: error: "type[PsycopgTests]" has no attribute "failUnless" [attr-defined]
- tests/test_psycopg_dbapi20.py:46: error: "type[PsycopgTPCTests]" has no attribute "assertEquals" [attr-defined]
+ /tmp/mypy_primer/projects/_psycopg_venv/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:1095: error: f-string: single '}' is not allowed [syntax]
downforeveryone (https://github.com/rpdelaney/downforeveryone): 5.64x faster (20.8s -> 3.7s in a single noisy sample)
+ /tmp/mypy_primer/projects/_downforeveryone_venv/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:1095:48: error: f-string: single '}' is not allowed [syntax]
arviz (https://github.com/arviz-devs/arviz): 4.64x faster (60.0s -> 12.9s in a single noisy sample)
- arviz/rcparams.py:337: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
- arviz/stats/ecdf_utils.py:324: error: Incompatible return value type (got "floating[Any]", expected "float") [return-value]
- arviz/wrappers/wrap_stan.py:107: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
- arviz/plots/tsplot.py:288: error: Unused "type: ignore" comment [unused-ignore]
- arviz/plots/tsplot.py:289: error: Unused "type: ignore" comment [unused-ignore]
- arviz/plots/tsplot.py:323: error: Unused "type: ignore" comment [unused-ignore]
- arviz/plots/tsplot.py:326: error: Unused "type: ignore" comment [unused-ignore]
- arviz/plots/tsplot.py:354: error: Unused "type: ignore" comment [unused-ignore]
- arviz/plots/tsplot.py:357: error: Unused "type: ignore" comment [unused-ignore]
- arviz/plots/tsplot.py:399: error: Unused "type: ignore" comment [unused-ignore]
- arviz/plots/tsplot.py:402: error: Unused "type: ignore" comment [unused-ignore]
- arviz/plots/tsplot.py:405: error: Unused "type: ignore" comment [unused-ignore]
- arviz/data/inference_data.py:418: error: Need type annotation for "group_kws" (hint: "group_kws: dict[<type>, <type>] = ...") [var-annotated]
- arviz/data/inference_data.py:494: error: No overload variant of "to_netcdf" of "Dataset" matches argument types "str", "str", "str", "str" [call-overload]
- arviz/data/inference_data.py:494: note: Possible overload variants:
- arviz/data/inference_data.py:494: note: def to_netcdf(self, path: None = ..., mode: Literal['w', 'a'] = ..., format: Literal['NETCDF4', 'NETCDF4_CLASSIC', 'NETCDF3_64BIT', 'NETCDF3_CLASSIC'] | None = ..., group: str | None = ..., engine: Literal['netcdf4', 'scipy', 'h5netcdf'] | None = ..., encoding: Mapping[Any, Mapping[str, Any]] | None = ..., unlimited_dims: Iterable[Hashable] | None = ..., compute: bool = ..., invalid_netcdf: bool = ...) -> bytes
- arviz/data/inference_data.py:494: note: def to_netcdf(self, path: str | PathLike[Any], mode: Literal['w', 'a'] = ..., format: Literal['NETCDF4', 'NETCDF4_CLASSIC', 'NETCDF3_64BIT', 'NETCDF3_CLASSIC'] | None = ..., group: str | None = ..., engine: Literal['netcdf4', 'scipy', 'h5netcdf'] | None = ..., encoding: Mapping[Any, Mapping[str, Any]] | None = ..., unlimited_dims: Iterable[Hashable] | None = ..., *, compute: Literal[False], invalid_netcdf: bool = ...) -> Any
- arviz/data/inference_data.py:494: note: def to_netcdf(self, path: str | PathLike[Any], mode: Literal['w', 'a'] = ..., format: Literal['NETCDF4', 'NETCDF4_CLASSIC', 'NETCDF3_64BIT', 'NETCDF3_CLASSIC'] | None = ..., group: str | None = ..., engine: Literal['netcdf4', 'scipy', 'h5netcdf'] | None = ..., encoding: Mapping[Any, Mapping[str, Any]] | None = ..., unlimited_dims: Iterable[Hashable] | None = ..., compute: Literal[True] = ..., invalid_netcdf: bool = ...) -> None
- arviz/data/inference_data.py:494: note: def to_netcdf(self, path: str | PathLike[Any], mode: Literal['w', 'a'] = ..., format: Literal['NETCDF4', 'NETCDF4_CLASSIC', 'NETCDF3_64BIT', 'NETCDF3_CLASSIC'] | None = ..., group: str | None = ..., engine: Literal['netcdf4', 'scipy', 'h5netcdf'] | None = ..., encoding: Mapping[Any, Mapping[str, Any]] | None = ..., unlimited_dims: Iterable[Hashable] | None = ..., compute: bool = ..., invalid_netcdf: bool = ...) -> Any | None
- arviz/data/inference_data.py:509: error: Incompatible types in assignment (expression has type "dict[Any, dict[str, bool]]", target has type "str") [assignment]
- arviz/data/inference_data.py:1704: error: Unused "type: ignore" comment [unused-ignore]
- arviz/data/inference_data.py:1705: error: Unused "type: ignore" comment [unused-ignore]
- arviz/data/inference_data.py:1706: error: Unused "type: ignore" comment [unused-ignore]
- arviz/data/inference_data.py:1707: error: Unused "type: ignore" comment [unused-ignore]
- arviz/data/inference_data.py:1708: error: Unused "type: ignore" comment [unused-ignore]
- arviz/data/inference_data.py:1709: error: Unused "type: ignore" comment [unused-ignore]
- doc/sphinxext/gallery_generator.py:120: error: Need type annotation for "categorized_contents" [var-annotated]
- arviz/plots/backends/matplotlib/posteriorplot.py:265: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
- arviz/plots/backends/bokeh/posteriorplot.py:244: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
- arviz/data/example_data/code/radon/radon.py:49: error: Module has no attribute "from_pymc3" [attr-defined]
- arviz/tests/base_tests/test_utils.py:251: error: Function "_stack" could always be true in boolean context [truthy-function]
- arviz/tests/base_tests/test_data_zarr.py:29: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
- arviz/tests/base_tests/test_data.py:1535: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
+ /tmp/mypy_primer/projects/_arviz_venv/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:1095: error: f-string: single '}' is not allowed [syntax]
pandas (https://github.com/pandas-dev/pandas): 9.98x faster (495.5s -> 49.7s in a single noisy sample)
+ /tmp/mypy_primer/projects/_pandas_venv/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:1095: error: f-string: single '}' is not allowed [syntax]
- 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/io/formats/printing.py:262: error: Unused "type: ignore" comment [unused-ignore]
- pandas/core/dtypes/dtypes.py:2129: error: Argument 1 to "np_find_common_type" has incompatible type "*Generator[Any | dtype[Any] | ExtensionDtype, None, None]"; expected "dtype[Any]" [arg-type]
- pandas/io/common.py:915: error: Value of type variable "_BufferT_co" of "TextIOWrapper" cannot be "_IOWrapper | BaseBuffer" [type-var]
- pandas/io/common.py:916: error: Unused "type: ignore" comment [unused-ignore]
- pandas/core/nanops.py:828: error: Incompatible types in assignment (expression has type "Any | float", variable has type "ndarray[Any, dtype[Any]]") [assignment]
- pandas/core/computation/ops.py:80: error: Unused "type: ignore" comment [unused-ignore]
- pandas/core/missing.py:422: error: Unused "type: ignore" comment [unused-ignore]
- pandas/core/missing.py:422: error: No overload variant of "apply_along_axis" matches argument types "Callable[[ndarray[Any, Any]], None]", "int", "ndarray[Any, Any]" [call-overload]
- pandas/core/missing.py:422: note: Error code "call-overload" not covered by "type: ignore" comment
- pandas/core/missing.py:422: note: Possible overload variants:
- pandas/core/missing.py:422: note: def [_P`-1, _SCT: generic] apply_along_axis(func1d: Callable[[ndarray[Any, dtype[Any]], **_P], _SupportsArray[dtype[_SCT]] | _NestedSequence[_SupportsArray[dtype[_SCT]]]], axis: SupportsIndex, arr: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes], *args: _P.args, **kwargs: _P.kwargs) -> ndarray[Any, dtype[_SCT]]
- pandas/core/missing.py:422: note: def [_P`-1] apply_along_axis(func1d: Callable[[ndarray[Any, dtype[Any]], **_P], _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes]], axis: SupportsIndex, arr: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes], *args: _P.args, **kwargs: _P.kwargs) -> ndarray[Any, dtype[Any]]
- pandas/core/common.py:249: error: Module has no attribute "VisibleDeprecationWarning" [attr-defined]
- pandas/core/arrays/boolean.py:372: error: Signature of "_logical_method" incompatible with supertype "BaseMaskedArray" [override]
- pandas/core/arrays/boolean.py:372: note: Superclass:
- pandas/core/arrays/boolean.py:372: note: def _arith_method(self: BaseMaskedArray, other: Any, op: Any) -> Any
- pandas/core/arrays/boolean.py:372: note: Subclass:
- pandas/core/arrays/boolean.py:372: note: def _logical_method(self, other: Any, op: Any) -> Any
- pandas/core/arrays/boolean.py:372: note: Superclass:
- pandas/core/arrays/boolean.py:372: note: def _arith_method(self: BaseMaskedArray, other: Any, op: Any) -> Any
- pandas/core/arrays/boolean.py:372: note: Subclass:
- pandas/core/arrays/boolean.py:372: note: def _logical_method(self, other: Any, op: Any) -> Any
- pandas/core/arrays/arrow/array.py:2430: error: Argument 1 to "normalize" has incompatible type "str"; expected "Literal['NFC', 'NFD', 'NFKC', 'NFKD']" [arg-type]
- pandas/plotting/_core.py:1041: error: Argument 1 to "len" has incompatible type "Any | bool"; expected "Sized" [arg-type]
- pandas/core/series.py:817: error: Unused "type: ignore" comment, use narrower [prop-decorator] instead of [misc] code [unused-ignore]
- pandas/core/indexing.py:918: error: Item "_LocationIndexer" of "_LocationIndexer | Any" has no attribute "_setitem_with_indexer" [union-attr]
- pandas/core/generic.py:8012: error: Unsupported operand type for ~ ("ExtensionArray | ndarray[Any, Any] | Any") [operator]
- pandas/core/apply.py:254: error: Unused "type: ignore" comment [unused-ignore]
- pandas/core/window/rolling.py:1510: error: Argument "raw" to "roll_apply" has incompatible type "builtins.bool | numpy.bool"; expected "builtins.bool" [arg-type]
- pandas/core/tools/datetimes.py:1003: error: Argument "exact" to "_convert_listlike_datetimes" has incompatible type "bool | Literal[_NoDefault.no_default]"; expected "bool" [arg-type]
- pandas/core/indexes/interval.py:560: error: Unused "type: ignore" comment [unused-ignore]
- pandas/core/indexes/interval.py:994: error: Signature of "_intersection" incompatible with supertype "Index" [override]
- pandas/core/indexes/interval.py:994: note: Superclass:
- pandas/core/indexes/interval.py:994: note: def _intersection(self, other: Index, sort: bool = ...) -> Any
- pandas/core/indexes/interval.py:994: note: Subclass:
- pandas/core/indexes/interval.py:994: note: def _intersection(self, other: Any, sort: Any) -> Any
- pandas/core/groupby/groupby.py:3722: error: Argument "mask" to "group_fillna_indexer" has incompatible type "ndarray[Any, dtype[bool]] | Any"; expected "ndarray[Any, dtype[unsignedinteger[_8Bit]]]" [arg-type]
- pandas/core/groupby/groupby.py:4241: error: Argument "interpolation" to "group_quantile" has incompatible type "str"; expected "Literal['linear', 'lower', 'higher', 'nearest', 'midpoint']" [arg-type]
- pandas/core/groupby/groupby.py:4273: error: Argument "mask" to "group_quantile" has incompatible type "ndarray[Any, dtype[bool]]"; expected "ndarray[Any, dtype[unsignedinteger[_8Bit]]]" [arg-type]
- pandas/core/resample.py:1632: error: Signature of "_downsample" incompatible with supertype "Resampler" [override]
- pandas/core/resample.py:1632: note: Superclass:
- pandas/core/resample.py:1632: note: def _downsample(self, f: Any, **kwargs: Any) -> Any
- pandas/core/resample.py:1632: note: Subclass:
- pandas/core/resample.py:1632: note: def _downsample(self, how: Any, **kwargs: Any) -> Any
- pandas/core/resample.py:1791: error: Signature of "_downsample" incompatible with supertype "Resampler" [override]
- pandas/core/resample.py:1791: note: Superclass:
- pandas/core/resample.py:1791: note: def _downsample(self, f: Any, **kwargs: Any) -> Any
- pandas/core/resample.py:1791: note: Subclass:
- pandas/core/resample.py:1791: note: def _downsample(self, how: Any, **kwargs: Any) -> Any
- pandas/tests/scalar/timedelta/test_timedelta.py:591: error: Untyped decorator makes function "test_hash_equality_invariance" untyped [misc]
- pandas/tests/frame/test_ufunc.py:69: error: "_UFunc_Nin2_Nout1[Literal['add'], Literal[22], Literal[0]]" not callable [misc]
- pandas/tests/frame/test_ufunc.py:76: error: "_UFunc_Nin1_Nout1[Literal['negative'], Literal[19], None]" not callable [misc]
- pandas/tests/extension/date/array.py:116: error: Unused "type: ignore" comment [unused-ignore]
- pandas/plotting/_matplotlib/tools.py:84: error: Unused "type: ignore" comment [unused-ignore]
- pandas/plotting/_matplotlib/tools.py:447: error: Unused "type: ignore" comment [unused-ignore]
- pandas/plotting/_matplotlib/tools.py:451: error: Unused "type: ignore" comment [unused-ignore]
- pandas/plotting/_matplotlib/tools.py:463: error: Unused "type: ignore" comment [unused-ignore]
- pandas/plotting/_matplotlib/tools.py:465: error: Unused "type: ignore" comment [unused-ignore]
- pandas/plotting/_matplotlib/tools.py:467: error: Unused "type: ignore" comment [unused-ignore]
- pandas/plotting/_matplotlib/tools.py:469: error: Unused "type: ignore" comment [unused-ignore]
- pandas/plotting/_matplotlib/style.py:305: error: Unused "type: ignore" comment [unused-ignore]
- pandas/plotting/_matplotlib/converter.py:365: error: Unused "type: ignore" comment [unused-ignore]
- pandas/plotting/_matplotlib/converter.py:366: error: Unused "type: ignore" comment [unused-ignore]
- pandas/plotting/_matplotlib/converter.py:368: error: Unused "type: ignore" comment [unused-ignore]
- pandas/plotting/_matplotlib/converter.py:369: error: Unused "type: ignore" comment [unused-ignore]
- pandas/plotting/_matplotlib/converter.py:984: error: Unused "type: ignore" comment [unused-ignore]
- pandas/tests/io/test_sql.py:597: error: Unused "type: ignore" comment [unused-ignore]
- pandas/tests/indexes/test_base.py:1638: error: Unexpected keyword argument "data" for "RangeIndex" [call-arg]
- pandas/core/indexes/range.py:150: note: "RangeIndex" defined here
- pandas/plotting/_matplotlib/timeseries.py:143: error: Unused "type: ignore" comment [unused-ignore]
- pandas/plotting/_matplotlib/timeseries.py:156: error: Unused "type: ignore" comment [unused-ignore]
- pandas/plotting/_matplotlib/timeseries.py:174: error: Unused "type: ignore" comment [unused-ignore]
- pandas/plotting/_matplotlib/timeseries.py:177: error: Unused "type: ignore" comment [unused-ignore]
- pandas/plotting/_matplotlib/timeseries.py:180: error: Unused "type: ignore" comment [unused-ignore]
- pandas/plotting/_matplotlib/core.py:533: error: Unused "type: ignore" comment [unused-ignore]
- pandas/plotting/_matplotlib/core.py:535: error: Unused "type: ignore" comment [unused-ignore]
- pandas/plotting/_matplotlib/core.py:536: error: Unused "type: ignore" comment [unused-ignore]
- pandas/plotting/_matplotlib/core.py:539: error: Unused "type: ignore" comment [unused-ignore]
- pandas/plotting/_matplotlib/core.py:1270: error: Unused "type: ignore" comment [unused-ignore]
- pandas/plotting/_matplotlib/core.py:1271: error: Unused "type: ignore" comment [unused-ignore]
... (truncated 23 lines) ...
alectryon (https://github.com/cpitclaudel/alectryon)
- alectryon/markers.py:100: error: Need type annotation for "QUERY_SHAPE" [var-annotated]
+ alectryon/markers.py:99: error: Need type annotation for "QUERY_SHAPE" [var-annotated]
- alectryon/core.py:425: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
+ alectryon/core.py:424: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
- alectryon/core.py:454: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
+ alectryon/core.py:453: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
... (truncated 1838 lines) ...```
Well... that's not good.
Diff from mypy_primer, showing the effect of this PR on open source code:
setuptools (https://github.com/pypa/setuptools): 15.88x faster (32.8s -> 2.1s in a single noisy sample)
+ setuptools/warnings.py:19: error: f-string: single '}' is not allowed [syntax]
- setuptools/_itertools.py:1: error: Cannot find implementation or library stub for module named "more_itertools" [import-not-found]
- setuptools/_path.py:12: error: Cannot find implementation or library stub for module named "more_itertools" [import-not-found]
- setuptools/tests/environment.py:7: error: Cannot find implementation or library stub for module named "jaraco" [import-not-found]
- setuptools/msvc.py:18: error: Cannot find implementation or library stub for module named "more_itertools" [import-not-found]
- setuptools/msvc.py:1421: error: Argument 1 to "filter" has incompatible type "Callable[[int | str | bytes | PathLike[str] | PathLike[bytes]], bool]"; expected "Callable[[str], TypeGuard[str | None]]" [arg-type]
- setuptools/_entry_points.py:5: error: Cannot find implementation or library stub for module named "jaraco.functools" [import-not-found]
- setuptools/_entry_points.py:7: error: Cannot find implementation or library stub for module named "more_itertools" [import-not-found]
- pkg_resources/__init__.py:96: error: Cannot find implementation or library stub for module named "platformdirs" [import-not-found]
- pkg_resources/__init__.py:2651: error: Value of type variable "AnyStr" of "abspath" cannot be "Sequence[object]" [type-var]
- setuptools/_reqs.py:6: error: Cannot find implementation or library stub for module named "jaraco" [import-not-found]
- setuptools/tests/test_glob.py:2: error: Cannot find implementation or library stub for module named "jaraco" [import-not-found]
- setuptools/tests/test_build_meta.py:15: error: Cannot find implementation or library stub for module named "jaraco" [import-not-found]
- setuptools/config/expand.py:120: error: Cannot find implementation or library stub for module named "more_itertools" [import-not-found]
- setuptools/config/setupcfg.py:303: error: "Callable[[str, Any], None] | Any" not callable [misc]
- setuptools/config/pyprojecttoml.py:285: error: Cannot find implementation or library stub for module named "more_itertools" [import-not-found]
- setuptools/dist.py:13: error: Cannot find implementation or library stub for module named "more_itertools" [import-not-found]
- setuptools/package_index.py:23: error: Cannot find implementation or library stub for module named "more_itertools" [import-not-found]
- setuptools/build_meta.py:422: error: List item 1 has incompatible type "str | PathLike[str]"; expected "str" [list-item]
- setuptools/tests/test_wheel.py:18: error: Cannot find implementation or library stub for module named "jaraco" [import-not-found]
- setuptools/tests/test_sdist.py:16: error: Cannot find implementation or library stub for module named "jaraco" [import-not-found]
- setuptools/tests/test_egg_info.py:14: error: Cannot find implementation or library stub for module named "jaraco" [import-not-found]
- setuptools/tests/test_build_py.py:8: error: Cannot find implementation or library stub for module named "jaraco" [import-not-found]
- setuptools/tests/test_bdist_wheel.py:17: error: Cannot find implementation or library stub for module named "jaraco" [import-not-found]
- setuptools/tests/fixtures.py:7: error: Cannot find implementation or library stub for module named "path" [import-not-found]
- setuptools/tests/config/test_pyprojecttoml_dynamic_deps.py:4: error: Cannot find implementation or library stub for module named "jaraco" [import-not-found]
- setuptools/tests/config/test_pyprojecttoml.py:5: error: Cannot find implementation or library stub for module named "jaraco" [import-not-found]
- setuptools/tests/config/test_pyprojecttoml.py:8: error: Cannot find implementation or library stub for module named "path" [import-not-found]
- setuptools/command/build_py.py:13: error: Cannot find implementation or library stub for module named "more_itertools" [import-not-found]
- setuptools/command/build_py.py:13: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
- setuptools/tests/test_config_discovery.py:7: error: Cannot find implementation or library stub for module named "jaraco" [import-not-found]
- setuptools/tests/test_config_discovery.py:9: error: Cannot find implementation or library stub for module named "path" [import-not-found]
- setuptools/tests/test_build_ext.py:6: error: Cannot find implementation or library stub for module named "jaraco" [import-not-found]
- setuptools/tests/test_build_ext.py:186: error: Unused "type: ignore" comment [unused-ignore]
- setuptools/tests/test_easy_install.py:23: error: Cannot find implementation or library stub for module named "jaraco" [import-not-found]
- setuptools/tests/test_editable_install.py:14: error: Cannot find implementation or library stub for module named "jaraco" [import-not-found]
- setuptools/tests/test_editable_install.py:17: error: Cannot find implementation or library stub for module named "path" [import-not-found]
stone (https://github.com/dropbox/stone)
- stone/ir/data_types.py:1653: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
+ stone/ir/data_types.py:1650: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
- stone/backends/python_rsrc/stone_serializers.py:324: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
+ stone/backends/python_rsrc/stone_serializers.py:323: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
- stone/backends/python_rsrc/stone_serializers.py:420: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
+ stone/backends/python_rsrc/stone_serializers.py:414: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
psycopg (https://github.com/psycopg/psycopg): 6.22x faster (52.3s -> 8.4s in a single noisy sample)
- tests/dbapi20_tpc.py:36: error: "TwoPhaseCommitTests" has no attribute "assertEquals" [attr-defined]
- tests/dbapi20_tpc.py:37: error: "TwoPhaseCommitTests" has no attribute "assertEquals" [attr-defined]
- tests/dbapi20_tpc.py:38: error: "TwoPhaseCommitTests" has no attribute "assertEquals" [attr-defined]
- tests/dbapi20_tpc.py:42: error: "TwoPhaseCommitTests" has no attribute "assertEquals" [attr-defined]
- tests/dbapi20_tpc.py:44: error: "TwoPhaseCommitTests" has no attribute "assertEquals" [attr-defined]
- tests/dbapi20.py:175: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:184: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:194: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:195: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:197: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:197: note: Error code "attr-defined" not covered by "type: ignore" comment
- tests/dbapi20.py:198: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:198: note: Error code "attr-defined" not covered by "type: ignore" comment
- tests/dbapi20.py:200: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:203: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:206: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:209: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:212: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:215: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:218: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:231: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:232: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:233: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:234: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:235: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:236: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:237: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:238: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:239: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:333: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:338: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:403: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:432: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:484: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:519: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:539: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:595: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:608: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:613: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:630: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:639: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:663: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:679: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:684: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:706: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:780: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:849: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:854: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:859: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:864: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:869: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- psycopg/psycopg/waiting.py:67: error: Incompatible types in assignment (expression has type "Any | None", variable has type "RV") [assignment]
- psycopg/psycopg/waiting.py:102: error: Incompatible types in assignment (expression has type "Any | None", variable has type "RV") [assignment]
- psycopg/psycopg/waiting.py:163: error: Incompatible types in assignment (expression has type "Any | None", variable has type "RV") [assignment]
- psycopg/psycopg/waiting.py:221: error: Incompatible types in assignment (expression has type "Any | None", variable has type "RV") [assignment]
- psycopg/psycopg/waiting.py:258: error: Incompatible types in assignment (expression has type "Any | None", variable has type "RV") [assignment]
- psycopg/psycopg/waiting.py:314: error: Incompatible types in assignment (expression has type "Any | None", variable has type "RV") [assignment]
- psycopg/psycopg/waiting.py:362: error: Incompatible types in assignment (expression has type "Any | None", variable has type "RV") [assignment]
- tests/test_psycopg_dbapi20.py:45: error: "type[PsycopgTests]" has no attribute "failUnless" [attr-defined]
- tests/test_psycopg_dbapi20.py:46: error: "type[PsycopgTPCTests]" has no attribute "assertEquals" [attr-defined]
+ /tmp/mypy_primer/projects/_psycopg_venv/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:1095: error: f-string: single '}' is not allowed [syntax]
altair (https://github.com/vega/altair): 9.04x faster (113.3s -> 12.5s in a single noisy sample)
- tests/vegalite/v5/test_theme.py:984: error: Redundant cast to "str" [redundant-cast]
- tests/vegalite/v5/test_renderers.py:20: error: Unused "type: ignore" comment [unused-ignore]
+ /tmp/mypy_primer/projects/_altair_venv/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:1095: error: f-string: single '}' is not allowed [syntax]
- tools/schemapi/utils.py:30: error: Cannot find implementation or library stub for module named "mistune" [import-not-found]
- tools/schemapi/utils.py:31: error: Cannot find implementation or library stub for module named "mistune.renderers.rst" [import-not-found]
downforeveryone (https://github.com/rpdelaney/downforeveryone): 5.68x faster (20.2s -> 3.5s in a single noisy sample)
+ /tmp/mypy_primer/projects/_downforeveryone_venv/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:1095:48: error: f-string: single '}' is not allowed [syntax]
arviz (https://github.com/arviz-devs/arviz): 3.11x faster (37.9s -> 12.2s in a single noisy sample)
- arviz/rcparams.py:337: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
- arviz/stats/ecdf_utils.py:324: error: Incompatible return value type (got "floating[Any]", expected "float") [return-value]
- arviz/wrappers/wrap_stan.py:107: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
- arviz/plots/tsplot.py:288: error: Unused "type: ignore" comment [unused-ignore]
- arviz/plots/tsplot.py:289: error: Unused "type: ignore" comment [unused-ignore]
- arviz/plots/tsplot.py:323: error: Unused "type: ignore" comment [unused-ignore]
- arviz/plots/tsplot.py:326: error: Unused "type: ignore" comment [unused-ignore]
- arviz/plots/tsplot.py:354: error: Unused "type: ignore" comment [unused-ignore]
- arviz/plots/tsplot.py:357: error: Unused "type: ignore" comment [unused-ignore]
- arviz/plots/tsplot.py:399: error: Unused "type: ignore" comment [unused-ignore]
- arviz/plots/tsplot.py:402: error: Unused "type: ignore" comment [unused-ignore]
- arviz/plots/tsplot.py:405: error: Unused "type: ignore" comment [unused-ignore]
- arviz/data/inference_data.py:418: error: Need type annotation for "group_kws" (hint: "group_kws: dict[<type>, <type>] = ...") [var-annotated]
- arviz/data/inference_data.py:494: error: No overload variant of "to_netcdf" of "Dataset" matches argument types "str", "str", "str", "str" [call-overload]
- arviz/data/inference_data.py:494: note: Possible overload variants:
- arviz/data/inference_data.py:494: note: def to_netcdf(self, path: None = ..., mode: Literal['w', 'a'] = ..., format: Literal['NETCDF4', 'NETCDF4_CLASSIC', 'NETCDF3_64BIT', 'NETCDF3_CLASSIC'] | None = ..., group: str | None = ..., engine: Literal['netcdf4', 'scipy', 'h5netcdf'] | None = ..., encoding: Mapping[Any, Mapping[str, Any]] | None = ..., unlimited_dims: Iterable[Hashable] | None = ..., compute: bool = ..., invalid_netcdf: bool = ...) -> bytes
- arviz/data/inference_data.py:494: note: def to_netcdf(self, path: str | PathLike[Any], mode: Literal['w', 'a'] = ..., format: Literal['NETCDF4', 'NETCDF4_CLASSIC', 'NETCDF3_64BIT', 'NETCDF3_CLASSIC'] | None = ..., group: str | None = ..., engine: Literal['netcdf4', 'scipy', 'h5netcdf'] | None = ..., encoding: Mapping[Any, Mapping[str, Any]] | None = ..., unlimited_dims: Iterable[Hashable] | None = ..., *, compute: Literal[False], invalid_netcdf: bool = ...) -> Any
- arviz/data/inference_data.py:494: note: def to_netcdf(self, path: str | PathLike[Any], mode: Literal['w', 'a'] = ..., format: Literal['NETCDF4', 'NETCDF4_CLASSIC', 'NETCDF3_64BIT', 'NETCDF3_CLASSIC'] | None = ..., group: str | None = ..., engine: Literal['netcdf4', 'scipy', 'h5netcdf'] | None = ..., encoding: Mapping[Any, Mapping[str, Any]] | None = ..., unlimited_dims: Iterable[Hashable] | None = ..., compute: Literal[True] = ..., invalid_netcdf: bool = ...) -> None
- arviz/data/inference_data.py:494: note: def to_netcdf(self, path: str | PathLike[Any], mode: Literal['w', 'a'] = ..., format: Literal['NETCDF4', 'NETCDF4_CLASSIC', 'NETCDF3_64BIT', 'NETCDF3_CLASSIC'] | None = ..., group: str | None = ..., engine: Literal['netcdf4', 'scipy', 'h5netcdf'] | None = ..., encoding: Mapping[Any, Mapping[str, Any]] | None = ..., unlimited_dims: Iterable[Hashable] | None = ..., compute: bool = ..., invalid_netcdf: bool = ...) -> Any | None
- arviz/data/inference_data.py:509: error: Incompatible types in assignment (expression has type "dict[Any, dict[str, bool]]", target has type "str") [assignment]
- arviz/data/inference_data.py:1704: error: Unused "type: ignore" comment [unused-ignore]
- arviz/data/inference_data.py:1705: error: Unused "type: ignore" comment [unused-ignore]
- arviz/data/inference_data.py:1706: error: Unused "type: ignore" comment [unused-ignore]
- arviz/data/inference_data.py:1707: error: Unused "type: ignore" comment [unused-ignore]
- arviz/data/inference_data.py:1708: error: Unused "type: ignore" comment [unused-ignore]
- arviz/data/inference_data.py:1709: error: Unused "type: ignore" comment [unused-ignore]
- doc/sphinxext/gallery_generator.py:120: error: Need type annotation for "categorized_contents" [var-annotated]
- arviz/plots/backends/matplotlib/posteriorplot.py:265: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
- arviz/plots/backends/bokeh/posteriorplot.py:244: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
- arviz/data/example_data/code/radon/radon.py:49: error: Module has no attribute "from_pymc3" [attr-defined]
- arviz/tests/base_tests/test_utils.py:251: error: Function "_stack" could always be true in boolean context [truthy-function]
- arviz/tests/base_tests/test_data_zarr.py:29: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
- arviz/tests/base_tests/test_data.py:1535: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
+ /tmp/mypy_primer/projects/_arviz_venv/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:1095: error: f-string: single '}' is not allowed [syntax]
pandas (https://github.com/pandas-dev/pandas): 7.46x faster (336.0s -> 45.0s in a single noisy sample)
+ /tmp/mypy_primer/projects/_pandas_venv/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:1095: error: f-string: single '}' is not allowed [syntax]
- 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/io/formats/printing.py:262: error: Unused "type: ignore" comment [unused-ignore]
- pandas/core/dtypes/dtypes.py:2129: error: Argument 1 to "np_find_common_type" has incompatible type "*Generator[Any | dtype[Any] | ExtensionDtype, None, None]"; expected "dtype[Any]" [arg-type]
- pandas/io/common.py:915: error: Value of type variable "_BufferT_co" of "TextIOWrapper" cannot be "_IOWrapper | BaseBuffer" [type-var]
- pandas/io/common.py:916: error: Unused "type: ignore" comment [unused-ignore]
- pandas/core/nanops.py:828: error: Incompatible types in assignment (expression has type "Any | float", variable has type "ndarray[Any, dtype[Any]]") [assignment]
- pandas/core/computation/ops.py:80: error: Unused "type: ignore" comment [unused-ignore]
- pandas/core/missing.py:422: error: Unused "type: ignore" comment [unused-ignore]
- pandas/core/missing.py:422: error: No overload variant of "apply_along_axis" matches argument types "Callable[[ndarray[Any, Any]], None]", "int", "ndarray[Any, Any]" [call-overload]
- pandas/core/missing.py:422: note: Error code "call-overload" not covered by "type: ignore" comment
- pandas/core/missing.py:422: note: Possible overload variants:
- pandas/core/missing.py:422: note: def [_P`-1, _SCT: generic] apply_along_axis(func1d: Callable[[ndarray[Any, dtype[Any]], **_P], _SupportsArray[dtype[_SCT]] | _NestedSequence[_SupportsArray[dtype[_SCT]]]], axis: SupportsIndex, arr: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes], *args: _P.args, **kwargs: _P.kwargs) -> ndarray[Any, dtype[_SCT]]
- pandas/core/missing.py:422: note: def [_P`-1] apply_along_axis(func1d: Callable[[ndarray[Any, dtype[Any]], **_P], _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes]], axis: SupportsIndex, arr: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes], *args: _P.args, **kwargs: _P.kwargs) -> ndarray[Any, dtype[Any]]
- pandas/core/common.py:249: error: Module has no attribute "VisibleDeprecationWarning" [attr-defined]
- pandas/core/arrays/boolean.py:372: error: Signature of "_logical_method" incompatible with supertype "BaseMaskedArray" [override]
- pandas/core/arrays/boolean.py:372: note: Superclass:
- pandas/core/arrays/boolean.py:372: note: def _arith_method(self: BaseMaskedArray, other: Any, op: Any) -> Any
- pandas/core/arrays/boolean.py:372: note: Subclass:
- pandas/core/arrays/boolean.py:372: note: def _logical_method(self, other: Any, op: Any) -> Any
- pandas/core/arrays/boolean.py:372: note: Superclass:
- pandas/core/arrays/boolean.py:372: note: def _arith_method(self: BaseMaskedArray, other: Any, op: Any) -> Any
- pandas/core/arrays/boolean.py:372: note: Subclass:
- pandas/core/arrays/boolean.py:372: note: def _logical_method(self, other: Any, op: Any) -> Any
- pandas/core/arrays/arrow/array.py:2430: error: Argument 1 to "normalize" has incompatible type "str"; expected "Literal['NFC', 'NFD', 'NFKC', 'NFKD']" [arg-type]
- pandas/plotting/_core.py:1041: error: Argument 1 to "len" has incompatible type "Any | bool"; expected "Sized" [arg-type]
- pandas/core/series.py:817: error: Unused "type: ignore" comment, use narrower [prop-decorator] instead of [misc] code [unused-ignore]
- pandas/core/indexing.py:918: error: Item "_LocationIndexer" of "_LocationIndexer | Any" has no attribute "_setitem_with_indexer" [union-attr]
- pandas/core/generic.py:8012: error: Unsupported operand type for ~ ("ExtensionArray | ndarray[Any, Any] | Any") [operator]
- pandas/core/apply.py:254: error: Unused "type: ignore" comment [unused-ignore]
- pandas/core/window/rolling.py:1510: error: Argument "raw" to "roll_apply" has incompatible type "builtins.bool | numpy.bool"; expected "builtins.bool" [arg-type]
- pandas/core/tools/datetimes.py:1003: error: Argument "exact" to "_convert_listlike_datetimes" has incompatible type "bool | Literal[_NoDefault.no_default]"; expected "bool" [arg-type]
- pandas/core/indexes/interval.py:560: error: Unused "type: ignore" comment [unused-ignore]
- pandas/core/indexes/interval.py:994: error: Signature of "_intersection" incompatible with supertype "Index" [override]
- pandas/core/indexes/interval.py:994: note: Superclass:
- pandas/core/indexes/interval.py:994: note: def _intersection(self, other: Index, sort: bool = ...) -> Any
- pandas/core/indexes/interval.py:994: note: Subclass:
- pandas/core/indexes/interval.py:994: note: def _intersection(self, other: Any, sort: Any) -> Any
- pandas/core/groupby/groupby.py:3722: error: Argument "mask" to "group_fillna_indexer" has incompatible type "ndarray[Any, dtype[bool]] | Any"; expected "ndarray[Any, dtype[unsignedinteger[_8Bit]]]" [arg-type]
- pandas/core/groupby/groupby.py:4241: error: Argument "interpolation" to "group_quantile" has incompatible type "str"; expected "Literal['linear', 'lower', 'higher', 'nearest', 'midpoint']" [arg-type]
- pandas/core/groupby/groupby.py:4273: error: Argument "mask" to "group_quantile" has incompatible type "ndarray[Any, dtype[bool]]"; expected "ndarray[Any, dtype[unsignedinteger[_8Bit]]]" [arg-type]
- pandas/core/resample.py:1632: error: Signature of "_downsample" incompatible with supertype "Resampler" [override]
- pandas/core/resample.py:1632: note: Superclass:
- pandas/core/resample.py:1632: note: def _downsample(self, f: Any, **kwargs: Any) -> Any
- pandas/core/resample.py:1632: note: Subclass:
- pandas/core/resample.py:1632: note: def _downsample(self, how: Any, **kwargs: Any) -> Any
- pandas/core/resample.py:1791: error: Signature of "_downsample" incompatible with supertype "Resampler" [override]
- pandas/core/resample.py:1791: note: Superclass:
- pandas/core/resample.py:1791: note: def _downsample(self, f: Any, **kwargs: Any) -> Any
- pandas/core/resample.py:1791: note: Subclass:
- pandas/core/resample.py:1791: note: def _downsample(self, how: Any, **kwargs: Any) -> Any
- pandas/tests/scalar/timedelta/test_timedelta.py:591: error: Untyped decorator makes function "test_hash_equality_invariance" untyped [misc]
- pandas/tests/frame/test_ufunc.py:69: error: "_UFunc_Nin2_Nout1[Literal['add'], Literal[22], Literal[0]]" not callable [misc]
- pandas/tests/frame/test_ufunc.py:76: error: "_UFunc_Nin1_Nout1[Literal['negative'], Literal[19], None]" not callable [misc]
- pandas/tests/extension/date/array.py:116: error: Unused "type: ignore" comment [unused-ignore]
- pandas/plotting/_matplotlib/tools.py:84: error: Unused "type: ignore" comment [unused-ignore]
- pandas/plotting/_matplotlib/tools.py:447: error: Unused "type: ignore" comment [unused-ignore]
- pandas/plotting/_matplotlib/tools.py:451: error: Unused "type: ignore" comment [unused-ignore]
- pandas/plotting/_matplotlib/tools.py:463: error: Unused "type: ignore" comment [unused-ignore]
- pandas/plotting/_matplotlib/tools.py:465: error: Unused "type: ignore" comment [unused-ignore]
- pandas/plotting/_matplotlib/tools.py:467: error: Unused "type: ignore" comment [unused-ignore]
- pandas/plotting/_matplotlib/tools.py:469: error: Unused "type: ignore" comment [unused-ignore]
- pandas/plotting/_matplotlib/style.py:305: error: Unused "type: ignore" comment [unused-ignore]
- pandas/plotting/_matplotlib/converter.py:365: error: Unused "type: ignore" comment [unused-ignore]
- pandas/plotting/_matplotlib/converter.py:366: error: Unused "type: ignore" comment [unused-ignore]
- pandas/plotting/_matplotlib/converter.py:368: error: Unused "type: ignore" comment [unused-ignore]
- pandas/plotting/_matplotlib/converter.py:369: error: Unused "type: ignore" comment [unused-ignore]
- pandas/plotting/_matplotlib/converter.py:984: error: Unused "type: ignore" comment [unused-ignore]
- pandas/tests/io/test_sql.py:597: error: Unused "type: ignore" comment [unused-ignore]
- pandas/tests/indexes/test_base.py:1638: error: Unexpected keyword argument "data" for "RangeIndex" [call-arg]
- pandas/core/indexes/range.py:150: note: "RangeIndex" defined here
- pandas/plotting/_matplotlib/timeseries.py:143: error: Unused "type: ignore" comment [unused-ignore]
- pandas/plotting/_matplotlib/timeseries.py:156: error: Unused "type: ignore" comment [unused-ignore]
- pandas/plotting/_matplotlib/timeseries.py:174: error: Unused "type: ignore" comment [unused-ignore]
- pandas/plotting/_matplotlib/timeseries.py:177: error: Unused "type: ignore" comment [unused-ignore]
- pandas/plotting/_matplotlib/timeseries.py:180: error: Unused "type: ignore" comment [unused-ignore]
- pandas/plotting/_matplotlib/core.py:533: error: Unused "type: ignore" comment [unused-ignore]
- pandas/plotting/_matplotlib/core.py:535: error: Unused "type: ignore" comment [unused-ignore]
- pandas/plotting/_matplotlib/core.py:536: error: Unused "type: ignore" comment [unused-ignore]
- pandas/plotting/_matplotlib/core.py:539: error: Unused "type: ignore" comment [unused-ignore]
- pandas/plotting/_matplotlib/core.py:1270: error: Unused "type: ignore" comment [unused-ignore]
- pandas/plotting/_matplotlib/core.py:1271: error: Unused "type: ignore" comment [unused-ignore]
... (truncated 23 lines) ...
alectryon (https://github.com/cpitclaudel/alectryon)
- alectryon/markers.py:100: error: Need type annotation for "QUERY_SHAPE" [var-annotated]
+ alectryon/markers.py:99: error: Need type annotation for "QUERY_SHAPE" [var-annotated]
- alectryon/core.py:425: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
+ alectryon/core.py:424: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
- alectryon/core.py:454: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
+ alectryon/core.py:453: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
... (truncated 1838 lines) ...```
We do a lil "finding out there are bugs in tokenize". https://github.com/python/cpython/issues/125008
Diff from mypy_primer, showing the effect of this PR on open source code:
setuptools (https://github.com/pypa/setuptools): 17.70x faster (34.2s -> 1.9s in a single noisy sample)
+ setuptools/warnings.py:19: error: f-string: single '}' is not allowed [syntax]
- setuptools/_itertools.py:1: error: Cannot find implementation or library stub for module named "more_itertools" [import-not-found]
- setuptools/_path.py:12: error: Cannot find implementation or library stub for module named "more_itertools" [import-not-found]
- setuptools/tests/environment.py:7: error: Cannot find implementation or library stub for module named "jaraco" [import-not-found]
- setuptools/msvc.py:18: error: Cannot find implementation or library stub for module named "more_itertools" [import-not-found]
- setuptools/msvc.py:1421: error: Argument 1 to "filter" has incompatible type "Callable[[int | str | bytes | PathLike[str] | PathLike[bytes]], bool]"; expected "Callable[[str], TypeGuard[str | None]]" [arg-type]
- setuptools/_entry_points.py:5: error: Cannot find implementation or library stub for module named "jaraco.functools" [import-not-found]
- setuptools/_entry_points.py:7: error: Cannot find implementation or library stub for module named "more_itertools" [import-not-found]
- pkg_resources/__init__.py:96: error: Cannot find implementation or library stub for module named "platformdirs" [import-not-found]
- pkg_resources/__init__.py:2651: error: Value of type variable "AnyStr" of "abspath" cannot be "Sequence[object]" [type-var]
- setuptools/_reqs.py:6: error: Cannot find implementation or library stub for module named "jaraco" [import-not-found]
- setuptools/tests/test_glob.py:2: error: Cannot find implementation or library stub for module named "jaraco" [import-not-found]
- setuptools/tests/test_build_meta.py:15: error: Cannot find implementation or library stub for module named "jaraco" [import-not-found]
- setuptools/config/expand.py:120: error: Cannot find implementation or library stub for module named "more_itertools" [import-not-found]
- setuptools/config/setupcfg.py:303: error: "Callable[[str, Any], None] | Any" not callable [misc]
- setuptools/config/pyprojecttoml.py:285: error: Cannot find implementation or library stub for module named "more_itertools" [import-not-found]
- setuptools/dist.py:13: error: Cannot find implementation or library stub for module named "more_itertools" [import-not-found]
- setuptools/package_index.py:23: error: Cannot find implementation or library stub for module named "more_itertools" [import-not-found]
- setuptools/build_meta.py:422: error: List item 1 has incompatible type "str | PathLike[str]"; expected "str" [list-item]
- setuptools/tests/test_wheel.py:18: error: Cannot find implementation or library stub for module named "jaraco" [import-not-found]
- setuptools/tests/test_sdist.py:16: error: Cannot find implementation or library stub for module named "jaraco" [import-not-found]
- setuptools/tests/test_egg_info.py:14: error: Cannot find implementation or library stub for module named "jaraco" [import-not-found]
- setuptools/tests/test_build_py.py:8: error: Cannot find implementation or library stub for module named "jaraco" [import-not-found]
- setuptools/tests/test_bdist_wheel.py:17: error: Cannot find implementation or library stub for module named "jaraco" [import-not-found]
- setuptools/tests/fixtures.py:7: error: Cannot find implementation or library stub for module named "path" [import-not-found]
- setuptools/tests/config/test_pyprojecttoml_dynamic_deps.py:4: error: Cannot find implementation or library stub for module named "jaraco" [import-not-found]
- setuptools/tests/config/test_pyprojecttoml.py:5: error: Cannot find implementation or library stub for module named "jaraco" [import-not-found]
- setuptools/tests/config/test_pyprojecttoml.py:8: error: Cannot find implementation or library stub for module named "path" [import-not-found]
- setuptools/command/build_py.py:13: error: Cannot find implementation or library stub for module named "more_itertools" [import-not-found]
- setuptools/command/build_py.py:13: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
- setuptools/tests/test_config_discovery.py:7: error: Cannot find implementation or library stub for module named "jaraco" [import-not-found]
- setuptools/tests/test_config_discovery.py:9: error: Cannot find implementation or library stub for module named "path" [import-not-found]
- setuptools/tests/test_build_ext.py:6: error: Cannot find implementation or library stub for module named "jaraco" [import-not-found]
- setuptools/tests/test_build_ext.py:186: error: Unused "type: ignore" comment [unused-ignore]
- setuptools/tests/test_easy_install.py:23: error: Cannot find implementation or library stub for module named "jaraco" [import-not-found]
- setuptools/tests/test_editable_install.py:14: error: Cannot find implementation or library stub for module named "jaraco" [import-not-found]
- setuptools/tests/test_editable_install.py:17: error: Cannot find implementation or library stub for module named "path" [import-not-found]
stone (https://github.com/dropbox/stone)
- stone/ir/data_types.py:1653: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
+ stone/ir/data_types.py:1650: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
- stone/backends/python_rsrc/stone_serializers.py:324: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
+ stone/backends/python_rsrc/stone_serializers.py:323: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
- stone/backends/python_rsrc/stone_serializers.py:420: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
+ stone/backends/python_rsrc/stone_serializers.py:414: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
psycopg (https://github.com/psycopg/psycopg): 6.25x faster (53.7s -> 8.6s in a single noisy sample)
- tests/dbapi20_tpc.py:36: error: "TwoPhaseCommitTests" has no attribute "assertEquals" [attr-defined]
- tests/dbapi20_tpc.py:37: error: "TwoPhaseCommitTests" has no attribute "assertEquals" [attr-defined]
- tests/dbapi20_tpc.py:38: error: "TwoPhaseCommitTests" has no attribute "assertEquals" [attr-defined]
- tests/dbapi20_tpc.py:42: error: "TwoPhaseCommitTests" has no attribute "assertEquals" [attr-defined]
- tests/dbapi20_tpc.py:44: error: "TwoPhaseCommitTests" has no attribute "assertEquals" [attr-defined]
- tests/dbapi20.py:175: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:184: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:194: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:195: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:197: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:197: note: Error code "attr-defined" not covered by "type: ignore" comment
- tests/dbapi20.py:198: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:198: note: Error code "attr-defined" not covered by "type: ignore" comment
- tests/dbapi20.py:200: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:203: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:206: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:209: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:212: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:215: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:218: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:231: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:232: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:233: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:234: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:235: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:236: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:237: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:238: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:239: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:333: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:338: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:403: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:432: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:484: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:519: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:539: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:595: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:608: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:613: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:630: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:639: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:663: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:679: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:684: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:706: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:780: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:849: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:854: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:859: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:864: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- tests/dbapi20.py:869: error: "DatabaseAPI20Test" has no attribute "failUnless" [attr-defined]
- psycopg/psycopg/waiting.py:67: error: Incompatible types in assignment (expression has type "Any | None", variable has type "RV") [assignment]
- psycopg/psycopg/waiting.py:102: error: Incompatible types in assignment (expression has type "Any | None", variable has type "RV") [assignment]
- psycopg/psycopg/waiting.py:163: error: Incompatible types in assignment (expression has type "Any | None", variable has type "RV") [assignment]
- psycopg/psycopg/waiting.py:221: error: Incompatible types in assignment (expression has type "Any | None", variable has type "RV") [assignment]
- psycopg/psycopg/waiting.py:258: error: Incompatible types in assignment (expression has type "Any | None", variable has type "RV") [assignment]
- psycopg/psycopg/waiting.py:314: error: Incompatible types in assignment (expression has type "Any | None", variable has type "RV") [assignment]
- psycopg/psycopg/waiting.py:362: error: Incompatible types in assignment (expression has type "Any | None", variable has type "RV") [assignment]
- tests/test_psycopg_dbapi20.py:45: error: "type[PsycopgTests]" has no attribute "failUnless" [attr-defined]
- tests/test_psycopg_dbapi20.py:46: error: "type[PsycopgTPCTests]" has no attribute "assertEquals" [attr-defined]
+ /tmp/mypy_primer/projects/_psycopg_venv/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:1095: error: f-string: single '}' is not allowed [syntax]
altair (https://github.com/vega/altair): 8.74x faster (113.6s -> 13.0s in a single noisy sample)
- tests/vegalite/v5/test_theme.py:984: error: Redundant cast to "str" [redundant-cast]
- tests/vegalite/v5/test_renderers.py:16: error: Unused "type: ignore" comment [unused-ignore]
+ /tmp/mypy_primer/projects/_altair_venv/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:1095: error: f-string: single '}' is not allowed [syntax]
- tools/schemapi/utils.py:30: error: Cannot find implementation or library stub for module named "mistune" [import-not-found]
- tools/schemapi/utils.py:31: error: Cannot find implementation or library stub for module named "mistune.renderers.rst" [import-not-found]
- tools/generate_schema_wrapper.py:18: error: Cannot find implementation or library stub for module named "vl_convert" [import-not-found]
downforeveryone (https://github.com/rpdelaney/downforeveryone): 5.39x faster (20.3s -> 3.8s in a single noisy sample)
+ /tmp/mypy_primer/projects/_downforeveryone_venv/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:1095:50: error: f-string: single '}' is not allowed [syntax]
arviz (https://github.com/arviz-devs/arviz): 3.91x faster (48.4s -> 12.4s in a single noisy sample)
- arviz/rcparams.py:337: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
- arviz/stats/ecdf_utils.py:324: error: Incompatible return value type (got "floating[Any]", expected "float") [return-value]
- arviz/wrappers/wrap_stan.py:107: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
- arviz/plots/tsplot.py:288: error: Unused "type: ignore" comment [unused-ignore]
- arviz/plots/tsplot.py:289: error: Unused "type: ignore" comment [unused-ignore]
- arviz/plots/tsplot.py:323: error: Unused "type: ignore" comment [unused-ignore]
- arviz/plots/tsplot.py:326: error: Unused "type: ignore" comment [unused-ignore]
- arviz/plots/tsplot.py:354: error: Unused "type: ignore" comment [unused-ignore]
- arviz/plots/tsplot.py:357: error: Unused "type: ignore" comment [unused-ignore]
- arviz/plots/tsplot.py:399: error: Unused "type: ignore" comment [unused-ignore]
- arviz/plots/tsplot.py:402: error: Unused "type: ignore" comment [unused-ignore]
- arviz/plots/tsplot.py:405: error: Unused "type: ignore" comment [unused-ignore]
- arviz/data/inference_data.py:418: error: Need type annotation for "group_kws" (hint: "group_kws: dict[<type>, <type>] = ...") [var-annotated]
- arviz/data/inference_data.py:494: error: No overload variant of "to_netcdf" of "Dataset" matches argument types "str", "str", "str", "str" [call-overload]
- arviz/data/inference_data.py:494: note: Possible overload variants:
- arviz/data/inference_data.py:494: note: def to_netcdf(self, path: None = ..., mode: Literal['w', 'a'] = ..., format: Literal['NETCDF4', 'NETCDF4_CLASSIC', 'NETCDF3_64BIT', 'NETCDF3_CLASSIC'] | None = ..., group: str | None = ..., engine: Literal['netcdf4', 'scipy', 'h5netcdf'] | None = ..., encoding: Mapping[Any, Mapping[str, Any]] | None = ..., unlimited_dims: Iterable[Hashable] | None = ..., compute: bool = ..., invalid_netcdf: bool = ...) -> bytes
- arviz/data/inference_data.py:494: note: def to_netcdf(self, path: str | PathLike[Any], mode: Literal['w', 'a'] = ..., format: Literal['NETCDF4', 'NETCDF4_CLASSIC', 'NETCDF3_64BIT', 'NETCDF3_CLASSIC'] | None = ..., group: str | None = ..., engine: Literal['netcdf4', 'scipy', 'h5netcdf'] | None = ..., encoding: Mapping[Any, Mapping[str, Any]] | None = ..., unlimited_dims: Iterable[Hashable] | None = ..., *, compute: Literal[False], invalid_netcdf: bool = ...) -> Any
- arviz/data/inference_data.py:494: note: def to_netcdf(self, path: str | PathLike[Any], mode: Literal['w', 'a'] = ..., format: Literal['NETCDF4', 'NETCDF4_CLASSIC', 'NETCDF3_64BIT', 'NETCDF3_CLASSIC'] | None = ..., group: str | None = ..., engine: Literal['netcdf4', 'scipy', 'h5netcdf'] | None = ..., encoding: Mapping[Any, Mapping[str, Any]] | None = ..., unlimited_dims: Iterable[Hashable] | None = ..., compute: Literal[True] = ..., invalid_netcdf: bool = ...) -> None
- arviz/data/inference_data.py:494: note: def to_netcdf(self, path: str | PathLike[Any], mode: Literal['w', 'a'] = ..., format: Literal['NETCDF4', 'NETCDF4_CLASSIC', 'NETCDF3_64BIT', 'NETCDF3_CLASSIC'] | None = ..., group: str | None = ..., engine: Literal['netcdf4', 'scipy', 'h5netcdf'] | None = ..., encoding: Mapping[Any, Mapping[str, Any]] | None = ..., unlimited_dims: Iterable[Hashable] | None = ..., compute: bool = ..., invalid_netcdf: bool = ...) -> Any | None
- arviz/data/inference_data.py:509: error: Incompatible types in assignment (expression has type "dict[Any, dict[str, bool]]", target has type "str") [assignment]
- arviz/data/inference_data.py:1704: error: Unused "type: ignore" comment [unused-ignore]
- arviz/data/inference_data.py:1705: error: Unused "type: ignore" comment [unused-ignore]
- arviz/data/inference_data.py:1706: error: Unused "type: ignore" comment [unused-ignore]
- arviz/data/inference_data.py:1707: error: Unused "type: ignore" comment [unused-ignore]
- arviz/data/inference_data.py:1708: error: Unused "type: ignore" comment [unused-ignore]
- arviz/data/inference_data.py:1709: error: Unused "type: ignore" comment [unused-ignore]
- doc/sphinxext/gallery_generator.py:120: error: Need type annotation for "categorized_contents" [var-annotated]
- arviz/plots/backends/matplotlib/posteriorplot.py:265: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
- arviz/plots/backends/bokeh/posteriorplot.py:244: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
- arviz/data/example_data/code/radon/radon.py:49: error: Module has no attribute "from_pymc3" [attr-defined]
- arviz/tests/base_tests/test_utils.py:251: error: Function "_stack" could always be true in boolean context [truthy-function]
- arviz/tests/base_tests/test_data_zarr.py:29: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
- arviz/tests/base_tests/test_data.py:1535: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
+ /tmp/mypy_primer/projects/_arviz_venv/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:1095: error: f-string: single '}' is not allowed [syntax]
pandas (https://github.com/pandas-dev/pandas): 11.21x faster (334.1s -> 29.8s in a single noisy sample)
+ /tmp/mypy_primer/projects/_pandas_venv/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:1095: error: f-string: single '}' is not allowed [syntax]
- 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/io/formats/printing.py:262: error: Unused "type: ignore" comment [unused-ignore]
- pandas/core/dtypes/dtypes.py:2129: error: Argument 1 to "np_find_common_type" has incompatible type "*Generator[Any | dtype[Any] | ExtensionDtype, None, None]"; expected "dtype[Any]" [arg-type]
- pandas/io/common.py:915: error: Value of type variable "_BufferT_co" of "TextIOWrapper" cannot be "_IOWrapper | BaseBuffer" [type-var]
- pandas/io/common.py:916: error: Unused "type: ignore" comment [unused-ignore]
- pandas/core/nanops.py:828: error: Incompatible types in assignment (expression has type "Any | float", variable has type "ndarray[Any, dtype[Any]]") [assignment]
- pandas/core/computation/ops.py:80: error: Unused "type: ignore" comment [unused-ignore]
- pandas/core/missing.py:422: error: Unused "type: ignore" comment [unused-ignore]
- pandas/core/missing.py:422: error: No overload variant of "apply_along_axis" matches argument types "Callable[[ndarray[Any, Any]], None]", "int", "ndarray[Any, Any]" [call-overload]
- pandas/core/missing.py:422: note: Error code "call-overload" not covered by "type: ignore" comment
- pandas/core/missing.py:422: note: Possible overload variants:
- pandas/core/missing.py:422: note: def [_P`-1, _SCT: generic] apply_along_axis(func1d: Callable[[ndarray[Any, dtype[Any]], **_P], _SupportsArray[dtype[_SCT]] | _NestedSequence[_SupportsArray[dtype[_SCT]]]], axis: SupportsIndex, arr: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes], *args: _P.args, **kwargs: _P.kwargs) -> ndarray[Any, dtype[_SCT]]
- pandas/core/missing.py:422: note: def [_P`-1] apply_along_axis(func1d: Callable[[ndarray[Any, dtype[Any]], **_P], _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes]], axis: SupportsIndex, arr: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes], *args: _P.args, **kwargs: _P.kwargs) -> ndarray[Any, dtype[Any]]
- pandas/core/common.py:249: error: Module has no attribute "VisibleDeprecationWarning" [attr-defined]
- pandas/core/arrays/boolean.py:372: error: Signature of "_logical_method" incompatible with supertype "BaseMaskedArray" [override]
- pandas/core/arrays/boolean.py:372: note: Superclass:
- pandas/core/arrays/boolean.py:372: note: def _arith_method(self: BaseMaskedArray, other: Any, op: Any) -> Any
- pandas/core/arrays/boolean.py:372: note: Subclass:
- pandas/core/arrays/boolean.py:372: note: def _logical_method(self, other: Any, op: Any) -> Any
- pandas/core/arrays/boolean.py:372: note: Superclass:
- pandas/core/arrays/boolean.py:372: note: def _arith_method(self: BaseMaskedArray, other: Any, op: Any) -> Any
- pandas/core/arrays/boolean.py:372: note: Subclass:
- pandas/core/arrays/boolean.py:372: note: def _logical_method(self, other: Any, op: Any) -> Any
- pandas/core/arrays/arrow/array.py:2430: error: Argument 1 to "normalize" has incompatible type "str"; expected "Literal['NFC', 'NFD', 'NFKC', 'NFKD']" [arg-type]
- pandas/plotting/_core.py:1041: error: Argument 1 to "len" has incompatible type "Any | bool"; expected "Sized" [arg-type]
- pandas/core/series.py:817: error: Unused "type: ignore" comment, use narrower [prop-decorator] instead of [misc] code [unused-ignore]
- pandas/core/indexing.py:918: error: Item "_LocationIndexer" of "_LocationIndexer | Any" has no attribute "_setitem_with_indexer" [union-attr]
- pandas/core/generic.py:8012: error: Unsupported operand type for ~ ("ExtensionArray | ndarray[Any, Any] | Any") [operator]
- pandas/core/apply.py:254: error: Unused "type: ignore" comment [unused-ignore]
- pandas/core/window/rolling.py:1510: error: Argument "raw" to "roll_apply" has incompatible type "builtins.bool | numpy.bool"; expected "builtins.bool" [arg-type]
- pandas/core/tools/datetimes.py:1003: error: Argument "exact" to "_convert_listlike_datetimes" has incompatible type "bool | Literal[_NoDefault.no_default]"; expected "bool" [arg-type]
- pandas/core/indexes/interval.py:560: error: Unused "type: ignore" comment [unused-ignore]
- pandas/core/indexes/interval.py:994: error: Signature of "_intersection" incompatible with supertype "Index" [override]
- pandas/core/indexes/interval.py:994: note: Superclass:
- pandas/core/indexes/interval.py:994: note: def _intersection(self, other: Index, sort: bool = ...) -> Any
- pandas/core/indexes/interval.py:994: note: Subclass:
- pandas/core/indexes/interval.py:994: note: def _intersection(self, other: Any, sort: Any) -> Any
- pandas/core/groupby/groupby.py:3722: error: Argument "mask" to "group_fillna_indexer" has incompatible type "ndarray[Any, dtype[bool]] | Any"; expected "ndarray[Any, dtype[unsignedinteger[_8Bit]]]" [arg-type]
- pandas/core/groupby/groupby.py:4241: error: Argument "interpolation" to "group_quantile" has incompatible type "str"; expected "Literal['linear', 'lower', 'higher', 'nearest', 'midpoint']" [arg-type]
- pandas/core/groupby/groupby.py:4273: error: Argument "mask" to "group_quantile" has incompatible type "ndarray[Any, dtype[bool]]"; expected "ndarray[Any, dtype[unsignedinteger[_8Bit]]]" [arg-type]
- pandas/core/resample.py:1632: error: Signature of "_downsample" incompatible with supertype "Resampler" [override]
- pandas/core/resample.py:1632: note: Superclass:
- pandas/core/resample.py:1632: note: def _downsample(self, f: Any, **kwargs: Any) -> Any
- pandas/core/resample.py:1632: note: Subclass:
- pandas/core/resample.py:1632: note: def _downsample(self, how: Any, **kwargs: Any) -> Any
- pandas/core/resample.py:1791: error: Signature of "_downsample" incompatible with supertype "Resampler" [override]
- pandas/core/resample.py:1791: note: Superclass:
- pandas/core/resample.py:1791: note: def _downsample(self, f: Any, **kwargs: Any) -> Any
- pandas/core/resample.py:1791: note: Subclass:
- pandas/core/resample.py:1791: note: def _downsample(self, how: Any, **kwargs: Any) -> Any
- pandas/tests/scalar/timedelta/test_timedelta.py:591: error: Untyped decorator makes function "test_hash_equality_invariance" untyped [misc]
- pandas/tests/frame/test_ufunc.py:69: error: "_UFunc_Nin2_Nout1[Literal['add'], Literal[22], Literal[0]]" not callable [misc]
- pandas/tests/frame/test_ufunc.py:76: error: "_UFunc_Nin1_Nout1[Literal['negative'], Literal[19], None]" not callable [misc]
- pandas/tests/extension/date/array.py:116: error: Unused "type: ignore" comment [unused-ignore]
- pandas/plotting/_matplotlib/tools.py:84: error: Unused "type: ignore" comment [unused-ignore]
- pandas/plotting/_matplotlib/tools.py:447: error: Unused "type: ignore" comment [unused-ignore]
- pandas/plotting/_matplotlib/tools.py:451: error: Unused "type: ignore" comment [unused-ignore]
- pandas/plotting/_matplotlib/tools.py:463: error: Unused "type: ignore" comment [unused-ignore]
- pandas/plotting/_matplotlib/tools.py:465: error: Unused "type: ignore" comment [unused-ignore]
- pandas/plotting/_matplotlib/tools.py:467: error: Unused "type: ignore" comment [unused-ignore]
- pandas/plotting/_matplotlib/tools.py:469: error: Unused "type: ignore" comment [unused-ignore]
- pandas/plotting/_matplotlib/style.py:305: error: Unused "type: ignore" comment [unused-ignore]
- pandas/plotting/_matplotlib/converter.py:365: error: Unused "type: ignore" comment [unused-ignore]
- pandas/plotting/_matplotlib/converter.py:366: error: Unused "type: ignore" comment [unused-ignore]
- pandas/plotting/_matplotlib/converter.py:368: error: Unused "type: ignore" comment [unused-ignore]
- pandas/plotting/_matplotlib/converter.py:369: error: Unused "type: ignore" comment [unused-ignore]
- pandas/plotting/_matplotlib/converter.py:984: error: Unused "type: ignore" comment [unused-ignore]
- pandas/tests/io/test_sql.py:597: error: Unused "type: ignore" comment [unused-ignore]
- pandas/tests/indexes/test_base.py:1638: error: Unexpected keyword argument "data" for "RangeIndex" [call-arg]
- pandas/core/indexes/range.py:150: note: "RangeIndex" defined here
- pandas/plotting/_matplotlib/timeseries.py:143: error: Unused "type: ignore" comment [unused-ignore]
- pandas/plotting/_matplotlib/timeseries.py:156: error: Unused "type: ignore" comment [unused-ignore]
- pandas/plotting/_matplotlib/timeseries.py:174: error: Unused "type: ignore" comment [unused-ignore]
- pandas/plotting/_matplotlib/timeseries.py:177: error: Unused "type: ignore" comment [unused-ignore]
- pandas/plotting/_matplotlib/timeseries.py:180: error: Unused "type: ignore" comment [unused-ignore]
- pandas/plotting/_matplotlib/core.py:533: error: Unused "type: ignore" comment [unused-ignore]
- pandas/plotting/_matplotlib/core.py:535: error: Unused "type: ignore" comment [unused-ignore]
- pandas/plotting/_matplotlib/core.py:536: error: Unused "type: ignore" comment [unused-ignore]
- pandas/plotting/_matplotlib/core.py:539: error: Unused "type: ignore" comment [unused-ignore]
- pandas/plotting/_matplotlib/core.py:1270: error: Unused "type: ignore" comment [unused-ignore]
- pandas/plotting/_matplotlib/core.py:1271: error: Unused "type: ignore" comment [unused-ignore]
... (truncated 23 lines) ...
alectryon (https://github.com/cpitclaudel/alectryon)
- alectryon/markers.py:100: error: Need type annotation for "QUERY_SHAPE" [var-annotated]
+ alectryon/markers.py:99: error: Need type annotation for "QUERY_SHAPE" [var-annotated]
- alectryon/core.py:425: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
+ alectryon/core.py:424: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
- alectryon/core.py:454: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
... (truncated 1852 lines) ...```
Diff from mypy_primer, showing the effect of this PR on open source code:
spark (https://github.com/apache/spark)
+ python/pyspark/pandas/supported_api_gen.py:398: SyntaxWarning: invalid escape sequence '\_'
+ return func_str[:-1] + "\_" # noqa: W605
sockeye (https://github.com/awslabs/sockeye)
+ sockeye/layers.py:642: error: Unused "type: ignore" comment [unused-ignore]
steam.py (https://github.com/Gobot1234/steam.py): 12.10x faster (44.1s -> 3.6s in a single noisy sample)
+ steam/utils.py:143: error: f-string: expecting a valid expression after '{' [syntax]
- steam/types/trade.py:69: error: Overwriting TypedDict field "instanceid" while merging [misc]
- steam/types/trade.py:69: error: Overwriting TypedDict field "classid" while merging [misc]
- steam/types/trade.py:112: error: Overwriting TypedDict field "assetid" while merging [misc]
- steam/types/trade.py:112: error: Overwriting TypedDict field "amount" while merging [misc]
- steam/types/trade.py:112: error: Overwriting TypedDict field "appid" while merging [misc]
- steam/types/trade.py:112: error: Overwriting TypedDict field "contextid" while merging [misc]
- steam/types/trade.py:112: error: Overwriting TypedDict field "instanceid" while merging [misc]
- steam/types/trade.py:112: error: Overwriting TypedDict field "classid" while merging [misc]
- steam/types/trade.py:112: error: Overwriting TypedDict field "missing" while merging [misc]
- steam/types/vdf.py:31: error: Incompatible return value type (implicitly returns "None", expected "Never") [empty-body]
- steam/types/vdf.py:33: error: Incompatible return value type (implicitly returns "None", expected "Never") [empty-body]
- steam/types/manifest.py:67: error: Duplicate TypedDict key "review_percentage" [misc]
- steam/types/manifest.py:68: error: Duplicate TypedDict key "review_score" [misc]
- steam/types/manifest.py:71: error: Duplicate TypedDict key "steam_release_date" [misc]
- steam/types/manifest.py:73: error: Duplicate TypedDict key "store_tags" [misc]
- steam/_const.py:29: error: Module "steam.clan" has no attribute "Clan" [attr-defined]
- steam/_const.py:30: error: Module "steam.group" has no attribute "Group" [attr-defined]
- steam/_const.py:37: error: Unused "type: ignore" comment [unused-ignore]
- steam/_const.py:57: error: Unused "type: ignore" comment [unused-ignore]
- steam/_const.py:69: error: Unused "type: ignore" comment [unused-ignore]
- steam/_const.py:73: error: Function is missing a return type annotation [no-untyped-def]
- steam/_const.py:73: error: Function is missing a type annotation for one or more arguments [no-untyped-def]
- steam/_const.py:75: error: Unused "type: ignore" comment [unused-ignore]
- steam/_const.py:90: error: Unused "type: ignore" comment [unused-ignore]
- steam/_const.py:100: error: Unused "type: ignore" comment [unused-ignore]
- steam/_const.py:109: error: Unused "type: ignore" comment [unused-ignore]
- steam/_const.py:110: error: Unused "type: ignore" comment [unused-ignore]
- steam/_const.py:118: error: Unused "type: ignore" comment [unused-ignore]
- steam/_const.py:146: error: Invalid base class [misc]
- steam/_const.py:194: error: Cannot assign to a method [method-assign]
- steam/_const.py:194: error: Incompatible types in assignment (expression has type "Callable[[_IDComparable, object], bool]", variable has type "Callable[[object, object], bool]") [assignment]
- steam/_const.py:195: error: Cannot assign to a method [method-assign]
- steam/_const.py:195: error: Incompatible types in assignment (expression has type "Callable[[_IDComparable], int]", variable has type "Callable[[object], int]") [assignment]
- steam/types/user.py:16: error: Module "steam.user" has no attribute "User" [attr-defined]
- steam/types/user.py:139: error: Cannot resolve name "Author" (possible cyclic definition) [misc]
- steam/types/user.py:143: error: Parameter 1 of Literal[...] is invalid [valid-type]
- steam/invite.py:16: error: Module "steam.clan" has no attribute "Clan" [attr-defined]
- steam/invite.py:19: error: Module "steam.group" has no attribute "Group" [attr-defined]
- steam/invite.py:21: error: Module "steam.user" has no attribute "User" [attr-defined]
- steam/invite.py:90: error: Attributes without a default cannot follow attributes with one [misc]
- steam/invite.py:109: error: Attributes without a default cannot follow attributes with one [misc]
- steam/invite.py:118: error: Cannot resolve name "ChatGroupInvite" (possible cyclic definition) [misc]
- steam/invite.py:134: error: Call to abstract method "accept" of "_Invite" with trivial body via super() is unsafe [safe-super]
- steam/enums.py:98: error: Function is missing a return type annotation [no-untyped-def]
- steam/enums.py:98: note: Use "-> None" if function does not return a value
- steam/enums.py:106: error: Invalid base class [misc]
- steam/enums.py:108: error: Unused "type: ignore" comment [unused-ignore]
- steam/enums.py:111: error: Unused "type: ignore" comment [unused-ignore]
- steam/enums.py:124: error: Unused "type: ignore" comment [unused-ignore]
- steam/enums.py:181: error: Invalid base class [misc]
- steam/enums.py:198: error: Unused "type: ignore" comment [unused-ignore]
- steam/enums.py:247: error: Unused "type: ignore" comment [unused-ignore]
- steam/enums.py:635: error: Unused "type: ignore" comment [unused-ignore]
- steam/enums.py:638: error: Dict entry 0 has incompatible type "int": "str"; expected "Language": "str" [dict-item]
- steam/enums.py:639: error: Dict entry 1 has incompatible type "int": "str"; expected "Language": "str" [dict-item]
- steam/enums.py:640: error: Dict entry 2 has incompatible type "int": "str"; expected "Language": "str" [dict-item]
- steam/enums.py:641: error: Dict entry 3 has incompatible type "int": "str"; expected "Language": "str" [dict-item]
- steam/enums.py:642: error: Dict entry 4 has incompatible type "int": "str"; expected "Language": "str" [dict-item]
- steam/enums.py:643: error: Dict entry 5 has incompatible type "int": "str"; expected "Language": "str" [dict-item]
- steam/enums.py:644: error: Dict entry 6 has incompatible type "int": "str"; expected "Language": "str" [dict-item]
- steam/enums.py:645: error: Dict entry 7 has incompatible type "int": "str"; expected "Language": "str" [dict-item]
- steam/enums.py:646: error: Dict entry 8 has incompatible type "int": "str"; expected "Language": "str" [dict-item]
- steam/enums.py:647: error: Dict entry 9 has incompatible type "int": "str"; expected "Language": "str" [dict-item]
- steam/enums.py:648: error: Dict entry 10 has incompatible type "int": "str"; expected "Language": "str" [dict-item]
- steam/enums.py:649: error: Dict entry 11 has incompatible type "int": "str"; expected "Language": "str" [dict-item]
- steam/enums.py:650: error: Dict entry 12 has incompatible type "int": "str"; expected "Language": "str" [dict-item]
- steam/enums.py:651: error: Dict entry 13 has incompatible type "int": "str"; expected "Language": "str" [dict-item]
- steam/enums.py:652: error: Dict entry 14 has incompatible type "int": "str"; expected "Language": "str" [dict-item]
- steam/enums.py:653: error: Dict entry 15 has incompatible type "int": "str"; expected "Language": "str" [dict-item]
- steam/enums.py:654: error: Dict entry 16 has incompatible type "int": "str"; expected "Language": "str" [dict-item]
- steam/enums.py:655: error: Dict entry 17 has incompatible type "int": "str"; expected "Language": "str" [dict-item]
- steam/enums.py:656: error: Dict entry 18 has incompatible type "int": "str"; expected "Language": "str" [dict-item]
- steam/enums.py:657: error: Dict entry 19 has incompatible type "int": "str"; expected "Language": "str" [dict-item]
- steam/enums.py:658: error: Dict entry 20 has incompatible type "int": "str"; expected "Language": "str" [dict-item]
- steam/enums.py:659: error: Dict entry 21 has incompatible type "int": "str"; expected "Language": "str" [dict-item]
- steam/enums.py:660: error: Dict entry 22 has incompatible type "int": "str"; expected "Language": "str" [dict-item]
- steam/enums.py:661: error: Dict entry 23 has incompatible type "int": "str"; expected "Language": "str" [dict-item]
- steam/enums.py:662: error: Dict entry 24 has incompatible type "int": "str"; expected "Language": "str" [dict-item]
- steam/enums.py:663: error: Dict entry 25 has incompatible type "int": "str"; expected "Language": "str" [dict-item]
- steam/enums.py:664: error: Dict entry 26 has incompatible type "int": "str"; expected "Language": "str" [dict-item]
- steam/enums.py:665: error: Dict entry 27 has incompatible type "int": "str"; expected "Language": "str" [dict-item]
- steam/enums.py:666: error: Dict entry 28 has incompatible type "int": "str"; expected "Language": "str" [dict-item]
- steam/enums.py:670: error: Unused "type: ignore" comment [unused-ignore]
- steam/enums.py:673: error: Dict entry 0 has incompatible type "int": "str"; expected "Language": "str" [dict-item]
- steam/enums.py:674: error: Dict entry 1 has incompatible type "int": "str"; expected "Language": "str" [dict-item]
- steam/enums.py:675: error: Dict entry 2 has incompatible type "int": "str"; expected "Language": "str" [dict-item]
- steam/enums.py:676: error: Dict entry 3 has incompatible type "int": "str"; expected "Language": "str" [dict-item]
- steam/enums.py:677: error: Dict entry 4 has incompatible type "int": "str"; expected "Language": "str" [dict-item]
- steam/enums.py:678: error: Dict entry 5 has incompatible type "int": "str"; expected "Language": "str" [dict-item]
- steam/enums.py:679: error: Dict entry 6 has incompatible type "int": "str"; expected "Language": "str" [dict-item]
- steam/enums.py:680: error: Dict entry 7 has incompatible type "int": "str"; expected "Language": "str" [dict-item]
- steam/enums.py:681: error: Dict entry 8 has incompatible type "int": "str"; expected "Language": "str" [dict-item]
- steam/enums.py:682: error: Dict entry 9 has incompatible type "int": "str"; expected "Language": "str" [dict-item]
- steam/enums.py:683: error: Dict entry 10 has incompatible type "int": "str"; expected "Language": "str" [dict-item]
- steam/enums.py:684: error: Dict entry 11 has incompatible type "int": "str"; expected "Language": "str" [dict-item]
... (truncated 1173 lines) ...
core (https://github.com/home-assistant/core): 5.78x faster (313.6s -> 54.3s in a single noisy sample)
+ Warning: unused section(s) in mypy.ini: [mypy-homeassistant.core], [mypy-homeassistant.exceptions], [mypy-homeassistant.helpers.area_registry], [mypy-homeassistant.helpers.condition], [mypy-homeassistant.helpers.debounce], [mypy-homeassistant.helpers.deprecation], [mypy-homeassistant.helpers.device_registry], [mypy-homeassistant.helpers.discovery], [mypy-homeassistant.helpers.dispatcher], [mypy-homeassistant.helpers.entity], [mypy-homeassistant.helpers.entity_platform], [mypy-homeassistant.helpers.entity_values], [mypy-homeassistant.helpers.event], [mypy-homeassistant.helpers.reload], [mypy-homeassistant.helpers.script], [mypy-homeassistant.helpers.script_variables], [mypy-homeassistant.helpers.singleton], [mypy-homeassistant.helpers.sun], [mypy-homeassistant.helpers.translation], [mypy-homeassistant.loader], [mypy-homeassistant.requirements], [mypy-homeassistant.runner], [mypy-homeassistant.setup], [mypy-homeassistant.util.async_], [mypy-homeassistant.util.color], [mypy-homeassistant.util.decorator], [mypy-homeassistant.util.location], [mypy-homeassistant.util.logging], [mypy-homeassistant.util.process], [mypy-homeassistant.util.unit_system], [mypy-homeassistant.components.yalexs_ble.*], [mypy-homeassistant.components.youtube.*], [mypy-homeassistant.components.zeroconf.*], [mypy-homeassistant.components.zodiac.*], [mypy-homeassistant.components.zone.*], [mypy-homeassistant.components.zwave_js.*], [mypy-tests.*]
+ homeassistant/components/yale_smart_alarm/lock.py:55: error: f-string: single '}' is not allowed [syntax]
- Warning: unused section(s) in mypy.ini: [mypy-tests.*]
- homeassistant/components/zeroconf/models.py:7: error: Class cannot subclass "Zeroconf" (has type "Any") [misc]
- homeassistant/components/zeroconf/models.py:16: error: Class cannot subclass "AsyncZeroconf" (has type "Any") [misc]
- homeassistant/components/owntracks/helper.py:6: error: Unused "type: ignore" comment [unused-ignore]
- homeassistant/util/ulid.py:44: error: Returning Any from function declared to return "str" [no-any-return]
- homeassistant/components/mqtt/async_client.py:40: error: Class cannot subclass "MQTTClient" (has type "Any") [misc]
- homeassistant/components/http/static.py:21: error: Class cannot subclass "StaticResource" (has type "Any") [misc]
- homeassistant/util/dt.py:116: error: Returning Any from function declared to return "tzinfo | None" [no-any-return]
- homeassistant/util/dt.py:227: error: Returning Any from function declared to return "datetime | None" [no-any-return]
- homeassistant/util/yaml/objects.py:32: error: Unused "type: ignore" comment [unused-ignore]
- homeassistant/util/package.py:82: error: Returning Any from function declared to return "bool" [no-any-return]
- homeassistant/components/http/web_runner.py:12: error: Class cannot subclass "BaseSite" (has type "Any") [misc]
- homeassistant/components/http/web_runner.py:62: error: Trying to assign name "_server" that is not in "__slots__" of type "homeassistant.components.http.web_runner.HomeAssistantTCPSite" [misc]
- homeassistant/components/recorder/table_managers/__init__.py:36: error: Returning Any from function declared to return "int | None" [no-any-return]
- homeassistant/helpers/json.py:175: error: Returning Any from function declared to return "str" [no-any-return]
- homeassistant/helpers/json.py:188: error: Returning Any from function declared to return "bytes" [no-any-return]
- homeassistant/auth/jwt_wrapper.py:29: error: Class cannot subclass "PyJWS" (has type "Any") [misc]
- homeassistant/auth/jwt_wrapper.py:38: error: Returning Any from function declared to return "tuple[bytes, bytes, dict[Any, Any], bytes]" [no-any-return]
- homeassistant/auth/jwt_wrapper.py:56: error: Class cannot subclass "PyJWT" (has type "Any") [misc]
- homeassistant/core.py:358: error: Untyped decorator makes function "job_type" untyped [misc]
- homeassistant/core.py:479: error: Untyped decorator makes function "is_running" untyped [misc]
- homeassistant/core.py:484: error: Untyped decorator makes function "is_stopping" untyped [misc]
- homeassistant/core.py:1277: error: Untyped decorator makes function "_as_dict" untyped [misc]
- homeassistant/core.py:1292: error: Returning Any from function declared to return "ReadOnlyDict[str, str | None]" [no-any-return]
- homeassistant/core.py:1294: error: Untyped decorator makes function "_as_read_only_dict" untyped [misc]
- homeassistant/core.py:1299: error: Untyped decorator makes function "json_fragment" untyped [misc]
- homeassistant/core.py:1300: error: Variable "homeassistant.helpers.json.json_fragment" is not valid as a type [valid-type]
- homeassistant/core.py:1300: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- homeassistant/core.py:1302: error: Returning Any from function declared to return json_fragment? [no-any-return]
- homeassistant/core.py:1315: error: Untyped decorator makes function "idx" untyped [misc]
- homeassistant/core.py:1353: error: Untyped decorator makes function "time_fired" untyped [misc]
- homeassistant/core.py:1358: error: Untyped decorator makes function "_as_dict" untyped [misc]
- homeassistant/core.py:1381: error: Returning Any from function declared to return "ReadOnlyDict[str, Any]" [no-any-return]
- homeassistant/core.py:1383: error: Untyped decorator makes function "_as_read_only_dict" untyped [misc]
- homeassistant/core.py:1399: error: Untyped decorator makes function "json_fragment" untyped [misc]
- homeassistant/core.py:1400: error: Variable "homeassistant.helpers.json.json_fragment" is not valid as a type [valid-type]
- homeassistant/core.py:1400: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- homeassistant/core.py:1402: error: Returning Any from function declared to return json_fragment? [no-any-return]
- homeassistant/core.py:1840: error: Untyped decorator makes function "name" untyped [misc]
- homeassistant/core.py:1847: error: Untyped decorator makes function "last_changed_timestamp" untyped [misc]
- homeassistant/core.py:1852: error: Untyped decorator makes function "last_reported_timestamp" untyped [misc]
- homeassistant/core.py:1857: error: Untyped decorator makes function "_as_dict" untyped [misc]
- homeassistant/core.py:1896: error: Returning Any from function declared to return "ReadOnlyDict[str, datetime | Collection[Any]]" [no-any-return]
- homeassistant/core.py:1898: error: Untyped decorator makes function "_as_read_only_dict" untyped [misc]
- homeassistant/core.py:1913: error: Untyped decorator makes function "as_dict_json" untyped [misc]
- homeassistant/core.py:1918: error: Untyped decorator makes function "json_fragment" untyped [misc]
- homeassistant/core.py:1919: error: Variable "homeassistant.helpers.json.json_fragment" is not valid as a type [valid-type]
- homeassistant/core.py:1919: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- homeassistant/core.py:1921: error: Returning Any from function declared to return json_fragment? [no-any-return]
- homeassistant/core.py:1923: error: Untyped decorator makes function "as_compressed_state" untyped [misc]
- homeassistant/core.py:1951: error: Untyped decorator makes function "as_compressed_state_json" untyped [misc]
- homeassistant/loader.py:781: error: Untyped decorator makes function "manifest_json_fragment" untyped [misc]
- homeassistant/loader.py:782: error: Variable "homeassistant.helpers.json.json_fragment" is not valid as a type [valid-type]
- homeassistant/loader.py:782: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- homeassistant/loader.py:784: error: Returning Any from function declared to return json_fragment? [no-any-return]
- homeassistant/loader.py:786: error: Untyped decorator makes function "name" untyped [misc]
- homeassistant/loader.py:791: error: Untyped decorator makes function "disabled" untyped [misc]
- homeassistant/loader.py:796: error: Untyped decorator makes function "domain" untyped [misc]
- homeassistant/loader.py:801: error: Untyped decorator makes function "dependencies" untyped [misc]
- homeassistant/loader.py:806: error: Untyped decorator makes function "after_dependencies" untyped [misc]
- homeassistant/loader.py:811: error: Untyped decorator makes function "requirements" untyped [misc]
- homeassistant/loader.py:816: error: Untyped decorator makes function "config_flow" untyped [misc]
- homeassistant/loader.py:821: error: Untyped decorator makes function "documentation" untyped [misc]
- homeassistant/loader.py:826: error: Untyped decorator makes function "issue_tracker" untyped [misc]
- homeassistant/loader.py:831: error: Untyped decorator makes function "loggers" untyped [misc]
- homeassistant/loader.py:836: error: Untyped decorator makes function "quality_scale" untyped [misc]
- homeassistant/loader.py:841: error: Untyped decorator makes function "iot_class" untyped [misc]
- homeassistant/loader.py:846: error: Untyped decorator makes function "integration_type" untyped [misc]
- homeassistant/loader.py:855: error: Untyped decorator makes function "import_executor" untyped [misc]
- homeassistant/loader.py:862: error: Untyped decorator makes function "has_translations" untyped [misc]
- homeassistant/loader.py:867: error: Untyped decorator makes function "has_services" untyped [misc]
- homeassistant/loader.py:919: error: Untyped decorator makes function "single_config_entry" untyped [misc]
- homeassistant/loader.py:1709: error: Returning Any from function declared to return "str | None" [no-any-return]
- homeassistant/helpers/start.py:69: error: Returning Any from function declared to return "bool" [no-any-return]
- homeassistant/components/recorder/models/state.py:61: error: Unused "type: ignore" comment [unused-ignore]
... (truncated 1342 lines) ...
Diff from mypy_primer, showing the effect of this PR on open source code:
spark (https://github.com/apache/spark)
+ python/pyspark/pandas/supported_api_gen.py:398: SyntaxWarning: invalid escape sequence '\_'
+ return func_str[:-1] + "\_" # noqa: W605
sockeye (https://github.com/awslabs/sockeye)
+ sockeye/layers.py:642: error: Unused "type: ignore" comment [unused-ignore]
steam.py (https://github.com/Gobot1234/steam.py): 12.27x faster (43.2s -> 3.5s in a single noisy sample)
+ steam/utils.py:143: error: f-string: expecting a valid expression after '{' [syntax]
- steam/types/trade.py:69: error: Overwriting TypedDict field "instanceid" while merging [misc]
- steam/types/trade.py:69: error: Overwriting TypedDict field "classid" while merging [misc]
- steam/types/trade.py:112: error: Overwriting TypedDict field "assetid" while merging [misc]
- steam/types/trade.py:112: error: Overwriting TypedDict field "amount" while merging [misc]
- steam/types/trade.py:112: error: Overwriting TypedDict field "appid" while merging [misc]
- steam/types/trade.py:112: error: Overwriting TypedDict field "contextid" while merging [misc]
- steam/types/trade.py:112: error: Overwriting TypedDict field "instanceid" while merging [misc]
- steam/types/trade.py:112: error: Overwriting TypedDict field "classid" while merging [misc]
- steam/types/trade.py:112: error: Overwriting TypedDict field "missing" while merging [misc]
- steam/types/vdf.py:31: error: Incompatible return value type (implicitly returns "None", expected "Never") [empty-body]
- steam/types/vdf.py:33: error: Incompatible return value type (implicitly returns "None", expected "Never") [empty-body]
- steam/types/manifest.py:67: error: Duplicate TypedDict key "review_percentage" [misc]
- steam/types/manifest.py:68: error: Duplicate TypedDict key "review_score" [misc]
- steam/types/manifest.py:71: error: Duplicate TypedDict key "steam_release_date" [misc]
- steam/types/manifest.py:73: error: Duplicate TypedDict key "store_tags" [misc]
- steam/_const.py:29: error: Module "steam.clan" has no attribute "Clan" [attr-defined]
- steam/_const.py:30: error: Module "steam.group" has no attribute "Group" [attr-defined]
- steam/_const.py:37: error: Unused "type: ignore" comment [unused-ignore]
- steam/_const.py:57: error: Unused "type: ignore" comment [unused-ignore]
- steam/_const.py:69: error: Unused "type: ignore" comment [unused-ignore]
- steam/_const.py:73: error: Function is missing a return type annotation [no-untyped-def]
- steam/_const.py:73: error: Function is missing a type annotation for one or more arguments [no-untyped-def]
- steam/_const.py:75: error: Unused "type: ignore" comment [unused-ignore]
- steam/_const.py:90: error: Unused "type: ignore" comment [unused-ignore]
- steam/_const.py:100: error: Unused "type: ignore" comment [unused-ignore]
- steam/_const.py:109: error: Unused "type: ignore" comment [unused-ignore]
- steam/_const.py:110: error: Unused "type: ignore" comment [unused-ignore]
- steam/_const.py:118: error: Unused "type: ignore" comment [unused-ignore]
- steam/_const.py:146: error: Invalid base class [misc]
- steam/_const.py:194: error: Cannot assign to a method [method-assign]
- steam/_const.py:194: error: Incompatible types in assignment (expression has type "Callable[[_IDComparable, object], bool]", variable has type "Callable[[object, object], bool]") [assignment]
- steam/_const.py:195: error: Cannot assign to a method [method-assign]
- steam/_const.py:195: error: Incompatible types in assignment (expression has type "Callable[[_IDComparable], int]", variable has type "Callable[[object], int]") [assignment]
- steam/types/user.py:16: error: Module "steam.user" has no attribute "User" [attr-defined]
- steam/types/user.py:139: error: Cannot resolve name "Author" (possible cyclic definition) [misc]
- steam/types/user.py:143: error: Parameter 1 of Literal[...] is invalid [valid-type]
- steam/invite.py:16: error: Module "steam.clan" has no attribute "Clan" [attr-defined]
- steam/invite.py:19: error: Module "steam.group" has no attribute "Group" [attr-defined]
- steam/invite.py:21: error: Module "steam.user" has no attribute "User" [attr-defined]
- steam/invite.py:90: error: Attributes without a default cannot follow attributes with one [misc]
- steam/invite.py:109: error: Attributes without a default cannot follow attributes with one [misc]
- steam/invite.py:118: error: Cannot resolve name "ChatGroupInvite" (possible cyclic definition) [misc]
- steam/invite.py:134: error: Call to abstract method "accept" of "_Invite" with trivial body via super() is unsafe [safe-super]
- steam/enums.py:98: error: Function is missing a return type annotation [no-untyped-def]
- steam/enums.py:98: note: Use "-> None" if function does not return a value
- steam/enums.py:106: error: Invalid base class [misc]
- steam/enums.py:108: error: Unused "type: ignore" comment [unused-ignore]
- steam/enums.py:111: error: Unused "type: ignore" comment [unused-ignore]
- steam/enums.py:124: error: Unused "type: ignore" comment [unused-ignore]
- steam/enums.py:181: error: Invalid base class [misc]
- steam/enums.py:198: error: Unused "type: ignore" comment [unused-ignore]
- steam/enums.py:247: error: Unused "type: ignore" comment [unused-ignore]
- steam/enums.py:635: error: Unused "type: ignore" comment [unused-ignore]
- steam/enums.py:638: error: Dict entry 0 has incompatible type "int": "str"; expected "Language": "str" [dict-item]
- steam/enums.py:639: error: Dict entry 1 has incompatible type "int": "str"; expected "Language": "str" [dict-item]
- steam/enums.py:640: error: Dict entry 2 has incompatible type "int": "str"; expected "Language": "str" [dict-item]
- steam/enums.py:641: error: Dict entry 3 has incompatible type "int": "str"; expected "Language": "str" [dict-item]
- steam/enums.py:642: error: Dict entry 4 has incompatible type "int": "str"; expected "Language": "str" [dict-item]
- steam/enums.py:643: error: Dict entry 5 has incompatible type "int": "str"; expected "Language": "str" [dict-item]
- steam/enums.py:644: error: Dict entry 6 has incompatible type "int": "str"; expected "Language": "str" [dict-item]
- steam/enums.py:645: error: Dict entry 7 has incompatible type "int": "str"; expected "Language": "str" [dict-item]
- steam/enums.py:646: error: Dict entry 8 has incompatible type "int": "str"; expected "Language": "str" [dict-item]
- steam/enums.py:647: error: Dict entry 9 has incompatible type "int": "str"; expected "Language": "str" [dict-item]
- steam/enums.py:648: error: Dict entry 10 has incompatible type "int": "str"; expected "Language": "str" [dict-item]
- steam/enums.py:649: error: Dict entry 11 has incompatible type "int": "str"; expected "Language": "str" [dict-item]
- steam/enums.py:650: error: Dict entry 12 has incompatible type "int": "str"; expected "Language": "str" [dict-item]
- steam/enums.py:651: error: Dict entry 13 has incompatible type "int": "str"; expected "Language": "str" [dict-item]
- steam/enums.py:652: error: Dict entry 14 has incompatible type "int": "str"; expected "Language": "str" [dict-item]
- steam/enums.py:653: error: Dict entry 15 has incompatible type "int": "str"; expected "Language": "str" [dict-item]
- steam/enums.py:654: error: Dict entry 16 has incompatible type "int": "str"; expected "Language": "str" [dict-item]
- steam/enums.py:655: error: Dict entry 17 has incompatible type "int": "str"; expected "Language": "str" [dict-item]
- steam/enums.py:656: error: Dict entry 18 has incompatible type "int": "str"; expected "Language": "str" [dict-item]
- steam/enums.py:657: error: Dict entry 19 has incompatible type "int": "str"; expected "Language": "str" [dict-item]
- steam/enums.py:658: error: Dict entry 20 has incompatible type "int": "str"; expected "Language": "str" [dict-item]
- steam/enums.py:659: error: Dict entry 21 has incompatible type "int": "str"; expected "Language": "str" [dict-item]
- steam/enums.py:660: error: Dict entry 22 has incompatible type "int": "str"; expected "Language": "str" [dict-item]
- steam/enums.py:661: error: Dict entry 23 has incompatible type "int": "str"; expected "Language": "str" [dict-item]
- steam/enums.py:662: error: Dict entry 24 has incompatible type "int": "str"; expected "Language": "str" [dict-item]
- steam/enums.py:663: error: Dict entry 25 has incompatible type "int": "str"; expected "Language": "str" [dict-item]
- steam/enums.py:664: error: Dict entry 26 has incompatible type "int": "str"; expected "Language": "str" [dict-item]
- steam/enums.py:665: error: Dict entry 27 has incompatible type "int": "str"; expected "Language": "str" [dict-item]
- steam/enums.py:666: error: Dict entry 28 has incompatible type "int": "str"; expected "Language": "str" [dict-item]
- steam/enums.py:670: error: Unused "type: ignore" comment [unused-ignore]
- steam/enums.py:673: error: Dict entry 0 has incompatible type "int": "str"; expected "Language": "str" [dict-item]
- steam/enums.py:674: error: Dict entry 1 has incompatible type "int": "str"; expected "Language": "str" [dict-item]
- steam/enums.py:675: error: Dict entry 2 has incompatible type "int": "str"; expected "Language": "str" [dict-item]
- steam/enums.py:676: error: Dict entry 3 has incompatible type "int": "str"; expected "Language": "str" [dict-item]
- steam/enums.py:677: error: Dict entry 4 has incompatible type "int": "str"; expected "Language": "str" [dict-item]
- steam/enums.py:678: error: Dict entry 5 has incompatible type "int": "str"; expected "Language": "str" [dict-item]
- steam/enums.py:679: error: Dict entry 6 has incompatible type "int": "str"; expected "Language": "str" [dict-item]
- steam/enums.py:680: error: Dict entry 7 has incompatible type "int": "str"; expected "Language": "str" [dict-item]
- steam/enums.py:681: error: Dict entry 8 has incompatible type "int": "str"; expected "Language": "str" [dict-item]
- steam/enums.py:682: error: Dict entry 9 has incompatible type "int": "str"; expected "Language": "str" [dict-item]
- steam/enums.py:683: error: Dict entry 10 has incompatible type "int": "str"; expected "Language": "str" [dict-item]
- steam/enums.py:684: error: Dict entry 11 has incompatible type "int": "str"; expected "Language": "str" [dict-item]
... (truncated 1173 lines) ...
core (https://github.com/home-assistant/core): 6.32x faster (301.8s -> 47.8s in a single noisy sample)
+ Warning: unused section(s) in mypy.ini: [mypy-homeassistant.core], [mypy-homeassistant.exceptions], [mypy-homeassistant.helpers.area_registry], [mypy-homeassistant.helpers.condition], [mypy-homeassistant.helpers.debounce], [mypy-homeassistant.helpers.deprecation], [mypy-homeassistant.helpers.device_registry], [mypy-homeassistant.helpers.discovery], [mypy-homeassistant.helpers.dispatcher], [mypy-homeassistant.helpers.entity], [mypy-homeassistant.helpers.entity_platform], [mypy-homeassistant.helpers.entity_values], [mypy-homeassistant.helpers.event], [mypy-homeassistant.helpers.reload], [mypy-homeassistant.helpers.script], [mypy-homeassistant.helpers.script_variables], [mypy-homeassistant.helpers.singleton], [mypy-homeassistant.helpers.sun], [mypy-homeassistant.helpers.translation], [mypy-homeassistant.loader], [mypy-homeassistant.requirements], [mypy-homeassistant.runner], [mypy-homeassistant.setup], [mypy-homeassistant.util.async_], [mypy-homeassistant.util.color], [mypy-homeassistant.util.decorator], [mypy-homeassistant.util.location], [mypy-homeassistant.util.logging], [mypy-homeassistant.util.process], [mypy-homeassistant.util.unit_system], [mypy-homeassistant.components.yalexs_ble.*], [mypy-homeassistant.components.youtube.*], [mypy-homeassistant.components.zeroconf.*], [mypy-homeassistant.components.zodiac.*], [mypy-homeassistant.components.zone.*], [mypy-homeassistant.components.zwave_js.*], [mypy-tests.*]
+ homeassistant/components/yale_smart_alarm/lock.py:55: error: f-string: single '}' is not allowed [syntax]
- Warning: unused section(s) in mypy.ini: [mypy-tests.*]
- homeassistant/components/zeroconf/models.py:7: error: Class cannot subclass "Zeroconf" (has type "Any") [misc]
- homeassistant/components/zeroconf/models.py:16: error: Class cannot subclass "AsyncZeroconf" (has type "Any") [misc]
- homeassistant/components/owntracks/helper.py:6: error: Unused "type: ignore" comment [unused-ignore]
- homeassistant/util/ulid.py:44: error: Returning Any from function declared to return "str" [no-any-return]
- homeassistant/components/mqtt/async_client.py:40: error: Class cannot subclass "MQTTClient" (has type "Any") [misc]
- homeassistant/components/http/static.py:21: error: Class cannot subclass "StaticResource" (has type "Any") [misc]
- homeassistant/util/dt.py:116: error: Returning Any from function declared to return "tzinfo | None" [no-any-return]
- homeassistant/util/dt.py:227: error: Returning Any from function declared to return "datetime | None" [no-any-return]
- homeassistant/util/yaml/objects.py:32: error: Unused "type: ignore" comment [unused-ignore]
- homeassistant/util/package.py:82: error: Returning Any from function declared to return "bool" [no-any-return]
- homeassistant/components/http/web_runner.py:12: error: Class cannot subclass "BaseSite" (has type "Any") [misc]
- homeassistant/components/http/web_runner.py:62: error: Trying to assign name "_server" that is not in "__slots__" of type "homeassistant.components.http.web_runner.HomeAssistantTCPSite" [misc]
- homeassistant/components/recorder/table_managers/__init__.py:36: error: Returning Any from function declared to return "int | None" [no-any-return]
- homeassistant/helpers/json.py:175: error: Returning Any from function declared to return "str" [no-any-return]
- homeassistant/helpers/json.py:188: error: Returning Any from function declared to return "bytes" [no-any-return]
- homeassistant/auth/jwt_wrapper.py:29: error: Class cannot subclass "PyJWS" (has type "Any") [misc]
- homeassistant/auth/jwt_wrapper.py:38: error: Returning Any from function declared to return "tuple[bytes, bytes, dict[Any, Any], bytes]" [no-any-return]
- homeassistant/auth/jwt_wrapper.py:56: error: Class cannot subclass "PyJWT" (has type "Any") [misc]
- homeassistant/core.py:358: error: Untyped decorator makes function "job_type" untyped [misc]
- homeassistant/core.py:479: error: Untyped decorator makes function "is_running" untyped [misc]
- homeassistant/core.py:484: error: Untyped decorator makes function "is_stopping" untyped [misc]
- homeassistant/core.py:1277: error: Untyped decorator makes function "_as_dict" untyped [misc]
- homeassistant/core.py:1292: error: Returning Any from function declared to return "ReadOnlyDict[str, str | None]" [no-any-return]
- homeassistant/core.py:1294: error: Untyped decorator makes function "_as_read_only_dict" untyped [misc]
- homeassistant/core.py:1299: error: Untyped decorator makes function "json_fragment" untyped [misc]
- homeassistant/core.py:1300: error: Variable "homeassistant.helpers.json.json_fragment" is not valid as a type [valid-type]
- homeassistant/core.py:1300: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- homeassistant/core.py:1302: error: Returning Any from function declared to return json_fragment? [no-any-return]
- homeassistant/core.py:1315: error: Untyped decorator makes function "idx" untyped [misc]
- homeassistant/core.py:1353: error: Untyped decorator makes function "time_fired" untyped [misc]
- homeassistant/core.py:1358: error: Untyped decorator makes function "_as_dict" untyped [misc]
- homeassistant/core.py:1381: error: Returning Any from function declared to return "ReadOnlyDict[str, Any]" [no-any-return]
- homeassistant/core.py:1383: error: Untyped decorator makes function "_as_read_only_dict" untyped [misc]
- homeassistant/core.py:1399: error: Untyped decorator makes function "json_fragment" untyped [misc]
- homeassistant/core.py:1400: error: Variable "homeassistant.helpers.json.json_fragment" is not valid as a type [valid-type]
- homeassistant/core.py:1400: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- homeassistant/core.py:1402: error: Returning Any from function declared to return json_fragment? [no-any-return]
- homeassistant/core.py:1840: error: Untyped decorator makes function "name" untyped [misc]
- homeassistant/core.py:1847: error: Untyped decorator makes function "last_changed_timestamp" untyped [misc]
- homeassistant/core.py:1852: error: Untyped decorator makes function "last_reported_timestamp" untyped [misc]
- homeassistant/core.py:1857: error: Untyped decorator makes function "_as_dict" untyped [misc]
- homeassistant/core.py:1896: error: Returning Any from function declared to return "ReadOnlyDict[str, datetime | Collection[Any]]" [no-any-return]
- homeassistant/core.py:1898: error: Untyped decorator makes function "_as_read_only_dict" untyped [misc]
- homeassistant/core.py:1913: error: Untyped decorator makes function "as_dict_json" untyped [misc]
- homeassistant/core.py:1918: error: Untyped decorator makes function "json_fragment" untyped [misc]
- homeassistant/core.py:1919: error: Variable "homeassistant.helpers.json.json_fragment" is not valid as a type [valid-type]
- homeassistant/core.py:1919: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- homeassistant/core.py:1921: error: Returning Any from function declared to return json_fragment? [no-any-return]
- homeassistant/core.py:1923: error: Untyped decorator makes function "as_compressed_state" untyped [misc]
- homeassistant/core.py:1951: error: Untyped decorator makes function "as_compressed_state_json" untyped [misc]
- homeassistant/loader.py:781: error: Untyped decorator makes function "manifest_json_fragment" untyped [misc]
- homeassistant/loader.py:782: error: Variable "homeassistant.helpers.json.json_fragment" is not valid as a type [valid-type]
- homeassistant/loader.py:782: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- homeassistant/loader.py:784: error: Returning Any from function declared to return json_fragment? [no-any-return]
- homeassistant/loader.py:786: error: Untyped decorator makes function "name" untyped [misc]
- homeassistant/loader.py:791: error: Untyped decorator makes function "disabled" untyped [misc]
- homeassistant/loader.py:796: error: Untyped decorator makes function "domain" untyped [misc]
- homeassistant/loader.py:801: error: Untyped decorator makes function "dependencies" untyped [misc]
- homeassistant/loader.py:806: error: Untyped decorator makes function "after_dependencies" untyped [misc]
- homeassistant/loader.py:811: error: Untyped decorator makes function "requirements" untyped [misc]
- homeassistant/loader.py:816: error: Untyped decorator makes function "config_flow" untyped [misc]
- homeassistant/loader.py:821: error: Untyped decorator makes function "documentation" untyped [misc]
- homeassistant/loader.py:826: error: Untyped decorator makes function "issue_tracker" untyped [misc]
- homeassistant/loader.py:831: error: Untyped decorator makes function "loggers" untyped [misc]
- homeassistant/loader.py:836: error: Untyped decorator makes function "quality_scale" untyped [misc]
- homeassistant/loader.py:841: error: Untyped decorator makes function "iot_class" untyped [misc]
- homeassistant/loader.py:846: error: Untyped decorator makes function "integration_type" untyped [misc]
- homeassistant/loader.py:855: error: Untyped decorator makes function "import_executor" untyped [misc]
- homeassistant/loader.py:862: error: Untyped decorator makes function "has_translations" untyped [misc]
- homeassistant/loader.py:867: error: Untyped decorator makes function "has_services" untyped [misc]
- homeassistant/loader.py:919: error: Untyped decorator makes function "single_config_entry" untyped [misc]
- homeassistant/loader.py:1709: error: Returning Any from function declared to return "str | None" [no-any-return]
- homeassistant/helpers/start.py:69: error: Returning Any from function declared to return "bool" [no-any-return]
- homeassistant/components/recorder/models/state.py:61: error: Unused "type: ignore" comment [unused-ignore]
... (truncated 1342 lines) ...
We do a lil "finding out there are bugs in 3.8 tokenize" https://bugs.python.org/issue35107
I plan to just include a more recent copy of tokenize here; note to self that I will have to mention this in the copyright file (along with the several other files that have special copyright status)
Looks like 3 weeks ago they dropped support for 3.8, as was under discussion last time I was thinking about this project. I've successfully procrastinated my way out of another constraint!
Diff from mypy_primer, showing the effect of this PR on open source code:
rotki (https://github.com/rotki/rotki): 2.19x slower (8.4s -> 18.4s in a single noisy sample)
spark (https://github.com/apache/spark)
+ python/pyspark/pandas/supported_api_gen.py:398: SyntaxWarning: invalid escape sequence '\_'
+ return func_str[:-1] + "\_" # noqa: W605
sockeye (https://github.com/awslabs/sockeye)
+ sockeye/layers.py:642: error: Unused "type: ignore" comment [unused-ignore]
schemathesis (https://github.com/schemathesis/schemathesis)
- File "/tmp/mypy_primer/old_mypy/venv/bin/mypy", line 8, in <module>
+ File "/tmp/mypy_primer/new_mypy/venv/bin/mypy", line 8, in <module>
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.12/site-packages/mypy/__main__.py", line 15, in console_entry
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.12/site-packages/mypy/__main__.py", line 15, in console_entry
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.12/site-packages/mypy/main.py", line 119, in main
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.12/site-packages/mypy/main.py", line 119, in main
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.12/site-packages/mypy/main.py", line 203, in run_build
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.12/site-packages/mypy/main.py", line 203, in run_build
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.12/site-packages/mypy/build.py", line 191, in build
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.12/site-packages/mypy/build.py", line 191, in build
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.12/site-packages/mypy/build.py", line 267, in _build
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.12/site-packages/mypy/build.py", line 267, in _build
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.12/site-packages/mypy/build.py", line 2947, in dispatch
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.12/site-packages/mypy/build.py", line 2947, in dispatch
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.12/site-packages/mypy/build.py", line 976, in write_deps_cache
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.12/site-packages/mypy/build.py", line 976, in write_deps_cache
Well, that mypy_primer diff seems, I dunno, fine. Time to finalize this adventure.
Diff from mypy_primer, showing the effect of this PR on open source code:
spark (https://github.com/apache/spark)
+ python/pyspark/pandas/supported_api_gen.py:398: SyntaxWarning: invalid escape sequence '\_'
+ return func_str[:-1] + "\_" # noqa: W605
sockeye (https://github.com/awslabs/sockeye)
+ sockeye/layers.py:642: error: Unused "type: ignore" comment [unused-ignore]
schemathesis (https://github.com/schemathesis/schemathesis)
- File "/tmp/mypy_primer/old_mypy/venv/bin/mypy", line 8, in <module>
+ File "/tmp/mypy_primer/new_mypy/venv/bin/mypy", line 8, in <module>
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.12/site-packages/mypy/__main__.py", line 15, in console_entry
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.12/site-packages/mypy/__main__.py", line 15, in console_entry
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.12/site-packages/mypy/main.py", line 119, in main
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.12/site-packages/mypy/main.py", line 119, in main
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.12/site-packages/mypy/main.py", line 203, in run_build
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.12/site-packages/mypy/main.py", line 203, in run_build
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.12/site-packages/mypy/build.py", line 191, in build
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.12/site-packages/mypy/build.py", line 191, in build
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.12/site-packages/mypy/build.py", line 267, in _build
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.12/site-packages/mypy/build.py", line 267, in _build
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.12/site-packages/mypy/build.py", line 2947, in dispatch
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.12/site-packages/mypy/build.py", line 2947, in dispatch
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.12/site-packages/mypy/build.py", line 976, in write_deps_cache
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.12/site-packages/mypy/build.py", line 976, in write_deps_cache
Diff from mypy_primer, showing the effect of this PR on open source code:
spark (https://github.com/apache/spark)
+ python/pyspark/pandas/supported_api_gen.py:398: SyntaxWarning: invalid escape sequence '\_'
+ return func_str[:-1] + "\_" # noqa: W605
sockeye (https://github.com/awslabs/sockeye)
+ sockeye/layers.py:642: error: Unused "type: ignore" comment [unused-ignore]
schemathesis (https://github.com/schemathesis/schemathesis)
- File "/tmp/mypy_primer/old_mypy/venv/bin/mypy", line 8, in <module>
+ File "/tmp/mypy_primer/new_mypy/venv/bin/mypy", line 8, in <module>
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.12/site-packages/mypy/__main__.py", line 15, in console_entry
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.12/site-packages/mypy/__main__.py", line 15, in console_entry
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.12/site-packages/mypy/main.py", line 119, in main
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.12/site-packages/mypy/main.py", line 119, in main
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.12/site-packages/mypy/main.py", line 203, in run_build
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.12/site-packages/mypy/main.py", line 203, in run_build
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.12/site-packages/mypy/build.py", line 191, in build
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.12/site-packages/mypy/build.py", line 191, in build
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.12/site-packages/mypy/build.py", line 267, in _build
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.12/site-packages/mypy/build.py", line 267, in _build
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.12/site-packages/mypy/build.py", line 2947, in dispatch
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.12/site-packages/mypy/build.py", line 2947, in dispatch
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.12/site-packages/mypy/build.py", line 976, in write_deps_cache
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.12/site-packages/mypy/build.py", line 976, in write_deps_cache
Diff from mypy_primer, showing the effect of this PR on open source code:
spark (https://github.com/apache/spark)
+ python/pyspark/pandas/supported_api_gen.py:398: SyntaxWarning: invalid escape sequence '\_'
+ return func_str[:-1] + "\_" # noqa: W605
sockeye (https://github.com/awslabs/sockeye)
+ sockeye/layers.py:642: error: Unused "type: ignore" comment [unused-ignore]
schemathesis (https://github.com/schemathesis/schemathesis)
- File "/tmp/mypy_primer/old_mypy/venv/bin/mypy", line 8, in <module>
+ File "/tmp/mypy_primer/new_mypy/venv/bin/mypy", line 8, in <module>
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.12/site-packages/mypy/__main__.py", line 15, in console_entry
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.12/site-packages/mypy/__main__.py", line 15, in console_entry
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.12/site-packages/mypy/main.py", line 119, in main
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.12/site-packages/mypy/main.py", line 119, in main
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.12/site-packages/mypy/main.py", line 203, in run_build
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.12/site-packages/mypy/main.py", line 203, in run_build
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.12/site-packages/mypy/build.py", line 191, in build
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.12/site-packages/mypy/build.py", line 191, in build
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.12/site-packages/mypy/build.py", line 267, in _build
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.12/site-packages/mypy/build.py", line 267, in _build
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.12/site-packages/mypy/build.py", line 2947, in dispatch
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.12/site-packages/mypy/build.py", line 2947, in dispatch
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.12/site-packages/mypy/build.py", line 976, in write_deps_cache
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.12/site-packages/mypy/build.py", line 976, in write_deps_cache
I'm worried that this approach will have a significant performance impact, especially when using a compiled mypy. It would be nice to see some performance measurements, especially when importing a large 3rd party package such as torch where parsing is a bottleneck.
I have a medium/long term plan to move away from using the ast module for parsing, and this would make it possible to support mypy: ignore without any performance impact.
@JukkaL That's a very reasonable concern. I myself anticipated there might be some performance hit, and was surprised when mypy primer (and also my first-hand experience) noticed no performance degradation. I will try running some benchmarks, especially on torch, and report back my results.
Edit(s), 2025-01-14:
Many confusing benchmark results.
running `python misc/perf_compare.py master mypy-ignore` in WSL1 gets me=== Results ===
master 15.311s (0.0%)
mypy-ignore 19.242s (+25.7%)
Running it again on regular Windows 10, I got
master 21.164s (0.0%)
mypy-ignore 25.565s (+20.8%)
Running it on Windows 10 on torch after I modified the benchmark script to be able to run on other repos (and print SDs) got me
master 114.325s (0.0%) | stdev 0.979s
mypy-ignore 114.263s (-0.1%) | stdev 0.651s
which is surprising! Worrying I might have messed up the benchmark, I ran it again, and got
master 128.554s (0.0%) | stdev 7.510s
mypy-ignore 146.215s (+13.7%) | stdev 9.628s
which was more expected. However, at this point I began to suspect that maybe my computer was just shifting into low-power mode after a while. I ran it on torch again with --num-runs=1, and got
master 130.198s (0.0%) | stdev 0.000s
mypy-ignore 129.884s (-0.2%) | stdev 0.000s
Doing the mypy self-check with n=2, I again get
mypy-ignore 26.856s (+23.0%) | stdev 0.206s
Doing the torch check with n=2, I again get
master 128.539s (0.0%) | stdev 1.846s
mypy-ignore 137.779s (+7.2%) | stdev 9.269s
The slowdown is significant. A multiple seconds. The proportion of time it takes seems to be less in torch than in mypy, however. Even though the absolute amount of time it takes increases.
There may be a solution that involves mypy.build.State.parse_inline_configuration + modifying Errors.ignored_lines that performs better. It would have slightly different semantics to type ignore since it wouldn't be associated with AST nodes, but maybe that's fine.
I haven't subsequently thought of a way to implement this technique without a slowdown (although I haven't been looking very hard), so I guess I'll just close this PR, and maybe try again later with a different implementation method (although, I don't feel a pressing need to make the attempt at the moment), either in a new PR or reopening this one. I think @hauntsaninja's idea for how it could be done sounds like a good idea, given that we already have mypy: "inline configuration" comments.
Edit: funnily enough, the mypy inline configurations are kind of already doing what I was doing again with the comments. Running perf-compare on a version of mypy where get_mypy_comments just returns [] saves us half a second. Ah, well. Whatchagonnado.
master 21.437s (0.0%) | stdev 0.238s
no-mypycon 20.962s (-2.2%) | stdev 0.391s
Why half a second and not multiple seconds? Well, perhaps some of the reason is because it just doesn't bother to... parse the file. For example, in the following code, untyped defs are disallowed and an error is raised:
"""
This is just a silly little multi-line string literal, surely it couldn't—
# mypy: disallow-untyped-defs
"""
def foo():
return 1