Skip to content

Conversation

@hauntsaninja
Copy link
Collaborator

@hauntsaninja hauntsaninja commented Jan 19, 2026

Best reviewed with whitespace ignored.
If the pure_ renames are undesirable it is easy to remove them, just helped me avoid some incorrect changes.

Will add better benchmarks, but speeds up interpreted mypy -c "1 + str()" by 10%

@github-actions
Copy link
Contributor

Diff from mypy_primer, showing the effect of this PR on open source code:

spark (https://github.com/apache/spark)
+ python/pyspark/sql/plot/core.py:501: error: Unused "type: ignore" comment  [unused-ignore]
+ python/pyspark/sql/plot/core.py:502: error: Unused "type: ignore" comment  [unused-ignore]
+ python/pyspark/sql/plot/core.py:506: error: Unused "type: ignore" comment  [unused-ignore]
+ python/pyspark/sql/plot/core.py:572: error: Unused "type: ignore" comment  [unused-ignore]
+ python/pyspark/sql/plot/core.py:573: error: Unused "type: ignore" comment  [unused-ignore]
+ python/pyspark/sql/plot/core.py:579: error: Unused "type: ignore" comment  [unused-ignore]
+ python/pyspark/sql/plot/core.py:580: error: Unused "type: ignore" comment  [unused-ignore]
+ python/pyspark/sql/plot/core.py:582: error: Unused "type: ignore" comment  [unused-ignore]
+ python/pyspark/pandas/window.py:175: error: Unused "type: ignore" comment  [unused-ignore]
+ python/pyspark/pandas/window.py:947: error: Unused "type: ignore" comment  [unused-ignore]
+ python/pyspark/pandas/window.py:1418: error: Unused "type: ignore" comment  [unused-ignore]
+ python/pyspark/pandas/usage_logging/__init__.py:135: error: Unused "type: ignore" comment  [unused-ignore]
- python/pyspark/pandas/usage_logging/__init__.py:127: error: Module has no attribute "core"  [attr-defined]
- python/pyspark/pandas/usage_logging/__init__.py:128: error: Module has no attribute "core"  [attr-defined]
- python/pyspark/pandas/usage_logging/__init__.py:129: error: Module has no attribute "core"  [attr-defined]
- python/pyspark/pandas/usage_logging/__init__.py:130: error: Module has no attribute "core"  [attr-defined]
- python/pyspark/pandas/usage_logging/__init__.py:131: error: Module has no attribute "core"  [attr-defined]
- python/pyspark/pandas/usage_logging/__init__.py:132: error: Module has no attribute "core"  [attr-defined]
- python/pyspark/pandas/usage_logging/__init__.py:133: error: Module has no attribute "core"  [attr-defined]

psycopg (https://github.com/psycopg/psycopg)
+ psycopg/psycopg/pq/__init__.py:76: error: Unused "type: ignore" comment  [unused-ignore]
+ psycopg/psycopg/pq/__init__.py:90: error: Unused "type: ignore" comment  [unused-ignore]

meson (https://github.com/mesonbuild/meson)
- mesonbuild/wrap/wrap.py:95:9: error: Returning Any from function declared to return "SSLContext | None"  [no-any-return]

dd-trace-py (https://github.com/DataDog/dd-trace-py)
+ ddtrace/_trace/trace_handlers.py:1002: error: Unused "type: ignore" comment  [unused-ignore]
+ ddtrace/_trace/trace_handlers.py:1003: error: Unused "type: ignore" comment  [unused-ignore]

jax (https://github.com/google/jax)
+ jax/experimental/mosaic/gpu/launch_context.py:823: error: Unused "type: ignore" comment  [unused-ignore]
+ jax/experimental/mosaic/gpu/launch_context.py:824: error: Unused "type: ignore" comment  [unused-ignore]
+ jax/experimental/mosaic/gpu/launch_context.py:920: error: Unused "type: ignore" comment  [unused-ignore]
+ jax/experimental/mosaic/gpu/launch_context.py:1135: error: Unused "type: ignore" comment  [unused-ignore]
+ jax/experimental/mosaic/gpu/core.py:726: error: Unused "type: ignore" comment  [unused-ignore]
+ jax/experimental/mosaic/gpu/tcgen05.py:345: error: Unused "type: ignore" comment  [unused-ignore]
+ jax/experimental/mosaic/gpu/tcgen05.py:488: error: Unused "type: ignore" comment  [unused-ignore]
+ jax/experimental/mosaic/gpu/tcgen05.py:489: error: Unused "type: ignore" comment  [unused-ignore]
+ jax/experimental/mosaic/gpu/tcgen05.py:490: error: Unused "type: ignore" comment  [unused-ignore]
+ jax/experimental/mosaic/gpu/tcgen05.py:645: error: Unused "type: ignore" comment  [unused-ignore]
+ jax/_src/pallas/mosaic_gpu/core.py:425: error: Unused "type: ignore" comment  [unused-ignore]
+ jax/_src/pallas/mosaic_gpu/core.py:1102: error: Unused "type: ignore" comment  [unused-ignore]
+ jax/_src/pallas/mosaic_gpu/interpret/gpu_callbacks.py:439: error: Unused "type: ignore" comment  [unused-ignore]
+ jax/_src/pallas/fuser/custom_fusion_lib.py:165: error: Unused "type: ignore" comment  [unused-ignore]

scipy (https://github.com/scipy/scipy)
- scipy/signal/_spectral_py.py:25: error: Incompatible default for argument "precenter" (default has type "object", argument has type "bool")  [assignment]
- scipy/signal/_spectral_py.py:275: error: Item "Buffer" of "Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | str | _NestedSequence[complex | bytes | str]" has no attribute "reshape"  [union-attr]
- scipy/signal/_spectral_py.py:275: error: Item "_SupportsArray[dtype[Any]]" of "Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | str | _NestedSequence[complex | bytes | str]" has no attribute "reshape"  [union-attr]
- scipy/signal/_spectral_py.py:275: error: Item "_NestedSequence[_SupportsArray[dtype[Any]]]" of "Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | str | _NestedSequence[complex | bytes | str]" has no attribute "reshape"  [union-attr]
- scipy/signal/_spectral_py.py:275: error: Item "complex" of "Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | str | _NestedSequence[complex | bytes | str]" has no attribute "reshape"  [union-attr]
- scipy/signal/_spectral_py.py:275: error: Item "str" of "Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | str | _NestedSequence[complex | bytes | str]" has no attribute "reshape"  [union-attr]
- scipy/signal/_spectral_py.py:275: error: Item "_NestedSequence[complex | bytes | str]" of "Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | str | _NestedSequence[complex | bytes | str]" has no attribute "reshape"  [union-attr]
- scipy/signal/_spectral_py.py:320: error: Item "Buffer" of "Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str]" has no attribute "dtype"  [union-attr]
- scipy/signal/_spectral_py.py:320: error: Item "_SupportsArray[dtype[Any]]" of "Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str]" has no attribute "dtype"  [union-attr]
- scipy/signal/_spectral_py.py:320: error: Item "_NestedSequence[_SupportsArray[dtype[Any]]]" of "Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str]" has no attribute "dtype"  [union-attr]
- scipy/signal/_spectral_py.py:320: error: Item "complex" of "Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str]" has no attribute "dtype"  [union-attr]
- scipy/signal/_spectral_py.py:320: error: Item "bytes" of "Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str]" has no attribute "dtype"  [union-attr]
- scipy/signal/_spectral_py.py:320: error: Item "str" of "Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str]" has no attribute "dtype"  [union-attr]
- scipy/signal/_spectral_py.py:320: error: Item "_NestedSequence[complex | bytes | str]" of "Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str]" has no attribute "dtype"  [union-attr]

pandas-stubs (https://github.com/pandas-dev/pandas-stubs)
+ pandas-stubs/_typing.pyi:1235: error: Unused "type: ignore" comment  [unused-ignore]

xarray (https://github.com/pydata/xarray)
- xarray/namedarray/utils.py: note: In function "module_available":
- xarray/namedarray/utils.py:57: error: Module has no attribute "util"  [attr-defined]
- xarray/namedarray/utils.py: note: At top level:
- xarray/namedarray/utils.py: note: In function "is_dask_collection":
- xarray/namedarray/utils.py:74: error: Returning Any from function declared to return "bool"  [no-any-return]
+ xarray/namedarray/utils.py:203: error: Unused "type: ignore" comment  [unused-ignore]
+ xarray/namedarray/utils.py:294: error: Unused "type: ignore" comment  [unused-ignore]
+ xarray/namedarray/pycompat.py:107: error: Unused "type: ignore[no-any-return, union-attr]" comment  [unused-ignore]
+ xarray/namedarray/pycompat.py:112: error: Unused "type: ignore" comment  [unused-ignore]
+ xarray/namedarray/pycompat.py:139: error: Unused "type: ignore" comment  [unused-ignore]
+ xarray/namedarray/pycompat.py:143: error: Unused "type: ignore[no-untyped-call, no-any-return]" comment  [unused-ignore]
+ xarray/namedarray/pycompat.py:147: error: Unused "type: ignore" comment  [unused-ignore]
+ xarray/namedarray/pycompat.py:159: error: Unused "type: ignore[union-attr, no-any-return]" comment  [unused-ignore]
+ xarray/util/deprecation_helpers.py:148: error: Unused "type: ignore" comment  [unused-ignore]
+ xarray/core/indexing.py:531: error: Unused "type: ignore" comment  [unused-ignore]
+ xarray/core/indexing.py:573: error: Unused "type: ignore" comment  [unused-ignore]
+ xarray/core/indexing.py:574: error: Unused "type: ignore" comment  [unused-ignore]
+ xarray/core/indexing.py:1530: error: Unused "type: ignore" comment  [unused-ignore]
+ xarray/core/indexing.py:1544: error: Unused "type: ignore" comment  [unused-ignore]
+ xarray/core/indexing.py:1929: error: Unused "type: ignore" comment  [unused-ignore]

bokeh (https://github.com/bokeh/bokeh)
+ src/bokeh/protocol/__init__.py:131: error: Unused "type: ignore" comment  [unused-ignore]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant