29
29
from flake8 .options .manager import OptionManager
30
30
31
31
# CalVer: YY.month.patch, e.g. first release of July 2022 == "22.7.1"
32
- __version__ = "22.11.1 "
32
+ __version__ = "22.11.2 "
33
33
34
34
35
35
Error_codes = {
@@ -785,7 +785,7 @@ def iter_guaranteed_once(iterable: ast.expr) -> bool:
785
785
return False
786
786
787
787
788
- trio_async_functions = (
788
+ trio_async_funcs = (
789
789
"aclose_forcefully" ,
790
790
"open_file" ,
791
791
"open_ssl_over_tcp_listeners" ,
@@ -806,6 +806,7 @@ def iter_guaranteed_once(iterable: ast.expr) -> bool:
806
806
class Visitor105 (Flake8TrioVisitor ):
807
807
def __init__ (self , * args : Any , ** kwargs : Any ):
808
808
super ().__init__ (* args , ** kwargs )
809
+ # keep a node stack so we can check whether calls are awaited
809
810
self .node_stack : List [ast .AST ] = []
810
811
811
812
def visit (self , node : ast .AST ):
@@ -817,8 +818,10 @@ def visit_Call(self, node: ast.Call):
817
818
if (
818
819
isinstance (node .func , ast .Attribute )
819
820
and isinstance (node .func .value , ast .Name )
820
- and node .func .value .id == "trio"
821
- and node .func .attr in trio_async_functions
821
+ and (
822
+ (node .func .value .id == "trio" and node .func .attr in trio_async_funcs )
823
+ or (node .func .value .id == "nursery" and node .func .attr == "start" )
824
+ )
822
825
and (
823
826
len (self .node_stack ) < 2
824
827
or not isinstance (self .node_stack [- 2 ], ast .Await )
0 commit comments