Skip to content

Conversation

@hauntsaninja
Copy link
Collaborator

This relates to changes made in #20492

It undoes some of the new narrowing, which has both good and bad effects, i.e. if we merge this, we'll need to re-open some issues

Opening this mainly as a way to keep an eye on primer as I try out a few things in this space

This relates to changes made in python#20492
@hauntsaninja hauntsaninja changed the title [wip] Avoid narrowing TypeType [do not review] Avoid narrowing TypeType Jan 22, 2026
@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/mllib/regression.py:282: error: Unused "type: ignore" comment  [unused-ignore]
- python/pyspark/mllib/regression.py:282: error: Incompatible return value type (got "LogisticRegressionModel", expected "LM")  [return-value]
- python/pyspark/mllib/regression.py:282: note: Error code "return-value" not covered by "type: ignore" comment

zulip (https://github.com/zulip/zulip)
- analytics/views/stats.py:577: error: Incompatible return value type (got "QuerySet[RealmCount, RealmCount]", expected "QuerySet[CountT, CountT]")  [return-value]
- analytics/views/stats.py:579: error: Incompatible return value type (got "QuerySet[UserCount, UserCount]", expected "QuerySet[CountT, CountT]")  [return-value]
- analytics/views/stats.py:581: error: Incompatible return value type (got "QuerySet[StreamCount, StreamCount]", expected "QuerySet[CountT, CountT]")  [return-value]
- analytics/views/stats.py:583: error: Incompatible return value type (got "QuerySet[InstallationCount, InstallationCount]", expected "QuerySet[CountT, CountT]")  [return-value]
- analytics/views/stats.py:585: error: Incompatible return value type (got "QuerySet[RemoteInstallationCount, RemoteInstallationCount]", expected "QuerySet[CountT, CountT]")  [return-value]
- analytics/views/stats.py:587: error: Incompatible return value type (got "QuerySet[RemoteRealmCount, RemoteRealmCount]", expected "QuerySet[CountT, CountT]")  [return-value]

pandera (https://github.com/pandera-dev/pandera)
+ tests/pandas/test_schema_components.py:590: error: "Iterable[Any]" has no attribute "tolist"  [attr-defined]

xarray (https://github.com/pydata/xarray)
+ xarray/indexes/nd_point_index.py: note: In member "from_variables" of class "NDPointIndex":
+ xarray/indexes/nd_point_index.py:271: error: Incompatible types in assignment (expression has type "type[ScipyKDTreeAdapter]", variable has type "type[T_TreeAdapter]")  [assignment]

artigraph (https://github.com/artigraph/artigraph)
+ src/arti/views/__init__.py:98: error: Incompatible types in assignment (expression has type "type[View] | None", variable has type "type[Self]")  [assignment]
+ src/arti/views/__init__.py:102: error: Incompatible types in assignment (expression has type "type[View] | None", variable has type "type[Self]")  [assignment]

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