dal.helpers package
Subpackages
- dal.helpers.flow package
- Submodules
- dal.helpers.flow.gflow module
GFlowGFlow.add_edge()GFlow.calc_remaps()GFlow.check_forced_links()GFlow.check_ros_port()GFlow.flowGFlow.forced_remap()GFlow.generate_graph()GFlow.generate_remaps()GFlow.get_adjacent_unremappable_port()GFlow.get_port_template()GFlow.get_remaps()GFlow.get_vertex()GFlow.iterate_through_links()GFlow.loggerGFlow.reverse_type()GFlow.set_remap()GFlow.should_skip()GFlow.sort_graph()
- Module contents
GFlowGFlow.add_edge()GFlow.calc_remaps()GFlow.check_forced_links()GFlow.check_ros_port()GFlow.flowGFlow.forced_remap()GFlow.generate_graph()GFlow.generate_remaps()GFlow.get_adjacent_unremappable_port()GFlow.get_port_template()GFlow.get_remaps()GFlow.get_vertex()GFlow.iterate_through_links()GFlow.loggerGFlow.reverse_type()GFlow.set_remap()GFlow.should_skip()GFlow.sort_graph()
Submodules
dal.helpers.cache module
# Size of each object in bytes, calculated using pympler asizeof
│ Flow | 19.36 MB | │ Configuration | 21.86 MB | │ Ports | 23.18 MB | | Layout | 23.04 MB | | Annotation | 23.04 MB | | GraphicScene | 22.7 MB | ———————————
dal.helpers.helpers module
Copyright (C) Mov.ai - All Rights Reserved Unauthorized copying of this file, via any medium is strictly prohibited Proprietary and confidential
Developers: - Manuel Silva (manuel.silva@mov.ai) - 2020 - Tiago Paulino (tiago@mov.ai) - 2020
- class dal.helpers.helpers.Helpers
Bases:
objectHelper Methods
- static find_by_key(data, target)
- static get_args(prev_struct) dict
- static get_partial_dict(_input: dict, key: dict) dict
Giving a full dict and a beggining return the full dict containing that beggining
- static join_first(add_struct: dict, prev_struct: dict) dict
- static replace_dict_values(haystack: dict, needle: any, value: any) None
- static update_dict(_base_dict: dict, _add_dict: dict) dict
Join a dictionary with another dictionary
- dal.helpers.helpers.flatten(data: dict, output: list, path: str, join_char: str = '.') list
Returns a list of paths
- Parameters:
data (dict) – expects a dictionary to start
output (list) – variable to save the list of paths
path (str) – accumulative path
join_char (str) – character to join path entries
- Returns:
a list of paths
- Return type:
output (list)
dal.helpers.parsers module
Copyright (C) Mov.ai - All Rights Reserved Unauthorized copying of this file, via any medium is strictly prohibited Proprietary and confidential
Developers: - Manuel Silva (manuel.silva@mov.ai) - 2020
- class dal.helpers.parsers.ParamParser(flow: Flow)
Bases:
objectParser for the node instance, container and flow parameters Supports configuration. parameters, var, flow and env variables
- eval_config(_config: str, *__)
- Returns the config expression evaluated
$(<contex> <configuration name>.<parameter reference>) ex.: $(config name.var1.var2)
- Parameters:
_config (str) – <configuration name>.<parameter reference>
- Returns:
the expression evaluated
- Return type:
output (any)
- eval_flow(param_name: str, default: str, instance: NodeInst | Container, node_name: str) any
- Returns the flow expression evaluated
ex.: $(flow myvar)
- Parameters:
param_name (str): reference to a parameter default (str): default value with parsing instance (NodeInst || Container): an instance node_name (str): node instance name (may be in the context of a subflow)
- Returns:
output (any): the expression evaluated
- eval_param(param_name: str, default: str, instance: Flow | NodeInst | Container, node_name: str) any
- Returns the param expression evaluated or default
ex.: $(param name)
- eval_reference(key: str, expression: str, instance: ObjectWithName, node_name: str) str
Calls a specific function to evaluate the expression
- Parameters:
- Returns:
the parameter value after evaluation
- Return type:
output (str)
- eval_var(reference: str, *__) Any
- Returns the var expression evaluated
ex.: $(var robot.name)
- Parameters:
- reference (str): reference to
a parameter <fleet or robot>.<parameter reference>
- Returns:
output (any): the expression evaluated
- logger = <Logger ParamParser.mov.ai (INFO)>
- parse(key: str, expression: str, node_name: str, instance: ObjectWithName, context: str | None = None) Any
Returns the parameter value. If the value is a valid expression, it is evaluated.
- Parameters:
- Returns:
the parameter value after evaluation
- Return type:
output (str)
- dal.helpers.parsers.get_string_from_template(template: str, task_entry: object) str
Applies a task entry into a template
Module contents
Copyright (C) Mov.ai - All Rights Reserved Unauthorized copying of this file, via any medium is strictly prohibited Proprietary and confidential
Developers: - Moawiya Mograbi (moawiya@mov.ai) - 2022
- class dal.helpers.GFlow(flow)
Bases:
objectGraph generator in use to calculate remaps
- add_edge(key: str, _id: str, _type: str) dict
Add a new edge to the vertex
- calc_remaps() dict
Returns the remaps after calculation
- check_ros_port(node_name: str, port_name: str)
- function that verifies if a specific port name has a ROS message associated
- Args:
node_name (str): simplified node name (e.g. publisher2) port_name (str): full port name (e.g. publisher2/bool_out/out)
- Returns:
bool: True if port name has a ROS message associateds. False otherwise
- generate_graph() dict
Generate the graph
- generate_remaps() dict
Generates the remaps
- get_adjacent_unremappable_port(port_type, links: list)
- get_port_template(node_inst: str, port_name: str) str
Get the port template from the node template
- get_remaps(force: bool = False) dict
Returns the calculated remaps
- get_vertex(key: str, _type: str = 'From') dict
Get or create a new vertex
- iterate_through_links(port_type, links: list) list
- logger = <Logger gflow.mov.ai (INFO)>
- reverse_type(port_type: str) str
- set_remap(key: str, remap: str)
Set the vertex remap value
- sort_graph() list
Sort the graph by the number of elements in links
- class dal.helpers.Helpers
Bases:
objectHelper Methods
- static find_by_key(data, target)
- static get_args(prev_struct) dict
- static get_partial_dict(_input: dict, key: dict) dict
Giving a full dict and a beggining return the full dict containing that beggining
- static join_first(add_struct: dict, prev_struct: dict) dict
- static replace_dict_values(haystack: dict, needle: any, value: any) None
- static update_dict(_base_dict: dict, _add_dict: dict) dict
Join a dictionary with another dictionary
- dal.helpers.flatten(data: dict, output: list, path: str, join_char: str = '.') list
Returns a list of paths
- Parameters:
data (dict) – expects a dictionary to start
output (list) – variable to save the list of paths
path (str) – accumulative path
join_char (str) – character to join path entries
- Returns:
a list of paths
- Return type:
output (list)