403Webshell
Server IP : 192.158.238.246  /  Your IP : 18.222.24.23
Web Server : LiteSpeed
System : Linux uniform.iwebfusion.net 4.18.0-553.27.1.lve.1.el8.x86_64 #1 SMP Wed Nov 20 15:58:00 UTC 2024 x86_64
User : jenniferflocom ( 1321)
PHP Version : 8.1.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /opt/alt/python37/lib/python3.7/site-packages/beaker/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/alt/python37/lib/python3.7/site-packages/beaker/__pycache__/util.cpython-37.pyc
B

��[�B�@sdZddlZddlZddlZddlmZmZmZmZm	Z	m
Z
mZmZm
Z
mZyddlZWnek
rtddlZYnXddlmZmZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlm Z ddl!m"Z"ddlm#Z$d	Z%d
ddd
dddgZ&dd�Z'dAdd�Z(dd�Z)dd�Z*dd�Z+dBdd�Z,dd�Z-Gdd
�d
e.�Z/Gd d�de.�Z0Gd!d�de0�Z1da2dCd$d
�Z3d%d&�Z4d'd(�Z5d)d*�Z6d+d,�Z7d-d.�Z8d/d0�Z9dDd1d2�Z:d3d4�Z;d5d6�Z<Gd7d8�d8e.�Z=Gd9d:�d:e.�Z>d;d�Z?d<d�Z@d=d>�ZAd?d@�ZBdS)EzBeaker utilities�N�)
�PY2�string_type�unicode_text�NoneType�dictkeyslist�im_class�im_func�pickle�func_signature�default_im_func)�datetime�	timedelta)�asbool)�
exceptions)�local��ThreadLocal�WeakValuedRegistry�SyncDict�encoded_path�verify_directory�	serialize�deserializecCs
||_|S)z�Return a function with a given __name__.

    Will assign to __name__ and return the original function if possible on
    the Python implementation, otherwise a new function will be constructed.

    )�__name__)�fn�name�r�</opt/alt/python37/lib/python3.7/site-packages/beaker/util.py�function_named&srcs*�p�j�ddlm����fdd�}|S)z!Skip a test if predicate is true.r)�SkipTestcs$�j������fdd�}t|��S)Ncs*��rd��f}�|��n
�||�SdS)Nz'%s' skipped: %sr)�args�kw�msg)r r�fn_name�	predicate�reasonrr�maybe:s


z(skip_if.<locals>.decorate.<locals>.maybe)rr)rr')r r%r&)rr$r�decorate7szskip_if.<locals>.decorate)r�noser )r%r&r(r)r r%r&r�skip_if1s
r*cOs<y|||�d}Wn|k
r*d}YnX|s8td��dS)zGAssert the given exception is raised by the given function + arguments.FTz#Callable did not raise an exceptionN)�AssertionError)Z
except_clsZ	callable_r!r"�successrrr�
assert_raisesEs

r-cCsJd}x@t�|tj�sDy|d7}t�|�Wq|dkr<�YqXqWdS)zcverifies and creates a directory.  tries to
    ignore collisions with other threads and processes.rr�N)�os�access�F_OK�makedirs)�dirZtriesrrrrRscCs*tt|�j�}|r"|ddkr"dSdSdS)z8Return True if the given function has a 'self' argument.r)�self�clsTFN)�listr�
