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 method

Typically, this will be used as a decorator for a method

Parameters
wrappedtypes.FunctionType or types.MethodType

The function to wrap. optional: if omitted, returns a function that can be invoked later to create the PropertyIVar

class owmeta_core.command_util.PropertyIVar(*args, **kwargs)[source]

Bases: IVar

An IVar that functions similarly to a property

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’.

setter(fset)[source]

Decorator for the setter that goes along with this property.

See also

property
class owmeta_core.command_util.SubCommand(cmd)[source]

Bases: object

A descriptor that wraps objects which function as sub-commands to OWM or to other sub-commands