-=[ Mr. Bumblebee ]=-
_Indonesia_

Path : /usr/lib/python2.7/dist-packages/bzrlib/transport/
File Upload :
Current File : //usr/lib/python2.7/dist-packages/bzrlib/transport/memory.pyc

ó
î:ïNc@@sdZddlmZddlZddlZddlmZmZddlm	Z	ddl
mZmZddl
mZmZmZmZddlmZmZmZd	efd
„ƒYZdejfd„ƒYZd
efd„ƒYZdejfd„ƒYZd„ZdS(s±Implementation of Transport that uses memory for its storage.

The contents of the transport will be lost when the object is discarded,
so this is primarily useful for testing.
i(tabsolute_importN(tS_IFREGtS_IFDIR(tStringIO(t	transportturlutils(t
FileExistst	LockErrortInProcessTransportt
NoSuchFile(tAppendBasedFileStreamt
_file_streamst
LateReadErrort
MemoryStatcB@seZd„ZRS(cC@sZ||_|s4|dkr$d}nt|B|_n"|dkrId}nt|B|_dS(Ni¤ií(tst_sizetNoneRtst_modeR(tselftsizetis_dirtperms((s;/usr/lib/python2.7/dist-packages/bzrlib/transport/memory.pyt__init__2s			(t__name__t
__module__R(((s;/usr/lib/python2.7/dist-packages/bzrlib/transport/memory.pyR
0stMemoryTransportcB@sÝeZdZdd„Zdd„Zd„Zdd„Zd„Zd„Z	d„Z
d	„Zd
„Zdd„Z
dd„Zdd
„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„ZRS(s<This is an in memory file system for transient data storage.tcC@s›|dkrd}n|ddkr2|d}ntt|ƒj|ƒ|jdƒd}|| |_|||_idd6|_i|_i|_	dS(s/Set the 'base' path where files will be stored.Rs
memory:///iÿÿÿÿt/t:iN(
tsuperRRtfindt_schemet_cwdRt_dirst_filest_locks(Rturltsplit((s;/usr/lib/python2.7/dist-packages/bzrlib/transport/memory.pyRAs	


	cC@s‹tjj|j|ƒ}t|ƒdks:|ddkrG|d7}n|j|}|j|ƒ}|j|_|j|_|j	|_	|S(sSee Transport.clone().iiÿÿÿÿR(
RtURLt_combine_pathsRtlenRt	__class__R R!R"(RtoffsettpathR#tresult((s;/usr/lib/python2.7/dist-packages/bzrlib/transport/memory.pytclonePs"

cC@s=|j|ƒ}|jjdƒdkr.|jS|jd SdS(sSee Transport.abspath().RiiÿÿÿÿN(R,tbasetcount(Rtrelpathttemp_t((s;/usr/lib/python2.7/dist-packages/bzrlib/transport/memory.pytabspath\scC@ss|j|ƒ}|j|ƒ|jj|dƒ\}}|dkrL|}n||jƒ|f|j|<t|ƒS(sSee Transport.append_file().RN(RN(t_abspatht
_check_parentR!tgetRtreadR'(RR/tftmodeR2torig_contentt	orig_mode((s;/usr/lib/python2.7/dist-packages/bzrlib/transport/memory.pytappend_filegs
	cC@sCtjj|ƒ}|dkr?||jkr?t|ƒ‚q?ndS(NR(tosR*tdirnameR R	(RR2tdir((s;/usr/lib/python2.7/dist-packages/bzrlib/transport/memory.pyR3qscC@s+|j|ƒ}||jkp*||jkS(sSee Transport.has().(R2R!R (RR/R2((s;/usr/lib/python2.7/dist-packages/bzrlib/transport/memory.pythaswscC@s;|j|ƒ}||jkr-t|ƒ‚n|j|=dS(sSee Transport.delete().N(R2R!R	(RR/R2((s;/usr/lib/python2.7/dist-packages/bzrlib/transport/memory.pytdelete|scC@st|ƒ‚dS(s,See bzrlib.transport.Transport.external_url.N(R(R((s;/usr/lib/python2.7/dist-packages/bzrlib/transport/memory.pytexternal_urlƒscC@s[|j|ƒ}||jkrF||jkr7t|ƒSt|ƒ‚nt|j|dƒS(sSee Transport.get().i(R2R!R RR	R(RR/R2((s;/usr/lib/python2.7/dist-packages/bzrlib/transport/memory.pyR4‰s
cC@sr|j|ƒ}|j|ƒ|jƒ}t|ƒtk	rUtd|dddƒ‚n||f|j|<t|ƒS(sSee Transport.put_file().t	undefinediis4put_file must be given a file of bytes, not unicode.(R2R3R5ttypetstrtUnicodeEncodeErrorR!R'(RR/R6R7R2tbytes((s;/usr/lib/python2.7/dist-packages/bzrlib/transport/memory.pytput_file“s
cC@sK|j|ƒ}|j|ƒ||jkr:t|ƒ‚n||j|<dS(sSee Transport.mkdir().N(R2R3R R(RR/R7R2((s;/usr/lib/python2.7/dist-packages/bzrlib/transport/memory.pytmkdir¡s

cC@s9|j|d|ƒt||ƒ}|t|j|ƒ<|S(s See Transport.open_write_stream.R(t	put_bytesR
RR1(RR/R7R+((s;/usr/lib/python2.7/dist-packages/bzrlib/transport/memory.pytopen_write_stream©scC@stS(sSee Transport.listable.(tTrue(R((s;/usr/lib/python2.7/dist-packages/bzrlib/transport/memory.pytlistable°scc@sHxA|jD]6}|j|jƒr
tj|t|jƒƒVq
q
WdS(N(R!t
startswithRRtescapeR'(Rtfile((s;/usr/lib/python2.7/dist-packages/bzrlib/transport/memory.pytiter_files_recursive´scC@sÝ|j|ƒ}|dkr9||jkr9t|ƒ‚ng}|jdƒs[|d7}nxo|j|jfD][}xR|D]J}|j|ƒr{|t|ƒ}|rÅd|krÅ|j|ƒqÅq{q{WqnWtt	j
|ƒS(sSee Transport.list_dir().R(R2R R	tendswithR!RLR'tappendtmapRRM(RR/R2R+t
path_groupR*ttrailing((s;/usr/lib/python2.7/dist-packages/bzrlib/transport/memory.pytlist_dir¹s

c@s]|j|ƒ‰|j|ƒ‰‡‡fd†‰‡fd†}||jƒ||jƒdS(s:Rename a file or directory; fail if the destination existsc@sC|ˆkrˆ}n*|jˆdƒr?ˆ|tˆƒ}n|S(NR(RLR'(tx(tabs_fromtabs_to(s;/usr/lib/python2.7/dist-packages/bzrlib/transport/memory.pytreplaceÏs
	c@s`xY|D]Q}ˆ|ƒ}||kr||kr@t|ƒ‚n||||<||=qqWdS(N(R(t	containerR*tnew_path(RY(s;/usr/lib/python2.7/dist-packages/bzrlib/transport/memory.pyt
do_renamesÕs
N(R2R!R (Rtrel_fromtrel_toR\((RWRXRYs;/usr/lib/python2.7/dist-packages/bzrlib/transport/memory.pytrenameËs
cC@s|j|ƒ}||jkr=|jttj|ƒ|ƒnxC|jD]8}|j|dƒrG|jttj|ƒ|ƒqGqGWxO|jD]D}|j|dƒr||kr|jttj|ƒ|ƒqqW||jkrót	|ƒ‚n|j|=dS(sSee Transport.rmdir.RN(
R2R!t_translate_errortIOErrorterrnotENOTDIRRLt	ENOTEMPTYR R	(RR/R2R*((s;/usr/lib/python2.7/dist-packages/bzrlib/transport/memory.pytrmdiràs#cC@s€|j|ƒ}||jkrJtt|j|dƒt|j|dƒS||jkrptdt|j|ƒSt|ƒ‚dS(sSee Transport.stat().iiN(R2R!R
R'tFalseR RJR	(RR/R2((s;/usr/lib/python2.7/dist-packages/bzrlib/transport/memory.pytstatðscC@st|j|ƒ|ƒS(sSee Transport.lock_read().(t_MemoryLockR2(RR/((s;/usr/lib/python2.7/dist-packages/bzrlib/transport/memory.pyt	lock_readûscC@st|j|ƒ|ƒS(sSee Transport.lock_write().(RhR2(RR/((s;/usr/lib/python2.7/dist-packages/bzrlib/transport/memory.pyt
lock_writeÿscC@sÓtj|ƒ}|d dkr#|S|jjdƒ}|jdƒ}g}xu||D]i}|dkr–|s‰td||jfƒ‚n|d }qU|dks¾|dkr±qU|j|ƒqUWddj|ƒS(s#Generate an internal absolute path.iRs..sillegal relpath %r under %riÿÿÿÿt.R(RtunescapeRR$t
ValueErrorRQtjoin(RR/t	cwd_partst	rel_partstrti((s;/usr/lib/python2.7/dist-packages/bzrlib/transport/memory.pyR2s 
N(RRt__doc__RRR,R1R:R3R>R?R@R4RFRGRIRKRORUR_ReRgRiRjR2(((s;/usr/lib/python2.7/dist-packages/bzrlib/transport/memory.pyR>s,	
					
								RhcB@s eZdZd„Zd„ZRS(sThis makes a lock.cC@sW||_||_|j|jjkr@td|jfƒ‚n||jj|j<dS(NsFile %r already locked(R*RR"R(RR*R((s;/usr/lib/python2.7/dist-packages/bzrlib/transport/memory.pyRs
		cC@s|jj|j=d|_dS(N(RR"R*R(R((s;/usr/lib/python2.7/dist-packages/bzrlib/transport/memory.pytunlock"s(RRRsRRt(((s;/usr/lib/python2.7/dist-packages/bzrlib/transport/memory.pyRhs	tMemoryServercB@s2eZdZd„Zd„Zd„Zd„ZRS(s0Server for the MemoryTransport for testing with.c@sgidd6ˆ_iˆ_iˆ_dtˆƒˆ_‡fd†}|ˆ_tjˆjˆjƒdS(NRs
memory+%s:///c@sGddlm}|j|ƒ}ˆj|_ˆj|_ˆj|_|S(Ni(tmemory(tbzrlib.transportRvRR R!R"(R#RvR+(R(s;/usr/lib/python2.7/dist-packages/bzrlib/transport/memory.pytmemory_factory/s(	RR R!R"tidRt_memory_factoryRtregister_transport(RRx((Rs;/usr/lib/python2.7/dist-packages/bzrlib/transport/memory.pytstart_server*s			cC@stj|j|jƒdS(N(Rtunregister_transportRRz(R((s;/usr/lib/python2.7/dist-packages/bzrlib/transport/memory.pytstop_server9scC@s|jS(s$See bzrlib.transport.Server.get_url.(R(R((s;/usr/lib/python2.7/dist-packages/bzrlib/transport/memory.pytget_url=scC@s
t‚dS(N(tNotImplementedError(R((s;/usr/lib/python2.7/dist-packages/bzrlib/transport/memory.pyt
get_bogus_urlAs(RRRsR|R~RR(((s;/usr/lib/python2.7/dist-packages/bzrlib/transport/memory.pyRu's
			cC@s
ttfgS(s.Return the permutations to be used in testing.(RRu(((s;/usr/lib/python2.7/dist-packages/bzrlib/transport/memory.pytget_test_permutationsEs(Rst
__future__RR;RbRgRRt	cStringIORtbzrlibRRt
bzrlib.errorsRRRR	RwR
RRtobjectR
t	TransportRRhtServerRuR‚(((s;/usr/lib/python2.7/dist-packages/bzrlib/transport/memory.pyt<module>s"Ú

Copyright © 2017 || Recoded By Mr.Bumblebee