Skip to content

Commit

Permalink
Add CLI arguments for yaml-yugi-ko proposal
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinlul committed Aug 10, 2023
1 parent 7e3492b commit 7fe2aaa
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 11 deletions.
24 changes: 16 additions & 8 deletions .github/workflows/merge.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ on:
jobs:
merge:
runs-on: ubuntu-latest
defaults:
run:
working-directory: yaml-yugi
steps:
- uses: actions/checkout@v3
with:
Expand All @@ -22,6 +19,13 @@ jobs:
with:
repository: DawnbrandBots/yaml-yugipedia
path: yaml-yugipedia
- uses: actions/checkout@v3
with:
repository: DawnbrandBots/yaml-yugi-ko
sparse-checkout: |
/*.csv
/overrides.tsv
sparse-checkout-cone-mode: false
- uses: actions/checkout@v3
with:
repository: DawnbrandBots/yaml-yugi-zh
Expand All @@ -37,10 +41,8 @@ jobs:
cache-dependency-path: yaml-yugi/src/requirements.txt
- name: Download yaml-yugi-ko exports
run: |
cd ..
curl -fsSLO https://github.com/DawnbrandBots/yaml-yugi-ko/raw/master/overrides.tsv
curl -fsSLO https://dawnbrandbots.github.io/yaml-yugi-ko/ocg.csv
- run: pip install -r src/requirements.txt
- run: pip install -r yaml-yugi/src/requirements.txt
- name: Transform (series)
working-directory: yaml-yugi/data/series
run: python3 ../../src/main_archetypes.py ../../../yaml-yugipedia/wikitext/archetypes
Expand All @@ -54,8 +56,10 @@ jobs:
--assignments ../../src/assignments/assignments.yaml \
--tcg ../../data/limit-regulation/tcg/current.vector.json \
--ocg ../../data/limit-regulation/ocg/current.vector.json \
--ko ../../../overrides.tsv \
--ko-csv ../../../ocg.csv \
--ko ../../../yaml-yugi-ko/overrides.tsv \
--ko-official ../../../ocg.csv \
--ko-override ../../../yaml-yugi-ko/ocg-override.csv \
--ko-prerelease ../../../yaml-yugi-ko/ocg-prerelease.csv \
--aggregate ../../../aggregate/cards.json
- name: Transform (Rush Duel)
working-directory: yaml-yugi/data/rush
Expand All @@ -77,10 +81,12 @@ jobs:
message: "Transform: ${{ github.run_number }} (${{ github.run_id }})"
working-directory: yaml-yugi
- if: steps.commit.outputs.status > 0
working-directory: yaml-yugi
run: gh workflow run validate-data.yaml
env:
GH_TOKEN: ${{ github.token }}
- if: steps.commit.outputs.status > 0
working-directory: yaml-yugi
name: Merge
run: |
sed -s '1i---' data/cards/*.yaml > ../aggregate/cards.yaml
Expand All @@ -102,8 +108,10 @@ jobs:
cache: yarn
cache-dependency-path: yaml-yugi/yarn.lock
- if: steps.commit.outputs.status > 0
working-directory: yaml-yugi
run: yarn
- if: steps.commit.outputs.status > 0
working-directory: yaml-yugi
name: Load (push)
env:
OPENSEARCH_URL: ${{ secrets.OS_URL }}
Expand Down
8 changes: 5 additions & 3 deletions src/main_ocgtcg.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
parser.add_argument("--tcg", help="TCG Forbidden & Limited List, Konami ID vector JSON")
parser.add_argument("--ocg", help="OCG Forbidden & Limited List, English name vector JSON")
parser.add_argument("--ko", help="yaml-yugi-ko overrides.tsv")
parser.add_argument("--ko-csv", help="yaml-yugi-ko official database CSV")
parser.add_argument("--ko-official", help="yaml-yugi-ko official database CSV")
parser.add_argument("--ko-override", help="yaml-yugi-ko ocg-override.csv")
parser.add_argument("--ko-prerelease", help="yaml-yugi-ko ocg-prerelease.csv")
parser.add_argument("--generate-schema", action="store_true", help="output generated JSON schema file")
parser.add_argument("--processes", type=int, default=0, help="number of worker processes, default ncpu")
parser.add_argument("--aggregate", help="output aggregate JSON file")
Expand Down Expand Up @@ -48,7 +50,7 @@ def main() -> None:
]

if processes == 1:
cards = job(args.wikitext_directory, files, args.zh_CN, args.assignments, tcg, ocg, args.ko, args.ko_csv, args.aggregate is not None)
cards = job(args.wikitext_directory, files, args.zh_CN, args.assignments, tcg, ocg, args.ko, args.ko_official, args.aggregate is not None)
else:
size = math.ceil(len(files) / processes)
partitions = [files[i:i+size] for i in range(0, len(files), size)]
Expand All @@ -58,7 +60,7 @@ def main() -> None:
with Pool(processes) as pool:
jobs = [
pool.apply_async(job, (args.wikitext_directory, partition,
args.zh_CN, args.assignments, tcg, ocg, args.ko, args.ko_csv, args.aggregate is not None))
args.zh_CN, args.assignments, tcg, ocg, args.ko, args.ko_official, args.aggregate is not None))
for partition in partitions
]
for result in jobs:
Expand Down

0 comments on commit 7fe2aaa

Please sign in to comment.