gvm/protocols/gmpv214/types.py 1 location
|
@@ 118-131 (lines=14) @@
|
115 |
|
ALARM = "Alarm" |
116 |
|
|
117 |
|
|
118 |
|
def get_severity_level_from_string( |
119 |
|
severity_level: Optional[str], |
120 |
|
) -> Optional[SeverityLevel]: |
121 |
|
"""Convert a severity level string into a SeverityLevel instance""" |
122 |
|
if not severity_level: |
123 |
|
return None |
124 |
|
|
125 |
|
try: |
126 |
|
return SeverityLevel[severity_level.upper()] |
127 |
|
except KeyError: |
128 |
|
raise InvalidArgument( |
129 |
|
argument='severity_level', |
130 |
|
function=get_severity_level_from_string.__name__, |
131 |
|
) from None |
132 |
|
|
133 |
|
|
134 |
|
class ScannerType(Enum): |
gvm/protocols/gmpv208/entities/severity.py 1 location
|
@@ 42-55 (lines=14) @@
|
39 |
|
DEBUG = "Debug" |
40 |
|
|
41 |
|
|
42 |
|
def get_severity_level_from_string( |
43 |
|
severity_level: Optional[str], |
44 |
|
) -> Optional[SeverityLevel]: |
45 |
|
"""Convert a severity level string into a SeverityLevel instance""" |
46 |
|
if not severity_level: |
47 |
|
return None |
48 |
|
|
49 |
|
try: |
50 |
|
return SeverityLevel[severity_level.upper()] |
51 |
|
except KeyError: |
52 |
|
raise InvalidArgument( |
53 |
|
argument='severity_level', |
54 |
|
function=get_severity_level_from_string.__name__, |
55 |
|
) from None |
56 |
|
|