specitems 1.7.1__tar.gz → 1.7.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 (33) hide show
  1. {specitems-1.7.1 → specitems-1.7.2}/PKG-INFO +1 -1
  2. {specitems-1.7.1 → specitems-1.7.2}/pyproject.toml +1 -1
  3. {specitems-1.7.1 → specitems-1.7.2}/src/specitems/__init__.py +5 -3
  4. {specitems-1.7.1 → specitems-1.7.2}/src/specitems/spec.pickle +0 -0
  5. {specitems-1.7.1 → specitems-1.7.2}/src/specitems/specconfig.py +38 -2
  6. {specitems-1.7.1 → specitems-1.7.2}/README.md +0 -0
  7. {specitems-1.7.1 → specitems-1.7.2}/src/specitems/cite.py +0 -0
  8. {specitems-1.7.1 → specitems-1.7.2}/src/specitems/clangformat.py +0 -0
  9. {specitems-1.7.1 → specitems-1.7.2}/src/specitems/clihash.py +0 -0
  10. {specitems-1.7.1 → specitems-1.7.2}/src/specitems/clipickle.py +0 -0
  11. {specitems-1.7.1 → specitems-1.7.2}/src/specitems/clispecdoc.py +0 -0
  12. {specitems-1.7.1 → specitems-1.7.2}/src/specitems/clitypeview.py +0 -0
  13. {specitems-1.7.1 → specitems-1.7.2}/src/specitems/cliutil.py +0 -0
  14. {specitems-1.7.1 → specitems-1.7.2}/src/specitems/cliverify.py +0 -0
  15. {specitems-1.7.1 → specitems-1.7.2}/src/specitems/cliyamlquery.py +0 -0
  16. {specitems-1.7.1 → specitems-1.7.2}/src/specitems/content.py +0 -0
  17. {specitems-1.7.1 → specitems-1.7.2}/src/specitems/contentcommonmark.py +0 -0
  18. {specitems-1.7.1 → specitems-1.7.2}/src/specitems/contentmarkdown.py +0 -0
  19. {specitems-1.7.1 → specitems-1.7.2}/src/specitems/contentsphinx.py +0 -0
  20. {specitems-1.7.1 → specitems-1.7.2}/src/specitems/contenttext.py +0 -0
  21. {specitems-1.7.1 → specitems-1.7.2}/src/specitems/copyrights.py +0 -0
  22. {specitems-1.7.1 → specitems-1.7.2}/src/specitems/getvaluesubprocess.py +0 -0
  23. {specitems-1.7.1 → specitems-1.7.2}/src/specitems/glossary.py +0 -0
  24. {specitems-1.7.1 → specitems-1.7.2}/src/specitems/hashutil.py +0 -0
  25. {specitems-1.7.1 → specitems-1.7.2}/src/specitems/itemmapper.py +0 -0
  26. {specitems-1.7.1 → specitems-1.7.2}/src/specitems/items.py +0 -0
  27. {specitems-1.7.1 → specitems-1.7.2}/src/specitems/licenseinfo.py +0 -0
  28. {specitems-1.7.1 → specitems-1.7.2}/src/specitems/py.typed +0 -0
  29. {specitems-1.7.1 → specitems-1.7.2}/src/specitems/spdx.py +0 -0
  30. {specitems-1.7.1 → specitems-1.7.2}/src/specitems/specdoc.py +0 -0
  31. {specitems-1.7.1 → specitems-1.7.2}/src/specitems/specformatter.py +0 -0
  32. {specitems-1.7.1 → specitems-1.7.2}/src/specitems/specverify.py +0 -0
  33. {specitems-1.7.1 → specitems-1.7.2}/src/specitems/subprocessaction.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: specitems
