Skip to content

Commit d63db2f

Browse files
committed
fix: narrow isdigit to stricter isdecimal
1 parent 10b7368 commit d63db2f

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

hslog/filter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ def _handle_tag_change(self, msg: str, line: str):
401401
self._current_buffer.should_skip = False
402402

403403
if (
404-
tag.isdigit() or
404+
tag.isdecimal() or
405405
tag in BLACKLISTED_TAGS or
406406
(
407407
self._current_buffer is not None and

hslog/parser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ def flush(self):
9999
self.send_choice_packet = None
100100

101101
def parse_entity_id(self, entity: str) -> int:
102-
if entity.isdigit():
102+
if entity.isdecimal():
103103
return int(entity)
104104

105105
if entity == tokens.GAME_ENTITY:

hslog/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55

66
def parse_enum(enum, value):
7-
if value.isdigit():
7+
if value.isdecimal():
88
value = int(value)
99
elif hasattr(enum, value):
1010
value = getattr(enum, value)
@@ -17,7 +17,7 @@ def parse_tag(tag, value):
1717
tag = parse_enum(GameTag, tag)
1818
if tag in TAG_TYPES:
1919
value = parse_enum(TAG_TYPES[tag], value)
20-
elif value.isdigit():
20+
elif value.isdecimal():
2121
value = int(value)
2222
else:
2323
raise NotImplementedError("Invalid string value %r = %r" % (tag, value))

0 commit comments

Comments
 (0)