summaryrefslogtreecommitdiff
path: root/python/binaryview.py
diff options
context:
space:
mode:
authorPeter LaFosse <peter@vector35.com>2021-11-23 08:49:18 -0500
committerPeter LaFosse <peter@vector35.com>2021-11-29 09:25:27 -0500
commit7145eaf90190f114449610948d6fa0ddf2191771 (patch)
tree95470ee20ed5c70bdcb715b0f237974c45a30094 /python/binaryview.py
parentefb34483c43fb360914186a335c772f8a53b7b8f (diff)
Fix type check warnings in TypedDataAccessor
Diffstat (limited to 'python/binaryview.py')
-rw-r--r--python/binaryview.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/python/binaryview.py b/python/binaryview.py
index 395dd9b0..a931ee0b 100644
--- a/python/binaryview.py
+++ b/python/binaryview.py
@@ -8042,12 +8042,12 @@ class TypedDataAccessor:
return TypedDataAccessor(m.type.immutable_copy(), self.address + m.offset, self.view, self.endian)
@staticmethod
- def byte_order(endian) -> str:
+ def byte_order(endian) -> str: # as of python3.8 -> Literal["little", "big"]
return "little" if endian == Endianness.LittleEndian else "big"
@staticmethod
def int_from_bytes(data:bytes, width:int, sign:bool, endian:Optional[Endianness]=None) -> int:
- return int.from_bytes(data[0:width], byteorder=TypedDataAccessor.byte_order(endian), signed=sign)
+ return int.from_bytes(data[0:width], byteorder=TypedDataAccessor.byte_order(endian), signed=sign) # type: ignore
def __float__(self):
if not isinstance(self.type, _types.FloatType):
@@ -8077,7 +8077,7 @@ class TypedDataAccessor:
_types.PointerType, _types.PointerBuilder,
_types.EnumerationType, _types.EnumerationBuilder)
assert isinstance(self.type, integral_types), f"Can't set the value of type {type(self.type)} to int value"
- to_write = data.to_bytes(len(self), TypedDataAccessor.byte_order(self.endian))
+ to_write = data.to_bytes(len(self), TypedDataAccessor.byte_order(self.endian)) # type: ignore
elif isinstance(data, float) and isinstance(self.type, (_types.FloatType, _types.FloatBuilder)):
endian = "<" if self.endian == Endianness.LittleEndian else ">"
if self.type.width == 2: