Skip to content

Commit

Permalink
undo unnecessary brackets for print
Browse files Browse the repository at this point in the history
  • Loading branch information
rbiasini committed Sep 25, 2019
1 parent dbc2480 commit ffa68ef
Show file tree
Hide file tree
Showing 10 changed files with 34 additions and 34 deletions.
6 changes: 3 additions & 3 deletions examples/get_panda_password.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ def get_panda_password():

wifi = p.get_serial()
#print('[%s]' % ', '.join(map(str, wifi)))
print(("SSID: " + wifi[0]))
print(("Password: " + wifi[1]))
print("SSID: " + wifi[0])
print("Password: " + wifi[1])

if __name__ == "__main__":
get_panda_password()
get_panda_password()
4 changes: 2 additions & 2 deletions examples/tesla_tester.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ def tesla_tester():
vin_index = int(binascii.hexlify(dat)[:2]) #first byte is the index, 00, 01, 02
vin_string = binascii.hexlify(dat)[2:] #rest of the string is the actual VIN data
vin[vin_index] = vin_string.decode("hex")
print(("Got VIN index " + str(vin_index) + " data " + vin[vin_index]))
print("Got VIN index " + str(vin_index) + " data " + vin[vin_index])
#if we have all 3 parts of the VIN, print it and break out of our while loop
if 0 in vin and 1 in vin and 2 in vin:
print(("VIN: " + vin[0] + vin[1] + vin[2][:3]))
print("VIN: " + vin[0] + vin[1] + vin[2][:3])
break

if __name__ == "__main__":
Expand Down
22 changes: 11 additions & 11 deletions python/esptool.py
Original file line number Diff line number Diff line change
Expand Up @@ -488,14 +488,14 @@ def __init__(self, load_file=None):
(magic, segments, self.flash_mode, self.flash_size_freq, self.entrypoint) = struct.unpack('<BBBBI', load_file.read(8))

if first_flash_mode != self.flash_mode:
print(('WARNING: Flash mode value in first header (0x%02x) disagrees with second (0x%02x). Using second value.'
% (first_flash_mode, self.flash_mode)))
print('WARNING: Flash mode value in first header (0x%02x) disagrees with second (0x%02x). Using second value.'
% (first_flash_mode, self.flash_mode))
if first_flash_size_freq != self.flash_size_freq:
print(('WARNING: Flash size/freq value in first header (0x%02x) disagrees with second (0x%02x). Using second value.'
% (first_flash_size_freq, self.flash_size_freq)))
print('WARNING: Flash size/freq value in first header (0x%02x) disagrees with second (0x%02x). Using second value.'
% (first_flash_size_freq, self.flash_size_freq))
if first_entrypoint != self.entrypoint:
print(('WARNING: Enterypoint address in first header (0x%08x) disagrees with second header (0x%08x). Using second value.'
% (first_entrypoint, self.entrypoint)))
print('WARNING: Enterypoint address in first header (0x%08x) disagrees with second header (0x%08x). Using second value.'
% (first_entrypoint, self.entrypoint))

if magic != ESPROM.ESP_IMAGE_MAGIC or segments > 16:
raise FatalError('Invalid V2 second header magic=%d segments=%d' % (magic, segments))
Expand Down Expand Up @@ -911,8 +911,8 @@ def write_flash(esp, args):
t = time.time()
flasher.flash_write(address, image, not args.no_progress)
t = time.time() - t
print(('\rWrote %d bytes at 0x%x in %.1f seconds (%.1f kbit/s)...'
% (len(image), address, t, len(image) / t * 8 / 1000)))
print('\rWrote %d bytes at 0x%x in %.1f seconds (%.1f kbit/s)...'
% (len(image), address, t, len(image) / t * 8 / 1000))
print('Leaving...')
if args.verify:
print('Verifying just-written flash...')
Expand All @@ -922,7 +922,7 @@ def write_flash(esp, args):

def image_info(args):
image = LoadFirmwareImage(args.filename)
print(('Image version: %d' % image.version))
print('Image version: %d' % image.version)
print(('Entry point: %08x' % image.entrypoint) if image.entrypoint != 0 else 'Entry point not set')
print('%d segments' % len(image.segments))
print()
Expand Down Expand Up @@ -1024,8 +1024,8 @@ def read_flash(esp, args):
t = time.time()
data = flasher.flash_read(args.address, args.size, not args.no_progress)
t = time.time() - t
print(('\rRead %d bytes at 0x%x in %.1f seconds (%.1f kbit/s)...'
% (len(data), args.address, t, len(data) / t * 8 / 1000)))
print('\rRead %d bytes at 0x%x in %.1f seconds (%.1f kbit/s)...'
% (len(data), args.address, t, len(data) / t * 8 / 1000))
file(args.filename, 'wb').write(data)


