sshmitm.moduleparser.enhanced_configparser module

exception sshmitm.moduleparser.enhanced_configparser.DefaultConfigNotFound

Bases: Exception

class sshmitm.moduleparser.enhanced_configparser.ExtendedConfigParser(productionini=None, defaultini='default.ini', package=None, env_name='ENHANCED_CONFIG_FILE', modules_from_file=False, ignore_missing_default_config=False)

Bases: ConfigParser

Parameters:
  • productionini (str | None, default: None)

  • defaultini (str, default: 'default.ini')

  • package (str | None, default: None)

  • env_name (str, default: 'ENHANCED_CONFIG_FILE')

  • modules_from_file (bool, default: False)

  • ignore_missing_default_config (bool, default: False)

append(configpath)
Parameters:

configpath (str)

Return type:

None

copy()

create a copy of the current config

Return type:

ExtendedConfigParser

getboolean_or_string(section, option)
Parameters:
  • section (str)

  • option (str)

Return type:

bool | str

getlist(section, option, sep=',', chars=None)
Parameters:
  • section (str)

  • option (str)

  • sep (str, default: ',')

  • chars (str | None, default: None)

Return type:

list[str]

read(filenames, encoding='utf-8')

Read and parse a filename or an iterable of filenames.

Files that cannot be opened are silently ignored; this is designed so that you can specify an iterable of potential configuration file locations (e.g. current directory, user’s home directory, systemwide directory), and all existing configuration files in the iterable will be read. A single filename may also be given.

Return list of successfully read files.

Parameters:
  • filenames (Any)

  • encoding (str | None, default: 'utf-8')

Return type:

list[str]