# eric7.Plugins.CheckerPlugins.CodeStyleChecker.Annotations.AnnotationsFutureVisitor

Module implementing a node visitor for function type annotations.

### Global Attributes

None

### Classes

AnnotationsFutureVisitor | Class implementing a node visitor to check __future__ imports.

### Functions

None

## AnnotationsFutureVisitor

Class implementing a node visitor to check __future__ imports.

### Derived from

ast.NodeVisitor

### Class Attributes

SimplifyableTypes

### Class Methods

None

### Methods

AnnotationsFutureVisitor | Constructor
getTypingImports | Public method to get the list of typing imports.
hasTypingImports | Public method to check, if the analyzed code includes typing imports.
importsFutureAnnotations | Public method to check, if the analyzed code uses future annotation.
visit_Attribute | Public method to record simplifiable names.
visit_Import | Public method to check imports for typing related stuff.
visit_ImportFrom | Public method to detect the 'from __future__ import annotations' import if present.

### Static Methods

None

#### AnnotationsFutureVisitor (Constructor)

AnnotationsFutureVisitor()

Constructor

#### AnnotationsFutureVisitor.getTypingImports

getTypingImports()

Public method to get the list of typing imports.

Return:
  list of typing imports

Return Type:
  list of str

#### AnnotationsFutureVisitor.hasTypingImports

hasTypingImports()

Public method to check, if the analyzed code includes typing imports.

Return:
  flag indicating the use of typing imports

Return Type:
  bool

#### AnnotationsFutureVisitor.importsFutureAnnotations

importsFutureAnnotations()

Public method to check, if the analyzed code uses future annotation.

Return:
  flag indicatung the use of future annotation

Return Type:
  bool

#### AnnotationsFutureVisitor.visit_Attribute

visit_Attribute(node)

Public method to record simplifiable names.

If 'import typing' or 'import typing as t' is used, add simplifiable names that were used later on in the code.

node (ast.Attribute)
  reference to the AST Attribute node

#### AnnotationsFutureVisitor.visit_Import

visit_Import(node)

Public method to check imports for typing related stuff.

This looks like: import typing or import typing as t

typing or t will be added to the list of typing aliases.

node (ast.Import)
  reference to the AST Import node

#### AnnotationsFutureVisitor.visit_ImportFrom

visit_ImportFrom(node)

Public method to detect the 'from __future__ import annotations' import if present.

If 'from typing import ...' is used, add simplifiable names that were imported.

node (ast.ImportFrom)
  reference to the AST ImportFrom node

Up