Skip to content

Commit c2ba165

Browse files
committed
refactor: __init__.py -> snippets.py
1 parent 1c53109 commit c2ba165

File tree

5 files changed

+16
-12
lines changed

5 files changed

+16
-12
lines changed

src/sphinxnotes/snippet/cache.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from typing import List, Tuple, Dict, Optional
1010
from dataclasses import dataclass
1111

12-
from . import Snippet
12+
from .snippets import Snippet
1313
from .utils.pdict import PDict
1414

1515

src/sphinxnotes/snippet/cli.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414
from textwrap import dedent
1515
from shutil import get_terminal_size
1616
import posixpath
17+
from importlib.metadata import version
1718

1819
from xdg.BaseDirectory import xdg_config_home
1920

20-
from . import __version__
2121
from .config import Config
2222
from .cache import Cache
2323
from .table import tablify, COLUMNS
@@ -60,7 +60,10 @@ def main(argv: List[str] = sys.argv[1:]):
6060
* (any) wildcard for any snippet"""),
6161
)
6262
parser.add_argument(
63-
'-v', '--version', action='version', version='%(prog)s ' + __version__
63+
'-v',
64+
'--version',
65+
action='version',
66+
version='%(prog)s ' + version('sphinxnotes.any'),
6467
)
6568
parser.add_argument(
6669
'-c', '--config', default=DEFAULT_CONFIG_FILE, help='path to configuration file'

src/sphinxnotes/snippet/ext.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
from collections.abc import Iterator
2727

2828
from .config import Config
29-
from . import Snippet, WithTitle, Document, Section
29+
from .snippets import Snippet, WithTitle, Document, Section
3030
from .picker import pick
3131
from .cache import Cache, Item
3232
from .keyword import Extractor

src/sphinxnotes/snippet/picker.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
from sphinx.util import logging
1717

18-
from . import Snippet, Section, Document
18+
from .snippets import Snippet, Section, Document
1919

2020
if TYPE_CHECKING:
2121
from sphinx.application import Sphinx

src/sphinxnotes/snippet/__init__.py renamed to src/sphinxnotes/snippet/snippets.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
"""
2-
sphinxnotes.snippet
3-
~~~~~~~~~~~~~~~~~~~
2+
sphinxnotes.snippet.snippets
3+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
44
5-
:copyright: Copyright 2020 Shengyu Zhang
5+
Definitions of various snippets.
6+
7+
:copyright: Copyright 2024 Shengyu Zhang
68
:license: BSD, see LICENSE for details.
79
"""
810

@@ -15,14 +17,13 @@
1517
if TYPE_CHECKING:
1618
from sphinx.environment import BuildEnvironment
1719

18-
__version__ = '1.1.1'
19-
2020

2121
class Snippet(object):
2222
"""
23-
Snippet is base class of reStructuredText snippet.
23+
Snippet is structured fragments extracted from a single Sphinx document
24+
(can also be said to be a reStructuredText file).
2425
25-
:param nodes: Document nodes that make up this snippet
26+
:param nodes: nodes of doctree that make up this snippet.
2627
"""
2728

2829
#: docname where the snippet is located, can be referenced by

0 commit comments

Comments
 (0)