@@ -187,7 +187,7 @@ def _get_fields(cls: type) -> Iterator[tuple[Field, type]]:
187187 continue
188188 if isinstance (annotation , str ):
189189 try :
190- annotation = eval (annotation , cls_globals , cls_locals ) # noqa: PGH001
190+ annotation = eval (annotation , cls_globals , cls_locals )
191191 except NameError as ex :
192192 raise TypeError (f"Failed to parse annotation of field '{ cls .__name__ } .{ name } ': { ex } " ) from None
193193 yield field , annotation
@@ -211,7 +211,6 @@ def _check_field(field: Field, field_type: type, context: str) -> None:
211211
212212@dataclass (slots = True )
213213class _ClassInfo (Generic [T ]):
214-
215214 _cache : ClassVar [MutableMapping [type [Any ], _ClassInfo [Any ]]] = WeakKeyDictionary ()
216215
217216 dataclass : type [T ]
@@ -260,7 +259,8 @@ class Binder(Generic[T]):
260259 Binds TOML data to a specific dataclass.
261260 """
262261
263- __slots__ = ("_dataclass" , "_instance" , "_class_info" )
262+ __slots__ = "_class_info" , "_dataclass" , "_instance"
263+
264264 _dataclass : type [T ]
265265 _instance : T | None
266266 _class_info : _ClassInfo [T ]
@@ -270,12 +270,10 @@ def __class_getitem__(cls: type[Binder[T]], dataclass: type[T]) -> Binder[T]:
270270 return cls (dataclass )
271271
272272 @overload
273- def __init__ (self , class_or_instance : type [T ]) -> None :
274- ...
273+ def __init__ (self , class_or_instance : type [T ]) -> None : ...
275274
276275 @overload
277- def __init__ (self , class_or_instance : T ) -> None :
278- ...
276+ def __init__ (self , class_or_instance : T ) -> None : ...
279277
280278 def __init__ (self , class_or_instance : type [T ] | T ) -> None :
281279 if isinstance (class_or_instance , type ):
@@ -323,7 +321,7 @@ def _bind_to_single_type(self, value: object, field_type: type, context: str) ->
323321 elif issubclass (origin , Mapping ):
324322 if not isinstance (value , dict ):
325323 raise TypeError (f"Value for '{ context } ' has type '{ type (value ).__name__ } ', expected table" )
326- key_type , elem_type = get_args (field_type )
324+ _key_type , elem_type = get_args (field_type )
327325 mapping = {
328326 key : self ._bind_to_field (elem , elem_type , None , f'{ context } ["{ key } "]' ) for key , elem in value .items ()
329327 }
@@ -506,7 +504,7 @@ def _format_toml_table(
506504 origin = get_origin (field_type )
507505 if origin is not None :
508506 if issubclass (origin , Mapping ):
509- key_type , value_type = get_args (field_type )
507+ _key_type , value_type = get_args (field_type )
510508 if isinstance (value_type , Binder ):
511509 if value is None :
512510 nested_map = {f"{ key_fmt } .<name>" : None }
@@ -568,12 +566,10 @@ def _format_toml_table(
568566 # These definitions exist to support the deprecated `Binder[DC]` syntax in mypy.
569567
570568 @classmethod
571- def bind (cls , data : Mapping [str , Any ]) -> T :
572- ...
569+ def bind (cls , data : Mapping [str , Any ]) -> T : ...
573570
574571 @classmethod
575- def parse_toml (cls , file : BinaryIO | str | Path ) -> T :
576- ...
572+ def parse_toml (cls , file : BinaryIO | str | Path ) -> T : ...
577573
578574 else :
579575
0 commit comments