Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(163)

Side by Side Diff: tools/json_schema_compiler/model.py

Issue 849103005: Cleanup most pylint errors in json_schema_compiler. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import os.path 5 import os.path
6 6
7 from json_parse import OrderedDict 7 from json_parse import OrderedDict
8 from memoize import memoize 8 from memoize import memoize
9 9
10 10
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 options = json.get('options', {}) 297 options = json.get('options', {})
298 self.conditions = options.get('conditions', []) 298 self.conditions = options.get('conditions', [])
299 self.actions = options.get('actions', []) 299 self.actions = options.get('actions', [])
300 self.supports_listeners = options.get('supportsListeners', True) 300 self.supports_listeners = options.get('supportsListeners', True)
301 self.supports_rules = options.get('supportsRules', False) 301 self.supports_rules = options.get('supportsRules', False)
302 self.supports_dom = options.get('supportsDom', False) 302 self.supports_dom = options.get('supportsDom', False)
303 303
304 def GeneratePropertyFromParam(p): 304 def GeneratePropertyFromParam(p):
305 return Property(self, p['name'], p, namespace, origin) 305 return Property(self, p['name'], p, namespace, origin)
306 306
307 self.filters = [GeneratePropertyFromParam(filter) 307 self.filters = [GeneratePropertyFromParam(filter_instance)
308 for filter in json.get('filters', [])] 308 for filter_instance in json.get('filters', [])]
309 callback_param = None 309 callback_param = None
310 for param in json.get('parameters', []): 310 for param in json.get('parameters', []):
311 if param.get('type') == 'function': 311 if param.get('type') == 'function':
312 if callback_param: 312 if callback_param:
313 # No ParseException because the webstore has this. 313 # No ParseException because the webstore has this.
314 # Instead, pretend all intermediate callbacks are properties. 314 # Instead, pretend all intermediate callbacks are properties.
315 self.params.append(GeneratePropertyFromParam(callback_param)) 315 self.params.append(GeneratePropertyFromParam(callback_param))
316 callback_param = param 316 callback_param = param
317 else: 317 else:
318 self.params.append(GeneratePropertyFromParam(param)) 318 self.params.append(GeneratePropertyFromParam(param))
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
596 # Sanity check: platforms should not be an empty list. 596 # Sanity check: platforms should not be an empty list.
597 if not json['platforms']: 597 if not json['platforms']:
598 raise ValueError('"platforms" cannot be an empty list') 598 raise ValueError('"platforms" cannot be an empty list')
599 platforms = [] 599 platforms = []
600 for platform_name in json['platforms']: 600 for platform_name in json['platforms']:
601 for platform_enum in _Enum.GetAll(Platforms): 601 for platform_enum in _Enum.GetAll(Platforms):
602 if platform_name == platform_enum.name: 602 if platform_name == platform_enum.name:
603 platforms.append(platform_enum) 603 platforms.append(platform_enum)
604 break 604 break
605 return platforms 605 return platforms
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698