diff options
author | Reiko Asakura | 2021-03-14 17:08:10 -0400 |
---|---|---|
committer | Reiko Asakura | 2021-03-14 17:10:39 -0400 |
commit | 7208cdd8dcd45d89adbeafffbd342346ace949aa (patch) | |
tree | ed7645e0babd6a54fc33402155c616bfc0e006be | |
parent | Add ScePafThread functions (diff) | |
download | vds-libraries-7208cdd8dcd45d89adbeafffbd342346ace949aa.tar.gz |
Use ruamel instead of PyYAML
-rw-r--r-- | .github/workflows/lint.yml | 4 | ||||
-rw-r--r-- | scripts/nids.py | 13 |
2 files changed, 6 insertions, 11 deletions
diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 2cd117b..81051d1 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -22,6 +22,10 @@ jobs: - name: Checkout uses: actions/checkout@v2 + - name: Install dependencies + run: | + pip3 install ruamel.yaml + - name: Check NIDs sort run: | python3 scripts/nids-check-sort.py diff --git a/scripts/nids.py b/scripts/nids.py index 6966076..e9a5567 100644 --- a/scripts/nids.py +++ b/scripts/nids.py @@ -9,19 +9,10 @@ import sys from pathlib import Path -import yaml -try: - from yaml import CLoader as YamlLoader -except ImportError: - from yaml import SafeLoader as YamlLoader +from ruamel.yaml import YAML def load(nids): - if isinstance(nids, Path): - nids = yaml.load(nids.read_bytes(), Loader=YamlLoader) - elif not isinstance(nids, dict): - nids = yaml.load(nids, Loader=YamlLoader) - - return nids + return nids if isinstance(nids, dict) else YAML(typ='safe').load(nids) def process(nids, modules_cb=None, module_cb=None, libraries_cb=None, library_cb=None, functions_cb=None, variables_cb=None, export_cb=None, user_data=None): |