scripts: Remove unused variables in all Python scripts

Discovered with pylint3.

Use the placeholder name '_' for unproblematic unused variables. It's
what I'm used to, and pylint knows not to flag it.

Python tip:

    for i in range(n):
        some_list.append(0)

can be replaced with

    some_list += n*[0]

Similarly, 3*'\t' gives '\t\t\t'.

(Relevant here because pylint flagged the loop index as unused.)

To do integer division in Python 3, use // instead of /.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
This commit is contained in:
Ulf Magnusson 2019-03-19 19:28:24 +01:00 committed by Kumar Gala
commit 12ba9dfa52
15 changed files with 19 additions and 26 deletions

View file

@ -79,14 +79,14 @@ def write_gperf_table(fp, eh, objs):
# priv stack declarations
fp.write("%{\n")
fp.write(includes)
for obj_addr, ko in objs.items():
for obj_addr in objs:
fp.write(priv_stack_decl_temp % (obj_addr))
fp.write("%}\n")
# structure declaration
fp.write(structure)
for obj_addr, ko in objs.items():
for obj_addr in objs:
byte_str = struct.pack("<I" if eh.little_endian else ">I", obj_addr)
fp.write("\"")
for byte in byte_str: