fail2ban.client.configparserinc module
**************************************

class fail2ban.client.configparserinc.SafeConfigParserWithIncludes(share_config=None, *args, **kwargs)

   Bases: "configparser.ConfigParser"

      Class adds functionality to SafeConfigParser to handle included
      other configuration files (or may be urls, whatever in the
      future)

      File should have section [includes] and only 2 options
      implemented are 'files_before' and 'files_after' where files are
      listed 1 per line.

      Example:

   [INCLUDES] before = 1.conf

      3.conf

   after = 1.conf

      It is a simple implementation, so just basic care is taken about
      recursion. Includes preserve right order, ie new files are
      inserted to the list of read configs before original, and their
      includes correspondingly so the list should follow the leaves of
      the tree.

      I wasn't sure what would be the right way to implement generic
      (aka c++ template) so we could base at any >>*<<configparser
      class... so I will leave it for the future

   Attributes:
      **converters**
      **share_config**
   -[ Methods ]-

   +------------+--------------------------------------------------------------------------------------------+
   | "add_sect  | Create a new section in the configuration.                                                 |
   | ion"(self, |                                                                                            |
   | section)   |                                                                                            |
   +------------+--------------------------------------------------------------------------------------------+
   | "clear"(s  |                                                                                            |
   | elf)       |                                                                                            |
   +------------+--------------------------------------------------------------------------------------------+
   | "get"(sel  | Get an option value for a given section.                                                   |
   | f,         |                                                                                            |
   | section,   |                                                                                            |
   | option,    |                                                                                            |
   | \*[, raw,  |                                                                                            |
   | vars,      |                                                                                            |
   | ...])      |                                                                                            |
   +------------+--------------------------------------------------------------------------------------------+
   | "getint"(  |                                                                                            |
   | self,      |                                                                                            |
   | section,   |                                                                                            |
   | option,    |                                                                                            |
   | \*[, raw,  |                                                                                            |
   | ...])      |                                                                                            |
   +------------+--------------------------------------------------------------------------------------------+
   | "has_opti  | Check for the existence of a given option in a given section.                              |
   | on"(self,  |                                                                                            |
   | section,   |                                                                                            |
   | option)    |                                                                                            |
   +------------+--------------------------------------------------------------------------------------------+
   | "has_sect  | Indicate whether the named section is present in the configuration.                        |
   | ion"(self, |                                                                                            |
   | section)   |                                                                                            |
   +------------+--------------------------------------------------------------------------------------------+
   | "items"(s  | Return a list of (name, value) tuples for each option in a section.                        |
   | elf[,      |                                                                                            |
   | section,   |                                                                                            |
   | raw,       |                                                                                            |
   | vars])     |                                                                                            |
   +------------+--------------------------------------------------------------------------------------------+
   | "keys"(se  |                                                                                            |
   | lf)        |                                                                                            |
   +------------+--------------------------------------------------------------------------------------------+
   | "options"  | Return a list of option names for the given section name.                                  |
   | (self,     |                                                                                            |
   | section)   |                                                                                            |
   +------------+--------------------------------------------------------------------------------------------+
   | "pop"(sel  | If key is not found, d is returned if given, otherwise KeyError is raised.                 |
   | f, key[,   |                                                                                            |
   | default])  |                                                                                            |
   +------------+--------------------------------------------------------------------------------------------+
   | "popitem"  | Remove a section from the parser and return it as a (section_name, section_proxy) tuple.   |
   | (self)     |                                                                                            |
   +------------+--------------------------------------------------------------------------------------------+
   | "read"(se  | Read and parse a filename or an iterable of filenames.                                     |
   | lf, filen  |                                                                                            |
   | ames[, ge  |                                                                                            |
   | t_include  |                                                                                            |
   | s])        |                                                                                            |
   +------------+--------------------------------------------------------------------------------------------+
   | "read_dic  | Read configuration from a dictionary.                                                      |
   | t"(self,   |                                                                                            |
   | dictionar  |                                                                                            |
   | y[,        |                                                                                            |
   | source])   |                                                                                            |
   +------------+--------------------------------------------------------------------------------------------+
   | "read_fil  | Like read() but the argument must be a file-like object.                                   |
   | e"(self,   |                                                                                            |
   | f[,        |                                                                                            |
   | source])   |                                                                                            |
   +------------+--------------------------------------------------------------------------------------------+
   | "read_str  | Read configuration from a given string.                                                    |
   | ing"(self, |                                                                                            |
   | string[,   |                                                                                            |
   | source])   |                                                                                            |
   +------------+--------------------------------------------------------------------------------------------+
   | "readfp"(  | Deprecated, use read_file instead.                                                         |
   | self, fp[, |                                                                                            |
   | filename]) |                                                                                            |
   +------------+--------------------------------------------------------------------------------------------+
   | "remove_o  | Remove an option.                                                                          |
   | ption"(se  |                                                                                            |
   | lf,        |                                                                                            |
   | section,   |                                                                                            |
   | option)    |                                                                                            |
   +------------+--------------------------------------------------------------------------------------------+
   | "remove_s  | Remove a file section.                                                                     |
   | ection"(s  |                                                                                            |
   | elf,       |                                                                                            |
   | section)   |                                                                                            |
   +------------+--------------------------------------------------------------------------------------------+
   | "sections  | Return a list of section names, excluding [DEFAULT]                                        |
   | "(self)    |                                                                                            |
   +------------+--------------------------------------------------------------------------------------------+
   | "set"(sel  | Set an option.                                                                             |
   | f,         |                                                                                            |
   | section,   |                                                                                            |
   | option[,   |                                                                                            |
   | value])    |                                                                                            |
   +------------+--------------------------------------------------------------------------------------------+
   | "setdefau  |                                                                                            |
   | lt"(self,  |                                                                                            |
   | key[,      |                                                                                            |
   | default])  |                                                                                            |
   +------------+--------------------------------------------------------------------------------------------+
   | "update"(  | If E present and has a .keys() method, does:     for k in E: D[k] = E[k] If E present and  |
   | \*args,    | lacks .keys() method, does:     for (k, v) in E: D[k] = v In either case, this is followed |
   | \*\*kwds)  | by: for k, v in F.items(): D[k] = v                                                        |
   +------------+--------------------------------------------------------------------------------------------+
   | "values"(  |                                                                                            |
   | self)      |                                                                                            |
   +------------+--------------------------------------------------------------------------------------------+
   | "write"(s  | Write an .ini-format representation of the configuration state.                            |
   | elf, fp[,  |                                                                                            |
   | space_aro  |                                                                                            |
   | und_delim  |                                                                                            |
   | iters])    |                                                                                            |
   +------------+--------------------------------------------------------------------------------------------+

   +-------------------+------------+
   | **defaults**      |            |
   +-------------------+------------+
   | **get_defaults**  |            |
   +-------------------+------------+
   | **get_sections**  |            |
   +-------------------+------------+
   | **getboolean**    |            |
   +-------------------+------------+
   | **getfloat**      |            |
   +-------------------+------------+
   | **merge_section** |            |
   +-------------------+------------+
   | **optionxform**   |            |
   +-------------------+------------+

   BOOLEAN_STATES = {'0': False, '1': True, 'false': False, 'no': False, 'off': False, 'on': True, 'true': True, 'yes': True}

   NONSPACECRE = re.compile('\\S')

   OPTCRE = re.compile('\n        (?P<option>.*?)                    # very permissive!\n        \\s*(?P<vi>=|:)\\s*              # any number of space/tab,\n                                           # followed by any of t, re.VERBOSE)

   OPTCRE_NV = re.compile('\n        (?P<option>.*?)                    # very permissive!\n        \\s*(?:                             # any number of space/tab,\n        (?P<vi>=|:)\\s*                 # optionally followed , re.VERBOSE)

   SECTCRE = re.compile('\n        \\[                                 # [\n        (?P<header>[^]]+)                  # very permissive!\n        \\]                                 # ]\n        ', re.VERBOSE)

   SECTION_NAME = 'INCLUDES'

   add_section(self, section)

      Create a new section in the configuration.  Extends
      RawConfigParser.add_section by validating if the section name is
      a string.

   clear(self)

   property converters

   defaults(self)

   get(self, section, option, *, raw=False, vars=None, fallback=<object object at 0xfdef8cc8>)

      Get an option value for a given section.

      If >>`<<vars' is provided, it must be a dictionary. The option
      is looked up in >>`<<vars' (if provided), >>`<<section', and in
      >>`<<DEFAULTSECT' in that order. If the key is not found and
      >>`<<fallback' is provided, it is used as a fallback value.
      >>`<<None' can be provided as a >>`<<fallback' value.

      If interpolation is enabled and the optional argument >>`<<raw'
      is False, all interpolations are expanded in the return values.

      Arguments >>`<<raw', >>`<<vars', and >>`<<fallback' are keyword
      only.

      The section DEFAULT is special.

   get_defaults(self)

   get_sections(self)

   getboolean(self, section, option, *, raw=False, vars=None, fallback=<object object at 0xfdef8cc8>, **kwargs)

   getfloat(self, section, option, *, raw=False, vars=None, fallback=<object object at 0xfdef8cc8>, **kwargs)

   getint(self, section, option, *, raw=False, vars=None, fallback=<object object at 0xfdef8cc8>, **kwargs)

   has_option(self, section, option)

      Check for the existence of a given option in a given section. If
      the specified >>`<<section' is None or an empty string, DEFAULT
      is assumed. If the specified >>`<<section' does not exist,
      returns False.

   has_section(self, section)

      Indicate whether the named section is present in the
      configuration.

      The DEFAULT section is not acknowledged.

   items(self, section=<object object at 0xfdef8cc8>, raw=False, vars=None)

      Return a list of (name, value) tuples for each option in a
      section.

      All % interpolations are expanded in the return values, based on
      the defaults passed into the constructor, unless the optional
      argument >>`<<raw' is true.  Additional substitutions may be
      provided using the >>`<<vars' argument, which must be a
      dictionary whose contents overrides any pre-existing defaults.

      The section DEFAULT is special.

   keys(self)

   merge_section(self, section, options, pref='known/')

   options(self, section)

      Return a list of option names for the given section name.

   optionxform(self, optionstr)

   pop(self, key, default=<object object at 0xfdef80c0>)

      If key is not found, d is returned if given, otherwise KeyError
      is raised.

   popitem(self)

      Remove a section from the parser and return it as a
      (section_name, section_proxy) tuple. If no section is present,
      raise KeyError.

      The section DEFAULT is never returned because it cannot be
      removed.

   read(self, filenames, get_includes=True)

      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.

   read_dict(self, dictionary, source='<dict>')

      Read configuration from a dictionary.

      Keys are section names, values are dictionaries with keys and
      values that should be present in the section. If the used
      dictionary type preserves order, sections and their keys will be
      added in order.

      All types held in the dictionary are converted to strings during
      reading, including section names, option names and keys.

      Optional second argument is the >>`<<source' specifying the name
      of the dictionary being read.

   read_file(self, f, source=None)

      Like read() but the argument must be a file-like object.

      The >>`<<f' argument must be iterable, returning one line at a
      time. Optional second argument is the >>`<<source' specifying
      the name of the file being read. If not given, it is taken from
      f.name. If >>`<<f' has no >>`<<name' attribute, >>`<<<???>' is
      used.

   read_string(self, string, source='<string>')

      Read configuration from a given string.

   readfp(self, fp, filename=None)

      Deprecated, use read_file instead.

   remove_option(self, section, option)

      Remove an option.

   remove_section(self, section)

      Remove a file section.

   sections(self)

      Return a list of section names, excluding [DEFAULT]

   set(self, section, option, value=None)

      Set an option.  Extends RawConfigParser.set by validating type
      and interpolation syntax on the value.

   setdefault(self, key, default=None)

   property share_config

   update(*args, **kwds)

      If E present and has a .keys() method, does:     for k in E:
      D[k] = E[k] If E present and lacks .keys() method, does:     for
      (k, v) in E: D[k] = v In either case, this is followed by: for
      k, v in F.items(): D[k] = v

   values(self)

   write(self, fp, space_around_delimiters=True)

      Write an .ini-format representation of the configuration state.

      If >>`<<space_around_delimiters' is True (the default),
      delimiters between keys and values are surrounded by spaces.
