call(Client)Coro: support nested.getattr.retrieval
This commit is contained in:
parent
50930aec36
commit
31184071db
|
@ -4,6 +4,7 @@
|
||||||
import asyncio
|
import asyncio
|
||||||
import signal
|
import signal
|
||||||
from concurrent.futures import Future
|
from concurrent.futures import Future
|
||||||
|
from operator import attrgetter
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from threading import Thread
|
from threading import Thread
|
||||||
from typing import Any, Coroutine, Dict, List, Optional, Sequence
|
from typing import Any, Coroutine, Dict, List, Optional, Sequence
|
||||||
|
@ -53,24 +54,18 @@ class App:
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def call_backend_coro(self,
|
def call_backend_coro(self, name: str, uuid: str, args: Sequence[str] = ()
|
||||||
name: str,
|
) -> None:
|
||||||
uuid: str,
|
self._call_coro(attrgetter(name)(self.backend)(*args), uuid)
|
||||||
args: Optional[List[str]] = None) -> None:
|
|
||||||
self._call_coro(
|
|
||||||
getattr(self.backend, name)(*args or []), uuid
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def call_client_coro(self,
|
def call_client_coro(self,
|
||||||
account_id: str,
|
account_id: str,
|
||||||
name: str,
|
name: str,
|
||||||
uuid: str,
|
uuid: str,
|
||||||
args: Optional[List[str]] = None) -> None:
|
args: Sequence[str] = ()) -> None:
|
||||||
client = self.backend.clients[account_id]
|
client = self.backend.clients[account_id]
|
||||||
self._call_coro(
|
self._call_coro(attrgetter(name)(client)(*args), uuid)
|
||||||
getattr(client, name)(*args or []), uuid
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def pdb(self, additional_data: Sequence = ()) -> None:
|
def pdb(self, additional_data: Sequence = ()) -> None:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user