From 14815b3d8cf48bb3c55e6c816d54f33b7103b08f Mon Sep 17 00:00:00 2001 From: rocky Date: Sun, 13 Dec 2015 17:55:05 -0500 Subject: [PATCH] test_pythonlib: Fix bug in traversing directores walker.py: imports; Add test Python2.5 bytecode - it works! Makefile: remove temporary directories and _dis files which were added by mistake --- test/Makefile | 9 +- test/bytecode_2.5/test_applyEquiv.pyc | Bin 0 -> 844 bytes test/bytecode_2.5/test_augmentedAssign.pyc | Bin 0 -> 1323 bytes test/bytecode_2.5/test_class.pyc | Bin 0 -> 1884 bytes test/bytecode_2.5/test_del.pyc | Bin 0 -> 796 bytes test/bytecode_2.5/test_divide_future.pyc | Bin 0 -> 339 bytes test/bytecode_2.5/test_divide_no_future.pyc | Bin 0 -> 271 bytes test/bytecode_2.5/test_docstring.pyc | Bin 0 -> 1518 bytes test/bytecode_2.5/test_empty.pyc | Bin 0 -> 100 bytes test/bytecode_2.5/test_exceptions.pyc | Bin 0 -> 2777 bytes test/bytecode_2.5/test_exec.pyc | Bin 0 -> 193 bytes test/bytecode_2.5/test_expressions.pyc | Bin 0 -> 341 bytes test/bytecode_2.5/test_extendedImport.pyc | Bin 0 -> 540 bytes test/bytecode_2.5/test_extendedPrint.pyc | Bin 0 -> 253 bytes test/bytecode_2.5/test_functions.pyc | Bin 0 -> 2438 bytes test/bytecode_2.5/test_global.pyc | Bin 0 -> 840 bytes test/bytecode_2.5/test_globals.pyc | Bin 0 -> 312 bytes test/bytecode_2.5/test_import.pyc | Bin 0 -> 754 bytes test/bytecode_2.5/test_import_as.pyc | Bin 0 -> 888 bytes test/bytecode_2.5/test_integers.pyc | Bin 0 -> 721 bytes test/bytecode_2.5/test_iterators.pyc | Bin 0 -> 216 bytes test/bytecode_2.5/test_lambda.pyc | Bin 0 -> 994 bytes test/bytecode_2.5/test_listComprehensions.pyc | Bin 0 -> 1158 bytes test/bytecode_2.5/test_loops.pyc | Bin 0 -> 742 bytes test/bytecode_2.5/test_loops2.pyc | Bin 0 -> 438 bytes test/bytecode_2.5/test_misc.pyc | Bin 0 -> 1001 bytes test/bytecode_2.5/test_nested_elif.pyc | Bin 0 -> 884 bytes test/bytecode_2.5/test_nested_scopes.pyc | Bin 0 -> 4012 bytes test/bytecode_2.5/test_prettyprint.pyc | Bin 0 -> 2586 bytes test/bytecode_2.5/test_print.pyc | Bin 0 -> 248 bytes test/bytecode_2.5/test_print_to.pyc | Bin 0 -> 617 bytes test/bytecode_2.5/test_single_stmt.pyc | Bin 0 -> 116 bytes test/bytecode_2.5/test_slices.pyc | Bin 0 -> 1033 bytes test/bytecode_2.5/test_tuple_params.pyc | Bin 0 -> 1171 bytes test/bytecode_2.5/test_tuples.pyc | Bin 0 -> 791 bytes test/bytecode_2.5/test_yield.pyc | Bin 0 -> 720 bytes test/ok_2.7/aifc.pyc_dis | 932 ------------------ test/ok_2.7/antigravity.pyc_dis | 3 - test/ok_2.7/anydbm.pyc_dis | 83 -- test/ok_2.7/asynchat.pyc_dis | 231 ----- test/ok_2.7/asyncore.pyc_dis | 560 ----------- test/ok_2.7/atexit.pyc_dis | 69 -- test/ok_2.7/audiodev.pyc_dis | 245 ----- test/test_pythonlib.py | 22 +- uncompyle6/walker.py | 10 +- 45 files changed, 28 insertions(+), 2136 deletions(-) create mode 100644 test/bytecode_2.5/test_applyEquiv.pyc create mode 100644 test/bytecode_2.5/test_augmentedAssign.pyc create mode 100644 test/bytecode_2.5/test_class.pyc create mode 100644 test/bytecode_2.5/test_del.pyc create mode 100644 test/bytecode_2.5/test_divide_future.pyc create mode 100644 test/bytecode_2.5/test_divide_no_future.pyc create mode 100644 test/bytecode_2.5/test_docstring.pyc create mode 100644 test/bytecode_2.5/test_empty.pyc create mode 100644 test/bytecode_2.5/test_exceptions.pyc create mode 100644 test/bytecode_2.5/test_exec.pyc create mode 100644 test/bytecode_2.5/test_expressions.pyc create mode 100644 test/bytecode_2.5/test_extendedImport.pyc create mode 100644 test/bytecode_2.5/test_extendedPrint.pyc create mode 100644 test/bytecode_2.5/test_functions.pyc create mode 100644 test/bytecode_2.5/test_global.pyc create mode 100644 test/bytecode_2.5/test_globals.pyc create mode 100644 test/bytecode_2.5/test_import.pyc create mode 100644 test/bytecode_2.5/test_import_as.pyc create mode 100644 test/bytecode_2.5/test_integers.pyc create mode 100644 test/bytecode_2.5/test_iterators.pyc create mode 100644 test/bytecode_2.5/test_lambda.pyc create mode 100644 test/bytecode_2.5/test_listComprehensions.pyc create mode 100644 test/bytecode_2.5/test_loops.pyc create mode 100644 test/bytecode_2.5/test_loops2.pyc create mode 100644 test/bytecode_2.5/test_misc.pyc create mode 100644 test/bytecode_2.5/test_nested_elif.pyc create mode 100644 test/bytecode_2.5/test_nested_scopes.pyc create mode 100644 test/bytecode_2.5/test_prettyprint.pyc create mode 100644 test/bytecode_2.5/test_print.pyc create mode 100644 test/bytecode_2.5/test_print_to.pyc create mode 100644 test/bytecode_2.5/test_single_stmt.pyc create mode 100644 test/bytecode_2.5/test_slices.pyc create mode 100644 test/bytecode_2.5/test_tuple_params.pyc create mode 100644 test/bytecode_2.5/test_tuples.pyc create mode 100644 test/bytecode_2.5/test_yield.pyc delete mode 100644 test/ok_2.7/aifc.pyc_dis delete mode 100644 test/ok_2.7/antigravity.pyc_dis delete mode 100644 test/ok_2.7/anydbm.pyc_dis delete mode 100644 test/ok_2.7/asynchat.pyc_dis delete mode 100644 test/ok_2.7/asyncore.pyc_dis delete mode 100644 test/ok_2.7/atexit.pyc_dis delete mode 100644 test/ok_2.7/audiodev.pyc_dis diff --git a/test/Makefile b/test/Makefile index 2f689b42..9930aa48 100644 --- a/test/Makefile +++ b/test/Makefile @@ -12,10 +12,17 @@ check: check-short check-2.7-ok #: Run quick tests check-short: $(PYTHON) test_pythonlib.py --base-2.7 --verify $(COMPILE) + $(PYTHON) test_pythonlib.py --bytecode-2.5 #: Run longer Python 2.7's lib files known to be okay check-2.7-ok: $(PYTHON) test_pythonlib.py --ok-2.7 --verify $(COMPILE) -clean: +clean: clean-py-dis clean-dis + +clean-dis: find . -name '*_dis' -exec rm -v '{}' ';' + +#: Clean temporary compile/decompile/verify direcotries in /tmp +clean-py-dis: + rm -fr /tmp/py-dis-* || true diff --git a/test/bytecode_2.5/test_applyEquiv.pyc b/test/bytecode_2.5/test_applyEquiv.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4e71ba1b8222b650908ab13d6438925db76dc730 GIT binary patch literal 844 zcma)4OG*Pl5PdaCG+zt~E?l}ATzCQz1to%@knG$@OefO#nP^Y^KwQP8dJ&iITzC>s z;R$?I6QU7B6RPIbuU~alzkJln&+l)W9gKe!em5v#i^>7_zyX065V*)dgl+_vgUiDe z;AY@v4Hw}`aAmj(M){n$Dq3-k2ifsLpt4H|b5ujX10$fZL#9@&!9CMyfzYSjvyhoH zG*7PEm&YL{f~hc1ly*aU*zWgFZ?`W7{%W;(G|y;N?0ZSPMD)TOW9ZdE0qxrWpeG56BUdELd4($a2H{M)yudBG$jH{A9))h zE`swnTO=jo;esa(axGS)wwBS(lE*2Q&y*>zWM1y`M<5ch<>*HC{4zD00&cv%6u&|h z>#&*>G!5y*Qyt5BlC37zIW$daDH{TMN%H3^o4QJUC}D{TQjm(2rAnz$>eO{vkVWx& zs#jXC4S40YCflZuyb>Dhc)Lc{kQQVeE6-OqhJJZnLC;=0OWfeJyKe7GYfCx)=RN`8 C0e!Uq literal 0 HcmV?d00001 diff --git a/test/bytecode_2.5/test_augmentedAssign.pyc b/test/bytecode_2.5/test_augmentedAssign.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a4456cab5bfb3337f3bb73203af43a23b6e7378d GIT binary patch literal 1323 zcmaJ>O>fgc5S_L2={9X?#Ycn$+Y_NxlLLoP6c80it%Ove7O7Gs6gl3FN@Msb~za8!`hm4k4QCrlaEqaO~`RHtugl~~&Q612}-I>Jo z!y{3ca&@F@az;(VTP1}@qC`HUw$(rb2t-#~cjZ&u-kIZOx5qR5=@Kr=8JxF9!2nzZLZ42Q94=m~xH3g>-6sIgsjOp5Ros%r-0o*Wp`_U)2 zY={b7zgs3=QWtxo!lCQ!WnzoEDv6Rjd{2AQ5?}mo>VfIc^4ybJ`swADY>SRXS~~>6hmZjN|71 zNJdJEgDeaDsF{rU-X725JoO}3GE+Qpm6B=12XV^h+1xehnd5vI2H7khUgD;T#{;g0 zk_+j@qhuUT8)bQ*WYcjLF!EjgeyoOZ#QS3<_qCt|PHGnuZjePcsa1pCPi zbE)(};29)!BVV2XAf?rX=O+7n5?q+zLY2U{Ng^Y0q9rfH8t;FKvkLM%qgdpje5GfX z;ZKT67A{s|4i*1h);imuD%)fa*c#Za>AHve1{JL;TW70m6V)}+9TxTu!)2|pYH<_z GL-rR4`}wQ@ literal 0 HcmV?d00001 diff --git a/test/bytecode_2.5/test_class.pyc b/test/bytecode_2.5/test_class.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c1043cf733f24ec871d808aa290a525b7b8cf780 GIT binary patch literal 1884 zcmcIk%Wl&^6dlKT8Wn+xgm_3;f<-n-)NO?jNf)rHkjsW_EY~w8mK;0sOcZ4ef5VbJ zU&22i@dcbSj*~(wnjn$L<2%>)+{d|h=IhTR@5}dZ<5+BdF5a*4=mi!j#1yL|WLLqkNu$ad6 za|T)Wu)ylgTcl9goa;N#jZcPQNYcZwkFDqvWtv#D%92V&y*{G;YCBCAni_kTCX6hc z{bILair7g}?7{|g@Yj$o3;?;0*Ctw@scurqqqz!0!|@Blc_Eh>wgE8#t#+QRbiJa0 zwX;r5^S0A-_p5~g$2ZV;Ydto%2Ml-!bsUcIfy`L~9_}JlT+mZs7q-Kee+XT`2+oiu zy4^VL^jv!cCjW6}$@S!)xqixQ59N9?yo}0GAT{WCIK%VV_*(trkw4KQ=zE^G` zRMHJI*}=Cbc(yZXDL%VSF%QKb*8*+>X1w1NGo3Sz)q&Nr`4#E~r21Ie3U{N$w%uMU zFRACXleTky1;OkLxd=m9#5mRvML>C5V-cttmw_ZTMm-f{O) JtLJ$5{{l(G=~}PC)^8N(X@w>6nN_3gQWd*8=%9 z9kchB^jGv3^iGx?0epPCdwh2kdH3&F{QmprO9A~ir1>+Aa7Um4t_UOe6@iZ7>o-Gl z0;g9o=m9N%(wy$Y7kbD%;oOBDZTWkB&<79UOpBf$fj)$DvfAoX&<{W#!)-zvANIlL z#7}zui1oKr?J;QLPZ&weaJdmN?U9zW17Ur_p}xO0Tq3P76NXvTdmGMp{R!N}=^mgj4!S-6`wFUpK0f zg>qw*xsgrlEG5CF4D=hp#taF=fB<=UrtI52&+UYhKv^qx(Q{?raFpNE<;=chPR|MK zh+xvWb-Owddri0?ayHAfFR~1|c;2Bxw&9zr4002f-WlEw_YjVHNq^Vl+YMOX-p#;YG|vEKPfo1hyVZp literal 0 HcmV?d00001 diff --git a/test/bytecode_2.5/test_divide_future.pyc b/test/bytecode_2.5/test_divide_future.pyc new file mode 100644 index 0000000000000000000000000000000000000000..cd927a2c6241c82b2de4f88464242ba8ac357d4d GIT binary patch literal 339 zcmdn|iI;2joqdkU3{b!fq#YC(7>X@`j1(YZWXNV<$YErNVq{=UVPbGk;bw66NMQvs zct8veAcGgg-~=-GKnyO1U=4nt=FI;+Tp$J;kip21!o(m7(oF literal 0 HcmV?d00001 diff --git a/test/bytecode_2.5/test_docstring.pyc b/test/bytecode_2.5/test_docstring.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c1fa3d3503c7283e973bc987677de81f9508f8f1 GIT binary patch literal 1518 zcmcIkO>fgc5FOh|r~^esd`KLSj0DIBgk*;kLWnO3PB}O|B)P0Y>{3f@Ty>WN5L@ZQ+LGK3Z?5oO1-yEC)zz47|X_wC{5Z(pA+rTGPTKE<#PVRDf9hmkId|{FfB`v*5(2ZDbwJjn-)o4^`;tv!VqTH~F>@#rVn^Nw5d%l_ zPEaxcHzwE!#+Y(dI%6J1n^~5u+CeyBD)U>BZea!@Y5J!s|DsiYUF!vltEw|aX@pKv7OxfY2A%@KLJLS0Arw|WM<tNh&orWs*njLLXxvJj@FqTc2vXN0$dVVO7Z!mY3u_I}rw_piQ99f>=E`i`F# zh#D$Tdl}9n5IZ#+jqc&GmWPE^= rX4@UVo`&BtGzPAy$k}ChZDI8`fCK{?QOpYzD@iRbiBHWfD5=yd Xs4V6HirD1lrH12F>tOTG~R literal 0 HcmV?d00001 diff --git a/test/bytecode_2.5/test_exceptions.pyc b/test/bytecode_2.5/test_exceptions.pyc new file mode 100644 index 0000000000000000000000000000000000000000..673557aa9ba4b0e49a101ce45ba92ad75ef3bd1c GIT binary patch literal 2777 zcmcIm+iuf95S?|>T%4q$P(V}y!c9sMMI=EWBwA5bNK}>bU>=J4Vuh}eT$-ecjg(03 z6Z`<*!6WZ{317hvz?rdQJE_yA7u@b-Z10Ze%sG4c`KMz3`2A~rm%=N9-#2L9cNmR- zMW2aw;287`jv}2A#~_^*CqsHpoGj^_ICG@);^asd#L1H`ic=tMic=(A62~N67NuxZ5C|<&3gzlL^wr9MBCj8DW#A# zZZP}<(mq1+gdjYk<(aU4e^_+}yUu~{awx9=vl3o4_*CP^zJh6s{TMvuSKd{A<#@gw zM(B0Drw2oyD>$gv`A5D%Dx*wk7f$&)e=$nA>g;%O_=TVGvmiVbu5z##aU_`Y|JpiO95wzu`+K$7NX~NlUcD2JJdwq*5 zd``5DM;MzxyO=~9F*kvB3Uh^!xfC_t2+@wX2{5)-Uo8uhZjrMX(<9S)5n#;~4jGFQ zG^UF39l9lmtfz}|iBuNsCd7(G4$Ga0b#m(6M98FAt1(s6&@!un*2=>>AD7MgON{k+ z;T|d1RAcIm`1}u`@8hdeKu-!fh3!kh-&mg&e+wN?C%rm_^b>SGn$?lcW9m~Szkoy@ zOkM%~Ox8uz(A?r`T!9%=!)Oxl4!~8H)ocyUp&UW@Okm0pfaQIM)FHNV2tR(TsGAQu z;9!DHKiuj$Ud!cK>!pLj8>(@ycuAIxezzuX*qpf0Kd*0dmtaO$u+gK9!0eqG+_!P{_t*+nu)CwQV_jNnGuEmP`$)n|z&j zAgjQJ*G!9d0*g-(78l0i$!~G}!+_m($FXgnV7+p4s P1^k(zHQ|-fiWT(_ypf|} literal 0 HcmV?d00001 diff --git a/test/bytecode_2.5/test_exec.pyc b/test/bytecode_2.5/test_exec.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9415ebcafda3d4f694316a4c0bc868a344f3ced6 GIT binary patch literal 193 zcmdn|iI;2joqdkU3{b!fq#b~`SQkj7Ffc?hFr)$*j0`NHKsuF?p_u`hnaTtb2nEUq zYcPSdu>pxh1zQC}BR>t0StT4GBDJ_AIX@+}gdNC9&&f|p%qcDbsm#ew1~N5(ECvKo o%md_tw8W=Yq$cYXR2GBGu*uC&Da}c>;{>w7wy-gAFmf{j0QdnS%>V!Z literal 0 HcmV?d00001 diff --git a/test/bytecode_2.5/test_expressions.pyc b/test/bytecode_2.5/test_expressions.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e13879b93f5eecc4e2b17910405ed4369ae339d9 GIT binary patch literal 341 zcmdn|iI;2joqdkU3{b!bq#b~`m={Q-Ffg<*Fhl_vj10jVOhA!jkUR*p0I@R=7rOw7 z5(b7Eup-H3Mi_^Q0mMmRX0Q{7O0z&jSP>#@5D|8uNU#P6&>+7|Ai_ixa*Sum5pjw;U{FKt1R6DR)Afo^^ CWH&(o literal 0 HcmV?d00001 diff --git a/test/bytecode_2.5/test_extendedImport.pyc b/test/bytecode_2.5/test_extendedImport.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4734a333cb09e430744f1e08b1d4553a782fc800 GIT binary patch literal 540 zcmYLGyH3L}6g^JgCFu*P6C)CtI&@+{2oO@~P>@mim}%zWYZletWFXTDNpa-Ag7U&P|nJVMn74w-E=*nw5I8nD?P%pYKmeFarq<5UT{l zDy}Rp0ck5PNy#rQ(Ezd-5Ja&kkXw>kToRvJQIeXMlA01wl$lqeS5R5Z0hF=H%}*)K SNwwnyvcUp8OuUSeKnMUIF)q&l literal 0 HcmV?d00001 diff --git a/test/bytecode_2.5/test_functions.pyc b/test/bytecode_2.5/test_functions.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d0711142111be36dc06edb01c51cca9dbfc15b73 GIT binary patch literal 2438 zcmdT`O>fgc5FOib66d3#E#+HCNC@SCs-z8w145u4iiA|8?JYuz9B&E{p{Z&|EmCsJ z58=*{JHLcq!7pIm*iPKYCMn8=SUa8_ujjpanqB9|?`rA$ub*!`ihdT~U-R(4vC%|R zqBc8*I0k7`9Fw#qjzu~rPL8xKj!imGxMFMVu1p zsyJoR8{$+**Tkuk-X^_CQ-j(Yq_^m}ev?Vgs2e;v;Nj;&>c@3Nj_Pb^!T6gT3wnOg zIT@XLL4SDa@1A`POpabQ9JW4OGCX96M`ms;2mtDye{9Z?{sz*l@bVZ0SQyBY34#SG ziL|#G(q4^UjFH%#m2-%Anp8;;e<_H?X)gEOEo6&CV|Rw~4)IKsJU{(>!LqH2)7?S7 z1Wv5m`z##M&E}`7z-GmAygPH4KJ@4#jfYxM3nH2FVL^bEC&QuKyY6{-AGiucR^!le z@AKNY)Fg7Iq(D|Bm@*7n>>5S4x)1q;u(G?7BxU=wm}Dx5?LyGQtXV)ati z*am5=@(6lrd9$4ZK^86y8OSL2ubN3Ep9Agl&?iNr9w8#`zSzkz!HrwUd9=x=Ox} zJtU3(zf|!2#nlRq>d;*dYbmCVkDuZ}3J;W=kg^3uV0`IS6=nlQ7H`A54TEohx(kC- mNZ~lH^GKNVFT9W3FTV`+XwZ8le5gg5S^7>xnAm?3OyB;5Qr$)x|dQ~a!5|0NICT)*4lNfR@Msb2xCZ2?Z4?U z_xzIniS`$CW|i0}6e5_nU+=w{oz?B1nf&?d?o$c(pP=z0g-;0#z!yRRT7Zc_M_@+q zgEmKCNAMj$pnx-s;OyLtAy1yM@Hc@(>#?}1-BQ24N7^ruKa_5X07f}xs}4TRmPTX)9&hfC*N0S7g8R!iLce?9j;xYmOHfb z(wPTYRohPH)~YpP`z}ql+wJ1Y*`=+C)%d=~g|X@0D-8u2w{2>tjna*gT=A;!sFF@q z4XrjBE7!=1`&LZ|LMM5}aZ2Ie5Ks@PZ#MwfF!T+mZ`8YUYH^-K#JC7To^j+9{+M7d zr2gNCNAha{uXT8$JQ)#j&~wtg{?(wTtQZpS`5|9*M8^pWs1PdtF#VR$8Upy2eE!d4 z26oB&e#|@(N7Y*z5Bjg+LK$ZX$T0uiF1QlQ#Kmc1Uyva)w2BsBONrQVnL3SZ!yOQLa; znLFp)nLGDav2c4nIx~C^@!e+V8dCsV0gnaYOb9G^1O;3GQiNVVNMYor*=h2UwHRH7 zt}q?J9wv^LPv4RM9J%5etiC(cwk@or;U2BvW+4MWNOT8#QvrE~0SuA^WVs+MV#MLuI& HHf8Az#XB)$ literal 0 HcmV?d00001 diff --git a/test/bytecode_2.5/test_import.pyc b/test/bytecode_2.5/test_import.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ed2d9003d456c8f3acb5c04c060ea8b384120ed6 GIT binary patch literal 754 zcmY*W&59F25U!d0ZF-Y+5%J`q4}w8R0(+80L`B%WtSm`jVNk+kx{?g(nI5}qHqP0L zPvXU+cb~+E5MMy6CyA>K{ngj?`%TTaUw!fQ$M;tW?9VaVmweq91_cl?2B1RN1Q0RV z@erc$!2k6(AZi@^O^8}GZ@{Jvx&u)M0$<;R&C&j?yAX9j3y8!n)`Cq4vyV>zkKq$Q z+VlA4{X=-iBl{4Y0QRAOfhTZr`QbC%u(0W%?e+d-5QL8AX;v6ZqoR_-p>(FS2}&Q3 zMNEV?mrG;iE=f9y2{X*e2{Buz?vT%{h%HI8l(a^vFfmzC>3t(tri3FQ?%bRo%j=5P zCYOtfaF`f%C`&b3F-4SXqT+l!-fp*}mB9sS&dOb>X{2!cx7WDVr_46jCRQ@emGFX> zrDY{7Jm*&yQ)+UN{^s*`5b&o{hv5pHi&r>kFrV-R@~iQk71BMX$=Vo)^MxsM729f8 z>C2xEe7J5hpDUBh=j5BX%2CMHI67hTI(B$Dn_W-Q-lC-kzJwP$s@Hy%W_V+HF_xP9 zKt0|rlV@jVJ2_nrWSmFFXgBeLC%%0>ccslD){a{2;4YaXAK%n?J75ZT;Jljuf3`bf f*YnJ%QsWCh$K7XWhrQr&*b7gCM}Y`Wp%?rCZ-2aB literal 0 HcmV?d00001 diff --git a/test/bytecode_2.5/test_import_as.pyc b/test/bytecode_2.5/test_import_as.pyc new file mode 100644 index 0000000000000000000000000000000000000000..db35409e3bdbc1a06d7d60036599b3277b222827 GIT binary patch literal 888 zcmZ8fO>fgc5FI;h+PW=GOIwiOum_~(Kpd$jgb;!XlwJZ=9jU?sS<Ptk_<&J8AH_ zH~tFZ#GPNlui(l7X16s(Sn`{%w@+`!{`Pa*`|{)a%LHy7kK+q|^;d=zAY^nPbz$y6 z=r(x^!j&fH{%VuAAzW+nb;vd#^laIJ`6lFB5N?BG+0K!AS0~p{vz(crlU~u~JGhDF0pu1*l|6=e6HAPub zNkvht{i+tdp3rik5)@`8s+b5>DJD{hqidq@eGzMMq$wsWuq5qyqgke#bDUMNA|WS& zW++ljWKq@mji6p+gudt9wwWJ`vzlhI6yut(m&mj^mgT6t08z|{s;B+_a=G-U633V` ztJI5}{1p3twffd)Dwkz0<5a|D>KWscg<>a4WF=QcOqndb>^DDex(;uF%sz&wbv(sx zi}Q1Sf!Yj4IYrvxG?_`MF&fK7nZ~NthS=-%cne{Yk?h7#Ry z%oWrmd2)PweI?^+7z}8GW5GOa;I#k% literal 0 HcmV?d00001 diff --git a/test/bytecode_2.5/test_integers.pyc b/test/bytecode_2.5/test_integers.pyc new file mode 100644 index 0000000000000000000000000000000000000000..882fcdd1463130ed099fcd28b46049022e1d6f13 GIT binary patch literal 721 zcmZuvO^?$s5FMv&wrf6?V~;*Th1B+r5Q0;CLP+J*OO(db)>_Ao?1@TlNcTNs#~;a;pO56{AK%_oa2^AWulbE%88pC#QGm|iR=|eI05%!u zVUMgZA02*58L;y&_NQH5Pdkk^jbZRzJ(YK*Ol}f59i7+^|^Fdu~QocW!c(E~S z%0SBR6dh1$tbE;c_B=nfhHx&|&NK~@qVg8GS@5-LIy!i#tl7qAv0tpHY#Gxgq`d3G z?MwCU4S{){;5+9j{b+wNV+AtkX|iN6z2ZO#ibDIUC@B3Z zv5VBVpq#V1{J=MOqQ)gUWYv1N?@7QWOj&?Ch)+2E{|m)2i!W=hTZ^wG^Z1k@&mInP XaeA)BV=)#ZagzyFZiM7F#a#RW0Ft?Q literal 0 HcmV?d00001 diff --git a/test/bytecode_2.5/test_iterators.pyc b/test/bytecode_2.5/test_iterators.pyc new file mode 100644 index 0000000000000000000000000000000000000000..86b2b52c54ff25135a419a71748859d5441b891f GIT binary patch literal 216 zcmdn|iI;2joqdkU3{b!dq#b~`7(`S^Fr+dtq%bfvGcvfuaxp|PGNdvxxEJy=gnLxT zg5?;|Q2reK|%nl?%GEx;>^HTgYn1GxTkab0gdFiPo zj6hbV29RJt5XFK(Zb@o!NqlBWYEfcIeo?VrL1i%qP}C+jKczG$)edAzF&~iNWng3E KU}9tf)64+sFC>@% literal 0 HcmV?d00001 diff --git a/test/bytecode_2.5/test_lambda.pyc b/test/bytecode_2.5/test_lambda.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ab80c35b00e88df291fc3af1580f0704b0d3457c GIT binary patch literal 994 zcmcIi%T5A85bT-Zt*F6+egYSXA3%)8yNC5=Ow7Uzr~xI+crcNZ{*6cPeu-b<7g#mR zy7-7(WZAB*sWe^Pz5DXsY&^fc9`$8@mGC@7_-lX@u_8|(O01Gc+*;0b)OFPLf?~cX zw!|ZnZ8;~EoK#7imO-p$YjWDI!>+FY41+jE_$J^XzXt|+5F`U820~hheuJX(;bN4I zdp7M%?n4byH#;8C#Utd3KGCm))2H7a4)8lSGE*|sGBXmO#L-DGu96)x6WP3<*b0mE zFQ;u53>whckL^t(4kPydY&Bt>2Ez02rq~DdxDVDwf8W=TP+wkp4OwyepM!5_g%=0M z)Qdi}NH}9OOUh&wz;au@#1&1%*Ii7+HT~17Hdj@6D=&P~<}w3eoK6DwIZbbdE>yuL k>BxoPirq%`%h&B|$nK7B?cK;_U-vqMUDZ-8U03{l0Q$dzbpQYW literal 0 HcmV?d00001 diff --git a/test/bytecode_2.5/test_listComprehensions.pyc b/test/bytecode_2.5/test_listComprehensions.pyc new file mode 100644 index 0000000000000000000000000000000000000000..afd1c511313e2b4af09ee67e2d8d6d4f3d79ebc7 GIT binary patch literal 1158 zcmah{%T5$g5Ixo1^Pb@;kg!5y%s>bU-~)p(8ZfY8fg9}3!~lJ1o4^cBH;E+RM&pK0 zab?___#L`+%fc`4)Sc;>i5n-W>Z&`ZPMx}Szx`=czx?|C@({h>EWa;k>6QZ+AOt=N zd_e?wz5^rJY&GD!Fic!bBr^ycY;A8_fQPWr2Y6k;8Un8mD0CSnEdvu5q2S0N&l?1V zKCC$Cz1bSKU>*_d;Lb$y89}iREe%8OTPS6FD%+NpVF;n#vX=fp@)bde)mCq1xcHte zW|IPr9dt$^hX3bHZz0Jof=XUm9WGtWOC3!2%BNUP3>#a9Njv1cNHQ-$H7BVJlk5yg zwEsE@29qqo=Oj7X^vsY*lH}vvkpD)KHa~3%YHSl0;nxw4z;ASSI094W&CJ0ch0$ek z7h^CyWsDW!2 zS3K5NIEAE!55i{3u+yYNQ;95dYLZNox508ND>6tg4)jd1@4Hw=NcHt+Ce7ZS#A&wC zIXyc!?@T+5JMDDo>@riiM<@GPX4-cZu7f~g)fy{nTvk`1+p)d>9akkZ?cmyYa1YH1 zrkT>5@3$jkCGYL+?JB?3828k#w0gm69z4v0M=gsy?g1X>=TGurts8LcWs703(gQzj z?b@qSRhPS}V{j)n`p?CrI`^~FPIz%*p6mGO0$tsi6A`rsv<2D>qjh=3Z$rjp)hSBR IS#c`vU-QMcl>h($ literal 0 HcmV?d00001 diff --git a/test/bytecode_2.5/test_loops.pyc b/test/bytecode_2.5/test_loops.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e1a10313063ed161a0454a94577cb7c0e9c8dadf GIT binary patch literal 742 zcmZ`%L2KJE82#kbP9yNChh0X|spOKRy|rbGjdr9k7=;!Jfni+hOQYgQjwO@i+*|+3 zj=S%d40`B4*e}>8&rUPC8T6#@>3vVnLf?PI{M*kTA2Vpah~^J8>{|vP0VV*eGe8EC z!2^TyuZJ)R00WQ#+y`K~z!rO;88FXvYAytJ*)U_;ypcOFzPMN&ZQJa>wwbgxKB?cHyeO>u>3q zfIGA<$&D%Ouvm-1Kv+|i84AyfB6SW+EvBXvwTAQSnX;{hRz+GmVWz^(P)N+oyjbT= zv#pfFA?GhN=~HpJb~B^J?b_iWGqP<{IhOniQOukxPDi8Vayh&+c#Aoyw5@VClsMXW zjp|I&EOl;DDN-%D4>_$$N>U1?shX!w8O;@^|5P0hA%WW=_>@~zG=rj-0$=)m*L4Y! zM4Bu~oL82qzC-5)s!sqfU}Gx(x;g7_^xfRZD#!OdTHAAiD2O3qG3(L@*=`UrwqdC1 RM63fb;~PbS5T3NQwF?!m-o{%zGy#tyqNq?o+CnRpf`l}?Z31aF?oNn#CXe2I5}!hR z04JrjxG>+&-#5&BAKyLk{`Gki!S)^Sf6Zn+1_>|+csm8kJnaseYv8j+Ug# zh>21d6Xh4aUzVk}(rTen?#gVDk|&k_H_PAbD0P{oI+Pe@Qq)T?3&WcjOfrtvAtgE! zL$}G7Q->i4q>h4sYAr*vvKxmlUb~!tJ=h}-|4U^LId!?#vPjicmwkK8&~A00?KD~M Irqg2k1^z5}TmS$7 literal 0 HcmV?d00001 diff --git a/test/bytecode_2.5/test_misc.pyc b/test/bytecode_2.5/test_misc.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8c927995378368277f7db62322f895f4bba65064 GIT binary patch literal 1001 zcmah{&2G~`5dPLqoup}KOF=Xoz$fZM#ep+IgdkGXDj=s25rkH5c1bNIj_ci^BK1Uh z8;;z00G@%T;0c&nr;S95usokrfuP z0_VWHAutAp0;fCB9+Z!Bf#)Au82ZoxX$2b4&Pxa4WEX?e_fQ+e={t^(uBxG{R~D?L zMlMz1blcbYR2{dwl=zZ$zq@zx8UwY7VHLUx)j(@jhfr(i?qvZfO;Xei^rM?RQ;Xp6 zI5lBj%*I7B4M$0~W5XjI7W2#sI$bV;t!Er`mw*PMd1)QAf+3A8oZ=(yM;;xI7%rs4 zK}~`)fipn5HTEOU*K=rnQnUHgh1v?!_2gsBgovaBvqqZL#>#1GMi2APwnh#q(=4@8 za(crBAx0d>!scadOXY!7@GdWEGr`q1wkWG{Sj_JK*DZ8jNV!hjMcs%SUo@2^Q!S-k zC6AQTnVL_?jCss>gGFa8J0gYk-YQkc;5mpUQV_4x0s!)S^sgn4ob93y_(cUzC~&Vt^Hz_-TMOfdu^W z^HRZri5fs21A-_P1}RT1E{V?r5~(TisX3WxdIgom96)iK-29Z%oK!nbAiKB(NU$;S pGIBBkF`QB1*B4e0!kiA9yUCn2+6X&YcO%rD7#ke zs(ES!>2KkYcO?D?zk)vi-*;xOsc#QpduPth&YYR^edn_N{qMELZ-4#qRZrqi8U2^I z!avdY_!&7C85%hRsN<**m0x)6CLR<}SU5jwEz zxF)#{xvq+4AE+Jbb_ZLy6}vO1o!EO0hBwhfI7z#3oI7U|oE>;KuW=GZF_{*R14}D8 zZqnSaqDodvsg*p6TKO6TSP3$(n81t4@WKH2ULN9WyJUsxJRunuIWRcQgAlbtttbU<4t9Re!!K`%ycGf0J9zpb+bPU2G=O5pFhm*KQj9YR{ z>bYf%@Cxsv`4vASedHq}zo-lE!{(QW+OoXVkoA#5n6;|1cL{newN!i1OQM#&y5w~T z^Z`!1oa+aen2YJL`btE<=+jX$Q|GWr8z!yJZFC8092(FaG_!;&kjAY}>U_Ahn|gHC z9K5Tz)jbz%2W9VLYRLIwHcQ4h_%^0syNwCJwhtf+z*yZg>owr=H6um@Y()t8#;>6{e87RZl5jN0_TT{-zfd`h`bgwzIa+`7M<3yvF zb%(6RoboBJT|WO1O-uy~RFWDHDHY(%C7?}r9`@u9iF}^(DO3&w5kpxrfBw6-Wh1@PjsE#dzG^v}kx}Tv7>s)2lk(L&6 zs@u_L=e(mRz{^+#Velm!DYDc59VbG@b z`x>&`tt>Z@cNAel&1)A|$ZUsKSDOj|HRyc~gz;jO#WVp;E>*}Hgt=hj=Mpjn?(%OH z1W!#p?VJSJ!`b*nb*y+W?3{G{&ch?fAud}%6{-GU7zO7M|J4i!_}9~kqVqv_6b1Ts zO1BDwVc)xj2@2n%rFJD7{lTgKJ$lPrDXc+`-`NkeglFEl#r-3i-fs6t(dayAw>{k1 zyyX#5kG|y58jtfluJHJB=-psLmTU!ikJ1NdvV*EL8zU_p4^AHYqhaunt`&ZSW~1bk Y+^T*Z*L7F%b=}%()veS7Uz4`xUoVwh2LJ#7 literal 0 HcmV?d00001 diff --git a/test/bytecode_2.5/test_prettyprint.pyc b/test/bytecode_2.5/test_prettyprint.pyc new file mode 100644 index 0000000000000000000000000000000000000000..551dcfe6925d410788a6d8babe01fb1a95b66cbf GIT binary patch literal 2586 zcmcIlJ#XVi5FJvoY|@rL@6PuXfTe)MRxG3ngu`9Zq%sUTl^TWOt}Nnck|0+wRJgkI zY4R^prVNlDkvhL3e;|2pDOtAR5 zf&OjjyK4KPXw8p#?JT@@@z-mj_5?|&eNhK;(Ud_;)Duxpt@4?uLn_sCQ7`Q7`W^c* z>^JV)Ls{E%*Aw+pegr?hXh#x9bVEKk;(Rw>tu0rZqF#x5Eg!@IgCDboMQiDc)w*4Q zob%3SEX*Ma;~QO>VNq&hW<{A~=D3&zM@L?jPs>;b+zpDz7+q$;I4`M4vWvh>ba2bb z_dIVr&Eh1_qBJqHARh-x$N6P3OSSKRKS`=!9uZOzm4+4!a${BhRW(hFKKA{k8un3e zHZzkv3q~`ekK$Y{+>%t6{<+q{#F*miZujcy>i8npBb~x3tEQd8j6!)W!Vc8FJhtV8cHDUtHt|L|D-5F=aG zUT^hN#O8Bk^_YL4{UhSr-r0f=$F~^OZvfk^9CS1^!Y10Li-y^+dl zp1Y6_*vzicH3fa<3GzP;*MK44U;9Ob{0c%|58(#EBlrY-E)up0+k_p$E@6+bPdFej zYWNgj31f5;c8*c~4EPj;k*&s(tvOX7<2F?X3wm%p+@^#~Fx^kcM8}ePm%Cbbm%9$j zU`X_7p6L*?bV#68sU$Xrt2C+1$&J)Aq}NP~RG%!xUI$9CP_ZfxTqM?*_rkkxet<>w z6+oP(l+H{-k~>=f!`FN`RCzocT7$w~vi2C3UsC>M zeYAf)5HD-P(w^CC`i$4KE|*9A&l*%4aO_{^YMSad{K~2n&~mrjmRnZ>HE7!A`?442ILL+aLmoNAP9ZE^F@yO>krfgfvdOR9)lIh%TubS5u#fBX@Wao&t$8 zIAt)nAh6^wcJ#+_oQIcVdH?))k&B&0yq>eWCx#MY$qa-F#a$qlfxtlMP(-RH!plfS z9s3;z9f!>MUqr!&=s()uZ~a+t&K)l%2mT?i3|ZCMP)atgT9{73*{04B2pvI{5n*j$ zZEF~JI+)EMj^i;n$_O`T$VquqX!m)JqbjQj>>8**P?+0I)t0-0uF-_Cl>2SgXK>w8 zVGXQW!f9^R=P_MkEf_i>G*vcFQ}P?Gbu{oRDcjJ5Be91& h;nWW;{WeeMr+l`tswr`H$Z@9{1V`a090fym&v#jplHC9R literal 0 HcmV?d00001 diff --git a/test/bytecode_2.5/test_single_stmt.pyc b/test/bytecode_2.5/test_single_stmt.pyc new file mode 100644 index 0000000000000000000000000000000000000000..275b337ca7e6c865e87b0515df7cab95dbadf42a GIT binary patch literal 116 zcmdn|iI;2joqdkU3{b!bq#b~`m=j2(Ffh1#q%blBYcK(MnXEv=?hZpBTIJU8KgIBnhvDKHxgMdv_oI zki5er;~A%qfD1i`E9!jMeUS!!L<5%*LmY+D6c~EdN}Zpp;1<3>l@hATV?=M&#CcVN zq`aA#a0eo<%6(LBqT&pd#=_03Rk=PL7A9g(4y~ywj4I~ekf^+yt7;Wz&Z^Rk!%5&$ zqoT}1k|5=Vh3IqjrN)j|5zh;!@2Z#*y&NK{S&Y@ket)@K_NETUSQ5&HMHzb<`}bUZ z?m@eyEnTivZnaEJO%|Sndu1%`=6N*E%5Y56;VvuhraqsmBDW_|jZyi9H8eFaXK8?v zai|71EYX`RC13~O+N4Zqk{PJd#h!VYQgpc?w#f{m&+QaLy81UX6qT2y>85Ntax?RY z=9Ik9Av3U!6>_-Spa?@5z%u?T#`Q-d?TXPTwumhK<~c@E4cE?MQUMzi_ScZj6=Btv sbEg+2e&Rka2-C`1*{+bHy|zz9{T_;g?5*gEH(67(#ZI;-Izlq$FQgCKtpET3 literal 0 HcmV?d00001 diff --git a/test/bytecode_2.5/test_tuple_params.pyc b/test/bytecode_2.5/test_tuple_params.pyc new file mode 100644 index 0000000000000000000000000000000000000000..89c2ae749a61b0a58f36ceb1d0cc4a9da1b4f7cc GIT binary patch literal 1171 zcmbVLU2oGc6uoKMZuL4OJ|tfK7$LPqJR*b`gVzaVJWWVZ8ha#C8b`6CE@*w*zu}R0 zehI&VU%)+X*Fpu-SSz1i+sF4FAK!lac`UyE_7m~WNsWBaCnbC^Aaz9N(J?ah10vzHb%|^1QYUrVqzgN(J2{z1YuYB$ z65Fy)ozqPvFHM87NK0N~uI5!M&82i*%~T{2;$vRe+tVB|(RoU)rP7&M)LpqrYum!< zsSvwm=BM&Q=WX)vN=-Bjt>HrLFn zRc2Y0CRH-6l<@M~#^t(^MddHz3R8&;-X8D>d7Q$T#|+m!`V`WtPpbi~*ji%S*f2Va z7$^eYVV-)NyB^2W7k-j?yzf~WV~ld~05D{@tJJp-n7oymA?I56?kx zszPj^Etk99Zt>ZfwQ0y@L)YL!o8@t>Wo$~joo!s9RbjQ{E;pU0PQ0ouscnI^v$7Vn z(>h_Ki~-{w<0;{77N;3m^c;Q4h`;-9Io=_T2zjnundiuT6_M-6 zuXswC%Mgs`b9&{y^BHB}7J(gi??~WFeX(`AYs`x=#o?SVOon18CSposN@FSpLW(iH G=i)C9Uzef) literal 0 HcmV?d00001 diff --git a/test/bytecode_2.5/test_yield.pyc b/test/bytecode_2.5/test_yield.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c649bf323c4f0dc0b7011108237e3104f211ba8f GIT binary patch literal 720 zcmaKpu};G<5QhIt($W?xIv`*GiGd*#yZ}NVA%Pe=6hWm*C@PI979oY$6+wat-iDE# zC*di00k}H~42UN2@3VcezyJL5-fTR-z3vV$c`DrRaC5gTDSw1ZAS3h$lm>VLdI8c< zgAnC1Oo%kXBVq5ffnEd?VgF_m-2+*u$U?6IQ-Q7G5!jy|9i&wp#WQ@i{op4ij(me< zXmV5Z{itvQnG3iHs&KnwmV01y2r5_LbztcWX%-KJd%_9bETPL;HsH8i`%Vl0q-~>{ zi&rp+9Mz5^R${HRh1^_=1vEn~RH;ri?SGs~hB{s6pj@4>Ysu#){`j62*kco21s8}mTji4#ML>&w zJ~Y30x#HPrcwT@fl{bmay_@9;S7iY;nbgX@R`A+-X?j&jaz6Is!X!yY64hfz?yys5 t@siDZY7ui&`d@&5isWki$JW&-9cN}++_*)SR#30iBY~(9(Hu4O{RB(yb^HJT literal 0 HcmV?d00001 diff --git a/test/ok_2.7/aifc.pyc_dis b/test/ok_2.7/aifc.pyc_dis deleted file mode 100644 index 76ef3d97..00000000 --- a/test/ok_2.7/aifc.pyc_dis +++ /dev/null @@ -1,932 +0,0 @@ -# Embedded file name: /src/external-vcs/github/rocky/uncompyle6/test/ok_2.7/aifc.py -"""Stuff to parse AIFF-C and AIFF files. - -Unless explicitly stated otherwise, the description below is true -both for AIFF-C files and AIFF files. - -An AIFF-C file has the following structure. - - +-----------------+ - | FORM | - +-----------------+ - | | - +----+------------+ - | | AIFC | - | +------------+ - | | | - | | . | - | | . | - | | . | - +----+------------+ - -An AIFF file has the string "AIFF" instead of "AIFC". - -A chunk consists of an identifier (4 bytes) followed by a size (4 bytes, -big endian order), followed by the data. The size field does not include -the size of the 8 byte header. - -The following chunk types are recognized. - - FVER - (AIFF-C only). - MARK - <# of markers> (2 bytes) - list of markers: - (2 bytes, must be > 0) - (4 bytes) - ("pstring") - COMM - <# of channels> (2 bytes) - <# of sound frames> (4 bytes) - (2 bytes) - (10 bytes, IEEE 80-bit extended - floating point) - in AIFF-C files only: - (4 bytes) - ("pstring") - SSND - (4 bytes, not used by this program) - (4 bytes, not used by this program) - - -A pstring consists of 1 byte length, a string of characters, and 0 or 1 -byte pad to make the total length even. - -Usage. - -Reading AIFF files: - f = aifc.open(file, 'r') -where file is either the name of a file or an open file pointer. -The open file pointer must have methods read(), seek(), and close(). -In some types of audio files, if the setpos() method is not used, -the seek() method is not necessary. - -This returns an instance of a class with the following public methods: - getnchannels() -- returns number of audio channels (1 for - mono, 2 for stereo) - getsampwidth() -- returns sample width in bytes - getframerate() -- returns sampling frequency - getnframes() -- returns number of audio frames - getcomptype() -- returns compression type ('NONE' for AIFF files) - getcompname() -- returns human-readable version of - compression type ('not compressed' for AIFF files) - getparams() -- returns a tuple consisting of all of the - above in the above order - getmarkers() -- get the list of marks in the audio file or None - if there are no marks - getmark(id) -- get mark with the specified id (raises an error - if the mark does not exist) - readframes(n) -- returns at most n frames of audio - rewind() -- rewind to the beginning of the audio stream - setpos(pos) -- seek to the specified position - tell() -- return the current position - close() -- close the instance (make it unusable) -The position returned by tell(), the position given to setpos() and -the position of marks are all compatible and have nothing to do with -the actual position in the file. -The close() method is called automatically when the class instance -is destroyed. - -Writing AIFF files: - f = aifc.open(file, 'w') -where file is either the name of a file or an open file pointer. -The open file pointer must have methods write(), tell(), seek(), and -close(). - -This returns an instance of a class with the following public methods: - aiff() -- create an AIFF file (AIFF-C default) - aifc() -- create an AIFF-C file - setnchannels(n) -- set the number of channels - setsampwidth(n) -- set the sample width - setframerate(n) -- set the frame rate - setnframes(n) -- set the number of frames - setcomptype(type, name) - -- set the compression type and the - human-readable compression type - setparams(tuple) - -- set all parameters at once - setmark(id, pos, name) - -- add specified mark to the list of marks - tell() -- return current position in output file (useful - in combination with setmark()) - writeframesraw(data) - -- write audio frames without pathing up the - file header - writeframes(data) - -- write audio frames and patch up the file header - close() -- patch up the file header and close the - output file -You should set the parameters before the first writeframesraw or -writeframes. The total number of frames does not need to be set, -but when it is set to the correct value, the header does not have to -be patched up. -It is best to first set all parameters, perhaps possibly the -compression type, and then write audio frames using writeframesraw. -When all frames have been written, either call writeframes('') or -close() to patch up the sizes in the header. -Marks can be added anytime. If there are any marks, you must call -close() after all frames have been written. -The close() method is called automatically when the class instance -is destroyed. - -When a file is opened with the extension '.aiff', an AIFF file is -written, otherwise an AIFF-C file is written. This default can be -changed by calling aiff() or aifc() before the first writeframes or -writeframesraw. -""" -import struct -import __builtin__ -__all__ = ['Error', 'open', 'openfp'] - -class Error(Exception): - pass - - -_AIFC_version = 2726318400L - -def _read_long(file): - try: - return struct.unpack('>l', file.read(4))[0] - except struct.error: - raise EOFError - - -def _read_ulong(file): - try: - return struct.unpack('>L', file.read(4))[0] - except struct.error: - raise EOFError - - -def _read_short(file): - try: - return struct.unpack('>h', file.read(2))[0] - except struct.error: - raise EOFError - - -def _read_ushort(file): - try: - return struct.unpack('>H', file.read(2))[0] - except struct.error: - raise EOFError - - -def _read_string(file): - length = ord(file.read(1)) - if length == 0: - data = '' - else: - data = file.read(length) - if length & 1 == 0: - dummy = file.read(1) - return data - - -_HUGE_VAL = 1.79769313486231e+308 - -def _read_float(f): - expon = _read_short(f) - sign = 1 - if expon < 0: - sign = -1 - expon = expon + 32768 - himant = _read_ulong(f) - lomant = _read_ulong(f) - if expon == himant == lomant == 0: - f = 0.0 - elif expon == 32767: - f = _HUGE_VAL - else: - expon = expon - 16383 - f = (himant * 4294967296L + lomant) * pow(2.0, expon - 63) - return sign * f - - -def _write_short(f, x): - f.write(struct.pack('>h', x)) - - -def _write_ushort(f, x): - f.write(struct.pack('>H', x)) - - -def _write_long(f, x): - f.write(struct.pack('>l', x)) - - -def _write_ulong(f, x): - f.write(struct.pack('>L', x)) - - -def _write_string(f, s): - if len(s) > 255: - raise ValueError('string exceeds maximum pstring length') - f.write(struct.pack('B', len(s))) - f.write(s) - if len(s) & 1 == 0: - f.write(chr(0)) - - -def _write_float(f, x): - import math - if x < 0: - sign = 32768 - x = x * -1 - else: - sign = 0 - if x == 0: - expon = 0 - himant = 0 - lomant = 0 - else: - fmant, expon = math.frexp(x) - if expon > 16384 or fmant >= 1 or fmant != fmant: - expon = sign | 32767 - himant = 0 - lomant = 0 - else: - expon = expon + 16382 - if expon < 0: - fmant = math.ldexp(fmant, expon) - expon = 0 - expon = expon | sign - fmant = math.ldexp(fmant, 32) - fsmant = math.floor(fmant) - himant = long(fsmant) - fmant = math.ldexp(fmant - fsmant, 32) - fsmant = math.floor(fmant) - lomant = long(fsmant) - _write_ushort(f, expon) - _write_ulong(f, himant) - _write_ulong(f, lomant) - - -from chunk import Chunk - -class Aifc_read(): - - def initfp(self, file): - self._version = 0 - self._decomp = None - self._convert = None - self._markers = [] - self._soundpos = 0 - self._file = file - chunk = Chunk(file) - if chunk.getname() != 'FORM': - raise Error, 'file does not start with FORM id' - formdata = chunk.read(4) - if formdata == 'AIFF': - self._aifc = 0 - elif formdata == 'AIFC': - self._aifc = 1 - else: - raise Error, 'not an AIFF or AIFF-C file' - self._comm_chunk_read = 0 - while 1: - self._ssnd_seek_needed = 1 - try: - chunk = Chunk(self._file) - except EOFError: - break - - chunkname = chunk.getname() - if chunkname == 'COMM': - self._read_comm_chunk(chunk) - self._comm_chunk_read = 1 - elif chunkname == 'SSND': - self._ssnd_chunk = chunk - dummy = chunk.read(8) - self._ssnd_seek_needed = 0 - elif chunkname == 'FVER': - self._version = _read_ulong(chunk) - elif chunkname == 'MARK': - self._readmark(chunk) - chunk.skip() - - if not self._comm_chunk_read or not self._ssnd_chunk: - raise Error, 'COMM chunk and/or SSND chunk missing' - if self._aifc and self._decomp: - import cl - params = [cl.ORIGINAL_FORMAT, - 0, - cl.BITS_PER_COMPONENT, - self._sampwidth * 8, - cl.FRAME_RATE, - self._framerate] - if self._nchannels == 1: - params[1] = cl.MONO - elif self._nchannels == 2: - params[1] = cl.STEREO_INTERLEAVED - else: - raise Error, 'cannot compress more than 2 channels' - self._decomp.SetParams(params) - return - - def __init__(self, f): - if type(f) == type(''): - f = __builtin__.open(f, 'rb') - self.initfp(f) - - def getfp(self): - return self._file - - def rewind(self): - self._ssnd_seek_needed = 1 - self._soundpos = 0 - - def close(self): - if self._decomp: - self._decomp.CloseDecompressor() - self._decomp = None - self._file.close() - return - - def tell(self): - return self._soundpos - - def getnchannels(self): - return self._nchannels - - def getnframes(self): - return self._nframes - - def getsampwidth(self): - return self._sampwidth - - def getframerate(self): - return self._framerate - - def getcomptype(self): - return self._comptype - - def getcompname(self): - return self._compname - - def getparams(self): - return (self.getnchannels(), - self.getsampwidth(), - self.getframerate(), - self.getnframes(), - self.getcomptype(), - self.getcompname()) - - def getmarkers(self): - if len(self._markers) == 0: - return None - else: - return self._markers - - def getmark(self, id): - for marker in self._markers: - if id == marker[0]: - return marker - - raise Error, 'marker %r does not exist' % (id,) - - def setpos(self, pos): - if pos < 0 or pos > self._nframes: - raise Error, 'position not in range' - self._soundpos = pos - self._ssnd_seek_needed = 1 - - def readframes(self, nframes): - if self._ssnd_seek_needed: - self._ssnd_chunk.seek(0) - dummy = self._ssnd_chunk.read(8) - pos = self._soundpos * self._framesize - if pos: - self._ssnd_chunk.seek(pos + 8) - self._ssnd_seek_needed = 0 - if nframes == 0: - return '' - data = self._ssnd_chunk.read(nframes * self._framesize) - if self._convert and data: - data = self._convert(data) - self._soundpos = self._soundpos + len(data) // (self._nchannels * self._sampwidth) - return data - - def _decomp_data(self, data): - import cl - dummy = self._decomp.SetParam(cl.FRAME_BUFFER_SIZE, len(data) * 2) - return self._decomp.Decompress(len(data) // self._nchannels, data) - - def _ulaw2lin(self, data): - import audioop - return audioop.ulaw2lin(data, 2) - - def _adpcm2lin(self, data): - import audioop - if not hasattr(self, '_adpcmstate'): - self._adpcmstate = None - data, self._adpcmstate = audioop.adpcm2lin(data, 2, self._adpcmstate) - return data - - def _read_comm_chunk(self, chunk): - self._nchannels = _read_short(chunk) - self._nframes = _read_long(chunk) - self._sampwidth = (_read_short(chunk) + 7) // 8 - self._framerate = int(_read_float(chunk)) - self._framesize = self._nchannels * self._sampwidth - if self._aifc: - kludge = 0 - if chunk.chunksize == 18: - kludge = 1 - print 'Warning: bad COMM chunk size' - chunk.chunksize = 23 - self._comptype = chunk.read(4) - if kludge: - length = ord(chunk.file.read(1)) - if length & 1 == 0: - length = length + 1 - chunk.chunksize = chunk.chunksize + length - chunk.file.seek(-1, 1) - self._compname = _read_string(chunk) - if self._comptype != 'NONE': - if self._comptype == 'G722': - try: - import audioop - except ImportError: - pass - else: - self._convert = self._adpcm2lin - self._sampwidth = 2 - return - - try: - import cl - except ImportError: - if self._comptype in ('ULAW', 'ulaw'): - try: - import audioop - self._convert = self._ulaw2lin - self._sampwidth = 2 - return - except ImportError: - pass - - raise Error, 'cannot read compressed AIFF-C files' - - if self._comptype in ('ULAW', 'ulaw'): - scheme = cl.G711_ULAW - elif self._comptype in ('ALAW', 'alaw'): - scheme = cl.G711_ALAW - else: - raise Error, 'unsupported compression type' - self._decomp = cl.OpenDecompressor(scheme) - self._convert = self._decomp_data - self._sampwidth = 2 - else: - self._comptype = 'NONE' - self._compname = 'not compressed' - - def _readmark(self, chunk): - nmarkers = _read_short(chunk) - try: - for i in range(nmarkers): - id = _read_short(chunk) - pos = _read_long(chunk) - name = _read_string(chunk) - if pos or name: - self._markers.append((id, pos, name)) - - except EOFError: - print 'Warning: MARK chunk contains only', - print len(self._markers), - if len(self._markers) == 1: - print 'marker', - else: - print 'markers', - print 'instead of', nmarkers - - -class Aifc_write(): - - def __init__(self, f): - if type(f) == type(''): - filename = f - f = __builtin__.open(f, 'wb') - else: - filename = '???' - self.initfp(f) - if filename[-5:] == '.aiff': - self._aifc = 0 - else: - self._aifc = 1 - - def initfp(self, file): - self._file = file - self._version = _AIFC_version - self._comptype = 'NONE' - self._compname = 'not compressed' - self._comp = None - self._convert = None - self._nchannels = 0 - self._sampwidth = 0 - self._framerate = 0 - self._nframes = 0 - self._nframeswritten = 0 - self._datawritten = 0 - self._datalength = 0 - self._markers = [] - self._marklength = 0 - self._aifc = 1 - return - - def __del__(self): - if self._file: - self.close() - - def aiff(self): - if self._nframeswritten: - raise Error, 'cannot change parameters after starting to write' - self._aifc = 0 - - def aifc(self): - if self._nframeswritten: - raise Error, 'cannot change parameters after starting to write' - self._aifc = 1 - - def setnchannels(self, nchannels): - if self._nframeswritten: - raise Error, 'cannot change parameters after starting to write' - if nchannels < 1: - raise Error, 'bad # of channels' - self._nchannels = nchannels - - def getnchannels(self): - if not self._nchannels: - raise Error, 'number of channels not set' - return self._nchannels - - def setsampwidth(self, sampwidth): - if self._nframeswritten: - raise Error, 'cannot change parameters after starting to write' - if sampwidth < 1 or sampwidth > 4: - raise Error, 'bad sample width' - self._sampwidth = sampwidth - - def getsampwidth(self): - if not self._sampwidth: - raise Error, 'sample width not set' - return self._sampwidth - - def setframerate(self, framerate): - if self._nframeswritten: - raise Error, 'cannot change parameters after starting to write' - if framerate <= 0: - raise Error, 'bad frame rate' - self._framerate = framerate - - def getframerate(self): - if not self._framerate: - raise Error, 'frame rate not set' - return self._framerate - - def setnframes(self, nframes): - if self._nframeswritten: - raise Error, 'cannot change parameters after starting to write' - self._nframes = nframes - - def getnframes(self): - return self._nframeswritten - - def setcomptype(self, comptype, compname): - if self._nframeswritten: - raise Error, 'cannot change parameters after starting to write' - if comptype not in ('NONE', 'ULAW', 'ulaw', 'ALAW', 'alaw', 'G722'): - raise Error, 'unsupported compression type' - self._comptype = comptype - self._compname = compname - - def getcomptype(self): - return self._comptype - - def getcompname(self): - return self._compname - - def setparams(self, info): - nchannels, sampwidth, framerate, nframes, comptype, compname = info - if self._nframeswritten: - raise Error, 'cannot change parameters after starting to write' - if comptype not in ('NONE', 'ULAW', 'ulaw', 'ALAW', 'alaw', 'G722'): - raise Error, 'unsupported compression type' - self.setnchannels(nchannels) - self.setsampwidth(sampwidth) - self.setframerate(framerate) - self.setnframes(nframes) - self.setcomptype(comptype, compname) - - def getparams(self): - if not self._nchannels or not self._sampwidth or not self._framerate: - raise Error, 'not all parameters set' - return (self._nchannels, - self._sampwidth, - self._framerate, - self._nframes, - self._comptype, - self._compname) - - def setmark(self, id, pos, name): - if id <= 0: - raise Error, 'marker ID must be > 0' - if pos < 0: - raise Error, 'marker position must be >= 0' - if type(name) != type(''): - raise Error, 'marker name must be a string' - for i in range(len(self._markers)): - if id == self._markers[i][0]: - self._markers[i] = (id, pos, name) - return - - self._markers.append((id, pos, name)) - - def getmark(self, id): - for marker in self._markers: - if id == marker[0]: - return marker - - raise Error, 'marker %r does not exist' % (id,) - - def getmarkers(self): - if len(self._markers) == 0: - return None - else: - return self._markers - - def tell(self): - return self._nframeswritten - - def writeframesraw(self, data): - self._ensure_header_written(len(data)) - nframes = len(data) // (self._sampwidth * self._nchannels) - if self._convert: - data = self._convert(data) - self._file.write(data) - self._nframeswritten = self._nframeswritten + nframes - self._datawritten = self._datawritten + len(data) - - def writeframes(self, data): - self.writeframesraw(data) - if self._nframeswritten != self._nframes or self._datalength != self._datawritten: - self._patchheader() - - def close(self): - if self._file is None: - return - else: - try: - self._ensure_header_written(0) - if self._datawritten & 1: - self._file.write(chr(0)) - self._datawritten = self._datawritten + 1 - self._writemarkers() - if self._nframeswritten != self._nframes or self._datalength != self._datawritten or self._marklength: - self._patchheader() - if self._comp: - self._comp.CloseCompressor() - self._comp = None - finally: - self._convert = None - f = self._file - self._file = None - f.close() - - return - - def _comp_data(self, data): - import cl - dummy = self._comp.SetParam(cl.FRAME_BUFFER_SIZE, len(data)) - dummy = self._comp.SetParam(cl.COMPRESSED_BUFFER_SIZE, len(data)) - return self._comp.Compress(self._nframes, data) - - def _lin2ulaw(self, data): - import audioop - return audioop.lin2ulaw(data, 2) - - def _lin2adpcm(self, data): - import audioop - if not hasattr(self, '_adpcmstate'): - self._adpcmstate = None - data, self._adpcmstate = audioop.lin2adpcm(data, 2, self._adpcmstate) - return data - - def _ensure_header_written(self, datasize): - if not self._nframeswritten: - if self._comptype in ('ULAW', 'ulaw', 'ALAW', 'alaw'): - if not self._sampwidth: - self._sampwidth = 2 - if self._sampwidth != 2: - raise Error, 'sample width must be 2 when compressing with ULAW or ALAW' - if self._comptype == 'G722': - if not self._sampwidth: - self._sampwidth = 2 - if self._sampwidth != 2: - raise Error, 'sample width must be 2 when compressing with G7.22 (ADPCM)' - if not self._nchannels: - raise Error, '# channels not specified' - if not self._sampwidth: - raise Error, 'sample width not specified' - if not self._framerate: - raise Error, 'sampling rate not specified' - self._write_header(datasize) - - def _init_compression(self): - if self._comptype == 'G722': - self._convert = self._lin2adpcm - return - try: - import cl - except ImportError: - if self._comptype in ('ULAW', 'ulaw'): - try: - import audioop - self._convert = self._lin2ulaw - return - except ImportError: - pass - - raise Error, 'cannot write compressed AIFF-C files' - - if self._comptype in ('ULAW', 'ulaw'): - scheme = cl.G711_ULAW - elif self._comptype in ('ALAW', 'alaw'): - scheme = cl.G711_ALAW - else: - raise Error, 'unsupported compression type' - self._comp = cl.OpenCompressor(scheme) - params = [cl.ORIGINAL_FORMAT, - 0, - cl.BITS_PER_COMPONENT, - self._sampwidth * 8, - cl.FRAME_RATE, - self._framerate, - cl.FRAME_BUFFER_SIZE, - 100, - cl.COMPRESSED_BUFFER_SIZE, - 100] - if self._nchannels == 1: - params[1] = cl.MONO - elif self._nchannels == 2: - params[1] = cl.STEREO_INTERLEAVED - else: - raise Error, 'cannot compress more than 2 channels' - self._comp.SetParams(params) - dummy = self._comp.Compress(0, '') - self._convert = self._comp_data - - def _write_header(self, initlength): - if self._aifc and self._comptype != 'NONE': - self._init_compression() - self._file.write('FORM') - if not self._nframes: - self._nframes = initlength // (self._nchannels * self._sampwidth) - self._datalength = self._nframes * self._nchannels * self._sampwidth - if self._datalength & 1: - self._datalength = self._datalength + 1 - if self._aifc: - if self._comptype in ('ULAW', 'ulaw', 'ALAW', 'alaw'): - self._datalength = self._datalength // 2 - if self._datalength & 1: - self._datalength = self._datalength + 1 - elif self._comptype == 'G722': - self._datalength = (self._datalength + 3) // 4 - if self._datalength & 1: - self._datalength = self._datalength + 1 - try: - self._form_length_pos = self._file.tell() - except (AttributeError, IOError): - self._form_length_pos = None - - commlength = self._write_form_length(self._datalength) - if self._aifc: - self._file.write('AIFC') - self._file.write('FVER') - _write_ulong(self._file, 4) - _write_ulong(self._file, self._version) - else: - self._file.write('AIFF') - self._file.write('COMM') - _write_ulong(self._file, commlength) - _write_short(self._file, self._nchannels) - if self._form_length_pos is not None: - self._nframes_pos = self._file.tell() - _write_ulong(self._file, self._nframes) - if self._comptype in ('ULAW', 'ulaw', 'ALAW', 'alaw', 'G722'): - _write_short(self._file, 8) - else: - _write_short(self._file, self._sampwidth * 8) - _write_float(self._file, self._framerate) - if self._aifc: - self._file.write(self._comptype) - _write_string(self._file, self._compname) - self._file.write('SSND') - if self._form_length_pos is not None: - self._ssnd_length_pos = self._file.tell() - _write_ulong(self._file, self._datalength + 8) - _write_ulong(self._file, 0) - _write_ulong(self._file, 0) - return - - def _write_form_length(self, datalength): - if self._aifc: - commlength = 23 + len(self._compname) - if commlength & 1: - commlength = commlength + 1 - verslength = 12 - else: - commlength = 18 - verslength = 0 - _write_ulong(self._file, 4 + verslength + self._marklength + 8 + commlength + 16 + datalength) - return commlength - - def _patchheader(self): - curpos = self._file.tell() - if self._datawritten & 1: - datalength = self._datawritten + 1 - self._file.write(chr(0)) - else: - datalength = self._datawritten - if datalength == self._datalength and self._nframes == self._nframeswritten and self._marklength == 0: - self._file.seek(curpos, 0) - return - self._file.seek(self._form_length_pos, 0) - dummy = self._write_form_length(datalength) - self._file.seek(self._nframes_pos, 0) - _write_ulong(self._file, self._nframeswritten) - self._file.seek(self._ssnd_length_pos, 0) - _write_ulong(self._file, datalength + 8) - self._file.seek(curpos, 0) - self._nframes = self._nframeswritten - self._datalength = datalength - - def _writemarkers(self): - if len(self._markers) == 0: - return - self._file.write('MARK') - length = 2 - for marker in self._markers: - id, pos, name = marker - length = length + len(name) + 1 + 6 - if len(name) & 1 == 0: - length = length + 1 - - _write_ulong(self._file, length) - self._marklength = length + 8 - _write_short(self._file, len(self._markers)) - for marker in self._markers: - id, pos, name = marker - _write_short(self._file, id) - _write_ulong(self._file, pos) - _write_string(self._file, name) - - -def open(f, mode = None): - if mode is None: - if hasattr(f, 'mode'): - mode = f.mode - else: - mode = 'rb' - if mode in ('r', 'rb'): - return Aifc_read(f) - elif mode in ('w', 'wb'): - return Aifc_write(f) - else: - raise Error, "mode must be 'r', 'rb', 'w', or 'wb'" - return - - -openfp = open -if __name__ == '__main__': - import sys - if not sys.argv[1:]: - sys.argv.append('/usr/demos/data/audio/bach.aiff') - fn = sys.argv[1] - f = open(fn, 'r') - try: - print 'Reading', fn - print 'nchannels =', f.getnchannels() - print 'nframes =', f.getnframes() - print 'sampwidth =', f.getsampwidth() - print 'framerate =', f.getframerate() - print 'comptype =', f.getcomptype() - print 'compname =', f.getcompname() - if sys.argv[2:]: - gn = sys.argv[2] - print 'Writing', gn - g = open(gn, 'w') - try: - g.setparams(f.getparams()) - while 1: - data = f.readframes(1024) - if not data: - break - g.writeframes(data) - - finally: - g.close() - - print 'Done.' - finally: - f.close() \ No newline at end of file diff --git a/test/ok_2.7/antigravity.pyc_dis b/test/ok_2.7/antigravity.pyc_dis deleted file mode 100644 index fe0ddabb..00000000 --- a/test/ok_2.7/antigravity.pyc_dis +++ /dev/null @@ -1,3 +0,0 @@ -# Embedded file name: /src/external-vcs/github/rocky/uncompyle6/test/ok_2.7/antigravity.py -import webbrowser -webbrowser.open('http://xkcd.com/353/') \ No newline at end of file diff --git a/test/ok_2.7/anydbm.pyc_dis b/test/ok_2.7/anydbm.pyc_dis deleted file mode 100644 index 4b5617a2..00000000 --- a/test/ok_2.7/anydbm.pyc_dis +++ /dev/null @@ -1,83 +0,0 @@ -# Embedded file name: /src/external-vcs/github/rocky/uncompyle6/test/ok_2.7/anydbm.py -"""Generic interface to all dbm clones. - -Instead of - - import dbm - d = dbm.open(file, 'w', 0666) - -use - - import anydbm - d = anydbm.open(file, 'w') - -The returned object is a dbhash, gdbm, dbm or dumbdbm object, -dependent on the type of database being opened (determined by whichdb -module) in the case of an existing dbm. If the dbm does not exist and -the create or new flag ('c' or 'n') was specified, the dbm type will -be determined by the availability of the modules (tested in the above -order). - -It has the following interface (key and data are strings): - - d[key] = data # store data at key (may override data at - # existing key) - data = d[key] # retrieve data at key (raise KeyError if no - # such key) - del d[key] # delete data stored at key (raises KeyError - # if no such key) - flag = key in d # true if the key exists - list = d.keys() # return a list of all existing keys (slow!) - -Future versions may change the order in which implementations are -tested for existence, and add interfaces to other dbm-like -implementations. -""" - -class error(Exception): - pass - - -_names = ['dbhash', - 'gdbm', - 'dbm', - 'dumbdbm'] -_errors = [error] -_defaultmod = None -for _name in _names: - try: - _mod = __import__(_name) - except ImportError: - continue - - if not _defaultmod: - _defaultmod = _mod - _errors.append(_mod.error) - -if not _defaultmod: - raise ImportError, 'no dbm clone found; tried %s' % _names -error = tuple(_errors) - -def open(file, flag = 'r', mode = 438): - """Open or create database at path given by *file*. - - Optional argument *flag* can be 'r' (default) for read-only access, 'w' - for read-write access of an existing database, 'c' for read-write access - to a new or existing database, and 'n' for read-write access to a new - database. - - Note: 'r' and 'w' fail if the database doesn't exist; 'c' creates it - only if it doesn't exist; and 'n' always creates a new database. - """ - from whichdb import whichdb - result = whichdb(file) - if result is None: - if 'c' in flag or 'n' in flag: - mod = _defaultmod - else: - raise error, "need 'c' or 'n' flag to open new db" - elif result == '': - raise error, 'db type could not be determined' - else: - mod = __import__(result) - return mod.open(file, flag, mode) \ No newline at end of file diff --git a/test/ok_2.7/asynchat.pyc_dis b/test/ok_2.7/asynchat.pyc_dis deleted file mode 100644 index 71577895..00000000 --- a/test/ok_2.7/asynchat.pyc_dis +++ /dev/null @@ -1,231 +0,0 @@ -# Embedded file name: /src/external-vcs/github/rocky/uncompyle6/test/ok_2.7/asynchat.py -r"""A class supporting chat-style (command/response) protocols. - -This class adds support for 'chat' style protocols - where one side -sends a 'command', and the other sends a response (examples would be -the common internet protocols - smtp, nntp, ftp, etc..). - -The handle_read() method looks at the input stream for the current -'terminator' (usually '\r\n' for single-line responses, '\r\n.\r\n' -for multi-line output), calling self.found_terminator() on its -receipt. - -for example: -Say you build an async nntp client using this class. At the start -of the connection, you'll have self.terminator set to '\r\n', in -order to process the single-line greeting. Just before issuing a -'LIST' command you'll set it to '\r\n.\r\n'. The output of the LIST -command will be accumulated (using your own 'collect_incoming_data' -method) up to the terminator, and then control will be returned to -you - by calling your self.found_terminator() method. -""" -import socket -import asyncore -from collections import deque -from sys import py3kwarning -from warnings import filterwarnings, catch_warnings - -class async_chat(asyncore.dispatcher): - """This is an abstract class. You must derive from this class, and add - the two methods collect_incoming_data() and found_terminator()""" - ac_in_buffer_size = 4096 - ac_out_buffer_size = 4096 - - def __init__(self, sock = None, map = None): - self.ac_in_buffer = '' - self.incoming = [] - self.producer_fifo = deque() - asyncore.dispatcher.__init__(self, sock, map) - - def collect_incoming_data(self, data): - raise NotImplementedError('must be implemented in subclass') - - def _collect_incoming_data(self, data): - self.incoming.append(data) - - def _get_data(self): - d = ''.join(self.incoming) - del self.incoming[:] - return d - - def found_terminator(self): - raise NotImplementedError('must be implemented in subclass') - - def set_terminator(self, term): - """Set the input delimiter. Can be a fixed string of any length, an integer, or None""" - self.terminator = term - - def get_terminator(self): - return self.terminator - - def handle_read(self): - try: - data = self.recv(self.ac_in_buffer_size) - except socket.error as why: - self.handle_error() - return - - self.ac_in_buffer = self.ac_in_buffer + data - while self.ac_in_buffer: - lb = len(self.ac_in_buffer) - terminator = self.get_terminator() - if not terminator: - self.collect_incoming_data(self.ac_in_buffer) - self.ac_in_buffer = '' - elif isinstance(terminator, int) or isinstance(terminator, long): - n = terminator - if lb < n: - self.collect_incoming_data(self.ac_in_buffer) - self.ac_in_buffer = '' - self.terminator = self.terminator - lb - else: - self.collect_incoming_data(self.ac_in_buffer[:n]) - self.ac_in_buffer = self.ac_in_buffer[n:] - self.terminator = 0 - self.found_terminator() - else: - terminator_len = len(terminator) - index = self.ac_in_buffer.find(terminator) - if index != -1: - if index > 0: - self.collect_incoming_data(self.ac_in_buffer[:index]) - self.ac_in_buffer = self.ac_in_buffer[index + terminator_len:] - self.found_terminator() - else: - index = find_prefix_at_end(self.ac_in_buffer, terminator) - if index: - if index != lb: - self.collect_incoming_data(self.ac_in_buffer[:-index]) - self.ac_in_buffer = self.ac_in_buffer[-index:] - break - else: - self.collect_incoming_data(self.ac_in_buffer) - self.ac_in_buffer = '' - - def handle_write(self): - self.initiate_send() - - def handle_close(self): - self.close() - - def push(self, data): - sabs = self.ac_out_buffer_size - if len(data) > sabs: - for i in xrange(0, len(data), sabs): - self.producer_fifo.append(data[i:i + sabs]) - - else: - self.producer_fifo.append(data) - self.initiate_send() - - def push_with_producer(self, producer): - self.producer_fifo.append(producer) - self.initiate_send() - - def readable(self): - """predicate for inclusion in the readable for select()""" - return 1 - - def writable(self): - """predicate for inclusion in the writable for select()""" - return self.producer_fifo or not self.connected - - def close_when_done(self): - """automatically close this channel once the outgoing queue is empty""" - self.producer_fifo.append(None) - return - - def initiate_send(self): - while self.producer_fifo and self.connected: - first = self.producer_fifo[0] - if not first: - del self.producer_fifo[0] - if first is None: - self.handle_close() - return - obs = self.ac_out_buffer_size - try: - with catch_warnings(): - if py3kwarning: - filterwarnings('ignore', '.*buffer', DeprecationWarning) - data = buffer(first, 0, obs) - except TypeError: - data = first.more() - if data: - self.producer_fifo.appendleft(data) - else: - del self.producer_fifo[0] - continue - - try: - num_sent = self.send(data) - except socket.error: - self.handle_error() - return - - if num_sent: - if num_sent < len(data) or obs < len(first): - self.producer_fifo[0] = first[num_sent:] - else: - del self.producer_fifo[0] - return - - return - - def discard_buffers(self): - self.ac_in_buffer = '' - del self.incoming[:] - self.producer_fifo.clear() - - -class simple_producer: - - def __init__(self, data, buffer_size = 512): - self.data = data - self.buffer_size = buffer_size - - def more(self): - if len(self.data) > self.buffer_size: - result = self.data[:self.buffer_size] - self.data = self.data[self.buffer_size:] - return result - else: - result = self.data - self.data = '' - return result - - -class fifo: - - def __init__(self, list = None): - if not list: - self.list = deque() - else: - self.list = deque(list) - - def __len__(self): - return len(self.list) - - def is_empty(self): - return not self.list - - def first(self): - return self.list[0] - - def push(self, data): - self.list.append(data) - - def pop(self): - if self.list: - return (1, self.list.popleft()) - else: - return (0, None) - return None - - -def find_prefix_at_end(haystack, needle): - l = len(needle) - 1 - while l and not haystack.endswith(needle[:l]): - l -= 1 - - return l \ No newline at end of file diff --git a/test/ok_2.7/asyncore.pyc_dis b/test/ok_2.7/asyncore.pyc_dis deleted file mode 100644 index f6d9354e..00000000 --- a/test/ok_2.7/asyncore.pyc_dis +++ /dev/null @@ -1,560 +0,0 @@ -# Embedded file name: /src/external-vcs/github/rocky/uncompyle6/test/ok_2.7/asyncore.py -"""Basic infrastructure for asynchronous socket service clients and servers. - -There are only two ways to have a program on a single processor do "more -than one thing at a time". Multi-threaded programming is the simplest and -most popular way to do it, but there is another very different technique, -that lets you have nearly all the advantages of multi-threading, without -actually using multiple threads. it's really only practical if your program -is largely I/O bound. If your program is CPU bound, then pre-emptive -scheduled threads are probably what you really need. Network servers are -rarely CPU-bound, however. - -If your operating system supports the select() system call in its I/O -library (and nearly all do), then you can use it to juggle multiple -communication channels at once; doing other work while your I/O is taking -place in the "background." Although this strategy can seem strange and -complex, especially at first, it is in many ways easier to understand and -control than multi-threaded programming. The module documented here solves -many of the difficult problems for you, making the task of building -sophisticated high-performance network servers and clients a snap. -""" -import select -import socket -import sys -import time -import warnings -import os -from errno import EALREADY, EINPROGRESS, EWOULDBLOCK, ECONNRESET, EINVAL, ENOTCONN, ESHUTDOWN, EINTR, EISCONN, EBADF, ECONNABORTED, EPIPE, EAGAIN, errorcode -_DISCONNECTED = frozenset((ECONNRESET, - ENOTCONN, - ESHUTDOWN, - ECONNABORTED, - EPIPE, - EBADF)) -try: - socket_map -except NameError: - socket_map = {} - -def _strerror(err): - try: - return os.strerror(err) - except (ValueError, OverflowError, NameError): - if err in errorcode: - return errorcode[err] - return 'Unknown error %s' % err - - -class ExitNow(Exception): - pass - - -_reraised_exceptions = (ExitNow, KeyboardInterrupt, SystemExit) - -def read(obj): - try: - obj.handle_read_event() - except _reraised_exceptions: - raise - except: - obj.handle_error() - - -def write(obj): - try: - obj.handle_write_event() - except _reraised_exceptions: - raise - except: - obj.handle_error() - - -def _exception(obj): - try: - obj.handle_expt_event() - except _reraised_exceptions: - raise - except: - obj.handle_error() - - -def readwrite(obj, flags): - try: - if flags & select.POLLIN: - obj.handle_read_event() - if flags & select.POLLOUT: - obj.handle_write_event() - if flags & select.POLLPRI: - obj.handle_expt_event() - if flags & (select.POLLHUP | select.POLLERR | select.POLLNVAL): - obj.handle_close() - except socket.error as e: - if e.args[0] not in _DISCONNECTED: - obj.handle_error() - else: - obj.handle_close() - except _reraised_exceptions: - raise - except: - obj.handle_error() - - -def poll(timeout = 0.0, map = None): - if map is None: - map = socket_map - if map: - r = [] - w = [] - e = [] - for fd, obj in map.items(): - is_r = obj.readable() - is_w = obj.writable() - if is_r: - r.append(fd) - if is_w and not obj.accepting: - w.append(fd) - if is_r or is_w: - e.append(fd) - - if [] == r == w == e: - time.sleep(timeout) - return - try: - r, w, e = select.select(r, w, e, timeout) - except select.error as err: - if err.args[0] != EINTR: - raise - else: - return - - for fd in r: - obj = map.get(fd) - if obj is None: - continue - read(obj) - - for fd in w: - obj = map.get(fd) - if obj is None: - continue - write(obj) - - for fd in e: - obj = map.get(fd) - if obj is None: - continue - _exception(obj) - - return - - -def poll2(timeout = 0.0, map = None): - if map is None: - map = socket_map - if timeout is not None: - timeout = int(timeout * 1000) - pollster = select.poll() - if map: - for fd, obj in map.items(): - flags = 0 - if obj.readable(): - flags |= select.POLLIN | select.POLLPRI - if obj.writable() and not obj.accepting: - flags |= select.POLLOUT - if flags: - flags |= select.POLLERR | select.POLLHUP | select.POLLNVAL - pollster.register(fd, flags) - - try: - r = pollster.poll(timeout) - except select.error as err: - if err.args[0] != EINTR: - raise - r = [] - - for fd, flags in r: - obj = map.get(fd) - if obj is None: - continue - readwrite(obj, flags) - - return - - -poll3 = poll2 - -def loop(timeout = 30.0, use_poll = False, map = None, count = None): - if map is None: - map = socket_map - if use_poll and hasattr(select, 'poll'): - poll_fun = poll2 - else: - poll_fun = poll - if count is None: - while map: - poll_fun(timeout, map) - - else: - while map and count > 0: - poll_fun(timeout, map) - count = count - 1 - - return - - -class dispatcher(): - debug = False - connected = False - accepting = False - connecting = False - closing = False - addr = None - ignore_log_types = frozenset(['warning']) - - def __init__(self, sock = None, map = None): - if map is None: - self._map = socket_map - else: - self._map = map - self._fileno = None - if sock: - sock.setblocking(0) - self.set_socket(sock, map) - self.connected = True - try: - self.addr = sock.getpeername() - except socket.error as err: - if err.args[0] in (ENOTCONN, EINVAL): - self.connected = False - else: - self.del_channel(map) - raise - - else: - self.socket = None - return - - def __repr__(self): - status = [self.__class__.__module__ + '.' + self.__class__.__name__] - if self.accepting and self.addr: - status.append('listening') - elif self.connected: - status.append('connected') - if self.addr is not None: - try: - status.append('%s:%d' % self.addr) - except TypeError: - status.append(repr(self.addr)) - - return '<%s at %#x>' % (' '.join(status), id(self)) - - __str__ = __repr__ - - def add_channel(self, map = None): - if map is None: - map = self._map - map[self._fileno] = self - return - - def del_channel(self, map = None): - fd = self._fileno - if map is None: - map = self._map - if fd in map: - del map[fd] - self._fileno = None - return - - def create_socket(self, family, type): - self.family_and_type = (family, type) - sock = socket.socket(family, type) - sock.setblocking(0) - self.set_socket(sock) - - def set_socket(self, sock, map = None): - self.socket = sock - self._fileno = sock.fileno() - self.add_channel(map) - - def set_reuse_addr(self): - try: - self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, self.socket.getsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR) | 1) - except socket.error: - pass - - def readable(self): - return True - - def writable(self): - return True - - def listen(self, num): - self.accepting = True - if os.name == 'nt' and num > 5: - num = 5 - return self.socket.listen(num) - - def bind(self, addr): - self.addr = addr - return self.socket.bind(addr) - - def connect(self, address): - self.connected = False - self.connecting = True - err = self.socket.connect_ex(address) - if err in (EINPROGRESS, EALREADY, EWOULDBLOCK) or err == EINVAL and os.name in ('nt', 'ce'): - self.addr = address - return - if err in (0, EISCONN): - self.addr = address - self.handle_connect_event() - else: - raise socket.error(err, errorcode[err]) - - def accept(self): - try: - conn, addr = self.socket.accept() - except TypeError: - return None - except socket.error as why: - if why.args[0] in (EWOULDBLOCK, ECONNABORTED, EAGAIN): - return None - raise - else: - return (conn, addr) - - return None - - def send(self, data): - try: - result = self.socket.send(data) - return result - except socket.error as why: - if why.args[0] == EWOULDBLOCK: - return 0 - if why.args[0] in _DISCONNECTED: - self.handle_close() - return 0 - raise - - def recv(self, buffer_size): - try: - data = self.socket.recv(buffer_size) - if not data: - self.handle_close() - return '' - return data - except socket.error as why: - if why.args[0] in _DISCONNECTED: - self.handle_close() - return '' - raise - - def close(self): - self.connected = False - self.accepting = False - self.connecting = False - self.del_channel() - try: - self.socket.close() - except socket.error as why: - if why.args[0] not in (ENOTCONN, EBADF): - raise - - def __getattr__(self, attr): - try: - retattr = getattr(self.socket, attr) - except AttributeError: - raise AttributeError("%s instance has no attribute '%s'" % (self.__class__.__name__, attr)) - else: - msg = '%(me)s.%(attr)s is deprecated. Use %(me)s.socket.%(attr)s instead.' % {'me': self.__class__.__name__, - 'attr': attr} - warnings.warn(msg, DeprecationWarning, stacklevel=2) - return retattr - - def log(self, message): - sys.stderr.write('log: %s\n' % str(message)) - - def log_info(self, message, type = 'info'): - if type not in self.ignore_log_types: - print '%s: %s' % (type, message) - - def handle_read_event(self): - if self.accepting: - self.handle_accept() - elif not self.connected: - if self.connecting: - self.handle_connect_event() - self.handle_read() - else: - self.handle_read() - - def handle_connect_event(self): - err = self.socket.getsockopt(socket.SOL_SOCKET, socket.SO_ERROR) - if err != 0: - raise socket.error(err, _strerror(err)) - self.handle_connect() - self.connected = True - self.connecting = False - - def handle_write_event(self): - if self.accepting: - return - if not self.connected: - if self.connecting: - self.handle_connect_event() - self.handle_write() - - def handle_expt_event(self): - err = self.socket.getsockopt(socket.SOL_SOCKET, socket.SO_ERROR) - if err != 0: - self.handle_close() - else: - self.handle_expt() - - def handle_error(self): - nil, t, v, tbinfo = compact_traceback() - try: - self_repr = repr(self) - except: - self_repr = '<__repr__(self) failed for object at %0x>' % id(self) - - self.log_info('uncaptured python exception, closing channel %s (%s:%s %s)' % (self_repr, - t, - v, - tbinfo), 'error') - self.handle_close() - - def handle_expt(self): - self.log_info('unhandled incoming priority event', 'warning') - - def handle_read(self): - self.log_info('unhandled read event', 'warning') - - def handle_write(self): - self.log_info('unhandled write event', 'warning') - - def handle_connect(self): - self.log_info('unhandled connect event', 'warning') - - def handle_accept(self): - self.log_info('unhandled accept event', 'warning') - - def handle_close(self): - self.log_info('unhandled close event', 'warning') - self.close() - - -class dispatcher_with_send(dispatcher): - - def __init__(self, sock = None, map = None): - dispatcher.__init__(self, sock, map) - self.out_buffer = '' - - def initiate_send(self): - num_sent = 0 - num_sent = dispatcher.send(self, self.out_buffer[:512]) - self.out_buffer = self.out_buffer[num_sent:] - - def handle_write(self): - self.initiate_send() - - def writable(self): - return not self.connected or len(self.out_buffer) - - def send(self, data): - if self.debug: - self.log_info('sending %s' % repr(data)) - self.out_buffer = self.out_buffer + data - self.initiate_send() - - -def compact_traceback(): - t, v, tb = sys.exc_info() - tbinfo = [] - if not tb: - raise AssertionError('traceback does not exist') - while tb: - tbinfo.append((tb.tb_frame.f_code.co_filename, tb.tb_frame.f_code.co_name, str(tb.tb_lineno))) - tb = tb.tb_next - - del tb - file, function, line = tbinfo[-1] - info = ' '.join([ '[%s|%s|%s]' % x for x in tbinfo ]) - return ((file, function, line), - t, - v, - info) - - -def close_all(map = None, ignore_all = False): - if map is None: - map = socket_map - for x in map.values(): - try: - x.close() - except OSError as x: - if x.args[0] == EBADF: - pass - elif not ignore_all: - raise - except _reraised_exceptions: - raise - except: - if not ignore_all: - raise - - map.clear() - return - - -if os.name == 'posix': - import fcntl - - class file_wrapper(): - - def __init__(self, fd): - self.fd = os.dup(fd) - - def recv(self, *args): - return os.read(self.fd, *args) - - def send(self, *args): - return os.write(self.fd, *args) - - def getsockopt(self, level, optname, buflen = None): - if level == socket.SOL_SOCKET and optname == socket.SO_ERROR and not buflen: - return 0 - raise NotImplementedError('Only asyncore specific behaviour implemented.') - - read = recv - write = send - - def close(self): - os.close(self.fd) - - def fileno(self): - return self.fd - - - class file_dispatcher(dispatcher): - - def __init__(self, fd, map = None): - dispatcher.__init__(self, None, map) - self.connected = True - try: - fd = fd.fileno() - except AttributeError: - pass - - self.set_file(fd) - flags = fcntl.fcntl(fd, fcntl.F_GETFL, 0) - flags = flags | os.O_NONBLOCK - fcntl.fcntl(fd, fcntl.F_SETFL, flags) - return - - def set_file(self, fd): - self.socket = file_wrapper(fd) - self._fileno = self.socket.fileno() - self.add_channel() \ No newline at end of file diff --git a/test/ok_2.7/atexit.pyc_dis b/test/ok_2.7/atexit.pyc_dis deleted file mode 100644 index d86ecc27..00000000 --- a/test/ok_2.7/atexit.pyc_dis +++ /dev/null @@ -1,69 +0,0 @@ -# Embedded file name: /src/external-vcs/github/rocky/uncompyle6/test/ok_2.7/atexit.py -""" -atexit.py - allow programmer to define multiple exit functions to be executed -upon normal program termination. - -One public function, register, is defined. -""" -__all__ = ['register'] -import sys -_exithandlers = [] - -def _run_exitfuncs(): - """run any registered exit functions - - _exithandlers is traversed in reverse order so functions are executed - last in, first out. - """ - exc_info = None - while _exithandlers: - func, targs, kargs = _exithandlers.pop() - try: - func(*targs, **kargs) - except SystemExit: - exc_info = sys.exc_info() - except: - import traceback - print >> sys.stderr, 'Error in atexit._run_exitfuncs:' - traceback.print_exc() - exc_info = sys.exc_info() - - if exc_info is not None: - raise exc_info[0], exc_info[1], exc_info[2] - return - - -def register(func, *targs, **kargs): - """register a function to be executed upon normal program termination - - func - function to be called at exit - targs - optional arguments to pass to func - kargs - optional keyword arguments to pass to func - - func is returned to facilitate usage as a decorator. - """ - _exithandlers.append((func, targs, kargs)) - return func - - -if hasattr(sys, 'exitfunc'): - register(sys.exitfunc) -sys.exitfunc = _run_exitfuncs -if __name__ == '__main__': - - def x1(): - print 'running x1' - - - def x2(n): - print 'running x2(%r)' % (n,) - - - def x3(n, kwd = None): - print 'running x3(%r, kwd=%r)' % (n, kwd) - - - register(x1) - register(x2, 12) - register(x3, 5, 'bar') - register(x3, 'no kwd args') \ No newline at end of file diff --git a/test/ok_2.7/audiodev.pyc_dis b/test/ok_2.7/audiodev.pyc_dis deleted file mode 100644 index 701f8216..00000000 --- a/test/ok_2.7/audiodev.pyc_dis +++ /dev/null @@ -1,245 +0,0 @@ -# Embedded file name: /src/external-vcs/github/rocky/uncompyle6/test/ok_2.7/audiodev.py -"""Classes for manipulating audio devices (currently only for Sun and SGI)""" -from warnings import warnpy3k -warnpy3k('the audiodev module has been removed in Python 3.0', stacklevel=2) -del warnpy3k -__all__ = ['error', 'AudioDev'] - -class error(Exception): - pass - - -class Play_Audio_sgi: - classinited = 0 - frameratelist = nchannelslist = sampwidthlist = None - - def initclass(self): - import AL - self.frameratelist = [(48000, AL.RATE_48000), - (44100, AL.RATE_44100), - (32000, AL.RATE_32000), - (22050, AL.RATE_22050), - (16000, AL.RATE_16000), - (11025, AL.RATE_11025), - (8000, AL.RATE_8000)] - self.nchannelslist = [(1, AL.MONO), (2, AL.STEREO), (4, AL.QUADRO)] - self.sampwidthlist = [(1, AL.SAMPLE_8), (2, AL.SAMPLE_16), (3, AL.SAMPLE_24)] - self.classinited = 1 - - def __init__(self): - import al, AL - if not self.classinited: - self.initclass() - self.oldparams = [] - self.params = [AL.OUTPUT_RATE, 0] - self.config = al.newconfig() - self.inited_outrate = 0 - self.inited_width = 0 - self.inited_nchannels = 0 - self.converter = None - self.port = None - return - - def __del__(self): - if self.port: - self.stop() - if self.oldparams: - import al, AL - al.setparams(AL.DEFAULT_DEVICE, self.oldparams) - self.oldparams = [] - - def wait(self): - if not self.port: - return - import time - while self.port.getfilled() > 0: - time.sleep(0.1) - - self.stop() - - def stop(self): - if self.port: - self.port.closeport() - self.port = None - if self.oldparams: - import al, AL - al.setparams(AL.DEFAULT_DEVICE, self.oldparams) - self.oldparams = [] - return - - def setoutrate(self, rate): - for raw, cooked in self.frameratelist: - if rate == raw: - self.params[1] = cooked - self.inited_outrate = 1 - break - else: - raise error, 'bad output rate' - - def setsampwidth(self, width): - for raw, cooked in self.sampwidthlist: - if width == raw: - self.config.setwidth(cooked) - self.inited_width = 1 - break - else: - if width == 0: - import AL - self.inited_width = 0 - self.config.setwidth(AL.SAMPLE_16) - self.converter = self.ulaw2lin - else: - raise error, 'bad sample width' - - def setnchannels(self, nchannels): - for raw, cooked in self.nchannelslist: - if nchannels == raw: - self.config.setchannels(cooked) - self.inited_nchannels = 1 - break - else: - raise error, 'bad # of channels' - - def writeframes(self, data): - if not (self.inited_outrate and self.inited_nchannels): - raise error, 'params not specified' - if not self.port: - import al, AL - self.port = al.openport('Python', 'w', self.config) - self.oldparams = self.params[:] - al.getparams(AL.DEFAULT_DEVICE, self.oldparams) - al.setparams(AL.DEFAULT_DEVICE, self.params) - if self.converter: - data = self.converter(data) - self.port.writesamps(data) - - def getfilled(self): - if self.port: - return self.port.getfilled() - else: - return 0 - - def getfillable(self): - if self.port: - return self.port.getfillable() - else: - return self.config.getqueuesize() - - def ulaw2lin(self, data): - import audioop - return audioop.ulaw2lin(data, 2) - - -class Play_Audio_sun: - - def __init__(self): - self.outrate = 0 - self.sampwidth = 0 - self.nchannels = 0 - self.inited_outrate = 0 - self.inited_width = 0 - self.inited_nchannels = 0 - self.converter = None - self.port = None - return - - def __del__(self): - self.stop() - - def setoutrate(self, rate): - self.outrate = rate - self.inited_outrate = 1 - - def setsampwidth(self, width): - self.sampwidth = width - self.inited_width = 1 - - def setnchannels(self, nchannels): - self.nchannels = nchannels - self.inited_nchannels = 1 - - def writeframes(self, data): - if not (self.inited_outrate and self.inited_width and self.inited_nchannels): - raise error, 'params not specified' - if not self.port: - import sunaudiodev, SUNAUDIODEV - self.port = sunaudiodev.open('w') - info = self.port.getinfo() - info.o_sample_rate = self.outrate - info.o_channels = self.nchannels - if self.sampwidth == 0: - info.o_precision = 8 - self.o_encoding = SUNAUDIODEV.ENCODING_ULAW - else: - info.o_precision = 8 * self.sampwidth - info.o_encoding = SUNAUDIODEV.ENCODING_LINEAR - self.port.setinfo(info) - if self.converter: - data = self.converter(data) - self.port.write(data) - - def wait(self): - if not self.port: - return - self.port.drain() - self.stop() - - def stop(self): - if self.port: - self.port.flush() - self.port.close() - self.port = None - return - - def getfilled(self): - if self.port: - return self.port.obufcount() - else: - return 0 - - -def AudioDev(): - try: - import al - except ImportError: - try: - import sunaudiodev - return Play_Audio_sun() - except ImportError: - try: - import Audio_mac - except ImportError: - raise error, 'no audio device' - else: - return Audio_mac.Play_Audio_mac() - - else: - return Play_Audio_sgi() - - -def test(fn = None): - import sys - if sys.argv[1:]: - fn = sys.argv[1] - else: - fn = 'f:just samples:just.aif' - import aifc - af = aifc.open(fn, 'r') - print fn, af.getparams() - p = AudioDev() - p.setoutrate(af.getframerate()) - p.setsampwidth(af.getsampwidth()) - p.setnchannels(af.getnchannels()) - BUFSIZ = af.getframerate() / af.getsampwidth() / af.getnchannels() - while 1: - data = af.readframes(BUFSIZ) - if not data: - break - print len(data) - p.writeframes(data) - - p.wait() - - -if __name__ == '__main__': - test() \ No newline at end of file diff --git a/test/test_pythonlib.py b/test/test_pythonlib.py index 85b571d9..7158ae19 100755 --- a/test/test_pythonlib.py +++ b/test/test_pythonlib.py @@ -54,12 +54,22 @@ PYOC = ('*.pyc', '*.pyo') test_options = { # name: (src_basedir, pattern, output_base_suffix, pythoin_version) - 'test': ['test', PYC, 'test'], - '2.7': ['python2.7', PYC, 'python2.7', '2.7'], - 'ok-2.6': [os.path.join(src_dir, 'ok_2.6'), - PYC, 'ok-2.6', '2.6'], + 'test': + ['test', PYC, 'test'], + + 'bytecode-2.5': + ['bytecode_2.5', PYC, 'bytecode_2.5', '2.5'], + + '2.7': + ['python2.7', PYC, 'python2.7', '2.7'], + + 'ok-2.6': + [os.path.join(src_dir, 'ok_2.6'), + PYC, 'ok-2.6', '2.6'], + 'ok-2.7': [os.path.join(src_dir, 'ok_2.7'), PYC, 'ok-2.7', '2.7'], + 'base-2.7': [os.path.join(src_dir, 'base-tests', 'python2.7'), PYC, 'base_2.7', '2.7'], } @@ -113,9 +123,9 @@ def do_tests(src_dir, obj_patterns, target_dir, opts): pass pass - for root, dirs, basenames in os.walk(src_dir): + for root, dirs, basenames in os.walk('.'): # Turn root into a relative path - dirname = root[len(src_dir)+1:] + dirname = root[2:] # 2 = len('.') + 1 file_matches(files, dirname, basenames, obj_patterns) if not files: diff --git a/uncompyle6/walker.py b/uncompyle6/walker.py index 625757e5..e107ada4 100644 --- a/uncompyle6/walker.py +++ b/uncompyle6/walker.py @@ -45,19 +45,17 @@ from __future__ import print_function import sys, re +from uncompyle6.spark import GenericASTTraversal +from uncompyle6.dparser import AST +from uncompyle6.scanner import Token, Code + if (sys.version_info >= (3, 0)): from io import StringIO import uncompyle6 - from .spark import GenericASTTraversal - from .dparser import AST - from .scanner import Token, Code minint = -sys.maxsize-1 maxint = sys.maxsize else: from StringIO import StringIO - from spark import GenericASTTraversal - from dparser import AST - from scanner import Token, Code minint = -sys.maxint-1 maxint = sys.maxint