Skip to content

Commit 31b93ea

Browse files
committed
Move sources enum to data pkg
1 parent 239c3bf commit 31b93ea

File tree

2 files changed

+14
-11
lines changed

2 files changed

+14
-11
lines changed

app/data/__init__.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,21 @@
11
"""app.data"""
2+
import enum
3+
24
from ..services.location.csbs import CSBSLocationService
35
from ..services.location.jhu import JhuLocationService
46
from ..services.location.nyt import NYTLocationService
57

8+
9+
class Sources(str, enum.Enum):
10+
"""
11+
A source available for retrieving data.
12+
"""
13+
14+
jhu = "jhu"
15+
csbs = "csbs"
16+
nyt = "nyt"
17+
18+
619
# Mapping of services to data-sources.
720
DATA_SOURCES = {
821
"jhu": JhuLocationService(),

app/routers/v2.py

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,12 @@
33

44
from fastapi import APIRouter, HTTPException, Request
55

6-
from ..data import DATA_SOURCES
6+
from ..data import DATA_SOURCES, Sources
77
from ..models import LatestResponse, LocationResponse, LocationsResponse
88

99
V2 = APIRouter()
1010

1111

12-
class Sources(str, enum.Enum):
13-
"""
14-
A source available for retrieving data.
15-
"""
16-
17-
jhu = "jhu"
18-
csbs = "csbs"
19-
nyt = "nyt"
20-
21-
2212
@V2.get("/latest", response_model=LatestResponse)
2313
async def get_latest(request: Request, source: Sources = "jhu"): # pylint: disable=unused-argument
2414
"""

0 commit comments

Comments
 (0)