From 7cdeb5e42a2f16babc2b68bb026e58bb783da904 Mon Sep 17 00:00:00 2001 From: Dhvani Patel Date: Thu, 27 Jul 2017 14:50:21 -0600 Subject: [PATCH] Fixed up sub to make sub for every window --- __pycache__/toCheck.pypy-41.pyc | Bin 2604 -> 15515 bytes mutate_token_sub.py | 206 ++++++++++++ mutate_token_sub.pyc | Bin 3754 -> 6332 bytes py_mutations_hub.py | 74 +++-- toCheck.py | 570 ++++++++++++++++++++++++++++++++ 5 files changed, 825 insertions(+), 25 deletions(-) create mode 100644 toCheck.py diff --git a/__pycache__/toCheck.pypy-41.pyc b/__pycache__/toCheck.pypy-41.pyc index 462cb2f93cfeef90406e38e7c6a5f31b6924e241..7002a4437dfb5f9e9608ffbaaf31b3e5d7cc0277 100644 GIT binary patch literal 15515 zcmds8TWlQHc|NndTyl94FQ!DvlI1aDTa@i=OiHGkICXrHl%%#8Wu(+Gn|3j&W=l}leIXnLEQ{&gZ{{GuFW&V}TceG+D<>SAl>PoHad_mPM z)hMX-g0k3FRP~~2l+=1jmrJTXq8eqjUe@IiRUcK2F||IX%VkxssK&TjAJ^qkRi99e zNwq$y%VVlOr5eZ7`Y~OusQR>O%&7HQT^^V6oLYZGmnT$xUNw%Z_2arcsp=KcRx-Y7?_8sP8Jy@b(=`tv}AKy1sN0`xpK<{;e%x z166zs$u+OzH7?((1?@O&HFfYX5Jbvw1d2{waH(5wZzX%bCuhVKTi*4X{hYuQ9^ z1iQcN)w{tpFYF}sbLj0!Pq)qIxZOCcN7+pIF}ik&OKP?1*SZ_^Fxn0}y1ImF-;2#6 zMo^OZbmKURmo{z$QT)0WnJ#>_E8(rU+X_u;!#v>1R5zAQzT@l56vrV%i zJfn8Ax5f`^u}s+3ZyryhzYr(-1~-kbmoh>DZTyR-Ku6Gj-BJNCq|_hFGjjwsGmj9_%*+$i%p50*nK?oHGP7Xt3nuYTO3f+dpOOq1 z;!(+*R{m+poKgN6$vmc<>r0PeTO6YF;n3J2*#;7~Mi!z(;@|7+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t^ zQx4W_#xci;R9f;Jx-iNh)PJ8|_2|~?7k!z2YSXv<1xk#c zC#gtJQPk+d$uIqA*G zupzw$daGhYj+!#?B(BM?B5y=q^jfsL+o{8c9S^FbbK`Lmf8O!gtUyGgkz*r1 zaM$sAW}?C!n8@uJ>oy~6&I98HoM^v*fXyBZ3Jt8L@Q zkCBYHF7cck!mEZn=9DI<#7&7?WgA%%WN97_bln`}-uCX^PWP!>g#OL`-m@^+{(gTa z*xpJSbdu@Ji{voLG|a+=|?Wfv-KmJXLbRdn|bC; z=GNTt$f#*uvsa8wpf#eAex41ILoL_0QEH8&iw+eD`)Pv3YR~# zpRzVOELV%KHt9Y~r8a*@#!%QJH46{|egN~NqMbkudP=IN*T@iHUVh;xkIVK7%hFN1hT=>M|!(mVH701)q8%d)S}5XlP0k&6N%E15u8J(t{I z?aP2?kit0NDm|H!*b@G;9oCaS(C(07C1tqdD7Q|TM4~B#Cibv zxx%_Ic7%h#ls35jJTYMsUnPQainKqU^buCrHiT5xyqn%Cz7PD?RKHuft$lneS;!mO zSF(Hx=JjT^x!SCi*JuL+<1BIXO|95uI7$uA15J$*erGt!aR3wr zBr(Q+Ljm5RE20#qL-Y{$c9~YawYcxuzajPDpIp-zH_E7 0: + if after[0] == ' ': + new_text = before + chosenToken.encode() + after + else: + new_text = before + chosenToken.encode() + after + else: + new_text = before + chosenToken.encode() + after + else: + + if chosenInd == data["indexes_m"].index('\n'): + #print "shiz" + if after[0] == ' ': + space = ' ' * (check-1) + else: + space = ' ' * (check) + new_text = before + chosenToken.encode() + space + after + else: + #print "WAS HERE" + new_text = before + chosenToken.encode() + after + + + #print actual_target_ind + + #print '-------------------------------' + #print new_text + toTest = checkPyPySyntax(new_text) + if toTest == None: + #print radOut + #if radOut != 0: + # radOut = radOut-1 + #else: + # radOut = 0 + #print radOut + curr = curr + 1 + if curr > 10: + radOut = radOut + 1 + else: + radOut = radOut + fixToks.remove(send) + chosens.remove(chosenLineInd) + insToks.remove(insTok) + #print "test_t" + else: + curr = 0 + radOut = radOut + 1 + + + return new_text, YES_TOKEN, SUBSTITUTION, chosens, fixToks, insToks + + #print "-----------FINISHED-------------------" + #print chosenLineInd+1 + #print out_tokens_loc + #print len(raw_tokens_pass) + #print len(out_tokens_loc) + #print lenD + + def subTokMut(raw_tokens, raw_text): with open('vocabulary_mutate.json') as data_file: diff --git a/mutate_token_sub.pyc b/mutate_token_sub.pyc index 2af272838b9b1d6ca3a3affb17d34580ba66e52f..995ba760cbb7c9a1c2259c0bb6f0713467fed907 100644 GIT binary patch delta 2907 zcmZuyO>84s5w6$%Nz$<$C*#ENW`6QFGtMM4nXvrrkCq)KMr3E=K*xh;Mg-IA?wQz0 z+GD#7VR}ACPaY0--EaET{H$YnLVYL!M;XfMkN>Z^8!gvEA$ zuD@4Ruc}_ZU!Hq+Z6@|{+WcVawR?3Md<_17nV;?--kkYeCQUyex}PIQ(RMNO>%Y7m z>&IC68GeTNxe3F6C5W^^L5zHY;gO=BOi>UgUs2N_9fu@HP}L#&`rU^_L6U$&g2RF% zbT~&^(fUq-0+X~!!6@lrYQ{*9V!di_Q1$Q{={~X1r4vRYCyeya38sBORX+|dh@T?R zBSNQ1r^qpA%8AjQL7n%=PYgtpu+5N{{genPkI_SpA7mxxalr{X{3&9r@BD~@Go;T@ zGf7UI_F~jgYQQFhedCx-3j6q&9TN8Fm>m}O^<#EK*g)wC*;}8BGK4UksMIA;?blWN zNVOlU_8Y3L@T(%(93B3a{9)1=a!ksz@%qj$D43MAr|7T;C5kdJ@U^~UQ;;V;NvI3w z|3rZ{C>KnN)TC*r54J#>e-othREWp+h+4yjo~AuToL1CeGv0Wzv@^D3TtN$i*nFc^Q%@ zt!5UoV2Lzm%D5yOJgLiLKIVccLf6LWh==D2=_}Oa_VKLo*4Ur`C(FElwqfCE`O4{~ zk;xT_yDULhxZYPuFC%HR=x!WUKIH@gSrX}^Y-fXOIwh< z6#uKp01@NV`7o|mrDRT4GI$c#{5rWvO+HFQc~<6m)Y|{}|6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