mirror of
https://github.com/chatmail/core.git
synced 2026-05-08 01:16:31 +03:00
Fix missing imports in deltachat_rpc_client
This commit is contained in:
@@ -20,7 +20,7 @@ class Account:
|
|||||||
id: int
|
id: int
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def _rpc(self) -> Rpc:
|
def _rpc(self) -> "Rpc":
|
||||||
return self.manager.rpc
|
return self.manager.rpc
|
||||||
|
|
||||||
async def wait_for_event(self) -> AttrDict:
|
async def wait_for_event(self) -> AttrDict:
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ class Chat:
|
|||||||
id: int
|
id: int
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def _rpc(self) -> Rpc:
|
def _rpc(self) -> "Rpc":
|
||||||
return self.account._rpc
|
return self.account._rpc
|
||||||
|
|
||||||
async def delete(self) -> None:
|
async def delete(self) -> None:
|
||||||
@@ -218,8 +218,8 @@ class Chat:
|
|||||||
async def get_locations(
|
async def get_locations(
|
||||||
self,
|
self,
|
||||||
contact: Optional[Contact] = None,
|
contact: Optional[Contact] = None,
|
||||||
timestamp_from: Optional[datetime] = None,
|
timestamp_from: Optional["datetime"] = None,
|
||||||
timestamp_to: Optional[datetime] = None,
|
timestamp_to: Optional["datetime"] = None,
|
||||||
) -> List[AttrDict]:
|
) -> List[AttrDict]:
|
||||||
"""Get list of location snapshots for the given contact in the given timespan."""
|
"""Get list of location snapshots for the given contact in the given timespan."""
|
||||||
time_from = calendar.timegm(timestamp_from.utctimetuple()) if timestamp_from else 0
|
time_from = calendar.timegm(timestamp_from.utctimetuple()) if timestamp_from else 0
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ class Client:
|
|||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
account: Account,
|
account: "Account",
|
||||||
hooks: Optional[Iterable[Tuple[Callable, Union[type, EventFilter]]]] = None,
|
hooks: Optional[Iterable[Tuple[Callable, Union[type, EventFilter]]]] = None,
|
||||||
logger: Optional[logging.Logger] = None,
|
logger: Optional[logging.Logger] = None,
|
||||||
) -> None:
|
) -> None:
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ class Contact:
|
|||||||
id: int
|
id: int
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def _rpc(self) -> Rpc:
|
def _rpc(self) -> "Rpc":
|
||||||
return self.account._rpc
|
return self.account._rpc
|
||||||
|
|
||||||
async def block(self) -> None:
|
async def block(self) -> None:
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ class DeltaChat:
|
|||||||
This is the root of the object oriented API.
|
This is the root of the object oriented API.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, rpc: Rpc) -> None:
|
def __init__(self, rpc: "Rpc") -> None:
|
||||||
self.rpc = rpc
|
self.rpc = rpc
|
||||||
|
|
||||||
async def add_account(self) -> Account:
|
async def add_account(self) -> Account:
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ class RawEvent(EventFilter):
|
|||||||
return (self.types, self.func) == (other.types, other.func)
|
return (self.types, self.func) == (other.types, other.func)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
async def filter(self, event: AttrDict) -> bool:
|
async def filter(self, event: "AttrDict") -> bool:
|
||||||
if self.types and event.type not in self.types:
|
if self.types and event.type not in self.types:
|
||||||
return False
|
return False
|
||||||
return await self._call_func(event)
|
return await self._call_func(event)
|
||||||
@@ -120,7 +120,7 @@ class NewMessage(EventFilter):
|
|||||||
command: Optional[str] = None,
|
command: Optional[str] = None,
|
||||||
is_bot: Optional[bool] = False,
|
is_bot: Optional[bool] = False,
|
||||||
is_info: Optional[bool] = None,
|
is_info: Optional[bool] = None,
|
||||||
func: Optional[Callable[[AttrDict], bool]] = None,
|
func: Optional[Callable[["AttrDict"], bool]] = None,
|
||||||
) -> None:
|
) -> None:
|
||||||
super().__init__(func=func)
|
super().__init__(func=func)
|
||||||
self.is_bot = is_bot
|
self.is_bot = is_bot
|
||||||
@@ -159,7 +159,7 @@ class NewMessage(EventFilter):
|
|||||||
)
|
)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
async def filter(self, event: AttrDict) -> bool:
|
async def filter(self, event: "AttrDict") -> bool:
|
||||||
if self.is_bot is not None and self.is_bot != event.message_snapshot.is_bot:
|
if self.is_bot is not None and self.is_bot != event.message_snapshot.is_bot:
|
||||||
return False
|
return False
|
||||||
if self.is_info is not None and self.is_info != event.message_snapshot.is_info:
|
if self.is_info is not None and self.is_info != event.message_snapshot.is_info:
|
||||||
@@ -201,7 +201,7 @@ class MemberListChanged(EventFilter):
|
|||||||
return (self.added, self.func) == (other.added, other.func)
|
return (self.added, self.func) == (other.added, other.func)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
async def filter(self, event: AttrDict) -> bool:
|
async def filter(self, event: "AttrDict") -> bool:
|
||||||
if self.added is not None and self.added != event.member_added:
|
if self.added is not None and self.added != event.member_added:
|
||||||
return False
|
return False
|
||||||
return await self._call_func(event)
|
return await self._call_func(event)
|
||||||
@@ -233,7 +233,7 @@ class GroupImageChanged(EventFilter):
|
|||||||
return (self.deleted, self.func) == (other.deleted, other.func)
|
return (self.deleted, self.func) == (other.deleted, other.func)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
async def filter(self, event: AttrDict) -> bool:
|
async def filter(self, event: "AttrDict") -> bool:
|
||||||
if self.deleted is not None and self.deleted != event.image_deleted:
|
if self.deleted is not None and self.deleted != event.image_deleted:
|
||||||
return False
|
return False
|
||||||
return await self._call_func(event)
|
return await self._call_func(event)
|
||||||
@@ -258,7 +258,7 @@ class GroupNameChanged(EventFilter):
|
|||||||
return self.func == other.func
|
return self.func == other.func
|
||||||
return False
|
return False
|
||||||
|
|
||||||
async def filter(self, event: AttrDict) -> bool:
|
async def filter(self, event: "AttrDict") -> bool:
|
||||||
return await self._call_func(event)
|
return await self._call_func(event)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ class Message:
|
|||||||
id: int
|
id: int
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def _rpc(self) -> Rpc:
|
def _rpc(self) -> "Rpc":
|
||||||
return self.account._rpc
|
return self.account._rpc
|
||||||
|
|
||||||
async def send_reaction(self, *reaction: str):
|
async def send_reaction(self, *reaction: str):
|
||||||
|
|||||||
Reference in New Issue
Block a user