parameters)�funcr!rrr�has_self_arg`sr9�cCs0t|t�rtj|tj|d�ntj||d�dS)zIssue a warning.)�
stacklevelN)�
isinstancer�warnings�warnrZ
BeakerWarning)r#r;rrrr>is
r>cs�fdd�}|S)Ncs*��fdd�}�j|_d��jf|_|S)Ncst��td��||�S)N�)r=r>�DeprecationWarning)r!Zkargs)r�messagerr�deprecated_methodssz6deprecated.<locals>.wrapper.<locals>.deprecated_methodz%s

%s)r�__doc__)rrB)rA)rr�wrapperrszdeprecated.<locals>.wrapperr)rArDr)rAr�
deprecatedqsrEc@s>eZdZdZdZdd�Zdd�Zdd�Zdd
d�Zdd
�Z	d	S)rz$stores a value on a per-thread basis�_tlocalcCst�|_dS)N)rF)r4rrr�__init__�szThreadLocal.__init__cCs||j_dS)N)rF�value)r4rHrrr�put�szThreadLocal.putcCst|jd�S)NrH)�hasattrrF)r4rrr�has�szThreadLocal.hasNcCst|jd|�S)NrH)�getattrrF)r4�defaultrrr�get�szThreadLocal.getcCs
|j`dS)N)rFrH)r4rrr�remove�szThreadLocal.remove)N)
r�
__module__�__qualname__rC�	__slots__rGrIrKrNrOrrrrr}s
c@s`eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dS)ra�
    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.

    cCst��|_i|_dS)N)�
_threading�Lock�mutex�dict)r4rrrrG�s
zSyncDict.__init__cOsVy,||jkr|j|S|j||f|�|�SWn$tk
rP|j||f|�|�SXdS)N)rV�sync_get�KeyError)r4�key�
createfuncr!�kwargsrrrrN�s

zSyncDict.getcOsr|j��zVy,||jkr"|j|S|j||f|�|�SWn$tk
r\|j||f|�|�SXWd|j��XdS)N)rU�acquirerV�_createrX�release)r4rYrZr!r[rrrrW�s


zSyncDict.sync_getcOs|||�||<}|S)Nr)r4rYrZr!r[�objrrrr]�szSyncDict._createcCs
||jkS)N)rV)r4rYrrr�has_key�szSyncDict.has_keycCs|j�|�S)N)rV�__contains__)r4rYrrrra�szSyncDict.__contains__cCs|j�|�S)N)rV�__getitem__)r4rYrrrrb�szSyncDict.__getitem__cCs|j�||�dS)N)rV�__setitem__)r4rYrHrrrrc�szSyncDict.__setitem__cCs|j�|�S)N)rV�__delitem__)r4rYrrrrd�szSyncDict.__delitem__cCs|j��dS)N)rV�clear)r4rrrre�szSyncDict.clearN)rrPrQrCrGrNrWr]r`rarbrcrdrerrrrr�s	
c@seZdZdd�ZdS)rcCst��|_t��|_dS)N)rS�RLockrU�weakref�WeakValueDictionaryrV)r4rrrrG�s
zWeakValuedRegistry.__init__N)rrPrQrGrrrrr�s�.encTc	Cs�d�|�}tdkrddlma|rLt|t�r@t|�d����}nt|���}tj�	|�}g}x$t
d|�D]}|�|d|��qhWtjj|f|��}t|�tj�|||�S)zsGenerate a unique file-accessible path from the given list of
    identifiers starting at the given root directory.�_Nr)�sha1zutf-8r)
�joinrkZ
beaker.cryptor<r�encode�	hexdigestr/�path�basename�range�appendr)	�rootZidentifiers�	extension�depthZdigest_filenames�ident�tokens�dr3rrrr�s

cCs8t|t�r|St|t�r,t�d|�r,t|�Std��dS)Nz^\d+$zThis is not a proper int)r<�intr�re�match�	Exception)r_rrr�asint�s

r}cCs�t||�s�t|t�s|f}d}x�|D]�}yn|ttfkrLdd�|�d�D�}nD|tkrZt}n.|tkrht}n |tt	fkr�t||�s�t
d|��||�}d}WnYnX|r$Pq$W|s�t
|��nt|t�r�|��s�t
d|��|S)NFcSsg|]}|���qSr)�strip)�.0�xrrr�
<listcomp>	sz"verify_options.<locals>.<listcomp>�,z%s requires a timedelta typeTz!Empty strings are invalid for: %s)
r<�tupler6�split�boolrryr}rr
r|�strr~)�opt�types�errorZcoerced�typrrr�verify_optionss4





