| 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 sys | 5 import sys |
| 6 | 6 |
| 7 import schema_util | 7 import schema_util |
| 8 from docs_server_utils import ToUnicode | 8 from docs_server_utils import ToUnicode |
| 9 from file_system import FileNotFoundError | 9 from file_system import FileNotFoundError |
| 10 from future import Future | 10 from future import Future |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 '''A CompiledFileSystem specifically for parsing JSON configuration data. | 99 '''A CompiledFileSystem specifically for parsing JSON configuration data. |
| 100 These are memoized over file systems tied to different branches. | 100 These are memoized over file systems tied to different branches. |
| 101 ''' | 101 ''' |
| 102 return self.Create(file_system, | 102 return self.Create(file_system, |
| 103 SingleFile(lambda _, data: | 103 SingleFile(lambda _, data: |
| 104 json_parse.Parse(ToUnicode(data))), | 104 json_parse.Parse(ToUnicode(data))), |
| 105 CompiledFileSystem, | 105 CompiledFileSystem, |
| 106 category='json') | 106 category='json') |
| 107 | 107 |
| 108 @memoize | 108 @memoize |
| 109 def ForApiSchema(self, file_system): | 109 def ForAPISchema(self, file_system): |
| 110 '''Creates a CompiledFileSystem for parsing raw JSON or IDL API schema | 110 '''Creates a CompiledFileSystem for parsing raw JSON or IDL API schema |
| 111 data and formatting it so that it can be used by other classes, such | 111 data and formatting it so that it can be used by other classes, such |
| 112 as Model and APISchemaGraph. | 112 as Model and APISchemaGraph. |
| 113 ''' | 113 ''' |
| 114 return self.Create(file_system, | 114 return self.Create(file_system, |
| 115 SingleFile(Unicode(schema_util.ProcessSchema)), | 115 SingleFile(Unicode(schema_util.ProcessSchema)), |
| 116 CompiledFileSystem, | 116 CompiledFileSystem, |
| 117 category='api-schema') | 117 category='api-schema') |
| 118 | 118 |
| 119 @memoize | 119 @memoize |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 cache_entry = self._list_object_store.Get(path).Get() | 258 cache_entry = self._list_object_store.Get(path).Get() |
| 259 if cache_entry is not None: | 259 if cache_entry is not None: |
| 260 return cache_entry.version | 260 return cache_entry.version |
| 261 return self._file_system.Stat(path).version | 261 return self._file_system.Stat(path).version |
| 262 | 262 |
| 263 def FileExists(self, path): | 263 def FileExists(self, path): |
| 264 return self._file_system.Exists(path) | 264 return self._file_system.Exists(path) |
| 265 | 265 |
| 266 def GetIdentity(self): | 266 def GetIdentity(self): |
| 267 return self._file_system.GetIdentity() | 267 return self._file_system.GetIdentity() |
| OLD | NEW |