mirror of
https://github.com/opentx/opentx.git
synced 2025-07-21 15:25:17 +03:00
PEP8 radio/util/parse.py
Fix whitespace and indentation
This commit is contained in:
parent
fa0ded50fe
commit
196dbb1d39
1 changed files with 44 additions and 45 deletions
|
@ -26,33 +26,33 @@ for line in fr.readlines():
|
||||||
pos_endparenthesis = line.find('"', pos_pstr + 7)
|
pos_endparenthesis = line.find('"', pos_pstr + 7)
|
||||||
else:
|
else:
|
||||||
pos_endparenthesis = line.find("\")", pos_pstr)
|
pos_endparenthesis = line.find("\")", pos_pstr)
|
||||||
str = line[pos_pstr+6:pos_endparenthesis]
|
pstr = line[pos_pstr + 6:pos_endparenthesis]
|
||||||
|
|
||||||
str_rep = "STR_"+str.upper()
|
str_rep = "STR_" + pstr.upper()
|
||||||
for s in (" ", ".", "[", "]", "-", "!", "/", ")", "(", "%", "+", ":"):
|
for s in (" ", ".", "[", "]", "-", "!", "/", ")", "(", "%", "+", ":"):
|
||||||
str_rep = str_rep.replace(s, "")
|
str_rep = str_rep.replace(s, "")
|
||||||
|
|
||||||
if "14" in str or "32" in str or "@" in str or len(str_rep) <= 5:
|
if "14" in pstr or "32" in pstr or "@" in pstr or len(str_rep) <= 5:
|
||||||
pos_pstr = -1
|
pos_pstr = -1
|
||||||
else:
|
else:
|
||||||
if MENU:
|
if MENU:
|
||||||
glob_str = line[pos_pstr + 5:pos_endparenthesis + 1]
|
glob_str = line[pos_pstr + 5:pos_endparenthesis + 1]
|
||||||
str_rep = "STR_MENU"+str.upper()
|
str_rep = "STR_MENU" + pstr.upper()
|
||||||
else:
|
else:
|
||||||
glob_str = line[pos_pstr:pos_endparenthesis + 2]
|
glob_str = line[pos_pstr:pos_endparenthesis + 2]
|
||||||
str_rep = "STR_"+str.upper()
|
str_rep = "STR_" + pstr.upper()
|
||||||
for s in (" ", ".", "[", "]", "-", "!", "/", ")", "(", "%", "+", ":"):
|
for s in (" ", ".", "[", "]", "-", "!", "/", ")", "(", "%", "+", ":"):
|
||||||
str_rep = str_rep.replace(s, "")
|
str_rep = str_rep.replace(s, "")
|
||||||
|
|
||||||
line = line.replace(glob_str, str_rep)
|
line = line.replace(glob_str, str_rep)
|
||||||
|
|
||||||
if str_rep in replacements.keys():
|
if str_rep in replacements.keys():
|
||||||
if replacements[str_rep] != str:
|
if replacements[str_rep] != pstr:
|
||||||
print("!!!!! NON !!!!!")
|
print("!!!!! NON !!!!!")
|
||||||
else:
|
else:
|
||||||
replacements[str_rep] = str
|
replacements[str_rep] = pstr
|
||||||
print(glob_str, "=>", str, str_rep)
|
print(glob_str, "=>", pstr, str_rep)
|
||||||
ew.write("#define " + str_rep[1:] + " "*(17-len(str_rep)) + '"%s"\n' % str)
|
ew.write("#define " + str_rep[1:] + " " * (17 - len(str_rep)) + '"%s"\n' % pstr)
|
||||||
hw.write("extern const PROGMEM char %s[];\n" % str_rep)
|
hw.write("extern const PROGMEM char %s[];\n" % str_rep)
|
||||||
cw.write("const prog_char APM %s[] = %s;\n" % (str_rep, str_rep[1:]))
|
cw.write("const prog_char APM %s[] = %s;\n" % (str_rep, str_rep[1:]))
|
||||||
|
|
||||||
|
@ -64,4 +64,3 @@ fw.close()
|
||||||
ew.close()
|
ew.close()
|
||||||
hw.close()
|
hw.close()
|
||||||
cw.close()
|
cw.close()
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue