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

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

Issue 48263002: list apis by channel info, e.g. dev, stable (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
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
11 from future import Gettable, Future 11 from future import Gettable, Future
12 from schema_util import ProcessSchema 12 from schema_util import ProcessSchema
13 from svn_constants import API_PATH 13 from svn_constants import API_PATH
14 from third_party.json_schema_compiler.model import Namespace, UnixName 14 from third_party.json_schema_compiler.model import Namespace, UnixName
15 15
16 16
17 @SingleFile 17 @SingleFile
18 def _CreateAPIModel(path, data): 18 def _CreateAPIModel(path, data):
19 schema = ProcessSchema(path, data) 19 schema = ProcessSchema(path, data)
20 if os.path.splitext(path)[1] == '.json': 20 if os.path.splitext(path)[1] == '.json':
21 schema = schema[0] 21 schema = schema[0]
22 if not schema: return None
not at google - send to devlin 2013/11/07 23:52:18 When does this happen? If the schema doesn't parse
hukun 2013/11/08 06:23:39 One example is "musicManagerPrivate". 1) Process
22 return Namespace(schema, schema['namespace']) 23 return Namespace(schema, schema['namespace'])
23 24
24
not at google - send to devlin 2013/11/07 23:52:18 Ppython style is still is actually to have 2 blank
hukun 2013/11/08 06:23:39 Done
25 class APIModels(object): 25 class APIModels(object):
26 '''Tracks APIs and their Models. 26 '''Tracks APIs and their Models.
27 ''' 27 '''
28 28
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):
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
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

Powered by Google App Engine
This is Rietveld 408576698