mirror of
https://github.com/NotAShelf/Basix.git
synced 2025-10-03 07:23:35 +00:00
Initial commit
This commit is contained in:
commit
e5a0d512ea
4 changed files with 823 additions and 0 deletions
24
packages/convert-scheme/package.nix
Normal file
24
packages/convert-scheme/package.nix
Normal file
|
@ -0,0 +1,24 @@
|
|||
{pkgs, ...}:
|
||||
pkgs.writers.writePython3Bin "convert-scheme" {
|
||||
libraries = with pkgs.python311Packages; [pyyaml];
|
||||
flakeIgnore = ["E302" "E305" "E501"];
|
||||
} ''
|
||||
import argparse
|
||||
import yaml
|
||||
import json
|
||||
|
||||
def yaml_to_json(yaml_file, json_file):
|
||||
with open(yaml_file, 'r') as yml_file:
|
||||
data = yaml.load(yml_file, Loader=yaml.FullLoader)
|
||||
|
||||
with open(json_file, 'w') as json_file:
|
||||
json.dump(data, json_file, indent=4)
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = argparse.ArgumentParser(description="Convert YAML to JSON")
|
||||
parser.add_argument("input", help="Path to the input YAML file")
|
||||
parser.add_argument("output", help="Path to the output JSON file")
|
||||
args = parser.parse_args()
|
||||
|
||||
yaml_to_json(args.input, args.output)
|
||||
''
|
Loading…
Add table
Add a link
Reference in a new issue