Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 9 additions & 13 deletions app/data/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,16 @@
from ..services.location.csbs import CSBSLocationService
from ..services.location.jhu import JhuLocationService
from ..services.location.nyt import NYTLocationService
from ..services.location import LocationService

# Mapping of services to data-sources.
DATA_SOURCES = {
"jhu": JhuLocationService(),
"csbs": CSBSLocationService(),
"nyt": NYTLocationService(),
}
class DATA_SOURCES:
DATA_SOURCES = {}

def data(self)
self.DATA_SOURCES['jhu'] = JhuLocationService()
self.DATA_SOURCES['csbs'] = CSBSLocationService()
self.DATA_SOURCES['nyt'] = NYTLocationService()

def data_source(source):
"""
Retrieves the provided data-source service.

:returns: The service.
:rtype: LocationService
"""
return DATA_SOURCES.get(source.lower())
def data_source(self, source : str)-> LocationService:
return self.DATA_SOURCES.get(source.lower())