Skip to content

Commit 25c08ec

Browse files
committed
Minor improvements of int_from_byte() and byte_from_int()
1 parent 9bc5ab4 commit 25c08ec

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

kaitaistruct.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -377,13 +377,11 @@ def process_rotate_left(data, amount, group_size):
377377

378378
@staticmethod
379379
def int_from_byte(v):
380-
if PY2:
381-
return ord(v)
382-
return v
380+
return ord(v) if PY2 else v
383381

384382
@staticmethod
385383
def byte_from_int(i):
386-
return chr(i) if PY2 else bytes([i])
384+
return chr(i) if PY2 else bytes((i,))
387385

388386
@staticmethod
389387
def byte_array_index(data, i):

0 commit comments

Comments
 (0)