datajoint / datajoint-docs-original

https://docs.datajoint.org
Other
2 stars 13 forks source link

document use of python config object as contextmanager #227

Open ixcat opened 4 years ago

ixcat commented 4 years ago

this is documented in actual code, but not in docs. probably should have some kind of cross link with #226

ixcat commented 4 years ago

from datajoint/settings.py:

        """
        The config object can also be used in a with statement to change the state of the configuration
        temporarily. kwargs to the context manager are the keys into config, where '.' is replaced by a
        double underscore '__'. The context manager yields the changed config object.
        Example:
        >>> import datajoint as dj
        >>> with dj.config(safemode=False, database__host="localhost") as cfg:
        >>>     # do dangerous stuff here
        """