OLD | NEW |
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 import copy | 5 import copy |
6 import logging | 6 import logging |
7 import os | 7 import os |
8 import posixpath | 8 import posixpath |
9 | 9 |
10 from environment import IsPreviewServer | 10 from environment import IsPreviewServer |
11 from extensions_paths import ( | 11 from extensions_paths import ( |
12 API, API_FEATURES, JSON_TEMPLATES, PRIVATE_TEMPLATES) | 12 API_FEATURES, JSON_TEMPLATES, PRIVATE_TEMPLATES) |
13 import third_party.json_schema_compiler.json_parse as json_parse | 13 import third_party.json_schema_compiler.json_parse as json_parse |
14 import third_party.json_schema_compiler.model as model | 14 import third_party.json_schema_compiler.model as model |
15 from environment import IsPreviewServer | 15 from environment import IsPreviewServer |
16 from third_party.json_schema_compiler.memoize import memoize | 16 from third_party.json_schema_compiler.memoize import memoize |
17 | 17 |
18 | 18 |
19 def _CreateId(node, prefix): | 19 def _CreateId(node, prefix): |
20 if node.parent is not None and not isinstance(node.parent, model.Namespace): | 20 if node.parent is not None and not isinstance(node.parent, model.Namespace): |
21 return '-'.join([prefix, node.parent.simple_name, node.simple_name]) | 21 return '-'.join([prefix, node.parent.simple_name, node.simple_name]) |
22 return '-'.join([prefix, node.simple_name]) | 22 return '-'.join([prefix, node.simple_name]) |
(...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
565 # anything. Don't do it. | 565 # anything. Don't do it. |
566 if not IsPreviewServer(): | 566 if not IsPreviewServer(): |
567 handlebar_dict['samples'] = _LazySamplesGetter( | 567 handlebar_dict['samples'] = _LazySamplesGetter( |
568 handlebar_dict['name'], | 568 handlebar_dict['name'], |
569 self._samples) | 569 self._samples) |
570 return handlebar_dict | 570 return handlebar_dict |
571 | 571 |
572 def get(self, api_name, disable_refs=False): | 572 def get(self, api_name, disable_refs=False): |
573 return self._GenerateHandlebarContext( | 573 return self._GenerateHandlebarContext( |
574 self._get_schema_model(api_name, disable_refs)) | 574 self._get_schema_model(api_name, disable_refs)) |
OLD | NEW |