def create_map(instance_args, signature_args, instance_edges, signature_edges, op=None):
    carg_map = {}
    for i in range(len(instance_args)):
        iarg = instance_args[i]
        sarg = signature_args[i]
        if is_number(iarg):
            iarg = str(iarg)
        carg_map[sarg] = instance_edges[iarg]
        carg_map[sarg].name = iarg
        idims = hdfgutils.get_attribute_value(instance_edges[iarg].attributes['dimensions'])
        iid_literal = False
        if instance_edges[iarg].iid:
            inst_iid = instance_edges[iarg].iid
            iid_literal = is_literal(inst_iid)
        sdims = hdfgutils.get_attribute_value(signature_edges[sarg].attributes['dimensions'])
        if ((len(idims) != len(sdims)) and (not iid_literal)):
            logging.error('Error! Dimensions between edges connecting components do not match:{} versus {} for {} and {}'.format(idims, sdims, iarg, sarg))
        elif (not iid_literal):
            for d in range(len(idims)):
                inst_dim = idims[d]
                sig_dim = sdims[d]
                if is_number(inst_dim):
                    inst_dim = str(inst_dim)
                carg_map[sig_dim] = instance_edges[inst_dim]
                carg_map[sig_dim].name = inst_dim
                carg_map[sig_dim].attributes['vtype'].CopyFrom(hdfgutils.make_attribute('vtype', 'scalar'))
    if (len(signature_args) > len(instance_args)):
        start = len(instance_args)
        for default in signature_args[start:]:
            sig_attr = list(signature_edges[default].attributes)
            if ('default' not in sig_attr):
                logging.error('Error! No default value for unspecified arg: {}'.format(default))
            else:
                def_val = hdfgutils.get_attribute_value(signature_edges[default].attributes['default'])
                carg_map[default] = signature_edges[default]
                carg_map[default].attributes['value'].CopyFrom(hdfgutils.make_attribute('value', def_val))
                if is_number(def_val):
                    def_val = str(def_val)
                carg_map[default].name = def_val
                carg_map[default].attributes['vtype'].CopyFrom(hdfgutils.make_attribute('vtype', 'scalar'))
    for e in op.edge_info:
        vcat = hdfgutils.get_attribute_value(op.edge_info[e].attributes['vcat'])
        if (vcat == 'declaration'):
            dims = hdfgutils.get_attribute_value(op.edge_info[e].attributes['dimensions'])
            sig_name = op.edge_info[e].name.rsplit('/', 1)[(- 1)]
    return carg_map
def create_map(instance_args, signature_args, instance_edges, signature_edges, op=None):
    carg_map = {}
    for i in range(len(instance_args)):
        iarg = instance_args[i]
        sarg = signature_args[i]
        if is_number(iarg):
            iarg = str(iarg)
        carg_map[sarg] = instance_edges[iarg]
        carg_map[sarg].name = iarg
        idims = hdfgutils.get_attribute_value(instance_edges[iarg].attributes['dimensions'])
        iid_literal = False
        if instance_edges[iarg].iid:
            inst_iid = instance_edges[iarg].iid
            iid_literal = is_literal(inst_iid)
        sdims = hdfgutils.get_attribute_value(signature_edges[sarg].attributes['dimensions'])
        if ((len(idims) != len(sdims)) and (not iid_literal)):
            logging.error('Error! Dimensions between edges connecting components do not match:{} versus {} for {} and {}'.format(idims, sdims, iarg, sarg))
        elif (not iid_literal):
            for d in range(len(idims)):
                inst_dim = idims[d]
                sig_dim = sdims[d]
                if is_number(inst_dim):
                    inst_dim = str(inst_dim)
                carg_map[sig_dim] = instance_edges[inst_dim]
                carg_map[sig_dim].name = inst_dim
                carg_map[sig_dim].attributes['vtype'].CopyFrom(hdfgutils.make_attribute('vtype', 'scalar'))
    if (len(signature_args) > len(instance_args)):
        start = len(instance_args)
        for default in signature_args[start:]:
            sig_attr = list(signature_edges[default].attributes)
            if ('default' not in sig_attr):
                logging.error('Error! No default value for unspecified arg: {}'.format(default))
            else:
                def_val = hdfgutils.get_attribute_value(signature_edges[default].attributes['default'])
                carg_map[default] = signature_edges[default]
                carg_map[default].attributes['value'].CopyFrom(hdfgutils.make_attribute('value', def_val))
                if is_number(def_val):
                    def_val = str(def_val)
                carg_map[default].name = def_val
                carg_map[default].attributes['vtype'].CopyFrom(hdfgutils.make_attribute('vtype', 'scalar'))
    for e in op.edge_info:
        vcat = hdfgutils.get_attribute_value(op.edge_info[e].attributes['vcat'])
        if (vcat == 'declaration'):
            dims = hdfgutils.get_attribute_value(op.edge_info[e].attributes['dimensions'])
            sig_name = op.edge_info[e].name.rsplit('/', 1)[(- 1)]
    return carg_map