def guessTypenameFromSet(ts):
    assert(len(ts) > 0)

    isOptional = ST_NONE in ts
    if isOptional:
        ts.remove(ST_NONE)
        if len(ts) == 0: return '<# AnyObject #>'

    typemap = {
        ST_BOOL: 'Bool',
        ST_INT: 'Int',
        ST_STR: 'String',
        ST_FLOAT: 'Float',
        ST_URL: 'NSURL',
        ST_ANYOBJECT: 'AnyObject'
    }

    if len(ts) == 1:
        s = list(ts)[0]
    else:
        if ST_STR in ts:
            s = ST_STR
        else:
            s = ST_ANYOBJECT

    ret = typemap.get(s, None)
    if ret == None: return '<# AnyObject #>'
    return ret + ('?' if isOptional else '')
dataset/ETHPy150Open safx/swift-idl/json2idl.py/guessTypenameFromSet/original