Access and manipulate the metadata of objects.
getarguments(obj)
A function to get the arguments captured by the init method of a class when an instance of the given type is initialized.
Parameters: |
|
---|
Raises: |
|
---|
Returns: |
|
---|
gethash(obj)
A function to get an unique deterministic hash of the object calculated from the name and the arguments captured by the init method of the object. If the object was not registered, an AttributeError will be raised. The hash will be calculated using the md5 algorithm by default but can be setted manually using the sethash function.
Parameters: |
|
---|
Returns: |
|
---|
Raises: |
|
---|
getmetadata(obj)
A function to get the metadata of the object. The metadata is a dictionary containing the name, the arguments and the hash of the object.
Parameters: |
|
---|
Returns: |
|
---|
getname(obj)
A function to get the name of the object. If the object has a model__name attribute, it will be returned. Otherwise, the class name will be returned.
Parameters: |
|
---|
Returns: |
|
---|
sethash(obj, hash=None)
A function to set the hash of the object. If the hash is not provided, it will be calculated using the md5 algorithm from the name and the arguments captured by the init method of the object by default. If a hash is provided, it will be setted as the hash of the object.
Parameters: |
|
---|
setname(obj, name=None)
A function to set the name of the object. If the name is not provided, it will be retrieved from the class name. If a name is provided, it will be setted as the name of the object.
Parameters: |
|
---|