diff --git a/app/coordinates.py b/app/coordinates.py index be972c6e..b324250a 100644 --- a/app/coordinates.py +++ b/app/coordinates.py @@ -1,23 +1,18 @@ """app.coordinates.py""" +class Coordinates: +def __init__(self, lat_long): +self.lat_long = lat_long -class Coordinates: - """ - A position on earth using decimal coordinates (latitude and longitude). - """ +if __name__ == "__main__": +us_lat, us_long = 45, 60 +us = Point(us_lat, us_long) +us_coord = Coorinates(us) - def __init__(self, latitude, longitude): - self.latitude = latitude - self.longitude = longitude - def serialize(self): - """ - Serializes the coordinates into a dict. - :returns: The serialized coordinates. - :rtype: dict - """ - return {"latitude": self.latitude, "longitude": self.longitude} +class Point: - def __str__(self): - return "lat: %s, long: %s" % (self.latitude, self.longitude) +def __init__(self, x, y): +self.x = x +self.y = y diff --git a/app/main.py b/app/main.py index b9aff949..7ccb68e3 100644 --- a/app/main.py +++ b/app/main.py @@ -119,3 +119,4 @@ async def handle_validation_error( uvicorn.run( "app.main:APP", host="127.0.0.1", port=SETTINGS.port, log_level="info", ) +# this is a test comment \ No newline at end of file diff --git a/app/models.py b/app/models.py index 497a4b83..843d71b2 100644 --- a/app/models.py +++ b/app/models.py @@ -22,40 +22,35 @@ class LatestResponse(BaseModel): latest: Latest -class Timeline(BaseModel): - """ - Timeline model. - """ +class Timeline(basemodel): - timeline: Dict[str, int] = {} + def __init__(self, timeline): - @validator("timeline") - @classmethod - def sort_timeline(cls, value): - """Sort the timeline history before inserting into the model""" - return dict(sorted(value.items())) + self.timeline = timeline - @property - def latest(self): - """Get latest available history value.""" - return list(self.timeline.values())[-1] if self.timeline else 0 + - def serialize(self): - """ - Serialize the model into dict - TODO: override dict() instead of using serialize - """ - return {**self.dict(), "latest": self.latest} +class Timelines(basemodel): + def __init__(self, confirmed, deaths, recovered): -class Timelines(BaseModel): - """ - Timelines model. - """ + self.confirmed = confirmed + + self.deaths = deaths + + self.recovered = recovered + + + + if __name__ == "__main__": + + confirm = Timeline({'Sat':10, 'Wed':20}) + + death = Timeline({'Sat':10, 'Wed':20}) + + recovered = Timeline({'Sat':10, 'Wed':20}) - confirmed: Timeline - deaths: Timeline - recovered: Timeline + timelines_1 = Timelines(confirm, death, recovered) class Location(BaseModel): diff --git a/Makefile b/makefile similarity index 100% rename from Makefile rename to makefile