entangled-cli 2.0.3__tar.gz → 2.0.5__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {entangled_cli-2.0.3 → entangled_cli-2.0.5}/PKG-INFO +1 -1
- {entangled_cli-2.0.3 → entangled_cli-2.0.5}/entangled/document.py +6 -0
- {entangled_cli-2.0.3 → entangled_cli-2.0.5}/entangled/markdown_reader.py +6 -0
- {entangled_cli-2.0.3 → entangled_cli-2.0.5}/entangled/status.py +13 -2
- {entangled_cli-2.0.3 → entangled_cli-2.0.5}/entangled/tangle.py +3 -0
- {entangled_cli-2.0.3 → entangled_cli-2.0.5}/pyproject.toml +1 -1
- {entangled_cli-2.0.3 → entangled_cli-2.0.5}/LICENSE +0 -0
- {entangled_cli-2.0.3 → entangled_cli-2.0.5}/README.md +0 -0
- {entangled_cli-2.0.3 → entangled_cli-2.0.5}/entangled/__init__.py +0 -0
- {entangled_cli-2.0.3 → entangled_cli-2.0.5}/entangled/code_reader.py +0 -0
- {entangled_cli-2.0.3 → entangled_cli-2.0.5}/entangled/commands/__init__.py +0 -0
- {entangled_cli-2.0.3 → entangled_cli-2.0.5}/entangled/commands/brei.py +0 -0
- {entangled_cli-2.0.3 → entangled_cli-2.0.5}/entangled/commands/new.py +0 -0
- {entangled_cli-2.0.3 → entangled_cli-2.0.5}/entangled/commands/status.py +0 -0
- {entangled_cli-2.0.3 → entangled_cli-2.0.5}/entangled/commands/stitch.py +0 -0
- {entangled_cli-2.0.3 → entangled_cli-2.0.5}/entangled/commands/sync.py +0 -0
- {entangled_cli-2.0.3 → entangled_cli-2.0.5}/entangled/commands/tangle.py +0 -0
- {entangled_cli-2.0.3 → entangled_cli-2.0.5}/entangled/commands/watch.py +0 -0
- {entangled_cli-2.0.3 → entangled_cli-2.0.5}/entangled/config/__init__.py +0 -0
- {entangled_cli-2.0.3 → entangled_cli-2.0.5}/entangled/config/language.py +0 -0
- {entangled_cli-2.0.3 → entangled_cli-2.0.5}/entangled/config/templates.py +0 -0
- {entangled_cli-2.0.3 → entangled_cli-2.0.5}/entangled/config/version.py +0 -0
- {entangled_cli-2.0.3 → entangled_cli-2.0.5}/entangled/construct.py +0 -0
- {entangled_cli-2.0.3 → entangled_cli-2.0.5}/entangled/errors/__init__.py +0 -0
- {entangled_cli-2.0.3 → entangled_cli-2.0.5}/entangled/errors/internal.py +0 -0
- {entangled_cli-2.0.3 → entangled_cli-2.0.5}/entangled/errors/user.py +0 -0
- {entangled_cli-2.0.3 → entangled_cli-2.0.5}/entangled/filedb.py +0 -0
- {entangled_cli-2.0.3 → entangled_cli-2.0.5}/entangled/hooks/__init__.py +0 -0
- {entangled_cli-2.0.3 → entangled_cli-2.0.5}/entangled/hooks/base.py +0 -0
- {entangled_cli-2.0.3 → entangled_cli-2.0.5}/entangled/hooks/build.py +0 -0
- {entangled_cli-2.0.3 → entangled_cli-2.0.5}/entangled/hooks/quarto_attributes.py +0 -0
- {entangled_cli-2.0.3 → entangled_cli-2.0.5}/entangled/hooks/task.py +0 -0
- {entangled_cli-2.0.3 → entangled_cli-2.0.5}/entangled/logging.py +0 -0
- {entangled_cli-2.0.3 → entangled_cli-2.0.5}/entangled/main.py +0 -0
- {entangled_cli-2.0.3 → entangled_cli-2.0.5}/entangled/parsing.py +0 -0
- {entangled_cli-2.0.3 → entangled_cli-2.0.5}/entangled/properties.py +0 -0
- {entangled_cli-2.0.3 → entangled_cli-2.0.5}/entangled/py.typed +0 -0
- {entangled_cli-2.0.3 → entangled_cli-2.0.5}/entangled/text_location.py +0 -0
- {entangled_cli-2.0.3 → entangled_cli-2.0.5}/entangled/transaction.py +0 -0
- {entangled_cli-2.0.3 → entangled_cli-2.0.5}/entangled/utility.py +0 -0
- {entangled_cli-2.0.3 → entangled_cli-2.0.5}/entangled/version.py +0 -0
|
@@ -57,11 +57,17 @@ class ReferenceMap:
|
|
|
57
57
|
default_factory=lambda: defaultdict(list)
|
|
58
58
|
)
|
|
59
59
|
targets: set[str] = field(default_factory=set)
|
|
60
|
+
alias: dict[str, str] = field(default_factory=dict)
|
|
60
61
|
|
|
61
62
|
def names(self) -> Iterable[str]:
|
|
62
63
|
return self.index.keys()
|
|
63
64
|
|
|
64
65
|
def by_name(self, n: str) -> Iterable[CodeBlock]:
|
|
66
|
+
if n not in self.index and n not in self.alias:
|
|
67
|
+
raise AttributeError(name=n, obj=self)
|
|
68
|
+
if n not in self.index:
|
|
69
|
+
return self.by_name(self.alias[n])
|
|
70
|
+
|
|
65
71
|
return (self.map[r] for r in self.index[n])
|
|
66
72
|
|
|
67
73
|
def new_id(self, filename: str, name: str) -> ReferenceId:
|
|
@@ -130,6 +130,12 @@ class MarkdownReader(mawk.RuleSet):
|
|
|
130
130
|
self.reference_map[ref] = code
|
|
131
131
|
if target_file is not None:
|
|
132
132
|
self.reference_map.targets.add(target_file)
|
|
133
|
+
|
|
134
|
+
# when both target_file and block_id are given,
|
|
135
|
+
# make an alias
|
|
136
|
+
if target_file is not None and block_id is not None:
|
|
137
|
+
self.reference_map.alias[target_file] = block_id
|
|
138
|
+
|
|
133
139
|
self.content.append(ref)
|
|
134
140
|
self.current_content = []
|
|
135
141
|
|
|
@@ -5,6 +5,17 @@ from itertools import chain
|
|
|
5
5
|
from pathlib import Path
|
|
6
6
|
|
|
7
7
|
|
|
8
|
+
def safe_glob(pattern):
|
|
9
|
+
"""The `glob` method of `Path` raises a FileNotFound error when
|
|
10
|
+
there are rapid changes in the filesystem.
|
|
11
|
+
|
|
12
|
+
`safe_glob` catches this error and returns an empty list instead."""
|
|
13
|
+
try:
|
|
14
|
+
return Path().glob(pattern)
|
|
15
|
+
except FileNotFoundError:
|
|
16
|
+
return []
|
|
17
|
+
|
|
18
|
+
|
|
8
19
|
def find_watch_dirs():
|
|
9
20
|
"""List all directories that contain files that need watching."""
|
|
10
21
|
input_file_list = list_input_files()
|
|
@@ -16,9 +27,9 @@ def find_watch_dirs():
|
|
|
16
27
|
|
|
17
28
|
def list_input_files():
|
|
18
29
|
"""List all input files."""
|
|
19
|
-
include_file_list = chain.from_iterable(map(
|
|
30
|
+
include_file_list = chain.from_iterable(map(safe_glob, config.watch_list))
|
|
20
31
|
exclude_file_list = list(
|
|
21
|
-
chain.from_iterable(map(
|
|
32
|
+
chain.from_iterable(map(safe_glob, config.ignore_list))
|
|
22
33
|
)
|
|
23
34
|
return [path for path in include_file_list if not path in exclude_file_list]
|
|
24
35
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|