diff options
author | Muxi Yan <mxyan@google.com> | 2018-01-19 12:20:15 -0800 |
---|---|---|
committer | Muxi Yan <mxyan@google.com> | 2018-01-19 12:20:15 -0800 |
commit | fb061c329ac5086b62619b118191574f3fd27a79 (patch) | |
tree | 6a855770d7218425a2cd53bc378800c30d6c8525 /tools/codegen | |
parent | 032e9b32dc5978a042bdda5c3031ae6cbd928973 (diff) | |
parent | 9813858908da2e7deaa58d91f4030e6881e364e3 (diff) |
Merge remote-tracking branch 'upstream/master' into fix-stream-compression-config-interface
Diffstat (limited to 'tools/codegen')
-rwxr-xr-x | tools/codegen/core/gen_settings_ids.py | 9 | ||||
-rwxr-xr-x | tools/codegen/core/gen_static_metadata.py | 16 | ||||
-rwxr-xr-x | tools/codegen/core/gen_stats_data.py | 13 |
3 files changed, 22 insertions, 16 deletions
diff --git a/tools/codegen/core/gen_settings_ids.py b/tools/codegen/core/gen_settings_ids.py index bc4380605a..5c3f066b15 100755 --- a/tools/codegen/core/gen_settings_ids.py +++ b/tools/codegen/core/gen_settings_ids.py @@ -174,10 +174,13 @@ for decorated_setting in sorted(decorated_settings): print >> C, "{NULL, 0, 0, 0, GRPC_CHTTP2_DISCONNECT_ON_INVALID_VALUE, GRPC_HTTP2_PROTOCOL_ERROR}," i += 1 print >> C, "{\"%s\", %du, %du, %du, GRPC_CHTTP2_%s, GRPC_HTTP2_%s}," % ( - decorated_setting.name, decorated_setting.setting.default, - decorated_setting.setting.min, decorated_setting.setting.max, + decorated_setting.name, + decorated_setting.setting.default, + decorated_setting.setting.min, + decorated_setting.setting.max, decorated_setting.setting.on_error.behavior, - decorated_setting.setting.on_error.code,) + decorated_setting.setting.on_error.code, + ) i += 1 print >> C, "};" diff --git a/tools/codegen/core/gen_static_metadata.py b/tools/codegen/core/gen_static_metadata.py index 10903a1134..d4c0052b28 100755 --- a/tools/codegen/core/gen_static_metadata.py +++ b/tools/codegen/core/gen_static_metadata.py @@ -391,8 +391,8 @@ for i, elem in enumerate(all_strs): print >> H, '#define %s (grpc_static_slice_table[%d])' % ( mangle(elem).upper(), i) print >> H -print >> C, 'static uint8_t g_bytes[] = {%s};' % ( - ','.join('%d' % ord(c) for c in ''.join(all_strs))) +print >> C, 'static uint8_t g_bytes[] = {%s};' % (','.join( + '%d' % ord(c) for c in ''.join(all_strs))) print >> C print >> C, 'static void static_ref(void *unused) {}' print >> C, 'static void static_unref(void *unused) {}' @@ -448,8 +448,8 @@ for i, elem in enumerate(all_elems): print >> H print >> C, ('uintptr_t grpc_static_mdelem_user_data[GRPC_STATIC_MDELEM_COUNT] ' '= {') -print >> C, ' %s' % ','.join('%d' % static_userdata.get(elem, 0) - for elem in all_elems) +print >> C, ' %s' % ','.join( + '%d' % static_userdata.get(elem, 0) for elem in all_elems) print >> C, '};' print >> C @@ -524,8 +524,8 @@ for i, k in enumerate(elem_keys): idxs[h] = i print >> C, 'static const uint16_t elem_keys[] = {%s};' % ','.join( '%d' % k for k in keys) -print >> C, 'static const uint8_t elem_idxs[] = {%s};' % ','.join('%d' % i - for i in idxs) +print >> C, 'static const uint8_t elem_idxs[] = {%s};' % ','.join( + '%d' % i for i in idxs) print >> C print >> H, 'grpc_mdelem grpc_static_mdelem_for_static_strings(int a, int b);' @@ -583,8 +583,8 @@ print >> H, 'extern const uint8_t grpc_static_accept_stream_encoding_metadata[%d 1 << len(STREAM_COMPRESSION_ALGORITHMS)) print >> C, 'const uint8_t grpc_static_accept_stream_encoding_metadata[%d] = {' % ( 1 << len(STREAM_COMPRESSION_ALGORITHMS)) -print >> C, '0,%s' % ','.join('%d' % md_idx(elem) - for elem in stream_compression_elems) +print >> C, '0,%s' % ','.join( + '%d' % md_idx(elem) for elem in stream_compression_elems) print >> C, '};' print >> H, '#define GRPC_MDELEM_ACCEPT_STREAM_ENCODING_FOR_ALGORITHMS(algs) (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[grpc_static_accept_stream_encoding_metadata[(algs)]], GRPC_MDELEM_STORAGE_STATIC))' diff --git a/tools/codegen/core/gen_stats_data.py b/tools/codegen/core/gen_stats_data.py index 93f2035c45..5c9d9e5ea5 100755 --- a/tools/codegen/core/gen_stats_data.py +++ b/tools/codegen/core/gen_stats_data.py @@ -28,8 +28,8 @@ REQUIRED_FIELDS = ['name', 'doc'] def make_type(name, fields): - return (collections.namedtuple( - name, ' '.join(list(set(REQUIRED_FIELDS + fields)))), []) + return (collections.namedtuple(name, ' '.join( + list(set(REQUIRED_FIELDS + fields)))), []) def c_str(s, encoding='ascii'): @@ -44,7 +44,10 @@ def c_str(s, encoding='ascii'): return '"' + result + '"' -types = (make_type('Counter', []), make_type('Histogram', ['max', 'buckets']),) +types = ( + make_type('Counter', []), + make_type('Histogram', ['max', 'buckets']), +) inst_map = dict((t[0].__name__, t[1]) for t in types) @@ -349,8 +352,8 @@ with open('src/core/lib/debug/stats_data.cc', 'w') as C: print >> C, "const int grpc_stats_histo_start[%d] = {%s};" % ( len(inst_map['Histogram']), ','.join('%s' % x for x in histo_start)) print >> C, "const int *const grpc_stats_histo_bucket_boundaries[%d] = {%s};" % ( - len(inst_map['Histogram']), ','.join('grpc_stats_table_%d' % x - for x in histo_bucket_boundaries)) + len(inst_map['Histogram']), ','.join( + 'grpc_stats_table_%d' % x for x in histo_bucket_boundaries)) print >> C, "void (*const grpc_stats_inc_histogram[%d])(int x) = {%s};" % ( len(inst_map['Histogram']), ','.join( 'grpc_stats_inc_%s' % histogram.name.lower() |