Create an event. Notes: An event is simply a dictionary: the only required field is ``type``. A ``timestamp`` field will be set to the current time if not provided.
(type, _fields=None, __dict__=dict, __now__=time.time, **fields)
| 16 | |
| 17 | |
| 18 | def Event(type, _fields=None, __dict__=dict, __now__=time.time, **fields): |
| 19 | """Create an event. |
| 20 | |
| 21 | Notes: |
| 22 | An event is simply a dictionary: the only required field is ``type``. |
| 23 | A ``timestamp`` field will be set to the current time if not provided. |
| 24 | """ |
| 25 | event = __dict__(_fields, **fields) if _fields else fields |
| 26 | if 'timestamp' not in event: |
| 27 | event.update(timestamp=__now__(), type=type) |
| 28 | else: |
| 29 | event['type'] = type |
| 30 | return event |
| 31 | |
| 32 | |
| 33 | def group_from(type): |