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

.. py:module:: khard.config

.. autoapi-nested-parse::

   Loading and validation of the configuration file



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

Classes
~~~~~~~

.. autoapisummary::

   khard.config.Config



Functions
~~~~~~~~~

.. autoapisummary::

   khard.config.validate_command
   khard.config.validate_action
   khard.config.validate_private_objects



Attributes
~~~~~~~~~~

.. autoapisummary::

   khard.config.logger


.. py:data:: logger
   

   

.. py:exception:: ConfigError

   Bases: :py:obj:`Exception`

   Errors during config file parsing


.. py: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


.. py: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


.. py: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.

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

      

   .. py:method:: _load_config_file(config_file: Optional[str]) -> configobj.ConfigObj
      :classmethod:

      Find and load the config file.

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


   .. py:method:: _validate(config: configobj.ConfigObj) -> configobj.ConfigObj
      :staticmethod:


   .. py:method:: _set_attributes() -> None

      Set the attributes from the internal config instance on self.


   .. py:method:: init_address_books() -> None

      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.


   .. py:method:: get_address_books(names: Iterable[str], queries: Dict[str, khard.query.Query]) -> khard.address_book.AddressBookCollection

      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


   .. py:method:: merge(other: Union[configobj.ConfigObj, Dict]) -> None

      Merge the config with some other dict or ConfigObj

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


   .. py:method:: merge_args(args: argparse.Namespace) -> None

      Merge options from a flat argparse object.

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



