1-based indexing for RPC list parameters
This commit is contained in:
parent
b3195bcd82
commit
26b4a116ba
2
rpc.py
2
rpc.py
@ -32,7 +32,7 @@ def l_pack(value: Any, envelope: int=3, wrapped: bool=True, basictype=b'0', enco
|
|||||||
bare = b't'.join(l_pack(k, envelope=envelope, wrapped=False, encoding=encoding) + l_pack(v, envelope=envelope, wrapped=False, encoding=encoding) for k, v in value.items())
|
bare = b't'.join(l_pack(k, envelope=envelope, wrapped=False, encoding=encoding) + l_pack(v, envelope=envelope, wrapped=False, encoding=encoding) for k, v in value.items())
|
||||||
return (b'2' + bare + b'f') if wrapped else bare
|
return (b'2' + bare + b'f') if wrapped else bare
|
||||||
elif not isinstance(value, str) and hasattr(value, '__iter__'):
|
elif not isinstance(value, str) and hasattr(value, '__iter__'):
|
||||||
bare = b't'.join(l_pack(k, envelope=envelope, wrapped=False, encoding=encoding) + l_pack(v, envelope=envelope, wrapped=False, encoding=encoding) for k, v in enumerate(value))
|
bare = b't'.join(l_pack(k, envelope=envelope, wrapped=False, encoding=encoding) + l_pack(v, envelope=envelope, wrapped=False, encoding=encoding) for k, v in enumerate(value, start=1))
|
||||||
return (b'2' + bare + b'f') if wrapped else bare
|
return (b'2' + bare + b'f') if wrapped else bare
|
||||||
elif isinstance(value, MReference):
|
elif isinstance(value, MReference):
|
||||||
return l_pack(str(value), envelope=envelope, basictype=b'1', encoding=encoding)
|
return l_pack(str(value), envelope=envelope, basictype=b'1', encoding=encoding)
|
||||||
|
Loading…
Reference in New Issue
Block a user