| |
- builtins.classmethod(builtins.object)
-
- abstractclassmethod
- builtins.object
-
- ABC
- builtins.property(builtins.object)
-
- abstractproperty
- builtins.staticmethod(builtins.object)
-
- abstractstaticmethod
- builtins.type(builtins.object)
-
- ABCMeta
class ABC(builtins.object) |
|
Helper class that provides a standard way to create an ABC using
inheritance. |
|
Data descriptors defined here:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
Data and other attributes defined here:
- __abstractmethods__ = frozenset()
|
class ABCMeta(builtins.type) |
|
Metaclass for defining Abstract Base Classes (ABCs).
Use this metaclass to create an ABC. An ABC can be subclassed
directly, and then acts as a mix-in class. You can also register
unrelated concrete classes (even built-in classes) and unrelated
ABCs as 'virtual subclasses' -- these and their descendants will
be considered subclasses of the registering ABC by the built-in
issubclass() function, but the registering ABC won't show up in
their MRO (Method Resolution Order) nor will method
implementations defined by the registering ABC be callable (not
even via super()). |
|
- Method resolution order:
- ABCMeta
- builtins.type
- builtins.object
Methods defined here:
- __instancecheck__(cls, instance)
- Override for isinstance(instance, cls).
- __subclasscheck__(cls, subclass)
- Override for issubclass(subclass, cls).
- register(cls, subclass)
- Register a virtual subclass of an ABC.
Returns the subclass, to allow usage as a class decorator.
Static methods defined here:
- __new__(mcls, name, bases, namespace, **kwargs)
- Create and return a new object. See help(type) for accurate signature.
Methods inherited from builtins.type:
- __call__(self, /, *args, **kwargs)
- Call self as a function.
- __delattr__(self, name, /)
- Implement delattr(self, name).
- __dir__(...)
- __dir__() -> list
specialized __dir__ implementation for types
- __getattribute__(self, name, /)
- Return getattr(self, name).
- __init__(self, /, *args, **kwargs)
- Initialize self. See help(type(self)) for accurate signature.
- __prepare__(...) from builtins.type
- __prepare__() -> dict
used to create the namespace for the class statement
- __repr__(self, /)
- Return repr(self).
- __setattr__(self, name, value, /)
- Implement setattr(self, name, value).
- __sizeof__(...)
- __sizeof__() -> int
return memory consumption of the type object
- __subclasses__(...)
- __subclasses__() -> list of immediate subclasses
- mro(...)
- mro() -> list
return a type's method resolution order
Data descriptors inherited from builtins.type:
- __abstractmethods__
- __dict__
- __text_signature__
Data and other attributes inherited from builtins.type:
- __base__ = <class 'type'>
- type(object_or_name, bases, dict)
type(object) -> the object's type
type(name, bases, dict) -> a new type
- __bases__ = (<class 'type'>,)
- __basicsize__ = 864
- __dictoffset__ = 264
- __flags__ = 2148292097
- __itemsize__ = 40
- __mro__ = (<class 'abc.ABCMeta'>, <class 'type'>, <class 'object'>)
- __weakrefoffset__ = 368
|
class abstractproperty(builtins.property) |
|
A decorator indicating abstract properties.
Requires that the metaclass is ABCMeta or derived from it. A
class that has a metaclass derived from ABCMeta cannot be
instantiated unless all of its abstract properties are overridden.
The abstract properties can be called using any of the normal
'super' call mechanisms.
Usage:
class C(metaclass=ABCMeta):
@abstractproperty
def my_abstract_property(self):
...
This defines a read-only property; you can also define a read-write
abstract property using the 'long' form of property declaration:
class C(metaclass=ABCMeta):
def getx(self): ...
def setx(self, value): ...
x = abstractproperty(getx, setx)
'abstractproperty' is deprecated. Use 'property' with 'abstractmethod'
instead. |
|
- Method resolution order:
- abstractproperty
- builtins.property
- builtins.object
Data descriptors defined here:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
Data and other attributes defined here:
- __isabstractmethod__ = True
Methods inherited from builtins.property:
- __delete__(self, instance, /)
- Delete an attribute of instance.
- __get__(self, instance, owner, /)
- Return an attribute of instance, which is of type owner.
- __getattribute__(self, name, /)
- Return getattr(self, name).
- __init__(self, /, *args, **kwargs)
- Initialize self. See help(type(self)) for accurate signature.
- __new__(*args, **kwargs) from builtins.type
- Create and return a new object. See help(type) for accurate signature.
- __set__(self, instance, value, /)
- Set an attribute of instance to value.
- deleter(...)
- Descriptor to change the deleter on a property.
- getter(...)
- Descriptor to change the getter on a property.
- setter(...)
- Descriptor to change the setter on a property.
Data descriptors inherited from builtins.property:
- fdel
- fget
- fset
|
|