From 4943487db9af5b6a0b430762a1cc06371c6abc45 Mon Sep 17 00:00:00 2001 From: Waqar Ahmed Date: Tue, 4 Jun 2024 05:16:17 +0500 Subject: [PATCH] Remove ruamel.yaml usages --- catalog_reader/scripts/apps_hashes.py | 9 ++------- requirements.txt | 1 - 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/catalog_reader/scripts/apps_hashes.py b/catalog_reader/scripts/apps_hashes.py index 19a14c0..3e04159 100644 --- a/catalog_reader/scripts/apps_hashes.py +++ b/catalog_reader/scripts/apps_hashes.py @@ -2,7 +2,6 @@ import argparse import os import pathlib -import ruamel.yaml import shutil import yaml @@ -12,10 +11,6 @@ from catalog_reader.names import get_library_path, get_library_hashes_path, get_base_library_dir_name_from_version -YAML = ruamel.yaml.YAML() -YAML.indent(mapping=2, sequence=4, offset=2) - - def update_catalog_hashes(catalog_path: str) -> None: if not os.path.exists(catalog_path): raise CatalogDoesNotExist(catalog_path) @@ -54,7 +49,7 @@ def update_catalog_hashes(catalog_path: str) -> None: continue with open(str(app_metadata_file), 'r') as f: - app_config = YAML.load(f) + app_config = yaml.safe_load(f.read()) if (lib_version := app_config.get('lib_version')) and lib_version not in hashes: print( @@ -74,7 +69,7 @@ def update_catalog_hashes(catalog_path: str) -> None: app_config['lib_version_hash'] = hashes[lib_version] with open(str(app_metadata_file), 'w') as f: - YAML.dump(app_config, f) + yaml.safe_dump(app_config) print(f'[\033[92mOK\x1B[0m]\tUpdated library hash for {app_dir.name!r} in {train_dir.name}') diff --git a/requirements.txt b/requirements.txt index a863b1d..ffef472 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,5 +3,4 @@ jinja2 jsonschema==4.10.3 markdown pyyaml -ruamel.yaml semantic_version