Skip to content

Commit 6477a03

Browse files
committed
docs
Signed-off-by: Jan Kowalleck <jan.kowalleck@gmail.com>
1 parent 234f0de commit 6477a03

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

cyclonedx/contrib/bom/utils.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@
3030

3131

3232
class BomRefDiscriminator:
33+
"""
34+
Utility to give BomRefs unique values.
35+
"""
3336

3437
def __init__(self, bomrefs: Iterable['BomRef'], prefix: str = 'BomRef') -> None:
3538
# do not use dict/set here, different BomRefs with same value have same hash and would shadow each other
@@ -43,6 +46,10 @@ def __exit__(self, exc_type: Any, exc_val: Any, exc_tb: Any) -> None:
4346
self.reset()
4447

4548
def discriminate(self) -> None:
49+
"""
50+
Check BomRefs' values for uniqueness.
51+
Duplications will be assigned a unique value.
52+
"""
4653
known_values = []
4754
for bomref, _ in self._bomrefs:
4855
value = bomref.value
@@ -52,6 +59,9 @@ def discriminate(self) -> None:
5259
known_values.append(value)
5360

5461
def reset(self) -> None:
62+
"""
63+
Reset BomRef's values to the initial state.
64+
"""
5565
for bomref, original_value in self._bomrefs:
5666
bomref.value = original_value
5767

0 commit comments

Comments
 (0)