Module implementing a node visitor to check return statements.
None |
ReturnVisitor | Class implementing a node visitor to check return statements. |
None |
Class implementing a node visitor to check return statements.
Note 1: This class is modeled after flake8-return v1.2.0 checker without checking for superfluous return. Note 2: This class is a combination of the main visitor class and the various mixin classes of of the above checker.
Assigns |
Loops |
Refs |
Returns |
Tries |
None |
ReturnVisitor | Constructor |
__checkFunction | Private method to check a function definition node. |
__checkImplicitReturn | Private method to check for an implicit return statement. |
__checkImplicitReturnValue | Private method to check for implicit return values. |
__checkUnnecessaryAssign | Private method to check for an unnecessary assign statement. |
__checkUnnecessaryReturnNone | Private method to check for an unnecessary 'return None' statement. |
__hasRefsBeforeNextAssign | Private method to check for references before a following assign statement. |
__hasRefsOrAssignsWithinTryOrLoop | Private method to check for references or assignments in exception handlers or loops. |
__isFalse | Private method to check, if a node value is False. |
__isNone | Private method to check, if a node value is None. |
__resultExists | Private method to check the existance of a return result. |
__visitAssignTarget | Private method to handle an assign target node. |
__visitLoop | Private method to handle loop nodes. |
__visitWithStack | Private method to traverse a given function node using a stack. |
assigns | Public method to get the Assign nodes. |
loops | Public method to get the Loop nodes. |
refs | Public method to get the References nodes. |
returns | Public method to get the Return nodes. |
tries | Public method to get the Try nodes. |
visit_Assign | Public method to handle an assign node. |
visit_AsyncFor | Public method to handle an async for loop. |
visit_AsyncFunctionDef | Public method to handle a function definition. |
visit_For | Public method to handle a for loop. |
visit_FunctionDef | Public method to handle a function definition. |
visit_Name | Public method to handle a name node. |
visit_Return | Public method to handle a return node. |
visit_Try | Public method to handle a try/except node. |
visit_While | Public method to handle a while loop. |
None |
Constructor
Private method to check a function definition node.
Private method to check for an implicit return statement.
Private method to check for implicit return values.
Private method to check for an unnecessary assign statement.
Private method to check for an unnecessary 'return None' statement.
Private method to check for references before a following assign statement.
Private method to check for references or assignments in exception handlers or loops.
Private method to check, if a node value is False.
Private method to check, if a node value is None.
Private method to check the existance of a return result.
Private method to handle an assign target node.
Private method to handle loop nodes.
Private method to traverse a given function node using a stack.
Public method to get the Assign nodes.
Public method to get the Loop nodes.
Public method to get the References nodes.
Public method to get the Return nodes.
Public method to get the Try nodes.
Public method to handle an assign node.
Public method to handle an async for loop.
Public method to handle a function definition.
Public method to handle a for loop.
Public method to handle a function definition.
Public method to handle a name node.
Public method to handle a return node.
Public method to handle a try/except node.
Public method to handle a while loop.