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:
parent
c585e20f5a
commit
b5680ca0d8
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/python
|
#! /usr/bin/env python
|
||||||
|
|
||||||
# Copyright 2016 Google Inc.
|
# Copyright 2016 Google Inc.
|
||||||
#
|
#
|
||||||
@ -41,7 +41,7 @@ valid_codepoint_data = '''
|
|||||||
'''
|
'''
|
||||||
if sys.version_info[0] < 3:
|
if sys.version_info[0] < 3:
|
||||||
def to_unicode(i):
|
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:
|
else:
|
||||||
def to_unicode(i):
|
def to_unicode(i):
|
||||||
return chr(i)
|
return chr(i)
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python2
|
||||||
# Copyright 2017 Google Inc.
|
# Copyright 2017 Google Inc.
|
||||||
# Use of this source code is governed by a BSD-style license that can be
|
# Use of this source code is governed by a BSD-style license that can be
|
||||||
# found in the LICENSE file.
|
# found in the LICENSE file.
|
||||||
@ -27,7 +27,7 @@ def gerrit_change_id_to_number(cid):
|
|||||||
i = 0
|
i = 0
|
||||||
while i < len(x) and x[i] != '[':
|
while i < len(x) and x[i] != '[':
|
||||||
i += 1
|
i += 1
|
||||||
print json.loads(x[i:])[0]['_number']
|
return json.loads(x[i:])[0]['_number']
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
try:
|
try:
|
||||||
@ -37,6 +37,6 @@ if __name__ == '__main__':
|
|||||||
changeid = retrieve_changeid(sys.argv[1] if len(sys.argv) == 2 else 'HEAD')
|
changeid = retrieve_changeid(sys.argv[1] if len(sys.argv) == 2 else 'HEAD')
|
||||||
if changeid is None:
|
if changeid is None:
|
||||||
exit(2)
|
exit(2)
|
||||||
gerrit_change_id_to_number(changeid)
|
sys.stdout.write('%d\n' % gerrit_change_id_to_number(changeid))
|
||||||
except:
|
except:
|
||||||
exit(1)
|
exit(1)
|
||||||
|
Loading…
Reference in New Issue
Block a user