|
10 | 10 | from ctypes import * |
11 | 11 | import struct |
12 | 12 |
|
| 13 | +from typing import Union |
13 | 14 | from PyQt5.QtCore import QSharedMemory |
14 | 15 |
|
15 | 16 | from mbconfig import * |
@@ -127,7 +128,7 @@ def _recalcheader(self, byteoffset:int, bytecount:int): |
127 | 128 | self._head.changeByteCount = rightedge - self._head.changeByteOffset |
128 | 129 | self._head.changeCounter += 1 |
129 | 130 |
|
130 | | - def _getbytes(self, byteoffset:int, count:int, bytestype=bytes)->bytes: |
| 131 | + def _getbytes(self, byteoffset: int, count: int, bytestype=bytes) -> Union[bytes, bytearray]: |
131 | 132 | if 0 <= byteoffset < self._countbytes: |
132 | 133 | if byteoffset+count > self._countbytes: |
133 | 134 | c = self._countbytes - byteoffset |
@@ -233,7 +234,7 @@ def getbytearray(self, byteoffset:int, bytecount:int)->bytearray: |
233 | 234 | """ |
234 | 235 | return self._getbytes(byteoffset, bytecount, bytearray) |
235 | 236 |
|
236 | | - def setbytes(self, byteoffset:int, value:type[bytes|bytearray]): |
| 237 | + def setbytes(self, byteoffset: int, value: Union[bytes, bytearray]): |
237 | 238 | """ |
238 | 239 | @details |
239 | 240 | Function set `value` (`bytes` or `bytearray`) array object into device memory |
@@ -311,7 +312,7 @@ def getbitbytes(self, bitoffset:int, bitcount:int)->bytes: |
311 | 312 | """ |
312 | 313 | return bytes(self.getbitbytearray(bitoffset, bitcount)) |
313 | 314 |
|
314 | | - def setbitbytes(self, bitoffset:int, bitcount:int, value:type[bytes|bytearray]): |
| 315 | + def setbitbytes(self, bitoffset: int, bitcount: int, value: Union[bytes, bytearray]): |
315 | 316 | """ |
316 | 317 | @details |
317 | 318 | Function set `value` (`bytes` or `bytearray`) array object into device memory |
|
0 commit comments