FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
python-thingserver/thingserver/event.py at master · labthings/python-thingserver · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
This repository was archived by the owner on Jun 7, 2021. It is now read-only.
labthings
/
python-thingserver
Public archive
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Issues
1
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
python-thingserver
/
thingserver
/
event.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
51 lines (38 loc) · 1.19 KB
Breadcrumbs
python-thingserver
/
thingserver
/
event.py
Copy path
File metadata and controls
51 lines (38 loc) · 1.19 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
Back
|
FazBrowse Home
|
New Git URL