kifield/kifield.py
def insert_part_fields_into_dcm(
    part_fields_dict, filename, recurse, group_components, backup, no_range
):
    """Insert the fields in the extracted part dictionary into a DCM file."""

    logger.log(
        DEBUG_OVERVIEW, "Inserting extracted fields into DCM file {}.".format(filename)
    )

    if backup:
        create_backup(filename)

    # Get the part fields from the DCM file.
    dcm_part_fields_dict = extract_part_fields_from_dcm(filename)

    # Add the part fields from the part field dictionary.
    dcm_part_fields_dict = combine_part_field_dicts(
        part_fields_dict, dcm_part_fields_dict
    )

    # Create a new Dcm object from the combined part fields.
    dcm = Dcm()
    for part_name, fields in list(dcm_part_fields_dict.items()):
        cmp = Component()
        cmp.name = part_name
        for k, v in list(fields.items()):
            if k in dcm_field_names:
                setattr(cmp, k, v)
        dcm.components.append(cmp)

    # Overwrite the current DCM file with the new part fields.
    dcm.save(filename)
Insert the fields in the extracted part dictionary into a DCM file.
Insert the fields in the extracted part dictionary into a DCM file.
Insert the fields in the extracted part dictionary into a DCM file .
def insert_part_fields_into_dcm(
    part_fields_dict, filename, recurse, group_components, backup, no_range
):
    logger.log(
        DEBUG_OVERVIEW, "Inserting extracted fields into DCM file {}.".format(filename)
    )
    if backup:
        create_backup(filename)
    dcm_part_fields_dict = extract_part_fields_from_dcm(filename)
    dcm_part_fields_dict = combine_part_field_dicts(
        part_fields_dict, dcm_part_fields_dict
    )
    dcm = Dcm()
    for part_name, fields in list(dcm_part_fields_dict.items()):
        cmp = Component()
        cmp.name = part_name
        for k, v in list(fields.items()):
            if k in dcm_field_names:
                setattr(cmp, k, v)
        dcm.components.append(cmp)
    dcm.save(filename)
def insert_part_fields_into_dcm ( part_fields_dict , filename , recurse , group_components , backup , no_range ) : logger . log ( DEBUG_OVERVIEW , "Inserting extracted fields into DCM file {}." . format ( filename ) ) if backup : create_backup ( filename ) dcm_part_fields_dict = extract_part_fields_from_dcm ( filename ) dcm_part_fields_dict = combine_part_field_dicts ( part_fields_dict , dcm_part_fields_dict ) dcm = Dcm ( ) for part_name , fields in list ( dcm_part_fields_dict . items ( ) ) : cmp = Component ( ) cmp . name = part_name for k , v in list ( fields . items ( ) ) : if k in dcm_field_names : setattr ( cmp , k , v ) dcm . components . append ( cmp ) dcm . save ( filename )
Insert the fields in the extracted part dictionary into a DCM file.
Insert the fields in the extracted part dictionary into a DCM file .
"""Insert the fields in the extracted part dictionary into a DCM file.""" # Get the part fields from the DCM file. # Add the part fields from the part field dictionary. # Create a new Dcm object from the combined part fields. # Overwrite the current DCM file with the new part fields.
part_fields_dict
filename
recurse
group_components
backup
no_range