r�cCs4x.|D]&\}}}||krt||||�||<qW|S)N)r�)�paramsZrulesetrYr�rArrr�verify_rulessr�cCsPdttfdfdttfdfdttfdfdttttfdfd	ttfd
fdttfdfd
tfdfdtfdfdttfdfdttfdfdttfdfdttfdfdttfdfdttfdfdttfdfdttfd fd!ttfd"fd#ttfd$fd%tfd&fg}t||�}|�d�}|�r&t|t��r&t|t��s&t|d'�|d<|�d�dk	�rL|�dd(��sLt	d)��|S)*N�data_dirz3data_dir must be a string referring to a directory.�lock_dirz3lock_dir must be a string referring to a directory.�typezSession type must be a string.�cookie_expireszGCookie expires was not a boolean, datetime, int, or timedelta instance.Z
cookie_domainzCookie domain must be a string.Zcookie_pathzCookie path must be a string.�idzSession id must be a string.rYzSession key must be a string.Zsecretz Session secret must be a string.Zvalidate_keyz%Session encrypt_key must be a string.Zencrypt_keyz&Session validate_key must be a string.Zencrypt_nonce_bitsz+Session encrypt_nonce_bits must be a numberZsecurez!Session secure must be a boolean.Zhttponlyz#Session httponly must be a boolean.�timeoutz#Session timeout must be an integer.Zsave_accessed_timez@Session save_accessed_time must be a boolean (defaults to true).�autozSession is created if accessed.Zwebtest_varnamez!Session varname must be a string.Zdata_serializerz!data_serializer must be a string.)�secondsTz.save_accessed_time must be true to use timeout)
r�rr�r
rryr�rNr<r|)r��rules�optsr�rrr�coerce_session_params&s:



r�c	Csbdttfdfdttfdfdtfdfdttfdfd	ttfd
fdtttfdfd
ttfdfg}t||�S)Nr�z3data_dir must be a string referring to a directory.r�z3lock_dir must be a string referring to a directory.r�zCache type must be a string.�enabledz&enabled must be true/false if present.�expirezNexpire must be an integer representing how many seconds the cache is valid for�regionsz7Regions must be a comma separated list of valid regions�
key_lengthzUkey_length must be an integer which indicates the longest a key can be before hashing)r�rr�ryr6r�r�)r�r�rrr�coerce_cache_paramsJs

r�cCs>dttfdfdttfdfdtfdfdtfdfd	tfd
fdtfdfd
ttfdfdtfdfdttfdfdtfdfdttfdfdttfdfdttfdfdttfdfdttfdfdtfd fd!ttfd"fd#tfd$fd%tfd&fd'tfd(fd)ttfd*fd+tfd,fd-tfd.fd/tfd0fd1tfd2fd3tfd4fd5ttfd6fd7tfd8fg}t||�S)9NZcasz#cas must be a boolean or an integerZno_blockz(no_block must be a boolean or an integerZreceive_timeoutz"receive_timeout must be an integerZsend_timeoutzsend_timeout must be an integerZketama_hashzHketama_hash must be a string designating a valid hashing strategy optionZ
_poll_timeoutz _poll_timeout must be an integerZ
auto_ejectzauto_eject must be an integerZ
retry_timeoutz retry_timeout must be an integerZ_sort_hostsz_sort_hosts must be an integerZ_io_msg_watermarkz$_io_msg_watermark must be an integerZketamaz&ketama must be a boolean or an integerZketama_weightedz/ketama_weighted must be a boolean or an integerZ_io_key_prefetchz0_io_key_prefetch must be a boolean or an integerZ_hash_with_prefix_keyz5_hash_with_prefix_key must be a boolean or an integerZtcp_nodelayz+tcp_nodelay must be a boolean or an integerZ
failure_limitz failure_limit must be an integerZbuffer_requestsz/buffer_requests must be a boolean or an integerZ_socket_send_sizez$_socket_send_size must be an integerZnum_replicasznum_replicas must be an integerZ
remove_failedz remove_failed must be an integerZ_noreplyz(_noreply must be a boolean or an integerZ_io_bytes_watermarkz&_io_bytes_watermark must be an integerZ_socket_recv_sizez$_socket_recv_size must be an integer�distributionzEdistribution must be a string designating a valid distribution optionZconnect_timeoutz"connect_timeout must be an integer�hashz8hash must be a string designating a valid hashing optionZverify_keysz+verify_keys must be a boolean or an integerZdead_timeoutzdead_timeout must be an integer)r�ryr�r�)�	behaviorsr�rrr�coerce_memcached_behaviorsZs@












r�cCs@|rtddddd�}ni}xH|��D]<\}}|�d�rF|||dd�<|�d�r$|||dd�<q$Wt|�d|kr�|r�d	|d<|�d
d�}|�r<i}x�|D]�}|s�q�t|�d�|�d�|�d
�|d|�d�|�dt�d�}d|}	t|	�}
x0t|�D]$}|�|	�r�|�|�|||
d�<q�Wt|�|||<q�W||d<|S)zJParse configuration options and validate for use with the
    CacheManagerZmemoryN)r�r�r�Zlog_filez
