eric7.Plugins.CheckerPlugins.CodeStyleChecker.Annotations.AnnotationsDeprecationsVisitor

Module implementing a node visitor for checking the use of deprecated 'typing' symbols.

Global Attributes

None

Classes

AnnotationsDeprecationsVisitor Class implementing a node visitor for checking the use of deprecated 'typing' symbols.
AnnotationsFutureImportVisitor Class implementing a node visitor to dtermine, if the annotations __future__ import is present.

Functions

None


AnnotationsDeprecationsVisitor

Class implementing a node visitor for checking the use of deprecated 'typing' symbols.

Derived from

ast.NodeVisitor

Class Attributes

NameReplacements
visit_AsyncFunctionDef

Class Methods

None

Methods

AnnotationsDeprecationsVisitor Constructor
__checkDeprecation Private method to check, if the given name is deprecated.
getIssues Public method to get the list of detected issues.
visit_AnnAssign Public method to handle an ast.AnnAssign node.
visit_Attribute Public method to handle an ast.Attribute node.
visit_FunctionDef Public method to handle an ast.FunctionDef or ast.AsyncFunctionDef node.
visit_Import Public method to handle an ast.Import node.
visit_ImportFrom Public method to handle an ast.ImportFrom node.

Static Methods

None

AnnotationsDeprecationsVisitor (Constructor)

AnnotationsDeprecationsVisitor(exemptedList)

Constructor

exemptedList (list of str)
list of typing symbols exempted from checking

AnnotationsDeprecationsVisitor.__checkDeprecation

__checkDeprecation(node, name)

Private method to check, if the given name is deprecated.

node (ast.ImportFrom, ast.Attribute)
reference to the node
name (str)
name to be checked

AnnotationsDeprecationsVisitor.getIssues

getIssues()

Public method to get the list of detected issues.

Return:
list of detected issues consisting of a tuple of a reference to the node and a tuple containing the used name and the suggested replacement
Return Type:
list of tuples of (ast.AST, (str, str))

AnnotationsDeprecationsVisitor.visit_AnnAssign

visit_AnnAssign(node)

Public method to handle an ast.AnnAssign node.

node (ast.AnnAssign)
reference to the node to be handled

AnnotationsDeprecationsVisitor.visit_Attribute

visit_Attribute(node)

Public method to handle an ast.Attribute node.

node (ast.Attribute)
reference to the node to be handled

AnnotationsDeprecationsVisitor.visit_FunctionDef

visit_FunctionDef(node)

Public method to handle an ast.FunctionDef or ast.AsyncFunctionDef node.

node (ast.FunctionDef or ast.AsyncFunctionDef)
reference to the node to be handled

AnnotationsDeprecationsVisitor.visit_Import

visit_Import(node)

Public method to handle an ast.Import node.

node (ast.Import)
reference to the node to be handled

AnnotationsDeprecationsVisitor.visit_ImportFrom

visit_ImportFrom(node)

Public method to handle an ast.ImportFrom node.

node (ast.ImportFrom)
reference to the node to be handled
Up


AnnotationsFutureImportVisitor

Class implementing a node visitor to dtermine, if the annotations __future__ import is present.

This class is used to determine usage of annotations for Python 3.8.

Derived from

ast.NodeVisitor

Class Attributes

None

Class Methods

None

Methods

AnnotationsFutureImportVisitor Constructor
futureImportPresent Public method to check, if a 'from __future__ import annotations' statement exists.
visit_ImportFrom Public method to handle an ast.ImportFrom node.

Static Methods

None

AnnotationsFutureImportVisitor (Constructor)

AnnotationsFutureImportVisitor()

Constructor

AnnotationsFutureImportVisitor.futureImportPresent

futureImportPresent()

Public method to check, if a 'from __future__ import annotations' statement exists.

Return:
flag indicating the existence of the import statement
Return Type:
bool

AnnotationsFutureImportVisitor.visit_ImportFrom

visit_ImportFrom(node)

Public method to handle an ast.ImportFrom node.

node (ast.ImportFrom)
reference to the node to be handled
Up