1 parent 1fa06cb commit 347e7ecCopy full SHA for 347e7ec
1 file changed
openlcb/scanner.py
@@ -17,15 +17,14 @@ class Scanner:
17
_onHasNext on every push). Mimic Java behavior where
18
"\\Z" can be added as the delimiter for EOF.
19
"""
20
- EOF = bytes([0x05]) # flag value *not* used for find arg
+ EOF = 0x05 # flag value (*skips find*)
21
# ESCAPED_EOF = ESCAPED_EOF_S.encode("utf-8")
22
# EOF = 0x05 # type: int
23
# EOF = -1
24
25
def __init__(self, delimiter: Union[bytes, bytearray, int] = EOF):
26
- if isinstance(delimiter, int):
27
- delimiter = bytes([delimiter])
28
- self._delimiter = delimiter # type: Union[bytes, bytearray]
+ # ^ NOTE: b''.find(int(delimiter)) works fine
+ self._delimiter = delimiter # type: Union[bytes, bytearray, int]
29
self._buffer = bytearray()
30
31
def push(self, data: Union[bytearray, bytes, int]):
0 commit comments