botlib.object¶
JSON file backed objectect with dotted access.
Exceptions
ENODATE |
date cannot be determined. |
ENOJSON |
string cannot be _parsed as JSON. |
-
class
Config
(*args, **kwargs)[source]¶ Bases:
botlib.object.Default
A Config objectect can read previous cfg from disk.
-
class
Default
(*args, **kwargs)[source]¶ Bases:
botlib.object.Object
A object with a “default” set. Standard default return is Object().
-
class
Object
(*args, **kwargs)[source]¶ Bases:
dict
Dict with dotted access instead of brackets, with json files to sync and load from.
-
grep
(val)[source]¶ Grep for a matching stringified value, return a Object with those matching values.
-
load
(path, force=False, skip=[], full=True)[source]¶ Load a json file into this object. use skip as a list of keys to skip.
-
prepare
()[source]¶ - Prepare the object and return a string containing the “data” part.Keyword can be “prefix” when using a subdirectory.Use “saved” when savestamp need to be different from the “now” timestamp.
-
printable
(keys=[], skip=[], nokeys=False)[source]¶ Determine from provided keys list and/or from skipping from a skiplist a displayable string from those attributes.
-
read
(path)[source]¶ Read a json dump from given path, returning the json string with comments stripped.
-
register
(key, val, force=False)[source]¶ Register key, value and throw an exception is value is already set.
-
sync
(*args, **kwargs)¶
-