schema_util¶
Utilities for writing content to files and for other file manipulation.
Functions
|
|
Tries to get the GitHub access token from the environment. Defaults to above value if not found. |
|
|
Make a request and adds the above GitHub access credentials. |
|
Check if the given schema standard version is above target version |
|
Write data from a URL resource into a file. |
|
Get the data from the specified url as a string. |
|
Convert an XML element to an XML string. |
- format_error(row_number, row, warning_message='Schema term is empty or the line is malformed', error_code='GENERIC_ERROR')[source]¶
- get_api_key()[source]¶
Tries to get the GitHub access token from the environment. Defaults to above value if not found.
- Returns:
A GitHub access key or an empty string.
- make_url_request(resource_url, try_authenticate=True)[source]¶
Make a request and adds the above GitHub access credentials.
- Parameters:
resource_url (str) – The url to retrieve.
try_authenticate (bool) – If True add the above credentials.
- Returns:
url_request
- schema_version_greater_equal(hed_schema, target_version)[source]¶
Check if the given schema standard version is above target version
- Parameters:
hed_schema (HedSchema or HedSchemaGroup) – If a schema group, checks if any version is above.
target_version (str) – The semantic version to check against
- Returns:
- True if the version is above target_version
False if it is not, or it is ambiguous.
- Return type:
bool
- url_to_file(resource_url)[source]¶
Write data from a URL resource into a file. Data is decoded as unicode.
- Parameters:
resource_url (str) – The URL to the resource.
- Returns:
The local temporary filename for the downloaded file,
- Return type:
str