You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-04 12:00:25 +00:00
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:
@@ -26,11 +26,11 @@ def write_string(_f, text, newline=True):
|
||||
|
||||
|
||||
def escape(ret):
|
||||
ret = ret.replace("&", "&");
|
||||
ret = ret.replace("<", ">");
|
||||
ret = ret.replace(">", "<");
|
||||
ret = ret.replace("'", "'");
|
||||
ret = ret.replace("\"", """);
|
||||
ret = ret.replace("&", "&")
|
||||
ret = ret.replace("<", ">")
|
||||
ret = ret.replace(">", "<")
|
||||
ret = ret.replace("'", "'")
|
||||
ret = ret.replace("\"", """)
|
||||
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()
|
||||
|
||||
@@ -17,7 +17,7 @@ if len(input_list) < 1:
|
||||
|
||||
def validate_tag(elem, tag):
|
||||
if (elem.tag != tag):
|
||||
print("Tag mismatch, expected '" + tag + "', got " + elem.tag);
|
||||
print("Tag mismatch, expected '" + tag + "', got " + elem.tag)
|
||||
sys.exit(255)
|
||||
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ if len(input_list) < 1:
|
||||
|
||||
def validate_tag(elem, tag):
|
||||
if (elem.tag != tag):
|
||||
print("Tag mismatch, expected '" + tag + "', got " + elem.tag);
|
||||
print("Tag mismatch, expected '" + tag + "', got " + elem.tag)
|
||||
sys.exit(255)
|
||||
|
||||
|
||||
@@ -90,7 +90,7 @@ def make_html_top(body, bottom=False):
|
||||
def make_html_class_list(class_list, columns):
|
||||
|
||||
div = ET.Element("div")
|
||||
div.attrib["class"] = "ClassList";
|
||||
div.attrib["class"] = "ClassList"
|
||||
|
||||
h1 = ET.SubElement(div, "h2")
|
||||
h1.text = "Alphabetical Class List"
|
||||
@@ -463,7 +463,7 @@ def make_method_def(name, m, declare, event=False):
|
||||
def make_html_class(node):
|
||||
|
||||
div = ET.Element("div")
|
||||
div.attrib["class"] = "class";
|
||||
div.attrib["class"] = "class"
|
||||
|
||||
a = ET.SubElement(div, "a")
|
||||
a.attrib["name"] = node.attrib["name"]
|
||||
@@ -482,7 +482,7 @@ def make_html_class(node):
|
||||
ET.SubElement(div, "br")
|
||||
|
||||
div2 = ET.SubElement(div, "div")
|
||||
div2.attrib["class"] = "inheritance";
|
||||
div2.attrib["class"] = "inheritance"
|
||||
|
||||
span = ET.SubElement(div2, "span")
|
||||
span.text = "Inherits: "
|
||||
@@ -493,7 +493,7 @@ def make_html_class(node):
|
||||
ET.SubElement(div, "br")
|
||||
|
||||
div3 = ET.SubElement(div, "div")
|
||||
div3.attrib["class"] = "category";
|
||||
div3.attrib["class"] = "category"
|
||||
|
||||
span = ET.SubElement(div3, "span")
|
||||
span.attrib["class"] = "category"
|
||||
@@ -520,7 +520,7 @@ def make_html_class(node):
|
||||
h4.text = "Public Methods:"
|
||||
|
||||
method_table = ET.SubElement(div, "table")
|
||||
method_table.attrib["class"] = "method_list";
|
||||
method_table.attrib["class"] = "method_list"
|
||||
|
||||
for m in list(methods):
|
||||
#li = ET.SubElement(div2, "li")
|
||||
@@ -533,7 +533,7 @@ def make_html_class(node):
|
||||
h4.text = "Events:"
|
||||
|
||||
event_table = ET.SubElement(div, "table")
|
||||
event_table.attrib["class"] = "method_list";
|
||||
event_table.attrib["class"] = "method_list"
|
||||
|
||||
for m in list(events):
|
||||
#li = ET.SubElement(div2, "li")
|
||||
@@ -545,13 +545,13 @@ def make_html_class(node):
|
||||
h4 = ET.SubElement(div, "h4")
|
||||
h4.text = "Public Variables:"
|
||||
div2 = ET.SubElement(div, "div")
|
||||
div2.attrib["class"] = "member_list";
|
||||
div2.attrib["class"] = "member_list"
|
||||
|
||||
for c in list(members):
|
||||
|
||||
li = ET.SubElement(div2, "li")
|
||||
div3 = ET.SubElement(li, "div")
|
||||
div3.attrib["class"] = "member";
|
||||
div3.attrib["class"] = "member"
|
||||
make_type(c.attrib["type"], div3)
|
||||
span = ET.SubElement(div3, "span")
|
||||
span.attrib["class"] = "identifier member_name"
|
||||
@@ -566,12 +566,12 @@ def make_html_class(node):
|
||||
h4 = ET.SubElement(div, "h4")
|
||||
h4.text = "Constants:"
|
||||
div2 = ET.SubElement(div, "div")
|
||||
div2.attrib["class"] = "constant_list";
|
||||
div2.attrib["class"] = "constant_list"
|
||||
|
||||
for c in list(constants):
|
||||
li = ET.SubElement(div2, "li")
|
||||
div3 = ET.SubElement(li, "div")
|
||||
div3.attrib["class"] = "constant";
|
||||
div3.attrib["class"] = "constant"
|
||||
|
||||
span = ET.SubElement(div3, "span")
|
||||
span.attrib["class"] = "identifier constant_name"
|
||||
@@ -614,10 +614,10 @@ def make_html_class(node):
|
||||
descr = m.find("description")
|
||||
|
||||
if (descr == None or descr.text.strip() == ""):
|
||||
continue;
|
||||
continue
|
||||
|
||||
div2 = ET.SubElement(div, "div")
|
||||
div2.attrib["class"] = "method_doc";
|
||||
div2.attrib["class"] = "method_doc"
|
||||
|
||||
div2.append(make_method_def(node.attrib["name"], m, True))
|
||||
#anchor = ET.SubElement(div2, "a")
|
||||
@@ -675,7 +675,7 @@ for cn in class_names:
|
||||
css.attrib["type"] = "text/css"
|
||||
body2 = ET.SubElement(html2, "body")
|
||||
make_html_top(body2)
|
||||
body2.append(make_html_class(c));
|
||||
body2.append(make_html_class(c))
|
||||
make_html_bottom(body2)
|
||||
et_out = ET.ElementTree(html2)
|
||||
et_out.write(c.attrib["name"] + ".html")
|
||||
|
||||
Reference in New Issue
Block a user