-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes the expected output data for python and adds a script to automatically regenerate the expected data to make it easier in the future
- Loading branch information
Showing
5 changed files
with
47 additions
and
5 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#! /usr/bin/env python3 | ||
# | ||
# Copyright (c) 2024 Joshua Watt | ||
# | ||
# SPDX-License-Identifier: MIT | ||
|
||
import sys | ||
import subprocess | ||
|
||
from pathlib import Path | ||
|
||
THIS_DIR = Path(__file__).parent | ||
DATA_DIR = THIS_DIR.parent / "data" | ||
|
||
|
||
def make_dest(src, lang, ext): | ||
return THIS_DIR / lang / (src.stem + ext) | ||
|
||
|
||
def main(): | ||
for src in DATA_DIR.iterdir(): | ||
if not src.is_file(): | ||
continue | ||
|
||
if not src.name.endswith(".jsonld"): | ||
continue | ||
|
||
for lang, ext in (("python", ".py"), ("raw", ".txt")): | ||
subprocess.run( | ||
[ | ||
"shacl2code", | ||
"generate", | ||
f"--input={src}", | ||
lang, | ||
f"--output={make_dest(src, lang, ext)}", | ||
], | ||
check=True, | ||
) | ||
|
||
|
||
if __name__ == "__main__": | ||
sys.exit(main()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters