engine.py
def generate_patch(old_file, new_file, calibration_file, output_file):
    """Replaces the btcal's file with the new patch information and saves to disk."""

    # Opens the files and creates a dict using spot IDs to easily map patch information back together
    old_map = open_patch(old_file)
    new_map = open_patch(new_file)
    keywords = {new_map[key]:old_map[key] for key in old_map}

    with open(calibration_file) as read_file:
        calibration_content = read_file.read()

    for key in keywords:
        calibration_content = calibration_content.replace(keywords[key], key)

    try:
        os.remove(output_file)
    except FileNotFoundError:
        pass

    with open(output_file, 'x') as write_file:
        write_file.write(calibration_content)
Replaces the btcal's file with the new patch information and saves to disk.
Replaces the btcal's file with the new patch information and saves to disk.
Replaces the btcal ' s file with the new patch information and saves to disk .
def generate_patch(old_file, new_file, calibration_file, output_file):
    old_map = open_patch(old_file)
    new_map = open_patch(new_file)
    keywords = {new_map[key]:old_map[key] for key in old_map}
    with open(calibration_file) as read_file:
        calibration_content = read_file.read()
    for key in keywords:
        calibration_content = calibration_content.replace(keywords[key], key)
    try:
        os.remove(output_file)
    except FileNotFoundError:
        pass
    with open(output_file, 'x') as write_file:
        write_file.write(calibration_content)
def generate_patch ( old_file , new_file , calibration_file , output_file ) : old_map = open_patch ( old_file ) new_map = open_patch ( new_file ) keywords = { new_map [ key ] : old_map [ key ] for key in old_map } with open ( calibration_file ) as read_file : calibration_content = read_file . read ( ) for key in keywords : calibration_content = calibration_content . replace ( keywords [ key ] , key ) try : os . remove ( output_file ) except FileNotFoundError : pass with open ( output_file , 'x' ) as write_file : write_file . write ( calibration_content )
Replaces the btcal's file with the new patch information and saves to disk.
Replaces the btcal ' s file with the new patch information and saves to disk .
"""Replaces the btcal's file with the new patch information and saves to disk.""" # Opens the files and creates a dict using spot IDs to easily map patch information back together
old_file
new_file
calibration_file
output_file