Fixed bug that results in incorrect type narrowing when a value whose…#10177
Closed
erictraut wants to merge 1 commit into
Closed
Fixed bug that results in incorrect type narrowing when a value whose…#10177erictraut wants to merge 1 commit into
erictraut wants to merge 1 commit into
Conversation
… type is a non-callable (and non-final) class is passed as the second argument to an `isinstance` call and the first argument is a callable type. In this case, a subclass could provide a compatible `__call__` method, so the type shouldn't be narrowed to `Never`. This addresses #10171.
Contributor
|
Diff from mypy_primer, showing the effect of this PR on open source code: ibis (https://github.com/ibis-project/ibis)
+ /tmp/mypy_primer/projects/ibis/ibis/common/graph.py:190:24 - error: Cannot access attribute "match" for class "function"
+ Attribute "match" is unknown (reportFunctionMemberAccess)
+ /tmp/mypy_primer/projects/ibis/ibis/common/graph.py:194:37 - error: Argument of type "Finder | type | tuple[_ClassInfo, ...]" cannot be assigned to parameter "class_or_tuple" of type "_ClassInfo" in function "isinstance"
+ Type "Finder | type | tuple[_ClassInfo, ...]" is not assignable to type "_ClassInfo"
+ Type "Finder" is not assignable to type "_ClassInfo"
+ "function" is not assignable to "type"
+ "function" is not assignable to "UnionType"
+ "function" is not assignable to "tuple[_ClassInfo, ...]" (reportArgumentType)
+ /tmp/mypy_primer/projects/ibis/ibis/common/graph.py:194:37 - error: Second argument to "isinstance" must be a class or tuple of classes
+ Generic type with type arguments not allowed for instance or class checks (reportArgumentType)
+ /tmp/mypy_primer/projects/ibis/ibis/common/graph.py:227:31 - error: Cannot access attribute "match" for class "function"
+ Attribute "match" is unknown (reportFunctionMemberAccess)
+ /tmp/mypy_primer/projects/ibis/ibis/common/graph.py:237:24 - error: Object of type "Replacer" is not subscriptable (reportIndexIssue)
+ /tmp/mypy_primer/projects/ibis/ibis/expr/types/relations.py:2276:13 - error: No overloads for "update" match the provided arguments (reportCallIssue)
+ /tmp/mypy_primer/projects/ibis/ibis/expr/types/relations.py:2276:34 - error: Argument of type "((str) -> (str | None)) | Mapping[str, str]" cannot be assigned to parameter "m" of type "Iterable[tuple[str, str]]" in function "update"
+ Type "((str) -> (str | None)) | Mapping[str, str]" is not assignable to type "Iterable[tuple[str, str]]"
+ "Mapping[str, str]" is not assignable to "Iterable[tuple[str, str]]"
+ Type parameter "_T_co@Iterable" is covariant, but "str" is not a subtype of "tuple[str, str]"
+ "str" is not assignable to "tuple[str, str]" (reportArgumentType)
+ /tmp/mypy_primer/projects/ibis/ibis/expr/types/relations.py:2312:31 - error: Cannot access attribute "format" for class "function"
+ Attribute "format" is unknown (reportFunctionMemberAccess)
- /tmp/mypy_primer/projects/ibis/ibis/expr/types/relations.py:2324:22 - error: Type "((str) -> (str | None)) | None" is not assignable to declared type "(name: Unknown) -> str"
+ /tmp/mypy_primer/projects/ibis/ibis/expr/types/relations.py:2324:22 - error: Type "((str) -> (str | None)) | None" is not assignable to declared type "(name: Unknown) -> (str | Any)"
- Type "((str) -> (str | None)) | None" is not assignable to type "(name: Unknown) -> str"
+ Type "((str) -> (str | None)) | None" is not assignable to type "(name: Unknown) -> (str | Any)"
- Type "None" is not assignable to type "(name: Unknown) -> str" (reportAssignmentType)
+ Type "None" is not assignable to type "(name: Unknown) -> (str | Any)" (reportAssignmentType)
+ /tmp/mypy_primer/projects/ibis/ibis/expr/types/relations.py:4411:48 - error: Argument of type "str | ((Value) -> Scalar)" cannot be assigned to parameter "name" of type "str" in function "__new__"
+ Type "str | ((Value) -> Scalar)" is not assignable to type "str"
+ "function" is not assignable to "str" (reportArgumentType)
+ /tmp/mypy_primer/projects/ibis/ibis/selectors.py:523:13 - error: No overloads for "__init__" match the provided arguments (reportCallIssue)
+ /tmp/mypy_primer/projects/ibis/ibis/selectors.py:523:18 - error: Argument of type "((Value) -> Value) | Mapping[str | None, Deferred | ((Value) -> Value)] | dict[None, Deferred | ((Value) -> Value)]" cannot be assigned to parameter "iterable" of type "Iterable[list[bytes]]" in function "__init__"
+ Type "((Value) -> Value) | Mapping[str | None, Deferred | ((Value) -> Value)] | dict[None, Deferred | ((Value) -> Value)]" is not assignable to type "Iterable[list[bytes]]"
+ "Mapping[str | None, Deferred | ((Value) -> Value)]" is not assignable to "Iterable[list[bytes]]"
+ Type parameter "_T_co@Iterable" is covariant, but "str | None" is not a subtype of "list[bytes]"
+ Type "str | None" is not assignable to type "list[bytes]"
+ "str" is not assignable to "list[bytes]" (reportArgumentType)
+ /tmp/mypy_primer/projects/ibis/ibis/selectors.py:537:46 - error: Cannot access attribute "resolve" for class "function"
+ Attribute "resolve" is unknown (reportFunctionMemberAccess)
- /tmp/mypy_primer/projects/ibis/ibis/selectors.py:541:41 - error: Argument of type "map[BooleanValue | None]" cannot be assigned to parameter "sequence" of type "Iterable[_T@reduce]" in function "reduce"
+ /tmp/mypy_primer/projects/ibis/ibis/selectors.py:541:41 - error: Argument of type "map[Any | None]" cannot be assigned to parameter "sequence" of type "Iterable[_T@reduce]" in function "reduce"
- "map[BooleanValue | None]" is incompatible with protocol "Iterable[BooleanValue]"
+ "map[Any | None]" is incompatible with protocol "Iterable[BooleanValue]"
- Type "() -> map[BooleanValue | None]" is not assignable to type "() -> Iterator[_T_co@Iterable]"
+ Type "() -> map[Any | None]" is not assignable to type "() -> Iterator[_T_co@Iterable]"
- Function return type "map[BooleanValue | None]" is incompatible with type "Iterator[_T_co@Iterable]"
+ Function return type "map[Any | None]" is incompatible with type "Iterator[_T_co@Iterable]"
- "map[BooleanValue | None]" is incompatible with protocol "Iterator[_T_co@Iterable]" (reportArgumentType)
+ "map[Any | None]" is incompatible with protocol "Iterator[_T_co@Iterable]" (reportArgumentType)
- 7594 errors, 117 warnings, 0 informations
+ 7606 errors, 117 warnings, 0 informations
sympy (https://github.com/sympy/sympy)
- /tmp/mypy_primer/projects/sympy/sympy/utilities/codegen.py:608:47 - error: "__getitem__" method not defined on type "set[Unknown]" (reportIndexIssue)
+ "__iter__" method not defined (reportGeneralTypeIssues)
+ /tmp/mypy_primer/projects/sympy/sympy/utilities/codegen.py:622:34 - error: "Relational" is not iterable
+ "__iter__" method not defined (reportGeneralTypeIssues)
+ /tmp/mypy_primer/projects/sympy/sympy/utilities/codegen.py:622:34 - error: "Unequality" is not iterable
+ "__iter__" method not defined (reportGeneralTypeIssues)
+ /tmp/mypy_primer/projects/sympy/sympy/utilities/codegen.py:622:34 - error: "Integer" is not iterable
- /tmp/mypy_primer/projects/sympy/sympy/utilities/tests/test_lambdify.py:2032:45 - error: Argument of type "(e: Unknown) -> (tuple[Unknown, str] | tuple[Unknown | list[tuple[Unknown, Unknown]], list[Unknown] | set[Unknown] | tuple[Unknown, ...]] | tuple[Unknown | list[tuple[Unknown, Unknown]], dict[Unknown, Unknown]] | tuple[Unknown | list[tuple[Unknown, Unknown]], Unknown] | tuple[list[Unknown], Unknown] | tuple[list[tuple[Unknown, Unknown]], list[Unknown]] | Unknown)" cannot be assigned to parameter "cse" of type "bool" in function "lambdify"
+ /tmp/mypy_primer/projects/sympy/sympy/utilities/tests/test_lambdify.py:2032:45 - error: Argument of type "(e: Unknown) -> (Unknown | tuple[list[tuple[Unknown, Unknown]], list[Unknown]])" cannot be assigned to parameter "cse" of type "bool" in function "lambdify"
- 33072 errors, 72 warnings, 0 informations
+ 33074 errors, 72 warnings, 0 informations
werkzeug (https://github.com/pallets/werkzeug)
+ /tmp/mypy_primer/projects/werkzeug/src/werkzeug/routing/map.py
+ /tmp/mypy_primer/projects/werkzeug/src/werkzeug/routing/map.py:645:36 - error: No overloads for "sub" match the provided arguments (reportCallIssue)
+ /tmp/mypy_primer/projects/werkzeug/src/werkzeug/routing/map.py:645:71 - error: Argument of type "str | ((...) -> str)" cannot be assigned to parameter "string" of type "str" in function "sub"
+ Type "str | ((...) -> str)" is not assignable to type "str"
+ "function" is not assignable to "str" (reportArgumentType)
- 118 errors, 9 warnings, 0 informations
+ 120 errors, 9 warnings, 0 informations
scikit-learn (https://github.com/scikit-learn/scikit-learn)
+ /tmp/mypy_primer/projects/scikit-learn/sklearn/model_selection/_search.py:545:26 - error: Object of type "(...) -> object" is not subscriptable (reportIndexIssue)
- 14525 errors, 30 warnings, 0 informations
+ 14526 errors, 30 warnings, 0 informations
bokeh (https://github.com/bokeh/bokeh)
+ /tmp/mypy_primer/projects/bokeh/src/bokeh/core/property/instance.py:101:48 - error: Cannot access attribute "rsplit" for class "function"
+ Attribute "rsplit" is unknown (reportFunctionMemberAccess)
+ /tmp/mypy_primer/projects/bokeh/src/bokeh/document/callbacks.py
+ /tmp/mypy_primer/projects/bokeh/src/bokeh/document/callbacks.py:306:56 - error: Argument of type "EventCallback | Callback" cannot be assigned to parameter "object" of type "Callback" in function "append"
+ Type "EventCallback | Callback" is not assignable to type "Callback"
+ "function" is not assignable to "Callback" (reportArgumentType)
+ /tmp/mypy_primer/projects/bokeh/src/bokeh/io/showing.py
+ /tmp/mypy_primer/projects/bokeh/src/bokeh/io/showing.py:157:33 - error: Argument of type "UIElement | ModifyDoc | Sequence[UIElement]" cannot be assigned to parameter "obj" of type "UIElement | Sequence[UIElement]" in function "_show_with_state"
+ Type "UIElement | ModifyDoc | Sequence[UIElement]" is not assignable to type "UIElement | Sequence[UIElement]"
+ Type "ModifyDoc" is not assignable to type "UIElement | Sequence[UIElement]"
+ "function" is not assignable to "UIElement"
+ "function" is not assignable to "Sequence[UIElement]" (reportArgumentType)
+ /tmp/mypy_primer/projects/bokeh/src/bokeh/server/tornado.py:399:58 - error: Argument of type "Application | ModifyDoc" cannot be assigned to parameter "application" of type "Application" in function "__init__"
+ Type "Application | ModifyDoc" is not assignable to type "Application"
+ "function" is not assignable to "Application" (reportArgumentType)
- 7356 errors, 295 warnings, 0 informations
+ 7360 errors, 295 warnings, 0 informations
prefect (https://github.com/PrefectHQ/prefect)
+ /tmp/mypy_primer/projects/prefect/src/integrations/prefect-dask/prefect_dask/task_runners.py:254:53 - error: Argument of type "str | ((...) -> Unknown)" cannot be assigned to parameter "name" of type "str" in function "from_qualified_name"
+ Type "str | ((...) -> Unknown)" is not assignable to type "str"
+ "function" is not assignable to "str" (reportArgumentType)
+ /tmp/mypy_primer/projects/prefect/src/prefect/_internal/compatibility/async_dispatch.py:58:73 - error: Cannot access attribute "__func__" for class "function"
+ Attribute "__func__" is unknown (reportFunctionMemberAccess)
+ /tmp/mypy_primer/projects/prefect/src/prefect/_internal/compatibility/async_dispatch.py:79:75 - error: Cannot access attribute "__func__" for class "function"
+ Attribute "__func__" is unknown (reportFunctionMemberAccess)
+ /tmp/mypy_primer/projects/prefect/src/prefect/flows.py:274:42 - error: Cannot access attribute "__func__" for class "function"
+ Attribute "__func__" is unknown (reportFunctionMemberAccess)
+ /tmp/mypy_primer/projects/prefect/src/prefect/tasks.py:384:42 - error: Cannot access attribute "__func__" for class "function"
+ Attribute "__func__" is unknown (reportFunctionMemberAccess)
- 5476 errors, 286 warnings, 0 informations
+ 5481 errors, 286 warnings, 0 informations
core (https://github.com/home-assistant/core)
+ /tmp/mypy_primer/projects/core/homeassistant/components/cloud/http_api.py:208:24 - error: Type "tuple[HTTPStatus, ((Exception) -> str) | str]" is not assignable to declared type "tuple[HTTPStatus, str] | None"
+ Type "tuple[HTTPStatus, ((Exception) -> str) | str]" is not assignable to type "tuple[HTTPStatus, str] | None"
+ "tuple[HTTPStatus, ((Exception) -> str) | str]" is not assignable to "tuple[HTTPStatus, str]"
+ Tuple entry 2 is incorrect type
+ Type "((Exception) -> str) | str" is not assignable to type "str"
+ "function" is not assignable to "str"
+ "tuple[HTTPStatus, ((Exception) -> str) | str]" is not assignable to "None" (reportAssignmentType)
+ /tmp/mypy_primer/projects/core/homeassistant/components/conversation/__init__.py:206:51 - error: Argument of type "str | (() -> (str | UndefinedType | None))" cannot be assigned to parameter "name" of type "str" in function "__init__"
+ Type "str | (() -> (str | UndefinedType | None))" is not assignable to type "str"
+ "function" is not assignable to "str" (reportArgumentType)
+ /tmp/mypy_primer/projects/core/homeassistant/components/ring/binary_sensor.py:162:9 - error: Object of type "() -> (Mapping[str, Any] | None)" is not subscriptable (reportIndexIssue)
+ /tmp/mypy_primer/projects/core/homeassistant/components/ring/binary_sensor.py:166:9 - error: Object of type "() -> (Mapping[str, Any] | None)" is not subscriptable (reportIndexIssue)
+ /tmp/mypy_primer/projects/core/homeassistant/components/ring/binary_sensor.py:168:16 - error: Type "() -> (Mapping[str, Any] | None)" is not assignable to return type "Mapping[str, Any] | None"
+ Type "() -> (Mapping[str, Any] | None)" is not assignable to type "Mapping[str, Any] | None"
+ "function" is not assignable to "Mapping[str, Any]"
+ "function" is not assignable to "None" (reportReturnType)
+ /tmp/mypy_primer/projects/core/homeassistant/components/sensibo/entity.py:36:42 - error: Argument of type "dict[str, str | (() -> (str | UndefinedType | None))]" cannot be assigned to parameter "translation_placeholders" of type "dict[str, str] | None" in function "__init__"
+ Type "dict[str, str | (() -> (str | UndefinedType | None))]" is not assignable to type "dict[str, str] | None"
+ "dict[str, str | (() -> (str | UndefinedType | None))]" is not assignable to "dict[str, str]"
+ Type parameter "_VT@dict" is invariant, but "str | (() -> (str | UndefinedType | None))" is not the same as "str"
+ Consider switching from "dict" to "Mapping" which is covariant in the value type
+ "dict[str, str | (() -> (str | UndefinedType | None))]" is not assignable to "None" (reportArgumentType)
+ /tmp/mypy_primer/projects/core/homeassistant/components/sensibo/entity.py:44:42 - error: Argument of type "dict[str, () -> (str | UndefinedType | None)]" cannot be assigned to parameter "translation_placeholders" of type "dict[str, str] | None" in function "__init__"
+ Type "dict[str, () -> (str | UndefinedType | None)]" is not assignable to type "dict[str, str] | None"
+ "dict[str, () -> (str | UndefinedType | None)]" is not assignable to "dict[str, str]"
+ Type parameter "_VT@dict" is invariant, but "() -> (str | UndefinedType | None)" is not the same as "str"
+ Consider switching from "dict" to "Mapping" which is covariant in the value type
+ "dict[str, () -> (str | UndefinedType | None)]" is not assignable to "None" (reportArgumentType)
+ /tmp/mypy_primer/projects/core/homeassistant/components/sensor/__init__.py:634:47 - error: Operator "not in" not supported for types "Literal['.']" and "() -> (StateType | date | datetime | Decimal)" (reportOperatorIssue)
+ /tmp/mypy_primer/projects/core/homeassistant/components/sensor/__init__.py:634:68 - error: Operator "not in" not supported for types "Literal['e']" and "() -> (StateType | date | datetime | Decimal)" (reportOperatorIssue)
+ /tmp/mypy_primer/projects/core/homeassistant/components/sensor/__init__.py:636:47 - error: Argument of type "() -> (StateType | date | datetime | Decimal)" cannot be assigned to parameter "x" of type "ConvertibleToInt" in function "__new__"
+ Type "() -> (StateType | date | datetime | Decimal)" is not assignable to type "ConvertibleToInt"
+ "function" is not assignable to "str"
+ "function" is incompatible with protocol "Buffer"
+ "__buffer__" is not present
+ "function" is incompatible with protocol "SupportsInt"
+ "__int__" is not present
+ "function" is incompatible with protocol "SupportsIndex"
+ "__index__" is not present
+ ... (reportArgumentType)
+ /tmp/mypy_primer/projects/core/homeassistant/components/sensor/__init__.py:636:47 - error: Argument of type "() -> (StateType | date | datetime | Decimal)" cannot be assigned to parameter "x" of type "ConvertibleToInt" in function "__new__"
+ Type "() -> (StateType | date | datetime | Decimal)" is not assignable to type "ConvertibleToInt"
+ "function" is not assignable to "str"
+ "function" is incompatible with protocol "Buffer"
+ "__buffer__" is not present
+ "function" is incompatible with protocol "SupportsInt"
+ "__int__" is not present
+ "function" is incompatible with protocol "SupportsIndex"
+ "__index__" is not present (reportArgumentType)
+ /tmp/mypy_primer/projects/core/homeassistant/components/sensor/__init__.py:639:49 - error: Argument of type "() -> (StateType | date | datetime | Decimal)" cannot be assigned to parameter "x" of type "ConvertibleToFloat" in function "__new__"
+ Type "() -> (StateType | date | datetime | Decimal)" is not assignable to type "ConvertibleToFloat"
+ "function" is not assignable to "str"
+ "function" is incompatible with protocol "Buffer"
+ "__buffer__" is not present
+ "function" is incompatible with protocol "SupportsFloat"
+ "__float__" is not present
+ "function" is incompatible with protocol "SupportsIndex"
+ "__index__" is not present (reportArgumentType)
+ /tmp/mypy_primer/projects/core/homeassistant/components/sensor/__init__.py:651:31 - error: Type "() -> (StateType | date | datetime | Decimal)" is not assignable to declared type "int | float | Decimal"
+ Type "() -> (StateType | date | datetime | Decimal)" is not assignable to type "int | float | Decimal"
+ "function" is not assignable to "int"
+ "function" is not assignable to "float"
+ "function" is not assignable to "Decimal" (reportAssignmentType)
+ /tmp/mypy_primer/projects/core/homeassistant/components/siren/__init__.py:69:47 - error: Cannot access attribute "values" for class "function"
+ Attribute "values" is unknown (reportFunctionMemberAccess)
- /tmp/mypy_primer/projects/core/homeassistant/components/siren/__init__.py:84:39 - error: "Never" is not iterable (reportGeneralTypeIssues)
+ /tmp/mypy_primer/projects/core/homeassistant/components/siren/__init__.py:84:61 - error: Cannot access attribute "items" for class "function"
+ Attribute "items" is unknown (reportFunctionMemberAccess)
+ /tmp/mypy_primer/projects/core/homeassistant/components/tts/__init__.py:859:52 - error: Argument of type "(() -> (str | UndefinedType | None)) | str" cannot be assigned to parameter "engine_name" of type "str" in function "write_tags"
+ Type "(() -> (str | UndefinedType | None)) | str" is not assignable to type "str"
+ "function" is not assignable to "str" (reportArgumentType)
+ /tmp/mypy_primer/projects/core/homeassistant/core.py:595:59 - error: Argument of type "((*_Ts@add_job) -> Any) | Coroutine[Any, Any, Any]" cannot be assigned to parameter "target" of type "Coroutine[Any, Any, _R@async_create_task]" in function "async_create_task" (reportArgumentType)
+ /tmp/mypy_primer/projects/core/homeassistant/core.py:662:43 - error: Argument of type "((*_Ts@async_add_job) -> (Coroutine[Any, Any, _R@async_add_job] | _R@async_add_job)) | Coroutine[Any, Any, _R@async_add_job]" cannot be assigned to parameter "target" of type "Coroutine[Any, Any, _R@async_create_task]" in function "async_create_task"
+ Type "((*_Ts@async_add_job) -> (Coroutine[Any, Any, _R@async_add_job] | _R@async_add_job)) | Coroutine[Any, Any, _R@async_add_job]" is not assignable to type "Coroutine[Any, Any, _R@async_add_job]"
+ "function" is not assignable to "Coroutine[Any, Any, _R@async_add_job]" (reportArgumentType)
+ /tmp/mypy_primer/projects/core/homeassistant/core.py:989:43 - error: Argument of type "((*_Ts@async_run_job) -> (Coroutine[Any, Any, _R@async_run_job] | _R@async_run_job)) | Coroutine[Any, Any, _R@async_run_job]" cannot be assigned to parameter "target" of type "Coroutine[Any, Any, _R@async_create_task]" in function "async_create_task"
+ Type "((*_Ts@async_run_job) -> (Coroutine[Any, Any, _R@async_run_job] | _R@async_run_job)) | Coroutine[Any, Any, _R@async_run_job]" is not assignable to type "Coroutine[Any, Any, _R@async_run_job]"
+ "function" is not assignable to "Coroutine[Any, Any, _R@async_run_job]" (reportArgumentType)
+ /tmp/mypy_primer/projects/core/homeassistant/helpers/entity_component.py:232:24 - error: Type "str | ((...) -> Any) | HassJob[..., Any]" is not assignable to declared type "str | HassJob[..., Any]"
+ Type "str | ((...) -> Any) | HassJob[..., Any]" is not assignable to type "str | HassJob[..., Any]"
+ Type "(...) -> Any" is not assignable to type "str | HassJob[..., Any]"
+ "function" is not assignable to "str"
+ "function" is not assignable to "HassJob[..., Any]" (reportAssignmentType)
+ /tmp/mypy_primer/projects/core/homeassistant/helpers/event.py:1474:9 - error: No overloads for "async_run_hass_job" match the provided arguments (reportCallIssue)
... (truncated 34 lines) ...
pip (https://github.com/pypa/pip)
+ /tmp/mypy_primer/projects/pip/src/pip/_vendor/distlib/version.py:141:35 - error: Argument of type "(v: Unknown, c: Unknown, p: Unknown) -> Unknown" cannot be assigned to parameter "name" of type "str" in function "getattr"
+ "function" is not assignable to "str" (reportArgumentType)
- 1811 errors, 33 warnings, 0 informations
+ 1812 errors, 33 warnings, 0 informations
streamlit (https://github.com/streamlit/streamlit)
+ /tmp/mypy_primer/projects/streamlit/lib/streamlit/commands/navigation.py:47:16 - error: Type "(() -> None) | StreamlitPage" is not assignable to return type "StreamlitPage"
+ Type "(() -> None) | StreamlitPage" is not assignable to type "StreamlitPage"
+ "function" is not assignable to "StreamlitPage" (reportReturnType)
+ /tmp/mypy_primer/projects/streamlit/lib/streamlit/elements/dialog_decorator.py
+ /tmp/mypy_primer/projects/streamlit/lib/streamlit/elements/dialog_decorator.py:219:26 - error: Type "F@dialog_decorator | str" is not assignable to declared type "str"
+ Type "((...) -> None) | str" is not assignable to type "str"
+ "function" is not assignable to "str" (reportAssignmentType)
+ /tmp/mypy_primer/projects/streamlit/lib/streamlit/elements/dialog_decorator.py:254:26 - error: Type "F@experimental_dialog_decorator | str" is not assignable to declared type "str"
+ Type "((...) -> None) | str" is not assignable to type "str"
+ "function" is not assignable to "str" (reportAssignmentType)
+ /tmp/mypy_primer/projects/streamlit/lib/streamlit/navigation/page.py
+ /tmp/mypy_primer/projects/streamlit/lib/streamlit/navigation/page.py:181:25 - error: Argument of type "str | (() -> None)" cannot be assigned to parameter "args" of type "StrPath" in function "__new__"
+ Type "str | (() -> None)" is not assignable to type "StrPath"
+ Type "() -> None" is not assignable to type "StrPath"
+ "function" is not assignable to "str"
+ "function" is incompatible with protocol "PathLike[str]"
+ "__fspath__" is not present (reportArgumentType)
+ /tmp/mypy_primer/projects/streamlit/lib/streamlit/navigation/page.py:183:20 - error: Operator "/" not supported for types "Path" and "Path | (() -> None)"
+ Operator "/" not supported for types "Path" and "() -> None" (reportOperatorIssue)
+ /tmp/mypy_primer/projects/streamlit/lib/streamlit/navigation/page.py:193:63 - error: Argument of type "Path | (() -> None)" cannot be assigned to parameter "script_path" of type "Path" in function "page_icon_and_name"
+ Type "Path | (() -> None)" is not assignable to type "Path"
+ "function" is not assignable to "Path" (reportArgumentType)
- 3831 errors, 121 warnings, 0 informations
+ 3837 errors, 121 warnings, 0 informations
steam.py (https://github.com/Gobot1234/steam.py)
+ /tmp/mypy_primer/projects/steam.py/steam/ext/commands/commands.py:523:40 - warning: Cannot access attribute "convert" for class "function"
+ Attribute "convert" is unknown (reportFunctionMemberAccess)
+ /tmp/mypy_primer/projects/steam.py/steam/ext/commands/commands.py:914:30 - error: Argument of type "Context[Bot] | MaybeCommandT@inner" cannot be assigned to parameter of type "Context[Bot]"
+ Type "Context[Bot] | ((...) -> Command[Cog[Bot] | Bot | None, ..., Any]) | Command[Cog[Bot] | Bot | None, ..., Any]*" is not assignable to type "Context[Bot]"
+ "Command[Cog[Bot] | Bot | None, ..., Any]*" is not assignable to "Context[Bot]" (reportArgumentType)
- 8519 errors, 94 warnings, 0 informations
+ 8520 errors, 95 warnings, 0 informations
ignite (https://github.com/pytorch/ignite)
+ /tmp/mypy_primer/projects/ignite/ignite/handlers/checkpoint.py:326:43 - error: Argument of type "str | ((...) -> Unknown) | Path" cannot be assigned to parameter "dirname" of type "str | Path" in function "__init__"
+ Type "str | ((...) -> Unknown) | Path" is not assignable to type "str | Path"
+ Type "(...) -> Unknown" is not assignable to type "str | Path"
+ "function" is not assignable to "str"
+ "function" is not assignable to "Path" (reportArgumentType)
- 2627 errors, 16 warnings, 0 informations
+ 2628 errors, 16 warnings, 0 informations
antidote (https://github.com/Finistere/antidote)
- /tmp/mypy_primer/projects/antidote/src/antidote/core/_debug.py:151:81 - warning: Unnecessary "# type: ignore" comment (reportUnnecessaryTypeIgnoreComment)
+ /tmp/mypy_primer/projects/antidote/src/antidote/core/_debug.py:146:25 - error: Type of "w" is unknown (reportUnknownVariableType)
+ /tmp/mypy_primer/projects/antidote/src/antidote/core/_debug.py:146:30 - error: "(...) -> Any" is not iterable (reportGeneralTypeIssues)
+ /tmp/mypy_primer/projects/antidote/src/antidote/core/_inject.py:108:24 - error: Cannot access attribute "__func__" for class "function"
+ Attribute "__func__" is unknown (reportFunctionMemberAccess)
+ /tmp/mypy_primer/projects/antidote/src/antidote/core/_inject.py:286:21 - error: Cannot access attribute "__func__" for class "function"
+ Attribute "__func__" is unknown (reportFunctionMemberAccess)
- 745 errors, 78 warnings, 0 informations
+ 749 errors, 77 warnings, 0 informations
sphinx (https://github.com/sphinx-doc/sphinx)
+ /tmp/mypy_primer/projects/sphinx/sphinx/ext/autodoc/__init__.py
+ /tmp/mypy_primer/projects/sphinx/sphinx/ext/autodoc/__init__.py:2479:49 - error: Cannot access attribute "func" for class "function"
+ Attribute "func" is unknown (reportFunctionMemberAccess)
+ /tmp/mypy_primer/projects/sphinx/sphinx/ext/autodoc/__init__.py:2517:37 - error: Cannot access attribute "__func__" for class "function"
+ Attribute "__func__" is unknown (reportFunctionMemberAccess)
+ /tmp/mypy_primer/projects/sphinx/sphinx/util/logging.py
+ /tmp/mypy_primer/projects/sphinx/sphinx/util/logging.py:366:38 - error: Cannot access attribute "prefix" for class "function"
+ Attribute "prefix" is unknown (reportFunctionMemberAccess)
+ /tmp/mypy_primer/projects/sphinx/sphinx/util/logging.py:367:27 - error: Cannot assign to attribute "prefix" for class "function"
+ Attribute "prefix" is unknown (reportFunctionMemberAccess)
+ /tmp/mypy_primer/projects/sphinx/sphinx/util/logging.py:370:27 - error: Cannot assign to attribute "prefix" for class "function"
+ Attribute "prefix" is unknown (reportFunctionMemberAccess)
- 1 error, 0 warnings, 0 informations
+ 6 errors, 0 warnings, 0 informations
pydantic (https://github.com/pydantic/pydantic)
+ /tmp/mypy_primer/projects/pydantic/pydantic/_internal/_core_metadata.py
+ /tmp/mypy_primer/projects/pydantic/pydantic/_internal/_core_metadata.py:87:85 - error: Expected mapping for dictionary unpack operator (reportGeneralTypeIssues)
+ /tmp/mypy_primer/projects/pydantic/pydantic/_internal/_discriminated_union.py:66:29 - error: Type "str | ((Any) -> Hashable)" is not assignable to declared type "str | Discriminator"
+ Type "str | ((Any) -> Hashable)" is not assignable to type "str | Discriminator"
+ Type "(Any) -> Hashable" is not assignable to type "str | Discriminator"
+ "function" is not assignable to "str"
+ "function" is not assignable to "Discriminator" (reportAssignmentType)
+ /tmp/mypy_primer/projects/pydantic/pydantic/_internal/_discriminated_union.py:70:40 - error: Argument of type "str | Discriminator" cannot be assigned to parameter "discriminator" of type "str" in function "__init__"
+ Type "str | Discriminator" is not assignable to type "str"
+ "Discriminator" is not assignable to "str" (reportArgumentType)
+ /tmp/mypy_primer/projects/pydantic/pydantic/_internal/_generate_schema.py:1228:80 - error: Cannot access attribute "generate_aliases" for class "function"
+ Attribute "generate_aliases" is unknown (reportFunctionMemberAccess)
+ /tmp/mypy_primer/projects/pydantic/pydantic/_internal/_generate_schema.py:1279:80 - error: Cannot access attribute "generate_aliases" for class "function"
+ Attribute "generate_aliases" is unknown (reportFunctionMemberAccess)
+ /tmp/mypy_primer/projects/pydantic/pydantic/_internal/_generate_schema.py:1630:80 - error: Cannot access attribute "alias" for class "function"
+ Attribute "alias" is unknown (reportFunctionMemberAccess)
... (truncated 288 lines) ...``` |
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
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.
… type is a non-callable (and non-final) class is passed as the second argument to an
isinstancecall and the first argument is a callable type. In this case, a subclass could provide a compatible__call__method, so the type shouldn't be narrowed toNever. This addresses #10171.