| OLD | NEW |
| 1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 2013 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 posixpath | 5 import posixpath |
| 6 | 6 |
| 7 from compiled_file_system import SingleFile, Unicode | 7 from compiled_file_system import SingleFile, Unicode |
| 8 from docs_server_utils import StringIdentity | 8 from docs_server_utils import StringIdentity |
| 9 from extensions_paths import API_PATHS | 9 from extensions_paths import API_PATHS |
| 10 from features_bundle import HasParentFeature | 10 from features_bundle import HasParentFeature |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 file_system, self._CreateAPIModel, APIModels, category=self._platform) | 31 file_system, self._CreateAPIModel, APIModels, category=self._platform) |
| 32 | 32 |
| 33 @SingleFile | 33 @SingleFile |
| 34 @Unicode | 34 @Unicode |
| 35 def _CreateAPIModel(self, path, data): | 35 def _CreateAPIModel(self, path, data): |
| 36 def does_not_include_platform(node): | 36 def does_not_include_platform(node): |
| 37 return ('extension_types' in node and | 37 return ('extension_types' in node and |
| 38 node['extension_types'] != 'all' and | 38 node['extension_types'] != 'all' and |
| 39 self._platform not in node['extension_types']) | 39 self._platform not in node['extension_types']) |
| 40 | 40 |
| 41 schema = ProcessSchema(path, data, inline=True)[0] | 41 schema = ProcessSchema(path, data, full_inline=True)[0] |
| 42 if not schema: | 42 if not schema: |
| 43 raise ValueError('No schema for %s' % path) | 43 raise ValueError('No schema for %s' % path) |
| 44 return Namespace(DeleteNodes( | 44 return Namespace(DeleteNodes( |
| 45 schema, matcher=does_not_include_platform), schema['namespace']) | 45 schema, matcher=does_not_include_platform), schema['namespace']) |
| 46 | 46 |
| 47 def GetNames(self): | 47 def GetNames(self): |
| 48 # API names appear alongside some of their methods/events/etc in the | 48 # API names appear alongside some of their methods/events/etc in the |
| 49 # features file. APIs are those which either implicitly or explicitly have | 49 # features file. APIs are those which either implicitly or explicitly have |
| 50 # no parent feature (e.g. app, app.window, and devtools.inspectedWindow are | 50 # no parent feature (e.g. app, app.window, and devtools.inspectedWindow are |
| 51 # APIs; runtime.onConnectNative is not). | 51 # APIs; runtime.onConnectNative is not). |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 | 103 |
| 104 def IterModels(self): | 104 def IterModels(self): |
| 105 future_models = [(name, self.GetModel(name)) for name in self.GetNames()] | 105 future_models = [(name, self.GetModel(name)) for name in self.GetNames()] |
| 106 for name, future_model in future_models: | 106 for name, future_model in future_models: |
| 107 try: | 107 try: |
| 108 model = future_model.Get() | 108 model = future_model.Get() |
| 109 except FileNotFoundError: | 109 except FileNotFoundError: |
| 110 continue | 110 continue |
| 111 if model: | 111 if model: |
| 112 yield name, model | 112 yield name, model |
| OLD | NEW |