def save(self, new_path=None):
        """Moves or creates the file with stream contents to a new location.

        Args:
            new_path: path to move to, if None a temporary file is created.
        """
        self.saved_in_temp = new_path is None
        if new_path is None:
            fd, new_path = tempfile.mkstemp()
            os.close(fd)

        if self.current_path:
            shutil.move(self.current_path, new_path)
        else:
            with open(new_path, 'wb') as dest:
                _copy_stream(self._data, dest, self._size)
        self.current_path = new_path
def save ( self , new_path = None ) : self . saved_in_temp = new_path is None if new_path is None : fd , new_path = tempfile . mkstemp ( ) os . close ( fd ) if self . current_path : shutil . move ( self . current_path , new_path ) else : with open ( new_path , 'wb' ) as dest : _copy_stream ( self . _data , dest , self . _size ) self . current_path = new_path
Moves or creates the file with stream contents to a new location.

        Args:
            new_path: path to move to, if None a temporary file is created.