style: Start applying PEP8 to Python files, indentation issues

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

- E101 - Reindent all lines.
- E112 - Fix under-indented comments.
- E113 - Fix over-indented comments.
- E115 - Fix under-indented comments.
- E116 - Fix over-indented comments.
- E121 - Fix a badly indented line.
- E122 - Fix a badly indented line.
- E123 - Fix a badly indented line.
- E124 - Fix a badly indented line.
- E125 - Fix indentation undistinguish from the next logical line.
- E126 - Fix a badly indented line.
- E127 - Fix a badly indented line.
- E128 - Fix a badly indented line.
- E129 - Fix a badly indented line.
This commit is contained in:
Rémi Verschelde 2016-10-30 18:44:57 +01:00
parent 681575fa71
commit 97c8508f5e
88 changed files with 6291 additions and 6291 deletions

View file

@ -9,9 +9,9 @@ gd_call=""
gd_inc=""
for x in env.global_defaults:
env.core_sources.append("#platform/"+x+"/globals/global_defaults.cpp")
gd_inc+='#include "platform/'+x+'/globals/global_defaults.h"\n'
gd_call+="\tregister_"+x+"_global_defaults();\n"
env.core_sources.append("#platform/"+x+"/globals/global_defaults.cpp")
gd_inc+='#include "platform/'+x+'/globals/global_defaults.h"\n'
gd_call+="\tregister_"+x+"_global_defaults();\n"
gd_cpp='#include "globals.h"\n'
gd_cpp+=gd_inc
@ -24,25 +24,25 @@ f.close()
import os
txt = "0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0"
if ("SCRIPT_AES256_ENCRYPTION_KEY" in os.environ):
e=os.environ["SCRIPT_AES256_ENCRYPTION_KEY"]
txt = ""
ec_valid=True
if (len(e)!=64):
ec_valid=False
else:
e=os.environ["SCRIPT_AES256_ENCRYPTION_KEY"]
txt = ""
ec_valid=True
if (len(e)!=64):
ec_valid=False
else:
for i in range(len(e)>>1):
if (i>0):
txt+=","
txts="0x"+e[i*2:i*2+2]
try:
int(txts,16)
except:
ec_valid=False
txt+=txts
if (not ec_valid):
txt = "0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0"
print("Invalid AES256 encryption key, not 64 bits hex: "+e)
for i in range(len(e)>>1):
if (i>0):
txt+=","
txts="0x"+e[i*2:i*2+2]
try:
int(txts,16)
except:
ec_valid=False
txt+=txts
if (not ec_valid):
txt = "0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0"
print("Invalid AES256 encryption key, not 64 bits hex: "+e)
f = open("script_encryption_key.cpp", "wb")
f.write("#include \"globals.h\"\nuint8_t script_encryption_key[32]={" + txt + "};\n")

View file

@ -168,94 +168,94 @@ MethodBind* create_method_bind($ifret R$ $ifnoret void$ (T::*p_method)($arg, P@$
def make_version(template,nargs,argmax,const,ret):
intext=template
from_pos=0
outtext=""
intext=template
from_pos=0
outtext=""
while(True):
to_pos=intext.find("$",from_pos)
if (to_pos==-1):
outtext+=intext[from_pos:]
break
else:
outtext+=intext[from_pos:to_pos]
end=intext.find("$",to_pos+1)
if (end==-1):
break # ignore
macro=intext[to_pos+1:end]
cmd=""
data=""
while(True):
to_pos=intext.find("$",from_pos)
if (to_pos==-1):
outtext+=intext[from_pos:]
break
else:
outtext+=intext[from_pos:to_pos]
end=intext.find("$",to_pos+1)
if (end==-1):
break # ignore
macro=intext[to_pos+1:end]
cmd=""
data=""
if (macro.find(" ")!=-1):
cmd=macro[0:macro.find(" ")]
data=macro[macro.find(" ")+1:]
else:
cmd=macro
if (macro.find(" ")!=-1):
cmd=macro[0:macro.find(" ")]
data=macro[macro.find(" ")+1:]
else:
cmd=macro
if (cmd=="argc"):
outtext+=str(nargs)
if (cmd=="ifret" and ret):
outtext+=data
if (cmd=="ifargs" and nargs):
outtext+=data
if (cmd=="ifretargs" and nargs and ret):
outtext+=data
if (cmd=="ifconst" and const):
outtext+=data
elif (cmd=="ifnoconst" and not const):
outtext+=data
elif (cmd=="ifnoret" and not ret):
outtext+=data
elif (cmd=="iftempl" and (nargs>0 or ret)):
outtext+=data
elif (cmd=="arg,"):
for i in range(1,nargs+1):
if (i>1):
outtext+=", "
outtext+=data.replace("@",str(i))
elif (cmd=="arg"):
for i in range(1,nargs+1):
outtext+=data.replace("@",str(i))
elif (cmd=="noarg"):
for i in range(nargs+1,argmax+1):
outtext+=data.replace("@",str(i))
elif (cmd=="noarg"):
for i in range(nargs+1,argmax+1):
outtext+=data.replace("@",str(i))
if (cmd=="argc"):
outtext+=str(nargs)
if (cmd=="ifret" and ret):
outtext+=data
if (cmd=="ifargs" and nargs):
outtext+=data
if (cmd=="ifretargs" and nargs and ret):
outtext+=data
if (cmd=="ifconst" and const):
outtext+=data
elif (cmd=="ifnoconst" and not const):
outtext+=data
elif (cmd=="ifnoret" and not ret):
outtext+=data
elif (cmd=="iftempl" and (nargs>0 or ret)):
outtext+=data
elif (cmd=="arg,"):
for i in range(1,nargs+1):
if (i>1):
outtext+=", "
outtext+=data.replace("@",str(i))
elif (cmd=="arg"):
for i in range(1,nargs+1):
outtext+=data.replace("@",str(i))
elif (cmd=="noarg"):
for i in range(nargs+1,argmax+1):
outtext+=data.replace("@",str(i))
elif (cmd=="noarg"):
for i in range(nargs+1,argmax+1):
outtext+=data.replace("@",str(i))
from_pos=end+1
from_pos=end+1
return outtext
return outtext
def run(target, source, env):
versions=10
versions_ext=6
text=""
text_ext=""
versions=10
versions_ext=6
text=""
text_ext=""
for i in range(0,versions+1):
for i in range(0,versions+1):
t=""
t+=make_version(template,i,versions,False,False)
t+=make_version(template_typed,i,versions,False,False)
t+=make_version(template,i,versions,False,True)
t+=make_version(template_typed,i,versions,False,True)
t+=make_version(template,i,versions,True,False)
t+=make_version(template_typed,i,versions,True,False)
t+=make_version(template,i,versions,True,True)
t+=make_version(template_typed,i,versions,True,True)
if (i>=versions_ext):
text_ext+=t
else:
text+=t
t=""
t+=make_version(template,i,versions,False,False)
t+=make_version(template_typed,i,versions,False,False)
t+=make_version(template,i,versions,False,True)
t+=make_version(template_typed,i,versions,False,True)
t+=make_version(template,i,versions,True,False)
t+=make_version(template_typed,i,versions,True,False)
t+=make_version(template,i,versions,True,True)
t+=make_version(template_typed,i,versions,True,True)
if (i>=versions_ext):
text_ext+=t
else:
text+=t
f=open(target[0].path,"w")
f.write(text)
f.close()
f=open(target[0].path,"w")
f.write(text)
f.close()
f=open(target[1].path,"w")
f.write(text_ext)
f.close()
f=open(target[1].path,"w")
f.write(text_ext)
f.close()