v0.1.2 #60
@ -10,7 +10,7 @@ class CallbackLanguage:
|
||||
language: str
|
||||
|
||||
@classmethod
|
||||
def from_callback(cls, callback: CallbackQuery):
|
||||
def from_callback(cls, callback: CallbackQuery) -> "CallbackLanguage":
|
||||
"""Parse callback query and extract language data from it.
|
||||
|
||||
### Args:
|
||||
|
@ -23,7 +23,7 @@ class GarbageEntry:
|
||||
date: datetime
|
||||
|
||||
@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
|
||||
|
||||
### Args:
|
||||
@ -60,7 +60,7 @@ class GarbageEntry:
|
||||
)
|
||||
|
||||
@classmethod
|
||||
async def from_record(cls, data: Mapping[str, Any]):
|
||||
async def from_record(cls, data: Mapping[str, Any]) -> "GarbageEntry":
|
||||
locations = [
|
||||
await Location.get(location_id) for location_id in data["locations"]
|
||||
]
|
||||
|
@ -28,7 +28,7 @@ class Location:
|
||||
timezone: Union[BaseTzInfo, DstTzInfo]
|
||||
|
||||
@classmethod
|
||||
async def get(cls, id: int):
|
||||
async def get(cls, id: int) -> "Location":
|
||||
db_entry = await col_locations.find_one({"id": id})
|
||||
|
||||
if db_entry is None:
|
||||
@ -40,7 +40,7 @@ class Location:
|
||||
return cls(**db_entry)
|
||||
|
||||
@classmethod
|
||||
async def find(cls, name: str):
|
||||
async def find(cls, name: str) -> "Location":
|
||||
db_entry = await col_locations.find_one({"name": {"$regex": name}})
|
||||
|
||||
if db_entry is None:
|
||||
@ -52,7 +52,7 @@ class Location:
|
||||
return cls(**db_entry)
|
||||
|
||||
@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]}})
|
||||
|
||||
if db_entry is None:
|
||||
|
Reference in New Issue
Block a user