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

Change tuple[] repr to tuple[()] #15783

Merged
merged 2 commits into from
Jul 30, 2023
Merged

Conversation

sobolevn
Copy link
Member

Closes #15782

@github-actions

This comment has been minimized.

@github-actions
Copy link
Contributor

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

steam.py (https://github.com/Gobot1234/steam.py)
- steam/protobufs/struct_messages.py:24: error: Incompatible types in assignment (expression has type "tuple[]", variable has type "dict[str, Any]")  [assignment]
+ steam/protobufs/struct_messages.py:24: error: Incompatible types in assignment (expression has type "tuple[()]", variable has type "dict[str, 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, Any | int, Any | int, Any | int, Any, Any]", variable has type "tuple[]")  [assignment]
+ modules/ui/layout.py:264: error: Incompatible types in assignment (expression has type "tuple[Any, Any | int, Any | int, Any | int, Any, Any]", variable has type "tuple[()]")  [assignment]

discord.py (https://github.com/Rapptz/discord.py)
- discord/ext/tasks/__init__.py:497: error: Incompatible types in assignment (expression has type "tuple[]", variable has type "tuple[type[OSError], type[GatewayNotFound], type[ConnectionClosed], type[ClientError], type[TimeoutError]]")  [assignment]
+ discord/ext/tasks/__init__.py:497: error: Incompatible types in assignment (expression has type "tuple[()]", variable has type "tuple[type[OSError], type[GatewayNotFound], type[ConnectionClosed], type[ClientError], type[TimeoutError]]")  [assignment]

streamlit (https://github.com/streamlit/streamlit)
- lib/tests/streamlit/elements/date_input_test.py:174:16: error: Non-overlapping equality check (left operand type: "Union[date, Tuple[], Tuple[date], Tuple[date, date]]", right operand type: "List[datetime]")  [comparison-overlap]
+ lib/tests/streamlit/elements/date_input_test.py:174:16: error: Non-overlapping equality check (left operand type: "Union[date, Tuple[()], Tuple[date], Tuple[date, date]]", right operand type: "List[datetime]")  [comparison-overlap]

pydantic (https://github.com/samuelcolvin/pydantic)
- pydantic/v1/typing.py:47: error: Incompatible types in assignment (expression has type "tuple[]", variable has type "type[GenericAlias]")  [assignment]
+ pydantic/v1/typing.py:47: error: Incompatible types in assignment (expression has type "tuple[()]", variable has type "type[GenericAlias]")  [assignment]
- pydantic/v1/typing.py:53: error: Incompatible types in assignment (expression has type "tuple[]", variable has type "type[UnionType]")  [assignment]
+ pydantic/v1/typing.py:53: error: Incompatible types in assignment (expression has type "tuple[()]", variable has type "type[UnionType]")  [assignment]

@sobolevn sobolevn merged commit d71afbf into master Jul 30, 2023
18 checks passed
@sobolevn sobolevn deleted the better-empty-tuple-type-repr branch July 30, 2023 13:53
@sobolevn
Copy link
Member Author

Thanks! :)

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.

Incorrect type repr of empty tuples and namedtuples
2 participants