@@ -651,11 +651,7 @@ def _get_name_nodes(self):
651
651
yield matching
652
652
653
653
def _get_return_nodes_skip_functions (self ):
654
- for child_node in self .get_children ():
655
- if child_node .is_function :
656
- continue
657
- for matching in child_node ._get_return_nodes_skip_functions ():
658
- yield matching
654
+ yield from ()
659
655
660
656
def _get_yield_nodes_skip_lambdas (self ):
661
657
for child_node in self .get_children ():
@@ -2832,6 +2828,12 @@ def catch(self, exceptions): # pylint: disable=redefined-outer-name
2832
2828
return True
2833
2829
return False
2834
2830
2831
+ def _get_return_nodes_skip_functions (self ):
2832
+ for child_node in self .body :
2833
+ if child_node .is_function :
2834
+ continue
2835
+ yield from child_node ._get_return_nodes_skip_functions ()
2836
+
2835
2837
2836
2838
class Exec (Statement ):
2837
2839
"""Class representing the ``exec`` statement.
@@ -2982,6 +2984,17 @@ def _get_assign_nodes(self):
2982
2984
for child_node in self .orelse :
2983
2985
yield from child_node ._get_assign_nodes ()
2984
2986
2987
+ def _get_return_nodes_skip_functions (self ):
2988
+ for child_node in self .body :
2989
+ if child_node .is_function :
2990
+ continue
2991
+ yield from child_node ._get_return_nodes_skip_functions ()
2992
+
2993
+ for child_node in self .orelse :
2994
+ if child_node .is_function :
2995
+ continue
2996
+ yield from child_node ._get_return_nodes_skip_functions ()
2997
+
2985
2998
2986
2999
class AsyncFor (For ):
2987
3000
"""Class representing an :class:`ast.AsyncFor` node.
@@ -3262,6 +3275,17 @@ def _get_assign_nodes(self):
3262
3275
for child_node in self .orelse :
3263
3276
yield from child_node ._get_assign_nodes ()
3264
3277
3278
+ def _get_return_nodes_skip_functions (self ):
3279
+ for child_node in self .body :
3280
+ if child_node .is_function :
3281
+ continue
3282
+ yield from child_node ._get_return_nodes_skip_functions ()
3283
+
3284
+ for child_node in self .orelse :
3285
+ if child_node .is_function :
3286
+ continue
3287
+ yield from child_node ._get_return_nodes_skip_functions ()
3288
+
3265
3289
3266
3290
class IfExp (NodeNG ):
3267
3291
"""Class representing an :class:`ast.IfExp` node.
@@ -3673,12 +3697,6 @@ def get_children(self):
3673
3697
def _get_return_nodes_skip_functions (self ):
3674
3698
yield self
3675
3699
3676
- for child_node in self .get_children ():
3677
- if child_node .is_function :
3678
- continue
3679
- for matching in child_node ._get_return_nodes_skip_functions ():
3680
- yield matching
3681
-
3682
3700
3683
3701
class Set (_BaseContainer ):
3684
3702
"""Class representing an :class:`ast.Set` node.
@@ -3987,6 +4005,18 @@ def _get_assign_nodes(self):
3987
4005
for child_node in self .orelse :
3988
4006
yield from child_node ._get_assign_nodes ()
3989
4007
4008
+ def _get_return_nodes_skip_functions (self ):
4009
+ for child_node in self .body :
4010
+ if child_node .is_function :
4011
+ continue
4012
+ yield from child_node ._get_return_nodes_skip_functions ()
4013
+
4014
+ for child_node in self .orelse or ():
4015
+ if child_node .is_function :
4016
+ continue
4017
+ for matching in child_node ._get_return_nodes_skip_functions ():
4018
+ yield matching
4019
+
3990
4020
3991
4021
class TryFinally (mixins .BlockRangeMixIn , Statement ):
3992
4022
"""Class representing an :class:`ast.TryFinally` node.
@@ -4054,6 +4084,18 @@ def _get_assign_nodes(self):
4054
4084
for child_node in self .finalbody :
4055
4085
yield from child_node ._get_assign_nodes ()
4056
4086
4087
+ def _get_return_nodes_skip_functions (self ):
4088
+ for child_node in self .body :
4089
+ if child_node .is_function :
4090
+ continue
4091
+ yield from child_node ._get_return_nodes_skip_functions ()
4092
+
4093
+ for child_node in self .finalbody :
4094
+ if child_node .is_function :
4095
+ continue
4096
+ for matching in child_node ._get_return_nodes_skip_functions ():
4097
+ yield matching
4098
+
4057
4099
4058
4100
class Tuple (_BaseContainer ):
4059
4101
"""Class representing an :class:`ast.Tuple` node.
@@ -4252,6 +4294,18 @@ def _get_assign_nodes(self):
4252
4294
for child_node in self .orelse :
4253
4295
yield from child_node ._get_assign_nodes ()
4254
4296
4297
+ def _get_return_nodes_skip_functions (self ):
4298
+ for child_node in self .body :
4299
+ if child_node .is_function :
4300
+ continue
4301
+ yield from child_node ._get_return_nodes_skip_functions ()
4302
+
4303
+ for child_node in self .orelse :
4304
+ if child_node .is_function :
4305
+ continue
4306
+ for matching in child_node ._get_return_nodes_skip_functions ():
4307
+ yield matching
4308
+
4255
4309
4256
4310
class With (mixins .BlockRangeMixIn , mixins .AssignTypeMixin , Statement ):
4257
4311
"""Class representing an :class:`ast.With` node.
@@ -4313,6 +4367,12 @@ def _get_assign_nodes(self):
4313
4367
for child_node in self .body :
4314
4368
yield from child_node ._get_assign_nodes ()
4315
4369
4370
+ def _get_return_nodes_skip_functions (self ):
4371
+ for child_node in self .body :
4372
+ if child_node .is_function :
4373
+ continue
4374
+ yield from child_node ._get_return_nodes_skip_functions ()
4375
+
4316
4376
4317
4377
class AsyncWith (With ):
4318
4378
"""Asynchronous ``with`` built with the ``async`` keyword."""
0 commit comments