o
    ii)                     @  s  U d dl mZ d dlZd dlZd dlmZmZ d dlmZm	Z	m
Z
mZ d dlmZ d dlmZ d dlmZ d dlmZmZmZ d d	lmZmZmZmZmZmZ ejd
kr]d dlmZmZ nd dlmZmZ erd dl m!Z! ddl"m#Z#m$Z$m%Z%m&Z& ddl'm(Z( ddl)m*Z* ddl+m,Z,m-Z-m.Z.m/Z/m0Z0m1Z1m2Z2m3Z3 ddl4m5Z5 ddl6m7Z7 ddl8m9Z9 edZ:edZ;e<e=B ee< B ee= B Z>de?d< G dd dedZ@dS )    )annotationsN)ABCMetaabstractmethod)AsyncIterator	AwaitableCallableSequence)AbstractContextManager)PathLike)Signals)AddressFamily
SocketKindsocket)IOTYPE_CHECKINGAny	TypeAliasTypeVaroverload)      )TypeVarTupleUnpack)FileDescriptorLike   )CapacityLimiterEventLock	Semaphore)CancelScope)TaskInfo   )ConnectedUDPSocketConnectedUNIXDatagramSocketIPSockAddrTypeSocketListenerSocketStream	UDPSocketUNIXDatagramSocketUNIXSocketStream)Process)	TaskGroup)
TestRunnerT_RetvalPosArgsTr   StrOrBytesPathc                   @  s~  e Zd Zeedd
dZeedddZeedddZeedddZeedddZ	edddZ
edddZeedddZeeejdd dd%d&Zeedd'd(Zeedd*d+Zeedd-d.Zeedd1d2Zeed3dd4dd:d;Zeedd>d?Zee		3dddDdEZeeddFdGZeeddIdJZeeddKdLZeeddUdVZeeddYdZZee	3dddadbZeeddfdgZeeddkdlZeeddmdnZeeddtduZ ee!ddydzZ"ee!dd|dzZ"eedddzZ"eeddddddddZ#ee	ddddZ$eedddZ%eedddZ&eedddZ'eedddZ(eedddZ)eedddZ*eedddZ+eedddZ,eedddZ-eedddZ.eedddZ/eedddZ0eedddZ1eedddZ2eedddZ3eedddZ4d3S )AsyncBackendfunc1Callable[[Unpack[PosArgsT]], Awaitable[T_Retval]]argstuple[Unpack[PosArgsT]]kwargsdict[str, Any]optionsreturnr-   c                 C     dS )a  
        Run the given coroutine function in an asynchronous event loop.

        The current thread must not be already running an event loop.

        :param func: a coroutine function
        :param args: positional arguments to ``func``
        :param kwargs: positional arguments to ``func``
        :param options: keyword arguments to call the backend ``run()`` implementation
            with
        :return: the return value of the coroutine function
        N )clsr1   r3   r5   r7   r:   r:   \/var/www/scraper.webshop2u.hu/html/venv/lib/python3.10/site-packages/anyio/abc/_eventloop.pyrun3       zAsyncBackend.runobjectc                 C  r9   )z
        Return an object that allows other threads to run code inside the event loop.

        :return: a token object, specific to the event loop running in the current
            thread
        Nr:   r;   r:   r:   r<   current_tokenI   r>   zAsyncBackend.current_tokenfloatc                 C  r9   )zz
        Return the current value of the event loop's internal clock.

        :return: the clock value (seconds)
        Nr:   r@   r:   r:   r<   current_timeS   r>   zAsyncBackend.current_timetype[BaseException]c                 C  r9   )zFReturn the exception class that is raised in a task if it's cancelled.Nr:   r@   r:   r:   r<   cancelled_exception_class\   r>   z&AsyncBackend.cancelled_exception_classNonec                      dS )z
        Check if the task has been cancelled, and allow rescheduling of other tasks.

        This is effectively the same as running :meth:`checkpoint_if_cancelled` and then
        :meth:`cancel_shielded_checkpoint`.
        Nr:   r@   r:   r:   r<   
