loop_step package#

Submodules#

loop_step.loop module#

Non-graphical part of the Loop step in a SEAMM flowchart

exception loop_step.loop.BreakLoop(message='break from the loop')[source]#

Bases: Exception

Indicates that SEAMM should break from the loop

exception loop_step.loop.ContinueLoop(message='continue with next iteration of loop')[source]#

Bases: Exception

Indicates that SEAMM should continue from the loop

class loop_step.loop.Loop(flowchart=None, extension=None)[source]#

Bases: Node

create_parser()[source]#

Setup the command-line / config file parser

default_edge_subtype()[source]#

Return the default subtype of the edge. Usually this is ‘next’ but for nodes with two or more edges leaving them, such as a loop, this method will return an appropriate default for the current edge. For example, by default the first edge emanating from a loop-node is the ‘loop’ edge; the second, the ‘exit’ edge.

A return value of ‘too many’ indicates that the node exceeds the number of allowed exit edges.

describe()[source]#

Write out information about what this node will do

description_text(P=None)[source]#

Return a short description of this step.

Return a nicely formatted string describing what this step will do.

Keyword Arguments:

P – a dictionary of parameter values, which may be variables or final values. If None, then the parameters values will be used as is.

exit_node()[source]#

The next node after the loop, if any

property git_revision#

The git version of this module.

property iter_format#
loop_node()[source]#

The first node in the loop body

run()[source]#

Run a Loop step.

safe_filename(filename)[source]#
set_id(node_id=())[source]#

Sequentially number the loop subnodes

set_subids(node_id=())[source]#

Set the ids of the nodes in the loop

property version#

The semantic version of this module.

property working_path#
exception loop_step.loop.SkipIteration(message='skip iteration of loop')[source]#

Bases: Exception

Indicates that SEAMM should skip this iteration of the loop, removing any directories, etc.

loop_step.loop.break_loop()[source]#

Break from the loop and continue on.

loop_step.loop.continue_loop()[source]#

Continue to the next iteration of the loop

loop_step.loop.skip_iteration()[source]#

Entirely skip this iteration, removing any files, etc.

loop_step.loop_parameters module#

Control parameters for loops

class loop_step.loop_parameters.LoopParameters(defaults={}, data=None)[source]#

Bases: Parameters

The control parameters for loops

