diff options
author | Hal Canary <halcanary@google.com> | 2018-04-03 17:25:15 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-04-05 14:16:02 +0000 |
commit | b5680ca0d8d3f21905e4a144eceb3c74ae29ac83 (patch) | |
tree | fe3236a1287a0a2491bed8d20b09cfe708995648 /experimental | |
parent | c585e20f5a7a49808ddf6ac12af287f226bb26dc (diff) |
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>
Diffstat (limited to 'experimental')
-rwxr-xr-x | experimental/tools/generate-unicode-test-txt | 4 | ||||
-rwxr-xr-x | experimental/tools/gerrit-change-id-to-number | 6 |
2 files changed, 5 insertions, 5 deletions
diff --git a/experimental/tools/generate-unicode-test-txt b/experimental/tools/generate-unicode-test-txt index 76de70ec25..99277537bd 100755 --- a/experimental/tools/generate-unicode-test-txt +++ b/experimental/tools/generate-unicode-test-txt @@ -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) diff --git a/experimental/tools/gerrit-change-id-to-number b/experimental/tools/gerrit-change-id-to-number index ddc9045edb..f8547579c0 100755 --- a/experimental/tools/gerrit-change-id-to-number +++ b/experimental/tools/gerrit-change-id-to-number @@ -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) |