1111when it's an lvalue, return the Parameter's value type (the first type arg
1212of Parameter[_T]) instead of the raw descriptor type.
1313
14- Usage: add ``plugins = ["param._mypy_plugin "]`` to your mypy configuration.
14+ Usage: add ``plugins = ["param.mypy_plugin "]`` to your mypy configuration.
1515"""
1616
1717from __future__ import annotations
2323from mypy .types import AnyType , Instance , Type , TypeOfAny , get_proper_type
2424
2525
26- PARAMETER_BASE_FULLNAME = "param.parameterized.Parameter"
27- PARAMETERIZED_FULLNAME = "param.parameterized.Parameterized"
28-
29-
3026def _is_parameter_type (typ : Type ) -> bool :
3127 proper = get_proper_type (typ )
3228 if not isinstance (proper , Instance ):
3329 return False
3430 return any (
35- base .fullname == PARAMETER_BASE_FULLNAME
31+ base .fullname == "param.parameterized.Parameter"
3632 for base in proper .type .mro
3733 )
3834
3935
4036def _is_parameterized_class (info : TypeInfo ) -> bool :
4137 return any (
42- base .fullname == PARAMETERIZED_FULLNAME
38+ base .fullname == "param.parameterized.Parameterized"
4339 for base in info .mro
4440 )
4541
@@ -69,7 +65,7 @@ def _class_attribute_hook(ctx: AttributeContext) -> Type:
6965 return AnyType (TypeOfAny .special_form )
7066
7167
72- class ParamPlugin (Plugin ):
68+ class _ParamPlugin (Plugin ):
7369 def get_class_attribute_hook (
7470 self , fullname : str
7571 ) -> t .Callable [[AttributeContext ], Type ] | None :
@@ -96,4 +92,4 @@ def get_class_attribute_hook(
9692
9793
9894def plugin (version : str ) -> type [Plugin ]:
99- return ParamPlugin
95+ return _ParamPlugin
0 commit comments