mirror of
https://github.com/NotAShelf/Basix.git
synced 2026-06-23 21:23:23 +00:00
Merge pull request #8 from alfarelcynthesis/use-safe-yaml-loader
convert-scheme: use safe yaml loader (+fix)
This commit is contained in:
commit
350a804305
1 changed files with 2 additions and 2 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
{pkgs, ...}:
|
{pkgs, ...}:
|
||||||
pkgs.writers.writePython3Bin "convert-scheme" {
|
pkgs.writers.writePython3Bin "convert-scheme" {
|
||||||
libraries = with pkgs.python311Packages; [pyyaml];
|
libraries = with pkgs.python3Packages; [pyyaml];
|
||||||
flakeIgnore = ["E302" "E305" "E501"];
|
flakeIgnore = ["E302" "E305" "E501"];
|
||||||
} ''
|
} ''
|
||||||
import argparse
|
import argparse
|
||||||
|
|
@ -9,7 +9,7 @@ pkgs.writers.writePython3Bin "convert-scheme" {
|
||||||
|
|
||||||
def yaml_to_json(yaml_file, json_file):
|
def yaml_to_json(yaml_file, json_file):
|
||||||
with open(yaml_file, 'r') as yml_file:
|
with open(yaml_file, 'r') as yml_file:
|
||||||
data = yaml.load(yml_file, Loader=yaml.FullLoader)
|
data = yaml.safe_load(yml_file)
|
||||||
|
|
||||||
with open(json_file, 'w') as json_file:
|
with open(json_file, 'w') as json_file:
|
||||||
json.dump(data, json_file, indent=4)
|
json.dump(data, json_file, indent=4)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue