486
486
def put(self, relpath, f, mode=None):
487
"""Copy the file-like or string object into the location.
487
"""Copy the file-like object into the location.
489
489
:param relpath: Location to put the contents, relative to base.
490
:param f: File-like or string object.
490
:param f: File-like object.
491
491
:param mode: The mode for the newly created file,
492
492
None means just use the default
494
494
raise NotImplementedError(self.put)
496
def non_atomic_put(self, relpath, f, mode=None):
497
"""Copy the file-like object into the target location.
499
This function is not strictly safe to use. It is only meant to
500
be used when you already know that the target does not exist.
501
It is not safe, because it will open and truncate the remote
502
file. So there may be a time when the file has invalid contents.
504
:param relpath: The remote location to put the contents.
505
:param f: File-like object.
506
:param mode: Possible access permissions for new file.
507
None means do not set remote permissions.
509
# Default implementation just does an atomic put.
510
return self.put(relpath, f, mode=mode)
496
512
def put_multi(self, files, mode=None, pb=None):
497
513
"""Put a set of files into the location.