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 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
384 # cases like path='/foo/b' and f='/foo/bar/baz'. | 384 # cases like path='/foo/b' and f='/foo/bar/baz'. |
385 if f == path or f.startswith(path + self.sep): | 385 if f == path or f.startswith(path + self.sep): |
386 self.files[f] = None | 386 self.files[f] = None |
387 | 387 |
388 self.dirs = set(filter(lambda d: not (d == path or d.startswith(path + s elf.sep)), self.dirs)) | 388 self.dirs = set(filter(lambda d: not (d == path or d.startswith(path + s elf.sep)), self.dirs)) |
389 | 389 |
390 def copytree(self, source, destination): | 390 def copytree(self, source, destination): |
391 source = self.normpath(source) | 391 source = self.normpath(source) |
392 destination = self.normpath(destination) | 392 destination = self.normpath(destination) |
393 | 393 |
394 for source_file in self.files: | 394 for source_file in self.files.keys(): |
Dirk Pranke
2014/08/27 23:42:45
this change is fine for Python 2.7, but I think it
patro
2014/09/01 09:14:02
Done.
| |
395 if source_file.startswith(source): | 395 if source_file.startswith(source): |
396 destination_path = self.join(destination, self.relpath(source_fi le, source)) | 396 destination_path = self.join(destination, self.relpath(source_fi le, source)) |
397 self.maybe_make_directory(self.dirname(destination_path)) | 397 self.maybe_make_directory(self.dirname(destination_path)) |
398 self.files[destination_path] = self.files[source_file] | 398 self.files[destination_path] = self.files[source_file] |
399 | 399 |
400 def split(self, path): | 400 def split(self, path): |
401 idx = path.rfind(self.sep) | 401 idx = path.rfind(self.sep) |
402 if idx == -1: | 402 if idx == -1: |
403 return ('', path) | 403 return ('', path) |
404 return (path[:idx], path[(idx + 1):]) | 404 return (path[:idx], path[(idx + 1):]) |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
476 return self.data.readline(length) | 476 return self.data.readline(length) |
477 | 477 |
478 def __iter__(self): | 478 def __iter__(self): |
479 return self.data.__iter__() | 479 return self.data.__iter__() |
480 | 480 |
481 def next(self): | 481 def next(self): |
482 return self.data.next() | 482 return self.data.next() |
483 | 483 |
484 def seek(self, offset, whence=os.SEEK_SET): | 484 def seek(self, offset, whence=os.SEEK_SET): |
485 self.data.seek(offset, whence) | 485 self.data.seek(offset, whence) |
OLD | NEW |