Esempio n. 1
0
def doesMatch_notypes(tup, templ):
    if isinstance(tup, tuple) or (isinstance(tup, _linda_server.Value) and tup.isTuple()):
        if len(tup) != len(templ):
            raise NoTupleMatch
        for tup_e, templ_e in zip(tup, templ):
            try:
                doesMatch_notypes(tup_e, templ_e)
            except NoTupleMatch:
                raise NoTupleMatch
        return tup
    elif templ.isType():
        if compare(tup.type, templ):
            return tup
        else:
            raise NoTupleMatch
    else:
        if compare(tup.type, templ.type) and tup == templ:
            return tup
        else:
            raise NoTupleMatch
Esempio n. 2
0
def lookupIso(t1, t2):
    if isinstance(t1, _linda_server.Value):
        t1 = t1.type_id
    if isinstance(t2, _linda_server.Value):
        t2 = t2.type_id
    try:
        v = __cache[(t1, t2)]
    except KeyError:
        v = compare(type_cache.lookupType(t1), type_cache.lookupType(t2))
        saveIso(t1, t2, v)
    return v
Esempio n. 3
0
def doesMatch_notypes(tup, templ):
    if isinstance(tup, tuple) or (isinstance(tup, _linda_server.Value)
                                  and tup.isTuple()):
        if len(tup) != len(templ):
            raise NoTupleMatch
        for tup_e, templ_e in zip(tup, templ):
            try:
                doesMatch_notypes(tup_e, templ_e)
            except NoTupleMatch:
                raise NoTupleMatch
        return tup
    elif templ.isType():
        if compare(tup.type, templ):
            return tup
        else:
            raise NoTupleMatch
    else:
        if compare(tup.type, templ.type) and tup == templ:
            return tup
        else:
            raise NoTupleMatch