Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 from caching_file_system import CachingFileSystem | 5 from caching_file_system import CachingFileSystem |
| 6 from local_file_system import LocalFileSystem | 6 from local_file_system import LocalFileSystem |
| 7 from offline_file_system import OfflineFileSystem | 7 from offline_file_system import OfflineFileSystem |
| 8 from subversion_file_system import SubversionFileSystem | 8 from subversion_file_system import SubversionFileSystem |
| 9 from third_party.json_schema_compiler.memoize import memoize | 9 from third_party.json_schema_compiler.memoize import memoize |
| 10 | 10 |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 85 if self._constructor_for_test is not None: | 85 if self._constructor_for_test is not None: |
| 86 file_system = self._constructor_for_test(branch=branch, revision=revision) | 86 file_system = self._constructor_for_test(branch=branch, revision=revision) |
| 87 else: | 87 else: |
| 88 file_system = SubversionFileSystem.Create(branch=branch, | 88 file_system = SubversionFileSystem.Create(branch=branch, |
| 89 revision=revision) | 89 revision=revision) |
| 90 if self._offline: | 90 if self._offline: |
| 91 file_system = OfflineFileSystem(file_system) | 91 file_system = OfflineFileSystem(file_system) |
| 92 return CachingFileSystem(file_system, self._object_store_creator) | 92 return CachingFileSystem(file_system, self._object_store_creator) |
| 93 | 93 |
| 94 @staticmethod | 94 @staticmethod |
| 95 def ForLocal(object_store_creator): | 95 def ForLocal(object_store_creator, **optargs): |
| 96 '''Used in creating a server instance on localhost. | 96 '''Used in creating a server instance on localhost. |
| 97 ''' | 97 ''' |
| 98 return HostFileSystemProvider( | 98 optargs['constructor_for_test'] = lambda **_: LocalFileSystem.Create() |
|
Jeffrey Yasskin
2013/10/14 18:52:31
You can write:
HostFileSystemProvider(
object_s
not at google - send to devlin
2013/10/14 21:03:34
Done.
| |
| 99 object_store_creator, | 99 return HostFileSystemProvider(object_store_creator, **optargs) |
| 100 constructor_for_test=lambda **_: LocalFileSystem.Create()) | |
| 101 | 100 |
| 102 @staticmethod | 101 @staticmethod |
| 103 def ForTest(file_system, object_store_creator): | 102 def ForTest(file_system, object_store_creator, **optargs): |
| 104 '''Used in creating a test server instance. The HostFileSystemProvider | 103 '''Used in creating a test server instance. The HostFileSystemProvider |
| 105 returned here will always return |file_system| when its Create() method is | 104 returned here will always return |file_system| when its Create() method is |
| 106 called. | 105 called. |
| 107 ''' | 106 ''' |
| 108 return HostFileSystemProvider( | 107 optargs['constructor_for_test'] = lambda **_: file_system |
| 109 object_store_creator, | 108 return HostFileSystemProvider(object_store_creator, **optargs) |
| 110 constructor_for_test=lambda **_: file_system) | |
| OLD | NEW |