:mod:`khard.config`
===================

.. py:module:: khard.config

.. autoapi-nested-parse::

   Loading and validation of the configuration file



Module Contents
---------------


.. data:: logger
   

   

.. py:exception:: ConfigError

   Bases: :class:`Exception`

   Errors during config file parsing


.. function:: validate_command(value: List[str]) -> List[str]

   Special validator to check shell commands

   The input must either be a list of strings or a string that shlex.split can
   parse into such.

   :param value: the config value to validate
   :returns: the command after validation
   :raises: validate.ValidateError


.. function:: validate_action(value: str) -> str

   Check that the given value is a valid action.

   :param value: the config value to check
   :returns: the same value
   :raises: validate.ValidateError


.. function:: validate_private_objects(value: List[str]) -> List[str]

   Check that the private objects are reasonable

   :param value: the config value to check
   :returns: the list of private objects
   :raises: validate.ValidateError


.. py:class:: Config(config_file: Optional[str] = None)

   Parse and validate the config file with configobj.

   .. attribute:: supported_vcard_versions
      :annotation: = ['3.0', '4.0']

      

   .. method:: _load_config_file(cls, config_file: Optional[str])
      :classmethod:


      Find and load the config file.

      :param config_file: the path to the config file to load
      :returns: the loaded config file


   .. method:: _validate(config: configobj.ConfigObj)
      :staticmethod:



   .. method:: _set_attributes(self)


      Set the attributes from the internal config instance on self.


   .. method:: init_address_books(self)


      Initialize the internal address book collection.

      This method should only be called *after* merging in the command line
      options as they can hold some options that are relevant for the loading
      of the address books.


   .. method:: get_address_books(self, names: Iterable[str], queries: Dict[str, Query])


      Load all address books with the given names.

      :param names: the address books to load
      :param queries: a mapping of address book names to search queries
      :returns: the loaded address books


   .. method:: merge(self, other: Union[configobj.ConfigObj, Dict])


      Merge the config with some other dict or ConfigObj

      :param other: the other dict or ConfigObj to merge into self
      :returns: None


   .. method:: merge_args(self, args: Namespace)


      Merge options from a flat argparse object.

      :param argparse.Namespace args: the parsed arguments to incorperate



