コード例 #1
0
def dofo(f, start, end, regex_format_info):
    global case_num
    case_num += 1
    print("case {}".format(case_num))
    res = detect_file_format(f, start, end, regex_format_info)
    if res is not None:
        res = {"order": res["order"]}
    print(repr(res))
    print("")
コード例 #2
0
def dofo(f, start, end, regex_format_info):
    global case_num
    case_num += 1
    print("case {}".format(case_num))
    res = detect_file_format(f, start, end, regex_format_info)
    if res is not None:
        res = {
            "order": res["order"]
        }
    print(repr(res))
    print("")
コード例 #3
0
def do_binary_seek_pos(f, st, ed, cmp_pattern, regex_pattern):
    global dataset_index
    dataset_index += 1

    regex_format_info = detect_datetime_format(cmp_pattern, None)
    file_order_info = detect_file_format(f, cmp_pattern, None,
                                         regex_format_info)

    print("\ndataset[{}]".format(dataset_index))
    print("st={}, ed={}".format(st, ed))
    pos = binary_seek_pos(f, st, ed, cmp_pattern, regex_format_info,
                          file_order_info)
    if pos is None:
        print("binary search return None")
    else:
        print("pos=%d" % pos)
        f.seek(pos)
        print(f.readline())
コード例 #4
0
def do_binary_seek_pos(f, st, ed, cmp_pattern, regex_pattern):
    global dataset_index
    dataset_index += 1

    regex_format_info = detect_datetime_format(cmp_pattern, None)
    file_order_info   = detect_file_format(f, cmp_pattern, None, 
            regex_format_info)

    print("\ndataset[{}]".format(dataset_index))
    print("st={}, ed={}".format(st, ed))
    pos = binary_seek_pos(f, st, ed, cmp_pattern, regex_format_info, 
            file_order_info)
    if pos is None:
        print("binary search return None")
    else:
        print("pos=%d" % pos)
        f.seek(pos)
        print(f.readline())