-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Typecheck unreachable code #18707
base: master
Are you sure you want to change the base?
Typecheck unreachable code #18707
Conversation
Except things important enough we marked them before, which include: - `if not typing.TYPE_CHECKING` - platform checks that do not match
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.
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.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This is an awful hack but the documentation says: > Ask a static type checker to confirm that a line of code is > unreachable. as well as something specifically about `Never` (it's confusing)
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
I am happy with how the test changes are now. I'll update code a bit based on mypy primer results but I think this is mostly final. |
This comment has been minimized.
This comment has been minimized.
I don't know how to test this.
Alright, I went through mypy-primer. ... well, skimmed over at the end, but whatever. The biggest thing that feels wrong but actually isn't is something like this: x: int
if isinstance(x, int):
raise ValueError()
reveal_type(x) # <- this is not Never This is because the end of both branches are unreachable. It's impossible to get to that |
Diff from mypy_primer, showing the effect of this PR on open source code: beartype (https://github.com/beartype/beartype)
+ beartype/_util/cache/utilcachecall.py:575: error: Incompatible return value type (got "Callable[..., Any]", expected "CallableT") [return-value]
- beartype/_util/func/utilfuncmake.py:310: error: Unused "type: ignore" comment [unused-ignore]
vision (https://github.com/pytorch/vision)
+ torchvision/transforms/v2/_augment.py:82: error: Incompatible types in assignment (expression has type "None", variable has type "list[float]") [assignment]
speedrun.com_global_scoreboard_webapp (https://github.com/Avasam/speedrun.com_global_scoreboard_webapp)
+ backend/services/utils.py:71: error: Incompatible return value type (got "SrcErrorResultDto", expected "dict[Literal['data'], Any] | None") [return-value]
dragonchain (https://github.com/dragonchain/dragonchain)
+ dragonchain/lib/keys.py:60:49: error: "None" has no attribute "pubkey" [attr-defined]
+ dragonchain/lib/keys.py:277:80: error: Argument 4 to "sign_l1_block" has incompatible type "BlockModel"; expected "L1BlockModel" [arg-type]
+ dragonchain/lib/keys.py:279:80: error: Argument 4 to "sign_l2_block" has incompatible type "BlockModel"; expected "L2BlockModel" [arg-type]
+ dragonchain/lib/keys.py:281:80: error: Argument 4 to "sign_l3_block" has incompatible type "BlockModel"; expected "L3BlockModel" [arg-type]
+ dragonchain/lib/keys.py:283:80: error: Argument 4 to "sign_l4_block" has incompatible type "BlockModel"; expected "L4BlockModel" [arg-type]
+ dragonchain/lib/keys.py:285:80: error: Argument 4 to "sign_l5_block" has incompatible type "BlockModel"; expected "L5BlockModel" [arg-type]
schema_salad (https://github.com/common-workflow-language/schema_salad)
+ schema_salad/ref_resolver.py: note: In member "validate_link" of class "Loader":
+ schema_salad/ref_resolver.py:1093:20: error: Incompatible return value type (got "None", expected "str | CommentedSeq | CommentedMap") [return-value]
prefect (https://github.com/PrefectHQ/prefect)
+ src/prefect/settings/sources.py:118: error: Unsupported right operand type for in ("Optional[list[str]]") [operator]
+ src/prefect/_internal/concurrency/cancellation.py:181: error: Unsupported left operand type for > ("None") [operator]
+ src/prefect/server/database/dependencies.py:304: error: "Self" has no attribute "_func" [attr-defined]
+ src/prefect/client/orchestration/__init__.py:319: error: Setting? has no attribute "value" [attr-defined]
+ src/prefect/client/orchestration/__init__.py:809: error: Incompatible types in assignment (expression has type "int", variable has type "list[float]") [assignment]
+ src/prefect/client/orchestration/__init__.py:1327: error: Setting? has no attribute "value" [attr-defined]
+ src/prefect/client/orchestration/__init__.py:1605: error: Incompatible types in assignment (expression has type "int", variable has type "list[float]") [assignment]
+ src/prefect/concurrency/v1/sync.py:69: error: Value of type "Coroutine[Any, Any, R?]" must be used [unused-coroutine]
+ src/prefect/concurrency/v1/sync.py:69: note: Are you missing an await?
- src/prefect/server/models/deployments.py:744: error: "Never" has no attribute "model_dump" [attr-defined]
+ src/prefect/workers/base.py:699: error: Setting? has no attribute "value" [attr-defined]
+ src/prefect/input/run_input.py:553: error: Incompatible return value type (got "Coroutine[Any, Any, R?]", expected "Union[T, AutomaticRunInput[T]]") [return-value]
+ src/prefect/flow_runs.py:322: error: Item "None" of "Optional[State[Any]]" has no attribute "is_running" [union-attr]
+ src/prefect/flow_runs.py:325: error: Item "type" of "Union[type[AutomaticRunInput[Never]], type[T]]" has no attribute "load" [union-attr]
+ src/prefect/flow_runs.py:326: error: Return value expected [return-value]
- src/prefect/cli/deploy.py:872: error: Need type annotation for "active_workers" (hint: "active_workers: list[<type>] = ...") [var-annotated]
static-frame (https://github.com/static-frame/static-frame)
+ static_frame/core/frame.py:5721: error: Unused "type: ignore" comment [unused-ignore]
altair (https://github.com/vega/altair)
+ tools/schemapi/codegen.py:153: error: Set comprehension has incompatible type Set[set[str]]; expected Set[str] [misc]
+ tools/schemapi/codegen.py:154: error: Set comprehension has incompatible type Set[set[str]]; expected Set[str] [misc]
+ tools/schemapi/codegen.py:156: error: Set comprehension has incompatible type Set[set[str]]; expected Set[str] [misc]
trio (https://github.com/python-trio/trio)
+ src/trio/testing/_raises_group.py:720: error: Unsupported left operand type for + ("None") [operator]
+ src/trio/_core/_tests/test_io.py:348: error: "_EpollStatistics" has no attribute "monitors" [attr-defined]
+ src/trio/_core/_tests/test_io.py:349: error: "_EpollStatistics" has no attribute "tasks_waiting"; maybe "tasks_waiting_read" or "tasks_waiting_write"? [attr-defined]
+ src/trio/_core/_tests/test_io.py:399: error: "_EpollStatistics" has no attribute "monitors" [attr-defined]
+ src/trio/_core/_tests/test_io.py:400: error: "_EpollStatistics" has no attribute "tasks_waiting"; maybe "tasks_waiting_read" or "tasks_waiting_write"? [attr-defined]
+ src/trio/_tests/test_subprocess.py:370: error: No overload variant of "run_process" matches argument types "list[str]", "str" [call-overload]
+ src/trio/_tests/test_subprocess.py:370: note: Possible overload variants:
+ src/trio/_tests/test_subprocess.py:370: note: def run_process(command: str | bytes | PathLike[str] | PathLike[bytes], *, task_status: TaskStatus[Process] = ..., stdin: bytes | bytearray | memoryview[int] | int | HasFileno | None = ..., capture_stdout: bool = ..., capture_stderr: bool = ..., check: bool = ..., deliver_cancel: Callable[[Process], Awaitable[object]] | None = ..., stdout: int | HasFileno | None = ..., stderr: int | HasFileno | None = ..., close_fds: bool = ..., shell: Literal[True], cwd: str | bytes | PathLike[str] | PathLike[bytes] | None = ..., env: Mapping[str, str] | None = ..., preexec_fn: Callable[[], object] | None = ..., restore_signals: bool = ..., start_new_session: bool = ..., pass_fds: Sequence[int] = ...) -> Coroutine[Any, Any, CompletedProcess[bytes]]
+ src/trio/_tests/test_subprocess.py:370: note: def run_process(command: Sequence[str | bytes | PathLike[str] | PathLike[bytes]], *, task_status: TaskStatus[Process] = ..., stdin: bytes | bytearray | memoryview[int] | int | HasFileno | None = ..., capture_stdout: bool = ..., capture_stderr: bool = ..., check: bool = ..., deliver_cancel: Callable[[Process], Awaitable[None]] | None = ..., stdout: int | HasFileno | None = ..., stderr: int | HasFileno | None = ..., close_fds: bool = ..., shell: bool = ..., cwd: str | bytes | PathLike[str] | PathLike[bytes] | None = ..., env: Mapping[str, str] | None = ..., preexec_fn: Callable[[], object] | None = ..., restore_signals: bool = ..., start_new_session: bool = ..., pass_fds: Sequence[int] = ...) -> Coroutine[Any, Any, CompletedProcess[bytes]]
+ src/trio/_tests/test_subprocess.py:468: error: Item "None" of "SendStream | None" has no attribute "aclose" [union-attr]
+ src/trio/_tests/test_subprocess.py:486: error: Item "None" of "SendStream | None" has no attribute "send_all" [union-attr]
+ src/trio/_tests/test_subprocess.py:487: error: Item "None" of "SendStream | None" has no attribute "aclose" [union-attr]
+ src/trio/_tests/test_ssl.py:932: error: "None" not callable [misc]
+ src/trio/_tests/test_socket.py:353: error: "SocketType" has no attribute "share" [attr-defined]
+ src/trio/_tests/test_socket.py:354: error: Module has no attribute "fromshare" [attr-defined]
pandera (https://github.com/pandera-dev/pandera)
+ tests/core/test_schema_components.py:476: error: "Iterable[Any]" has no attribute "tolist" [attr-defined]
rich (https://github.com/Textualize/rich)
+ rich/_windows.py:56: error: Module has no attribute "getwindowsversion" [attr-defined]
manticore (https://github.com/trailofbits/manticore)
+ manticore/wasm/types.py:56: error: Unused "type: ignore" comment [unused-ignore]
+ manticore/native/cpu/abstractcpu.py:693: error: Incompatible types in assignment (expression has type "bool", variable has type "Never") [assignment]
+ manticore/native/cpu/abstractcpu.py:695: error: Incompatible types in assignment (expression has type "int", variable has type "Never") [assignment]
pandas (https://github.com/pandas-dev/pandas)
+ pandas/core/dtypes/dtypes.py:480: error: Incompatible types in assignment (expression has type "dtype[Any] | ExtensionDtype", variable has type "str") [assignment]
+ pandas/core/arrays/categorical.py:453: error: Item "ExtensionArray" of "ExtensionArray | ndarray[Any, Any]" has no attribute "_pa_array" [union-attr]
+ pandas/core/arrays/categorical.py:453: error: Item "ndarray[Any, Any]" of "ExtensionArray | ndarray[Any, Any]" has no attribute "_pa_array" [union-attr]
+ pandas/io/pytables.py:2077: error: Value of type "None" is not indexable [index]
+ pandas/core/generic.py:4656: error: "ndarray[tuple[int, ...], dtype[numpy.bool[builtins.bool]]]" has no attribute "to_numpy" [attr-defined]
+ pandas/core/frame.py:11564: error: Item "ndarray[Any, Any]" of "ExtensionArray | ndarray[Any, Any]" has no attribute "_reduce" [union-attr]
+ pandas/core/window/ewm.py:1069: error: Value of type "None" is not indexable [index]
+ pandas/core/tools/datetimes.py:1056: error: Incompatible types in assignment (expression has type "bool", variable has type "Timestamp | NaTType | Series | Index") [assignment]
+ pandas/core/internals/managers.py:234: error: "BaseBlockManager" has no attribute "_rebuild_blknos_and_blklocs" [attr-defined]
+ pandas/core/internals/managers.py:245: error: "BaseBlockManager" has no attribute "_rebuild_blknos_and_blklocs" [attr-defined]
+ pandas/core/reshape/reshape.py:495: error: Incompatible types in assignment (expression has type "Index", variable has type "Never") [assignment]
+ pandas/core/reshape/reshape.py:501: error: Generator has incompatible item type "signedinteger[_32Bit | _64Bit]"; expected "ndarray[tuple[int, ...], dtype[signedinteger[_32Bit | _64Bit]]]" [misc]
+ pandas/core/reshape/reshape.py:508: error: Incompatible types in assignment (expression has type "MultiIndex", variable has type "Never") [assignment]
+ pandas/core/reshape/reshape.py:966: error: Incompatible types in assignment (expression has type "list[Any]", variable has type "FrozenList") [assignment]
+ pandas/core/reshape/reshape.py:967: error: Incompatible types in assignment (expression has type "list[ndarray[Any, Any]]", variable has type "FrozenList") [assignment]
- pandas/io/formats/style.py:1903: error: "Never" has no attribute "shape" [attr-defined]
- pandas/io/formats/style.py:1906: error: "Never" has no attribute "shape" [attr-defined]
ignite (https://github.com/pytorch/ignite)
+ ignite/engine/engine.py:246: error: Argument 1 to "append" of "list" has incompatible type "list[str] | list[EventEnum]"; expected "EventEnum" [arg-type]
+ ignite/engine/engine.py:248: error: Invalid index type "list[str] | list[EventEnum]" for "dict[str | Events | CallableEventWithFilter, str]"; expected type "str | Events | CallableEventWithFilter" [index]
+ ignite/handlers/param_scheduler.py:1179: error: Argument 1 to "ConcatScheduler" has incompatible type "list[ParamScheduler | ParamGroupScheduler | Any]"; expected "list[ParamScheduler]" [arg-type]
+ ignite/handlers/param_scheduler.py:1188: error: Argument "schedulers" to "simulate_values" of "ConcatScheduler" has incompatible type "list[ParamScheduler | ParamGroupScheduler | Any]"; expected "list[ParamScheduler]" [arg-type]
+ ignite/handlers/lr_finder.py:103: error: Unsupported operand types for * ("int" and "None") [operator]
+ ignite/handlers/lr_finder.py:103: error: Unsupported operand types for * ("None" and "int") [operator]
+ ignite/handlers/lr_finder.py:103: error: Unsupported left operand type for * ("None") [operator]
+ ignite/handlers/lr_finder.py:103: note: Both left and right operands are unions
mitmproxy (https://github.com/mitmproxy/mitmproxy)
+ mitmproxy/contentviews/__init__.py:201: error: "None" not callable [misc]
kornia (https://github.com/kornia/kornia)
+ kornia/feature/lightglue.py:580: error: "None" has no attribute "__iter__" (not iterable) [attr-defined]
+ kornia/contrib/models/sam/model.py:212: error: "SamConfig" has no attribute "num_heads" [attr-defined]
PyGithub (https://github.com/PyGithub/PyGithub)
- github/GithubRetry.py:202: error: Unused "type: ignore" comment [unused-ignore]
+ github/Team.py:305: error: Incompatible types in assignment (expression has type "str", variable has type "Repository") [assignment]
werkzeug (https://github.com/pallets/werkzeug)
+ src/werkzeug/middleware/shared_data.py:139: error: Cannot assign to a method [method-assign]
+ src/werkzeug/middleware/shared_data.py:139: error: Incompatible types in assignment (expression has type "Callable[[Arg(str, 'x')], bool]", variable has type "Callable[[Arg(str, 'filename')], bool]") [assignment]
+ tests/test_wrappers.py:729: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment]
+ tests/test_wrappers.py:741: error: Incompatible types in assignment (expression has type "int", variable has type "Optional[timedelta]") [assignment]
+ tests/test_wrappers.py:981: error: Call to untyped function "generate_items" in typed context [no-untyped-call]
+ tests/test_wrappers.py:997: error: Argument 1 to "write" of "ResponseStream" has incompatible type "str"; expected "bytes" [arg-type]
+ tests/test_wrappers.py:998: error: Non-overlapping equality check (left operand type: "tuple[str, str]", right operand type: "list[str]") [comparison-overlap]
+ tests/test_http.py:141: error: Incompatible types in assignment (expression has type "float", variable has type "Optional[int]") [assignment]
+ tests/test_http.py:144: error: Incompatible types in assignment (expression has type "float", variable has type "Optional[int]") [assignment]
mypy (https://github.com/python/mypy)
+ mypyc/ir/pprint.py:231: error: "PrimitiveOp" has no attribute "type_args" [attr-defined]
+ mypyc/ir/pprint.py:232: error: "PrimitiveOp" has no attribute "type_args" [attr-defined]
xarray (https://github.com/pydata/xarray)
+ xarray/core/npcompat.py: note: In function "isdtype":
+ xarray/core/npcompat.py:73: error: Argument 2 to "isinstance" has incompatible type "set[type | type[float64]]"; expected "_ClassInfo" [arg-type]
+ xarray/core/variable.py:899: error: Unused "type: ignore" comment [unused-ignore]
+ xarray/core/variable.py:901: error: Unused "type: ignore" comment [unused-ignore]
+ xarray/core/variable.py: note: In member "_pad_options_dim_to_index" of class "Variable":
+ xarray/core/variable.py:1118: error: Unsupported target for indexed assignment ("Mapping[Any, int | float | tuple[int, int] | tuple[float, float]]") [index]
+ xarray/core/variable.py: note: At top level:
+ xarray/core/variable.py:2785: error: Unused "type: ignore" comment [unused-ignore]
+ xarray/core/variable.py:2787: error: Unused "type: ignore" comment [unused-ignore]
- xarray/core/computation.py: note: In function "apply_variable_ufunc":
- xarray/core/computation.py:848: error: "Never" has no attribute "ndim" [attr-defined]
- xarray/core/computation.py:851: error: "Never" has no attribute "ndim" [attr-defined]
+ xarray/coding/cftime_offsets.py: note: In function "date_range_like":
+ xarray/coding/cftime_offsets.py:1588: error: Left operand of "and" is always true [redundant-expr]
+ xarray/core/dataset.py: note: In member "transpose" of class "Dataset":
+ xarray/core/dataset.py:6173: error: If condition is always true [redundant-expr]
+ xarray/core/dataset.py: note: At top level:
+ xarray/core/dataarray.py: note: In member "to_pandas" of class "DataArray":
+ xarray/core/dataarray.py:3921: error: Incompatible types in assignment (expression has type "ndarray[Any, Any]", variable has type "Never") [assignment]
+ xarray/core/dataarray.py: note: At top level:
steam.py (https://github.com/Gobot1234/steam.py)
+ steam/tag.py:117: error: Yield value expected [misc]
+ steam/abc.py:992: error: Yield value expected [misc]
+ steam/ext/tf2/backpack.py:301: error: "BackpackItem[OwnerT]" has no attribute "elevated" [attr-defined]
+ steam/ext/tf2/backpack.py:304: error: "BackpackItem[OwnerT]" has no attribute "killstreak" [attr-defined]
+ steam/ext/tf2/backpack.py:305: error: "BackpackItem[OwnerT]" has no attribute "killstreak" [attr-defined]
+ steam/ext/tf2/backpack.py:310: error: "BackpackItem[OwnerT]" has no attribute "festivized"; maybe "is_festivized"? [attr-defined]
+ steam/ext/tf2/backpack.py:313: error: "BackpackItem[OwnerT]" has no attribute "craft_number" [attr-defined]
+ steam/ext/tf2/backpack.py:314: error: "BackpackItem[OwnerT]" has no attribute "selfNumber" [attr-defined]
+ steam/ext/tf2/backpack.py:316: error: "BackpackItem[OwnerT]" has no attribute "crate_number" [attr-defined]
+ steam/ext/tf2/backpack.py:317: error: "BackpackItem[OwnerT]" has no attribute "selfNumber" [attr-defined]
+ steam/ext/tf2/backpack.py:343: error: Incompatible return value type (got "BackpackItem[OwnerT]", expected "BackpackItem[None]") [return-value]
Expression (https://github.com/cognitedata/Expression)
+ expression/core/result.py:267: error: Incompatible types in "yield" (actual type "None", expected type "_TSourceOut") [misc]
+ expression/core/option.py:308: error: Incompatible types in "yield" (actual type "None", expected type "_TSourceOut") [misc]
+ README.py:629: error: Incompatible types in assignment (expression has type "range", variable has type "Seq[int]") [assignment]
+ tests/test_seq_builder.py:186: error: Yield value expected [misc]
+ tests/test_result_builder.py:221: error: Yield value expected [misc]
+ tests/test_option_builder.py:218: error: Yield value expected [misc]
streamlit (https://github.com/streamlit/streamlit)
+ lib/streamlit/type_util.py: note: In function "to_bytes":
+ lib/streamlit/type_util.py:167:26: error: If x = b'abc' then f"{x}" or "{}".format(x) produces "b'abc'", not "abc". If this is desired behavior, use f"{x!r}" or "{!r}".format(x). Otherwise, decode the bytes [str-bytes-safe]
+ lib/tests/streamlit/watcher/local_sources_watcher_test.py:263:17: error: Module "streamlit.watcher.local_sources_watcher" does not explicitly export attribute "get_default_path_watcher_class" [attr-defined]
+ lib/tests/streamlit/stop_test.py:25:16: error: Item "None" of "Optional[ScriptRequests]" has no attribute "_state" [union-attr]
poetry (https://github.com/python-poetry/poetry)
+ src/poetry/utils/helpers.py:307: error: Module has no attribute "OpenKey" [attr-defined]
+ src/poetry/utils/helpers.py:308: error: Module has no attribute "HKEY_CURRENT_USER" [attr-defined]
+ src/poetry/utils/helpers.py:311: error: Module has no attribute "QueryValueEx" [attr-defined]
+ src/poetry/utils/helpers.py:331: error: Module has no attribute "windll" [attr-defined]
+ src/poetry/utils/helpers.py:342: error: Module has no attribute "windll" [attr-defined]
urllib3 (https://github.com/urllib3/urllib3)
+ src/urllib3/util/ssl_.py:271: error: Argument 1 to "get" of "dict" has incompatible type "int | None"; expected "int" [arg-type]
+ src/urllib3/util/ssl_.py:274: error: Argument 1 to "get" of "dict" has incompatible type "int | None"; expected "int" [arg-type]
+ src/urllib3/util/ssl_.py:288: error: "None" not callable [misc]
+ src/urllib3/util/ssl_.py:351: error: Returning Any from function declared to return "SSLContext" [no-any-return]
+ src/urllib3/util/ssl_.py:501: error: "None" has no attribute "_validate_ssl_context_for_tls_in_tls" [attr-defined]
+ src/urllib3/util/ssl_.py:502: error: Returning Any from function declared to return "SSLSocket | SSLTransport" [no-any-return]
+ src/urllib3/util/ssl_.py:502: error: "None" not callable [misc]
+ src/urllib3/contrib/emscripten/response.py:192: error: "None" has no attribute "_put_conn" [attr-defined]
+ src/urllib3/contrib/emscripten/fetch.py:400: error: Argument 1 to "len" has incompatible type "Buffer"; expected "Sized" [arg-type]
+ src/urllib3/contrib/emscripten/fetch.py:400: error: Argument 1 to "len" has incompatible type "None"; expected "Sized" [arg-type]
+ src/urllib3/contrib/emscripten/fetch.py:402: error: Unsupported target for indexed assignment ("Buffer") [index]
+ src/urllib3/contrib/emscripten/fetch.py:402: error: Value of type "None" is not indexable [index]
+ src/urllib3/contrib/emscripten/fetch.py:406: error: Argument 1 to "len" has incompatible type "None"; expected "Sized" [arg-type]
+ test/test_response.py:647: error: Incompatible types in assignment (expression has type "int", variable has type "HTTPResponse | None") [assignment]
aiohttp (https://github.com/aio-libs/aiohttp)
+ aiohttp/client_exceptions.py:339:19: error: Incompatible types in assignment (expression has type "tuple[Never, ...]", variable has type "tuple[type[SSLCertVerificationError]]") [assignment]
+ aiohttp/client_exceptions.py:339:19: note: Error code "assignment" not covered by "type: ignore" comment
+ aiohttp/client_exceptions.py:340:25: error: Incompatible types in assignment (expression has type "tuple[type[ClientSSLError], type[ValueError]]", variable has type "tuple[type[ClientSSLError], type[SSLCertVerificationError]]") [assignment]
+ aiohttp/client_exceptions.py:345:18: error: Incompatible types in assignment (expression has type "tuple[Never, ...]", variable has type "tuple[type[SSLError]]") [assignment]
+ aiohttp/client_exceptions.py:346:23: error: Incompatible types in assignment (expression has type "tuple[type[ClientSSLError]]", variable has type "tuple[type[ClientSSLError], type[SSLError]]") [assignment]
+ aiohttp/cookiejar.py:473:13: error: Incompatible types in "yield" (actual type "None", expected type "Morsel[str]") [misc]
+ aiohttp/cookiejar.py:473:13: note: Error code "misc" not covered by "type: ignore" comment
+ aiohttp/multipart.py:319:32: error: Argument 1 to "decode" of "BodyPartReader" has incompatible type "bytearray"; expected "bytes" [arg-type]
+ aiohttp/multipart.py:320:16: error: Incompatible return value type (got "bytearray", expected "bytes") [return-value]
+ aiohttp/connector.py:779:16: error: Incompatible return value type (got "None", expected "SSLContext") [return-value]
+ aiohttp/connector.py:779:16: note: Error code "return-value" not covered by "type: ignore" comment
+ aiohttp/client_reqrep.py:172:25: error: Incompatible types in assignment (expression has type "tuple[type[bool]]", variable has type "tuple[type[SSLContext], type[bool], type[Fingerprint]]") [assignment]
+ aiohttp/client_reqrep.py:172:25: note: Error code "assignment" not covered by "type: ignore" comment
spark (https://github.com/apache/spark)
+ python/pyspark/core/context.py:818: error: Unused "type: ignore" comment [unused-ignore]
+ python/pyspark/core/context.py:819: error: Unused "type: ignore" comment [unused-ignore]
+ python/pyspark/sql/types.py:1301: error: Incompatible return value type (got "StructType", expected "StructField") [return-value]
+ python/pyspark/sql/types.py:1301: error: Argument 1 to "StructType" has incompatible type "StructField"; expected "list[StructField] | None" [arg-type]
+ python/pyspark/sql/types.py:1479: error: Return value expected [return-value]
+ python/pyspark/sql/types.py:1523: error: Return value expected [return-value]
+ python/pyspark/sql/readwriter.py:845: error: Function is missing a type annotation [no-untyped-def]
+ python/pyspark/sql/readwriter.py:854: error: Incompatible types in assignment (expression has type "bool", variable has type "Never") [assignment]
+ python/pyspark/sql/readwriter.py:855: error: Item "None" of "Any | None" has no attribute "BytesToString" [union-attr]
+ python/pyspark/sql/readwriter.py:861: error: Item "None" of "Any | None" has no attribute "Encoders" [union-attr]
+ python/pyspark/sql/streaming/state.py:224: error: Incompatible types in assignment (expression has type "float", variable has type "int") [assignment]
+ python/pyspark/sql/pandas/conversion.py:712: error: List comprehension has incompatible type List[TimestampType | None]; expected List[DataType] [misc]
+ python/pyspark/sql/pandas/conversion.py:715: error: PandasDataFrameLike? has no attribute "dtypes" [attr-defined]
+ python/pyspark/sql/session.py:1538: error: Incompatible types in assignment (expression has type "list[Never]", variable has type "AtomicType | StructType | str | None") [assignment]
+ python/pyspark/sql/classic/dataframe.py:1609: error: "tuple[dict[str, Column]]" has no attribute "keys" [attr-defined]
+ python/pyspark/sql/classic/dataframe.py:1610: error: "tuple[dict[str, Column]]" has no attribute "values" [attr-defined]
+ python/pyspark/pandas/generic.py:788: error: Need type annotation for "new_name" [var-annotated]
+ python/pyspark/sql/connect/dataframe.py:885: error: "tuple[dict[str, Column]]" has no attribute "items" [attr-defined]
+ python/pyspark/sql/connect/client/core.py:1783: error: Unexpected keyword argument "message_paramters" for "PySparkValueError"; did you mean "messageParameters"? [call-arg]
+ python/pyspark/errors/exceptions/base.py:35: note: "PySparkValueError" defined here
+ python/pyspark/sql/worker/write_into_data_source.py:208: error: Incompatible types in assignment (expression has type "WriterCommitMessage", variable has type "Never") [assignment]
+ python/pyspark/streaming/context.py:390: error: Argument 1 to "parallelize" of "SparkContext" has incompatible type "RDD[T]"; expected "Iterable[T]" [arg-type]
+ python/pyspark/ml/connect/readwrite.py:286: error: Argument 1 to "session" of "BaseReadWrite" has incompatible type "pyspark.sql.connect.session.SparkSession"; expected "pyspark.sql.session.SparkSession" [arg-type]
+ python/pyspark/ml/connect/readwrite.py:287: error: Incompatible return value type (got "Pipeline", expected "RL") [return-value]
+ python/pyspark/ml/connect/readwrite.py:293: error: Argument 1 to "session" of "BaseReadWrite" has incompatible type "pyspark.sql.connect.session.SparkSession"; expected "pyspark.sql.session.SparkSession" [arg-type]
+ python/pyspark/ml/connect/readwrite.py:294: error: Incompatible return value type (got "PipelineModel", expected "RL") [return-value]
+ python/pyspark/ml/connect/readwrite.py:300: error: Argument 1 to "session" of "BaseReadWrite" has incompatible type "pyspark.sql.connect.session.SparkSession"; expected "pyspark.sql.session.SparkSession" [arg-type]
+ python/pyspark/ml/connect/readwrite.py:301: error: Incompatible return value type (got "CrossValidator", expected "RL") [return-value]
+ python/pyspark/ml/connect/readwrite.py:306: error: Argument 1 to "CrossValidatorModelReader" has incompatible type "type[CrossValidator]"; expected "type[CrossValidatorModel]" [arg-type]
+ python/pyspark/ml/connect/readwrite.py:307: error: Argument 1 to "session" of "BaseReadWrite" has incompatible type "pyspark.sql.connect.session.SparkSession"; expected "pyspark.sql.session.SparkSession" [arg-type]
+ python/pyspark/ml/connect/readwrite.py:308: error: Incompatible return value type (got "CrossValidatorModel", expected "RL") [return-value]
+ python/pyspark/ml/connect/readwrite.py:314: error: Argument 1 to "session" of "BaseReadWrite" has incompatible type "pyspark.sql.connect.session.SparkSession"; expected "pyspark.sql.session.SparkSession" [arg-type]
+ python/pyspark/ml/connect/readwrite.py:315: error: Incompatible return value type (got "TrainValidationSplit", expected "RL") [return-value]
+ python/pyspark/ml/connect/readwrite.py:320: error: Incompatible types in assignment (expression has type "TrainValidationSplitModelReader", variable has type "TrainValidationSplitReader") [assignment]
+ python/pyspark/ml/connect/readwrite.py:321: error: Argument 1 to "session" of "BaseReadWrite" has incompatible type "pyspark.sql.connect.session.SparkSession"; expected "pyspark.sql.session.SparkSession" [arg-type]
+ python/pyspark/ml/connect/readwrite.py:322: error: Incompatible return value type (got "TrainValidationSplit", expected "RL") [return-value]
+ python/pyspark/ml/connect/readwrite.py:328: error: Argument 1 to "session" of "BaseReadWrite" has incompatible type "pyspark.sql.connect.session.SparkSession"; expected "pyspark.sql.session.SparkSession" [arg-type]
+ python/pyspark/ml/connect/readwrite.py:329: error: Incompatible return value type (got "OneVsRest[Any]", expected "RL") [return-value]
+ python/pyspark/ml/connect/readwrite.py:335: error: Argument 1 to "session" of "BaseReadWrite" has incompatible type "pyspark.sql.connect.session.SparkSession"; expected "pyspark.sql.session.SparkSession" [arg-type]
+ python/pyspark/ml/connect/readwrite.py:336: error: Incompatible return value type (got "OneVsRestModel", expected "RL") [return-value]
+ python/pyspark/ml/connect/readwrite.py:356: error: Incompatible types in assignment (expression has type "PowerIterationClustering", variable has type "Never") [assignment]
+ python/pyspark/ml/connect/readwrite.py:360: error: Unused "type: ignore" comment [unused-ignore]
+ python/pyspark/mllib/linalg/__init__.py:1104: error: Incompatible return value type (got "SparseVector", expected "DenseVector") [return-value]
anyio (https://github.com/agronholm/anyio)
+ src/anyio/to_interpreter.py:189: error: Argument 2 to "call" of "Worker" has incompatible type "tuple[*PosArgsT]"; expected "tuple[Any]" [arg-type]
psycopg (https://github.com/psycopg/psycopg)
+ psycopg/psycopg/_conninfo_attempts_async.py:106: error: Incompatible types in assignment (expression has type "list[tuple[AddressFamily, SocketKind, int, str, tuple[str, int] | tuple[str, int, int, int] | tuple[int, bytes]]]", variable has type "list[tuple[AddressFamily, SocketKind, int, str, tuple[str, int] | tuple[str, int, int, int]]]") [assignment]
+ psycopg/psycopg/connection_async.py:39: error: Incompatible import of "Lock" (imported name has type "type[lock]", local name has type "type[Lock]") [assignment]
+ psycopg/psycopg/connection_async.py:56: error: Incompatible types in assignment (expression has type "type[KeyboardInterrupt]", variable has type "tuple[type[CancelledError], type[KeyboardInterrupt]]") [assignment]
+ psycopg/psycopg/connection_async.py:447: error: Value of type "Coroutine[Any, Any, None]" must be used [unused-coroutine]
+ psycopg/psycopg/connection_async.py:447: note: Are you missing an await?
+ psycopg/psycopg/connection_async.py:458: error: Value of type "Coroutine[Any, Any, None]" must be used [unused-coroutine]
+ psycopg/psycopg/connection_async.py:458: note: Are you missing an await?
+ psycopg/psycopg/connection_async.py:469: error: Value of type "Coroutine[Any, Any, None]" must be used [unused-coroutine]
+ psycopg/psycopg/connection_async.py:469: note: Are you missing an await?
+ psycopg/psycopg/connection_async.py:480: error: Value of type "Coroutine[Any, Any, None]" must be used [unused-coroutine]
+ psycopg/psycopg/connection_async.py:480: note: Are you missing an await?
+ tests/pq/test_pgconn.py:45: error: If x = b'abc' then f"{x}" or "{}".format(x) produces "b'abc'", not "abc". If this is desired behavior, use f"{x!r}" or "{!r}".format(x). Otherwise, decode the bytes [str-bytes-safe]
+ tests/pool/test_sched_async.py:153: error: Incompatible types in assignment (expression has type "tuple[Any]", variable has type "tuple[()]") [assignment]
+ psycopg_pool/psycopg_pool/pool_async.py:120: error: Expected iterable as variadic argument [misc]
+ psycopg_pool/psycopg_pool/pool_async.py:120: error: Value of type "Coroutine[Any, Any, None]" must be used [unused-coroutine]
+ psycopg_pool/psycopg_pool/pool_async.py:120: note: Are you missing an await?
+ psycopg_pool/psycopg_pool/pool_async.py:591: error: Value of type "Coroutine[Any, Any, AsyncCursor[Any]]" must be used [unused-coroutine]
+ psycopg_pool/psycopg_pool/pool_async.py:591: note: Are you missing an await?
+ tests/pool/test_pool_common_async.py:71: error: Incompatible types in assignment (expression has type "type[DeprecationWarning]", variable has type "type[RuntimeWarning]") [assignment]
jinja (https://github.com/pallets/jinja)
+ src/jinja2/runtime.py:903: error: Statement is unreachable [unreachable]
dulwich (https://github.com/dulwich/dulwich)
+ dulwich/refs.py:804: error: Unsupported right operand type for in ("None") [operator]
+ dulwich/refs.py:807: error: "None" has no attribute "__delitem__" [attr-defined]
+ dulwich/refs.py:809: error: "None" has no attribute "__delitem__" [attr-defined]
antidote (https://github.com/Finistere/antidote)
+ tests/lib/injectable/test_injectable.py:121: error: Missing positional argument "x" in call to "method" of "MyService" [call-arg]
sphinx (https://github.com/sphinx-doc/sphinx)
+ sphinx/util/osutil.py: note: In function "_relative_path":
+ sphinx/util/osutil.py:191:12: error: Unexpected keyword argument "walk_up" for "relative_to" of "PurePath" [call-arg]
+ note: "relative_to" of "PurePath" defined here
+ sphinx/transforms/__init__.py: note: In member "apply_transforms" of class "SphinxTransformer":
+ sphinx/transforms/__init__.py:103:33: error: Incompatible types in assignment (expression has type "Node", variable has type "document") [assignment]
pandas-stubs (https://github.com/pandas-dev/pandas-stubs)
+ tests/test_frame.py:3808: error: All overload variants of "select_dtypes" of "DataFrame" require at least one argument [call-overload]
+ tests/test_frame.py:3808: note: Possible overload variants:
+ tests/test_frame.py:3808: note: def select_dtypes(self, include: Literal['str', 'string', 'U', 'str_', 'str0', 'unicode', 'unicode_', 'string[pyarrow]'] | type[str] | StringDtype | type[str_], exclude: Literal['number', 'datetime64', 'datetime', 'integer', 'timedelta', 'timedelta64', 'datetimetz', 'datetime64[ns]'] | Literal['bool', 'boolean', '?', 'b1', 'bool_', 'bool[pyarrow]', 'boolean[pyarrow]'] | type[builtins.bool] | BooleanDtype | type[numpy.bool[builtins.bool]] | Literal['int', 'Int8', 'Int16', 'Int32', 'Int64', 'b', 'i1', 'int8', 'byte', 'h', 'i2', 'int16', 'short', 'i', 'i4', 'int32', 'intc', 'l', 'i8', 'int64', 'int_', 'long', 'q', 'longlong', 'p', 'intp', 'int8[pyarrow]', 'int16[pyarrow]', 'int32[pyarrow]', 'int64[pyarrow]'] | type[int] | Int8Dtype | Int16Dtype | Int32Dtype | Int64Dtype | <6 more items> | Literal['UInt8', 'UInt16', 'UInt32', 'UInt64', 'B', 'u1', 'uint8', 'ubyte', 'H', 'u2', 'uint16', 'ushort', 'I', 'u4', 'uint32', 'uintc', 'L', 'u8', 'uint', 'ulong', 'uint64', 'Q', 'ulonglong', 'P', 'uintp', 'uint8[pyarrow]', 'uint16[pyarrow]', 'uint32[pyarrow]', 'uint64[pyarrow]'] | UInt8Dtype | UInt16Dtype | UInt32Dtype | UInt64Dtype | type[unsignedinteger[_8Bit]] | type[unsignedinteger[_16Bit]] | type[unsignedinteger[_32Bit]] | type[unsignedinteger[_32Bit | _64Bit]] | type[unsignedinteger[_64Bit]] | type[unsignedinteger[_32Bit | _64Bit]] | Literal['str', 'string', 'U', 'str_', 'str0', 'unicode', 'unicode_', 'string[pyarrow]'] | type[str] | StringDtype | type[str_] | Literal['bytes', 'S', 'bytes_', 'bytes0', 'string_', 'binary[pyarrow]'] | type[bytes] | type[bytes_] | <8 more items> | list[Literal['number', 'datetime64', 'datetime', 'integer', 'timedelta', 'timedelta64', 'datetimetz', 'datetime64[ns]'] | Literal['bool', 'boolean', '?', 'b1', 'bool_', 'bool[pyarrow]', 'boolean[pyarrow]'] | type[builtins.bool] | BooleanDtype | type[numpy.bool[builtins.bool]] | Literal['int', 'Int8', 'Int16', 'Int32', 'Int64', 'b', 'i1', 'int8', 'byte', 'h', 'i2', 'int16', 'short', 'i', 'i4', 'int32', 'intc', 'l', 'i8', 'int64', 'int_', 'long', 'q', 'longlong', 'p', 'intp', 'int8[pyarrow]', 'int16[pyarrow]', 'int32[pyarrow]', 'int64[pyarrow]'] | type[int] | Int8Dtype | Int16Dtype | Int32Dtype | Int64Dtype | <6 more items> | Literal['UInt8', 'UInt16', 'UInt32', 'UInt64', 'B', 'u1', 'uint8', 'ubyte', 'H', 'u2', 'uint16', 'ushort', 'I', 'u4', 'uint32', 'uintc', 'L', 'u8', 'uint', 'ulong', 'uint64', 'Q', 'ulonglong', 'P', 'uintp', 'uint8[pyarrow]', 'uint16[pyarrow]', 'uint32[pyarrow]', 'uint64[pyarrow]'] | UInt8Dtype | UInt16Dtype | UInt32Dtype | UInt64Dtype | type[unsignedinteger[_8Bit]] | type[unsignedinteger[_16Bit]] | type[unsignedinteger[_32Bit]] | type[unsignedinteger[_32Bit | _64Bit]] | type[unsignedinteger[_64Bit]] | type[unsignedinteger[_32Bit | _64Bit]] | Literal['str', 'string', 'U', 'str_', 'str0', 'unicode', 'unicode_', 'string[pyarrow]'] | type[str] | StringDtype | type[str_] | Literal['bytes', 'S', 'bytes_', 'bytes0', 'string_', 'binary[pyarrow]'] | type[bytes] | type[bytes_] | <8 more items>] | None = ...) -> Never
+ tests/test_frame.py:3808: note: def select_dtypes(self, include: Literal['number', 'datetime64', 'datetime', 'integer', 'timedelta', 'timedelta64', 'datetimetz', 'datetime64[ns]'] | Literal['bool', 'boolean', '?', 'b1', 'bool_', 'bool[pyarrow]', 'boolean[pyarrow]'] | type[builtins.bool] | BooleanDtype | type[numpy.bool[builtins.bool]] | Literal['int', 'Int8', 'Int16', 'Int32', 'Int64', 'b', 'i1', 'int8', 'byte', 'h', 'i2', 'int16', 'short', 'i', 'i4', 'int32', 'intc', 'l', 'i8', 'int64', 'int_', 'long', 'q', 'longlong', 'p', 'intp', 'int8[pyarrow]', 'int16[pyarrow]', 'int32[pyarrow]', 'int64[pyarrow]'] | type[int] | Int8Dtype | Int16Dtype | Int32Dtype | Int64Dtype | <6 more items> | Literal['UInt8', 'UInt16', 'UInt32', 'UInt64', 'B', 'u1', 'uint8', 'ubyte', 'H', 'u2', 'uint16', 'ushort', 'I', 'u4', 'uint32', 'uintc', 'L', 'u8', 'uint', 'ulong', 'uint64', 'Q', 'ulonglong', 'P', 'uintp', 'uint8[pyarrow]', 'uint16[pyarrow]', 'uint32[pyarrow]', 'uint64[pyarrow]'] | UInt8Dtype | UInt16Dtype | UInt32Dtype | UInt64Dtype | type[unsignedinteger[_8Bit]] | type[unsignedinteger[_16Bit]] | type[unsignedinteger[_32Bit]] | type[unsignedinteger[_32Bit | _64Bit]] | type[unsignedinteger[_64Bit]] | type[unsignedinteger[_32Bit | _64Bit]] | Literal['str', 'string', 'U', 'str_', 'str0', 'unicode', 'unicode_', 'string[pyarrow]'] | type[str] | StringDtype | type[str_] | Literal['bytes', 'S', 'bytes_', 'bytes0', 'string_', 'binary[pyarrow]'] | type[bytes] | type[bytes_] | <8 more items> | list[Literal['number', 'datetime64', 'datetime', 'integer', 'timedelta', 'timedelta64', 'datetimetz', 'datetime64[ns]'] | Literal['bool', 'boolean', '?', 'b1', 'bool_', 'bool[pyarrow]', 'boolean[pyarrow]'] | type[builtins.bool] | BooleanDtype | type[numpy.bool[builtins.bool]] | Literal['int', 'Int8', 'Int16', 'Int32', 'Int64', 'b', 'i1', 'int8', 'byte', 'h', 'i2', 'int16', 'short', 'i', 'i4', 'int32', 'intc', 'l', 'i8', 'int64', 'int_', 'long', 'q', 'longlong', 'p', 'intp', 'int8[pyarrow]', 'int16[pyarrow]', 'int32[pyarrow]', 'int64[pyarrow]'] | type[int] | Int8Dtype | Int16Dtype | Int32Dtype | Int64Dtype | <6 more items> | Literal['UInt8', 'UInt16', 'UInt32', 'UInt64', 'B', 'u1', 'uint8', 'ubyte', 'H', 'u2', 'uint16', 'ushort', 'I', 'u4', 'uint32', 'uintc', 'L', 'u8', 'uint', 'ulong', 'uint64', 'Q', 'ulonglong', 'P', 'uintp', 'uint8[pyarrow]', 'uint16[pyarrow]', 'uint32[pyarrow]', 'uint64[pyarrow]'] | UInt8Dtype | UInt16Dtype | UInt32Dtype | UInt64Dtype | type[unsignedinteger[_8Bit]] | type[unsignedinteger[_16Bit]] | type[unsignedinteger[_32Bit]] | type[unsignedinteger[_32Bit | _64Bit]] | type[unsignedinteger[_64Bit]] | type[unsignedinteger[_32Bit | _64Bit]] | Literal['str', 'string', 'U', 'str_', 'str0', 'unicode', 'unicode_', 'string[pyarrow]'] | type[str] | StringDtype | type[str_] | Literal['bytes', 'S', 'bytes_', 'bytes0', 'string_', 'binary[pyarrow]'] | type[bytes] | type[bytes_] | <8 more items>] | None, exclude: Literal['str', 'string', 'U', 'str_', 'str0', 'unicode', 'unicode_', 'string[pyarrow]'] | type[str] | StringDtype | type[str_]) -> Never
+ tests/test_frame.py:3808: note: def select_dtypes(self, exclude: Literal['str', 'string', 'U', 'str_', 'str0', 'unicode', 'unicode_', 'string[pyarrow]'] | type[str] | StringDtype | type[str_]) -> Never
+ tests/test_frame.py:3808: note: def select_dtypes(self, include: list[Never], exclude: list[Never]) -> Never
+ tests/test_frame.py:3808: note: def select_dtypes(self, include: Literal['number', 'datetime64', 'datetime', 'integer', 'timedelta', 'timedelta64', 'datetimetz', 'datetime64[ns]'] | Literal['bool', 'boolean', '?', 'b1', 'bool_', 'bool[pyarrow]', 'boolean[pyarrow]'] | type[builtins.bool] | BooleanDtype | type[numpy.bool[builtins.bool]] | Literal['int', 'Int8', 'Int16', 'Int32', 'Int64', 'b', 'i1', 'int8', 'byte', 'h', 'i2', 'int16', 'short', 'i', 'i4', 'int32', 'intc', 'l', 'i8', 'int64', 'int_', 'long', 'q', 'longlong', 'p', 'intp', 'int8[pyarrow]', 'int16[pyarrow]', 'int32[pyarrow]', 'int64[pyarrow]'] | type[int] | Int8Dtype | Int16Dtype | Int32Dtype | Int64Dtype | <6 more items> | Literal['UInt8', 'UInt16', 'UInt32', 'UInt64', 'B', 'u1', 'uint8', 'ubyte', 'H', 'u2', 'uint16', 'ushort', 'I', 'u4', 'uint32', 'uintc', 'L', 'u8', 'uint', 'ulong', 'uint64', 'Q', 'ulonglong', 'P', 'uintp', 'uint8[pyarrow]', 'uint16[pyarrow]', 'uint32[pyarrow]', 'uint64[pyarrow]'] | UInt8Dtype | UInt16Dtype | UInt32Dtype | UInt64Dtype | type[unsignedinteger[_8Bit]] | type[unsignedinteger[_16Bit]] | type[unsignedinteger[_32Bit]] | type[unsignedinteger[_32Bit | _64Bit]] | type[unsignedinteger[_64Bit]] | type[unsignedinteger[_32Bit | _64Bit]] | Literal['str', 'string', 'U', 'str_', 'str0', 'unicode', 'unicode_', 'string[pyarrow]'] | type[str] | StringDtype | type[str_] | Literal['bytes', 'S', 'bytes_', 'bytes0', 'string_', 'binary[pyarrow]'] | type[bytes] | type[bytes_] | <8 more items> | list[Literal['number', 'datetime64', 'datetime', 'integer', 'timedelta', 'timedelta64', 'datetimetz', 'datetime64[ns]'] | Literal['bool', 'boolean', '?', 'b1', 'bool_', 'bool[pyarrow]', 'boolean[pyarrow]'] | type[builtins.bool] | BooleanDtype | type[numpy.bool[builtins.bool]] | Literal['int', 'Int8', 'Int16', 'Int32', 'Int64', 'b', 'i1', 'int8', 'byte', 'h', 'i2', 'int16', 'short', 'i', 'i4', 'int32', 'intc', 'l', 'i8', 'int64', 'int_', 'long', 'q', 'longlong', 'p', 'intp', 'int8[pyarrow]', 'int16[pyarrow]', 'int32[pyarrow]', 'int64[pyarrow]'] | type[int] | Int8Dtype | Int16Dtype | Int32Dtype | Int64Dtype | <6 more items> | Literal['UInt8', 'UInt16', 'UInt32', 'UInt64', 'B', 'u1', 'uint8', 'ubyte', 'H', 'u2', 'uint16', 'ushort', 'I', 'u4', 'uint32', 'uintc', 'L', 'u8', 'uint', 'ulong', 'uint64', 'Q', 'ulonglong', 'P', 'uintp', 'uint8[pyarrow]', 'uint16[pyarrow]', 'uint32[pyarrow]', 'uint64[pyarrow]'] | UInt8Dtype | UInt16Dtype | UInt32Dtype | UInt64Dtype | type[unsignedinteger[_8Bit]] | type[unsignedinteger[_16Bit]] | type[unsignedinteger[_32Bit]] | type[unsignedinteger[_32Bit | _64Bit]] | type[unsignedinteger[_64Bit]] | type[unsignedinteger[_32Bit | _64Bit]] | Literal['str', 'string', 'U', 'str_', 'str0', 'unicode', 'unicode_', 'string[pyarrow]'] | type[str] | StringDtype | type[str_] | Literal['bytes', 'S', 'bytes_', 'bytes0', 'string_', 'binary[pyarrow]'] | type[bytes] | type[bytes_] | <8 more items>], exclude: Literal['bool', 'boolean', '?', 'b1', 'bool_', 'bool[pyarrow]', 'boolean[pyarrow]', 'int', 'Int8', 'Int16', 'Int32', 'Int64', 'b', 'i1', 'int8', 'byte', 'h', 'i2', 'int16', 'short', 'i', 'i4', 'int32', 'intc', 'l', 'i8', 'int64', 'int_', 'long', 'q', 'longlong', 'p', 'intp', 'int8[pyarrow]', 'int16[pyarrow]', 'int32[pyarrow]', 'int64[pyarrow]', 'UInt8', 'UInt16', 'UInt32', 'UInt64', 'B', 'u1', 'uint8', 'ubyte', 'H', 'u2', 'uint16', 'ushort', 'I', 'u4', 'uint32', 'uintc', 'L', 'u8', 'uint', 'ulong', 'uint64', 'Q', 'ulonglong', 'P', 'uintp', 'uint8[pyarrow]', 'uint16[pyarrow]', 'uint32[pyarrow]', 'uint64[pyarrow]', 'str', 'string', 'U', 'str_', 'str0', 'unicode', 'unicode_', 'string[pyarrow]', 'bytes', 'S', 'bytes_', 'bytes0', 'string_', 'binary[pyarrow]', 'float', 'Float32', 'Float64', 'e', 'f2', '<f2', 'float16', 'half', 'f', 'f4', 'float32', 'single', 'd', 'f8', 'float64', 'double', 'float_', 'g', 'f16', 'float128', 'longdouble', 'longfloat', 'float[pyarrow]', 'double[pyarrow]', 'float16[pyarrow]', 'float32[pyarrow]', 'float64[pyarrow]', 'complex', 'F', 'c8', 'complex64', 'csingle', 'singlecomplex', 'D', 'c16', 'complex128', 'cdouble', 'cfloat', 'complex_', 'G', 'c32', 'complex256', 'clongdouble', 'clongfloat', 'longcomplex', 'timedelta64[Y]', 'timedelta64[M]', 'timedelta64[W]', 'timedelta64[D]', 'timedelta64[h]', 'timedelta64[m]', 'timedelta64[s]', 'timedelta64[ms]', 'timedelta64[us]', 'timedelta64[μs]', 'timedelta64[ns]', 'timedelta64[ps]', 'timedelta64[fs]', 'timedelta64[as]', 'm8[Y]', 'm8[M]', 'm8[W]', 'm8[D]', 'm8[h]', 'm8[m]', 'm8[s]', 'm8[ms]', 'm8[us]', 'm8[μs]', 'm8[ns]', 'm8[ps]', 'm8[fs]', 'm8[as]', '<m8[Y]', '<m8[M]', '<m8[W]', '<m8[D]', '<m8[h]', '<m8[m]', '<m8[s]', '<m8[ms]', '<m8[us]', '<m8[μs]', '<m8[ns]', '<m8[ps]', '<m8[fs]', '<m8[as]', 'duration[s][pyarrow]', 'duration[ms][pyarrow]', 'duration[us][pyarrow]', 'duration[ns][pyarrow]', 'datetime64[Y]', 'datetime64[M]', 'datetime64[W]', 'datetime64[D]', 'datetime64[h]', 'datetime64[m]', 'datetime64[s]', 'datetime64[ms]', 'datetime64[us]', 'datetime64[μs]', 'datetime64[ns]', 'datetime64[ps]', 'datetime64[fs]', 'datetime64[as]', 'M8[Y]', 'M8[M]', 'M8[W]', 'M8[D]', 'M8[h]', 'M8[m]', 'M8[s]', 'M8[ms]', 'M8[us]', 'M8[μs]', 'M8[ns]', 'M8[ps]', 'M8[fs]', 'M8[as]', '<M8[Y]', '<M8[M]', '<M8[W]', '<M8[D]', '<M8[h]', '<M8[m]', '<M8[s]', '<M8[ms]', '<M8[us]', '<M8[μs]', '<M8[ns]', '<M8[ps]', '<M8[fs]', '<M8[as]', 'date32[pyarrow]', 'date64[pyarrow]', 'timestamp[s][pyarrow]', 'timestamp[ms][pyarrow]', 'timestamp[us][pyarrow]', 'timestamp[ns][pyarrow]', 'category', 'object', 'O', 'V', 'void', 'void0', 'number', 'datetime64', 'datetime', 'integer', 'timedelta', 'timedelta64', 'datetimetz'] | type[builtins.bool] | BooleanDtype | type[numpy.bool[builtins.bool]] | type[int] | Int8Dtype | <40 more items> | None = ...) -> DataFrame
... (truncated 2 lines) ...
yarl (https://github.com/aio-libs/yarl)
+ yarl/_quoting_py.py:38:20: error: Incompatible return value type (got "None", expected "str") [return-value]
+ yarl/_quoting_py.py:127:20: error: Incompatible return value type (got "None", expected "str") [return-value]
+ yarl/_query.py:36:24: error: Argument 1 to "int" has incompatible type "Union[Union[str, int, float], Sequence[Union[str, int, float]]]"; expected "Union[str, Buffer, SupportsInt, SupportsIndex, SupportsTrunc]" [arg-type]
pydantic (https://github.com/pydantic/pydantic)
+ pydantic/v1/typing.py:228: error: Incompatible return value type (got "GenericAlias", expected "type[Any]") [return-value]
+ pydantic/v1/main.py:1086: error: Incompatible types in assignment (expression has type "set[str]", variable has type "Never") [assignment]
websockets (https://github.com/aaugustin/websockets)
+ src/websockets/legacy/protocol.py:1077: error: Argument 1 to "join" of "str" has incompatible type "list[str | bytes]"; expected "Iterable[str]" [arg-type]
+ src/websockets/legacy/protocol.py:1077: error: Argument 1 to "join" of "bytes" has incompatible type "list[str | bytes]"; expected "Iterable[Buffer]" [arg-type]
pip (https://github.com/pypa/pip)
+ src/pip/_internal/resolution/legacy/resolver.py:454: error: Argument 2 to "prepare_installed_requirement" of "RequirementPreparer" has incompatible type "str | None"; expected "str" [arg-type]
+ src/pip/_internal/resolution/legacy/resolver.py:476: error: Item "None" of "Link | None" has no attribute "scheme" [union-attr]
pwndbg (https://github.com/pwndbg/pwndbg)
+ pwndbg/aglib/dynamic.py: note: In function "r_debug_install_link_map_changed_hook":
+ pwndbg/aglib/dynamic.py:134: error: Unexpected keyword argument "stop_hook" for "break_at" of "Process" [call-arg]
+ pwndbg/dbg/__init__.py:490: note: "break_at" of "Process" defined here
+ pwndbg/aglib/onegadget.py: note: In function "check_constraint":
+ pwndbg/aglib/onegadget.py:507: error: Argument 1 to "find" has incompatible type "CheckSatResult"; expected "int | Value | None" [arg-type]
Tanjun (https://github.com/FasterSpeeding/Tanjun)
+ tanjun/_internal/__init__.py:83: error: Returning Any from function declared to return "bool" [no-any-return]
- tanjun/parsing.py:588: error: "Never" has no attribute "__iter__" (not iterable) [attr-defined]
- tanjun/parsing.py:1632: error: Statement is unreachable [unreachable]
- tanjun/parsing.py:1642: error: Statement is unreachable [unreachable]
- tanjun/dependencies/limiters.py:851: error: "Never" has no attribute "unlock" [attr-defined]
+ tanjun/dependencies/limiters.py:852: error: Statement is unreachable [unreachable]
- tanjun/commands/slash.py:820: error: Statement is unreachable [unreachable]
- tanjun/commands/slash.py:1787: error: Statement is unreachable [unreachable]
- tanjun/clients.py:2294: error: "Never" has no attribute "__iter__" (not iterable) [attr-defined]
+ tanjun/clients.py:2295: error: Statement is unreachable [unreachable]
+ tanjun/annotations.py:1453: error: Incompatible types in assignment (expression has type "type[int]", variable has type "type[float]") [assignment]
+ tanjun/annotations.py:1455: error: Incompatible types in assignment (expression has type "_IntEnumConverter", variable has type "_FloatEnumConverter") [assignment]
+ tanjun/annotations.py:1458: error: Incompatible types in assignment (expression has type "type[str]", variable has type "type[float]") [assignment]
ibis (https://github.com/ibis-project/ibis)
- ibis/common/bases.py:231: error: Need type annotation for "field" [var-annotated]
+ ibis/util.py:656: error: Need type annotation for "hashable_obj" [var-annotated]
+ ibis/util.py:660: error: Incompatible types in assignment (expression has type "frozenset[Never]", variable has type "tuple[Any, ...]") [assignment]
+ ibis/util.py:662: error: Incompatible types in assignment (expression has type "int", variable has type "tuple[Any, ...]") [assignment]
+ ibis/common/tests/test_grounds_py310.py:45: error: Too many positional patterns for class pattern [misc]
... (truncated 229 lines) ...``` |
assert_type
fails to fail forNoReturn
#16319Never
can't be used #18779Mypy doesn't typecheck unreachable code and this is surprising to many. This is an attempt at fixing that. It's a draft until:
--strict
maybe and hopefully enable it by default in 2.0) (skipped for now, I will add after reviews)Problem areas based on test cases:
check-incremental.test
's changes)Never
doesn't support operations (e.g.<Never>.f()
,<Never> > 5
) (fixed)Never
for these, I think?Also maybe
reveal_type(<Never>)
should be non-trivial. (fixed)Generally I tried enabling
--warn-unreachable
in a test case if it looked like people were relying on un-checked unreachable code as a test. Also obviously many of the test case changes are wrong I just did not have the energy to fix all the bugs (and honestly maybe should think through the two things above -- the first especially was a source of issues).I also have no clue what mypyc does so the test change there could be awful.