shapepipe.pipeline.config

shapepipe.pipeline.config

CONFIGURATION FILE HANDLING.

This module defines methods for handling the pipeline configuration file.

Author

Samuel Farrens <samuel.farrens@cea.fr>

class CustomParser(defaults=None, dict_type=<class 'dict'>, allow_no_value=False, *, delimiters=('=', ':'), comment_prefixes=('#', ';'), inline_comment_prefixes=None, strict=True, empty_lines_in_values=True, default_section='DEFAULT', interpolation=<object object>, converters=<object object>)[source]

Bases: configparser.ConfigParser

Custom Parser.

This class adds functionality to the ConfigParser class.

getexpanded(section, option)[source]

Get Expanded.

This method expands enviroment varibles obtaiened using the get method.

Parameters
  • section (str) – Configuration file section

  • option (str) – Configuration file option

Returns

Expanded enviroment variables

Return type

str

getlist(section, option, delimiter=',')[source]

Get List.

This method retrieves a list of strings separated by a given delimiter.

Parameters
  • section (str) – Configuration file section

  • option (str) – Configuration file option

  • delimiter (str, optional) – Delimiter between list entries, default is ‘,’

Returns

List of strings

Return type

list

_abc_impl = <_abc._abc_data object>
class SetUpParser(file_name)[source]

Bases: object

Set Up Parser.

This class sets up an instance of CustomParser and checks the pipeline related parameters.

Parameters

file_name (str) – Configuration file name

property file_name

Set file name.

This sets the configuration file name.

Raises

IOError – For non existent configuration file

_set_defaults()[source]

Set Defaults.

Set default configuration options.

_set_execution_options()[source]

Set Execution Options.

This method checks the execution options in the configuration file.

Raises
_set_file_options()[source]

Set File Options.

This module checks the file options in the configuration file.

Raises
  • RuntimeError – For no input directory specified

  • OSError – For non-existent input directory

  • RuntimeError – For no output directory specified

  • OSError – For non-existent output directory

_set_worker_options()[source]

Set Worker Options.

This module checks the worker options in the configuration file.

get_parser()[source]

Get Parser.

Return a configuration file parser instance.

Returns

Custom configuration file parser

Return type

CustomParser

create_config_parser(file_name)[source]

Create Configuration Parser.

This function creates a configuration file parser instance.

Parameters

file_name (str) – Configuration file name

Returns

Custom configuration file parser

Return type

CustomParser