forked from ExpDev07/coronavirus-tracker-api
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnyt.py
More file actions
32 lines (24 loc) · 909 Bytes
/
nyt.py
File metadata and controls
32 lines (24 loc) · 909 Bytes
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
"""app.locations.nyt.py"""
from . import TimelinedLocation
class NYTLocation(TimelinedLocation):
"""
A NYT (county) Timelinedlocation.
"""
# pylint: disable=too-many-arguments,redefined-builtin
def __init__(self, id, state, county, coordinates, last_updated, timelines):
super().__init__(id, "US", state, coordinates, last_updated, timelines)
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(timelines)
# Update with new fields.
serialized.update(
{"state": self.state, "county": self.county,}
)
# Return the serialized location.
return serialized