waterbutler.core package¶
waterbutler.core.auth module¶
waterbutler.core.exceptions module¶
waterbutler.core.log_payload module¶
waterbutler.core.logging module¶
-
class
waterbutler.core.logging.
MaskFormatter
(fmt=None, datefmt=None, style='%', pattern=None, mask='***')[source]¶ Bases:
logging.Formatter
-
format
(record)[source]¶ Format the specified record as text.
The record’s attribute dictionary is used as the operand to a string formatting operation which yields the returned string. Before formatting the dictionary, a couple of preparatory steps are carried out. The message attribute of the record is computed using LogRecord.getMessage(). If the formatting string uses the time (as determined by a call to usesTime(), formatTime() is called to format the event time. If there is exception information, it is formatted using formatException() and appended to the message.
-
waterbutler.core.metadata module¶
waterbutler.core.metrics module¶
-
class
waterbutler.core.metrics.
MetricsBase
[source]¶ Bases:
object
Lightweight wrapper around a dict to make keeping track of metrics a little easier.
Current functionality is limited, but may be extended later. To do:
update/override method to indicate expectations of existing key
self.metrics.add_default(‘some.flag’, True) <later> self.metrics.override(‘some.flag’, False) # dies if ‘some.flag’ doesn’t already exist
optional type validation?
self.metrics.add(‘some.flag’, True, bool()) -or- self.metrics.define(‘some.flag’, bool()) <later> self.metrics.add(‘some.flag’, ‘foobar’) # dies, ‘foobar’ isn’t a bool
-
add
(key, value)[source]¶ add() stores the given value under the given key. Subkeys can be specified by placing a dot between the parent and child keys. e.g. ‘foo.bar’ will be interpreted as
self._metrics['foo']['bar']
Parameters: - key (str) – the key to store
value
under - value – the value to store, type unrestricted
- key (str) – the key to store
-
incr
(key)[source]¶ incr() increments the value stored in key, or initializes it to 1 if it has not yet been set.
Parameters: key (str) – the key to increment the value
of
-
append
(key, new_value)[source]¶ Assume key points to a list and append
new_value
to it. Will initialize a list if key is undefined. Type homogeneity of list members is not enforced.Parameters: - key (str) – the key to store
value
under - value – the value to store, type unrestricted
- key (str) – the key to store
-
class
waterbutler.core.metrics.
MetricsRecord
(category)[source]¶ Bases:
waterbutler.core.metrics.MetricsBase
An extension to MetricsBase that carries a category and list of submetrics. When serialized, will include the serialized child metrics
-
key
¶ ID string for this record: ‘{category}’
-
-
class
waterbutler.core.metrics.
MetricsSubRecord
(category, name)[source]¶ Bases:
waterbutler.core.metrics.MetricsRecord
An extension to MetricsRecord that carries a name in addition to a category. Will identify itself as {category}_{name}. Can create its own subrecord whose category will be this subrecord’s
name
.-
key
¶ ID string for this subrecord: ‘{category}_{name}’
-
new_subrecord
(name)[source]¶ Creates and saves a new subrecord. The new subrecord will have its category set to the parent subrecord’s
name
. ex:parent = MetricsRecord('foo') child = parent.new_subrecord('bar') grandchild = child.new_subrecord('baz') print(parent.key) # foo print(child.key) # foo_bar print(grandchild.key) # bar_baz
-
waterbutler.core.path module¶
waterbutler.core.provider module¶
waterbutler.core.remote_logging module¶
waterbutler.core.signing module¶
-
waterbutler.core.signing.
order_recursive
(data)[source]¶ Recursively sort keys of input data and all its nested dictionaries. Used to ensure consistent ordering of JSON payloads.