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

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

Issue 63203002: Docserver: Make the hand-written Cron methods run first rather than last, since (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: jeffrey Created 7 years, 1 month 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 | Annotate | Revision Log
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 logging 5 import logging
6 import os 6 import os
7 import posixpath 7 import posixpath
8 8
9 from compiled_file_system import SingleFile 9 from compiled_file_system import SingleFile
10 from file_system import FileNotFoundError 10 from file_system import FileNotFoundError
(...skipping 18 matching lines...) Expand all
29 def __init__(self, features_bundle, compiled_fs_factory, file_system): 29 def __init__(self, features_bundle, compiled_fs_factory, file_system):
30 self._features_bundle = features_bundle 30 self._features_bundle = features_bundle
31 self._model_cache = compiled_fs_factory.Create( 31 self._model_cache = compiled_fs_factory.Create(
32 file_system, _CreateAPIModel, APIModels) 32 file_system, _CreateAPIModel, APIModels)
33 33
34 def GetNames(self): 34 def GetNames(self):
35 # API names appear alongside some of their methods/events/etc in the 35 # API names appear alongside some of their methods/events/etc in the
36 # features file. APIs are those which either implicitly or explicitly have 36 # features file. APIs are those which either implicitly or explicitly have
37 # no parent feature (e.g. app, app.window, and devtools.inspectedWindow are 37 # no parent feature (e.g. app, app.window, and devtools.inspectedWindow are
38 # APIs; runtime.onConnectNative is not). 38 # APIs; runtime.onConnectNative is not).
39 api_features = self._features_bundle.GetAPIFeatures() 39 api_features = self._features_bundle.GetAPIFeatures().Get()
40 return [name for name, feature in api_features.iteritems() 40 return [name for name, feature in api_features.iteritems()
41 if ('.' not in name or 41 if ('.' not in name or
42 name.rsplit('.', 1)[0] not in api_features or 42 name.rsplit('.', 1)[0] not in api_features or
43 feature.get('noparent'))] 43 feature.get('noparent'))]
44 44
45 def GetModel(self, api_name): 45 def GetModel(self, api_name):
46 # Callers sometimes specify a filename which includes .json or .idl - if 46 # Callers sometimes specify a filename which includes .json or .idl - if
47 # so, believe them. They may even include the 'api/' prefix. 47 # so, believe them. They may even include the 'api/' prefix.
48 if os.path.splitext(api_name)[1] in ('.json', '.idl'): 48 if os.path.splitext(api_name)[1] in ('.json', '.idl'):
49 if not api_name.startswith(API_PATH + '/'): 49 if not api_name.startswith(API_PATH + '/'):
(...skipping 16 matching lines...) Expand all
66 (API_PATH, file_name, ext)) 66 (API_PATH, file_name, ext))
67 for ext in ('json', 'idl')] 67 for ext in ('json', 'idl')]
68 def resolve(): 68 def resolve():
69 for future in futures: 69 for future in futures:
70 try: 70 try:
71 return future.Get() 71 return future.Get()
72 except FileNotFoundError: pass 72 except FileNotFoundError: pass
73 # Propagate the first FileNotFoundError if neither were found. 73 # Propagate the first FileNotFoundError if neither were found.
74 futures[0].Get() 74 futures[0].Get()
75 return Future(delegate=Gettable(resolve)) 75 return Future(delegate=Gettable(resolve))
OLDNEW
« no previous file with comments | « chrome/common/extensions/docs/server2/api_list_data_source.py ('k') | chrome/common/extensions/docs/server2/app.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698