3
- Version: 1.7.1
3
+ Version: 1.7.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.7.1"
7
+ version = "1.7.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"}
@@ -145,9 +145,10 @@ from .itemmapper import (
145
145
  from .licenseinfo import (LicenseAggregate, LicenseEntry, LicenseProvider)
146
146
  from .spdx import (get_license_list_version, parse_license_expression,
147
147
  parse_license_identifier, permits)
148
- from .specconfig import (CONFIG_FILE, CONFIG_UID, check_license_items,
149
- create_content_context, create_type_provider,
150
- find_config_file, load_config_item, yield_tasks)
148
+ from .specconfig import (CONFIG_FILE, CONFIG_UID, add_inline_items,
149
+ check_license_items, create_content_context,
150
+ create_type_provider, find_config_file,
151
+ load_config_item, yield_tasks)
151
152
  from .specdoc import (SpecDocumentConfig, add_specification_documentation,
152
153
  generate_specification_documentation)
153
154
  from .specformatter import SpecYAMLFormatter
@@ -218,6 +219,7 @@ __all__ = [
218
219
  "SubstitutionError",
219
220
  "TextContent",
220
221
  "TextMapper",
222
+ "add_inline_items",
221
223
  "add_license_arguments",
222
224
  "add_specification_documentation",
223
225
  "atomic_dump_to_file",
@@ -24,6 +24,7 @@
24
24
  # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25
25
  # POSSIBILITY OF SUCH DAMAGE.
26
26
 
27
+ import copy
27
28
  import logging
28
29
  from pathlib import Path
29
30
  from typing import Any, Iterator, Optional
@@ -31,8 +32,8 @@ from typing import Any, Iterator, Optional
31
32
  from .cliutil import load_config
32
33
  from .content import ContentContext
33
34
  from .licenseinfo import LicenseAggregate, LicenseProvider
34
- from .items import (EmptyItemCache, Item, ItemDataByUID, ItemTypeProvider,
35
- SpecTypeProvider)
35
+ from .items import (EmptyItemCache, Item, ItemCache, ItemDataByUID,
36
+ ItemTypeProvider, SpecTypeProvider)
36
37
  from .specverify import SpecVerifier
37
38
 
38
39
  #: The name of the configuration file of a tree.
@@ -204,6 +205,41 @@ def check_license_items(config: Item, provider: LicenseProvider) -> None:
204
205
  raise ValueError("\n".join(errors))
205
206
 
206
207
 
208
+ def add_inline_items(config: Item, item_cache: ItemCache) -> None:
209
+ """
210
+ Add the inline items of the configuration to the item cache.
211
+
212
+ An inline item is part of the configuration file. It takes the license
213
+ and the copyrights of the configuration item, unless it states its own.
214
+ An inline item without links gets an empty list of links. An inline item
215
+ without an enabled-by attribute is enabled. An inline item without a type
216
+ has the inline type. An inline item may link to another inline item.
217
+
218
+ Args:
219
+ config: The configuration item.
220
+ item_cache: The item cache of the tree.
221
+
222
+ Raises:
223
+ ValueError: An inline item exists already in the item cache or in the
224
+ configuration.
225
+ """
226
+ data_by_uid: ItemDataByUID = {}
227
+ for entry in config.get("inline-items", []):
228
+ uid = entry["uid"]
229
+ if (uid in item_cache or uid in item_cache.proxies
230
+ or uid in data_by_uid):
231
+ raise ValueError(f"the inline item {uid} exists already")
232
+ data = copy.deepcopy(entry["data"])
233
+ for key, value in (("SPDX-License-Identifier",
234
+ config["SPDX-License-Identifier"]),
235
+ ("copyrights", config["copyrights"]),
236
+ ("enabled-by", True), ("links", []), ("type",
237
+ "inline")):
238
+ data.setdefault(key, copy.deepcopy(value))
239
+ data_by_uid[uid] = data
240
+ item_cache.add_items(data_by_uid)
241
+
242
+
207
243
  def yield_tasks(config: Item, task_type: str) -> Iterator[dict]:
208
244
  """
209
245
  Yield the tasks of the type in the order of the configuration.
File without changes