diff --git a/board/tools/enter_download_mode.py b/board/tools/enter_download_mode.py index d464488b8e592a..3dd6545f4caffe 100755 --- a/board/tools/enter_download_mode.py +++ b/board/tools/enter_download_mode.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -from __future__ import print_function + import sys import time diff --git a/examples/can_bit_transition.py b/examples/can_bit_transition.py index 9a54d6ff0fea89..1cd72a6831cde5 100755 --- a/examples/can_bit_transition.py +++ b/examples/can_bit_transition.py @@ -65,11 +65,11 @@ def load(self, filename, start, end): def PrintUnique(log_file, low_range, high_range): # find messages with bits that are always low - start, end = map(float, low_range.split('-')) + start, end = list(map(float, low_range.split('-'))) low = Info() low.load(log_file, start, end) # find messages with bits that are always high - start, end = map(float, high_range.split('-')) + start, end = list(map(float, high_range.split('-'))) high = Info() high.load(log_file, start, end) # print messages that go from low to high diff --git a/examples/can_logger.py b/examples/can_logger.py index 6a1fe28086d8c0..203023dc92c106 100755 --- a/examples/can_logger.py +++ b/examples/can_logger.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -from __future__ import print_function + import binascii import csv import sys diff --git a/python/__init__.py b/python/__init__.py index 573d6f159a3c9d..18e57e8d7a0792 100644 --- a/python/__init__.py +++ b/python/__init__.py @@ -1,5 +1,5 @@ # python library to interface with panda -from __future__ import print_function + import binascii import struct import hashlib @@ -9,12 +9,12 @@ import time import traceback import subprocess -from dfu import PandaDFU -from esptool import ESPROM, CesantaFlasher -from flash_release import flash_release -from update import ensure_st_up_to_date -from serial import PandaSerial -from isotp import isotp_send, isotp_recv +from .dfu import PandaDFU +from .esptool import ESPROM, CesantaFlasher +from .flash_release import flash_release +from .update import ensure_st_up_to_date +from .serial import PandaSerial +from .isotp import isotp_send, isotp_recv __version__ = '0.0.9' diff --git a/python/dfu.py b/python/dfu.py index 02deed47bbe2ec..b3bf05da1ae1d5 100644 --- a/python/dfu.py +++ b/python/dfu.py @@ -1,4 +1,4 @@ -from __future__ import print_function + import os import usb1 import struct diff --git a/python/esptool.py b/python/esptool.py index d97c177c01b93e..941c3557c8a00c 100755 --- a/python/esptool.py +++ b/python/esptool.py @@ -114,7 +114,7 @@ def __init__(self, port=None, baud=ESP_ROM_BAUD): """ Read a SLIP packet from the serial port """ def read(self): - return self._slip_reader.next() + return next(self._slip_reader) """ Write bytes to the serial port while performing SLIP escaping """ def write(self, packet): @@ -991,7 +991,7 @@ def elf2image(args): def read_mac(esp, args): mac = esp.read_mac() - print('MAC: %s' % ':'.join(map(lambda x: '%02x' % x, mac))) + print('MAC: %s' % ':'.join(['%02x' % x for x in mac])) def chip_id(esp, args): @@ -1203,7 +1203,7 @@ def add_spi_flash_subparsers(parent, auto_detect=False): 'version', help='Print esptool version') # internal sanity check - every operation matches a module function of the same name - for operation in subparsers.choices.keys(): + for operation in list(subparsers.choices.keys()): assert operation in globals(), "%s should be a module function" % operation args = parser.parse_args() diff --git a/python/flash_release.py b/python/flash_release.py index 8fb9b64443bdb6..b50c9b36b3af78 100755 --- a/python/flash_release.py +++ b/python/flash_release.py @@ -1,10 +1,10 @@ #!/usr/bin/env python3 -from __future__ import print_function + import sys import time import requests import json -import StringIO +import io def flash_release(path=None, st_serial=None): from panda import Panda, PandaDFU, ESPROM, CesantaFlasher @@ -29,7 +29,7 @@ def status(x): url = json.loads(r.text)['url'] r = requests.get(url) print("Fetching firmware from %s" % url) - path = StringIO.StringIO(r.content) + path = io.StringIO(r.content) zf = ZipFile(path) zf.printdir() diff --git a/python/isotp.py b/python/isotp.py index 09ee180b9e2429..891b0bd7264a2e 100644 --- a/python/isotp.py +++ b/python/isotp.py @@ -24,7 +24,7 @@ def recv(panda, cnt, addr, nbus): # leave around nmsgs.append((ids, ts, dat, bus)) kmsgs = nmsgs[-256:] - return map(str, ret) + return list(map(str, ret)) def isotp_recv_subaddr(panda, addr, bus, sendaddr, subaddr): msg = recv(panda, 1, addr, bus)[0] diff --git a/tests/all_wifi_test.py b/tests/all_wifi_test.py index 2c92cd90c2046b..85dc173b07625c 100755 --- a/tests/all_wifi_test.py +++ b/tests/all_wifi_test.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 import requests import json -from automated.helpers import _connect_wifi +from .automated.helpers import _connect_wifi from panda import Panda from nose.tools import assert_equal diff --git a/tests/automated/1_program.py b/tests/automated/1_program.py index 6b8a3ad4875657..944db18d9aaed6 100644 --- a/tests/automated/1_program.py +++ b/tests/automated/1_program.py @@ -1,6 +1,6 @@ import os from panda import Panda -from helpers import panda_type_to_serial, test_white_and_grey, test_all_pandas, panda_connect_and_init +from .helpers import panda_type_to_serial, test_white_and_grey, test_all_pandas, panda_connect_and_init @test_all_pandas @panda_connect_and_init diff --git a/tests/automated/2_usb_to_can.py b/tests/automated/2_usb_to_can.py index f0411b32c66aae..eba421e531e36d 100644 --- a/tests/automated/2_usb_to_can.py +++ b/tests/automated/2_usb_to_can.py @@ -1,10 +1,10 @@ -from __future__ import print_function + import os import sys import time from panda import Panda from nose.tools import assert_equal, assert_less, assert_greater -from helpers import SPEED_NORMAL, SPEED_GMLAN, time_many_sends, test_white_and_grey, panda_type_to_serial, test_all_pandas, panda_connect_and_init +from .helpers import SPEED_NORMAL, SPEED_GMLAN, time_many_sends, test_white_and_grey, panda_type_to_serial, test_all_pandas, panda_connect_and_init @test_all_pandas @panda_connect_and_init @@ -30,8 +30,8 @@ def test_can_loopback(p): # confirm receive both on loopback and send receipt time.sleep(0.05) r = p.can_recv() - sr = filter(lambda x: x[3] == 0x80 | bus, r) - lb = filter(lambda x: x[3] == bus, r) + sr = [x for x in r if x[3] == 0x80 | bus] + lb = [x for x in r if x[3] == bus] assert len(sr) == 1 assert len(lb) == 1 @@ -67,7 +67,7 @@ def test_reliability(p): p.set_can_loopback(True) p.set_can_speed_kbps(0, 1000) - addrs = range(100, 100+MSG_COUNT) + addrs = list(range(100, 100+MSG_COUNT)) ts = [(j, 0, "\xaa"*8, 0) for j in addrs] # 100 loops @@ -80,11 +80,11 @@ def test_reliability(p): while len(r) < 200 and (time.time() - st) < 0.5: r.extend(p.can_recv()) - sent_echo = filter(lambda x: x[3] == 0x80, r) - loopback_resp = filter(lambda x: x[3] == 0, r) + sent_echo = [x for x in r if x[3] == 0x80] + loopback_resp = [x for x in r if x[3] == 0] - assert_equal(sorted(map(lambda x: x[0], loopback_resp)), addrs) - assert_equal(sorted(map(lambda x: x[0], sent_echo)), addrs) + assert_equal(sorted([x[0] for x in loopback_resp]), addrs) + assert_equal(sorted([x[0] for x in sent_echo]), addrs) assert_equal(len(r), 200) # take sub 20ms diff --git a/tests/automated/3_wifi.py b/tests/automated/3_wifi.py index 2e9c81f3f4efe4..f57dbbd0210c69 100644 --- a/tests/automated/3_wifi.py +++ b/tests/automated/3_wifi.py @@ -1,8 +1,8 @@ -from __future__ import print_function + import os import time from panda import Panda -from helpers import connect_wifi, test_white, test_all_pandas, panda_type_to_serial, panda_connect_and_init +from .helpers import connect_wifi, test_white, test_all_pandas, panda_type_to_serial, panda_connect_and_init import requests @test_all_pandas diff --git a/tests/automated/4_wifi_functionality.py b/tests/automated/4_wifi_functionality.py index ee9857d09e1817..67cce4bf9c37a6 100644 --- a/tests/automated/4_wifi_functionality.py +++ b/tests/automated/4_wifi_functionality.py @@ -1,7 +1,7 @@ -from __future__ import print_function + import time from panda import Panda -from helpers import time_many_sends, connect_wifi, test_white, panda_type_to_serial +from .helpers import time_many_sends, connect_wifi, test_white, panda_type_to_serial from nose.tools import timed, assert_equal, assert_less, assert_greater @test_white diff --git a/tests/automated/5_wifi_udp.py b/tests/automated/5_wifi_udp.py index 8b62cf082ee705..642d8f02a59961 100644 --- a/tests/automated/5_wifi_udp.py +++ b/tests/automated/5_wifi_udp.py @@ -1,7 +1,7 @@ -from __future__ import print_function + import sys import time -from helpers import time_many_sends, connect_wifi, test_white, panda_type_to_serial +from .helpers import time_many_sends, connect_wifi, test_white, panda_type_to_serial from panda import Panda, PandaWifiStreaming from nose.tools import timed, assert_equal, assert_less, assert_greater @@ -54,7 +54,7 @@ def test_udp_doesnt_drop(serials=None): missing = True while len(r) > 0: r = p.can_recv() - r = filter(lambda x: x[3] == bus and x[0] == msg_id, r) + r = [x for x in r if x[3] == bus and x[0] == msg_id] if len(r) > 0: missing = False usb_ok_cnt += len(r) diff --git a/tests/automated/6_two_panda.py b/tests/automated/6_two_panda.py index 8b308ce500ff8c..d15f98ee7f81a6 100644 --- a/tests/automated/6_two_panda.py +++ b/tests/automated/6_two_panda.py @@ -1,10 +1,10 @@ -from __future__ import print_function + import os import time import random from panda import Panda from nose.tools import assert_equal, assert_less, assert_greater -from helpers import time_many_sends, test_two_panda, test_two_black_panda, panda_type_to_serial, clear_can_buffers, panda_connect_and_init +from .helpers import time_many_sends, test_two_panda, test_two_black_panda, panda_type_to_serial, clear_can_buffers, panda_connect_and_init @test_two_panda @panda_type_to_serial diff --git a/tests/automated/helpers.py b/tests/automated/helpers.py index 651dc44fe312ac..370e696d8393bc 100644 --- a/tests/automated/helpers.py +++ b/tests/automated/helpers.py @@ -4,7 +4,7 @@ import random import subprocess import requests -import thread +import _thread from functools import wraps from panda import Panda from nose.tools import timed, assert_equal, assert_less, assert_greater @@ -75,7 +75,7 @@ def _connect_wifi(dongle_id, pw, insecure_okay=False): print("WIFI: scanning %d" % cnt) os.system("iwlist %s scanning > /dev/null" % wlan_interface) os.system("nmcli device wifi rescan") - wifi_scan = filter(lambda x: ssid in x, subprocess.check_output(["nmcli","dev", "wifi", "list"]).split("\n")) + wifi_scan = [x for x in subprocess.check_output(["nmcli","dev", "wifi", "list"]).split("\n") if ssid in x] if len(wifi_scan) != 0: break time.sleep(0.1) @@ -153,11 +153,11 @@ def time_many_sends(p, bus, precv=None, msg_count=100, msg_id=None, two_pandas=F while len(r_echo) < r_echo_len_exected and (time.time() - st) < 10: r_echo.extend(p.can_recv()) - sent_echo = filter(lambda x: x[3] == 0x80 | bus and x[0] == msg_id, r) - sent_echo.extend(filter(lambda x: x[3] == 0x80 | bus and x[0] == msg_id, r_echo)) - resp = filter(lambda x: x[3] == bus and x[0] == msg_id, r) + sent_echo = [x for x in r if x[3] == 0x80 | bus and x[0] == msg_id] + sent_echo.extend([x for x in r_echo if x[3] == 0x80 | bus and x[0] == msg_id]) + resp = [x for x in r if x[3] == bus and x[0] == msg_id] - leftovers = filter(lambda x: (x[3] != 0x80 | bus and x[3] != bus) or x[0] != msg_id, r) + leftovers = [x for x in r if (x[3] != 0x80 | bus and x[3] != bus) or x[0] != msg_id] assert_equal(len(leftovers), 0) assert_equal(len(resp), msg_count) @@ -230,7 +230,7 @@ def wrapper(panda_serials=None, **kwargs): for bus, speed in [(0, SPEED_NORMAL), (1, SPEED_NORMAL), (2, SPEED_NORMAL), (3, SPEED_GMLAN)]: panda.set_can_speed_kbps(bus, speed) clear_can_buffers(panda) - thread.start_new_thread(heartbeat_thread, (panda,)) + _thread.start_new_thread(heartbeat_thread, (panda,)) # Run test function ret = fn(*pandas, **kwargs) diff --git a/tests/black_loopback_test.py b/tests/black_loopback_test.py index 61076eb1cae7bb..725358aab6c518 100755 --- a/tests/black_loopback_test.py +++ b/tests/black_loopback_test.py @@ -4,7 +4,7 @@ # Tests all buses, including OBD CAN, which is on the same bus as CAN0 in this test. # To be sure, the test should be run with both harness orientations -from __future__ import print_function + import os import sys import time diff --git a/tests/black_white_loopback_test.py b/tests/black_white_loopback_test.py index 332158bacec042..a4df4e502755ad 100755 --- a/tests/black_white_loopback_test.py +++ b/tests/black_white_loopback_test.py @@ -4,7 +4,7 @@ # Tests all buses, including OBD CAN, which is on the same bus as CAN0 in this test. # To be sure, the test should be run with both harness orientations -from __future__ import print_function + import os import sys import time diff --git a/tests/black_white_relay_endurance.py b/tests/black_white_relay_endurance.py index 71cdcfffb199b4..3041aa8c4e7e53 100755 --- a/tests/black_white_relay_endurance.py +++ b/tests/black_white_relay_endurance.py @@ -4,7 +4,7 @@ # Tests all buses, including OBD CAN, which is on the same bus as CAN0 in this test. # To be sure, the test should be run with both harness orientations -from __future__ import print_function + import os import sys import time diff --git a/tests/black_white_relay_test.py b/tests/black_white_relay_test.py index 8ff1a0bf7e9b32..65877dc29f7058 100755 --- a/tests/black_white_relay_test.py +++ b/tests/black_white_relay_test.py @@ -3,7 +3,7 @@ # Relay test with loopback between black panda (+ harness and power) and white/grey panda # Tests the relay switching multiple times / second by looking at the buses on which loop occurs. -from __future__ import print_function + import os import sys import time diff --git a/tests/can_printer.py b/tests/can_printer.py index 58388bc5750ffb..ae22a4176395f2 100755 --- a/tests/can_printer.py +++ b/tests/can_printer.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -from __future__ import print_function + import os import sys import time @@ -30,7 +30,7 @@ def can_printer(): if sec_since_boot() - lp > 0.1: dd = chr(27) + "[2J" dd += "%5.2f\n" % (sec_since_boot() - start) - for k,v in sorted(zip(msgs.keys(), map(lambda x: binascii.hexlify(x[-1]), msgs.values()))): + for k,v in sorted(zip(list(msgs.keys()), [binascii.hexlify(x[-1]) for x in list(msgs.values())])): dd += "%s(%6d) %s\n" % ("%04X(%4d)" % (k,k),len(msgs[k]), v) print(dd) lp = sec_since_boot() diff --git a/tests/debug_console.py b/tests/debug_console.py index 5f6ecd642ce646..0d0f85591b71c1 100755 --- a/tests/debug_console.py +++ b/tests/debug_console.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -from __future__ import print_function + import os import sys import time @@ -19,9 +19,9 @@ serials = Panda.list() if os.getenv("SERIAL"): - serials = filter(lambda x: x==os.getenv("SERIAL"), serials) + serials = [x for x in serials if x==os.getenv("SERIAL")] - pandas = list(map(lambda x: Panda(x, claim=claim), serials)) + pandas = list([Panda(x, claim=claim) for x in serials]) if not len(pandas): sys.exit("no pandas found") diff --git a/tests/elm_car_simulator.py b/tests/elm_car_simulator.py index 56aa696d5abac1..ffb309664e4532 100755 --- a/tests/elm_car_simulator.py +++ b/tests/elm_car_simulator.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 """Used to Reverse/Test ELM protocol auto detect and OBD message response without a car.""" -from __future__ import print_function + import sys import os import struct diff --git a/tests/elm_throughput.py b/tests/elm_throughput.py index 07c406c6f4258d..2895b0926119d9 100755 --- a/tests/elm_throughput.py +++ b/tests/elm_throughput.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -from __future__ import print_function + import socket import threading import select diff --git a/tests/elm_wifi.py b/tests/elm_wifi.py index f5a8849833df60..fecb1d09628cba 100644 --- a/tests/elm_wifi.py +++ b/tests/elm_wifi.py @@ -1,4 +1,4 @@ -from __future__ import print_function + import os import sys import time @@ -8,7 +8,7 @@ import struct sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), "..")) -import elm_car_simulator +from . import elm_car_simulator sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), "..", "..")) from panda import Panda diff --git a/tests/loopback_test.py b/tests/loopback_test.py index 0101d7674cd32b..02c8d2cd144a12 100755 --- a/tests/loopback_test.py +++ b/tests/loopback_test.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -from __future__ import print_function + import os import sys import time @@ -29,14 +29,14 @@ def run_test(sleep_duration): run_test_w_pandas(pandas, sleep_duration) def run_test_w_pandas(pandas, sleep_duration): - h = list(map(lambda x: Panda(x), pandas)) + h = list([Panda(x) for x in pandas]) print("H", h) for hh in h: hh.set_safety_mode(Panda.SAFETY_ALLOUTPUT) # test both directions - for ho in permutations(range(len(h)), r=2): + for ho in permutations(list(range(len(h))), r=2): print("***************** TESTING", ho) panda0, panda1 = h[ho[0]], h[ho[1]] diff --git a/tests/safety/test_cadillac.py b/tests/safety/test_cadillac.py index 352acb6d385cbe..6ae27550e11d8d 100644 --- a/tests/safety/test_cadillac.py +++ b/tests/safety/test_cadillac.py @@ -183,8 +183,8 @@ def test_realtime_limits(self): def test_fwd_hook(self): # nothing allowed - buss = range(0x0, 0x3) - msgs = range(0x1, 0x800) + buss = list(range(0x0, 0x3)) + msgs = list(range(0x1, 0x800)) for b in buss: for m in msgs: diff --git a/tests/safety/test_chrysler.py b/tests/safety/test_chrysler.py index 3989e98b9f365b..ff1776c36f979d 100755 --- a/tests/safety/test_chrysler.py +++ b/tests/safety/test_chrysler.py @@ -181,8 +181,8 @@ def test_torque_measurements(self): self.assertEqual(0, self.safety.get_chrysler_torque_meas_min()) def test_fwd_hook(self): - buss = range(0x0, 0x3) - msgs = range(0x1, 0x800) + buss = list(range(0x0, 0x3)) + msgs = list(range(0x1, 0x800)) chrysler_camera_detected = [0, 1] for ccd in chrysler_camera_detected: diff --git a/tests/safety/test_gm.py b/tests/safety/test_gm.py index cd664a64fb6a1f..3b81defffe0f89 100644 --- a/tests/safety/test_gm.py +++ b/tests/safety/test_gm.py @@ -282,8 +282,8 @@ def test_realtime_limits(self): def test_fwd_hook(self): # nothing allowed - buss = range(0x0, 0x3) - msgs = range(0x1, 0x800) + buss = list(range(0x0, 0x3)) + msgs = list(range(0x1, 0x800)) for b in buss: for m in msgs: diff --git a/tests/safety/test_honda.py b/tests/safety/test_honda.py index 3ade53ae7a9c87..1cbb56ac262888 100755 --- a/tests/safety/test_honda.py +++ b/tests/safety/test_honda.py @@ -254,8 +254,8 @@ def test_spam_cancel_safety_check(self): self.assertTrue(self.safety.safety_tx_hook(self._button_msg(RESUME_BTN, BUTTON_MSG))) def test_fwd_hook(self): - buss = range(0x0, 0x3) - msgs = range(0x1, 0x800) + buss = list(range(0x0, 0x3)) + msgs = list(range(0x1, 0x800)) long_controls_allowed = [0, 1] fwd_brake = [False, True] diff --git a/tests/safety/test_honda_bosch.py b/tests/safety/test_honda_bosch.py index 7852a5c3cd036f..e0dcfc8df156da 100755 --- a/tests/safety/test_honda_bosch.py +++ b/tests/safety/test_honda_bosch.py @@ -21,8 +21,8 @@ def _send_msg(self, bus, addr, length): return to_send def test_fwd_hook(self): - buss = range(0x0, 0x3) - msgs = range(0x1, 0x800) + buss = list(range(0x0, 0x3)) + msgs = list(range(0x1, 0x800)) is_panda_black = self.safety.get_hw_type() == 3 # black panda bus_rdr_cam = 2 if is_panda_black else 1 bus_rdr_car = 0 if is_panda_black else 2 diff --git a/tests/safety/test_hyundai.py b/tests/safety/test_hyundai.py index 2deddf53054876..b863b545a2f0fb 100644 --- a/tests/safety/test_hyundai.py +++ b/tests/safety/test_hyundai.py @@ -190,8 +190,8 @@ def test_realtime_limits(self): def test_fwd_hook(self): - buss = range(0x0, 0x3) - msgs = range(0x1, 0x800) + buss = list(range(0x0, 0x3)) + msgs = list(range(0x1, 0x800)) hyundai_giraffe_switch_2 = [0, 1] self.safety.set_hyundai_camera_bus(2) diff --git a/tests/safety/test_subaru.py b/tests/safety/test_subaru.py index 7afe6be01ef9e1..9f75677120e37b 100644 --- a/tests/safety/test_subaru.py +++ b/tests/safety/test_subaru.py @@ -174,8 +174,8 @@ def test_realtime_limits(self): def test_fwd_hook(self): - buss = range(0x0, 0x3) - msgs = range(0x1, 0x800) + buss = list(range(0x0, 0x3)) + msgs = list(range(0x1, 0x800)) blocked_msgs = [290, 356, 545, 802] for b in buss: for m in msgs: diff --git a/tests/safety/test_toyota.py b/tests/safety/test_toyota.py index e7c9b601a1f062..e2bc2a15287ff6 100644 --- a/tests/safety/test_toyota.py +++ b/tests/safety/test_toyota.py @@ -281,8 +281,8 @@ def test_gas_interceptor_safety_check(self): def test_fwd_hook(self): - buss = range(0x0, 0x3) - msgs = range(0x1, 0x800) + buss = list(range(0x0, 0x3)) + msgs = list(range(0x1, 0x800)) long_controls_allowed = [0, 1] toyota_camera_forwarded = [0, 1] diff --git a/tests/safety/test_toyota_ipas.py b/tests/safety/test_toyota_ipas.py index 9e163e64121f75..cc74d3a15d6767 100644 --- a/tests/safety/test_toyota_ipas.py +++ b/tests/safety/test_toyota_ipas.py @@ -135,7 +135,7 @@ def test_angle_cmd_when_disabled(self): # test angle cmd too far from actual angle_refs = [-10, 10] - deltas = range(-2, 3) + deltas = list(range(-2, 3)) expected_results = [False, True, True, True, False] for a in angle_refs: diff --git a/tests/safety_replay/test_safety_replay.py b/tests/safety_replay/test_safety_replay.py index ff23e0164767d6..70987371054871 100755 --- a/tests/safety_replay/test_safety_replay.py +++ b/tests/safety_replay/test_safety_replay.py @@ -3,8 +3,8 @@ import os import requests -from helpers import safety_modes -from replay_drive import replay_drive +from .helpers import safety_modes +from .replay_drive import replay_drive from tools.lib.logreader import LogReader BASE_URL = "https://commadataci.blob.core.windows.net/openpilotci/" diff --git a/tests/throughput_test.py b/tests/throughput_test.py index 0bda03265d0253..69b06c7646d0b2 100755 --- a/tests/throughput_test.py +++ b/tests/throughput_test.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -from __future__ import print_function + import os import sys import struct @@ -34,7 +34,7 @@ p_in.can_recv() BATCH_SIZE = 16 - for a in tqdm(range(0, 10000, BATCH_SIZE)): + for a in tqdm(list(range(0, 10000, BATCH_SIZE))): for b in range(0, BATCH_SIZE): msg = b"\xaa"*4 + struct.pack("I", a+b) if a%1 == 0: @@ -61,4 +61,4 @@ if len(set_out - set_in): print("MISSING %d" % len(set_out - set_in)) if len(set_out - set_in) < 256: - print(map(hex, sorted(list(set_out - set_in)))) + print(list(map(hex, sorted(list(set_out - set_in))))) diff --git a/tests/tucan_loopback.py b/tests/tucan_loopback.py index dbde2735e30445..1b5ed016633837 100755 --- a/tests/tucan_loopback.py +++ b/tests/tucan_loopback.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -from __future__ import print_function + import os import sys import time @@ -29,14 +29,14 @@ def run_test(sleep_duration): run_test_w_pandas(pandas, sleep_duration) def run_test_w_pandas(pandas, sleep_duration): - h = list(map(lambda x: Panda(x), pandas)) + h = list([Panda(x) for x in pandas]) print("H", h) for hh in h: hh.set_controls_allowed(True) # test both directions - for ho in permutations(range(len(h)), r=2): + for ho in permutations(list(range(len(h))), r=2): print("***************** TESTING", ho) panda0, panda1 = h[ho[0]], h[ho[1]]