Exemple #1
0
 def mk_repr_result(sf, key2repr_handler4recur, obj):
     'key2repr_handler4recur -> obj -> IReprResult'
     check_key2repr_handler(key2repr_handler4recur)
     check_(sf.verify__deep, key2repr_handler4recur, obj)
     id2ancestor = {}
     repr_result = _mk_repr_result_(sf, id2ancestor, key2repr_handler4recur, obj)
     assert not id2ancestor
     check_instance(IReprResult, repr_result)
     return repr_result
Exemple #2
0
    def __init__(sf, baseobj_repr_result, may_start_repr_result, may_stop_repr_result, may_step_repr_result):
        check_instance(IReprResult, baseobj_repr_result)
        check_instance_or_None(IReprResult, may_start_repr_result)
        check_instance_or_None(IReprResult, may_stop_repr_result)
        check_instance_or_None(IReprResult, may_step_repr_result)

        sf.__x = baseobj_repr_result
        sf.__0 = may_start_repr_result
        sf.__1 = may_stop_repr_result
        sf.__2 = may_step_repr_result
Exemple #3
0
    def __init__(sf, func_repr_result, arg_repr_results, ordered_kwarg_pairs):
        check_instance(IReprResult, func_repr_result)

        check_tuple(arg_repr_results)
        check_instance_all(IReprResult, arg_repr_results)

        check_tuple(ordered_kwarg_pairs)
        check_pairs_of(str, IReprResult, ordered_kwarg_pairs)
            # kw can be arbitrary str!!!
            # but when repr, "kw=arg", require identifier
        check_all(check_identifier, map(fst, ordered_kwarg_pairs))

        sf.__f = func_repr_result
        sf.__xs = arg_repr_results
        sf.__ps = ordered_kwarg_pairs
Exemple #4
0
    def __init__(sf, baseobj_repr_result, key1_or_slice3_seq):
        check_instance(IReprResult, baseobj_repr_result)
        check_tuple(key1_or_slice3_seq)
        check_all(check_tuple, key1_or_slice3_seq)
        if not all(len(ks) in (1,3) for ks in key1_or_slice3_seq): raise TypeError
        for ks in key1_or_slice3_seq:
            L = len(ks)
            if L == 1:
                [key] = ks
                check_instance(IReprResult)
            elif L == 3:
                triple = ks
                for m in triple:
                    check_instance_or_None(IReprResult, m)
            else:
                raise logic-err


        sf.__x = baseobj_repr_result
        sf.__kss = key1_or_slice3_seq
Exemple #5
0
    def __init__(sf, may_item_tester, key_repr_handler, value_repr_handler):
        if may_item_tester is None:
            item_tester = the_Tester_True
        else:
            item_tester = may_item_tester
            check_instance(BaseTester, item_tester)
        del item_tester

        check_instance(IReprHandler, key_repr_handler)
        check_instance(IReprHandler, value_repr_handler)
        sf.__may_item_tester = may_item_tester
        sf.__key_repr_handler = key_repr_handler
        sf.__value_repr_handler = value_repr_handler
Exemple #6
0
def compare_repr_result(lhs, rhs):
    'IReprResult -> IReprResult -> [-1..+1]'
    check_instance(IReprResult, lhs)
    check_instance(IReprResult, rhs)
    return compare(lhs, rhs)
Exemple #7
0
 def __init__(sf, baseobj_repr_result, key_repr_result):
     check_instance(IReprResult, baseobj_repr_result)
     check_instance(IReprResult, key_repr_result)
     sf.__e = baseobj_repr_result
     sf.__k = key_repr_result
Exemple #8
0
 def __init__(sf, baseobj_repr_result, var_repr_result):
     check_instance(IReprResult, baseobj_repr_result)
     check_instance(ReprResult__var, var_repr_result)
     sf.__e = baseobj_repr_result
     sf.__v = var_repr_result
Exemple #9
0
 def __init__(sf, may_module_repr_result, var_repr_result):
     check_instance_or_None(ReprResult__module, may_module_repr_result)
     check_instance(ReprResult__var, var_repr_result)
     sf.__may_pkg = may_module_repr_result
     sf.__nm = var_repr_result