OLD | NEW |
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 import logging | 6 import logging |
7 import os | 7 import os |
8 | 8 |
9 import compiled_file_system as compiled_fs | 9 import compiled_file_system as compiled_fs |
10 from file_system import FileNotFoundError | 10 from file_system import FileNotFoundError |
11 import third_party.json_schema_compiler.json_parse as json_parse | 11 import third_party.json_schema_compiler.json_parse as json_parse |
12 import third_party.json_schema_compiler.model as model | 12 import third_party.json_schema_compiler.model as model |
13 import third_party.json_schema_compiler.idl_schema as idl_schema | 13 import third_party.json_schema_compiler.idl_schema as idl_schema |
14 import third_party.json_schema_compiler.idl_parser as idl_parser | 14 import third_party.json_schema_compiler.idl_parser as idl_parser |
15 | 15 |
16 # Increment this version when there are changes to the data stored in any of | 16 # Increment this version when there are changes to the data stored in any of |
17 # the caches used by APIDataSource. This allows the cache to be invalidated | 17 # the caches used by APIDataSource. This would include changes to model.py in |
18 # without having to flush memcache on the production server. | 18 # JSON schema compiler! This allows the cache to be invalidated without having |
19 _VERSION = 8 | 19 # to flush memcache on the production server. |
| 20 _VERSION = 9 |
20 | 21 |
21 def _RemoveNoDocs(item): | 22 def _RemoveNoDocs(item): |
22 if json_parse.IsDict(item): | 23 if json_parse.IsDict(item): |
23 if item.get('nodoc', False): | 24 if item.get('nodoc', False): |
24 return True | 25 return True |
25 to_remove = [] | 26 to_remove = [] |
26 for key, value in item.items(): | 27 for key, value in item.items(): |
27 if _RemoveNoDocs(value): | 28 if _RemoveNoDocs(value): |
28 to_remove.append(key) | 29 to_remove.append(key) |
29 for k in to_remove: | 30 for k in to_remove: |
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
420 if self._disable_refs: | 421 if self._disable_refs: |
421 cache, ext = ( | 422 cache, ext = ( |
422 (self._idl_cache_no_refs, '.idl') if (unix_name in idl_names) else | 423 (self._idl_cache_no_refs, '.idl') if (unix_name in idl_names) else |
423 (self._json_cache_no_refs, '.json')) | 424 (self._json_cache_no_refs, '.json')) |
424 else: | 425 else: |
425 cache, ext = ((self._idl_cache, '.idl') if (unix_name in idl_names) else | 426 cache, ext = ((self._idl_cache, '.idl') if (unix_name in idl_names) else |
426 (self._json_cache, '.json')) | 427 (self._json_cache, '.json')) |
427 return self._GenerateHandlebarContext( | 428 return self._GenerateHandlebarContext( |
428 cache.GetFromFile('%s/%s%s' % (self._base_path, unix_name, ext)), | 429 cache.GetFromFile('%s/%s%s' % (self._base_path, unix_name, ext)), |
429 path) | 430 path) |
OLD | NEW |