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

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

Issue 82433002: Docserver: Further refactoring to the new GithubFileSystem to make it update (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase, fix test data Created 7 years 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 (c) 2012 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2012 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 future import Gettable, Future 5 from future import Gettable, Future
6 6
7 7
8 class FileNotFoundError(Exception): 8 class _BaseFileSystemException(Exception):
9 def __init__(self, message):
10 Exception.__init__(self, message)
11
12 @classmethod
13 def RaiseInFuture(cls, message):
14 def boom(): raise cls(message)
15 return Future(delegate=Gettable(boom))
16
17
18 class FileNotFoundError(_BaseFileSystemException):
9 '''Raised when a file isn't found for read or stat. 19 '''Raised when a file isn't found for read or stat.
10 ''' 20 '''
11 def __init__(self, filename): 21 def __init__(self, filename):
12 Exception.__init__(self, filename) 22 _BaseFileSystemException.__init__(self, filename)
13 23
14 24
15 class FileSystemError(Exception): 25 class FileSystemError(_BaseFileSystemException):
16 '''Raised on when there are errors reading or statting files, such as a 26 '''Raised on when there are errors reading or statting files, such as a
17 network timeout. 27 network timeout.
18 ''' 28 '''
19 def __init__(self, filename): 29 def __init__(self, filename):
20 Exception.__init__(self, filename) 30 _BaseFileSystemException.__init__(self, filename)
21 31
22 32
23 class StatInfo(object): 33 class StatInfo(object):
24 '''The result of calling Stat on a FileSystem. 34 '''The result of calling Stat on a FileSystem.
25 ''' 35 '''
26 def __init__(self, version, child_versions=None): 36 def __init__(self, version, child_versions=None):
27 self.version = version 37 self.version = version
28 self.child_versions = child_versions 38 self.child_versions = child_versions
29 39
30 def __eq__(self, other): 40 def __eq__(self, other):
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 yield walkinfo 143 yield walkinfo
134 144
135 for walkinfo in walk(root): 145 for walkinfo in walk(root):
136 yield walkinfo 146 yield walkinfo
137 147
138 def __repr__(self): 148 def __repr__(self):
139 return '<%s>' % type(self).__name__ 149 return '<%s>' % type(self).__name__
140 150
141 def __str__(self): 151 def __str__(self):
142 return repr(self) 152 return repr(self)
OLDNEW
« no previous file with comments | « chrome/common/extensions/docs/server2/fake_fetchers.py ('k') | chrome/common/extensions/docs/server2/github_file_system.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698