kifield/common.py
def create_backup(file):
    """Create a backup copy of a file.

    Args:
        file (string): Path to file.
    """

    if file in backedup_files:
        return

    if not os.path.isfile(file):
        return

    index = 1  # Start with this backup file suffix.
    while True:
        backup_file = "{}.{}.bak".format(file, index)
        if not os.path.isfile(backup_file):
            # Found an unused backup file name, so make backup.
            shutil.copy(file, backup_file)
            break  # Backup done, so break out of loop.
        index += 1  # Else keep looking for an unused backup file name.

    backedup_files.append(file)
Create a backup copy of a file.

    Args:
        file (string): Path to file.
    
Create a backup copy of a file.
Create a backup copy of a file .
def create_backup(file):
    if file in backedup_files:
        return
    if not os.path.isfile(file):
        return
    index = 1  
    while True:
        backup_file = "{}.{}.bak".format(file, index)
        if not os.path.isfile(backup_file):
            shutil.copy(file, backup_file)
            break  
        index += 1  
    backedup_files.append(file)
def create_backup ( file ) : if file in backedup_files : return if not os . path . isfile ( file ) : return index = 1 while True : backup_file = "{}.{}.bak" . format ( file , index ) if not os . path . isfile ( backup_file ) : shutil . copy ( file , backup_file ) break index += 1 backedup_files . append ( file )
Create a backup copy of a file.
Create a backup copy of a file .
"""Create a backup copy of a file.

    Args:
        file (string): Path to file.
    """ # Start with this backup file suffix. # Found an unused backup file name, so make backup. # Backup done, so break out of loop. # Else keep looking for an unused backup file name.
file
Path to file.
Path to file .