fastoad.models.performances.mission.mission_definition.mission_builder.structure_builders module

Classes for managing internal structures of missions.

The mission file provides a “human” definition of the mission. Structures are the translation of this human definition, that is ready to be transformed in a Python implementation.

class fastoad.models.performances.mission.mission_definition.mission_builder.structure_builders.AbstractStructureBuilder(definition: InitVar, name: str, parent_name: Optional[str] = None)[source]

Bases: ABC

Base class for building structures of mission parts.

“Structures” are dicts that are derived from the mission definition file so that they can be readily translated into the matching implementation.

Usage:

Subclasses must implement the build method that will create the specific part of the structure dict (name and type fields are automated).

If the structure has to contain the result of another result, insert_builder() should be used to ensure a correct processing of the global structure, especially to get a correct resolution of input_definitions.

definition: InitVar
name: str
parent_name: str = None
type = None

Defined by subclass

property structure: OrderedDict

A dictionary that is ready to be translated to the matching implementation.

get_input_definitions() List[InputDefinition][source]

List of InputDefinition instances in the structure.

process_builder(builder: AbstractStructureBuilder) dict[source]

Method to be used when another StructureBuilder object should be inserted in structure.

Not using this method will prevent a correct processing of input_definitions.

Note

The returned object is always an empty dict. It is actually a memory reference that will allow to fill this “placeholder” later with the final result of the builder, that cannot be completely known when builder is created from read definition.

Parameters

builder – the builder object

Returns

the object that has to be put at location where the builder result should be used

property qualified_name

).

Type

Name of the current structure, preceded by the parent names, separated by colons (

class fastoad.models.performances.mission.mission_definition.mission_builder.structure_builders.DefaultStructureBuilder(definition: InitVar, name: str, parent_name: Optional[str] = None)[source]

Bases: AbstractStructureBuilder

Builder for structures that do not need to process the given definition.

Parameters

definition – the definition for the part only

type = None

Defined by subclass

definition: InitVar
name: str
class fastoad.models.performances.mission.mission_definition.mission_builder.structure_builders.SegmentStructureBuilder(definition: InitVar, name: str, parent_name: Optional[str] = None)[source]

Bases: AbstractStructureBuilder

Structure builder for segment definition.

Parameters

definition – the definition for the segment only

type = 'segment'

Defined by subclass

definition: InitVar
name: str
class fastoad.models.performances.mission.mission_definition.mission_builder.structure_builders.PhaseStructureBuilder(definition: InitVar, name: str, parent_name: Optional[str] = None)[source]

Bases: AbstractStructureBuilder

Structure builder for phase definition.

Parameters

definition – the whole content of definition file

type = 'phase'

Defined by subclass

definition: InitVar
name: str
class fastoad.models.performances.mission.mission_definition.mission_builder.structure_builders.RouteStructureBuilder(definition: InitVar, name: str, parent_name: Optional[str] = None)[source]

Bases: AbstractStructureBuilder

Structure builder for route definition.

Parameters

definition – the whole content of definition file

type = 'route'

Defined by subclass

definition: InitVar
name: str
class fastoad.models.performances.mission.mission_definition.mission_builder.structure_builders.MissionStructureBuilder(definition: InitVar, name: str, parent_name: Optional[str] = None)[source]

Bases: AbstractStructureBuilder

Structure builder for mission definition.

Parameters

definition – the whole content of definition file

property qualified_name

).

Type

Name of the current structure, preceded by the parent names, separated by colons (

type = 'mission'

Defined by subclass

definition: InitVar
name: str