API Documentation

Inheritance Diagram

Inheritance diagram of unicum.visibleobject

Visible Objects

class unicum.visibleobject.VisibleObject(*args, **kwargs)[source]

Bases: unicum.factoryobject.FactoryObject, unicum.linkedobject.LinkedObject, unicum.persistentobject.PersistentObject

get_property(property_name, property_item_name=None)[source]
to_serializable(level=0, all_properties_flag=False, recursive=True)[source]
to_json(all_properties_flag=False, property_order=('Name', 'Class', 'Module'), **kwargs)[source]
to_range(all_properties_flag=False)[source]
classmethod from_serializable(item, register_flag=False)[source]

core class method to create visible objects from a dictionary

classmethod from_json(json_str)[source]
classmethod from_range(range_list, register_flag=True)[source]

core class method to create visible objects from a range (nested list)

classmethod create(name=None, register_flag=False, **kwargs)[source]
class unicum.visibleobject.VisibleList[source]

Bases: list

register()[source]
class unicum.visibleobject.VisibleObjectList(iterable=None, object_type=<class 'unicum.visibleobject.VisibleObject'>)[source]

Bases: unicum.factoryobject.ObjectList, unicum.visibleobject.VisibleList

class unicum.visibleobject.VisibleAttributeList(iterable=None, object_type=<class 'unicum.visibleobject.VisibleObject'>, value_types=(<class 'float'>, <class 'int'>, <class 'str'>, <class 'NoneType'>, <class 'unicum.visibleobject.VisibleObject'>))[source]

Bases: unicum.persistentobject.AttributeList, unicum.visibleobject.VisibleList

class unicum.visibleobject.VisibleDataRange(iterable=None, value_types=(<class 'float'>, <class 'int'>, <class 'str'>, <class 'NoneType'>, <class 'unicum.visibleobject.VisibleObject'>), none_alias=(None, ' ', '', 'None'))[source]

Bases: unicum.datarange.DataRange

SessionHandler

class unicum.session.SessionHandler(pkg_name='unicum', cls_name='VisibleObject', cast_types={})[source]

Bases: object

api session handler for multiprocessing sessions

Parameters:
  • pkg_name – module containing relevant classes
  • cls_name – default class (inherited from unicum.VisibleObject)
  • types – additional dict of types to cast arguments

Standard type conversion is following a naming convention. So if an arguments ends with int the value will be casted with the type int given as value to the key int in types.

Same with number, year, month, day and long. Similar we cast float and value to a float, string, str and name to a str as well as bool and flag to bool

Anything ending with variant would be ignored.

And finally, the value of cls will be replaced by an attribute of pkg_name of the same name and the value of self will be replaced by an cls_name instance.

start_session(session_id)[source]

starts a session with given session_id

validate_session(session_id)[source]

checks wether a session with given session id exists

call_session(session_id, func='', kwargs={})[source]

calls the session and makes a function call with kwargs (which will be casted accordingly)

stop_session(session_id)[source]

closes a session with given session_id

Base Objects

Factory Objects

class unicum.factoryobject.FactoryType[source]

Bases: type

classmethod get(key, default=None)[source]
class unicum.factoryobject.FactoryObject(*args, **kwargs)[source]

Bases: object

Objects identified by name

register(*names)[source]
remove()[source]
to_serializable(level=0, all_properties_flag=False, recursive=True)[source]
classmethod from_serializable(item)[source]
classmethod filter(filter_func=None)[source]
classmethod get(key, default=None)[source]
classmethod keys()[source]
classmethod values()[source]
classmethod items()[source]
class unicum.factoryobject.ObjectList(iterable=None, object_type=<class 'unicum.factoryobject.FactoryObject'>)[source]

Bases: list

index(item, start=None, stop=None)[source]

Return first index of value.

Raises ValueError if the value is not present.

get(item, default=None)[source]
append(value)[source]

Append object to the end of the list.

insert(index, value)[source]

Insert object before index.

extend(iterable)[source]

Extend list by appending elements from the iterable.

to_serializable(level=0, all_properties_flag=False, recursive=True)[source]
classmethod from_serializable(item)[source]

Linked Objects

Bases: object

ref_obj
attr
class unicum.linkedobject.LinkedObject[source]

Bases: object

links from linked_obj to (obj, attribute) with obj.attribute = linked_obj

creates link from obj.attr to self :param obj: object to register link to :param attr: attribute name to register link to

removes link from obj.attr

redirects all links to self (the new linked object)

Persistent Objects

class unicum.persistentobject.PersistentObject(*args, **kwargs)[source]

Bases: object

STARTS_WITH = '_'
ENDS_WITH = '_'
JSON_INDENT = 2
is_modified
classmethod from_serializable(object_dict)[source]

core class method to create visible objects from a dictionary

to_serializable(level=0, all_properties_flag=False, recursive=True)[source]
modify_object(property_name, property_value_variant=None)[source]

api visible method for modifying visible object properties

Parameters:
  • property_name (string, list or dict) – property name
  • property_value_variant (various or None) – property value, must be None if property_name is of type dict
Returns:

modified object

Return type:

unicum.lfojbect.VisibleObject

class unicum.persistentobject.PersistentList[source]

Bases: list

classmethod from_serializable(item)[source]
to_serializable(level=0, all_properties_flag=False, recursive=True)[source]
class unicum.persistentobject.PersistentDict[source]

Bases: dict

classmethod from_serializable(item)[source]
to_serializable(level=0, all_properties_flag=False, recursive=True)[source]
class unicum.persistentobject.AttributeList(iterable=None, object_type=<class 'unicum.persistentobject.PersistentObject'>, value_types=(<class 'float'>, <class 'int'>, <class 'str'>, <class 'NoneType'>))[source]

Bases: list

object list class

classmethod from_serializable(item)[source]
append(value)[source]

Append object to the end of the list.

index(value, start=None, stop=None)[source]

Return first index of value.

Raises ValueError if the value is not present.

insert(index, value)[source]

Insert object before index.

extend(iterable)[source]

Extend list by appending elements from the iterable.

to_serializable(level=0, all_properties_flag=False, recursive=True)[source]
keys(level=0, all_properties_flag=False)[source]
values(level=0, all_properties_flag=False)[source]
items(level=0, all_properties_flag=False)[source]

DataRange Object

class unicum.datarange.DataRange(iterable=None, value_types=(<class 'float'>, <class 'int'>, <class 'str'>, <class 'NoneType'>), none_alias=(None, ' ', '', 'None'), **kwargs)[source]

Bases: object

update(other)[source]
keys()[source]
values()[source]
items()[source]
get(key, default=None)[source]
pop(key, default=None)[source]
popitem()[source]
row_append(row_key, value_list)[source]

append a new row to a DataRange

Parameters:
  • row_key – a string
  • value_list – a list
col_append(col_key, value_list)[source]

append a new row to a DataRange

Parameters:
  • row_key – a string
  • value_list – a list
row_keys()[source]
col_keys()[source]
row(item)[source]
col(item)[source]
item_list
total_list
to_serializable(level=0, all_properties_flag=False, recursive=True)[source]
transpose()[source]
append(key, value)[source]
extend(other)[source]
insert(item, key, value=None)[source]