403Webshell
Server IP : 65.1.209.187  /  Your IP : 216.73.216.144
Web Server : nginx/1.24.0
System : Linux ip-172-31-5-206 6.14.0-1015-aws #15~24.04.1-Ubuntu SMP Tue Sep 23 22:44:48 UTC 2025 x86_64
User :  ( 1001)
PHP Version : 8.3.6
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /lib/python3/dist-packages/aioredis/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3/dist-packages/aioredis/__pycache__/pool.cpython-312.pyc
�

���]�@����ddlZddlZddlZddlZddlZddlmZmZddlm	Z	ddl
mZmZddl
mZddlmZddlmZdddddd	dddddd
�d�ZGd�d
e�ZGd�d�ZGd�d�Zy)�N�)�create_connection�_PUBSUB_COMMANDS)�logger)�	parse_url�
CloseEvent)�PoolClosedError)�AbcPool)�Lock�
)�db�password�ssl�encoding�minsize�maxsize�parser�loop�create_connection_timeout�pool_cls�connection_clsc
��8K�|
rt|
t�sJd��|
}nt}t|t�r|t|�\}}
|
j
d|�}|
j
d|�}|
j
d|�}|
j
d|	�}	d|
vr"|
ds|
ds|r
Jd|
d|f��|xs|
d}||||||||||	||��}	|jd	�
��d{���|S7�#t$r+|j�|j��d{���7�wxYw�w)a{Creates Redis Pool.

    By default it creates pool of Redis instances, but it is
    also possible to create pool of plain connections by passing
    ``lambda conn: conn`` as commands_factory.

    *commands_factory* parameter is deprecated since v0.2.9

    All arguments are the same as for create_connection.

    Returns RedisPool instance or a pool_cls if it is given.
    z-pool_class does not meet the AbcPool contractr
rr�timeoutrzConflicting ssl options are set)rrrrrrrF��override_minN)�
issubclassr
�ConnectionsPool�
isinstance�strr�
setdefault�
_fill_free�	Exception�close�wait_closed)�addressr
rrrrrrrrrr�cls�options�pools               �//usr/lib/python3/dist-packages/aioredis/pool.py�create_poolr*sU����"��(�G�,�	@�?�	@�,������'�3��$�W�-����
�
�
��b�
)���%�%�j�(�;���%�%�j�(�;��$+�$6�$6��0�%2�!��G���5�>�'�%�.��
H�1�7�5�>�3�HH�
H�E��'����C��w��H�h����v�)B�,���D���o�o�5�o�1�1�1�
�K�	2�����
�
����� � � �
��s<�CD�C#�C!�C#�D�!C#�#,D�D�D�Dc�l�eZdZdZd(dddddd�d�Zd�Zed��Zed��Zed��Z	ed	��Z
ed
��Zd�Zd�Z
d
�Zd�Zed��Zd�Zed��Zed��Zd�Zd�Zd)d�Zd�Zd�Zd�Zd�Zd�Zed��Zed��Zed��Zd*d�Zd�Z d �Z!d!�Z"d"�Z#d+d#�Z$d$�Z%d%�Z&d&�Z'd'�Z(y),rzRedis connections pool.N)rrrrrc��t|t�r|dk\sJd|t|�f��|�Jd��t|t�r|dkDsJd|t|�f��||ks
Jd||f��|�-tjdk\rtjdt�||_||_	||_
||_||_||_
||_|	|_t!j"|��|_t'�|_d|_t-j.t1��	�|_t5|j6�|_d|_|
|_y)
Nrzminsize must be int >= 0z"Arbitrary pool size is disallowed.zmaxsize must be int > 0zInvalid pool min/max sizes)��zThe loop argument is deprecated)�maxlen)�lock)r�int�type�sys�version_info�warnings�warn�DeprecationWarning�_address�_db�	_password�_ssl�	_encoding�
_parser_class�_minsize�_create_connection_timeout�collections�deque�_pool�set�_used�
_acquiring�asyncio�	Conditionr�_condr�	_do_close�_close_state�_pubsub_conn�_connection_cls)�selfr%r
rrrrrrrrrs            r)�__init__zConnectionsPool.__init__EsJ��
�'�3�'�G�q�L�	@�&���g��;@�	@�8��"�H�$H�H�"��'�3�'�G�a�K�	?�%�w��W�
�:?�	?�7��'�!�	<�(�'�7�$<�	<�!���� 0� 0�F� :��M�M�;�,�
.���
����!�����	�!���#�����
�*C��'� �&�&�g�6��
��U��
�����&�&�D�F�3��
�&�t�~�~�6��� ���-���c��dj|jj|j|j|j
|j�S)Nz#<{} [db:{}, size:[{}:{}], free:{}]>)�format�	__class__�__name__r
rr�freesize�rMs r)�__repr__zConnectionsPool.__repr__ds;��4�;�;��N�N�#�#�T�W�W��L�L�$�,�,��
�
�7�	7rOc��|jS)zMinimum pool size.)r>rUs r)rzConnectionsPool.minsizeis���}�}�rOc�.�|jjS)zMaximum pool size.)rBr/rUs r)rzConnectionsPool.maxsizens���z�z� � � rOc�`�|jt|j�z|jzS)zCurrent pool size.)rT�lenrDrErUs r)�sizezConnectionsPool.sizess$���}�}�s�4�:�:��.����@�@rOc�,�t|j�S)z#Current number of free connections.)rZrBrUs r)rTzConnectionsPool.freesizexs���4�:�:��rOc��|jS�N)r8rUs r)r%zConnectionsPool.address}s���}�}�rOc��K�|j4�d{���|j��d{���ddd��d{���y7�-7�7�	#1�d{���7swYyxYw�w)zPClear pool connections.

        Close and remove all free connections.
        N)rH�	_do_clearrUs r)�clearzConnectionsPool.clear�sR����
�:�:�	#�	#��.�.�"�"�"�	#�	#�	#��"��	#��	#�	#�	#�sQ�A�A�A�A�A�A�A�A�A�A�A�A�
A�A�Ac��K�g}|jrV|jj�}|j�|j|j	��|jr�Vtj|��d{���y7��wr^)rB�popleftr#�appendr$rF�gather�rM�waiters�conns   r)r`zConnectionsPool._do_clear�s_�������j�j��:�:�%�%�'�D��J�J�L��N�N�4�+�+�-�.��j�j��n�n�g�&�&�&�s�A$B�'B�<B�=Bc��K�|j4�d{���|jrJ|j��g}|jrV|jj�}|j	�|j|j
��|jr�V|jD]1}|j	�|j|j
���3tj|��d{���tjdt|��ddd��d{���y7��7�77�
#1�d{���7swYyxYw�w)NzClosed %d connection(s))
rHrErBrcr#rdr$rDrFrer�debugrZrfs   r)rIzConnectionsPool._do_close�s�����:�:�	B�	B����7����7�&��G��*�*��z�z�)�)�+���
�
�����t�/�/�1�2��*�*��
�
�
3���
�
�����t�/�/�1�2�
3��.�.�'�*�*�*��L�L�2�C��L�A�	B�	B�	B��
+��	B��	B�	B�	B�s^�D?�D#�D?�BD*�AD*�.D&�/#D*�D?�D(�D?�&D*�(D?�*D<�0D3�1D<�8D?c�n�|jj�s|jj�yy)zLClose all free and in-progress connections and mark pool as closed.
        N)rJ�is_setrCrUs r)r#zConnectionsPool.close�s-��� � �'�'�)����!�!�#�*rOc�6�|jj�S)zTrue if pool is closed.)rJrlrUs r)�closedzConnectionsPool.closed�s��� � �'�'�)�)rOc��TK�|jj��d{���y7��w)zWait until pool gets closed.N)rJ�waitrUs r)r$zConnectionsPool.wait_closed�s�������$�$�&�&�&�s�(�&�(c�"�|jxsdS)zCurrently selected db index.r)r9rUs r)r
