| OLD | NEW |
| 1 # Copyright (C) 2009 Google Inc. All rights reserved. | 1 # Copyright (C) 2009 Google Inc. All rights reserved. |
| 2 # | 2 # |
| 3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
| 4 # modification, are permitted provided that the following conditions are | 4 # modification, are permitted provided that the following conditions are |
| 5 # met: | 5 # met: |
| 6 # | 6 # |
| 7 # * Redistributions of source code must retain the above copyright | 7 # * Redistributions of source code must retain the above copyright |
| 8 # notice, this list of conditions and the following disclaimer. | 8 # notice, this list of conditions and the following disclaimer. |
| 9 # * Redistributions in binary form must reproduce the above | 9 # * Redistributions in binary form must reproduce the above |
| 10 # copyright notice, this list of conditions and the following disclaimer | 10 # copyright notice, this list of conditions and the following disclaimer |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 | 117 |
| 118 self.files[destination] = self.files[source] | 118 self.files[destination] = self.files[source] |
| 119 self.written_files[destination] = self.files[source] | 119 self.written_files[destination] = self.files[source] |
| 120 | 120 |
| 121 def dirname(self, path): | 121 def dirname(self, path): |
| 122 return self._split(path)[0] | 122 return self._split(path)[0] |
| 123 | 123 |
| 124 def exists(self, path): | 124 def exists(self, path): |
| 125 return self.isfile(path) or self.isdir(path) | 125 return self.isfile(path) or self.isdir(path) |
| 126 | 126 |
| 127 def getsize(self, path): |
| 128 if not self.exists(path): |
| 129 self._raise_not_found(path) |
| 130 return len(self.read_binary_file(path)) |
| 131 |
| 127 def files_under(self, path, dirs_to_skip=None, file_filter=None): | 132 def files_under(self, path, dirs_to_skip=None, file_filter=None): |
| 128 dirs_to_skip = dirs_to_skip or [] | 133 dirs_to_skip = dirs_to_skip or [] |
| 129 | 134 |
| 130 filter_all = lambda fs, dirpath, basename: True | 135 filter_all = lambda fs, dirpath, basename: True |
| 131 | 136 |
| 132 file_filter = file_filter or filter_all | 137 file_filter = file_filter or filter_all |
| 133 files = [] | 138 files = [] |
| 134 if self.isfile(path): | 139 if self.isfile(path): |
| 135 if file_filter(self, self.dirname(path), self.basename(path)) and se
lf.files[path] is not None: | 140 if file_filter(self, self.dirname(path), self.basename(path)) and se
lf.files[path] is not None: |
| 136 files.append(path) | 141 files.append(path) |
| (...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 495 return self.data.readline(length) | 500 return self.data.readline(length) |
| 496 | 501 |
| 497 def __iter__(self): | 502 def __iter__(self): |
| 498 return self.data.__iter__() | 503 return self.data.__iter__() |
| 499 | 504 |
| 500 def next(self): | 505 def next(self): |
| 501 return self.data.next() | 506 return self.data.next() |
| 502 | 507 |
| 503 def seek(self, offset, whence=os.SEEK_SET): | 508 def seek(self, offset, whence=os.SEEK_SET): |
| 504 self.data.seek(offset, whence) | 509 self.data.seek(offset, whence) |
| OLD | NEW |