Skip to content

Commit d25ea30

Browse files
committed
Minor changes
1 parent f5916bd commit d25ea30

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

sphinxnotes/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,6 @@
88
99
:copyright: Copyright 2020 by the Shengyu Zhang.
1010
"""
11+
12+
# NOTE: Don't use ``__import__('pkg_resources').declare_namespace(__name__)``
13+
# here, it causes the application startup process to be slower

sphinxnotes/snippet/cli.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ def main(argv:List[str]=sys.argv[1:]) -> int:
9696
igparser.add_argument('--vim-binding', action='store_true', help='dump recommended (neo)vim key binding')
9797
igparser.set_defaults(func=_on_command_integration, parser=igparser)
9898

99-
10099
# Parse command line arguments
101100
args = parser.parse_args(argv)
102101

sphinxnotes/snippet/ext.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"""
1010

1111
from __future__ import annotations
12-
from typing import List, Set, TYPE_CHECKING, Type, Dict
12+
from typing import List, Set, TYPE_CHECKING, Dict
1313
import re
1414

1515
from docutils import nodes
@@ -21,7 +21,7 @@
2121
from sphinx.util import logging
2222

2323
from .config import Config
24-
from . import Snippet, WithTitle, Document, Section, WithCodeBlock
24+
from . import Snippet, WithTitle, Document, Section
2525
from .picker import pick
2626
from .cache import Cache, Item
2727
from .keyword import Extractor
@@ -41,8 +41,6 @@ def extract_tags(s:Snippet) -> str:
4141
tags += 'd'
4242
elif isinstance(s, Section):
4343
tags += 's'
44-
if isinstance(s, WithCodeBlock):
45-
tags += 'c'
4644
return tags
4745

4846

@@ -63,8 +61,8 @@ def extract_keywords(s:Snippet) -> List[str]:
6361

6462

6563
def is_matched(pats:Dict[str,List[str]], s:[Snippet], docname:str) -> bool:
66-
# Wildcard
67-
if '*' in pats:
64+
"""Whether the snippet's tags and docname matched by given patterns pats"""
65+
if '*' in pats: # Wildcard
6866
for pat in pats['*']:
6967
if re.match(pat, docname):
7068
return True

0 commit comments

Comments
 (0)