-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Change error message for incompatible type assignment when using Generics #12556
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
Open
Cynthiawl
wants to merge
5
commits into
python:master
Choose a base branch
from
Cynthiawl:message_1
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
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
Diff from mypy_primer, showing the effect of this PR on open source code: pegen (https://github.com/we-like-parsers/pegen)
- src/pegen/utils.py:19: error: Argument 1 to "module_from_spec" has incompatible type "Optional[ModuleSpec]"; expected "ModuleSpec" [arg-type]
+ src/pegen/utils.py:19: error: expression has type "Optional[ModuleSpec]", variable has type "ModuleSpec" [arg-type]
boostedblob (https://github.com/hauntsaninja/boostedblob)
- boostedblob/boost.py:547: error: Argument 1 to "create_task" has incompatible type "Awaitable[T]"; expected "Union[Generator[Any, None, <nothing>], Coroutine[Any, Any, <nothing>]]"
+ boostedblob/boost.py:547: error: expression has type "Awaitable[T]", variable has type "Union[Generator[Any, None, <nothing>], Coroutine[Any, Any, <nothing>]]"
pydantic (https://github.com/samuelcolvin/pydantic)
- pydantic/class_validators.py:332: error: Argument 1 to "ChainMap" has incompatible type "*List[MappingProxyType[str, Any]]"; expected "MutableMapping[<nothing>, <nothing>]" [arg-type]
+ pydantic/class_validators.py:332: error: expression has type "*List[MappingProxyType[str, Any]]", variable has type "MutableMapping[<nothing>, <nothing>]" [arg-type]
pandera (https://github.com/pandera-dev/pandera)
- pandera/checks.py:74: error: Argument 1 to "ChainMap" has incompatible type "MappingProxyType[str, Any]"; expected "MutableMapping[str, Callable[..., Any]]" [arg-type]
+ pandera/checks.py:74: error: expression has type "MappingProxyType[str, Any]", variable has type "MutableMapping[str, Callable[..., Any]]" [arg-type]
paasta (https://github.com/yelp/paasta)
- paasta_tools/metrics/metastatus_lib.py:672: error: Argument "key" to "sorted" has incompatible type "Callable[[Any], Sequence[Tuple[str, str]]]"; expected "Callable[[_SlaveT], Union[SupportsDunderLT, SupportsDunderGT]]"
+ paasta_tools/metrics/metastatus_lib.py:672: error: expression has type "Callable[[Any], Sequence[Tuple[str, str]]]", variable has type "Callable[[_SlaveT], Union[SupportsDunderLT, SupportsDunderGT]]"
- paasta_tools/metrics/metastatus_lib.py:672: error: Argument "key" to "sorted" has incompatible type "Callable[[Any], Sequence[Tuple[str, str]]]"; expected "Callable[[Any], Union[SupportsDunderLT, SupportsDunderGT]]"
+ paasta_tools/metrics/metastatus_lib.py:672: error: expression has type "Callable[[Any], Sequence[Tuple[str, str]]]", variable has type "Callable[[Any], Union[SupportsDunderLT, SupportsDunderGT]]"
- paasta_tools/instance/kubernetes.py:559: error: Argument 1 to "append" of "list" has incompatible type "Task[KubernetesAutoscalingStatusDict]"; expected "Future[Dict[str, Any]]"
+ paasta_tools/instance/kubernetes.py:559: error: expression has type "Task[KubernetesAutoscalingStatusDict]", variable has type "Future[Dict[str, Any]]"
- paasta_tools/instance/kubernetes.py:564: error: Argument 1 to "create_task" has incompatible type "Awaitable[Sequence[Any]]"; expected "Union[Generator[Any, None, <nothing>], Coroutine[Any, Any, <nothing>]]"
+ paasta_tools/instance/kubernetes.py:564: error: expression has type "Awaitable[Sequence[Any]]", variable has type "Union[Generator[Any, None, <nothing>], Coroutine[Any, Any, <nothing>]]"
- paasta_tools/instance/kubernetes.py:592: error: Argument 1 to "get_backends_from_mesh_status" has incompatible type "Task[Mapping[str, Any]]"; expected "Future[Dict[str, Any]]"
+ paasta_tools/instance/kubernetes.py:592: error: expression has type "Task[Mapping[str, Any]]", variable has type "Future[Dict[str, Any]]"
- paasta_tools/instance/kubernetes.py:603: error: Argument 2 to "get_pod_status_tasks_by_sha_and_readiness" has incompatible type "Optional[Task[Set[str]]]"; expected "Future[Dict[str, Any]]"
- paasta_tools/instance/kubernetes.py:614: error: Argument "pod_status_by_sha_and_readiness_task" to "get_versions_for_controller_revisions" has incompatible type "Task[defaultdict[Tuple[str, str], defaultdict[bool, List[Future[Dict[str, Any]]]]]]"; expected "Future[Mapping[Tuple[str, str], Mapping[bool, Sequence[Future[Mapping[str, Any]]]]]]"
+ paasta_tools/instance/kubernetes.py:603: error: expression has type "Optional[Task[Set[str]]]", variable has type "Future[Dict[str, Any]]"
+ paasta_tools/instance/kubernetes.py:614: error: expression has type "Task[defaultdict[Tuple[str, str], defaultdict[bool, List[Future[Dict[str, Any]]]]]]", variable has type "Future[Mapping[Tuple[str, str], Mapping[bool, Sequence[Future[Mapping[str, Any]]]]]]"
- paasta_tools/instance/kubernetes.py:622: error: Argument 2 to "get_pod_status_tasks_by_replicaset" has incompatible type "Optional[Task[Set[str]]]"; expected "Future[Dict[str, Any]]"
+ paasta_tools/instance/kubernetes.py:622: error: expression has type "Optional[Task[Set[str]]]", variable has type "Future[Dict[str, Any]]"
- paasta_tools/instance/kubernetes.py:633: error: Argument "pod_status_by_replicaset_task" to "get_versions_for_replicasets" has incompatible type "Task[Dict[str, List[Future[Dict[str, Any]]]]]"; expected "Future[Mapping[str, Sequence[Future[Dict[str, Any]]]]]"
+ paasta_tools/instance/kubernetes.py:633: error: expression has type "Task[Dict[str, List[Future[Dict[str, Any]]]]]", variable has type "Future[Mapping[str, Sequence[Future[Dict[str, Any]]]]]"
- paasta_tools/instance/kubernetes.py:1055: error: Argument 1 to "create_task" has incompatible type "Awaitable[Sequence[Any]]"; expected "Union[Generator[Any, None, <nothing>], Coroutine[Any, Any, <nothing>]]"
+ paasta_tools/instance/kubernetes.py:1055: error: expression has type "Awaitable[Sequence[Any]]", variable has type "Union[Generator[Any, None, <nothing>], Coroutine[Any, Any, <nothing>]]"
- paasta_tools/instance/kubernetes.py:1240: error: Argument 1 to "create_task" has incompatible type "Awaitable[Sequence[Any]]"; expected "Union[Generator[Any, None, <nothing>], Coroutine[Any, Any, <nothing>]]"
+ paasta_tools/instance/kubernetes.py:1240: error: expression has type "Awaitable[Sequence[Any]]", variable has type "Union[Generator[Any, None, <nothing>], Coroutine[Any, Any, <nothing>]]"
aioredis (https://github.com/aio-libs/aioredis)
- aioredis/client.py:4158: error: Argument 1 to "update" of "MutableMapping" has incompatible type "Dict[Union[bytes, str], Optional[Any]]"; expected "SupportsKeysAndGetItem[Union[bytes, str, memoryview], Callable[[Dict[str, str]], Awaitable[None]]]" [arg-type]
+ aioredis/client.py:4158: error: expression has type "Dict[Union[bytes, str], Optional[Any]]", variable has type "SupportsKeysAndGetItem[Union[bytes, str, memoryview], Callable[[Dict[str, str]], Awaitable[None]]]" [arg-type]
rclip (https://github.com/yurijmikhalevich/rclip)
- rclip/utils.py:45: error: Argument 1 to "makedirs" has incompatible type "Optional[str]"; expected "Union[str, bytes, PathLike[str], PathLike[bytes]]"
+ rclip/utils.py:45: error: expression has type "Optional[str]", variable has type "Union[str, bytes, PathLike[str], PathLike[bytes]]"
- rclip/db.py:70: error: Argument 1 to "update" of "MutableMapping" has incompatible type "NewImage"; expected "SupportsKeysAndGetItem[Any, None]"
+ rclip/db.py:70: error: expression has type "NewImage", variable has type "SupportsKeysAndGetItem[Any, None]"
aiortc (https://github.com/aiortc/aiortc)
- src/aiortc/rtcpeerconnection.py:138: error: Argument 1 to "parse_h264_profile_level_id" has incompatible type "Union[int, str]"; expected "str"
+ src/aiortc/rtcpeerconnection.py:138: error: expression has type "Union[int, str]", variable has type "str"
pip (https://github.com/pypa/pip)
- src/pip/_internal/metadata/pkg_resources.py:214: error: Argument 1 to "Environment" has incompatible type "None"; expected "WorkingSet"
+ src/pip/_internal/metadata/pkg_resources.py:214: error: expression has type "None", variable has type "WorkingSet"
- src/pip/_internal/network/session.py:406: error: Argument 1 to "ip_address" has incompatible type "Optional[str]"; expected "Union[int, str, bytes, IPv4Address, IPv6Address]"
+ src/pip/_internal/network/session.py:406: error: expression has type "Optional[str]", variable has type "Union[int, str, bytes, IPv4Address, IPv6Address]"
vision (https://github.com/pytorch/vision)
- torchvision/datasets/utils.py:69: error: Argument 1 to "md5" has incompatible type "**Dict[str, bool]"; expected "Union[bytes, Union[bytearray, memoryview, array[Any], mmap, _CData]]" [arg-type]
+ torchvision/datasets/utils.py:69: error: expression has type "**Dict[str, bool]", variable has type "Union[bytes, Union[bytearray, memoryview, array[Any], mmap, _CData]]" [arg-type]
anyio (https://github.com/agronholm/anyio)
- src/anyio/from_thread.py:397: error: Argument 2 to "submit" of "Executor" has incompatible type "Callable[[], Coroutine[Any, Any, None]]"; expected "Callable[..., Coroutine[Any, Any, T_Retval]]" [arg-type]
+ src/anyio/from_thread.py:397: error: expression has type "Callable[[], Coroutine[Any, Any, None]]", variable has type "Callable[..., Coroutine[Any, Any, T_Retval]]" [arg-type]
- src/anyio/_backends/_asyncio.py:188: error: Argument 1 to "getcoroutinestate" has incompatible type "Union[Generator[Optional[Future[object]], None, Any], Awaitable[Any]]"; expected "Coroutine[Any, Any, Any]" [arg-type]
+ src/anyio/_backends/_asyncio.py:188: error: expression has type "Union[Generator[Optional[Future[object]], None, Any], Awaitable[Any]]", variable has type "Coroutine[Any, Any, Any]" [arg-type]
pylint (https://github.com/pycqa/pylint)
- pylint/config/arguments_manager.py:165: error: Argument "action" to "add_argument" of "_ActionsContainer" has incompatible type "str"; expected "Union[Type[Action], Literal['store', 'store_const', 'store_true', 'store_false', 'append', 'append_const', 'count', 'help', 'version', 'extend']]" [arg-type]
- pylint/config/arguments_manager.py:210: error: Argument "action" to "add_argument" of "_ActionsContainer" has incompatible type "str"; expected "Union[Type[Action], Literal['store', 'store_const', 'store_true', 'store_false', 'append', 'append_const', 'count', 'help', 'version', 'extend']]" [arg-type]
+ pylint/config/arguments_manager.py:165: error: expression has type "str", variable has type "Union[Type[Action], Literal['store', 'store_const', 'store_true', 'store_false', 'append', 'append_const', 'count', 'help', 'version', 'extend']]" [arg-type]
+ pylint/config/arguments_manager.py:210: error: expression has type "str", variable has type "Union[Type[Action], Literal['store', 'store_const', 'store_true', 'store_false', 'append', 'append_const', 'count', 'help', 'version', 'extend']]" [arg-type]
steam.py (https://github.com/Gobot1234/steam.py)
- steam/image.py:88: error: Argument 1 to "open" has incompatible type "Union[ImageIO, str, bytes, PathLike[str], PathLike[bytes], int]"; expected "Union[Union[str, bytes, PathLike[str], PathLike[bytes]], int]" [arg-type]
+ steam/image.py:88: error: expression has type "Union[ImageIO, str, bytes, PathLike[str], PathLike[bytes], int]", variable has type "Union[Union[str, bytes, PathLike[str], PathLike[bytes]], int]" [arg-type]
- steam/enums.py:95: error: Argument 1 to "__new__" of "EnumMeta" has incompatible type "EnumMeta"; expected "Type[EnumMeta]" [arg-type]
+ steam/enums.py:95: error: expression has type "EnumMeta", variable has type "Type[EnumMeta]" [arg-type]
- steam/enums.py:139: error: Argument 1 to "MappingProxyType" has incompatible type "Mapping[str, Enum]"; expected "SupportsKeysAndGetItem[str, E]" [arg-type]
+ steam/enums.py:139: error: expression has type "Mapping[str, Enum]", variable has type "SupportsKeysAndGetItem[str, E]" [arg-type]
- steam/enums.py:157: error: Argument 1 to "__setattr__" of "object" has incompatible type "Enum"; expected "str" [arg-type]
+ steam/enums.py:157: error: expression has type "Enum", variable has type "str" [arg-type]
- steam/enums.py:158: error: Argument 1 to "__setattr__" of "object" has incompatible type "Enum"; expected "str" [arg-type]
+ steam/enums.py:158: error: expression has type "Enum", variable has type "str" [arg-type]
zulip (https://github.com/zulip/zulip)
- zerver/tornado/django_api.py:39: error: Argument "cert" to "send" of "HTTPAdapter" has incompatible type "Union[None, bytes, str, Container[Union[bytes, str]]]"; expected "Union[None, bytes, str, Tuple[Union[bytes, str], Union[bytes, str]]]" [arg-type]
+ zerver/tornado/django_api.py:39: error: expression has type "Union[None, bytes, str, Container[Union[bytes, str]]]", variable has type "Union[None, bytes, str, Tuple[Union[bytes, str], Union[bytes, str]]]" [arg-type]
ibis (https://github.com/ibis-project/ibis)
- ibis/util.py:178: error: Argument 1 to "map" has incompatible type "Callable[[Sized], int]"; expected "Callable[[Iterable[str]], int]"
+ ibis/util.py:178: error: expression has type "Callable[[Sized], int]", variable has type "Callable[[Iterable[str]], int]"
- ibis/util.py:182: error: Argument 1 to "len" has incompatible type "Iterable[str]"; expected "Sized"
+ ibis/util.py:182: error: expression has type "Iterable[str]", variable has type "Sized"
- ibis/expr/types/core.py:292: error: Argument "params" to "compile" of "BaseBackend" has incompatible type "Optional[Mapping[ValueExpr, Any]]"; expected "Optional[Mapping[Expr, Any]]"
+ ibis/expr/types/core.py:292: error: expression has type "Optional[Mapping[ValueExpr, Any]]", variable has type "Optional[Mapping[Expr, Any]]"
- ibis/expr/window.py:501: error: Argument 1 to "propagate_down_window" has incompatible type "Expr"; expected "ValueExpr"
+ ibis/expr/window.py:501: error: expression has type "Expr", variable has type "ValueExpr"
- ibis/expr/types/relations.py:70: error: Argument 2 to "join" of "TableExpr" has incompatible type "Union[str, Sequence[Union[str, Tuple[Union[str, ColumnExpr], Union[str, ColumnExpr]], BooleanValue]]]"; expected "Union[str, Sequence[Union[str, Tuple[Union[str, ColumnExpr], Union[str, ColumnExpr]], BooleanColumn]]]"
+ ibis/expr/types/relations.py:70: error: expression has type "Union[str, Sequence[Union[str, Tuple[Union[str, ColumnExpr], Union[str, ColumnExpr]], BooleanValue]]]", variable has type "Union[str, Sequence[Union[str, Tuple[Union[str, ColumnExpr], Union[str, ColumnExpr]], BooleanColumn]]]"
- ibis/expr/types/relations.py:369: error: Argument 1 to "promote_list" has incompatible type "Sequence[ValueExpr]"; expected "Sequence[<nothing>]"
+ ibis/expr/types/relations.py:369: error: expression has type "Sequence[ValueExpr]", variable has type "Sequence[<nothing>]"
- ibis/expr/types/relations.py:370: error: Argument 1 to "promote_list" has incompatible type "Sequence[BooleanValue]"; expected "Sequence[<nothing>]"
+ ibis/expr/types/relations.py:370: error: expression has type "Sequence[BooleanValue]", variable has type "Sequence[<nothing>]"
- ibis/expr/types/relations.py:857: error: Argument 1 to "aggregate" of "TableExpr" has incompatible type "List[ValueExpr]"; expected "Optional[Sequence[ScalarExpr]]"
+ ibis/expr/types/relations.py:857: error: expression has type "List[ValueExpr]", variable has type "Optional[Sequence[ScalarExpr]]"
- ibis/expr/types/generic.py:84: error: Argument 1 has incompatible type "Node"; expected "ValueOp"
+ ibis/expr/types/generic.py:84: error: expression has type "Node", variable has type "ValueOp"
pyppeteer (https://github.com/pyppeteer/pyppeteer)
+ pyppeteer/connection.py:44: error: expression has type "None", variable has type "int"
+ pyppeteer/connection.py:44: error: expression has type "None", variable has type "float"
- pyppeteer/connection.py:44: error: Argument "max_size" to "Connect" has incompatible type "None"; expected "int"
- pyppeteer/connection.py:44: error: Argument "ping_interval" to "Connect" has incompatible type "None"; expected "float"
- pyppeteer/connection.py:44: error: Argument "ping_timeout" to "Connect" has incompatible type "None"; expected "float"
- pyppeteer/launcher.py:148: error: Argument 2 to "Popen" has incompatible type "**Dict[str, Optional[Any]]"; expected "int"
- pyppeteer/launcher.py:148: error: Argument 2 to "Popen" has incompatible type "**Dict[str, Optional[Any]]"; expected "bool"
- pyppeteer/launcher.py:148: error: Argument 2 to "Popen" has incompatible type "**Dict[str, Optional[Any]]"; expected "str"
+ pyppeteer/launcher.py:148: error: expression has type "**Dict[str, Optional[Any]]", variable has type "int"
+ pyppeteer/launcher.py:148: error: expression has type "**Dict[str, Optional[Any]]", variable has type "bool"
+ pyppeteer/launcher.py:148: error: expression has type "**Dict[str, Optional[Any]]", variable has type "str"
pylox (https://github.com/sco1/pylox)
- pylox/ast_printer.py:10: error: Argument 1 to "accept" of "Expr" has incompatible type "AstPrinter"; expected "VisitorProtocol" [arg-type]
- pylox/ast_printer.py:17: error: Argument 1 to "accept" of "Expr" has incompatible type "AstPrinter"; expected "VisitorProtocol" [arg-type]
+ pylox/ast_printer.py:10: error: expression has type "AstPrinter", variable has type "VisitorProtocol" [arg-type]
+ pylox/ast_printer.py:17: error: expression has type "AstPrinter", variable has type "VisitorProtocol" [arg-type]
- pylox/builtins/py_builtins.py:149: error: Argument 1 to "len" has incompatible type "LoxInstance"; expected "Sized" [arg-type]
+ pylox/builtins/py_builtins.py:149: error: expression has type "LoxInstance", variable has type "Sized" [arg-type]
pyp (https://github.com/hauntsaninja/pyp)
- pyp.py:643: error: Argument 1 to "code_for_line" has incompatible type "Optional[int]"; expected "int"
+ pyp.py:643: error: expression has type "Optional[int]", variable has type "int"
xarray (https://github.com/pydata/xarray)
- xarray/core/dataset.py:8008: error: Argument 1 to "set" has incompatible type "Mapping[Hashable, int]"; expected "Iterable[Optional[str]]" [arg-type]
+ xarray/core/dataset.py:8008: error: expression has type "Mapping[Hashable, int]", variable has type "Iterable[Optional[str]]" [arg-type]
- xarray/core/alignment.py:534: error: Argument 1 to "_reindex_one" of "Aligner" has incompatible type "Tuple[DataAlignable, Dict[Tuple[Tuple[Tuple[Hashable, Tuple[Hashable, ...]], ...], Type[Index]], Index]]"; expected "DataAlignable" [arg-type]
+ xarray/core/alignment.py:534: error: expression has type "Tuple[DataAlignable, Dict[Tuple[Tuple[Tuple[Hashable, Tuple[Hashable, ...]], ...], Type[Index]], Index]]", variable has type "DataAlignable" [arg-type]
core (https://github.com/home-assistant/core)
- homeassistant/core.py:436: error: Argument 1 to "create_task" of "AbstractEventLoop" has incompatible type "Awaitable[_R]"; expected "Union[Coroutine[Any, Any, _R], Generator[Any, None, _R]]" [arg-type]
+ homeassistant/core.py:436: error: expression has type "Awaitable[_R]", variable has type "Union[Coroutine[Any, Any, _R], Generator[Any, None, _R]]" [arg-type]
- homeassistant/core.py:467: error: Argument 1 to "create_task" of "AbstractEventLoop" has incompatible type "Awaitable[_R]"; expected "Union[Coroutine[Any, Any, <nothing>], Generator[Any, None, <nothing>]]" [arg-type]
+ homeassistant/core.py:467: error: expression has type "Awaitable[_R]", variable has type "Union[Coroutine[Any, Any, <nothing>], Generator[Any, None, <nothing>]]" [arg-type]
- homeassistant/components/fritz/config_flow.py:133: error: Argument 1 to "ip_address" has incompatible type "Optional[str]"; expected "Union[int, str, bytes, IPv4Address, IPv6Address]" [arg-type]
+ homeassistant/components/fritz/config_flow.py:133: error: expression has type "Optional[str]", variable has type "Union[int, str, bytes, IPv4Address, IPv6Address]" [arg-type]
- homeassistant/components/statistics/sensor.py:648: error: Argument "method" to "quantiles" has incompatible type "str"; expected "Literal['inclusive', 'exclusive']" [arg-type]
+ homeassistant/components/statistics/sensor.py:648: error: expression has type "str", variable has type "Literal['inclusive', 'exclusive']" [arg-type]
- homeassistant/components/zabbix/__init__.py:93: error: Argument 3 has incompatible type "Callable[[datetime], bool]"; expected "Union[HassJob[Optional[Awaitable[None]]], Callable[[datetime], Optional[Awaitable[None]]]]" [arg-type]
+ homeassistant/components/zabbix/__init__.py:93: error: expression has type "Callable[[datetime], bool]", variable has type "Union[HassJob[Optional[Awaitable[None]]], Callable[[datetime], Optional[Awaitable[None]]]]" [arg-type]
- homeassistant/components/sonos/media.py:138: error: Argument 1 to "int" has incompatible type "Optional[Any]"; expected "Union[str, bytes, SupportsInt, SupportsIndex, SupportsTrunc]" [arg-type]
+ homeassistant/components/sonos/media.py:138: error: expression has type "Optional[Any]", variable has type "Union[str, bytes, SupportsInt, SupportsIndex, SupportsTrunc]" [arg-type]
dragonchain (https://github.com/dragonchain/dragonchain)
- dragonchain/lib/database/redis.py:399:36: error: Argument 2 to "zadd" of "SortedSetCommands" has incompatible type "Dict[str, int]"; expected "Mapping[Union[str, bytes], Union[bytes, float, int, str]]"
+ dragonchain/lib/database/redis.py:399:36: error: expression has type "Dict[str, int]", variable has type "Mapping[Union[str, bytes], Union[bytes, float, int, str]]"
- dragonchain/lib/database/redis_utest.py:61:42: error: Argument 2 to "zadd_async" has incompatible type "str"; expected "int"
+ dragonchain/lib/database/redis_utest.py:61:42: error: expression has type "str", variable has type "int"
- dragonchain/lib/database/redis_utest.py:217:35: error: Argument 2 to "zadd_sync" has incompatible type "str"; expected "Dict[str, int]"
+ dragonchain/lib/database/redis_utest.py:217:35: error: expression has type "str", variable has type "Dict[str, int]"
- dragonchain/webserver/lib/api_keys_utest.py:48:87: error: Argument "permissions_document" to "create_api_key_v1" has incompatible type "Dict[str, str]"; expected "Optional[permissions_doc]"
+ dragonchain/webserver/lib/api_keys_utest.py:48:87: error: expression has type "Dict[str, str]", variable has type "Optional[permissions_doc]"
- dragonchain/webserver/lib/api_keys_utest.py:91:59: error: Argument 3 to "update_api_key_v1" has incompatible type "Dict[str, str]"; expected "Optional[permissions_doc]"
+ dragonchain/webserver/lib/api_keys_utest.py:91:59: error: expression has type "Dict[str, str]", variable has type "Optional[permissions_doc]"
- dragonchain/job_processor/job_processor_utest.py:219:53: error: Argument 1 to "get_job_name" has incompatible type "Collection[str]"; expected "str"
+ dragonchain/job_processor/job_processor_utest.py:219:53: error: expression has type "Collection[str]", variable has type "str"
- dragonchain/job_processor/job_processor_utest.py:231:69: error: Argument 1 to "get_job_name" has incompatible type "Collection[str]"; expected "str"
+ dragonchain/job_processor/job_processor_utest.py:231:69: error: expression has type "Collection[str]", variable has type "str"
- dragonchain/webserver/lib/verifications_dao_utest.py:51:49: error: Argument 1 to "_get_verification_records" has incompatible type "int"; expected "str"
- dragonchain/webserver/lib/verifications_dao_utest.py:58:49: error: Argument 1 to "_get_verification_records" has incompatible type "int"; expected "str"
- dragonchain/webserver/lib/verifications_dao_utest.py:71:55: error: Argument 1 to "_level_records" has incompatible type "int"; expected "str"
+ dragonchain/webserver/lib/verifications_dao_utest.py:51:49: error: expression has type "int", variable has type "str"
+ dragonchain/webserver/lib/verifications_dao_utest.py:58:49: error: expression has type "int", variable has type "str"
+ dragonchain/webserver/lib/verifications_dao_utest.py:71:55: error: expression has type "int", variable has type "str"
- dragonchain/webserver/lib/verifications_dao_utest.py:77:53: error: Argument 1 to "_all_records" has incompatible type "int"; expected "str"
+ dragonchain/webserver/lib/verifications_dao_utest.py:77:53: error: expression has type "int", variable has type "str"
- dragonchain/transaction_processor/level_5_actions_utest.py:188:41: error: Argument 1 to "store_l4_blocks" has incompatible type "int"; expected "str"
+ dragonchain/transaction_processor/level_5_actions_utest.py:188:41: error: expression has type "int", variable has type "str"
- dragonchain/transaction_processor/level_5_actions_utest.py:199:55: error: Argument 1 to "verify_blocks" has incompatible type "List[str]"; expected "Iterable[bytes]"
+ dragonchain/transaction_processor/level_5_actions_utest.py:199:55: error: expression has type "List[str]", variable has type "Iterable[bytes]"
- dragonchain/transaction_processor/level_5_actions_utest.py:458:36: error: Argument 1 to "is_backlog" has incompatible type "int"; expected "str"
+ dragonchain/transaction_processor/level_5_actions_utest.py:458:36: error: expression has type "int", variable has type "str"
- dragonchain/transaction_processor/level_4_actions_utest.py:73:50: error: Argument 1 to "verify_blocks" has incompatible type "List[MagicMock]"; expected "List[L3BlockModel]"
+ dragonchain/transaction_processor/level_4_actions_utest.py:73:50: error: expression has type "List[MagicMock]", variable has type "List[L3BlockModel]"
- dragonchain/transaction_processor/level_3_actions_utest.py:247:86: error: Argument 2 to "verify_blocks" has incompatible type "Dict[str, str]"; expected "L1Headers"
+ dragonchain/transaction_processor/level_3_actions_utest.py:247:86: error: expression has type "Dict[str, str]", variable has type "L1Headers"
- dragonchain/scheduler/scheduler_utest.py:85:52: error: Argument 1 to "schedule_contract_invocation" has incompatible type "FakeScModel"; expected "SmartContractModel"
+ dragonchain/scheduler/scheduler_utest.py:85:52: error: expression has type "FakeScModel", variable has type "SmartContractModel"
- dragonchain/job_processor/contract_job_utest.py:84:85: error: Argument 1 to "update_faas_fields" of "SmartContractModel" has incompatible type "BuildTaskResultWithHelpers"; expected "SmartContractModel"
+ dragonchain/job_processor/contract_job_utest.py:84:85: error: expression has type "BuildTaskResultWithHelpers", variable has type "SmartContractModel"
- dragonchain/job_processor/contract_job_utest.py:87:76: error: Argument 1 to "set_state" of "SmartContractModel" has incompatible type "BuildTaskResultWithHelpers"; expected "SmartContractModel"
+ dragonchain/job_processor/contract_job_utest.py:87:76: error: expression has type "BuildTaskResultWithHelpers", variable has type "SmartContractModel"
Tanjun (https://github.com/FasterSpeeding/Tanjun)
- tanjun/context/menu.py:184: error: Argument "default" to "resolve_to_member" of "MenuContext" has incompatible type "None"; expected "User" [arg-type]
+ tanjun/context/menu.py:184: error: expression has type "None", variable has type "User" [arg-type]
- tanjun/clients.py:1130: error: Argument 1 to "chain" has incompatible type "Iterator[BaseSlashCommand]"; expected "Iterable[AppCommand[ABC]]" [arg-type]
+ tanjun/clients.py:1130: error: expression has type "Iterator[BaseSlashCommand]", variable has type "Iterable[AppCommand[ABC]]" [arg-type]
- tanjun/clients.py:1130: error: Argument 2 to "chain" has incompatible type "Iterator[MenuCommand[Any, Literal[CommandType.MESSAGE]]]"; expected "Iterable[AppCommand[ABC]]" [arg-type]
+ tanjun/clients.py:1130: error: expression has type "Iterator[MenuCommand[Any, Literal[CommandType.MESSAGE]]]", variable has type "Iterable[AppCommand[ABC]]" [arg-type]
- tanjun/clients.py:2260: error: Argument 1 to "import_module" has incompatible type "Union[str, Path]"; expected "str" [arg-type]
- tanjun/clients.py:2272: error: Argument 1 to "_get_path_module" has incompatible type "Union[str, Path]"; expected "Path" [arg-type]
+ tanjun/clients.py:2260: error: expression has type "Union[str, Path]", variable has type "str" [arg-type]
+ tanjun/clients.py:2272: error: expression has type "Union[str, Path]", variable has type "Path" [arg-type]
pandas (https://github.com/pandas-dev/pandas)
- pandas/_config/localization.py:48: error: Argument 1 to "join" of "str" has incompatible type "Tuple[Optional[str], Optional[str]]"; expected "Iterable[str]" [arg-type]
+ pandas/_config/localization.py:48: error: expression has type "Tuple[Optional[str], Optional[str]]", variable has type "Iterable[str]" [arg-type]
|
This approach doesn't work -- the new error message should on be given if we are constructing an instance of a generic type. In most cases the existing "Argument N to ..." messages should be preserved. |
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.
Description
Fixes #8934
The initial error is that the error message is unclear as it claims an incompatible type. But the real case is after the class receives an int, it expects the next argument to also be an int.
Test Plan
We locate the error in message.py and change the format of the original error message. We review the discussion under the issue and produce something like”expression has type xx, variable has type xx.” One thing we miss is that the discussion suggested adding the function name, which is foo. But as we looked into the code and context, we found that ast/mypy got the context as FloatExpr instead of Foo(the original function name). So it’s hard for us to get the function name. The change won’t affect the tests cases and we can still pass them.
The format was “Argument {} to {} has incompatible type {}; expected {}”.
Now, the format is “expression has type {}, variable has type {}”.