class Class(_model.Class, ApiObject): (source)
Represents a class definition.
Method | __init__ |
Undocumented |
Method | ancestors |
Reccursively returns resolved_bases for all bases. |
Method | find |
Look up a name in this class and its base classes. |
Class Variable | decorations |
A list of decorations used in the class definition. |
Class Variable | members |
The members of the API object. |
Class Variable | parent |
The parent of the API object. |
Instance Variable | constructor |
The constructor method of this class. |
Instance Variable | inherited |
Members inherited from superclasses. |
Instance Variable | is |
Whether this class is abstract. |
Instance Variable | is |
Whether this class extends one of the standard library exceptions. |
Instance Variable | mro |
The method resoltion order of this class. |
Instance Variable | resolved |
For each bases, try to resolve the name to an ApiObject or fallback to the expanded name. |
Instance Variable | subclasses |
The direct subclasses of this class. |
Method | _init |
A method to define extra attributes that will be set after initialization. |
Inherited from Class
:
Instance Variable | bases |
Undocumented |
Instance Variable | is |
Undocumented |
Class Variable | _spec |
Undocumented |
Instance Variable | _ast |
Undocumented |
Inherited from Class
(via Class
):
Instance Variable | bases |
The list of base classes as code strings. |
Instance Variable | metaclass |
The metaclass used in the class definition as a code string. |
Instance Variable | modifiers |
A list of language-specific modifiers that were used to declare this #Variable object. |
Instance Variable | semantic |
A list of hints that describe the object. |
Inherited from HasMembers
(via Class
, Class
):
Method | sync |
Synchronize the hierarchy of this API object and all of it's children. This should be called when the #HasMembers.members are updated to ensure that all child objects reference the right #parent. Loaders are expected to return #ApiObject#s in a fully synchronized state such that the user does not have to call this method unless they are doing modifications to the tree. |
Inherited from ApiObject
(via Class
, Class
, HasMembers
):
Instance Variable | docstring |
The documentation string of the API object. |
Instance Variable | location |
The location of the API object, i.e. where it is sourced from/defined in the code. |
Instance Variable | name |
The name of the entity. This is usually relative to the respective parent of the entity, as opposed to it's fully qualified name/absolute name. However, that is more of a recommendation than rule. For example the #docspec_python loader by default returns #Module objects with their full module name (and does not create a module hierarchy). |
Property | path |
Returns a list of all of this API object's parents, from top to bottom. The list includes self as the last item. |
Inherited from ApiObject
(via Class
):
Method | __repr__ |
Undocumented |
Method | __str__ |
Undocumented |
Method | add |
A new nodes to the tree, siblings to this node. |
Method | get |
Retrieve a member from the API object. This will always return None for objects that don't support members (eg. Function and Variable ). |
Method | get |
Like get_member but can return several items with the same name. |
Method | remove |
Undocumented |
Method | replace |
Replace this object by one or more objects. |
Method | walk |
Traverse a tree of objects, calling the genericvisitor.Visitor.visit method of visitor when entering each node. |
Method | walkabout |
Perform a tree traversal similarly to walk() , except also call the genericvisitor.Visitor.depart method before exiting each node. |
Instance Variable | root |
TreeRoot instance holding references to all objects in the tree. |
Property | dotted |
The fully qualified dotted name of this object, as DottedName instance. |
Property | full |
The fully qualified dotted name of this object, as string. This value is used as the key in the ApiObject.root.all_objects dictionnary. |
Property | module |
Undocumented |
Property | scope |
Undocumented |
Method | _members |
Undocumented |
Method | _remove |
Undocumented |
Method | _repr |
Undocumented |
Inherited from ApiObject
(via Class
, ApiObject
):
Method | sync |
Synchronize the hierarchy of this API object and all of it's children. This should be called when the #HasMembers.members are updated to ensure that all child objects reference the right #parent. Loaders are expected to return #ApiObject#s in a fully synchronized state such that the user does not have to call this method unless they are doing modifications to the tree. |
Instance Variable | docstring |
The documentation string of the API object. |
Instance Variable | location |
The location of the API object, i.e. where it is sourced from/defined in the code. |
Instance Variable | name |
The name of the entity. This is usually relative to the respective parent of the entity, as opposed to it's fully qualified name/absolute name. However, that is more of a recommendation than rule. For example the #docspec_python loader by default returns #Module objects with their full module name (and does not create a module hierarchy). |
Property | path |
Returns a list of all of this API object's parents, from top to bottom. The list includes self as the last item. |
Inherited from CanTriggerWarnings
(via Class
, ApiObject
):
Method | warn |
Undocumented |
Inherited from GetMembersMixin
(via Class
, ApiObject
):
Method | __getitem__ |
Undocumented |
Inherited from ApiObject
:
Method | expand |
Return a fully qualified name for the possibly-dotted name . |
Method | resolve |
Return the object named by "name" (using Python's lookup rules) in this context. |
Class Variable | docstring |
The documentation string of the API object. |
Class Variable | location |
The location of the API object, i.e. where it is sourced from/defined in the code. |
Class Variable | module |
Undocumented |
Class Variable | root |
TreeRoot instance holding references to all objects in the tree. |
Instance Variable | aliases |
Aliases to this object. |
Instance Variable | doc |
Objects that can be considered as a source of documentation. |
Method | _local |
Undocumented |
Method | _resolve |
Follow an indirection and return the supposed full name of the origin object. |
Inherited from ApiObject
(via ApiObject
):
Method | __repr__ |
Undocumented |
Method | __str__ |
Undocumented |
Method | add |
A new nodes to the tree, siblings to this node. |
Method | get |
Retrieve a member from the API object. This will always return None for objects that don't support members (eg. Function and Variable ). |
Method | get |
Like get_member but can return several items with the same name. |
Method | remove |
Undocumented |
Method | replace |
Replace this object by one or more objects. |
Method | walk |
Traverse a tree of objects, calling the genericvisitor.Visitor.visit method of visitor when entering each node. |
Method | walkabout |
Perform a tree traversal similarly to walk() , except also call the genericvisitor.Visitor.depart method before exiting each node. |
Property | dotted |
The fully qualified dotted name of this object, as DottedName instance. |
Property | full |
The fully qualified dotted name of this object, as string. This value is used as the key in the ApiObject.root.all_objects dictionnary. |
Property | scope |
Undocumented |
Method | _members |
Undocumented |
Method | _remove |
Undocumented |
Method | _repr |
Undocumented |
Class Variable | _spec |
Undocumented |
Inherited from ApiObject
(via ApiObject
, ApiObject
):
Method | sync |
Synchronize the hierarchy of this API object and all of it's children. This should be called when the #HasMembers.members are updated to ensure that all child objects reference the right #parent. Loaders are expected to return #ApiObject#s in a fully synchronized state such that the user does not have to call this method unless they are doing modifications to the tree. |
Instance Variable | name |
The name of the entity. This is usually relative to the respective parent of the entity, as opposed to it's fully qualified name/absolute name. However, that is more of a recommendation than rule. For example the #docspec_python loader by default returns #Module objects with their full module name (and does not create a module hierarchy). |
Property | path |
Returns a list of all of this API object's parents, from top to bottom. The list includes self as the last item. |
Inherited from CanTriggerWarnings
(via ApiObject
, ApiObject
):
Method | warn |
Undocumented |
Inherited from GetMembersMixin
(via ApiObject
, ApiObject
):
Method | __getitem__ |
Undocumented |
Whether this class is abstract.
A class is abstract if it has abstract methods or if it's declared with metaclass=ABCMeta.
For each bases, try to resolve the name to an ApiObject
or fallback to the expanded name.
See Also | |
resolve_name and expand_name |
A method to define extra attributes that will be set after initialization.
Note | |
Most attributes don't need a special value at initialization (if they use None as default for instance), in those cases, avoid overriding this method by declaring them as class variable. Override this method only if you have to initialize an attribute value to a mutable object. |