This module provides various utility functions.
| Function | compare |
Compare two resource IDs. |
| Function | get |
Return a realistic size for the content of an attribute. Python does not really return good sizes for some of the data types. |
| Function | get |
Split a full path e.g. from a http request into its component and return a CSE local ri . Also handle retargeting paths. |
| Function | is |
Test whether a resource ID does not yet exists. |
| Function | resource |
Get A CSEBase resource by its csi. This might be a different <CSEBase> resource then the hosting CSE. |
| Function | resource |
Get the resource type from a resource ID. |
| Function | ri |
Get the resource ID from any CSEBase or remoteCSE resource by its csi. |
| Function | ri |
Return the unstructured resource ID from either an unstructured or structured resource ID. |
| Function | ri |
Get the resource ID from a resource by its structured path. Makes a lookup to a table in the DB. |
| Function | srn |
Get the structured part of a hybrid resource ID, including the necessary handling of virtual resources in the path. |
| Function | structured |
Get the structured path of a resource by its ri. |
| Variable | storage |
Storage singleton instance. |
Compare two resource IDs.
Both IDs can be either unstructured or structured resource IDs. They match if they point to the same resource.
| Parameters | |
id1:str | First ID for the comparison. |
id2:str | Second ID for the comparison |
| Returns | |
bool | True if both IDs point to the same resource, False otherwise. |
Return a realistic size for the content of an attribute. Python does not really return good sizes for some of the data types.
| Parameters | |
attribute:Any | An attribute's content of any of the suppported types. |
| Returns | |
int | Byte size of the attribute's value. |
Split a full path e.g. from a http request into its component and return a CSE local ri . Also handle retargeting paths.
| Parameters | |
id:str | A resource ID to process. This could be a structured or unstructured, and in CSE-relative, SP-relative or Absolute format. |
| Returns | |
tuple[ | The return tupple is (RI, CSI of the resource ID, structured path of the ID, SPID if any, debug message or None). |
Test whether a resource ID does not yet exists.
| Parameters | |
ri:str | Resource ID to check |
| Returns | |
bool | Boolean indicating the result of the test |
Get A CSEBase resource by its csi. This might be a different <CSEBase> resource then the hosting CSE.
| Parameters | |
csi:str | CSE-ID of the <CSEBase> resource to retrieve. |
| Returns | |
Any | None | <CSEBase> resource or None if not found. |
Get the resource type from a resource ID.
| Parameters | |
id:str | Resource ID to check. |
| Returns | |
ResourceTypes | None | Resource type, or None in case of an error. |
Get the resource ID from any CSEBase or remoteCSE resource by its csi.
| Parameters | |
csi:str | The CSE-ID to search for. |
| Returns | |
str | None | The resource ID of the resource with the csi, or None in case of an error. |
Return the unstructured resource ID from either an unstructured or structured resource ID.
| Parameters | |
id:str | Structured or unstructured Resource ID. |
| Returns | |
str | Unstructured resource ID. |
Get the resource ID from a resource by its structured path. Makes a lookup to a table in the DB.
| Parameters | |
srn:str | structured path. |
| Returns | |
str | None | Resource ID, or None in case of an error. |
Get the structured part of a hybrid resource ID, including the necessary handling of virtual resources in the path.
| Parameters | |
srn:str | Structured version of a resource ID. This part will be filled in when ommitted. |
id:str | Resource ID to check. |
| Returns | |
tuple[ | Tuple of the (possible new & filled) structured path and the resource ID. |