Skip to content

Commit 7bfa0bd

Browse files
committed
Adress review comments
Signed-off-by: Tushar Goel <tushar.goel.dav@gmail.com>
1 parent ba20954 commit 7bfa0bd

File tree

2 files changed

+1
-25
lines changed

2 files changed

+1
-25
lines changed

vulnerabilities/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,7 @@ def normalize_purl(purl: Union[PackageURL, str]):
540540

541541

542542
def get_purl_version_class(purl):
543-
RANGE_CLASS_BY_SCHEMES["alpine"] = AlpineLinuxVersionRange
543+
RANGE_CLASS_BY_SCHEMES["apk"] = AlpineLinuxVersionRange
544544
purl_version_class = None
545545
check_version_class = RANGE_CLASS_BY_SCHEMES.get(purl.type, None)
546546
if check_version_class:

vulnerabilities/views.py

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -32,36 +32,12 @@
3232
from vulnerabilities.forms import VulnerabilitySearchForm
3333
from vulnerabilities.severity_systems import EPSS
3434
from vulnerabilities.severity_systems import SCORING_SYSTEMS
35-
from vulnerabilities.utils import get_purl_version_class
3635
from vulnerablecode import __version__ as VULNERABLECODE_VERSION
3736
from vulnerablecode.settings import env
3837

3938
PAGE_SIZE = 20
4039

4140

42-
def purl_sort_key(purl: models.Package):
43-
"""
44-
Return a sort key for the built-in sorted() function when sorting a list
45-
of Package objects. If the Package ``type`` is supported by univers, apply
46-
the univers version class to the Package ``version``, and otherwise use the
47-
``version`` attribute as is.
48-
"""
49-
purl_version_class = get_purl_version_class(purl)
50-
purl_sort_version = purl.version
51-
if purl_version_class:
52-
purl_sort_version = purl_version_class(purl.version)
53-
return (purl.type, purl.namespace, purl.name, purl_sort_version, purl.qualifiers, purl.subpath)
54-
55-
56-
def get_purl_version_class(purl: models.Package):
57-
RANGE_CLASS_BY_SCHEMES["apk"] = AlpineLinuxVersionRange
58-
purl_version_class = None
59-
check_version_class = RANGE_CLASS_BY_SCHEMES.get(purl.type, None)
60-
if check_version_class:
61-
purl_version_class = check_version_class.version_class
62-
return purl_version_class
63-
64-
6541
class PackageSearch(ListView):
6642
model = models.Package
6743
template_name = "packages.html"

0 commit comments

Comments
 (0)