specitems 1.7.7__tar.gz → 1.7.8__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.
Files changed (33) hide show
  1. {specitems-1.7.7 → specitems-1.7.8}/PKG-INFO +1 -1
  2. {specitems-1.7.7 → specitems-1.7.8}/pyproject.toml +1 -1
  3. {specitems-1.7.7 → specitems-1.7.8}/src/specitems/itemmapper.py +28 -4
  4. {specitems-1.7.7 → specitems-1.7.8}/README.md +0 -0
  5. {specitems-1.7.7 → specitems-1.7.8}/src/specitems/__init__.py +0 -0
  6. {specitems-1.7.7 → specitems-1.7.8}/src/specitems/cite.py +0 -0
  7. {specitems-1.7.7 → specitems-1.7.8}/src/specitems/clangformat.py +0 -0
  8. {specitems-1.7.7 → specitems-1.7.8}/src/specitems/clihash.py +0 -0
  9. {specitems-1.7.7 → specitems-1.7.8}/src/specitems/clipickle.py +0 -0
  10. {specitems-1.7.7 → specitems-1.7.8}/src/specitems/clispecdoc.py +0 -0
  11. {specitems-1.7.7 → specitems-1.7.8}/src/specitems/clitypeview.py +0 -0
  12. {specitems-1.7.7 → specitems-1.7.8}/src/specitems/cliutil.py +0 -0
  13. {specitems-1.7.7 → specitems-1.7.8}/src/specitems/cliverify.py +0 -0
  14. {specitems-1.7.7 → specitems-1.7.8}/src/specitems/cliyamlquery.py +0 -0
  15. {specitems-1.7.7 → specitems-1.7.8}/src/specitems/content.py +0 -0
  16. {specitems-1.7.7 → specitems-1.7.8}/src/specitems/contentcommonmark.py +0 -0
  17. {specitems-1.7.7 → specitems-1.7.8}/src/specitems/contentmarkdown.py +0 -0
  18. {specitems-1.7.7 → specitems-1.7.8}/src/specitems/contentsphinx.py +0 -0
  19. {specitems-1.7.7 → specitems-1.7.8}/src/specitems/contenttext.py +0 -0
  20. {specitems-1.7.7 → specitems-1.7.8}/src/specitems/copyrights.py +0 -0
  21. {specitems-1.7.7 → specitems-1.7.8}/src/specitems/getvaluesubprocess.py +0 -0
  22. {specitems-1.7.7 → specitems-1.7.8}/src/specitems/glossary.py +0 -0
  23. {specitems-1.7.7 → specitems-1.7.8}/src/specitems/hashutil.py +0 -0
  24. {specitems-1.7.7 → specitems-1.7.8}/src/specitems/items.py +0 -0
  25. {specitems-1.7.7 → specitems-1.7.8}/src/specitems/licenseinfo.py +0 -0
  26. {specitems-1.7.7 → specitems-1.7.8}/src/specitems/py.typed +0 -0
  27. {specitems-1.7.7 → specitems-1.7.8}/src/specitems/spdx.py +0 -0
  28. {specitems-1.7.7 → specitems-1.7.8}/src/specitems/spec.pickle +0 -0
  29. {specitems-1.7.7 → specitems-1.7.8}/src/specitems/specconfig.py +0 -0
  30. {specitems-1.7.7 → specitems-1.7.8}/src/specitems/specdoc.py +0 -0
  31. {specitems-1.7.7 → specitems-1.7.8}/src/specitems/specformatter.py +0 -0
  32. {specitems-1.7.7 → specitems-1.7.8}/src/specitems/specverify.py +0 -0
  33. {specitems-1.7.7 → specitems-1.7.8}/src/specitems/subprocessaction.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: specitems
3
- Version: 1.7.7
3
+ Version: 1.7.8
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
@@ -4,7 +4,7 @@
4
4
 
5
5
  [project]
6
6
  name = "specitems"
7
- version = "1.7.7"
7
+ version = "1.7.8"
8
8
  description = "Provides interfaces to work with specification items."
9
9
  authors = [
10
10
  {name = "The specitems Authors", email = "specthings@embedded-brains.de"}
@@ -257,6 +257,17 @@ class _ItemMapperContext:
257
257
  return token[len(token) // 2:]
258
258
 
259
259
 
260
+ class _ReferenceGetValue:
261
+ """ Gets a value which refers to the item and takes no content of it. """
262
+
263
+ # pylint: disable=too-few-public-methods
264
+ def __init__(self, get_value: ItemGetValue) -> None:
265
+ self._get_value = get_value
266
+
267
+ def __call__(self, ctx: "ItemGetValueContext") -> Any:
268
+ return self._get_value(ctx)
269
+
270
+
260
271
  class _GetValueDictionary(dict):
261
272
 
262
273
  def __init__(self, get_value: ItemGetValue) -> None:
@@ -548,11 +559,22 @@ class ItemMapper(abc.ABC):
548
559
  assert key not in get_value_map
549
560
  get_value_map[key] = (get_value, {})
550
561
 
551
- def add_get_value(self, type_path_key: str,
552
- get_value: ItemGetValue) -> None:
562
+ def add_get_value(self,
563
+ type_path_key: str,
564
+ get_value: ItemGetValue,
565
+ reference: bool = False) -> None:
553
566
  """
554
567
  Associate the get value method with the type/key path.
555
- """
568
+
569
+ Args:
570
+ type_path_key: The type path and the key path of the value.
571
+ get_value: The method which gets the value.
572
+ reference: If true, the value refers to the item and takes no
573
+ content of it. A mapped value of a reference does not
574
+ register the item as a part of the work.
575
+ """
576
+ if reference:
577
+ get_value = _ReferenceGetValue(get_value)
556
578
  self._add_get_value_map(type_path_key, (get_value, {}))
557
579
 
558
580
  def add_get_value_dictionary(self, type_path_key: str,
@@ -625,6 +647,7 @@ class ItemMapper(abc.ABC):
625
647
  """
626
648
  ctx = ItemGetValueContext(item, normalized_key_path.strip("/"), args,
627
649
  item.data, self, self.get_value_map(item))
650
+ get_value: ItemGetValue = self.get_value_default
628
651
  while ctx.remaining_path:
629
652
  key_end = ctx.remaining_path.find("/")
630
653
  if key_end >= 0:
@@ -644,7 +667,8 @@ class ItemMapper(abc.ABC):
644
667
  get_value, ctx.get_value_map = ctx.get_value_map.get(
645
668
  parts[0], (self.get_value_default, {}))
646
669
  ctx.value = get_value(ctx)
647
- self.register_part(item)
670
+ if not isinstance(get_value, _ReferenceGetValue):
671
+ self.register_part(item)
648
672
  return ctx
649
673
 
650
674
  def map(self,
File without changes