config_validator
flexi_json_input(config)
¶
Allows flexible inputs. If a string is parsed, then assume it's a file path and read in as a json. If a dict is parsed, then assume it's already a valid loaded json, and return it as is
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
str or dict
|
Input to translate into a dict. |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
If input is neither a str nor a dict, then wrong input type |
Returns:
| Name | Type | Description |
|---|---|---|
dict |
Dictionary read from JSON |
validate_mesh_config(config)
¶
Validates a mesh config
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
str or dict
|
Mesh config to be validated. If type 'str', tries to read in as a filename and open file as json If type 'dict', assumes it's already read in from a json file |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
Incorrect config parsed in. Must be 'str' or 'dict' |
FileNotFoundError
|
Could not read in file if 'str' parsed |
ValidationError
|
Malformed mesh config |