Skip to content

Commit

Permalink
refactor: __init__.py -> snippets.py
Browse files Browse the repository at this point in the history
  • Loading branch information
SilverRainZ committed Oct 13, 2024
1 parent 278f624 commit 8f80425
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/sphinxnotes/snippet/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from typing import List, Tuple, Dict, Optional
from dataclasses import dataclass

from . import Snippet
from .snippets import Snippet
from .utils.pdict import PDict


Expand Down
8 changes: 6 additions & 2 deletions src/sphinxnotes/snippet/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@
from textwrap import dedent
from shutil import get_terminal_size
import posixpath
from importlib.metadata import version

from xdg.BaseDirectory import xdg_config_home
from sphinx.util.matching import patmatch

from . import __version__, Document
from .snippets import Document
from .config import Config
from .cache import Cache, IndexID, Index
from .table import tablify, COLUMNS
Expand Down Expand Up @@ -61,7 +62,10 @@ def main(argv: List[str] = sys.argv[1:]):
* (any) wildcard for any snippet"""),
)
parser.add_argument(
'-v', '--version', action='version', version='%(prog)s ' + __version__
'-v',
'--version',
action='version',
version='%(prog)s ' + version('sphinxnotes.any'),
)
parser.add_argument(
'-c', '--config', default=DEFAULT_CONFIG_FILE, help='path to configuration file'
Expand Down
2 changes: 1 addition & 1 deletion src/sphinxnotes/snippet/ext.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
from collections.abc import Iterator

from .config import Config
from . import Snippet, WithTitle, Document, Section
from .snippets import Snippet, WithTitle, Document, Section
from .picker import pick
from .cache import Cache, Item
from .keyword import Extractor
Expand Down
2 changes: 1 addition & 1 deletion src/sphinxnotes/snippet/picker.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

from sphinx.util import logging

from . import Snippet, Section, Document
from .snippets import Snippet, Section, Document

if TYPE_CHECKING:
from sphinx.application import Sphinx
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
"""
sphinxnotes.snippet
~~~~~~~~~~~~~~~~~~~
sphinxnotes.snippet.snippets
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: Copyright 2020 Shengyu Zhang
Definitions of various snippets.
:copyright: Copyright 2024 Shengyu Zhang
:license: BSD, see LICENSE for details.
"""

Expand All @@ -16,14 +18,13 @@
if TYPE_CHECKING:
from sphinx.environment import BuildEnvironment

__version__ = '1.1.1'


class Snippet(object):
"""
Snippet is base class of reStructuredText snippet.
Snippet is structured fragments extracted from a single Sphinx document
(can also be said to be a reStructuredText file).
:param nodes: Document nodes that make up this snippet
:param nodes: nodes of doctree that make up this snippet.
"""

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

0 comments on commit 8f80425

Please sign in to comment.