System-level utilities and helper functions.
Bases: object
A pluggable backend loaded lazily based on some value.
Bases: object
Bases: exceptions.Exception
The poll-function passed to LoopingCall can raise this exception to break out of the loop normally. This is somewhat analogous to StopIteration.
An optional return-value can be included as the argument to the exception; this return-value will be returned by LoopingCall.wait()
Advance overriden time using a datetime.timedelta.
Advance overriden time by seconds.
Checks that obj is of type cls, and lets PyLint infer types
Remove the overridden time.
Recursively flatten a nested dictionary
Generate a random password from the supplied symbols.
Believed to be reasonably secure (with a reasonable password length!)
Returns a list of items matching the specified path. Takes an XPath-like expression e.g. prop1/prop2/prop3, and for each item in items, looks up items[prop1][prop2][prop3]. Like XPath, if any of the intermediate results are lists it will treat each list item individually. A ‘None’ in items or any child expressions will be ignored, this function will not throw because of None (anywhere) in items. The returned list will contain no None values.
Returns a class from a string including module and class
Returns an object including a module or module and class
Return True if before is older than seconds
Returns iso formatted utcnow.
Return a dictionary in which the dictionaries keys are mapped to new keys.
Turn an iso formatted time back into a datetime
Return two dicts, one containing only keys the other containing everything but keys
Override utils.utcnow to return a constant time.
Return a dict that only contains a subset of keys
Synchronization decorator
Decorating a method like so: @synchronized(‘mylock’) def foo(self, *args):
...
ensures that only one thread will execute the bar method at a time.
Different methods can share the same lock: @synchronized(‘mylock’) def foo(self, *args):
...
@synchronized(‘mylock’) def bar(self, *args):
...
This way only one of either foo or bar can be executing at a time.
The external keyword argument denotes whether this lock should work across multiple processes. This means that if two different workers both run a a method decorated with @synchronized(‘mylock’, external=True), only one of them will execute at a time.
Overridable version of datetime.datetime.utcnow.
Timestamp version of our utcnow function.
Try to turn a string into utf-8 if possible.
Code is directly from the utf8 function in http://github.com/facebook/tornado/blob/master/tornado/escape.py
Sends a vpn negotiation packet and returns the server session.
Returns False on a failure. Basic packet structure is below.
x | cli_id |
x = packet identifier 0x38 cli_id = 64 bit identifier ? = unknown, probably flags/padding
x | srv_id | cli_id |
x = packet identifier 0x40 cli_id = 64 bit identifier ? = unknown, probably flags/padding bit 9 was 1 and the rest were 0 in testing
Escapes a string so it is valid within XML or XHTML.
Code is directly from the utf8 function in http://github.com/facebook/tornado/blob/master/tornado/escape.py