zConnectionsPool.db�s���x�x�}�1�rOc��|jS)zCurrent set codec or None.)r<rUs r)rzConnectionsPool.encoding�s���~�~�rOc���|j||�\}}|�*|j|g|��i|��}|j||||�S|j||||�}|j||||�S)a+Executes redis command in a free connection and returns
        future waiting for result.

        Picks connection from free pool and send command through
        that connection.
        If no connection is found, returns coroutine waiting for
        free connection to execute command.
        )�get_connection�execute�
_check_result�
_wait_execute)rM�command�args�kwrhr%�fut�coros        r)ruzConnectionsPool.execute�s~���+�+�G�T�:�
��g����$�,�,�w�4��4��4�C��%�%�c�7�D�"�=�=��%�%�g�w��b�A�D��%�%�d�G�T�2�>�>rOc�|�|j|�\}}|�|j|g|���S|j|||i�S)a�Executes Redis (p)subscribe/(p)unsubscribe commands.

        ConnectionsPool picks separate connection for pub/sub
        and uses it until explicitly closed or disconnected
        (unsubscribing from all channels/patterns will leave connection
         locked for pub/sub use).

        There is no auto-reconnect for this PUB/SUB connection.

        Returns asyncio.gather coroutine waiting for all channels/patterns
        to receive answers.
        )rt�execute_pubsub�_wait_execute_pubsub)rMrx�channelsrhr%s     r)r~zConnectionsPool.execute_pubsub�sM���+�+�G�4�
