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
7 from path_util
import IsDirectory
10 class EmptyDirFileSystem(FileSystem
):
11 '''A FileSystem with empty directories. Useful to inject places to disable
12 features such as samples.
14 def Read(self
, paths
, skip_not_found
=False):
17 if not IsDirectory(path
):
18 if skip_not_found
: continue
19 raise FileNotFoundError('EmptyDirFileSystem cannot read %s' % path
)
21 return Future(value
=result
)
24 return Future(value
=())
27 if not IsDirectory(path
):
28 raise FileNotFoundError('EmptyDirFileSystem cannot stat %s' % path
)
29 return StatInfo(0, child_versions
=[])
31 def GetIdentity(self
):
32 return self
.__class
__.__name
__