specitems 1.6.0__tar.gz → 1.6.2__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 (25) hide show
  1. {specitems-1.6.0 → specitems-1.6.2}/PKG-INFO +1 -1
  2. {specitems-1.6.0 → specitems-1.6.2}/pyproject.toml +1 -1
  3. {specitems-1.6.0 → specitems-1.6.2}/src/specitems/itemmapper.py +12 -7
  4. {specitems-1.6.0 → specitems-1.6.2}/src/specitems/items.py +6 -2
  5. {specitems-1.6.0 → specitems-1.6.2}/README.md +0 -0
  6. {specitems-1.6.0 → specitems-1.6.2}/src/specitems/__init__.py +0 -0
  7. {specitems-1.6.0 → specitems-1.6.2}/src/specitems/cite.py +0 -0
  8. {specitems-1.6.0 → specitems-1.6.2}/src/specitems/clihash.py +0 -0
  9. {specitems-1.6.0 → specitems-1.6.2}/src/specitems/clipickle.py +0 -0
  10. {specitems-1.6.0 → specitems-1.6.2}/src/specitems/clispecdoc.py +0 -0
  11. {specitems-1.6.0 → specitems-1.6.2}/src/specitems/cliutil.py +0 -0
  12. {specitems-1.6.0 → specitems-1.6.2}/src/specitems/cliyamlquery.py +0 -0
  13. {specitems-1.6.0 → specitems-1.6.2}/src/specitems/content.py +0 -0
  14. {specitems-1.6.0 → specitems-1.6.2}/src/specitems/contentcommonmark.py +0 -0
  15. {specitems-1.6.0 → specitems-1.6.2}/src/specitems/contentmarkdown.py +0 -0
  16. {specitems-1.6.0 → specitems-1.6.2}/src/specitems/contentsphinx.py +0 -0
  17. {specitems-1.6.0 → specitems-1.6.2}/src/specitems/contenttext.py +0 -0
  18. {specitems-1.6.0 → specitems-1.6.2}/src/specitems/getvaluesubprocess.py +0 -0
  19. {specitems-1.6.0 → specitems-1.6.2}/src/specitems/glossary.py +0 -0
  20. {specitems-1.6.0 → specitems-1.6.2}/src/specitems/hashutil.py +0 -0
  21. {specitems-1.6.0 → specitems-1.6.2}/src/specitems/py.typed +0 -0
  22. {specitems-1.6.0 → specitems-1.6.2}/src/specitems/spec.pickle +0 -0
  23. {specitems-1.6.0 → specitems-1.6.2}/src/specitems/specdoc.py +0 -0
  24. {specitems-1.6.0 → specitems-1.6.2}/src/specitems/specverify.py +0 -0
  25. {specitems-1.6.0 → specitems-1.6.2}/src/specitems/subprocessaction.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: specitems
3
- Version: 1.6.0
3
+ Version: 1.6.2
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.6.0"
7
+ version = "1.6.2"
8
8
  description = "Provides interfaces to work with specification items."
9
9
  authors = [
10
10
  {name = "The specitems Authors", email = "specthings@embedded-brains.de"}
@@ -39,8 +39,8 @@ ItemGetValueMap = dict[str, tuple[ItemGetValue, Any]]
39
39
 
40
40
  _VAR_NAME = "(?:[a-zA-Z0-9._/-]+|\\*):[\\[\\]a-zA-Z0-9._/-]+(?::[^${}]*)?"
41
41
  _VAR_SINGLE = re.compile(f"^[$@]\\{{{_VAR_NAME}\\}}$")
42
- _VAR_TOKENS = re.compile(r"(?:\$\$(?=\{|\$\{))|(?:@@(?=\{|@\{))|"
43
- f"[$@]\\{{{_VAR_NAME}\\}}|(?:[$@]\\{{)")
42
+ _VAR_TOKENS = re.compile(f"(?:(\\$+|@+)\\{{{_VAR_NAME}\\}})|"
43
+ r"(?:(\$+|@+)\{)")
44
44
 
45
45
 
46
46
  class _ItemMapperError(Exception):
@@ -65,16 +65,21 @@ class _ItemMapperContext:
65
65
 
66
66
  def replace(self, mobj: re.Match) -> str:
67
67
  """ Replace the match. """
68
+ designator = mobj.group(1)
68
69
  token = mobj.group(0)
69
- if len(token) > 2:
70
+ if designator:
71
+ brace = len(designator)
72
+ if brace & 1 == 0:
73
+ return token[brace // 2:]
70
74
  try:
71
- return str(
72
- self._mapper.map(token[2:-1], self._item, self._prefix)[2])
75
+ value = self._mapper.map(token[brace + 1:-1], self._item,
76
+ self._prefix)[2]
73
77
  except Exception as err:
74
78
  raise _ItemMapperError(mobj.start(), mobj.end()) from err
75
- if token[1] == "{":
79
+ return f"{token[:brace // 2]}{value}"
80
+ if len(token) & 1 == 0:
76
81
  raise _ItemMapperError(mobj.start(), mobj.end())
77
- return token[0]
82
+ return token[len(token) // 2:]
78
83
 
79
84
 
80
85
  class _GetValueDictionary(dict):
@@ -1206,13 +1206,17 @@ class ItemCache(dict):
1206
1206
 
1207
1207
  The item is not removed from the persistent cache storage.
1208
1208
  """
1209
- item = self[uid]
1209
+ item = self.pop(uid)
1210
+ for selection in self._selection_stack:
1211
+ selection.pop(uid, None)
1212
+ for view in self._view_stack:
1213
+ view.pop(item, None)
1210
1214
  item.clear_links()
1211
1215
  try:
1212
1216
  self.type_provider.items_by_type[item.type].remove(item)
1213
1217
  except (KeyError, ValueError):
1214
1218
  pass
1215
- del self[uid]
1219
+ del item
1216
1220
 
1217
1221
  def initialize_links(self, uids: Iterable[str]) -> None:
1218
1222
  """ Initialize the links to parents and children. """
File without changes