Common documentation

Package containing useful resources shared between the other packages.

XML Parser

Module for sequence parsing

class sequence.common.parser.BlockProperties(block_type)

Class to manipulate block properties

check_type(block_type, block_id)

Check properties validity

Parameters:
  • block_type – type of the block to use for checking
  • block_id – ID of the block (for error message)
get_dictionnary()

Return a dictionnary of the block properties

get_element()

Return XML element of the block properties

parse_properties(node)

Parse an xml node as block properties

set_dictionary(dictionary)

Set the dictionnary as the block properties Return True if the dictionary has been modified

exception sequence.common.parser.InvalidSequenceError(strerror)

Custom error raised when the sequence is invalid

exception sequence.common.parser.SequenceSynthaxError(strerror)

Custom error raised when a synthax error is detected

class sequence.common.parser.XMLBlock(block_id, block_type)

Class to manipulate an XML block

check_type()

Check block validity

create_action()

Create action from Actions module

get_element()

Build and return the XML node corresponding to the block

handle_multiple_inputs()

Return True if the block handles multiple inputs

handle_multiple_outputs()

Return True if the block handles multiple outputs

parse_block(node)

Parse an XML node as a block

parse_io(node)

Parse an XML node as input/output data

class sequence.common.parser.XMLSequence(sequence_id, depth=0, level=0, execution=False)

Class to manipulate an XML sequence

check_sequence()

Check sequence validity (only for execution)

create_actions()

Create actions (only for execution)

Create links between blocks

get_element()

Build and return the XML node corresponding to the sequence

parse_backup(backup_node, subsequence_node)

Parse an xml node as a backup sequence

Parameters:
  • backup_node – xml node of the backup sequence reference
  • subsequence_node – xml node of the subsequences list
parse_blocks(node)

Parse an xml node as list of blocks

parse_sequence(node)

Parse an xml node as a sequence

parse_subsequences(node)

Parse an xml node as list of subsequences

remove_block(block)

Remove a block from the block list and break the links

set_backup(backup)

Set a custom backup to the sequence

xml_export(filename, pretty=True)

Export XML Sequence to an XML file

sequence.common.parser.assert_valid_id(string, display_name)

Assert valid IDs

Parameters:
  • string – str – string to assert
  • display_name – str – string to display with error message
sequence.common.parser.custom_format_sequence(in_file, out_file)

Format a sequence xml file with a custom format

Parameters:
  • in_file – sequence file written with the pretty print option of lxml
  • out_file – file object to write the formatted sequence
sequence.common.parser.is_sequence(node)

Test if a node is a sequence, and return its ID

sequence.common.parser.parse_sequence_file(file_name, max_depth=None, backup_file=None, execution=True)

Parse an XML sequence file

Parameters:
  • file_name – str – name of the file to parse as a sequence
  • max_depth – int – maximum depth for sequence creation
  • backup_file – str – name of the file to parse as a backup sequence
Returns:

the XMLSequence corresponding

Constants

Module containing constants

sequence.common.constant.enum(**enums)

Function allowing the definition of enumerations

Parameters:enums – set of elements to enumerate
Returns:an enumeration

Table Of Contents

Previous topic

Core documentation

Next topic

Script documentation

This Page