| 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 from collections import defaultdict, Mapping | 8 from collections import defaultdict, Mapping |
| 9 | 9 |
| 10 import third_party.json_schema_compiler.json_parse as json_parse | 10 import third_party.json_schema_compiler.json_parse as json_parse |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 if self._disable_refs: | 125 if self._disable_refs: |
| 126 type_name = link.split('.', 1)[-1] | 126 type_name = link.split('.', 1)[-1] |
| 127 return { 'href': '#type-%s' % type_name, 'text': link, 'name': link } | 127 return { 'href': '#type-%s' % type_name, 'text': link, 'name': link } |
| 128 return self._ref_resolver.SafeGetLink(link, namespace=self._namespace.name) | 128 return self._ref_resolver.SafeGetLink(link, namespace=self._namespace.name) |
| 129 | 129 |
| 130 def ToDict(self): | 130 def ToDict(self): |
| 131 if self._namespace is None: | 131 if self._namespace is None: |
| 132 return {} | 132 return {} |
| 133 return { | 133 return { |
| 134 'name': self._namespace.name, | 134 'name': self._namespace.name, |
| 135 'description': self._namespace.description, |
| 135 'types': self._GenerateTypes(self._namespace.types.values()), | 136 'types': self._GenerateTypes(self._namespace.types.values()), |
| 136 'functions': self._GenerateFunctions(self._namespace.functions), | 137 'functions': self._GenerateFunctions(self._namespace.functions), |
| 137 'events': self._GenerateEvents(self._namespace.events), | 138 'events': self._GenerateEvents(self._namespace.events), |
| 138 'properties': self._GenerateProperties(self._namespace.properties) | 139 'properties': self._GenerateProperties(self._namespace.properties) |
| 139 } | 140 } |
| 140 | 141 |
| 141 def _GenerateTypes(self, types): | 142 def _GenerateTypes(self, types): |
| 142 return [self._GenerateType(t) for t in types] | 143 return [self._GenerateType(t) for t in types] |
| 143 | 144 |
| 144 def _GenerateType(self, type_): | 145 def _GenerateType(self, type_): |
| (...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 501 if self._disable_refs: | 502 if self._disable_refs: |
| 502 cache, ext = ( | 503 cache, ext = ( |
| 503 (self._idl_cache_no_refs, '.idl') if (unix_name in idl_names) else | 504 (self._idl_cache_no_refs, '.idl') if (unix_name in idl_names) else |
| 504 (self._json_cache_no_refs, '.json')) | 505 (self._json_cache_no_refs, '.json')) |
| 505 else: | 506 else: |
| 506 cache, ext = ((self._idl_cache, '.idl') if (unix_name in idl_names) else | 507 cache, ext = ((self._idl_cache, '.idl') if (unix_name in idl_names) else |
| 507 (self._json_cache, '.json')) | 508 (self._json_cache, '.json')) |
| 508 return self._GenerateHandlebarContext( | 509 return self._GenerateHandlebarContext( |
| 509 cache.GetFromFile('%s/%s%s' % (self._base_path, unix_name, ext)), | 510 cache.GetFromFile('%s/%s%s' % (self._base_path, unix_name, ext)), |
| 510 path) | 511 path) |
| OLD | NEW |