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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 continue | 197 continue |
198 if path: | 198 if path: |
199 path += sep | 199 path += sep |
200 path += comp | 200 path += comp |
201 if comps[-1] == '' and path: | 201 if comps[-1] == '' and path: |
202 path += '/' | 202 path += '/' |
203 path = path.replace(sep + sep, sep) | 203 path = path.replace(sep + sep, sep) |
204 return path | 204 return path |
205 | 205 |
206 def listdir(self, path): | 206 def listdir(self, path): |
207 root, dirs, files = list(self.walk(path))[0] | 207 _, dirs, files = list(self.walk(path))[0] |
208 return dirs + files | 208 return dirs + files |
209 | 209 |
210 def walk(self, top): | 210 def walk(self, top): |
211 sep = self.sep | 211 sep = self.sep |
212 if not self.isdir(top): | 212 if not self.isdir(top): |
213 raise OSError("%s is not a directory" % top) | 213 raise OSError("%s is not a directory" % top) |
214 | 214 |
215 if not top.endswith(sep): | 215 if not top.endswith(sep): |
216 top += sep | 216 top += sep |
217 | 217 |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
493 return self.data.readline(length) | 493 return self.data.readline(length) |
494 | 494 |
495 def __iter__(self): | 495 def __iter__(self): |
496 return self.data.__iter__() | 496 return self.data.__iter__() |
497 | 497 |
498 def next(self): | 498 def next(self): |
499 return self.data.next() | 499 return self.data.next() |
500 | 500 |
501 def seek(self, offset, whence=os.SEEK_SET): | 501 def seek(self, offset, whence=os.SEEK_SET): |
502 self.data.seek(offset, whence) | 502 self.data.seek(offset, whence) |
OLD | NEW |