Edit File: __init__.cpython-311.pyc
� ����q�dl����������������������������d�Z�ddlZddlZddlZddlZddlmZ�ddlmZ�ddl m Z � �ddl mZ�n#�e$�r��G�d��d������������ZY�nw�xY�wg�d �Z e d gz ��Z �G�d��dej��������������������Z�G�d ��dej��������������������Z�G�d��de������������Z�G�d��de������������Z�G�d��d������������Z�G�d��deee������������Z�G�d��deee������������Zd��Zd��Z�G�d��de������������Z�G�d��de������������Z�G�d��d e������������Z�G�d!��d"e������������Z�G�d#��d$e������������Z�G�d%��d&e������������Z�G�d'��d(������������Z�G�d)��d*ee������������Z �G�d+��d,ee������������Z!�G�d-��d.ee������������Z"�G�d/��d e ������������Z#dS�)0zAcontextlib2 - backports and enhancements to the contextlib module�����N)�deque��wraps�� MethodType)�GenericAliasc�������������������������e�Zd�ZdS�)r���N)�__name__� __module__�__qualname__��������e/builddir/build/BUILD/cloudlinux-venv-1.0.2/venv/lib/python3.11/site-packages/contextlib2/__init__.pyr���r������s���������������r���r���) �asynccontextmanager�contextmanager�closing�nullcontext�AbstractContextManager�AbstractAsyncContextManager�AsyncExitStack�ContextDecorator� ExitStack�redirect_stdout�redirect_stderr�suppress�aclosing�ContextStackc��������������������d�����e�Zd�ZdZ�ee������������Zd��Zej ��������d����������������Z ed����������������ZdS�)r���z,An abstract base class for context managers.c�����������������������|�S��z0Return `self` upon entering the runtime context.r �����selfs��� r���� __enter__z AbstractContextManager.__enter__"���s�������r���c�����������������������dS��z9Raise any exception triggered within the runtime context.Nr ����r"����exc_type� exc_value� tracebacks��� r����__exit__zAbstractContextManager.__exit__&���s ��������tr���c������������������N�����|�t�����������u�rt����������j��������|dd������������S�t����������S�)Nr#���r*���)r����_collections_abc�_check_methods�NotImplemented��cls�Cs��� r����__subclasshook__z'AbstractContextManager.__subclasshook__+���s)�������(�(�(�#�2�1�k�:�N�N�N��r���N)r ���r���r����__doc__�classmethodr����__class_getitem__r#����abc�abstractmethodr*���r2���r ���r���r���r���r������ss��������������6�6�#��L�1�1�������� ����������������[�����r���r���c��������������������d�����e�Zd�ZdZ�ee������������Zd��Zej ��������d����������������Z ed����������������ZdS�)r���z9An abstract base class for asynchronous context managers.c������������������� ���K����|�S�r ���r ���r!���s��� r���� __aenter__z&AbstractAsyncContextManager.__aenter__8���s�����������r���c������������������� ���K����dS�r%���r ���r&���s��� r���� __aexit__z%AbstractAsyncContextManager.__aexit__<���s ������������tr���c������������������N�����|�t�����������u�rt����������j��������|dd������������S�t����������S�)Nr:���r<���)r���r,���r-���r.���r/���s��� r���r2���z,AbstractAsyncContextManager.__subclasshook__A���s3�������-�-�-�#�2�1�l�3>�@��@�� @��r���N)r ���r���r���r3���r4���r���r5���r:���r6���r7���r<���r2���r ���r���r���r���r���2���ss��������������C�C�#��L�1�1�������� ����������������[�����r���r���c��������������������$�����e�Zd�ZdZd��Zd��Zd��ZdS�)r���zJA base class or mixin that enables context managers to work as decorators.c������������������^�����t����������j��������dt�����������������������|������������������������������������S�)a���Returns the context manager used to actually wrap the call to the decorated function. The default implementation just returns *self*. Overriding this method allows otherwise one-shot context managers like _GeneratorContextManager to support use as decorators via implicit recreation. DEPRECATED: refresh_cm was never added to the standard library's ContextDecorator API z2refresh_cm was never added to the standard library)�warnings�warn�DeprecationWarning�_recreate_cmr!���s��� r���� refresh_cmzContextDecorator.refresh_cmL���s0������� � �J�(� *�� *�� *�� � �"�"�"r���c�����������������������|�S�)a6��Return a recreated instance of self. Allows an otherwise one-shot context manager like _GeneratorContextManager to support use as a decorator via implicit recreation. This is a private interface just for _GeneratorContextManager. See issue #11647 for details. r ���r!���s��� r���rC���zContextDecorator._recreate_cm]���s ��������r���c������������������@��������t��������������������������fd���������������}|S�)Nc�������������������p�������������������������������������������5����|�i�|��cd�d�d��������������S�#�1�swxY�w�Y���d�S��N�rC�����args�kwds�funcr"���s��� ��r����innerz(ContextDecorator.__call__.<locals>.innerj���s���������"�"�$�$�� +�� +��t�T�*�T�*�*� +�� +�� +�� +�� +�� +�� +�� +�� +�� +�� +�� +����� +�� +�� +�� +�� +�� +s����+�/�/r����r"���rM���rN���s���`` r����__call__zContextDecorator.__call__i���s9�������� �t��� +�� +�� +�� +�� +�� �� +���r���N)r ���r���r���r3���rD���rC���rP���r ���r���r���r���r���I���sG��������������P�P�#��#��#�" �� �� ���������r���r���c�������������������������e�Zd�ZdZd��Zd��ZdS�)�AsyncContextDecoratorzPA base class or mixin that enables async context managers to work as decorators.c�����������������������|�S�)z-Return a recreated instance of self. r ���r!���s��� r���rC���z"AsyncContextDecorator._recreate_cmt���s ��������r���c������������������@��������t��������������������������fd���������������}|S�)Nc������������������������K�����������������������������������������4��d�{V������|�i�|����d�{V���cd�d�d��������������d�{V����S�#�1��d�{V���swxY�w�Y���d�S�rH���rI���rJ���s��� ��r���rN���z-AsyncContextDecorator.__call__.<locals>.innerz���s�������������(�(�*�*�� 1�� 1�� 1�� 1�� 1�� 1�� 1�� 1�!�T�4�0�4�0�0�0�0�0�0�0�0� 1�� 1�� 1�� 1�� 1�� 1�� 1�� 1�� 1�� 1�� 1�� 1�� 1�� 1�� 1�� 1�� 1�� 1�� 1�� 1�� 1�� 1�� 1�� 1����� 1�� 1�� 1�� 1�� 1�� 1s����?� A �A r���rO���s���`` r���rP���zAsyncContextDecorator.__call__y���s9�������� �t��� 1�� 1�� 1�� 1�� 1�� �� 1���r���N)r ���r���r���r3���rC���rP���r ���r���r���rR���rR���q���s8��������������V�V������ ��������r���rR���c�������������������������e�Zd�ZdZd��ZdS�)�_GeneratorContextManagerBasezBShared functionality for @contextmanager and @asynccontextmanager.c������������������������||i�|��|�_���������|||c|�_��������|�_��������|�_��������t ����������|dd�������������}|�t����������|�������������j��������}||�_��������d�S�)Nr3���)�genrM���rK���rL����getattr�typer3���)r"���rM���rK���rL����docs��� r����__init__z%_GeneratorContextManagerBase.__init__����s]�������4��&��&�&���*.��d�'�� �4�9�d�i��d�I�t�,�,���;��t�*�*�$�C�����r���N)r ���r���r���r3���r]���r ���r���r���rW���rW�������s)��������������L�L���������r���rW���c��������������������$�����e�Zd�ZdZd��Zd��Zd��ZdS�)�_GeneratorContextManagerz%Helper for @contextmanager decorator.c������������������N�����|�����������������������|�j��������|�j��������|�j��������������������S�rH����� __class__rM���rK���rL���r!���s��� r���rC���z%_GeneratorContextManager._recreate_cm����� ��������~�~�d�i���D�I�>�>�>r���c������������������t�����|�`�|�`|�` �t����������|�j��������������������S�#�t ����������$�r�t ����������d������������d��w�xY�w�Nzgenerator didn't yield)rK���rL���rM����nextrY���� StopIteration�RuntimeErrorr!���s��� r���r#���z"_GeneratorContextManager.__enter__����sU������� �I�t�y�$�)� C����>�>�!���� C�� C�� C��7�8�8�d�B� C���s������7c����������������������|�5 �t����������|�j���������������������t����������d�������������#�t����������$�r�Y�dS�w�xY�w|� �|��������������} �|�j�����������������������������|||�������������nj#�t����������$�r}||ucY�d�}~S�d�}~wt����������$�r(}||u�rY�d�}~dS�|t����������u�r|j��������|u�rY�d�}~dS���d�}~w�t ����������j����������������������d���������|u�rY�dS���xY�wt����������d�������������)N�generator didn't stopF����z#generator didn't stop after throw())rf���rY���rh���rg����throw� __cause__�sys�exc_info)r"���r[����valuer)����excs��� r���r*���z!_GeneratorContextManager.__exit__����sC������<� <��T�X�����#�#:�;�;�;���!�� �� �� ��u�u� ���� ��}������� �����t�U�I�6�6�6�6�� �� (�� (�� (���%�'�'�'�'�'�'�'������� �� �� ��%�<�<� �5�5�5�5�5���=�(�(�S�]�e�-C�-C� �5�5�5�5�5������ ���<�>�>�!�$��-�-� �5�5������D�E�E�EsH����'�� 5�5�A"��" C �,A5�/C �5 C �B%�B%�$B%�% C �C N)r ���r���r���r3���rC���r#���r*���r ���r���r���r_���r_�������sQ���������������0�/�?��?��?�C��C��C�-F��-F��-F��-F��-Fr���r_���c��������������������$�����e�Zd�ZdZd��Zd��Zd��ZdS�)�_AsyncGeneratorContextManagerz Helper for @asynccontextmanager.c������������������N�����|�����������������������|�j��������|�j��������|�j��������������������S�rH���ra���r!���s��� r���rC���z*_AsyncGeneratorContextManager._recreate_cm����rc���r���c����������������������K���� �|�j����������������������������������������������d�{V���S�#�t����������$�r�t����������d������������d��w�xY�wre���)rY���� __anext__�StopAsyncIterationrh���r!���s��� r���r:���z(_AsyncGeneratorContextManager.__aenter__����sb���������� C���+�+�-�-�-�-�-�-�-�-�-��!�� C�� C�� C��7�8�8�d�B� C���s����#��>c����������������������K����|�@ �|�j����������������������������������������������d�{V����t����������d�������������#�t����������$�r�Y�d�S�w�xY�w|� �|��������������} �|�j������������������������������|||��������������d�{V����t����������d�������������#�t����������$�r}||ucY�d�}~S�d�}~wt����������$�r;}||u�rY�d�}~dS�t����������|t����������t����������f������������r|j��������|u�rY�d�}~dS���d�}~wt����������$�r}||ur��Y�d�}~d�S�d�}~ww�xY�w)Nrj���z$generator didn't stop after athrow()F) rY���rv���rh���rw����athrow� isinstancerg���rm���� BaseException)r"����typrp���r)���rq���s��� r���r<���z'_AsyncGeneratorContextManager.__aexit__����s�����������;� <��h�(�(�*�*�*�*�*�*�*�*�*��#�#:�;�;�;���&�� �� �� ���� ���� ��}������ ��h�o�o�c�5�)�<�<�<�<�<�<�<�<�<�"�#I�J�J�J��%�� (�� (�� (��%�'�'�'�'�'�'�'������� �� �� ��%�<�<� �5�5�5�5�5���e�m�5G�%H�I�I��%��}��-�-�$�u�u�u�u�u������ �� �� �� ��e�#�#���$�#�#�#�#�#����� ���sQ����4�� A�A�1B�� C6� B�C6� C6�#C�-%C�C� C6�&C1�1C6N)r ���r���r���r3���rC���r:���r<���r ���r���r���rs���rs�������sL���������������+�*�?��?��?�C��C��C�!��!��!��!��!r���rs���c������������������<�������t��������������������������fd���������������}|S�)a���@contextmanager decorator. Typical usage: @contextmanager def some_generator(<arguments>): <setup> try: yield <value> finally: <cleanup> This makes this: with some_generator(<arguments>) as <variable>: <body> equivalent to this: <setup> try: <variable> = <value> <body> finally: <cleanup> c�������������������&������t�����������|�|������������S�rH���)r_����rK���rL���rM���s��� �r����helperzcontextmanager.<locals>.helper'��s�������'��d�D�9�9�9r���r����rM���r����s���` r���r���r�����s3�������6��4�[�[�:��:��:��:���[�:��Mr���c������������������<�������t��������������������������fd���������������}|S�)a���@asynccontextmanager decorator. Typical usage: @asynccontextmanager async def some_async_generator(<arguments>): <setup> try: yield <value> finally: <cleanup> This makes this: async with some_async_generator(<arguments>) as <variable>: <body> equivalent to this: <setup> try: <variable> = <value> <body> finally: <cleanup> c�������������������&������t�����������|�|������������S�rH���)rs���r���s��� �r���r����z#asynccontextmanager.<locals>.helperH��s�������,�T�4��>�>�>r���r���r����s���` r���r���r���-��s3�������6��4�[�[�?��?��?��?���[�?��Mr���c��������������������$�����e�Zd�ZdZd��Zd��Zd��ZdS�)r���a2��Context to automatically close something at the end of a block. Code like this: with closing(<module>.open(<arguments>)) as f: <block> is equivalent to this: f = <module>.open(<arguments>) try: <block> finally: f.close() c�����������������������||�_���������d�S�rH�����thing�r"���r����s��� r���r]���zclosing.__init___��� �������� � � r���c�����������������������|�j���������S�rH���r����r!���s��� r���r#���zclosing.__enter__a��s �������z�r���c������������������8�����|�j���������������������������������������������d�S�rH���)r�����close�r"���ro���s��� r���r*���zclosing.__exit__c��s������� �������r���N�r ���r���r���r3���r]���r#���r*���r ���r���r���r���r���N��sK����������������� ������������������r���r���c��������������������$�����e�Zd�ZdZd��Zd��Zd��ZdS�)r���a���Async context manager for safely finalizing an asynchronously cleaned-up resource such as an async generator, calling its ``aclose()`` method. Code like this: async with aclosing(<module>.fetch(<arguments>)) as agen: <block> is equivalent to this: agen = <module>.fetch(<arguments>) try: <block> finally: await agen.aclose() c�����������������������||�_���������d�S�rH���r����r����s��� r���r]���zaclosing.__init__y��r����r���c����������������������K����|�j���������S�rH���r����r!���s��� r���r:���zaclosing.__aenter__{��s�����������z�r���c�������������������H���K����|�j����������������������������������������������d�{V����d�S�rH���)r�����acloser����s��� r���r<���zaclosing.__aexit__}��s2�����������j���!�!�!�!�!�!�!�!�!�!�!r���N)r ���r���r���r3���r]���r:���r<���r ���r���r���r���r���g��sK�����������������"����������"��"��"��"��"r���r���c��������������������$�����e�Zd�ZdZd��Zd��Zd��ZdS�)�_RedirectStreamNc������������������"�����||�_���������g�|�_��������d�S�rH���)�_new_target�_old_targets)r"���� new_targets��� r���r]���z_RedirectStream.__init__���s������%�������r���c�����������������������|�j������������������������������t����������t����������|�j���������������������������������t����������t����������|�j��������|�j���������������������|�j��������S�rH���)r�����appendrZ���rn����_stream�setattrr����r!���s��� r���r#���z_RedirectStream.__enter__���sE�������� � ���d�l�!;�!;�<�<�<���T�\�4�#3�4�4�4���r���c������������������j�����t����������t����������|�j��������|�j��������������������������������������������������������d�S�rH���)r����rn���r����r�����pop�r"����exctype�excinst�exctbs��� r���r*���z_RedirectStream.__exit__���s+��������T�\�4�#4�#8�#8�#:�#:�;�;�;�;�;r���)r ���r���r���r����r]���r#���r*���r ���r���r���r����r�������sF���������������G������ �� �� � <��<��<��<��<r���r����c�������������������������e�Zd�ZdZdZdS�)r���aA��Context manager for temporarily redirecting stdout to another file. # How to send help() to stderr with redirect_stdout(sys.stderr): help(dir) # How to write help() to a file with open('help.txt', 'w') as f: with redirect_stdout(f): help(pow) �stdoutN�r ���r���r���r3���r����r ���r���r���r���r������s�������������� �� ���G�G�Gr���r���c�������������������������e�Zd�ZdZdZdS�)r���zCContext manager for temporarily redirecting stderr to another file.�stderrNr����r ���r���r���r���r������s��������������M�M��G�G�Gr���r���c��������������������$�����e�Zd�ZdZd��Zd��Zd��ZdS�)r���a?��Context manager to suppress specified exceptions After the exception is suppressed, execution proceeds with the next statement following the with statement. with suppress(FileNotFoundError): os.remove(somefile) # Execution still resumes here if the file was already removed c�����������������������||�_���������d�S�rH���)�_exceptions)r"���� exceptionss��� r���r]���zsuppress.__init__���s������%����r���c�����������������������d�S�rH���r ���r!���s��� r���r#���zsuppress.__enter__�����������r���c������������������4�����|d�uot����������||�j��������������������S�rH���)� issubclassr����r����s��� r���r*���zsuppress.__exit__���s!��������d�"�L�z�'�4�;K�'L�'L�Lr���Nr����r ���r���r���r���r������sP�����������������&��&��&� �� �� � M�� M�� M�� M�� Mr���r���c��������������������j�����e�Zd�ZdZed����������������Zed����������������Zd��Zd��Zd��Z d��Z d��Zd ��Zd d�Z dS�)�_BaseExitStackz.A base class for ExitStack and AsyncExitStack.c������������������"�����t����������||�������������S�rH���r�����cm�cm_exits��� r����_create_exit_wrapperz#_BaseExitStack._create_exit_wrapper�����������'�2�&�&�&r���c�������������������"�����������^�������fd�}|S�)Nc���������������������������i�����d�S�rH���r ����r'���rq����tbrK����callbackrL���s��� ���r���� _exit_wrapperz8_BaseExitStack._create_cb_wrapper.<locals>._exit_wrapper���s��������H�d�#�d�#�#�#�#�#r���r ����rK���rL���r����r����s���`` @r����_create_cb_wrapperz!_BaseExitStack._create_cb_wrapper���s9�������������4� $�� $�� $�� $�� $�� $�� $��r���c������������������,�����t������������������������|�_��������d�S�rH���)r����_exit_callbacksr!���s��� r���r]���z_BaseExitStack.__init__���s������$�w�w����r���c������������������r������t����������|���������������������������}|�j��������|_��������t������������������������|�_��������|S�)z@Preserve the context stack by transferring it to a new instance.)r[���r����r���)r"���� new_stacks��� r����pop_allz_BaseExitStack.pop_all���s0�������D��J�J�L�L� �$(�$8� �!�$�w�w����r���c�����������������������t����������|������������} �|j��������}|����������������������||�������������n%#�t����������$�r�|����������������������|�������������Y�nw�xY�w|S�)a��Registers a callback with the standard __exit__ method signature. Can suppress exceptions the same way __exit__ method can. Also accepts any object with an __exit__ method (registering a call to the method instead of the object itself). )r[���r*���� _push_cm_exit�AttributeError�_push_exit_callback�r"����exit�_cb_type�exit_methods��� r����pushz_BaseExitStack.push���su���������:�:�� 2�"�+�K� � ���t�[�1�1�1�1�� ��� +�� +�� +��$�$�T�*�*�*�*�*� +���� ��s����/��A�Ac�����������������������t����������|������������}|j��������}|���������������������|������������}|����������������������||�������������|S�)z�Enters the supplied context manager. If successful, also pushes its __exit__ method as a callback and returns the result of the __enter__ method. )r[���r*���r#���r�����r"���r�����_cm_type�_exit�results��� r���� enter_contextz_BaseExitStack.enter_context���sE���������8�8���!���#�#�B�'�'�����2�u�%�%�%�� r���c�������������������,���� �|�^}}}�n_#�t�����������$�rR}t����������|���������������������������������d������������d���������}d���������������������|������������}t ����������|������������d�d}~ww�xY�w�|j��������|g|��R�i�|��}||_��������|���������������������|�������������|S�)z\Registers an arbitrary callback and arguments. Cannot suppress exceptions. �(�����"Not enough positional arguments {}N)� ValueError�str� partition�format� TypeErrorr�����__wrapped__r�����rK���rL���r"���r����rq����exc_details�msgr����s��� r���r����z_BaseExitStack.callback��s������� +�$(�!�D�(�T�T���� +�� +�� +��c�(�(�,�,�S�1�1�!�4�K�6�=�=�k�J�J�C��C�.�.�d�*����� +�����0��/��H�4�H�H�H�4�H�H� ��%-� �!�� � ��/�/�/��������� A$�A A�A$c������������������^�����|�����������������������||������������}|����������������������|d�������������dS�)z;Helper to correctly register callbacks to __exit__ methods.TN)r����r�����r"���r����r����r����s��� r���r����z_BaseExitStack._push_cm_exit��s3�������1�1�"�g�>�>� �� � ���5�5�5�5�5r���Tc������������������>�����|�j������������������������������||f�������������d�S�rH���)r����r����)r"���r�����is_syncs��� r���r����z"_BaseExitStack._push_exit_callback��s$��������#�#�W�h�$7�8�8�8�8�8r���N)T)r ���r���r���r3����staticmethodr����r����r]���r����r����r����r����r����r����r ���r���r���r����r�������s���������������8�8��'��'���\�'��������\��'��'��'�����������(����������(6��6��6� 9��9��9��9��9��9r���r����c��������������������$�����e�Zd�ZdZd��Zd��Zd��ZdS�)r���a���Context manager for dynamic management of a stack of exit callbacks. For example: with ExitStack() as stack: files = [stack.enter_context(open(fname)) for fname in filenames] # All opened files will automatically be closed at the end of # the with statement, even if attempts to open files later # in the list raise an exception. c�����������������������|�S�rH���r ���r!���s��� r���r#���zExitStack.__enter__+��s�������r���c��������������������� ��|d���������d�u}t����������j����������������������d���������� � fd�}d}d}|�j��������rj|�j�������������������������������������������\��}}|sJ�� ��||��rd}d}d}n6#��t����������j����������������������}�||d���������|d����������������������d}|}Y�nxY�w|�j���������j|r2 �|d���������j��������} |d����������#�t ����������$�r�| |d���������_����������w�xY�w|o|S�)Nr���rk���c������������������F������ �|�j���������}||u�rd�S�|�|�u�rn|}��||�_���������d�S�rH�����__context__��new_exc�old_exc�exc_context� frame_excs��� �r����_fix_exception_contextz2ExitStack.__exit__.<locals>._fix_exception_context4���M������� &�%�1���'�)�)��F��&�+��*B�*B��%�� &��#*�G���r���FT�NNN�rn���ro���r����r����r����r{���)r"���r�����received_excr�����suppressed_exc� pending_raiser�����cb�new_exc_details� fixed_ctxr����s��� @r���r*���zExitStack.__exit__.��sA������"�1�~�T�1����L�N�N�1�%� � *�� *�� *�� *�� *� ���� ��"�� .��.�2�2�4�4�K�G�R��N�N�N� .��2�{�#��5�%)�N�$)�M�"4�K��� .�"%�,�.�.��&�&��q�'9�;�q�>�J�J�J� $� �-���������"�� .���� � ��(��N�6� �!�!�n�$�� �� �� �� �-6��A��*�� ������.��.s����A"��"1B�"B7��7Cc������������������4�����|�����������������������ddd�������������dS��z%Immediately unwind the context stack.N)r*���r!���s��� r���r����zExitStack.close_��s������� � �d�D�$�'�'�'�'�'r���N)r ���r���r���r3���r#���r*���r����r ���r���r���r���r��� ��sL����������������������//��//��//�b(��(��(��(��(r���r���c��������������������h�����e�Zd�ZdZed����������������Zed����������������Zd��Zd��Zd��Z d��Z d��Zd ��Zd ��Z dS�)r���a���Async context manager for dynamic management of a stack of exit callbacks. For example: async with AsyncExitStack() as stack: connections = [await stack.enter_async_context(get_connection()) for i in range(5)] # All opened connections will automatically be released at the # end of the async with statement, even if attempts to open a # connection later in the list raise an exception. c������������������"�����t����������||�������������S�rH���r���r����s��� r����_create_async_exit_wrapperz)AsyncExitStack._create_async_exit_wrapperr��r����r���c�������������������"�����������^�������fd�}|S�)Nc�������������������(����K�������i������d�{V����d�S�rH���r ���r����s��� ���r���r����z>AsyncExitStack._create_async_cb_wrapper.<locals>._exit_wrapperz��s4������������(�D�)�D�)�)�)�)�)�)�)�)�)�)�)r���r ���r����s���`` @r����_create_async_cb_wrapperz'AsyncExitStack._create_async_cb_wrapperv��s9�������������4� *�� *�� *�� *�� *�� *�� *��r���c����������������������K����t����������|������������}|j��������}|���������������������|��������������d{V���}|����������������������||�������������|S�)z�Enters the supplied async context manager. If successful, also pushes its __aexit__ method as a callback and returns the result of the __aenter__ method. N)r[���r<���r:����_push_async_cm_exitr����s��� r����enter_async_contextz"AsyncExitStack.enter_async_context~��s[�������������8�8���"���*�*�2�.�.�.�.�.�.�.�.��� � ��U�+�+�+�� r���c�����������������������t����������|������������} �|j��������}|����������������������||�������������n&#�t����������$�r�|����������������������|d�������������Y�nw�xY�w|S�)a#��Registers a coroutine function with the standard __aexit__ method signature. Can suppress exceptions the same way __aexit__ method can. Also accepts any object with an __aexit__ method (registering a call to the method instead of the object itself). F)r[���r<���r��r����r����r����s��� r����push_async_exitzAsyncExitStack.push_async_exit���sw���������:�:�� 8�"�,�K� � �$�$�T�;�7�7�7�7�� ��� 2�� 2�� 2��$�$�T�5�1�1�1�1�1� 2���� ��s����/�� A�Ac�������������������.���� �|�^}}}�n_#�t�����������$�rR}t����������|���������������������������������d������������d���������}d���������������������|������������}t ����������|������������d�d}~ww�xY�w�|j��������|g|��R�i�|��}||_��������|���������������������|d�������������|S�)zfRegisters an arbitrary coroutine function and arguments. Cannot suppress exceptions. r����r����r����NF)r����r����r����r����r����r��r����r����r����s��� r����push_async_callbackz"AsyncExitStack.push_async_callback���s������� +�$(�!�D�(�T�T���� +�� +�� +��c�(�(�,�,�S�1�1�!�4�K�6�=�=�k�J�J�C��C�.�.�d�*����� +�����6��5�h�N��N�N�N��N�N� ��%-� �!�� � ���6�6�6��r����c�������������������D���K����|�����������������������ddd��������������d{V����dS�r����)r<���r!���s��� r���r����zAsyncExitStack.aclose���s4�����������n�n�T�4��.�.�.�.�.�.�.�.�.�.�.r���c������������������^�����|�����������������������||������������}|����������������������|d�������������dS�)zLHelper to correctly register coroutine function to __aexit__ method.FN)r��r����r����s��� r���r��z"AsyncExitStack._push_async_cm_exit���s5��������7�7��G�D�D� �� � ���6�6�6�6�6r���c������������������� ���K����|�S�rH���r ���r!���s��� r���r:���zAsyncExitStack.__aenter__���s�����������r���c�����������������������K����|d���������d�u}t����������j����������������������d�����������fd�}d}d}|�j��������rv|�j�������������������������������������������\��}} �|r�||��}n�||����d�{V���}|rd}d}d}n6#��t����������j����������������������} �|| d���������|d����������������������d}| }Y�nxY�w|�j���������v|r2 �|d���������j��������} |d����������#�t ����������$�r�| |d���������_����������w�xY�w|o|S�)Nr���rk���c������������������F������ �|�j���������}||u�rd�S�|�|�u�rn|}��||�_���������d�S�rH���r����r����s��� �r���r����z8AsyncExitStack.__aexit__.<locals>._fix_exception_context���r����r���FTr����r����)r"���r����r����r����r����r����r����r�����cb_suppressr����r����r����s��� @r���r<���zAsyncExitStack.__aexit__���si����������"�1�~�T�1����L�N�N�1�%� � *�� *�� *�� *�� *� ���� ��"�� .��.�2�2�4�4�K�G�R� .���9�"$�"�k�"2�K�K�(*��K�(8�"8�"8�"8�"8�"8�"8�K���5�%)�N�$)�M�"4�K��� .�"%�,�.�.��&�&��q�'9�;�q�>�J�J�J� $� �-�������#��"�� .�$��� � ��(��N�6� �!�!�n�$�� �� �� �� �-6��A��*�� ������.��.s����A0��01B#�0C��CN)r ���r���r���r3���r����r��r��r��r ��r��r����r��r:���r<���r ���r���r���r���r���e��s��������������� �� ���'��'���\�'��������\�� �� �� ������$�����(/��/��/�7��7��7������3/��3/��3/��3/��3/r���r���c��������������������2�����e�Zd�ZdZdd�Zd��Zd��Zd��Zd��ZdS�) r���aO��Context manager that does no additional processing. Used as a stand-in for a normal context manager, when a particular block of code is only sometimes used with a normal context manager: cm = optional_cm if condition else nullcontext() with cm: # Perform operation, using optional_cm if condition is True Nc�����������������������||�_���������d�S�rH�����enter_result)r"���r��s��� r���r]���znullcontext.__init__���s������(����r���c�����������������������|�j���������S�rH���r��r!���s��� r���r#���znullcontext.__enter__��s������� � r���c�����������������������d�S�rH���r ����r"����excinfos��� r���r*���znullcontext.__exit__��r����r���c����������������������K����|�j���������S�rH���r��r!���s��� r���r:���znullcontext.__aenter__��s����������� � r���c������������������� ���K����d�S�rH���r ���r��s��� r���r<���znullcontext.__aexit__ ��s�����������r���rH���) r ���r���r���r3���r]���r#���r*���r:���r<���r ���r���r���r���r������sn�����������������)��)��)��)�!��!��!� �� �� �!��!��!� �� �� �� �� r���r���c��������������������4�������e�Zd�ZdZ��fd�Zd��Zd��Zd��Z��xZS�)r���z+Backwards compatibility alias for ExitStackc������������������������t����������j��������dt�����������������������t����������t����������|�������������������������������������������������d�S�)Nz*ContextStack has been renamed to ExitStack)r@���rA���rB����superr���r]���)r"���rb���s��� �r���r]���zContextStack.__init__��s?�������� �B�(� *�� *�� *� �l�D�!�!�*�*�,�,�,�,�,r���c������������������,�����|�����������������������|������������S�rH���)r����)r"���r����s��� r���� register_exitzContextStack.register_exit��s�������y�y��"�"�"r���c������������������$������|�j���������|g|�R�i�|��S�rH���)r����)r"���r����rK���rL���s��� r����registerzContextStack.register��s$�������t�}�X�5��5�5�5��5�5�5r���c������������������*�����|�������������������������������������S�rH���)r����r!���s��� r����preservezContextStack.preserve��s�������|�|�~�~�r���) r ���r���r���r3���r]���r ��r"��r$��� __classcell__)rb���s���@r���r���r�����sk���������������5�5�-��-��-��-��-� #��#��#�6��6��6�������������r���)$r3���r6���rn���r@���r,����collectionsr���� functoolsr����typesr���r����ImportError�__all__�ABCr���r����objectr���rR���rW���r_���rs���r���r���r���r���r����r���r���r���r����r���r���r���r���r ���r���r����<module>r-�����sb�����G��G�� � � � �� � � � �������������������������������������������������� �"�"�"�"�"�"�"���� �� �� � �� �� �� �� �� �� �� �� �� � ����I��I��I����N��������������S�W�������*���������#�'�������.%��%��%��%��%�v��%��%��%�P �� �� �� �� �F�� �� �� � �� �� �� �� �� �� �� �$AF��AF��AF��AF��AF�;�5�/�AF��AF��AF�H2��2��2��2��2�$@�$?�$9�2��2��2�j�����B�����B���������$�������2"��"��"��"��"�*��"��"��"�4<��<��<��<��<�,��<��<��<�$ �� �� �� �� �o�� �� �� � ���������o�������M��M��M��M��M�%��M��M��M�<U9��U9��U9��U9��U9��U9��U9��U9�rA(��A(��A(��A(��A(�� 6��A(��A(��A(�JK/��K/��K/��K/��K/�^�%@��K/��K/��K/�\ �� �� �� �� �(�*E�� �� �� �8���������9����������s����-��A�A