Skip to content

Commit 470e206

Browse files
authored
docs: added docstring to swid_parser.py (#3716)
* closes #3712
1 parent 9e386cd commit 470e206

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

cve_bin_tool/sbom_manager/swid_parser.py

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

1010

1111
class SWIDParser:
12+
"""
13+
Class responsible for parsing SWID (Software Identification Tags) XML BOM (Bill of Materials) files.
14+
"""
15+
1216
def __init__(self, validate: bool = True):
1317
self.validate = validate
1418

@@ -35,6 +39,13 @@ def parse(self, sbom_file: str) -> list[list[str]]:
3539
return modules
3640

3741
def extract(self, swid: str) -> list[str]:
42+
"""
43+
Extracts the product name and version from a SWID entry.
44+
args:
45+
swid: SWID entry
46+
returns:
47+
list containing product name and version
48+
"""
3849
# Return parsed swid entry as [product, version] list item
3950
# Format of swid is "URI: <vendor>-<product>-<version>"
4051
item = swid[swid.find(":") + 1 :].split("-")

0 commit comments

Comments
 (0)