Class vitem
About :
The virtuel model is a graph of nodes and links between nodes A vitem object is a node of this graph. The main property is a unique identificator. Every vitem has such an attribute. The subclass of vitem may have other parameters that can be set through a basic API which is defined by the set, insert and remove method.
Functions
Function | summury |
---|---|
__init__(self) | |
exported(self) | returns a dictionary describing the attributes of the class for introspection goals (more…) |
update_to_last_version(self) | |
uid(self) | returns the identificator of the item (more…) |
get_uid(self) | returns the identificator of the item (more…) |
get(self, attribute, atkey=None) | get attibute value (more…) |
set(self, attribute, value, atkey=None) | Set the value of a vitem attribute (more…) |
insert(self, attribute, item, i=-1, atkey=None) | Insert an item reference into an attribute considered as a list of item (more…) |
remove(self, attribute, item, atkey=None) | Remove the first item reference inside an attribute considered as a list of item (more…) |
find_referenced_uid(self, uid, CHECKED=[], root=True) | Find a subuid by parsing the subgraph in a recursive mode. (more…) |
build_subuid_and_fathers_dictionaries(self, SUBUIDS={}, FATHERS={}, father=None) | Build a dictionnary of subuidof every subnodes from the graph handled by the current item. (more…) |
update_subuid_and_fathers_dictionaries_at_removal(self, SUBUIDS={}, FATHERS={}, father=None, item=None, DONE=None) | |
get_direct_children(self, CHILDREN=None) | Build a set of direct children (more…) |
deep_copy(self, COPY={}, preserveclass=True, preserv_enumeration=True) | |
Set(self, value=None, attribute=None, atkey=None, waitfeedback=True, newitem=False, local=False, sendtoserver=True) | A new Set Method which do both local and remote propagation of event (more…) |
Insert(self, item, i=-1, attribute=’’, atkey=None, waitfeedback=True, newitem=False, local=True) | A new Insert Method which do both local and remote propagation of event (more…) |
Remove(self, item, attribute=’’, atkey=None, waitfeedback=True, stillExist=False, local=True) | A new Remove Method which do both local and remote propagation of event (more…) |
Get(self, attribute=None) | |
SetContext(self, connector, deep=True) | A method to associate item to server connector (more…) |
get_fathers(self) | Provides the list of direct father of the current item within a given context (more…) |
is_father__(self, item, DONE, fathers=None) | Recursive navigation from an item to find is self is among the parents (more…) |
is_father(self, item, fathers=None) | Recursive navigation from an item to find is self is among the parents (more…) |
Methods desciption :
init
def __init__(self)
exported
def exported(self)
returns a dictionary describing the attributes of the class for introspection goals it is used by other packages to automate actions at a raw level like dump and load of an object dict[‘name’]=(‘string’,1,1,subtype=None) The key defines the name of the attribute. The tuple identifies the type of attribute, its cardinality min and its cardinality max Type of the attribute may be ‘string’, ‘int’,’boolean’,’real’,’uid’. When ‘uid’ is chosen, the attribute is a reference or a list of reference to other nodes. Then the subtype identifies which type of item may be referenced. If subtype== None then any node is acceptable. At last but not least, when cardmin == -1 the attribute is expected to be a dictionnary.
update_to_last_version
def update_to_last_version(self)
uid
def uid(self)
returns the identificator of the item
get_uid
def get_uid(self)
returns the identificator of the item
get
def get(self, attribute, atkey=None)
get attibute value if attribute is a dictionary then atkey indicates the dictionnary key which value is expected
set
def set(self, attribute, value, atkey=None)
Set the value of a vitem attribute
- attribute : the name of the attribute
- value : the value of the attribute
-
atkey : if not None then the attribute is considered as a dictionary and the attribute becomes the item of the dictionnar with this key
- returns bool,message – bool = True when set was applied – bool = False when set was not possible – message = information message
insert
def insert(self, attribute, item, i=-1, atkey=None)
Insert an item reference into an attribute considered as a list of item attribute : the name of the attribute value : the value of the attribute i : position of the inserted item atkey : if not None then the attribute is considered as a dictionary and the attribute becomes the item of the dictionnar with this key
returns bool,message bool = True when set was applied bool = False when set was not possible message = information message
remove
def remove(self, attribute, item, atkey=None)
Remove the first item reference inside an attribute considered as a list of item attribute : the name of the attribute value : the value of the attribute atkey : if not None then the attribute is considered as a dictionary and the attribute becomes the item of the dictionnar with this key
returns bool,message bool = True when set was applied bool = False when set was not possible message = information message
find_referenced_uid
def find_referenced_uid(self, uid, CHECKED=[], root=True)
Find a subuid by parsing the subgraph in a recursive mode.
- uid : the searched uid
- CHECKED : is a list of uids that have been already checked to avoid infinite loops
- root : a boolean which must be True to start the scan
build_subuid_and_fathers_dictionaries
def build_subuid_and_fathers_dictionaries(self, SUBUIDS={}, FATHERS={}, father=None)
Build a dictionnary of subuidof every subnodes from the graph handled by the current item. Since it is a recursive method the returned value as the list of already checked entities must be given as main parameters.
- → SUBUIDS : dictionary if uids
- → FATHERS : dictionary if backward links
- → father : the current father by wihch the item is introduced in the graph. If None that is just a rebuild from scratch
- ←s SUBUIDS : modified dictionary
- ←s SUBUIDS : modified dictionary
update_subuid_and_fathers_dictionaries_at_removal
def update_subuid_and_fathers_dictionaries_at_removal(self, SUBUIDS={}, FATHERS={}, father=None, item=None, DONE=None)
get_direct_children
def get_direct_children(self, CHILDREN=None)
Build a set of direct children
deep_copy
def deep_copy(self, COPY={}, preserveclass=True, preserv_enumeration=True)
Set
def Set(self, value=None, attribute=None, atkey=None, waitfeedback=True, newitem=False, local=False, sendtoserver=True)
A new Set Method which do both local and remote propagation of event
Insert
def Insert(self, item, i=-1, attribute='', atkey=None, waitfeedback=True, newitem=False, local=True)
A new Insert Method which do both local and remote propagation of event
Remove
def Remove(self, item, attribute='', atkey=None, waitfeedback=True, stillExist=False, local=True)
A new Remove Method which do both local and remote propagation of event
Get
def Get(self, attribute=None)
SetContext
def SetContext(self, connector, deep=True)
A method to associate item to server connector
get_fathers
def get_fathers(self)
Provides the list of direct father of the current item within a given context
is_father__
def is_father__(self, item, DONE, fathers=None)
Recursive navigation from an item to find is self is among the parents
is_father
def is_father(self, item, fathers=None)
Recursive navigation from an item to find is self is among the parents