| OLD | NEW |
| 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 import os | 5 import os |
| 6 | 6 |
| 7 class FileNotFoundError(Exception): | 7 class FileNotFoundError(Exception): |
| 8 def __init__(self, filename): | 8 def __init__(self, filename): |
| 9 Exception.__init__(self, filename) | 9 Exception.__init__(self, filename) |
| 10 | 10 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 binary=True then the contents will be a str. | 49 binary=True then the contents will be a str. |
| 50 ''' | 50 ''' |
| 51 raise NotImplementedError() | 51 raise NotImplementedError() |
| 52 | 52 |
| 53 def ReadSingle(self, path, binary=False): | 53 def ReadSingle(self, path, binary=False): |
| 54 '''Reads a single file from the FileSystem. | 54 '''Reads a single file from the FileSystem. |
| 55 ''' | 55 ''' |
| 56 return self.Read([path], binary=binary).Get()[path] | 56 return self.Read([path], binary=binary).Get()[path] |
| 57 | 57 |
| 58 # TODO(cduvall): Allow Stat to take a list of paths like Read. | 58 # TODO(cduvall): Allow Stat to take a list of paths like Read. |
| 59 # TODO(kalman): Make stat values always (incrementing) ints. |
| 60 # GithubFileSystem can use the timestamp of the patch rather than the hash? |
| 59 def Stat(self, path): | 61 def Stat(self, path): |
| 60 '''Returns a |StatInfo| object containing the version of |path|. If |path| | 62 '''Returns a |StatInfo| object containing the version of |path|. If |path| |
| 61 is a directory, |StatInfo| will have the versions of all the children of | 63 is a directory, |StatInfo| will have the versions of all the children of |
| 62 the directory in |StatInfo.child_versions|. | 64 the directory in |StatInfo.child_versions|. |
| 63 ''' | 65 ''' |
| 64 raise NotImplementedError() | 66 raise NotImplementedError() |
| 65 | 67 |
| 66 @classmethod | 68 @classmethod |
| 67 def GetName(cls): | 69 def GetName(cls): |
| 68 '''The type of the file system, exposed for caching classes to namespace | 70 '''The type of the file system, exposed for caching classes to namespace |
| 69 their caches. It is unlikely that this needs to be overridden. | 71 their caches. It is unlikely that this needs to be overridden. |
| 70 ''' | 72 ''' |
| 71 return cls.__name__ | 73 return cls.__name__ |
| 72 | 74 |
| 73 @classmethod | 75 @classmethod |
| 74 def GetVersion(cls): | 76 def GetVersion(cls): |
| 75 '''The version of the file system, exposed for caching classes backed to | 77 '''The version of the file system, exposed for caching classes backed to |
| 76 file systems. It is unlikely that this needs to be overridden. | 78 file systems. It is unlikely that this needs to be overridden. |
| 77 ''' | 79 ''' |
| 78 return None | 80 return None |
| OLD | NEW |