@@ -156,7 +156,7 @@ def __init__(
156156 self .parent : Module | None = parent
157157 """An optional parent for the final module object."""
158158
159- self .current : Module | Class = None # type: ignore[assignment]
159+ self .current : Module | Class = None
160160 """The current object being inspected."""
161161
162162 self .docstring_parser : DocstringStyle | Parser | None = docstring_parser
@@ -351,7 +351,7 @@ def inspect_class(self, node: ObjectNode) -> None:
351351 self .generic_inspect (node )
352352 self .extensions .call ("on_members" , node = node , obj = class_ , agent = self )
353353 self .extensions .call ("on_class_members" , node = node , cls = class_ , agent = self )
354- self .current = self .current .parent # type: ignore[assignment]
354+ self .current = self .current .parent # ty: ignore[invalid- assignment]
355355
356356 def inspect_staticmethod (self , node : ObjectNode ) -> None :
357357 """Inspect a static method.
@@ -561,7 +561,7 @@ def handle_attribute(self, node: ObjectNode, annotation: str | Expr | None = Non
561561 elif parent .kind is Kind .FUNCTION :
562562 if parent .name != "__init__" :
563563 return
564- parent = parent .parent # type: ignore[assignment]
564+ parent = parent .parent
565565 labels .add ("instance-attribute" )
566566
567567 try :
@@ -581,10 +581,10 @@ def handle_attribute(self, node: ObjectNode, annotation: str | Expr | None = Non
581581 analysis = "dynamic" ,
582582 )
583583 attribute .labels |= labels
584- parent .set_member (node .name , attribute )
584+ parent .set_member (node .name , attribute ) # ty:ignore[possibly-missing-attribute]
585585
586586 if node .name == "__all__" :
587- parent .exports = list (node .obj )
587+ parent .exports = list (node .obj ) # ty:ignore[invalid-assignment]
588588 self .extensions .call ("on_instance" , node = node , obj = attribute , agent = self )
589589 self .extensions .call ("on_attribute_instance" , node = node , attr = attribute , agent = self )
590590
@@ -642,7 +642,7 @@ def _convert_object_to_annotation(obj: Any, *, parent: Module | Class, member: s
642642 annotation_node = compile (annotation , mode = "eval" , filename = "<>" , flags = ast .PyCF_ONLY_AST , optimize = 2 )
643643 except SyntaxError :
644644 return obj
645- return safe_get_annotation (annotation_node .body , parent , member = member ) # type: ignore[attr-defined ]
645+ return safe_get_annotation (annotation_node .body , parent , member = member ) # ty: ignore[unresolved-attribute ]
646646
647647
648648_type_parameter_kind_map = {
@@ -674,9 +674,9 @@ def _convert_type_parameters(
674674 if bound is not None :
675675 bound = _convert_type_to_annotation (bound , parent = parent , member = member )
676676 constraints : list [str | Expr ] = [
677- _convert_type_to_annotation (constraint , parent = parent , member = member ) # type: ignore[misc]
677+ _convert_type_to_annotation (constraint , parent = parent , member = member )
678678 for constraint in getattr (type_parameter , "__constraints__" , ())
679- ]
679+ ] # ty:ignore[invalid-assignment]
680680
681681 if getattr (type_parameter , "has_default" , lambda : False )():
682682 default = _convert_type_to_annotation (
@@ -711,10 +711,10 @@ def _convert_type_to_annotation(obj: Any, *, parent: Module | Class, member: str
711711 ]
712712
713713 if origin is types .UnionType :
714- return functools .reduce (lambda left , right : ExprBinOp (left , "|" , right ), args ) # type: ignore[arg-type]
714+ return functools .reduce (lambda left , right : ExprBinOp (left , "|" , right ), args )
715715
716716 origin = _convert_type_to_annotation (origin , parent = parent , member = member )
717717 if origin is None :
718718 return None
719719
720- return ExprSubscript (origin , ExprTuple (args , implicit = True )) # type: ignore[arg -type]
720+ return ExprSubscript (origin , ExprTuple (args , implicit = True )) # ty: ignore[invalid-argument -type]
0 commit comments