Make hook run in both python 2 and 3

Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
This commit is contained in:
Thomas Lauf 2019-08-21 20:59:50 +02:00
parent 6d09d8fe13
commit a0a5e0ddac

View file

@ -38,9 +38,14 @@ import subprocess
# Description # Description
# UDAs # UDAs
try:
input_stream = sys.stdin.buffer
except AttributeError:
input_stream = sys.stdin
# Make no changes to the task, simply observe. # Make no changes to the task, simply observe.
old = json.loads(sys.stdin.buffer.readline().decode("utf-8", errors="replace")) old = json.loads(input_stream.readline().decode("utf-8", errors="replace"))
new = json.loads(sys.stdin.buffer.readline().decode("utf-8", errors="replace")) new = json.loads(input_stream.readline().decode("utf-8", errors="replace"))
print(json.dumps(new)) print(json.dumps(new))
def extract_timew_tags_from(json_obj): def extract_timew_tags_from(json_obj):