rope.base.pyscopes

Classes

Scope

GlobalScope

ComprehensionScope

FunctionScope

ClassScope

TemporaryScope

Currently used for list comprehensions and generator expressions

Module Contents

class rope.base.pyscopes.Scope(pycore, pyobject, parent_scope)
pycore
pyobject
parent
get_names()

Return the names defined or imported in this scope

get_defined_names()

Return the names defined in this scope

get_name(name)

Return name PyName defined in this scope

get_scopes()

Return the subscopes of this scope

The returned scopes should be sorted by the order they appear.

lookup(name)
get_propagated_names()

Return the visible names of this scope

Return the names defined in this scope that are visible from scopes containing this scope. This method returns the same dictionary returned by get_names() except for ClassScope which returns an empty dict.

get_start()
get_body_start()
get_end()
get_logical_end()
start
end
logical_end
get_kind()
get_region()
in_region(offset)

Checks if offset is in scope region

class rope.base.pyscopes.GlobalScope(pycore, module)

Bases: Scope

names
get_start()
get_kind()
get_name(name)

Return name PyName defined in this scope

get_names()

Return the names defined or imported in this scope

get_inner_scope_for_line(lineno, indents=None)
get_inner_scope_for_offset(offset)
property builtin_names
pycore
pyobject
parent
get_defined_names()

Return the names defined in this scope

get_scopes()

Return the subscopes of this scope

The returned scopes should be sorted by the order they appear.

lookup(name)
get_propagated_names()

Return the visible names of this scope

Return the names defined in this scope that are visible from scopes containing this scope. This method returns the same dictionary returned by get_names() except for ClassScope which returns an empty dict.

get_body_start()
get_end()
get_logical_end()
start
end
logical_end
get_region()
in_region(offset)

Checks if offset is in scope region

class rope.base.pyscopes.ComprehensionScope(pycore, pyobject, visitor)

Bases: Scope

names = None
returned_asts = None
defineds = None
visitor
get_names()

Return the names defined or imported in this scope

get_logical_end()
logical_end
get_body_start()
pycore
pyobject
parent
get_defined_names()

Return the names defined in this scope

get_name(name)

Return name PyName defined in this scope

get_scopes()

Return the subscopes of this scope

The returned scopes should be sorted by the order they appear.

lookup(name)
get_propagated_names()

Return the visible names of this scope

Return the names defined in this scope that are visible from scopes containing this scope. This method returns the same dictionary returned by get_names() except for ClassScope which returns an empty dict.

get_start()
get_end()
start
end
get_kind()
get_region()
in_region(offset)

Checks if offset is in scope region

class rope.base.pyscopes.FunctionScope(pycore, pyobject, visitor)

Bases: Scope

names = None
returned_asts = None
is_generator = None
defineds = None
visitor
get_names()

Return the names defined or imported in this scope

get_kind()
invalidate_data()
pycore
pyobject
parent
get_defined_names()

Return the names defined in this scope

get_name(name)

Return name PyName defined in this scope

get_scopes()

Return the subscopes of this scope

The returned scopes should be sorted by the order they appear.

lookup(name)
get_propagated_names()

Return the visible names of this scope

Return the names defined in this scope that are visible from scopes containing this scope. This method returns the same dictionary returned by get_names() except for ClassScope which returns an empty dict.

get_start()
get_body_start()
get_end()
get_logical_end()
start
end
logical_end
get_region()
in_region(offset)

Checks if offset is in scope region

class rope.base.pyscopes.ClassScope(pycore, pyobject)

Bases: Scope

get_kind()
get_propagated_names()

Return the visible names of this scope

Return the names defined in this scope that are visible from scopes containing this scope. This method returns the same dictionary returned by get_names() except for ClassScope which returns an empty dict.

pycore
pyobject
parent
get_names()

Return the names defined or imported in this scope

get_defined_names()

Return the names defined in this scope

get_name(name)

Return name PyName defined in this scope

get_scopes()

Return the subscopes of this scope

The returned scopes should be sorted by the order they appear.

lookup(name)
get_start()
get_body_start()
get_end()
get_logical_end()
start
end
logical_end
get_region()
in_region(offset)

Checks if offset is in scope region

class rope.base.pyscopes.TemporaryScope(pycore, parent_scope, names)

Bases: Scope

Currently used for list comprehensions and generator expressions

These scopes do not appear in the get_scopes() method of their parent scopes.

names
get_names()

Return the names defined or imported in this scope

get_defined_names()

Return the names defined in this scope

get_kind()
pycore
pyobject
parent
get_name(name)

Return name PyName defined in this scope

get_scopes()

Return the subscopes of this scope

The returned scopes should be sorted by the order they appear.

lookup(name)
get_propagated_names()

Return the visible names of this scope

Return the names defined in this scope that are visible from scopes containing this scope. This method returns the same dictionary returned by get_names() except for ClassScope which returns an empty dict.

get_start()
get_body_start()
get_end()
get_logical_end()
start
end
logical_end
get_region()
in_region(offset)

Checks if offset is in scope region