Skip to content
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

Make messages use builtin types instead of typing's types #15070

Merged
merged 4 commits into from Apr 19, 2023

Conversation

koogoro
Copy link
Collaborator

@koogoro koogoro commented Apr 17, 2023

Adds a new option , use_lowercase_builtins(), to choose whether to report builtin types (tuple, list, set, frozenset) as the builtins instead of the uppercased versions in typing. This option is only set to True for python versions that are at least 3.9.

Pipes options all the way through to the messages module. This work revealed a few places that types are printed with str() instead of using format_type, which has been changed. This does change reporting overall, though this should make messages more consistent.

Adds a hidden flag --force-uppercase-builtins that sets the option to True regardless of python version. This allows us to have tests that are independent of version.

…ough, modify tests so they don't all need to be changed
@koogoro koogoro requested a review from JukkaL April 17, 2023 20:28
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

Copy link
Collaborator

@JukkaL JukkaL left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this makes error messages more consistent and nicer-looking! Overall looks good, just left a few comments.

mypy/checkmember.py Outdated Show resolved Hide resolved
mypy/main.py Show resolved Hide resolved
@github-actions
Copy link
Contributor

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

aioredis (https://github.com/aio-libs/aioredis)
- aioredis/client.py:4114: error: Incompatible types in assignment (expression has type "Dict[Union[bytes, str, memoryview], Optional[Any]]", variable has type "Dict[Union[bytes, str, memoryview], Callable[[Dict[str, str]], Awaitable[None]]]")  [assignment]
+ aioredis/client.py:4114: error: Incompatible types in assignment (expression has type "dict[Union[bytes, str, memoryview], Optional[Any]]", variable has type "dict[Union[bytes, str, memoryview], Callable[[dict[str, str]], Awaitable[None]]]")  [assignment]
- aioredis/client.py:4158: error: Argument 1 to "update" of "MutableMapping" has incompatible type "Dict[Union[bytes, str, memoryview], Optional[Any]]"; expected "SupportsKeysAndGetItem[Union[bytes, str, memoryview], Callable[[Dict[str, str]], Awaitable[None]]]"  [arg-type]
+ aioredis/client.py:4158: error: Argument 1 to "update" of "MutableMapping" has incompatible type "dict[Union[bytes, str, memoryview], Optional[Any]]"; expected "SupportsKeysAndGetItem[Union[bytes, str, memoryview], Callable[[dict[str, str]], Awaitable[None]]]"  [arg-type]
- aioredis/client.py:4172: error: Incompatible types in assignment (expression has type "Dict[Union[bytes, str, memoryview], Callable[[Dict[str, str]], Awaitable[None]]]", variable has type "Dict[Any, Optional[Any]]")  [assignment]
+ aioredis/client.py:4172: error: Incompatible types in assignment (expression has type "dict[Union[bytes, str, memoryview], Callable[[dict[str, str]], Awaitable[None]]]", variable has type "dict[Any, Optional[Any]]")  [assignment]

pylox (https://github.com/sco1/pylox)
- pylox/containers/array.py:26: error: "Dict[Any, Any]" has no attribute "append"  [attr-defined]
+ pylox/containers/array.py:26: error: "dict[Any, Any]" has no attribute "append"  [attr-defined]
- pylox/containers/array.py:39: error: "Dict[Any, Any]" has no attribute "appendleft"  [attr-defined]
+ pylox/containers/array.py:39: error: "dict[Any, Any]" has no attribute "appendleft"  [attr-defined]
- pylox/containers/array.py:100: error: "Dict[Any, Any]" has no attribute "popleft"  [attr-defined]
+ pylox/containers/array.py:100: error: "dict[Any, Any]" has no attribute "popleft"  [attr-defined]
- pylox/containers/array.py:115: error: "Dict[Any, Any]" has no attribute "reverse"  [attr-defined]
+ pylox/containers/array.py:115: error: "dict[Any, Any]" has no attribute "reverse"  [attr-defined]
- pylox/containers/array.py:133: error: Incompatible types in assignment (expression has type "deque[Any]", variable has type "Dict[Any, Any]")  [assignment]
+ pylox/containers/array.py:133: error: Incompatible types in assignment (expression has type "deque[Any]", variable has type "dict[Any, Any]")  [assignment]
- pylox/containers/array.py:147: error: Incompatible types in assignment (expression has type "deque[None]", variable has type "Dict[Any, Any]")  [assignment]
+ pylox/containers/array.py:147: error: Incompatible types in assignment (expression has type "deque[None]", variable has type "dict[Any, Any]")  [assignment]
- pylox/builtins/py_builtins.py:21: error: Incompatible types in assignment (expression has type "deque[Any]", variable has type "Dict[Any, Any]")  [assignment]
+ pylox/builtins/py_builtins.py:21: error: Incompatible types in assignment (expression has type "deque[Any]", variable has type "dict[Any, Any]")  [assignment]

poetry (https://github.com/python-poetry/poetry)
- src/poetry/packages/locker.py:335: error: Returning Any from function declared to return "Dict[str, Any]"  [no-any-return]
+ src/poetry/packages/locker.py:335: error: Returning Any from function declared to return "dict[str, Any]"  [no-any-return]
- src/poetry/factory.py:337: error: Returning Any from function declared to return "Dict[str, List[str]]"  [no-any-return]
+ src/poetry/factory.py:337: error: Returning Any from function declared to return "dict[str, list[str]]"  [no-any-return]

apprise (https://github.com/caronc/apprise)
- apprise/cli.py:94: error: Incompatible types in assignment (expression has type "Tuple[str, str, str, str]", variable has type "Tuple[str, str, str, str, str, str, str, str]")  [assignment]
+ apprise/cli.py:94: error: Incompatible types in assignment (expression has type "tuple[str, str, str, str]", variable has type "tuple[str, str, str, str, str, str, str, str]")  [assignment]
- 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[str, str]", variable has type "tuple[str]")  [assignment]

Auto-Split (https://github.com/Avasam/Auto-Split)
- src/capture_method/__init__.py:100: error: Incompatible types in assignment (expression has type "None", base class "dict" defined the type as "Callable[[Dict[CaptureMethodEnum, CaptureMethodInfo], CaptureMethodEnum], CaptureMethodInfo]")  [assignment]
+ src/capture_method/__init__.py:100: error: Incompatible types in assignment (expression has type "None", base class "dict" defined the type as "Callable[[dict[CaptureMethodEnum, CaptureMethodInfo], CaptureMethodEnum], CaptureMethodInfo]")  [assignment]

pip (https://github.com/pypa/pip)
- src/pip/_internal/metadata/_json.py:67: error: Item "None" of "Optional[List[Any]]" has no attribute "__iter__" (not iterable)  [union-attr]
+ src/pip/_internal/metadata/_json.py:67: error: Item "None" of "Optional[list[Any]]" has no attribute "__iter__" (not iterable)  [union-attr]

operator (https://github.com/canonical/operator)
- ops/storage.py:191: error: Incompatible types in "yield" (actual type "Tuple[Any, ...]", expected type "Tuple[str, str, str]")  [misc]
+ ops/storage.py:191: error: Incompatible types in "yield" (actual type "tuple[Any, ...]", expected type "tuple[str, str, str]")  [misc]
- ops/pebble.py:2353: error: Incompatible types in assignment (expression has type "List[str]", target has type "str")  [assignment]
+ ops/pebble.py:2353: error: Incompatible types in assignment (expression has type "list[str]", target has type "str")  [assignment]
- ops/model.py:2616: error: No overload variant of "run" matches argument types "Tuple[str, ...]", "Dict[str, object]"  [call-overload]
+ ops/model.py:2616: error: No overload variant of "run" matches argument types "tuple[str, ...]", "dict[str, object]"  [call-overload]
- ops/model.py:2643: error: Incompatible types in assignment (expression has type "Iterable[str]", variable has type "Union[str, None, int, float, Dict[str, JsonObject], List[JsonObject], Tuple[JsonObject, ...]]")  [assignment]
+ ops/model.py:2643: error: Incompatible types in assignment (expression has type "Iterable[str]", variable has type "Union[str, None, int, float, dict[str, JsonObject], list[JsonObject], tuple[JsonObject, ...]]")  [assignment]
- ops/model.py:2644: error: Item "None" of "Union[Any, None, int, float, str, Dict[str, JsonObject], List[JsonObject], Tuple[JsonObject, ...]]" has no attribute "split"  [union-attr]
+ ops/model.py:2644: error: Item "None" of "Union[Any, None, int, float, str, dict[str, JsonObject], list[JsonObject], tuple[JsonObject, ...]]" has no attribute "split"  [union-attr]
- ops/model.py:2644: error: Item "int" of "Union[Any, None, int, float, str, Dict[str, JsonObject], List[JsonObject], Tuple[JsonObject, ...]]" has no attribute "split"  [union-attr]
+ ops/model.py:2644: error: Item "int" of "Union[Any, None, int, float, str, dict[str, JsonObject], list[JsonObject], tuple[JsonObject, ...]]" has no attribute "split"  [union-attr]
- ops/model.py:2644: error: Item "float" of "Union[Any, None, int, float, str, Dict[str, JsonObject], List[JsonObject], Tuple[JsonObject, ...]]" has no attribute "split"  [union-attr]
+ ops/model.py:2644: error: Item "float" of "Union[Any, None, int, float, str, dict[str, JsonObject], list[JsonObject], tuple[JsonObject, ...]]" has no attribute "split"  [union-attr]
- ops/model.py:2644: error: Item "Dict[str, JsonObject]" of "Union[Any, None, int, float, str, Dict[str, JsonObject], List[JsonObject], Tuple[JsonObject, ...]]" has no attribute "split"  [union-attr]
+ ops/model.py:2644: error: Item "dict[str, JsonObject]" of "Union[Any, None, int, float, str, dict[str, JsonObject], list[JsonObject], tuple[JsonObject, ...]]" has no attribute "split"  [union-attr]
- ops/model.py:2644: error: Item "List[JsonObject]" of "Union[Any, None, int, float, str, Dict[str, JsonObject], List[JsonObject], Tuple[JsonObject, ...]]" has no attribute "split"  [union-attr]
+ ops/model.py:2644: error: Item "list[JsonObject]" of "Union[Any, None, int, float, str, dict[str, JsonObject], list[JsonObject], tuple[JsonObject, ...]]" has no attribute "split"  [union-attr]
- ops/model.py:2644: error: Item "Tuple[JsonObject, ...]" of "Union[Any, None, int, float, str, Dict[str, JsonObject], List[JsonObject], Tuple[JsonObject, ...]]" has no attribute "split"  [union-attr]
+ ops/model.py:2644: error: Item "tuple[JsonObject, ...]" of "Union[Any, None, int, float, str, dict[str, JsonObject], list[JsonObject], tuple[JsonObject, ...]]" has no attribute "split"  [union-attr]
- ops/model.py:2644: error: Item "None" of "Union[str, None, int, float, Dict[str, JsonObject], List[JsonObject], Tuple[JsonObject, ...]]" has no attribute "__iter__" (not iterable)  [union-attr]
+ ops/model.py:2644: error: Item "None" of "Union[str, None, int, float, dict[str, JsonObject], list[JsonObject], tuple[JsonObject, ...]]" has no attribute "__iter__" (not iterable)  [union-attr]
- ops/model.py:2644: error: Item "int" of "Union[str, None, int, float, Dict[str, JsonObject], List[JsonObject], Tuple[JsonObject, ...]]" has no attribute "__iter__" (not iterable)  [union-attr]
+ ops/model.py:2644: error: Item "int" of "Union[str, None, int, float, dict[str, JsonObject], list[JsonObject], tuple[JsonObject, ...]]" has no attribute "__iter__" (not iterable)  [union-attr]
- ops/model.py:2644: error: Item "float" of "Union[str, None, int, float, Dict[str, JsonObject], List[JsonObject], Tuple[JsonObject, ...]]" has no attribute "__iter__" (not iterable)  [union-attr]
+ ops/model.py:2644: error: Item "float" of "Union[str, None, int, float, dict[str, JsonObject], list[JsonObject], tuple[JsonObject, ...]]" has no attribute "__iter__" (not iterable)  [union-attr]
- ops/model.py:2800: error: Incompatible types in assignment (expression has type "Dict[str, Dict[str, str]]", variable has type "Union[str, None, int, float, Dict[str, JsonObject], List[JsonObject], Tuple[JsonObject, ...]]")  [assignment]
+ ops/model.py:2800: error: Incompatible types in assignment (expression has type "dict[str, dict[str, str]]", variable has type "Union[str, None, int, float, dict[str, JsonObject], list[JsonObject], tuple[JsonObject, ...]]")  [assignment]
- ops/model.py:2801: error: Value of type "Union[str, None, int, float, Dict[str, JsonObject], List[JsonObject], Tuple[JsonObject, ...]]" is not indexable  [index]
+ ops/model.py:2801: error: Value of type "Union[str, None, int, float, dict[str, JsonObject], list[JsonObject], tuple[JsonObject, ...]]" is not indexable  [index]
- ops/model.py:2801: note:     def __getitem__(self, slice, /) -> List[JsonObject]
+ ops/model.py:2801: note:     def __getitem__(self, slice, /) -> list[JsonObject]
- ops/model.py:2801: note:     def __getitem__(self, slice, /) -> Tuple[JsonObject, ...]
+ ops/model.py:2801: note:     def __getitem__(self, slice, /) -> tuple[JsonObject, ...]
- ops/model.py:2801: error: Invalid index type "str" for "Union[str, None, int, float, Dict[str, JsonObject], List[JsonObject], Tuple[JsonObject, ...]]"; expected type "Union[SupportsIndex, slice]"  [index]
+ ops/model.py:2801: error: Invalid index type "str" for "Union[str, None, int, float, dict[str, JsonObject], list[JsonObject], tuple[JsonObject, ...]]"; expected type "Union[SupportsIndex, slice]"  [index]
- ops/model.py:2802: error: Value of type "Union[str, Any, None, int, float, Dict[str, JsonObject], List[JsonObject], Tuple[JsonObject, ...]]" is not indexable  [index]
+ ops/model.py:2802: error: Value of type "Union[str, Any, None, int, float, dict[str, JsonObject], list[JsonObject], tuple[JsonObject, ...]]" is not indexable  [index]
- ops/model.py:2802: note:     def __getitem__(self, slice, /) -> List[JsonObject]
+ ops/model.py:2802: note:     def __getitem__(self, slice, /) -> list[JsonObject]
- ops/model.py:2802: note:     def __getitem__(self, slice, /) -> Tuple[JsonObject, ...]
+ ops/model.py:2802: note:     def __getitem__(self, slice, /) -> tuple[JsonObject, ...]
- ops/model.py:2802: error: Incompatible types (expression has type "Union[str, Any, None, int, float, Dict[str, JsonObject], List[JsonObject], Tuple[JsonObject, ...]]", TypedDict item "status" has type "str")  [typeddict-item]
+ ops/model.py:2802: error: Incompatible types (expression has type "Union[str, Any, None, int, float, dict[str, JsonObject], list[JsonObject], tuple[JsonObject, ...]]", TypedDict item "status" has type "str")  [typeddict-item]
- ops/model.py:2802: error: Invalid index type "str" for "Union[str, Any, None, int, float, Dict[str, JsonObject], List[JsonObject], Tuple[JsonObject, ...]]"; expected type "Union[SupportsIndex, slice]"  [index]
+ ops/model.py:2802: error: Invalid index type "str" for "Union[str, Any, None, int, float, dict[str, JsonObject], list[JsonObject], tuple[JsonObject, ...]]"; expected type "Union[SupportsIndex, slice]"  [index]
- ops/model.py:2803: error: Value of type "Union[str, Any, None, int, float, Dict[str, JsonObject], List[JsonObject], Tuple[JsonObject, ...]]" is not indexable  [index]
+ ops/model.py:2803: error: Value of type "Union[str, Any, None, int, float, dict[str, JsonObject], list[JsonObject], tuple[JsonObject, ...]]" is not indexable  [index]
- ops/model.py:2803: note:     def __getitem__(self, slice, /) -> List[JsonObject]
+ ops/model.py:2803: note:     def __getitem__(self, slice, /) -> list[JsonObject]
- ops/model.py:2803: note:     def __getitem__(self, slice, /) -> Tuple[JsonObject, ...]
+ ops/model.py:2803: note:     def __getitem__(self, slice, /) -> tuple[JsonObject, ...]
- ops/model.py:2803: error: Incompatible types (expression has type "Union[str, Any, None, int, float, Dict[str, JsonObject], List[JsonObject], Tuple[JsonObject, ...]]", TypedDict item "message" has type "str")  [typeddict-item]
+ ops/model.py:2803: error: Incompatible types (expression has type "Union[str, Any, None, int, float, dict[str, JsonObject], list[JsonObject], tuple[JsonObject, ...]]", TypedDict item "message" has type "str")  [typeddict-item]
- ops/model.py:2803: error: Invalid index type "str" for "Union[str, Any, None, int, float, Dict[str, JsonObject], List[JsonObject], Tuple[JsonObject, ...]]"; expected type "Union[SupportsIndex, slice]"  [index]
+ ops/model.py:2803: error: Invalid index type "str" for "Union[str, Any, None, int, float, dict[str, JsonObject], list[JsonObject], tuple[JsonObject, ...]]"; expected type "Union[SupportsIndex, slice]"  [index]
- ops/model.py:2822: error: Incompatible types in assignment (expression has type "List[str]", variable has type "Union[str, None, int, float, Dict[str, JsonObject], List[JsonObject], Tuple[JsonObject, ...]]")  [assignment]
+ ops/model.py:2822: error: Incompatible types in assignment (expression has type "list[str]", variable has type "Union[str, None, int, float, dict[str, JsonObject], list[JsonObject], tuple[JsonObject, ...]]")  [assignment]

... (truncated 62 lines) ...

steam.py (https://github.com/Gobot1234/steam.py)
- steam/_const.py:114: error: Incompatible default for argument "unpacker" (default has type "Callable[[Union[bytes, Union[bytearray, memoryview, array[Any], mmap, _CData, PickleBuffer]], int], Tuple[Any, ...]]", argument has type "Callable[[bytes], Tuple[int]]")  [assignment]
+ steam/_const.py:114: error: Incompatible default for argument "unpacker" (default has type "Callable[[Union[bytes, Union[bytearray, memoryview, array[Any], mmap, _CData, PickleBuffer]], int], tuple[Any, ...]]", argument has type "Callable[[bytes], tuple[int]]")  [assignment]
- steam/protobufs/struct_messages.py:23: error: Incompatible types in assignment (expression has type "Tuple[]", variable has type "Dict[str, Any]")  [assignment]
+ steam/protobufs/struct_messages.py:23: error: Incompatible types in assignment (expression has type "tuple[]", variable has type "dict[str, Any]")  [assignment]
- steam/app.py:336: error: Argument 2 to "AuthenticationTicketVerificationResult" has incompatible type "*List[User]"; expected "bool"  [arg-type]
+ steam/app.py:336: error: Argument 2 to "AuthenticationTicketVerificationResult" has incompatible type "*list[User]"; expected "bool"  [arg-type]
- steam/app.py:985: error: "Tuple[str, int, int]" has no attribute "id"  [attr-defined]
+ steam/app.py:985: error: "tuple[str, int, int]" has no attribute "id"  [attr-defined]
- steam/trade.py:191: 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:191: 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:374: error: Incompatible types in assignment (expression has type "Tuple[Any, ...]", base class "Asset" defined the type as "Tuple[str, str, str, str, str, str]")  [assignment]
+ steam/trade.py:374: error: Incompatible types in assignment (expression has type "tuple[Any, ...]", base class "Asset" defined the type as "tuple[str, str, str, str, str, str]")  [assignment]
- steam/game_server.py:146: error: Argument "type" to "Query" has incompatible type "Type[List[Any]]"; expected "Union[Type[List[str]], Tuple[Type[List[str]], ...], None]"  [arg-type]
+ steam/game_server.py:146: error: Argument "type" to "Query" has incompatible type "Type[list[Any]]"; expected "Union[Type[list[str]], tuple[Type[list[str]], ...], None]"  [arg-type]
- steam/game_server.py:151: error: Argument "type" to "Query" has incompatible type "Type[List[Any]]"; expected "Union[Type[List[str]], Tuple[Type[List[str]], ...], None]"  [arg-type]
+ steam/game_server.py:151: error: Argument "type" to "Query" has incompatible type "Type[list[Any]]"; expected "Union[Type[list[str]], tuple[Type[list[str]], ...], None]"  [arg-type]
- steam/game_server.py:156: error: Argument "type" to "Query" has incompatible type "Type[List[Any]]"; expected "Union[Type[List[str]], Tuple[Type[List[str]], ...], None]"  [arg-type]
+ steam/game_server.py:156: error: Argument "type" to "Query" has incompatible type "Type[list[Any]]"; expected "Union[Type[list[str]], tuple[Type[list[str]], ...], None]"  [arg-type]
- steam/http.py:339: error: Incompatible return value type (got "GetTradeOffers", expected "Dict[str, Any]")  [return-value]
+ steam/http.py:339: error: Incompatible return value type (got "GetTradeOffers", expected "dict[str, Any]")  [return-value]
- steam/chat.py:150: error: Incompatible types in assignment (expression has type "Tuple[int, ...]", base class "_PartialMemberProto" defined the type as "Tuple[RoleID, ...]")  [assignment]
+ steam/chat.py:150: error: Incompatible types in assignment (expression has type "tuple[int, ...]", base class "_PartialMemberProto" defined the type as "tuple[RoleID, ...]")  [assignment]
- steam/client.py:829: error: Incompatible types in assignment (expression has type "List[GameServer]", variable has type "List[IPsWithSteamIDsResponseServer]")  [assignment]
+ steam/client.py:829: error: Incompatible types in assignment (expression has type "list[GameServer]", variable has type "list[IPsWithSteamIDsResponseServer]")  [assignment]
- steam/ext/commands/cooldown.py:39: error: Incompatible return value type (implicitly returns "None", expected "Union[int, Tuple[int, ...]]")  [return-value]
+ steam/ext/commands/cooldown.py:39: error: Incompatible return value type (implicitly returns "None", expected "Union[int, tuple[int, ...]]")  [return-value]
- steam/ext/commands/cooldown.py:52: error: Incompatible return value type (got "Tuple[Union[Clan, None, Any, ID32], Any]", expected "Union[int, Tuple[int, ...]]")  [return-value]
+ steam/ext/commands/cooldown.py:52: error: Incompatible return value type (got "tuple[Union[Clan, None, Any, ID32], Any]", expected "Union[int, tuple[int, ...]]")  [return-value]
- steam/ext/commands/cooldown.py:56: error: Incompatible return value type (got "Tuple[Union[Clan, None, Any], Any]", expected "Union[int, Tuple[int, ...]]")  [return-value]
+ steam/ext/commands/cooldown.py:56: error: Incompatible return value type (got "tuple[Union[Clan, None, Any], Any]", expected "Union[int, tuple[int, ...]]")  [return-value]
- steam/ext/commands/cooldown.py:62: error: Incompatible return value type (got "Tuple[Union[Clan, None, Any, bool], Any]", expected "Union[int, Tuple[int, ...]]")  [return-value]
+ steam/ext/commands/cooldown.py:62: error: Incompatible return value type (got "tuple[Union[Clan, None, Any, bool], Any]", expected "Union[int, tuple[int, ...]]")  [return-value]
- steam/ext/commands/cooldown.py:116: error: Argument 1 to "expire_cache" of "Cooldown" has incompatible type "Union[int, Tuple[int, ...]]"; expected "Tuple[int, ...]"  [arg-type]
+ steam/ext/commands/cooldown.py:116: error: Argument 1 to "expire_cache" of "Cooldown" has incompatible type "Union[int, tuple[int, ...]]"; expected "tuple[int, ...]"  [arg-type]
- steam/ext/commands/cooldown.py:116: error: Argument 1 to "expire_cache" of "Cooldown" has incompatible type "Union[int, Tuple[int, ...]]"; expected "int"  [arg-type]
+ steam/ext/commands/cooldown.py:116: error: Argument 1 to "expire_cache" of "Cooldown" has incompatible type "Union[int, tuple[int, ...]]"; expected "int"  [arg-type]
- steam/ext/commands/cooldown.py:117: error: Argument 1 to "get_retry_after" of "Cooldown" has incompatible type "Union[int, Tuple[int, ...]]"; expected "Tuple[int, ...]"  [arg-type]
+ steam/ext/commands/cooldown.py:117: error: Argument 1 to "get_retry_after" of "Cooldown" has incompatible type "Union[int, tuple[int, ...]]"; expected "tuple[int, ...]"  [arg-type]
- steam/ext/commands/cooldown.py:117: error: Argument 1 to "get_retry_after" of "Cooldown" has incompatible type "Union[int, Tuple[int, ...]]"; expected "int"  [arg-type]
+ steam/ext/commands/cooldown.py:117: error: Argument 1 to "get_retry_after" of "Cooldown" has incompatible type "Union[int, tuple[int, ...]]"; expected "int"  [arg-type]
- steam/ext/commands/converters.py:68: error: Argument 2 of "__setitem__" is incompatible with supertype "dict"; supertype defines the argument type as "Tuple[Union[ConverterBase[Any], BasicConverter[Any]], ...]"  [override]
+ steam/ext/commands/converters.py:68: error: Argument 2 of "__setitem__" is incompatible with supertype "dict"; supertype defines the argument type as "tuple[Union[ConverterBase[Any], BasicConverter[Any]], ...]"  [override]
- steam/ext/commands/converters.py:68: error: Argument 2 of "__setitem__" is incompatible with supertype "MutableMapping"; supertype defines the argument type as "Tuple[Union[ConverterBase[Any], BasicConverter[Any]], ...]"  [override]
+ steam/ext/commands/converters.py:68: error: Argument 2 of "__setitem__" is incompatible with supertype "MutableMapping"; supertype defines the argument type as "tuple[Union[ConverterBase[Any], BasicConverter[Any]], ...]"  [override]
- steam/ext/commands/converters.py:534: error: Incompatible types in assignment (expression has type "Union[object, Any]", variable has type "Union[T, str, Tuple[T, ...], Tuple[str, ...], Union[ConverterBase[Any], BasicConverter[Any]]]")  [assignment]
+ steam/ext/commands/converters.py:534: error: Incompatible types in assignment (expression has type "Union[object, Any]", variable has type "Union[T, str, tuple[T, ...], tuple[str, ...], Union[ConverterBase[Any], BasicConverter[Any]]]")  [assignment]
- steam/ext/commands/converters.py:539: error: Item "Tuple[Any, ...]" of "Union[Tuple[Any, ...], T, str, ConverterBase[Any], BasicConverter[Any], Tuple[T, ...], Tuple[str, ...]]" has no attribute "__name__"  [union-attr]
+ steam/ext/commands/converters.py:539: error: Item "tuple[Any, ...]" of "Union[tuple[Any, ...], T, str, ConverterBase[Any], BasicConverter[Any], tuple[T, ...], tuple[str, ...]]" has no attribute "__name__"  [union-attr]
- steam/ext/commands/converters.py:539: error: Item "object" of "Union[Tuple[Any, ...], T, str, ConverterBase[Any], BasicConverter[Any], Tuple[T, ...], Tuple[str, ...]]" has no attribute "__name__"  [union-attr]
+ steam/ext/commands/converters.py:539: error: Item "object" of "Union[tuple[Any, ...], T, str, ConverterBase[Any], BasicConverter[Any], tuple[T, ...], tuple[str, ...]]" has no attribute "__name__"  [union-attr]
- steam/ext/commands/converters.py:539: error: Item "str" of "Union[Tuple[Any, ...], T, str, ConverterBase[Any], BasicConverter[Any], Tuple[T, ...], Tuple[str, ...]]" has no attribute "__name__"  [union-attr]
+ steam/ext/commands/converters.py:539: error: Item "str" of "Union[tuple[Any, ...], T, str, ConverterBase[Any], BasicConverter[Any], tuple[T, ...], tuple[str, ...]]" has no attribute "__name__"  [union-attr]

... (truncated 48 lines) ...

aiohttp (https://github.com/aio-libs/aiohttp)
- aiohttp/helpers.py:771: error: Value of type "Optional[List[Tuple[str, str]]]" is not indexable  [index]
+ aiohttp/helpers.py:771: error: Value of type "Optional[list[tuple[str, str]]]" is not indexable  [index]

stone (https://github.com/dropbox/stone)
- test/test_tsd_types.py:30: error: Incompatible default for argument "custom_args" (default has type "None", argument has type "List[Any]")  [assignment]
+ test/test_tsd_types.py:30: error: Incompatible default for argument "custom_args" (default has type "None", argument has type "list[Any]")  [assignment]

sublime_debugger (https://github.com/daveleroy/sublime_debugger)
- modules/ui/layout.py:264: error: Incompatible types in assignment (expression has type "Tuple[Any, Union[Any, int], Union[Any, int], Any, Any]", variable has type "Tuple[]")  [assignment]
+ modules/ui/layout.py:264: error: Incompatible types in assignment (expression has type "tuple[Any, Union[Any, int], Union[Any, int], Any, Any]", variable has type "tuple[]")  [assignment]
- modules/dap/variable.py:90: error: Incompatible types in "await" (actual type "Optional[Future[List[Variable]]]", expected type "Awaitable[Any]")  [misc]
+ modules/dap/variable.py:90: error: Incompatible types in "await" (actual type "Optional[Future[list[Variable]]]", expected type "Awaitable[Any]")  [misc]
- modules/dap/transport.py:231: error: Argument 1 to "call_soon" has incompatible type "Callable[[str, Dict[str, Any]], Any]"; expected "Callable[[VarArg(Any)], Any]"  [arg-type]
+ modules/dap/transport.py:231: error: Argument 1 to "call_soon" has incompatible type "Callable[[str, dict[str, Any]], Any]"; expected "Callable[[VarArg(Any)], Any]"  [arg-type]
- modules/dap/session.py:747: error: Incompatible types in assignment (expression has type "Optional[Dict[str, Any]]", variable has type "RunInTerminalResponse")  [assignment]
+ modules/dap/session.py:747: error: Incompatible types in assignment (expression has type "Optional[dict[str, Any]]", variable has type "RunInTerminalResponse")  [assignment]
- modules/dap/session.py:752: error: Incompatible return value type (got "RunInTerminalResponse", expected "Dict[str, Any]")  [return-value]
+ modules/dap/session.py:752: error: Incompatible return value type (got "RunInTerminalResponse", expected "dict[str, Any]")  [return-value]
- modules/schema.py:153: error: Dict entry 0 has incompatible type "str": "List[Dict[str, Any]]"; expected "str": "Collection[str]"  [dict-item]
+ modules/schema.py:153: error: Dict entry 0 has incompatible type "str": "list[dict[str, Any]]"; expected "str": "Collection[str]"  [dict-item]
- modules/schema.py:174: error: List item 0 has incompatible type "Dict[str, str]"; expected "str"  [list-item]
+ modules/schema.py:174: error: List item 0 has incompatible type "dict[str, str]"; expected "str"  [list-item]
- modules/schema.py:175: error: List item 1 has incompatible type "Dict[str, Collection[str]]"; expected "str"  [list-item]
+ modules/schema.py:175: error: List item 1 has incompatible type "dict[str, Collection[str]]"; expected "str"  [list-item]
- modules/debugger.py:667: error: Incompatible types in assignment (expression has type "List[ExternalTerminal]", variable has type "List[TerminusIntegratedTerminal]")  [assignment]
+ modules/debugger.py:667: error: Incompatible types in assignment (expression has type "list[ExternalTerminal]", variable has type "list[TerminusIntegratedTerminal]")  [assignment]

alerta (https://github.com/alerta/alerta)
- alerta/app.py:48: error: Incompatible default for argument "config_override" (default has type "None", argument has type "Dict[str, Any]")  [assignment]
+ alerta/app.py:48: error: Incompatible default for argument "config_override" (default has type "None", argument has type "dict[str, Any]")  [assignment]
- alerta/models/heartbeat.py:28: error: Incompatible default for argument "tags" (default has type "None", argument has type "List[str]")  [assignment]
+ alerta/models/heartbeat.py:28: error: Incompatible default for argument "tags" (default has type "None", argument has type "list[str]")  [assignment]
- alerta/models/heartbeat.py:161: error: Incompatible default for argument "customers" (default has type "None", argument has type "List[str]")  [assignment]
+ alerta/models/heartbeat.py:161: error: Incompatible default for argument "customers" (default has type "None", argument has type "list[str]")  [assignment]
- alerta/models/heartbeat.py:170: error: Incompatible default for argument "status" (default has type "None", argument has type "List[str]")  [assignment]

... (truncated 502 lines) ...```

Copy link
Collaborator

@JukkaL JukkaL left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the updates! Looks good now.

@JukkaL JukkaL changed the title [Draft] Make messages use builtin types instead of typing's types Make messages use builtin types instead of typing's types Apr 19, 2023
@JukkaL JukkaL merged commit 768ba66 into python:master Apr 19, 2023
19 checks passed
@koogoro koogoro deleted the maxmurin/use-lowercase-list branch April 20, 2023 02:03
hauntsaninja added a commit to hauntsaninja/mypy that referenced this pull request Sep 16, 2023
Fixes python#15877

Regression was introduced by python#15070. Previously Errors objects created
in mypyc build would just use all the default values, now they use the
actual options object involved
ilevkivskyi pushed a commit that referenced this pull request Sep 17, 2023
Fixes #15877

Regression was introduced by #15070. Previously Errors objects created
in mypyc build would just use all the default values, now they use the
actual options object involved
JukkaL pushed a commit that referenced this pull request Oct 10, 2023
Fixes #15877

Regression was introduced by #15070. Previously Errors objects created
in mypyc build would just use all the default values, now they use the
actual options object involved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants