aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/distrib
diff options
context:
space:
mode:
authorGravatar Mehrdad Afshari <mmx@google.com>2018-01-02 14:40:00 -0800
committerGravatar Mehrdad Afshari <mmx@google.com>2018-01-02 14:40:00 -0800
commit87cd994b0477e98c976e7b321b3c1f52666ab5e0 (patch)
tree8590a82e599e0c763f32f835ef2bbb129871e75b /tools/distrib
parent63392f682e21543099926251b642cdcd0be2a17f (diff)
Upgrade yapf to 0.20.0
Upgrade yapf version to 0.20.0 and reformat Python files.
Diffstat (limited to 'tools/distrib')
-rwxr-xr-xtools/distrib/check_copyright.py12
-rwxr-xr-xtools/distrib/check_include_guards.py16
-rw-r--r--tools/distrib/python/grpcio_tools/grpc_tools/command.py4
-rw-r--r--tools/distrib/python/grpcio_tools/setup.py6
-rwxr-xr-xtools/distrib/python/make_grpcio_tools.py6
-rwxr-xr-xtools/distrib/run_clang_tidy.py6
-rwxr-xr-xtools/distrib/yapf_code.sh2
7 files changed, 30 insertions, 22 deletions
diff --git a/tools/distrib/check_copyright.py b/tools/distrib/check_copyright.py
index f6e73624a7..8f782e07c2 100755
--- a/tools/distrib/check_copyright.py
+++ b/tools/distrib/check_copyright.py
@@ -84,13 +84,15 @@ _EXEMPT = frozenset((
# census.proto copied from github
'tools/grpcz/census.proto',
# status.proto copied from googleapis
- 'src/proto/grpc/status/status.proto',))
+ 'src/proto/grpc/status/status.proto',
+))
RE_YEAR = r'Copyright (?P<first_year>[0-9]+\-)?(?P<last_year>[0-9]+) gRPC authors.'
-RE_LICENSE = dict((k, r'\n'.join(
- LICENSE_PREFIX[k] + (RE_YEAR
- if re.search(RE_YEAR, line) else re.escape(line))
- for line in LICENSE_NOTICE)) for k, v in LICENSE_PREFIX.iteritems())
+RE_LICENSE = dict(
+ (k, r'\n'.join(LICENSE_PREFIX[k] +
+ (RE_YEAR if re.search(RE_YEAR, line) else re.escape(line))
+ for line in LICENSE_NOTICE))
+ for k, v in LICENSE_PREFIX.iteritems())
if args.precommit:
FILE_LIST_COMMAND = 'git status -z | grep -Poz \'(?<=^[MARC][MARCD ] )[^\s]+\''
diff --git a/tools/distrib/check_include_guards.py b/tools/distrib/check_include_guards.py
index 24e076afda..6fc606f2ef 100755
--- a/tools/distrib/check_include_guards.py
+++ b/tools/distrib/check_include_guards.py
@@ -95,14 +95,14 @@ class GuardValidator(object):
# Does the guard end with a '_H'?
running_guard = match.group(1)
if not running_guard.endswith('_H'):
- fcontents = self.fail(fpath, match.re, match.string,
- match.group(1), valid_guard, fix)
+ fcontents = self.fail(fpath, match.re, match.string, match.group(1),
+ valid_guard, fix)
if fix: save(fpath, fcontents)
# Is it the expected one based on the file path?
if running_guard != valid_guard:
- fcontents = self.fail(fpath, match.re, match.string,
- match.group(1), valid_guard, fix)
+ fcontents = self.fail(fpath, match.re, match.string, match.group(1),
+ valid_guard, fix)
if fix: save(fpath, fcontents)
# Is there a #define? Is it the same as the #ifndef one?
@@ -114,8 +114,8 @@ class GuardValidator(object):
# Is the #define guard the same as the #ifndef guard?
if match.group(1) != running_guard:
- fcontents = self.fail(fpath, match.re, match.string,
- match.group(1), valid_guard, fix)
+ fcontents = self.fail(fpath, match.re, match.string, match.group(1),
+ valid_guard, fix)
if fix: save(fpath, fcontents)
# Is there a properly commented #endif?
@@ -138,8 +138,8 @@ class GuardValidator(object):
self.fail(fpath, endif_re, flines[-1], '', '', False)
elif match.group(1) != running_guard:
# Is the #endif guard the same as the #ifndef and #define guards?
- fcontents = self.fail(fpath, endif_re, fcontents,
- match.group(1), valid_guard, fix)
+ fcontents = self.fail(fpath, endif_re, fcontents, match.group(1),
+ valid_guard, fix)
if fix: save(fpath, fcontents)
return not self.failed # Did the check succeed? (ie, not failed)
diff --git a/tools/distrib/python/grpcio_tools/grpc_tools/command.py b/tools/distrib/python/grpcio_tools/grpc_tools/command.py
index c0f9d93b0a..7ede05f140 100644
--- a/tools/distrib/python/grpcio_tools/grpc_tools/command.py
+++ b/tools/distrib/python/grpcio_tools/grpc_tools/command.py
@@ -30,8 +30,8 @@ def build_package_protos(package_root):
proto_files.append(
os.path.abspath(os.path.join(root, filename)))
- well_known_protos_include = pkg_resources.resource_filename('grpc_tools',
- '_proto')
+ well_known_protos_include = pkg_resources.resource_filename(
+ 'grpc_tools', '_proto')
for proto_file in proto_files:
command = [
diff --git a/tools/distrib/python/grpcio_tools/setup.py b/tools/distrib/python/grpcio_tools/setup.py
index 342a220d5e..c6bcee497f 100644
--- a/tools/distrib/python/grpcio_tools/setup.py
+++ b/tools/distrib/python/grpcio_tools/setup.py
@@ -196,7 +196,8 @@ def extension_modules():
language='c++',
define_macros=list(DEFINE_MACROS),
extra_compile_args=list(EXTRA_COMPILE_ARGS),
- extra_link_args=list(EXTRA_LINK_ARGS),)
+ extra_link_args=list(EXTRA_LINK_ARGS),
+ )
extensions = [plugin_ext]
if BUILD_WITH_CYTHON:
from Cython import Build
@@ -220,4 +221,5 @@ setuptools.setup(
'protobuf>=3.5.0.post1',
'grpcio>={version}'.format(version=grpc_version.VERSION),
],
- package_data=package_data(),)
+ package_data=package_data(),
+)
diff --git a/tools/distrib/python/make_grpcio_tools.py b/tools/distrib/python/make_grpcio_tools.py
index 216492a2f3..4847233217 100755
--- a/tools/distrib/python/make_grpcio_tools.py
+++ b/tools/distrib/python/make_grpcio_tools.py
@@ -107,12 +107,14 @@ def get_deps():
`out_file`."""
cc_files_output = bazel_query(BAZEL_DEPS_PROTOC_LIB_QUERY)
cc_files = [
- name[len(PROTOBUF_CC_PREFIX):] for name in cc_files_output
+ name[len(PROTOBUF_CC_PREFIX):]
+ for name in cc_files_output
if name.endswith('.cc') and name.startswith(PROTOBUF_CC_PREFIX)
]
proto_files_output = bazel_query(BAZEL_DEPS_COMMON_PROTOS_QUERY)
proto_files = [
- name[len(PROTOBUF_PROTO_PREFIX):] for name in proto_files_output
+ name[len(PROTOBUF_PROTO_PREFIX):]
+ for name in proto_files_output
if name.endswith('.proto') and name.startswith(PROTOBUF_PROTO_PREFIX)
]
commit_hash = protobuf_submodule_commit_hash()
diff --git a/tools/distrib/run_clang_tidy.py b/tools/distrib/run_clang_tidy.py
index 3ac712ea9e..72d7956b68 100755
--- a/tools/distrib/run_clang_tidy.py
+++ b/tools/distrib/run_clang_tidy.py
@@ -54,7 +54,8 @@ argp.set_defaults(fix=False)
args = argp.parse_args()
cmdline = [
- clang_tidy, '--checks=-*,%s' % ','.join(GRPC_CHECKS),
+ clang_tidy,
+ '--checks=-*,%s' % ','.join(GRPC_CHECKS),
'--warnings-as-errors=%s' % ','.join(GRPC_CHECKS)
] + ['--extra-arg-before=%s' % arg for arg in extra_args]
@@ -65,6 +66,7 @@ jobs = []
for filename in args.files:
jobs.append(jobset.JobSpec(
cmdline + [filename],
- shortname=filename,)) #verbose_success=True))
+ shortname=filename,
+ )) #verbose_success=True))
jobset.run(jobs, maxjobs=args.jobs)
diff --git a/tools/distrib/yapf_code.sh b/tools/distrib/yapf_code.sh
index fb14f36c66..d188a0242c 100755
--- a/tools/distrib/yapf_code.sh
+++ b/tools/distrib/yapf_code.sh
@@ -34,7 +34,7 @@ virtualenv $VIRTUALENV
PYTHON=$(realpath "${VIRTUALENV}/bin/python")
$PYTHON -m pip install --upgrade pip==9.0.1
$PYTHON -m pip install --upgrade futures
-$PYTHON -m pip install yapf==0.16.0
+$PYTHON -m pip install yapf==0.20.0
yapf() {
local exclusion exclusion_args=()