Skip to content

Commit 6da7563

Browse files
committed
docs
Signed-off-by: Jan Kowalleck <jan.kowalleck@gmail.com>
1 parent 6223670 commit 6da7563

2 files changed

Lines changed: 16 additions & 7 deletions

File tree

cyclonedx/contrib/bom/utils.py

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@
3131

3232

3333
class BomDependencyGraphFlatMerger:
34+
"""
35+
36+
"""
3437

3538
def __init__(self, bom: 'Bom') -> None:
3639
self._bom = bom
@@ -43,17 +46,24 @@ def __enter__(self) -> None:
4346
def __exit__(self, exc_type: Any, exc_val: Any, exc_tb: Any) -> None:
4447
self.reset()
4548

46-
def reset(self) -> None:
47-
# Do NOT use the setter - this would create overhead and most importantly,
48-
# and this could cause deduplication of an existing malformed set.
49-
# Just access the internal field directly!
50-
self._bom._dependencies = self._deps
51-
5249
def flatten_merge(self) -> None:
50+
"""
51+
Flatten and merge all of Bom's dependencies.
52+
"""
5353
self._bom.dependencies = self._merge_deps(chain.from_iterable(
5454
self._flatten_dep(dep) for dep in self._deps
5555
))
5656

57+
def reset(self) -> None:
58+
"""
59+
Reset Bom's dependencies to the initial state.
60+
"""
61+
# Do NOT use the setter - this would create overhead,
62+
# and - most importantly - this could cause deduplication of an existing malformed set.
63+
# Just access the internal field directly!
64+
self._bom._dependencies = self._deps
65+
66+
5767
@staticmethod
5868
def _merge_deps(deps: Iterable[Dependency]) -> Iterable[Dependency]:
5969
uniques: dict[BomRef, Dependency] = {}

cyclonedx/output/json.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ def generate(self, force_regeneration: bool = False) -> None:
7171
_view = SCHEMA_VERSIONS.get(self.schema_version_enum)
7272
bom = self.get_bom()
7373
bom.validate()
74-
# utilize contrib.dependency.flatten() somewhere here
7574
with BomRefDiscriminator.from_bom(bom):
7675
with BomDependencyGraphFlatMerger(bom):
7776
bom_json: dict[str, Any] = json_loads(

0 commit comments

Comments
 (0)