2to3 applied

This commit is contained in:
Riccardo
2019-09-24 22:33:46 -07:00
parent ffa68ef711
commit 2dc34096a0
38 changed files with 87 additions and 87 deletions

View File

@@ -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 os
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'

View File

@@ -1,4 +1,4 @@
from __future__ import print_function
import os
import usb1
import struct

View File

@@ -114,7 +114,7 @@ class ESPROM(object):
""" 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 main():
'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()

View File

@@ -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 flash_release(path=None, st_serial=None):
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()

View File

@@ -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]