beaker.cache.�
zcache.�r�Tr�r�r�r�r�r�)r�r�r�r�r�r�z%s.Z
cache_regions)	rV�items�
startswithr��poprN�DEFAULT_CACHE_KEY_LENGTH�lenr)�configZinclude_defaults�optionsrY�valr�Zregion_configsZregionZregion_optionsZ
region_prefixZ
region_lenrrr�parse_cache_config_optionssB





r�cCs@i}x.|��D]"\}}|�d�r|||dd�<qWt|�|S)z�Parse behavior options and validate for use with pylibmc
    client/PylibMCNamespaceManager, or potentially other memcached
    NamespaceManagers that support behaviorsz	behavior.�	N)r�r�r�)r�r�rYr�rrr�parse_memcached_behaviors�s
r�cCsTd}t|d�st|d�r(t|�}t|�}|r<d|j|jfSdt�|�|jfSdS)z+Generates a unique namespace for a functionNr	�__func__z%s.%sz%s|%s)rJrr	rPr�inspect�
getsourcefile)r8Zklsrrr�func_namespace�sr�c@seZdZdd�Zdd�ZdS)�PickleSerializercCs
t�|�S)N)r
�loads)r4�data_stringrrrr��szPickleSerializer.loadscCst�|d�S)Nr?)r
�dumps)r4�datarrrr��szPickleSerializer.dumpsN)rrPrQr�r�rrrrr��sr�c@seZdZdd�Zdd�ZdS)�JsonSerializercCst�t�|��d��S)Nzutf-8)�jsonr��zlib�
decompress�decode)r4r�rrrr��szJsonSerializer.loadscCst�t�|��d��S)Nzutf-8)r��compressr�r�rm)r4r�rrrr��szJsonSerializer.dumpsN)rrPrQr�r�rrrrr��sr�cCs |dkrt�}nt�}|�|�S)Nr�)r�r�r�)r��method�
serializerrrrr�scCs |dkrt�}nt�}|�|�S)Nr�)r�r�r�)r�r�r�rrrr�scCsJt��}ts |�t�����n|�t���t�|�	�dd���
d�S)Nrr:�ascii)�hashlib�md5r�update�socket�gethostnamerm�binascii�hexlify�digestr�)Zmachine_hashrrr�machine_identifier�s
r�cCs\tjdkr<d|}t|d�}|�|�|��t�||�nt|d�}|�|�|��dS)N�posixz%s.temp�wb)r/r�open�write�close�rename)�filepath�contents�tempnameZfhrrr�
safe_write�s




r�)N)r:)rir:T)T)CrCr�r�r��_compatrrrrrrr	r
rr�	threadingrS�ImportErrorZdummy_threadingr
rr/rz�stringr�rgr=�sysr�r�r�Zbeaker.convertersr�beakerrrrFr��__all__rr*r-rr9r>rE�objectrrrrkrr}r�r�r�r�r�r�r�r�r�r�rrr�r�rrrr�<module>sl0

	
A
	$%
.
	

Youez - 2016 - github.com/yon3zu
LinuXploit