Skip to content

Commit bfd6a45

Browse files
committed
Update comments
Signed-off-by: Jono Yang <jyang@nexb.com>
1 parent a010aea commit bfd6a45

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

src/purl_validator/__init__.py

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

3131

3232
def create_purl_map_entry(purl):
33+
"""
34+
Given a `purl` that is a PackageURL proper or a string representation of
35+
one, return a bytestring containing the type, namespace (if available), and
36+
name of the package from `purl`.
37+
"""
3338
if not isinstance(purl, (PackageURL, str)):
3439
raise ValueError(f"invalid `purl`: {purl}")
3540

@@ -50,6 +55,12 @@ def create_purl_map_entry(purl):
5055

5156

5257
def create_purl_map(purls):
58+
"""
59+
Given an iterable of `purls`, that can be either PackageURLs proper or
60+
strings representing them, return a Ducer map that contains strings created
61+
from the type, namespace (if available), and name of the packages from
62+
`purls`.
63+
"""
5364
# purl map entries must be unique, sorted, and converted to bytes before going into the Map
5465
purl_map_entries = set(create_purl_map_entry(purl) for purl in purls)
5566
prepared_purl_map_entries = sorted((purl_map_entry, 1) for purl_map_entry in purl_map_entries)
@@ -74,6 +85,10 @@ def load_map(cls, location):
7485
return m
7586

7687
def validate_purl(self, purl):
88+
"""
89+
Given a `purl` that is a PackageURL proper or a string representation of
90+
one, return True if `purl` exists, False otherwise.
91+
"""
7792
purl_map_entry = create_purl_map_entry(purl)
7893
in_purl_map = bool(self.purl_map.get(purl_map_entry))
7994
return in_purl_map

0 commit comments

Comments
 (0)