mypy icon indicating copy to clipboard operation
mypy copied to clipboard

Fix enum `.value` with tuple

Open A5rocks opened this issue 2 years ago • 2 comments

This makes .value not accidentally prune out one of its literals!

Alternatively (I just realized this now) we could just return the type without .last_known_value. I can switch to that if that's better. Anyways, I suspect this initial approach might be unpopular with mypy primer anyways!

Noticed this while looking at https://github.com/python/mypy/issues/14092!

A5rocks avatar Jul 11 '23 08:07 A5rocks

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

poetry (https://github.com/python-poetry/poetry)
+ tests/puzzle/test_solver.py:3463: error: Dict entry 0 has incompatible type "str": "str"; expected "str": "str | None"  [dict-item]
+ tests/puzzle/test_solver.py:3464: error: Dict entry 1 has incompatible type "str": "str"; expected "str": "str | None"  [dict-item]

steam.py (https://github.com/Gobot1234/steam.py)
+ steam/_const.py:112: error: Incompatible types in assignment (expression has type "str", variable has type "str")  [assignment]
+ steam/protobufs/headers.py:138: error: Incompatible types in assignment (expression has type "int", variable has type "int")  [assignment]
+ steam/protobufs/headers.py:139: error: Incompatible types in assignment (expression has type "int", variable has type "int")  [assignment]

pip (https://github.com/pypa/pip)
+ src/pip/_internal/utils/deprecation.py:88: error: List item 1 has incompatible type "tuple[str | None, str | str]"; expected "tuple[int | str | None, str | str | None]"  [list-item]
+ src/pip/_internal/utils/deprecation.py:94: error: List item 2 has incompatible type "tuple[str | None, str]"; expected "tuple[int | str | None, str | str | None]"  [list-item]

mypy_primer (https://github.com/hauntsaninja/mypy_primer)
+ mypy_primer/utils.py:39: error: Returning Any from function declared to return "str"  [no-any-return]

nox (https://github.com/wntrblm/nox)
+ nox/sessions.py:125: error: Incompatible types in assignment (expression has type "int", variable has type "int")  [assignment]
+ nox/sessions.py:812: error: Returning Any from function declared to return "bool"  [no-any-return]

graphql-core (https://github.com/graphql-python/graphql-core)
+ src/graphql/utilities/extend_schema.py:240: error: TypedDict key must be a string literal; expected one of ("query", "mutation", "subscription", "types", "directives", ...)  [literal-required]

spack (https://github.com/spack/spack)
+ lib/spack/spack/install_test.py:54: error: Incompatible types in assignment (expression has type "int", variable has type "int")  [assignment]

operator (https://github.com/canonical/operator)
- ops/pebble.py:2480: error: Incompatible types in assignment (expression has type "list[str]", target has type "str")  [assignment]

mkosi (https://github.com/systemd/mkosi)
+ mkosi/util.py:46:9: error: Returning Any from function declared to return "str"  [no-any-return]
+ mkosi/architecture.py:31:9: error: Returning Any from function declared to return "str"  [no-any-return]

streamlit (https://github.com/streamlit/streamlit)
+ lib/streamlit/elements/image.py: note: In class "WidthBehaviour":
+ lib/streamlit/elements/image.py:73:16: error: Incompatible types in assignment (expression has type "int", variable has type "int")  [assignment]
+ lib/streamlit/elements/image.py:74:14: error: Incompatible types in assignment (expression has type "int", variable has type "int")  [assignment]
+ lib/streamlit/elements/image.py:75:12: error: Incompatible types in assignment (expression has type "int", variable has type "int")  [assignment]

aiortc (https://github.com/aiortc/aiortc)
+ src/aiortc/sdp.py:66: error: Incompatible types in assignment (expression has type "int", variable has type "int")  [assignment]

discord.py (https://github.com/Rapptz/discord.py)
+ discord/enums.py:500: error: Incompatible types in assignment (expression has type "int", variable has type "int")  [assignment]
- discord/automod.py:133: error: Need type annotation for "ret"  [var-annotated]
- discord/scheduled_event.py:491: error: Incompatible types in assignment (expression has type "int | int | int | int", target has type "str")  [assignment]
- discord/scheduled_event.py:510: error: Incompatible types in assignment (expression has type "int | int | int", target has type "str")  [assignment]
- discord/guild.py:3161: error: Incompatible types in assignment (expression has type "int | int | int", target has type "str")  [assignment]
- discord/app_commands/transformers.py:137: error: Incompatible types in assignment (expression has type "list[dict[str, Any]]", target has type "str | int")  [assignment]
- discord/app_commands/transformers.py:139: error: Incompatible types in assignment (expression has type "list[int | int | int | int | int | int | int | int | int | int | int]", target has type "str | int")  [assignment]
- discord/app_commands/transformers.py:147: error: Incompatible types in assignment (expression has type "int | float", target has type "str | int")  [assignment]
- discord/app_commands/transformers.py:149: error: Incompatible types in assignment (expression has type "int | float", target has type "str | int")  [assignment]

urllib3 (https://github.com/urllib3/urllib3)
+ src/urllib3/util/timeout.py:17: error: Incompatible types in assignment (expression has type "int", variable has type "int")  [assignment]

materialize (https://github.com/MaterializeInc/materialize)
+ misc/python/materialize/data_ingest/definition.py:54: error: Returning Any from function declared to return "int"  [no-any-return]
+ misc/python/materialize/xcompile.py:31: error: Returning Any from function declared to return "str"  [no-any-return]

github-actions[bot] avatar Jul 11 '23 08:07 github-actions[bot]

Yeah... As expected.

A5rocks avatar Jul 11 '23 08:07 A5rocks

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

steam.py (https://github.com/Gobot1234/steam.py)
+ steam/_const.py:112: error: Incompatible types in assignment (expression has type "Literal['lxml-xml']", variable has type "Literal['html.parser']")  [assignment]
- steam/app.py:116: error: Incompatible return value type (got "NameT | str", expected "str")  [return-value]
+ steam/app.py:116: error: Incompatible return value type (got "NameT | Literal['']", expected "builtins.str")  [return-value]
- steam/trade.py:192: error: Incompatible types in assignment (expression has type "tuple[str, str, str, str, str, str, str]", base class "Asset" defined the type as "tuple[str, str, str, str, str, str]")  [assignment]
+ steam/trade.py:192: error: Incompatible types in assignment (expression has type "tuple[Literal['name'], builtins.str, builtins.str, builtins.str, builtins.str, builtins.str, builtins.str]", base class "Asset" defined the type as "tuple[builtins.str, builtins.str, builtins.str, builtins.str, builtins.str, builtins.str]")  [assignment]

dragonchain (https://github.com/dragonchain/dragonchain)
- dragonchain/lib/database/redis_utest.py:217:35: error: Argument 2 to "zadd_sync" has incompatible type "str"; expected "Dict[str, int]"  [arg-type]
+ dragonchain/lib/database/redis_utest.py:217:35: error: Argument 2 to "zadd_sync" has incompatible type "Literal['banana']"; expected "Dict[builtins.str, int]"  [arg-type]

poetry (https://github.com/python-poetry/poetry)
+ tests/puzzle/test_solver.py:3463: error: Dict entry 0 has incompatible type "str": "Literal['0.1.0']"; expected "str": "Literal['repo'] | None"  [dict-item]
+ tests/puzzle/test_solver.py:3464: error: Dict entry 1 has incompatible type "str": "Literal["sys_platform == 'darwin'"]"; expected "str": "Literal['repo'] | None"  [dict-item]

comtypes (https://github.com/enthought/comtypes)
- comtypes/typeinfo.py:858: error: List item 0 has incompatible type "tuple[str, Module]"; expected "tuple[str, type[_CData]] | tuple[str, type[_CData], int]"  [list-item]
+ comtypes/typeinfo.py:858: error: List item 0 has incompatible type "tuple[Literal['guid'], Module]"; expected "tuple[builtins.str, type[_CData]] | tuple[builtins.str, type[_CData], int]"  [list-item]
- comtypes/typeinfo.py:891: error: List item 0 has incompatible type "tuple[str, Module]"; expected "tuple[str, type[_CData]] | tuple[str, type[_CData], int]"  [list-item]
+ comtypes/typeinfo.py:891: error: List item 0 has incompatible type "tuple[Literal['guid'], Module]"; expected "tuple[builtins.str, type[_CData]] | tuple[builtins.str, type[_CData], int]"  [list-item]

pip (https://github.com/pypa/pip)
+ src/pip/_internal/utils/deprecation.py:88: error: List item 1 has incompatible type "tuple[builtins.str | None, Literal['pip {} will enforce this behaviour change.'] | Literal['Since pip {}, this is no longer supported.']]"; expected "tuple[int | builtins.str | None, Literal['Discussion can be found at https://github.com/pypa/pip/issues/{}'] | Literal['You can use the flag --use-feature={} to test the upcoming behaviour.'] | None]"  [list-item]
+ src/pip/_internal/utils/deprecation.py:94: error: List item 2 has incompatible type "tuple[builtins.str | None, Literal['A possible replacement is {}.']]"; expected "tuple[int | builtins.str | None, Literal['Discussion can be found at https://github.com/pypa/pip/issues/{}'] | Literal['You can use the flag --use-feature={} to test the upcoming behaviour.'] | None]"  [list-item]

mypy_primer (https://github.com/hauntsaninja/mypy_primer)
+ mypy_primer/utils.py:39: error: Returning Any from function declared to return "str"  [no-any-return]

prefect (https://github.com/PrefectHQ/prefect)
- src/prefect/server/database/configurations.py:234: error: Incompatible types in assignment (expression has type "str", target has type "dict[str, float | Any]")  [assignment]
+ src/prefect/server/database/configurations.py:234: error: Incompatible types in assignment (expression has type "Literal['named']", target has type "dict[builtins.str, float | Any]")  [assignment]
- src/prefect/server/database/query_components.py:213: error: Argument 2 to "where" of "Select" has incompatible type "Any | bool"; expected "ColumnElement[bool] | _HasClauseElement | SQLCoreOperations[bool] | ExpressionElementRole[bool] | Callable[[], ColumnElement[bool]] | LambdaElement"  [arg-type]
+ src/prefect/server/database/query_components.py:213: error: Argument 2 to "where" of "Select" has incompatible type "Any | Literal[True]"; expected "ColumnElement[builtins.bool] | _HasClauseElement | SQLCoreOperations[builtins.bool] | ExpressionElementRole[builtins.bool] | Callable[[], ColumnElement[builtins.bool]] | LambdaElement"  [arg-type]
- src/prefect/testing/utilities.py:186: error: Argument "sort" to "read_flow_runs" of "PrefectClient" has incompatible type "prefect.server.schemas.sorting.FlowRunSort"; expected "prefect.client.schemas.sorting.FlowRunSort"  [arg-type]
+ src/prefect/testing/utilities.py:186: error: Argument "sort" to "read_flow_runs" of "PrefectClient" has incompatible type "Literal[FlowRunSort.EXPECTED_START_TIME_ASC]"; expected "prefect.client.schemas.sorting.FlowRunSort"  [arg-type]

scikit-learn (https://github.com/scikit-learn/scikit-learn)
- sklearn/svm/tests/test_svm.py:596: error: List item 1 has incompatible type "tuple[type[NuSVC], str]"; expected "tuple[type[BaseSVC], str]"  [list-item]
+ sklearn/svm/tests/test_svm.py:596: error: List item 1 has incompatible type "tuple[type[NuSVC], Literal['specified nu is infeasible']]"; expected "tuple[type[BaseSVC], builtins.str]"  [list-item]
- sklearn/ensemble/tests/test_stacking.py:552: error: List item 1 has incompatible type "tuple[type[StackingRegressor], type[DummyRegressor], str, LinearRegression, Any, Any]"; expected "tuple[ABCMeta, type[BaseEstimator], str, BaseEstimator, Any, Any]"  [list-item]
+ sklearn/ensemble/tests/test_stacking.py:552: error: List item 1 has incompatible type "tuple[type[StackingRegressor], type[DummyRegressor], Literal['predict'], LinearRegression, Any, Any]"; expected "tuple[ABCMeta, type[BaseEstimator], builtins.str, BaseEstimator, Any, Any]"  [list-item]

nox (https://github.com/wntrblm/nox)
+ nox/sessions.py:812: error: Returning Any from function declared to return "bool"  [no-any-return]

apprise (https://github.com/caronc/apprise)
- apprise/plugins/NotifyMisskey.py:117: error: Incompatible types in assignment (expression has type "tuple[str, str]", variable has type "tuple[str]")  [assignment]
+ apprise/plugins/NotifyMisskey.py:117: error: Incompatible types in assignment (expression has type "tuple[Literal['{schema}://{token}@{host}'], Literal['{schema}://{token}@{host}:{port}']]", variable has type "tuple[builtins.str]")  [assignment]

graphql-core (https://github.com/graphql-python/graphql-core)
+ src/graphql/utilities/extend_schema.py:240: error: TypedDict key must be a string literal; expected one of ("query", "mutation", "subscription", "types", "directives", ...)  [literal-required]

mkosi (https://github.com/systemd/mkosi)
+ mkosi/util.py:46:9: error: Returning Any from function declared to return "str"  [no-any-return]
+ mkosi/architecture.py:31:9: error: Returning Any from function declared to return "str"  [no-any-return]

operator (https://github.com/canonical/operator)
- ops/pebble.py:2480: error: Incompatible types in assignment (expression has type "list[str]", target has type "str")  [assignment]

streamlit (https://github.com/streamlit/streamlit)
- lib/tests/streamlit/elements/time_widgets_test.py:49:59: error: Argument "step" has incompatible type "Tuple[int, int]"; expected "Union[int, timedelta]"  [arg-type]
+ lib/tests/streamlit/elements/time_widgets_test.py:49:59: error: Argument "step" has incompatible type "Tuple[Literal[90], Literal[0]]"; expected "Union[builtins.int, timedelta]"  [arg-type]

discord.py (https://github.com/Rapptz/discord.py)
- discord/automod.py:133: error: Need type annotation for "ret"  [var-annotated]
- discord/scheduled_event.py:491: error: Incompatible types in assignment (expression has type "int | int | int | int", target has type "str")  [assignment]
- discord/scheduled_event.py:510: error: Incompatible types in assignment (expression has type "int | int | int", target has type "str")  [assignment]
- discord/guild.py:3161: error: Incompatible types in assignment (expression has type "int | int | int", target has type "str")  [assignment]
- discord/app_commands/transformers.py:137: error: Incompatible types in assignment (expression has type "list[dict[str, Any]]", target has type "str | int")  [assignment]
- discord/app_commands/transformers.py:139: error: Incompatible types in assignment (expression has type "list[int | int | int | int | int | int | int | int | int | int | int]", target has type "str | int")  [assignment]
- discord/app_commands/transformers.py:147: error: Incompatible types in assignment (expression has type "int | float", target has type "str | int")  [assignment]
- discord/app_commands/transformers.py:149: error: Incompatible types in assignment (expression has type "int | float", target has type "str | int")  [assignment]

materialize (https://github.com/MaterializeInc/materialize)
+ misc/python/materialize/data_ingest/definition.py:54: error: Returning Any from function declared to return "int"  [no-any-return]
+ misc/python/materialize/xcompile.py:31: error: Returning Any from function declared to return "str"  [no-any-return]

github-actions[bot] avatar Jul 12 '23 04:07 github-actions[bot]

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

dragonchain (https://github.com/dragonchain/dragonchain)
- dragonchain/lib/database/redis_utest.py:217:35: error: Argument 2 to "zadd_sync" has incompatible type "str"; expected "Dict[str, int]"  [arg-type]
+ dragonchain/lib/database/redis_utest.py:217:35: error: Argument 2 to "zadd_sync" has incompatible type "Literal['banana']"; expected "Dict[builtins.str, int]"  [arg-type]

steam.py (https://github.com/Gobot1234/steam.py)
+ steam/_const.py:112: error: Incompatible types in assignment (expression has type "Literal['lxml-xml']", variable has type "Literal['html.parser']")  [assignment]
- steam/app.py:116: error: Incompatible return value type (got "NameT | str", expected "str")  [return-value]
+ steam/app.py:116: error: Incompatible return value type (got "NameT | Literal['']", expected "builtins.str")  [return-value]
- steam/trade.py:192: error: Incompatible types in assignment (expression has type "tuple[str, str, str, str, str, str, str]", base class "Asset" defined the type as "tuple[str, str, str, str, str, str]")  [assignment]
+ steam/trade.py:192: error: Incompatible types in assignment (expression has type "tuple[Literal['name'], builtins.str, builtins.str, builtins.str, builtins.str, builtins.str, builtins.str]", base class "Asset" defined the type as "tuple[builtins.str, builtins.str, builtins.str, builtins.str, builtins.str, builtins.str]")  [assignment]

poetry (https://github.com/python-poetry/poetry)
+ tests/puzzle/test_solver.py:3463: error: Dict entry 0 has incompatible type "str": "Literal['0.1.0']"; expected "str": "Literal['repo'] | None"  [dict-item]
+ tests/puzzle/test_solver.py:3464: error: Dict entry 1 has incompatible type "str": "Literal["sys_platform == 'darwin'"]"; expected "str": "Literal['repo'] | None"  [dict-item]

comtypes (https://github.com/enthought/comtypes)
- comtypes/typeinfo.py:858: error: List item 0 has incompatible type "tuple[str, Module]"; expected "tuple[str, type[_CData]] | tuple[str, type[_CData], int]"  [list-item]
+ comtypes/typeinfo.py:858: error: List item 0 has incompatible type "tuple[Literal['guid'], Module]"; expected "tuple[builtins.str, type[_CData]] | tuple[builtins.str, type[_CData], int]"  [list-item]
- comtypes/typeinfo.py:891: error: List item 0 has incompatible type "tuple[str, Module]"; expected "tuple[str, type[_CData]] | tuple[str, type[_CData], int]"  [list-item]
+ comtypes/typeinfo.py:891: error: List item 0 has incompatible type "tuple[Literal['guid'], Module]"; expected "tuple[builtins.str, type[_CData]] | tuple[builtins.str, type[_CData], int]"  [list-item]

pip (https://github.com/pypa/pip)
+ src/pip/_internal/utils/deprecation.py:88: error: List item 1 has incompatible type "tuple[builtins.str | None, Literal['pip {} will enforce this behaviour change.'] | Literal['Since pip {}, this is no longer supported.']]"; expected "tuple[int | builtins.str | None, Literal['Discussion can be found at https://github.com/pypa/pip/issues/{}'] | Literal['You can use the flag --use-feature={} to test the upcoming behaviour.'] | None]"  [list-item]
+ src/pip/_internal/utils/deprecation.py:94: error: List item 2 has incompatible type "tuple[builtins.str | None, Literal['A possible replacement is {}.']]"; expected "tuple[int | builtins.str | None, Literal['Discussion can be found at https://github.com/pypa/pip/issues/{}'] | Literal['You can use the flag --use-feature={} to test the upcoming behaviour.'] | None]"  [list-item]

mypy_primer (https://github.com/hauntsaninja/mypy_primer)
+ mypy_primer/utils.py:39: error: Returning Any from function declared to return "str"  [no-any-return]

prefect (https://github.com/PrefectHQ/prefect)
- src/prefect/server/database/configurations.py:234: error: Incompatible types in assignment (expression has type "str", target has type "dict[str, float | Any]")  [assignment]
+ src/prefect/server/database/configurations.py:234: error: Incompatible types in assignment (expression has type "Literal['named']", target has type "dict[builtins.str, float | Any]")  [assignment]
- src/prefect/server/database/query_components.py:213: error: Argument 2 to "where" of "Select" has incompatible type "Any | bool"; expected "ColumnElement[bool] | _HasClauseElement | SQLCoreOperations[bool] | ExpressionElementRole[bool] | Callable[[], ColumnElement[bool]] | LambdaElement"  [arg-type]
+ src/prefect/server/database/query_components.py:213: error: Argument 2 to "where" of "Select" has incompatible type "Any | Literal[True]"; expected "ColumnElement[builtins.bool] | _HasClauseElement | SQLCoreOperations[builtins.bool] | ExpressionElementRole[builtins.bool] | Callable[[], ColumnElement[builtins.bool]] | LambdaElement"  [arg-type]
- src/prefect/testing/utilities.py:186: error: Argument "sort" to "read_flow_runs" of "PrefectClient" has incompatible type "prefect.server.schemas.sorting.FlowRunSort"; expected "prefect.client.schemas.sorting.FlowRunSort"  [arg-type]
+ src/prefect/testing/utilities.py:186: error: Argument "sort" to "read_flow_runs" of "PrefectClient" has incompatible type "Literal[FlowRunSort.EXPECTED_START_TIME_ASC]"; expected "prefect.client.schemas.sorting.FlowRunSort"  [arg-type]

scikit-learn (https://github.com/scikit-learn/scikit-learn)
- sklearn/svm/tests/test_svm.py:596: error: List item 1 has incompatible type "tuple[type[NuSVC], str]"; expected "tuple[type[BaseSVC], str]"  [list-item]
+ sklearn/svm/tests/test_svm.py:596: error: List item 1 has incompatible type "tuple[type[NuSVC], Literal['specified nu is infeasible']]"; expected "tuple[type[BaseSVC], builtins.str]"  [list-item]
- sklearn/ensemble/tests/test_stacking.py:552: error: List item 1 has incompatible type "tuple[type[StackingRegressor], type[DummyRegressor], str, LinearRegression, Any, Any]"; expected "tuple[ABCMeta, type[BaseEstimator], str, BaseEstimator, Any, Any]"  [list-item]
+ sklearn/ensemble/tests/test_stacking.py:552: error: List item 1 has incompatible type "tuple[type[StackingRegressor], type[DummyRegressor], Literal['predict'], LinearRegression, Any, Any]"; expected "tuple[ABCMeta, type[BaseEstimator], builtins.str, BaseEstimator, Any, Any]"  [list-item]

nox (https://github.com/wntrblm/nox)
+ nox/sessions.py:812: error: Returning Any from function declared to return "bool"  [no-any-return]

apprise (https://github.com/caronc/apprise)
- apprise/plugins/NotifyMisskey.py:117: error: Incompatible types in assignment (expression has type "tuple[str, str]", variable has type "tuple[str]")  [assignment]
+ apprise/plugins/NotifyMisskey.py:117: error: Incompatible types in assignment (expression has type "tuple[Literal['{schema}://{token}@{host}'], Literal['{schema}://{token}@{host}:{port}']]", variable has type "tuple[builtins.str]")  [assignment]

graphql-core (https://github.com/graphql-python/graphql-core)
+ src/graphql/utilities/extend_schema.py:240: error: TypedDict key must be a string literal; expected one of ("query", "mutation", "subscription", "types", "directives", ...)  [literal-required]

mkosi (https://github.com/systemd/mkosi)
+ mkosi/util.py:46:9: error: Returning Any from function declared to return "str"  [no-any-return]
+ mkosi/architecture.py:31:9: error: Returning Any from function declared to return "str"  [no-any-return]

operator (https://github.com/canonical/operator)
- ops/pebble.py:2480: error: Incompatible types in assignment (expression has type "list[str]", target has type "str")  [assignment]

discord.py (https://github.com/Rapptz/discord.py)
- discord/automod.py:133: error: Need type annotation for "ret"  [var-annotated]
- discord/scheduled_event.py:491: error: Incompatible types in assignment (expression has type "int | int | int | int", target has type "str")  [assignment]
- discord/scheduled_event.py:510: error: Incompatible types in assignment (expression has type "int | int | int", target has type "str")  [assignment]
- discord/guild.py:3161: error: Incompatible types in assignment (expression has type "int | int | int", target has type "str")  [assignment]
- discord/app_commands/transformers.py:137: error: Incompatible types in assignment (expression has type "list[dict[str, Any]]", target has type "str | int")  [assignment]
- discord/app_commands/transformers.py:139: error: Incompatible types in assignment (expression has type "list[int | int | int | int | int | int | int | int | int | int | int]", target has type "str | int")  [assignment]
- discord/app_commands/transformers.py:147: error: Incompatible types in assignment (expression has type "int | float", target has type "str | int")  [assignment]
- discord/app_commands/transformers.py:149: error: Incompatible types in assignment (expression has type "int | float", target has type "str | int")  [assignment]

streamlit (https://github.com/streamlit/streamlit)
- lib/tests/streamlit/elements/time_widgets_test.py:49:59: error: Argument "step" has incompatible type "Tuple[int, int]"; expected "Union[int, timedelta]"  [arg-type]
+ lib/tests/streamlit/elements/time_widgets_test.py:49:59: error: Argument "step" has incompatible type "Tuple[Literal[90], Literal[0]]"; expected "Union[builtins.int, timedelta]"  [arg-type]

materialize (https://github.com/MaterializeInc/materialize)
+ misc/python/materialize/data_ingest/definition.py:54: error: Returning Any from function declared to return "int"  [no-any-return]
+ misc/python/materialize/xcompile.py:31: error: Returning Any from function declared to return "str"  [no-any-return]

github-actions[bot] avatar Jul 12 '23 06:07 github-actions[bot]

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

steam.py (https://github.com/Gobot1234/steam.py)
+ steam/_const.py:112: error: Incompatible types in assignment (expression has type "Literal['lxml-xml']", variable has type "Literal['html.parser']")  [assignment]
- steam/app.py:116: error: Incompatible return value type (got "NameT | str", expected "str")  [return-value]
+ steam/app.py:116: error: Incompatible return value type (got "NameT | Literal['']", expected "builtins.str")  [return-value]
- steam/trade.py:192: error: Incompatible types in assignment (expression has type "tuple[str, str, str, str, str, str, str]", base class "Asset" defined the type as "tuple[str, str, str, str, str, str]")  [assignment]
+ steam/trade.py:192: error: Incompatible types in assignment (expression has type "tuple[Literal['name'], builtins.str, builtins.str, builtins.str, builtins.str, builtins.str, builtins.str]", base class "Asset" defined the type as "tuple[builtins.str, builtins.str, builtins.str, builtins.str, builtins.str, builtins.str]")  [assignment]

comtypes (https://github.com/enthought/comtypes)
- comtypes/typeinfo.py:858: error: List item 0 has incompatible type "tuple[str, Module]"; expected "tuple[str, type[_CData]] | tuple[str, type[_CData], int]"  [list-item]
+ comtypes/typeinfo.py:858: error: List item 0 has incompatible type "tuple[Literal['guid'], Module]"; expected "tuple[builtins.str, type[_CData]] | tuple[builtins.str, type[_CData], int]"  [list-item]
- comtypes/typeinfo.py:891: error: List item 0 has incompatible type "tuple[str, Module]"; expected "tuple[str, type[_CData]] | tuple[str, type[_CData], int]"  [list-item]
+ comtypes/typeinfo.py:891: error: List item 0 has incompatible type "tuple[Literal['guid'], Module]"; expected "tuple[builtins.str, type[_CData]] | tuple[builtins.str, type[_CData], int]"  [list-item]

poetry (https://github.com/python-poetry/poetry)
+ tests/puzzle/test_solver.py:3463: error: Dict entry 0 has incompatible type "str": "Literal['0.1.0']"; expected "str": "Literal['repo'] | None"  [dict-item]
+ tests/puzzle/test_solver.py:3464: error: Dict entry 1 has incompatible type "str": "Literal["sys_platform == 'darwin'"]"; expected "str": "Literal['repo'] | None"  [dict-item]

dragonchain (https://github.com/dragonchain/dragonchain)
- dragonchain/lib/database/redis_utest.py:217:35: error: Argument 2 to "zadd_sync" has incompatible type "str"; expected "Dict[str, int]"  [arg-type]
+ dragonchain/lib/database/redis_utest.py:217:35: error: Argument 2 to "zadd_sync" has incompatible type "Literal['banana']"; expected "Dict[builtins.str, int]"  [arg-type]

pip (https://github.com/pypa/pip)
+ src/pip/_internal/utils/deprecation.py:88: error: List item 1 has incompatible type "tuple[builtins.str | None, Literal['pip {} will enforce this behaviour change.'] | Literal['Since pip {}, this is no longer supported.']]"; expected "tuple[int | builtins.str | None, Literal['Discussion can be found at https://github.com/pypa/pip/issues/{}'] | Literal['You can use the flag --use-feature={} to test the upcoming behaviour.'] | None]"  [list-item]
+ src/pip/_internal/utils/deprecation.py:94: error: List item 2 has incompatible type "tuple[builtins.str | None, Literal['A possible replacement is {}.']]"; expected "tuple[int | builtins.str | None, Literal['Discussion can be found at https://github.com/pypa/pip/issues/{}'] | Literal['You can use the flag --use-feature={} to test the upcoming behaviour.'] | None]"  [list-item]

prefect (https://github.com/PrefectHQ/prefect)
- src/prefect/server/database/configurations.py:234: error: Incompatible types in assignment (expression has type "str", target has type "dict[str, float | Any]")  [assignment]
+ src/prefect/server/database/configurations.py:234: error: Incompatible types in assignment (expression has type "Literal['named']", target has type "dict[builtins.str, float | Any]")  [assignment]
- src/prefect/server/database/query_components.py:213: error: Argument 2 to "where" of "Select" has incompatible type "Any | bool"; expected "ColumnElement[bool] | _HasClauseElement | SQLCoreOperations[bool] | ExpressionElementRole[bool] | Callable[[], ColumnElement[bool]] | LambdaElement"  [arg-type]
+ src/prefect/server/database/query_components.py:213: error: Argument 2 to "where" of "Select" has incompatible type "Any | Literal[True]"; expected "ColumnElement[builtins.bool] | _HasClauseElement | SQLCoreOperations[builtins.bool] | ExpressionElementRole[builtins.bool] | Callable[[], ColumnElement[builtins.bool]] | LambdaElement"  [arg-type]
- src/prefect/testing/utilities.py:186: error: Argument "sort" to "read_flow_runs" of "PrefectClient" has incompatible type "prefect.server.schemas.sorting.FlowRunSort"; expected "prefect.client.schemas.sorting.FlowRunSort"  [arg-type]
+ src/prefect/testing/utilities.py:186: error: Argument "sort" to "read_flow_runs" of "PrefectClient" has incompatible type "Literal[FlowRunSort.EXPECTED_START_TIME_ASC]"; expected "prefect.client.schemas.sorting.FlowRunSort"  [arg-type]

scikit-learn (https://github.com/scikit-learn/scikit-learn)
- sklearn/svm/tests/test_svm.py:596: error: List item 1 has incompatible type "tuple[type[NuSVC], str]"; expected "tuple[type[BaseSVC], str]"  [list-item]
+ sklearn/svm/tests/test_svm.py:596: error: List item 1 has incompatible type "tuple[type[NuSVC], Literal['specified nu is infeasible']]"; expected "tuple[type[BaseSVC], builtins.str]"  [list-item]
- sklearn/ensemble/tests/test_stacking.py:552: error: List item 1 has incompatible type "tuple[type[StackingRegressor], type[DummyRegressor], str, LinearRegression, Any, Any]"; expected "tuple[ABCMeta, type[BaseEstimator], str, BaseEstimator, Any, Any]"  [list-item]
+ sklearn/ensemble/tests/test_stacking.py:552: error: List item 1 has incompatible type "tuple[type[StackingRegressor], type[DummyRegressor], Literal['predict'], LinearRegression, Any, Any]"; expected "tuple[ABCMeta, type[BaseEstimator], builtins.str, BaseEstimator, Any, Any]"  [list-item]

apprise (https://github.com/caronc/apprise)
- apprise/plugins/NotifyMisskey.py:117: error: Incompatible types in assignment (expression has type "tuple[str, str]", variable has type "tuple[str]")  [assignment]
+ apprise/plugins/NotifyMisskey.py:117: error: Incompatible types in assignment (expression has type "tuple[Literal['{schema}://{token}@{host}'], Literal['{schema}://{token}@{host}:{port}']]", variable has type "tuple[builtins.str]")  [assignment]

streamlit (https://github.com/streamlit/streamlit)
- lib/tests/streamlit/elements/time_widgets_test.py:49:59: error: Argument "step" has incompatible type "Tuple[int, int]"; expected "Union[int, timedelta]"  [arg-type]
+ lib/tests/streamlit/elements/time_widgets_test.py:49:59: error: Argument "step" has incompatible type "Tuple[Literal[90], Literal[0]]"; expected "Union[builtins.int, timedelta]"  [arg-type]

discord.py (https://github.com/Rapptz/discord.py)
- discord/scheduled_event.py:491: error: Incompatible types in assignment (expression has type "int | int | int | int", target has type "str")  [assignment]
+ discord/scheduled_event.py:491: error: Incompatible types in assignment (expression has type "Literal[1] | Literal[2] | Literal[3] | Literal[4]", target has type "str")  [assignment]
- discord/scheduled_event.py:510: error: Incompatible types in assignment (expression has type "int | int | int", target has type "str")  [assignment]
+ discord/scheduled_event.py:510: error: Incompatible types in assignment (expression has type "Literal[1] | Literal[2] | Literal[3]", target has type "str")  [assignment]
- discord/guild.py:3161: error: Incompatible types in assignment (expression has type "int | int | int", target has type "str")  [assignment]
+ discord/guild.py:3161: error: Incompatible types in assignment (expression has type "Literal[1] | Literal[2] | Literal[3]", target has type "str")  [assignment]
- discord/app_commands/transformers.py:139: error: Incompatible types in assignment (expression has type "list[int | int | int | int | int | int | int | int | int | int | int]", target has type "str | int")  [assignment]
+ discord/app_commands/transformers.py:139: error: Incompatible types in assignment (expression has type "list[Literal[0] | Literal[1] | Literal[2] | Literal[3] | Literal[4] | Literal[5] | Literal[10] | Literal[11] | Literal[12] | Literal[13] | Literal[15]]", target has type "str | builtins.int")  [assignment]

github-actions[bot] avatar Jul 12 '23 08:07 github-actions[bot]

Turns out the error reporting fix I added fixes https://github.com/python/mypy/issues/12523!

A5rocks avatar Jul 18 '23 06:07 A5rocks

Going through mypy primer:

  • most of the changes are fine, just more error reporting which is probably nicer (?)
    • this isn't always the case, but it's the case enough and I'm already using the best heuristic I can think of (i.e. whether both a literal and a non-literal are used)
  • steam.py gets an error because it tries to conditionally assign a final different values
    • I think this is expected.
  • pip and poetry get weird new inference errors
    • this is an existing problem I believe, I don't think this PR caused these. I can't think of how they're caused by anything I touched, other than comparing literals revealing these. last_known_value is probably forgotten somewhere?
    • I'm going to leave these alone for another PR (I may be horrible at scoping but even I'm not this bad), both of these can probably be fixed with just an explicit type

tl;dr all seems fine

A5rocks avatar Jul 18 '23 06:07 A5rocks

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

steam.py (https://github.com/Gobot1234/steam.py)
+ steam/_const.py:112: error: Incompatible types in assignment (expression has type "Literal['lxml-xml']", variable has type "Literal['html.parser']")  [assignment]
- steam/trade.py:194: error: Incompatible types in assignment (expression has type "tuple[str, str, str, str, str, str, str]", base class "Asset" defined the type as "tuple[str, str, str, str, str, str]")  [assignment]
+ steam/trade.py:194: error: Incompatible types in assignment (expression has type "tuple[Literal['name'], builtins.str, builtins.str, builtins.str, builtins.str, builtins.str, builtins.str]", base class "Asset" defined the type as "tuple[builtins.str, builtins.str, builtins.str, builtins.str, builtins.str, builtins.str]")  [assignment]

comtypes (https://github.com/enthought/comtypes)
- comtypes/typeinfo.py:858: error: List item 0 has incompatible type "tuple[str, Module]"; expected "tuple[str, type[_CData]] | tuple[str, type[_CData], int]"  [list-item]
+ comtypes/typeinfo.py:858: error: List item 0 has incompatible type "tuple[Literal['guid'], Module]"; expected "tuple[builtins.str, type[_CData]] | tuple[builtins.str, type[_CData], int]"  [list-item]
- comtypes/typeinfo.py:891: error: List item 0 has incompatible type "tuple[str, Module]"; expected "tuple[str, type[_CData]] | tuple[str, type[_CData], int]"  [list-item]
+ comtypes/typeinfo.py:891: error: List item 0 has incompatible type "tuple[Literal['guid'], Module]"; expected "tuple[builtins.str, type[_CData]] | tuple[builtins.str, type[_CData], int]"  [list-item]

dragonchain (https://github.com/dragonchain/dragonchain)
- dragonchain/lib/database/redis_utest.py:217:35: error: Argument 2 to "zadd_sync" has incompatible type "str"; expected "Dict[str, int]"  [arg-type]
+ dragonchain/lib/database/redis_utest.py:217:35: error: Argument 2 to "zadd_sync" has incompatible type "Literal['banana']"; expected "Dict[builtins.str, int]"  [arg-type]

poetry (https://github.com/python-poetry/poetry)
+ tests/puzzle/test_solver.py:3463: error: Dict entry 0 has incompatible type "str": "Literal['0.1.0']"; expected "str": "Literal['repo'] | None"  [dict-item]
+ tests/puzzle/test_solver.py:3464: error: Dict entry 1 has incompatible type "str": "Literal["sys_platform == 'darwin'"]"; expected "str": "Literal['repo'] | None"  [dict-item]

pip (https://github.com/pypa/pip)
+ src/pip/_internal/utils/deprecation.py:88: error: List item 1 has incompatible type "tuple[builtins.str | None, Literal['pip {} will enforce this behaviour change.'] | Literal['Since pip {}, this is no longer supported.']]"; expected "tuple[int | builtins.str | None, Literal['Discussion can be found at https://github.com/pypa/pip/issues/{}'] | Literal['You can use the flag --use-feature={} to test the upcoming behaviour.'] | None]"  [list-item]
+ src/pip/_internal/utils/deprecation.py:94: error: List item 2 has incompatible type "tuple[builtins.str | None, Literal['A possible replacement is {}.']]"; expected "tuple[int | builtins.str | None, Literal['Discussion can be found at https://github.com/pypa/pip/issues/{}'] | Literal['You can use the flag --use-feature={} to test the upcoming behaviour.'] | None]"  [list-item]

prefect (https://github.com/PrefectHQ/prefect)
- src/prefect/server/database/configurations.py:234: error: Incompatible types in assignment (expression has type "str", target has type "dict[str, float | Any]")  [assignment]
+ src/prefect/server/database/configurations.py:234: error: Incompatible types in assignment (expression has type "Literal['named']", target has type "dict[builtins.str, float | Any]")  [assignment]
- src/prefect/server/database/query_components.py:213: error: Argument 2 to "where" of "Select" has incompatible type "Any | bool"; expected "ColumnElement[bool] | _HasClauseElement | SQLCoreOperations[bool] | ExpressionElementRole[bool] | Callable[[], ColumnElement[bool]] | LambdaElement"  [arg-type]
+ src/prefect/server/database/query_components.py:213: error: Argument 2 to "where" of "Select" has incompatible type "Any | Literal[True]"; expected "ColumnElement[builtins.bool] | _HasClauseElement | SQLCoreOperations[builtins.bool] | ExpressionElementRole[builtins.bool] | Callable[[], ColumnElement[builtins.bool]] | LambdaElement"  [arg-type]
- src/prefect/testing/utilities.py:186: error: Argument "sort" to "read_flow_runs" of "PrefectClient" has incompatible type "prefect.server.schemas.sorting.FlowRunSort"; expected "prefect.client.schemas.sorting.FlowRunSort"  [arg-type]
+ src/prefect/testing/utilities.py:186: error: Argument "sort" to "read_flow_runs" of "PrefectClient" has incompatible type "Literal[FlowRunSort.EXPECTED_START_TIME_ASC]"; expected "prefect.client.schemas.sorting.FlowRunSort"  [arg-type]

scikit-learn (https://github.com/scikit-learn/scikit-learn)
- sklearn/svm/tests/test_svm.py:596: error: List item 1 has incompatible type "tuple[type[NuSVC], str]"; expected "tuple[type[BaseSVC], str]"  [list-item]
+ sklearn/svm/tests/test_svm.py:596: error: List item 1 has incompatible type "tuple[type[NuSVC], Literal['specified nu is infeasible']]"; expected "tuple[type[BaseSVC], builtins.str]"  [list-item]
- sklearn/ensemble/tests/test_stacking.py:552: error: List item 1 has incompatible type "tuple[type[StackingRegressor], type[DummyRegressor], str, LinearRegression, Any, Any]"; expected "tuple[ABCMeta, type[BaseEstimator], str, BaseEstimator, Any, Any]"  [list-item]
+ sklearn/ensemble/tests/test_stacking.py:552: error: List item 1 has incompatible type "tuple[type[StackingRegressor], type[DummyRegressor], Literal['predict'], LinearRegression, Any, Any]"; expected "tuple[ABCMeta, type[BaseEstimator], builtins.str, BaseEstimator, Any, Any]"  [list-item]

apprise (https://github.com/caronc/apprise)
- apprise/plugins/NotifyMisskey.py:117: error: Incompatible types in assignment (expression has type "tuple[str, str]", variable has type "tuple[str]")  [assignment]
+ apprise/plugins/NotifyMisskey.py:117: error: Incompatible types in assignment (expression has type "tuple[Literal['{schema}://{token}@{host}'], Literal['{schema}://{token}@{host}:{port}']]", variable has type "tuple[builtins.str]")  [assignment]

discord.py (https://github.com/Rapptz/discord.py)
- discord/scheduled_event.py:491: error: Incompatible types in assignment (expression has type "int | int | int | int", target has type "str")  [assignment]
+ discord/scheduled_event.py:491: error: Incompatible types in assignment (expression has type "Literal[1] | Literal[2] | Literal[3] | Literal[4]", target has type "str")  [assignment]
- discord/scheduled_event.py:510: error: Incompatible types in assignment (expression has type "int | int | int", target has type "str")  [assignment]
+ discord/scheduled_event.py:510: error: Incompatible types in assignment (expression has type "Literal[1] | Literal[2] | Literal[3]", target has type "str")  [assignment]
- discord/guild.py:3161: error: Incompatible types in assignment (expression has type "int | int | int", target has type "str")  [assignment]
+ discord/guild.py:3161: error: Incompatible types in assignment (expression has type "Literal[1] | Literal[2] | Literal[3]", target has type "str")  [assignment]
- discord/app_commands/transformers.py:139: error: Incompatible types in assignment (expression has type "list[int | int | int | int | int | int | int | int | int | int | int]", target has type "str | int")  [assignment]
+ discord/app_commands/transformers.py:139: error: Incompatible types in assignment (expression has type "list[Literal[0] | Literal[1] | Literal[2] | Literal[3] | Literal[4] | Literal[5] | Literal[10] | Literal[11] | Literal[12] | Literal[13] | Literal[15]]", target has type "str | builtins.int")  [assignment]

streamlit (https://github.com/streamlit/streamlit)
- lib/tests/streamlit/elements/time_widgets_test.py:49:59: error: Argument "step" has incompatible type "Tuple[int, int]"; expected "Union[int, timedelta]"  [arg-type]
+ lib/tests/streamlit/elements/time_widgets_test.py:49:59: error: Argument "step" has incompatible type "Tuple[Literal[90], Literal[0]]"; expected "Union[builtins.int, timedelta]"  [arg-type]

github-actions[bot] avatar Jul 18 '23 07:07 github-actions[bot]

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

steam.py (https://github.com/Gobot1234/steam.py)
+ steam/_const.py:112: error: Incompatible types in assignment (expression has type "Literal['lxml-xml']", variable has type "Literal['html.parser']")  [assignment]
- steam/trade.py:194: error: Incompatible types in assignment (expression has type "tuple[str, str, str, str, str, str, str]", base class "Asset" defined the type as "tuple[str, str, str, str, str, str]")  [assignment]
+ steam/trade.py:194: error: Incompatible types in assignment (expression has type "tuple[Literal['name'], builtins.str, builtins.str, builtins.str, builtins.str, builtins.str, builtins.str]", base class "Asset" defined the type as "tuple[builtins.str, builtins.str, builtins.str, builtins.str, builtins.str, builtins.str]")  [assignment]

poetry (https://github.com/python-poetry/poetry)
+ tests/puzzle/test_solver.py:3463: error: Dict entry 0 has incompatible type "str": "Literal['0.1.0']"; expected "str": "Literal['repo'] | None"  [dict-item]
+ tests/puzzle/test_solver.py:3464: error: Dict entry 1 has incompatible type "str": "Literal["sys_platform == 'darwin'"]"; expected "str": "Literal['repo'] | None"  [dict-item]

comtypes (https://github.com/enthought/comtypes)
- comtypes/typeinfo.py:858: error: List item 0 has incompatible type "tuple[str, Module]"; expected "tuple[str, type[_CData]] | tuple[str, type[_CData], int]"  [list-item]
+ comtypes/typeinfo.py:858: error: List item 0 has incompatible type "tuple[Literal['guid'], Module]"; expected "tuple[builtins.str, type[_CData]] | tuple[builtins.str, type[_CData], int]"  [list-item]
- comtypes/typeinfo.py:891: error: List item 0 has incompatible type "tuple[str, Module]"; expected "tuple[str, type[_CData]] | tuple[str, type[_CData], int]"  [list-item]
+ comtypes/typeinfo.py:891: error: List item 0 has incompatible type "tuple[Literal['guid'], Module]"; expected "tuple[builtins.str, type[_CData]] | tuple[builtins.str, type[_CData], int]"  [list-item]

dragonchain (https://github.com/dragonchain/dragonchain)
- dragonchain/lib/database/redis_utest.py:217:35: error: Argument 2 to "zadd_sync" has incompatible type "str"; expected "Dict[str, int]"  [arg-type]
+ dragonchain/lib/database/redis_utest.py:217:35: error: Argument 2 to "zadd_sync" has incompatible type "Literal['banana']"; expected "Dict[builtins.str, int]"  [arg-type]

pip (https://github.com/pypa/pip)
+ src/pip/_internal/utils/deprecation.py:88: error: List item 1 has incompatible type "tuple[builtins.str | None, Literal['pip {} will enforce this behaviour change.'] | Literal['Since pip {}, this is no longer supported.']]"; expected "tuple[int | builtins.str | None, Literal['Discussion can be found at https://github.com/pypa/pip/issues/{}'] | Literal['You can use the flag --use-feature={} to test the upcoming behaviour.'] | None]"  [list-item]
+ src/pip/_internal/utils/deprecation.py:94: error: List item 2 has incompatible type "tuple[builtins.str | None, Literal['A possible replacement is {}.']]"; expected "tuple[int | builtins.str | None, Literal['Discussion can be found at https://github.com/pypa/pip/issues/{}'] | Literal['You can use the flag --use-feature={} to test the upcoming behaviour.'] | None]"  [list-item]

prefect (https://github.com/PrefectHQ/prefect)
- src/prefect/server/database/configurations.py:234: error: Incompatible types in assignment (expression has type "str", target has type "dict[str, float | Any]")  [assignment]
+ src/prefect/server/database/configurations.py:234: error: Incompatible types in assignment (expression has type "Literal['named']", target has type "dict[builtins.str, float | Any]")  [assignment]
- src/prefect/server/database/query_components.py:213: error: Argument 2 to "where" of "Select" has incompatible type "Any | bool"; expected "ColumnElement[bool] | _HasClauseElement | SQLCoreOperations[bool] | ExpressionElementRole[bool] | Callable[[], ColumnElement[bool]] | LambdaElement"  [arg-type]
+ src/prefect/server/database/query_components.py:213: error: Argument 2 to "where" of "Select" has incompatible type "Any | Literal[True]"; expected "ColumnElement[builtins.bool] | _HasClauseElement | SQLCoreOperations[builtins.bool] | ExpressionElementRole[builtins.bool] | Callable[[], ColumnElement[builtins.bool]] | LambdaElement"  [arg-type]
- src/prefect/testing/utilities.py:186: error: Argument "sort" to "read_flow_runs" of "PrefectClient" has incompatible type "prefect.server.schemas.sorting.FlowRunSort"; expected "prefect.client.schemas.sorting.FlowRunSort"  [arg-type]
+ src/prefect/testing/utilities.py:186: error: Argument "sort" to "read_flow_runs" of "PrefectClient" has incompatible type "Literal[FlowRunSort.EXPECTED_START_TIME_ASC]"; expected "prefect.client.schemas.sorting.FlowRunSort"  [arg-type]

scikit-learn (https://github.com/scikit-learn/scikit-learn)
- sklearn/svm/tests/test_svm.py:596: error: List item 1 has incompatible type "tuple[type[NuSVC], str]"; expected "tuple[type[BaseSVC], str]"  [list-item]
+ sklearn/svm/tests/test_svm.py:596: error: List item 1 has incompatible type "tuple[type[NuSVC], Literal['specified nu is infeasible']]"; expected "tuple[type[BaseSVC], builtins.str]"  [list-item]
- sklearn/ensemble/tests/test_stacking.py:552: error: List item 1 has incompatible type "tuple[type[StackingRegressor], type[DummyRegressor], str, LinearRegression, Any, Any]"; expected "tuple[ABCMeta, type[BaseEstimator], str, BaseEstimator, Any, Any]"  [list-item]
+ sklearn/ensemble/tests/test_stacking.py:552: error: List item 1 has incompatible type "tuple[type[StackingRegressor], type[DummyRegressor], Literal['predict'], LinearRegression, Any, Any]"; expected "tuple[ABCMeta, type[BaseEstimator], builtins.str, BaseEstimator, Any, Any]"  [list-item]

apprise (https://github.com/caronc/apprise)
- apprise/plugins/NotifyMisskey.py:117: error: Incompatible types in assignment (expression has type "tuple[str, str]", variable has type "tuple[str]")  [assignment]
+ apprise/plugins/NotifyMisskey.py:117: error: Incompatible types in assignment (expression has type "tuple[Literal['{schema}://{token}@{host}'], Literal['{schema}://{token}@{host}:{port}']]", variable has type "tuple[builtins.str]")  [assignment]

streamlit (https://github.com/streamlit/streamlit)
- lib/tests/streamlit/elements/time_widgets_test.py:49:59: error: Argument "step" has incompatible type "Tuple[int, int]"; expected "Union[int, timedelta]"  [arg-type]
+ lib/tests/streamlit/elements/time_widgets_test.py:49:59: error: Argument "step" has incompatible type "Tuple[Literal[90], Literal[0]]"; expected "Union[builtins.int, timedelta]"  [arg-type]

discord.py (https://github.com/Rapptz/discord.py)
- discord/scheduled_event.py:491: error: Incompatible types in assignment (expression has type "int | int | int | int", target has type "str")  [assignment]
+ discord/scheduled_event.py:491: error: Incompatible types in assignment (expression has type "Literal[1] | Literal[2] | Literal[3] | Literal[4]", target has type "str")  [assignment]
- discord/scheduled_event.py:510: error: Incompatible types in assignment (expression has type "int | int | int", target has type "str")  [assignment]
+ discord/scheduled_event.py:510: error: Incompatible types in assignment (expression has type "Literal[1] | Literal[2] | Literal[3]", target has type "str")  [assignment]
- discord/guild.py:3161: error: Incompatible types in assignment (expression has type "int | int | int", target has type "str")  [assignment]
+ discord/guild.py:3161: error: Incompatible types in assignment (expression has type "Literal[1] | Literal[2] | Literal[3]", target has type "str")  [assignment]
- discord/app_commands/transformers.py:139: error: Incompatible types in assignment (expression has type "list[int | int | int | int | int | int | int | int | int | int | int]", target has type "str | int")  [assignment]
+ discord/app_commands/transformers.py:139: error: Incompatible types in assignment (expression has type "list[Literal[0] | Literal[1] | Literal[2] | Literal[3] | Literal[4] | Literal[5] | Literal[10] | Literal[11] | Literal[12] | Literal[13] | Literal[15]]", target has type "str | builtins.int")  [assignment]

github-actions[bot] avatar Jul 18 '23 07:07 github-actions[bot]

would really appreciate seeing this merged

KotlinIsland avatar Jul 29 '24 04:07 KotlinIsland