owmeta_core.command_util module¶
Utilities for making objects that work with the CLICommandWrapper
- exception owmeta_core.command_util.GenericUserError[source]¶
Bases:
Exception
An error which should be reported to the user. Not necessarily an error that is the user’s fault
- class owmeta_core.command_util.IVar(default_value=None, doc=None, value_type=<class 'str'>, name=None)[source]¶
Bases:
object
A descriptor for instance variables amended to provide some attributes like default values, value types, etc.
- classmethod property(wrapped=None, *args, **kwargs)[source]¶
Creates a
PropertyIVar
from a methodTypically, this will be used as a decorator for a method
- Parameters
- wrapped
types.FunctionType
ortypes.MethodType
The function to wrap. optional: if omitted, returns a function that can be invoked later to create the
PropertyIVar
- wrapped
- class owmeta_core.command_util.PropertyIVar(*args, **kwargs)[source]¶
Bases:
IVar
An
IVar
that functions similarly to aproperty
Typically a PropertyIVar will be created by using
IVar.property
as a decorator for a method like:class A(object): @IVar.property('default_value') def prop(self): return 'value'
- __get__(target, objecttype=None)[source]¶
Executes the provided getter
When the getter is first called, and when a setter is also defined, the setter will be called with the default value before the getter is called for the first time. _Even if the default_value is not set explicitly, the setter will still be called with ‘None’.