netbits.registries.identifier.Identifier¶
- class netbits.registries.identifier.Identifier(namespace: str, id: str)[source]¶
Bases:
objectA class to represent an identifier with a namespace and an ID.
- Parameters:
namespace (str) – The namespace of the identifier.
id (str) – The ID of the identifier.
- __init__(namespace: str, id: str)[source]¶
Initialize an Identifier instance.
- Parameters:
namespace (str) – The namespace of the identifier.
id (str) – The ID of the identifier.
Methods
__init__(namespace, id)Initialize an Identifier instance.
from_string(namespaced_string)Create an Identifier instance from a namespaced string.
- classmethod from_string(namespaced_string: str)[source]¶
Create an Identifier instance from a namespaced string.
- Parameters:
namespaced_string (str) – A string in the format ‘namespace:id’.
- Returns:
An Identifier instance.
- Return type:
- Raises:
ValueError – If the string is not in the format ‘namespace:id’.