Skip to content

Commit 24e5ff6

Browse files
committed
Nits
1 parent efe2926 commit 24e5ff6

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

tivars/var.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
from .tokenizer import Name
1717

1818

19+
# Use Self type if possible
1920
match version_info[:2]:
2021
case 3, 10:
2122
Self = 'TIEntry'
@@ -447,7 +448,7 @@ def __format__(self, format_spec: str) -> str:
447448
case sep, width:
448449
string = self.calc_data.hex(sep, int(width))
449450

450-
return string if match["case"] == "x" else string.upper()
451+
return string.lower() if match["case"] == "x" else string.upper()
451452

452453
elif not format_spec:
453454
return super().__str__()
@@ -636,6 +637,10 @@ def next_entry_length(stream: BinaryIO) -> int:
636637
data_length = int.from_bytes(stream.read(2), 'little')
637638
stream.seek(-4, 1)
638639

640+
if meta_length not in (TIEntry.base_meta_length, TIEntry.flash_meta_length):
641+
warn(f"Got unexpected meta length ({meta_length}) from bytestream.",
642+
BytesWarning)
643+
639644
return 2 + meta_length + 2 + data_length
640645

641646
@classmethod

0 commit comments

Comments
 (0)