/
Art86
/
DefectDojo-DevSecOps
Обзор
Документация
Войти
/
Art86
/
DefectDojo-DevSecOps
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
dojo/tools/parser_test.py
41 строка
1 KB
Cody Maffucci
Generic Parser: Support Test Type Meta (#12348)
01 май 2025, 00:58
01 май 2025, 00:58
7a01699
Код
Авторство
О чём код?
import importlib from contextlib import suppress from django.conf import settings class ParserTest: def __init__(self, *args: list, **kwargs: dict): parser_test_class = OpenSourceParserTest with suppress(ModuleNotFoundError): if ( class_path := getattr(settings, "PARSER_TEST_CLASS_PATH", None) ) is not None: module_name, _separator, class_name = class_path.rpartition(".") module = importlib.import_module(module_name) parser_test_class = getattr(module, class_name) parser_test_class().apply(self, *args, **kwargs) class OpenSourceParserTest: def apply( self, instance: ParserTest, name: str, parser_type: str, version: str, *args: list, description: str | None = None, dynamic_tool: bool | None = None, static_tool: bool | None = None, **kwargs: dict, ): instance.name = name instance.type = parser_type instance.version = version if description is not None: instance.description = description if dynamic_tool is not None: instance.dynamic_tool = dynamic_tool if static_tool is not None: instance.static_tool = static_tool