Skip to content

Commit 12f36ad

Browse files
committed
flake8 linting
1 parent 6f27e01 commit 12f36ad

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

peripheral_drivers/i2cbridge/decode.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,7 @@ def platform_write_rpt(devaddr, memaddr, nbytes, cmd_table):
5656

5757

5858
def decode_file(filename, break_on_stop=True, base=None):
59-
import os
60-
progname = os.path.split(filename)[1]
59+
# progname = os.path.split(filename)[1]
6160
prog = load_file(filename, base=base)
6261
decoder = I2CBridgeDecoder(report_filename=None, break_on_stop=break_on_stop)
6362
return decoder.decode(prog)
@@ -82,7 +81,7 @@ def print(self, *args, **kwargs):
8281
fd = self._fd
8382
else:
8483
fd = sys.stdout
85-
print(*args, **kwargs)
84+
print(*args, **kwargs, file=fd)
8685
return
8786

8887
def decode(self, prog):
@@ -156,7 +155,7 @@ def decode(self, prog):
156155
pa += inc
157156
else:
158157
self.print(f"Write - dev_addr: 0x{devaddr:02x} - mem_addr:" +
159-
f" 0x{memaddr:04x} - START - data:", end="")
158+
f" 0x{memaddr:04x} - START - data:", end="")
160159
for j in range(n_code-2):
161160
data = _int(next(cmd_table))
162161
pa += 1
@@ -179,7 +178,7 @@ def decode(self, prog):
179178
elif op_code == o_sx: # set result address
180179
result_address = 0x800 + n_code*32
181180
self.print(f"Set result address to 0x{result_address:03x}" +
182-
f" (0x{n_code:02x})")
181+
f" (0x{n_code:02x})")
183182
pa += 1
184183

185184
self.print("---- End of report ----")
@@ -198,7 +197,6 @@ def load_file(file_path=None, base=None):
198197
if binary:
199198
return iter(open(file_path, 'rb'))
200199
else:
201-
#return iter(open(file_path, 'r'))
202200
fd = open(file_path, "r")
203201
sl = fd.read().split()
204202
ll = []
@@ -232,7 +230,8 @@ def main():
232230
import argparse
233231
parser = argparse.ArgumentParser("I2CBridge Program Decoder")
234232
parser.add_argument("prog_file", default=None, help="Program file (binary or hex ASCII) to decode")
235-
parser.add_argument("-c", "--continue_on_stop", default=False, help="Instead of breaking decoding when 'stop' byte reached, continue parsing with warning.")
233+
parser.add_argument("-c", "--continue_on_stop", default=False,
234+
help="Instead of breaking decoding when 'stop' byte reached, continue parsing with warning.")
236235
parser.add_argument("-d", "--decimal", default=False, help="Interpret ASCII input as base-10 (instead of base-16).")
237236
args = parser.parse_args()
238237
base = 16

0 commit comments

Comments
 (0)