��g���&�4�&�&�w�:��:�:��,�,�W�g�x��L�LrOc�\�|j�j�}|tv}|rK|jr?|jjs"|j|jj
fSd|_t
|j�D]�}|jd}|jjd�|jr�:|jr�G|r=||_|jj|�|jj|�||j
fcSd|jfS)zDGet free connection from pool.

        Returns connection.
        Nrr)�upper�striprrKrnr%�rangerTrB�rotate�	in_pubsub�removerD�addr8)rMrxry�	is_pubsub�irhs      r)rtzConnectionsPool.get_connection�s����-�-�/�'�'�)���/�/�	���*�*��$�$�+�+��(�(�$�*;�*;�*C�*C�C�C� $�D���t�}�}�%�	&�A��:�:�a�=�D��J�J���a� ��{�{���~�~���$(��!��
�
�!�!�$�'��
�
���t�$�����%�%�	&��T�]�]�"�"rOc��|S)zjHook to check result or catch exception (like MovedError).

        This method can be coroutine.
        �)rMr{�datas   r)rvzConnectionsPool._check_result�s	��
�
rOc���K�|j||��d{���}	|j|g|��i|���d{���|j|�S7�47�#|j|�wxYw�w)z'Acquire connection and execute command.N)�acquireru�release�rMr%rxryrzrhs      r)rwzConnectionsPool._wait_execute�s[�����\�\�'�4�0�0��	�&�$�,�,�w�<��<��<�<��L�L���	1��<���L�L���s5�A'�A
�A'�A�A�A�A'�A�A$�$A'c��.K�|jrtd��|j�)|jjsJd|jf��|j4�d{���|jrtd��|j�|jjr |j	|��d{���}||_|j}|j
|g|��i|���d{���cddd��d{���S7��7�H7�7�#1�d{���7swYyxYw�w)N�Pool is closedz Expected no or closed connection)rnr	rKrH�_create_new_connectionr~r�s      r)rz$ConnectionsPool._wait_execute_pubsubs�����;�;�!�"2�3�3�� � �(�D�,=�,=�,D�,D�	C�.��0A�0A�GC�	C�D��:�:�	E�	E��{�{�%�&6�7�7�� � �(�D�,=�,=�,D�,D�!�8�8��A�A��$(��!��$�$�D�-�$�-�-�g�C��C��C�C�	E�	E�	E��B��D��	E��	E�	E�	E�sm�AD�C8� D�#AD�1C:�20D�"C<�#D�&D�2C>�3D�:D�<D�>D�D�D	�D�Dc��*K�d}|j4�d{���t|j�D],}|xr&|j|j	|��d{���}�.||_ddd��d{���|S7�a7�!7�
#1�d{���7swY|SxYw�w)z~Changes db index for all free connections.

        All previously acquired connections will be closed when released.
        TN)rHr�rTrB�selectr9)rMr
�resr�s    r)r�zConnectionsPool.selects�����
���:�:�	�	��4�=�=�)�
?���>�T�Z�Z��]�%9�%9�"�%=�=��
?��D�H�	�	��
�		��=��	��	�	�	��
�sV�B�A7�B�>A=�A9�
A=�%B�0A;�1B�9A=�;B�=B�B�B�Bc��K�||_|j4�d{���t|j�D](}|j|j|��d{����*ddd��d{���y7�U7�7�	#1�d{���7swYyxYw�wr^)r:rHr�rTrB�auth)rMrr�s   r)r�zConnectionsPool.auth!s{����!����:�:�	3�	3��4�=�=�)�
3���j�j��m�(�(��2�2�2�
3�	3�	3�	3��2��	3��	3�	3�	3�sV�B�A0�B�:A6�A2�A6�B�*A4�+B�2A6�4B�6B�<A?�=B�Bc�t�|jr,|jjs|jjSy)Nr)rKrnr�rUs r)r�zConnectionsPool.in_pubsub's.�����T�%6�%6�%=�%=��$�$�.�.�.�rOc��|jr,|jjs|jjStji�Sr^)rKrn�pubsub_channels�types�MappingProxyTyperUs r)r�zConnectionsPool.pubsub_channels-�<�����T�%6�%6�%=�%=��$�$�4�4�4��%�%�b�)�)rOc��|jr,|jjs|jjStji�Sr^)rKrn�pubsub_patternsr�r�rUs r)r�zConnectionsPool.pubsub_patterns3r�rOc��VK�|jrtd��|j4�d{���|jrtd��	|jd���d{���|jr||j
j
�}|jrJ|��||jvsJ||jf��|jj|�|cddd��d{���S|jj��d{�����7��7��7�,7�#1�d{���7swYyxYw�w)zYAcquires a connection from free pool.

        Creates new connection if needed.
        r�NTr)
rnr	rHr!rTrBrcrDr�rp)rMrxryrhs    r)r�zConnectionsPool.acquire9s����
�;�;�!�"2�3�3��:�:�	,�	,��{�{�%�&6�7�7���o�o�4�o�8�8�8��=�=��:�:�-�-�/�D�#�{�{�0�D�0�?��t�z�z�1�E�D�$�*�*�3E�E�1��J�J�N�N�4�(��	,�	,�	,��*�*�/�/�+�+�+��	,��9��		,��,��	,�	,�	,�su�(D)�D�D)�.D�D�A:D�D)�#D�$D)�)D�D�D�D)�D�D)�D�D&�D�D&�"D)c���||jvs	Jd|f��|jj|�|j�s|jr't	j
d|�|j
�n�|jr't	j
d|�|j
�n�|jr't	j
d|�|j
�n{|j|jk(rR|jr5|j|jkr|jj|�n!|j
�n|j
�tj|j!��y)z�Returns used connection back into pool.

        When returned connection has db index that differs from one in pool
        the connection will be closed and dropped.
        When queue of free connections is full the connection will be dropped.
        z)Invalid connection, maybe from other poolz,Connection %r is in transaction, closing it.z/Connection %r is in subscribe mode, closing it.z/Connection %r has pending commands, closing it.N)rDr�rn�in_transactionr�warningr#r��_waitersr
