예제 #1
0
def get_example():
    example = cmd_data.filter_by(lambda x: x.has_timestamp and len(x.cmd_list) > 50).sort_by(lambda x: len(x.cmd_list))[0]
    example_ = editor_cmd_data.find_by(lambda x: x.user_name == example.user_name and str(x.timestamp) == str(example.timestamp))
    combined_output = report_tools.print_log_item_with_time(example) + report_tools.print_log_item_with_time(example_)
    combined_output = sorted(combined_output, key=lambda x: x[1])
    print example.file_path
    with open('example_1_shell.html', 'w') as f_out:
        f_out.write(report_tools.print_log_item(example))
    with open('example_1_editor.html', 'w') as f_out:
        f_out.write(report_tools.print_log_item(example_).encode('utf8'))
    with open('example_1.html', 'w') as f_out:
        for item in combined_output:
            f_out.write(item[0].encode('utf8'))
        # f_out.write("\n".join([item[0] for item in combined_output]).encode('utf8'))

    example = cmd_data.filter_by(lambda x: len(x.cmd_list) > 50).sort_by(lambda x: len(x.cmd_list))[1]
    example_ = editor_cmd_data.find_by(lambda x: x.user_name == example.user_name and str(x.timestamp) == str(example.timestamp))
    print example.file_path
    with open('example_2_shell.html', 'w') as f_out:
        f_out.write(report_tools.print_log_item(example))
    with open('example_2_editor.html', 'w') as f_out:
        f_out.write(report_tools.print_log_item(example_).encode('utf8'))


    example = cmd_data.filter_by(lambda x: x.timestamp[0]=='02' and x.timestamp[1]=='12' and x.timestamp[2]=='2015' and x.user_name == '*****@*****.**')
    print [item.timestamp for item in example]
예제 #2
0
    example = cmd_data.filter_by(lambda x: len(x.cmd_list) > 50).sort_by(lambda x: len(x.cmd_list))[1]
    example_ = editor_cmd_data.find_by(lambda x: x.user_name == example.user_name and str(x.timestamp) == str(example.timestamp))
    print example.file_path
    with open('example_2_shell.html', 'w') as f_out:
        f_out.write(report_tools.print_log_item(example))
    with open('example_2_editor.html', 'w') as f_out:
        f_out.write(report_tools.print_log_item(example_).encode('utf8'))


    example = cmd_data.filter_by(lambda x: x.timestamp[0]=='02' and x.timestamp[1]=='12' and x.timestamp[2]=='2015' and x.user_name == '*****@*****.**')
    print [item.timestamp for item in example]

    example_1 = example[0]
    example_2 = editor_cmd_data.find_by(lambda x: x.user_name == example_1.user_name and str(x.timestamp) == str(example_1.timestamp))
    with open('course_shell.html', 'w') as f_out:
        f_out.write(report_tools.print_log_item(example_1))
    if example_2:
        with open('course_editor.html', 'w') as f_out:
            f_out.write(report_tools.print_log_item(example_2))


    example = cmd_data.filter_by(lambda x: x.timestamp[0]=='02' and x.timestamp[1]=='12' and x.timestamp[2]=='2015' and x.user_name == '*****@*****.**')
    print [item.timestamp for item in example]

    example_1 = example[1]
    example_2 = editor_cmd_data.find_by(lambda x: x.user_name == example_1.user_name and str(x.timestamp) == str(example_1.timestamp))
    with open('wei_shell.html', 'w') as f_out:
        f_out.write(report_tools.print_log_item(example_1))
    if example_2:
        with open('wei_editor.html', 'w') as f_out:
            f_out.write(report_tools.print_log_item(example_2))