mirror of
https://github.com/chatmail/core.git
synced 2026-05-22 00:06:30 +03:00
refactor(deltachat-rpc-client): drop support for keyword arguments
All Rust methods have positional arguments and it is not going to change.
This commit is contained in:
@@ -89,16 +89,14 @@ class Rpc:
|
|||||||
return await queue.get()
|
return await queue.get()
|
||||||
|
|
||||||
def __getattr__(self, attr: str):
|
def __getattr__(self, attr: str):
|
||||||
async def method(*args, **kwargs) -> Any:
|
async def method(*args) -> Any:
|
||||||
self.id += 1
|
self.id += 1
|
||||||
request_id = self.id
|
request_id = self.id
|
||||||
|
|
||||||
assert not (args and kwargs), "Mixing positional and keyword arguments"
|
|
||||||
|
|
||||||
request = {
|
request = {
|
||||||
"jsonrpc": "2.0",
|
"jsonrpc": "2.0",
|
||||||
"method": attr,
|
"method": attr,
|
||||||
"params": kwargs or args,
|
"params": args,
|
||||||
"id": self.id,
|
"id": self.id,
|
||||||
}
|
}
|
||||||
data = (json.dumps(request) + "\n").encode()
|
data = (json.dumps(request) + "\n").encode()
|
||||||
|
|||||||
Reference in New Issue
Block a user