ok

Mini Shell

Direktori : /proc/self/root/proc/self/root/proc/thread-self/root/lib/python2.7/site-packages/rhn/
Upload File :
Current File : //proc/self/root/proc/self/root/proc/thread-self/root/lib/python2.7/site-packages/rhn/SmartIO.pyo

�
��Qc@sNdZddlZddlmZddd��YZdd�Zd�ZdS(	s*
This module implements the SmartIO class
i����N(tStringIOtSmartIOcBsAeZdZddd�Zd�Zd�Zd�Zd�ZRS(s�
    The SmartIO class allows one to put a cap on the memory consumption.
    StringIO objects are very fast, because they are stored in memory, but
    if they are too big the memory footprint becomes noticeable.
    The write method of a SmartIO determines if the data that is to be added
    to the (initially) StrintIO object does not exceed a certain threshold; if
    it does, it switches the storage to a temporary disk file
    i@icCs4||_t�|_|r'd|_n	d|_dS(Nii(t
_max_mem_sizeRt_iot_fixed(tselftmax_mem_sizet	force_mem((s//usr/lib/python2.7/site-packages/rhn/SmartIO.pyt__init__s
	cCs
||_dS(N(R(RR((s//usr/lib/python2.7/site-packages/rhn/SmartIO.pytset_max_mem_size%scCs|jS(N(R(R((s//usr/lib/python2.7/site-packages/rhn/SmartIO.pytget_max_mem_size(scCsv|jsbt|�|jj�|jkrbt�}|j|jj��d|_||_qbn|jj|�dS(Ni(RtlenRttellRt	_tempfiletwritetgetvalue(Rtdatattmpfile((s//usr/lib/python2.7/site-packages/rhn/SmartIO.pyR+s	"		cCst|j|�S(N(tgetattrR(Rtname((s//usr/lib/python2.7/site-packages/rhn/SmartIO.pyt__getattr__7s(t__name__t
__module__t__doc__RR	R
RR(((s//usr/lib/python2.7/site-packages/rhn/SmartIO.pyRs			cCscddl}|st�}n|jddtj�d|�\}}tj|�tj|d�S(Ni����tprefixs_rhn_transports-%d-tdirswb+(ttempfiletgetDefaultStoragetmkstemptostgetpidtunlinktfdopen(ttmpdirRtfdtfname((s//usr/lib/python2.7/site-packages/rhn/SmartIO.pyR
;s
cCs�d}d}yt|�}Wntk
r0|SXx`|j�D]R}|jd�r>|jd�}t|�dkr�|dj�p�|}q�q>q>W|j�|S(sY Reads the default temp dir from up2date config.
    if defined uses that else use /tmp. s/etc/sysconfig/rhn/up2dates/tmpstmpDir=t=ii����(topentIOErrort	readlinest
startswithtsplitRtstriptclose(t
up2dateCfgR!tftlinetcfgdir((s//usr/lib/python2.7/site-packages/rhn/SmartIO.pyREs
 
((RRt	cStringIORRtNoneR
R(((s//usr/lib/python2.7/site-packages/rhn/SmartIO.pyt<module>s
+

Zerion Mini Shell 1.0