otoole package¶
Submodules¶
otoole.cli module¶
otoole.exceptions module¶
-
exception
otoole.exceptions.
OtooleException
[source]¶ Bases:
Exception
Base class for all otoole exceptions.
-
exception
otoole.exceptions.
OtooleRelationError
(resource, foreign_resource, message)[source]¶ Bases:
otoole.exceptions.OtooleException
Relations between input data is not correct
Parameters:
-
exception
otoole.exceptions.
OtooleValidationError
(resource, message)[source]¶ Bases:
otoole.exceptions.OtooleException
Input data is invalid
Parameters:
otoole.validate module¶
Ensures that technology and fuel names match the convention
For example, to validate the following list of names, you would use the config shown below:
theseUNIQUE_ENTRY1
are__UNIQUE_ENTRY2
all__UNIQUE_ENTRY1
validUNIQUE_ENTRY2
entryUNIQUE_ENTRY1
in__UNIQUE_ENTRY2
a____UNIQUE_ENTRY1
list_UNIQUE_ENTRY2
Create a yaml validation config with the following format:
codes:
some_valid_codes:
UNIQUE_ENTRY1: Description of unique entry 1
UNIQUE_ENTRY2: Description of unique entry 2
schema:
schema_name:
- name: first_entry_in_schema
valid: ['these', 'are__', 'all__', 'valid', 'entry', 'in__', 'a____', 'list_']
position: (1, 5) # a tuple representing the start and end position
- name: second_entry_in_schema
valid: some_valid_codes # references an entry in the codes section of the config
position: (6, 19) # a tuple representing the start and end position
-
otoole.validate.
compose_expression
(schema: List[T]) → str[source]¶ Generates a regular expression from a schema
Returns: Return type: str
-
otoole.validate.
compose_multi_expression
(resource: List[T]) → str[source]¶ Concatenates multiple expressions using an OR operator
Use to validate elements using an OR operation e.g. the elements must match this expression OR the expression
-
otoole.validate.
create_schema
(config: Dict[KT, VT] = None) → Dict[KT, VT][source]¶ Populate the dict of schema with codes from the validation config
Parameters: config (dict, default=None) – A configuration dictionary containing codes
andschema
keys
-
otoole.validate.
identify_orphaned_fuels_techs
(package) → Dict[str, str][source]¶ Returns a list of fuels and technologies which are unconnected
Returns: Return type: dict