|
5 | 5 |
|
6 | 6 | import logging |
7 | 7 | import os |
| 8 | +import pickle |
8 | 9 | from os.path import abspath, exists, splitext |
9 | 10 | from subprocess import Popen |
10 | | -import pickle |
11 | 11 |
|
12 | 12 | import matplotlib.pyplot as plt |
13 | 13 | import numpy as np |
@@ -350,23 +350,24 @@ def analyze_report_pcap(pcap_file: str, total_flows_from_trace: int = 0) -> dict |
350 | 350 |
|
351 | 351 |
|
352 | 352 | def pypy_analyze_int_report_pcap(pcap_file: str, total_flows: int = 0) -> dict: |
353 | | - code = "import pickle\n" \ |
354 | | - "from xnt import analyze_report_pcap\n" |
| 353 | + code = "import pickle\n" "from xnt import analyze_report_pcap\n" |
355 | 354 |
|
356 | 355 | if total_flows: |
357 | 356 | code += f"result = analyze_report_pcap('{pcap_file}', {total_flows})\n" |
358 | 357 | else: |
359 | 358 | code += f"result = analyze_report_pcap('{pcap_file}')\n" |
360 | 359 |
|
361 | 360 | # pickle dictionary from analyze_report_pcap |
362 | | - code += "with open('trace.pickle', 'wb') as handle:\n" \ |
363 | | - " pickle.dump(result, handle, protocol=pickle.HIGHEST_PROTOCOL)" |
| 361 | + code += ( |
| 362 | + "with open('trace.pickle', 'wb') as handle:\n" |
| 363 | + " pickle.dump(result, handle, protocol=pickle.HIGHEST_PROTOCOL)" |
| 364 | + ) |
364 | 365 |
|
365 | 366 | cmd = ["pypy", "-c", code] |
366 | 367 | p = Popen(cmd) |
367 | 368 | p.wait() |
368 | 369 |
|
369 | | - with open('trace.pickle', 'rb') as handle: |
| 370 | + with open("trace.pickle", "rb") as handle: |
370 | 371 | result = pickle.load(handle) |
371 | 372 |
|
372 | 373 | return result |
|
0 commit comments