Possibly fixed #8 #57

Merged
profitroll merged 10 commits from profitroll/timezones-fix into dev 2024-05-31 00:25:54 +03:00
3 changed files with 6 additions and 6 deletions
Showing only changes of commit 0562521f0d - Show all commits

View File

@ -10,7 +10,7 @@ class CallbackLanguage:
language: str language: str
@classmethod @classmethod
def from_callback(cls, callback: CallbackQuery): def from_callback(cls, callback: CallbackQuery) -> "CallbackLanguage":
"""Parse callback query and extract language data from it. """Parse callback query and extract language data from it.
### Args: ### Args:

View File

@ -23,7 +23,7 @@ class GarbageEntry:
date: datetime date: datetime
@classmethod @classmethod
async def from_dict(cls, data: Mapping[str, Any]): async def from_dict(cls, data: Mapping[str, Any]) -> "GarbageEntry":
"""Generate GarbageEntry object from the mapping provided """Generate GarbageEntry object from the mapping provided
### Args: ### Args:
@ -60,7 +60,7 @@ class GarbageEntry:
) )
@classmethod @classmethod
async def from_record(cls, data: Mapping[str, Any]): async def from_record(cls, data: Mapping[str, Any]) -> "GarbageEntry":
locations = [ locations = [
await Location.get(location_id) for location_id in data["locations"] await Location.get(location_id) for location_id in data["locations"]
] ]

View File

@ -28,7 +28,7 @@ class Location:
timezone: Union[BaseTzInfo, DstTzInfo] timezone: Union[BaseTzInfo, DstTzInfo]
@classmethod @classmethod
async def get(cls, id: int): async def get(cls, id: int) -> "Location":
db_entry = await col_locations.find_one({"id": id}) db_entry = await col_locations.find_one({"id": id})
if db_entry is None: if db_entry is None:
@ -40,7 +40,7 @@ class Location:
return cls(**db_entry) return cls(**db_entry)
@classmethod @classmethod
async def find(cls, name: str): async def find(cls, name: str) -> "Location":
db_entry = await col_locations.find_one({"name": {"$regex": name}}) db_entry = await col_locations.find_one({"name": {"$regex": name}})
if db_entry is None: if db_entry is None:
@ -52,7 +52,7 @@ class Location:
return cls(**db_entry) return cls(**db_entry)
@classmethod @classmethod
async def nearby(cls, lat: float, lon: float): async def nearby(cls, lat: float, lon: float) -> "Location":
db_entry = await col_locations.find_one({"location": {"$near": [lon, lat]}}) db_entry = await col_locations.find_one({"location": {"$near": [lon, lat]}})
if db_entry is None: if db_entry is None: