| 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 250 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  261  |  261  | 
|  262         return TemporaryDirectory(fs=self, **kwargs) |  262         return TemporaryDirectory(fs=self, **kwargs) | 
|  263  |  263  | 
|  264     def maybe_make_directory(self, *path): |  264     def maybe_make_directory(self, *path): | 
|  265         norm_path = self.normpath(self.join(*path)) |  265         norm_path = self.normpath(self.join(*path)) | 
|  266         while norm_path and not self.isdir(norm_path): |  266         while norm_path and not self.isdir(norm_path): | 
|  267             self.dirs.add(norm_path) |  267             self.dirs.add(norm_path) | 
|  268             norm_path = self.dirname(norm_path) |  268             norm_path = self.dirname(norm_path) | 
|  269  |  269  | 
|  270     def move(self, source, destination): |  270     def move(self, source, destination): | 
|  271         if self.files[source] is None: |  271         if not self.exists(source): | 
|  272             self._raise_not_found(source) |  272             self._raise_not_found(source) | 
|  273         self.files[destination] = self.files[source] |  273         if self.isfile(source): | 
|  274         self.written_files[destination] = self.files[destination] |  274             self.files[destination] = self.files[source] | 
|  275         self.files[source] = None |  275             self.written_files[destination] = self.files[destination] | 
|  276         self.written_files[source] = None |  276             self.files[source] = None | 
 |  277             self.written_files[source] = None | 
 |  278             return | 
 |  279         self.copytree(source, destination) | 
 |  280         self.rmtree(source) | 
|  277  |  281  | 
|  278     def _slow_but_correct_normpath(self, path): |  282     def _slow_but_correct_normpath(self, path): | 
|  279         return re.sub(re.escape(os.path.sep), self.sep, os.path.normpath(path)) |  283         return re.sub(re.escape(os.path.sep), self.sep, os.path.normpath(path)) | 
|  280  |  284  | 
|  281     def normpath(self, path): |  285     def normpath(self, path): | 
|  282         # This function is called a lot, so we try to optimize the common cases |  286         # This function is called a lot, so we try to optimize the common cases | 
|  283         # instead of always calling _slow_but_correct_normpath(), above. |  287         # instead of always calling _slow_but_correct_normpath(), above. | 
|  284         if '..' in path or '/./' in path: |  288         if '..' in path or '/./' in path: | 
|  285             # This doesn't happen very often; don't bother trying to optimize it
     . |  289             # This doesn't happen very often; don't bother trying to optimize it
     . | 
|  286             return self._slow_but_correct_normpath(path) |  290             return self._slow_but_correct_normpath(path) | 
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  476         return self.data.readline(length) |  480         return self.data.readline(length) | 
|  477  |  481  | 
|  478     def __iter__(self): |  482     def __iter__(self): | 
|  479         return self.data.__iter__() |  483         return self.data.__iter__() | 
|  480  |  484  | 
|  481     def next(self): |  485     def next(self): | 
|  482         return self.data.next() |  486         return self.data.next() | 
|  483  |  487  | 
|  484     def seek(self, offset, whence=os.SEEK_SET): |  488     def seek(self, offset, whence=os.SEEK_SET): | 
|  485         self.data.seek(offset, whence) |  489         self.data.seek(offset, whence) | 
| OLD | NEW |