Utils

Submodules

django_analyses.utils.choice_enum module

Definition of the ChoiceEnum class.

class django_analyses.utils.choice_enum.ChoiceEnum

Bases: enum.Enum

A Python enum with a method to provide choices in the format that Django expects them.

choices = <bound method ChoiceEnum.choices of <enum 'ChoiceEnum'>>

django_analyses.utils.input_manager module

Definition of the InputManager class.

class django_analyses.utils.input_manager.InputManager(run, configuration: dict)

Bases: object

Creates Input subclass instances according to the provided Run’s associated InputSpecification.

all_input_instances
convert_raw_configuration_to_input_instances() → List[django_analyses.models.input.input.Input]

Coverts a user-provided input configuration dictionary to Input subclass instances.

Returns:Created inputs
Return type:List[Input]
create_input_instances() → dict

Creates all the required Input subclass instances for the provided run, including the creation of the destination directories of generated files.

Returns:Full input configuration
Return type:dict
create_required_paths() → None

Creates all the directories required for generated files.

get_all_input_instances() → List[django_analyses.models.input.input.Input]

Returns all Input subclass instances for the provided run.

Returns:Input instances
Return type:List[Input]
get_full_configuration() → dict

Returns the complete input configuration dictionary to be passed to the appropriate analysis interface.

Returns:Full input configuration
Return type:dict
get_missing_dynamic_default_definitions() → List[django_analyses.models.input.definitions.string_input_definition.StringInputDefinition]

Returns a list of missing string inputs with a dynamic_default value.

Returns:List of missing dynamic_default instances
Return type:List[StringInputDefinition]
get_missing_input_definitions() → Set[django_analyses.models.input.definitions.input_definition.InputDefinition]

Returns the InputDefinition subclass instances missing in the configuration for the given run.

Returns:Input definitions missing in the provided configuration
Return type:Set[InputDefinition]
get_missing_output_directory_definition() → List[django_analyses.models.input.definitions.directory_input_definition.DirectoryInputDefinition]

Returns missing output directory definition. There should only be one at the most, however, it is returned as a list so it can easily be appended to other missing inputs.

Returns:List of missing output directory configurations that should be generated
Return type:List[StringInputDefinition]
get_missing_output_path_definitions() → List[django_analyses.models.input.definitions.string_input_definition.StringInputDefinition]

Returns missing output path definitions.

Returns:List of missing output path configurations that should be generated
Return type:List[StringInputDefinition]
get_or_create_input_instance_from_raw(key: str, value: Any) → Tuple[django_analyses.models.input.input.Input, bool]

Get or create the appropriate Input instance from some user-provided dictionary item configuration.

Parameters:
  • key (str) – Input definition key
  • value (Any) – Input value
Returns:

Matching Input instance and whether is has been created or not

Return type:

Tuple[Input, bool]

Raises:

InputDefinition.DoesNotExist – Invalid input definition key within the input dictionary

get_or_create_missing_inputs() → List[django_analyses.models.input.input.Input]

Returns a list of Input subclass instances required to complete the provided run’s input configuration.

Returns:Missing input instances
Return type:List[Input]
get_required_paths() → List[django_analyses.models.input.input.Input]

Returns all input instances that require some parent directory to exist.

Returns:Input instances
Return type:List[Input]
input_definition_is_a_missing_output_directory(input_definition: django_analyses.models.input.definitions.input_definition.InputDefinition) → bool

Checks whether the provided input definition represents an output directory, and whether it is missing in the provided configuration.

Parameters:input_definition (InputDefinition) – Input definition in question
Returns:Whether the provided input definition represents an output directory and is missing in the complete input configuration
Return type:bool
input_definition_is_a_missing_output_path(input_definition: django_analyses.models.input.definitions.input_definition.InputDefinition) → bool

Checks whether the provided input definition represents an output path, and whether it is missing in the provided configuration.

Parameters:input_definition (InputDefinition) – Input definition in question
Returns:Whether the provided input definition represents an output path and is missing in the complete input configuration
Return type:bool
missing_input_definitions
missing_inputs
raw_input_instances
required_paths

django_analyses.utils.output_manager module

class django_analyses.utils.output_manager.OutputManager(run, results: dict)

Bases: object

create_output_instance(key: str, value) → django_analyses.models.output.output.Output
create_output_instances() → list

Module contents

Utilities for the django_analyses app.