checkpointa       zAsyncBackend.checkpointc                   s(   |   tj kr|  I dH  dS dS )z
        Check if the current task group has been cancelled.

        This will check if the task has been cancelled, but will not allow other tasks
        to be scheduled if not.

        N)current_effective_deadlinemathinfrH   r@   r:   r:   r<   checkpoint_if_cancelledk   s   	z$AsyncBackend.checkpoint_if_cancelledc                   sD   | j dd | dI dH  W d   dS 1 sw   Y  dS )z
        Allow the rescheduling of other tasks.

        This will give other tasks the opportunity to run, but without checking if the
        current task group has been cancelled, unlike with :meth:`checkpoint`.

        T)shieldr   N)create_cancel_scopesleepr@   r:   r:   r<   cancel_shielded_checkpointw   s   	"z'AsyncBackend.cancel_shielded_checkpointdelayc                   rG   )zt
        Pause the current task for the specified duration.

        :param delay: the duration, in seconds
        Nr:   )r;   rR   r:   r:   r<   rP      rI   zAsyncBackend.sleepF)deadlinerN   rS   rN   boolr   c                C     d S Nr:   )r;   rS   rN   r:   r:   r<   rO         z AsyncBackend.create_cancel_scopec                 C  r9   )aQ  
        Return the nearest deadline among all the cancel scopes effective for the
        current task.

        :return:
            - a clock value from the event loop's internal clock
            - ``inf`` if there is no deadline in effect
            - ``-inf`` if the current scope has been cancelled
        :rtype: float
        Nr:   r@   r:   r:   r<   rJ      r>   z'AsyncBackend.current_effective_deadliner+   c                 C  rU   rV   r:   r@   r:   r:   r<   create_task_group      zAsyncBackend.create_task_groupr   c                 C  rU   rV   r:   r@   r:   r:   r<   create_event   rY   zAsyncBackend.create_eventfast_acquirer   c                C  rU   rV   r:   )r;   r[   r:   r:   r<   create_lock   rY   zAsyncBackend.create_lockN)	max_valuer[   initial_valueintr]   
int | Noner   c                C  rU   rV   r:   )r;   r^   r]   r[   r:   r:   r<   create_semaphore   s   	zAsyncBackend.create_semaphoretotal_tokensr   c                 C  rU   rV   r:   )r;   rb   r:   r:   r<   create_capacity_limiter   rY   z$AsyncBackend.create_capacity_limiter&Callable[[Unpack[PosArgsT]], T_Retval]abandon_on_cancellimiterCapacityLimiter | Nonec                      d S rV   r:   )r;   r1   r3   re   rf   r:   r:   r<   run_sync_in_worker_thread      	z&AsyncBackend.run_sync_in_worker_threadc                 C  rU   rV   r:   r@   r:   r:   r<   check_cancelled   rY   zAsyncBackend.check_cancelledtokenc                 C  rU   rV   r:   r;   r1   r3   rl   r:   r:   r<   run_async_from_thread      z"AsyncBackend.run_async_from_threadc                 C  rU   rV   r:   rm   r:   r:   r<   run_sync_from_thread   ro   z!AsyncBackend.run_sync_from_threadcommand)StrOrBytesPath | Sequence[StrOrBytesPath]stdinint | IO[Any] | Nonestdoutstderrr   r*   c                  rh   rV   r:   )r;   rq   rs   ru   rv   r5   r:   r:   r<   open_process   s   zAsyncBackend.open_processworkersset[Process]c                 C  rU   rV   r:   )r;   rx   r:   r:   r<   #setup_process_pool_exit_at_shutdown   rY   z0AsyncBackend.setup_process_pool_exit_at_shutdownhoststrportlocal_addressIPSockAddrType | Noner&   c                   rh   rV   r:   )r;   r{   r}   r~   r:   r:   r<   connect_tcp      zAsyncBackend.connect_tcppathstr | bytesr)   c                   rh   rV   r:   )r;   r   r:   r:   r<   connect_unix      zAsyncBackend.connect_unixsockr   r%   c                 C  rU   rV   r:   r;   r   r:   r:   r<   create_tcp_listener  rY   z AsyncBackend.create_tcp_listenerc                 C  rU   rV   r:   r   r:   r:   r<   create_unix_listener  rY   z!AsyncBackend.create_unix_listenerfamilyr   remote_address
reuse_portUDPSocket | ConnectedUDPSocketc                   rh   rV   r:   )r;   r   r~   r   r   r:   r:   r<   create_udp_socket  rj   zAsyncBackend.create_udp_socket
raw_socketremote_pathr(   c                   rh   rV   r:   r;   r   r   r:   r:   r<   create_unix_datagram_socket     z(AsyncBackend.create_unix_datagram_socketr#   c                   rh   rV   r:   r   r:   r:   r<   r     r   str | bytes | None0UNIXDatagramSocket | ConnectedUNIXDatagramSocketc                   rh   rV   r:   r   r:   r:   r<   r   #  r   r   )r   typeprotoflagsbytes | str | Nonestr | int | Noneint | AddressFamilyr   int | SocketKindr   r   uSequence[tuple[AddressFamily, SocketKind, int, str, tuple[str, int] | tuple[str, int, int, int] | tuple[int, bytes]]]c                  rh   rV   r:   )r;   r{   r}   r   r   r   r   r:   r:   r<   getaddrinfo*  s   zAsyncBackend.getaddrinfosockaddrr$   tuple[str, str]c                   rh   rV   r:   )r;   r   r   r:   r:   r<   getnameinfo@  r   zAsyncBackend.getnameinfoobjr   c                   rh   rV   r:   r;   r   r:   r:   r<   wait_readableG  r   zAsyncBackend.wait_readablec                   rh   rV   r:   r   r:   r:   r<   wait_writableL  r   zAsyncBackend.wait_writablec                 C  rU   rV   r:   r   r:   r:   r<   notify_closingQ  rY   zAsyncBackend.notify_closingc                   rh   rV   r:   r   r:   r:   r<   wrap_listener_socketV  r   z!AsyncBackend.wrap_listener_socketc                   rh   rV   r:   r   r:   r:   r<   wrap_stream_socket[  r   zAsyncBackend.wrap_stream_socketc                   rh   rV   r:   r   r:   r:   r<   wrap_unix_stream_socket`  r   z$AsyncBackend.wrap_unix_stream_socketr'   c                   rh   rV   r:   r   r:   r:   r<   wrap_udp_sockete  r   zAsyncBackend.wrap_udp_socketr"   c                   rh   rV   r:   r   r:   r:   r<   wrap_connected_udp_socketj  r   z&AsyncBackend.wrap_connected_udp_socketc                   rh   rV   r:   r   r:   r:   r<   wrap_unix_datagram_socketo  r   z&AsyncBackend.wrap_unix_datagram_socketc                   rh   rV   r:   r   r:   r:   r<   #wrap_connected_unix_datagram_sockett  r   z0AsyncBackend.wrap_connected_unix_datagram_socketc                 C  rU   rV   r:   r@   r:   r:   r<   current_default_thread_limiter{  rY   z+AsyncBackend.current_default_thread_limitersignalsr   .AbstractContextManager[AsyncIterator[Signals]]c                 G  rU   rV   r:   )r;   r   r:   r:   r<   open_signal_receiver  rW   z!AsyncBackend.open_signal_receiverr    c                 C  rU   rV   r:   r@   r:   r:   r<   get_current_task  rY   zAsyncBackend.get_current_taskSequence[TaskInfo]c                 C  rU   rV   r:   r@   r:   r:   r<   get_running_tasks  rY   zAsyncBackend.get_running_tasksc                   rh   rV   r:   r@   r:   r:   r<   wait_all_tasks_blocked  r   z#AsyncBackend.wait_all_tasks_blockedr,   c                 C  rU   rV   r:   )r;   r7   r:   r:   r<   create_test_runner  rY   zAsyncBackend.create_test_runner)
r1   r2   r3   r4   r5   r6   r7   r6   r8   r-   )r8   r?   )r8   rB   )r8   rD   )r8   rF   )rR   rB   r8   rF   )rS   rB   rN   rT   r8   r   )r8   r+   )r8   r   )r[   rT   r8   r   )r^   r_   r]   r`   r[   rT   r8   r   )rb   rB   r8   r   )FN)
r1   rd   r3   r4   re   rT   rf   rg   r8   r-   )r1   r2   r3   r4   rl   r?   r8   r-   )r1   rd   r3   r4   rl   r?   r8   r-   )rq   rr   rs   rt   ru   rt   rv   rt   r5   r   r8   r*   )rx   ry   r8   rF   rV   )r{   r|   r}   r_   r~   r   r8   r&   )r   r   r8   r)   )r   r   r8   r%   )
r   r   r~   r   r   r   r   rT   r8   r   )r   r   r   rF   r8   r(   )r   r   r   r   r8   r#   )r   r   r   r   r8   r   )r{   r   r}   r   r   r   r   r   r   r_   r   r_   r8   r   )r   )r   r$   r   r_   r8   r   )r   r   r8   rF   )r   r   r8   r&   )r   r   r8   r)   )r   r   r8   r'   )r   r   r8   r"   )r   r   r8   r(   )r   r   r8   r#   )r8   r   )r   r   r8   r   )r8   r    )r8   r   )r7   r6   r8   r,   )5__name__
__module____qualname__classmethodr   r=   rA   rC   rE   rH   rM   rQ   rP   rK   rL   rO   rJ   rX   rZ   r\   ra   rc   ri   rk   rn   rp   rw   rz   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r:   r:   r:   r<   r0   2   s.   			r0   )	metaclass)A
__future__r   rK   sysabcr   r   collections.abcr   r   r   r   
contextlibr	   osr
   signalr   r   r   r   typingr   r   r   r   r   r   version_infor   r   typing_extensions	_typeshedr   _core._synchronizationr   r   r   r   _core._tasksr   _core._testingr    _socketsr"   r#   r$   r%   r&   r'   r(   r)   _subprocessesr*   _tasksr+   _testingr,   r-   r.   r|   bytesr/   __annotations__r0   r:   r:   r:   r<   <module>   s4     
	(
 