rope.base.pyobjects =================== .. py:module:: rope.base.pyobjects Exceptions ---------- .. autoapisummary:: rope.base.pyobjects.IsBeingInferredError Classes ------- .. autoapisummary:: rope.base.pyobjects.PyObject rope.base.pyobjects.AbstractClass rope.base.pyobjects.AbstractFunction rope.base.pyobjects.AbstractModule rope.base.pyobjects.PyDefinedObject rope.base.pyobjects.PyFunction rope.base.pyobjects.PyComprehension rope.base.pyobjects.PyClass rope.base.pyobjects.PyModule rope.base.pyobjects.PyPackage Functions --------- .. autoapisummary:: rope.base.pyobjects.get_base_type rope.base.pyobjects.get_unknown Module Contents --------------- .. py:class:: PyObject(type_) .. py:attribute:: type .. py:method:: get_attributes() .. py:method:: get_attribute(name) .. py:method:: get_module() .. py:method:: get_type() .. py:function:: 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. .. py:function:: 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. .. py:class:: AbstractClass Bases: :py:obj:`PyObject` .. py:method:: get_name() .. py:method:: get_doc() .. py:method:: get_superclasses() .. py:attribute:: type .. py:method:: get_attributes() .. py:method:: get_attribute(name) .. py:method:: get_module() .. py:method:: get_type() .. py:class:: AbstractFunction Bases: :py:obj:`PyObject` .. py:method:: get_name() .. py:method:: get_doc() .. py:method:: get_param_names(special_args=True) .. py:method:: get_returned_object(args) .. py:attribute:: type .. py:method:: get_attributes() .. py:method:: get_attribute(name) .. py:method:: get_module() .. py:method:: get_type() .. py:class:: AbstractModule(doc=None) Bases: :py:obj:`PyObject` .. py:method:: get_doc() .. py:method:: get_resource() .. py:attribute:: type .. py:method:: get_attributes() .. py:method:: get_attribute(name) .. py:method:: get_module() .. py:method:: get_type() .. py:class:: PyDefinedObject(pycore, ast_node, parent) Python defined names that rope can access their sources .. py:attribute:: pycore .. py:attribute:: ast_node .. py:attribute:: scope :value: None .. py:attribute:: parent .. py:attribute:: structural_attributes :value: None .. py:attribute:: concluded_attributes .. py:attribute:: attributes .. py:attribute:: defineds :value: None .. py:property:: absolute_name .. py:attribute:: visitor_class :value: None .. py:method:: get_attributes() .. py:method:: get_attribute(name) .. py:method:: get_scope() .. py:method:: get_module() .. py:method:: get_name() .. py:method:: get_doc() -> Optional[str] .. py:method:: get_ast() .. py:class:: PyFunction(pycore, ast_node, parent) Bases: :py:obj:`PyDefinedObject`, :py:obj:`AbstractFunction` Python defined names that rope can access their sources .. py:attribute:: pycore .. py:attribute:: ast_node .. py:attribute:: scope :value: None .. py:attribute:: parent .. py:attribute:: structural_attributes :value: None .. py:attribute:: concluded_attributes .. py:attribute:: attributes .. py:attribute:: defineds :value: None .. py:property:: absolute_name .. py:attribute:: visitor_class :value: None .. py:method:: get_attributes() .. py:method:: get_attribute(name) .. py:method:: get_scope() .. py:method:: get_module() .. py:method:: get_name() .. py:method:: get_doc() -> Optional[str] .. py:method:: get_ast() .. py:method:: get_param_names(special_args=True) .. py:method:: get_returned_object(args) .. py:attribute:: type .. py:method:: get_type() .. py:class:: PyComprehension(pycore, ast_node, parent) Bases: :py:obj:`PyDefinedObject`, :py:obj:`PyObject` Python defined names that rope can access their sources .. py:method:: get_name() .. py:attribute:: pycore .. py:attribute:: ast_node .. py:attribute:: scope :value: None .. py:attribute:: parent .. py:attribute:: structural_attributes :value: None .. py:attribute:: concluded_attributes .. py:attribute:: attributes .. py:attribute:: defineds :value: None .. py:property:: absolute_name .. py:attribute:: visitor_class :value: None .. py:method:: get_attributes() .. py:method:: get_attribute(name) .. py:method:: get_scope() .. py:method:: get_module() .. py:method:: get_doc() -> Optional[str] .. py:method:: get_ast() .. py:attribute:: type .. py:method:: get_type() .. py:class:: PyClass(pycore, ast_node, parent) Bases: :py:obj:`PyDefinedObject`, :py:obj:`AbstractClass` Python defined names that rope can access their sources .. py:attribute:: pycore .. py:attribute:: ast_node .. py:attribute:: scope :value: None .. py:attribute:: parent .. py:attribute:: structural_attributes :value: None .. py:attribute:: concluded_attributes .. py:attribute:: attributes .. py:attribute:: defineds :value: None .. py:property:: absolute_name .. py:attribute:: visitor_class :value: None .. py:method:: get_attributes() .. py:method:: get_attribute(name) .. py:method:: get_scope() .. py:method:: get_module() .. py:method:: get_name() .. py:method:: get_doc() -> Optional[str] .. py:method:: get_ast() .. py:method:: get_superclasses() .. py:attribute:: type .. py:method:: get_type() .. py:class:: PyModule(pycore, ast_node, resource) Bases: :py:obj:`_PyModule` Python defined names that rope can access their sources .. py:attribute:: resource .. py:attribute:: concluded_data :value: [] .. py:property:: absolute_name :type: str .. py:method:: get_resource() .. py:attribute:: pycore .. py:attribute:: ast_node .. py:attribute:: scope :value: None .. py:attribute:: parent .. py:attribute:: structural_attributes :value: None .. py:attribute:: concluded_attributes .. py:attribute:: attributes .. py:attribute:: defineds :value: None .. py:attribute:: visitor_class :value: None .. py:method:: get_attributes() .. py:method:: get_attribute(name) .. py:method:: get_scope() .. py:method:: get_module() .. py:method:: get_name() .. py:method:: get_doc() -> Optional[str] .. py:method:: get_ast() .. py:attribute:: type .. py:method:: get_type() .. py:class:: PyPackage(pycore, ast_node, resource) Bases: :py:obj:`_PyModule` Python defined names that rope can access their sources .. py:attribute:: resource .. py:attribute:: concluded_data :value: [] .. py:property:: absolute_name :type: str .. py:method:: get_resource() .. py:attribute:: pycore .. py:attribute:: ast_node .. py:attribute:: scope :value: None .. py:attribute:: parent .. py:attribute:: structural_attributes :value: None .. py:attribute:: concluded_attributes .. py:attribute:: attributes .. py:attribute:: defineds :value: None .. py:attribute:: visitor_class :value: None .. py:method:: get_attributes() .. py:method:: get_attribute(name) .. py:method:: get_scope() .. py:method:: get_module() .. py:method:: get_name() .. py:method:: get_doc() -> Optional[str] .. py:method:: get_ast() .. py:attribute:: type .. py:method:: get_type() .. py:exception:: IsBeingInferredError Bases: :py:obj:`rope.base.exceptions.RopeError` Base exception for rope