rope.base.pyscopes ================== .. py:module:: rope.base.pyscopes Classes ------- .. autoapisummary:: rope.base.pyscopes.Scope rope.base.pyscopes.GlobalScope rope.base.pyscopes.ComprehensionScope rope.base.pyscopes.FunctionScope rope.base.pyscopes.ClassScope rope.base.pyscopes.TemporaryScope Module Contents --------------- .. py:class:: Scope(pycore, pyobject, parent_scope) .. py:attribute:: pycore .. py:attribute:: pyobject .. py:attribute:: parent .. py:method:: get_names() Return the names defined or imported in this scope .. py:method:: get_defined_names() Return the names defined in this scope .. py:method:: get_name(name) Return name `PyName` defined in this scope .. py:method:: get_scopes() Return the subscopes of this scope The returned scopes should be sorted by the order they appear. .. py:method:: lookup(name) .. py:method:: 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. .. py:method:: get_start() .. py:method:: get_body_start() .. py:method:: get_end() .. py:method:: get_logical_end() .. py:attribute:: start .. py:attribute:: end .. py:attribute:: logical_end .. py:method:: get_kind() .. py:method:: get_region() .. py:method:: in_region(offset) Checks if offset is in scope region .. py:class:: GlobalScope(pycore, module) Bases: :py:obj:`Scope` .. py:attribute:: names .. py:method:: get_start() .. py:method:: get_kind() .. py:method:: get_name(name) Return name `PyName` defined in this scope .. py:method:: get_names() Return the names defined or imported in this scope .. py:method:: get_inner_scope_for_line(lineno, indents=None) .. py:method:: get_inner_scope_for_offset(offset) .. py:property:: builtin_names .. py:attribute:: pycore .. py:attribute:: pyobject .. py:attribute:: parent .. py:method:: get_defined_names() Return the names defined in this scope .. py:method:: get_scopes() Return the subscopes of this scope The returned scopes should be sorted by the order they appear. .. py:method:: lookup(name) .. py:method:: 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. .. py:method:: get_body_start() .. py:method:: get_end() .. py:method:: get_logical_end() .. py:attribute:: start .. py:attribute:: end .. py:attribute:: logical_end .. py:method:: get_region() .. py:method:: in_region(offset) Checks if offset is in scope region .. py:class:: ComprehensionScope(pycore, pyobject, visitor) Bases: :py:obj:`Scope` .. py:attribute:: names :value: None .. py:attribute:: returned_asts :value: None .. py:attribute:: defineds :value: None .. py:attribute:: visitor .. py:method:: get_names() Return the names defined or imported in this scope .. py:method:: get_logical_end() .. py:attribute:: logical_end .. py:method:: get_body_start() .. py:attribute:: pycore .. py:attribute:: pyobject .. py:attribute:: parent .. py:method:: get_defined_names() Return the names defined in this scope .. py:method:: get_name(name) Return name `PyName` defined in this scope .. py:method:: get_scopes() Return the subscopes of this scope The returned scopes should be sorted by the order they appear. .. py:method:: lookup(name) .. py:method:: 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. .. py:method:: get_start() .. py:method:: get_end() .. py:attribute:: start .. py:attribute:: end .. py:method:: get_kind() .. py:method:: get_region() .. py:method:: in_region(offset) Checks if offset is in scope region .. py:class:: FunctionScope(pycore, pyobject, visitor) Bases: :py:obj:`Scope` .. py:attribute:: names :value: None .. py:attribute:: returned_asts :value: None .. py:attribute:: is_generator :value: None .. py:attribute:: defineds :value: None .. py:attribute:: visitor .. py:method:: get_names() Return the names defined or imported in this scope .. py:method:: get_kind() .. py:method:: invalidate_data() .. py:attribute:: pycore .. py:attribute:: pyobject .. py:attribute:: parent .. py:method:: get_defined_names() Return the names defined in this scope .. py:method:: get_name(name) Return name `PyName` defined in this scope .. py:method:: get_scopes() Return the subscopes of this scope The returned scopes should be sorted by the order they appear. .. py:method:: lookup(name) .. py:method:: 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. .. py:method:: get_start() .. py:method:: get_body_start() .. py:method:: get_end() .. py:method:: get_logical_end() .. py:attribute:: start .. py:attribute:: end .. py:attribute:: logical_end .. py:method:: get_region() .. py:method:: in_region(offset) Checks if offset is in scope region .. py:class:: ClassScope(pycore, pyobject) Bases: :py:obj:`Scope` .. py:method:: get_kind() .. py:method:: 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. .. py:attribute:: pycore .. py:attribute:: pyobject .. py:attribute:: parent .. py:method:: get_names() Return the names defined or imported in this scope .. py:method:: get_defined_names() Return the names defined in this scope .. py:method:: get_name(name) Return name `PyName` defined in this scope .. py:method:: get_scopes() Return the subscopes of this scope The returned scopes should be sorted by the order they appear. .. py:method:: lookup(name) .. py:method:: get_start() .. py:method:: get_body_start() .. py:method:: get_end() .. py:method:: get_logical_end() .. py:attribute:: start .. py:attribute:: end .. py:attribute:: logical_end .. py:method:: get_region() .. py:method:: in_region(offset) Checks if offset is in scope region .. py:class:: TemporaryScope(pycore, parent_scope, names) Bases: :py:obj:`Scope` Currently used for list comprehensions and generator expressions These scopes do not appear in the `get_scopes()` method of their parent scopes. .. py:attribute:: names .. py:method:: get_names() Return the names defined or imported in this scope .. py:method:: get_defined_names() Return the names defined in this scope .. py:method:: get_kind() .. py:attribute:: pycore .. py:attribute:: pyobject .. py:attribute:: parent .. py:method:: get_name(name) Return name `PyName` defined in this scope .. py:method:: get_scopes() Return the subscopes of this scope The returned scopes should be sorted by the order they appear. .. py:method:: lookup(name) .. py:method:: 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. .. py:method:: get_start() .. py:method:: get_body_start() .. py:method:: get_end() .. py:method:: get_logical_end() .. py:attribute:: start .. py:attribute:: end .. py:attribute:: logical_end .. py:method:: get_region() .. py:method:: in_region(offset) Checks if offset is in scope region