From 87cd994b0477e98c976e7b321b3c1f52666ab5e0 Mon Sep 17 00:00:00 2001 From: Mehrdad Afshari Date: Tue, 2 Jan 2018 14:40:00 -0800 Subject: Upgrade yapf to 0.20.0 Upgrade yapf version to 0.20.0 and reformat Python files. --- tools/buildgen/bunch.py | 5 +++-- tools/buildgen/mako_renderer.py | 8 ++++---- tools/buildgen/plugins/expand_filegroups.py | 7 +++---- tools/buildgen/plugins/generate_vsprojects.py | 13 +++++++------ tools/buildgen/plugins/transitive_dependencies.py | 4 ++-- 5 files changed, 19 insertions(+), 18 deletions(-) (limited to 'tools/buildgen') diff --git a/tools/buildgen/bunch.py b/tools/buildgen/bunch.py index 0ce9a6b233..f3bfc81102 100755 --- a/tools/buildgen/bunch.py +++ b/tools/buildgen/bunch.py @@ -48,5 +48,6 @@ def merge_json(dst, add): elif isinstance(dst, list) and isinstance(add, list): dst.extend(add) else: - raise Exception('Tried to merge incompatible objects %s %s\n\n%r\n\n%r' - % (type(dst).__name__, type(add).__name__, dst, add)) + raise Exception( + 'Tried to merge incompatible objects %s %s\n\n%r\n\n%r' % + (type(dst).__name__, type(add).__name__, dst, add)) diff --git a/tools/buildgen/mako_renderer.py b/tools/buildgen/mako_renderer.py index 0569fa14d2..acd72bd2e3 100755 --- a/tools/buildgen/mako_renderer.py +++ b/tools/buildgen/mako_renderer.py @@ -99,10 +99,10 @@ def main(argv): elif opt == '-P': assert not got_preprocessed_input assert json_dict == {} - sys.path.insert( - 0, - os.path.abspath( - os.path.join(os.path.dirname(sys.argv[0]), 'plugins'))) + sys.path.insert(0, + os.path.abspath( + os.path.join( + os.path.dirname(sys.argv[0]), 'plugins'))) with open(arg, 'r') as dict_file: dictionary = pickle.load(dict_file) got_preprocessed_input = True diff --git a/tools/buildgen/plugins/expand_filegroups.py b/tools/buildgen/plugins/expand_filegroups.py index 886a59cdbb..99d9463b3f 100755 --- a/tools/buildgen/plugins/expand_filegroups.py +++ b/tools/buildgen/plugins/expand_filegroups.py @@ -104,8 +104,7 @@ def mako_plugin(dictionary): # build reverse dependency map things = {} - for thing in dictionary['libs'] + dictionary['targets'] + dictionary[ - 'filegroups']: + for thing in dictionary['libs'] + dictionary['targets'] + dictionary['filegroups']: things[thing['name']] = thing thing['used_by'] = [] thing_deps = lambda t: t.get('uses', []) + t.get('filegroups', []) + t.get('deps', []) @@ -148,7 +147,7 @@ def mako_plugin(dictionary): lib[lst] = vals lib['plugins'] = plugins if lib.get('generate_plugin_registry', False): - lib['src'].append('src/core/plugin_registry/%s_plugin_registry.cc' % - lib['name']) + lib['src'].append( + 'src/core/plugin_registry/%s_plugin_registry.cc' % lib['name']) for lst in FILEGROUP_LISTS: lib[lst] = uniquify(lib.get(lst, [])) diff --git a/tools/buildgen/plugins/generate_vsprojects.py b/tools/buildgen/plugins/generate_vsprojects.py index f6251d4677..f7ef49288f 100755 --- a/tools/buildgen/plugins/generate_vsprojects.py +++ b/tools/buildgen/plugins/generate_vsprojects.py @@ -56,11 +56,12 @@ def mako_plugin(dictionary): target['vs_props'] = [] target['vs_proj_dir'] = target.get('vs_proj_dir', default_test_dir) if target.get('vs_project_guid', - None) is None and 'windows' in target.get('platforms', - ['windows']): + None) is None and 'windows' in target.get( + 'platforms', ['windows']): name = target['name'] guid = re.sub('(........)(....)(....)(....)(.*)', - r'{\1-\2-\3-\4-\5}', hashlib.md5(name).hexdigest()) + r'{\1-\2-\3-\4-\5}', + hashlib.md5(name).hexdigest()) target['vs_project_guid'] = guid.upper() # Exclude projects without a visual project guid, such as the tests. projects = [ @@ -69,9 +70,9 @@ def mako_plugin(dictionary): projects = [ project for project in projects - if project['language'] != 'c++' or project['build'] == 'all' or project[ - 'build'] == 'protoc' or (project['language'] == 'c++' and (project[ - 'build'] == 'test' or project['build'] == 'private')) + if project['language'] != 'c++' or project['build'] == 'all' or + project['build'] == 'protoc' or (project['language'] == 'c++' and ( + project['build'] == 'test' or project['build'] == 'private')) ] project_dict = dict([(p['name'], p) for p in projects]) diff --git a/tools/buildgen/plugins/transitive_dependencies.py b/tools/buildgen/plugins/transitive_dependencies.py index 5373bca2d1..258e10bff5 100644 --- a/tools/buildgen/plugins/transitive_dependencies.py +++ b/tools/buildgen/plugins/transitive_dependencies.py @@ -54,5 +54,5 @@ def mako_plugin(dictionary): target['transitive_deps'] = transitive_deps(target, libs) python_dependencies = dictionary.get('python_dependencies') - python_dependencies['transitive_deps'] = ( - transitive_deps(python_dependencies, libs)) + python_dependencies['transitive_deps'] = (transitive_deps( + python_dependencies, libs)) -- cgit v1.2.3