experimental/tools: minor code cleanup

Change-Id: I4d84dfed284aea9746808bf8a22f45e5bd9c519f
Reviewed-on: https://skia-review.googlesource.com/118597
Reviewed-by: Hal Canary <halcanary@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
This commit is contained in:
Hal Canary 2018-04-03 17:25:15 -04:00 committed by Skia Commit-Bot
parent c585e20f5a
commit b5680ca0d8
2 changed files with 5 additions and 5 deletions

View File

@ -1,4 +1,4 @@
#!/usr/bin/python
#! /usr/bin/env python
# Copyright 2016 Google Inc.
#
@ -41,7 +41,7 @@ valid_codepoint_data = '''
'''
if sys.version_info[0] < 3:
def to_unicode(i):
return ('\U%08x' % i).decode('unicode-escape').encode('UTF-8')
return ('\\U%08x' % i).decode('unicode-escape').encode('UTF-8')
else:
def to_unicode(i):
return chr(i)

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python2
# Copyright 2017 Google Inc.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
@ -27,7 +27,7 @@ def gerrit_change_id_to_number(cid):
i = 0
while i < len(x) and x[i] != '[':
i += 1
print json.loads(x[i:])[0]['_number']
return json.loads(x[i:])[0]['_number']
if __name__ == '__main__':
try:
@ -37,6 +37,6 @@ if __name__ == '__main__':
changeid = retrieve_changeid(sys.argv[1] if len(sys.argv) == 2 else 'HEAD')
if changeid is None:
exit(2)
gerrit_change_id_to_number(changeid)
sys.stdout.write('%d\n' % gerrit_change_id_to_number(changeid))
except:
exit(1)