pycc.astwrappers package

Submodules

pycc.astwrappers.name module

Wrappers for ast.Name nodes.

class pycc.astwrappers.name.Name(node)

Bases: object

Wrapper for an ast.Name node for ease of use.

assignments

Get an iterable of all assignments to a name.

The scoping rules for this method are identical to that which produces an iterable of name uses.

constant

True if name is assigned to only once within its lexical scope.

declaration

Get the first declaration of the Name.

node

Get the raw ast.Name node.

source

Get the asttools.name.NAME_SOURCE of the Name.

token

Get the string which represents the Name.

uses

Get an iterable of all uses of the name.

If the source is asttools.name.NAME_SOURCE.BUILTIN this iterable will contain all uses of the name in the module. Otherwise only uses within the lexical scope of the declaration are contained within the iterable.

class pycc.astwrappers.name.NameGenerator(node)

Bases: pycc.asttools.visitor.NodeVisitorIter, pycc.asttools.name.NameVisitorMixin

Visitor which produces Name objects.

visit()

Produce Name objects from a NameVisitorMixin.

Module contents

Wrappers for AST nodes.