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

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

   Bases: "ConfigParser.SafeConfigParser"

      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 ]-

   +------------+--------------------------------------------------------------------------------------------+
   | "share_co  |                                                                                            |
   | nfig"      |                                                                                            |
   +------------+--------------------------------------------------------------------------------------------+

   -[ Methods ]-

   +------------+--------------------------------------------------------------------------------------------+
   | "add_sect  | Create a new section in the configuration.                                                 |
   | ion"(sect  |                                                                                            |
   | ion)       |                                                                                            |
   +------------+--------------------------------------------------------------------------------------------+
   | "defaults  |                                                                                            |
   | "()        |                                                                                            |
   +------------+--------------------------------------------------------------------------------------------+
   | "get"(sec  | Get an option value for a given section.                                                   |
   | tion,      |                                                                                            |
   | option[,   |                                                                                            |
   | raw,       |                                                                                            |
   | vars])     |                                                                                            |
   +------------+--------------------------------------------------------------------------------------------+
   | "get_defa  |                                                                                            |
   | ults"()    |                                                                                            |
   +------------+--------------------------------------------------------------------------------------------+
   | "get_sect  |                                                                                            |
   | ions"()    |                                                                                            |
   +------------+--------------------------------------------------------------------------------------------+
   | "getboole  |                                                                                            |
   | an"(secti  |                                                                                            |
   | on,        |                                                                                            |
   | option)    |                                                                                            |
   +------------+--------------------------------------------------------------------------------------------+
   | "getfloat  |                                                                                            |
   | "(section, |                                                                                            |
   | option)    |                                                                                            |
   +------------+--------------------------------------------------------------------------------------------+
   | "getint"(  |                                                                                            |
   | section,   |                                                                                            |
   | option)    |                                                                                            |
   +------------+--------------------------------------------------------------------------------------------+
   | "has_opti  | Check for the existence of a given option in a given section.                              |
   | on"(secti  |                                                                                            |
   | on,        |                                                                                            |
   | option)    |                                                                                            |
   +------------+--------------------------------------------------------------------------------------------+
   | "has_sect  | Indicate whether the named section is present in the configuration.                        |
   | ion"(sect  |                                                                                            |
   | ion)       |                                                                                            |
   +------------+--------------------------------------------------------------------------------------------+
   | "items"(s  | Return a list of tuples with (name, value) for each option in the section.                 |
   | ection[,   |                                                                                            |
   | raw,       |                                                                                            |
   | vars])     |                                                                                            |
   +------------+--------------------------------------------------------------------------------------------+
   | "merge_se  |                                                                                            |
   | ction"(se  |                                                                                            |
   | ction,     |                                                                                            |
   | options[,  |                                                                                            |
   | pref])     |                                                                                            |
   +------------+--------------------------------------------------------------------------------------------+
   | "options"  | Return a list of option names for the given section name.                                  |
   | (section)  |                                                                                            |
   +------------+--------------------------------------------------------------------------------------------+
   | "optionxf  |                                                                                            |
   | orm"(opti  |                                                                                            |
   | onstr)     |                                                                                            |
   +------------+--------------------------------------------------------------------------------------------+
   | "read"(fi  |                                                                                            |
   | lenames[,  |                                                                                            |
   | get_inclu  |                                                                                            |
   | des])      |                                                                                            |
   +------------+--------------------------------------------------------------------------------------------+
   | "readfp"(  | Like read() but the argument must be a file-like object.                                   |
   | fp[,       |                                                                                            |
   | filename]) |                                                                                            |
   +------------+--------------------------------------------------------------------------------------------+
   | "remove_o  | Remove an option.                                                                          |
   | ption"(se  |                                                                                            |
   | ction,     |                                                                                            |
   | option)    |                                                                                            |
   +------------+--------------------------------------------------------------------------------------------+
   | "remove_s  | Remove a file section.                                                                     |
   | ection"(s  |                                                                                            |
   | ection)    |                                                                                            |
   +------------+--------------------------------------------------------------------------------------------+
   | "sections  | Return a list of section names, excluding [DEFAULT]                                        |
   | "()        |                                                                                            |
   +------------+--------------------------------------------------------------------------------------------+
   | "set"(sec  | Set an option.                                                                             |
   | tion,      |                                                                                            |
   | option[,   |                                                                                            |
   | value])    |                                                                                            |
   +------------+--------------------------------------------------------------------------------------------+
   | "write"(f  | Write an .ini-format representation of the configuration state.                            |
   | p)         |                                                                                            |
   +------------+--------------------------------------------------------------------------------------------+

   OPTCRE = <_sre.SRE_Pattern object at 0x7ae8c180>

   OPTCRE_NV = <_sre.SRE_Pattern object at 0x7b06ee80>

   SECTCRE = <_sre.SRE_Pattern object at 0x7af10890>

   SECTION_NAME = 'INCLUDES'

   add_section(section)

      Create a new section in the configuration.

      Raise DuplicateSectionError if a section by the specified name
      already exists. Raise ValueError if name is DEFAULT or any of
      it's case-insensitive variants.

   defaults()

   get(section, option, raw=False, vars=None)

      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
      >>`<<defaults' in that order.

      All % interpolations are expanded in the return values, unless
      the optional argument >>`<<raw' is true. Values for
      interpolation keys are looked up in the same manner as the
      option.

      The section DEFAULT is special.

   get_defaults()

   get_sections()

   getboolean(section, option)

   getfloat(section, option)

   getint(section, option)

   has_option(section, option)

      Check for the existence of a given option in a given section.

   has_section(section)

      Indicate whether the named section is present in the
      configuration.

      The DEFAULT section is not acknowledged.

   items(section, raw=False, vars=None)

      Return a list of tuples with (name, value) for each option in
      the 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.

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

   options(section)

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

   optionxform(optionstr)

   read(filenames, get_includes=True)

   readfp(fp, filename=None)

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

      The >>`<<fp' argument must have a >>`<<readline' method.
      Optional second argument is the >>`<<filename', which if not
      given, is taken from fp.name.  If fp has no >>`<<name'
      attribute, >>`<<<???>' is used.

   remove_option(section, option)

      Remove an option.

   remove_section(section)

      Remove a file section.

   sections()

      Return a list of section names, excluding [DEFAULT]

   set(section, option, value=None)

      Set an option.  Extend ConfigParser.set: check for string
      values.

   share_config

   write(fp)

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