style: Various other PEP8 fixes in Python files

Done with `autopep8 --select=E7`, fixes:

- E701 - Put colon-separated compound statement on separate lines.
- E702 - Put semicolon-separated compound statement on separate lines.
- E703 - Put semicolon-separated compound statement on separate lines.
- E711 - Fix comparison with None.
- E712 - Fix (trivial case of) comparison with boolean.
- E713 - Fix (trivial case of) non-membership check.
- E721 - Fix various deprecated code (via lib2to3).
This commit is contained in:
Rémi Verschelde 2016-11-01 00:24:30 +01:00
parent 817dd7ccbb
commit f34151ff0f
25 changed files with 370 additions and 369 deletions

View file

@ -26,11 +26,11 @@ def write_string(_f, text, newline=True):
def escape(ret):
ret = ret.replace("&", "&");
ret = ret.replace("<", "&gt;");
ret = ret.replace(">", "&lt;");
ret = ret.replace("'", "&apos;");
ret = ret.replace("\"", "&quot;");
ret = ret.replace("&", "&amp;")
ret = ret.replace("<", "&gt;")
ret = ret.replace(">", "&lt;")
ret = ret.replace("'", "&apos;")
ret = ret.replace("\"", "&quot;")
return ret
@ -138,22 +138,22 @@ def write_class(c):
for a in list(m):
if (a.tag == "return"):
typ = get_tag(a, "type")
write_string(f, '<return' + typ + '>');
write_string(f, '</return>');
write_string(f, '<return' + typ + '>')
write_string(f, '</return>')
elif (a.tag == "argument"):
default = get_tag(a, "default")
write_string(f, '<argument index="' + a.attrib["index"] + '" name="' + escape(a.attrib["name"]) + '" type="' + a.attrib["type"] + '"' + default + '>');
write_string(f, '</argument>');
write_string(f, '<argument index="' + a.attrib["index"] + '" name="' + escape(a.attrib["name"]) + '" type="' + a.attrib["type"] + '"' + default + '>')
write_string(f, '</argument>')
write_string(f, '<description>');
write_string(f, '<description>')
if (old_class != None):
old_method_descr = find_method_descr(old_class, m.attrib["name"])
if (old_method_descr):
write_string(f, escape(escape(old_method_descr.strip())))
write_string(f, '</description>');
write_string(f, '</description>')
dec_tab()
write_string(f, "</method>")
dec_tab()
@ -173,15 +173,15 @@ def write_class(c):
for a in list(m):
if (a.tag == "argument"):
write_string(f, '<argument index="' + a.attrib["index"] + '" name="' + escape(a.attrib["name"]) + '" type="' + a.attrib["type"] + '">');
write_string(f, '</argument>');
write_string(f, '<argument index="' + a.attrib["index"] + '" name="' + escape(a.attrib["name"]) + '" type="' + a.attrib["type"] + '">')
write_string(f, '</argument>')
write_string(f, '<description>');
write_string(f, '<description>')
if (old_class != None):
old_signal_descr = find_signal_descr(old_class, m.attrib["name"])
if (old_signal_descr):
write_string(f, escape(old_signal_descr.strip()))
write_string(f, '</description>');
write_string(f, '</description>')
dec_tab()
write_string(f, "</signal>")
dec_tab()