Skip to content

Commit f29f530

Browse files
committed
Refactoring
1 parent 2f8562e commit f29f530

6 files changed

Lines changed: 27 additions & 45 deletions

File tree

python/docs/reference.txt

Lines changed: 4 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,17 @@
1+
.. currentmodule:: firebird.uuid
12

23
#######################
34
Firebird-uuid Reference
45
#######################
56

6-
firebird.uuid namespace
7-
=======================
8-
9-
You can import next components directly from `firebird.uuid` module:
10-
11-
- from `.model`: `.NodeType`, `.Node`, `.IANA_ROOT_NAME`
12-
- from `.spec`: `.get_specification`, `.get_specifications`, `.parse_specifications`, `.ROOT_SPEC`
13-
- from `~.firebird.uuid.registry`: `~firebird.uuid.registry.registry`, `.OIDRegistry`
14-
15-
Sub-modules
16-
===========
17-
18-
.. module:: firebird.uuid.spec
19-
:synopsis:
20-
217
.. autodata:: ROOT_SPEC
22-
23-
.. autoclass:: LocalFileAdapter
8+
.. autodata:: IANA_ROOT_NAME
9+
.. autodata:: registry
2410

2511
.. autofunction:: get_specification
2612
.. autofunction:: get_specifications
2713
.. autofunction:: parse_specifications
28-
.. autofunction:: validate_dict
29-
.. autofunction:: validate_spec
30-
.. autofunction:: pythonize
31-
.. autofunction:: pythonize_spec
32-
33-
.. module:: firebird.uuid.model
34-
:synopsis:
35-
36-
.. autodata:: IANA_ROOT_NAME
3714

3815
.. autoclass:: NodeType
3916
.. autoclass:: Node
40-
41-
.. autofunction:: build_tree
42-
.. autofunction:: validate_parent_child_equality
43-
44-
.. module:: firebird.uuid.registry
45-
:synopsis:
46-
47-
.. autodata:: firebird.uuid.registry.registry
48-
49-
.. autoclass:: firebird.uuid.registry.OIDRegistry
17+
.. autoclass:: OIDRegistry

python/docs/requirements.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
sphinx-bootstrap-theme>=0.8.1
22
sphinx-autodoc-typehints>=1.19.4
3-
./python
3+
sphinx>=5.3
4+
.

python/src/firebird/uuid/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,6 @@
3535
3636
"""
3737

38-
from .model import NodeType, Node, IANA_ROOT_NAME
39-
from .spec import get_specification, get_specifications, parse_specifications, ROOT_SPEC
40-
from .registry import registry, OIDRegistry
38+
from ._model import NodeType, Node, IANA_ROOT_NAME
39+
from ._spec import get_specification, get_specifications, parse_specifications, ROOT_SPEC
40+
from ._registry import registry, OIDRegistry
Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#coding:utf-8
22
#
33
# PROGRAM/MODULE: firebird-uuid
4-
# FILE: firebird/uuid/model.py
4+
# FILE: firebird/uuid/_model.py
55
# DESCRIPTION: Model for Firebird OID registry
66
# CREATED: 11.11.2022
77
#
@@ -55,6 +55,20 @@ class NodeType(Enum):
5555

5656
class Node(Distinct):
5757
"""OID node.
58+
59+
Arguments:
60+
parent: Parent node (`None` for root node)
61+
oid: Node OID. When `None`, OID is constructed from parent OID and `number` parameter.
62+
number: Node order number in parent. Part of node OID for child nodes.
63+
name: Node name.
64+
description: Node description.
65+
contact: Contact person for this node.
66+
email: E-mail of contact person.
67+
site: URL to home site of node maintainer
68+
parent_spec: URL to YAML specification of parent node. If not specified, it's
69+
taken from `parent` node.
70+
node_spec: URL to node TAML specification
71+
node_type: Node type. If not specified, it's derived from `node_spec`.
5872
"""
5973
def __init__(self, *, parent: Node=None, oid: str=None, number: int=None, name: str=None,
6074
description: str=None, contact: str=None, email: str=None, site: str=None,
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
from toml import dumps, loads
4343
from firebird.base.types import Error, STOP
4444
from firebird.base.collections import Registry
45-
from firebird.uuid.model import NodeType, Node, build_tree
45+
from ._model import NodeType, Node, build_tree
4646

4747
class OIDRegistry(Registry):
4848
"""Firebird OID registry.
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,12 @@
6464

6565
from __future__ import annotations
6666
from typing import Tuple
67+
import os
6768
import re
69+
from urllib.request import url2pathname
6870
import requests
6971
import yaml
7072

71-
from urllib.request import url2pathname
72-
import os
73-
7473

7574
class LocalFileAdapter(requests.adapters.BaseAdapter):
7675
"""Protocol Adapter to allow Requests to GET file:// URLs

0 commit comments

Comments
 (0)