This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import time | |
| from contextlib import contextmanager | |
| class TimedResult(object): | |
| def __init__(self): | |
| self.started = None | |
| self.stopped = None | |
| def start(self): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Struct(object): | |
| def __init__(self, **kwargs): | |
| self.update(kwargs) | |
| def update(self, d): | |
| self.__dict__.update(d) | |
| def __repr__(self): | |
| return 'Struct(%s)' % ', '.join('%s=%s' % (k, repr(v)) for (k,v) in | |
| def __len__(self): | |
| return len(self.__dict__) |