Skip to content

Commit 4285fbf

Browse files
committed
Testing cordinates
1 parent 68dfa7a commit 4285fbf

File tree

2 files changed

+21
-11
lines changed

2 files changed

+21
-11
lines changed

app/coordinates.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,21 @@ def __init__(self, latitude, longitude):
1010
self.latitude = latitude
1111
self.longitude = longitude
1212

13-
def serialize(self):
13+
class Serialize:
14+
def serialize(self,latitude,longitude):
1415
"""
1516
Serializes the coordinates into a dict.
1617
1718
:returns: The serialized coordinates.
1819
:rtype: dict
1920
"""
20-
return {"latitude": self.latitude, "longitude": self.longitude}
21+
self.latitude=latitude
22+
self.longitude=longitude
23+
24+
return {self.latitude,self.longitude}
2125

2226
def __str__(self):
2327
return "lat: %s, long: %s" % (self.latitude, self.longitude)
28+
29+
latitude = Coordinates("latitude")
30+
longitude= Coordinates("longitude")

app/data/__init__.py

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,20 @@
22
from ..services.location.csbs import CSBSLocationService
33
from ..services.location.jhu import JhuLocationService
44
from ..services.location.nyt import NYTLocationService
5-
from ..services.location import LocationService
65

76
# Mapping of services to data-sources.
8-
class DATA_SOURCES:
9-
data_SOURCES = {}
7+
DATA_SOURCES = {
8+
"jhu": JhuLocationService(),
9+
"csbs": CSBSLocationService(),
10+
"nyt": NYTLocationService(),
11+
}
1012

11-
def data(self):
12-
self.data_SOURCES['jhu'] = JhuLocationService()
13-
self.data_SOURCES['csbs'] = CSBSLocationService()
14-
self.data_SOURCES['nyt'] = NYTLocationService()
1513

16-
def data_source(self, source: str)-> LocationService:
14+
def data_source(source):
15+
"""
16+
Retrieves the provided data-source service.
1717
18-
return self.data_SOURCES.get(source.lower())
18+
:returns: The service.
19+
:rtype: LocationService
20+
"""
21+
return DATA_SOURCES.get(source.lower())

0 commit comments

Comments
 (0)