Low-level State functions

In general there is little need to touch these unless you want to alter some assumed defaults.

Module for handling consistent state storage.

cozify.config.state_path

file path where state storage is kept. By default XDG conventions are used. (Most likely ~/.config/python-cozify/python-cozify.cfg)

Type:str
cozify.config.state

State object used for in-memory state. By default initialized with _initState.

Type:configparser.ConfigParser
cozify.config.latest_version

Current up to date version number. Anything encountered lower than this will go through autoconversion.

Type:int
cozify.config.commit(tmpstate=None)[source]

Write current state to file storage.

Parameters:tmpstate (configparser.ConfigParser) – State object to store instead of default state.
cozify.config.dump()[source]

Print out current state file to stdout. Long values are truncated since this is only for visualization.

cozify.config.set_state_path(filepath=None, copy_current=False)[source]

Set state storage path. Useful for example for testing without affecting your normal state. Call with no arguments to reset back to autoconfigured location.

Parameters:
  • filepath (str) – file path to use as new storage location. Defaults to XDG defined path.
  • copy_current (bool) – Instead of initializing target file, dump previous state into it.
cozify.config.version(new_version=None)[source]

Return or manipulate current config version.

Parameters:new_version (int) – New version number to assume for the current config. You probably don’t want to do this!