diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2016-10-30 18:44:57 +0100 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2016-11-01 00:33:51 +0100 |
commit | 97c8508f5e4f57b1048830d44e76e1f4517fd449 (patch) | |
tree | 3d6af30f519a2a7788e596f21d91f3ecfa399864 /core | |
parent | 681575fa7123592897090c6cce44402c4e45baeb (diff) |
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.
Diffstat (limited to 'core')
-rw-r--r-- | core/SCsub | 44 | ||||
-rw-r--r-- | core/make_binders.py | 174 |
2 files changed, 109 insertions, 109 deletions
diff --git a/core/SCsub b/core/SCsub index cbed2e4f35..d3429c57a8 100644 --- a/core/SCsub +++ b/core/SCsub @@ -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: - - 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) + 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) f = open("script_encryption_key.cpp", "wb") f.write("#include \"globals.h\"\nuint8_t script_encryption_key[32]={" + txt + "};\n") diff --git a/core/make_binders.py b/core/make_binders.py index 7584722965..72ca3286fa 100644 --- a/core/make_binders.py +++ b/core/make_binders.py @@ -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="" - - 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 (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 - - return 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="" + + 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)) + + from_pos=end+1 + + return outtext def run(target, source, env): - versions=10 - versions_ext=6 - text="" - text_ext="" - - 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 - - - f=open(target[0].path,"w") - f.write(text) - f.close() - - f=open(target[1].path,"w") - f.write(text_ext) - f.close() + versions=10 + versions_ext=6 + text="" + text_ext="" + + 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 + + + f=open(target[0].path,"w") + f.write(text) + f.close() + + f=open(target[1].path,"w") + f.write(text_ext) + f.close() |