%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /opt/alt/python27/lib/python2.7/site-packages/beaker/
Upload File :
Create Path :
Current File : //opt/alt/python27/lib/python2.7/site-packages/beaker/util.pyo

�
퀍Kc@s�dZyddlZddlZWn)ek
rMddlZddlZnXddlmZm	Z	ddl
Z
ddlZddlZddl
Z
ddlZddlZeede�p�ejdkZejd kZejjd	�Zes�er	ddlZnddlZdd
lmZddlmZdd
ddddgZd�Zd�Z de!fd��YZ"de!fd��YZ#de#fd��YZ$da&dde'd�Z(d�Z)d�Z*d�Z+d�Z,e'd�Z-d�Z.dS(!sBeaker utilitiesi����N(tdatetimet	timedeltatpy3kwarningiiiitjava(tasbool(tlocaltThreadLocaltRegistrytWeakValuedRegistrytSyncDicttencoded_pathtverify_directorycCs]d}xPtj|tj�sXy|d7}tj|�Wq	|dkrU�qUq	Xq	WdS(scverifies and creates a directory.  tries to
    ignore collisions with other threads and processes.iiiN(tostaccesstF_OKtmakedirs(tdirttries((s</opt/alt/python27/lib/python2.7/site-packages/beaker/util.pyR#s
cs�fd�}|S(Ncs8��fd�}�j|_d��jf|_|S(Ncs tj�td��||�S(Ni(twarningstwarntDeprecationWarning(targstkargs(tfntmessage(s</opt/alt/python27/lib/python2.7/site-packages/beaker/util.pytdeprecated_method3ss%s

%s(t__name__t__doc__(RR(R(Rs</opt/alt/python27/lib/python2.7/site-packages/beaker/util.pytwrapper2s((RR((Rs</opt/alt/python27/lib/python2.7/site-packages/beaker/util.pyt
deprecated1scBsDeZdZdZd�Zd�Zd�Zdd�Zd�Z	RS(s$stores a value on a per-thread basist_tlocalcCst�|_dS(N(R(tself((s</opt/alt/python27/lib/python2.7/site-packages/beaker/util.pyt__init__AscCs||j_dS(N(Rtvalue(RR!((s</opt/alt/python27/lib/python2.7/site-packages/beaker/util.pytputDscCst|jd�S(NR!(thasattrR(R((s</opt/alt/python27/lib/python2.7/site-packages/beaker/util.pythasGscCst|jd|�S(NR!(tgetattrR(Rtdefault((s</opt/alt/python27/lib/python2.7/site-packages/beaker/util.pytgetJscCs
|j`dS(N(RR!(R((s</opt/alt/python27/lib/python2.7/site-packages/beaker/util.pytremoveMsN(
Rt
__module__Rt	__slots__R R"R$tNoneR'R((((s</opt/alt/python27/lib/python2.7/site-packages/beaker/util.pyR<s			cBsheZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�ZRS(s�
    An efficient/threadsafe singleton map algorithm, a.k.a.
    "get a value based on this key, and create if not found or not
    valid" paradigm:
    
        exists && isvalid ? get : create

    Designed to work with weakref dictionaries to expect items
    to asynchronously disappear from the dictionary.  

    Use python 2.3.3 or greater !  a major bug was just fixed in Nov.
    2003 that was driving me nuts with garbage collection/weakrefs in
    this section.

    cCstj�|_i|_dS(N(t_threadt
allocate_locktmutextdict(R((s</opt/alt/python27/lib/python2.7/site-packages/beaker/util.pyR `scOs_y4|j|�r|j|S|j||||�SWn$tk
rZ|j||||�SXdS(N(thas_keyR/tsync_gettKeyError(Rtkeyt
createfuncRtkwargs((s</opt/alt/python27/lib/python2.7/site-packages/beaker/util.pyR'ds
cOs�|jj�z_y4|j|�r-|j|S|j||||�SWn$tk
rj|j||||�SXWd|jj�XdS(N(R.tacquireR0R/t_createR2trelease(RR3R4RR5((s</opt/alt/python27/lib/python2.7/site-packages/beaker/util.pyR1ms

cOs|||�||<}|S(N((RR3R4RR5tobj((s</opt/alt/python27/lib/python2.7/site-packages/beaker/util.pyR7zscCs|jj|�S(N(R/R0(RR3((s</opt/alt/python27/lib/python2.7/site-packages/beaker/util.pyR0~scCs|jj|�S(N(R/t__contains__(RR3((s</opt/alt/python27/lib/python2.7/site-packages/beaker/util.pyR:�scCs|jj|�S(N(R/t__getitem__(RR3((s</opt/alt/python27/lib/python2.7/site-packages/beaker/util.pyR;�scCs|jj||�dS(N(R/t__setitem__(RR3R!((s</opt/alt/python27/lib/python2.7/site-packages/beaker/util.pyR<�scCs|jj|�S(N(R/t__delitem__(RR3((s</opt/alt/python27/lib/python2.7/site-packages/beaker/util.pyR=�scCs|jj�dS(N(R/tclear(R((s</opt/alt/python27/lib/python2.7/site-packages/beaker/util.pyR>�s(
RR)RR R'R1R7R0R:R;R<R=R>(((s</opt/alt/python27/lib/python2.7/site-packages/beaker/util.pyR	Ps				
						cBseZd�ZRS(cCs"tj�|_tj�|_dS(N(t
_threadingtRLockR.tweakreftWeakValueDictionaryR/(R((s</opt/alt/python27/lib/python2.7/site-packages/beaker/util.pyR �s(RR)R (((s</opt/alt/python27/lib/python2.7/site-packages/beaker/util.pyR�ss.encc	Cs�dj|�}tdkr.ddlman|rmtrXt|jd��j�}qmt|�j�}ntjj	|�}g}x+t
d|�D]}|j|d|!�q�Wtjj||�}t|�tjj|||�S(ssGenerate a unique file-accessible path from the given list of
    identifiers starting at the given root directory.t_i����(tsha1sutf-8iiN(
tjoinRDR+t
beaker.cryptotpy3ktencodet	hexdigestRtpathtbasenametrangetappendR(	troottidentifierst	extensiontdepthtdigest_filenamestidentttokenstdR((s</opt/alt/python27/lib/python2.7/site-packages/beaker/util.pyR
�s
cCst||�s�t|t�s*|f}nt}x�|D]�}yh|ttfkr}g|jd�D]}|j�^qb}n!|tkr�t}n||�}t}WnnX|r7Pq7q7W|st	|��qn/t|t
�r|j�rt	d|��n|S(Nt,s!Empty strings are invalid for: %s(t
isinstancettupletFalsetlisttsplittstriptboolRtTruet	Exceptiontstr(toptttypesterrortcoercedttyptx((s</opt/alt/python27/lib/python2.7/site-packages/beaker/util.pytverify_options�s*
+	
cCsGx@|D]8\}}}||krt||||�||<qqW|S(N(Rg(tparamstrulesetR3RbR((s</opt/alt/python27/lib/python2.7/site-packages/beaker/util.pytverify_rules�s!cCsdttjfdfdttjfdfdttjfdfdtttfdfd	ttjfd
fdtfdfd
tfdfdttjfdfdttjfdfdttjfdfdttjfdfdttjfdfdttjfdfg
}t||�S(Ntdata_dirs3data_dir must be a string referring to a directory.tlock_dirs3lock_dir must be a string referring to a directory.ttypesSession type must be a string.tcookie_expiressBCookie expires was not a boolean, datetime, or timedelta instance.t
cookie_domainsCookie domain must be a string.tidsSession id must be a string.R3sSession key must be a string.tsecrets Session secret must be a string.tvalidate_keys%Session encrypt_key must be a string.tencrypt_keys&Session validate_key must be a string.tsecures!Session secure must be a boolean.ttimeouts#Session timeout must be an integer.tautosSession is created if accessed.(R`RbtNoneTypeR]RRtintRj(Rhtrules((s</opt/alt/python27/lib/python2.7/site-packages/beaker/util.pytcoerce_session_params�sc	Cs�dttjfdfdttjfdfdtfdfdttjfdfd	ttjfd
fdtttjfdfg}t||�S(
NRks3data_dir must be a string referring to a directory.Rls3lock_dir must be a string referring to a directory.RmsCache type must be a string.tenableds&enabled must be true/false if present.texpiresNexpire must be an integer representing how many seconds the cache is valid fortregionss7Regions must be a comma seperated list of valid regions(R`RbRwR]RxRZRXRj(RhRy((s</opt/alt/python27/lib/python2.7/site-packages/beaker/util.pytcoerce_cache_params�sc

Cs�|r*tdddddddd�}ni}xZ|j�D]L\}}|jd�ri|||d<n|jd�r=|||d	<q=q=Wt|�d
|kr�t|d
<n|jdd�}|r�i}x�|D]�}td|jd�d|jd�d|jd�d
|d
d|jd��}t|�d
}	xA|j	�D]3}|jd|�rG|j|�|||	<qGqGWt|�|||<q�W||d<n|S(sJParse configuration options and validate for use with the
    CacheManagerRmtmemoryRkR|tlog_files
beaker.cache.i
scache.iR{R}Rlis%s.t
cache_regionsN(
R/R+t	iteritemst
startswithR~R^tpopR'tlentkeys(
tconfigtinclude_defaultstoptionsR3tvalR}tregion_configstregiontregion_optionst
region_len((s</opt/alt/python27/lib/python2.7/site-packages/beaker/util.pytparse_cache_config_options�s:





cCs\d}t|d�r*|j}|j}n|rDd|j|jfSd|j|jfSdS(s+Generates a unique namespace for a functiontim_funcs%s.%sN(R+R#tim_classR�R)R(tfunctkls((s</opt/alt/python27/lib/python2.7/site-packages/beaker/util.pytfunc_namespace$s	(ii(ii(/RtthreadR,t	threadingR?tImportErrortdummy_threadtdummy_threadingRRRtstringRbRARtsysR%RYtversion_infoRGtpy24tplatformR�tjythontpickletcPickletbeaker.convertersRRRt__all__RRtobjectRR	RR+RDR^R
RgRjRzR~R�R�(((s</opt/alt/python27/lib/python2.7/site-packages/beaker/util.pyt<module>sJ
!		=				)

Zerion Mini Shell 1.0