rope.base.pyobjects

Exceptions

IsBeingInferredError

Base exception for rope

Classes

PyObject

AbstractClass

AbstractFunction

AbstractModule

PyDefinedObject

Python defined names that rope can access their sources

PyFunction

Python defined names that rope can access their sources

PyComprehension

Python defined names that rope can access their sources

PyClass

Python defined names that rope can access their sources

PyModule

Python defined names that rope can access their sources

PyPackage

Python defined names that rope can access their sources

Functions

get_base_type(name)

Return the base type with name name.

get_unknown()

Return a pyobject whose type is unknown

Module Contents

class rope.base.pyobjects.PyObject(type_)
type
get_attributes()
get_attribute(name)
get_module()
get_type()
rope.base.pyobjects.get_base_type(name)

Return the base type with name name.

The base types are ‘Type’, ‘Function’, ‘Module’ and ‘Unknown’. It was used to check the type of a PyObject but currently its use is discouraged. Use classes defined in this module instead. For example instead of pyobject.get_type() == get_base_type('Function') use isinstance(pyobject, AbstractFunction).

You can use AbstractClass for classes, AbstractFunction for functions, and AbstractModule for modules. You can also use PyFunction and PyClass for testing if an object is defined somewhere and rope can access its source. These classes provide more methods.

rope.base.pyobjects.get_unknown()

Return a pyobject whose type is unknown

Note that two unknown objects are equal. So for example you can write:

if pyname.get_object() == get_unknown():
    print('cannot determine what this pyname holds')

Rope could have used None for indicating unknown objects but we had to check that in many places. So actually this method returns a null object.

class rope.base.pyobjects.AbstractClass

Bases: PyObject

get_name()
get_doc()
get_superclasses()
type
get_attributes()
get_attribute(name)
get_module()
get_type()
class rope.base.pyobjects.AbstractFunction

Bases: PyObject

get_name()
get_doc()
get_param_names(special_args=True)
get_returned_object(args)
type
get_attributes()
get_attribute(name)
get_module()
get_type()
class rope.base.pyobjects.AbstractModule(doc=None)

Bases: PyObject

get_doc()
get_resource()
type
get_attributes()
get_attribute(name)
get_module()
get_type()
class rope.base.pyobjects.PyDefinedObject(pycore, ast_node, parent)

Python defined names that rope can access their sources

pycore
ast_node
scope = None
parent
structural_attributes = None
concluded_attributes
attributes
defineds = None
property absolute_name
visitor_class = None
get_attributes()
get_attribute(name)
get_scope()
get_module()
get_name()
get_doc() → str | None
get_ast()
class rope.base.pyobjects.PyFunction(pycore, ast_node, parent)

Bases: PyDefinedObject, AbstractFunction

Python defined names that rope can access their sources

pycore
ast_node
scope = None
parent
structural_attributes = None
concluded_attributes
attributes
defineds = None
property absolute_name
visitor_class = None
get_attributes()
get_attribute(name)
get_scope()
get_module()
get_name()
get_doc() → str | None
get_ast()
get_param_names(special_args=True)
get_returned_object(args)
type
get_type()
class rope.base.pyobjects.PyComprehension(pycore, ast_node, parent)

Bases: PyDefinedObject, PyObject

Python defined names that rope can access their sources

get_name()
pycore
ast_node
scope = None
parent
structural_attributes = None
concluded_attributes
attributes
defineds = None
property absolute_name
visitor_class = None
get_attributes()
get_attribute(name)
get_scope()
get_module()
get_doc() → str | None
get_ast()
type
get_type()
class rope.base.pyobjects.PyClass(pycore, ast_node, parent)

Bases: PyDefinedObject, AbstractClass

Python defined names that rope can access their sources

pycore
ast_node
scope = None
parent
structural_attributes = None
concluded_attributes
attributes
defineds = None
property absolute_name
visitor_class = None
get_attributes()
get_attribute(name)
get_scope()
get_module()
get_name()
get_doc() → str | None
get_ast()
get_superclasses()
type
get_type()
class rope.base.pyobjects.PyModule(pycore, ast_node, resource)

Bases: _PyModule

Python defined names that rope can access their sources

resource
concluded_data = []
property absolute_name: str
get_resource()
pycore
ast_node
scope = None
parent
structural_attributes = None
concluded_attributes
attributes
defineds = None
visitor_class = None
get_attributes()
get_attribute(name)
get_scope()
get_module()
get_name()
get_doc() → str | None
get_ast()
type
get_type()
class rope.base.pyobjects.PyPackage(pycore, ast_node, resource)

Bases: _PyModule

Python defined names that rope can access their sources

resource
concluded_data = []
property absolute_name: str
get_resource()
pycore
ast_node
scope = None
parent
structural_attributes = None
concluded_attributes
attributes
defineds = None
visitor_class = None
get_attributes()
get_attribute(name)
get_scope()
get_module()
get_name()
get_doc() → str | None
get_ast()
type
get_type()
exception rope.base.pyobjects.IsBeingInferredError

Bases: rope.base.exceptions.RopeError

Base exception for rope