specitems 1.2.2__tar.gz → 1.3.0__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.
- {specitems-1.2.2 → specitems-1.3.0}/PKG-INFO +1 -1
- {specitems-1.2.2 → specitems-1.3.0}/pyproject.toml +1 -1
- {specitems-1.2.2 → specitems-1.3.0}/src/specitems/itemmapper.py +37 -0
- {specitems-1.2.2 → specitems-1.3.0}/src/specitems/items.py +13 -13
- {specitems-1.2.2 → specitems-1.3.0}/README.md +0 -0
- {specitems-1.2.2 → specitems-1.3.0}/src/specitems/__init__.py +0 -0
- {specitems-1.2.2 → specitems-1.3.0}/src/specitems/cite.py +0 -0
- {specitems-1.2.2 → specitems-1.3.0}/src/specitems/clihash.py +0 -0
- {specitems-1.2.2 → specitems-1.3.0}/src/specitems/clipickle.py +0 -0
- {specitems-1.2.2 → specitems-1.3.0}/src/specitems/clispecdoc.py +0 -0
- {specitems-1.2.2 → specitems-1.3.0}/src/specitems/cliutil.py +0 -0
- {specitems-1.2.2 → specitems-1.3.0}/src/specitems/cliyamlquery.py +0 -0
- {specitems-1.2.2 → specitems-1.3.0}/src/specitems/content.py +0 -0
- {specitems-1.2.2 → specitems-1.3.0}/src/specitems/contentmarkdown.py +0 -0
- {specitems-1.2.2 → specitems-1.3.0}/src/specitems/contentsphinx.py +0 -0
- {specitems-1.2.2 → specitems-1.3.0}/src/specitems/contenttext.py +0 -0
- {specitems-1.2.2 → specitems-1.3.0}/src/specitems/getvaluesubprocess.py +0 -0
- {specitems-1.2.2 → specitems-1.3.0}/src/specitems/glossary.py +0 -0
- {specitems-1.2.2 → specitems-1.3.0}/src/specitems/hashutil.py +0 -0
- {specitems-1.2.2 → specitems-1.3.0}/src/specitems/py.typed +0 -0
- {specitems-1.2.2 → specitems-1.3.0}/src/specitems/spec.pickle +0 -0
- {specitems-1.2.2 → specitems-1.3.0}/src/specitems/specdoc.py +0 -0
- {specitems-1.2.2 → specitems-1.3.0}/src/specitems/specverify.py +0 -0
- {specitems-1.2.2 → specitems-1.3.0}/src/specitems/subprocessaction.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: specitems
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.3.0
|
|
4
4
|
Summary: Provides interfaces to work with specification items.
|
|
5
5
|
Keywords: certification,documentation,markdown,qualification,requirements-management,traceability
|
|
6
6
|
Author: The specitems Authors
|
|
@@ -510,6 +510,43 @@ class ItemMapper(abc.ABC):
|
|
|
510
510
|
return new_dict
|
|
511
511
|
return data
|
|
512
512
|
|
|
513
|
+
def substitute_flexible_list(self,
|
|
514
|
+
flexible_list: list,
|
|
515
|
+
is_enabled_method: Callable[[Any], bool],
|
|
516
|
+
item: Optional[Item] = None,
|
|
517
|
+
prefix: str = "") -> list[str]:
|
|
518
|
+
"""
|
|
519
|
+
Create a new list containing the substituted elements of the flexible
|
|
520
|
+
list.
|
|
521
|
+
|
|
522
|
+
Where an element is a dictionary, when its enabled-by expression
|
|
523
|
+
evaluates to true, the data substitution of the element value is added
|
|
524
|
+
to the new list.
|
|
525
|
+
"""
|
|
526
|
+
new_list: list[str] = []
|
|
527
|
+
for index, element in enumerate(flexible_list):
|
|
528
|
+
prefix_2 = f"{prefix}[{index}]"
|
|
529
|
+
if isinstance(element, dict):
|
|
530
|
+
if not is_enabled_method(
|
|
531
|
+
self.substitute_data(element["enabled-by"], item,
|
|
532
|
+
prefix_2)):
|
|
533
|
+
continue
|
|
534
|
+
element = self.substitute_data(element["value"], item,
|
|
535
|
+
prefix_2)
|
|
536
|
+
elif isinstance(element, str):
|
|
537
|
+
if _SINGLE_SUBSTITUTION.search(element):
|
|
538
|
+
element = self.map(element[2:-1], item, prefix_2)[2]
|
|
539
|
+
else:
|
|
540
|
+
element = self.substitute(element, item, prefix_2)
|
|
541
|
+
else:
|
|
542
|
+
element = self.substitute_data(element, item, prefix_2)
|
|
543
|
+
if isinstance(element, list):
|
|
544
|
+
new_list.extend(element)
|
|
545
|
+
else:
|
|
546
|
+
assert isinstance(element, str)
|
|
547
|
+
new_list.append(element)
|
|
548
|
+
return new_list
|
|
549
|
+
|
|
513
550
|
def add_value_provider(self, provider: "ItemValueProvider") -> None:
|
|
514
551
|
""" Add the value provider to the mapper. """
|
|
515
552
|
self._value_providers.append(provider)
|
|
@@ -157,23 +157,23 @@ def is_enabled(enabled_set: EnabledSet, enabled_by: Any) -> bool:
|
|
|
157
157
|
return enabled_by in enabled_set
|
|
158
158
|
|
|
159
159
|
|
|
160
|
-
def _ops_is_enabled_op_and(
|
|
161
|
-
|
|
160
|
+
def _ops_is_enabled_op_and(ops: dict, enabled_set: EnabledSet,
|
|
161
|
+
enabled_by: Any) -> bool:
|
|
162
162
|
for next_enabled_by in enabled_by:
|
|
163
|
-
if not is_enabled_with_ops(enabled_set, next_enabled_by
|
|
163
|
+
if not is_enabled_with_ops(ops, enabled_set, next_enabled_by):
|
|
164
164
|
return False
|
|
165
165
|
return True
|
|
166
166
|
|
|
167
167
|
|
|
168
|
-
def _ops_is_enabled_op_not(
|
|
169
|
-
|
|
170
|
-
return not is_enabled_with_ops(enabled_set, enabled_by
|
|
168
|
+
def _ops_is_enabled_op_not(ops: dict, enabled_set: EnabledSet,
|
|
169
|
+
enabled_by: Any) -> bool:
|
|
170
|
+
return not is_enabled_with_ops(ops, enabled_set, enabled_by)
|
|
171
171
|
|
|
172
172
|
|
|
173
|
-
def _ops_is_enabled_op_or(
|
|
174
|
-
|
|
173
|
+
def _ops_is_enabled_op_or(ops: dict, enabled_set: EnabledSet,
|
|
174
|
+
enabled_by: Any) -> bool:
|
|
175
175
|
for next_enabled_by in enabled_by:
|
|
176
|
-
if is_enabled_with_ops(enabled_set, next_enabled_by
|
|
176
|
+
if is_enabled_with_ops(ops, enabled_set, next_enabled_by):
|
|
177
177
|
return True
|
|
178
178
|
return False
|
|
179
179
|
|
|
@@ -185,8 +185,8 @@ IS_ENABLED_OPS = {
|
|
|
185
185
|
}
|
|
186
186
|
|
|
187
187
|
|
|
188
|
-
def is_enabled_with_ops(
|
|
189
|
-
|
|
188
|
+
def is_enabled_with_ops(ops: dict, enabled_set: EnabledSet,
|
|
189
|
+
enabled_by: Any) -> bool:
|
|
190
190
|
"""
|
|
191
191
|
Evaluate the enabled-by expression using the enabled set with custom
|
|
192
192
|
operations.
|
|
@@ -194,10 +194,10 @@ def is_enabled_with_ops(enabled_set: EnabledSet, enabled_by: Any,
|
|
|
194
194
|
if isinstance(enabled_by, bool):
|
|
195
195
|
return enabled_by
|
|
196
196
|
if isinstance(enabled_by, list):
|
|
197
|
-
return _ops_is_enabled_op_or(enabled_set, enabled_by
|
|
197
|
+
return _ops_is_enabled_op_or(ops, enabled_set, enabled_by)
|
|
198
198
|
if isinstance(enabled_by, dict):
|
|
199
199
|
key, value = next(iter(enabled_by.items()))
|
|
200
|
-
return ops[key](enabled_set, value
|
|
200
|
+
return ops[key](ops, enabled_set, value)
|
|
201
201
|
return enabled_by in enabled_set
|
|
202
202
|
|
|
203
203
|
|
|
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
|