Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync typeshed #13252

Merged
merged 5 commits into from
Jul 28, 2022
Merged

Sync typeshed #13252

merged 5 commits into from
Jul 28, 2022

Conversation

ilevkivskyi
Copy link
Member

Source commit:
python/typeshed@5397d43

This version doesn't have Python 2 anymore.

Ref #12237

cc @hauntsaninja @sobolevn

@hauntsaninja
Copy link
Collaborator

You'll probably need to cherry pick #13093 again

@ilevkivskyi
Copy link
Member Author

@hauntsaninja Oh, right. I will CP now.

Ivan Levkivskyi and others added 2 commits July 27, 2022 20:22
@AlexWaygood
Copy link
Member

N.B. This version of typeshed also drops support for 3.6, so you may also have to reapply d22899f to fix the CI

@github-actions

This comment has been minimized.

@ilevkivskyi
Copy link
Member Author

@AlexWaygood Oh, great, I thought I would need top fix it myself :-)

@github-actions

This comment has been minimized.

@AlexWaygood
Copy link
Member

Also FYI the main culprits for the primer diff are:

@github-actions

This comment has been minimized.

@github-actions
Copy link
Contributor

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

ignite (https://github.com/pytorch/ignite)
+ ignite/handlers/time_profilers.py:257: error: Unused "type: ignore" comment

mypy (https://github.com/python/mypy)
+ mypy/test/testpep561.py:117: error: Unused "type: ignore[operator]" comment

rotki (https://github.com/rotki/rotki)
+ rotkehlchen/chain/ethereum/modules/adex/types.py:251: error: Unused "type: ignore" comment
+ rotkehlchen/chain/ethereum/modules/adex/types.py:252: error: Unused "type: ignore" comment
+ rotkehlchen/chain/ethereum/modules/adex/types.py:253: error: Unused "type: ignore" comment
+ rotkehlchen/chain/ethereum/modules/adex/adex.py:786: error: Unused "type: ignore" comment

pydantic (https://github.com/samuelcolvin/pydantic)
+ pydantic/color.py:199: error: Unused "type: ignore" comment

psycopg (https://github.com/psycopg/psycopg)
+ tests/test_adapt.py:412: error: Unused "type: ignore" comment

werkzeug (https://github.com/pallets/werkzeug)
+ src/werkzeug/serving.py:224: error: Unused "type: ignore" comment

sphinx (https://github.com/sphinx-doc/sphinx)
+ sphinx/util/typing.py: note: In function "_restify_py36":
+ sphinx/util/typing.py:269:26: error: Module has no attribute "GenericMeta"; maybe "Generic"?  [attr-defined]
+ sphinx/util/typing.py: note: In function "_stringify_py36":
+ sphinx/util/typing.py:507:33: error: Module has no attribute "GenericMeta"; maybe "Generic"?  [attr-defined]
+ sphinx/util/typing.py: note: At top level:
+ sphinx/util/typing.py:509: error: Unused "type: ignore" comment
+ sphinx/util/typing.py:510: error: Unused "type: ignore" comment
+ sphinx/util/typing.py:511: error: Unused "type: ignore" comment
+ sphinx/util/typing.py:512: error: Unused "type: ignore" comment
+ sphinx/util/typing.py:515: error: Unused "type: ignore" comment
+ sphinx/util/typing.py:516: error: Unused "type: ignore" comment

ibis (https://github.com/ibis-project/ibis)
- ibis/tests/expr/test_datatypes.py:35: error: List comprehension has incompatible type List[Tuple[str, GeoSpatial]]; expected List[Tuple[Collection[object], Variadic]]
- ibis/backends/postgres/registry.py:172: error: List item 0 has incompatible type "Tuple[str, Callable[[Any, Any], Any]]"; expected "Tuple[str, Callable[[VarArg(Any)], str]]"
- ibis/backends/postgres/registry.py:191: error: Cannot infer type of lambda

urllib3 (https://github.com/urllib3/urllib3)
+ test/with_dummyserver/test_https.py:463: error: Item "socket" of "Union[socket, Any]" has no attribute "server_hostname"  [union-attr]
+ test/with_dummyserver/test_https.py:784: error: Item "socket" of "Union[socket, Any]" has no attribute "version"  [union-attr]
+ test/with_dummyserver/test_https.py:882: error: Item "socket" of "Union[socket, Any]" has no attribute "version"  [union-attr]

prefect (https://github.com/PrefectHQ/prefect)
- src/prefect/utilities/asyncutils.py:181: error: Argument 1 to "wraps" has incompatible type "T"; expected "Callable[..., Any]"
- src/prefect/__init__.py:79: error: Incompatible types in assignment (expression has type "List[Prefect1ImportInterceptor]", variable has type "List[_MetaPathFinder]")
- src/prefect/__init__.py:79: note: "List" is invariant -- see https://mypy.readthedocs.io/en/stable/common_issues.html#variance
- src/prefect/__init__.py:79: note: Consider using "Sequence" instead, which is covariant
- src/prefect/__init__.py:79: error: Unsupported operand types for + ("List[Prefect1ImportInterceptor]" and "List[_MetaPathFinder]")

spark (https://github.com/apache/spark)
+ python/pyspark/ml/tuning.py:464: error: Unused "type: ignore" comment

pyinstrument (https://github.com/joerick/pyinstrument)
+ pyinstrument/vendor/decorator.py:66: error: Incompatible redefinition (redefinition with type "Callable[[Any], Any]", original type overloaded function)

aiohttp (https://github.com/aio-libs/aiohttp)
+ aiohttp/helpers.py:126: error: Incompatible redefinition (redefinition with type "Callable[[Any], bool]", original type overloaded function)  [misc]
+ aiohttp/web_runner.py:171: error: Unused "type: ignore" comment

discord.py (https://github.com/Rapptz/discord.py)
+ discord/guild.py:554: error: Need type annotation for "empty_tuple"
- discord/ext/tasks/__init__.py:494: error: Incompatible types in assignment (expression has type "Tuple[]", variable has type "Tuple[Type[OSError], Type[GatewayNotFound], Type[ConnectionClosed], Type[ClientError], Type[TimeoutError]]")
+ discord/ext/tasks/__init__.py:494: error: Incompatible types in assignment (expression has type "Tuple[<nothing>, ...]", variable has type "Tuple[Type[OSError], Type[GatewayNotFound], Type[ConnectionClosed], Type[ClientError], Type[TimeoutError]]")
- discord/ext/tasks/__init__.py:564: error: Incompatible types in assignment (expression has type "FT", variable has type "None")
+ discord/ext/tasks/__init__.py:564: error: Incompatible types in assignment (expression has type "Callable[[VarArg(<nothing>), KwArg(<nothing>)], CoroutineType[Any, Any, <nothing>]]", variable has type "None")
+ discord/ext/tasks/__init__.py:565: error: Incompatible return value type (got "Callable[[VarArg(<nothing>), KwArg(<nothing>)], CoroutineType[Any, Any, <nothing>]]", expected "FT")
- discord/ext/tasks/__init__.py:592: error: Incompatible types in assignment (expression has type "FT", variable has type "None")
+ discord/ext/tasks/__init__.py:592: error: Incompatible types in assignment (expression has type "Callable[[VarArg(<nothing>), KwArg(<nothing>)], CoroutineType[Any, Any, <nothing>]]", variable has type "None")
+ discord/ext/tasks/__init__.py:593: error: Incompatible return value type (got "Callable[[VarArg(<nothing>), KwArg(<nothing>)], CoroutineType[Any, Any, <nothing>]]", expected "FT")
+ discord/ext/tasks/__init__.py:623: error: Incompatible return value type (got "Callable[..., CoroutineType[Any, Any, Any]]", expected "ET")
- discord/ext/commands/cog.py:229: error: Item "Group" of "Union[Any, Group, Command[Any, Any, Any]]" has no attribute "__cog_listener_names__"
+ discord/ext/commands/cog.py:229: error: "Callable[..., CoroutineType[Any, Any, Any]]" has no attribute "__cog_listener_names__"
- discord/ext/commands/cog.py:229: error: Item "Command[Any, Any, Any]" of "Union[Any, Group, Command[Any, Any, Any]]" has no attribute "__cog_listener_names__"
- discord/ext/commands/cog.py:232: error: Item "Group" of "Union[Any, Group, Command[Any, Any, Any]]" has no attribute "__name__"
- discord/ext/commands/cog.py:232: error: Item "Command[Any, Any, Any]" of "Union[Any, Group, Command[Any, Any, Any]]" has no attribute "__name__"

pandas (https://github.com/pandas-dev/pandas)
+ pandas/core/computation/scope.py:327: error: Unused "type: ignore" comment
+ pandas/core/computation/scope.py:328: error: Unused "type: ignore" comment
+ pandas/io/common.py:577: error: Unused "type: ignore" comment
+ pandas/core/indexes/frozen.py:65: error: Incompatible types in assignment (expression has type "Callable[[FrozenList, Any], FrozenList]", base class "list" defined the type as overloaded function)  [assignment]
+ pandas/io/pytables.py:3470: error: Unused "type: ignore" comment
- pandas/core/groupby/generic.py:686: error: Incompatible types in assignment (expression has type "List[ndarray[Any, dtype[_SCT]]]", variable has type "List[ndarray[Any, dtype[signedinteger[Any]]]]")  [assignment]
+ pandas/core/reshape/merge.py:1616: error: Cannot determine type of "__add__"  [has-type]
+ pandas/core/groupby/generic.py:690: error: Unused "type: ignore" comment
+ pandas/core/reshape/reshape.py:313: error: Cannot determine type of "__add__"  [has-type]
+ pandas/tests/resample/test_datetime_index.py:1303: error: Unused "type: ignore" comment
+ pandas/tests/frame/indexing/test_setitem.py:268: error: Unused "type: ignore" comment
+ pandas/tests/tools/test_to_datetime.py:1088: error: Unused "type: ignore" comment
+ pandas/tests/tools/test_to_datetime.py:1092: error: Unused "type: ignore" comment

@hauntsaninja hauntsaninja merged commit 23e38ce into python:master Jul 28, 2022
@ilevkivskyi ilevkivskyi deleted the sync-ts-py2 branch July 28, 2022 09:19
@ilevkivskyi
Copy link
Member Author

@AlexWaygood do you understand the couple new Cannot determine type of "__add__" errors in the primer? This looks like some kind of a bug to me.

@AlexWaygood
Copy link
Member

@AlexWaygood do you understand the couple new Cannot determine type of "__add__" errors in the primer? This looks like some kind of a bug to me.

Yeah, it's a regression, caused by the fact that list.__add__ is now an overloaded function. We discussed it a bit in python/typeshed#8293 (comment) — our judgement was that the typeshed change fixed enough bugs that it was worth paying the price of the regression. But obviously the best of all worlds would be if we could find a fix for the regression on the mypy side as well :)

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.

3 participants