-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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 #10862
Merged
Merged
Sync typeshed #10862
Conversation
This file contains 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
Source commit: python/typeshed@581b2d5
This comment has been minimized.
This comment has been minimized.
I'm not sure why these changes are now requiring list in some fixtures, but it's easy enough to add list to the fixtures. The trickier test failure is the fallout of python/typeshed#5476 |
This comment has been minimized.
This comment has been minimized.
hauntsaninja
pushed a commit
to hauntsaninja/mypy
that referenced
this pull request
Jul 27, 2021
This PR does not mean mypy supports PEP 612, but it does do enough to unblock python#10862 mypy should now treat Callable[P, T] as Callable[..., T] and the code paths with incomplete support will no longer crash (but will not do what you'd want)
hauntsaninja
pushed a commit
to hauntsaninja/mypy
that referenced
this pull request
Jul 27, 2021
This PR does not mean mypy supports PEP 612, but it does do enough to unblock python#10862 mypy should now treat Callable[P, T] as Callable[..., T] and the code paths with incomplete support will no longer crash (but will not do what you'd want)
hauntsaninja
added a commit
that referenced
this pull request
Aug 4, 2021
This PR does not mean mypy supports PEP 612, but it does do enough to unblock #10862 mypy should now treat Callable[P, T] as Callable[..., T] and the code paths with incomplete support will no longer crash (but will not do what you'd want) Co-authored-by: hauntsaninja <>
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Diff from mypy_primer, showing the effect of this PR on open source code: pip (https://github.com/pypa/pip.git)
+ src/pip/_internal/utils/logging.py:152: error: Missing type parameters for generic type "StreamHandler"
+ src/pip/_internal/utils/logging.py:239: error: Return type "IO[Any]" of "_open" incompatible with return type "TextIOWrapper" in supertype "FileHandler"
+ src/pip/_internal/cli/progress_bars.py:84: error: Incompatible types in assignment (expression has type "Callable[[int, FrameType], None]", variable has type "Union[Callable[[int, Optional[FrameType]], Any], int, Handlers, None]")
werkzeug (https://github.com/pallets/werkzeug.git)
+ src/werkzeug/datastructures.pyi:41: error: Argument 1 of "__imul__" is incompatible with supertype "list"; supertype defines the argument type as "SupportsIndex"
+ src/werkzeug/datastructures.pyi:41: note: This violates the Liskov substitution principle
+ src/werkzeug/datastructures.pyi:41: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#incompatible-overrides
+ src/werkzeug/datastructures.pyi:41: error: Argument 1 of "__imul__" is incompatible with "__mul__" of supertype "list"; supertype defines the argument type as "SupportsIndex"
+ src/werkzeug/datastructures.pyi:41: error: Signatures of "__imul__" and "__mul__" are incompatible
+ src/werkzeug/datastructures.pyi:48: error: Argument 1 of "insert" is incompatible with supertype "list"; supertype defines the argument type as "SupportsIndex"
+ src/werkzeug/datastructures.pyi:48: note: This violates the Liskov substitution principle
+ src/werkzeug/datastructures.pyi:48: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#incompatible-overrides
+ src/werkzeug/datastructures.pyi:49: error: Argument 1 of "pop" is incompatible with supertype "list"; supertype defines the argument type as "SupportsIndex"
+ src/werkzeug/datastructures.pyi:49: note: This violates the Liskov substitution principle
+ src/werkzeug/datastructures.pyi:49: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#incompatible-overrides
+ src/werkzeug/serving.py:234: error: "socket" has no attribute "getpeercert"
+ src/werkzeug/serving.py:723: error: Argument 2 of "handle_error" is incompatible with supertype "TCPServer"; supertype defines the argument type as "Union[Tuple[str, int], str]"
+ src/werkzeug/serving.py:723: note: This violates the Liskov substitution principle
+ src/werkzeug/serving.py:723: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#incompatible-overrides
+ src/werkzeug/serving.py:723: error: Argument 2 of "handle_error" is incompatible with supertype "BaseServer"; supertype defines the argument type as "Union[Tuple[str, int], str]"
- tests/test_wrappers.py:370: error: Function is missing a return type annotation
- tests/test_wrappers.py:388: error: Function is missing a return type annotation
- tests/test_wrappers.py:388: note: Use "-> None" if function does not return a value
- tests/test_wrappers.py:423: error: Function is missing a return type annotation
- tests/test_wrappers.py:423: note: Use "-> None" if function does not return a value
- tests/test_wrappers.py:648: error: Function is missing a type annotation
- tests/test_wrappers.py:682: error: Function is missing a return type annotation
- tests/test_wrappers.py:682: note: Use "-> None" if function does not return a value
- tests/test_wrappers.py:691: error: Function is missing a return type annotation
- tests/test_wrappers.py:693: error: Function is missing a type annotation
- tests/test_wrappers.py:696: error: Function is missing a type annotation
- tests/test_wrappers.py:699: error: Function is missing a type annotation
- tests/test_wrappers.py:710: error: Function is missing a return type annotation
- tests/test_wrappers.py:710: note: Use "-> None" if function does not return a value
- tests/test_wrappers.py:720: error: Function is missing a return type annotation
- tests/test_wrappers.py:720: note: Use "-> None" if function does not return a value
- tests/test_wrappers.py:755: error: Function is missing a return type annotation
- tests/test_wrappers.py:755: note: Use "-> None" if function does not return a value
- tests/test_wrappers.py:796: error: Function is missing a return type annotation
- tests/test_wrappers.py:796: note: Use "-> None" if function does not return a value
- tests/test_wrappers.py:840: note: (Skipping most remaining errors due to unresolved imports or missing stubs; fix these first)
+ tests/test_wrappers.py:370: note: (Skipping most remaining errors due to unresolved imports or missing stubs; fix these first)
porcupine (https://github.com/Akuli/porcupine.git)
+ porcupine/utils.py:565: error: unused "type: ignore" comment
+ porcupine/tabs.py:764: error: unused "type: ignore" comment
+ porcupine/menubar.py:79: error: unused "type: ignore" comment
+ porcupine/menubar.py:83: error: unused "type: ignore" comment
+ porcupine/menubar.py:84: error: unused "type: ignore" comment
+ porcupine/menubar.py:113: error: unused "type: ignore" comment
+ porcupine/menubar.py:116: error: unused "type: ignore" comment
+ porcupine/menubar.py:124: error: unused "type: ignore" comment
+ porcupine/menubar.py:149: error: unused "type: ignore" comment
+ porcupine/menubar.py:152: error: unused "type: ignore" comment
+ porcupine/menubar.py:153: error: unused "type: ignore" comment
+ porcupine/menubar.py:154: error: unused "type: ignore" comment
+ porcupine/menubar.py:156: error: unused "type: ignore" comment
+ porcupine/menubar.py:157: error: unused "type: ignore" comment
+ porcupine/menubar.py:162: error: unused "type: ignore" comment
+ porcupine/menubar.py:191: error: unused "type: ignore" comment
+ porcupine/menubar.py:191: error: Unsupported operand types for + ("None" and "int") [operator]
+ porcupine/menubar.py:191: note: Left operand is of type "Optional[int]"
+ porcupine/menubar.py:192: error: unused "type: ignore" comment
+ porcupine/menubar.py:334: error: unused "type: ignore" comment
+ porcupine/plugins/autocomplete.py:162: error: unused "type: ignore" comment
+ porcupine/plugins/autocomplete.py:163: error: unused "type: ignore" comment
+ porcupine/plugins/autocomplete.py:212: error: unused "type: ignore" comment
+ porcupine/plugins/autocomplete.py:222: error: unused "type: ignore" comment
+ porcupine/plugins/autocomplete.py:229: error: unused "type: ignore" comment
+ porcupine/plugins/autocomplete.py:248: error: unused "type: ignore" comment
+ porcupine/plugins/autocomplete.py:250: error: unused "type: ignore" comment
+ porcupine/plugins/pastebin.py:159: error: unused "type: ignore" comment
+ porcupine/plugins/pastebin.py:177: error: unused "type: ignore" comment
+ porcupine/plugins/find.py:155: error: unused "type: ignore" comment
+ porcupine/plugins/find.py:230: error: unused "type: ignore" comment
+ porcupine/plugins/find.py:317: error: unused "type: ignore" comment
+ porcupine/plugins/find.py:338: error: unused "type: ignore" comment
+ porcupine/plugins/directory_tree.py:148: error: unused "type: ignore" comment
+ porcupine/plugins/directory_tree.py:155: error: unused "type: ignore" comment
+ porcupine/plugins/directory_tree.py:157: error: Statement is unreachable [unreachable]
+ porcupine/plugins/directory_tree.py:168: error: unused "type: ignore" comment
+ porcupine/plugins/directory_tree.py:230: error: unused "type: ignore" comment
+ porcupine/plugins/directory_tree.py:263: error: Incompatible types in assignment (expression has type "Optional[str]", variable has type "str") [assignment]
+ porcupine/plugins/directory_tree.py:270: error: unused "type: ignore" comment
+ porcupine/plugins/directory_tree.py:275: error: unused "type: ignore" comment
+ porcupine/plugins/directory_tree.py:288: error: unused "type: ignore" comment
+ porcupine/plugins/directory_tree.py:299: error: unused "type: ignore" comment
+ porcupine/plugins/directory_tree.py:379: error: unused "type: ignore" comment
+ porcupine/plugins/directory_tree.py:394: error: unused "type: ignore" comment
+ porcupine/plugins/directory_tree.py:414: error: unused "type: ignore" comment
+ porcupine/plugins/directory_tree.py:423: error: List item 0 has incompatible type "None"; expected "str" [list-item]
+ porcupine/plugins/directory_tree.py:471: error: unused "type: ignore" comment
+ porcupine/plugins/python_venv.py:116: error: unused "type: ignore" comment
+ porcupine/plugins/pluginmanager.py:83: error: unused "type: ignore" comment
+ porcupine/plugins/pluginmanager.py:85: error: unused "type: ignore" comment
+ porcupine/plugins/pluginmanager.py:147: error: unused "type: ignore" comment
+ porcupine/plugins/pluginmanager.py:150: error: unused "type: ignore" comment
pandas (https://github.com/pandas-dev/pandas.git)
+ pandas/io/common.py:658: error: No overload variant of "BZ2File" matches argument types "Union[str, Union[IO[Any], RawIOBase, BufferedIOBase, TextIOBase, TextIOWrapper, mmap]]", "str", "Dict[str, Any]" [call-overload]
+ pandas/io/common.py:658: note: Possible overload variants:
+ pandas/io/common.py:658: note: def __init__(self, filename: _WritableFileobj, mode: Union[Literal['w'], Literal['wb'], Literal['x'], Literal['xb'], Literal['a'], Literal['ab']], buffering: Optional[Any] = ..., compresslevel: int = ...) -> BZ2File
+ pandas/io/common.py:658: note: def __init__(self, filename: _ReadableFileobj, mode: Union[Literal[''], Literal['r'], Literal['rb']] = ..., buffering: Optional[Any] = ..., compresslevel: int = ...) -> BZ2File
+ pandas/io/common.py:658: note: def __init__(self, filename: Union[str, bytes, PathLike[str], PathLike[bytes]], mode: Union[Union[Literal[''], Literal['r'], Literal['rb']], Union[Literal['w'], Literal['wb'], Literal['x'], Literal['xb'], Literal['a'], Literal['ab']]] = ..., buffering: Optional[Any] = ..., compresslevel: int = ...) -> BZ2File
+ pandas/io/common.py:663: error: unused "type: ignore" comment
sphinx (https://github.com/sphinx-doc/sphinx.git)
+ sphinx/util/logging.py: note: In member "handle" of class "SphinxLoggerAdapter":
+ sphinx/util/logging.py:140:9: error: Item "LoggerAdapter" of "Union[Logger, LoggerAdapter]" has no attribute "handle"
+ sphinx/util/inspect.py: note: In function "is_singledispatch_function":
+ sphinx/util/inspect.py:342:13: error: "FunctionType" has no attribute "dispatch"
+ sphinx/util/inspect.py: note: At top level:
+ sphinx/ext/coverage.py: note: In member "build_py_coverage" of class "CoverageBuilder":
+ sphinx/ext/coverage.py:218:51: error: Item "object" of "Union[object, object]" has no attribute "__doc__"
websockets (https://github.com/aaugustin/websockets.git)
+ src/websockets/legacy/server.py:773: error: "AbstractServer" has no attribute "sockets"
+ src/websockets/legacy/server.py:774: error: "AbstractServer" has no attribute "sockets"
+ src/websockets/legacy/server.py:894: error: Returning Any from function declared to return "Optional[List[socket]]"
+ src/websockets/legacy/server.py:894: error: "AbstractServer" has no attribute "sockets"
aiohttp (https://github.com/aio-libs/aiohttp.git)
+ aiohttp/web_runner.py:264: error: "AbstractServer" has no attribute "sockets" [attr-defined]
+ aiohttp/test_utils.py:132: error: "AbstractServer" has no attribute "sockets" [attr-defined]
pytest (https://github.com/pytest-dev/pytest.git)
- src/_pytest/config/__init__.py:1061: error: Argument 3 to "getattr" has incompatible type "bool"; expected "Optional[Namespace]" [arg-type]
+ src/_pytest/logging.py:318: error: Missing type parameters for generic type "StreamHandler" [type-arg]
+ src/_pytest/logging.py:619: error: Argument 1 to "setStream" of "StreamHandler" has incompatible type "TextIO"; expected "TextIOWrapper" [arg-type]
+ src/_pytest/logging.py:754: error: Missing type parameters for generic type "StreamHandler" [type-arg]
+ testing/test_tmpdir.py:52: note: (Skipping most remaining errors due to unresolved imports or missing stubs; fix these first)
- testing/test_tmpdir.py:52: error: Too many arguments for "FakeConfig" [call-arg]
- testing/test_tmpdir.py:65: error: Too many arguments for "FakeConfig" [call-arg]
- testing/test_config.py:422: error: Too many arguments for "DummyEntryPoint" [call-arg]
- testing/test_config.py:436: note: (Skipping most remaining errors due to unresolved imports or missing stubs; fix these first)
anyio (https://github.com/agronholm/anyio.git)
+ src/anyio/_backends/_asyncio.py:188: error: Argument 1 to "getgeneratorstate" has incompatible type "Union[Generator[Optional[Future[object]], None, Any], Awaitable[Any]]"; expected "Generator[Any, Any, Any]"
+ src/anyio/_backends/_asyncio.py:1283: error: unused "type: ignore" comment
+ src/anyio/_backends/_asyncio.py:1820: error: Argument 4 to "TaskInfo" has incompatible type "Union[Generator[Optional[Future[object]], None, Any], Awaitable[Any]]"; expected "Coroutine[Any, Any, Any]"
graphql-core (https://github.com/graphql-python/graphql-core.git)
+ src/graphql/subscription/subscribe.py:89: error: unused "type: ignore" comment
+ tests/execution/test_sync.py:61: error: Redundant cast to "Awaitable[Any]"
tornado (https://github.com/tornadoweb/tornado.git)
- tornado/auth.py:323: error: Argument 3 to "getattr" has incompatible type "bool"; expected "Optional[str]"
|
Closed
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Source commit:
python/typeshed@581b2d5