Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(236)

Side by Side Diff: chrome/common/extensions/docs/server2/empty_dir_file_system.py

Issue 15087006: Docserver: there is only one. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: epic rebase Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 file_system import FileNotFoundError, FileSystem, StatInfo 5 from file_system import FileNotFoundError, FileSystem, StatInfo
6 from future import Future 6 from future import Future
7 7
8 class EmptyDirFileSystem(FileSystem): 8 class EmptyDirFileSystem(FileSystem):
9 '''A FileSystem with empty directories. Useful to inject places to disable 9 '''A FileSystem with empty directories. Useful to inject places to disable
10 features such as samples. 10 features such as samples.
11 ''' 11 '''
12 def Read(self, paths, binary=False): 12 def Read(self, paths, binary=False):
13 result = {} 13 result = {}
14 for path in paths: 14 for path in paths:
15 if not path.endswith('/'): 15 if not path.endswith('/'):
16 raise FileNotFoundError('EmptyDirFileSystem cannot read %s' % path) 16 raise FileNotFoundError('EmptyDirFileSystem cannot read %s' % path)
17 result[path] = [] 17 result[path] = []
18 return Future(value=result) 18 return Future(value=result)
19 19
20 def Stat(self, path): 20 def Stat(self, path):
21 if not path.endswith('/'): 21 if not path.endswith('/'):
22 raise FileNotFoundError('EmptyDirFileSystem cannot stat %s' % path) 22 raise FileNotFoundError('EmptyDirFileSystem cannot stat %s' % path)
23 return StatInfo(0, child_versions=[]) 23 return StatInfo(0, child_versions=[])
24
25 def GetIdentity(self):
26 return self.__class__.__name__
OLDNEW
« no previous file with comments | « chrome/common/extensions/docs/server2/cron_servlet_test.py ('k') | chrome/common/extensions/docs/server2/file_system.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698