Skip to content

datar.core.options

module

datar.core.options

Provide options

Functions
  • add_option(x, default) Add an option</>
  • get_option(x, default) (Any) Get the current value set for option x,or default (which defaults to NULL) if the option is unset. </>
  • options(*args, _return, **kwargs) (Mapping) Allow the user to set and examine a variety of global options</>
  • options_context(**kwargs) A context manager to execute code with temporary options</>
function

datar.core.options.options(*args, _return=None, **kwargs)

Allow the user to set and examine a variety of global options

Parameters
  • *args (Union) Names of options to return
  • _return (bool, optional) Whether return the options.If None, turned to True when option names provided in args.
  • **kwargs (Any) name-value pair to create/set an option
Returns (Mapping)

The options before updating if _return is True.

generator

datar.core.options.options_context(**kwargs)

A context manager to execute code with temporary options

Note that this is not thread-safe.

function

datar.core.options.get_option(x, default=None) → Any

Get the current value set for option x,or default (which defaults to NULL) if the option is unset.

Parameters
  • x (str) The name of the option
  • default (Any, optional) The default value if x is unset
function

datar.core.options.add_option(x, default=None)

Add an option

Parameters
  • x (str) The name of the option
  • default (Any, optional) The default value if x is unset