From b179975134a3302cda4473240abcb74ecb45a6a0 Mon Sep 17 00:00:00 2001 From: thestig <thestig@chromium.org> Date: Thu, 15 Jan 2015 15:19:23 -0800 Subject: Cleanup most pylint errors in json_schema_compiler. Review URL: https://codereview.chromium.org/849103005 Cr-Commit-Position: refs/heads/master@{#311761} --- tools/json_schema_compiler/cc_generator.py | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) (limited to 'tools/json_schema_compiler/cc_generator.py') diff --git a/tools/json_schema_compiler/cc_generator.py b/tools/json_schema_compiler/cc_generator.py index 1d243f0..23056db 100644 --- a/tools/json_schema_compiler/cc_generator.py +++ b/tools/json_schema_compiler/cc_generator.py @@ -60,9 +60,9 @@ class _Generator(object): .Append('//') .Append() ) - for property in self._namespace.properties.values(): + for prop in self._namespace.properties.values(): property_code = self._type_helper.GeneratePropertyValues( - property, + prop, 'const %(type)s %(name)s = %(value)s;', nodoc=True) if property_code: @@ -454,8 +454,7 @@ class _Generator(object): # Results::Create function if function.callback: - c.Concat(self._GenerateCreateCallbackArguments(function_namespace, - 'Results', + c.Concat(self._GenerateCreateCallbackArguments('Results', function.callback)) c.Append('} // namespace %s' % function_namespace) @@ -467,10 +466,8 @@ class _Generator(object): event_namespace = cpp_util.Classname(event.name) (c.Append('namespace %s {' % event_namespace) .Append() - .Cblock(self._GenerateEventNameConstant(None, event)) - .Cblock(self._GenerateCreateCallbackArguments(event_namespace, - None, - event)) + .Cblock(self._GenerateEventNameConstant(event)) + .Cblock(self._GenerateCreateCallbackArguments(None, event)) .Append('} // namespace %s' % event_namespace) ) return c @@ -884,7 +881,6 @@ class _Generator(object): cpp_type_namespace = '' if type_.namespace != self._namespace: cpp_type_namespace = '%s::' % type_.namespace.unix_name - cpp_type_name = self._type_helper.GetCppType(type_) (c.Append('std::string %s;' % enum_as_string) .Sblock('if (!%s->GetAsString(&%s)) {' % (src_var, enum_as_string)) .Concat(self._GenerateError( @@ -965,7 +961,7 @@ class _Generator(object): c.Sblock('%s%s %sParse%s(const std::string& enum_string) {' % (maybe_namespace, classname, maybe_namespace, classname)) - for i, enum_value in enumerate( + for _, enum_value in enumerate( self._type_helper.FollowRef(type_).enum_values): # This is broken up into all ifs with no else ifs because we get # "fatal error C1061: compiler limit : blocks nested too deeply" @@ -979,7 +975,6 @@ class _Generator(object): return c def _GenerateCreateCallbackArguments(self, - cpp_namespace, function_scope, callback): """Generate all functions to create Value parameters for a callback. @@ -1017,7 +1012,7 @@ class _Generator(object): }) return c - def _GenerateEventNameConstant(self, function_scope, event): + def _GenerateEventNameConstant(self, event): """Generates a constant string array for the event name. """ c = Code() -- cgit v1.1