in azure/datalake/store/transfer.py [0:0]
def _rename_file(self, src, dst, overwrite=False):
""" Rename a file from file_name.inprogress to just file_name. Invoked once download completes on a file.
Internal function used by `download`.
"""
try:
# we do a final check to make sure someone didn't create the destination file while download was occuring
# if the user did not specify overwrite.
if os.path.isfile(dst):
if not overwrite:
raise FileExistsError(dst)
os.remove(dst)
os.rename(src, dst)
except Exception as e:
logger.error('Rename failed for source file: %r; %r', src, e)
raise e
logger.debug('Renamed %r to %r', src, dst)