GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — python-thingserver/thingserver/event.py at master · labthings/python-thingserver
This repository was archived by the owner on Jun 7, 2021. It is now read-only.
Expand file tree/ Copy pathevent.pyMore file actions 51 lines (38 loc) · 1.19 KB / Copy pathevent.pyFile metadata and controls51 lines (38 loc) · 1.19 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 """High-level Event base class implementation.""" from .utils import timestamp class Event: """An Event represents an individual event from a thing.""" def __init__(self, thing, name, data=None): """ Initialize the object. thing -- Thing this event belongs to name -- name of the event data -- data associated with the event """ self.thing = thing self.name = name self.data = data self.time = timestamp() def as_event_description(self): """ Get the event description. Returns a dictionary describing the event. """ description = { {"event": self.name, "timestamp": self.time,} } if self.data is not None: description["data"] = self.data return description def get_thing(self): """Get the thing associated with this event.""" return self.thing def get_name(self): """Get the event's name.""" return self.name def get_data(self): """Get the event's data.""" return self.data def get_time(self): """Get the event's timestamp.""" return self.time |
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |