add file_json

This commit is contained in:
Cayo Puigdefabregas 2022-03-25 13:53:27 +01:00
parent 43b4437333
commit 7d1e1589b6
1 changed files with 6 additions and 0 deletions

View File

@ -1,4 +1,5 @@
import io import io
import json
import uuid import uuid
import jwt import jwt
import ereuse_utils import ereuse_utils
@ -166,6 +167,11 @@ def file(name: str) -> dict:
return json_encode(yaml2json(name)) return json_encode(yaml2json(name))
def file_json(name):
with Path(__file__).parent.joinpath('files').joinpath(name).open() as f:
return json.loads(f.read())
def file_workbench(name: str) -> dict: def file_workbench(name: str) -> dict:
"""Opens and parses a YAML file from the ``files`` subdir.""" """Opens and parses a YAML file from the ``files`` subdir."""
with Path(__file__).parent.joinpath('workbench_files').joinpath(name + '.json').open() as f: with Path(__file__).parent.joinpath('workbench_files').joinpath(name + '.json').open() as f: