Skip to content

Commit 07560c2

Browse files
committed
Remove a condition that can never be true
1 parent 7c291e8 commit 07560c2

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

curtsies/events.py

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -271,16 +271,14 @@ def could_be_unfinished_char(seq: bytes, encoding: str) -> bool:
271271

272272
def could_be_unfinished_utf8(seq: bytes) -> bool:
273273
# http://en.wikipedia.org/wiki/UTF-8#Description
274-
275-
# fmt: off
276-
if ord(seq[0:1]) & 0b10000000 == 0b10000000 and len(seq) < 1: return True
277-
elif ord(seq[0:1]) & 0b11100000 == 0b11000000 and len(seq) < 2: return True
278-
elif ord(seq[0:1]) & 0b11110000 == 0b11100000 and len(seq) < 3: return True
279-
elif ord(seq[0:1]) & 0b11111000 == 0b11110000 and len(seq) < 4: return True
280-
elif ord(seq[0:1]) & 0b11111100 == 0b11111000 and len(seq) < 5: return True
281-
elif ord(seq[0:1]) & 0b11111110 == 0b11111100 and len(seq) < 6: return True
282-
else: return False
283-
# fmt: on
274+
o = ord(seq[0:1])
275+
return (
276+
(o & 0b11100000 == 0b11000000 and len(seq) < 2)
277+
or (o & 0b11110000 == 0b11100000 and len(seq) < 3)
278+
or (o & 0b11111000 == 0b11110000 and len(seq) < 4)
279+
or (o & 0b11111100 == 0b11111000 and len(seq) < 5)
280+
or (o & 0b11111110 == 0b11111100 and len(seq) < 6)
281+
)
284282

285283

286284
def pp_event(seq: Union[Event, str]) -> Union[str, bytes]:

0 commit comments

Comments
 (0)