rrTrBrdrF�
ensure_future�_wakeup�rMrhs  r)r�zConnectionsPool.releaseNs���t�z�z�!�	?�7��$?�	?�!��
�
���$���{�{��"�"����B�D�J��
�
��������E�t�M��
�
��������E�t�M��
�
�����D�G�G�#��<�<�D�M�M�D�L�L�$@��J�J�%�%�d�+��J�J�L��
�
�����d�l�l�n�-rOc���t|j�D]S}|jd}|jr|jj	��9|jjd��Uy)Nr���)r�rTrBrnrcr�)rMr�rhs   r)�_drop_closedzConnectionsPool._drop_closedpsP���t�}�}�%�	&�A��:�:�a�=�D��{�{��
�
�"�"�$��
�
�!�!�"�%�	&rOc��K�|j�|j|jkr�|xjdz
c_	|j	|j
��d{���}|j
d��d{���|jj|�|xjdzc_|j�|j|jkr��|jry|r�|js�|j|jkr�|xjdz
c_	|j	|j
��d{���}|jj|�|xjdzc_|j�|js|j|jkr��yyyyy7��P7��:#|xjdzc_|j�wxYw7��#|xjdzc_|j�wxYw�w)Nr�ping)r�r[rrEr�r8rurBrdrTr)rMrrhs   r)r!zConnectionsPool._fill_freexs����������i�i�$�,�,�&��O�O�q� �O�	
$�!�8�8����G�G���l�l�6�*�*�*��
�
�!�!�$�'����1�$���!�!�#��i�i�$�,�,�&��=�=����j�j�T�Y�Y����%=����1�$��(�!%�!<�!<�T�]�]�!K�K�D��J�J�%�%�d�+��O�O�q�(�O��%�%�'��j�j�T�Y�Y����%=�j�%=�j��H��+�����1�$���!�!�#��L���O�O�q�(�O��%�%�'�sy�?H�F6� F0�!F6�9F3�:F6�>H�A	H�"G"�G �G"� A
H�+H�0F6�3F6�6'G�H� G"�"'H	�	Hc
��t||j|j|j|j|j
|j|j��S)N)r
rrrrrr)rr9r:r;r<r=r?rL)rMr%s  r)r�z&ConnectionsPool._create_new_connection�sH�� ��$(�H�H�*.�.�.�%)�Y�Y�*.�.�.�(,�(:�(:�)-�)H�)H�04�0D�0D�#�	#rOc��K�|j4�d{���|jj�ddd��d{���|�|j��d{���yy7�J7�"#1�d{���7swY�2xYw7��wr^)rH�notifyr$)rM�closing_conns  r)r�zConnectionsPool._wakeup�so�����:�:�	 �	 ��J�J����	 �	 ��#��*�*�,�,�,�$�	 ��	 ��	 �	 �	 ��
-�sM�A9�A�A9�A"�A9�A �A9�A7�A9� A9�"A4�(A+�)A4�0A9c��td��)Nz6'await' should be used as a context manager expression)�RuntimeErrorrUs r)�	__enter__zConnectionsPool.__enter__�s���D�F�	FrOc��yr^r�)rMrys  r)�__exit__zConnectionsPool.__exit__�s��rOc#�rK�|j�j�Ed{���}t||�S7��wr^)r��	__await__�_ConnectionContextManagerr�s  r)r�zConnectionsPool.__await__�s/�����,�,�.�2�2�4�4��(��t�4�4�5�s�"7�5�7c��t|�S)z�Return async context manager for working with connection.

        async with pool.get() as conn:
            await conn.execute('get', 'my-key')
        )�_AsyncConnectionContextManagerrUs r)�getzConnectionsPool.get�s��.�d�3�3rO)NNN)r�)Nr�r^))rS�
