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

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

Issue 1848103005: [Extensions] Remove the "use_movable_types" entry from idl/json files (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
« no previous file with comments | « extensions/common/api/webcam_private.idl ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 copy 5 import copy
6 6
7 import json_parse 7 import json_parse
8 8
9 9
10 def DeleteNodes(item, delete_key=None, matcher=None): 10 def DeleteNodes(item, delete_key=None, matcher=None):
(...skipping 19 matching lines...) Expand all
30 for key in toDelete: 30 for key in toDelete:
31 del item[key] 31 del item[key]
32 elif type(item) == list: 32 elif type(item) == list:
33 item[:] = [DeleteNodes(thing, delete_key, matcher) 33 item[:] = [DeleteNodes(thing, delete_key, matcher)
34 for thing in item if not ShouldDelete(thing)] 34 for thing in item if not ShouldDelete(thing)]
35 35
36 return item 36 return item
37 37
38 38
39 def Load(filename): 39 def Load(filename):
40 with open(filename, 'r') as handle: 40 try:
41 schemas = json_parse.Parse(handle.read()) 41 with open(filename, 'r') as handle:
42 return schemas 42 schemas = json_parse.Parse(handle.read())
43 return schemas
44 except:
45 print('FAILED: Exception encountered while loading "%s"' % filename)
Devlin 2016/04/01 23:34:29 drive-by: compile failures where I forgot to remov
lazyboy 2016/04/02 00:04:34 Acknowledged.
46 raise
43 47
44 48
45 # A dictionary mapping |filename| to the object resulting from loading the JSON 49 # A dictionary mapping |filename| to the object resulting from loading the JSON
46 # at |filename|. 50 # at |filename|.
47 _cache = {} 51 _cache = {}
48 52
49 53
50 def CachedLoad(filename): 54 def CachedLoad(filename):
51 """Equivalent to Load(filename), but caches results for subsequent calls""" 55 """Equivalent to Load(filename), but caches results for subsequent calls"""
52 if filename not in _cache: 56 if filename not in _cache:
53 _cache[filename] = Load(filename) 57 _cache[filename] = Load(filename)
54 # Return a copy of the object so that any changes a caller makes won't affect 58 # Return a copy of the object so that any changes a caller makes won't affect
55 # the next caller. 59 # the next caller.
56 return copy.deepcopy(_cache[filename]) 60 return copy.deepcopy(_cache[filename])
57 61
OLDNEW
« no previous file with comments | « extensions/common/api/webcam_private.idl ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698