deeplabcut.pose_estimation_pytorch.data.helper
Classes:
| Name | Description |
|---|---|
CombinedPropertyMeta |
Combined metaclass that integrates the functionalities of both |
PropertyMeta |
Metaclass for creating class properties in a more organized and systematic |
Functions:
| Name | Description |
|---|---|
class_property |
Decorator to create a class property. |
CombinedPropertyMeta
Bases: ABCMeta, PropertyMeta
Combined metaclass that integrates the functionalities of both ABCMeta and
BasePropertyMeta.
This metaclass is useful in scenarios where a class needs to use both abstract methods (from ABCMeta)
and the property definition utilities provided by BasePropertyMeta.
By using this metaclass, a class can be both an abstract class (with abstract methods and/or properties)
and can also define properties in the structured manner facilitated by PropertyMeta.
Inherits: - ABCMeta: Metaclass for base classes that include abstract methods. - PropertyMeta: Metaclass that facilitates structured property definitions.
Note:
When defining a class using CombinedPropertyMeta, ensure that the class also inherits
from ABC to make it compatible with the ABCMeta behavior.
Source code in deeplabcut/pose_estimation_pytorch/data/helper.py
PropertyMeta
Bases: type
Metaclass for creating class properties in a more organized and systematic manner.
This metaclass allows a class to define its properties using a simple dictionary
structure (properties). The dictionary keys represent the property names,
while the values are tuples containing two callables:
1. The function that represents the logic of the property.
2. The function that provides the arguments for the logic function.
Usage: class MyClass(metaclass=PropertyMeta): properties = { 'property_name': (logic_function, arguments_function), # ... more properties ... }
For each property specified in the properties dictionary, the metaclass will
generate a real property that uses the logic from logic_function and
arguments from arguments_function.
- properties (dict): Dictionary containing property names as keys and tuples of (logic_function, arguments_function) as values.
Source code in deeplabcut/pose_estimation_pytorch/data/helper.py
class_property
Decorator to create a class property.
Parameters:
- func: Callable that represents the logic of the property.
- arg_func: Callable that provides the arguments for func.
Returns:
- A property with the logic encapsulated in func and arguments derived from arg_func.