File tree Expand file tree Collapse file tree 1 file changed +3
-11
lines changed Expand file tree Collapse file tree 1 file changed +3
-11
lines changed Original file line number Diff line number Diff line change 2929PURL_MAP_LOCATION = Path (__file__ ).parent / "purls.map"
3030
3131
32- def check_purl (purl ):
32+ def create_purl_map_entry (purl ):
3333 if not isinstance (purl , (PackageURL , str )):
3434 raise ValueError (f"invalid `purl`: { purl } " )
3535
@@ -39,25 +39,17 @@ def check_purl(purl):
3939 else :
4040 p = purl
4141
42- return p
43-
44-
45- def create_purl_map_entry (purl ):
46- p = check_purl (purl )
47-
48- # Convert purl to bytes
42+ # Create purl map entry string
4943 if p .namespace :
5044 purl_str = f"{ p .type } /{ p .namespace } /{ p .name } "
5145 else :
5246 purl_str = f"{ p .type } /{ p .name } "
5347
48+ # Convert purl map entry string to bytes
5449 return bytes (purl_str , "utf-8" )
5550
5651
5752def create_purl_map (purls ):
58- # Ensure elements of `purls` are PackageURLs:
59- purls = (check_purl (purl ) for purl in purls )
60-
6153 # purl map entries must be unique, sorted, and converted to bytes before going into the Map
6254 purl_map_entries = set (create_purl_map_entry (purl ) for purl in purls )
6355 prepared_purl_map_entries = sorted ((purl_map_entry , 1 ) for purl_map_entry in purl_map_entries )
You can’t perform that action at this time.
0 commit comments