File tree Expand file tree Collapse file tree 1 file changed +23
-6
lines changed
Expand file tree Collapse file tree 1 file changed +23
-6
lines changed Original file line number Diff line number Diff line change 11"""app.data"""
2+ from ..services .location import LocationService
23from ..services .location .csbs import CSBSLocationService
34from ..services .location .jhu import JhuLocationService
45from ..services .location .nyt import NYTLocationService
56
6- # Mapping of services to data-sources.
7+ class dataSourceFactory ():
8+ def getDataSource ():
9+ return LocationService ()
10+
11+ class JhuFactory (dataSourceFactory ):
12+ def getDataSource ():
13+ return JhuLocationService ()
14+
15+ class CSBSFactory (dataSourceFactory ):
16+ def getDataSource ():
17+ return CSBSLocationService ()
18+
19+ class NYTFactory (dataSourceFactory ):
20+ def getDataSource ():
21+ return NYTLcationService ()
22+
23+
24+ # Mapping of factories to data-sources.
725DATA_SOURCES = {
8- "jhu" : JhuLocationService (),
9- "csbs" : CSBSLocationService (),
10- "nyt" : NYTLocationService (),
26+ "jhu" : JhuFactory (),
27+ "csbs" : CSBSFactory (),
28+ "nyt" : NYTFactory (),
1129}
1230
13-
1431def data_source (source ):
1532 """
1633 Retrieves the provided data-source service.
1734
1835 :returns: The service.
1936 :rtype: LocationService
2037 """
21- return DATA_SOURCES .get (source .lower ())
38+ return DATA_SOURCES .get (source .lower ()). getDataSource ()
You can’t perform that action at this time.
0 commit comments