From 25b2cecec9b2c5b2eb4b44fb41274e5f492974f6 Mon Sep 17 00:00:00 2001 From: Jan Petykiewicz Date: Sat, 18 Apr 2020 15:50:58 -0700 Subject: [PATCH] Minor changes to satisfy type checker --- fatamorgana/records.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/fatamorgana/records.py b/fatamorgana/records.py index 3b36649..62bd1da 100644 --- a/fatamorgana/records.py +++ b/fatamorgana/records.py @@ -218,8 +218,8 @@ class Record(metaclass=ABCMeta): def read_refname(stream: io.BufferedIOBase, - is_present: bool, - is_reference: bool + is_present: Union[bool, int], + is_reference: Union[bool, int] ) -> Union[None, int, NString]: """ Helper function for reading a possibly-absent, possibly-referenced NString. @@ -242,8 +242,8 @@ def read_refname(stream: io.BufferedIOBase, def read_refstring(stream: io.BufferedIOBase, - is_present: bool, - is_reference: bool + is_present: Union[bool, int], + is_reference: Union[bool, int], ) -> Union[None, int, AString]: """ Helper function for reading a possibly-absent, possibly-referenced `AString`. @@ -937,18 +937,18 @@ class Property(Record): s = 0x01 & (byte >> 0) name = read_refname(stream, c, n) - values: Optional[List[property_value_t]] if v == 0: if u < 0x0f: value_count = u else: value_count = read_uint(stream) - values = [read_property_value(stream) for _ in range(value_count)] + values: Optional[List[property_value_t]] = [read_property_value(stream) + for _ in range(value_count)] else: values = None if u != 0: raise InvalidDataError('Malformed property record header') - record = Property(name, values, s) + record = Property(name, values, bool(s)) logger.debug('Record ending at 0x{:x}:\n {}'.format(stream.tell(), record)) return record