Input

Module contents

Definition of all the models required to create an input specification for some AnalysisVersion and keep track of the inputs associated with some Run instance.

Submodules

django_analyses.models.input.input module

Definition of the base Input model.

class django_analyses.models.input.input.Input(*args, **kwargs)

Bases: django.db.models.base.Model

This model serves as a base class for different types of inputs.

argument_value

Returns the value of the input as expected by the interface.

Returns:Input value as expected by the interface
Return type:Any
definition = None
get_argument_value() → Any

Returns the input’s value after applying any manipulations specified by the associated definition. This method is used to bridge database-compatible values with non-database-compatible values required by interfaces.

Returns:Input value as expected by the interface
Return type:Any
key

Returns the key of the associated definition.

Returns:Input definition key
Return type:str
objects = <model_utils.managers.InheritanceManager object>
pre_save() → None

If this input class’s value is a ForeignKey field, fix it in cases it is provided as int (the instance’s primary key).

Note

This method may be overridden by subclasses to implement custom functionality before saving. However, be sure to include:

super().pre_save()

within your custom function.

If this input’s definition points to a related model’s field, returns the related instance (i.e. the instance in which the field’s value is this input’s value).

Returns:related instance
Return type:Any
raise_required_error()

Raises ValidationError to indicate this input is required.

Raises:ValidationError – Required input not provided
run

The Run instance in which this input was included.

save(*args, **kwargs)

Overrides the model’s save() method to provide custom functionality.

validate() → None

Run any custom validations before saving the model.

Note

This method may be overridden by subclasses to implement custom functionality before saving. However, be sure to include:

super().pre_save()

within your custom function.

value = None

The value field is meant to be overriden by subclasses according to the type of data provided as input.

value_is_foreign_key

Checks whether the value attribute is a ForeignKey field.

Returns:value is foreign key or not
Return type:bool

django_analyses.models.input.input_specification module

Definition of the InputSpecification class.

class django_analyses.models.input.input_specification.InputSpecification(id, created, modified, analysis)

Bases: django_extensions.db.models.TimeStampedModel

analysis

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

analysis_version_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

base_input_definitions

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

Pizza.toppings and Topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

configuration_keys
default_configuration
get_configuration_keys() → set
get_default_input_configurations() → dict
input_definitions
objects = <django_analyses.models.managers.input_specification.InputSpecificationManager object>
validate_keys(**kwargs) → None
validate_kwargs(**kwargs) → None
validate_required(**kwargs) → None

django_analyses.models.input.utils module

class django_analyses.models.input.utils.ListElementTypes

Bases: django_analyses.utils.choice_enum.ChoiceEnum

An enumeration.

BLN = 'Boolean'
FIL = 'File'
FLT = 'Float'
INT = 'Integer'
STR = 'String'