parameters = {'configuration name': {'default': '', 'default_units': '', 'description': '', 'enumeration': (), 'format_string': 's', 'help_text': 'The filter for the configuration name', 'kind': 'string'}, 'default configuration': {'default': 'last', 'default_units': '', 'description': 'Select configuration:', 'enumeration': ('all', 'last', 'first', 'name is', 'name matches', 'name regexp'), 'format_string': 's', 'help_text': 'The configuration to select as the default.', 'kind': 'string'}, 'directory name': {'default': 'loop iteration', 'default_units': '', 'description': 'Directory names:', 'enumeration': ('loop iteration', 'system name', 'configuration name'), 'format_string': 's', 'help_text': 'The directory name for the loop iteration.', 'kind': 'string'}, 'end': {'default': '10', 'default_units': '', 'description': 'to', 'enumeration': (), 'format_string': '', 'help_text': 'The ending value of the loop.', 'kind': 'float'}, 'errors': {'default': 'continue to next iteration', 'default_units': '', 'description': 'On errors', 'enumeration': ('continue to next iteration', 'exit the loop', 'stop the job'), 'format_string': 's', 'help_text': 'How to handle errors', 'kind': 'string'}, 'query-column': {'default': '', 'default_units': '', 'description': '', 'enumeration': (), 'format_string': 's', 'help_text': 'The column to test', 'kind': 'string'}, 'query-op': {'default': '==', 'default_units': '', 'description': '', 'enumeration': ('==', '!=', '>', '>=', '<', '<=', 'contains', 'does not contain', 'contains regexp', 'does not contain regexp', 'is empty', 'is not empty'), 'format_string': 's', 'help_text': 'The column to test', 'kind': 'string'}, 'query-value': {'default': '', 'default_units': '', 'description': '', 'enumeration': (), 'format_string': 's', 'help_text': 'Value to use in the test', 'kind': 'string'}, 'start': {'default': '1', 'default_units': '', 'description': 'from', 'enumeration': (), 'format_string': '', 'help_text': 'The starting value of the loop.', 'kind': 'float'}, 'step': {'default': '1', 'default_units': '', 'description': 'by', 'enumeration': (), 'format_string': '', 'help_text': 'The step or increment of the loop value.', 'kind': 'float'}, 'system name': {'default': '', 'default_units': '', 'description': '', 'enumeration': (), 'format_string': 's', 'help_text': 'The filter for the system name', 'kind': 'string'}, 'table': {'default': 'table1', 'default_units': '', 'description': '', 'enumeration': (), 'format_string': 's', 'help_text': 'The table to iterate over.', 'kind': 'string'}, 'type': {'default': 'For', 'default_units': '', 'description': '', 'enumeration': ('For', 'Foreach', 'For rows in table', 'For systems in the database'), 'format_string': 's', 'help_text': 'The type of loop used.', 'kind': 'enumeration'}, 'values': {'default': '', 'default_units': '', 'description': 'value in', 'enumeration': (), 'format_string': 's', 'help_text': 'The list of values for the loop.', 'kind': 'string'}, 'variable': {'default': 'i', 'default_units': '', 'description': 'loop variable', 'enumeration': (), 'format_string': '', 'help_text': 'The name of the loop variable.', 'kind': 'string'}, 'where': {'default': 'Use all rows', 'default_units': '', 'description': '', 'enumeration': ('Use all rows', 'Select rows where column'), 'format_string': 's', 'help_text': 'The filter for rows, defaults to all rows.', 'kind': 'string'}, 'where system name': {'default': 'is anything', 'default_units': '', 'description': 'where name:', 'enumeration': ('is anything', 'is', 'matches', 'regexp'), 'format_string': 's', 'help_text': 'The filter for the system name, defaults to all systems.', 'kind': 'string'}}#

loop_step.loop_step module#

Helper class needed for the stevedore integration. Needs to provide a description() method that returns a dict containing a description of this node, and a factory() method for creating the graphical and non-graphical nodes.

class loop_step.loop_step.LoopStep(flowchart=None, gui=None)[source]#

Bases: object

create_node(flowchart=None, **kwargs)[source]#

Return the new node object

create_tk_node(canvas=None, **kwargs)[source]#

Return the graphical Tk node object

description()[source]#

Return a description of what this extension does

my_description = {'description': 'An interface for Loop', 'group': 'Control', 'name': 'Loop'}#

loop_step.tk_loop module#

The graphical part of a Loop step

class loop_step.tk_loop.TkLoop(tk_flowchart=None, node=None, canvas=None, x=120, y=20, w=200, h=50, my_logger=<Logger loop_step.tk_loop (WARNING)>)[source]#

Bases: TkNode

The node_class is the class of the ‘real’ node that this class is the Tk graphics partner for

create_dialog()[source]#

Create the dialog!

criteria_callback(widget, criterion, event, what)[source]#

Handle changes in the search criteria widget.

Parameters:
  • widget (Tk widget) – The widget.

  • criterion (sw.Criterion) – The row – Criterion widget – in the table.

  • event (tk.Event) – The event causing the callback.

  • what (str) – The item that changed: ‘inclusion’, ‘field’, ‘operator’, ‘self.two_values’, ‘clear’, ‘set’, ‘add row’, ‘remove row’

default_edge_subtype()[source]#

Return the default subtype of the edge. Usually this is ‘next’ but for nodes with two or more edges leaving them, such as a loop, this method will return an appropriate default for the current edge. For example, by default the first edge emanating from a loop-node is the ‘loop’ edge; the second, the ‘exit’ edge.

A return value of ‘too many’ indicates that the node exceeds the number of allowed exit edges.

next_anchor()[source]#

Return where the next node should be positioned. The default is <gap> below the ‘s’ anchor point.

node_class#

alias of Loop

reset_dialog(widget=None)[source]#

Lay out the edit dialog according to the type of loop.

right_click(event)[source]#

Probably need to add our dialog…

Module contents#

loop_step A step for loops in the SEAMM flowcharts