@@ -774,7 +774,7 @@ def visit_Import(self, node):
774774 prefix = self .__source_before ('import' )
775775 imp = self .__convert (node .names [0 ])
776776 assert imp is not None
777- return imp .replace (prefix = prefix , qualid = imp .qualid .replace (prefix = imp .prefix ))
777+ return imp .replace (prefix = prefix , qualid = imp .qualid .replace (prefix = imp .prefix )) # ty: ignore[unresolved-attribute] # imp is Import at runtime
778778
779779 prefix = self .__source_before ('import' )
780780 names_prefix = self .__whitespace ()
@@ -1197,7 +1197,7 @@ def __convert_match_pattern(self, node):
11971197 py .MatchCase .Pattern .Kind .GROUP ,
11981198 JContainer (
11991199 prefix ,
1200- [JRightPadded (inner .replace (prefix = inner_prefix ) if hasattr (inner , 'replace' ) else inner , Space .EMPTY , Markers .EMPTY )], # ty: ignore[call-non-callable]
1200+ [JRightPadded (inner .replace (prefix = inner_prefix ) if hasattr (inner , 'replace' ) else inner , Space .EMPTY , Markers .EMPTY )],
12011201 Markers .EMPTY
12021202 ),
12031203 None
@@ -2243,7 +2243,7 @@ def __map_decorator(self, decorator) -> j.Annotation:
22432243 name = name .replace (prefix = extra_parens [- 1 ][1 ]) # ty: ignore[unresolved-attribute] # recursive call returns unknown
22442244
22452245 # Wrap in extra parentheses (innermost to outermost)
2246- wrapped : Expression = name
2246+ wrapped : Expression = name # ty: ignore[invalid-assignment]
22472247 for i in range (len (extra_parens ) - 1 , - 1 , - 1 ):
22482248 paren_prefix , _ = extra_parens [i ]
22492249 suffix = self .__whitespace ()
@@ -2769,7 +2769,7 @@ def __convert_type(self, node) -> Optional[TypeTree]:
27692769 prefix = self .__whitespace ()
27702770 converted_type = self .__convert_internal (node , self .__convert_type , self .__convert_type_mapper )
27712771 if isinstance (converted_type , TypeTree ):
2772- return converted_type .replace (prefix = prefix ) # ty: ignore[unresolved-attribute] # TypeTree base class doesn't have replace
2772+ return converted_type .replace (prefix = prefix ) # TypeTree base class doesn't have replace
27732773 else :
27742774 return py .ExpressionTypeTree (
27752775 random_id (),
@@ -3065,14 +3065,14 @@ def ident_or_field(parts: List[str]) -> NameTree:
30653065 return ident_or_field (name .split ('.' ))
30663066
30673067 def __convert_all (self , trees : Sequence ) -> List [J2 ]:
3068- return [c for tree in trees if (c := self .__convert (tree )) is not None ] # ty: ignore[invalid-return-type]
3068+ return [c for tree in trees if (c := self .__convert (tree )) is not None ] # ty: ignore[invalid-return-type] # J list, J2 is bound to J
30693069
30703070 def __convert_block (self , statements : Sequence [Statement ], delim : str = ':' ) -> j .Block :
30713071 prefix = self .__source_before (delim )
30723072 if statements :
3073- statements = [self .__pad_statement (cast (ast .stmt , s )) for s in statements ] # ty: ignore[invalid-assignment]
3073+ statements = [self .__pad_statement (cast (ast .stmt , s )) for s in statements ] # ty: ignore[invalid-assignment] # padded statement list type
30743074 else :
3075- statements = [self .__pad_right (j .Empty (random_id (), Space .EMPTY , Markers .EMPTY ), Space .EMPTY )] # ty: ignore[invalid-assignment]
3075+ statements = [self .__pad_right (j .Empty (random_id (), Space .EMPTY , Markers .EMPTY ), Space .EMPTY )] # ty: ignore[invalid-assignment] # padded statement list type
30763076 return j .Block (
30773077 random_id (),
30783078 prefix ,
@@ -3095,7 +3095,7 @@ def __pad_statement(self, stmt: ast.stmt) -> JRightPadded[Statement]:
30953095 self ._token_idx = save_idx
30963096 padding = Space .EMPTY
30973097 markers = Markers .EMPTY
3098- return JRightPadded (statement , padding , markers ) # ty: ignore[invalid-return-type] # statement is J|None from __convert_statement
3098+ return JRightPadded (statement , padding , markers ) # ty: ignore[invalid-return-type] # statement is J from __convert_statement
30993099
31003100 def __pad_list_element (self , element : J2 , last : bool = False , pad_last : bool = True , delim : str = ',' ,
31013101 end_delim : Optional [str ] = None ) -> JRightPadded [J2 ]:
0 commit comments