Fix json loader - it should go in 'validators' not 'utils'

Fixes #214
This commit is contained in:
Patrick Robertson
2025-02-20 13:10:23 +00:00
parent 40488e0869
commit eda359a1ef
7 changed files with 11 additions and 12 deletions

View File

@@ -208,7 +208,7 @@ def read_yaml(yaml_filename: str) -> CommentedMap:
pass
if not config:
config = EMPTY_CONFIG
config = deepcopy(EMPTY_CONFIG)
return config

View File

@@ -1,6 +1,7 @@
# used as validators for config values. Should raise an exception if the value is invalid.
from pathlib import Path
import argparse
import json
def example_validator(value):
if "example" not in value:
@@ -16,4 +17,7 @@ def positive_number(value):
def valid_file(value):
if not Path(value).is_file():
raise argparse.ArgumentTypeError(f"File '{value}' does not exist.")
return value
return value
def json_loader(cli_val):
return json.loads(cli_val)