@@ 209-237 (lines=29) @@ | ||
206 | VULNERABILITY = "vuln" |
|
207 | ||
208 | ||
209 | def get_filter_type_from_string( |
|
210 | filter_type: Optional[str], |
|
211 | ) -> Optional[FilterType]: |
|
212 | """Convert a filter type string to an actual FilterType instance |
|
213 | ||
214 | Arguments: |
|
215 | filter_type (str): Filter type string to convert to a FilterType |
|
216 | """ |
|
217 | if not filter_type: |
|
218 | return None |
|
219 | ||
220 | if filter_type == 'vuln': |
|
221 | return FilterType.VULNERABILITY |
|
222 | ||
223 | if filter_type == 'os': |
|
224 | return FilterType.OPERATING_SYSTEM |
|
225 | ||
226 | if filter_type == 'config': |
|
227 | return FilterType.SCAN_CONFIG |
|
228 | ||
229 | if filter_type == 'secinfo': |
|
230 | return FilterType.ALL_SECINFO |
|
231 | ||
232 | try: |
|
233 | return FilterType[filter_type.upper()] |
|
234 | except KeyError: |
|
235 | raise InvalidArgument( |
|
236 | argument='filter_type', |
|
237 | function=get_filter_type_from_string.__name__, |
|
238 | ) from None |
|
239 | ||
240 |
@@ 392-423 (lines=32) @@ | ||
389 | VULNERABILITY = "vuln" |
|
390 | ||
391 | ||
392 | def get_filter_type_from_string( |
|
393 | filter_type: Optional[str], |
|
394 | ) -> Optional[FilterType]: |
|
395 | """Convert a filter type string to an actual FilterType instance |
|
396 | ||
397 | Arguments: |
|
398 | filter_type (str): Filter type string to convert to a FilterType |
|
399 | """ |
|
400 | if not filter_type: |
|
401 | return None |
|
402 | ||
403 | if filter_type == 'vuln': |
|
404 | return FilterType.VULNERABILITY |
|
405 | ||
406 | if filter_type == 'os': |
|
407 | return FilterType.OPERATING_SYSTEM |
|
408 | ||
409 | if filter_type == 'config': |
|
410 | return FilterType.SCAN_CONFIG |
|
411 | ||
412 | if filter_type == 'secinfo': |
|
413 | return FilterType.ALL_SECINFO |
|
414 | ||
415 | if filter_type == 'tls_certificate': |
|
416 | return FilterType.TLS_CERTIFICATE |
|
417 | ||
418 | try: |
|
419 | return FilterType[filter_type.upper()] |
|
420 | except KeyError: |
|
421 | raise InvalidArgument( |
|
422 | argument='filter_type', |
|
423 | function=get_filter_type_from_string.__name__, |
|
424 | ) from None |
|
425 | ||
426 |
@@ 202-233 (lines=32) @@ | ||
199 | VULNERABILITY = "vuln" |
|
200 | ||
201 | ||
202 | def get_filter_type_from_string( |
|
203 | filter_type: Optional[str], |
|
204 | ) -> Optional[FilterType]: |
|
205 | """Convert a filter type string to an actual FilterType instance |
|
206 | ||
207 | Arguments: |
|
208 | filter_type (str): Filter type string to convert to a FilterType |
|
209 | """ |
|
210 | if not filter_type: |
|
211 | return None |
|
212 | ||
213 | if filter_type == 'vuln': |
|
214 | return FilterType.VULNERABILITY |
|
215 | ||
216 | if filter_type == 'os': |
|
217 | return FilterType.OPERATING_SYSTEM |
|
218 | ||
219 | if filter_type == 'config': |
|
220 | return FilterType.SCAN_CONFIG |
|
221 | ||
222 | if filter_type == 'secinfo': |
|
223 | return FilterType.ALL_SECINFO |
|
224 | ||
225 | if filter_type == 'tls_certificate': |
|
226 | return FilterType.TLS_CERTIFICATE |
|
227 | ||
228 | try: |
|
229 | return FilterType[filter_type.upper()] |
|
230 | except KeyError: |
|
231 | raise InvalidArgument( |
|
232 | argument='filter_type', |
|
233 | function=get_filter_type_from_string.__name__, |
|
234 | ) from None |
|
235 | ||
236 |