__module__�__qualname__�__doc__rNrV�propertyrrr[rTr%rar`rIr#rnr$r
rrur~rtrvrwrr�r�r�r�r�r�r�r�r!r�r�r�r�r�r�r�rOr)rrBsx��!�.�*.�t�+/� $��	.�>7�
�����!��!��A��A���������#�'�
B�$��*��*�'���������?�"M�&#�6��E�
�3�����
�*��*�
�*��*�
,�* .�D&�(�:	#�-�F�
�5�
4rOrc�"�eZdZdZd�Zd�Zd�Zy)r��rB�_connc� �||_||_yr^r�)rMr(rhs   r)rNz"_ConnectionContextManager.__init__������
���
rOc��|jSr^)r�rUs r)r�z#_ConnectionContextManager.__enter__�s���z�z�rOc��	|jj|j�d|_d|_y#d|_d|_wxYwr^�rBr�r��rM�exc_type�	exc_value�tbs    r)r�z"_ConnectionContextManager.__exit__�s=��	��J�J���t�z�z�*��D�J��D�J���D�J��D�J�s	�%6�AN)rSr�r��	__slots__rNr�r�r�rOr)r�r��s��"�I���rOr�c�"�eZdZdZd�Zd�Zd�Zy)r�r�c� �||_d|_yr^r�)rMr(s  r)rNz'_AsyncConnectionContextManager.__init__�r�rOc��xK�|jj��d{���}||_|jS7��wr^)rBr�r�r�s  r)�
__aenter__z)_AsyncConnectionContextManager.__aenter__�s1�����Z�Z�'�'�)�)����
��z�z��*�s�:�8�:c��K�	|jj|j�d|_d|_y#d|_d|_wxYw�wr^r�r�s    r)�	__aexit__z(_AsyncConnectionContextManager.__aexit__�s@����	��J�J���t�z�z�*��D�J��D�J���D�J��D�J�s�A�%8�A�A�AN)rSr�r�r�rNr�r�r�rOr)r�r��s��"�I���
rOr�)rFr@r�r5r3�
connectionrr�logr�utilrr�errorsr	�abcr
�locksrr*rr�r�r�rOr)�<module>r�sk������
�;��'�#���&*�D�d�#�Q��!���#�D�0�fv4�g�v4�r��&�rO

Youez - 2016 - github.com/yon3zu
LinuXploit