forked from ExpDev07/coronavirus-tracker-api
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcsbs.py
More file actions
43 lines (35 loc) · 1.06 KB
/
csbs.py
File metadata and controls
43 lines (35 loc) · 1.06 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
"""app.locations.csbs.py"""
from . import Location
class CSBSLocation(Location):
"""
A CSBS (county) location.
"""
# pylint: disable=too-many-arguments,redefined-builtin
def __init__(self, id, state, county, coordinates, last_updated, confirmed, deaths):
super().__init__(
# General info.
id,
"US",
state,
coordinates,
last_updated,
# Statistics.
confirmed=confirmed,
deaths=deaths,
recovered=0,
)
self.state = state
self.county = county
def serialize(self, timelines=False): # pylint: disable=arguments-differ,unused-argument
"""
Serializes the location into a dict.
:returns: The serialized location.
:rtype: dict
"""
serialized = super().serialize()
# Update with new fields.
serialized.update(
{"state": self.state, "county": self.county,}
)
# Return the serialized location.
return serialized