Firebird-uuid Reference

firebird.uuid.ROOT_SPEC = 'https://raw.githubusercontent.com/FirebirdSQL/firebird-uuid/master/root.oid'

str(object=’’) -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.__str__() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to ‘strict’.

firebird.uuid.IANA_ROOT_NAME = 'iso.org.dod.internet.private.enterprise'

str(object=’’) -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.__str__() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to ‘strict’.

firebird.uuid.oid_registry = OIDRegistry([])

Firebird OID registry.

firebird.uuid.get_specification(url: str) str[source]

Returns YAML text of OID specification from URL.

Parameters:

url (str) – URL of OID specification.

Raises:

requests.HTTPError – If one occurred.

Return type:

str

firebird.uuid.get_specifications(root: str = 'https://raw.githubusercontent.com/FirebirdSQL/firebird-uuid/master/root.oid') Tuple[Dict[str, str], Dict[str, Exception]][source]

Function traverses the tree of OID YAML specifications, and returns accessible YAML specifications and errors encountered during tree traversal.

This function does not perform any validation of loaded specifications beoynd checks and transformations needed to parse the YAML to get links to child specifications.

Returns tuple with two dictionaries:
  • First dictionary contains url: spec_yaml with all YAML specifications that were successfuly fetched.

  • Second dictionary contains url: Exception with all errors encountered during tree traversal.

Parameters:

root (str) – URL to root specification where tree traversal should begin.

Return type:

Tuple[Dict[str, str], Dict[str, Exception]]

firebird.uuid.parse_specifications(specifications: Dict) Tuple[Dict[str, Dict], Dict[str, Exception]][source]

Function that parses OID YAML specifications.

Returns tuple with two dictionaries:
  • First dictionary contains url: spec_dict, where dictionaries contain data from successfuly parsed and validated OID YAML specifications.

  • Second dictionary contains url: Exception with errors encountered during parsing and validation.

Parameters:

specifications (Dict) – Dictionary with YAML specifications returned by get_all_specifications() function.

Return type:

Tuple[Dict[str, Dict], Dict[str, Exception]]

class firebird.uuid.NodeType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: Enum

LEAF = 'leaf'
NODE = 'node'
PRIVATE = 'private'
ROOT = 'root'
class firebird.uuid.Node(*, parent: Node | None = None, oid: str | None = None, number: int | None = None, name: str | None = None, description: str | None = None, contact: str | None = None, email: str | None = None, site: str | None = None, parent_spec: str | None = None, node_spec: str | None = None, node_type: str | None = None)[source]

Bases: Distinct

OID node.

Parameters:
  • parent (Optional[Node]) – Parent node (None for root node)

  • oid (Optional[str]) – Node OID. When None, OID is constructed from parent OID and number parameter.

  • number (Optional[int]) – Node order number in parent. Part of node OID for child nodes.

  • name (Optional[str]) – Node name.

  • description (Optional[str]) – Node description.

  • contact (Optional[str]) – Contact person for this node.

  • email (Optional[str]) – E-mail of contact person.

  • site (Optional[str]) – URL to home site of node maintainer

  • parent_spec (Optional[str]) – URL to YAML specification of parent node. If not specified, it’s taken from parent node.

  • node_spec (Optional[str]) – URL to node TAML specification

  • node_type (Optional[str]) – Node type. If not specified, it’s derived from node_spec.

as_toml_dict() Dict[source]

Returns dictionary with instance data suitable for storage in TOML format (values that are not of basic type are converted to string).

Return type:

Dict

classmethod from_spec(spec_url: str, data: Dict, parent: Node | None = None) Node[source]

Returns new node from specification.

Parameters:
  • spec_url (str) – Source URL for specification.

  • data (Dict) – Parsed and validated data from OID node specification document

  • parent (Node | None) – Parent node.

Return type:

Node

get_key() UUID[source]

Returns node key -> UID

Return type:

UUID

set_parent(parent: Node) None[source]

Set new parent node.

Important: This method does NOT change the parent’s children list!

Parameters:

parent (Node) –

Return type:

None

children: List[Node]

Child nodes

contact: str | None

Name of node administrator

description: str | None

Node description

email: str | None

E-mail to node administrator

property full_name: str

Full node name (from root node)

name: str | None

Node name

node_spec: str | None

URL to node specification

node_type: NodeType | None

Node type

number: int | None

Node number (OID part after parent node OID)

oid: str | None

OID

parent: Node | None

Parent node (or None for ROOT)

parent_spec: str | None

URL to parent node specification

site: str | None

URL to node administrator home

uid: UUID

UUID

class firebird.uuid.OIDRegistry(data: Mapping | Sequence | Registry = None)[source]

Bases: Registry

Firebird OID registry.

Parameters:

data (Union[Mapping, Sequence, Registry]) –

as_toml() str[source]

Returns registry content as TOML document.

Return type:

str

get_root() Node | None[source]

Returns ROOT node, or None if root node is not registered.

Return type:

Node | None

update_from_specifications(specifications: Dict[str, str]) None[source]

Updates registered nodes from specifications.

Parameters:

specifications (Dict[str, str]) – Dictionary with url: spec_dict as returned by parse_specifications.

Return type:

None

update_from_toml(toml: str) None[source]

Updates registered nodes from TOML document.

Parameters:

toml (str) – TOML document (as created by as_toml method).

Return type:

None