@@ -37,3 +37,42 @@ def visit_Subscript(
37
37
if is_name_attr (node .value , state .from_imports , ('typing' ,), ('Unpack' ,)):
38
38
if isinstance (parent , (ast .Subscript , ast .Index )):
39
39
yield ast_to_offset (node .value ), _replace_unpack_with_star
40
+
41
+
42
+ def _visit_func (
43
+ state : State ,
44
+ node : ast .AsyncFunctionDef | ast .FunctionDef ,
45
+ parent : ast .AST ,
46
+ ) -> Iterable [tuple [Offset , TokenFunc ]]:
47
+ if state .settings .min_version < (3 , 11 ):
48
+ return
49
+
50
+ vararg = node .args .vararg
51
+ if (
52
+ vararg is not None and
53
+ isinstance (vararg .annotation , ast .Subscript ) and
54
+ is_name_attr (
55
+ vararg .annotation .value ,
56
+ state .from_imports ,
57
+ ('typing' ,), ('Unpack' ,),
58
+ )
59
+ ):
60
+ yield ast_to_offset (vararg .annotation .value ), _replace_unpack_with_star
61
+
62
+
63
+ @register (ast .AsyncFunctionDef )
64
+ def visit_AsyncFunctionDef (
65
+ state : State ,
66
+ node : ast .AsyncFunctionDef ,
67
+ parent : ast .AST ,
68
+ ) -> Iterable [tuple [Offset , TokenFunc ]]:
69
+ yield from _visit_func (state , node , parent )
70
+
71
+
72
+ @register (ast .FunctionDef )
73
+ def visit_FunctionDef (
74
+ state : State ,
75
+ node : ast .FunctionDef ,
76
+ parent : ast .AST ,
77
+ ) -> Iterable [tuple [Offset , TokenFunc ]]:
78
+ yield from _visit_func (state , node , parent )
0 commit comments