The utilities submodule
This module provides utility functions.
These utility functions are used by the high level functions defined in
safedata_validator.zenodo and safedata_validator.server. The functions are used to
check that the correct inputs have been supplied in the correct order.
check_file_is_excel(file_path)
Check that the file path provided points to a .xlsx file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_path
|
Path
|
A path to the file to check |
required |
Returns:
| Type | Description |
|---|---|
bool
|
A bool specifying whether or not the file is an .xlsx file. |
Source code in safedata_validator/utilities.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | |
check_file_is_json(file_path)
Check that the file path provided points to a JSON file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_path
|
Path
|
A path to the file to check |
required |
Returns:
| Type | Description |
|---|---|
bool
|
A bool specifying whether or not the file is a JSON file. |
Source code in safedata_validator/utilities.py
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | |
check_file_is_metadata_json(file_path)
Function to check if a file is a safedata metadata style JSON file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_path
|
Path
|
A path to the file to check |
required |
Returns:
| Type | Description |
|---|---|
bool
|
A bool specifying whether or not the file is a safedata metadata style JSON |
bool
|
file. |
Source code in safedata_validator/utilities.py
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 | |
check_file_is_zenodo_json(file_path)
Function to check if a file is a Zenodo JSON file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_path
|
Path
|
A path to the file to check |
required |
Returns:
| Type | Description |
|---|---|
bool
|
A bool specifying whether or not the file is a Zenodo JSON file. |
Source code in safedata_validator/utilities.py
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | |