Skip to content

Conversation

@max-muoto
Copy link
Contributor

This PR addressed #15169, and also makes the type more accurate by, instead of accepting str | Any for the first tuple value, simply accepting | tuple[int | str, int]. Let me know if there's context I'm missing but I'm not seeing any reason why we can't do things this way.

@max-muoto max-muoto marked this pull request as ready for review December 27, 2025 21:58
@github-actions
Copy link
Contributor

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

core (https://github.com/home-assistant/core)
+ homeassistant/components/esphome/assist_satellite.py:777: error: Argument 2 of "datagram_received" is incompatible with supertype "asyncio.protocols.DatagramProtocol"; supertype defines the argument type as "tuple[str | int, int] | tuple[str, int, int, int]"  [override]
+ homeassistant/components/esphome/assist_satellite.py:777: note: This violates the Liskov substitution principle
+ homeassistant/components/esphome/assist_satellite.py:777: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#incompatible-overrides

anyio (https://github.com/agronholm/anyio)
+ src/anyio/_backends/_asyncio.py:1229: error: Argument 2 of "datagram_received" is incompatible with supertype "asyncio.protocols.DatagramProtocol"; supertype defines the argument type as "tuple[str | int, int] | tuple[str, int, int, int]"  [override]
+ src/anyio/_backends/_asyncio.py:1229: note: This violates the Liskov substitution principle
+ src/anyio/_backends/_asyncio.py:1229: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#incompatible-overrides

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.

1 participant