1
0
mirror of https://gitlab.com/libvirt/libvirt-python.git synced 2025-08-04 12:21:57 +03:00

stream: no type change

static typing forbids re-declaring a variable with different types.
Rename the variable.

Signed-off-by: Philipp Hahn <hahn@univention.de>
This commit is contained in:
Philipp Hahn
2018-11-21 09:26:08 +01:00
committed by Daniel Berrange
parent 109b257fe5
commit d144e70957

View File

@ -203,10 +203,10 @@
if length is None: if length is None:
self.abort() self.abort()
raise RuntimeError("recvHole handler failed") raise RuntimeError("recvHole handler failed")
ret = holeHandler(self, length, opaque) ret_hole = holeHandler(self, length, opaque)
if type(ret) is int and ret < 0: if type(ret_hole) is int and ret_hole < 0:
self.abort() self.abort()
raise RuntimeError("holeHandler handler returned %d" % ret) raise RuntimeError("holeHandler handler returned %d" % ret_hole)
continue continue
elif isinstance(got, int): elif isinstance(got, int):
raise ValueError(got) raise ValueError(got)
@ -216,10 +216,10 @@
if len(got) == 0: if len(got) == 0:
break break
ret = handler(self, got, opaque) ret_data = handler(self, got, opaque)
if type(ret) is int and ret < 0: if type(ret_data) is int and ret_data < 0:
self.abort() self.abort()
raise RuntimeError("sparseRecvAll handler returned %d" % ret) raise RuntimeError("sparseRecvAll handler returned %d" % ret_data)
def sparseSendAll(self, handler: Callable[['virStream', int, _T], Union[bytes, int]], holeHandler: Callable[['virStream', _T], Tuple[bool, int]], skipHandler: Callable[['virStream', int, _T], int], opaque: _T) -> None: def sparseSendAll(self, handler: Callable[['virStream', int, _T], Union[bytes, int]], holeHandler: Callable[['virStream', _T], Tuple[bool, int]], skipHandler: Callable[['virStream', int, _T], int], opaque: _T) -> None:
"""Send the entire data stream, reading the data from the """Send the entire data stream, reading the data from the