def _make_choice()

in awsglue/gluetypes.py [0:0]


def _make_choice(s1, s2):
    if isinstance(s1, ChoiceType):
        left_types = s1.choices
    else:
        left_types = {s1.typeName(): s1}

    if isinstance(s2, ChoiceType):
        right_types = s2.choices
    else:
        right_types = {s2.typeName(): s2}

    for typecode, datatype in iteritems(left_types):
        if typecode in right_types:
            right_types[typecode] = mergeDataTypes(datatype,
                                                   right_types[typecode])
        else:
            right_types[typecode] = datatype

    return ChoiceType(right_types.values(), s1.properties)