upsies.jobs.set

Manage configuration files

Classes

class upsies.jobs.set.SetJob(*, home_directory=None, cache_directory=None, cache_id='', ignore_cache=False, no_output_is_ok=False, hidden=False, autostart=True, guaranteed=False, precondition=None, prejobs=(), callbacks={}, **kwargs)[source]

Bases: JobBase

Display or change configuration file option

cache_id = None
initialize(*, config, option=None, value=(), reset=None, dump=())[source]

Set and display option(s)

Parameters:
  • configConfigBase instance

  • option (str) – “.”-delimited path to option in config or None

  • value

    New value for option or any falsy value to display the current value

    If value is a sequence and option is not, the items are joined with a space. If value is not a sequence and option is, value is turned into a sequence with the single item value.

  • reset (bool) – Whether to reset option to default value and ignore value

  • dump (bool) –

    Sequence of sections in config

    Read and write configuration the files associated with each section. Default values are commented out so the user can easily edit each file.

If only config is given, display all options and values.

If option is given, only display its value.

If option and value is given, set option to value and display the new value.

If dump is given, it is a sequence of sections. For each section, the corresponding file is written.

async run()[source]

Do the work

This method is called by start(). Its coroutine is passed to add_task().

Any keyword arguments passed to initialize() are available via kwargs.

The job is_finished when all added tasks are done or cancelled. (See also finalize() and finalization().)

This method may call add_task() if more tasks are required.