Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 17 additions & 8 deletions cve_bin_tool/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,23 +85,32 @@ class Remarks(OrderedEnum):
Each member of the enumeration represents a specific remark with a unique value.
"""

NewFound = 1, "1", "NewFound", "n", "N"
Unexplored = 2, "2", "Unexplored", "u", "U", ""
Confirmed = 3, "3", "Confirmed", "c", "C"
Mitigated = 4, "4", "Mitigated", "m", "M"
FalsePositive = 5, "5", "FalsePositive", "f", "F"
NotAffected = 6, "6", "NotAffected", "i", "I"

def __new__(cls, value: int, *aliases: str) -> Remarks:
NewFound = 1, "New", "1", "NewFound", "n", "N"
Unexplored = 2, "Unexplored", "2", "Unexplored", "u", "U", ""
Confirmed = 3, "Confirmed", "3", "Confirmed", "c", "C"
Mitigated = 4, "Mitigated", "4", "Mitigated", "m", "M"
FalsePositive = 5, "False Positive", "5", "FalsePositive", "f", "F"
NotAffected = 6, "Not Affected", "6", "NotAffected", "i", "I"

def __new__(cls, value: int, string: str, *aliases: str) -> Remarks:
"""
Return a new instance of the Remarks enumeration.
"""
obj = object.__new__(cls)
obj._value_ = value
for alias in aliases:
cls._value2member_map_[alias] = obj
string_map = getattr(cls, "string_map", {})
string_map[value] = string
cls.string_map = string_map
return obj

def __str__(self):
"""
Returns a human-readable string of the enumeration value
"""
return self.string_map[self.value]


class CVE(NamedTuple):
"""
Expand Down