From 9a33e8ccab5c861f4ac63f9a74dee8b7f010594d Mon Sep 17 00:00:00 2001 From: Warittorn Cheevachaipimol Date: Mon, 7 Oct 2024 16:46:53 +0700 Subject: [PATCH] fix --- .github/scripts/merge_all.py | 41 ------------------------- .github/workflows/aggregate_signals.yml | 2 +- .github/workflows/upload_ipfs.yml | 2 +- 3 files changed, 2 insertions(+), 43 deletions(-) delete mode 100644 .github/scripts/merge_all.py diff --git a/.github/scripts/merge_all.py b/.github/scripts/merge_all.py deleted file mode 100644 index 4197e4b..0000000 --- a/.github/scripts/merge_all.py +++ /dev/null @@ -1,41 +0,0 @@ -import json -import os -import sys -import yaml - -from collections import defaultdict, OrderedDict - - -def main(input_path: str, output_path: str): - shared_prefix_traits: dict[str, dict] = {} - - iter_ = os.walk(input_path) - root, dirs, files = iter_.__next__() - for d in dirs: - if (file := f"{d}.yaml") in files: - with open(os.path.join(root, file), 'r') as f: - shared_prefix_traits[d] = yaml.safe_load(f) - else: - print(f"Missing {d}.yaml") - exit(1) - - for root, _, files in iter_: - signal_ids: dict[str, OrderedDict] = defaultdict(OrderedDict) - prefix = root.split('/')[-1] - for file in sorted(files): - with open(os.path.join(root, file), 'r') as f: - signal_id = file.split('.')[0] - prefixed_signal_id = f"{prefix}:{signal_id}" - - signal_ids[prefixed_signal_id].update(yaml.safe_load(f)) - signal_ids[prefixed_signal_id].update(shared_prefix_traits[prefix]) - - if not os.path.exists(output_path): - os.makedirs(output_path) - - with open(f"{output_path}/registry.json", 'w') as f: - json.dump(signal_ids, f, indent=4) - - -if __name__ == '__main__': - main(*sys.argv[1:]) diff --git a/.github/workflows/aggregate_signals.yml b/.github/workflows/aggregate_signals.yml index f7e1641..a93fddd 100644 --- a/.github/workflows/aggregate_signals.yml +++ b/.github/workflows/aggregate_signals.yml @@ -22,7 +22,7 @@ jobs: pip install pyyaml - name: Aggregate Signals - run: python .github/scripts/merge_all.py ./signals . + run: python .github/scripts/aggregate_signals.py ./signals . - name: Cache Rust-Script uses: actions/cache@v4 diff --git a/.github/workflows/upload_ipfs.yml b/.github/workflows/upload_ipfs.yml index 335634b..9db4e21 100644 --- a/.github/workflows/upload_ipfs.yml +++ b/.github/workflows/upload_ipfs.yml @@ -21,7 +21,7 @@ jobs: pip install pyyaml - name: Aggregate Signals - run: python .github/scripts/merge_all.py ./signals ./output + run: python .github/scripts/aggregate_signals.py ./signals ./output - name: Upload to IPFS id: upload