Expand Down
2 changes: 1 addition & 1 deletion python/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def ensure_st_up_to_date():

assert(not panda.bootstub)
version = str(panda.get_version())
print(("%s should be %s" % (version, repo_version)))
print("%s should be %s" % (version, repo_version))
assert(version.startswith(repo_version))

if __name__ == "__main__":
Expand Down
16 changes: 8 additions & 8 deletions tests/automated/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def _connect_wifi(dongle_id, pw, insecure_okay=False):
except:
pass

print(("WIFI: connecting to %s" % ssid))
print("WIFI: connecting to %s" % ssid)

while 1:
if sys.platform == "darwin":
Expand All @@ -72,7 +72,7 @@ def _connect_wifi(dongle_id, pw, insecure_okay=False):
cnt = 0
MAX_TRIES = 10
while cnt < MAX_TRIES:
print(("WIFI: scanning %d" % cnt))
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"))
Expand Down Expand Up @@ -176,7 +176,7 @@ def wrapper(panda_type=None, **kwargs):
if panda_type is not None:
if not isinstance(panda_type, list):
panda_type = [panda_type]

# If not done already, get panda serials and their type
global _panda_serials
if _panda_serials == None:
Expand All @@ -185,7 +185,7 @@ def wrapper(panda_type=None, **kwargs):
p = Panda(serial=serial)
_panda_serials.append((serial, p.get_type()))
p.close()

# Find a panda with the correct types and add the corresponding serial
serials = []
for p_type in panda_type:
Expand Down Expand Up @@ -216,7 +216,7 @@ def wrapper(panda_serials=None, **kwargs):
if panda_serials is not None:
if not isinstance(panda_serials, list):
panda_serials = [panda_serials]

# Connect to pandas
pandas = []
for panda_serial in panda_serials:
Expand Down Expand Up @@ -247,7 +247,7 @@ def clear_can_buffers(panda):
# clear tx buffers
for i in range(4):
panda.can_clear(i)

# clear rx buffers
panda.can_clear(0xFFFF)
r = [1]
Expand All @@ -256,5 +256,5 @@ def clear_can_buffers(panda):
r = panda.can_recv()
time.sleep(0.05)
if (time.time() - st) > 10:
print(("Unable to clear can buffers for panda ", panda.get_serial()))
assert False
print("Unable to clear can buffers for panda ", panda.get_serial())
assert False
2 changes: 1 addition & 1 deletion tests/get_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
if __name__ == "__main__":
for p in Panda.list():
pp = Panda(p)
print(("%s: %s" % (pp.get_serial()[0], pp.get_version())))
print("%s: %s" % (pp.get_serial()[0], pp.get_version()))


2 changes: 1 addition & 1 deletion tests/gmbitbang/rigol.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
print(resources.list_resources())

scope = resources.open_resource('USB0::0x1AB1::0x04CE::DS1ZA184652242::INSTR', timeout=2000, chunk_size=1024000)
print((scope.query('*IDN?').strip()))
print(scope.query('*IDN?').strip())

#voltscale = scope.ask_for_values(':CHAN1:SCAL?')[0]
#voltoffset = scope.ask_for_values(":CHAN1:OFFS?")[0]
Expand Down
4 changes: 2 additions & 2 deletions tests/gmbitbang/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
p2.set_safety_mode(Panda.SAFETY_ALLOUTPUT)

# get versions
print((p1.get_version()))
print((p2.get_version()))
print(p1.get_version())
print(p2.get_version())

# this sets bus 2 to actually be GMLAN
p2.set_gmlan(bus=2)
Expand Down
4 changes: 2 additions & 2 deletions tests/health_test.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python3
import time
from panda import Panda

if __name__ == "__main__":
panda_serials = Panda.list()
pandas = []
Expand All @@ -13,7 +13,7 @@

while True:
for panda in pandas:
print((panda.health()))
print(panda.health())
print("\n")
time.sleep(0.5)

6 changes: 3 additions & 3 deletions tests/standalone_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
p = Panda("WIFI")
else:
p = Panda()
print((p.get_serial()))
print((p.health()))
print(p.get_serial())
print(p.health())

t1 = time.time()
for i in range(100):
p.get_serial()
t2 = time.time()
print(("100 requests took %.2f ms" % ((t2-t1)*1000)))
print("100 requests took %.2f ms" % ((t2-t1)*1000))

p.set_safety_mode(Panda.SAFETY_ALLOUTPUT)

Expand Down

0 comments on commit ffa68ef

Please sign in to comment.