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 would include changes to model.py in | 17 # the caches used by APIDataSource. This allows the cache to be invalidated |
18 # JSON schema compiler! This allows the cache to be invalidated without having | 18 # without having to flush memcache on the production server. |
19 # to flush memcache on the production server. | 19 _VERSION = 9 |
20 _VERSION = 10 | |
21 | 20 |
22 def _RemoveNoDocs(item): | 21 def _RemoveNoDocs(item): |
23 if json_parse.IsDict(item): | 22 if json_parse.IsDict(item): |
24 if item.get('nodoc', False): | 23 if item.get('nodoc', False): |
25 return True | 24 return True |
26 to_remove = [] | 25 to_remove = [] |
27 for key, value in item.items(): | 26 for key, value in item.items(): |
28 if _RemoveNoDocs(value): | 27 if _RemoveNoDocs(value): |
29 to_remove.append(key) | 28 to_remove.append(key) |
30 for k in to_remove: | 29 for k in to_remove: |
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
428 if self._disable_refs: | 427 if self._disable_refs: |
429 cache, ext = ( | 428 cache, ext = ( |
430 (self._idl_cache_no_refs, '.idl') if (unix_name in idl_names) else | 429 (self._idl_cache_no_refs, '.idl') if (unix_name in idl_names) else |
431 (self._json_cache_no_refs, '.json')) | 430 (self._json_cache_no_refs, '.json')) |
432 else: | 431 else: |
433 cache, ext = ((self._idl_cache, '.idl') if (unix_name in idl_names) else | 432 cache, ext = ((self._idl_cache, '.idl') if (unix_name in idl_names) else |
434 (self._json_cache, '.json')) | 433 (self._json_cache, '.json')) |
435 return self._GenerateHandlebarContext( | 434 return self._GenerateHandlebarContext( |
436 cache.GetFromFile('%s/%s%s' % (self._base_path, unix_name, ext)), | 435 cache.GetFromFile('%s/%s%s' % (self._base_path, unix_name, ext)), |
437 path) | 436 path) |
OLD | NEW |