FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Sync typeshed by ilevkivskyi · Pull Request #13252 · python/mypy · GitHub

Repository navigation

Sync typeshed - #13252

Merged
hauntsaninja merged 5 commits into
python:masterfrom
ilevkivskyi:sync-ts-py2
Jul 28, 2022
Merged

hauntsaninja merged 5 commits into
python:masterfrom
ilevkivskyi:sync-ts-py2

Conversation

Copy link
Copy Markdown
Member

Source commit:
python/typeshed@5397d43

This version doesn't have Python 2 anymore.

Ref #12237

cc @hauntsaninja @sobolevn

Copy link
Copy Markdown
Collaborator

You'll probably need to cherry pick #13093 again

Copy link
Copy Markdown
Member Author

@hauntsaninja Oh, right. I will CP now.

Ivan Levkivskyi and others added 2 commits July 27, 2022 20:22
Fixes python#13091

Co-authored-by: Ivan Levkivskyi <ilevkivskyi@dropbox.com>

Copy link
Copy Markdown
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

This comment has been minimized.

Copy link
Copy Markdown
Member Author

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

This comment has been minimized.

Copy link
Copy Markdown
Member

Also FYI the main culprits for the primer diff are:

This comment has been minimized.

Copy link
Copy Markdown
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 merged commit 23e38ce into python:master Jul 28, 2022
ilevkivskyi deleted the sync-ts-py2 branch July 28, 2022 09:19

Copy link
Copy Markdown
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.

Copy link
Copy Markdown
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 :)

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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


Back | FazBrowse Home | New Git URL