pyexperiment.State¶
- class pyexperiment.State(filename=None)[source]¶
Represents persistent state of an experiment.
Methods
__init__([filename]) Initializer base_keys() Returns the keys of the first level of the mapping clear(() -> None. Remove all items from D.) do_rollover(filename[, rotate_n_state_files]) Rotate state files (as in logging module). get(key[, default]) Get the key or return the default value if provided get_instance() Get the singleton instance get_or_set(key, value) Either gets the value associated with key or set it items(() -> list of D’s (key, value) pairs, ...) iteritems(() -> an iterator over the (key, ...) iterkeys(() -> an iterator over the keys of D) itervalues(...) keys(() -> list of D’s keys) load([filename, lazy, raise_error]) Loads state from a h5f file merge(other) Merge in another mapping, giving precedence to self need_saving() Checks if state needs to be saved pop((k[,d]) -> v, ...) If key is not found, d is returned if given, otherwise KeyError is raised. popitem(() -> (k, v), ...) as a 2-tuple; but raise KeyError if D is empty. reset_instance() Reset the singleton save(filename[, rotate_n_state_files, ...]) Saves state to a h5f file, rotating if necessary section_keys() Returns the keys of the sections (and subsections) of the mapping setdefault((k[,d]) -> D.get(k,d), ...) show() Shows the state update(([E, ...) If E present and has a .keys() method, does: for k in E: D[k] = E[k] values(() -> list of D’s values) Attributes
SECTION_SEPARATOR