Skip to content

Commit b48a9c9

Browse files
committed
chore: Use __all__ to re-export APIs
1 parent 3fad43e commit b48a9c9

3 files changed

Lines changed: 34 additions & 39 deletions

File tree

src/sphinxnotes/data/__init__.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,42 @@
1212
from sphinx.util import logging
1313

1414
from . import meta
15+
from .data import (
16+
Registry, Form, BoolFlag, OperFlag,
17+
Value, ValueWrapper,
18+
RawData, Data,
19+
Field, Schema,
20+
)
21+
from .template import Phase, Template
22+
from .render import (
23+
Caller,
24+
pending_node, RenderedNode, rendered_node, rendered_inline_node,
25+
BaseDataDefiner, BaseDataDefineRole, BaseDataDefineDirective,
26+
StrictDataDefineDirective,
27+
)
1528

1629
if TYPE_CHECKING:
1730
from sphinx.application import Sphinx
1831

32+
33+
"""Python API for other Sphinx extesions."""
34+
__all__ = [
35+
'Registry', 'Form', 'BoolFlag', 'OperFlag',
36+
'Value', 'ValueWrapper',
37+
'RawData', 'Data',
38+
'Field', 'Schema',
39+
40+
'Phase', 'Template',
41+
42+
'Caller',
43+
'pending_node', 'RenderedNode', 'rendered_node', 'rendered_inline_node',
44+
'BaseDataDefiner', 'BaseDataDefineRole', 'BaseDataDefineDirective',
45+
'BaseDataDefineDirective', 'StrictDataDefineDirective',
46+
]
47+
1948
logger = logging.getLogger(__name__)
2049

50+
2151
def setup(app: Sphinx):
2252
meta.pre_setup(app)
2353

src/sphinxnotes/data/api.py

Lines changed: 0 additions & 37 deletions
This file was deleted.

src/sphinxnotes/data/data.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ def ascontext(self) -> dict[str, Any]:
171171
def title(self) -> str | None:
172172
return ValueWrapper(self.name).as_str()
173173

174+
174175
@dataclass
175176
class Field:
176177
#: Type of element.
@@ -414,7 +415,9 @@ def parse(self, data: RawData) -> Data:
414415

415416
return Data(name, attrs, content)
416417

417-
def fields(self, pred: Callable[[Field], bool] | None = None) -> Generator[tuple[str, Field]]:
418+
def fields(
419+
self, pred: Callable[[Field], bool] | None = None
420+
) -> Generator[tuple[str, Field]]:
418421
def ok(f: Field) -> bool:
419422
return not pred or pred(f)
420423

@@ -428,7 +431,6 @@ def ok(f: Field) -> bool:
428431
if self.content and ok(self.content):
429432
yield 'content', self.content
430433

431-
432434
def items(
433435
self, data: Data, pred: Callable[[Field], bool] | None = None
434436
) -> Generator[tuple[str, Field, Value]]:

0 commit comments

Comments
 (0)