From b98e6c99a7232d75c49a51dbc800ff420aa13c00 Mon Sep 17 00:00:00 2001 From: Rinary Date: Fri, 11 Oct 2024 19:35:45 +0300 Subject: [PATCH] fix !type: --- Tools/_sunrise/Schemas/validate_yml.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Tools/_sunrise/Schemas/validate_yml.py b/Tools/_sunrise/Schemas/validate_yml.py index 9795d690266..dfe03535419 100644 --- a/Tools/_sunrise/Schemas/validate_yml.py +++ b/Tools/_sunrise/Schemas/validate_yml.py @@ -31,7 +31,12 @@ def check_dir(dir: str): def check_yml(yml_path: str): try: with open(yml_path, "r", encoding="utf-8") as file: - data = yaml.safe_load(file) # Замените на safe_load для большей безопасности + content = file.read() + # Удаляем строки с тегами !type: + filtered_content = remove_type_tags(content) + + # Загружаем оставшийся текст в формате YAML + data = yaml.safe_load(filtered_content) # Проверка нужных полей на русские символы for key in ['name', 'description', 'suffix']: @@ -43,6 +48,12 @@ def check_yml(yml_path: str): except Exception as e: add_error(yml_path, f"Ошибка чтения файла: {e}") +def remove_type_tags(content: str) -> str: + """Удаляет строки с тегами !type:.""" + lines = content.splitlines() + filtered_lines = [line for line in lines if '!type:' not in line] + return '\n'.join(filtered_lines) + def has_russian_chars(text: str) -> bool: """Проверяет, содержит ли текст русские символы.""" return bool(re.search(r'[а-яА-Я]', text))