config root man

Current Path : /compat/linux/proc/self/root/usr/local/lib/python2.5/test/

FreeBSD hs32.drive.ne.jp 9.1-RELEASE FreeBSD 9.1-RELEASE #1: Wed Jan 14 12:18:08 JST 2015 root@hs32.drive.ne.jp:/sys/amd64/compile/hs32 amd64
Upload File :
Current File : //compat/linux/proc/self/root/usr/local/lib/python2.5/test/test_itertools.pyc

³ò
h”Rc@s'ddkZddklZddkTddklZddkZddkZddkZei	Z
e
dZd„Zd„Z
d„Zd	„Zd
„Zdfd„ƒYZd
„Zdeifd„ƒYZdeifd„ƒYZd„Zdfd„ƒYZdfd„ƒYZdfd„ƒYZdfd„ƒYZdfd„ƒYZdfd„ƒYZdfd „ƒYZd!„Zd"eifd#„ƒYZd$eifd%„ƒYZ d&eifd'„ƒYZ!d(eifd)„ƒYZ"d*Z#he#d+<Z$e%d,„Z&e'd-joe&d.e(ƒndS(/iÿÿÿÿN(ttest_support(t*(tproxyicCsd|S(sTest function of one argumenti((tx((s//usr/local/lib/python2.5/test/test_itertools.pytoneargscGs
t‚dS(s"Test function that raises an errorN(t
ValueError(targs((s//usr/local/lib/python2.5/test/test_itertools.pyterrfuncsccsxdD]}|VqWdS(sNon-restartable source sequenceiiiN(iii((ti((s//usr/local/lib/python2.5/test/test_itertools.pytgen3scCs|ddjS(sTest predicateii((R((s//usr/local/lib/python2.5/test/test_itertools.pytisEvenscCs|ddjS(sTest predicateii((R((s//usr/local/lib/python2.5/test/test_itertools.pytisOddstStopNowcBs eZdZd„Zd„ZRS(s"Class emulating an empty iterable.cCs|S(N((tself((s//usr/local/lib/python2.5/test/test_itertools.pyt__iter__"scCs
t‚dS(N(t
StopIteration(R
((s//usr/local/lib/python2.5/test/test_itertools.pytnext$s(t__name__t
__module__t__doc__RR(((s//usr/local/lib/python2.5/test/test_itertools.pyR s	cCstt||ƒƒS(sHConvenience function for partially consuming a long of infinite iterable(tlisttislice(tntseq((s//usr/local/lib/python2.5/test/test_itertools.pyttake'stTestBasicOpscBseZd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Z	d„Z
d	„Zd
„Zd„Z
d„Zd
„Zd„ZRS(cCs¥|ittddƒƒtdƒƒ|ittdƒƒtdƒƒ|ittdƒƒgƒ|itdtddƒƒtdƒƒ|ittddƒdS(	Ntabctdeftabcdeftitabcdii(tassertEqualRtchainRtassertRaisest	TypeError(R
((s//usr/local/lib/python2.5/test/test_itertools.pyt
test_chain,s
%"(cCsR|itdtƒƒdddgƒ|itdtdƒƒdddgƒ|itdtdtdƒƒƒddgƒ|ittddƒ|ittdƒ|ittttt	d
ƒdƒƒtdƒ}|it
|ƒdƒ|iƒ|it
|ƒd
ƒtdƒ}|it
|ƒdƒ|iƒ|i|iƒdƒdS(NRtaitbitciiiii
scount(3)scount(4)i÷ÿÿÿs	count(-9)iøÿÿÿ(R$i(R%i(R&i(R$i(R%i(R&i(R$i(R%i(RtziptcountRR!R"t
OverflowErrorRRtmaxsizetreprR(R
R&((s//usr/local/lib/python2.5/test/test_itertools.pyt
test_count3s%(.&

cCs®|itdtdƒƒtdƒƒ|ittdƒƒgƒ|ittƒ|ittdƒ|ittttƒƒdƒƒddddddddddg
ƒdS(	Ni
Rt
abcabcabcaRiiii(RRtcycleRR!R"RR	(R
((s//usr/local/lib/python2.5/test/test_itertools.pyt
test_cycleCs
%cs÷|igttgƒƒƒ|igttgdtƒƒƒ|itttdgƒƒ|ittdƒ|ittdd„dƒd(d)d*d+d,d-d.d/g}g}xRt|d„ƒD]>\}}x/|D]'}|i||dƒ|i|ƒqÓWqÀW|i||ƒg}x‰t|d„ƒD]u\}}xft|d„ƒD]R\}}xC|D];}|i||dƒ|i||dƒ|i|ƒq]WqJWq+W|i||ƒg}t|d„ƒD]\}}||qË~}	tg}
|D]}|
|dqõ~
ƒ}|it|	ƒ|ƒ|it	|	ƒt	|ƒƒd}g}
tt
|ƒƒD]\}}|
|qa~
}|i|dddddgƒg}tt
|ƒƒD]0\}}tt|d
dƒƒo||q³q³~}|i|dddgƒg}tt
|ƒƒD]%\}}|t	t|ƒƒ|fq~}|i|d0d1d2d3d4gƒt
g}tt
|ƒƒD]%\}}|t	t|ƒƒ|fqƒ~dtƒd }|i|d5d6d7gƒd t
fd!„ƒY‰d‡fd"†}dtd#„}|iˆ||dƒƒ|iˆ||d
ƒƒd$d8‡fd%†ƒY}|ƒ|ƒdg}|iˆ||d&tƒ|iˆ||ƒ‡‡fd'†‰dˆ_|iˆ|dgˆƒd
ˆ_|iˆ|ddgˆƒdS(9NtkeyRcSs|S(((R((s//usr/local/lib/python2.5/test/test_itertools.pyt<lambda>Psi
iiiiiii
iiiiiiiicSs|dS(i((tr((s//usr/local/lib/python2.5/test/test_itertools.pyR1VscSs|dS(i((R2((s//usr/local/lib/python2.5/test/test_itertools.pyR1^scSs|dS(i((R2((s//usr/local/lib/python2.5/test/test_itertools.pyR1_scSs|dS(i((R2((s//usr/local/lib/python2.5/test/test_itertools.pyR1gstabracadabraR$R%R&tdR2itreverset
ExpectedErrorcBseZRS((RR(((s//usr/local/lib/python2.5/test/test_itertools.pyR6|sc3s&xt|ƒD]}dVq
Wˆ‚dS(Ntyo(trange(RR(R6(s//usr/local/lib/python2.5/test/test_itertools.pyt
delayed_raise~s
	cSs4g}t||ƒD]\}}|||ƒq~S(N(tgroupby(titerabletkeyptfunct_[1]tktg((s//usr/local/lib/python2.5/test/test_itertools.pytgulp‚stDummyCmpcseZ‡fd†ZRS(cs
ˆ‚dS(N((R
tdst(R6(s//usr/local/lib/python2.5/test/test_itertools.pyt__cmp__Œs(RRRD((R6(s//usr/local/lib/python2.5/test/test_itertools.pyRB‹sR=cs1ˆidjoˆid8_|Snˆ‚dS(Nii(tskip(tobj(tkeyfuncR6(s//usr/local/lib/python2.5/test/test_itertools.pyRG–s(ii
i(iii(iii(ii
i(iii(iii(iii(iii(iR$(iR%(iR&(iR4(iR2(iR$(iR2(iR%((RRR:tidR!R"tNonetappendtsettlentsortedRtTruet	ExceptionRE(R
tstdupR?R@telemtiktigR>tkeyst_[2]R2texpectedkeyst_[3]t_[4]t_[5]t_[6]R9RARB((RGR6s//usr/local/lib/python2.5/test/test_itertools.pyttest_groupbyJsj"3+3PEU		c	Cs|ittttdƒƒƒdddgƒ|ittddddddgƒƒddgƒ|itdtttƒƒƒddddgƒ|it	tƒ|it	td„ƒ|it	td„tdƒdƒ|it	ttd	ƒ|it	ttdƒtdƒƒi
ƒdS(
NiiiiicSs|S(((R((s//usr/local/lib/python2.5/test/test_itertools.pyR1¨scSs|S(((R((s//usr/local/lib/python2.5/test/test_itertools.pyR1©sii(RRtifilterR
R8RIRR(R!R"R(R
((s//usr/local/lib/python2.5/test/test_itertools.pyttest_ifilter£s.41"c	Cs |ittttdƒƒƒdddgƒ|ittddddddgƒƒdddgƒ|itdtttƒƒƒddddgƒ|it	tƒ|it	td	„ƒ|it	td
„tdƒdƒ|it	ttdƒ|it	ttdƒtdƒƒi
ƒdS(NiiiiiiiicSs|S(((R((s//usr/local/lib/python2.5/test/test_itertools.pyR1²scSs|S(((R((s//usr/local/lib/python2.5/test/test_itertools.pyR1³s(RRtifilterfalseR
R8RIRR(R!R"R(R
((s//usr/local/lib/python2.5/test/test_itertools.pyttest_ifilterfalse­s.71"c	Cs\g}tdtƒƒD]\}}|||fq~}|i|dd
dgƒ|ittdtdƒƒƒtdtdƒƒƒ|ittd	td
ƒƒƒtd	td
ƒƒƒ|itd
td	tƒƒƒtd	td
ƒƒƒ|ittd	ƒƒtd	ƒƒ|ittƒƒtƒƒ|ittd
ƒ|itttd
ƒd
ƒ|ig}tddƒD]}|t	t|ƒƒqu~tddƒƒ|ig}tddƒD]
}||q¾~tddƒƒt
ttddƒƒ}|it|ƒt
|ƒƒt
tttddƒƒƒ}|itti|ƒƒt|ƒƒdS(NRR$iR%iR&iiRiR(R$i(R%i(R&i(tizipR(RRR8R'RR!R"ttupletmapRHtmintmaxRLtdicttfromkeys(	R
R>RtytansRVtpairRXtids((s//usr/local/lib/python2.5/test/test_itertools.pyt	test_izip·s"9444"9-cCsf|ittdƒtdƒƒd
ddgƒ|ittddƒƒdddgƒ|itdtdƒƒdddgƒ|ittddƒƒgƒ|ittddƒƒgƒ|ittƒ|ittdddƒ|ittddƒtdƒ}|it	|ƒd	ƒtdd
ƒ}|it	|ƒdƒt|ƒ|it	|ƒdƒdS(NiR$iiiiýÿÿÿiysrepeat((1+0j))isrepeat((1+0j), 5)srepeat((1+0j), 0)(iR$(iR$(iR$yð?yð?(
RR'txrangetrepeatRRR!R"RIR+(R
R2((s//usr/local/lib/python2.5/test/test_itertools.pyttest_repeatËs((
cCs‚|itttitdƒtddƒƒƒd
ddgƒ|ittddtdƒƒƒdddgƒ|ittddtƒƒƒdddgƒ|itdtddtƒƒƒddgƒ|itttigƒƒgƒ|i	t
tƒ|i	t
ttiƒ|i	t
tdtdƒƒiƒ|i	t
ttdgdgƒiƒ|i	t
ttdgdgƒiƒdS(NiiiiiRiR$R%R&i
iiii(R$i(R%i(R&i(R$i(R%i(R&i(R$i(R%i(RRtimaptoperatortpowR8RIR(RR!R"tnegRRRR(R
((s//usr/local/lib/python2.5/test/test_itertools.pyt	test_imapÜs-!!
""%c	Cs]|itttittdƒtddƒƒƒƒd
ddgƒ|itdttitt	ƒt	dƒƒƒƒd
ddgƒ|itttigƒƒgƒ|i
ttttiddggƒƒ|i
ttƒ|i
tttidgdƒ|i
ttd	dgƒiƒ|i
t
ttdgƒiƒ|i
tttdgƒiƒdS(Niiiiiiitextrai
iiiiii(ii(ii(ii(ii(RRtstarmapRqRrR'R8RRaR(R!R"RRRR(R
((s//usr/local/lib/python2.5/test/test_itertools.pyttest_starmapìs30"(cCs†xHd
ddddgD]1}|itttdƒ|Œƒt|ŒƒqWxZddfddfddfgD]7\}}|itttdƒ|Œƒt|ŒƒqmW|itttdƒdƒƒtdƒƒ|itttdƒddƒƒtdƒƒ|itttdƒdddƒƒtdƒƒ|itttdƒddƒƒtddƒƒ|itttdƒdddƒƒtdddƒƒttdƒƒ}|itt|dƒƒtdƒƒ|it|ƒtddƒƒ|itttdƒƒ|itttdƒddddƒ|it	ttdƒd	ddƒ|it	ttdƒdd	d
ƒ|it	ttdƒddd
ƒ|it	ttdƒdddƒ|it	ttdƒdƒ|it	ttdƒddƒ|it	ttdƒddƒ|it	ttdƒdddƒ|it	ttdƒdddƒ|it
tttƒddtƒƒƒdƒdS(Ni
iiidiniiiiûÿÿÿiÿÿÿÿiR$(i
ii(i
ii(i
i(i
i(i(i
ini(i
idi(i
in(i
id(in(id(
RRRRmR8RItiterR!R"RRLR(R*(R
Rttgtargstit((s//usr/local/lib/python2.5/test/test_itertools.pyttest_isliceùsD/		
/+.117%%""""""cCsHddddddddg}d	„}|itt||ƒƒdddgƒ|itt|gƒƒgƒ|ittƒ|itttiƒ|itttid
gd
ƒ|ittddgƒiƒ|ittt	dgƒiƒtt
ddddddgƒ}|it|ƒdddgƒ|it|iƒdS(NiiiiiiiicSs
|djS(i
((R((s//usr/local/lib/python2.5/test/test_itertools.pyR1&sRui
i(ii(ii(ii(RRt	takewhileR!R"RqRrRRRtboolR(R
tdatatundertentt((s//usr/local/lib/python2.5/test/test_itertools.pyttest_takewhile$s	(!cCsûddddddddg}d	„}|itt||ƒƒdddddgƒ|itt|gƒƒgƒ|ittƒ|itttiƒ|itttidgd
ƒ|ittdd
gƒiƒ|ittt	dgƒiƒdS(NiiiiiiiicSs
|djS(i
((R((s//usr/local/lib/python2.5/test/test_itertools.pyR14sRui
(ii(ii(ii(
RRt	dropwhileR!R"RqRrRRR(R
R~R((s//usr/local/lib/python2.5/test/test_itertools.pyttest_dropwhile2s	.cCs©d}d„}tgƒ\}}|it|ƒgƒ|it|ƒgƒt||ƒƒ\}}|it||ƒtt|ƒt|ƒƒƒt||ƒƒ\}}|it|ƒt|ƒƒ|it|ƒt|ƒƒt||ƒƒ\}}x*tdƒD]}|i|iƒ|ƒqW~|it|ƒt|ƒƒt||ƒƒ\}}x*tdƒD]}|i|iƒ|ƒqlW~|it|ƒtd|ƒƒx½tdƒD]¯}dg|dg|}ti|ƒggf}t||ƒƒ}	x/|D]'}|	|iƒ}
||i	|
ƒqW|i|dt|ƒƒ|i|dt|ƒƒq»W|i
ttƒ|i
ttdƒ|i
ttddgd	ƒ|i
ttddgdd	ƒtd
ƒ\}}t|ƒdƒ}|it|ƒtdƒƒttdƒdƒ\}}}x*tdƒD]}|i|iƒ|ƒq7W|it|ƒtdƒƒ|i|iƒ|iƒgtdƒƒ|it|ƒtddƒƒ|it|ƒtddƒƒ|i
ttd
d
ƒ|i
t
tgdƒxutdƒD]g}td
|ƒ}|it|ƒtƒ|it|ƒ|ƒ|itt|ƒtd
ƒg|ƒqWtd
ƒ\}}t|ƒ\}}
|i||jƒtd
ƒ\}}t|ƒ}|i
t|ƒ|i
t|dƒ||ƒ}|it|ƒt|ƒjo"t|ƒjotd
ƒjnƒttdƒƒ\}}t|ƒ}|it|dƒt|ƒƒ~|i
tt|dƒdS(NiÈcss xt|ƒD]}|Vq
WdS(N(Rm(RR((s//usr/local/lib/python2.5/test/test_itertools.pytirange?s
idiiiiiRRRiÐtinvalidiÿÿÿÿi
t	__class__(tteeRRR'R8RmRtrandomtshuffleRJR!R"ttypeRRbRLRctassert_RtgetattrtReferenceError(R
RR„R$R%RtjtordertliststitstvalueR&tresultR4tt1tt2ttnewtt3tp((s//usr/local/lib/python2.5/test/test_itertools.pyttest_tee=sŽ	.




(
*HcCsš|ittƒiƒxOttttfD];}|it|gƒiƒ|it|tƒƒiƒq)W|ittgdƒiƒ|itttƒdƒiƒt
gƒ\}}|it|iƒ|it|iƒt
tƒƒ\}}|it|iƒ|it|iƒ|ittddƒiƒxatt
ttttfD]G}|it|d„gƒiƒ|it|d„tƒƒiƒqKWdS(NicSs|S(((R((s//usr/local/lib/python2.5/test/test_itertools.pyR1ªscSs|S(((R((s//usr/local/lib/python2.5/test/test_itertools.pyR1«s(R!RRaRR R.R:RRRIR‡RnR]R_RpR|R‚Rv(R
tfR˜tq((s//usr/local/lib/python2.5/test/test_itertools.pyttest_StopIteration–s$ (RRR#R,R/R\R^R`RlRoRtRwR{RRƒR™Rœ(((s//usr/local/lib/python2.5/test/test_itertools.pyR+s				Y	
	
				
	+			YtTestGCcBs†eZd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Z	d„Z
d	„Zd
„Zd„Z
d„Zd
„ZRS(cCs!|i|ƒ|iƒ~~dS(N(RJR(R
titeratort	container((s//usr/local/lib/python2.5/test/test_itertools.pyt	makecycle¯s

cCs g}|it|ƒ|ƒdS(N(R R (R
R$((s//usr/local/lib/python2.5/test/test_itertools.pyR#´scCs'g}|it|gdƒ|ƒdS(Ni(R R.(R
R$((s//usr/local/lib/python2.5/test/test_itertools.pyR/¸scCs,g}|ittd||gƒ|ƒdS(Ni(R R‚R}(R
R$((s//usr/local/lib/python2.5/test/test_itertools.pyRƒ¼scCs-g}|it|gdd„ƒ|ƒdS(NicSs|S(((R((s//usr/local/lib/python2.5/test/test_itertools.pyR1Âs(R R:(R
R$((s//usr/local/lib/python2.5/test/test_itertools.pyR\ÀscCsXd}d„}xBtt|ƒd|ƒD](\}}|iidgƒi|ƒq(WdS(Ni
cSs|S(((R((s//usr/local/lib/python2.5/test/test_itertools.pyR1ÇsR0R(R:Rmt__dict__t
setdefaultRJ(R
RRGRRŽ((s//usr/local/lib/python2.5/test/test_itertools.pyttest_issue2246Äs
	cCs-g}|itd„|gdƒ|ƒdS(NcSstS((RN(R((s//usr/local/lib/python2.5/test/test_itertools.pyR1Ísi(R R](R
R$((s//usr/local/lib/python2.5/test/test_itertools.pyR^ËscCs&g}|itd„|ƒ|ƒdS(NcSstS((tFalse(R((s//usr/local/lib/python2.5/test/test_itertools.pyR1Ñs(R R_(R
R$((s//usr/local/lib/python2.5/test/test_itertools.pyR`ÏscCs1g}|it|gd|gdƒ|ƒdS(Nii(R Ra(R
R$((s//usr/local/lib/python2.5/test/test_itertools.pyRlÓscCs-g}|itd„|gdƒ|ƒdS(NcSs|S(((R((s//usr/local/lib/python2.5/test/test_itertools.pyR1Ùsi(R Rp(R
R$((s//usr/local/lib/python2.5/test/test_itertools.pyRt×scCs*g}|it|gddƒ|ƒdS(Ni(R RRI(R
R$((s//usr/local/lib/python2.5/test/test_itertools.pyR{ÛscCs g}|it|ƒ|ƒdS(N(R Rn(R
R$((s//usr/local/lib/python2.5/test/test_itertools.pyRoßscCs3g}|itd„||fgdƒ|ƒdS(NcWs|S(((R€((s//usr/local/lib/python2.5/test/test_itertools.pyR1åsi(R Rv(R
R$((s//usr/local/lib/python2.5/test/test_itertools.pyRwãscCs/g}|ittdd||gƒ|ƒdS(Nii(R R|R}(R
R$((s//usr/local/lib/python2.5/test/test_itertools.pyRçs(RRR R#R/RƒR\R£R^R`RlRtR{RoRwR(((s//usr/local/lib/python2.5/test/test_itertools.pyR­s													ccsx|D]}|VqWdS(sRegular generatorN((tseqnR((s//usr/local/lib/python2.5/test/test_itertools.pytRëstGcBs eZdZd„Zd„ZRS(sSequence using __getitem__cCs
||_dS(N(R¥(R
R¥((s//usr/local/lib/python2.5/test/test_itertools.pyt__init__òscCs|i|S(N(R¥(R
R((s//usr/local/lib/python2.5/test/test_itertools.pyt__getitem__ôs(RRRR¨R©(((s//usr/local/lib/python2.5/test/test_itertools.pyR§ðs	tIcBs)eZdZd„Zd„Zd„ZRS(s Sequence using iterator protocolcCs||_d|_dS(Ni(R¥R(R
R¥((s//usr/local/lib/python2.5/test/test_itertools.pyR¨ùs	cCs|S(N((R
((s//usr/local/lib/python2.5/test/test_itertools.pyRüscCsF|it|iƒjo
t‚n|i|i}|id7_|S(Ni(RRLR¥R(R
tv((s//usr/local/lib/python2.5/test/test_itertools.pyRþs

(RRRR¨RR(((s//usr/local/lib/python2.5/test/test_itertools.pyRª÷s		tIgcBs eZdZd„Zd„ZRS(s9Sequence using iterator protocol defined with a generatorcCs||_d|_dS(Ni(R¥R(R
R¥((s//usr/local/lib/python2.5/test/test_itertools.pyR¨s	ccsx|iD]}|Vq
WdS(N(R¥(R
tval((s//usr/local/lib/python2.5/test/test_itertools.pyR	s
(RRRR¨R(((s//usr/local/lib/python2.5/test/test_itertools.pyR¬s	tXcBs eZdZd„Zd„ZRS(s Missing __getitem__ and __iter__cCs||_d|_dS(Ni(R¥R(R
R¥((s//usr/local/lib/python2.5/test/test_itertools.pyR¨s	cCsF|it|iƒjo
t‚n|i|i}|id7_|S(Ni(RRLR¥R(R
R«((s//usr/local/lib/python2.5/test/test_itertools.pyRs

(RRRR¨R(((s//usr/local/lib/python2.5/test/test_itertools.pyR®
s	tNcBs eZdZd„Zd„ZRS(sIterator missing next()cCs||_d|_dS(Ni(R¥R(R
R¥((s//usr/local/lib/python2.5/test/test_itertools.pyR¨s	cCs|S(N((R
((s//usr/local/lib/python2.5/test/test_itertools.pyRs(RRRR¨R(((s//usr/local/lib/python2.5/test/test_itertools.pyR¯s	tEcBs)eZdZd„Zd„Zd„ZRS(sTest propagation of exceptionscCs||_d|_dS(Ni(R¥R(R
R¥((s//usr/local/lib/python2.5/test/test_itertools.pyR¨"s	cCs|S(N((R
((s//usr/local/lib/python2.5/test/test_itertools.pyR%scCsdddS(Nii((R
((s//usr/local/lib/python2.5/test/test_itertools.pyR's(RRRR¨RR(((s//usr/local/lib/python2.5/test/test_itertools.pyR° s		tScBs)eZdZd„Zd„Zd„ZRS(sTest immediate stopcCsdS(N((R
R¥((s//usr/local/lib/python2.5/test/test_itertools.pyR¨,scCs|S(N((R
((s//usr/local/lib/python2.5/test/test_itertools.pyR.scCs
t‚dS(N(R(R
((s//usr/local/lib/python2.5/test/test_itertools.pyR0s(RRRR¨RR(((s//usr/local/lib/python2.5/test/test_itertools.pyR±*s		cCs(ttd„ttt|ƒƒƒƒƒS(s Test multiple tiers of iteratorscSs|S(((R((s//usr/local/lib/python2.5/test/test_itertools.pyR15s(R RpR¦R¬R§(R¥((s//usr/local/lib/python2.5/test/test_itertools.pytL3stTestVariousIteratorArgscBsteZd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Z	d„Z
d	„Zd
„Zd„Z
RS(c	Cs%xddtdƒd	tdddƒfD]õ}x•ttttttfD]{}|it	t
||ƒƒƒt	||ƒƒƒ|it	t
||ƒ||ƒƒƒt	||ƒƒt	||ƒƒƒqGW|itt
t
|ƒƒ|itt	t
t|ƒƒƒ|itt	t
t|ƒƒƒq(WdS(
Nt123Riètdog333333ó?iÐi˜i(Rµg333333ó?(R8RmR§RªR¬R±R²R¦RRR R!R"R®R¯tZeroDivisionErrorR°(R
RPR@((s//usr/local/lib/python2.5/test/test_itertools.pyR#:s(.Kc	Csxddtdƒd
tdddƒfD]×}xwttttttfD]]}t|ƒd	}t	||ƒƒd	}t	t
t||ƒƒ|ƒƒ}|i||ƒqGW|i
ttt|ƒƒ|i
tt	tt|ƒƒƒ|i
tt	tt|ƒƒƒq(WdS(NR´RièRµg333333ó?iÐi˜ii(sdog333333ó?(R8RmR§RªR¬R±R²R¦RLRRR.RR!R"R®R¯R¶R°(R
RPR@ttgtlentexpectedtactual((s//usr/local/lib/python2.5/test/test_itertools.pyR/Cs(!c	Csxþtdƒtdƒtdƒd	tdddƒfD]É}xittttttfD]O}|ig}t	||ƒƒD]\}}||qv~t
||ƒƒƒqSW|itt	t
|ƒƒ|itt
t	t|ƒƒƒ|itt
t	t|ƒƒƒq4WdS(
Ni
iièiiiÐi˜i(ii(R8RmR§RªR¬R±R²R¦RR:RR!R"R®R¯R¶R°(R
RPR@R>R?tsb((s//usr/local/lib/python2.5/test/test_itertools.pyR\Ns4Mc
Csùxòtdƒtdƒtdƒd	tdddƒfD]½}xTttttttfD]:}|it	t
t||ƒƒƒtt||ƒƒƒqSW|i
tt
tt|ƒƒ|i
tt	t
tt|ƒƒƒ|i
tt	t
tt|ƒƒƒq4WdS(
Ni
iièiiiÐi˜i(ii(R8RmR§RªR¬R±R²R¦RRR]R
tfilterR!R"R®R¯R¶R°(R
RPR@((s//usr/local/lib/python2.5/test/test_itertools.pyR^Vs48"c
Csùxòtdƒtdƒtdƒd	tdddƒfD]½}xTttttttfD]:}|it	t
t||ƒƒƒtt
||ƒƒƒqSW|itt
tt|ƒƒ|itt	t
tt|ƒƒƒ|itt	t
tt|ƒƒƒq4WdS(
Ni
iièiiiÐi˜i(ii(R8RmR§RªR¬R±R²R¦RRR_R
R»RR!R"R®R¯R¶R°(R
RPR@((s//usr/local/lib/python2.5/test/test_itertools.pyR`^s48"c	Csxddtdƒd	tdddƒfD]î}xŽttttttfD]t}|it	t
||ƒƒƒt||ƒƒƒ|it	t
||ƒ||ƒƒƒt||ƒ||ƒƒƒqGW|it
t
t|ƒƒ|it
t	t
t|ƒƒƒ|itt	t
t|ƒƒƒq(WdS(
NR´RièRµg333333ó?iÐi˜i(sdog333333ó?(R8RmR§RªR¬R±R²R¦RRRaR'R!R"R®R¯R¶R°(R
RPR@((s//usr/local/lib/python2.5/test/test_itertools.pyRlfs(.Dc
CsEx>tdƒtdƒtdƒd	tdddƒfD]	}x ttttttfD]†}|it	t
t||ƒƒƒtt||ƒƒƒ|it	t
t
i||ƒ||ƒƒƒtt
i||ƒ||ƒƒƒqSW|itt
tt|ƒƒ|itt	t
tt|ƒƒƒ|itt	t
tt|ƒƒƒq4WdS(
Ni
iidiiii2i(ii(R8RmR§RªR¬R±R²R¦RRRpRRcRqRrR!R"R®R¯R¶R°(R
RPR@((s//usr/local/lib/python2.5/test/test_itertools.pyRtos44P"c	CsýxöddtdƒdtdddƒfD]Í}xdttttttfD]J}|it	t
||ƒd	dd
ƒƒt	||ƒƒd	dd
…ƒqGW|it
t
t|ƒdƒ|it
t	t
t|ƒdƒƒ|itt	t
t|ƒdƒƒq(WdS(
Nt12345RièRµg333333ó?iÐi˜iiii
(sdog333333ó?(R8RmR§RªR¬R±R²R¦RRRRIR!R"R®R¯R¶R°(R
RPR@((s//usr/local/lib/python2.5/test/test_itertools.pyR{xs(H"c
Cs xtdƒtdƒtdƒd	tdddƒfD]ä}xrttttttfD]X}t||ƒ}|i	t
tti
||ƒƒƒtti
||ƒ||ƒƒƒqSW|ittti
t|ƒƒ|itt
tti
t|ƒƒƒ|itt
tti
t|ƒƒƒq4WdS(
Ni
iidiiii2i(ii(R8RmR§RªR¬R±R²R¦R'RRRvRqRrRcR!R"R®R¯R¶R°(R
RPR@tss((s//usr/local/lib/python2.5/test/test_itertools.pyRw€s4G%c
Cs&xtdƒtdƒtdƒd	tdddƒfD]ê}xttttttfD]g}g}x3||ƒD]%}t|ƒpPn|i	|ƒqlW|i
ttt||ƒƒƒ|ƒqSW|i
tttt|ƒƒ|i
ttttt|ƒƒƒ|i
ttttt|ƒƒƒq4WdS(
Ni
iièiiiÐi˜i(ii(R8RmR§RªR¬R±R²R¦R
RJRRR|R!R"R®R¯R¶R°(R
RPR@ttgtRR((s//usr/local/lib/python2.5/test/test_itertools.pyR‰s4

)"c
Cs0x)tdƒtdƒtdƒd	tdddƒfD]ô}x‹ttttttfD]q}g}x=||ƒD]/}|ot|ƒoqln|i	|ƒqlW|i
ttt||ƒƒƒ|ƒqSW|i
tttt|ƒƒ|i
ttttt|ƒƒƒ|i
ttttt|ƒƒƒq4WdS(
Ni
iièiiiÐi˜i(ii(R8RmR§RªR¬R±R²R¦RRJRRR‚R!R"R®R¯R¶R°(R
RPR@R¾RR((s//usr/local/lib/python2.5/test/test_itertools.pyRƒ•s4
)"c	Csx
ddtdƒd
tdddƒfD]ä}x|ttttttfD]b}t||ƒƒ\}}|i	t
|ƒt
||ƒƒƒ|i	t
|ƒt
||ƒƒƒqGW|ittt
|ƒƒ|itt
tt|ƒƒd	ƒ|itt
tt|ƒƒd	ƒq(WdS(NR´RièRµg333333ó?iÐi˜ii(sdog333333ó?(R8RmR§RªR¬R±R²R¦R‡RRR!R"R®R¯R¶R°(R
RPR@tit1tit2((s//usr/local/lib/python2.5/test/test_itertools.pyR™¡s("&#(RRR#R/R\R^R`RlRtR{RwRRƒR™(((s//usr/local/lib/python2.5/test/test_itertools.pyR³8s															tLengthTransparencycBseZd„ZRS(cCsLddkl}|i|tddƒƒdƒ|it|tdƒƒdS(Niÿÿÿÿ(RLi2(ttest.test_iterlenRLRRnRIR!R"(R
RL((s//usr/local/lib/python2.5/test/test_itertools.pyRo­s(RRRo(((s//usr/local/lib/python2.5/test/test_itertools.pyRÁ«stRegressionTestscBseZd„Zd„ZRS(csNd„}‡fd†}g‰|d	|d
ƒttƒ}|iˆ|ƒdS(Ncsmdg‡‡fd†}t|ƒ}t|ƒ|dd+t||ƒ}t|gt|ƒŒ‰ˆiƒdS(Nics#|o|2ˆˆiƒƒn|S(N(R(R’tfirst(Rštz(s//usr/local/lib/python2.5/test/test_itertools.pyR@»s(RRpRaRLR(ttuple1Ršttuple2R@titemstgen((RšRÅs//usr/local/lib/python2.5/test/test_itertools.pyt
mutatingtuple·scs|attƒˆ(dS(N(tTR(R€(RÄ(s//usr/local/lib/python2.5/test/test_itertools.pyRšÆsiiiiii(iii(iii(RRËR(R
RÊRštsecond((RÄs//usr/local/lib/python2.5/test/test_itertools.pyttest_sf_793826´s	c	s܇fd†}‡fd†}g‰|ittt|ƒ|tƒƒƒ|iˆddgƒg‰|ittt|ƒ|tƒƒƒ|iˆddgƒg‰|ittt|ƒƒƒ|iˆddgƒdS(Nc3s6ˆidƒdVˆidƒt‚ˆidƒdS(Niii(RJtAssertionError((thist(s//usr/local/lib/python2.5/test/test_itertools.pytgen1Õs


c3s4ˆidƒdVˆidƒ|o
t‚ndS(Niii(RJR(R(RÏ(s//usr/local/lib/python2.5/test/test_itertools.pytgen2Üs


ii(R!RÎRR R¤RRNR.(R
RÐRÑ((RÏs//usr/local/lib/python2.5/test/test_itertools.pyttest_sf_950057Ñs%%(RRRÍRÒ(((s//usr/local/lib/python2.5/test/test_itertools.pyRòs	tSubclassWithKwargsTestcBseZd„ZRS(cs•xŽtttttttttt	t
fD]e‰dˆf‡fd†ƒY}y|ddƒWq(tj
o#}|id|i
djƒq(Xq(WdS(NtSubclasscseZd‡fd†ZRS(csˆi||ŒdS(N(R¨(R
tnewargR(tcls(s//usr/local/lib/python2.5/test/test_itertools.pyR¨õsN(RRRIR¨((RÖ(s//usr/local/lib/python2.5/test/test_itertools.pyRÔôsRÕisdoes not take keyword argumentsi(RnRaR]R_R RpRvRR|R‚R.R"tfailIfR(R
RÔterr((RÖs//usr/local/lib/python2.5/test/test_itertools.pyttest_keywords_in_subclassðs(RRRÙ(((s//usr/local/lib/python2.5/test/test_itertools.pyRÓïss™ Doctest for examples in the library reference: libitertools.tex


>>> amounts = [120.15, 764.05, 823.14]
>>> for checknum, amount in izip(count(1200), amounts):
...     print 'Check %d is for $%.2f' % (checknum, amount)
...
Check 1200 is for $120.15
Check 1201 is for $764.05
Check 1202 is for $823.14

>>> import operator
>>> for cube in imap(operator.pow, xrange(1,4), repeat(3)):
...    print cube
...
1
8
27

>>> reportlines = ['EuroPython', 'Roster', '', 'alex', '', 'laura', '', 'martin', '', 'walter', '', 'samuele']
>>> for name in islice(reportlines, 3, None, 2):
...    print name.title()
...
Alex
Laura
Martin
Walter
Samuele

>>> from operator import itemgetter
>>> d = dict(a=1, b=2, c=1, d=2, e=1, f=2, g=3)
>>> di = sorted(sorted(d.iteritems()), key=itemgetter(1))
>>> for k, g in groupby(di, itemgetter(1)):
...     print k, map(itemgetter(0), g)
...
1 ['a', 'c', 'e']
2 ['b', 'd', 'f']
3 ['g']

# Find runs of consecutive numbers using groupby.  The key to the solution
# is differencing with a range so that consecutive numbers all appear in
# same group.
>>> data = [ 1,  4,5,6, 10, 15,16,17,18, 22, 25,26,27,28]
>>> for k, g in groupby(enumerate(data), lambda (i,x):i-x):
...     print map(operator.itemgetter(1), g)
...
[1]
[4, 5, 6]
[10]
[15, 16, 17, 18]
[22]
[25, 26, 27, 28]

>>> def take(n, seq):
...     return list(islice(seq, n))

>>> def enumerate(iterable):
...     return izip(count(), iterable)

>>> def tabulate(function):
...     "Return function(0), function(1), ..."
...     return imap(function, count())

>>> def iteritems(mapping):
...     return izip(mapping.iterkeys(), mapping.itervalues())

>>> def nth(iterable, n):
...     "Returns the nth item"
...     return list(islice(iterable, n, n+1))

>>> def all(seq, pred=None):
...     "Returns True if pred(x) is true for every element in the iterable"
...     for elem in ifilterfalse(pred, seq):
...         return False
...     return True

>>> def any(seq, pred=None):
...     "Returns True if pred(x) is true for at least one element in the iterable"
...     for elem in ifilter(pred, seq):
...         return True
...     return False

>>> def no(seq, pred=None):
...     "Returns True if pred(x) is false for every element in the iterable"
...     for elem in ifilter(pred, seq):
...         return False
...     return True

>>> def quantify(seq, pred=None):
...     "Count how many times the predicate is true in the sequence"
...     return sum(imap(pred, seq))

>>> def padnone(seq):
...     "Returns the sequence elements and then returns None indefinitely"
...     return chain(seq, repeat(None))

>>> def ncycles(seq, n):
...     "Returns the sequence elements n times"
...     return chain(*repeat(seq, n))

>>> def dotproduct(vec1, vec2):
...     return sum(imap(operator.mul, vec1, vec2))

>>> def flatten(listOfLists):
...     return list(chain(*listOfLists))

>>> def repeatfunc(func, times=None, *args):
...     "Repeat calls to func with specified arguments."
...     "   Example:  repeatfunc(random.random)"
...     if times is None:
...         return starmap(func, repeat(args))
...     else:
...         return starmap(func, repeat(args, times))

>>> def pairwise(iterable):
...     "s -> (s0,s1), (s1,s2), (s2, s3), ..."
...     a, b = tee(iterable)
...     try:
...         b.next()
...     except StopIteration:
...         pass
...     return izip(a, b)

This is not part of the examples but it tests to make sure the definitions
perform as purported.

>>> take(10, count())
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]

>>> list(enumerate('abc'))
[(0, 'a'), (1, 'b'), (2, 'c')]

>>> list(islice(tabulate(lambda x: 2*x), 4))
[0, 2, 4, 6]

>>> nth('abcde', 3)
['d']

>>> all([2, 4, 6, 8], lambda x: x%2==0)
True

>>> all([2, 3, 6, 8], lambda x: x%2==0)
False

>>> any([2, 4, 6, 8], lambda x: x%2==0)
True

>>> any([1, 3, 5, 9], lambda x: x%2==0,)
False

>>> no([1, 3, 5, 9], lambda x: x%2==0)
True

>>> no([1, 2, 5, 9], lambda x: x%2==0)
False

>>> quantify(xrange(99), lambda x: x%2==0)
50

>>> a = [[1, 2, 3], [4, 5, 6]]
>>> flatten(a)
[1, 2, 3, 4, 5, 6]

>>> list(repeatfunc(pow, 5, 2, 3))
[8, 8, 8, 8, 8]

>>> import random
>>> take(5, imap(int, repeatfunc(random.random)))
[0, 0, 0, 0, 0]

>>> list(pairwise('abcd'))
[('a', 'b'), ('b', 'c'), ('c', 'd')]

>>> list(pairwise([]))
[]

>>> list(pairwise('a'))
[]

>>> list(islice(padnone('abc'), 0, 6))
['a', 'b', 'c', None, None, None]

>>> list(ncycles('abc', 3))
['a', 'b', 'c', 'a', 'b', 'c', 'a', 'b', 'c']

>>> dotproduct([1,2,3], [4,5,6])
32

t
libreftestcCs½ttttttf}ti|Œ|ovtt	dƒofddk
}dgd}xAtt
|ƒƒD]-}ti|Œ|iƒt	iƒ||<qhW|GHntit	it|ƒdS(Ntgettotalrefcountiÿÿÿÿi(RR³RRÃRÁRÓRtrun_unittestthasattrtsystgcRIRmRLtcollectRÛtrun_doctesttmodulesR(tverbosettest_classesRßtcountsR((s//usr/local/lib/python2.5/test/test_itertools.pyt	test_main¾s		



	t__main__Rã()tunittestttestRt	itertoolstweakrefRRÞRqRˆtMAX_Py_ssize_tR*tminsizeRRR	R
RRRtTestCaseRRR¦R§RªR¬R®R¯R°R±R²R³RÁRÃRÓRÚt__test__RIRæRRN(((s//usr/local/lib/python2.5/test/test_itertools.pys<module>sH
							ÿƒ>	
	
		s=Ë


Man Man