treevalue.tree.common

TreeStorage

class treevalue.tree.common.TreeStorage

raw

treevalue.tree.common.raw(obj)
Overview:

Try wrap the given obj to raw wrapper.

Arguments:
  • obj (object): The original object.

Returns:
  • wrapped (object): Wrapped object, if the type is not necessary to be wrapped, the original object will be returned here.

unraw

treevalue.tree.common.unraw(wrapped)
Overview:

Try unwrap the given wrapped to original object.

Arguments:
  • wrapped (object): Wrapped object.

Returns:
  • obj (object): The original object.

RawWrapper

class treevalue.tree.common.RawWrapper

Wrapper class of the raw value.

__init__()

Initialize self. See help(type(self)) for accurate signature.

value()
Overview:

Get wrapped original value.

Returns:
  • obj: Original value.

delayed_partial

treevalue.tree.common.delayed_partial(func, *args, **kwargs)
Overview:

Build a delayed partial object. Similar to functools.partial().

Returns:
  • delayed: Delayed object.

undelay

treevalue.tree.common.undelay(p, is_final=True)
Overview:
Get the value of a given object, it can be a delayed proxy, a simple object or

a nested delayed proxy.

Arguments:
  • p (object): Given object to be undelay.

  • is_final (bool): Is final value getting or not, default is True.

Returns:
  • value (object): Actual value of the given ``p`.

DelayedProxy

class treevalue.tree.common.DelayedProxy
Overview:

Base class of all the delayed proxy class.

fvalue()
Overview:

Get value of the delayed proxy. Can be accessed in treevalue.tree.common.undelay() when is_final is True.

Returns:
  • value (object): Calculation result.

value()
Overview:

Get value of the delayed proxy. Should make sure the result is cached. Can be accessed in treevalue.tree.common.undelay() when is_final is False.

Returns:
  • value (object): Calculation result.

DelayedValueProxy

class treevalue.tree.common.DelayedValueProxy
Overview:

Simple function delayed proxy.

fvalue()
Overview:

Get value of the delayed proxy. Can be accessed in treevalue.tree.common.undelay() when is_final is True.

Returns:
  • value (object): Calculation result.

DelayedFuncProxy

class treevalue.tree.common.DelayedFuncProxy
Overview:

Simple function delayed proxy.

fvalue()
Overview:

Get value of the delayed proxy. Can be accessed in treevalue.tree.common.undelay() when is_final is True.

Returns:
  • value (object): Calculation result.