anki.config
===========

.. py:module:: anki.config

.. autoapi-nested-parse::

   Config handling

   - To set a config value, use col.set_config(key, val).
   - To get a config value, use col.get_config(key, default=None). In
   the case of lists and dictionaries, any changes you make to the returned
   value will not be saved unless you call set_config().
   - To remove a config value, use col.remove_config(key).

   For legacy reasons, the config is also exposed as a dict interface
   as col.conf.  To support old code that was mutating inner values,
   using col.conf["key"] needs to wrap lists and dicts when returning them.
   As this is less efficient, please use the col.*_config() API in new code.
   The legacy set also does not support the new undo handling.



Attributes
----------

.. autoapisummary::

   anki.config.Config


Classes
-------

.. autoapisummary::

   anki.config.ConfigManager
   anki.config.WrappedList
   anki.config.WrappedDict


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

.. py:data:: Config

.. py:class:: ConfigManager(col: anki.collection.Collection)

   .. py:attribute:: col


   .. py:method:: get_immutable(key: str) -> Any


   .. py:method:: set(key: str, val: Any) -> None


   .. py:method:: remove(key: str) -> anki.collection.OpChanges


   .. py:method:: get(key: str, default: Any | None = None) -> Any


   .. py:method:: setdefault(key: str, default: Any) -> Any


.. py:class:: WrappedList(conf: weakref.ref[ConfigManager], key: str, val: Any)

   Bases: :py:obj:`list`


   Built-in mutable sequence.

   If no argument is given, the constructor creates a new empty list.
   The argument must be an iterable if specified.


   .. py:attribute:: key


   .. py:attribute:: conf


   .. py:attribute:: orig


.. py:class:: WrappedDict(conf: weakref.ref[ConfigManager], key: str, val: Any)

   Bases: :py:obj:`dict`


   dict() -> new empty dictionary
   dict(mapping) -> new dictionary initialized from a mapping object's
       (key, value) pairs
   dict(iterable) -> new dictionary initialized as if via:
       d = {}
       for k, v in iterable:
           d[k] = v
   dict(**kwargs) -> new dictionary initialized with the name=value pairs
       in the keyword argument list.  For example:  dict(one=1, two=2)


   .. py:attribute:: key


   .. py:attribute:: conf


   .. py:attribute:: orig


