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

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

Issue 337373004: Docserver: Replace instances of 'Api' with 'API' (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 6 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
« no previous file with comments | « no previous file | chrome/common/extensions/docs/server2/api_data_source_test.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 from copy import copy 5 from copy import copy
6 import logging 6 import logging
7 import os 7 import os
8 import posixpath 8 import posixpath
9 9
10 from data_source import DataSource 10 from data_source import DataSource
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 'properties': self._GenerateProperties(self._namespace.properties), 108 'properties': self._GenerateProperties(self._namespace.properties),
109 'introList': self._GetIntroTableList(), 109 'introList': self._GetIntroTableList(),
110 'channelWarning': self._GetChannelWarning(), 110 'channelWarning': self._GetChannelWarning(),
111 } 111 }
112 if self._namespace.deprecated: 112 if self._namespace.deprecated:
113 as_dict['deprecated'] = self._namespace.deprecated 113 as_dict['deprecated'] = self._namespace.deprecated
114 114
115 as_dict['byName'] = _GetByNameDict(as_dict) 115 as_dict['byName'] = _GetByNameDict(as_dict)
116 return as_dict 116 return as_dict
117 117
118 def _GetApiAvailability(self): 118 def _GetAPIAvailability(self):
119 return self._availability_finder.GetApiAvailability(self._namespace.name) 119 return self._availability_finder.GetAPIAvailability(self._namespace.name)
120 120
121 def _GetChannelWarning(self): 121 def _GetChannelWarning(self):
122 if not self._IsExperimental(): 122 if not self._IsExperimental():
123 return { self._GetApiAvailability().channel_info.channel: True } 123 return { self._GetAPIAvailability().channel_info.channel: True }
124 return None 124 return None
125 125
126 def _IsExperimental(self): 126 def _IsExperimental(self):
127 return self._namespace.name.startswith('experimental') 127 return self._namespace.name.startswith('experimental')
128 128
129 def _GenerateTypes(self, types): 129 def _GenerateTypes(self, types):
130 return [self._GenerateType(t) for t in types] 130 return [self._GenerateType(t) for t in types]
131 131
132 def _GenerateType(self, type_): 132 def _GenerateType(self, type_):
133 type_dict = { 133 type_dict = {
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 } 347 }
348 348
349 def _GetIntroAvailabilityRow(self): 349 def _GetIntroAvailabilityRow(self):
350 ''' Generates the 'Availability' row data for an API intro table. 350 ''' Generates the 'Availability' row data for an API intro table.
351 ''' 351 '''
352 if self._IsExperimental(): 352 if self._IsExperimental():
353 status = 'experimental' 353 status = 'experimental'
354 version = None 354 version = None
355 scheduled = None 355 scheduled = None
356 else: 356 else:
357 availability = self._GetApiAvailability() 357 availability = self._GetAPIAvailability()
358 status = availability.channel_info.channel 358 status = availability.channel_info.channel
359 version = availability.channel_info.version 359 version = availability.channel_info.version
360 scheduled = availability.scheduled 360 scheduled = availability.scheduled
361 return { 361 return {
362 'title': 'Availability', 362 'title': 'Availability',
363 'content': [{ 363 'content': [{
364 'partial': self._template_cache.GetFromFile( 364 'partial': self._template_cache.GetFromFile(
365 posixpath.join(PRIVATE_TEMPLATES, 365 posixpath.join(PRIVATE_TEMPLATES,
366 'intro_tables', 366 'intro_tables',
367 '%s_message.html' % status)).Get(), 367 '%s_message.html' % status)).Get(),
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
528 self._samples) 528 self._samples)
529 return handlebar_dict 529 return handlebar_dict
530 return Future(callback=resolve) 530 return Future(callback=resolve)
531 531
532 def get(self, api_name): 532 def get(self, api_name):
533 return self._GetImpl(api_name).Get() 533 return self._GetImpl(api_name).Get()
534 534
535 def Cron(self): 535 def Cron(self):
536 futures = [self._GetImpl(name) for name in self._api_models.GetNames()] 536 futures = [self._GetImpl(name) for name in self._api_models.GetNames()]
537 return Collect(futures, except_pass=FileNotFoundError) 537 return Collect(futures, except_pass=FileNotFoundError)
OLDNEW
« no previous file with comments | « no previous file | chrome/common/extensions/docs/server2/api_data_source_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698