You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
By using this approach, we can eliminate the mypy plugin related to __pyi_private_set/get_type, allowing us to support other type checkers beyond mypy as well.
With this change, this code will work for all static type checkers:
How do you think about this approach? I'm willing to create a PR for this improvement.
The text was updated successfully, but these errors were encountered:
huynguyengl99
changed the title
Migrate __pyi_private_set/get_type to TypeVar defaults for broader type checker support
Migrate __pyi_private_set/get_type to TypeVar default for broader type checker support
May 12, 2025
huynguyengl99
changed the title
Migrate __pyi_private_set/get_type to TypeVar default for broader type checker support
Migrate _pyi_private_set/get_type to TypeVar default for broader type checker support
May 12, 2025
Uh oh!
There was an error while loading. Please reload this page.
Hi team,
Python 3.13 has added the
default
parameter for TypeVar (which we can use via typing_extensions for older Python versions).With this feature, we can remove the fields
_pyi_private_set_type
,_pyi_private_get_type
and the mypy plugin functions related to those.For example, instead of:
We can define:
By using this approach, we can eliminate the mypy plugin related to
__pyi_private_set
/get_type
, allowing us to support other type checkers beyond mypy as well.With this change, this code will work for all static type checkers:
Rather than requiring:
How do you think about this approach? I'm willing to create a PR for this improvement.
The text was updated successfully, but these errors were encountered: