⚝
One Hat Cyber Team
⚝
Your IP:
3.143.218.47
Server IP:
97.74.87.16
Server:
Linux 16.87.74.97.host.secureserver.net 5.14.0-503.38.1.el9_5.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Apr 18 08:52:10 EDT 2025 x86_64
Server Software:
Apache
PHP Version:
8.2.28
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
usr
/
lib64
/
python3.9
/
asyncio
/
__pycache__
/
View File Name :
tasks.cpython-39.pyc
a �����DOgs�����������������������@���s���d�Z�dZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddlmZ�ddlm Z �ddlmZ�ddlmZ�dd lmZ�dd lmZ�ddlmZ�e�d�jZdEdd �ZdFdd�ZdGdd�Zdd��ZG�dd��dej�ZeZzddlZW�n�e�y���Y�n0�ej�ZZdd�dd�Z ejj!Z!ejj"Z"ejj#Z#dde#d�dd�Z$dd��Z%dd�dd �Z&d!d"��Z'd#d$��Z(ddd%�d&d'�Z)ej*d(d)���Z+dHdd�d*d+�Z,dd�d,d-�Z-ej*d.d/���Z.ee._G�d0d1��d1ej/�Z0dd2d3�d4d5�Z1dd2d3�d6d7�Z2dd�d8d9�Z3d:d;��Z4e �5��Z6i�Z7d<d=��Z8d>d?��Z9d@dA��Z:dBdC��Z;e8Z<e;Z=e9Z>e:Z?z$ddDlm8Z8m;Z;m9Z9m:Z:m6Z6m7Z7�W�n�e�yz���Y�n0�e8Z@e;ZAe9ZBe:ZCdS�)Iz0Support for tasks, coroutines and the scheduler.)�Task�create_task�FIRST_COMPLETED�FIRST_EXCEPTION� ALL_COMPLETED�wait�wait_for�as_completed�sleep�gather�shield� ensure_future�run_coroutine_threadsafe�current_task� all_tasks�_register_task�_unregister_task�_enter_task�_leave_task�����N)�GenericAlias����)� base_tasks)� coroutines)�events)� exceptions)�futures)� _is_coroutinec�����������������C���s���|�du�rt����}�t�|��S�)z!Return a currently executed task.N)r����get_running_loop�_current_tasks�get��loop��r"����%/usr/lib64/python3.9/asyncio/tasks.pyr���#���s����r���c��������������������s\�����du�rt������d}ztt�}W�qJ�tyD���|d7�}|dkr@��Y�q0�qJq��fdd�|D��S�)z'Return a set of all tasks for the loop.Nr���r�������c��������������������s&���h�|�]}t��|���u�r|���s|�qS�r"���)r���� _get_loop�done��.0�tr ���r"���r#���� <setcomp>=���s����zall_tasks.<locals>.<setcomp>)r���r����list� _all_tasks�RuntimeError�r!����iZtasksr"���r ���r#���r���*���s����r���c��������������������s\�����d�u�rt������d}ztt�}W�qJ�tyD���|d7�}|dkr@��Y�q0�qJq��fdd�|D��S�)Nr���r���r$���c��������������������s���h�|�]}t��|���u�r|�qS�r"���)r���r%���r'���r ���r"���r#���r*���V��������z$_all_tasks_compat.<locals>.<setcomp>)r����get_event_loopr+���r,���r-���r.���r"���r ���r#����_all_tasks_compatA���s����r2���c�����������������C���s2���|d�ur.z |�j�}W�n�ty$���Y�n 0�||��d�S��N)�set_name�AttributeError)�task�namer4���r"���r"���r#����_set_task_nameY���s���� r8���c�����������������������s����e�Zd�ZdZdZddd���fdd� Z��fdd�Zee�Z d d ��Z dd��Zd d��Zdd��Z dd��Zdd��Zdd�dd�Zddd�dd�Zd!dd�Zd"��fdd� Zdd ��Z���ZS�)#r���z A coroutine wrapped in a Future.TN)r!���r7���c�������������������s����t���j|d��|�jr|�jd=�t�|�s:d|�_td|����|d�u�rRdt�����|�_n t |�|�_d|�_ d�|�_||�_t ���|�_|�jj|�j|�jd��t|���d�S�)Nr ������Fza coroutine was expected, got zTask-��context)�super�__init__�_source_tracebackr����iscoroutine�_log_destroy_pending� TypeError�_task_name_counter�_name�str�_must_cancel�_fut_waiter�_coro�contextvarsZcopy_context�_context�_loop� call_soon�_Task__stepr���)�self�coror!���r7����� __class__r"���r#���r=���u���s���� z Task.__init__c��������������������sF���|�j�tjkr8|�jr8|�dd�}|�jr,|�j|d<�|�j�|��t������d�S�)Nz%Task was destroyed but it is pending!)r6����messageZsource_traceback) �_stater���Z_PENDINGr@���r>���rJ���Zcall_exception_handlerr<����__del__)rM���r;���rO���r"���r#���rS�������s����� zTask.__del__c�����������������C���s ���t��|��S�r3���)r���Z_task_repr_info�rM���r"���r"���r#���� _repr_info����s����zTask._repr_infoc�����������������C���s���|�j�S�r3���)rG���rT���r"���r"���r#����get_coro����s����z Task.get_coroc�����������������C���s���|�j�S�r3���)rC���rT���r"���r"���r#����get_name����s����z Task.get_namec�����������������C���s���t�|�|�_d�S�r3���)rD���rC���)rM����valuer"���r"���r#���r4�������s����z Task.set_namec�����������������C���s���t�d��d�S�)Nz*Task does not support set_result operation�r-���)rM����resultr"���r"���r#���� set_result����s����zTask.set_resultc�����������������C���s���t�d��d�S�)Nz-Task does not support set_exception operationrY���)rM���� exceptionr"���r"���r#���� set_exception����s����zTask.set_exception)�limitc����������������C���s���t��|�|�S�)a���Return the list of stack frames for this task's coroutine. If the coroutine is not done, this returns the stack where it is suspended. If the coroutine has completed successfully or was cancelled, this returns an empty list. If the coroutine was terminated by an exception, this returns the list of traceback frames. The frames are always ordered from oldest to newest. The optional limit gives the maximum number of frames to return; by default all available frames are returned. Its meaning differs depending on whether a stack or a traceback is returned: the newest frames of a stack are returned, but the oldest frames of a traceback are returned. (This matches the behavior of the traceback module.) For reasons beyond our control, only one stack frame is returned for a suspended coroutine. )r���Z_task_get_stack)rM���r^���r"���r"���r#���� get_stack����s����zTask.get_stack)r^����filec����������������C���s���t��|�||�S�)an��Print the stack or traceback for this task's coroutine. This produces output similar to that of the traceback module, for the frames retrieved by get_stack(). The limit argument is passed to get_stack(). The file argument is an I/O stream to which the output is written; by default output is written to sys.stderr. )r���Z_task_print_stack)rM���r^���r`���r"���r"���r#����print_stack����s���� zTask.print_stackc�����������������C���s>���d|�_�|����rdS�|�jdur.|�jj|d�r.dS�d|�_||�_dS�)a���Request that this task cancel itself. This arranges for a CancelledError to be thrown into the wrapped coroutine on the next cycle through the event loop. The coroutine then has a chance to clean up or even deny the request using try/except/finally. Unlike Future.cancel, this does not guarantee that the task will be cancelled: the exception might be caught and acted upon, delaying cancellation of the task or preventing cancellation completely. The task may also return a value or raise a different exception. Immediately after this method is called, Task.cancelled() will not return True (unless the task was already cancelled). A task will be marked as cancelled when the wrapped coroutine terminates with a CancelledError exception (even if cancel() was not called). FN��msgT)Z_log_tracebackr&���rF����cancelrE����_cancel_message)rM���rc���r"���r"���r#���rd�������s���� zTask.cancelc�������������� ������s��|�����rt�d|��d|����|�jr>t|tj�s8|����}d|�_|�j}d�|�_t |�j |����z�z"|d�u�rp|�d��}n |�|�}W�n��t y��}�z:|�jr�d|�_t��j|�jd��nt���|j��W�Y�d�}~�n d�}~0��tj�y�}�z||�_t������W�Y�d�}~�n�d�}~0��ttf�y>�}�zt���|����W�Y�d�}~�n�d�}~0��t�yp�}�zt���|��W�Y�d�}~�n~d�}~0�0�t|dd��}|d�u�rjt�|�|�j u�r�td|��d|�d��}|�j j|�j||�jd ��n�|�r>||�u��r�td |����}|�j j|�j||�jd ��n>d|_|j |�j!|�jd ��||�_|�j�rh|�jj|�jd��rhd|�_n*td|��d|���}|�j j|�j||�jd ��n||d�u��r�|�j j|�j|�jd ��n\t"�#|��r�td |��d|���}|�j j|�j||�jd ��n$td|���}|�j j|�j||�jd ��W�t$|�j |���d�}�nt$|�j |���d�}�0�d�S�)Nz_step(): already done: z, Frb����_asyncio_future_blockingzTask z got Future z attached to a different loopr:���zTask cannot await on itself: z-yield was used instead of yield from in task z with z;yield was used instead of yield from for generator in task zTask got bad yield: )%r&���r����InvalidStateErrorrE���� isinstance�CancelledError�_make_cancelled_errorrG���rF���r���rJ����send�throw� StopIterationr<���rd���re���r[���rX���Z_cancelled_exc�KeyboardInterrupt� SystemExitr]���� BaseException�getattrr���r%���r-���rK���rL���rI���rf����add_done_callback� _Task__wakeup�inspectZisgeneratorr���)rM����excrN���rZ����blocking�new_excrO���r"���r#���Z__step����s������$ $ �� � � ������ � ��� � ��zTask.__stepc�������������� ���C���sL���z|�����W�n.�ty:�}�z|��|��W�Y�d�}~nd�}~0�0�|�����d�}�d�S�r3���)rZ���rp���rL���)rM����futureru���r"���r"���r#���Z__wakeupF��s���� z Task.__wakeup)N)N)�__name__� __module__�__qualname__�__doc__r@���r=���rS����classmethodr����__class_getitem__rU���rV���rW���r4���r[���r]���r_���ra���rd���rL���rs���� __classcell__r"���r"���rO���r#���r���c���s ��� "Wr���)r7���c����������������C���s ���t����}|�|��}t||��|S�)z]Schedule the execution of a coroutine object in a spawn task. Return a Task object. )r���r���r���r8���)rN���r7���r!���r6���r"���r"���r#���r���c��s���� r���)r!����timeout�return_whenc��������������������s����t��|��st�|��r(tdt|��j�����|�s4td��|tt t fvrPtd|�������du�rbt�����nt jdtdd��t|��}�tdd ��|�D���r�t jd tdd����fdd�|�D��}�t|�||���I�dH�S�) a���Wait for the Futures and coroutines given by fs to complete. The fs iterable must not be empty. Coroutines will be wrapped in Tasks. Returns two sets of Future: (done, pending). Usage: done, pending = await asyncio.wait(fs) Note: This does not raise TimeoutError! Futures that aren't done when the timeout occurs are returned in the second set. zexpect a list of futures, not z#Set of coroutines/Futures is empty.zInvalid return_when value: N�[The loop argument is deprecated since Python 3.8, and scheduled for removal in Python 3.10.������ stacklevelc�����������������s���s���|�]}t��|�V��qd�S�r3���)r���r?����r(����fr"���r"���r#���� <genexpr>���r0���zwait.<locals>.<genexpr>z�The explicit passing of coroutine objects to asyncio.wait() is deprecated since Python 3.8, and scheduled for removal in Python 3.11.c��������������������s���h�|�]}t�|��d���qS��r ����r���r����r ���r"���r#���r*������r0���zwait.<locals>.<setcomp>)r����isfuturer���r?���rA����typery���� ValueErrorr���r���r���r���r����warnings�warn�DeprecationWarning�set�any�_wait)�fsr!���r����r����r"���r ���r#���r���u��s$���� ��r���c�����������������G���s���|�����s|��d���d�S�r3���)r&���r[���)�waiter�argsr"���r"���r#����_release_waiter���s����r����r ���c������������� �������s���|du�rt����}ntjdtdd��|du�r4|�I�dH�S�|dkr�t|�|d�}�|����rX|����S�t|�|d�I�dH��z |����W�S��t j y��}�zt ���|�W�Y�d}~n d}~0�0�|���}|� |t|�}t�t|�}t|�|d�}�|��|��z�z|I�dH��W�nT�t j �yB���|�����r |�����Y�W�|����S�|��|��t|�|d�I�dH����Y�n0�|�����r`|����W�|����S�|��|��t|�|d�I�dH��z|����W�W�|����S��t j �y��}�zt ���|�W�Y�d}~n d}~0�0�W�|����n |����0�dS�)a���Wait for the single Future or coroutine to complete, with timeout. Coroutine will be wrapped in Task. Returns result of the Future or coroutine. When a timeout occurs, it cancels the task and raises TimeoutError. To avoid the task cancellation, wrap it in shield(). If the wait is cancelled, the task is also cancelled. This function is a coroutine. Nr����r����r����r���r ���)r���r���r����r����r����r���r&���rZ����_cancel_and_waitr���ri����TimeoutError� create_future� call_laterr����� functools�partialrr���rd����remove_done_callback)�futr����r!���ru���r�����timeout_handle�cbr"���r"���r#���r������sZ���� � � � �"r���c�������������� �������s����|�sJ�d��|�����d�|dur.|�|t���t|���������fdd�}|�D�]}|�|��qLz2�I�dH��W��durz�����|�D�]}|�|��q~n&�dur������|�D�]}|�|��q�0�t��t���}}|�D�]"}|���r�|� |��q�|� |��q�||fS�)zVInternal helper for wait(). The fs argument must be a collection of Futures. zSet of Futures is empty.Nc��������������������sZ�����d8�����dks4�t�ks4�tkrV|����sV|����d�urV�d�urD���������sV��d���d�S�)Nr���r���)r���r���� cancelledr\���rd���r&���r[����r�����Zcounterr����r����r����r"���r#����_on_completion���s������� �z_wait.<locals>._on_completion) r����r����r�����lenrr���rd���r����r����r&����add)r����r����r����r!���r����r����r&����pendingr"���r����r#���r�������s2�����r����c�������������� �������sP���|����}t�t|�}|��|��z |�����|I�dH��W�|��|��n|��|��0�dS�)z<Cancel the *fut* future or task and wait until it completes.N)r����r����r����r����rr���rd���r����)r����r!���r����r����r"���r"���r#���r������s���� r����)r!���r����c����������������#���s����t��|��st�|��r(tdt|��j������dur@tjdt dd��ddl m}�|�d���du�rft� ����fd d �t|��D���d�����fdd�}���fd d����fdd�}�D�]}|�����q��r�|dur؈�||��tt���D�]}|��V��q�dS�)a^��Return an iterator whose values are coroutines. When waiting for the yielded coroutines you'll get the results (or exceptions!) of the original Futures (or coroutines), in the order in which and as soon as they complete. This differs from PEP 3148; the proper way to use this is: for f in as_completed(fs): result = await f # The 'await' may raise. # Use result. If a timeout is specified, the 'await' will raise TimeoutError when the timeout occurs before all Futures are done. Note: The futures 'f' are not necessarily members of fs. z#expect an iterable of futures, not Nr����r����r����r���)�Queuer ���c��������������������s���h�|�]}t�|��d���qS�r����r����r����r ���r"���r#���r*���M��r0���zas_completed.<locals>.<setcomp>c���������������������s*����D�]}�|���������d���q�����d�S�r3���)r����� put_nowait�clearr����)r����r&����todor"���r#����_on_timeoutP��s���� z!as_completed.<locals>._on_timeoutc��������������������s4����sd�S����|������|����s0�d�ur0�����d�S�r3���)�remover����rd���r����)r&���r����r����r"���r#���r����V��s���� z$as_completed.<locals>._on_completionc����������������������s$���������I�d�H�}�|�d�u�rtj�|����S�r3���)r���r���r����rZ���r����)r&���r"���r#���� _wait_for_one^��s����z#as_completed.<locals>._wait_for_one)r���r����r���r?���rA���r����ry���r����r����r�����queuesr����r���r1���r����rr���r�����ranger����)r����r!���r����r����r����r����r�����_r"���)r����r&���r!���r����r����r#���r���.��s*����� r���c�������������������c���s ���dV��dS�)z�Skip one event loop run cycle. This is a private helper for 'asyncio.sleep()', used when the 'delay' is set to 0. It uses a bare 'yield' expression (which Task.__step knows how to handle) instead of creating a Future object. Nr"���r"���r"���r"���r#����__sleep0m��s���� r����c��������������������s~���|durt�jdtdd��|�dkr0t��I�dH��|S�|du�r@t���}|���}|�|�tj ||�}z|I�dH�W�|� ���S�|� ���0�dS�)z9Coroutine that completes after a given time (in seconds).Nr����r����r����r���)r����r����r����r����r���r���r����r����r���Z_set_result_unless_cancelledrd���)�delayrZ���r!���rx����hr"���r"���r#���r ���y��s&������ �r ���c����������������C���s����t��|��r6|du�rt���}|�|��}|jr2|jd=�|S�t�|��rb|dur^|t�|��ur^t d��|�S�t �|��r|tt |��|d�S�td��dS�)zmWrap a coroutine or an awaitable in a future. If the argument is a Future, it is returned directly. Nr9���zRThe future belongs to a different loop than the one specified as the loop argumentr ���z:An asyncio.Future, a coroutine or an awaitable is required)r���r?���r���r1���r���r>���r���r����r%���r����rt���Zisawaitabler����_wrap_awaitablerA���)Zcoro_or_futurer!���r6���r"���r"���r#���r������s���� r���c�����������������c���s���|�����E�dH�S�)z�Helper for asyncio.ensure_future(). Wraps awaitable (an object with __await__) into a coroutine that will later be wrapped in a Task by ensure_future(). N)� __await__)Z awaitabler"���r"���r#���r�������s����r����c�����������������������s0���e�Zd�ZdZdd���fdd� Zddd�Z���ZS�) �_GatheringFuturez�Helper for gather(). This overrides cancel() to cancel all the children and act more like Task.cancel(), which doesn't immediately mark itself as cancelled. Nr ���c�������������������s���t���j|d��||�_d|�_d�S�)Nr ���F)r<���r=���� _children�_cancel_requested)rM����childrenr!���rO���r"���r#���r=������s����z_GatheringFuture.__init__c�����������������C���s:���|�����rdS�d}|�jD�]}|j|d�rd}q|r6d|�_|S�)NFrb���T)r&���r����rd���r����)rM���rc����ret�childr"���r"���r#���rd������s���� z_GatheringFuture.cancel)N)ry���rz���r{���r|���r=���rd���r���r"���r"���rO���r#���r�������s���r����F�r!����return_exceptionsc�����������������G���s(���|�durt�jdtdd��t||�|d��S�)a���Return a future aggregating results from the given coroutines/futures. Coroutines will be wrapped in a future and scheduled in the event loop. They will not necessarily be scheduled in the same order as passed in. All futures must share the same event loop. If all the tasks are done successfully, the returned future's result is the list of results (in the order of the original sequence, not necessarily the order of results arrival). If *return_exceptions* is True, exceptions in the tasks are treated the same as successful results, and gathered in the result list; otherwise, the first raised exception will be immediately propagated to the returned future. Cancellation: if the outer Future is cancelled, all children (that have not completed yet) are also cancelled. If any child is cancelled, this is treated as if it raised CancelledError -- the outer Future is *not* cancelled in this case. (This is to prevent the cancellation of one child to cause other children to be cancelled.) If *return_exceptions* is False, cancelling gather() after it has been marked done won't cancel any submitted awaitables. For instance, gather can be marked done after propagating an exception to the caller, therefore, calling ``gather.cancel()`` after catching an exception (raised by one of the awaitables) from gather won't cancel any other awaitables. Nr����r����r����r����)r����r����r�����_gather)r!���r�����coros_or_futuresr"���r"���r#���r ������s �����r ���c��������������������s����|s*|�d�u�rt����}�|�������g����S�������fdd�}i�}g���d�d�d��|D�]f}||vr�t||�d�}|�d�u�r�t�|�}�||ur�d|_�d7��|||<�|�|��n||�}��� |��qVt ��|�d���S�)Nc��������������������s�����d7���d�u�s�����r,|����s(|�����d�S��sl|����rN|����}��|��d�S�|����}|d�url��|��d�S���kr�g�}��D�]J}�|����r�t�|�jd�u�r�dn|�j�}n|����}|d�u�r�|����}|� |��q|�j r�|����}��|��n ��|��d�S�)Nr�����)r&���r����r\���rj���r]���r���ri���re���rZ����appendr����r[���)r����ru����results�res�r����Z nfinishedZnfuts�outerr����r"���r#����_done_callback���s<���� �z_gather.<locals>._done_callbackr���r ���Fr���)r���r1���r����r[���r���r���r%���r@���rr���r����r����)r!���r����r����r����Z arg_to_fut�argr����r"���r����r#���r�������s4���� 7 r����c�������������������st���|durt�jdtdd��t|�|d������r0�S�t���}|�����fdd������fdd �}��������|���S�) a.��Wait for a future, shielding it from cancellation. The statement res = await shield(something()) is exactly equivalent to the statement res = await something() *except* that if the coroutine containing it is cancelled, the task running in something() is not cancelled. From the POV of something(), the cancellation did not happen. But its caller is still cancelled, so the yield-from expression still raises CancelledError. Note: If something() is cancelled by other means this will still cancel shield(). If you want to completely ignore cancellation (not recommended) you can combine shield() with a try/except clause, as follows: try: res = await shield(something()) except CancelledError: res = None Nr����r����r����r ���c��������������������s\���������r|�����s|�����d�S�|�����r.������n*|����}|d�urJ���|��n���|������d�S�r3���)r����r\���rd���r]���r[���rZ���)�innerru����r����r"���r#����_inner_done_callbackz��s���� z$shield.<locals>._inner_done_callbackc��������������������s��������s������d�S�r3���)r&���r����r����)r����r����r"���r#����_outer_done_callback���s����z$shield.<locals>._outer_done_callback) r����r����r����r���r&���r���r%���r����rr���)r����r!���r����r"���)r����r����r����r#���r���U��s����� r���c��������������������s:���t�����std��tj��������fdd�}��|���S�)zsSubmit a coroutine object to a given event loop. Return a concurrent.futures.Future to access the result. zA coroutine object is requiredc��������������� ������sl���zt��t���d����W�nN�ttfy0�����Y�n8�tyf�}��z ����rP��|�����W�Y�d�}�~�n d�}�~�0�0�d�S�)Nr ���)r���Z _chain_futurer���ro���rn���rp����set_running_or_notify_cancelr]���)ru����rN���rx���r!���r"���r#����callback���s���� z*run_coroutine_threadsafe.<locals>.callback)r���r?���rA���� concurrentr����FutureZcall_soon_threadsafe)rN���r!���r����r"���r����r#���r ������s���� r ���c�����������������C���s���t��|���dS�)z3Register a new task in asyncio as executed by loop.N)r,���r�����r6���r"���r"���r#���r������s����r���c�����������������C���s4���t��|��}|d�ur(td|�d|�d���|t�|�<�d�S�)NzCannot enter into task z while another task z is being executed.�r���r���r-����r!���r6���r���r"���r"���r#���r������s���� � r���c�����������������C���s2���t��|��}||ur(td|�d|�d���t�|�=�d�S�)Nz Leaving task z! does not match the current task �.r����r����r"���r"���r#���r������s���� � r���c�����������������C���s���t��|���dS�)zUnregister a task.N)r,����discardr����r"���r"���r#���r������s����r���)r���r���r���r���r,���r���)N)N)N)N)Dr|����__all__�concurrent.futuresr����rH���r����rt���� itertools�typesr�����weakrefr���r����r���r���r���r���r���r����count�__next__rB���r���r���r2���r8���Z _PyFuturer���Z_PyTaskZ_asyncio�ImportErrorZ_CTaskr���r���r���r���r���r����r���r����r����r���� coroutiner����r ���r���r����r����r����r ���r����r���r ����WeakSetr,���r���r���r���r���r���Z_py_register_taskZ_py_unregister_taskZ_py_enter_taskZ_py_leave_taskZ_c_register_taskZ_c_unregister_taskZ _c_enter_taskZ _c_leave_taskr"���r"���r"���r#����<module>���s���� �u +L,? &^?$