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

Side by Side Diff: chrome/common/extensions/docs/server2/api_models.py

Issue 385703005: Docserver: Modify doc inlining so all relevant data is present in availability_finder.py (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 5 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 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
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 # Inlined types are retained in the processed schema for availability
42 # finding purposes; they should be removed when creating Namespace objects.
not at google - send to devlin 2014/07/16 16:17:15 See comment in schema_util. This comment shouldn't
43 schema = ProcessSchema(path, data, retain_inlined_types=False)[0]
42 if not schema: 44 if not schema:
43 raise ValueError('No schema for %s' % path) 45 raise ValueError('No schema for %s' % path)
44 return Namespace(DeleteNodes( 46 return Namespace(DeleteNodes(
45 schema, matcher=does_not_include_platform), schema['namespace']) 47 schema, matcher=does_not_include_platform), schema['namespace'])
46 48
47 def GetNames(self): 49 def GetNames(self):
48 # API names appear alongside some of their methods/events/etc in the 50 # API names appear alongside some of their methods/events/etc in the
49 # features file. APIs are those which either implicitly or explicitly have 51 # features file. APIs are those which either implicitly or explicitly have
50 # no parent feature (e.g. app, app.window, and devtools.inspectedWindow are 52 # no parent feature (e.g. app, app.window, and devtools.inspectedWindow are
51 # APIs; runtime.onConnectNative is not). 53 # APIs; runtime.onConnectNative is not).
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 105
104 def IterModels(self): 106 def IterModels(self):
105 future_models = [(name, self.GetModel(name)) for name in self.GetNames()] 107 future_models = [(name, self.GetModel(name)) for name in self.GetNames()]
106 for name, future_model in future_models: 108 for name, future_model in future_models:
107 try: 109 try:
108 model = future_model.Get() 110 model = future_model.Get()
109 except FileNotFoundError: 111 except FileNotFoundError:
110 continue 112 continue
111 if model: 113 if model:
112 yield name, model 114 yield name, model
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698