Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / common / extensions / docs / server2 / offline_file_system.py
bloba020113d49b4e04cc9d643dd43c0d8b69810a406
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
3 # found in the LICENSE file.
5 from file_system import FileSystem, FileNotFoundError
6 from future import Gettable, Future
9 class OfflineFileSystem(FileSystem):
10 '''An offline FileSystem which masquerades as another file system. It throws
11 FileNotFound error for all operations, and overrides GetIdentity.
12 '''
13 def __init__(self, fs):
14 self._fs = fs
16 def Read(self, paths):
17 def raise_file_not_found():
18 raise FileNotFoundError('File system is offline, cannot read %s' % paths)
19 return Future(delegate=Gettable(raise_file_not_found))
21 def Stat(self, path):
22 raise FileNotFoundError('File system is offline, cannot read %s' % path)
24 def GetIdentity(self):
25 return self._fs.GetIdentity()