src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/Annotations/AnnotationsFunctionVisitor.py

branch
server
changeset 10759
aeb98b3fa008
parent 10754
6faecb62f3a4
child 11090
f5f5f5803935
equal deleted inserted replaced
10752:3cf5ee0c3e9f 10759:aeb98b3fa008
6 """ 6 """
7 Module implementing a node visitor for function type annotations. 7 Module implementing a node visitor for function type annotations.
8 """ 8 """
9 9
10 ##################################################################################### 10 #####################################################################################
11 ## The visitor and associated classes are adapted from flake8-annotations v3.0.1 11 ## The visitor and associated classes are adapted from flake8-annotations v3.1.1
12 ##################################################################################### 12 #####################################################################################
13 13
14 import ast 14 import ast
15 15
16 from .AnnotationsEnums import AnnotationType, ClassDecoratorType, FunctionType 16 from .AnnotationsEnums import AnnotationType, ClassDecoratorType, FunctionType
569 @param node reference to the AST Return node 569 @param node reference to the AST Return node
570 @type ast.Return 570 @type ast.Return
571 """ 571 """
572 if node.value is not None: 572 if node.value is not None:
573 # In the event of an explicit `None` return (`return None`), the 573 # In the event of an explicit `None` return (`return None`), the
574 # node body will be an instance `ast.Constant` (3.8+), which we 574 # node body will be an instance of `ast.Constant`, which we need to
575 # need to check to see if it's actually `None` 575 # check to see if it's actually `None`
576 if isinstance(node.value, ast.Constant) and node.value.value is None: 576 if isinstance(node.value, ast.Constant) and node.value.value is None:
577 return 577 return
578 578
579 self.__nonNoneReturnNodes.add(self.__context[-1]) 579 self.__nonNoneReturnNodes.add(self.__context[-1])
580 580

eric ide

mercurial