Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / common / extensions / docs / server2 / empty_dir_file_system.py
blob58053a80f57f50e8413797ff8d1ccdcd0cc6ce3c
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 FileNotFoundError, FileSystem, StatInfo
6 from future import Future
8 class EmptyDirFileSystem(FileSystem):
9 '''A FileSystem with empty directories. Useful to inject places to disable
10 features such as samples.
11 '''
12 def Read(self, paths):
13 result = {}
14 for path in paths:
15 if not path.endswith('/'):
16 raise FileNotFoundError('EmptyDirFileSystem cannot read %s' % path)
17 result[path] = []
18 return Future(value=result)
20 def Refresh(self):
21 return Future(value=())
23 def Stat(self, path):
24 if not path.endswith('/'):
25 raise FileNotFoundError('EmptyDirFileSystem cannot stat %s' % path)
26 return StatInfo(0, child_versions=[])
28 def GetIdentity(self):
29 return self.__class__.__name__