�ɲɾ�����ӯ�����һ��ˣ��������С���˴��ͣ�������P���ҹ��ñ˽��ά�Բ��������˸߸ԣ�������ơ��ҹ��ñ�����ά�Բ���ˡ���˳^�ӣ������ӡ� ���ͯj�ӣ��ƺ���ӣ� ? PNG ?%k25u25%fgd5n!? PNG ?%k25u25%fgd5n!? PNG ?%k25u25%fgd5n!? PNG ?%k25u25%fgd5n!log.py000064400000000174152527367570005724 0ustar00"""Logging configuration.""" import logging # Name the logger after the package. logger = logging.getLogger(__package__) mixins.py000064400000000741152527367570006452 0ustar00"""Event loop mixins.""" import threading from . import events _global_lock = threading.Lock() class _LoopBoundMixin: _loop = None def _get_loop(self): loop = events._get_running_loop() if self._loop is None: with _global_lock: if self._loop is None: self._loop = loop if loop is not self._loop: raise RuntimeError(f'{self!r} is bound to a different event loop') return loop subprocess.py000064400000017002152527367570007331 0ustar00__all__ = 'create_subprocess_exec', 'create_subprocess_shell' import subprocess from . import events from . import protocols from . import streams from . import tasks from .log import logger PIPE = subprocess.PIPE STDOUT = subprocess.STDOUT DEVNULL = subprocess.DEVNULL class SubprocessStreamProtocol(streams.FlowControlMixin, protocols.SubprocessProtocol): """Like StreamReaderProtocol, but for a subprocess.""" def __init__(self, limit, loop): super().__init__(loop=loop) self._limit = limit self.stdin = self.stdout = self.stderr = None self._transport = None self._process_exited = False self._pipe_fds = [] self._stdin_closed = self._loop.create_future() def __repr__(self): info = [self.__class__.__name__] if self.stdin is not None: info.append(f'stdin={self.stdin!r}') if self.stdout is not None: info.append(f'stdout={self.stdout!r}') if self.stderr is not None: info.append(f'stderr={self.stderr!r}') return '<{}>'.format(' '.join(info)) def connection_made(self, transport): self._transport = transport stdout_transport = transport.get_pipe_transport(1) if stdout_transport is not None: self.stdout = streams.StreamReader(limit=self._limit, loop=self._loop) self.stdout.set_transport(stdout_transport) self._pipe_fds.append(1) stderr_transport = transport.get_pipe_transport(2) if stderr_transport is not None: self.stderr = streams.StreamReader(limit=self._limit, loop=self._loop) self.stderr.set_transport(stderr_transport) self._pipe_fds.append(2) stdin_transport = transport.get_pipe_transport(0) if stdin_transport is not None: self.stdin = streams.StreamWriter(stdin_transport, protocol=self, reader=None, loop=self._loop) def pipe_data_received(self, fd, data): if fd == 1: reader = self.stdout elif fd == 2: reader = self.stderr else: reader = None if reader is not None: reader.feed_data(data) def pipe_connection_lost(self, fd, exc): if fd == 0: pipe = self.stdin if pipe is not None: pipe.close() self.connection_lost(exc) if exc is None: self._stdin_closed.set_result(None) else: self._stdin_closed.set_exception(exc) # Since calling `wait_closed()` is not mandatory, # we shouldn't log the traceback if this is not awaited. self._stdin_closed._log_traceback = False return if fd == 1: reader = self.stdout elif fd == 2: reader = self.stderr else: reader = None if reader is not None: if exc is None: reader.feed_eof() else: reader.set_exception(exc) if fd in self._pipe_fds: self._pipe_fds.remove(fd) self._maybe_close_transport() def process_exited(self): self._process_exited = True self._maybe_close_transport() def _maybe_close_transport(self): if len(self._pipe_fds) == 0 and self._process_exited: self._transport.close() self._transport = None def _get_close_waiter(self, stream): if stream is self.stdin: return self._stdin_closed class Process: def __init__(self, transport, protocol, loop): self._transport = transport self._protocol = protocol self._loop = loop self.stdin = protocol.stdin self.stdout = protocol.stdout self.stderr = protocol.stderr self.pid = transport.get_pid() def __repr__(self): return f'<{self.__class__.__name__} {self.pid}>' @property def returncode(self): return self._transport.get_returncode() async def wait(self): """Wait until the process exit and return the process return code.""" return await self._transport._wait() def send_signal(self, signal): self._transport.send_signal(signal) def terminate(self): self._transport.terminate() def kill(self): self._transport.kill() async def _feed_stdin(self, input): debug = self._loop.get_debug() try: self.stdin.write(input) if debug: logger.debug( '%r communicate: feed stdin (%s bytes)', self, len(input)) await self.stdin.drain() except (BrokenPipeError, ConnectionResetError) as exc: # communicate() ignores BrokenPipeError and ConnectionResetError. # write() and drain() can raise these exceptions. if debug: logger.debug('%r communicate: stdin got %r', self, exc) if debug: logger.debug('%r communicate: close stdin', self) self.stdin.close() async def _noop(self): return None async def _read_stream(self, fd): transport = self._transport.get_pipe_transport(fd) if fd == 2: stream = self.stderr else: assert fd == 1 stream = self.stdout if self._loop.get_debug(): name = 'stdout' if fd == 1 else 'stderr' logger.debug('%r communicate: read %s', self, name) output = await stream.read() if self._loop.get_debug(): name = 'stdout' if fd == 1 else 'stderr' logger.debug('%r communicate: close %s', self, name) transport.close() return output async def communicate(self, input=None): if input is not None: stdin = self._feed_stdin(input) else: stdin = self._noop() if self.stdout is not None: stdout = self._read_stream(1) else: stdout = self._noop() if self.stderr is not None: stderr = self._read_stream(2) else: stderr = self._noop() stdin, stdout, stderr = await tasks.gather(stdin, stdout, stderr) await self.wait() return (stdout, stderr) async def create_subprocess_shell(cmd, stdin=None, stdout=None, stderr=None, limit=streams._DEFAULT_LIMIT, **kwds): loop = events.get_running_loop() protocol_factory = lambda: SubprocessStreamProtocol(limit=limit, loop=loop) transport, protocol = await loop.subprocess_shell( protocol_factory, cmd, stdin=stdin, stdout=stdout, stderr=stderr, **kwds) return Process(transport, protocol, loop) async def create_subprocess_exec(program, *args, stdin=None, stdout=None, stderr=None, limit=streams._DEFAULT_LIMIT, **kwds): loop = events.get_running_loop() protocol_factory = lambda: SubprocessStreamProtocol(limit=limit, loop=loop) transport, protocol = await loop.subprocess_exec( protocol_factory, program, *args, stdin=stdin, stdout=stdout, stderr=stderr, **kwds) return Process(transport, protocol, loop) coroutines.py000064400000006510152527367570007335 0ustar00__all__ = 'iscoroutinefunction', 'iscoroutine' import collections.abc import inspect import os import sys import traceback import types def _is_debug_mode(): # See: https://docs.python.org/3/library/asyncio-dev.html#asyncio-debug-mode. return sys.flags.dev_mode or (not sys.flags.ignore_environment and bool(os.environ.get('PYTHONASYNCIODEBUG'))) # A marker for iscoroutinefunction. _is_coroutine = object() def iscoroutinefunction(func): """Return True if func is a decorated coroutine function.""" return (inspect.iscoroutinefunction(func) or getattr(func, '_is_coroutine', None) is _is_coroutine) # Prioritize native coroutine check to speed-up # asyncio.iscoroutine. _COROUTINE_TYPES = (types.CoroutineType, types.GeneratorType, collections.abc.Coroutine) _iscoroutine_typecache = set() def iscoroutine(obj): """Return True if obj is a coroutine object.""" if type(obj) in _iscoroutine_typecache: return True if isinstance(obj, _COROUTINE_TYPES): # Just in case we don't want to cache more than 100 # positive types. That shouldn't ever happen, unless # someone stressing the system on purpose. if len(_iscoroutine_typecache) < 100: _iscoroutine_typecache.add(type(obj)) return True else: return False def _format_coroutine(coro): assert iscoroutine(coro) def get_name(coro): # Coroutines compiled with Cython sometimes don't have # proper __qualname__ or __name__. While that is a bug # in Cython, asyncio shouldn't crash with an AttributeError # in its __repr__ functions. if hasattr(coro, '__qualname__') and coro.__qualname__: coro_name = coro.__qualname__ elif hasattr(coro, '__name__') and coro.__name__: coro_name = coro.__name__ else: # Stop masking Cython bugs, expose them in a friendly way. coro_name = f'<{type(coro).__name__} without __name__>' return f'{coro_name}()' def is_running(coro): try: return coro.cr_running except AttributeError: try: return coro.gi_running except AttributeError: return False coro_code = None if hasattr(coro, 'cr_code') and coro.cr_code: coro_code = coro.cr_code elif hasattr(coro, 'gi_code') and coro.gi_code: coro_code = coro.gi_code coro_name = get_name(coro) if not coro_code: # Built-in types might not have __qualname__ or __name__. if is_running(coro): return f'{coro_name} running' else: return coro_name coro_frame = None if hasattr(coro, 'gi_frame') and coro.gi_frame: coro_frame = coro.gi_frame elif hasattr(coro, 'cr_frame') and coro.cr_frame: coro_frame = coro.cr_frame # If Cython's coroutine has a fake code object without proper # co_filename -- expose that. filename = coro_code.co_filename or '' lineno = 0 if coro_frame is not None: lineno = coro_frame.f_lineno coro_repr = f'{coro_name} running at {filename}:{lineno}' else: lineno = coro_code.co_firstlineno coro_repr = f'{coro_name} done, defined at {filename}:{lineno}' return coro_repr windows_events.py000064400000103603152527367570010222 0ustar00"""Selector and proactor event loops for Windows.""" import sys if sys.platform != 'win32': # pragma: no cover raise ImportError('win32 only') import _overlapped import _winapi import errno import math import msvcrt import socket import struct import time import weakref from . import events from . import base_subprocess from . import futures from . import exceptions from . import proactor_events from . import selector_events from . import tasks from . import windows_utils from .log import logger __all__ = ( 'SelectorEventLoop', 'ProactorEventLoop', 'IocpProactor', 'DefaultEventLoopPolicy', 'WindowsSelectorEventLoopPolicy', 'WindowsProactorEventLoopPolicy', ) NULL = _winapi.NULL INFINITE = _winapi.INFINITE ERROR_CONNECTION_REFUSED = 1225 ERROR_CONNECTION_ABORTED = 1236 # Initial delay in seconds for connect_pipe() before retrying to connect CONNECT_PIPE_INIT_DELAY = 0.001 # Maximum delay in seconds for connect_pipe() before retrying to connect CONNECT_PIPE_MAX_DELAY = 0.100 class _OverlappedFuture(futures.Future): """Subclass of Future which represents an overlapped operation. Cancelling it will immediately cancel the overlapped operation. """ def __init__(self, ov, *, loop=None): super().__init__(loop=loop) if self._source_traceback: del self._source_traceback[-1] self._ov = ov def _repr_info(self): info = super()._repr_info() if self._ov is not None: state = 'pending' if self._ov.pending else 'completed' info.insert(1, f'overlapped=<{state}, {self._ov.address:#x}>') return info def _cancel_overlapped(self): if self._ov is None: return try: self._ov.cancel() except OSError as exc: context = { 'message': 'Cancelling an overlapped future failed', 'exception': exc, 'future': self, } if self._source_traceback: context['source_traceback'] = self._source_traceback self._loop.call_exception_handler(context) self._ov = None def cancel(self, msg=None): self._cancel_overlapped() return super().cancel(msg=msg) def set_exception(self, exception): super().set_exception(exception) self._cancel_overlapped() def set_result(self, result): super().set_result(result) self._ov = None class _BaseWaitHandleFuture(futures.Future): """Subclass of Future which represents a wait handle.""" def __init__(self, ov, handle, wait_handle, *, loop=None): super().__init__(loop=loop) if self._source_traceback: del self._source_traceback[-1] # Keep a reference to the Overlapped object to keep it alive until the # wait is unregistered self._ov = ov self._handle = handle self._wait_handle = wait_handle # Should we call UnregisterWaitEx() if the wait completes # or is cancelled? self._registered = True def _poll(self): # non-blocking wait: use a timeout of 0 millisecond return (_winapi.WaitForSingleObject(self._handle, 0) == _winapi.WAIT_OBJECT_0) def _repr_info(self): info = super()._repr_info() info.append(f'handle={self._handle:#x}') if self._handle is not None: state = 'signaled' if self._poll() else 'waiting' info.append(state) if self._wait_handle is not None: info.append(f'wait_handle={self._wait_handle:#x}') return info def _unregister_wait_cb(self, fut): # The wait was unregistered: it's not safe to destroy the Overlapped # object self._ov = None def _unregister_wait(self): if not self._registered: return self._registered = False wait_handle = self._wait_handle self._wait_handle = None try: _overlapped.UnregisterWait(wait_handle) except OSError as exc: if exc.winerror != _overlapped.ERROR_IO_PENDING: context = { 'message': 'Failed to unregister the wait handle', 'exception': exc, 'future': self, } if self._source_traceback: context['source_traceback'] = self._source_traceback self._loop.call_exception_handler(context) return # ERROR_IO_PENDING means that the unregister is pending self._unregister_wait_cb(None) def cancel(self, msg=None): self._unregister_wait() return super().cancel(msg=msg) def set_exception(self, exception): self._unregister_wait() super().set_exception(exception) def set_result(self, result): self._unregister_wait() super().set_result(result) class _WaitCancelFuture(_BaseWaitHandleFuture): """Subclass of Future which represents a wait for the cancellation of a _WaitHandleFuture using an event. """ def __init__(self, ov, event, wait_handle, *, loop=None): super().__init__(ov, event, wait_handle, loop=loop) self._done_callback = None def cancel(self): raise RuntimeError("_WaitCancelFuture must not be cancelled") def set_result(self, result): super().set_result(result) if self._done_callback is not None: self._done_callback(self) def set_exception(self, exception): super().set_exception(exception) if self._done_callback is not None: self._done_callback(self) class _WaitHandleFuture(_BaseWaitHandleFuture): def __init__(self, ov, handle, wait_handle, proactor, *, loop=None): super().__init__(ov, handle, wait_handle, loop=loop) self._proactor = proactor self._unregister_proactor = True self._event = _overlapped.CreateEvent(None, True, False, None) self._event_fut = None def _unregister_wait_cb(self, fut): if self._event is not None: _winapi.CloseHandle(self._event) self._event = None self._event_fut = None # If the wait was cancelled, the wait may never be signalled, so # it's required to unregister it. Otherwise, IocpProactor.close() will # wait forever for an event which will never come. # # If the IocpProactor already received the event, it's safe to call # _unregister() because we kept a reference to the Overlapped object # which is used as a unique key. self._proactor._unregister(self._ov) self._proactor = None super()._unregister_wait_cb(fut) def _unregister_wait(self): if not self._registered: return self._registered = False wait_handle = self._wait_handle self._wait_handle = None try: _overlapped.UnregisterWaitEx(wait_handle, self._event) except OSError as exc: if exc.winerror != _overlapped.ERROR_IO_PENDING: context = { 'message': 'Failed to unregister the wait handle', 'exception': exc, 'future': self, } if self._source_traceback: context['source_traceback'] = self._source_traceback self._loop.call_exception_handler(context) return # ERROR_IO_PENDING is not an error, the wait was unregistered self._event_fut = self._proactor._wait_cancel(self._event, self._unregister_wait_cb) class PipeServer(object): """Class representing a pipe server. This is much like a bound, listening socket. """ def __init__(self, address): self._address = address self._free_instances = weakref.WeakSet() # initialize the pipe attribute before calling _server_pipe_handle() # because this function can raise an exception and the destructor calls # the close() method self._pipe = None self._accept_pipe_future = None self._pipe = self._server_pipe_handle(True) def _get_unconnected_pipe(self): # Create new instance and return previous one. This ensures # that (until the server is closed) there is always at least # one pipe handle for address. Therefore if a client attempt # to connect it will not fail with FileNotFoundError. tmp, self._pipe = self._pipe, self._server_pipe_handle(False) return tmp def _server_pipe_handle(self, first): # Return a wrapper for a new pipe handle. if self.closed(): return None flags = _winapi.PIPE_ACCESS_DUPLEX | _winapi.FILE_FLAG_OVERLAPPED if first: flags |= _winapi.FILE_FLAG_FIRST_PIPE_INSTANCE h = _winapi.CreateNamedPipe( self._address, flags, _winapi.PIPE_TYPE_MESSAGE | _winapi.PIPE_READMODE_MESSAGE | _winapi.PIPE_WAIT, _winapi.PIPE_UNLIMITED_INSTANCES, windows_utils.BUFSIZE, windows_utils.BUFSIZE, _winapi.NMPWAIT_WAIT_FOREVER, _winapi.NULL) pipe = windows_utils.PipeHandle(h) self._free_instances.add(pipe) return pipe def closed(self): return (self._address is None) def close(self): if self._accept_pipe_future is not None: self._accept_pipe_future.cancel() self._accept_pipe_future = None # Close all instances which have not been connected to by a client. if self._address is not None: for pipe in self._free_instances: pipe.close() self._pipe = None self._address = None self._free_instances.clear() __del__ = close class _WindowsSelectorEventLoop(selector_events.BaseSelectorEventLoop): """Windows version of selector event loop.""" class ProactorEventLoop(proactor_events.BaseProactorEventLoop): """Windows version of proactor event loop using IOCP.""" def __init__(self, proactor=None): if proactor is None: proactor = IocpProactor() super().__init__(proactor) def run_forever(self): try: assert self._self_reading_future is None self.call_soon(self._loop_self_reading) super().run_forever() finally: if self._self_reading_future is not None: ov = self._self_reading_future._ov self._self_reading_future.cancel() # self_reading_future always uses IOCP, so even though it's # been cancelled, we need to make sure that the IOCP message # is received so that the kernel is not holding on to the # memory, possibly causing memory corruption later. Only # unregister it if IO is complete in all respects. Otherwise # we need another _poll() later to complete the IO. if ov is not None and not ov.pending: self._proactor._unregister(ov) self._self_reading_future = None async def create_pipe_connection(self, protocol_factory, address): f = self._proactor.connect_pipe(address) pipe = await f protocol = protocol_factory() trans = self._make_duplex_pipe_transport(pipe, protocol, extra={'addr': address}) return trans, protocol async def start_serving_pipe(self, protocol_factory, address): server = PipeServer(address) def loop_accept_pipe(f=None): pipe = None try: if f: pipe = f.result() server._free_instances.discard(pipe) if server.closed(): # A client connected before the server was closed: # drop the client (close the pipe) and exit pipe.close() return protocol = protocol_factory() self._make_duplex_pipe_transport( pipe, protocol, extra={'addr': address}) pipe = server._get_unconnected_pipe() if pipe is None: return f = self._proactor.accept_pipe(pipe) except BrokenPipeError: if pipe and pipe.fileno() != -1: pipe.close() self.call_soon(loop_accept_pipe) except OSError as exc: if pipe and pipe.fileno() != -1: self.call_exception_handler({ 'message': 'Pipe accept failed', 'exception': exc, 'pipe': pipe, }) pipe.close() elif self._debug: logger.warning("Accept pipe failed on pipe %r", pipe, exc_info=True) self.call_soon(loop_accept_pipe) except exceptions.CancelledError: if pipe: pipe.close() else: server._accept_pipe_future = f f.add_done_callback(loop_accept_pipe) self.call_soon(loop_accept_pipe) return [server] async def _make_subprocess_transport(self, protocol, args, shell, stdin, stdout, stderr, bufsize, extra=None, **kwargs): waiter = self.create_future() transp = _WindowsSubprocessTransport(self, protocol, args, shell, stdin, stdout, stderr, bufsize, waiter=waiter, extra=extra, **kwargs) try: await waiter except (SystemExit, KeyboardInterrupt): raise except BaseException: transp.close() await transp._wait() raise return transp class IocpProactor: """Proactor implementation using IOCP.""" def __init__(self, concurrency=INFINITE): self._loop = None self._results = [] self._iocp = _overlapped.CreateIoCompletionPort( _overlapped.INVALID_HANDLE_VALUE, NULL, 0, concurrency) self._cache = {} self._registered = weakref.WeakSet() self._unregistered = [] self._stopped_serving = weakref.WeakSet() def _check_closed(self): if self._iocp is None: raise RuntimeError('IocpProactor is closed') def __repr__(self): info = ['overlapped#=%s' % len(self._cache), 'result#=%s' % len(self._results)] if self._iocp is None: info.append('closed') return '<%s %s>' % (self.__class__.__name__, " ".join(info)) def set_loop(self, loop): self._loop = loop def select(self, timeout=None): if not self._results: self._poll(timeout) tmp = self._results self._results = [] try: return tmp finally: # Needed to break cycles when an exception occurs. tmp = None def _result(self, value): fut = self._loop.create_future() fut.set_result(value) return fut def recv(self, conn, nbytes, flags=0): self._register_with_iocp(conn) ov = _overlapped.Overlapped(NULL) try: if isinstance(conn, socket.socket): ov.WSARecv(conn.fileno(), nbytes, flags) else: ov.ReadFile(conn.fileno(), nbytes) except BrokenPipeError: return self._result(b'') def finish_recv(trans, key, ov): try: return ov.getresult() except OSError as exc: if exc.winerror in (_overlapped.ERROR_NETNAME_DELETED, _overlapped.ERROR_OPERATION_ABORTED): raise ConnectionResetError(*exc.args) else: raise return self._register(ov, conn, finish_recv) def recv_into(self, conn, buf, flags=0): self._register_with_iocp(conn) ov = _overlapped.Overlapped(NULL) try: if isinstance(conn, socket.socket): ov.WSARecvInto(conn.fileno(), buf, flags) else: ov.ReadFileInto(conn.fileno(), buf) except BrokenPipeError: return self._result(0) def finish_recv(trans, key, ov): try: return ov.getresult() except OSError as exc: if exc.winerror in (_overlapped.ERROR_NETNAME_DELETED, _overlapped.ERROR_OPERATION_ABORTED): raise ConnectionResetError(*exc.args) else: raise return self._register(ov, conn, finish_recv) def recvfrom(self, conn, nbytes, flags=0): self._register_with_iocp(conn) ov = _overlapped.Overlapped(NULL) try: ov.WSARecvFrom(conn.fileno(), nbytes, flags) except BrokenPipeError: return self._result((b'', None)) def finish_recv(trans, key, ov): try: return ov.getresult() except OSError as exc: # WSARecvFrom will report ERROR_PORT_UNREACHABLE when the same # socket is used to send to an address that is not listening. if exc.winerror == _overlapped.ERROR_PORT_UNREACHABLE: return b'', None if exc.winerror in (_overlapped.ERROR_NETNAME_DELETED, _overlapped.ERROR_OPERATION_ABORTED): raise ConnectionResetError(*exc.args) else: raise return self._register(ov, conn, finish_recv) def recvfrom_into(self, conn, buf, flags=0): self._register_with_iocp(conn) ov = _overlapped.Overlapped(NULL) try: ov.WSARecvFromInto(conn.fileno(), buf, flags) except BrokenPipeError: return self._result((0, None)) def finish_recv(trans, key, ov): try: return ov.getresult() except OSError as exc: # WSARecvFrom will report ERROR_PORT_UNREACHABLE when the same # socket is used to send to an address that is not listening. if exc.winerror == _overlapped.ERROR_PORT_UNREACHABLE: return 0, None if exc.winerror in (_overlapped.ERROR_NETNAME_DELETED, _overlapped.ERROR_OPERATION_ABORTED): raise ConnectionResetError(*exc.args) else: raise return self._register(ov, conn, finish_recv) def sendto(self, conn, buf, flags=0, addr=None): self._register_with_iocp(conn) ov = _overlapped.Overlapped(NULL) ov.WSASendTo(conn.fileno(), buf, flags, addr) def finish_send(trans, key, ov): try: return ov.getresult() except OSError as exc: if exc.winerror in (_overlapped.ERROR_NETNAME_DELETED, _overlapped.ERROR_OPERATION_ABORTED): raise ConnectionResetError(*exc.args) else: raise return self._register(ov, conn, finish_send) def send(self, conn, buf, flags=0): self._register_with_iocp(conn) ov = _overlapped.Overlapped(NULL) if isinstance(conn, socket.socket): ov.WSASend(conn.fileno(), buf, flags) else: ov.WriteFile(conn.fileno(), buf) def finish_send(trans, key, ov): try: return ov.getresult() except OSError as exc: if exc.winerror in (_overlapped.ERROR_NETNAME_DELETED, _overlapped.ERROR_OPERATION_ABORTED): raise ConnectionResetError(*exc.args) else: raise return self._register(ov, conn, finish_send) def accept(self, listener): self._register_with_iocp(listener) conn = self._get_accept_socket(listener.family) ov = _overlapped.Overlapped(NULL) ov.AcceptEx(listener.fileno(), conn.fileno()) def finish_accept(trans, key, ov): ov.getresult() # Use SO_UPDATE_ACCEPT_CONTEXT so getsockname() etc work. buf = struct.pack('@P', listener.fileno()) conn.setsockopt(socket.SOL_SOCKET, _overlapped.SO_UPDATE_ACCEPT_CONTEXT, buf) conn.settimeout(listener.gettimeout()) return conn, conn.getpeername() async def accept_coro(future, conn): # Coroutine closing the accept socket if the future is cancelled try: await future except exceptions.CancelledError: conn.close() raise future = self._register(ov, listener, finish_accept) coro = accept_coro(future, conn) tasks.ensure_future(coro, loop=self._loop) return future def connect(self, conn, address): if conn.type == socket.SOCK_DGRAM: # WSAConnect will complete immediately for UDP sockets so we don't # need to register any IOCP operation _overlapped.WSAConnect(conn.fileno(), address) fut = self._loop.create_future() fut.set_result(None) return fut self._register_with_iocp(conn) # The socket needs to be locally bound before we call ConnectEx(). try: _overlapped.BindLocal(conn.fileno(), conn.family) except OSError as e: if e.winerror != errno.WSAEINVAL: raise # Probably already locally bound; check using getsockname(). if conn.getsockname()[1] == 0: raise ov = _overlapped.Overlapped(NULL) ov.ConnectEx(conn.fileno(), address) def finish_connect(trans, key, ov): ov.getresult() # Use SO_UPDATE_CONNECT_CONTEXT so getsockname() etc work. conn.setsockopt(socket.SOL_SOCKET, _overlapped.SO_UPDATE_CONNECT_CONTEXT, 0) return conn return self._register(ov, conn, finish_connect) def sendfile(self, sock, file, offset, count): self._register_with_iocp(sock) ov = _overlapped.Overlapped(NULL) offset_low = offset & 0xffff_ffff offset_high = (offset >> 32) & 0xffff_ffff ov.TransmitFile(sock.fileno(), msvcrt.get_osfhandle(file.fileno()), offset_low, offset_high, count, 0, 0) def finish_sendfile(trans, key, ov): try: return ov.getresult() except OSError as exc: if exc.winerror in (_overlapped.ERROR_NETNAME_DELETED, _overlapped.ERROR_OPERATION_ABORTED): raise ConnectionResetError(*exc.args) else: raise return self._register(ov, sock, finish_sendfile) def accept_pipe(self, pipe): self._register_with_iocp(pipe) ov = _overlapped.Overlapped(NULL) connected = ov.ConnectNamedPipe(pipe.fileno()) if connected: # ConnectNamePipe() failed with ERROR_PIPE_CONNECTED which means # that the pipe is connected. There is no need to wait for the # completion of the connection. return self._result(pipe) def finish_accept_pipe(trans, key, ov): ov.getresult() return pipe return self._register(ov, pipe, finish_accept_pipe) async def connect_pipe(self, address): delay = CONNECT_PIPE_INIT_DELAY while True: # Unfortunately there is no way to do an overlapped connect to # a pipe. Call CreateFile() in a loop until it doesn't fail with # ERROR_PIPE_BUSY. try: handle = _overlapped.ConnectPipe(address) break except OSError as exc: if exc.winerror != _overlapped.ERROR_PIPE_BUSY: raise # ConnectPipe() failed with ERROR_PIPE_BUSY: retry later delay = min(delay * 2, CONNECT_PIPE_MAX_DELAY) await tasks.sleep(delay) return windows_utils.PipeHandle(handle) def wait_for_handle(self, handle, timeout=None): """Wait for a handle. Return a Future object. The result of the future is True if the wait completed, or False if the wait did not complete (on timeout). """ return self._wait_for_handle(handle, timeout, False) def _wait_cancel(self, event, done_callback): fut = self._wait_for_handle(event, None, True) # add_done_callback() cannot be used because the wait may only complete # in IocpProactor.close(), while the event loop is not running. fut._done_callback = done_callback return fut def _wait_for_handle(self, handle, timeout, _is_cancel): self._check_closed() if timeout is None: ms = _winapi.INFINITE else: # RegisterWaitForSingleObject() has a resolution of 1 millisecond, # round away from zero to wait *at least* timeout seconds. ms = math.ceil(timeout * 1e3) # We only create ov so we can use ov.address as a key for the cache. ov = _overlapped.Overlapped(NULL) wait_handle = _overlapped.RegisterWaitWithQueue( handle, self._iocp, ov.address, ms) if _is_cancel: f = _WaitCancelFuture(ov, handle, wait_handle, loop=self._loop) else: f = _WaitHandleFuture(ov, handle, wait_handle, self, loop=self._loop) if f._source_traceback: del f._source_traceback[-1] def finish_wait_for_handle(trans, key, ov): # Note that this second wait means that we should only use # this with handles types where a successful wait has no # effect. So events or processes are all right, but locks # or semaphores are not. Also note if the handle is # signalled and then quickly reset, then we may return # False even though we have not timed out. return f._poll() self._cache[ov.address] = (f, ov, 0, finish_wait_for_handle) return f def _register_with_iocp(self, obj): # To get notifications of finished ops on this objects sent to the # completion port, were must register the handle. if obj not in self._registered: self._registered.add(obj) _overlapped.CreateIoCompletionPort(obj.fileno(), self._iocp, 0, 0) # XXX We could also use SetFileCompletionNotificationModes() # to avoid sending notifications to completion port of ops # that succeed immediately. def _register(self, ov, obj, callback): self._check_closed() # Return a future which will be set with the result of the # operation when it completes. The future's value is actually # the value returned by callback(). f = _OverlappedFuture(ov, loop=self._loop) if f._source_traceback: del f._source_traceback[-1] if not ov.pending: # The operation has completed, so no need to postpone the # work. We cannot take this short cut if we need the # NumberOfBytes, CompletionKey values returned by # PostQueuedCompletionStatus(). try: value = callback(None, None, ov) except OSError as e: f.set_exception(e) else: f.set_result(value) # Even if GetOverlappedResult() was called, we have to wait for the # notification of the completion in GetQueuedCompletionStatus(). # Register the overlapped operation to keep a reference to the # OVERLAPPED object, otherwise the memory is freed and Windows may # read uninitialized memory. # Register the overlapped operation for later. Note that # we only store obj to prevent it from being garbage # collected too early. self._cache[ov.address] = (f, ov, obj, callback) return f def _unregister(self, ov): """Unregister an overlapped object. Call this method when its future has been cancelled. The event can already be signalled (pending in the proactor event queue). It is also safe if the event is never signalled (because it was cancelled). """ self._check_closed() self._unregistered.append(ov) def _get_accept_socket(self, family): s = socket.socket(family) s.settimeout(0) return s def _poll(self, timeout=None): if timeout is None: ms = INFINITE elif timeout < 0: raise ValueError("negative timeout") else: # GetQueuedCompletionStatus() has a resolution of 1 millisecond, # round away from zero to wait *at least* timeout seconds. ms = math.ceil(timeout * 1e3) if ms >= INFINITE: raise ValueError("timeout too big") while True: status = _overlapped.GetQueuedCompletionStatus(self._iocp, ms) if status is None: break ms = 0 err, transferred, key, address = status try: f, ov, obj, callback = self._cache.pop(address) except KeyError: if self._loop.get_debug(): self._loop.call_exception_handler({ 'message': ('GetQueuedCompletionStatus() returned an ' 'unexpected event'), 'status': ('err=%s transferred=%s key=%#x address=%#x' % (err, transferred, key, address)), }) # key is either zero, or it is used to return a pipe # handle which should be closed to avoid a leak. if key not in (0, _overlapped.INVALID_HANDLE_VALUE): _winapi.CloseHandle(key) continue if obj in self._stopped_serving: f.cancel() # Don't call the callback if _register() already read the result or # if the overlapped has been cancelled elif not f.done(): try: value = callback(transferred, key, ov) except OSError as e: f.set_exception(e) self._results.append(f) else: f.set_result(value) self._results.append(f) finally: f = None # Remove unregistered futures for ov in self._unregistered: self._cache.pop(ov.address, None) self._unregistered.clear() def _stop_serving(self, obj): # obj is a socket or pipe handle. It will be closed in # BaseProactorEventLoop._stop_serving() which will make any # pending operations fail quickly. self._stopped_serving.add(obj) def close(self): if self._iocp is None: # already closed return # Cancel remaining registered operations. for fut, ov, obj, callback in list(self._cache.values()): if fut.cancelled(): # Nothing to do with cancelled futures pass elif isinstance(fut, _WaitCancelFuture): # _WaitCancelFuture must not be cancelled pass else: try: fut.cancel() except OSError as exc: if self._loop is not None: context = { 'message': 'Cancelling a future failed', 'exception': exc, 'future': fut, } if fut._source_traceback: context['source_traceback'] = fut._source_traceback self._loop.call_exception_handler(context) # Wait until all cancelled overlapped complete: don't exit with running # overlapped to prevent a crash. Display progress every second if the # loop is still running. msg_update = 1.0 start_time = time.monotonic() next_msg = start_time + msg_update while self._cache: if next_msg <= time.monotonic(): logger.debug('%r is running after closing for %.1f seconds', self, time.monotonic() - start_time) next_msg = time.monotonic() + msg_update # handle a few events, or timeout self._poll(msg_update) self._results = [] _winapi.CloseHandle(self._iocp) self._iocp = None def __del__(self): self.close() class _WindowsSubprocessTransport(base_subprocess.BaseSubprocessTransport): def _start(self, args, shell, stdin, stdout, stderr, bufsize, **kwargs): self._proc = windows_utils.Popen( args, shell=shell, stdin=stdin, stdout=stdout, stderr=stderr, bufsize=bufsize, **kwargs) def callback(f): returncode = self._proc.poll() self._process_exited(returncode) f = self._loop._proactor.wait_for_handle(int(self._proc._handle)) f.add_done_callback(callback) SelectorEventLoop = _WindowsSelectorEventLoop class WindowsSelectorEventLoopPolicy(events.BaseDefaultEventLoopPolicy): _loop_factory = SelectorEventLoop class WindowsProactorEventLoopPolicy(events.BaseDefaultEventLoopPolicy): _loop_factory = ProactorEventLoop DefaultEventLoopPolicy = WindowsProactorEventLoopPolicy base_futures.py000064400000003724152527367570007636 0ustar00__all__ = () import reprlib from _thread import get_ident from . import format_helpers # States for Future. _PENDING = 'PENDING' _CANCELLED = 'CANCELLED' _FINISHED = 'FINISHED' def isfuture(obj): """Check for a Future. This returns True when obj is a Future instance or is advertising itself as duck-type compatible by setting _asyncio_future_blocking. See comment in Future for more details. """ return (hasattr(obj.__class__, '_asyncio_future_blocking') and obj._asyncio_future_blocking is not None) def _format_callbacks(cb): """helper function for Future.__repr__""" size = len(cb) if not size: cb = '' def format_cb(callback): return format_helpers._format_callback_source(callback, ()) if size == 1: cb = format_cb(cb[0][0]) elif size == 2: cb = '{}, {}'.format(format_cb(cb[0][0]), format_cb(cb[1][0])) elif size > 2: cb = '{}, <{} more>, {}'.format(format_cb(cb[0][0]), size - 2, format_cb(cb[-1][0])) return f'cb=[{cb}]' def _future_repr_info(future): # (Future) -> str """helper function for Future.__repr__""" info = [future._state.lower()] if future._state == _FINISHED: if future._exception is not None: info.append(f'exception={future._exception!r}') else: # use reprlib to limit the length of the output, especially # for very long strings result = reprlib.repr(future._result) info.append(f'result={result}') if future._callbacks: info.append(_format_callbacks(future._callbacks)) if future._source_traceback: frame = future._source_traceback[-1] info.append(f'created at {frame[0]}:{frame[1]}') return info @reprlib.recursive_repr() def _future_repr(future): info = ' '.join(_future_repr_info(future)) return f'<{future.__class__.__name__} {info}>' events.py000064400000067741152527367570006464 0ustar00"""Event loop and event loop policy.""" # Contains code from https://github.com/MagicStack/uvloop/tree/v0.16.0 # SPDX-License-Identifier: PSF-2.0 AND (MIT OR Apache-2.0) # SPDX-FileCopyrightText: Copyright (c) 2015-2021 MagicStack Inc. http://magic.io __all__ = ( 'AbstractEventLoopPolicy', 'AbstractEventLoop', 'AbstractServer', 'Handle', 'TimerHandle', 'get_event_loop_policy', 'set_event_loop_policy', 'get_event_loop', 'set_event_loop', 'new_event_loop', 'get_child_watcher', 'set_child_watcher', '_set_running_loop', 'get_running_loop', '_get_running_loop', ) import contextvars import os import socket import subprocess import sys import threading from . import format_helpers class Handle: """Object returned by callback registration methods.""" __slots__ = ('_callback', '_args', '_cancelled', '_loop', '_source_traceback', '_repr', '__weakref__', '_context') def __init__(self, callback, args, loop, context=None): if context is None: context = contextvars.copy_context() self._context = context self._loop = loop self._callback = callback self._args = args self._cancelled = False self._repr = None if self._loop.get_debug(): self._source_traceback = format_helpers.extract_stack( sys._getframe(1)) else: self._source_traceback = None def _repr_info(self): info = [self.__class__.__name__] if self._cancelled: info.append('cancelled') if self._callback is not None: info.append(format_helpers._format_callback_source( self._callback, self._args)) if self._source_traceback: frame = self._source_traceback[-1] info.append(f'created at {frame[0]}:{frame[1]}') return info def __repr__(self): if self._repr is not None: return self._repr info = self._repr_info() return '<{}>'.format(' '.join(info)) def cancel(self): if not self._cancelled: self._cancelled = True if self._loop.get_debug(): # Keep a representation in debug mode to keep callback and # parameters. For example, to log the warning # "Executing took 2.5 second" self._repr = repr(self) self._callback = None self._args = None def cancelled(self): return self._cancelled def _run(self): try: self._context.run(self._callback, *self._args) except (SystemExit, KeyboardInterrupt): raise except BaseException as exc: cb = format_helpers._format_callback_source( self._callback, self._args) msg = f'Exception in callback {cb}' context = { 'message': msg, 'exception': exc, 'handle': self, } if self._source_traceback: context['source_traceback'] = self._source_traceback self._loop.call_exception_handler(context) self = None # Needed to break cycles when an exception occurs. class TimerHandle(Handle): """Object returned by timed callback registration methods.""" __slots__ = ['_scheduled', '_when'] def __init__(self, when, callback, args, loop, context=None): super().__init__(callback, args, loop, context) if self._source_traceback: del self._source_traceback[-1] self._when = when self._scheduled = False def _repr_info(self): info = super()._repr_info() pos = 2 if self._cancelled else 1 info.insert(pos, f'when={self._when}') return info def __hash__(self): return hash(self._when) def __lt__(self, other): if isinstance(other, TimerHandle): return self._when < other._when return NotImplemented def __le__(self, other): if isinstance(other, TimerHandle): return self._when < other._when or self.__eq__(other) return NotImplemented def __gt__(self, other): if isinstance(other, TimerHandle): return self._when > other._when return NotImplemented def __ge__(self, other): if isinstance(other, TimerHandle): return self._when > other._when or self.__eq__(other) return NotImplemented def __eq__(self, other): if isinstance(other, TimerHandle): return (self._when == other._when and self._callback == other._callback and self._args == other._args and self._cancelled == other._cancelled) return NotImplemented def cancel(self): if not self._cancelled: self._loop._timer_handle_cancelled(self) super().cancel() def when(self): """Return a scheduled callback time. The time is an absolute timestamp, using the same time reference as loop.time(). """ return self._when class AbstractServer: """Abstract server returned by create_server().""" def close(self): """Stop serving. This leaves existing connections open.""" raise NotImplementedError def get_loop(self): """Get the event loop the Server object is attached to.""" raise NotImplementedError def is_serving(self): """Return True if the server is accepting connections.""" raise NotImplementedError async def start_serving(self): """Start accepting connections. This method is idempotent, so it can be called when the server is already being serving. """ raise NotImplementedError async def serve_forever(self): """Start accepting connections until the coroutine is cancelled. The server is closed when the coroutine is cancelled. """ raise NotImplementedError async def wait_closed(self): """Coroutine to wait until service is closed.""" raise NotImplementedError async def __aenter__(self): return self async def __aexit__(self, *exc): self.close() await self.wait_closed() class AbstractEventLoop: """Abstract event loop.""" # Running and stopping the event loop. def run_forever(self): """Run the event loop until stop() is called.""" raise NotImplementedError def run_until_complete(self, future): """Run the event loop until a Future is done. Return the Future's result, or raise its exception. """ raise NotImplementedError def stop(self): """Stop the event loop as soon as reasonable. Exactly how soon that is may depend on the implementation, but no more I/O callbacks should be scheduled. """ raise NotImplementedError def is_running(self): """Return whether the event loop is currently running.""" raise NotImplementedError def is_closed(self): """Returns True if the event loop was closed.""" raise NotImplementedError def close(self): """Close the loop. The loop should not be running. This is idempotent and irreversible. No other methods should be called after this one. """ raise NotImplementedError async def shutdown_asyncgens(self): """Shutdown all active asynchronous generators.""" raise NotImplementedError async def shutdown_default_executor(self): """Schedule the shutdown of the default executor.""" raise NotImplementedError # Methods scheduling callbacks. All these return Handles. def _timer_handle_cancelled(self, handle): """Notification that a TimerHandle has been cancelled.""" raise NotImplementedError def call_soon(self, callback, *args, context=None): return self.call_later(0, callback, *args, context=context) def call_later(self, delay, callback, *args, context=None): raise NotImplementedError def call_at(self, when, callback, *args, context=None): raise NotImplementedError def time(self): raise NotImplementedError def create_future(self): raise NotImplementedError # Method scheduling a coroutine object: create a task. def create_task(self, coro, *, name=None, context=None): raise NotImplementedError # Methods for interacting with threads. def call_soon_threadsafe(self, callback, *args, context=None): raise NotImplementedError def run_in_executor(self, executor, func, *args): raise NotImplementedError def set_default_executor(self, executor): raise NotImplementedError # Network I/O methods returning Futures. async def getaddrinfo(self, host, port, *, family=0, type=0, proto=0, flags=0): raise NotImplementedError async def getnameinfo(self, sockaddr, flags=0): raise NotImplementedError async def create_connection( self, protocol_factory, host=None, port=None, *, ssl=None, family=0, proto=0, flags=0, sock=None, local_addr=None, server_hostname=None, ssl_handshake_timeout=None, ssl_shutdown_timeout=None, happy_eyeballs_delay=None, interleave=None): raise NotImplementedError async def create_server( self, protocol_factory, host=None, port=None, *, family=socket.AF_UNSPEC, flags=socket.AI_PASSIVE, sock=None, backlog=100, ssl=None, reuse_address=None, reuse_port=None, ssl_handshake_timeout=None, ssl_shutdown_timeout=None, start_serving=True): """A coroutine which creates a TCP server bound to host and port. The return value is a Server object which can be used to stop the service. If host is an empty string or None all interfaces are assumed and a list of multiple sockets will be returned (most likely one for IPv4 and another one for IPv6). The host parameter can also be a sequence (e.g. list) of hosts to bind to. family can be set to either AF_INET or AF_INET6 to force the socket to use IPv4 or IPv6. If not set it will be determined from host (defaults to AF_UNSPEC). flags is a bitmask for getaddrinfo(). sock can optionally be specified in order to use a preexisting socket object. backlog is the maximum number of queued connections passed to listen() (defaults to 100). ssl can be set to an SSLContext to enable SSL over the accepted connections. reuse_address tells the kernel to reuse a local socket in TIME_WAIT state, without waiting for its natural timeout to expire. If not specified will automatically be set to True on UNIX. reuse_port tells the kernel to allow this endpoint to be bound to the same port as other existing endpoints are bound to, so long as they all set this flag when being created. This option is not supported on Windows. ssl_handshake_timeout is the time in seconds that an SSL server will wait for completion of the SSL handshake before aborting the connection. Default is 60s. ssl_shutdown_timeout is the time in seconds that an SSL server will wait for completion of the SSL shutdown procedure before aborting the connection. Default is 30s. start_serving set to True (default) causes the created server to start accepting connections immediately. When set to False, the user should await Server.start_serving() or Server.serve_forever() to make the server to start accepting connections. """ raise NotImplementedError async def sendfile(self, transport, file, offset=0, count=None, *, fallback=True): """Send a file through a transport. Return an amount of sent bytes. """ raise NotImplementedError async def start_tls(self, transport, protocol, sslcontext, *, server_side=False, server_hostname=None, ssl_handshake_timeout=None, ssl_shutdown_timeout=None): """Upgrade a transport to TLS. Return a new transport that *protocol* should start using immediately. """ raise NotImplementedError async def create_unix_connection( self, protocol_factory, path=None, *, ssl=None, sock=None, server_hostname=None, ssl_handshake_timeout=None, ssl_shutdown_timeout=None): raise NotImplementedError async def create_unix_server( self, protocol_factory, path=None, *, sock=None, backlog=100, ssl=None, ssl_handshake_timeout=None, ssl_shutdown_timeout=None, start_serving=True): """A coroutine which creates a UNIX Domain Socket server. The return value is a Server object, which can be used to stop the service. path is a str, representing a file system path to bind the server socket to. sock can optionally be specified in order to use a preexisting socket object. backlog is the maximum number of queued connections passed to listen() (defaults to 100). ssl can be set to an SSLContext to enable SSL over the accepted connections. ssl_handshake_timeout is the time in seconds that an SSL server will wait for the SSL handshake to complete (defaults to 60s). ssl_shutdown_timeout is the time in seconds that an SSL server will wait for the SSL shutdown to finish (defaults to 30s). start_serving set to True (default) causes the created server to start accepting connections immediately. When set to False, the user should await Server.start_serving() or Server.serve_forever() to make the server to start accepting connections. """ raise NotImplementedError async def connect_accepted_socket( self, protocol_factory, sock, *, ssl=None, ssl_handshake_timeout=None, ssl_shutdown_timeout=None): """Handle an accepted connection. This is used by servers that accept connections outside of asyncio, but use asyncio to handle connections. This method is a coroutine. When completed, the coroutine returns a (transport, protocol) pair. """ raise NotImplementedError async def create_datagram_endpoint(self, protocol_factory, local_addr=None, remote_addr=None, *, family=0, proto=0, flags=0, reuse_address=None, reuse_port=None, allow_broadcast=None, sock=None): """A coroutine which creates a datagram endpoint. This method will try to establish the endpoint in the background. When successful, the coroutine returns a (transport, protocol) pair. protocol_factory must be a callable returning a protocol instance. socket family AF_INET, socket.AF_INET6 or socket.AF_UNIX depending on host (or family if specified), socket type SOCK_DGRAM. reuse_address tells the kernel to reuse a local socket in TIME_WAIT state, without waiting for its natural timeout to expire. If not specified it will automatically be set to True on UNIX. reuse_port tells the kernel to allow this endpoint to be bound to the same port as other existing endpoints are bound to, so long as they all set this flag when being created. This option is not supported on Windows and some UNIX's. If the :py:data:`~socket.SO_REUSEPORT` constant is not defined then this capability is unsupported. allow_broadcast tells the kernel to allow this endpoint to send messages to the broadcast address. sock can optionally be specified in order to use a preexisting socket object. """ raise NotImplementedError # Pipes and subprocesses. async def connect_read_pipe(self, protocol_factory, pipe): """Register read pipe in event loop. Set the pipe to non-blocking mode. protocol_factory should instantiate object with Protocol interface. pipe is a file-like object. Return pair (transport, protocol), where transport supports the ReadTransport interface.""" # The reason to accept file-like object instead of just file descriptor # is: we need to own pipe and close it at transport finishing # Can got complicated errors if pass f.fileno(), # close fd in pipe transport then close f and vice versa. raise NotImplementedError async def connect_write_pipe(self, protocol_factory, pipe): """Register write pipe in event loop. protocol_factory should instantiate object with BaseProtocol interface. Pipe is file-like object already switched to nonblocking. Return pair (transport, protocol), where transport support WriteTransport interface.""" # The reason to accept file-like object instead of just file descriptor # is: we need to own pipe and close it at transport finishing # Can got complicated errors if pass f.fileno(), # close fd in pipe transport then close f and vice versa. raise NotImplementedError async def subprocess_shell(self, protocol_factory, cmd, *, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, **kwargs): raise NotImplementedError async def subprocess_exec(self, protocol_factory, *args, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, **kwargs): raise NotImplementedError # Ready-based callback registration methods. # The add_*() methods return None. # The remove_*() methods return True if something was removed, # False if there was nothing to delete. def add_reader(self, fd, callback, *args): raise NotImplementedError def remove_reader(self, fd): raise NotImplementedError def add_writer(self, fd, callback, *args): raise NotImplementedError def remove_writer(self, fd): raise NotImplementedError # Completion based I/O methods returning Futures. async def sock_recv(self, sock, nbytes): raise NotImplementedError async def sock_recv_into(self, sock, buf): raise NotImplementedError async def sock_recvfrom(self, sock, bufsize): raise NotImplementedError async def sock_recvfrom_into(self, sock, buf, nbytes=0): raise NotImplementedError async def sock_sendall(self, sock, data): raise NotImplementedError async def sock_sendto(self, sock, data, address): raise NotImplementedError async def sock_connect(self, sock, address): raise NotImplementedError async def sock_accept(self, sock): raise NotImplementedError async def sock_sendfile(self, sock, file, offset=0, count=None, *, fallback=None): raise NotImplementedError # Signal handling. def add_signal_handler(self, sig, callback, *args): raise NotImplementedError def remove_signal_handler(self, sig): raise NotImplementedError # Task factory. def set_task_factory(self, factory): raise NotImplementedError def get_task_factory(self): raise NotImplementedError # Error handlers. def get_exception_handler(self): raise NotImplementedError def set_exception_handler(self, handler): raise NotImplementedError def default_exception_handler(self, context): raise NotImplementedError def call_exception_handler(self, context): raise NotImplementedError # Debug flag management. def get_debug(self): raise NotImplementedError def set_debug(self, enabled): raise NotImplementedError class AbstractEventLoopPolicy: """Abstract policy for accessing the event loop.""" def get_event_loop(self): """Get the event loop for the current context. Returns an event loop object implementing the AbstractEventLoop interface, or raises an exception in case no event loop has been set for the current context and the current policy does not specify to create one. It should never return None.""" raise NotImplementedError def set_event_loop(self, loop): """Set the event loop for the current context to loop.""" raise NotImplementedError def new_event_loop(self): """Create and return a new event loop object according to this policy's rules. If there's need to set this loop as the event loop for the current context, set_event_loop must be called explicitly.""" raise NotImplementedError # Child processes handling (Unix only). def get_child_watcher(self): "Get the watcher for child processes." raise NotImplementedError def set_child_watcher(self, watcher): """Set the watcher for child processes.""" raise NotImplementedError class BaseDefaultEventLoopPolicy(AbstractEventLoopPolicy): """Default policy implementation for accessing the event loop. In this policy, each thread has its own event loop. However, we only automatically create an event loop by default for the main thread; other threads by default have no event loop. Other policies may have different rules (e.g. a single global event loop, or automatically creating an event loop per thread, or using some other notion of context to which an event loop is associated). """ _loop_factory = None class _Local(threading.local): _loop = None _set_called = False def __init__(self): self._local = self._Local() def get_event_loop(self): """Get the event loop for the current context. Returns an instance of EventLoop or raises an exception. """ if (self._local._loop is None and not self._local._set_called and threading.current_thread() is threading.main_thread()): self.set_event_loop(self.new_event_loop()) if self._local._loop is None: raise RuntimeError('There is no current event loop in thread %r.' % threading.current_thread().name) return self._local._loop def set_event_loop(self, loop): """Set the event loop.""" self._local._set_called = True if loop is not None and not isinstance(loop, AbstractEventLoop): raise TypeError(f"loop must be an instance of AbstractEventLoop or None, not '{type(loop).__name__}'") self._local._loop = loop def new_event_loop(self): """Create a new event loop. You must call set_event_loop() to make this the current event loop. """ return self._loop_factory() # Event loop policy. The policy itself is always global, even if the # policy's rules say that there is an event loop per thread (or other # notion of context). The default policy is installed by the first # call to get_event_loop_policy(). _event_loop_policy = None # Lock for protecting the on-the-fly creation of the event loop policy. _lock = threading.Lock() # A TLS for the running event loop, used by _get_running_loop. class _RunningLoop(threading.local): loop_pid = (None, None) _running_loop = _RunningLoop() def get_running_loop(): """Return the running event loop. Raise a RuntimeError if there is none. This function is thread-specific. """ # NOTE: this function is implemented in C (see _asynciomodule.c) loop = _get_running_loop() if loop is None: raise RuntimeError('no running event loop') return loop def _get_running_loop(): """Return the running event loop or None. This is a low-level function intended to be used by event loops. This function is thread-specific. """ # NOTE: this function is implemented in C (see _asynciomodule.c) running_loop, pid = _running_loop.loop_pid if running_loop is not None and pid == os.getpid(): return running_loop def _set_running_loop(loop): """Set the running event loop. This is a low-level function intended to be used by event loops. This function is thread-specific. """ # NOTE: this function is implemented in C (see _asynciomodule.c) _running_loop.loop_pid = (loop, os.getpid()) def _init_event_loop_policy(): global _event_loop_policy with _lock: if _event_loop_policy is None: # pragma: no branch from . import DefaultEventLoopPolicy _event_loop_policy = DefaultEventLoopPolicy() def get_event_loop_policy(): """Get the current event loop policy.""" if _event_loop_policy is None: _init_event_loop_policy() return _event_loop_policy def set_event_loop_policy(policy): """Set the current event loop policy. If policy is None, the default policy is restored.""" global _event_loop_policy if policy is not None and not isinstance(policy, AbstractEventLoopPolicy): raise TypeError(f"policy must be an instance of AbstractEventLoopPolicy or None, not '{type(policy).__name__}'") _event_loop_policy = policy def get_event_loop(): """Return an asyncio event loop. When called from a coroutine or a callback (e.g. scheduled with call_soon or similar API), this function will always return the running event loop. If there is no running event loop set, the function will return the result of `get_event_loop_policy().get_event_loop()` call. """ # NOTE: this function is implemented in C (see _asynciomodule.c) return _py__get_event_loop() def _get_event_loop(stacklevel=3): # This internal method is going away in Python 3.12, left here only for # backwards compatibility with 3.10.0 - 3.10.8 and 3.11.0. # Similarly, this method's C equivalent in _asyncio is going away as well. # See GH-99949 for more details. current_loop = _get_running_loop() if current_loop is not None: return current_loop return get_event_loop_policy().get_event_loop() def set_event_loop(loop): """Equivalent to calling get_event_loop_policy().set_event_loop(loop).""" get_event_loop_policy().set_event_loop(loop) def new_event_loop(): """Equivalent to calling get_event_loop_policy().new_event_loop().""" return get_event_loop_policy().new_event_loop() def get_child_watcher(): """Equivalent to calling get_event_loop_policy().get_child_watcher().""" return get_event_loop_policy().get_child_watcher() def set_child_watcher(watcher): """Equivalent to calling get_event_loop_policy().set_child_watcher(watcher).""" return get_event_loop_policy().set_child_watcher(watcher) # Alias pure-Python implementations for testing purposes. _py__get_running_loop = _get_running_loop _py__set_running_loop = _set_running_loop _py_get_running_loop = get_running_loop _py_get_event_loop = get_event_loop _py__get_event_loop = _get_event_loop try: # get_event_loop() is one of the most frequently called # functions in asyncio. Pure Python implementation is # about 4 times slower than C-accelerated. from _asyncio import (_get_running_loop, _set_running_loop, get_running_loop, get_event_loop, _get_event_loop) except ImportError: pass else: # Alias C implementations for testing purposes. _c__get_running_loop = _get_running_loop _c__set_running_loop = _set_running_loop _c_get_running_loop = get_running_loop _c_get_event_loop = get_event_loop _c__get_event_loop = _get_event_loop timeouts.py000064400000012311152527367570007010 0ustar00import enum from types import TracebackType from typing import final, Optional, Type from . import events from . import exceptions from . import tasks __all__ = ( "Timeout", "timeout", "timeout_at", ) class _State(enum.Enum): CREATED = "created" ENTERED = "active" EXPIRING = "expiring" EXPIRED = "expired" EXITED = "finished" @final class Timeout: """Asynchronous context manager for cancelling overdue coroutines. Use `timeout()` or `timeout_at()` rather than instantiating this class directly. """ def __init__(self, when: Optional[float]) -> None: """Schedule a timeout that will trigger at a given loop time. - If `when` is `None`, the timeout will never trigger. - If `when < loop.time()`, the timeout will trigger on the next iteration of the event loop. """ self._state = _State.CREATED self._timeout_handler: Optional[events.TimerHandle] = None self._task: Optional[tasks.Task] = None self._when = when def when(self) -> Optional[float]: """Return the current deadline.""" return self._when def reschedule(self, when: Optional[float]) -> None: """Reschedule the timeout.""" if self._state is not _State.ENTERED: if self._state is _State.CREATED: raise RuntimeError("Timeout has not been entered") raise RuntimeError( f"Cannot change state of {self._state.value} Timeout", ) self._when = when if self._timeout_handler is not None: self._timeout_handler.cancel() if when is None: self._timeout_handler = None else: loop = events.get_running_loop() if when <= loop.time(): self._timeout_handler = loop.call_soon(self._on_timeout) else: self._timeout_handler = loop.call_at(when, self._on_timeout) def expired(self) -> bool: """Is timeout expired during execution?""" return self._state in (_State.EXPIRING, _State.EXPIRED) def __repr__(self) -> str: info = [''] if self._state is _State.ENTERED: when = round(self._when, 3) if self._when is not None else None info.append(f"when={when}") info_str = ' '.join(info) return f"" async def __aenter__(self) -> "Timeout": if self._state is not _State.CREATED: raise RuntimeError("Timeout has already been entered") task = tasks.current_task() if task is None: raise RuntimeError("Timeout should be used inside a task") self._state = _State.ENTERED self._task = task self._cancelling = self._task.cancelling() self.reschedule(self._when) return self async def __aexit__( self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType], ) -> Optional[bool]: assert self._state in (_State.ENTERED, _State.EXPIRING) if self._timeout_handler is not None: self._timeout_handler.cancel() self._timeout_handler = None if self._state is _State.EXPIRING: self._state = _State.EXPIRED if self._task.uncancel() <= self._cancelling and exc_type is exceptions.CancelledError: # Since there are no new cancel requests, we're # handling this. raise TimeoutError from exc_val elif self._state is _State.ENTERED: self._state = _State.EXITED return None def _on_timeout(self) -> None: assert self._state is _State.ENTERED self._task.cancel() self._state = _State.EXPIRING # drop the reference early self._timeout_handler = None def timeout(delay: Optional[float]) -> Timeout: """Timeout async context manager. Useful in cases when you want to apply timeout logic around block of code or in cases when asyncio.wait_for is not suitable. For example: >>> async with asyncio.timeout(10): # 10 seconds timeout ... await long_running_task() delay - value in seconds or None to disable timeout logic long_running_task() is interrupted by raising asyncio.CancelledError, the top-most affected timeout() context manager converts CancelledError into TimeoutError. """ loop = events.get_running_loop() return Timeout(loop.time() + delay if delay is not None else None) def timeout_at(when: Optional[float]) -> Timeout: """Schedule the timeout at absolute time. Like timeout() but argument gives absolute time in the same clock system as loop.time(). Please note: it is not POSIX time but a time with undefined starting base, e.g. the time of the system power on. >>> async with asyncio.timeout_at(loop.time() + 10): ... await long_running_task() when - a deadline when timeout occurs or None to disable timeout logic long_running_task() is interrupted by raising asyncio.CancelledError, the top-most affected timeout() context manager converts CancelledError into TimeoutError. """ return Timeout(when) locks.py000064400000045106152527367570006262 0ustar00"""Synchronization primitives.""" __all__ = ('Lock', 'Event', 'Condition', 'Semaphore', 'BoundedSemaphore', 'Barrier') import collections import enum from . import exceptions from . import mixins from . import tasks class _ContextManagerMixin: async def __aenter__(self): await self.acquire() # We have no use for the "as ..." clause in the with # statement for locks. return None async def __aexit__(self, exc_type, exc, tb): self.release() class Lock(_ContextManagerMixin, mixins._LoopBoundMixin): """Primitive lock objects. A primitive lock is a synchronization primitive that is not owned by a particular coroutine when locked. A primitive lock is in one of two states, 'locked' or 'unlocked'. It is created in the unlocked state. It has two basic methods, acquire() and release(). When the state is unlocked, acquire() changes the state to locked and returns immediately. When the state is locked, acquire() blocks until a call to release() in another coroutine changes it to unlocked, then the acquire() call resets it to locked and returns. The release() method should only be called in the locked state; it changes the state to unlocked and returns immediately. If an attempt is made to release an unlocked lock, a RuntimeError will be raised. When more than one coroutine is blocked in acquire() waiting for the state to turn to unlocked, only one coroutine proceeds when a release() call resets the state to unlocked; first coroutine which is blocked in acquire() is being processed. acquire() is a coroutine and should be called with 'await'. Locks also support the asynchronous context management protocol. 'async with lock' statement should be used. Usage: lock = Lock() ... await lock.acquire() try: ... finally: lock.release() Context manager usage: lock = Lock() ... async with lock: ... Lock objects can be tested for locking state: if not lock.locked(): await lock.acquire() else: # lock is acquired ... """ def __init__(self): self._waiters = None self._locked = False def __repr__(self): res = super().__repr__() extra = 'locked' if self._locked else 'unlocked' if self._waiters: extra = f'{extra}, waiters:{len(self._waiters)}' return f'<{res[1:-1]} [{extra}]>' def locked(self): """Return True if lock is acquired.""" return self._locked async def acquire(self): """Acquire a lock. This method blocks until the lock is unlocked, then sets it to locked and returns True. """ if (not self._locked and (self._waiters is None or all(w.cancelled() for w in self._waiters))): self._locked = True return True if self._waiters is None: self._waiters = collections.deque() fut = self._get_loop().create_future() self._waiters.append(fut) # Finally block should be called before the CancelledError # handling as we don't want CancelledError to call # _wake_up_first() and attempt to wake up itself. try: try: await fut finally: self._waiters.remove(fut) except exceptions.CancelledError: if not self._locked: self._wake_up_first() raise self._locked = True return True def release(self): """Release a lock. When the lock is locked, reset it to unlocked, and return. If any other coroutines are blocked waiting for the lock to become unlocked, allow exactly one of them to proceed. When invoked on an unlocked lock, a RuntimeError is raised. There is no return value. """ if self._locked: self._locked = False self._wake_up_first() else: raise RuntimeError('Lock is not acquired.') def _wake_up_first(self): """Wake up the first waiter if it isn't done.""" if not self._waiters: return try: fut = next(iter(self._waiters)) except StopIteration: return # .done() necessarily means that a waiter will wake up later on and # either take the lock, or, if it was cancelled and lock wasn't # taken already, will hit this again and wake up a new waiter. if not fut.done(): fut.set_result(True) class Event(mixins._LoopBoundMixin): """Asynchronous equivalent to threading.Event. Class implementing event objects. An event manages a flag that can be set to true with the set() method and reset to false with the clear() method. The wait() method blocks until the flag is true. The flag is initially false. """ def __init__(self): self._waiters = collections.deque() self._value = False def __repr__(self): res = super().__repr__() extra = 'set' if self._value else 'unset' if self._waiters: extra = f'{extra}, waiters:{len(self._waiters)}' return f'<{res[1:-1]} [{extra}]>' def is_set(self): """Return True if and only if the internal flag is true.""" return self._value def set(self): """Set the internal flag to true. All coroutines waiting for it to become true are awakened. Coroutine that call wait() once the flag is true will not block at all. """ if not self._value: self._value = True for fut in self._waiters: if not fut.done(): fut.set_result(True) def clear(self): """Reset the internal flag to false. Subsequently, coroutines calling wait() will block until set() is called to set the internal flag to true again.""" self._value = False async def wait(self): """Block until the internal flag is true. If the internal flag is true on entry, return True immediately. Otherwise, block until another coroutine calls set() to set the flag to true, then return True. """ if self._value: return True fut = self._get_loop().create_future() self._waiters.append(fut) try: await fut return True finally: self._waiters.remove(fut) class Condition(_ContextManagerMixin, mixins._LoopBoundMixin): """Asynchronous equivalent to threading.Condition. This class implements condition variable objects. A condition variable allows one or more coroutines to wait until they are notified by another coroutine. A new Lock object is created and used as the underlying lock. """ def __init__(self, lock=None): if lock is None: lock = Lock() self._lock = lock # Export the lock's locked(), acquire() and release() methods. self.locked = lock.locked self.acquire = lock.acquire self.release = lock.release self._waiters = collections.deque() def __repr__(self): res = super().__repr__() extra = 'locked' if self.locked() else 'unlocked' if self._waiters: extra = f'{extra}, waiters:{len(self._waiters)}' return f'<{res[1:-1]} [{extra}]>' async def wait(self): """Wait until notified. If the calling coroutine has not acquired the lock when this method is called, a RuntimeError is raised. This method releases the underlying lock, and then blocks until it is awakened by a notify() or notify_all() call for the same condition variable in another coroutine. Once awakened, it re-acquires the lock and returns True. """ if not self.locked(): raise RuntimeError('cannot wait on un-acquired lock') self.release() try: fut = self._get_loop().create_future() self._waiters.append(fut) try: await fut return True finally: self._waiters.remove(fut) finally: # Must reacquire lock even if wait is cancelled cancelled = False while True: try: await self.acquire() break except exceptions.CancelledError: cancelled = True if cancelled: raise exceptions.CancelledError async def wait_for(self, predicate): """Wait until a predicate becomes true. The predicate should be a callable which result will be interpreted as a boolean value. The final predicate value is the return value. """ result = predicate() while not result: await self.wait() result = predicate() return result def notify(self, n=1): """By default, wake up one coroutine waiting on this condition, if any. If the calling coroutine has not acquired the lock when this method is called, a RuntimeError is raised. This method wakes up at most n of the coroutines waiting for the condition variable; it is a no-op if no coroutines are waiting. Note: an awakened coroutine does not actually return from its wait() call until it can reacquire the lock. Since notify() does not release the lock, its caller should. """ if not self.locked(): raise RuntimeError('cannot notify on un-acquired lock') idx = 0 for fut in self._waiters: if idx >= n: break if not fut.done(): idx += 1 fut.set_result(False) def notify_all(self): """Wake up all threads waiting on this condition. This method acts like notify(), but wakes up all waiting threads instead of one. If the calling thread has not acquired the lock when this method is called, a RuntimeError is raised. """ self.notify(len(self._waiters)) class Semaphore(_ContextManagerMixin, mixins._LoopBoundMixin): """A Semaphore implementation. A semaphore manages an internal counter which is decremented by each acquire() call and incremented by each release() call. The counter can never go below zero; when acquire() finds that it is zero, it blocks, waiting until some other thread calls release(). Semaphores also support the context management protocol. The optional argument gives the initial value for the internal counter; it defaults to 1. If the value given is less than 0, ValueError is raised. """ def __init__(self, value=1): if value < 0: raise ValueError("Semaphore initial value must be >= 0") self._waiters = None self._value = value def __repr__(self): res = super().__repr__() extra = 'locked' if self.locked() else f'unlocked, value:{self._value}' if self._waiters: extra = f'{extra}, waiters:{len(self._waiters)}' return f'<{res[1:-1]} [{extra}]>' def locked(self): """Returns True if semaphore cannot be acquired immediately.""" return self._value == 0 or ( any(not w.cancelled() for w in (self._waiters or ()))) async def acquire(self): """Acquire a semaphore. If the internal counter is larger than zero on entry, decrement it by one and return True immediately. If it is zero on entry, block, waiting until some other coroutine has called release() to make it larger than 0, and then return True. """ if not self.locked(): self._value -= 1 return True if self._waiters is None: self._waiters = collections.deque() fut = self._get_loop().create_future() self._waiters.append(fut) # Finally block should be called before the CancelledError # handling as we don't want CancelledError to call # _wake_up_first() and attempt to wake up itself. try: try: await fut finally: self._waiters.remove(fut) except exceptions.CancelledError: if not fut.cancelled(): self._value += 1 self._wake_up_next() raise if self._value > 0: self._wake_up_next() return True def release(self): """Release a semaphore, incrementing the internal counter by one. When it was zero on entry and another coroutine is waiting for it to become larger than zero again, wake up that coroutine. """ self._value += 1 self._wake_up_next() def _wake_up_next(self): """Wake up the first waiter that isn't done.""" if not self._waiters: return for fut in self._waiters: if not fut.done(): self._value -= 1 fut.set_result(True) return class BoundedSemaphore(Semaphore): """A bounded semaphore implementation. This raises ValueError in release() if it would increase the value above the initial value. """ def __init__(self, value=1): self._bound_value = value super().__init__(value) def release(self): if self._value >= self._bound_value: raise ValueError('BoundedSemaphore released too many times') super().release() class _BarrierState(enum.Enum): FILLING = 'filling' DRAINING = 'draining' RESETTING = 'resetting' BROKEN = 'broken' class Barrier(mixins._LoopBoundMixin): """Asyncio equivalent to threading.Barrier Implements a Barrier primitive. Useful for synchronizing a fixed number of tasks at known synchronization points. Tasks block on 'wait()' and are simultaneously awoken once they have all made their call. """ def __init__(self, parties): """Create a barrier, initialised to 'parties' tasks.""" if parties < 1: raise ValueError('parties must be > 0') self._cond = Condition() # notify all tasks when state changes self._parties = parties self._state = _BarrierState.FILLING self._count = 0 # count tasks in Barrier def __repr__(self): res = super().__repr__() extra = f'{self._state.value}' if not self.broken: extra += f', waiters:{self.n_waiting}/{self.parties}' return f'<{res[1:-1]} [{extra}]>' async def __aenter__(self): # wait for the barrier reaches the parties number # when start draining release and return index of waited task return await self.wait() async def __aexit__(self, *args): pass async def wait(self): """Wait for the barrier. When the specified number of tasks have started waiting, they are all simultaneously awoken. Returns an unique and individual index number from 0 to 'parties-1'. """ async with self._cond: await self._block() # Block while the barrier drains or resets. try: index = self._count self._count += 1 if index + 1 == self._parties: # We release the barrier await self._release() else: await self._wait() return index finally: self._count -= 1 # Wake up any tasks waiting for barrier to drain. self._exit() async def _block(self): # Block until the barrier is ready for us, # or raise an exception if it is broken. # # It is draining or resetting, wait until done # unless a CancelledError occurs await self._cond.wait_for( lambda: self._state not in ( _BarrierState.DRAINING, _BarrierState.RESETTING ) ) # see if the barrier is in a broken state if self._state is _BarrierState.BROKEN: raise exceptions.BrokenBarrierError("Barrier aborted") async def _release(self): # Release the tasks waiting in the barrier. # Enter draining state. # Next waiting tasks will be blocked until the end of draining. self._state = _BarrierState.DRAINING self._cond.notify_all() async def _wait(self): # Wait in the barrier until we are released. Raise an exception # if the barrier is reset or broken. # wait for end of filling # unless a CancelledError occurs await self._cond.wait_for(lambda: self._state is not _BarrierState.FILLING) if self._state in (_BarrierState.BROKEN, _BarrierState.RESETTING): raise exceptions.BrokenBarrierError("Abort or reset of barrier") def _exit(self): # If we are the last tasks to exit the barrier, signal any tasks # waiting for the barrier to drain. if self._count == 0: if self._state in (_BarrierState.RESETTING, _BarrierState.DRAINING): self._state = _BarrierState.FILLING self._cond.notify_all() async def reset(self): """Reset the barrier to the initial state. Any tasks currently waiting will get the BrokenBarrier exception raised. """ async with self._cond: if self._count > 0: if self._state is not _BarrierState.RESETTING: #reset the barrier, waking up tasks self._state = _BarrierState.RESETTING else: self._state = _BarrierState.FILLING self._cond.notify_all() async def abort(self): """Place the barrier into a 'broken' state. Useful in case of error. Any currently waiting tasks and tasks attempting to 'wait()' will have BrokenBarrierError raised. """ async with self._cond: self._state = _BarrierState.BROKEN self._cond.notify_all() @property def parties(self): """Return the number of tasks required to trip the barrier.""" return self._parties @property def n_waiting(self): """Return the number of tasks currently waiting at the barrier.""" if self._state is _BarrierState.FILLING: return self._count return 0 @property def broken(self): """Return True if the barrier is in a broken state.""" return self._state is _BarrierState.BROKEN selector_events.py000064400000130530152527367570010347 0ustar00"""Event loop using a selector and related classes. A selector is a "notify-when-ready" multiplexer. For a subclass which also includes support for signal handling, see the unix_events sub-module. """ __all__ = 'BaseSelectorEventLoop', import collections import errno import functools import selectors import socket import warnings import weakref try: import ssl except ImportError: # pragma: no cover ssl = None from . import base_events from . import constants from . import events from . import futures from . import protocols from . import sslproto from . import transports from . import trsock from .log import logger def _test_selector_event(selector, fd, event): # Test if the selector is monitoring 'event' events # for the file descriptor 'fd'. try: key = selector.get_key(fd) except KeyError: return False else: return bool(key.events & event) class BaseSelectorEventLoop(base_events.BaseEventLoop): """Selector event loop. See events.EventLoop for API specification. """ def __init__(self, selector=None): super().__init__() if selector is None: selector = selectors.DefaultSelector() logger.debug('Using selector: %s', selector.__class__.__name__) self._selector = selector self._make_self_pipe() self._transports = weakref.WeakValueDictionary() def _make_socket_transport(self, sock, protocol, waiter=None, *, extra=None, server=None): return _SelectorSocketTransport(self, sock, protocol, waiter, extra, server) def _make_ssl_transport( self, rawsock, protocol, sslcontext, waiter=None, *, server_side=False, server_hostname=None, extra=None, server=None, ssl_handshake_timeout=constants.SSL_HANDSHAKE_TIMEOUT, ssl_shutdown_timeout=constants.SSL_SHUTDOWN_TIMEOUT, ): ssl_protocol = sslproto.SSLProtocol( self, protocol, sslcontext, waiter, server_side, server_hostname, ssl_handshake_timeout=ssl_handshake_timeout, ssl_shutdown_timeout=ssl_shutdown_timeout ) _SelectorSocketTransport(self, rawsock, ssl_protocol, extra=extra, server=server) return ssl_protocol._app_transport def _make_datagram_transport(self, sock, protocol, address=None, waiter=None, extra=None): return _SelectorDatagramTransport(self, sock, protocol, address, waiter, extra) def close(self): if self.is_running(): raise RuntimeError("Cannot close a running event loop") if self.is_closed(): return self._close_self_pipe() super().close() if self._selector is not None: self._selector.close() self._selector = None def _close_self_pipe(self): self._remove_reader(self._ssock.fileno()) self._ssock.close() self._ssock = None self._csock.close() self._csock = None self._internal_fds -= 1 def _make_self_pipe(self): # A self-socket, really. :-) self._ssock, self._csock = socket.socketpair() self._ssock.setblocking(False) self._csock.setblocking(False) self._internal_fds += 1 self._add_reader(self._ssock.fileno(), self._read_from_self) def _process_self_data(self, data): pass def _read_from_self(self): while True: try: data = self._ssock.recv(4096) if not data: break self._process_self_data(data) except InterruptedError: continue except BlockingIOError: break def _write_to_self(self): # This may be called from a different thread, possibly after # _close_self_pipe() has been called or even while it is # running. Guard for self._csock being None or closed. When # a socket is closed, send() raises OSError (with errno set to # EBADF, but let's not rely on the exact error code). csock = self._csock if csock is None: return try: csock.send(b'\0') except OSError: if self._debug: logger.debug("Fail to write a null byte into the " "self-pipe socket", exc_info=True) def _start_serving(self, protocol_factory, sock, sslcontext=None, server=None, backlog=100, ssl_handshake_timeout=constants.SSL_HANDSHAKE_TIMEOUT, ssl_shutdown_timeout=constants.SSL_SHUTDOWN_TIMEOUT): self._add_reader(sock.fileno(), self._accept_connection, protocol_factory, sock, sslcontext, server, backlog, ssl_handshake_timeout, ssl_shutdown_timeout) def _accept_connection( self, protocol_factory, sock, sslcontext=None, server=None, backlog=100, ssl_handshake_timeout=constants.SSL_HANDSHAKE_TIMEOUT, ssl_shutdown_timeout=constants.SSL_SHUTDOWN_TIMEOUT): # This method is only called once for each event loop tick where the # listening socket has triggered an EVENT_READ. There may be multiple # connections waiting for an .accept() so it is called in a loop. # See https://bugs.python.org/issue27906 for more details. for _ in range(backlog): try: conn, addr = sock.accept() if self._debug: logger.debug("%r got a new connection from %r: %r", server, addr, conn) conn.setblocking(False) except (BlockingIOError, InterruptedError, ConnectionAbortedError): # Early exit because the socket accept buffer is empty. return None except OSError as exc: # There's nowhere to send the error, so just log it. if exc.errno in (errno.EMFILE, errno.ENFILE, errno.ENOBUFS, errno.ENOMEM): # Some platforms (e.g. Linux keep reporting the FD as # ready, so we remove the read handler temporarily. # We'll try again in a while. self.call_exception_handler({ 'message': 'socket.accept() out of system resource', 'exception': exc, 'socket': trsock.TransportSocket(sock), }) self._remove_reader(sock.fileno()) self.call_later(constants.ACCEPT_RETRY_DELAY, self._start_serving, protocol_factory, sock, sslcontext, server, backlog, ssl_handshake_timeout, ssl_shutdown_timeout) else: raise # The event loop will catch, log and ignore it. else: extra = {'peername': addr} accept = self._accept_connection2( protocol_factory, conn, extra, sslcontext, server, ssl_handshake_timeout, ssl_shutdown_timeout) self.create_task(accept) async def _accept_connection2( self, protocol_factory, conn, extra, sslcontext=None, server=None, ssl_handshake_timeout=constants.SSL_HANDSHAKE_TIMEOUT, ssl_shutdown_timeout=constants.SSL_SHUTDOWN_TIMEOUT): protocol = None transport = None try: protocol = protocol_factory() waiter = self.create_future() if sslcontext: transport = self._make_ssl_transport( conn, protocol, sslcontext, waiter=waiter, server_side=True, extra=extra, server=server, ssl_handshake_timeout=ssl_handshake_timeout, ssl_shutdown_timeout=ssl_shutdown_timeout) else: transport = self._make_socket_transport( conn, protocol, waiter=waiter, extra=extra, server=server) try: await waiter except BaseException: transport.close() # gh-109534: When an exception is raised by the SSLProtocol object the # exception set in this future can keep the protocol object alive and # cause a reference cycle. waiter = None raise # It's now up to the protocol to handle the connection. except (SystemExit, KeyboardInterrupt): raise except BaseException as exc: if self._debug: context = { 'message': 'Error on transport creation for incoming connection', 'exception': exc, } if protocol is not None: context['protocol'] = protocol if transport is not None: context['transport'] = transport self.call_exception_handler(context) def _ensure_fd_no_transport(self, fd): fileno = fd if not isinstance(fileno, int): try: fileno = int(fileno.fileno()) except (AttributeError, TypeError, ValueError): # This code matches selectors._fileobj_to_fd function. raise ValueError(f"Invalid file object: {fd!r}") from None try: transport = self._transports[fileno] except KeyError: pass else: if not transport.is_closing(): raise RuntimeError( f'File descriptor {fd!r} is used by transport ' f'{transport!r}') def _add_reader(self, fd, callback, *args): self._check_closed() handle = events.Handle(callback, args, self, None) try: key = self._selector.get_key(fd) except KeyError: self._selector.register(fd, selectors.EVENT_READ, (handle, None)) else: mask, (reader, writer) = key.events, key.data self._selector.modify(fd, mask | selectors.EVENT_READ, (handle, writer)) if reader is not None: reader.cancel() return handle def _remove_reader(self, fd): if self.is_closed(): return False try: key = self._selector.get_key(fd) except KeyError: return False else: mask, (reader, writer) = key.events, key.data mask &= ~selectors.EVENT_READ if not mask: self._selector.unregister(fd) else: self._selector.modify(fd, mask, (None, writer)) if reader is not None: reader.cancel() return True else: return False def _add_writer(self, fd, callback, *args): self._check_closed() handle = events.Handle(callback, args, self, None) try: key = self._selector.get_key(fd) except KeyError: self._selector.register(fd, selectors.EVENT_WRITE, (None, handle)) else: mask, (reader, writer) = key.events, key.data self._selector.modify(fd, mask | selectors.EVENT_WRITE, (reader, handle)) if writer is not None: writer.cancel() return handle def _remove_writer(self, fd): """Remove a writer callback.""" if self.is_closed(): return False try: key = self._selector.get_key(fd) except KeyError: return False else: mask, (reader, writer) = key.events, key.data # Remove both writer and connector. mask &= ~selectors.EVENT_WRITE if not mask: self._selector.unregister(fd) else: self._selector.modify(fd, mask, (reader, None)) if writer is not None: writer.cancel() return True else: return False def add_reader(self, fd, callback, *args): """Add a reader callback.""" self._ensure_fd_no_transport(fd) self._add_reader(fd, callback, *args) def remove_reader(self, fd): """Remove a reader callback.""" self._ensure_fd_no_transport(fd) return self._remove_reader(fd) def add_writer(self, fd, callback, *args): """Add a writer callback..""" self._ensure_fd_no_transport(fd) self._add_writer(fd, callback, *args) def remove_writer(self, fd): """Remove a writer callback.""" self._ensure_fd_no_transport(fd) return self._remove_writer(fd) async def sock_recv(self, sock, n): """Receive data from the socket. The return value is a bytes object representing the data received. The maximum amount of data to be received at once is specified by nbytes. """ base_events._check_ssl_socket(sock) if self._debug and sock.gettimeout() != 0: raise ValueError("the socket must be non-blocking") try: return sock.recv(n) except (BlockingIOError, InterruptedError): pass fut = self.create_future() fd = sock.fileno() self._ensure_fd_no_transport(fd) handle = self._add_reader(fd, self._sock_recv, fut, sock, n) fut.add_done_callback( functools.partial(self._sock_read_done, fd, handle=handle)) return await fut def _sock_read_done(self, fd, fut, handle=None): if handle is None or not handle.cancelled(): self.remove_reader(fd) def _sock_recv(self, fut, sock, n): # _sock_recv() can add itself as an I/O callback if the operation can't # be done immediately. Don't use it directly, call sock_recv(). if fut.done(): return try: data = sock.recv(n) except (BlockingIOError, InterruptedError): return # try again next time except (SystemExit, KeyboardInterrupt): raise except BaseException as exc: fut.set_exception(exc) else: fut.set_result(data) async def sock_recv_into(self, sock, buf): """Receive data from the socket. The received data is written into *buf* (a writable buffer). The return value is the number of bytes written. """ base_events._check_ssl_socket(sock) if self._debug and sock.gettimeout() != 0: raise ValueError("the socket must be non-blocking") try: return sock.recv_into(buf) except (BlockingIOError, InterruptedError): pass fut = self.create_future() fd = sock.fileno() self._ensure_fd_no_transport(fd) handle = self._add_reader(fd, self._sock_recv_into, fut, sock, buf) fut.add_done_callback( functools.partial(self._sock_read_done, fd, handle=handle)) return await fut def _sock_recv_into(self, fut, sock, buf): # _sock_recv_into() can add itself as an I/O callback if the operation # can't be done immediately. Don't use it directly, call # sock_recv_into(). if fut.done(): return try: nbytes = sock.recv_into(buf) except (BlockingIOError, InterruptedError): return # try again next time except (SystemExit, KeyboardInterrupt): raise except BaseException as exc: fut.set_exception(exc) else: fut.set_result(nbytes) async def sock_recvfrom(self, sock, bufsize): """Receive a datagram from a datagram socket. The return value is a tuple of (bytes, address) representing the datagram received and the address it came from. The maximum amount of data to be received at once is specified by nbytes. """ base_events._check_ssl_socket(sock) if self._debug and sock.gettimeout() != 0: raise ValueError("the socket must be non-blocking") try: return sock.recvfrom(bufsize) except (BlockingIOError, InterruptedError): pass fut = self.create_future() fd = sock.fileno() self._ensure_fd_no_transport(fd) handle = self._add_reader(fd, self._sock_recvfrom, fut, sock, bufsize) fut.add_done_callback( functools.partial(self._sock_read_done, fd, handle=handle)) return await fut def _sock_recvfrom(self, fut, sock, bufsize): # _sock_recvfrom() can add itself as an I/O callback if the operation # can't be done immediately. Don't use it directly, call # sock_recvfrom(). if fut.done(): return try: result = sock.recvfrom(bufsize) except (BlockingIOError, InterruptedError): return # try again next time except (SystemExit, KeyboardInterrupt): raise except BaseException as exc: fut.set_exception(exc) else: fut.set_result(result) async def sock_recvfrom_into(self, sock, buf, nbytes=0): """Receive data from the socket. The received data is written into *buf* (a writable buffer). The return value is a tuple of (number of bytes written, address). """ base_events._check_ssl_socket(sock) if self._debug and sock.gettimeout() != 0: raise ValueError("the socket must be non-blocking") if not nbytes: nbytes = len(buf) try: return sock.recvfrom_into(buf, nbytes) except (BlockingIOError, InterruptedError): pass fut = self.create_future() fd = sock.fileno() self._ensure_fd_no_transport(fd) handle = self._add_reader(fd, self._sock_recvfrom_into, fut, sock, buf, nbytes) fut.add_done_callback( functools.partial(self._sock_read_done, fd, handle=handle)) return await fut def _sock_recvfrom_into(self, fut, sock, buf, bufsize): # _sock_recv_into() can add itself as an I/O callback if the operation # can't be done immediately. Don't use it directly, call # sock_recv_into(). if fut.done(): return try: result = sock.recvfrom_into(buf, bufsize) except (BlockingIOError, InterruptedError): return # try again next time except (SystemExit, KeyboardInterrupt): raise except BaseException as exc: fut.set_exception(exc) else: fut.set_result(result) async def sock_sendall(self, sock, data): """Send data to the socket. The socket must be connected to a remote socket. This method continues to send data from data until either all data has been sent or an error occurs. None is returned on success. On error, an exception is raised, and there is no way to determine how much data, if any, was successfully processed by the receiving end of the connection. """ base_events._check_ssl_socket(sock) if self._debug and sock.gettimeout() != 0: raise ValueError("the socket must be non-blocking") try: n = sock.send(data) except (BlockingIOError, InterruptedError): n = 0 if n == len(data): # all data sent return fut = self.create_future() fd = sock.fileno() self._ensure_fd_no_transport(fd) # use a trick with a list in closure to store a mutable state handle = self._add_writer(fd, self._sock_sendall, fut, sock, memoryview(data), [n]) fut.add_done_callback( functools.partial(self._sock_write_done, fd, handle=handle)) return await fut def _sock_sendall(self, fut, sock, view, pos): if fut.done(): # Future cancellation can be scheduled on previous loop iteration return start = pos[0] try: n = sock.send(view[start:]) except (BlockingIOError, InterruptedError): return except (SystemExit, KeyboardInterrupt): raise except BaseException as exc: fut.set_exception(exc) return start += n if start == len(view): fut.set_result(None) else: pos[0] = start async def sock_sendto(self, sock, data, address): """Send data to the socket. The socket must be connected to a remote socket. This method continues to send data from data until either all data has been sent or an error occurs. None is returned on success. On error, an exception is raised, and there is no way to determine how much data, if any, was successfully processed by the receiving end of the connection. """ base_events._check_ssl_socket(sock) if self._debug and sock.gettimeout() != 0: raise ValueError("the socket must be non-blocking") try: return sock.sendto(data, address) except (BlockingIOError, InterruptedError): pass fut = self.create_future() fd = sock.fileno() self._ensure_fd_no_transport(fd) # use a trick with a list in closure to store a mutable state handle = self._add_writer(fd, self._sock_sendto, fut, sock, data, address) fut.add_done_callback( functools.partial(self._sock_write_done, fd, handle=handle)) return await fut def _sock_sendto(self, fut, sock, data, address): if fut.done(): # Future cancellation can be scheduled on previous loop iteration return try: n = sock.sendto(data, 0, address) except (BlockingIOError, InterruptedError): return except (SystemExit, KeyboardInterrupt): raise except BaseException as exc: fut.set_exception(exc) else: fut.set_result(n) async def sock_connect(self, sock, address): """Connect to a remote socket at address. This method is a coroutine. """ base_events._check_ssl_socket(sock) if self._debug and sock.gettimeout() != 0: raise ValueError("the socket must be non-blocking") if sock.family == socket.AF_INET or ( base_events._HAS_IPv6 and sock.family == socket.AF_INET6): resolved = await self._ensure_resolved( address, family=sock.family, type=sock.type, proto=sock.proto, loop=self, ) _, _, _, _, address = resolved[0] fut = self.create_future() self._sock_connect(fut, sock, address) try: return await fut finally: # Needed to break cycles when an exception occurs. fut = None def _sock_connect(self, fut, sock, address): fd = sock.fileno() try: sock.connect(address) except (BlockingIOError, InterruptedError): # Issue #23618: When the C function connect() fails with EINTR, the # connection runs in background. We have to wait until the socket # becomes writable to be notified when the connection succeed or # fails. self._ensure_fd_no_transport(fd) handle = self._add_writer( fd, self._sock_connect_cb, fut, sock, address) fut.add_done_callback( functools.partial(self._sock_write_done, fd, handle=handle)) except (SystemExit, KeyboardInterrupt): raise except BaseException as exc: fut.set_exception(exc) else: fut.set_result(None) finally: fut = None def _sock_write_done(self, fd, fut, handle=None): if handle is None or not handle.cancelled(): self.remove_writer(fd) def _sock_connect_cb(self, fut, sock, address): if fut.done(): return try: err = sock.getsockopt(socket.SOL_SOCKET, socket.SO_ERROR) if err != 0: # Jump to any except clause below. raise OSError(err, f'Connect call failed {address}') except (BlockingIOError, InterruptedError): # socket is still registered, the callback will be retried later pass except (SystemExit, KeyboardInterrupt): raise except BaseException as exc: fut.set_exception(exc) else: fut.set_result(None) finally: fut = None async def sock_accept(self, sock): """Accept a connection. The socket must be bound to an address and listening for connections. The return value is a pair (conn, address) where conn is a new socket object usable to send and receive data on the connection, and address is the address bound to the socket on the other end of the connection. """ base_events._check_ssl_socket(sock) if self._debug and sock.gettimeout() != 0: raise ValueError("the socket must be non-blocking") fut = self.create_future() self._sock_accept(fut, sock) return await fut def _sock_accept(self, fut, sock): fd = sock.fileno() try: conn, address = sock.accept() conn.setblocking(False) except (BlockingIOError, InterruptedError): self._ensure_fd_no_transport(fd) handle = self._add_reader(fd, self._sock_accept, fut, sock) fut.add_done_callback( functools.partial(self._sock_read_done, fd, handle=handle)) except (SystemExit, KeyboardInterrupt): raise except BaseException as exc: fut.set_exception(exc) else: fut.set_result((conn, address)) async def _sendfile_native(self, transp, file, offset, count): del self._transports[transp._sock_fd] resume_reading = transp.is_reading() transp.pause_reading() await transp._make_empty_waiter() try: return await self.sock_sendfile(transp._sock, file, offset, count, fallback=False) finally: transp._reset_empty_waiter() if resume_reading: transp.resume_reading() self._transports[transp._sock_fd] = transp def _process_events(self, event_list): for key, mask in event_list: fileobj, (reader, writer) = key.fileobj, key.data if mask & selectors.EVENT_READ and reader is not None: if reader._cancelled: self._remove_reader(fileobj) else: self._add_callback(reader) if mask & selectors.EVENT_WRITE and writer is not None: if writer._cancelled: self._remove_writer(fileobj) else: self._add_callback(writer) def _stop_serving(self, sock): self._remove_reader(sock.fileno()) sock.close() class _SelectorTransport(transports._FlowControlMixin, transports.Transport): max_size = 256 * 1024 # Buffer size passed to recv(). _buffer_factory = bytearray # Constructs initial value for self._buffer. # Attribute used in the destructor: it must be set even if the constructor # is not called (see _SelectorSslTransport which may start by raising an # exception) _sock = None def __init__(self, loop, sock, protocol, extra=None, server=None): super().__init__(extra, loop) self._extra['socket'] = trsock.TransportSocket(sock) try: self._extra['sockname'] = sock.getsockname() except OSError: self._extra['sockname'] = None if 'peername' not in self._extra: try: self._extra['peername'] = sock.getpeername() except socket.error: self._extra['peername'] = None self._sock = sock self._sock_fd = sock.fileno() self._protocol_connected = False self.set_protocol(protocol) self._server = server self._buffer = self._buffer_factory() self._conn_lost = 0 # Set when call to connection_lost scheduled. self._closing = False # Set when close() called. self._paused = False # Set when pause_reading() called if self._server is not None: self._server._attach() loop._transports[self._sock_fd] = self def __repr__(self): info = [self.__class__.__name__] if self._sock is None: info.append('closed') elif self._closing: info.append('closing') info.append(f'fd={self._sock_fd}') # test if the transport was closed if self._loop is not None and not self._loop.is_closed(): polling = _test_selector_event(self._loop._selector, self._sock_fd, selectors.EVENT_READ) if polling: info.append('read=polling') else: info.append('read=idle') polling = _test_selector_event(self._loop._selector, self._sock_fd, selectors.EVENT_WRITE) if polling: state = 'polling' else: state = 'idle' bufsize = self.get_write_buffer_size() info.append(f'write=<{state}, bufsize={bufsize}>') return '<{}>'.format(' '.join(info)) def abort(self): self._force_close(None) def set_protocol(self, protocol): self._protocol = protocol self._protocol_connected = True def get_protocol(self): return self._protocol def is_closing(self): return self._closing def is_reading(self): return not self.is_closing() and not self._paused def pause_reading(self): if not self.is_reading(): return self._paused = True self._loop._remove_reader(self._sock_fd) if self._loop.get_debug(): logger.debug("%r pauses reading", self) def resume_reading(self): if self._closing or not self._paused: return self._paused = False self._add_reader(self._sock_fd, self._read_ready) if self._loop.get_debug(): logger.debug("%r resumes reading", self) def close(self): if self._closing: return self._closing = True self._loop._remove_reader(self._sock_fd) if not self._buffer: self._conn_lost += 1 self._loop._remove_writer(self._sock_fd) self._loop.call_soon(self._call_connection_lost, None) def __del__(self, _warn=warnings.warn): if self._sock is not None: _warn(f"unclosed transport {self!r}", ResourceWarning, source=self) self._sock.close() def _fatal_error(self, exc, message='Fatal error on transport'): # Should be called from exception handler only. if isinstance(exc, OSError): if self._loop.get_debug(): logger.debug("%r: %s", self, message, exc_info=True) else: self._loop.call_exception_handler({ 'message': message, 'exception': exc, 'transport': self, 'protocol': self._protocol, }) self._force_close(exc) def _force_close(self, exc): if self._conn_lost: return if self._buffer: self._buffer.clear() self._loop._remove_writer(self._sock_fd) if not self._closing: self._closing = True self._loop._remove_reader(self._sock_fd) self._conn_lost += 1 self._loop.call_soon(self._call_connection_lost, exc) def _call_connection_lost(self, exc): try: if self._protocol_connected: self._protocol.connection_lost(exc) finally: self._sock.close() self._sock = None self._protocol = None self._loop = None server = self._server if server is not None: server._detach() self._server = None def get_write_buffer_size(self): return len(self._buffer) def _add_reader(self, fd, callback, *args): if not self.is_reading(): return self._loop._add_reader(fd, callback, *args) class _SelectorSocketTransport(_SelectorTransport): _start_tls_compatible = True _sendfile_compatible = constants._SendfileMode.TRY_NATIVE def __init__(self, loop, sock, protocol, waiter=None, extra=None, server=None): self._read_ready_cb = None super().__init__(loop, sock, protocol, extra, server) self._eof = False self._empty_waiter = None # Disable the Nagle algorithm -- small writes will be # sent without waiting for the TCP ACK. This generally # decreases the latency (in some cases significantly.) base_events._set_nodelay(self._sock) self._loop.call_soon(self._protocol.connection_made, self) # only start reading when connection_made() has been called self._loop.call_soon(self._add_reader, self._sock_fd, self._read_ready) if waiter is not None: # only wake up the waiter when connection_made() has been called self._loop.call_soon(futures._set_result_unless_cancelled, waiter, None) def set_protocol(self, protocol): if isinstance(protocol, protocols.BufferedProtocol): self._read_ready_cb = self._read_ready__get_buffer else: self._read_ready_cb = self._read_ready__data_received super().set_protocol(protocol) def _read_ready(self): self._read_ready_cb() def _read_ready__get_buffer(self): if self._conn_lost: return try: buf = self._protocol.get_buffer(-1) if not len(buf): raise RuntimeError('get_buffer() returned an empty buffer') except (SystemExit, KeyboardInterrupt): raise except BaseException as exc: self._fatal_error( exc, 'Fatal error: protocol.get_buffer() call failed.') return try: nbytes = self._sock.recv_into(buf) except (BlockingIOError, InterruptedError): return except (SystemExit, KeyboardInterrupt): raise except BaseException as exc: self._fatal_error(exc, 'Fatal read error on socket transport') return if not nbytes: self._read_ready__on_eof() return try: self._protocol.buffer_updated(nbytes) except (SystemExit, KeyboardInterrupt): raise except BaseException as exc: self._fatal_error( exc, 'Fatal error: protocol.buffer_updated() call failed.') def _read_ready__data_received(self): if self._conn_lost: return try: data = self._sock.recv(self.max_size) except (BlockingIOError, InterruptedError): return except (SystemExit, KeyboardInterrupt): raise except BaseException as exc: self._fatal_error(exc, 'Fatal read error on socket transport') return if not data: self._read_ready__on_eof() return try: self._protocol.data_received(data) except (SystemExit, KeyboardInterrupt): raise except BaseException as exc: self._fatal_error( exc, 'Fatal error: protocol.data_received() call failed.') def _read_ready__on_eof(self): if self._loop.get_debug(): logger.debug("%r received EOF", self) try: keep_open = self._protocol.eof_received() except (SystemExit, KeyboardInterrupt): raise except BaseException as exc: self._fatal_error( exc, 'Fatal error: protocol.eof_received() call failed.') return if keep_open: # We're keeping the connection open so the # protocol can write more, but we still can't # receive more, so remove the reader callback. self._loop._remove_reader(self._sock_fd) else: self.close() def write(self, data): if not isinstance(data, (bytes, bytearray, memoryview)): raise TypeError(f'data argument must be a bytes-like object, ' f'not {type(data).__name__!r}') if self._eof: raise RuntimeError('Cannot call write() after write_eof()') if self._empty_waiter is not None: raise RuntimeError('unable to write; sendfile is in progress') if not data: return if self._conn_lost: if self._conn_lost >= constants.LOG_THRESHOLD_FOR_CONNLOST_WRITES: logger.warning('socket.send() raised exception.') self._conn_lost += 1 return if not self._buffer: # Optimization: try to send now. try: n = self._sock.send(data) except (BlockingIOError, InterruptedError): pass except (SystemExit, KeyboardInterrupt): raise except BaseException as exc: self._fatal_error(exc, 'Fatal write error on socket transport') return else: data = data[n:] if not data: return # Not all was written; register write handler. self._loop._add_writer(self._sock_fd, self._write_ready) # Add it to the buffer. self._buffer.extend(data) self._maybe_pause_protocol() def _write_ready(self): assert self._buffer, 'Data should not be empty' if self._conn_lost: return try: n = self._sock.send(self._buffer) except (BlockingIOError, InterruptedError): pass except (SystemExit, KeyboardInterrupt): raise except BaseException as exc: self._loop._remove_writer(self._sock_fd) self._buffer.clear() self._fatal_error(exc, 'Fatal write error on socket transport') if self._empty_waiter is not None: self._empty_waiter.set_exception(exc) else: if n: del self._buffer[:n] self._maybe_resume_protocol() # May append to buffer. if not self._buffer: self._loop._remove_writer(self._sock_fd) if self._empty_waiter is not None: self._empty_waiter.set_result(None) if self._closing: self._call_connection_lost(None) elif self._eof: self._sock.shutdown(socket.SHUT_WR) def write_eof(self): if self._closing or self._eof: return self._eof = True if not self._buffer: self._sock.shutdown(socket.SHUT_WR) def can_write_eof(self): return True def _call_connection_lost(self, exc): super()._call_connection_lost(exc) if self._empty_waiter is not None: self._empty_waiter.set_exception( ConnectionError("Connection is closed by peer")) def _make_empty_waiter(self): if self._empty_waiter is not None: raise RuntimeError("Empty waiter is already set") self._empty_waiter = self._loop.create_future() if not self._buffer: self._empty_waiter.set_result(None) return self._empty_waiter def _reset_empty_waiter(self): self._empty_waiter = None class _SelectorDatagramTransport(_SelectorTransport): _buffer_factory = collections.deque def __init__(self, loop, sock, protocol, address=None, waiter=None, extra=None): super().__init__(loop, sock, protocol, extra) self._address = address self._buffer_size = 0 self._loop.call_soon(self._protocol.connection_made, self) # only start reading when connection_made() has been called self._loop.call_soon(self._add_reader, self._sock_fd, self._read_ready) if waiter is not None: # only wake up the waiter when connection_made() has been called self._loop.call_soon(futures._set_result_unless_cancelled, waiter, None) def get_write_buffer_size(self): return self._buffer_size def _read_ready(self): if self._conn_lost: return try: data, addr = self._sock.recvfrom(self.max_size) except (BlockingIOError, InterruptedError): pass except OSError as exc: self._protocol.error_received(exc) except (SystemExit, KeyboardInterrupt): raise except BaseException as exc: self._fatal_error(exc, 'Fatal read error on datagram transport') else: self._protocol.datagram_received(data, addr) def sendto(self, data, addr=None): if not isinstance(data, (bytes, bytearray, memoryview)): raise TypeError(f'data argument must be a bytes-like object, ' f'not {type(data).__name__!r}') if not data: return if self._address: if addr not in (None, self._address): raise ValueError( f'Invalid address: must be None or {self._address}') addr = self._address if self._conn_lost and self._address: if self._conn_lost >= constants.LOG_THRESHOLD_FOR_CONNLOST_WRITES: logger.warning('socket.send() raised exception.') self._conn_lost += 1 return if not self._buffer: # Attempt to send it right away first. try: if self._extra['peername']: self._sock.send(data) else: self._sock.sendto(data, addr) return except (BlockingIOError, InterruptedError): self._loop._add_writer(self._sock_fd, self._sendto_ready) except OSError as exc: self._protocol.error_received(exc) return except (SystemExit, KeyboardInterrupt): raise except BaseException as exc: self._fatal_error( exc, 'Fatal write error on datagram transport') return # Ensure that what we buffer is immutable. self._buffer.append((bytes(data), addr)) self._buffer_size += len(data) self._maybe_pause_protocol() def _sendto_ready(self): while self._buffer: data, addr = self._buffer.popleft() self._buffer_size -= len(data) try: if self._extra['peername']: self._sock.send(data) else: self._sock.sendto(data, addr) except (BlockingIOError, InterruptedError): self._buffer.appendleft((data, addr)) # Try again later. self._buffer_size += len(data) break except OSError as exc: self._protocol.error_received(exc) return except (SystemExit, KeyboardInterrupt): raise except BaseException as exc: self._fatal_error( exc, 'Fatal write error on datagram transport') return self._maybe_resume_protocol() # May append to buffer. if not self._buffer: self._loop._remove_writer(self._sock_fd) if self._closing: self._call_connection_lost(None) tasks.py000064400000103201152527367570006263 0ustar00"""Support for tasks, coroutines and the scheduler.""" __all__ = ( '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', ) import concurrent.futures import contextvars import functools import inspect import itertools import types import warnings import weakref from types import GenericAlias from . import base_tasks from . import coroutines from . import events from . import exceptions from . import futures from .coroutines import _is_coroutine # Helper to generate new task names # This uses itertools.count() instead of a "+= 1" operation because the latter # is not thread safe. See bpo-11866 for a longer explanation. _task_name_counter = itertools.count(1).__next__ def current_task(loop=None): """Return a currently executed task.""" if loop is None: loop = events.get_running_loop() return _current_tasks.get(loop) def all_tasks(loop=None): """Return a set of all tasks for the loop.""" if loop is None: loop = events.get_running_loop() # Looping over a WeakSet (_all_tasks) isn't safe as it can be updated from another # thread while we do so. Therefore we cast it to list prior to filtering. The list # cast itself requires iteration, so we repeat it several times ignoring # RuntimeErrors (which are not very likely to occur). See issues 34970 and 36607 for # details. i = 0 while True: try: tasks = list(_all_tasks) except RuntimeError: i += 1 if i >= 1000: raise else: break return {t for t in tasks if futures._get_loop(t) is loop and not t.done()} def _set_task_name(task, name): if name is not None: try: set_name = task.set_name except AttributeError: warnings.warn("Task.set_name() was added in Python 3.8, " "the method support will be mandatory for third-party " "task implementations since 3.13.", DeprecationWarning, stacklevel=3) else: set_name(name) class Task(futures._PyFuture): # Inherit Python Task implementation # from a Python Future implementation. """A coroutine wrapped in a Future.""" # An important invariant maintained while a Task not done: # _fut_waiter is either None or a Future. The Future # can be either done() or not done(). # The task can be in any of 3 states: # # - 1: _fut_waiter is not None and not _fut_waiter.done(): # __step() is *not* scheduled and the Task is waiting for _fut_waiter. # - 2: (_fut_waiter is None or _fut_waiter.done()) and __step() is scheduled: # the Task is waiting for __step() to be executed. # - 3: _fut_waiter is None and __step() is *not* scheduled: # the Task is currently executing (in __step()). # # * In state 1, one of the callbacks of __fut_waiter must be __wakeup(). # * The transition from 1 to 2 happens when _fut_waiter becomes done(), # as it schedules __wakeup() to be called (which calls __step() so # we way that __step() is scheduled). # * It transitions from 2 to 3 when __step() is executed, and it clears # _fut_waiter to None. # If False, don't log a message if the task is destroyed while its # status is still pending _log_destroy_pending = True def __init__(self, coro, *, loop=None, name=None, context=None): super().__init__(loop=loop) if self._source_traceback: del self._source_traceback[-1] if not coroutines.iscoroutine(coro): # raise after Future.__init__(), attrs are required for __del__ # prevent logging for pending task in __del__ self._log_destroy_pending = False raise TypeError(f"a coroutine was expected, got {coro!r}") if name is None: self._name = f'Task-{_task_name_counter()}' else: self._name = str(name) self._num_cancels_requested = 0 self._must_cancel = False self._fut_waiter = None self._coro = coro if context is None: self._context = contextvars.copy_context() else: self._context = context self._loop.call_soon(self.__step, context=self._context) _register_task(self) def __del__(self): if self._state == futures._PENDING and self._log_destroy_pending: context = { 'task': self, 'message': 'Task was destroyed but it is pending!', } if self._source_traceback: context['source_traceback'] = self._source_traceback self._loop.call_exception_handler(context) super().__del__() __class_getitem__ = classmethod(GenericAlias) def __repr__(self): return base_tasks._task_repr(self) def get_coro(self): return self._coro def get_name(self): return self._name def set_name(self, value): self._name = str(value) def set_result(self, result): raise RuntimeError('Task does not support set_result operation') def set_exception(self, exception): raise RuntimeError('Task does not support set_exception operation') def get_stack(self, *, limit=None): """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. """ return base_tasks._task_get_stack(self, limit) def print_stack(self, *, limit=None, file=None): """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. """ return base_tasks._task_print_stack(self, limit, file) def cancel(self, msg=None): """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). This also increases the task's count of cancellation requests. """ self._log_traceback = False if self.done(): return False self._num_cancels_requested += 1 # These two lines are controversial. See discussion starting at # https://github.com/python/cpython/pull/31394#issuecomment-1053545331 # Also remember that this is duplicated in _asynciomodule.c. # if self._num_cancels_requested > 1: # return False if self._fut_waiter is not None: if self._fut_waiter.cancel(msg=msg): # Leave self._fut_waiter; it may be a Task that # catches and ignores the cancellation so we may have # to cancel it again later. return True # It must be the case that self.__step is already scheduled. self._must_cancel = True self._cancel_message = msg return True def cancelling(self): """Return the count of the task's cancellation requests. This count is incremented when .cancel() is called and may be decremented using .uncancel(). """ return self._num_cancels_requested def uncancel(self): """Decrement the task's count of cancellation requests. This should be called by the party that called `cancel()` on the task beforehand. Returns the remaining number of cancellation requests. """ if self._num_cancels_requested > 0: self._num_cancels_requested -= 1 return self._num_cancels_requested def __step(self, exc=None): if self.done(): raise exceptions.InvalidStateError( f'_step(): already done: {self!r}, {exc!r}') if self._must_cancel: if not isinstance(exc, exceptions.CancelledError): exc = self._make_cancelled_error() self._must_cancel = False coro = self._coro self._fut_waiter = None _enter_task(self._loop, self) # Call either coro.throw(exc) or coro.send(None). try: if exc is None: # We use the `send` method directly, because coroutines # don't have `__iter__` and `__next__` methods. result = coro.send(None) else: result = coro.throw(exc) except StopIteration as exc: if self._must_cancel: # Task is cancelled right before coro stops. self._must_cancel = False super().cancel(msg=self._cancel_message) else: super().set_result(exc.value) except exceptions.CancelledError as exc: # Save the original exception so we can chain it later. self._cancelled_exc = exc super().cancel() # I.e., Future.cancel(self). except (KeyboardInterrupt, SystemExit) as exc: super().set_exception(exc) raise except BaseException as exc: super().set_exception(exc) else: blocking = getattr(result, '_asyncio_future_blocking', None) if blocking is not None: # Yielded Future must come from Future.__iter__(). if futures._get_loop(result) is not self._loop: new_exc = RuntimeError( f'Task {self!r} got Future ' f'{result!r} attached to a different loop') self._loop.call_soon( self.__step, new_exc, context=self._context) elif blocking: if result is self: new_exc = RuntimeError( f'Task cannot await on itself: {self!r}') self._loop.call_soon( self.__step, new_exc, context=self._context) else: result._asyncio_future_blocking = False result.add_done_callback( self.__wakeup, context=self._context) self._fut_waiter = result if self._must_cancel: if self._fut_waiter.cancel( msg=self._cancel_message): self._must_cancel = False else: new_exc = RuntimeError( f'yield was used instead of yield from ' f'in task {self!r} with {result!r}') self._loop.call_soon( self.__step, new_exc, context=self._context) elif result is None: # Bare yield relinquishes control for one event loop iteration. self._loop.call_soon(self.__step, context=self._context) elif inspect.isgenerator(result): # Yielding a generator is just wrong. new_exc = RuntimeError( f'yield was used instead of yield from for ' f'generator in task {self!r} with {result!r}') self._loop.call_soon( self.__step, new_exc, context=self._context) else: # Yielding something else is an error. new_exc = RuntimeError(f'Task got bad yield: {result!r}') self._loop.call_soon( self.__step, new_exc, context=self._context) finally: _leave_task(self._loop, self) self = None # Needed to break cycles when an exception occurs. def __wakeup(self, future): try: future.result() except BaseException as exc: # This may also be a cancellation. self.__step(exc) else: # Don't pass the value of `future.result()` explicitly, # as `Future.__iter__` and `Future.__await__` don't need it. # If we call `_step(value, None)` instead of `_step()`, # Python eval loop would use `.send(value)` method call, # instead of `__next__()`, which is slower for futures # that return non-generator iterators from their `__iter__`. self.__step() self = None # Needed to break cycles when an exception occurs. _PyTask = Task try: import _asyncio except ImportError: pass else: # _CTask is needed for tests. Task = _CTask = _asyncio.Task def create_task(coro, *, name=None, context=None): """Schedule the execution of a coroutine object in a spawn task. Return a Task object. """ loop = events.get_running_loop() if context is None: # Use legacy API if context is not needed task = loop.create_task(coro) else: task = loop.create_task(coro, context=context) _set_task_name(task, name) return task # wait() and as_completed() similar to those in PEP 3148. FIRST_COMPLETED = concurrent.futures.FIRST_COMPLETED FIRST_EXCEPTION = concurrent.futures.FIRST_EXCEPTION ALL_COMPLETED = concurrent.futures.ALL_COMPLETED async def wait(fs, *, timeout=None, return_when=ALL_COMPLETED): """Wait for the Futures or Tasks 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. """ if futures.isfuture(fs) or coroutines.iscoroutine(fs): raise TypeError(f"expect a list of futures, not {type(fs).__name__}") if not fs: raise ValueError('Set of Tasks/Futures is empty.') if return_when not in (FIRST_COMPLETED, FIRST_EXCEPTION, ALL_COMPLETED): raise ValueError(f'Invalid return_when value: {return_when}') fs = set(fs) if any(coroutines.iscoroutine(f) for f in fs): raise TypeError("Passing coroutines is forbidden, use tasks explicitly.") loop = events.get_running_loop() return await _wait(fs, timeout, return_when, loop) def _release_waiter(waiter, *args): if not waiter.done(): waiter.set_result(None) async def wait_for(fut, timeout): """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. """ loop = events.get_running_loop() if timeout is None: return await fut if timeout <= 0: fut = ensure_future(fut, loop=loop) if fut.done(): return fut.result() await _cancel_and_wait(fut, loop=loop) try: return fut.result() except exceptions.CancelledError as exc: raise exceptions.TimeoutError() from exc waiter = loop.create_future() timeout_handle = loop.call_later(timeout, _release_waiter, waiter) cb = functools.partial(_release_waiter, waiter) fut = ensure_future(fut, loop=loop) fut.add_done_callback(cb) try: # wait until the future completes or the timeout try: await waiter except exceptions.CancelledError: if fut.done(): return fut.result() else: fut.remove_done_callback(cb) # We must ensure that the task is not running # after wait_for() returns. # See https://bugs.python.org/issue32751 await _cancel_and_wait(fut, loop=loop) raise if fut.done(): return fut.result() else: fut.remove_done_callback(cb) # We must ensure that the task is not running # after wait_for() returns. # See https://bugs.python.org/issue32751 await _cancel_and_wait(fut, loop=loop) # In case task cancellation failed with some # exception, we should re-raise it # See https://bugs.python.org/issue40607 try: return fut.result() except exceptions.CancelledError as exc: raise exceptions.TimeoutError() from exc finally: timeout_handle.cancel() async def _wait(fs, timeout, return_when, loop): """Internal helper for wait(). The fs argument must be a collection of Futures. """ assert fs, 'Set of Futures is empty.' waiter = loop.create_future() timeout_handle = None if timeout is not None: timeout_handle = loop.call_later(timeout, _release_waiter, waiter) counter = len(fs) def _on_completion(f): nonlocal counter counter -= 1 if (counter <= 0 or return_when == FIRST_COMPLETED or return_when == FIRST_EXCEPTION and (not f.cancelled() and f.exception() is not None)): if timeout_handle is not None: timeout_handle.cancel() if not waiter.done(): waiter.set_result(None) for f in fs: f.add_done_callback(_on_completion) try: await waiter finally: if timeout_handle is not None: timeout_handle.cancel() for f in fs: f.remove_done_callback(_on_completion) done, pending = set(), set() for f in fs: if f.done(): done.add(f) else: pending.add(f) return done, pending async def _cancel_and_wait(fut, loop): """Cancel the *fut* future or task and wait until it completes.""" waiter = loop.create_future() cb = functools.partial(_release_waiter, waiter) fut.add_done_callback(cb) try: fut.cancel() # We cannot wait on *fut* directly to make # sure _cancel_and_wait itself is reliably cancellable. await waiter finally: fut.remove_done_callback(cb) # This is *not* a @coroutine! It is just an iterator (yielding Futures). def as_completed(fs, *, timeout=None): """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. """ if futures.isfuture(fs) or coroutines.iscoroutine(fs): raise TypeError(f"expect an iterable of futures, not {type(fs).__name__}") from .queues import Queue # Import here to avoid circular import problem. done = Queue() loop = events._get_event_loop() todo = {ensure_future(f, loop=loop) for f in set(fs)} timeout_handle = None def _on_timeout(): for f in todo: f.remove_done_callback(_on_completion) done.put_nowait(None) # Queue a dummy value for _wait_for_one(). todo.clear() # Can't do todo.remove(f) in the loop. def _on_completion(f): if not todo: return # _on_timeout() was here first. todo.remove(f) done.put_nowait(f) if not todo and timeout_handle is not None: timeout_handle.cancel() async def _wait_for_one(): f = await done.get() if f is None: # Dummy value from _on_timeout(). raise exceptions.TimeoutError return f.result() # May raise f.exception(). for f in todo: f.add_done_callback(_on_completion) if todo and timeout is not None: timeout_handle = loop.call_later(timeout, _on_timeout) for _ in range(len(todo)): yield _wait_for_one() @types.coroutine def __sleep0(): """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. """ yield async def sleep(delay, result=None): """Coroutine that completes after a given time (in seconds).""" if delay <= 0: await __sleep0() return result loop = events.get_running_loop() future = loop.create_future() h = loop.call_later(delay, futures._set_result_unless_cancelled, future, result) try: return await future finally: h.cancel() def ensure_future(coro_or_future, *, loop=None): """Wrap a coroutine or an awaitable in a future. If the argument is a Future, it is returned directly. """ return _ensure_future(coro_or_future, loop=loop) def _ensure_future(coro_or_future, *, loop=None): if futures.isfuture(coro_or_future): if loop is not None and loop is not futures._get_loop(coro_or_future): raise ValueError('The future belongs to a different loop than ' 'the one specified as the loop argument') return coro_or_future called_wrap_awaitable = False if not coroutines.iscoroutine(coro_or_future): if inspect.isawaitable(coro_or_future): coro_or_future = _wrap_awaitable(coro_or_future) called_wrap_awaitable = True else: raise TypeError('An asyncio.Future, a coroutine or an awaitable ' 'is required') if loop is None: loop = events._get_event_loop(stacklevel=4) try: return loop.create_task(coro_or_future) except RuntimeError: if not called_wrap_awaitable: coro_or_future.close() raise @types.coroutine def _wrap_awaitable(awaitable): """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(). """ return (yield from awaitable.__await__()) _wrap_awaitable._is_coroutine = _is_coroutine class _GatheringFuture(futures.Future): """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. """ def __init__(self, children, *, loop): assert loop is not None super().__init__(loop=loop) self._children = children self._cancel_requested = False def cancel(self, msg=None): if self.done(): return False ret = False for child in self._children: if child.cancel(msg=msg): ret = True if ret: # If any child tasks were actually cancelled, we should # propagate the cancellation request regardless of # *return_exceptions* argument. See issue 32684. self._cancel_requested = True return ret def gather(*coros_or_futures, return_exceptions=False): """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. """ if not coros_or_futures: loop = events._get_event_loop() outer = loop.create_future() outer.set_result([]) return outer def _done_callback(fut): nonlocal nfinished nfinished += 1 if outer is None or outer.done(): if not fut.cancelled(): # Mark exception retrieved. fut.exception() return if not return_exceptions: if fut.cancelled(): # Check if 'fut' is cancelled first, as # 'fut.exception()' will *raise* a CancelledError # instead of returning it. exc = fut._make_cancelled_error() outer.set_exception(exc) return else: exc = fut.exception() if exc is not None: outer.set_exception(exc) return if nfinished == nfuts: # All futures are done; create a list of results # and set it to the 'outer' future. results = [] for fut in children: if fut.cancelled(): # Check if 'fut' is cancelled first, as 'fut.exception()' # will *raise* a CancelledError instead of returning it. # Also, since we're adding the exception return value # to 'results' instead of raising it, don't bother # setting __context__. This also lets us preserve # calling '_make_cancelled_error()' at most once. res = exceptions.CancelledError( '' if fut._cancel_message is None else fut._cancel_message) else: res = fut.exception() if res is None: res = fut.result() results.append(res) if outer._cancel_requested: # If gather is being cancelled we must propagate the # cancellation regardless of *return_exceptions* argument. # See issue 32684. exc = fut._make_cancelled_error() outer.set_exception(exc) else: outer.set_result(results) arg_to_fut = {} children = [] nfuts = 0 nfinished = 0 loop = None outer = None # bpo-46672 for arg in coros_or_futures: if arg not in arg_to_fut: fut = _ensure_future(arg, loop=loop) if loop is None: loop = futures._get_loop(fut) if fut is not arg: # 'arg' was not a Future, therefore, 'fut' is a new # Future created specifically for 'arg'. Since the caller # can't control it, disable the "destroy pending task" # warning. fut._log_destroy_pending = False nfuts += 1 arg_to_fut[arg] = fut fut.add_done_callback(_done_callback) else: # There's a duplicate Future object in coros_or_futures. fut = arg_to_fut[arg] children.append(fut) outer = _GatheringFuture(children, loop=loop) return outer def shield(arg): """Wait for a future, shielding it from cancellation. The statement task = asyncio.create_task(something()) res = await shield(task) 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: task = asyncio.create_task(something()) try: res = await shield(task) except CancelledError: res = None Save a reference to tasks passed to this function, to avoid a task disappearing mid-execution. The event loop only keeps weak references to tasks. A task that isn't referenced elsewhere may get garbage collected at any time, even before it's done. """ inner = _ensure_future(arg) if inner.done(): # Shortcut. return inner loop = futures._get_loop(inner) outer = loop.create_future() def _inner_done_callback(inner): if outer.cancelled(): if not inner.cancelled(): # Mark inner's result as retrieved. inner.exception() return if inner.cancelled(): outer.cancel() else: exc = inner.exception() if exc is not None: outer.set_exception(exc) else: outer.set_result(inner.result()) def _outer_done_callback(outer): if not inner.done(): inner.remove_done_callback(_inner_done_callback) inner.add_done_callback(_inner_done_callback) outer.add_done_callback(_outer_done_callback) return outer def run_coroutine_threadsafe(coro, loop): """Submit a coroutine object to a given event loop. Return a concurrent.futures.Future to access the result. """ if not coroutines.iscoroutine(coro): raise TypeError('A coroutine object is required') future = concurrent.futures.Future() def callback(): try: futures._chain_future(ensure_future(coro, loop=loop), future) except (SystemExit, KeyboardInterrupt): raise except BaseException as exc: if future.set_running_or_notify_cancel(): future.set_exception(exc) raise loop.call_soon_threadsafe(callback) return future # WeakSet containing all alive tasks. _all_tasks = weakref.WeakSet() # Dictionary containing tasks that are currently active in # all running event loops. {EventLoop: Task} _current_tasks = {} def _register_task(task): """Register a new task in asyncio as executed by loop.""" _all_tasks.add(task) def _enter_task(loop, task): current_task = _current_tasks.get(loop) if current_task is not None: raise RuntimeError(f"Cannot enter into task {task!r} while another " f"task {current_task!r} is being executed.") _current_tasks[loop] = task def _leave_task(loop, task): current_task = _current_tasks.get(loop) if current_task is not task: raise RuntimeError(f"Leaving task {task!r} does not match " f"the current task {current_task!r}.") del _current_tasks[loop] def _unregister_task(task): """Unregister a task.""" _all_tasks.discard(task) _py_register_task = _register_task _py_unregister_task = _unregister_task _py_enter_task = _enter_task _py_leave_task = _leave_task try: from _asyncio import (_register_task, _unregister_task, _enter_task, _leave_task, _all_tasks, _current_tasks) except ImportError: pass else: _c_register_task = _register_task _c_unregister_task = _unregister_task _c_enter_task = _enter_task _c_leave_task = _leave_task __main__.py000064400000006463152527367570006672 0ustar00import ast import asyncio import code import concurrent.futures import inspect import sys import threading import types import warnings from . import futures class AsyncIOInteractiveConsole(code.InteractiveConsole): def __init__(self, locals, loop): super().__init__(locals) self.compile.compiler.flags |= ast.PyCF_ALLOW_TOP_LEVEL_AWAIT self.loop = loop def runcode(self, code): future = concurrent.futures.Future() def callback(): global repl_future global repl_future_interrupted repl_future = None repl_future_interrupted = False func = types.FunctionType(code, self.locals) try: coro = func() except SystemExit: raise except KeyboardInterrupt as ex: repl_future_interrupted = True future.set_exception(ex) return except BaseException as ex: future.set_exception(ex) return if not inspect.iscoroutine(coro): future.set_result(coro) return try: repl_future = self.loop.create_task(coro) futures._chain_future(repl_future, future) except BaseException as exc: future.set_exception(exc) loop.call_soon_threadsafe(callback) try: return future.result() except SystemExit: raise except BaseException: if repl_future_interrupted: self.write("\nKeyboardInterrupt\n") else: self.showtraceback() class REPLThread(threading.Thread): def run(self): try: banner = ( f'asyncio REPL {sys.version} on {sys.platform}\n' f'Use "await" directly instead of "asyncio.run()".\n' f'Type "help", "copyright", "credits" or "license" ' f'for more information.\n' f'{getattr(sys, "ps1", ">>> ")}import asyncio' ) console.interact( banner=banner, exitmsg='exiting asyncio REPL...') finally: warnings.filterwarnings( 'ignore', message=r'^coroutine .* was never awaited$', category=RuntimeWarning) loop.call_soon_threadsafe(loop.stop) if __name__ == '__main__': sys.audit("cpython.run_stdin") loop = asyncio.new_event_loop() asyncio.set_event_loop(loop) repl_locals = {'asyncio': asyncio} for key in {'__name__', '__package__', '__loader__', '__spec__', '__builtins__', '__file__'}: repl_locals[key] = locals()[key] console = AsyncIOInteractiveConsole(repl_locals, loop) repl_future = None repl_future_interrupted = False try: import readline # NoQA except ImportError: pass repl_thread = REPLThread() repl_thread.daemon = True repl_thread.start() while True: try: loop.run_forever() except KeyboardInterrupt: if repl_future and not repl_future.done(): repl_future.cancel() repl_future_interrupted = True continue else: break trsock.py000064400000004653152527367570006456 0ustar00import socket class TransportSocket: """A socket-like wrapper for exposing real transport sockets. These objects can be safely returned by APIs like `transport.get_extra_info('socket')`. All potentially disruptive operations (like "socket.close()") are banned. """ __slots__ = ('_sock',) def __init__(self, sock: socket.socket): self._sock = sock @property def family(self): return self._sock.family @property def type(self): return self._sock.type @property def proto(self): return self._sock.proto def __repr__(self): s = ( f"" def __getstate__(self): raise TypeError("Cannot serialize asyncio.TransportSocket object") def fileno(self): return self._sock.fileno() def dup(self): return self._sock.dup() def get_inheritable(self): return self._sock.get_inheritable() def shutdown(self, how): # asyncio doesn't currently provide a high-level transport API # to shutdown the connection. self._sock.shutdown(how) def getsockopt(self, *args, **kwargs): return self._sock.getsockopt(*args, **kwargs) def setsockopt(self, *args, **kwargs): self._sock.setsockopt(*args, **kwargs) def getpeername(self): return self._sock.getpeername() def getsockname(self): return self._sock.getsockname() def getsockbyname(self): return self._sock.getsockbyname() def settimeout(self, value): if value == 0: return raise ValueError( 'settimeout(): only 0 timeout is allowed on transport sockets') def gettimeout(self): return 0 def setblocking(self, flag): if not flag: return raise ValueError( 'setblocking(): transport sockets cannot be blocking') __pycache__/sslproto.cpython-312.opt-1.pyc000064400000121520152527367570014327 0ustar00 {|j|zddlZddlZddlZ ddlZddlmZddlmZddlmZddlm Z ddl m Z eejejfZGdd ejZGd d ejZd Zd ZGdde j(e j*ZGddej.Zy#e$rdZYwxYw)N) constants) exceptions) protocols) transports)loggerc eZdZdZdZdZdZdZy)SSLProtocolState UNWRAPPED DO_HANDSHAKEWRAPPEDFLUSHINGSHUTDOWNN)__name__ __module__ __qualname__r r r rr)/usr/lib64/python3.12/asyncio/sslproto.pyr r sI!LGHHrr ceZdZdZdZdZdZy)AppProtocolState STATE_INITSTATE_CON_MADE STATE_EOFSTATE_CON_LOSTN)rrrrrrrrrrrrsJ%NI%NrrcZ|r tdtj}|sd|_|S)Nz(Server side SSL needs a valid SSLContextF) ValueErrorsslcreate_default_contextcheck_hostname) server_sideserver_hostname sslcontexts r_create_transport_contextr$/s2CDD ++-J $) ! rc|||dz}n |}d|z}n|}||dz}n|}||cxk\rdk\sntd|d|d||fS)Nirzhigh (z) must be >= low (z) must be >= 0)r)highlowkbhilos radd_flowcontrol_defaultsr,=sh | ;dBBRB  { 1W  =q=b"# # r6MrceZdZdZej j ZdZddZ dZ dZ dZ dZ efd Zd Zd Zd Zdd ZdZdZddZdZdZedZdZdZdZdZdZdZ dZ!y)_SSLProtocolTransportTc.||_||_d|_y)NF)_loop _ssl_protocol_closed)selfloop ssl_protocols r__init__z_SSLProtocolTransport.__init__Xs ) rNc:|jj||S)z#Get optional transport information.)r1_get_extra_infor3namedefaults rget_extra_infoz$_SSLProtocolTransport.get_extra_info]s!!11$@@rc:|jj|yN)r1_set_app_protocol)r3protocols r set_protocolz"_SSLProtocolTransport.set_protocolas ,,X6rc.|jjSr>)r1 _app_protocolr3s r get_protocolz"_SSLProtocolTransport.get_protocolds!!///rcR|jxs|jjSr>)r2r1_is_transport_closingrDs r is_closingz _SSLProtocolTransport.is_closinggs ||It11GGIIrcn|js"d|_|jjyd|_y)a Close the transport. Buffered data will be flushed asynchronously. No more data will be received. After all buffered data is flushed, the protocol's connection_lost() method will (eventually) called with None as its argument. TN)r2r1_start_shutdownrDs rclosez_SSLProtocolTransport.closejs,||DL    . . 0!%D rcX|jsd|_|jdtyy)NTz9unclosed transport )r2warnResourceWarning)r3 _warningss r__del__z_SSLProtocolTransport.__del__xs)||DL NN* ,rc0|jj Sr>)r1_app_reading_pausedrDs r is_readingz _SSLProtocolTransport.is_readings%%9999rc8|jjy)zPause the receiving end. No data will be passed to the protocol's data_received() method until resume_reading() is called. N)r1_pause_readingrDs r pause_readingz#_SSLProtocolTransport.pause_readings ))+rc8|jjy)zResume the receiving end. Data received will once again be passed to the protocol's data_received() method. N)r1_resume_readingrDs rresume_readingz$_SSLProtocolTransport.resume_readings **,rcp|jj|||jjy)aSet the high- and low-water limits for write flow control. These two values control when to call the protocol's pause_writing() and resume_writing() methods. If specified, the low-water limit must be less than or equal to the high-water limit. Neither value can be negative. The defaults are implementation-specific. If only the high-water limit is given, the low-water limit defaults to an implementation-specific value less than or equal to the high-water limit. Setting high to zero forces low to zero as well, and causes pause_writing() to be called whenever the buffer becomes non-empty. Setting low to zero causes resume_writing() to be called only once the buffer is empty. Use of zero for either limit is generally sub-optimal as it reduces opportunities for doing I/O and computation concurrently. N)r1_set_write_buffer_limits_control_app_writingr3r'r(s rset_write_buffer_limitsz-_SSLProtocolTransport.set_write_buffer_limitss,& 33D#> //1rcZ|jj|jjfSr>)r1_outgoing_low_water_outgoing_high_waterrDs rget_write_buffer_limitsz-_SSLProtocolTransport.get_write_buffer_limits*""66""779 9rc6|jjS)z-Return the current size of the write buffers.)r1_get_write_buffer_sizerDs rget_write_buffer_sizez+_SSLProtocolTransport.get_write_buffer_sizes!!88::rcp|jj|||jjy)aSet the high- and low-water limits for read flow control. These two values control when to call the upstream transport's pause_reading() and resume_reading() methods. If specified, the low-water limit must be less than or equal to the high-water limit. Neither value can be negative. The defaults are implementation-specific. If only the high-water limit is given, the low-water limit defaults to an implementation-specific value less than or equal to the high-water limit. Setting high to zero forces low to zero as well, and causes pause_reading() to be called whenever the buffer becomes non-empty. Setting low to zero causes resume_reading() to be called only once the buffer is empty. Use of zero for either limit is generally sub-optimal as it reduces opportunities for doing I/O and computation concurrently. N)r1_set_read_buffer_limits_control_ssl_readingr]s rset_read_buffer_limitsz,_SSLProtocolTransport.set_read_buffer_limitss,& 224= //1rcZ|jj|jjfSr>)r1_incoming_low_water_incoming_high_waterrDs rget_read_buffer_limitsz,_SSLProtocolTransport.get_read_buffer_limitsrcrc6|jjS)z+Return the current size of the read buffer.)r1_get_read_buffer_sizerDs rget_read_buffer_sizez*_SSLProtocolTransport.get_read_buffer_sizes!!7799rc.|jjSr>)r1_app_writing_pausedrDs r_protocol_pausedz&_SSLProtocolTransport._protocol_pauseds!!555rct|tttfs!t dt |j |sy|jj|fy)zWrite some data bytes to the transport. This does not block; it buffers the data and arranges for it to be sent out asynchronously. z+data: expecting a bytes-like instance, got N) isinstancebytes bytearray memoryview TypeErrortyperr1_write_appdatar3datas rwritez_SSLProtocolTransport.writesX $ : >?##':#6#6"79: :  ))4'2rc:|jj|y)zWrite a list (or any iterable) of data bytes to the transport. The default implementation concatenates the arguments and calls write() on the result. N)r1r|)r3 list_of_datas r writelinesz _SSLProtocolTransport.writeliness )),7rct)zuClose the write end after flushing buffered data. This raises :exc:`NotImplementedError` right now. )NotImplementedErrorrDs r write_eofz_SSLProtocolTransport.write_eofs "!rcy)zAReturn True if this transport supports write_eof(), False if not.FrrDs r can_write_eofz#_SSLProtocolTransport.can_write_eofsrc&|jdy)zClose the transport immediately. Buffered data will be lost. No more data will be received. The protocol's connection_lost() method will (eventually) be called with None as its argument. N) _force_closerDs rabortz_SSLProtocolTransport.aborts $rcbd|_|j|jj|yyNT)r2r1_abortr3excs rrz"_SSLProtocolTransport._force_closes.    )    % %c * *rc|jjj||jxjt |z c_yr>)r1_write_backlogappend_write_buffer_sizelenr}s r_test__append_write_backlogz1_SSLProtocolTransport._test__append_write_backlogs7 ))006 --T:-rr>NN)"rrr_start_tls_compatibler _SendfileModeFALLBACK_sendfile_compatibler6r<rArErHrKwarningsrPrSrVrYr^rbrfrjrnrqpropertyrtrrrrrrrrrrr.r.Rs!$22;; A70J &!),:,-2,9;2,9:66 38" + ;rr.c eZdZdZdZdZdZ d+dZdZd,dZ dZ dZ dZ d Z d Zd Zd Zd,d ZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZ dZ!dZ"dZ#d Z$d!Z%d-d"Z&d#Z'd$Z(d%Z)d-d&Z*d'Z+d(Z,d)Z-d.d*Z.y)/ SSLProtocoliNc t tdt|j|_t |j|_|tj}n|dkrtd|| tj} n| dkrtd| |s t||}||_ |r |s||_ nd|_ ||_t||_t#j$|_d|_||_||_|j/|d|_d|_d|_||_| |_tj:|_tj:|_t@jB|_"d|_#|rtHjJ|_&ntHjN|_&|jjQ|j<|j>|j|j|_)d|_*d|_+d|_,d|_-d|_.|j_d|_0d|_1d|_2d|_3|ji|jky)Nzstdlib ssl module not availablerz7ssl_handshake_timeout should be a positive number, got z6ssl_shutdown_timeout should be a positive number, got )r#F)r!r")6r RuntimeErrorrxmax_size _ssl_bufferry_ssl_buffer_viewrSSL_HANDSHAKE_TIMEOUTrSSL_SHUTDOWN_TIMEOUTr$ _server_side_server_hostname _sslcontextdict_extra collectionsdequerr_waiterr0r?_app_transport_app_transport_created _transport_ssl_handshake_timeout_ssl_shutdown_timeout MemoryBIO _incoming _outgoingr r _state _conn_lostrr _app_staterwrap_bio_sslobj_ssl_writing_pausedrR_ssl_reading_pausedrmrlrh _eof_receivedrsrar`r[_get_app_transport) r3r4 app_protocolr#waiterr!r"call_connection_madessl_handshake_timeoutssl_shutdown_timeouts rr6zSSLProtocol.__init__sE ;@A A$T]]3 *4+;+; < ($-$C$C ! "a ',-/0 0 '#,#A#A !Q &+,./ /2_.J( ;$3D !$(D !%j1 *//1"#   |,"&+#&;#%9"&00  .99DO.==DO''00 NNDNN)) 1113 $) #( #( $%!#$  $$&"#( $%!#$  %%' !rc||_t|drDt|tjr*|j |_|j|_d|_ yd|_ y)N get_bufferTF) rChasattrrvrBufferedProtocolr_app_protocol_get_bufferbuffer_updated_app_protocol_buffer_updated_app_protocol_is_buffer)r3rs rr?zSSLProtocol._set_app_protocolasP) L, /<)C)CD,8,C,CD )0<0K0KD -+/D (+0D (rc|jy|jjs@|#|jj|d|_y|jjdd|_yr>)r cancelled set_exception set_resultrs r_wakeup_waiterzSSLProtocol._wakeup_waiterlsZ <<  ||%%' **3/  ''- rc|j9|jr tdt|j||_d|_|jS)Nz$Creating _SSLProtocolTransport twiceT)rrrr.r0rDs rrzSSLProtocol._get_app_transportvsJ    &**"#IJJ"7 D"ID *.D '"""rcV|jduxr|jjSr>)rrHrDs rrGz!SSLProtocol._is_transport_closing~s#d*Kt/I/I/KKrc2||_|jy)zXCalled when the low-level connection is made. Start the SSL handshake. N)r_start_handshake)r3 transports rconnection_madezSSLProtocol.connection_mades $ rcH|jj|jj|xjdz c_|j d|j _|jtjk7r|jtjk(s|jtjk(rEtj|_ |jj!|j"j$||j'tj(d|_d|_d|_|j-||j.r!|j.j1d|_|j2r"|j2j1d|_yy)zCalled when the low-level connection is lost or closed. The argument is an exception object or None (the latter meaning a regular EOF is received or the connection was aborted or closed). rNT)rclearrreadrrr2rr r rrrrrr0 call_soonrCconnection_lost _set_stater rr_shutdown_timeout_handlecancel_handshake_timeout_handlers rrzSSLProtocol.connection_losts9 !!#  1    **.D   ' ;;*77 7#3#B#BB#3#=#=="2"A"A $$T%7%7%G%GM (223"! C  ( (  ) ) 0 0 2,0D )  ) )  * * 1 1 3-1D * *rc|}|dks||jkDr |j}t|j|kr*t||_t |j|_|j SNr)rrrrxryr)r3nwants rrzSSLProtocol.get_buffers` 19t}},==D t 4 '(D $.t/?/?$@D !$$$rc|jj|jd||jtj k(r|j y|jtjk(r|jy|jtjk(r|jy|jtjk(r|jyyr>) rrrrr r _do_handshaker _do_readr _do_flushr _do_shutdown)r3nbytess rrzSSLProtocol.buffer_updateds T227F;< ;;*77 7    [[,44 4 MMO [[,55 5 NN  [[,55 5    6rcd|_ |jjrtjd||j t jk(r|jty|j t jk(r=|jt j|jry|jy|j t jk(r@|j|jt j |j#y|j t j k(r|j#yy#t$$r|j&j)wxYw)aCalled when the other end of the low-level stream is half-closed. If this returns a false value (including None), the transport will close itself. If it returns a true value, closing the transport is up to the protocol. Tz%r received EOFN)rr0 get_debugrdebugrr r _on_handshake_completeConnectionResetErrorr rrrRr _do_writerr ExceptionrrKrDs r eof_receivedzSSLProtocol.eof_receiveds" zz##% .5{{.;;;++,@A 0 8 88 0 9 9:++NN$ 0 9 99  0 9 9:!!# 0 9 99!!#:  OO ! ! #  s&A"E,AE5EAE#-E%E7c||jvr|j|S|j|jj||S|Sr>)rrr<r9s rr8zSSLProtocol._get_extra_infosC 4;; ;;t$ $ __ (??11$@ @Nrc&d}|tjk(rd}n|jtjk(r|tjk(rd}n|jtjk(r|tjk(rd}ne|jtjk(r|tj k(rd}n2|jtj k(r|tj k(rd}|r||_ytdj|j|)NFTz!cannot switch state from {} to {}) r r rr r rrrformat)r3 new_statealloweds rrzSSLProtocol._set_states (22 2G KK+55 5 )66 6G KK+88 8 )11 1G KK+33 3 )22 2G KK+44 4 )22 2G #DK3::KK,- -rcnjjr6tjdjj _nd_j tjjjjfd_ jy)Nz%r starts SSL handshakec$jSr>)_check_handshake_timeoutrDsrz.SSLProtocol._start_handshake..$s$*G*G*Ir) r0rrrtime_handshake_start_timerr r call_laterrrrrDs`rrzSSLProtocol._start_handshakes ::   ! LL2D 9)-):D &)-D & (556 JJ ! !$"="="I K & rc|jtjk(r+d|jd}|j t |yy)Nz$SSL handshake is taking longer than z! seconds: aborting the connection)rr r r _fatal_errorConnectionAbortedError)r3msgs rrz$SSLProtocol._check_handshake_timeout(sN ;;*77 76../0*+    4S9 : 8rc |jj|jdy#t$r|j Yyt j $r}|j|Yd}~yd}~wwxYwr>)r do_handshakerSSLAgainErrors_process_outgoingrSSLErrorrs rrzSSLProtocol._do_handshake1sb . LL % % '  ' ' -  %  " " $|| -  ' ' , , -s.A6 A6A11A6c|j!|jjd|_|j} | |jtj n||j }|jjrA|jj!|j"z }t%j&d||dz|j(j+||j-|j/||j0t2j4k(r>t2j6|_|j8j;|j=|j|j?y#t$rm}d}|jtjt|tjrd}nd}|j|||j|Yd}~yd}~wwxYw)Nz1SSL handshake failed on verifying the certificatezSSL handshake failedz%r: SSL handshake took %.1f msg@@)peercertcipher compression ssl_object) rrrrr r getpeercertrr rvrCertificateErrorrrr0rrrrrrupdater r rrrrrCrrr)r3 handshake_excsslobjrrrdts rrz"SSLProtocol._on_handshake_complete;s  ) ) 5  * * 1 1 3-1D * $ 0 8 89##))+H ::   !"T%?%??B LL94c J H"(--/'-'9'9';&,  . ??.99 9.==DO    . .t/F/F/H I  1  M OO,66 7#s334I,   c3 '    $  s4F G7 A#G22G7cjtjtjtjfvryj dj _jtjk(rjdyjtjjjjfd_ jy)NTc$jSr>)_check_shutdown_timeoutrDsrrz-SSLProtocol._start_shutdown..us446r)rr rrr rr2r rrr0rrrrrDs`rrJzSSLProtocol._start_shutdownds KK )) )) **      **.D   ' ;;*77 7 KK  OO,55 6,0JJ,A,A**6-D ) NN rc|jtjtjfvr/|jj t jdyy)NzSSL shutdown timed out)rr rrrrr TimeoutErrorrDs rrz#SSLProtocol._check_shutdown_timeoutysN KK )) ))  OO ( (''(@A C  rc|j|jtj|j yr>)rrr rrrDs rrzSSLProtocol._do_flushs*  (112 rcJ |js|jj|j|j |j dy#t $r|jYytj$r}|j |Yd}~yd}~wwxYwr>) rrunwrapr_call_eof_received_on_shutdown_completerrrrs rrzSSLProtocol._do_shutdowns -%% ##%  " " $  # # %  & &t , %  " " $|| ,  & &s + + ,s&AB"5B"BB"c|j!|jjd|_|r|j|y|jj |j j yr>)rrrr0rrrK)r3 shutdown_excs rrz!SSLProtocol._on_shutdown_completesU  ( ( 4  ) ) 0 0 2,0D )    l + JJ !6!6 7rc|jtj|j|jj |yyr>)rr r rrrs rrzSSLProtocol._aborts6 (223 ?? & OO ( ( - 'rc8|jtjtjtjfvrH|j t jk\rtjd|xj dz c_y|D];}|jj||xjt|z c_ = |jtjk(r|jyy#t $r}|j#|dYd}~yd}~wwxYw)NzSSL connection is closedrFatal error on SSL protocol)rr rrr rr!LOG_THRESHOLD_FOR_CONNLOST_WRITESrwarningrrrrr rrr)r3rr~exs rr|zSSLProtocol._write_appdatas KK )) )) **  )"M"MM9: OOq O  D    & &t ,  # #s4y 0 #! A{{.666 7 A   b"? @ @ As-C44 D=DDc~ |jr|jd}|jj|}t|}||kr(||d|jd<|xj|zc_n"|jd=|xj|zc_|jr|j y#t $rYwxYwr)rrrrrrr)r3r~countdata_lens rrzSSLProtocol._do_writes %%**1- **40t98#-1%&\D''*++u4+++A.++x7+%%     sBB00 B<;B<c|js@|jj}t|r|jj ||j yr>)rrrrrrr\r}s rrzSSLProtocol._process_outgoingsB''>>&&(D4y%%d+ !!#rc|jtjtjfvry |jsZ|j r|j n|j|jr|jn|j|jy#t$r}|j|dYd}~yd}~wwxYw)Nr )rr r rrRr_do_read__buffered_do_read__copiedrrrrirr)r3r#s rrzSSLProtocol._do_reads KK (( ))    A++//++-))+&&NN$**,  % % ' A   b"? @ @ AsA6B&& C /CC cd}d}jj}t|} jj ||}|dkDrY|}||kr4jj ||z ||d}|dkDr||z }nn$||kr4j j fd|dkDrj||s!jjyy#t$rYEwxYw)Nrrc$jSr>)rrDsrrz0SSLProtocol._do_read__buffered..s r) rrprrrr0rrrrrJ)r3offsetr%bufwantss` rr)zSSLProtocol._do_read__buffereds++D,F,F,HIC LL%%eS1Eqyun LL--efnc&'lKEqy% unJJ(()@A A:  - -f 5  # # %  "    sAC% C%% C10C1cd}d}d} |jj|j}|sn$|rd}d}|}n|rd}|g}nj|L |r|j j n,|s*|j j dj|s!|j|jyy#t$rYywxYw)N1TFr) rrrrrrC data_receivedjoinrrJ)r3chunkzeroonefirstr~s rr*zSSLProtocol._do_read__copied s  ))$--8 DC!EC!5>DKK&     , ,U 3    , ,SXXd^ <  # # %  "    sA C CCc> |jtjk(rHtj|_|jj }|rt jdyyy#ttf$rt$r}|j|dYd}~yd}~wwxYw)Nz?returning true from eof_received() has no effect when using sslzError calling eof_received()) rrrrrCrrr"KeyboardInterrupt SystemExit BaseExceptionr)r3 keep_openr#s rrzSSLProtocol._call_eof_received(s B"2"A"AA"2"<"< ..;;= NN$BCB ":.   B   b"@ A A BsA#A((BBBcZ|j}||jk\r/|js#d|_ |jj y||jkr0|jr#d|_ |jjyyy#t t f$rt$r4}|jjd||j|dYd}~yd}~wwxYw#t t f$rt$r4}|jjd||j|dYd}~yd}~wwxYw)NTzprotocol.pause_writing() failedmessage exceptionrr@Fz protocol.resume_writing() failed) rerarsrC pause_writingr9r:r;r0call_exception_handlerrr`resume_writing)r3sizers rr\z SSLProtocol._control_app_writing7s$**, 4,, ,T5M5M'+D $ ""002T-- -$2J2J',D $ ""1133K -&z2    11@!$!%!4!4 $ 3 &z2    11A!$!%!4!4 $ 3 s/B2CC'*CCD*6*D%%D*cH|jj|jzSr>)rpendingrrDs rrez"SSLProtocol._get_write_buffer_sizeTs~~%%(?(???rc\t||tj\}}||_||_yr>)r,r!FLOW_CONTROL_HIGH_WATER_SSL_WRITErar`r]s rr[z$SSLProtocol._set_write_buffer_limitsWs., #yBBD c$(!#& rcd|_yr)rRrDs rrUzSSLProtocol._pause_reading_s #' rcnjr(d_fd}jj|yy)NFcjtjk(rjyjtjk(rj yjtj k(rjyyr>)rr r rrrrrrDsrresumez+SSLProtocol._resume_reading..resumefs`;;"2":"::MMO[[$4$=$==NN$[[$4$=$==%%'>r)rRr0r)r3rLs` rrXzSSLProtocol._resume_readingbs2  # #',D $ ( JJ  ( $rc|j}||jk\r.|js"d|_|jj y||j kr/|jr"d|_|jj yyy)NTF)rprmrrrVrlrY)r3rDs rriz SSLProtocol._control_ssl_readingqsu))+ 4,, ,T5M5M'+D $ OO ) ) + T-- -$2J2J',D $ OO * * ,3K -rc\t||tj\}}||_||_yr>)r,r FLOW_CONTROL_HIGH_WATER_SSL_READrmrlr]s rrhz#SSLProtocol._set_read_buffer_limitszs., #yAAC c$(!#& rc.|jjSr>)rrFrDs rrpz!SSLProtocol._get_read_buffer_sizes~~%%%rcd|_y)z\Called when the low-level transport's buffer goes over the high-water mark. TN)rrDs rrAzSSLProtocol.pause_writings $( rc2d|_|jy)z^Called when the low-level transport's buffer drains below the low-water mark. FN)rrrDs rrCzSSLProtocol.resume_writings $)   rcf|jr|jj|t|tr5|jj rt jd||dyyt|tjs+|jj|||j|dyy)Nz%r: %sT)exc_infor>) rrrvOSErrorr0rrrrCancelledErrorrB)r3rr?s rrzSSLProtocol._fatal_errors ?? OO ( ( - c7 #zz##% XtWtD&C!:!:; JJ - -" !__ / r)zFatal error on transport)/rrrrrrrr6r?rrrGrrrrrr8rrrrrrJrrrrrr|rrrr)r*rr\rer[rUrXrirhrprArCrrrrrrsH  $#59&*'+&* Q"f 1#L "2H%  !F$-P ;.%R*C -8.A0! $A,#:#< B:@'( )-' & (! rr)renumrr ImportErrorrrrrlogrSSLWantReadErrorSSLSyscallErrorrEnumr rr$r,_FlowControlMixin Transportr.rrrrrr`s  ?**C,?,?@Ntyy &tyy & *r;J88&00r;jZ ),,Z { CsB00B:9B:__pycache__/subprocess.cpython-312.pyc000064400000027500152527367570013676 0ustar00 {|j92dZddlZddlmZddlmZddlmZddlmZddlmZejZ ejZ ejZ Gd d ejejZGd d Zdddej fd Zdddej ddZy))create_subprocess_execcreate_subprocess_shellN)events) protocols)streams)tasks)loggercLeZdZdZfdZdZdZdZdZdZ dZ d Z xZ S) SubprocessStreamProtocolz0Like StreamReaderProtocol, but for a subprocess.ct||||_dx|_x|_|_d|_d|_g|_|jj|_ y)N)loopF) super__init___limitstdinstdoutstderr _transport_process_exited _pipe_fds_loop create_future _stdin_closed)selflimitr __class__s +/usr/lib64/python3.12/asyncio/subprocess.pyrz!SubprocessStreamProtocol.__init__sZ d# 155 5T[4;$!ZZ557cl|jjg}|j|jd|j|j|jd|j|j |jd|j dj dj|S)Nzstdin=zstdout=zstderr=z<{}> )r__name__rappendrrformatjoin)rinfos r__repr__z!SubprocessStreamProtocol.__repr__s''( :: ! KK&/ 0 ;; " KK'$++1 2 ;; " KK'$++1 2}}SXXd^,,rcn||_|jd}|ftj|j|j |_|j j||jjd|jd}|ftj|j|j |_ |jj||jjd|jd}|)tj||d|j |_ yy)Nrrrr)protocolreaderr) rget_pipe_transportr StreamReaderrrr set_transportrr#r StreamWriterr)r transportstdout_transportstderr_transportstdin_transports rconnection_madez(SubprocessStreamProtocol.connection_made(s#$77:  '!..T[[48JJ@DK KK % %&6 7 NN ! !! $$77:  '!..T[[48JJ@DK KK % %&6 7 NN ! !! $#66q9  & --o7;5937::?DJ 'rcx|dk(r |j}n|dk(r |j}nd}||j|yyNrr*)rr feed_data)rfddatar,s rpipe_data_receivedz+SubprocessStreamProtocol.pipe_data_received@s@ 7[[F 1W[[FF     T " rc |dk(rz|j}||j|j|||jj dy|jj |d|j_y|dk(r |j}n|dk(r |j}nd}|$||jn|j |||jvr|jj||jy)NrFrr*) rcloseconnection_lostr set_result set_exception_log_tracebackrrfeed_eofrremove_maybe_close_transport)rr9excpiper,s rpipe_connection_lostz-SubprocessStreamProtocol.pipe_connection_lostJs 7::D   %{""--d3  ""0055:""1  7[[F 1W[[FF  {!$$S)   NN ! !" % ##%rc2d|_|jy)NT)rrDrs rprocess_exitedz'SubprocessStreamProtocol.process_exitedhs# ##%rct|jdk(r/|jr"|jj d|_yyy)Nr)lenrrrr=rIs rrDz/SubprocessStreamProtocol._maybe_close_transportls: t~~ ! #(<(< OO ! ! #"DO)= #rc8||jur |jSyN)rr)rstreams r_get_close_waiterz*SubprocessStreamProtocol._get_close_waiterqs TZZ %% % r) r" __module__ __qualname____doc__rr'r5r;rGrJrDrP __classcell__)rs@rr r s.:8-?0#&<&# &rr cZeZdZdZdZedZdZdZdZ dZ dZ d Z d Z d d Zy )Processc||_||_||_|j|_|j|_|j |_|j |_yrN)r _protocolrrrrget_pidpid)rr1r+rs rrzProcess.__init__wsH#! ^^ oo oo $$&rcPd|jjd|jdS)N)rr"rZrIs rr'zProcess.__repr__s&4>>**+1TXXJa88rc6|jjSrN)rget_returncoderIs r returncodezProcess.returncodes--//rcRK|jjd{S7w)z?Wait until the process exit and return the process return code.N)r_waitrIs rwaitz Process.waits__**,,,,s '%'c:|jj|yrN)r send_signal)rsignals rrezProcess.send_signals ##F+rc8|jjyrN)r terminaterIs rrhzProcess.terminates !!#rc8|jjyrN)rkillrIs rrjz Process.kills rcK|jj} |=|jj||r t j d|t ||jjd{|rt j d||jjy77#ttf$r#}|rt j d||Yd}~bd}~wwxYww)Nz%%r communicate: feed stdin (%s bytes)z%r communicate: stdin got %rz%r communicate: close stdin) r get_debugrwriter debugrLdrainBrokenPipeErrorConnectionResetErrorr=)rinputrnrEs r _feed_stdinzProcess._feed_stdins $$& H    'LL?s5zS**""$ $ $  LL6 =  %!56 H ;T3G  HsAC)AB4:B2;B4?3C)2B44C&C!C)!C&&C)c KywrNrIs r_noopz Process._noops scK|jj|}|dk(r |j}n|dk(sJ|j}|jj r |dk(rdnd}t jd|||jd{}|jj r |dk(rdnd}t jd|||j|S7Pw)Nr*rrrz%r communicate: read %sz%r communicate: close %s) rr-rrrrlr rnreadr=)rr9r1rOnameoutputs r _read_streamzProcess._read_streamsOO66r: 7[[F7N7[[F ::   !!Qw8HD LL2D$ ?{{}$ ::   !!Qw8HD LL3T4 @ %sBC#C!AC#NcK|j|j|}n|j}|j|j d}n|j}|j |j d}n|j}t j|||d{\}}}|jd{||fS7$7 wr7) rrsrvrr{rr gatherrc)rrrrrrs r communicatezProcess.communicates :: !$$U+EJJLE ;; "&&q)FZZ\F ;; "&&q)FZZ\F&+ll5&&&I Ivviik!Js$B%C'C (CC CCrN)r"rQrRrr'propertyr`rcrerhrjrsrvr{r~rurrrVrVvsH'900-,$(" rrVc Ktj  fd} j||f|||d|d{\}}t|| S7w)NctSNr)r r)srz)create_subprocess_shell..7e=A Crrrr)rget_running_loopsubprocess_shellrV) cmdrrrrkwdsprotocol_factoryr1r+rs ` @rrrsm  " " $DC 5 5 5 !!!Ix 9h -- s6AAA)rrrrc Ktj  fd} j||g||||d|d{\}} t|| S7w)NctSrrr)srrz(create_subprocess_exec..rrr)rrsubprocess_execrV) programrrrrargsrrr1r+rs ` @rrrsy  " " $DC 4 4 4!!F ! !Ix 9h -- s9AAA)__all__ subprocessrrrr logr PIPESTDOUTDEVNULLFlowControlMixinSubprocessProtocolr rV_DEFAULT_LIMITrrrurrrs =      b&w77(;;b&JU U p.2$t(/(>(> .8@iii,creZdZejZejZejZy) _SendfileModeN)__name__ __module__ __qualname__enumauto UNSUPPORTED TRY_NATIVEFALLBACK*/usr/lib64/python3.12/asyncio/constants.pyrr&s)$))+KJtyy{Hrr) r !LOG_THRESHOLD_FOR_CONNLOST_WRITESACCEPT_RETRY_DELAYDEBUG_STACK_DEPTHSSL_HANDSHAKE_TIMEOUTSSL_SHUTDOWN_TIMEOUT!SENDFILE_FALLBACK_READBUFFER_SIZE FLOW_CONTROL_HIGH_WATER_SSL_READ!FLOW_CONTROL_HIGH_WATER_SSL_WRITETHREAD_JOIN_TIMEOUTEnumrrrrrs^  %&! %/!#& $'!DIIr__pycache__/selector_events.cpython-312.opt-1.pyc000064400000173316152527367570015660 0ustar00 {|j̼dZdZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl mZddl mZddl mZddl mZdd l mZdd l mZdd l mZdd l mZdd lmZeejdZer ej4dZdZGddej<ZGddej@ejBZ"Gdde"Z#Gdde"ejHZ%y#e $rdZ YwxYw#e$rdZYpwxYw)zEvent loop using a selector and related classes. A selector is a "notify-when-ready" multiplexer. For a subclass which also includes support for signal handling, see the unix_events sub-module. )BaseSelectorEventLoopN) base_events) constants)events)futures) protocols)sslproto) transports)trsock)loggersendmsg SC_IOV_MAXFct |j|}t|j|zS#t$rYywxYwNF)get_keyboolrKeyError)selectorfdeventkeys 0/usr/lib64/python3.12/asyncio/selector_events.py_test_selector_eventr*sA(r"CJJ&'' s + 77ceZdZdZd3fd Zd3ddddZ d3ddddejejddZ d4d Z fd Z d Z d Z d ZdZdZdddejejfdZdddejejfdZddejejfdZdZdZdZdZdZdZdZdZdZdZd3dZdZd Z d!Z!d"Z"d#Z#d5d$Z$d%Z%d&Z&d'Z'd(Z(d)Z)d*Z*d+Z+d3d,Z,d-Z-d.Z.d/Z/d0Z0d1Z1d2Z2xZ3S)6rzJSelector event loop. See events.EventLoop for API specification. Nct||tj}t j d|j j||_|jtj|_ y)NzUsing selector: %s) super__init__ selectorsDefaultSelectorr debug __class____name__ _selector_make_self_pipeweakrefWeakValueDictionary _transports)selfrr"s rrzBaseSelectorEventLoop.__init__;sa    002H )8+=+=+F+FG! "668extraservercD|j|t||||||SN)_ensure_fd_no_transport_SelectorSocketTransport)r)sockprotocolwaiterr,r-s r_make_socket_transportz,BaseSelectorEventLoop._make_socket_transportEs* $$T*'dHf(-v7 7r*F) server_sideserver_hostnamer,r-ssl_handshake_timeoutssl_shutdown_timeoutc |j|tj||||||| | } t||| ||| jS)N)r8r9r+)r0r SSLProtocolr1_app_transport) r)rawsockr3 sslcontextr4r6r7r,r-r8r9 ssl_protocols r_make_ssl_transportz)BaseSelectorEventLoop._make_ssl_transportKsW $$W-++ (J "7!5  !w ',V =***r*cD|j|t||||||Sr/)r0_SelectorDatagramTransport)r)r2r3addressr4r,s r_make_datagram_transportz.BaseSelectorEventLoop._make_datagram_transport]s, $$T*)$h*165B Br*c|jr td|jry|jt||j "|j j d|_yy)Nz!Cannot close a running event loop) is_running RuntimeError is_closed_close_self_pipercloser$r)r"s rrJzBaseSelectorEventLoop.closecsa ?? BC C >>      >> % NN "!DN &r*c|j|jj|jjd|_|jjd|_|xj dzc_y)Nr)_remove_reader_ssockfilenorJ_csock _internal_fdsr)s rrIz&BaseSelectorEventLoop._close_self_pipens\ DKK..01     ar*cDtj\|_|_|jj d|jj d|xj dz c_|j |jj|jy)NFr) socket socketpairrNrP setblockingrQ _add_readerrO_read_from_selfrRs rr%z%BaseSelectorEventLoop._make_self_pipevsq#)#4#4#6  T[ & & a ++-t/C/CDr*cyr/r)datas r_process_self_dataz(BaseSelectorEventLoop._process_self_data~s r*c |jjd}|sy|j|1#t$rY=t$rYywxYw)Ni)rNrecvr]InterruptedErrorBlockingIOErrorr[s rrXz%BaseSelectorEventLoop._read_from_selfsV {{''-''-  $ "  s33 A A A c|j}|y |jdy#t$r(|jrt j ddYyYywxYw)Nz3Fail to write a null byte into the self-pipe socketTexc_info)rPsendOSError_debugr r!)r)csocks r_write_to_selfz$BaseSelectorEventLoop._write_to_selfsU   =  , JJu  ,{{ 0&*, ,s#,AAdc f|j|j|j||||||| yr/)rWrO_accept_connection)r)protocol_factoryr2r>r-backlogr8r9s r_start_servingz$BaseSelectorEventLoop._start_servings4 (?(?)4VW.0D Fr*c t|D]w} |j\} } |jrtjd|| | | j dd| i} |j || | ||||} |j| yy#tttf$rYyt$r} | jtjtjtjtj fvry|j#d| t%j&|d|j)|j+|j-t.j0|j2||||||| nYd} ~ dd} ~ wwxYw)Nz#%r got a new connection from %r: %rFpeernamez&socket.accept() out of system resource)message exceptionrT)rangeacceptrhr r!rV_accept_connection2 create_taskrar`ConnectionAbortedErrorrgerrnoEMFILEENFILEENOBUFSENOMEMcall_exception_handlerr TransportSocketrMrO call_laterrACCEPT_RETRY_DELAYrp)r)rnr2r>r-ror8r9_connaddrr,rvexcs rrmz(BaseSelectorEventLoop._accept_connectionsXwA" )![[] d;;LL!F!'t5  '2$T*11$dE:v)+?A  (G $%57MN  99u||!& !>> //#K%("("8"8">1 '' 6OOI$@$@$($7$7$4dJ$+-B$8 :  : sABE5E5&CE00E5c Kd}d} |}|j} |r|j|||| d|||| } n|j||| ||} | d{y7#t$r| j d} wxYw#t t f$rt$r?} |jr)d| d} ||| d<| | | d<|j| Yd} ~ yYd} ~ yd} ~ wwxYww)NT)r4r6r,r-r8r9)r4r,r-z3Error on transport creation for incoming connection)rsrtr3 transport) create_futurer@r5 BaseExceptionrJ SystemExitKeyboardInterruptrhr) r)rnrr,r>r-r8r9r3rr4rcontexts rrwz)BaseSelectorEventLoop._accept_connection2s  & 5')H'')F 44(Jv $E&*?)= 5? !77(6!8#     !  -.   5{{N!$ '*2GJ'(+4GK(++G44 5sSCA BA AA CA A==BC0C CCCc*|}t|ts t|j} |j |}|jstd|d|y#ttt f$rt d|dwxYw#t$rYywxYw)NzInvalid file object: zFile descriptor z is used by transport ) isinstanceintrOAttributeError TypeError ValueErrorr( is_closingrGr)r)rrOrs rr0z-BaseSelectorEventLoop._ensure_fd_no_transports&#& KV]]_- &((0I'')"&rf,B m%&&*#Iz: K #8!?@dJ K    sAB$B BBc|jtj|||d} |jj |}|j|j c}\}}|jj ||tjz||f||j|S#t$r1|jj|tj|dfY|SwxYwr/) _check_closedrHandler$rr\modifyr EVENT_READcancelrregister r)rcallbackargshandlermaskreaderwriters rrWz!BaseSelectorEventLoop._add_readers xtT: ..((,C &)ZZ "D"66 NN ! !"dY-A-A&A#)6"2 4!   4 NN # #B (<(<%+TN 4  4B%%6CCc||jry |jj|}|j|jc}\}}|t j z}|s|jj|n|jj||d|f||jyy#t$rYywxYw)NFT) rHr$rrr\rr unregisterrrrr)rrrrrs rrMz$BaseSelectorEventLoop._remove_reader&s >>  ..((,C&)ZZ "D"66 Y))) )D))"-%%b$v?!   B// B;:B;c|jtj|||d} |jj |}|j|j c}\}}|jj ||tjz||f||j|S#t$r1|jj|tjd|fY|SwxYwr/) rrrr$rr\rr EVENT_WRITErrrrs r _add_writerz!BaseSelectorEventLoop._add_writer;s xtT: ..((,C &)ZZ "D"66 NN ! !"dY-B-B&B#)6"2 4!   4 NN # #B (=(=%)6N 4  4rc||jry |jj|}|j|jc}\}}|t j z}|s|jj|n|jj|||df||jyy#t$rYywxYw)Remove a writer callback.FNT) rHr$rrr\rrrrrrrs r_remove_writerz$BaseSelectorEventLoop._remove_writerKs >>  ..((,C&)ZZ "D"66 Y*** *D))"-%%b$?!   rcN|j||j||g|y)zAdd a reader callback.N)r0rWr)rrrs r add_readerz BaseSelectorEventLoop.add_readerb' $$R(X--r*cF|j||j|S)zRemove a reader callback.)r0rMr)rs r remove_readerz#BaseSelectorEventLoop.remove_readerg! $$R(""2&&r*cN|j||j||g|y)zAdd a writer callback..N)r0rrs r add_writerz BaseSelectorEventLoop.add_writerlrr*cF|j||j|S)r)r0rrs r remove_writerz#BaseSelectorEventLoop.remove_writerqrr*cKtj||jr|jdk7r t d |j |S#t tf$rYnwxYw|j}|j}|j||j||j|||}|jtj|j |||d{7Sw)zReceive data from the socket. The return value is a bytes object representing the data received. The maximum amount of data to be received at once is specified by nbytes. rthe socket must be non-blockingrN)r_check_ssl_socketrh gettimeoutrr_rar`rrOr0rW _sock_recvadd_done_callback functoolspartial_sock_read_done)r)r2nfutrrs r sock_recvzBaseSelectorEventLoop.sock_recvvs %%d+ ;;4??,1>? ? 99Q< !12     " [[] $$R(!!"doosD!D    d22Bv F Hyy7AC5AC5A&#C5%A&&B C5/C20C5cL||js|j|yyr/) cancelledrr)rrrs rrz%BaseSelectorEventLoop._sock_read_done% >!1!1!3   r ""4r*c|jry |j|}|j|y#ttf$rYyt t f$rt$r}|j|Yd}~yd}~wwxYwr/) doner_ set_resultrar`rrr set_exception)r)rr2rr\rs rrz BaseSelectorEventLoop._sock_recvsu 88:  !99Q? ? >>#& &!12     " [[] $$R(!!"d&:&:CsK    d22Bv F Hyyrc|jry |j|}|j|y#ttf$rYyt t f$rt$r}|j|Yd}~yd}~wwxYwr/) rrrrar`rrrr)r)rr2rnbytesrs rrz%BaseSelectorEventLoop._sock_recv_intosv 88:  #^^C(F NN6 " !12  -.   #   c " " #rcKtj||jr|jdk7r t d |j |S#t tf$rYnwxYw|j}|j}|j||j||j|||}|jtj|j |||d{7Sw)aReceive a datagram from a datagram socket. The return value is a tuple of (bytes, address) representing the datagram received and the address it came from. The maximum amount of data to be received at once is specified by nbytes. rrrN)rrrhrrrecvfromrar`rrOr0rW_sock_recvfromrrrr)r)r2bufsizerrrs r sock_recvfromz#BaseSelectorEventLoop.sock_recvfroms %%d+ ;;4??,1>? ? ==) )!12     " [[] $$R(!!"d&9&93gN    d22Bv F Hyyrc|jry |j|}|j|y#ttf$rYyt t f$rt$r}|j|Yd}~yd}~wwxYwr/) rrrrar`rrrr)r)rr2rresultrs rrz$BaseSelectorEventLoop._sock_recvfromsv 88:  #]]7+F NN6 " !12  -.   #   c " " #rc Ktj||jr|jdk7r t d|s t |} |j ||S#ttf$rYnwxYw|j}|j}|j||j||j||||}|jtj |j"|||d{7Sw)zReceive data from the socket. The received data is written into *buf* (a writable buffer). The return value is a tuple of (number of bytes written, address). rrrN)rrrhrrlen recvfrom_intorar`rrOr0rW_sock_recvfrom_intorrrr)r)r2rrrrrs rsock_recvfrom_intoz(BaseSelectorEventLoop.sock_recvfrom_intos %%d+ ;;4??,1>? ?XF %%c62 2!12     " [[] $$R(!!"d&>&>T3"(*    d22Bv F Hyys7A DA"!D"A41D3A44B D>D?Dc|jry |j||}|j|y#ttf$rYyt t f$rt$r}|j|Yd}~yd}~wwxYwr/) rrrrar`rrrr)r)rr2rrrrs rrz)BaseSelectorEventLoop._sock_recvfrom_intosz 88:  #''W5F NN6 " !12  -.   #   c " " #s7A:A:A55A:c (Ktj||jr|jdk7r t d |j |}|t|k(ry|j}|j}|j||j||j||t||g}|jt!j"|j$|||d{S#t tf$rd}YwxYw7w)Send data to the socket. The socket must be connected to a remote socket. This method continues to send data from data until either all data has been sent or an error occurs. None is returned on success. On error, an exception is raised, and there is no way to determine how much data, if any, was successfully processed by the receiving end of the connection. rrNr)rrrhrrrfrar`rrrOr0r _sock_sendall memoryviewrrr_sock_write_done)r)r2r\rrrrs r sock_sendallz"BaseSelectorEventLoop.sock_sendalls %%d+ ;;4??,1>? ?  $A D >   " [[] $$R(!!"d&8&8#t",T"2QC9    d33R G Iy !12 A s7ADC9B D4D5D9D  D D  Dc:|jry|d} |j||d}||z }|t|k(r|jdy||d<y#ttf$rYytt f$rt $r}|j|Yd}~yd}~wwxYwNr) rrfrar`rrrrrr)r)rr2viewposstartrrs rrz#BaseSelectorEventLoop._sock_sendall7s 88: A  $uv,'A   CI  NN4 CF !12  -.      c "  sAB(B?BBcKtj||jr|jdk7r t d |j ||S#t tf$rYnwxYw|j}|j}|j||j||j||||}|jtj|j |||d{7Sw)rrrrN)rrrhrrsendtorar`rrOr0r _sock_sendtorrrr)r)r2r\rCrrrs r sock_sendtoz!BaseSelectorEventLoop.sock_sendtoMs %%d+ ;;4??,1>? ? ;;tW- -!12     " [[] $$R(!!"d&7&7dD")+    d33R G Iyys7AC7AC7A'$C7&A''B C71C42C7c|jry |j|d|}|j|y#ttf$rYyt t f$rt$r}|j|Yd}~yd}~wwxYwr) rrrrar`rrrr)r)rr2r\rCrrs rrz"BaseSelectorEventLoop._sock_sendtohsx 88:   D!W-A NN1  !12  -.   #   c " " #s8A; A; A66A;c Ktj||jr|jdk7r t d|j t jk(s-tjrd|j t jk(rG|j||j |j|j|d{}|d\}}}}}|j}|j||| |d{d}S7?7#d}wxYww)zTConnect to a remote socket at address. This method is a coroutine. rr)familytypeprotoloopN)rrrhrrrrTAF_INET _HAS_IPv6AF_INET6_ensure_resolvedrrr _sock_connect)r)r2rCresolvedrrs r sock_connectz"BaseSelectorEventLoop.sock_connectws %%d+ ;;4??,1>? ? ;;&.. (%%$++*H!22 $))4::3H#+1+ Aq!Q  " 3g. 9CCs<CDD2D7D<D=DDDD  Dc|j} |j||jdd}y#ttf$rf|j ||j ||j|||}|jtj|j||Yd}yttf$rt$r}|j|Yd}~d}yd}~wwxYw#d}wxYw)Nr)rOconnectrrar`r0r_sock_connect_cbrrrrrrrr)r)rr2rCrrrs rrz#BaseSelectorEventLoop._sock_connects [[]  LL ! NN4 C# !12 M  ( ( ,%%D))3g?F  ! !!!$"7"7FK MC-.   #   c " "C  # Cs97C"A0C'C"+CCC"CC""C&cL||js|j|yyr/)rrrs rrz&BaseSelectorEventLoop._sock_write_donerr*cv|jry |jtjtj}|dk7rt |d| |j dd}y#ttf$rYd}yttf$rt$r}|j|Yd}~d}yd}~wwxYw#d}wxYw)NrzConnect call failed ) r getsockoptrT SOL_SOCKETSO_ERRORrgrrar`rrrr)r)rr2rCerrrs rrz&BaseSelectorEventLoop._sock_connect_cbs 88:  //&"3"3V__ECaxc%9'#CDD NN4 C !12  C-.   #   c " "C  # Cs<AA*B4*B19B4=B1B,%B4,B11B44B8cKtj||jr|jdk7r t d|j }|j |||d{S7w)aWAccept a connection. The socket must be bound to an address and listening for connections. The return value is a pair (conn, address) where conn is a new socket object usable to send and receive data on the connection, and address is the address bound to the socket on the other end of the connection. rrN)rrrhrrr _sock_accept)r)r2rs r sock_acceptz!BaseSelectorEventLoop.sock_accepts_ %%d+ ;;4??,1>? ?  " #t$yysA'A0)A.*A0c|j} |j\}}|jd|j||fy#tt f$rc|j ||j||j||}|jtj|j||Yyttf$rt$r}|j!|Yd}~yd}~wwxYw)NFr)rOrvrVrrar`r0rWr rrrrrrrr)r)rr2rrrCrrs rr z"BaseSelectorEventLoop._sock_accepts [[] , KKMMD'   U # NND'? + !12 L  ( ( ,%%b$*;*;S$GF  ! !!!$"6"66J L-.   #   c " " #s$A A/C-;C-C((C-cK|j|j=|j}|j|j d{ |j |j |||dd{|j|r|j||j|j<S7h7A#|j|r|j||j|j<wxYww)NF)fallback) r(_sock_fd is_reading pause_reading_make_empty_waiter sock_sendfile_sock_reset_empty_waiterresume_reading)r)transpfileoffsetcountrs r_sendfile_nativez&BaseSelectorEventLoop._sendfile_natives   V__ -**,''))) 7++FLL$5:,<<  & & (%%'06D  V__ - *<  & & (%%'06D  V__ -s<A C: B6C:#B:6B87B::=C:8B::=C77C:cd|D]\}}|j|jc}\}}|tjzr1|/|jr|j |n|j ||tjzsz|}|jr|j||j |yr/) fileobjr\rr _cancelledrM _add_callbackrr)r) event_listrrrrrs r_process_eventsz%BaseSelectorEventLoop._process_eventss#IC(+ SXX %G%ffi***v/A$$''0&&v.i+++0B$$''0&&v.$r*cb|j|j|jyr/)rMrOrJ)r)r2s r _stop_servingz#BaseSelectorEventLoop._stop_servings DKKM* r*r/NNN)r)4r# __module__ __qualname____doc__rr5rSSL_HANDSHAKE_TIMEOUTSSL_SHUTDOWN_TIMEOUTr@rDrJrIr%r]rXrjrprmrwr0rWrMrrrrrrrrrrrrrrrrrrrrrrrr r rr"r$ __classcell__r"s@rrr5so 97%)$79=+ $t"+"A"A!*!?!? +&CGB " E  ,&#'tS-6-L-L,5,J,JFD#"+"A"A!*!?!? ,)`D"+"A"A!*!?!? -5^&$ * .. ' . ' ,#! *#".#"2#">,6 2.#* ," 7 /r*rceZdZdZdZdfd ZdZdZdZdZ dZ d Z d Z d Z d Zej fd ZddZdZdZdZdZxZS)_SelectorTransportiNct|||tj||jd< |j |jd<d|jvr |j|jd<||_ |j|_ d|_ |j|||_t!j"|_d|_d|_d|_|j|jj-||j.|j<y#t $rd|jd<YwxYw#tj$rd|jd<YwxYw)NrTsocknamerrFr)rrr r_extra getsocknamerg getpeernamerTerrorrrOr_protocol_connected set_protocol_server collectionsdeque_buffer _conn_lost_closing_paused_attachr()r)rr2r3r,r-r"s rrz_SelectorTransport.__init__ s8 % & 6 6t < H +&*&6&6&8DKK # T[[ ( /*.*:*:*< J'   #(  (# "((*   << # LL "*.'+ +&*DKK # + << /*. J' /s#D'!E'EE"E*)E*c|jjg}|j|jdn|jr|jd|jd|j |j |j jst|j j|j tj}|r|jdn|jdt|j j|j tj}|rd}nd}|j}|jd|d |d d jd j|S) Nclosedclosingzfd=z read=pollingz read=idlepollingidlezwrite=z<{}> )r"r#rappendr<r_looprHrr$rrrget_write_buffer_sizeformatjoin)r)inforBstaters r__repr__z_SelectorTransport.__repr__'s$''( ::  KK ! ]] KK " c$--)* :: !$***>*>*@*4::+?+?+/==):N:NPG N+ K(*4::+?+?+/==+4+@+@BG!002G KK'% 7)1= >}}SXXd^,,r*c&|jdyr/) _force_closerRs rabortz_SelectorTransport.abortCs $r*c ||_d|_yNT) _protocolr5)r)r3s rr6z_SelectorTransport.set_protocolFs!#' r*c|jSr/)rSrRs r get_protocolz_SelectorTransport.get_protocolJs ~~r*c|jSr/)r<rRs rrz_SelectorTransport.is_closingMs }}r*cB|j xr |j Sr/)rr=rRs rrz_SelectorTransport.is_readingPs??$$9T\\)99r*c|jsyd|_|jj|j|jj rt jd|yy)NTz%r pauses reading)rr=rGrMr get_debugr r!rRs rrz _SelectorTransport.pause_readingSsP   !!$--0 ::   ! LL,d 3 "r*c|js |jsyd|_|j|j|j|j j rtjd|yy)NFz%r resumes reading) r<r=rWr _read_readyrGrYr r!rRs rrz!_SelectorTransport.resume_reading[sW ==   (8(89 ::   ! LL-t 4 "r*cP|jryd|_|jj|j|jsa|xj dz c_|jj |j|jj|jdyyNTr) r<rGrMrr:r;r call_soon_call_connection_lostrRs rrJz_SelectorTransport.closecss ==   !!$--0|| OOq O JJ % %dmm 4 JJ !;!;T Br*cv|j-|d|t||jjyy)Nzunclosed transport )source)rResourceWarningrJ)r)_warns r__del__z_SelectorTransport.__del__ms5 :: ! 'x0/$ O JJ    "r*ct|tr4|jjrDt j d||dn*|jj ||||jd|j|y)Nz%r: %sTrd)rsrtrr3) rrgrGrYr r!rrSrO)r)rrss r _fatal_errorz_SelectorTransport._fatal_errorrse c7 #zz##% XtWtD JJ - -" ! NN /  #r*c|jry|jr?|jj|jj |j |j s,d|_|jj|j |xjdz c_|jj|j|yr]) r;r:clearrGrrr<rMr^r_)r)rs rrOz_SelectorTransport._force_closes ??  << LL   JJ % %dmm 4}} DM JJ % %dmm 4 1 T77=r*c |jr|jj||jj d|_d|_d|_|j }||jd|_yy#|jj d|_d|_d|_|j }||jd|_wwxYwr/)r5rSconnection_lostrrJrGr7_detach)r)rr-s rr_z(_SelectorTransport._call_connection_losts $''..s3 JJ   DJ!DNDJ\\F! # " JJ   DJ!DNDJ\\F! # "s 'A??ACcHttt|jSr/)summaprr:rRs rrHz(_SelectorTransport.get_write_buffer_sizes3sDLL)**r*cb|jsy|jj||g|yr/)rrGrWrs rrWz_SelectorTransport._add_readers*  r83d3r*)NN)zFatal error on transport)r#r&r'max_sizerrrMrPr6rUrrrrrJwarningswarnrdrfrOr_rHrWr+r,s@rr.r.skH E/8-8 (:45C%MM  > $+4r*r.ceZdZdZej j Z dfd ZfdZ dZ dZ dZ dZ d Zd Zd Zd ed dfdZdZdZdZdZfdZdZdZfdZxZS)r1TNcd|_t| |||||d|_d|_t r|j |_n|j|_tj|j|jj|jj||jj|j |j"|j$|,|jjt&j(|dyyr)_read_ready_cbrr_eof _empty_waiter _HAS_SENDMSG_write_sendmsg _write_ready _write_sendr _set_nodelayrrGr^rSconnection_maderWrr[r_set_result_unless_cancelled)r)rr2r3r4r,r-r"s rrz!_SelectorSocketTransport.__init__s# tXuf= !  $ 3 3D  $ 0 0D    , T^^;;TB T--!]]D,<,< >   JJ !E!E!' / r*ct|tjr|j|_n|j |_t ||yr/)rr BufferedProtocol_read_ready__get_bufferru_read_ready__data_receivedrr6)r)r3r"s rr6z%_SelectorSocketTransport.set_protocols< h : : ;"&">">D "&"A"AD  X&r*c$|jyr/)rurRs rr[z$_SelectorSocketTransport._read_readys r*c|jry |jjd}t|s t d |jj|}|s|jy |jj|y#t t f$rt$r}|j|dYd}~yd}~wwxYw#ttf$rYyt t f$rt$r}|j|dYd}~yd}~wwxYw#t t f$rt$r}|j|dYd}~yd}~wwxYw)Nz%get_buffer() returned an empty bufferz/Fatal error: protocol.get_buffer() call failed.$Fatal read error on socket transportz3Fatal error: protocol.buffer_updated() call failed.)r;rS get_bufferrrGrrrrfrrrar`_read_ready__on_eofbuffer_updated)r)rrrs rrz0_SelectorSocketTransport._read_ready__get_buffersC ??  ..++B/Cs8"#JKK ZZ))#.F  $ $ &  L NN ) )& 1--.      F H   !12  -.      c#I J  -.   L   J L L LsM1B C1D C%B<<CDD,DD D?#D::D?c|jry |jj|j}|s|jy |jj|y#tt f$rYyt tf$rt$r}|j|dYd}~yd}~wwxYw#t tf$rt$r}|j|dYd}~yd}~wwxYw)Nrz2Fatal error: protocol.data_received() call failed.) r;rr_rprar`rrrrfrrS data_received)r)r\rs rrz3_SelectorSocketTransport._read_ready__data_receiveds ??  ::??4==1D  $ $ &  K NN ( ( . !12  -.      c#I J  -.   K   I K K Ks5%A$B+$B(5B( B##B(+CCCcx|jjrtjd| |jj }|r&|jj|jy|jy#t tf$rt$r}|j|dYd}~yd}~wwxYw)Nz%r received EOFz1Fatal error: protocol.eof_received() call failed.) rGrYr r!rS eof_receivedrrrrfrMrrJ)r) keep_openrs rrz,_SelectorSocketTransport._read_ready__on_eof s ::   ! LL*D 1 335I  JJ % %dmm 4 JJL-.      H J  sBB9B44B9c<t|tttfs!t dt |j |jr td|j td|sy|jrH|jtjk\rtjd|xjdz c_ y|js] |j j#|}t||d}|sy|j0j3|j4|j6|jj9||j;y#t$t&f$rYmt(t*f$rt,$r}|j/|dYd}~yd}~wwxYw)N/data argument must be a bytes-like object, not z%Cannot call write() after write_eof()z(unable to write; sendfile is in progresssocket.send() raised exception.r%Fatal write error on socket transport)rbytes bytearrayrrrr#rvrGrwr;r!LOG_THRESHOLD_FOR_CONNLOST_WRITESr warningr:rrfrar`rrrrfrGrrrzrF_maybe_pause_protocol)r)r\rrs rwritez_SelectorSocketTransport.writes_$ : >?##':#6#6"9;< < 99FG G    )IJ J  ??)"M"MM@A OOq O || JJOOD)"$'+ JJ " "4==$2C2C D D! ""$!$%56  12   !!#'NO sEF(F?FFcJtj|jtSr/) itertoolsislicer:rrRs r_get_sendmsg_bufferz,_SelectorSocketTransport._get_sendmsg_bufferFs j99r*cr|jry |jj|j}|j ||j |j s|jj|j|j|jjd|jr|jdy|jr*|jjt j"yyy#t$t&f$rYyt(t*f$rt,$r}|jj|j|j j/|j1|d|j |jj3|Yd}~yYd}~yd}~wwxYwNr)r;rrr_adjust_leftover_buffer_maybe_resume_protocolr:rGrrrwrr<r_rvshutdownrTSHUT_WRrar`rrrrhrfr)r)rrs rryz'_SelectorSocketTransport._write_sendmsgIsV ??  8ZZ''(@(@(BCF  ( ( 0  ' ' )<< ))$--8%%1&&11$7==..t4YYJJ''7   !12  -.   6 JJ % %dmm 4 LL     c#J K!!-""0055.  6s:DF6F6/A8F11F6rreturnc|j}|r?|j}t|}||kr||z}n|j||dy|r>yyr/)r:popleftr appendleft)r)rbufferbb_lens rrz0_SelectorSocketTransport._adjust_leftover_bufferesO AFE%!!!FG*-r*c|jry |jj}|jj |}|t |k7r|jj ||d|j|js|jj|j|j|jjd|jr|jdy|jr*|jj!t"j$yyy#t&t(f$rYyt*t,f$rt.$r}|jj|j|jj1|j3|d|j |jj5|Yd}~yYd}~yd}~wwxYwr)r;r:rrrfrrrrGrrrwrr<r_rvrrTrrar`rrrrhrfr)r)rrrs rr{z$_SelectorSocketTransport._write_sendpss ??  8\\))+F 'ACK ''qr 3  ' ' )<< ))$--8%%1&&11$7==..t4YYJJ''7   !12  -.   6 JJ % %dmm 4 LL     c#J K!!-""0055.  6sA!D..G?GA8GGc|js |jryd|_|js*|jj t j yyrR)r<rvr:rrrTrrRs r write_eofz"_SelectorSocketTransport.write_eofs; ==DII  || JJ   /r*c|jr td|j td|sy|jj |Dcgc] }t |c}|j |jrA|jj|j|j |jyycc}w)Nz*Cannot call writelines() after write_eof()z-unable to writelines; sendfile is in progress) rvrGrwr:extendrrzrGrrr)r) list_of_datar\s r writelinesz#_SelectorSocketTransport.writeliness 99KL L    )NO O  ,G,$Z-,GH  << JJ " "4==$2C2C D  & & ( Hs CcyrRrZrRs r can_write_eofz&_SelectorSocketTransport.can_write_eofsr*c t||d|_|j%|jj t dyy#d|_|j%|jj t dwwxYw)NzConnection is closed by peer)rr_rzrwrConnectionError)r)rr"s rr_z._SelectorSocketTransport._call_connection_losts E G )# . $D !!-""00#$BCE.!%D !!-""00#$BCE.s A :Bc|j td|jj|_|js|jj d|jS)NzEmpty waiter is already set)rwrGrGrr:rrRs rrz+_SelectorSocketTransport._make_empty_waitersV    )<= =!ZZ557||    ) )$ /!!!r*cd|_yr/)rwrRs rrz,_SelectorSocketTransport._reset_empty_waiters !r*c0d|_t| yr/)rurrJrKs rrJz_SelectorSocketTransport.closes"  r*r%)r#r&r'_start_tls_compatibler _SendfileMode TRY_NATIVE_sendfile_compatiblerr6r[rrrrrryrrr{rrrr_rrrJr+r,s@rr1r1s $22==48$(/2'#LJK2*%%N:88 c d 8>0 )E""r*r1cVeZdZejZ dfd ZdZdZddZ dZ xZ S)rBcxt|||||||_d|_|jj |j j||jj |j|j|j|,|jj tj|dyyr) rr_address _buffer_sizerGr^rSr}rWrr[rr~)r)rr2r3rCr4r,r"s rrz#_SelectorDatagramTransport.__init__s tXu5  T^^;;TB T--!]]D,<,< >   JJ !E!E!' / r*c|jSr/)rrRs rrHz0_SelectorDatagramTransport.get_write_buffer_sizes   r*c|jry |jj|j\}}|jj ||y#t tf$rYyt$r%}|jj|Yd}~yd}~wttf$rt$r}|j|dYd}~yd}~wwxYw)Nz&Fatal read error on datagram transport)r;rrrprSdatagram_receivedrar`rgerror_receivedrrrrfr)r\rrs rr[z&_SelectorDatagramTransport._read_readys ??  9,,T]];JD$ NN , ,T4 8 !12   / NN ) )# . .-.   M   c#K L L Ms)(AC%C-B  C(B??CcZt|tttfs!t dt |j |sy|jr4|d|jfvrtd|j|j}|jrT|jrH|jtjk\rtjd|xjdz c_ y|jsI |jdr|j j#|y|j j%||y|jjAt||f|xjBtE|z c_!|jGy#t&t(f$r3|j*j-|j.|j0Yt2$r%}|j4j7|Yd}~yd}~wt8t:f$rt<$r}|j?|dYd}~yd}~wwxYw)Nrz!Invalid address: must be None or rrrr'Fatal write error on datagram transport)$rrrrrrr#rrr;rrr rr:r1rrfrrar`rGrr _sendto_readyrgrSrrrrrfrFrrrrs rrz!_SelectorDatagramTransport.sendtos$ : >?##':#6#6"9;< <  ==D$--00 7 GII==D ??t}})"M"MM@A OOq O || ;;z*JJOOD)JJ%%dD1 U4[$/0 SY& ""$$%56 J &&t}}d6H6HI --c2 12   !!BD s0-*F F ?H* H*G33H*H%%H*cX|jr|jj\}}|xjt|zc_ |jdr|j j |n|j j|||jr|j%|jsD|j&j)|j*|j,r|j/dyyy#ttf$r>|jj||f|xjt|z c_Yt$r%}|jj|Yd}~yd}~wttf$rt $r}|j#|dYd}~yd}~wwxYw)Nrrr)r:rrrr1rrfrrar`rrgrSrrrrrfrrGrrr<r_rs rrz(_SelectorDatagramTransport._sendto_readysQll--/JD$   T *  ;;z*JJOOD)JJ%%dD1ll, ##%|| JJ % %dmm 4}}**40$%56  ''t 5!!SY.! --c2 12   !!BD s, AC>>A F) F)E22F) F$$F)r%r/) r#r&r'r8r9_buffer_factoryrrHr[rrr+r,s@rrBrBs.!''O59$( /!9 *%X1r*rB)&r(__all__r8rzrrosrrTrqr&ssl ImportErrorrrrrr r r r logr hasattrrxsysconfrrgr BaseEventLoopr_FlowControlMixin Transportr.r1DatagramTransportrBrZr*rrs #   v}}i0 RZZ - (I K55I X_455#--_4DZ1Zzl1!3Z5Q5Ql1Y% C$  s#C&:C3&C0/C03C=<C=__pycache__/__main__.cpython-312.opt-2.pyc000064400000012521152527367570014163 0ustar00 {|j jddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl m Z GddejZGddejZedk(rej$d ej&Zej*ed eiZd D]Zeeee<eeeZdad a ddlZeZd e_ejA ejCyy#e$rY9wxYw#e"$r3t4r*t4jGst4jId aYVwxYw)N)futuresc$eZdZfdZdZxZS)AsyncIOInteractiveConsolect|||jjxjt j zc_||_tj|_ y)N) super__init__compilecompilerflagsastPyCF_ALLOW_TOP_LEVEL_AWAITloop contextvars copy_contextcontext)selflocalsr __class__s )/usr/lib64/python3.12/asyncio/__main__.pyr z"AsyncIOInteractiveConsole.__init__sH   ##s'E'EE# "//1 c8tjjfd}tj |j  j S#t$rt$r,trjdYyjYywxYw)Nc&dadatjj} |}tj|sj|y jj|jatj ty#t $rt $r}daj|Yd}~yd}~wt$r}j|Yd}~yd}~wwxYw#t$r}j|Yd}~yd}~wwxYw)NFTr) repl_futurerepl_future_interruptedtypes FunctionTyper SystemExitKeyboardInterrupt set_exception BaseExceptioninspect iscoroutine set_resultr create_taskrr _chain_future)funccoroexexccodefuturers rcallbackz3AsyncIOInteractiveConsole.runcode..callbacksK&+ #%%dDKK8D v&&t,!!$' *"ii33D$,,3O %%k6:! $ *.'$$R(  $$R( ! *$$S)) *s<BAC,C)*C C)C$$C), D5D  Drz KeyboardInterrupt ) concurrentrFuturercall_soon_threadsaferresultrr"rwrite showtraceback)rr,r.r-s`` @rruncodez!AsyncIOInteractiveConsole.runcodes|##**, *< !!(DLL!A %==? "   %& 23""$  %s A)BBB)__name__ __module__ __qualname__r r5 __classcell__)rs@rrrs 2 +%rrceZdZdZy) REPLThreadc  dtjdtjdttddd}tj |dt jd d t tjtjy#t jd d t tjtjwxYw) Nz asyncio REPL z on zy Use "await" directly instead of "asyncio.run()". Type "help", "copyright", "credits" or "license" for more information. ps1z>>> zimport asynciozexiting asyncio REPL...)bannerexitmsgignorez ^coroutine .* was never awaited$)messagecategory) sysversionplatformgetattrconsoleinteractwarningsfilterwarningsRuntimeWarningrr1stop)rr>s rrunzREPLThread.runGs 1 }D?*3v./~ ?    1  3  # #;' )  % %dii 0  # #;' )  % %dii 0s ABACN)r6r7r8rMrrr;r;Es1rr;__main__zcpython.run_stdinasyncio>__file__r6__spec__ __loader__ __package__ __builtins__FT)%r rPr,concurrent.futuresr/rr#rC threadingrrIrInteractiveConsolerThreadr;r6auditnew_event_looprset_event_loop repl_localskeyrrGrrreadline ImportError repl_threaddaemonstart run_foreverr donecancelrNrrrhsP    3% 7 73%l1!!10 z CII!" !7 ! ! #DG4 g&K,"8C= C, ( T:GK# ,KK       G&    ! ;#3#3#5""$*.'   s$9C/C:/C76C7:5D21D2__pycache__/base_events.cpython-312.opt-2.pyc000064400000226663152527367570014757 0ustar00 {|j24 ddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl Z ddl Z ddlZddlZddlZ ddlZddlmZddlmZddlmZddlmZddlmZddlmZdd lmZdd lmZdd lmZdd lmZdd lmZddlmZddl m!Z!dZ"dZ#dZ$e%edZ&dZ'dZ(dZ)dZ*d%dZ+d&dZ,dZ-e%edrdZ.ndZ.dZ/Gdd ej`Z1Gd!d"ejdZ3Gd#d$ejhZ5y#e$rdZYwxYw)'N) constants) coroutines)events) exceptions)futures) protocols)sslproto) staggered)tasks)timeouts) transports)trsock)logger) BaseEventLoopServerdg?AF_INET6iQc|j}tt|ddtjrt |j St|S)N__self__) _callback isinstancegetattrr Taskreprrstr)handlecbs ,/usr/lib64/python3.12/asyncio/base_events.py_format_handler Gs=   B'"j$/<BKK  6{ch|tjk(ry|tjk(ryt|S)Nzz) subprocessPIPESTDOUTr)fds r _format_piper'Ps+ Z__ z  Bxr!cttds td |jtjtj dy#t $r tdwxYw)N SO_REUSEPORTz)reuse_port not supported by socket modulerzTreuse_port not supported by socket module, SO_REUSEPORT defined but not implemented.)hasattrsocket ValueError setsockopt SOL_SOCKETr)OSErrorsocks r_set_reuseportr2Ys` 6> *DEE J OOF--v/B/BA F JIJ J Js /A A"c Pttdsy|dtjtjhvs|y|tjk(rtj}n%|tj k(rtj}ny|d}n,>?? L v!!!"" "" """ | D% TS[ D# 42: t9D!!!~~  JJv 'h${{6" d{    R &R6??24T47,KKK4T4L88 ;:&  2   s*7 F;9F7FFF F%$F%c tj}|D]$}|d}||vrg||<||j|&t|j }g}|dkDr%|j |dd|dz |dd|dz =|j dt jjt j|D|S)Nrrc3$K|]}|| ywN).0as r z(_interleave_addrinfos..s! a ]  s) collections OrderedDictrBlistvaluesextend itertoolschain from_iterable zip_longest) addrinfosfirst_address_family_countaddrinfos_by_familyaddrrFaddrinfos_lists reordereds r_interleave_addrinfosrds7%113a , ,*,  'F#**40  .5578OI!A%+,K-G!-KLM A > :Q >> ? ??00  ! !? 3  r!c|js'|j}t|ttfryt j |jyrP) cancelled exceptionr SystemExitKeyboardInterruptr _get_loopstop)futexcs r_run_until_complete_cbrnsB ==?mmo cJ(9: ;  c!r! TCP_NODELAYc4|jtjtjhvrl|jtj k(rN|j tjk(r0|jtjtjdyyyyNr) rFr+r@rrGr:rHr8r-ror0s r _set_nodelayrrsj KKFNNFOO< < V/// f000 OOF..0B0BA F10 =r!cyrPrQr0s rrrrrs r!c\t&t|tjr tdyy)Nz"Socket cannot be of type SSLSocket)sslr SSLSocketr>r0s r_check_ssl_socketrws' :dCMM:<==;r!cBeZdZdZdZdZdZdZdZdZ dZ d Z y ) _SendfileFallbackProtocolct|tjs td||_|j |_|j|_|j|_ |j|j||jr*|jjj|_yd|_y)Nz.transport should be _FlowControlMixin instance)rr_FlowControlMixinr> _transport get_protocol_proto is_reading_should_resume_reading_protocol_paused_should_resume_writing pause_reading set_protocol_loop create_future_write_ready_fut)selftransps r__init__z"_SendfileFallbackProtocol.__init__s&*">">?LM M ))+ &,&7&7&9#&,&=&=#D!  & &$(OO$9$9$G$G$ID !$(D !r!cK|jjr td|j}|y|d{y7w)NzConnection closed by peer)r| is_closingConnectionErrorr)rrls rdrainz_SendfileFallbackProtocol.drains< ?? % % '!"=> >## ;  s:AAActd)Nz?Invalid state: connection should have been established already. RuntimeError)r transports rconnection_madez)_SendfileFallbackProtocol.connection_madesNO Or!c|jB|%|jjtdn|jj||jj |y)NzConnection is closed by peer)r set_exceptionrr~connection_lost)rrms rrz)_SendfileFallbackProtocol.connection_losts[  ,{%%33#$BCE%%33C8 ##C(r!cp|jy|jjj|_yrP)rr|rrrs r pause_writingz'_SendfileFallbackProtocol.pause_writings,  ,  $ 5 5 C C Er!cb|jy|jjdd|_y)NF)r set_resultrs rresume_writingz(_SendfileFallbackProtocol.resume_writings-  (  ((/ $r!ctdNz'Invalid state: reading should be pausedr)rdatas r data_receivedz'_SendfileFallbackProtocol.data_receivedDEEr!ctdrrrs r eof_receivedz&_SendfileFallbackProtocol.eof_receivedrr!c<K|jj|j|jr|jj |j |j j |jr|jjyywrP) r|rr~rresume_readingrcancelrrrs rrestorez!_SendfileFallbackProtocol.restoress $$T[[1  & & OO * * ,  ,  ! ! ( ( *  & & KK & & ( 'sBBN) __name__ __module__ __qualname__rrrrrrrrrrQr!rryrys3 )O )F % FF )r!rycheZdZ ddZdZdZdZdZdZdZ d Z e d Z d Z d Zd ZdZy)rNc||_||_d|_g|_||_||_||_||_||_d|_ d|_ y)NrF) r_sockets _active_count_waiters_protocol_factory_backlog _ssl_context_ssl_handshake_timeout_ssl_shutdown_timeout_serving_serving_forever_fut)rloopsocketsprotocol_factory ssl_contextbacklogssl_handshake_timeoutssl_shutdown_timeouts rrzServer.__init__sU   !1 '&;#%9" $(!r!cPd|jjd|jdS)N) __class__rrrs r__repr__zServer.__repr__#s'4>>**+9T\\4DAFFr!c.|xjdz c_yrq)rrs r_attachzServer._attach&s ar!c|xjdzc_|jdk(r|j|jyyy)Nrr)rr_wakeuprs r_detachzServer._detach*s; a    "t}}'< LLN(= "r!c||j}d|_|D]$}|jr|jd&yrP)rdoner)rwaiterswaiters rrzServer._wakeup0s3-- F;;=!!$'r!c *|jryd|_|jD]p}|j|j|jj |j ||j||j|j|jryNT) rrlistenrr_start_servingrrrr)rr1s rrzServer._start_serving7sp ==  MMD KK & JJ % %&&d.?.?dmmT%@%@** ,"r!c|jSrP)rrs rget_loopzServer.get_loopBs zzr!c|jSrP)rrs r is_servingzServer.is_servingEs }}r!cT|jytd|jDS)NrQc3FK|]}tj|ywrP)rTransportSocket)rRss rrTz!Server.sockets..LsF 1V++A. s!)rtuplers rrzServer.socketsHs$ == F FFFr!cP|j}|yd|_|D]}|jj|d|_|j;|jj s!|jj d|_|jdk(r|jyy)NFr) rr _stop_servingrrrrrr)rrr1s rclosez Server.closeNs-- ?  D JJ $ $T *  % % 1--224  % % , , .(,D %    " LLN #r!cjK|jtjdd{y7w)Nr)rr sleeprs r start_servingzServer.start_servingas% kk!ns )313cK|jtd|d|jtd|d|j|jj |_ |jd{ d|_y7 #t j$r1 |j|jd{7#xYwwxYw#d|_wxYww)Nzserver z, is already being awaited on serve_forever()z is closed) rrrrrrrCancelledErrorr wait_closedrs r serve_foreverzServer.serve_forevergs  $ $ 0$!MNP P ==  ;< < $(JJ$<$<$>! -++ + +)-D % ,((   &&(((  )-D %s`A&C)B8B9B>CBC #C?CCC CC  C CCcK |jy|jj}|jj||d{y7wrP)rrrrB)rrs rrzServer.wait_closed|sE ( == ))+ V$ sA A A ArP)rrrrrrrrrrrpropertyrrrrrrQr!rrrs[>B )G  ( ,GG & -*r!rceZdZdZdZdZddddZdZdZd\ddd d Z d\d dddddd d dZ d]dZ d^dZ d^dZ d\dZdZdZdZdZdZdZdZd\dZdZdZdZdZdZd Zd!Zej>fd"Z d#Z!d$Z"dd%d&Z#dd%d'Z$dd%d(Z%d)Z&d*Z'd+Z(dd%d,Z)d-Z*d.Z+d/Z,d0d0d0d0d1d2Z-d_d3Z.d`d d4d5Z/d6Z0d7Z1d8Z2d\d9Z3 d^dd0d0d0dddddddd d: d;Z4 dad<Z5d`d d4d=Z6d>Z7d?Z8d dddd@dAZ9 d^d0d0d0ddddBdCZ:d0e;jxd0d0d1dDZ=dEZ> d^e;j~e;jddFdddddd dG dHZAddddIdJZBdKZCdLZDdMZEeFjeFjeFjd d d0ddddN dOZHeFjeFjeFjd d d0ddddN dPZIdQZJdRZKdSZLdTZMdUZNdVZOdWZPdXZQdYZRdZZSd[ZTy)brcd|_d|_d|_tj|_g|_d|_d|_d|_ tjdj|_ d|_|jt!j"d|_d|_d|_d|_d|_t/j0|_d|_d|_y)NrF monotonicg?)_timer_cancelled_count_closed _stoppingrUdeque_ready _scheduled_default_executor _internal_fds _thread_idtimeget_clock_info resolution_clock_resolution_exception_handler set_debugr_is_debug_modeslow_callback_duration_current_handle _task_factory"_coroutine_origin_tracking_enabled&_coroutine_origin_tracking_saved_depthweakrefWeakSet _asyncgens_asyncgens_shutdown_called_executor_shutdown_calledrs rrzBaseEventLoop.__init__s&'# !'') !%!%!4!4[!A!L!L"& z0023'*##!27/6:3"//+*/').&r!c d|jjd|jd|jd|j d S)Nrz running=z closed=z debug=r)rr is_running is_closed get_debugrs rrzBaseEventLoop.__repr__sP''( $//2C1DEnn&'wt~~/?.@ C r!c0 tj|S)Nr)rFuturers rrzBaseEventLoop.create_futures:~~4((r!N)namecontextc4 |j|j3tj||||}|jrM|jd=n?||j||}n|j|||}tj || |~S#~wxYw)N)rr r r ) _check_closedrr r_source_traceback_set_task_name)rcoror r tasks r create_taskzBaseEventLoop.create_tasks      %::dD'JD%%**2.))$5))$g)F  t , s BBcD |t|s td||_y)Nz'task factory must be a callable or None)callabler>r)rfactorys rset_task_factoryzBaseEventLoop.set_task_factorys*   x'8EF F$r!c |jSrP)rrs rget_task_factoryzBaseEventLoop.get_task_factorysJ!!!r!)extraserverc trPNotImplementedError)rr1protocolrrrs r_make_socket_transportz$BaseEventLoop._make_socket_transports &!!r!FT) server_sideserver_hostnamerrrrcall_connection_madec trPr) rrawsockr sslcontextrr!r"rrrrr#s r_make_ssl_transportz!BaseEventLoop._make_ssl_transports  $!!r!c trPr)rr1raddressrrs r_make_datagram_transportz&BaseEventLoop._make_datagram_transports (!!r!c trPrrpiperrrs r_make_read_pipe_transportz'BaseEventLoop._make_read_pipe_transports )!!r!c trPrr,s r_make_write_pipe_transportz(BaseEventLoop._make_write_pipe_transports *!!r!c K twrPr) rrargsshellstdinstdoutstderrbufsizerkwargss r_make_subprocess_transportz(BaseEventLoop._make_subprocess_transport s +!!s c trPrrs r_write_to_selfzBaseEventLoop._write_to_selfs "!r!c trPr)r event_lists r_process_eventszBaseEventLoop._process_eventss &!!r!c2|jr tdy)NzEvent loop is closed)rrrs rrzBaseEventLoop._check_closeds <<56 6 r!c2|jr tdy)Nz!Executor shutdown has been called)rrrs r_check_default_executorz%BaseEventLoop._check_default_executor#s  ) )BC C *r!c|jj||js+|j|j|j yyrP)rdiscardrcall_soon_threadsaferacloseragens r_asyncgen_finalizer_hookz&BaseEventLoop._asyncgen_finalizer_hook's? %~~  % %d&6&6 F r!c|jr tjd|dt||jj |y)Nzasynchronous generator z3 was scheduled after loop.shutdown_asyncgens() callsource)rwarningswarnResourceWarningraddrFs r_asyncgen_firstiter_hookz&BaseEventLoop._asyncgen_firstiter_hook,sA  * * MM)$212 . D!r!cK d|_t|jsyt|j}|jj t j |Dcgc]}|jc}ddid{}t||D].\}}t|ts|jd|||d0ycc}w7Gw)NTreturn_exceptionsz;an error occurred during closing of asynchronous generator )messagergasyncgen) rlenrrWclearr gatherrEzipr Exceptioncall_exception_handler)r closing_agensagresultsresultrGs rshutdown_asyncgensz BaseEventLoop.shutdown_asyncgens5s:*.'4??# T__-   $1 2MbbiikM 2$"$$ 7LFD&),++"99= B!' $ -83$s$A!C#C: CC &C,!CcK d|_|jy|j}tj|j |f}|j  tj|4d{|d{dddd{|jy7/7'7#1d{7swY)xYw#t$r?tjd|dtd|jjdYywxYww) NT)targetr2z:The executor did not finishing joining its threads within z seconds.) stacklevelFwait)rrr threadingThread _do_shutdownstartr timeoutjoin TimeoutErrorrLrMRuntimeWarningshutdown)rrjfuturethreads rshutdown_default_executorz'BaseEventLoop.shutdown_default_executorNs *.&  ! ! ) ##%!!):):&K  ''00 10 KKM11000 8 MM007y C(Q 8  " " + + + 7  8sAD B?4B$5B?8B*>B&?B* B?B(B?D $B?&B*(B?*B<0B3 1B<8B??ADD DD cZ |jjd|js"|jtj |dyy#t $rP}|js6|js!|j|j|Yd}~yYd}~yYd}~yd}~wwxYw)NTrd) rrnrrDr_set_result_unless_cancelledrYrfr)rroexs rrhzBaseEventLoop._do_shutdownfs D  " " + + + 6>>#))'*N*N*0$8$ D>>#F,<,<,>))&*>*>CC-?# DsA A B* ?? CD D  # # % 1IK K 2r!c |j|j|j|jt j } t j|_t j|j|jtj| |j|jrn d|_d|_tjd|jdt j|y#d|_d|_tjd|jdt j|wxYw)N) firstiter finalizerF)rrw_set_coroutine_origin_tracking_debugsysget_asyncgen_hooksrf get_identrset_asyncgen_hooksrPrHr_set_running_loop _run_oncer)rold_agen_hookss r run_foreverzBaseEventLoop.run_foreverws)   ++DKK8//1 4'113DO  " "T-J-J-1-J-J L  $ $T * >>"DN"DO  $ $T *  / / 6  " "N 3 #DN"DO  $ $T *  / / 6  " "N 3sA8DAEc" |j|jtj| }t j ||}|rd|_|jt |j |jt|js td|jS#|r0|jr |js|jxYw#|jtwxYw)NrFz+Event loop stopped before Future completed.)rrwrisfuturer ensure_future_log_destroy_pendingadd_done_callbackrnrrrfrgremove_done_callbackrr^)rronew_tasks rrun_until_completez BaseEventLoop.run_until_completes   ''//$$V$7 +0F '  !78 @      ' '(> ?{{}LM M}} FKKM&2B2B2D  "   ' '(> ?s.B??5C44C77Dc d|_yr)rrs rrkzBaseEventLoop.stops r!cn |jr td|jry|jrt j d|d|_|j j|jjd|_ |j}|d|_ |jdyy)Nz!Cannot close a running event loopzClose %rTFrd) rrrr|rdebugrrVrrrrnrexecutors rrzBaseEventLoop.closes  ?? BC C <<  ;; LLT *   )-&))  %)D "   5  ) r!c |jSrP)rrs rrzBaseEventLoop.is_closeds8||r!c|js4|d|t||js|jyyy)Nzunclosed event loop rJ)rrNrr)r_warns r__del__zBaseEventLoop.__del__s=~~ (1?4 P??$ % r!c |jduSrP)rrs rrzBaseEventLoop.is_runnings8t+,r!c, tjSrP)rrrs rrzBaseEventLoop.times ~~r!r c | td|j|j|z|g|d|i}|jr |jd=|S)Nzdelay must not be Noner r )r>call_atrr)rdelaycallbackr r2timers r call_laterzBaseEventLoop.call_latersd  =45 5 TYY[50(.T.%,.  " "''+ r!cP | td|j|jr"|j|j |dt j |||||}|jr |jd=tj|j|d|_ |S)Nzwhen cannot be Nonerr T) r>rr| _check_thread_check_callbackr TimerHandlerheapqheappushr)rwhenrr r2rs rrzBaseEventLoop.call_ats  <12 2  ;;     9 5""44wG  " "''+ t. r!c |j|jr"|j|j|d|j |||}|j r |j d=|S)N call_soonr )rr|rr _call_soonrrrr r2rs rrzBaseEventLoop.call_soonsf   ;;     ; 749  # #((, r!ctj|stj|rtd|dt |std|d|y)Nzcoroutines cannot be used with z()z"a callable object was expected by z(), got )r iscoroutineiscoroutinefunctionr>r)rrmethods rrzBaseEventLoop._check_callback(sg  " "8 ,..x81&<> >!4VH=l$% %"r!ctj||||}|jr |jd=|jj ||S)Nr )rHandlerrrB)rrr2r rs rrzBaseEventLoop._call_soon2sDxtW=  # #((, 6" r!c| |jytj}||jk7r tdy)NzMNon-thread-safe operation invoked on an event loop other than the current one)rrfrr)r thread_ids rrzBaseEventLoop._check_thread9sG  ?? " '')  ''( ( (r!c |j|jr|j|d|j|||}|jr |jd=|j |S)NrDr )rr|rrrr;rs rrDz"BaseEventLoop.call_soon_threadsafeJsc0  ;;  +A B49  # #((,  r!c<|j|jr|j|d|E|j}|j |'t j jd}||_t j|j|g||S)Nrun_in_executorasyncio)thread_name_prefixr) rr|rrrA concurrentrThreadPoolExecutor wrap_futuresubmit)rrfuncr2s rrzBaseEventLoop.run_in_executorUs  ;;  '8 9  --H  ( ( *%--@@'0A*2&"" HOOD (4 (t5 5r!cpt|tjjs t d||_y)Nz,executor must be ThreadPoolExecutor instance)rrrrr>rrs rset_default_executorz"BaseEventLoop.set_default_executores,(J$6$6$I$IJJK K!)r!c"|d|g}|r|jd||r|jd||r|jd||r|jd|dj|}tjd||j }t j ||||||} |j |z } d|d | d zd d | }| |jk\rtj|| Stj|| S) N:zfamily=ztype=zproto=zflags=, zGet address info %szGetting address info z took g@@z.3fzms: ) rBrkrrrr+ getaddrinforinfo) rrDrErFrGrHflagsmsgt0addrinfodts r_getaddrinfo_debugz BaseEventLoop._getaddrinfo_debugjsq!"  JJ + ,  JJth' (  JJy) *  JJy) *iin *C0 YY[%%dD&$uM YY[2 %cU&c#d8,O ,, , KK  LL r!rrFrGrHrc K|jr |j}ntj}|j d|||||||d{S7wrP)r|rr+rr)rrDrErFrGrHr getaddr_funcs rrzBaseEventLoop.getaddrinfosU ;;22L!--L)) ,dFD%HH HHsAAA AcbK|jdtj||d{S7wrP)rr+ getnameinfo)rsockaddrrs rrzBaseEventLoop.getnameinfos2)) &$$h77 77s &/-/)fallbackcZK|jr|jdk7r tdt||j |||| |j ||||d{S7#t j$r }|sYd}~nd}~wwxYw|j||||d{7Sw)Nrzthe socket must be non-blocking) r| gettimeoutr,rw_check_sendfile_params_sock_sendfile_nativerSendfileNotAvailableError_sock_sendfile_fallback)rr1fileoffsetcountrrms r sock_sendfilezBaseEventLoop.sock_sendfiles ;;4??,1>? ?$ ##D$> 33D$4:ECC CC33  11$28%AAA AsNA B+ A+$A)%A+(B+)A++B >BB+B  B+%B(&B+cBKtjd|d|dw)Nz-syscall sendfile is not available for socket z and file z combinationrrrr1rrrs rrz#BaseEventLoop._sock_sendfile_natives422;D8Dx| -. .sc8K|r|j||rt|tjntj}t |}d} |rt||z |}|dkrnYt |d|}|j d|j|d{} | sn#|j||d| d{|| z }p||dkDr"t|dr|j||zSSS7S75#|dkDr"t|dr|j||zwwwxYww)Nrseek) rminr!SENDFILE_FALLBACK_READBUFFER_SIZE bytearray memoryviewrreadinto sock_sendallr*) rr1rrr blocksizebuf total_sentviewreads rrz%BaseEventLoop._sock_sendfile_fallbacks1  IIf  yBB C#EE  "  / #EJ$6 BI A~!#z 2!11$ tLL''d5Dk:::d" A~'$"7 &:-.#8~M;A~'$"7 &:-.#8~sCA DAC.C*C.6C,7 C.(D*C.,C..)DDcdt|ddvr td|jtjk(s td|It |t stdj||dkrtdj|t |t stdj||dkrtdj|y)Nbmodez$file should be opened in binary modez+only SOCK_STREAM type sockets are supportedz+count must be a positive integer (got {!r})rz0offset must be a non-negative integer (got {!r})) rr,rGr+r:rr=r>formatrs rrz$BaseEventLoop._check_sendfile_paramss gdFC0 0CD DyyF...JK K  eS)AHHOQQz AHHOQQ&#&BII  A:BII  r!cK g}|j||\}}}}} d} tj|||} | jd|G|D]!\} }}}} | |k7r | j| n"|r|jt d|d|j| | d{| dx}}S#t$rP} d| dt | j }t | j|} |j| Yd} ~ d} ~ wwxYw7f#t$r)} |j| | | jd} ~ w| | jxYw#dx}}wxYww)NrFrGrHF*error while attempting to bind on address : z&no matching local address with family=z found) rBr+ setblockingbindr/rlowererrnopop sock_connectr)rr addr_infolocal_addr_infos my_exceptionsrFtype_rH_r)r1lfamilyladdrrmrs r _connect_sockzBaseEventLoop._connect_socks2  -(+4(ua# .==U%HD   U #+/?+GQ1e&(  2 %( 0@%+//11%(OyPV&WXX##D'2 2 2*. -J1#2'',ir#c(..2B1CE&cii5%,,S11 2 3    %   )- -Jsk E$AD D DD E$EEEE!!E$) rurFrHrr1 local_addrr"rrhappy_eyeballs_delay interleave all_errorsc DK | |s td| |r|s td|} | |s td| |s td| t|| |d}||| tdj||f|tj||d{}|s t d| :j| |tj||d{s t dd|r t ||}g| %|D]} j|d{}n0n.tjfd |D| d{d }|ʉDcgc] }|D]}| c}} |r td tdk(rd td tfd Drd t djdjdD| td|j tjk7rtd|j#|||| | | d{\}}j$r+|j'd}t)j*d|||||||fS777f#t $rYwxYw7Jcc}}w#dwxYw7kw)Nz+server_hostname is only meaningful with sslz:You must set server_hostname when using ssl without a host1ssl_handshake_timeout is only meaningful with ssl0ssl_shutdown_timeout is only meaningful with sslr8host/port and sock can not be specified at the same timerFrGrHrr!getaddrinfo() returned empty listc30K|] }|ffd yw)c*j|SrP)r)rr laddr_infosrs rz;BaseEventLoop.create_connection...]s$2D2D&+3r!NrQ)rRrrr rs rrTz2BaseEventLoop.create_connection..Zs' ).H)1).srrzcreate_connection failedc3:K|]}t|k(ywrPr)rRrmmodels rrTz2BaseEventLoop.create_connection..psGJSs3x50JszMultiple exceptions: {}rc32K|]}t|ywrPr)rRrms rrTz2BaseEventLoop.create_connection..us%E*3c#h*sz5host and port was not specified and no sock specified"A Stream Socket was expected, got )rrr+z%r connected to %s:%r: (%r, %r))r,rw_ensure_resolvedr+r:r/rdrr staggered_raceExceptionGrouprUrallrrkrG_create_connection_transportr|get_extra_inforr)rrrDrErurFrHrr1rr"rrrrrinfosrsubrmrrrr rs` @@@rcreate_connectionzBaseEventLoop.create_connectionsv   &sJK K  "s "ABB"O ,SCE E +CBD D   d #  + 0BJ  t/ NPP//t V''uE0NNEABB%$($9$9v++5d%:%,, #!"EFF" -eZ@J#+ %H!%)%7%7&+&? ? !&(66 ). )   |-7GZc3Cc3cZG &!,-GTT:!+(m+!$JqM 2GJGG",Q-/&&?&F&F II%E*%EE'GHH | KMMyyF...!8ACC%)$E$E "C"7!5%F%77 8 ;;++H5D LL:tT9h @(""mN," ?#! ! H "&J 7sBJ I5;J I8*J ?I>I;I>*J JJ J#J (A8J AJ 2J3AJ 8J ;I>> J J  J  J J JJ c .K|jd|}|j} |r.t|trdn|} |j ||| | ||||} n|j ||| } | d{| |fS7#| j xYww)NFr!r"rr)rrrboolr'r r) rr1rrur"r!rrrrr&rs rrz*BaseEventLoop._create_connection_transports #%##% !+C!6CJ00h F'&;%9 1;I 33D(FKI LL (""   OO  s0A,B/A?4A=5A?9B=A??BBcK |jr tdt|dtjj }|tjj urtd||tjj ur |j||||d{S|std||j||||d{S70#tj$r }|sYd}~Id}~wwxYw7)w)NzTransport is closing_sendfile_compatiblez(sendfile is not supported for transport zHfallback is disabled and native sendfile is not supported for transport ) rrrr _SendfileMode UNSUPPORTED TRY_NATIVE_sendfile_nativerr_sendfile_fallback)rrrrrrrrms rsendfilezBaseEventLoop.sendfiles ,    !56 6y"8 ..::< 9**66 6:9-HJ J 9**55 5 !229d395BBB ++4-9: :,,Y-3U<< <B77   rrr SSLProtocolrrrrr BaseExceptionrr_app_transport) rrrr&r!r"rrr ssl_protocol conmade_cb resume_cbs r start_tlszBaseEventLoop.start_tlssB  ;CD D*cnn5!n&' 'y"95AYM)IJL L##%++ (J "7!5!& (  !|,^^L$@$@)L NN9#;#;<  LL***   OO            s0CD6 C8%C6&C8* D66C88;D33D6)rFrHr reuse_portallow_broadcastr1c FK | | jtjk(rtd| |s |s |s|s|s|s|rGt |||||||} dj d| j D} td| d| jdd} nb|s|s|dk(r td ||fd ff} nttd r|tjk(r||fD] }|t|trtd |rO|dd vrH tjtj|j rtj"|||f||fff} ni}d|fd|ffD]\}}| t|t,rt/|dk(s td|j1||tj2|||d{}|s t'd|D]\}}}}}||f}||vrddg||<||||<!|j Dcgc]\}}|r|d |r|d||f} }}| s tdg}| D]\\}}\}}d} d} tj|tj2|} |r t5| |r/| j7tj8tj:d| jd|r| j=||r|s|j?| |d{|} n|d|}|jE}|jG| || |}|jHr4|rt)jJd||||nt)jLd||| |d{||fS#t$$rY0t&$r"}t)j*d||Yd}~Ud}~wwxYw7cc}}w7#t&$r/}| | jA|jB|Yd}~d}~w| | jAxYw7#|jAxYww)Nz$A datagram socket was expected, got )r remote_addrrFrHrr3r4rc36K|]\}}|s |d|yw)=NrQ)rRkvs rrTz9BaseEventLoop.create_datagram_endpoint..=s!$NLDAqAs!A3ZLs  zKsocket modifier keyword arguments can not be used when sock is specified. ()Frzunexpected address familyNNAF_UNIXzstring is expected)rz2Unable to check or remove stale UNIX socket %r: %rrrbz2-tuple is expectedrrzcan not get address informationrz@Datagram endpoint local_addr=%r remote_addr=%r created: (%r, %r)z2Datagram endpoint remote_addr=%r created: (%r, %r))'rGr+r:r,dictrkitemsrr*r=rrr>statS_ISSOCKosst_moderemoveFileNotFoundErrorr/rerrorrrUrr;r2r-r. SO_BROADCASTrrrrBrr*r|rr) rrrr6rFrHrr3r4r1optsproblemsr_addraddr_pairs_inforaerr addr_infosidxrfamrpror)key addr_pairr local_addressremote_addressrmrrrs rcreate_datagram_endpointz&BaseEventLoop.create_datagram_endpoint+s *  yyF... :4(CEEkeu/z{#)e'1,;= 99$NDJJL$NN 008z<==   U #F+Q;$%@AA%+UO\#B"D+&..0H'5D' 40E'(<==6*Q-{"B 6==)<)D)DEIIj1&,UO%/$=$?#B #$j/A{3C!DIC' *4 7CIN"+,A"BB&*&;&; f6G6G"'u4'<'A!A %")*M"NN7<3CCG#&*C"*437, 33:JsOC0 8="E&r,rwrCr r}platformrrUabcIterablerYr rWsetrZr[r\r+rGr|rwarningrBr-r. SO_REUSEADDRr@rr2rAr*r` IPV6_V6ONLYrr/rr EADDRNOTAVAILrrrGr:rrrrr)rrrDrErFrr1rrurZr3rrrrhostsfsr completedresrLsocktyperH canonnamesarMrrrs r create_serverzBaseEventLoop.create_servers  c4 HI I ,CE E + BD D   d #  t/ NPP$ "7 2 Os||x7O GrzT3' {'?'?@$%#d11$V8=2?# % ,,++E 55e<=EI4 % C9<6B%B!%}}R5ANN4($"--v/B/BDJ"bV^^V__,M&M&t,"&//1#FN;(;(;(.(:(:(,. @ " ;!V!:?%@%$d1g%%@#CDD!  ' !(| !LMMyyF... #EdX!NOOfGD   U #g'7W&;,.   ! ! #++a. ;; KK 0 c%,"<<!;;"NN,G+-xO! !4# @#%c#hnn&6 899(;(;;#KKM JJL#{{ &s 3$%cii54? @&A! ' !(!( !sC QL(+QL-.Q2 P L0C P !M02P P P B(Q?P?.Q09M-)P ,M--P 0 P9A=P6P <PPP P<<Q)rurrc rK|jtjk7rtd|| |s td| |s td| t ||j |||dd||d{\}}|j r)|jd}tjd|||||fS7@w) Nrrrr5T)r!rrr+z%r handled: (%r, %r)) rGr+r:r,rwrr|rrr)rrr1rurrrrs rconnect_accepted_socketz%BaseEventLoop.connect_accepted_socketRs 99** *A$JK K ,SCE E +CBD D   d #$($E$E "C"7!5%F%77 8 ;;++H5D LL/y( K(""7sA2B74B55AB7cK|}|j}|j|||} |d{|jr&t j d|j ||||fS7:#|jxYww)Nz Read pipe %r connected: (%r, %r))rr.rr|rrfilenorrr-rrrs rconnect_read_pipezBaseEventLoop.connect_read_pipeps#%##%2246J  LL ;; LL; 8 =(""   OO  ++BA0A.A06B.A00BBcK|}|j}|j|||} |d{|jr&t j d|j ||||fS7:#|jxYww)Nz!Write pipe %r connected: (%r, %r))rr0rr|rrrurvs rconnect_write_pipez BaseEventLoop.connect_write_pipes#%##%33D(FK  LL ;; LL< 8 =(""   OO  rxcr|g}||jdt||1|tjk(r|jdt|n>||jdt|||jdt|t j dj |y)Nzstdin=zstdout=stderr=zstdout=zstderr= )rBr'r#r%rrrk)rrr4r5r6rs r_log_subprocesszBaseEventLoop._log_subprocesssu   KK&e!4 56 7  &J,=,="= KK.f)=(>? @! gl6&:%;<=! gl6&:%;<= SXXd^$r!) r4r5r6universal_newlinesr3r7encodingerrorstextc Kt|ttfs td|r td|s td|dk7r td| r td| td| td|} d}|jrd |z}|j |||||j | |d ||||fi| d{}|jr|tjd |||| fS7-w) Nzcmd must be a string universal_newlines must be Falsezshell must be Truerbufsize must be 0text must be Falseencoding must be Noneerrors must be Nonezrun shell command %rT%s: %r) rr<rr,r|r}r9rr)rrcmdr4r5r6r~r3r7rrrr8r debug_logrs rsubprocess_shellzBaseEventLoop.subprocess_shells#s|,34 4 ?@ @12 2 a<01 1 12 2  45 5  23 3#% ;;/4I  E66 B9$99 c4KCIKK ;;90 KK)Y 7("" KsB=C/?C-.C/c K|r td|r td|dk7r td| r td| td| td|f| z}|}d}|jrd|}|j|||||j||d ||||fi| d{}|jr|t j d ||||fS7-w) Nrzshell must be Falserrrrrzexecute program Fr)r,r|r}r9rr)rrprogramr4r5r6r~r3r7rrrr2r8 popen_argsrrrs rsubprocess_execzBaseEventLoop.subprocess_execs  ?@ @ 23 3 a<01 1 12 2  45 5  23 3Z$& #% ;;+7+6I  E66 B9$99 j%   ;;90 KK)Y 7("" sB"C$C%.Cc |jSrP)rrs rget_exception_handlerz#BaseEventLoop.get_exception_handlers &&&r!cJ |t|std|||_y)Nz+A callable object or None is expected, got )rr>r)rhandlers rset_exception_handlerz#BaseEventLoop.set_exception_handlers:   x'8##*+/0 0")r!c |jd}|sd}|jd}|t|||jf}nd}d|vr;|j/|jjr|jj|d<|g}t |D]}|dvr||}|dk(r:dj tj|}d }||jz }nJ|dk(r:dj tj|}d }||jz }n t|}|j|d |tjd j || y)NrSz!Unhandled exception in event looprgFsource_tracebackhandle_traceback>rSrgr5z+Object created at (most recent call last): z+Handle created at (most recent call last): r r^)getrG __traceback__rrsortedrk traceback format_listrstriprrBrrG) rr rSrgr_ log_linesrRvaluetbs rdefault_exception_handlerz'BaseEventLoop.default_exception_handlers` ++i(9GKK ,  YI4K4KLHH g -$$0$$66$$66 & 'I '?C..CLE((WWY2259:F$**WWY2259:F$U    uBug. /#  TYYy)H=r!c |j |j|y d}|jd}||jd}||jd}|t|dr|j}|*t|dr|j|j||y|j||y#ttf$rt$rt j ddYywxYw#ttf$rt$r[} |jd ||d n:#ttf$rt$rt j d dYnwxYwYd}~yYd}~yd}~wwxYw) Nz&Exception in default exception handlerTr^rror get_contextrunz$Unhandled error in exception handler)rSrgr zeException in default exception handler while handling an unexpected error in custom exception handler) rrrhrir-rrGrr*rr)rr ctxthingrms rrZz$BaseEventLoop.call_exception_handler+sv *  " " * ,..w7$ 0 F+=$KK1E=#KK1E$ )F++-C?wsE':GGD33T7C++D':3 12   , E&*,  ,0 12   0022#I%(#*4 #$56$0LL"?+/000  0sMB8BC-%C-8/C*)C*-E DE/E E EEE cV |js|jj|yyrP) _cancelledrrBrrs r _add_callbackzBaseEventLoop._add_callbackss%%  KK  v &!r!cH |j||jyrP)rr;rs r_add_callback_signalsafez&BaseEventLoop._add_callback_signalsafexsD 6" r!cJ |jr|xjdz c_yyrq)rrrs r_timer_handle_cancelledz%BaseEventLoop._timer_handle_cancelled}s$A     ' '1 , ' r!cd t|j}|tkDrr|j|z tkDr\g}|jD]'}|j rd|_|j |)tj|||_d|_n|jrz|jdj ra|xjdzc_tj|j}d|_|jr|jdj rad}|js |jrd}nP|jrD|jdj}ttd||jz t }|j"j%|}|j'|d}|j|j(z}|jrm|jd}|j|k\rnNtj|j}d|_|jj ||jrmt|j}t+|D]} |jj-}|j r*|j.rr ||_|j} |j3|j| z } | |j4k\r t7j8dt;|| d|_|j3d}y#d|_wxYw)NFrrzExecuting %s took %.3f seconds)rUr_MIN_SCHEDULED_TIMER_HANDLESr%_MIN_CANCELLED_TIMER_HANDLES_FRACTIONrrBrheapifyheappoprr_whenrmaxrMAXIMUM_SELECT_TIMEOUT _selectorselectr>rrangepopleftr|r_runrrrfr ) r sched_count new_scheduledrrjrr=end_timentodoirrs rrzBaseEventLoop._run_onces $//* 6 6  ' '+ 55 6M//$$(-F%!((0 * MM- (+DO*+D '//dooa&8&C&C++q0+t7$)!//dooa&8&C&C  ;;$..G __??1%++D#a !346LMG^^**73  Z( 99;!7!77oo__Q'F||x']]4??3F %F  KK  v & ooDKK uA[[((*F  {{ 0+1D(BKKMr)BT888'G'5f'=rC,0D( !",0D(s A)L&& L/c t|t|jk(ry|rDtj|_tj t j||_ytj |j||_yrP)rrr}#get_coroutine_origin_tracking_depthr#set_coroutine_origin_tracking_depthrDEBUG_STACK_DEPTHrenableds rr{z,BaseEventLoop._set_coroutine_origin_trackingsw =D!H!HI I  779  7  3 3++ - 3:/  3 3;; =3:/r!c|jSrP)r|rs rrzBaseEventLoop.get_debugs {{r!cl||_|jr|j|j|yyrP)r|rrDr{rs rrzBaseEventLoop.set_debugs. ??   % %d&I&I7 S r!rP)NNNr<)r)rN)FNN)Urrrrrrrrrr r'r*r.r0r9r;r>rrArHrPr_rqrhrwrrrkrrrLrMrrrrrrrrrrDrrrrrrrrrrrrr%r#r$r2rVr+r:rrYr? AI_PASSIVErqrsrwrzr}r#r$rrrrrrZrrrrr{rrrQr!rrrs/< ))-d4 %""%)$" 9=" $t"&!%!% "CG" @D(," AE)-"04" ""7DG "20DK40$L*.%MM - :>06:$26&%("=A 5 * 2"#!1H7 A(, A./4*).X59Q#14T"&!%!%$Q#j*/"&!% #8-<#'-<^1"4%*(,.2-1 .+bEID#./q267;$ D#N'(f.@.@%&a D59K####"&!%K^"&!% #<# # %&0__&0oo&0oo27%)1(,T "#J%/OOJOO%/__$)1'+Dt #D' *"0>dF0P'  - N` :Tr!r)rr)r)6rUcollections.abcconcurrent.futuresrrrrZrCr+rAr#rfrrr}rLrru ImportErrorr5rrrrrr r r r r rrlogr__all__rrr*rArr r'r2rMrdrnrrrwProtocolryAbstractServerrAbstractEventLooprrQr!rrs-      $ #),% FJ ' #J8v," 6=!G  > A) 2 2A)HBV " "BJPTF,,PTk  CsD DD__pycache__/windows_utils.cpython-312.opt-2.pyc000064400000015152152527367570015360 0ustar00 {|j ddlZejdk7redddlZddlZddlZddlZddlZddlZddl Z dZ dZ ejZ ejZ ejZdde dd ZGd d ZGd d ej$Zy)Nwin32z win32 only)pipePopenPIPE PipeHandlei F)TT)duplex overlappedbufsizec  tjdjtjt t }|r6tj}tjtjz}||}}n$tj}tj}d|}}|tjz}|dr|tjz}|drtj}nd}dx} } tj||tjd||tj tj"} tj$||dtj"tj&|tj"} tj(| d} | j+d| | fS#| tj,| | tj,| xYw)Nz\\.\pipe\python-pipe-{:d}-{:d}-)prefixrTr )tempfilemktempformatosgetpidnext _mmap_counter_winapiPIPE_ACCESS_DUPLEX GENERIC_READ GENERIC_WRITEPIPE_ACCESS_INBOUNDFILE_FLAG_FIRST_PIPE_INSTANCEFILE_FLAG_OVERLAPPEDCreateNamedPipe PIPE_WAITNMPWAIT_WAIT_FOREVERNULL CreateFile OPEN_EXISTINGConnectNamedPipeGetOverlappedResult CloseHandle) rr r addressopenmodeaccessobsizeibsizeflags_and_attribsh1h2ovs ./usr/lib64/python3.12/asyncio/windows_utils.pyrr sOoo188 IIKm,./G--%%(=(== '..&&G 555H!}G000!}#88NB  $ $ Xw00 vvw;;W\\K   VQ g.C.C w||- % %bT : t$2v  >    # >    # s +B6F""1GczeZdZ dZdZedZdZejddZ e jfdZ dZd Zy ) rc||_yN_handleselfhandles r/__init__zPipeHandle.__init__Vs  cx|jd|j}nd}d|jjd|dS)Nzhandle=closed< >)r4 __class____name__r5s r/__repr__zPipeHandle.__repr__YsB << #t||./FF4>>**+1VHA66r9c|jSr2r3r6s r/r7zPipeHandle.handle`s ||r9cH|j td|jS)NzI/O operation on closed pipe)r4 ValueErrorrCs r/filenozPipeHandle.filenods" << ;< <||r9)r%cP|j||jd|_yyr2r3)r6r%s r/closezPipeHandle.closeis$ << #  %DL $r9cb|j#|d|t||jyy)Nz unclosed )source)r4ResourceWarningrH)r6_warns r/__del__zPipeHandle.__del__ns- << # IdX& E JJL $r9c|Sr2rCs r/ __enter__zPipeHandle.__enter__ss r9c$|jyr2)rH)r6tvtbs r/__exit__zPipeHandle.__exit__vs  r9N)r@ __module__ __qualname__r8rApropertyr7rFrr%rHwarningswarnrMrPrUrOr9r/rrQsR7 $+#6#6 %MM r9rc"eZdZ dfd ZxZS)rc dx}x}}dx} x} } |tk(r5tdd\} } tj| tj }n|}|tk(r&td\} } tj| d}n|}|tk(r&td\} }tj|d}n|t k(r|}n|} t| |f|||d|| t| |_ | t| |_ | t| |_ |tk(rt j||tk(rt j||tk(rt j|yy#| | | fD]}|tj|xYw#|tk(rt j||tk(rt j||tk(rt j|wwxYw)N)FTT)r r)TFrr)stdinstdoutstderr)rrmsvcrtopen_osfhandlerO_RDONLYSTDOUTsuperr8rr]r^r_rr%rH)r6argsr]r^r_kwds stdin_rfd stdout_wfd stderr_wfdstdin_wh stdout_rh stderr_rhstdin_rh stdout_wh stderr_whhr?s r/r8zPopen.__init__s/32 2J+///9y D=!%t!L Hh--h DII T>#'=#A Iy..y!#'=#A Iy..y!rzs/ <<7 l ##  0     ! \7+b&&X0%J  0%r9__pycache__/base_tasks.cpython-312.opt-1.pyc000064400000007760152527367570014572 0ustar00 {|jp tddlZddlZddlZddlmZddlmZdZejdZdZ dZ y) N) base_futures) coroutinesctj|}|jr|jsd|d<|j dd|j z|j |j dd|j |jr5tj|j}|j dd|d|S) N cancellingrrzname=%rz wait_for=zcoro=<>) r_future_repr_infordoneinsertget_name _fut_waiter_coror_format_coroutine)taskinfocoros +/usr/lib64/python3.12/asyncio/base_tasks.py_task_repr_infor s  ) )$ /D QKK9t}}./ # A4#3#3"678 zz++DJJ7 AvQ'( Kcpdjt|}d|jjd|dS)N >zz 7 " KK !   *  61;;?xt<=) //C  dX&T2  th&?@tL 4(";<4H d3 33CMM3GD $Tr *Hr) r:reprlibr?r1rrrrecursive_reprrr.rJrrrNsC&11 F+r__pycache__/streams.cpython-312.opt-1.pyc000064400000100275152527367570014124 0ustar00 {|jkldZddlZddlZddlZddlZddlZeedredz ZddlmZddlm Z ddlm Z dd lm Z dd lm Z dd l mZdd lmZd ZdeddZdeddZeedrdeddZdeddZGdde j,ZGddee j,ZGddZGddZy)) StreamReader StreamWriterStreamReaderProtocolopen_connection start_serverNAF_UNIX)open_unix_connectionstart_unix_server) coroutines)events) exceptions)format_helpers) protocols)logger)sleepi)limitc Ktj}t||}t|| |j fd||fi|d{\}}t | ||}||fS7w)aA wrapper for create_connection() returning a (reader, writer) pair. The reader returned is a StreamReader instance; the writer is a StreamWriter instance. The arguments are all the usual arguments to create_connection() except protocol_factory; most common are positional host and port, with various optional keyword arguments following. Additional optional keyword arguments are loop (to set the event loop instance to use) and limit (to set the buffer limit passed to the StreamReader). (If you want to customize the StreamReader and/or StreamReaderProtocol classes, just copy the code -- there's really nothing special here except some convenience.) rlooprcSNprotocols(/usr/lib64/python3.12/asyncio/streams.pyz!open_connection..1sN)r get_running_looprrcreate_connectionr) hostportrkwdsrreader transport_writerrs @rrrsx&  " " $D D 1F#F6H///$.(,..LIq )Xvt .sA A) A'A)cKtjfd}j|||fi|d{S7w)aStart a socket server, call back for each client connected. The first parameter, `client_connected_cb`, takes two parameters: client_reader, client_writer. client_reader is a StreamReader object, while client_writer is a StreamWriter object. This parameter can either be a plain callback function or a coroutine; if it is a coroutine, it will be automatically converted into a Task. The rest of the arguments are all the usual arguments to loop.create_server() except protocol_factory; most common are positional host and port, with various optional keyword arguments following. The return value is the same as loop.create_server(). Additional optional keyword argument is limit (to set the buffer limit passed to the StreamReader). The return value is the same as loop.create_server(), i.e. a Server object which can be used to stop the service. c>t}t|}|SNrrrrr%rclient_connected_cbrrs rfactoryzstart_server..factoryNs&E5'0C-13rN)r r create_server)r.r"r#rr$r/rs` ` @rrr6s@,  " " $D $##GT4@4@ @@ @s4A>AcKtj}t||}t|||jfd|fi|d{\}}t |||}||fS7w)z@Similar to `open_connection` but works with UNIX Domain Sockets.rrcSrrrsrrz&open_unix_connection..bsHrN)r r rrcreate_unix_connectionr) pathrr$rr%r&r'r(rs @rr r Zsv&&(E5'T:8T88 d,&*,, 1i64@v~,sA A( A& A(cKtjfd}j||fi|d{S7w)z=Similar to `start_server` but works with UNIX Domain Sockets.c>t}t|}|Sr+r,r-s rr/z"start_unix_server..factoryks&!D9F+F4G157HOrN)r r create_unix_server)r.r4rr$r/rs` ` @rr r fs>&&(  -T,,WdCdCCCCs 3?=?c6eZdZdZd dZdZdZdZdZdZ y) FlowControlMixina)Reusable flow control logic for StreamWriter.drain(). This implements the protocol methods pause_writing(), resume_writing() and connection_lost(). If the subclass overrides these it must call the super methods. StreamWriter.drain() must wait for _drain_helper() coroutine. Nc|tj|_n||_d|_t j |_d|_yNF)r get_event_loop_loop_paused collectionsdeque_drain_waiters_connection_lost)selfrs r__init__zFlowControlMixin.__init__~s> <..0DJDJ )//1 %rctd|_|jjrtjd|yy)NTz%r pauses writing)r>r= get_debugrdebugrCs r pause_writingzFlowControlMixin.pause_writings- ::   ! LL,d 3 "rcd|_|jjrtjd||j D]$}|j r|jd&y)NFz%r resumes writing)r>r=rFrrGrAdone set_resultrCwaiters rresume_writingzFlowControlMixin.resume_writingsO ::   ! LL-t 4))F;;=!!$'*rcd|_|jsy|jD]8}|jr||j d(|j |:yNT)rBr>rArKrL set_exceptionrCexcrNs rconnection_lostz FlowControlMixin.connection_lostsN $|| ))F;;=;%%d+((- *rcNK|jr td|jsy|jj }|j j | |d{|j j|y7 #|j j|wxYww)NzConnection lost)rBConnectionResetErrorr>r= create_futurerAappendremoverMs r _drain_helperzFlowControlMixin._drain_helpers  &'89 9|| ))+ ""6* /LL    & &v .     & &v .s0AB%B"B#B'B%BB""B%ctr)NotImplementedErrorrCstreams r_get_close_waiterz"FlowControlMixin._get_close_waiters!!rr) __name__ __module__ __qualname____doc__rDrIrOrUr[r`rrrr9r9ts%&4 ( . /"rr9cfeZdZdZdZd fd ZedZdZdZ fdZ dZ d Z d Z d ZxZS) ra=Helper class to adapt between Protocol and StreamReader. (This is a helper class instead of making StreamReader itself a Protocol subclass, because the StreamReader has other potential uses, and to prevent the user of the StreamReader to accidentally call inappropriate methods of the protocol.) Nc4t|||,tj||_|j |_nd|_|||_d|_d|_d|_ d|_ ||_ d|_ |jj|_y)NrF)superrDweakrefref_stream_reader_wr_source_traceback_strong_reader_reject_connection_stream_writer_task _transport_client_connected_cb _over_sslr=rX_closed)rC stream_readerr.r __class__s rrDzStreamReaderProtocol.__init__s d#  $%,[[%?D "%2%D%DD "%)D "  *#0D "'" $7!zz//1 rc<|jy|jSr)rjrHs r_stream_readerz#StreamReaderProtocol._stream_readers  ! ! )%%''rc|j}|j}||_||_|j ddu|_y)N sslcontext)r=r&rnrpget_extra_inforr)rCr(rr&s r_replace_writerz$StreamReaderProtocol._replace_writers<zz$$ $#"11,?tKrcxjrKddi}jrj|d<jj|j y_j }||jjddu_ jt|j_ j|j}tj|rAfd}jj|_j j#|d_yy)NmessagezpAn open stream was garbage collected prior to establishing network connection; call "stream.close()" explicitly.source_tracebackryc|jrjy|j}|0jj d|djyy)Nz*Unhandled exception in client_connected_cb)r} exceptionr&) cancelledcloserr=call_exception_handler)taskrTrCr&s rcallbackz6StreamReaderProtocol.connection_made..callbacks\~~'!)..*C 99'S),)2; ") 'r)rmrkr=rabortrprw set_transportrzrrrqrrnr iscoroutine create_taskroadd_done_callbackrl)rCr&contextr%resrs`` rconnection_madez$StreamReaderProtocol.connection_mades#  " "@G %%.2.D.D*+ JJ - -g 6 OO  #$$     +"11,?tK  $ $ 0".y$/5/3zz#;D ++F,0,?,?AC%%c* *"ZZ33C8  ,,X6"&D / 1rcf|j}|$||jn|j||jj s9||jj dn|jj|t ||d|_d|_ d|_ d|_ yr) rwfeed_eofrRrsrKrLrgrUrjrnrorp)rCrTr%rus rrUz$StreamReaderProtocol.connection_lost s$$  {!$$S)||  "{ ''- **3/ $!%" rcD|j}||j|yyr)rw feed_data)rCdatar%s r data_receivedz"StreamReaderProtocol.data_receiveds&$$     T " rcZ|j}||j|jryy)NFT)rwrrr)rCr%s r eof_receivedz!StreamReaderProtocol.eof_received!s,$$   OO  >>rc|jSr)rsr^s rr`z&StreamReaderProtocol._get_close_waiter,s ||rc |j}|jr"|js|jyyy#t$rYywxYwr)rsrKrrAttributeError)rCcloseds r__del__zStreamReaderProtocol.__del__/sM #\\F{{}V%5%5%7  "&8}   s A A  A NN)rarbrcrdrkrDpropertyrwr{rrUrrr`r __classcell__)rus@rrrsN2((( L('T$#  #rrczeZdZdZdZdZedZdZdZ dZ dZ d Z d Z d Zdd ZdZd d d ddZdZy )ra'Wraps a Transport. This exposes write(), writelines(), [can_]write_eof(), get_extra_info() and close(). It adds drain() which returns an optional Future on which you can wait for flow control. It also adds a transport property which references the Transport directly. c||_||_||_||_|jj |_|j j dyr)rp _protocol_readerr=rX _complete_futrL)rCr&rr%rs rrDzStreamWriter.__init__EsI#!  !ZZ557 %%d+rc|jjd|jg}|j|j d|jdj dj |S)N transport=zreader=<{}> )rurarprrYformatjoinrCinfos r__repr__zStreamWriter.__repr__Os['':doo5H)IJ << # KK'$,,!12 3}}SXXd^,,rc|jSrrprHs rr&zStreamWriter.transportUs rc:|jj|yr)rpwriterCrs rrzStreamWriter.writeYs d#rc:|jj|yr)rp writelinesrs rrzStreamWriter.writelines\s ""4(rc6|jjSr)rp write_eofrHs rrzStreamWriter.write_eof_s((**rc6|jjSr)rp can_write_eofrHs rrzStreamWriter.can_write_eofbs,,..rc6|jjSr)rprrHs rrzStreamWriter.closees$$&&rc6|jjSr)rp is_closingrHs rrzStreamWriter.is_closinghs))++rcVK|jj|d{y7wr)rr`rHs r wait_closedzStreamWriter.wait_closedksnn..t444s )')Nc:|jj||Sr)rprz)rCnamedefaults rrzzStreamWriter.get_extra_infons--dG<>jjl"jj22 OOXz#_"7!5 377 (  & 7s!8BB 3B.B/BBc|jjsc|jjrt j dt y|jt j d|t yy)Nzloop is closedz unclosed )rprr= is_closedwarningswarnResourceWarningrrHs rrzStreamWriter.__del__sT))+zz##% .@  $2OD ,rr)rarbrcrdrDrrr&rrrrrrrrzrrrrrrrr;sh,- $)+/',5=-4)-.2-1' ErrceZdZdZedfdZdZdZdZdZ dZ dZ d Z d Z d Zd Zd ZddZddZdZdZdZy)rNcl|dkr td||_|tj|_n||_t |_d|_d|_d|_ d|_ d|_ |jjr.tjtj d|_yy)NrzLimit cannot be <= 0Fr ) ValueError_limitr r<r= bytearray_buffer_eof_waiter _exceptionrpr>rFr extract_stacksys _getframerk)rCrrs rrDzStreamReader.__init__s A:34 4 <..0DJDJ {    ::   !%3%A%A a &"D " "rcdg}|jr'|jt|jd|jr|jd|jt k7r|jd|j|j r|jd|j |jr|jd|j|jr|jd|j|jr|jdd jd j|S) Nrz byteseofzlimit=zwaiter=z exception=rpausedrr) rrYlenrr_DEFAULT_LIMITrrrpr>rrrs rrzStreamReader.__repr__s << KK3t||,-V4 5 99 KK  ;;. ( KK& . / << KK'$,,!12 3 ?? KK*T__$78 9 ?? KK*T__$78 9 << KK !}}SXXd^,,rc|jSr)rrHs rrzStreamReader.exceptions rc||_|j}|*d|_|js|j|yyyr)rrrrRrSs rrRzStreamReader.set_exceptionsC  DL##%$$S)& rct|j}|*d|_|js|jdyyy)z1Wakeup read*() functions waiting for data or EOF.N)rrrLrMs r_wakeup_waiterzStreamReader._wakeup_waiters<  DL##%!!$'& rc||_yrr)rCr&s rrzStreamReader.set_transports #rc|jrEt|j|jkr"d|_|jj yyyr;)r>rrrrpresume_readingrHs r_maybe_resume_transportz$StreamReader._maybe_resume_transports; <rr pause_readingr]rs rrzStreamReader.feed_datas  D!  OO 'LLDLL!A O3 $--/ $ 4! ( ' '#'  's-BB%$B%c,K|jt|d|jr!d|_|jj |j j |_ |jd{d|_y7 #d|_wxYww)zpWait until feed_data() or feed_eof() is called. If stream was paused, automatically resume it. NzF() called while another coroutine is already waiting for incoming dataF)r RuntimeErrorr>rprr=rX)rC func_names r_wait_for_datazStreamReader._wait_for_data s << #+456 6 << DL OO * * ,zz//1  ,,  DL DLs0A'B*B9B:B>BB BBcKd}t|} |j|d{}|S7#tj$r}|jcYd}~Sd}~wtj $r}|j j||jr|j d|j|z=n|j j|jt|jdd}~wwxYww)aRead chunk of data from the stream until newline (b' ') is found. On success, return chunk that ends with newline. If only partial line can be read due to EOF, return incomplete line without terminating newline. When EOF was reached while no bytes read, empty bytes object is returned. If limit is reached, ValueError will be raised. In that case, if newline was found, complete line including newline will be removed from internal buffer. Else, internal buffer will be cleared. Limit is compared against part of the line without newline. If stream was paused, this function will automatically resume it if needed.  Nr) r readuntilrIncompleteReadErrorpartialLimitOverrunErrorr startswithconsumedclearrrargs)rCsepseplenlinees rreadlinezStreamReader.readline%s S (,,D --- 99 ++ (||&&sAJJ7LL!5!**v"5!56 ""$  ( ( *QVVAY' '  (sJC5.,.C5.C2 A C2 C5C2(BC--C22C5cKt|}|dk(r td|j |jd} t|j}||z |k\rO|jj ||}|dk7rn|dz|z }||j kDrt jd||jrEt|j}|jjt j|d|jdd{||j kDrt jd||jd||z}|jd||z=|jt|S7iw) aVRead data from the stream until ``separator`` is found. On success, the data and separator will be removed from the internal buffer (consumed). Returned data will include the separator at the end. Configured stream limit is used to check result. Limit sets the maximal length of data that can be returned, not counting the separator. If an EOF occurs and the complete separator is still not found, an IncompleteReadError exception will be raised, and the internal buffer will be reset. The IncompleteReadError.partial attribute may contain the separator partially. If the data cannot be read because of over limit, a LimitOverrunError exception will be raised, and the data will be left in the internal buffer, so it can be read again. rz,Separator should be at least one-byte stringNr z2Separator is not found, and chunk exceed the limitrz2Separator is found, but chunk is longer than limit)rrrrfindrrrrbytesrrrr)rC separatorroffsetbuflenisepchunks rrzStreamReader.readuntilDsz(Y Q;KL L ?? &// !*&F&(||((F;2: !f,DKK'$66L  yydll+ ""$ 44UDAA%%k2 2 2=@ $++ ..DdL L ^dVm, LL$- ( $$&U| 3sDE6 E4 A*E6cK|j |j|dk(ry|dkrLg} |j|jd{}|sn|j|8dj |S|j s%|j s|jdd{tt|j d|}|j d|=|j|S77Hw)aRead up to `n` bytes from the stream. If `n` is not provided or set to -1, read until EOF, then return all read bytes. If EOF was received and the internal buffer is empty, return an empty bytes object. If `n` is 0, return an empty bytes object immediately. If `n` is positive, return at most `n` available bytes as soon as at least 1 byte is available in the internal buffer. If EOF is received before any byte is read, return an empty bytes object. Returned value is not limited with limit, configured at stream creation. If stream was paused, this function will automatically resume it if needed. Nrrread) rr rrYrrrrr memoryviewr)rCnblocksblockrs rr zStreamReader.reads, ?? &// ! 6 q5 F"ii 44 e$  88F# #||DII%%f- - -Z -bq12 LL!  $$& 5 .s&AC)C%AC)C'AC)'C)cK|dkr td|j |j|dk(ryt|j|kr|jrEt |j}|jj tj|||jdd{t|j|krt|j|k(r0t |j}|jj n0t t|jd|}|jd|=|j|S7w)aRead exactly `n` bytes. Raise an IncompleteReadError if EOF is reached before `n` bytes can be read. The IncompleteReadError.partial attribute of the exception will contain the partial read bytes. if n is zero, return empty bytes object. Returned value is not limited with limit, configured at stream creation. If stream was paused, this function will automatically resume it if needed. rz*readexactly size can not be less than zeroNr readexactly) rrrrrrrrrrr r)rCr  incompleters rrzStreamReader.readexactlys q5IJ J ?? &// ! 6$,,!#yy"4<<0  ""$ 44ZCC%%m4 4 4 $,,!# t||  !&D LL   DLL1"156D RaR  $$&  5sB,E.E/E B Ec|SrrrHs r __aiter__zStreamReader.__aiter__s rcXK|jd{}|dk(rt|S7w)Nr)rStopAsyncIteration)rCvals r __anext__zStreamReader.__anext__s+MMO# #:$ $ $s *(*)r)r)rarbrcrkrrDrrrRrrrrrrrrrr rrrrrrrrsf+$",-$*($- .$, 8>Yv1f'Rrrrr)__all__r?socketrrrhhasattrr r rrrlogrtasksrrrrr r Protocolr9rrrrrrrs '  69 <B+/  rc|jS)zReturn the current deadline.)r'r(s rr!z Timeout.when.s zzrc|jtjurJ|jtjur t dt d|jj d||_|j|jj|d|_ytj}||jkr!|j|j|_y|j||j|_y)zReschedule the timeout.zTimeout has not been enteredzCannot change state of z TimeoutN)r$rrr RuntimeErrorvaluer'r%cancelrget_running_looptime call_soon _on_timeoutcall_at)r(r!loops r reschedulezTimeout.reschedule2s ;;fnn ,{{fnn,"#ABB)$++*;*;))r$rrr'roundappendjoinr.)r(infor!info_strs r__repr__zTimeout.__repr__Msst ;;&.. (+/::+A5Q'tD KK%v '88D>DKK--.az;;rcJK|jtjur tdt j }| tdtj |_||_|jj|_ |j|j|Sw)Nz Timeout has already been enteredz$Timeout should be used inside a task) r$rrr-r current_taskrr& cancelling _cancellingr6r')r(tasks r __aenter__zTimeout.__aenter__Us} ;;fnn ,AB B!!# <EF Fnn  ::002  # sB!B#exc_typeexc_valexc_tbcK|j!|jjd|_|jtjurVtj |_|j j|jkr|tjurt|y|jtjurtj|_ywN)r%r/r$rrrr&uncancelrGr CancelledError TimeoutErrorrr)r(rJrKrLs r __aexit__zTimeout.__aexit__as  ,  ! ! ( ( *$(D ! ;;&// ) ..DKzz""$(8(88XIbIb=b#/[[FNN * --DKsCCcp|jjtj|_d|_yrN)r&r/rrr$r%r+s rr3zTimeout._on_timeoutys% oo $r)r"r )r"N)rrr__doc__rfloatr)r!r6boolrstrrCrIr BaseExceptionrrRr3rrrr r s Xe_  huoMxM4M.@@<#< 4 ./-('  $ 0%rr delayr"crtj}t||j|zSdS)a Timeout async context manager. Useful in cases when you want to apply timeout logic around block of code or in cases when asyncio.wait_for is not suitable. For example: >>> async with asyncio.timeout(10): # 10 seconds timeout ... await long_running_task() delay - value in seconds or None to disable timeout logic long_running_task() is interrupted by raising asyncio.CancelledError, the top-most affected timeout() context manager converts CancelledError into TimeoutError. N)rr0r r1)rYr5s rr r s5  " " $D %*;499;& FF FFrr!ct|S)abSchedule the timeout at absolute time. Like timeout() but argument gives absolute time in the same clock system as loop.time(). Please note: it is not POSIX time but a time with undefined starting base, e.g. the time of the system power on. >>> async with asyncio.timeout_at(loop.time() + 10): ... await long_running_task() when - a deadline when timeout occurs or None to disable timeout logic long_running_task() is interrupted by raising asyncio.CancelledError, the top-most affected timeout() context manager converts CancelledError into TimeoutError. )r )r!s rr r s& 4=r)enumtypesrtypingrrrr9rr r __all__Enumrr rUr r rrrras (( TYYc%c%c%LG8E?GwG(Xe_r__pycache__/staggered.cpython-312.pyc000064400000014626152527367570013460 0ustar00 {|jPdZdZddlZddlmZddlmZddlmZddlmZdd d Z y) zFSupport for running coroutines in parallel with staggered start times.)staggered_raceN)events) exceptions)locks)tasks)loopc  Kxstjt|ddgg t d fd d  f d d} t j }j  |d} j||j |jd} r j d{d r r td|| f ~S7##tj$r,}|} D]}|j|jYd}~[d}~wwxYw# ~wxYww)aRun coroutines with staggered start times and take the first to finish. This method takes an iterable of coroutine functions. The first one is started immediately. From then on, whenever the immediately preceding one fails (raises an exception), or when *delay* seconds has passed, the next coroutine is started. This continues until one of the coroutines complete successfully, in which case all others are cancelled, or until all coroutines fail. The coroutines provided should be well-behaved in the following way: * They should only ``return`` if completed successfully. * They should always raise an exception if they did not complete successfully. In particular, if they handle cancellation, they should probably reraise, like this:: try: # do work except asyncio.CancelledError: # undo partially completed work raise Args: coro_fns: an iterable of coroutine functions, i.e. callables that return a coroutine object when called. Use ``functools.partial`` or lambdas to pass arguments. delay: amount of time, in seconds, between starting coroutines. If ``None``, the coroutines will run sequentially. loop: the event loop to use. Returns: tuple *(winner_result, winner_index, exceptions)* where - *winner_result*: the result of the winning coroutine, or ``None`` if no coroutines won. - *winner_index*: the index of the winning coroutine in ``coro_fns``, or ``None`` if no coroutines won. If the winning coroutine may return None on success, *winner_index* can be used to definitively determine whether any coroutine won. - *exceptions*: list of exceptions returned by the coroutines. ``len(exceptions)`` is equal to the number of coroutines actually started, and the order is the same as in ``coro_fns``. The winning coroutine's entry is ``None``. Ncj|#jssjd|jry|j }|yj |y)N)discarddone set_result cancelled exceptionappend)taskexcon_completed_fut running_tasksunhandled_exceptionss */usr/lib64/python3.12/asyncio/staggered.py task_donez!staggered_race..task_doneJscd#  ($))+!  ' ' - >>  nn ; ##C(c K|jd{|Xtjtj5t j |j d{ddd t \}}tj}tj}j||}j||j|j jdt! |dzk(sJ |d{}J||t j"}D]} | |us| j%y7N7#1swYxYw#t$rYywxYw7^#t&t(f$rt*$r} | |<|jYd} ~ yd} ~ wwxYww)Nr)wait contextlibsuppressexceptions_mod TimeoutErrorrwait_fornext StopIterationrEvent create_taskaddadd_done_callbacksetrlen current_taskcancel SystemExitKeyboardInterrupt BaseException) ok_to_startprevious_failed this_indexcoro_fn this_failednext_ok_to_start next_taskresultr)tedelay enum_coro_fnsrr run_one_cororr winner_index winner_results rr:z$staggered_race..run_one_coro[s    &$$^%@%@A nn_%9%9%;UCCC B "&}"5 Jkkm  ;;=$$\2BK%PQ )$##I. $:*q.000 "9_F ' ''%L"M!--d3L"L(HHJ#a !D BA    %-.   %&Jz " OO   sGE%)G(E*)E(*E*.G7E6BG F&F'F+&GG(E**E3/G6 F?GFGFF>F94G9F>>Gzstaggered race failed)returnN)rget_running_loop enumerater'rr#r$r%r& create_futurerCancelledErrorr*argsExceptionGroup)coro_fnsr8r propagate_cancellation_errorr. first_taskexrr9rrr:rrrr;r<s `` @@@@@@@@@rrr s`h  ,6**,Dh'MMLJEM)"66p$( Kkkm %%l;&EF *%$$Y/'+$#113  *&&& $ .!!8:NO O ' 3. .lJ6 46J'!00 */1,)DDKK)* * 46JsaAEA2D=C;C9C;D=D=5E9C;;D:"D50D=5D::D==EE) __doc____all__rrrrrrrrrrLs(L *37aKr__pycache__/proactor_events.cpython-312.pyc000064400000127314152527367570014727 0ustar00 {|j܂dZdZddlZddlZddlZddlZddlZddlZddlZddl m Z ddl m Z ddl m Z ddl m Z dd l mZdd l mZdd l mZdd l mZdd lmZdZGddej*ej,ZGddeej0ZGddeej4ZGddeZGddeej:ZGddeeej>Z Gddeeej>Z!Gdde jDZ#y)zEvent loop using a proactor and related classes. A proactor is a "notify-on-completion" multiplexer. Currently a proactor is only implemented on Windows with IOCP. )BaseProactorEventLoopN) base_events) constants)futures) exceptions) protocols)sslproto) transports)trsock)loggerctj||jd< |j|jd<d|jvr |j|jd<yy#tj $r5|j jrtjd|dYuwxYw#tj $rd|jd<YywxYw)Nsocketsocknamezgetsockname() failed on %rTexc_infopeername) r TransportSocket_extra getsocknamererror_loop get_debugr warning getpeername) transportsocks 0/usr/lib64/python3.12/asyncio/proactor_events.py_set_socket_extrars!'!7!7!=IXC'+'7'7'9 $ ))) 0+/+;+;+=I  Z (* <<C ?? $ $ & NN,dT CC|| 0+/I  Z ( 0s$A/B:/AB76B7:"CCceZdZdZ dfd ZdZdZdZdZdZ dZ e jfd Z dd Zd Zd Zd ZxZS)_ProactorBasePipeTransportz*Base class for pipe and socket transports.ct||||j|||_|j |||_d|_d|_d|_d|_ d|_ d|_ d|_ d|_ |j |j j|jj!|j"j$||,|jj!t&j(|dyy)NrF)super__init__ _set_extra_sock set_protocol_server_buffer _read_fut _write_fut_pending_write _conn_lost_closing_called_connection_lost _eof_written_attachr call_soon _protocolconnection_mader_set_result_unless_cancelledselflooprprotocolwaiterextraserver __class__s rr$z#_ProactorBasePipeTransport.__init__2s %   (#   ',$! << # LL " T^^;;TB   JJ !E!E!' / c|jjg}|j|jdn|jr|jd|j,|jd|jj |j |jd|j |j|jd|j|jr'|jdt|j|jr|jddjd j|S) Nclosedclosingzfd=zread=zwrite=zwrite_bufsize=z EOF writtenz<{}> ) r=__name__r&appendr.filenor*r+r)lenr0formatjoin)r7infos r__repr__z#_ProactorBasePipeTransport.__repr__Is''( ::  KK ! ]] KK " :: ! KK#djj//123 4 >> % KK%12 3 ?? & KK& 34 5 << KK.T\\):(;< =    KK &}}SXXd^,,r>c"||jd<y)Npipe)rr7rs rr%z%_ProactorBasePipeTransport._set_extra[s" Fr>c||_yNr3)r7r9s rr'z'_ProactorBasePipeTransport.set_protocol^s !r>c|jSrOrPr7s r get_protocolz'_ProactorBasePipeTransport.get_protocolas ~~r>c|jSrO)r.rRs r is_closingz%_ProactorBasePipeTransport.is_closingds }}r>c.|jryd|_|xjdz c_|js2|j&|jj |j d|j"|jjd|_yy)NTr) r.r-r)r+rr2_call_connection_lostr*cancelrRs rclosez _ProactorBasePipeTransport.closegsq ==   1|| 7 JJ !;!;T B >> % NN ! ! #!DN &r>cv|j-|d|t||jjyy)Nzunclosed transport )source)r&ResourceWarningrY)r7_warns r__del__z"_ProactorBasePipeTransport.__del__rs5 :: ! 'x0/$ O JJ    "r>c0 t|tr4|jjrDt j d||dn*|jj ||||jd|j|y#|j|wxYw)Nz%r: %sTr)message exceptionrr9) isinstanceOSErrorrrr debugcall_exception_handlerr3 _force_close)r7excr`s r _fatal_errorz'_ProactorBasePipeTransport._fatal_errorwsy ##w'::'')LL44H 11&!$!% $ 3   c "D  c "s A.BBcH|jS|jjs9||jjdn|jj||jr |j ryd|_|xj dz c_|jr!|jjd|_|jr!|jjd|_ d|_ d|_ |jj|j|y)NTrr) _empty_waiterdone set_result set_exceptionr.r/r-r+rXr*r,r)rr2rW)r7rgs rrfz'_ProactorBasePipeTransport._force_closes    )$2D2D2I2I2K{""--d3""005 ==T99   1 ?? OO " " $"DO >> NN ! ! #!DN  T77=r>c|jry |jj|t|jdrF|jj dk7r)|jj tj|jjd|_|j}||jd|_ d|_y#t|jdrF|jj dk7r)|jj tj|jjd|_|j}||jd|_ d|_wxYw)NshutdownT) r/r3connection_losthasattrr&rEror SHUT_RDWRrYr(_detach)r7rgr<s rrWz0_ProactorBasePipeTransport._call_connection_losts  ' '  0 NN * *3 / tzz:.4::3D3D3F"3L ##F$4$45 JJ   DJ\\F! # +/D (tzz:.4::3D3D3F"3L ##F$4$45 JJ   DJ\\F! # +/D (s CB+E?cf|j}|j|t|jz }|SrO)r,r)rF)r7sizes rget_write_buffer_sizez0_ProactorBasePipeTransport.get_write_buffer_sizes/"" << # C % %D r>NNN)zFatal error on pipe transport)rC __module__ __qualname____doc__r$rJr%r'rSrUrYwarningswarnr^rhrfrWrw __classcell__r=s@rr!r!.sQ448$(/.-$#" "%MM #>(0(r>r!cNeZdZdZ d fd ZdZdZdZdZdZ d dZ xZ S) _ProactorReadPipeTransportzTransport for read pipes.cd|_d|_t| ||||||t ||_|j j|jd|_y)NrpTF) _pending_data_length_pausedr#r$ bytearray_datarr2 _loop_reading) r7r8rr9r:r;r< buffer_sizer=s rr$z#_ProactorReadPipeTransport.__init__sT$&!  tXvufE{+  T//0 r>c:|j xr |j SrO)rr.rRs r is_readingz%_ProactorReadPipeTransport.is_readings<<5 $55r>c|js |jryd|_|jjrt j d|yy)NTz%r pauses reading)r.rrrr rdrRs r pause_readingz(_ProactorReadPipeTransport.pause_readings? ==DLL   ::   ! LL,d 3 "r>c|js |jsyd|_|j&|jj |j d|j }d|_|dkDr4|jj |j|jd|||jjrtjd|yy)NFrpz%r resumes reading) r.rr*rr2rr_data_receivedrrr rd)r7lengths rresume_readingz)_ProactorReadPipeTransport.resume_readings ==  >> ! JJ !3!3T :**$&! B; JJ !4!4djj&6I6 R ::   ! LL-t 4 "r>c.|jjrtjd| |jj }|s|jyy#t tf$rt$r}|j|dYd}~yd}~wwxYw)Nz%r received EOFz1Fatal error: protocol.eof_received() call failed.) rrr rdr3 eof_received SystemExitKeyboardInterrupt BaseExceptionrhrY)r7 keep_openrgs r _eof_receivedz(_ProactorReadPipeTransport._eof_receiveds ::   ! LL*D 1 335I JJL-.      H J  sA B8BBc|jr|jdk(sJ||_y|dk(r|jyt|jt j r" t j|j|y|jj|y#ttf$rt$r}|j|dYd}~yd}~wwxYw)Nrprz3Fatal error: protocol.buffer_updated() call failed.) rrrrbr3r BufferedProtocol_feed_data_to_buffered_protorrrrh data_received)r7datarrgs rrz)_ProactorReadPipeTransport._data_receiveds <<,,2 22(.D %  Q;     dnni&@&@ A 66t~~tL NN ( ( . 12   !!##12  s! BC6C  Ccd}d} ||j|us|j |jsJd|_|jrQ|j}|dk(r |dkDr|j ||yyt t |jd|}n|j|jr |dkDr|j ||yy|js?|jjj|j|j|_|js&|jj|j |dkDr|j ||yy#t $rZ}|js|j#|dn1|jj%rt'j(ddYd}~wd}~wt*$r}|j-|Yd}~d}~wt.$r}|j#|dYd}~d}~wt0j2$r|jsYwxYw#|dkDr|j ||wwxYw)Nrprz"Fatal read error on pipe transportz*Read error on pipe transport while closingTr)r*r.rkresultrbytes memoryviewrrXrr _proactor recv_intor&add_done_callbackrConnectionAbortedErrorrhrr rdConnectionResetErrorrfrcrCancelledError)r7futrrrgs rrz(_ProactorReadPipeTransport._loop_readings. 2~~,1G15@@!%88: ZZ\F{F{##D&1A!DJJ!7!@ADJJL}}2{##D&1)<E$A E$2H0$ H--AG=H0 H-G$H0$ H-0HH0#H-*H0,H--H00I )NNNirO) rCryrzr{r$rrrrrrr~rs@rrrs/#486;64&5$ /212r>rcReZdZdZdZfdZdZd dZdZdZ dZ d Z d Z xZ S) _ProactorBaseWritePipeTransportzTransport for write pipes.Tc2t||i|d|_yrO)r#r$rjr7argskwr=s rr$z(_ProactorBaseWritePipeTransport.__init__Ns $%"%!r>ct|tttfs!t dt |j |jr td|j td|sy|jrH|jtjk\rtjd|xjdz c_ y|j*|j J|j#t|y|j s!t||_|j%y|j j'||j%y)Nz/data argument must be a bytes-like object, not zwrite_eof() already calledz(unable to write; sendfile is in progresszsocket.send() raised exception.r)r)rbrrr TypeErrortyperCr0 RuntimeErrorrjr-r!LOG_THRESHOLD_FOR_CONNLOST_WRITESr rr+r) _loop_writing_maybe_pause_protocolextend)r7rs rwritez%_ProactorBaseWritePipeTransport.writeRs$ : >?Dz**+-. .   ;< <    )IJ J  ??)"M"MM@A OOq O  ?? "<<' ''   E$K  0$T?DL  & & ( LL   %  & & (r>cN ||j |jry||jusJd|_d|_|r|j||j}d|_|sx|jr&|j j |jd|jr)|jjtj|jn|j jj|j||_|jj!sW|jdk(sJt#||_|jj%|j&|j)n%|jj%|j&|j*)|j|j*j-dyyy#t.$r}|j1|Yd}~yd}~wt2$r}|j5|dYd}~yd}~wwxYw)Nrz#Fatal write error on pipe transport)r+r.r,rr)rr2rWr0r&rorSHUT_WR_maybe_resume_protocolrsendrkrFrrrrjrlrrfrcrh)r7frrgs rrz-_ProactorBaseWritePipeTransport._loop_writingxs& J}!8T]]' ''"DO"#D  |||# ==JJ(()C)CTJ$$JJ''7 ++-"&**"6"6";";DJJ"M++-..!333*-d)D'OO55d6H6HI..0OO55d6H6HI!!-$//2I""--d33J-# #   c " " J   c#H I I Js)GF=G H$&G<< H$HH$cyNTrRs r can_write_eofz-_ProactorBaseWritePipeTransport.can_write_eofr>c$|jyrO)rYrRs r write_eofz)_ProactorBaseWritePipeTransport.write_eofs  r>c&|jdyrOrfrRs rabortz%_ProactorBaseWritePipeTransport.abort $r>c|j td|jj|_|j|jj d|jS)NzEmpty waiter is already set)rjrr create_futurer+rlrRs r_make_empty_waiterz2_ProactorBaseWritePipeTransport._make_empty_waitersY    )<= =!ZZ557 ?? "    ) )$ /!!!r>cd|_yrO)rjrRs r_reset_empty_waiterz3_ProactorBaseWritePipeTransport._reset_empty_waiters !r>NN)rCryrzr{_start_tls_compatibler$rrrrrrrr~rs@rrrHs7$ "$)L'JR ""r>rc$eZdZfdZdZxZS)_ProactorWritePipeTransportct||i||jjj |j d|_|j j|jy)N) r#r$rrrecvr&r*r _pipe_closedrs rr$z$_ProactorWritePipeTransport.__init__sO $%"%--224::rB (():):;r>cB|jry|jdk(sJ|jr|jJy||jusJ||jfd|_|j|j t y|jy)Nr>) cancelledrr.r*r+rfBrokenPipeErrorrY)r7rs rrz(_ProactorWritePipeTransport._pipe_closeds ==? zz|s""" ==>>) )) dnn$;sDNN&;;$ ?? &   o/ 0 JJLr>)rCryrzr$rr~rs@rrrs < r>rcReZdZdZ d fd ZdZdZdZd dZd dZ d dZ xZ S) _ProactorDatagramTransportic||_d|_d|_t||||||t j |_|jj|jy)Nr)r:r;) _addressrj _buffer_sizer#r$ collectionsdequer)rr2r)r7r8rr9addressr:r;r=s rr$z#_ProactorDatagramTransport.__init__s^ ! tXfEJ#((*  T//0r>ct||yrOrrMs rr%z%_ProactorDatagramTransport._set_extra $%r>c|jSrO)rrRs rrwz0_ProactorDatagramTransport.get_write_buffer_sizes   r>c&|jdyrOrrRs rrz _ProactorDatagramTransport.abortrr>crt|tttfst dt ||sy|j (|d|j fvrtd|j |jrT|j rH|jtjk\rtjd|xjdz c_y|jjt||f|xjt!|z c_|j"|j%|j'y)Nz,data argument must be bytes-like object (%r)z!Invalid address: must be None or z!socket.sendto() raised exception.r)rbrrrrrr ValueErrorr-rrr rr)rDrrFr+rr)r7raddrs rsendtoz!_ProactorDatagramTransport.sendtos$ : >?J J( (  == $dDMM5J)J3DMM?CE E ??t}})"M"MMBC OOq O  U4[$/0 SY& ?? "     ""$r>c |jry||jusJd|_|r|j|jr|jr?|jr3|j r&|j j|jdy|jj\}}|xjt|zc_ |j6|j jj|j||_n7|j jj|j|||_|jj!|j"|j%y#t&$r%}|j(j+|Yd}~yd}~wt,$r}|j/|dYd}~yd}~wwxYw)N)rz'Fatal write error on datagram transport)r-r+rr)rr.rr2rWpopleftrrFrrr&rrrrrcr3error_received Exceptionrh)r7rrrrgs rrz(_ProactorDatagramTransport._loop_writingsd *$//) ))"DO <>S(T^^-C-1]] <<"DNjjl==D000t<-==,!$dmm$D!$JD$ 00t<}}(!%!5!5!:!:4::;?=="J"&!5!5!>!>tzz?C}}"N~~)001C1CD00t< / NN ) )# . .(( ==! 00t<sN G AG !,G .B G 92H HG4/H4#HHHH!H>rxrO) rCryrzrr$r%rwrrrrr~rs@rrrs2H59$( 1&! %: *D)=r>rceZdZdZdZdZy)_ProactorDuplexPipeTransportzTransport for duplex pipes.cy)NFrrRs rrz*_ProactorDuplexPipeTransport.can_write_eofUsr>ctrO)NotImplementedErrorrRs rrz&_ProactorDuplexPipeTransport.write_eofXs!!r>N)rCryrzr{rrrr>rrrPs&"r>rcfeZdZdZej j Z dfd ZdZ dZ dZ xZ S)_ProactorSocketTransportz Transport for connected sockets.cXt|||||||tj|yrO)r#r$r _set_nodelayr6s rr$z!_ProactorSocketTransport.__init__cs( tXvufE  &r>ct||yrOrrMs rr%z#_ProactorSocketTransport._set_extrahrr>cyrrrRs rrz&_ProactorSocketTransport.can_write_eofkrr>c|js |jryd|_|j*|jj t j yyr)r.r0r+r&rorrrRs rrz"_ProactorSocketTransport.write_eofnsA ==D--   ?? " JJ   / #r>rx) rCryrzr{r _SendfileMode TRY_NATIVE_sendfile_compatibler$r%rrr~rs@rrr\s4+$22==48$(' &0r>rceZdZfdZ ddZ dddddddddZ ddZ d dZ d d Z d d Z fd Z d Z d Z dZ d!dZdZdZdZdZdZdZdZdZddZdZ d"dZdZdZdZxZS)#rct|tjd|jj ||_||_d|_i|_ |j||jtjtjur.tj |j"j%yy)NzUsing proactor: %s)r#r$r rdr=rCr _selector_self_reading_future_accept_futuresset_loop_make_self_pipe threadingcurrent_thread main_threadsignal set_wakeup_fd_csockrE)r7proactorr=s rr$zBaseProactorEventLoop.__init__xs  )8+=+=+F+FG!!$(!!$   # # %)>)>)@ @  !3!3!5 6 Ar>Nc"t||||||SrO)r)r7rr9r:r;r<s r_make_socket_transportz,BaseProactorEventLoop._make_socket_transports'dHf(-v7 7r>F) server_sideserver_hostnamer;r<ssl_handshake_timeoutssl_shutdown_timeoutc ttj||||||| | } t||| ||| jS)N)rrr;r<)r SSLProtocolr_app_transport) r7rawsockr9 sslcontextr:rrr;r<rr ssl_protocols r_make_ssl_transportz)BaseProactorEventLoop._make_ssl_transportsI  ++h F_&;%9 ; !w ',V =***r>c"t||||||SrO)r)r7rr9rr:r;s r_make_datagram_transportz.BaseProactorEventLoop._make_datagram_transports)$h*0%9 9r>c t|||||SrO)rr7rr9r:r;s r_make_duplex_pipe_transportz1BaseProactorEventLoop._make_duplex_pipe_transports+D,0(FEK Kr>c t|||||SrO)rrs r_make_read_pipe_transportz/BaseProactorEventLoop._make_read_pipe_transports)$hNNr>c t|||||SrO)rrs r_make_write_pipe_transportz0BaseProactorEventLoop._make_write_pipe_transports+4+/65J Jr>c|jr td|jrytjtj urt jd|j|j|jjd|_ d|_ t|-y)Nz!Cannot close a running event looprp) is_runningr is_closedrrr r r _stop_accept_futures_close_self_piperrYrr#)r7r=s rrYzBaseProactorEventLoop.closes ?? BC C >>    # # %)>)>)@ @   $ !!#    r>cVK|jj||d{S7wrO)rr)r7rns r sock_recvzBaseProactorEventLoop.sock_recvs#^^((q1111 )')cVK|jj||d{S7wrO)rr)r7rbufs rsock_recv_intoz$BaseProactorEventLoop.sock_recv_intos#^^--dC8888r-cVK|jj||d{S7wrO)rr)r7rbufsizes r sock_recvfromz#BaseProactorEventLoop.sock_recvfroms#^^,,T7;;;;r-crK|s t|}|jj|||d{S7wrO)rFr recvfrom_into)r7rr/nbytess rsock_recvfrom_intoz(BaseProactorEventLoop.sock_recvfrom_intos1XF^^11$VDDDDs .757cVK|jj||d{S7wrO)rr)r7rrs r sock_sendallz"BaseProactorEventLoop.sock_sendalls#^^((t4444r-cZK|jj||d|d{S7w)Nr)rr)r7rrrs r sock_sendtoz!BaseProactorEventLoop.sock_sendtos'^^**4q'BBBBs "+)+cK|jr|jdk7r td|jj ||d{S7w)Nrzthe socket must be non-blocking)_debug gettimeoutrrconnect)r7rrs r sock_connectz"BaseProactorEventLoop.sock_connectsD ;;4??,1>? ?^^++D'::::sA A A AcTK|jj|d{S7wrO)racceptrMs r sock_acceptz!BaseProactorEventLoop.sock_accepts!^^**40000s (&(cK |j} t j|j}|r|n|}|syt|d}|rt||z|n|} t||}d} t| |z |}|dkr| | dkDr|j|SS|jj||||d{||z }| |z } ^#ttjf$r}t j dd}~wwxYw#t$rt j dwxYw7g#| dkDr|j|wwxYww)Nznot a regular filerl)rEAttributeErrorioUnsupportedOperationrSendfileNotAvailableErrorosfstatst_sizercminseekrsendfile) r7rfileoffsetcountrEerrfsize blocksizeend_pos total_sents r_sock_sendfile_nativez+BaseProactorEventLoop._sock_sendfile_natives_ M[[]F MHHV$,,E#E  ;/ 05#fune,5VU#  "& 0)< >% A~ &! nn--dD&)LLL)#i'  7 78 M667KL L M M667KL L MMA~ &!shEC D6E+D$E!D$:D";D$ C=#C88C==EDE"D$$D==EcjK|j}|j|jd{ |j|j|||dd{|j |r|j SS7P7)#|j |r|j wwxYww)NF)fallback)rrr sock_sendfiler&rr)r7transprOrPrQrs r_sendfile_nativez&BaseProactorEventLoop._sendfile_natives**,''))) (++FLL$5:,<<  & & (%%' *<  & & (%%'s84B3BB3#B B  B #%B3 B %B00B3c |j!|jjd|_|jjd|_|jjd|_|xj dzc_y)Nr)rrX_ssockrYr  _internal_fdsrRs rr)z&BaseProactorEventLoop._close_self_pipesg  $ $ 0  % % , , .(,D %     ar>ctj\|_|_|jj d|jj d|xj dz c_y)NFr)r socketpairr^r  setblockingr_rRs rrz%BaseProactorEventLoop._make_self_pipesN#)#4#4#6  T[ & & ar>ct ||j|j|ury|jj|jd}||_|j |j y#tj$rYyttf$rt$r}|jd||dYd}~yd}~wwxYw)Niz.Error on reading from the event loop self pipe)r`rar8) rrrrr^r_loop_self_readingrrrrrre)r7rrgs rrdz(BaseProactorEventLoop._loop_self_readings 9} ((1##DKK6A)*D %   7 7 8((  -.     ' 'K )   s" A,&A,,B7B7B22B7c|j}|y |jdy#t$r(|jrt j ddYyYywxYw)Nz3Fail to write a null byte into the self-pipe socketTr)r rrcr=r rd)r7csocks r_write_to_selfz$BaseProactorEventLoop._write_to_self4sU   =  , JJu  ,{{ 0&*, ,s#,AAc Pdfd jy)Nc  |s|j\}}jrtjd||} j || dd|i nj ||d|ij ryjj }|j j<|jy#t$r} jdk7r9jd|tj d j!n.jrtjd d Yd}~yYd}~yYd}~yd}~wt"j$$r j!YywxYw) Nz#%r got a new connection from %r: %rTr)rr;r<rrrrpzAccept failed on a socket)r`rarzAccept failed on socket %rr)rr=r rdrrr'rrBrrErrcrer rrYrr) rconnrr9rgr8protocol_factoryr7r<rrrrs rr8z2BaseProactorEventLoop._start_serving..loopKsw# *=!"JD${{ %J%+T49/1H!-00 (JD#-t"4V2G1E 1G 33 (#-t"4V4E>>#NN))$/78$$T[[]3##D) 6;;=B&//#>%("("8"8">1 JJL[[LL!=!%66!!,,   s%BC C FA0E&FFrO)r2) r7rlrrr<backlogrrr8s ````` ``@r_start_servingz$BaseProactorEventLoop._start_servingFs $ *$ *L tr>cyrOr)r7 event_lists r_process_eventsz%BaseProactorEventLoop._process_eventsss r>c|jjD]}|j|jjyrO)rvaluesrXclear)r7futures rr(z*BaseProactorEventLoop._stop_accept_futuresws6**113F MMO4 ""$r>c|jj|jd}|r|j|jj ||j yrO)rpoprErXr _stop_servingrY)r7rrus rrxz#BaseProactorEventLoop._stop_serving|sG%%))$++->  MMO $$T* r>rxrOr)r)NNdNN)rCryrzr$rrrr r"r$rYr,r0r3r7r9r;r@rCrWr\r)rrdrhrnrqr(rxr~rs@rrrvs 7=A267 9= + $t"&!% + CG9 BF*.K @D(,OAE)-J (29<E 5C; 1": (  98,&>A-1,0+Z % r>r)$r{__all__rFrIrr|r rrrrrrr r r r logr r_FlowControlMixin BaseTransportr! ReadTransportrWriteTransportrrDatagramTransportr Transportrr BaseEventLooprrr>rrs #  0$D!=!=!+!9!9DNP2!;!+!9!9P2fk"&@&0&?&?k"\"A,A=!;!+!=!=A=H "#=#B#-#7#7 "09>)3304KK55Kr>__pycache__/constants.cpython-312.pyc000064400000001675152527367570013527 0ustar00 {|jZddlZdZdZdZdZdZdZdZd Zd Z Gd d ejZ y) N gN@g>@iii,creZdZejZejZejZy) _SendfileModeN)__name__ __module__ __qualname__enumauto UNSUPPORTED TRY_NATIVEFALLBACK*/usr/lib64/python3.12/asyncio/constants.pyrr&s)$))+KJtyy{Hrr) r !LOG_THRESHOLD_FOR_CONNLOST_WRITESACCEPT_RETRY_DELAYDEBUG_STACK_DEPTHSSL_HANDSHAKE_TIMEOUTSSL_SHUTDOWN_TIMEOUT!SENDFILE_FALLBACK_READBUFFER_SIZE FLOW_CONTROL_HIGH_WATER_SSL_READ!FLOW_CONTROL_HIGH_WATER_SSL_WRITETHREAD_JOIN_TIMEOUTEnumrrrrrs^  %&! %/!#& $'!DIIr__pycache__/exceptions.cpython-312.opt-2.pyc000064400000004623152527367570014630 0ustar00 {|j dZGddeZeZGddeZGddeZGddeZ Gd d eZ Gd d eZ y ))BrokenBarrierErrorCancelledErrorInvalidStateError TimeoutErrorIncompleteReadErrorLimitOverrunErrorSendfileNotAvailableErrorc eZdZy)rN__name__ __module__ __qualname__+/usr/lib64/python3.12/asyncio/exceptions.pyrr s+rrc eZdZy)rNr rrrrrs5rrc eZdZy)rNr rrrrrsrrc&eZdZ fdZdZxZS)rc||dn t|}t| t|d|d||_||_y)N undefinedz bytes read on a total of z expected bytes)reprsuper__init__lenpartialexpected)selfrr r_expected __class__s rrzIncompleteReadError.__init__$sE$,$4[$x.  CL>)C&<8 9   rcHt||j|jffSN)typerrrs r __reduce__zIncompleteReadError.__reduce__+sDzDLL$--888rr r r rr# __classcell__rs@rrrs !9rrc&eZdZ fdZdZxZS)rc2t||||_yr )rrconsumed)rmessager)rs rrzLimitOverrunError.__init__5s !  rcNt||jd|jffS)N)r!argsr)r"s rr#zLimitOverrunError.__reduce__9s"DzDIIaL$--888rr$r&s@rrr/s !9rrc eZdZy)rNr rrrrr=s4rrN) __all__ BaseExceptionrr Exceptionr RuntimeErrorrEOFErrorrrrrrrr4s^ ( ,], 6 6 9(9$ 9 955r__pycache__/windows_events.cpython-312.opt-1.pyc000064400000121007152527367570015520 0ustar00 {|jKdZddlZejdk7redddlZddlZddlZddlmZddl Z ddl Z ddl Z ddl Z ddl Z ddlZddlmZddlmZdd lmZdd lmZdd lmZdd lmZdd lmZddlmZddlmZdZej6Zej8ZdZdZdZdZ GddejBZ"GddejBZ#Gdde#Z$Gdde#Z%Gdde&Z'Gdd ejPZ)Gd!d"ejTZ+Gd#d$Z,Gd%d&ejZZ.e)Z/Gd'd(ej`Z1Gd)d*ej`Z2e2Z3y)+z.Selector and proactor event loops for Windows.Nwin32z win32 only)partial)events)base_subprocess)futures) exceptions)proactor_events)selector_events)tasks) windows_utils)logger)SelectorEventLoopProactorEventLoop IocpProactorDefaultEventLoopPolicyWindowsSelectorEventLoopPolicyWindowsProactorEventLoopPolicyiigMbP?g?cXeZdZdZddfd ZfdZdZd fd ZfdZfd Z xZ S) _OverlappedFuturezSubclass of Future which represents an overlapped operation. Cancelling it will immediately cancel the overlapped operation. Nloopcft|||jr |jd=||_yNr)super__init___source_traceback_ov)selfovr __class__s //usr/lib64/python3.12/asyncio/windows_events.pyrz_OverlappedFuture.__init__7s1 d#  ! !&&r*ct|}|jH|jjrdnd}|j dd|d|jj dd|S)Npending completedrz overlapped=)r _repr_inforr&insertaddressr infostater"s r#r*z_OverlappedFuture._repr_info=s\w!# 88 !%!1!1I{E KK\%4883C3CB2GqI J r$c|jy |jjd|_y#t$rM}d||d}|jr|j|d<|jj |Yd}~d|_yd}~wwxYw)Nz&Cancelling an overlapped future failedmessage exceptionfuturesource_traceback)rcancelOSErrorr_loopcall_exception_handler)r exccontexts r#_cancel_overlappedz$_OverlappedFuture._cancel_overlappedDs 88   7 HHOO  7C G %%.2.D.D*+ JJ - -g 6 6 7s1 B r$cd|_yrB)r)r futs r#_unregister_wait_cbz)_BaseWaitHandleFuture._unregister_wait_cbs r$c|jsyd|_|j}d|_ tj||jdy#t$rh}|j tj k7rAd||d}|jr|j|d<|jj|Yd}~yYd}~~d}~wwxYwNFz$Failed to unregister the wait handler1r5) rTrS _overlappedUnregisterWaitr7winerrorERROR_IO_PENDINGrr8r9rdr rVr:r;s r#_unregister_waitz&_BaseWaitHandleFuture._unregister_waits  ''     & &{ 3   & ||{;;;E!$" ))262H2HG./ 11':< sA CAB<<CcD|jt| |Sr>)rlrr6r@s r#r6z_BaseWaitHandleFuture.cancels  w~#~&&r$cD|jt| |yrB)rlrrCrDs r#rCz#_BaseWaitHandleFuture.set_exceptions  i(r$cD|jt| |yrB)rlrrFrGs r#rFz _BaseWaitHandleFuture.set_results  6"r$rB) rIrJrKrLrr]r*rdrlr6rCrFrMrNs@r#rPrPas6<8<  '  '0')##r$rPcBeZdZdZddfd ZdZfdZfdZxZS)_WaitCancelFuturezoSubclass of Future which represents a wait for the cancellation of a _WaitHandleFuture using an event. Nrc:t|||||d|_y)Nr)rr_done_callback)r r!eventrVrr"s r#rz_WaitCancelFuture.__init__s! UKd;"r$ctd)Nz'_WaitCancelFuture must not be cancelled) RuntimeErrorr\s r#r6z_WaitCancelFuture.cancelsDEEr$c`t|||j|j|yyrB)rrFrsrGs r#rFz_WaitCancelFuture.set_results/ 6"    *    % +r$c`t|||j|j|yyrB)rrCrsrDs r#rCz_WaitCancelFuture.set_exceptions/ i(    *    % +r$) rIrJrKrLrr6rFrCrMrNs@r#rqrqs'8<# F& &&r$rqc4eZdZddfd ZfdZdZxZS)_WaitHandleFutureNrct|||||||_d|_t j dddd|_d|_y)NrTF)rr _proactor_unregister_proactorrg CreateEvent_event _event_fut)r r!rUrVproactorrr"s r#rz_WaitHandleFuture.__init__sG V[t<!$(!!--dD%F r$c|j-tj|jd|_d|_|jj |j d|_t|!|yrB) rrY CloseHandlerr| _unregisterrrrd)r rcr"s r#rdz%_WaitHandleFuture._unregister_wait_cbsY ;; "    ,DK"DO ""488, #C(r$c|jsyd|_|j}d|_ tj||j|jj|j|j|_y#t $rh}|j tjk7rAd||d}|jr|j|d<|jj|Yd}~yYd}~d}~wwxYwrf)rTrSrgUnregisterWaitExrr7rirjrr8r9r| _wait_cancelrdrrks r#rlz"_WaitHandleFuture._unregister_waits  ''     ( (dkk B..55dkk6:6N6NP ||{;;;E!$" ))262H2HG./ 11':< s A?? C0AC++C0)rIrJrKrrdrlrMrNs@r#rzrzsBF)$Pr$rzc2eZdZdZdZdZdZdZdZeZ y) PipeServerzXClass representing a pipe server. This is much like a bound, listening socket. c||_tj|_d|_d|_|j d|_yNT)_addressweakrefWeakSet_free_instances_pipe_accept_pipe_future_server_pipe_handle)r r,s r#rzPipeServer.__init__s; &0 #' --d3 r$cL|j|jdc}|_|S)NF)rr)r tmps r#_get_unconnected_pipez PipeServer._get_unconnected_pipes% **d&>&>u&ETZ r$c ,|jrytjtjz}|r|tjz}tj |j |tjtjztjztjtjtjtjtj}tj|}|j j#||SrB)closedrYPIPE_ACCESS_DUPLEXFILE_FLAG_OVERLAPPEDFILE_FLAG_FIRST_PIPE_INSTANCECreateNamedPiperPIPE_TYPE_MESSAGEPIPE_READMODE_MESSAGE PIPE_WAITPIPE_UNLIMITED_INSTANCESr BUFSIZENMPWAIT_WAIT_FOREVERNULL PipeHandleradd)r firstflagshpipes r#rzPipeServer._server_pipe_handles ;;=**W-I-II  W:: :E  # # MM5  % %(E(E E      , ,  ! !=#8#8  ( (',,  8''*   & r$c|jduSrB)rr\s r#rzPipeServer.closed s %&r$c |j!|jjd|_|jJ|jD]}|j d|_d|_|jj yyrB)rr6rrcloserclear)r rs r#rzPipeServer.close#sp  # # /  $ $ + + -'+D $ == $,, -DJ DM  & & ( %r$N) rIrJrKrLrrrrr__del__r$r#rrs'4$' )Gr$rceZdZdZy)_WindowsSelectorEventLoopz'Windows version of selector event loop.N)rIrJrKrLrr$r#rr2s1r$rcDeZdZdZdfd ZfdZdZdZ ddZxZ S)rz2Windows version of proactor event loop using IOCP.c<| t}t| |yrB)rrr)r rr"s r#rzProactorEventLoop.__init__9s  #~H "r$c |j|jt| |ja|jj }|jj |'|js|jj|d|_yy#|ja|jj }|jj |'|js|jj|d|_wwxYwrB) call_soon_loop_self_readingr run_forever_self_reading_futurerr6r&r|r)r r!r"s r#rzProactorEventLoop.run_forever>s 1 NN422 3 G  !((4..22))002>"**NN..r2,0)5t((4..22))002>"**NN..r2,0)5s )BA/D cK|jj|}|d{}|}|j||d|i}||fS7%w)Naddrextra)r| connect_pipe_make_duplex_pipe_transport)r protocol_factoryr,frprotocoltranss r#create_pipe_connectionz(ProactorEventLoop.create_pipe_connectionQsZ NN ' ' 0w#%00x8>7H1Jh s!A A &A cfKtdfd jgSw)NcJd} |ri|j}jj|jr|j y}j ||dij }|yjj|}|_ |jy#t$r9|r#|jdk7r|j jYyt$rz}|r9|jdk7r&jd||d|j n$j rt#j$d|djYd}~yd}~wt&j($r|r|j YyYywxYw) NrrrzPipe accept failed)r2r3rzAccept pipe failed on pipe %rT)exc_info)rHrdiscardrrrrr| accept_piperadd_done_callbackBrokenPipeErrorfilenorr7r9_debugrwarningr CancelledError) rrrr:r,loop_accept_piperr servers r#rz>ProactorEventLoop.start_serving_pipe..loop_accept_pipe\stD) 688:D**2248}} /1H44hvw.?5A335<NN..t4*./*##$45+# 1DKKMR/JJL/0 1DKKMR///#7%( $1 JJL[[NN#B#'$8/00,, !JJL !s1A B7/B7B77?F"8F"A0E55(F"!F"rB)rr)r rr,rrs```@@r#start_serving_pipez$ProactorEventLoop.start_serving_pipeYs2G$+ 6+ 6Z '(xs*1c K|j} t||||||||f| |d| } | d{| S7#ttf$rt$r+| j | j d{7wxYww)N)waiterr) create_future_WindowsSubprocessTransport SystemExitKeyboardInterrupt BaseExceptionr_wait) r rargsshellstdinstdoutstderrbufsizerkwargsrtransps r#_make_subprocess_transportz,ProactorEventLoop._make_subprocess_transports##%,T8T5-2FFG74:%7067 LL  -.    LLN,,.  s1'A>868A>8;A;3A64A;;A>rB) rIrJrKrLrrrrrrMrNs@r#rr6s%<# 1&1j04r$rceZdZdZefdZdZdZdZd!dZ dZ e d Z e d Zd"d Zd"d Zd"d Zd"dZd#dZd"dZdZdZdZdZdZd!dZdZdZdZdZdZdZ d!dZ!dZ"dZ#d Z$y)$rz#Proactor implementation using IOCP.cd|_g|_tjtjt d||_i|_tj|_ g|_ tj|_ yrX) r8_resultsrgCreateIoCompletionPortINVALID_HANDLE_VALUEr_iocp_cacherrrT _unregistered_stopped_serving)r concurrencys r#rzIocpProactor.__init__s_   77  , ,dA{D  "??, ' 1r$c2|j tdy)NzIocpProactor is closed)rrvr\s r# _check_closedzIocpProactor._check_closeds :: 78 8 r$cdt|jzdt|jzg}|j|j dd|j j ddj|dS)Nzoverlapped#=%sz result#=%sr< r))lenrrrrar"rIjoin)r r.s r#__repr__zIocpProactor.__repr__s_ 3t{{#33s4==113 ::  KK ! NN33SXXd^DDr$c||_yrB)r8)r rs r#set_loopzIocpProactor.set_loops  r$Ncz|js|j||j}g|_ |d}S#d}wxYwrB)rr])r timeoutrs r#selectzIocpProactor.selects:}} JJw mm  C$Cs6:c\|jj}|j||SrB)r8rrF)r valuercs r#_resultzIocpProactor._results%jj&&( u r$c |jS#t$rD}|jtjtj fvrt |jd}~wwxYwrB) getresultr7rirgERROR_NETNAME_DELETEDERROR_OPERATION_ABORTEDConnectionResetErrorr)rkeyr!r:s r#finish_socket_funczIocpProactor.finish_socket_funcsY <<> ! || A A + C C EE*CHH55  s A?AAc |j|||S#t$r,}|jtjk(r |dfcYd}~Sd}~wwxYwrB)rr7rirgERROR_PORT_UNREACHABLE)clsrrr! empty_resultr:s r#_finish_recvfromzIocpProactor._finish_recvfromsN ))%b9 9 ||{AAA#T))  s A  AA AA c|j|tjt} t |t j r"|j |j||n |j|j||j|||jS#t$r|jdcYSwxYw)Nr$) _register_with_iocprg Overlappedr isinstancesocketWSARecvrReadFilerr _registerrr connnbytesrr!s r#recvzIocpProactor.recvs   &  # #D ) %$ . 4;;=&%8 DKKM62~~b$(?(?@@ %<<$ $ %AB%%CCc|j|tjt} t |t j r"|j |j||n |j|j||j|||jS#t$r|jdcYSwxYwrX) r rgr rr r  WSARecvIntor ReadFileIntorrrrr rbufrr!s r# recv_intozIocpProactor.recv_intos   &  # #D ) #$ .t{{}c59 s3~~b$(?(?@@ #<<? " #rc*|j|tjt} |j |j |||j||t|jdS#t $r|jdcYSwxYw)N)r$Nr$r) r rgr r WSARecvFromrrrrrrrs r#recvfromzIocpProactor.recvfroms   &  # #D ) - NN4;;=&% 8~~b$0E0E=@)BC C -<< , , -!A55BBc*|j|tjt} |j |j |||j||t|jdS#t $r|jdcYSwxYw)NrNrr) r rgr rWSARecvFromIntorrrrrrrs r# recvfrom_intozIocpProactor.recvfrom_intos   &  # #D ) +   t{{}c5 9~~b$0E0E=>)@A A +<< * * +rc|j|tjt}|j |j ||||j |||jSrB)r rgr r WSASendTorrr)r rrrrr!s r#sendtozIocpProactor.sendtosQ   &  # #D ) T[[]C5~~b$(?(?@@r$cH|j|tjt}t |t j r"|j |j||n |j|j||j|||jSrB) r rgr rr r WSASendr WriteFilerrrs r#sendzIocpProactor.sendsq   &  # #D ) dFMM * JJt{{}c5 1 LL ,~~b$(?(?@@r$c||j|jjtjt }|j jjfd}d}|j||}||}tj||j|S)Nc,|jtjdj}j t j tj|jjjfS)Nz@P) rstructpackr setsockoptr  SOL_SOCKETrgSO_UPDATE_ACCEPT_CONTEXT settimeout gettimeout getpeername)rrr!rrlisteners r# finish_acceptz*IocpProactor.accept..finish_accept*sl LLN++dHOO$56C OOF--'@@# G OOH//1 2))++ +r$cvK |d{y7#tj$r|jwxYwwrB)r rr)r4rs r# accept_coroz(IocpProactor.accept..accept_coro3s2  ,,   s 99%69r) r _get_accept_socketfamilyrgr rAcceptExrrr ensure_futurer8)r r5r!r6r8r4corors ` @r#acceptzIocpProactor.accept$s   *&&x7  # #D ) HOO%t{{}5 , Hm<64( Dtzz2 r$cjtjk(rQtjj ||j j}|jd|S|j tjj jtj"t$}|j'j |fd}|j)||S#t$r?}|jtjk7rj!ddk(rYd}~d}~wwxYw)Nrrc|jjtjtj dSrX)rr/r r0rgSO_UPDATE_CONNECT_CONTEXT)rrr!rs r#finish_connectz,IocpProactor.connect..finish_connectVs1 LLN OOF--'AA1 FKr$)typer  SOCK_DGRAMrg WSAConnectrr8rrFr  BindLocalr:r7rierrno WSAEINVAL getsocknamer r ConnectExr)r rr,rcer!rBs ` r#connectzIocpProactor.connect@s 99)) )  " "4;;=' :****,C NN4 J   &   ! !$++- = # #D ) T[[]G, ~~b$77! zzU__,!!$)*  s.D E  5EE c 6|j|tjt}|dz}|dz dz}|j |j t j|j |||dd|j|||jS)Nl r) r rgr r TransmitFilermsvcrt get_osfhandlerr)r sockfileoffsetcountr! offset_low offset_highs r#sendfilezIocpProactor.sendfile_s   &  # #D )k) |{2   ,,T[[];"Kq! % ~~b$(?(?@@r$c|jtjt}|j j }|r|j Sfd}|j||S)Nc(|jSrB)r)rrr!rs r#finish_accept_pipez4IocpProactor.accept_pipe..finish_accept_pipevs LLNKr$)r rgr rConnectNamedPiperrr)r rr! connectedr[s ` r#rzIocpProactor.accept_pipeksf   &  # #D )'' 6 <<% % ~~b$(:;;r$c<Kt} tj|} tj|S#t$r(}|jtj k7rYd}~nd}~wwxYwt |dzt}tj|d{7w)N) CONNECT_PIPE_INIT_DELAYrg ConnectPiper7riERROR_PIPE_BUSYminCONNECT_PIPE_MAX_DELAYr sleepr r)r r,delayrUr:s r#rzIocpProactor.connect_pipe|s' $009''// <<;#>#>>?   #9:E++e$ $ $s6B6B A'A"B"A''.BBBc(|j||dS)zWait for a handle. Return a Future object. The result of the future is True if the wait completed, or False if the wait did not complete (on timeout). F)_wait_for_handle)r rUrs r#wait_for_handlezIocpProactor.wait_for_handles $$VWe<.finish_wait_for_handles779 r$r)rrYINFINITEmathceilrgr rRegisterWaitWithQueuerr,rqr8rzrr) r rUr _is_cancelmsr!rVrors @r#rhzIocpProactor._wait_for_handles  ?!!B7S=)B # #D )!77 DJJ B0 !"fk KA!"fk4'+zz3A  ##B' $%b!-C"D BJJr$c||jvrL|jj|tj|j |j ddyyrX)rTrrgrrrr objs r#r z IocpProactor._register_with_iocpsI d&& &     %  . .szz|TZZA N 'r$c^|jt||j}|jr |jd=|js |dd|}|j |||||f|j|j<|S#t $r}|j|Yd}~>d}~wwxYwr) rrr8rr&rFr7rCrr,)r r!rxcallbackrrrKs r#rzIocpProactor._registers  btzz 2  ##B'zz  $ tR0 U#$%b#x"8 BJJ #"" #s B B,B''B,cZ|j|jj|y)a Unregister an overlapped object. Call this method when its future has been cancelled. The event can already be signalled (pending in the proactor event queue). It is also safe if the event is never signalled (because it was cancelled). N)rrra)r r!s r#rzIocpProactor._unregisters$  !!"%r$cRtj|}|jd|SrX)r r2)r r:ss r#r9zIocpProactor._get_accept_sockets MM& ! Qr$c "|t}n<|dkr tdtj|dz}|tk\r td t j |j |}|nd}|\}}}} |jj|\}} } } | |j vr|j#nI|j%s9 | ||| } |j'| |j(j+|d}|j0D](} |jj| j2d*|j0j5y#t$rl|jjr%|jjdd||||fzd|dtjfvrtj|Y}wxYw#t,$r7} |j/| |j(j+|Yd} ~ d} ~ wwxYw#d}wxYw)Nrznegative timeoutrmztimeout too bigz8GetQueuedCompletionStatus() returned an unexpected eventz)err=%s transferred=%s key=%#x address=%#x)r2status)rp ValueErrorrqrrrgGetQueuedCompletionStatusrrpopKeyErrorr8 get_debugr9rrYrrr6donerFrrar7rCrr,r)r rrurerr transferredrr,rr!rxrzrrKs r#r]zIocpProactor._polls ?B q[/0 07S=)BX~ !233 ::4::rJF~B-3 *Cc7 '+{{w'?$2sH d+++ VVX $[#r:E LL'MM((+AMR$$B KKOOBJJ -%   "E ::'')JJ55%7#N&);W%E$F7q+"B"BCC'', ,,OOA&MM((++,AsC4 E G,H A1GG H,H<H HH Hc:|jj|yrB)rrrws r# _stop_servingzIocpProactor._stop_serving2s !!#&r$c4|jyt|jjD]:\}}}}|j rt |t r* |j<d}tj}||z} |jrx| tjkrCtjd|tj|z tj|z} |j!||jrxg|_t%j&|jd|_y#t$rS}|j>++ K!4>>#3j#@B>>+j8 JJz "kk DJJ' ; Czz-'C),&)# 00:=:O:OG$67 99'B CsD;; FAFFc$|jyrB)rr\s r#rzIocpProactor.__del__gs  r$rB)rr!)%rIrJrKrLrprrrrrr staticmethodr classmethodrrrrr#r&r*r>rLrXrrrirrhr rrr9r]rrrrr$r#rrs-#+29E     A A C AAA88> A<"0&= DO@& 7#r' -^r$rceZdZdZy)rc tj|f|||||d|_fd}jjj t jj} | j|y)N)rrrrrc\jj}j|yrB)_procpoll_process_exited)r returncoder s r#rzz4_WindowsSubprocessTransport._start..callbackrs!*J   ,r$) r Popenrr8r|riintrRr) r rrrrrrrrzrs ` r#_startz"_WindowsSubprocessTransport._startmso"(( 'U6&'%'  - JJ 0 0TZZ5G5G1H I H%r$N)rIrJrKrrr$r#rrks &r$rceZdZeZy)rN)rIrJrKr _loop_factoryrr$r#rr}%Mr$rceZdZeZy)rN)rIrJrKrrrr$r#rrrr$r)4rLsysplatform ImportErrorrgrYrG functoolsrrqrPr r-rrrrrr r r r r logr__all__rrpERROR_CONNECTION_REFUSEDERROR_CONNECTION_ABORTEDr`rdFuturerrPrqrzobjectrBaseSelectorEventLooprBaseProactorEventLooprrBaseSubprocessTransportrrBaseDefaultEventLoopPolicyrrrrr$r#rs\4 <<7 l ##   ||    --`G#GNNG#T&-&01P-1Ph88v2 E E2g==gTHHV &/"I"I &.&V%F%F&&V%F%F&8r$__pycache__/log.cpython-312.opt-2.pyc000064400000000370152527367570013223 0ustar00 {|j|2 ddlZejeZy)N)logging getLogger __package__logger$/usr/lib64/python3.12/asyncio/log.pyr s   ; 'r__pycache__/base_subprocess.cpython-312.opt-2.pyc000064400000036646152527367570015643 0ustar00 {|j"ddlZddlZddlZddlmZddlmZddlmZGddejZ Gdd ejZ Gd d e ejZ y) N) protocols) transports)loggerceZdZ dfd ZdZdZdZdZdZdZ e jfdZ d Z d Zd Zd Zd ZdZdZdZdZdZdZdZdZdZdZxZS)BaseSubprocessTransportc nt || d|_||_||_d|_d|_d|_g|_tj|_ i|_ d|_ |tjk(rd|jd<|tjk(rd|jd<|tjk(rd|jd< |j d||||||d| |j j$|_|j |j&d<|jj)r?t+|t,t.fr|} n|d} t1j2d| |j |jj5|j7| y#|j#xYw) NFrr)argsshellstdinstdoutstderrbufsize subprocesszprocess %r created: pid %s)super__init___closed _protocol_loop_proc_pid _returncode _exit_waiters collectionsdeque_pending_calls_pipes _finishedrPIPE_startclosepid_extra get_debug isinstancebytesstrrdebug create_task_connect_pipes)selfloopprotocolr r r rrrwaiterextrakwargsprogram __class__s 0/usr/lib64/python3.12/asyncio/base_subprocess.pyrz BaseSubprocessTransport.__init__ sx  !   )//1  JOO #!DKKN Z__ $!DKKN Z__ $!DKKN  DKK BTeF%w B:@ B JJNN $(JJ L! ::   !$ -q' LL5 $)) - t226:;  JJL s F!!F4c^|jjg}|jr|jd|j|jd|j|j |jd|j n/|j|jdn|jd|j jd}||jd|j|j jd}|j jd }|#||ur|jd |jn@||jd |j||jd |jd jdj|S)Nclosedzpid=z returncode=runningz not startedrzstdin=rr zstdout=stderr=zstdout=zstderr=z<{}> ) r4__name__rappendrrrgetpipeformatjoin)r-infor rrs r5__repr__z BaseSubprocessTransport.__repr__7sX''( << KK ! 99 KK$tyyk* +    ' KK+d&6&6%78 9 YY " KK " KK & "   KK& - .##  &F"2 KK. 6 7! gfkk]34! gfkk]34}}SXXd^,,c tN)NotImplementedError)r-r r r rrrr2s r5r"zBaseSubprocessTransport._startTs!!rBc||_yrDr)r-r/s r5 set_protocolz$BaseSubprocessTransport.set_protocolWs !rBc|jSrDrGr-s r5 get_protocolz$BaseSubprocessTransport.get_protocolZs ~~rBc|jSrD)rrJs r5 is_closingz"BaseSubprocessTransport.is_closing]s ||rBc|jryd|_|jjD]}||jj !|j t|j g|j jL|jjrtjd| |j jyyyy#t$rYywxYw)NTz$Close running child process: kill %r)rrvaluesr=r#rrpollrr&rwarningkillProcessLookupError)r-protos r5r#zBaseSubprocessTransport.close`s <<  [['')E} JJ   * JJ "  ( !)zz##%EtL  ! *) #&  s4C CCcb|js#|d|t||jyy)Nzunclosed transport )source)rResourceWarningr#)r-_warns r5__del__zBaseSubprocessTransport.__del__{s+|| 'x0/$ O JJLrBc|jSrD)rrJs r5get_pidzBaseSubprocessTransport.get_pids yyrBc|jSrD)rrJs r5get_returncodez&BaseSubprocessTransport.get_returncodesrBcR||jvr|j|jSyrD)rr=)r-fds r5get_pipe_transportz*BaseSubprocessTransport.get_pipe_transports%  ;;r?'' 'rBc0|j tyrD)rrSrJs r5 _check_procz#BaseSubprocessTransport._check_procs :: $& & rBcZ|j|jj|yrD)rbr send_signal)r-signals r5rdz#BaseSubprocessTransport.send_signals   v&rBcX|j|jjyrD)rbr terminaterJs r5rgz!BaseSubprocessTransport.terminates  rBcX|j|jjyrD)rbrrRrJs r5rRzBaseSubprocessTransport.kills  rBcK j}j}|j9|jfd|jd{\}}|jd<|j 9|j fd|j d{\}}|jd<|j9|j fd|jd{\}}|jd<|jjjjD]\}}|j|g|d_ |#|js|jdyyy777#ttf$rt $r7}|+|js|j#|Yd}~yYd}~yYd}~yd}~wwxYww)NctdS)Nr)WriteSubprocessPipeProtorJsr5z8BaseSubprocessTransport._connect_pipes..s 4T1=rBrctdS)NrReadSubprocessPipeProtorJsr5rlz8BaseSubprocessTransport._connect_pipes.. 3D!.rprBr )rrr connect_write_piperrconnect_read_piper call_soonrconnection_mader cancelled set_result SystemExitKeyboardInterrupt BaseException set_exception) r-r0procr._r=callbackdataexcs ` r5r,z&BaseSubprocessTransport._connect_pipess# (::D::Dzz% $ 7 7=JJ!  4"& A{{& $ 6 6<KK!!!4"& A{{& $ 6 6<KK!!!4"& A NN4>>994 @"&"5"5$x/$/#6"&D !&*:*:*<!!$'+=!; ! !-.   *!&*:*:*<$$S))+=! *shF?AE- E& AE-E)AE-E+A*E-&F?&E-)E-+E--F<#F7(F?7F<<F?c|j|jj||fy|jj|g|yrD)rr;rrt)r-cbrs r5_callzBaseSubprocessTransport._calls?    *    & &Dz 2 DJJ  +d +rBcr|j|jj|||jyrD)rrpipe_connection_lost _try_finish)r-r_rs r5_pipe_connection_lostz-BaseSubprocessTransport._pipe_connection_losts( 4>>66C@ rBcR|j|jj||yrD)rrpipe_data_received)r-r_rs r5_pipe_data_receivedz+BaseSubprocessTransport._pipe_data_receiveds 4>>44b$?rBc,|jjrtjd||||_|j j ||j _|j|jj|jy)Nz%r exited with return code %r) rr&rr@rr returncoderrprocess_exitedr)r-rs r5_process_exitedz'BaseSubprocessTransport._process_exitedsm ::   ! KK7z J% :: (%/DJJ ! 4>>001 rBcK |j |jS|jj}|jj ||d{S7wrD)rr create_futurerr;)r-r0s r5_waitzBaseSubprocessTransport._waitsU '    '## #))+ !!&)||sAAAAc|jytd|jjDr$d|_|j |j dyy)Nc3@K|]}|duxr |jywrD) disconnected).0ps r5 z6BaseSubprocessTransport._try_finish..s(.,1}//,sT)rallrrOr r_call_connection_lostrJs r5rz#BaseSubprocessTransport._try_finishsS    #  . **,. .!DN JJt114 8 .rBc |jj||jD].}|jr|j |j 0d|_d|_d|_d|_y#|jD].}|jr|j |j 0d|_d|_d|_d|_wxYwrD)rconnection_lostrrvrwrrr)r-rr0s r5rz-BaseSubprocessTransport._call_connection_losts " NN * *3 /,,'')%%d&6&67-"&D DJDJ!DN ,,'')%%d&6&67-"&D DJDJ!DNsA77 C:C)NN)r: __module__ __qualname__rrAr"rHrKrMr#warningswarnrYr[r]r`rbrdrgrRr,rrrrrrr __classcell__)r4s@r5rr s%)))r4r:r_r=rJs r5rAz!WriteSubprocessPipeProto.__repr__ s04>>**+4ytyym1MMrBcld|_|jj|j|d|_y)NT)rr|rr_)r-rs r5rz(WriteSubprocessPipeProto.connection_lost s)  ''5 rBcL|jjjyrD)r|r pause_writingrJs r5rz&WriteSubprocessPipeProto.pause_writings ))+rBcL|jjjyrD)r|rresume_writingrJs r5rz'WriteSubprocessPipeProto.resume_writings **,rBN) r:rrrrurArrrrrBr5rkrks!" N ,-rBrkceZdZdZy)rocP|jj|j|yrD)r|rr_)r-rs r5 data_receivedz%ReadSubprocessPipeProto.data_receiveds %%dggt4rBN)r:rrrrrBr5roros5rBro)rrrrrlogrSubprocessTransportr BaseProtocolrkProtocolrorrBr5rsTr"j<<r"j-y55-456'005rB__pycache__/sslproto.cpython-312.opt-2.pyc000064400000111753152527367570014337 0ustar00 {|j|zddlZddlZddlZ ddlZddlmZddlmZddlmZddlm Z ddl m Z eejejfZGdd ejZGd d ejZd Zd ZGdde j(e j*ZGddej.Zy#e$rdZYwxYw)N) constants) exceptions) protocols) transports)loggerc eZdZdZdZdZdZdZy)SSLProtocolState UNWRAPPED DO_HANDSHAKEWRAPPEDFLUSHINGSHUTDOWNN)__name__ __module__ __qualname__r r r rr)/usr/lib64/python3.12/asyncio/sslproto.pyr r sI!LGHHrr ceZdZdZdZdZdZy)AppProtocolState STATE_INITSTATE_CON_MADE STATE_EOFSTATE_CON_LOSTN)rrrrrrrrrrrrsJ%NI%NrrcZ|r tdtj}|sd|_|S)Nz(Server side SSL needs a valid SSLContextF) ValueErrorsslcreate_default_contextcheck_hostname) server_sideserver_hostname sslcontexts r_create_transport_contextr$/s2CDD ++-J $) ! rc|||dz}n |}d|z}n|}||dz}n|}||cxk\rdk\sntd|d|d||fS)Nirzhigh (z) must be >= low (z) must be >= 0)r)highlowkbhilos radd_flowcontrol_defaultsr,=sh | ;dBBRB  { 1W  =q=b"# # r6MrceZdZdZej j ZdZddZ dZ dZ dZ dZ efd Zd Zd Zd Zdd ZdZdZddZdZdZedZdZdZdZdZdZdZ dZ!y)_SSLProtocolTransportTc.||_||_d|_yNF)_loop _ssl_protocol_closed)selfloop ssl_protocols r__init__z_SSLProtocolTransport.__init__Xs ) rNc< |jj||SN)r2_get_extra_infor4namedefaults rget_extra_infoz$_SSLProtocolTransport.get_extra_info]s1!!11$@@rc:|jj|yr9)r2_set_app_protocol)r4protocols r set_protocolz"_SSLProtocolTransport.set_protocolas ,,X6rc.|jjSr9)r2 _app_protocolr4s r get_protocolz"_SSLProtocolTransport.get_protocolds!!///rcR|jxs|jjSr9)r3r2_is_transport_closingrEs r is_closingz _SSLProtocolTransport.is_closinggs ||It11GGIIrcp |js"d|_|jjyd|_yNT)r3r2_start_shutdownrEs rclosez_SSLProtocolTransport.closejs1 ||DL    . . 0!%D rcX|jsd|_|jdtyy)NTz9unclosed transport )r3warnResourceWarning)r4 _warningss r__del__z_SSLProtocolTransport.__del__xs)||DL NN* ,rc0|jj Sr9)r2_app_reading_pausedrEs r is_readingz _SSLProtocolTransport.is_readings%%9999rc: |jjyr9)r2_pause_readingrEs r pause_readingz#_SSLProtocolTransport.pause_readings ))+rc: |jjyr9)r2_resume_readingrEs rresume_readingz$_SSLProtocolTransport.resume_readings **,rcr |jj|||jjyr9)r2_set_write_buffer_limits_control_app_writingr4r'r(s rset_write_buffer_limitsz-_SSLProtocolTransport.set_write_buffer_limitss1 $ 33D#> //1rcZ|jj|jjfSr9)r2_outgoing_low_water_outgoing_high_waterrEs rget_write_buffer_limitsz-_SSLProtocolTransport.get_write_buffer_limits*""66""779 9rc8 |jjSr9)r2_get_write_buffer_sizerEs rget_write_buffer_sizez+_SSLProtocolTransport.get_write_buffer_sizes;!!88::rcr |jj|||jjyr9)r2_set_read_buffer_limits_control_ssl_readingr_s rset_read_buffer_limitsz,_SSLProtocolTransport.set_read_buffer_limitss1 $ 224= //1rcZ|jj|jjfSr9)r2_incoming_low_water_incoming_high_waterrEs rget_read_buffer_limitsz,_SSLProtocolTransport.get_read_buffer_limitsrerc8 |jjSr9)r2_get_read_buffer_sizerEs rget_read_buffer_sizez*_SSLProtocolTransport.get_read_buffer_sizes9!!7799rc.|jjSr9)r2_app_writing_pausedrEs r_protocol_pausedz&_SSLProtocolTransport._protocol_pauseds!!555rc t|tttfs!t dt |j |sy|jj|fy)Nz+data: expecting a bytes-like instance, got ) isinstancebytes bytearray memoryview TypeErrortyperr2_write_appdatar4datas rwritez_SSLProtocolTransport.writes] $ : >?##':#6#6"79: :  ))4'2rc< |jj|yr9)r2r~)r4 list_of_datas r writelinesz _SSLProtocolTransport.writeliness )),7rc tr9)NotImplementedErrorrEs r write_eofz_SSLProtocolTransport.write_eofs "!rc yr0rrEs r can_write_eofz#_SSLProtocolTransport.can_write_eofsOrc( |jdyr9) _force_closerEs rabortz_SSLProtocolTransport.aborts $rcbd|_|j|jj|yyrK)r3r2_abortr4excs rrz"_SSLProtocolTransport._force_closes.    )    % %c * *rc|jjj||jxjt |z c_yr9)r2_write_backlogappend_write_buffer_sizelenrs r_test__append_write_backlogz1_SSLProtocolTransport._test__append_write_backlogs7 ))006 --T:-rr9NN)"rrr_start_tls_compatibler _SendfileModeFALLBACK_sendfile_compatibler7r>rBrFrIrMwarningsrRrUrXr[r`rdrhrlrprspropertyrvrrrrrrrrrrr.r.Rs!$22;; A70J &!),:,-2,9;2,9:66 38" + ;rr.c eZdZdZdZdZdZ d+dZdZd,dZ dZ dZ dZ d Z d Zd Zd Zd,d ZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZ dZ!dZ"dZ#d Z$d!Z%d-d"Z&d#Z'd$Z(d%Z)d-d&Z*d'Z+d(Z,d)Z-d.d*Z.y)/ SSLProtocoliNc t tdt|j|_t |j|_|tj}n|dkrtd|| tj} n| dkrtd| |s t||}||_ |r |s||_ nd|_ ||_t||_t#j$|_d|_||_||_|j/|d|_d|_d|_||_| |_tj:|_tj:|_t@jB|_"d|_#|rtHjJ|_&ntHjN|_&|jjQ|j<|j>|j|j|_)d|_*d|_+d|_,d|_-d|_.|j_d|_0d|_1d|_2d|_3|ji|jky)Nzstdlib ssl module not availablerz7ssl_handshake_timeout should be a positive number, got z6ssl_shutdown_timeout should be a positive number, got )r#F)r!r")6r RuntimeErrorrzmax_size _ssl_bufferr{_ssl_buffer_viewrSSL_HANDSHAKE_TIMEOUTrSSL_SHUTDOWN_TIMEOUTr$ _server_side_server_hostname _sslcontextdict_extra collectionsdequerr_waiterr1r@_app_transport_app_transport_created _transport_ssl_handshake_timeout_ssl_shutdown_timeout MemoryBIO _incoming _outgoingr r _state _conn_lostrr _app_staterwrap_bio_sslobj_ssl_writing_pausedrT_ssl_reading_pausedrornrj _eof_receivedrurcrbr]_get_app_transport) r4r5 app_protocolr#waiterr!r"call_connection_madessl_handshake_timeoutssl_shutdown_timeouts rr7zSSLProtocol.__init__sE ;@A A$T]]3 *4+;+; < ($-$C$C ! "a ',-/0 0 '#,#A#A !Q &+,./ /2_.J( ;$3D !$(D !%j1 *//1"#   |,"&+#&;#%9"&00  .99DO.==DO''00 NNDNN)) 1113 $) #( #( $%!#$  $$&"#( $%!#$  %%' !rc||_t|drDt|tjr*|j |_|j|_d|_ yd|_ y)N get_bufferTF) rDhasattrrxrBufferedProtocolr_app_protocol_get_bufferbuffer_updated_app_protocol_buffer_updated_app_protocol_is_buffer)r4rs rr@zSSLProtocol._set_app_protocolasP) L, /<)C)CD,8,C,CD )0<0K0KD -+/D (+0D (rc|jy|jjs@|#|jj|d|_y|jjdd|_yr9)r cancelled set_exception set_resultrs r_wakeup_waiterzSSLProtocol._wakeup_waiterlsZ <<  ||%%' **3/  ''- rc|j9|jr tdt|j||_d|_|jS)Nz$Creating _SSLProtocolTransport twiceT)rrrr.r1rEs rrzSSLProtocol._get_app_transportvsJ    &**"#IJJ"7 D"ID *.D '"""rcV|jduxr|jjSr9)rrIrEs rrHz!SSLProtocol._is_transport_closing~s#d*Kt/I/I/KKrc4 ||_|jyr9)r_start_handshake)r4 transports rconnection_madezSSLProtocol.connection_mades $ rcJ |jj|jj|xjdz c_|j d|j _|jtjk7r|jtjk(s|jtjk(rEtj|_ |jj!|j"j$||j'tj(d|_d|_d|_|j-||j.r!|j.j1d|_|j2r"|j2j1d|_yy)NrT)rclearrreadrrr3rr r rrrrrr1 call_soonrDconnection_lost _set_stater rr_shutdown_timeout_handlecancel_handshake_timeout_handlers rrzSSLProtocol.connection_losts> !!#  1    **.D   ' ;;*77 7#3#B#BB#3#=#=="2"A"A $$T%7%7%G%GM (223"! C  ( (  ) ) 0 0 2,0D )  ) )  * * 1 1 3-1D * *rc|}|dks||jkDr |j}t|j|kr*t||_t |j|_|j SNr)rrrrzr{r)r4nwants rrzSSLProtocol.get_buffers` 19t}},==D t 4 '(D $.t/?/?$@D !$$$rc|jj|jd||jtj k(r|j y|jtjk(r|jy|jtjk(r|jy|jtjk(r|jyyr9) rrrrr r _do_handshaker _do_readr _do_flushr _do_shutdown)r4nbytess rrzSSLProtocol.buffer_updateds T227F;< ;;*77 7    [[,44 4 MMO [[,55 5 NN  [[,55 5    6rc d|_ |jjrtjd||j t jk(r|jty|j t jk(r=|jt j|jry|jy|j t jk(r@|j|jt j |j#y|j t j k(r|j#yy#t$$r|j&j)wxYw)NTz%r received EOF)rr1 get_debugrdebugrr r _on_handshake_completeConnectionResetErrorr rrrTr _do_writerr ExceptionrrMrEs r eof_receivedzSSLProtocol.eof_receiveds " zz##% .5{{.;;;++,@A 0 8 88 0 9 9:++NN$ 0 9 99  0 9 9:!!# 0 9 99!!#:  OO ! ! #  s&A"E-AE6EAE$-E%E8c||jvr|j|S|j|jj||S|Sr9)rrr>r;s rr:zSSLProtocol._get_extra_infosC 4;; ;;t$ $ __ (??11$@ @Nrc&d}|tjk(rd}n|jtjk(r|tjk(rd}n|jtjk(r|tjk(rd}ne|jtjk(r|tj k(rd}n2|jtj k(r|tj k(rd}|r||_ytdj|j|)NFTz!cannot switch state from {} to {}) r r rr r rrrformat)r4 new_statealloweds rrzSSLProtocol._set_states (22 2G KK+55 5 )66 6G KK+88 8 )11 1G KK+33 3 )22 2G KK+44 4 )22 2G #DK3::KK,- -rcnjjr6tjdjj _nd_j tjjjjfd_ jy)Nz%r starts SSL handshakec$jSr9)_check_handshake_timeoutrEsrz.SSLProtocol._start_handshake..$s$*G*G*Ir) r1rrrtime_handshake_start_timerr r call_laterrrrrEs`rrzSSLProtocol._start_handshakes ::   ! LL2D 9)-):D &)-D & (556 JJ ! !$"="="I K & rc|jtjk(r+d|jd}|j t |yy)Nz$SSL handshake is taking longer than z! seconds: aborting the connection)rr r r _fatal_errorConnectionAbortedError)r4msgs rrz$SSLProtocol._check_handshake_timeout(sN ;;*77 76../0*+    4S9 : 8rc |jj|jdy#t$r|j Yyt j $r}|j|Yd}~yd}~wwxYwr9)r do_handshakerSSLAgainErrors_process_outgoingrSSLErrorrs rrzSSLProtocol._do_handshake1sb . LL % % '  ' ' -  %  " " $|| -  ' ' , , -s.A6 A6A11A6c|j!|jjd|_|j} | |jtj n||j }|jjrA|jj!|j"z }t%j&d||dz|j(j+||j-|j/||j0t2j4k(r>t2j6|_|j8j;|j=|j|j?y#t$rm}d}|jtjt|tjrd}nd}|j|||j|Yd}~yd}~wwxYw)Nz1SSL handshake failed on verifying the certificatezSSL handshake failedz%r: SSL handshake took %.1f msg@@)peercertcipher compression ssl_object) rrrrr r getpeercertrr rxrCertificateErrorrrr1rrrrrrupdater r rrrrrDrrr)r4 handshake_excsslobjr rrdts rrz"SSLProtocol._on_handshake_complete;s  ) ) 5  * * 1 1 3-1D * $ 0 8 89##))+H ::   !"T%?%??B LL94c J H"(--/'-'9'9';&,  . ??.99 9.==DO    . .t/F/F/H I  1  M OO,66 7#s334I,   c3 '    $  s4F G7 A#G22G7cjtjtjtjfvryj dj _jtjk(rjdyjtjjjjfd_ jy)NTc$jSr9)_check_shutdown_timeoutrEsrrz-SSLProtocol._start_shutdown..us446r)rr rrr rr3r rrr1rrrrrEs`rrLzSSLProtocol._start_shutdownds KK )) )) **      **.D   ' ;;*77 7 KK  OO,55 6,0JJ,A,A**6-D ) NN rc|jtjtjfvr/|jj t jdyy)NzSSL shutdown timed out)rr rrrrr TimeoutErrorrEs rrz#SSLProtocol._check_shutdown_timeoutysN KK )) ))  OO ( (''(@A C  rc|j|jtj|j yr9)rrr rrrEs rrzSSLProtocol._do_flushs*  (112 rcJ |js|jj|j|j |j dy#t $r|jYytj$r}|j |Yd}~yd}~wwxYwr9) rrunwrapr_call_eof_received_on_shutdown_completerrrrs rrzSSLProtocol._do_shutdowns -%% ##%  " " $  # # %  & &t , %  " " $|| ,  & &s + + ,s&AB"5B"BB"c|j!|jjd|_|r|j|y|jj |j j yr9)rrrr1rrrM)r4 shutdown_excs rrz!SSLProtocol._on_shutdown_completesU  ( ( 4  ) ) 0 0 2,0D )    l + JJ !6!6 7rc|jtj|j|jj |yyr9)rr r rrrs rrzSSLProtocol._aborts6 (223 ?? & OO ( ( - 'rc8|jtjtjtjfvrH|j t jk\rtjd|xj dz c_y|D];}|jj||xjt|z c_ = |jtjk(r|jyy#t $r}|j#|dYd}~yd}~wwxYw)NzSSL connection is closedrFatal error on SSL protocol)rr rrr rr!LOG_THRESHOLD_FOR_CONNLOST_WRITESrwarningrrrrr rrr)r4rrexs rr~zSSLProtocol._write_appdatas KK )) )) **  )"M"MM9: OOq O  D    & &t ,  # #s4y 0 #! A{{.666 7 A   b"? @ @ As-C44 D=DDc~ |jr|jd}|jj|}t|}||kr(||d|jd<|xj|zc_n"|jd=|xj|zc_|jr|j y#t $rYwxYwr)rrrrrrr)r4rcountdata_lens rrzSSLProtocol._do_writes %%**1- **40t98#-1%&\D''*++u4+++A.++x7+%%     sBB00 B<;B<c|js@|jj}t|r|jj ||j yr9)rrrrrrr^rs rrzSSLProtocol._process_outgoingsB''>>&&(D4y%%d+ !!#rc|jtjtjfvry |jsZ|j r|j n|j|jr|jn|j|jy#t$r}|j|dYd}~yd}~wwxYw)Nr!)rr r rrTr_do_read__buffered_do_read__copiedrrrrkrr)r4r$s rrzSSLProtocol._do_reads KK (( ))    A++//++-))+&&NN$**,  % % ' A   b"? @ @ AsA6B&& C /CC cd}d}jj}t|} jj ||}|dkDrY|}||kr4jj ||z ||d}|dkDr||z }nn$||kr4j j fd|dkDrj||s!jjyy#t$rYEwxYw)Nrrc$jSr9)rrEsrrz0SSLProtocol._do_read__buffered..s r) rrrrrrr1rrrrrL)r4offsetr&bufwantss` rr*zSSLProtocol._do_read__buffereds++D,F,F,HIC LL%%eS1Eqyun LL--efnc&'lKEqy% unJJ(()@A A:  - -f 5  # # %  "    sAC% C%% C10C1cd}d}d} |jj|j}|sn$|rd}d}|}n|rd}|g}nj|L |r|j j n,|s*|j j dj|s!|j|jyy#t$rYywxYw)N1TFr) rrrrrrD data_receivedjoinrrL)r4chunkzeroonefirstrs rr+zSSLProtocol._do_read__copied s  ))$--8 DC!EC!5>DKK&     , ,U 3    , ,SXXd^ <  # # %  "    sA C CCc> |jtjk(rHtj|_|jj }|rt jdyyy#ttf$rt$r}|j|dYd}~yd}~wwxYw)Nz?returning true from eof_received() has no effect when using sslzError calling eof_received()) rrrrrDrrr#KeyboardInterrupt SystemExit BaseExceptionr)r4 keep_openr$s rrzSSLProtocol._call_eof_received(s B"2"A"AA"2"<"< ..;;= NN$BCB ":.   B   b"@ A A BsA#A((BBBcZ|j}||jk\r/|js#d|_ |jj y||jkr0|jr#d|_ |jjyyy#t t f$rt$r4}|jjd||j|dYd}~yd}~wwxYw#t t f$rt$r4}|jjd||j|dYd}~yd}~wwxYw)NTzprotocol.pause_writing() failedmessage exceptionrrAFz protocol.resume_writing() failed) rgrcrurD pause_writingr:r;r<r1call_exception_handlerrrbresume_writing)r4sizers rr^z SSLProtocol._control_app_writing7s$**, 4,, ,T5M5M'+D $ ""002T-- -$2J2J',D $ ""1133K -&z2    11@!$!%!4!4 $ 3 &z2    11A!$!%!4!4 $ 3 s/B2CC'*CCD*6*D%%D*cH|jj|jzSr9)rpendingrrEs rrgz"SSLProtocol._get_write_buffer_sizeTs~~%%(?(???rc\t||tj\}}||_||_yr9)r,r!FLOW_CONTROL_HIGH_WATER_SSL_WRITErcrbr_s rr]z$SSLProtocol._set_write_buffer_limitsWs., #yBBD c$(!#& rcd|_yrK)rTrEs rrWzSSLProtocol._pause_reading_s #' rcnjr(d_fd}jj|yy)NFcjtjk(rjyjtjk(rj yjtj k(rjyyr9)rr r rrrrrrEsrresumez+SSLProtocol._resume_reading..resumefs`;;"2":"::MMO[[$4$=$==NN$[[$4$=$==%%'>r)rTr1r)r4rMs` rrZzSSLProtocol._resume_readingbs2  # #',D $ ( JJ  ( $rc|j}||jk\r.|js"d|_|jj y||j kr/|jr"d|_|jj yyy)NTF)rrrorrrXrnr[)r4rEs rrkz SSLProtocol._control_ssl_readingqsu))+ 4,, ,T5M5M'+D $ OO ) ) + T-- -$2J2J',D $ OO * * ,3K -rc\t||tj\}}||_||_yr9)r,r FLOW_CONTROL_HIGH_WATER_SSL_READrornr_s rrjz#SSLProtocol._set_read_buffer_limitszs., #yAAC c$(!#& rc.|jjSr9)rrGrEs rrrz!SSLProtocol._get_read_buffer_sizes~~%%%rc d|_yrK)rrEs rrBzSSLProtocol.pause_writings $( rc4 d|_|jyr0)rrrEs rrDzSSLProtocol.resume_writings $)   rcf|jr|jj|t|tr5|jj rt jd||dyyt|tjs+|jj|||j|dyy)Nz%r: %sT)exc_infor?) rrrxOSErrorr1rrrrCancelledErrorrC)r4rr@s rrzSSLProtocol._fatal_errors ?? OO ( ( - c7 #zz##% XtWtD&C!:!:; JJ - -" !__ / ras  ?**C,?,?@Ntyy &tyy & *r;J88&00r;jZ ),,Z { CsB00B:9B:__pycache__/__init__.cpython-312.pyc000064400000002663152527367570013250 0ustar00 {|jdZddlZddlddlddlddlddlddlddlddl ddl ddl ddl ddl ddlddlddlddlej$ej$zej$zej$zej$zej$zej$ze j$ze j$ze j$ze j$ze j$zej$zej$zej$zej$zZej&dk(rddleej$z Zyddleej$z Zy)z'The asyncio package, tracking PEP 3156.N)*win32)__doc__sys base_events coroutinesevents exceptionsfutureslocks protocolsrunnersqueuesstreams subprocesstasks taskgroupstimeoutsthreads transports__all__platformwindows_events unix_events)/usr/lib64/python3.12/asyncio/__init__.pyrsZ-         >>      ??   ==        ??  >>  ??      ==      ??         "<<7! ~%%%G {"""Gr__pycache__/base_tasks.cpython-312.pyc000064400000007760152527367570013633 0ustar00 {|jp tddlZddlZddlZddlmZddlmZdZejdZdZ dZ y) N) base_futures) coroutinesctj|}|jr|jsd|d<|j dd|j z|j |j dd|j |jr5tj|j}|j dd|d|S) N cancellingrrzname=%rz wait_for=zcoro=<>) r_future_repr_infordoneinsertget_name _fut_waiter_coror_format_coroutine)taskinfocoros +/usr/lib64/python3.12/asyncio/base_tasks.py_task_repr_infor s  ) )$ /D QKK9t}}./ # A4#3#3"678 zz++DJJ7 AvQ'( Kcpdjt|}d|jjd|dS)N >zz 7 " KK !   *  61;;?xt<=) //C  dX&T2  th&?@tL 4(";<4H d3 33CMM3GD $Tr *Hr) r:reprlibr?r1rrrrecursive_reprrr.rJrrrNsC&11 F+r__pycache__/mixins.cpython-312.pyc000064400000002006152527367570013007 0ustar00 {|jRdZddlZddlmZejZGddZy)zEvent loop mixins.N)eventsceZdZdZdZy)_LoopBoundMixinNctj}|j"t5|j||_ddd||jurt |d|S#1swY'xYw)Nz# is bound to a different event loop)r_get_running_loop_loop _global_lock RuntimeError)selfloops '/usr/lib64/python3.12/asyncio/mixins.py _get_loopz_LoopBoundMixin._get_loop sa'') :: ::%!%DJ tzz !$)LMN N s A!!A*)__name__ __module__ __qualname__r rrrr s E rr)__doc__ threadingrLockr rrrrrs&y~~   r__pycache__/transports.cpython-312.opt-1.pyc000064400000033242152527367570014664 0ustar00 {|j)dZdZGddZGddeZGddeZGdd eeZGd d eZGd d eZGddeZy)zAbstract Transport class.) BaseTransport ReadTransportWriteTransport TransportDatagramTransportSubprocessTransportc<eZdZdZdZd dZd dZdZdZdZ d Z y) rzBase class for transports._extraNc|i}||_yNr )selfextras +/usr/lib64/python3.12/asyncio/transports.py__init__zBaseTransport.__init__s =E c:|jj||S)z#Get optional transport information.)r get)r namedefaults rget_extra_infozBaseTransport.get_extra_infos{{tW--rct)z2Return True if the transport is closing or closed.NotImplementedErrorr s r is_closingzBaseTransport.is_closing!!rct)aClose the transport. Buffered data will be flushed asynchronously. No more data will be received. After all buffered data is flushed, the protocol's connection_lost() method will (eventually) be called with None as its argument. rrs rclosezBaseTransport.close "!rct)zSet a new protocol.r)r protocols r set_protocolzBaseTransport.set_protocol%rrct)zReturn the current protocol.rrs r get_protocolzBaseTransport.get_protocol)rrr ) __name__ __module__ __qualname____doc__ __slots__rrrrr"r$rrrr s($I .""""rrc&eZdZdZdZdZdZdZy)rz#Interface for read-only transports.r*ct)z*Return True if the transport is receiving.rrs r is_readingzReadTransport.is_reading3rrct)zPause the receiving end. No data will be passed to the protocol's data_received() method until resume_reading() is called. rrs r pause_readingzReadTransport.pause_reading7 "!rct)zResume the receiving end. Data received will once again be passed to the protocol's data_received() method. rrs rresume_readingzReadTransport.resume_reading?r0rN)r%r&r'r(r)r-r/r2r*rrrr.s-I"""rrcFeZdZdZdZd dZdZdZdZdZ d Z d Z d Z y) rz$Interface for write-only transports.r*Nct)aSet the high- and low-water limits for write flow control. These two values control when to call the protocol's pause_writing() and resume_writing() methods. If specified, the low-water limit must be less than or equal to the high-water limit. Neither value can be negative. The defaults are implementation-specific. If only the high-water limit is given, the low-water limit defaults to an implementation-specific value less than or equal to the high-water limit. Setting high to zero forces low to zero as well, and causes pause_writing() to be called whenever the buffer becomes non-empty. Setting low to zero causes resume_writing() to be called only once the buffer is empty. Use of zero for either limit is generally sub-optimal as it reduces opportunities for doing I/O and computation concurrently. rr highlows rset_write_buffer_limitsz&WriteTransport.set_write_buffer_limitsMs &"!rct)z,Return the current size of the write buffer.rrs rget_write_buffer_sizez$WriteTransport.get_write_buffer_sizebrrct)zGet the high and low watermarks for write flow control. Return a tuple (low, high) where low and high are positive number of bytes.rrs rget_write_buffer_limitsz&WriteTransport.get_write_buffer_limitsfs "!rct)zWrite some data bytes to the transport. This does not block; it buffers the data and arranges for it to be sent out asynchronously. r)r datas rwritezWriteTransport.writelr0rcHdj|}|j|y)zWrite a list (or any iterable) of data bytes to the transport. The default implementation concatenates the arguments and calls write() on the result. rN)joinr?)r list_of_datar>s r writelineszWriteTransport.writelinests xx % 4rct)zClose the write end after flushing buffered data. (This is like typing ^D into a UNIX program reading from stdin.) Data may still be received. rrs r write_eofzWriteTransport.write_eof} "!rct)zAReturn True if this transport supports write_eof(), False if not.rrs r can_write_eofzWriteTransport.can_write_eofrrctzClose the transport immediately. Buffered data will be lost. No more data will be received. The protocol's connection_lost() method will (eventually) be called with None as its argument. rrs rabortzWriteTransport.abortrFrNN) r%r&r'r(r)r8r:r<r?rCrErHrKr*rrrrHs2.I"*"" """"rrceZdZdZdZy)raSInterface representing a bidirectional transport. There may be several implementations, but typically, the user does not implement new transports; rather, the platform provides some useful transports that are implemented using the platform's best practices. The user never instantiates a transport directly; they call a utility function, passing it a protocol factory and other information necessary to create the transport and protocol. (E.g. EventLoop.create_connection() or EventLoop.create_server().) The utility function will asynchronously create a transport and a protocol and hook them up by calling the protocol's connection_made() method, passing it the transport. The implementation here raises NotImplemented for every method except writelines(), which calls write() in a loop. r*N)r%r&r'r(r)r*rrrrs(Irrc"eZdZdZdZddZdZy)rz(Interface for datagram (UDP) transports.r*Nct)aSend data to the transport. This does not block; it buffers the data and arranges for it to be sent out asynchronously. addr is target socket address. If addr is None use target address pointed on transport creation. r)r r>addrs rsendtozDatagramTransport.sendtorrctrJrrs rrKzDatagramTransport.abortrFrr )r%r&r'r(r)rQrKr*rrrrs2I""rrc4eZdZdZdZdZdZdZdZdZ y) rr*ct)zGet subprocess id.rrs rget_pidzSubprocessTransport.get_pidrrct)zGet subprocess returncode. See also http://docs.python.org/3/library/subprocess#subprocess.Popen.returncode rrs rget_returncodez"SubprocessTransport.get_returncoder0rct)z&Get transport for pipe with number fd.r)r fds rget_pipe_transportz&SubprocessTransport.get_pipe_transportrrct)zSend signal to subprocess. See also: docs.python.org/3/library/subprocess#subprocess.Popen.send_signal r)r signals r send_signalzSubprocessTransport.send_signalr0rct)aLStop the subprocess. Alias for close() method. On Posix OSs the method sends SIGTERM to the subprocess. On Windows the Win32 API function TerminateProcess() is called to stop the subprocess. See also: http://docs.python.org/3/library/subprocess#subprocess.Popen.terminate rrs r terminatezSubprocessTransport.terminates "!rct)zKill the subprocess. On Posix OSs the function sends SIGKILL to the subprocess. On Windows kill() is an alias for terminate(). See also: http://docs.python.org/3/library/subprocess#subprocess.Popen.kill rrs rkillzSubprocessTransport.kills "!rN) r%r&r'r)rUrWrZr]r_rar*rrrrs%I"""" " "rrcPeZdZdZdZd fd ZdZdZdZd dZ d dZ d Z xZ S) _FlowControlMixinavAll the logic for (write) flow control in a mix-in base class. The subclass must implement get_write_buffer_size(). It must call _maybe_pause_protocol() whenever the write buffer size increases, and _maybe_resume_protocol() whenever it decreases. It may also override set_write_buffer_limits() (e.g. to specify different defaults). The subclass constructor must call super().__init__(extra). This will call set_write_buffer_limits(). The user may call set_write_buffer_limits() and get_write_buffer_size(), and their protocol's pause_writing() and resume_writing() may be called. )_loop_protocol_paused _high_water _low_waterc`t||||_d|_|j y)NF)superrrdre_set_write_buffer_limits)r rloop __class__s rrz_FlowControlMixin.__init__s+  % %%'rc@|j}||jkry|js#d|_ |jj yy#t t f$rt$r4}|jjd|||jdYd}~yd}~wwxYw)NTzprotocol.pause_writing() failedmessage exception transportr!) r:rfre _protocol pause_writing SystemExitKeyboardInterrupt BaseExceptionrdcall_exception_handler)r sizeexcs r_maybe_pause_protocolz'_FlowControlMixin._maybe_pause_protocols))+ 4## # $$$(D ! ,,.% 12    11@!$!% $ 3 sAB)*BBc<|jrA|j|jkr#d|_ |jj yyy#t t f$rt$r4}|jjd|||jdYd}~yd}~wwxYw)NFz protocol.resume_writing() failedrn) rer:rgrrresume_writingrtrurvrdrw)r rys r_maybe_resume_protocolz(_FlowControlMixin._maybe_resume_protocol's  ! !**,?$)D ! --/@ "  12    11A!$!% $ 3 sAB'*BBc2|j|jfSr )rgrfrs rr<z)_FlowControlMixin.get_write_buffer_limits7s!1!122rc| |d}nd|z}||dz}||cxk\rdk\sntd|d|d||_||_y)Nizhigh (z) must be >= low (z) must be >= 0) ValueErrorrfrgr5s rrjz*_FlowControlMixin._set_write_buffer_limits:sh <{ 3w ;!)Csa 23'HJ J rcJ|j|||jy)N)r6r7)rjrzr5s rr8z)_FlowControlMixin.set_write_buffer_limitsJs! %%4S%9 ""$rctr rrs rr:z'_FlowControlMixin.get_write_buffer_sizeNs!!rrL) r%r&r'r(r)rrzr}r<rjr8r: __classcell__)rls@rrcrcs3 KI($ 3 %"rrcN) r(__all__rrrrrrrcr*rrrsj  """"J"M"4I"]I"X ~0" "23"-3"lT" T"r__pycache__/exceptions.cpython-312.pyc000064400000006013152527367570013663 0ustar00 {|jdZdZGddeZeZGddeZGddeZGdd e Z Gd d eZ Gd d eZ y)zasyncio exceptions.)BrokenBarrierErrorCancelledErrorInvalidStateError TimeoutErrorIncompleteReadErrorLimitOverrunErrorSendfileNotAvailableErrorceZdZdZy)rz!The Future or Task was cancelled.N__name__ __module__ __qualname____doc__+/usr/lib64/python3.12/asyncio/exceptions.pyrr s+rrceZdZdZy)rz+The operation is not allowed in this state.Nr rrrrrs5rrceZdZdZy)rz~Sendfile syscall is not available. Raised if OS does not support sendfile syscall for given socket or file type. Nr rrrrrsrrc(eZdZdZfdZdZxZS)rz Incomplete read error. Attributes: - partial: read bytes string before the end of stream was reached - expected: total number of expected bytes (or None if unknown) c||dn t|}t| t|d|d||_||_y)N undefinedz bytes read on a total of z expected bytes)reprsuper__init__lenpartialexpected)selfrr r_expected __class__s rrzIncompleteReadError.__init__$sE$,$4[$x.  CL>)C&<8 9   rcHt||j|jffSN)typerrrs r __reduce__zIncompleteReadError.__reduce__+sDzDLL$--888rr r r rrr$ __classcell__rs@rrrs !9rrc(eZdZdZfdZdZxZS)rzReached the buffer limit while looking for a separator. Attributes: - consumed: total number of to be consumed bytes. c2t||||_yr!)rrconsumed)rmessager*rs rrzLimitOverrunError.__init__5s !  rcNt||jd|jffS)N)r"argsr*r#s rr$zLimitOverrunError.__reduce__9s"DzDIIaL$--888rr%r's@rrr/s !9rrceZdZdZy)rz*Barrier is broken by barrier.abort() call.Nr rrrrr=s4rrN) r__all__ BaseExceptionrr Exceptionr RuntimeErrorrEOFErrorrrrrrrr5s^ ( ,], 6 6 9(9$ 9 955r__pycache__/proactor_events.cpython-312.opt-2.pyc000064400000125222152527367570015663 0ustar00 {|j܂ dZddlZddlZddlZddlZddlZddlZddlZddlm Z ddlm Z ddlm Z ddlm Z ddlm Z dd lmZdd lmZdd lmZdd lmZd ZGddej(ej*ZGddeej.ZGddeej2ZGddeZGddeej8ZGddeeej<ZGddeeej<Z Gdde jBZ"y))BaseProactorEventLoopN) base_events) constants)futures) exceptions) protocols)sslproto) transports)trsock)loggerctj||jd< |j|jd<d|jvr |j|jd<yy#tj $r5|j jrtjd|dYuwxYw#tj $rd|jd<YywxYw)Nsocketsocknamezgetsockname() failed on %rTexc_infopeername) r TransportSocket_extra getsocknamererror_loop get_debugr warning getpeername) transportsocks 0/usr/lib64/python3.12/asyncio/proactor_events.py_set_socket_extrars!'!7!7!=IXC'+'7'7'9 $ ))) 0+/+;+;+=I  Z (* <<C ?? $ $ & NN,dT CC|| 0+/I  Z ( 0s$A/B:/AB76B7:"CCceZdZ d fd ZdZdZdZdZdZdZ e jfdZ dd Z d Zd Zd ZxZS)_ProactorBasePipeTransportct||||j|||_|j |||_d|_d|_d|_d|_ d|_ d|_ d|_ d|_ |j |j j|jj!|j"j$||,|jj!t&j(|dyy)NrF)super__init__ _set_extra_sock set_protocol_server_buffer _read_fut _write_fut_pending_write _conn_lost_closing_called_connection_lost _eof_written_attachr call_soon _protocolconnection_mader_set_result_unless_cancelledselflooprprotocolwaiterextraserver __class__s rr$z#_ProactorBasePipeTransport.__init__2s %   (#   ',$! << # LL " T^^;;TB   JJ !E!E!' / c|jjg}|j|jdn|jr|jd|j,|jd|jj |j |jd|j |j|jd|j|jr'|jdt|j|jr|jddjd j|S) Nclosedclosingzfd=zread=zwrite=zwrite_bufsize=z EOF writtenz<{}> ) r=__name__r&appendr.filenor*r+r)lenr0formatjoin)r7infos r__repr__z#_ProactorBasePipeTransport.__repr__Is''( ::  KK ! ]] KK " :: ! KK#djj//123 4 >> % KK%12 3 ?? & KK& 34 5 << KK.T\\):(;< =    KK &}}SXXd^,,r>c"||jd<y)Npipe)rr7rs rr%z%_ProactorBasePipeTransport._set_extra[s" Fr>c||_yNr3)r7r9s rr'z'_ProactorBasePipeTransport.set_protocol^s !r>c|jSrOrPr7s r get_protocolz'_ProactorBasePipeTransport.get_protocolas ~~r>c|jSrO)r.rRs r is_closingz%_ProactorBasePipeTransport.is_closingds }}r>c.|jryd|_|xjdz c_|js2|j&|jj |j d|j"|jjd|_yy)NTr) r.r-r)r+rr2_call_connection_lostr*cancelrRs rclosez _ProactorBasePipeTransport.closegsq ==   1|| 7 JJ !;!;T B >> % NN ! ! #!DN &r>cv|j-|d|t||jjyy)Nzunclosed transport )source)r&ResourceWarningrY)r7_warns r__del__z"_ProactorBasePipeTransport.__del__rs5 :: ! 'x0/$ O JJ    "r>c0 t|tr4|jjrDt j d||dn*|jj ||||jd|j|y#|j|wxYw)Nz%r: %sTr)message exceptionrr9) isinstanceOSErrorrrr debugcall_exception_handlerr3 _force_close)r7excr`s r _fatal_errorz'_ProactorBasePipeTransport._fatal_errorwsy ##w'::'')LL44H 11&!$!% $ 3   c "D  c "s A.BBcH|jS|jjs9||jjdn|jj||jr |j ryd|_|xj dz c_|jr!|jjd|_|jr!|jjd|_ d|_ d|_ |jj|j|y)NTrr) _empty_waiterdone set_result set_exceptionr.r/r-r+rXr*r,r)rr2rW)r7rgs rrfz'_ProactorBasePipeTransport._force_closes    )$2D2D2I2I2K{""--d3""005 ==T99   1 ?? OO " " $"DO >> NN ! ! #!DN  T77=r>c|jry |jj|t|jdrF|jj dk7r)|jj tj|jjd|_|j}||jd|_ d|_y#t|jdrF|jj dk7r)|jj tj|jjd|_|j}||jd|_ d|_wxYw)NshutdownT) r/r3connection_losthasattrr&rEror SHUT_RDWRrYr(_detach)r7rgr<s rrWz0_ProactorBasePipeTransport._call_connection_losts  ' '  0 NN * *3 / tzz:.4::3D3D3F"3L ##F$4$45 JJ   DJ\\F! # +/D (tzz:.4::3D3D3F"3L ##F$4$45 JJ   DJ\\F! # +/D (s CB+E?cf|j}|j|t|jz }|SrO)r,r)rF)r7sizes rget_write_buffer_sizez0_ProactorBasePipeTransport.get_write_buffer_sizes/"" << # C % %D r>NNN)zFatal error on pipe transport)rC __module__ __qualname__r$rJr%r'rSrUrYwarningswarnr^rhrfrWrw __classcell__r=s@rr!r!.sQ448$(/.-$#" "%MM #>(0(r>r!cLeZdZ dfd ZdZdZdZdZdZd dZ xZ S) _ProactorReadPipeTransportcd|_d|_t| ||||||t ||_|j j|jd|_y)NrpTF) _pending_data_length_pausedr#r$ bytearray_datarr2 _loop_reading) r7r8rr9r:r;r< buffer_sizer=s rr$z#_ProactorReadPipeTransport.__init__sT$&!  tXvufE{+  T//0 r>c:|j xr |j SrO)rr.rRs r is_readingz%_ProactorReadPipeTransport.is_readings<<5 $55r>c|js |jryd|_|jjrt j d|yy)NTz%r pauses reading)r.rrrr rdrRs r pause_readingz(_ProactorReadPipeTransport.pause_readings? ==DLL   ::   ! LL,d 3 "r>c|js |jsyd|_|j&|jj |j d|j }d|_|dkDr4|jj |j|jd|||jjrtjd|yy)NFrpz%r resumes reading) r.rr*rr2rr_data_receivedrrr rd)r7lengths rresume_readingz)_ProactorReadPipeTransport.resume_readings ==  >> ! JJ !3!3T :**$&! B; JJ !4!4djj&6I6 R ::   ! LL-t 4 "r>c.|jjrtjd| |jj }|s|jyy#t tf$rt$r}|j|dYd}~yd}~wwxYw)Nz%r received EOFz1Fatal error: protocol.eof_received() call failed.) rrr rdr3 eof_received SystemExitKeyboardInterrupt BaseExceptionrhrY)r7 keep_openrgs r _eof_receivedz(_ProactorReadPipeTransport._eof_receiveds ::   ! LL*D 1 335I JJL-.      H J  sA B8BBc|jr||_y|dk(r|jyt|jt j r" t j|j|y|jj|y#ttf$rt$r}|j|dYd}~yd}~wwxYw)Nrz3Fatal error: protocol.buffer_updated() call failed.) rrrrbr3r BufferedProtocol_feed_data_to_buffered_protorrrrh data_received)r7datarrgs rrz)_ProactorReadPipeTransport._data_receiveds <<)/D %  Q;     dnni&@&@ A 66t~~tL NN ( ( . 12   !!##12  s B C%B<<CcJd}d} |xd|_|jrQ|j}|dk(r |dkDr|j||yyt t |j d|}n|j|jr |dkDr|j||yy|js?|jjj|j|j |_|js&|jj|j |dkDr|j||yy#t $rZ}|js|j#|dn1|jj%rt'j(ddYd}~wd}~wt*$r}|j-|Yd}~d}~wt.$r}|j#|dYd}~d}~wt0j2$r|jsYwxYw#|dkDr|j||wwxYw)Nrprz"Fatal read error on pipe transportz*Read error on pipe transport while closingTr)r*rkresultrbytes memoryviewrrXr.rr _proactor recv_intor&add_done_callbackrConnectionAbortedErrorrhrr rdConnectionResetErrorrfrcrCancelledError)r7futrrrgs rrz(_ProactorReadPipeTransport._loop_readings. 2"&88: ZZ\F{F{##D&1A!DJJ!7!@ADJJL}}2{##D&1)<D<&A D<12H< HAFH H&F<7H< HGH#HHHHH")NNNirO) rCryrzr$rrrrrrr}r~s@rrrs/#486;64&5$ /212r>rcPeZdZ dZfdZdZd dZdZdZdZ dZ d Z xZ S) _ProactorBaseWritePipeTransportTc2t||i|d|_yrO)r#r$rjr7argskwr=s rr$z(_ProactorBaseWritePipeTransport.__init__Ns $%"%!r>ct|tttfs!t dt |j |jr td|j td|sy|jrH|jtjk\rtjd|xjdz c_ y|j|j!t|y|j"s!t||_|j%y|j"j'||j%y)Nz/data argument must be a bytes-like object, not zwrite_eof() already calledz(unable to write; sendfile is in progresszsocket.send() raised exception.r)r)rbrrr TypeErrortyperCr0 RuntimeErrorrjr-r!LOG_THRESHOLD_FOR_CONNLOST_WRITESr rr+ _loop_writingr)_maybe_pause_protocolextend)r7rs rwritez%_ProactorBaseWritePipeTransport.writeRs$ : >?Dz**+-. .   ;< <    )IJ J  ??)"M"MM@A OOq O  ?? "   E$K  0$T?DL  & & ( LL   %  & & (r>c  ||j |jryd|_d|_|r|j||j}d|_|sx|jr&|j j |jd|jr)|jjtj|jn|j jj|j||_|jj!sFt#||_|jj%|j&|j)n%|jj%|j&|j*)|j|j*j-dyyy#t.$r}|j1|Yd}~yd}~wt2$r}|j5|dYd}~yd}~wwxYw)Nrz#Fatal write error on pipe transport)r+r.r,rr)rr2rWr0r&rorSHUT_WR_maybe_resume_protocolrsendrkrFrrrrjrlrrfrcrh)r7frrgs rrz-_ProactorBaseWritePipeTransport._loop_writingxs& J}!8T]]"DO"#D  |||# ==JJ(()C)CTJ$$JJ''7 ++-"&**"6"6";";DJJ"M++-*-d)D'OO55d6H6HI..0OO55d6H6HI!!-$//2I""--d33J-# #   c " " J   c#H I I Js)F<FF<< HG H'G>>HcyNTrRs r can_write_eofz-_ProactorBaseWritePipeTransport.can_write_eofr>c$|jyrO)rYrRs r write_eofz)_ProactorBaseWritePipeTransport.write_eofs  r>c&|jdyrOrfrRs rabortz%_ProactorBaseWritePipeTransport.abort $r>c|j td|jj|_|j|jj d|jS)NzEmpty waiter is already set)rjrr create_futurer+rlrRs r_make_empty_waiterz2_ProactorBaseWritePipeTransport._make_empty_waitersY    )<= =!ZZ557 ?? "    ) )$ /!!!r>cd|_yrO)rjrRs r_reset_empty_waiterz3_ProactorBaseWritePipeTransport._reset_empty_waiters !r>NN) rCryrz_start_tls_compatibler$rrrrrrrr}r~s@rrrHs7$ "$)L'JR ""r>rc$eZdZfdZdZxZS)_ProactorWritePipeTransportct||i||jjj |j d|_|j j|jy)N) r#r$rrrecvr&r*r _pipe_closedrs rr$z$_ProactorWritePipeTransport.__init__sO $%"%--224::rB (():):;r>c|jry|jryd|_|j|j t y|j yrO) cancelledr.r*r+rfBrokenPipeErrorrY)r7rs rrz(_ProactorWritePipeTransport._pipe_closedsC ==?  ==  ?? &   o/ 0 JJLr>)rCryrzr$rr}r~s@rrrs < r>rcReZdZdZ d fd ZdZdZdZd dZd dZ d dZ xZ S) _ProactorDatagramTransportic||_d|_d|_t||||||t j |_|jj|jy)Nr)r:r;) _addressrj _buffer_sizer#r$ collectionsdequer)rr2r)r7r8rr9addressr:r;r=s rr$z#_ProactorDatagramTransport.__init__s^ ! tXfEJ#((*  T//0r>ct||yrOrrMs rr%z%_ProactorDatagramTransport._set_extra $%r>c|jSrO)rrRs rrwz0_ProactorDatagramTransport.get_write_buffer_sizes   r>c&|jdyrOrrRs rrz _ProactorDatagramTransport.abortrr>crt|tttfst dt ||sy|j (|d|j fvrtd|j |jrT|j rH|jtjk\rtjd|xjdz c_y|jjt||f|xjt!|z c_|j"|j%|j'y)Nz,data argument must be bytes-like object (%r)z!Invalid address: must be None or z!socket.sendto() raised exception.r)rbrrrrrr ValueErrorr-rrr rr)rDrrFr+rr)r7raddrs rsendtoz!_ProactorDatagramTransport.sendtos$ : >?J J( (  == $dDMM5J)J3DMM?CE E ??t}})"M"MMBC OOq O  U4[$/0 SY& ?? "     ""$r>cz |jryd|_|r|j|jr|jr?|jr3|j r&|j j|jdy|jj\}}|xjt|zc_ |j6|j jj|j||_n7|j jj|j|||_|jj!|j"|j%y#t&$r%}|j(j+|Yd}~yd}~wt,$r}|j/|dYd}~yd}~wwxYw)N)rz'Fatal write error on datagram transport)r-r+rr)rr.rr2rWpopleftrrFrrr&rrrrrcr3error_received Exceptionrh)r7rrrrgs rrz(_ProactorDatagramTransport._loop_writingsT *#DO <!>tzz?C}}"N~~)001C1CD00t< / NN ) )# . .(( ==! 00t<sM F#'F#9,F#B F#2G5# G2,G G5 #G2/G51G22G55!HrxrO) rCryrzrr$r%rwrrrrr}r~s@rrrs2H59$( 1&! %: *D)=r>rceZdZ dZdZy)_ProactorDuplexPipeTransportcy)NFrrRs rrz*_ProactorDuplexPipeTransport.can_write_eofUsr>ctrO)NotImplementedErrorrRs rrz&_ProactorDuplexPipeTransport.write_eofXs!!r>N)rCryrzrrrr>rrrPs&"r>rcdeZdZ ejj Z dfd ZdZdZ dZ xZ S)_ProactorSocketTransportcXt|||||||tj|yrO)r#r$r _set_nodelayr6s rr$z!_ProactorSocketTransport.__init__cs( tXvufE  &r>ct||yrOrrMs rr%z#_ProactorSocketTransport._set_extrahrr>cyrrrRs rrz&_ProactorSocketTransport.can_write_eofkrr>c|js |jryd|_|j*|jj t j yyr)r.r0r+r&rorrrRs rrz"_ProactorSocketTransport.write_eofnsA ==D--   ?? " JJ   / #r>rx) rCryrzr _SendfileMode TRY_NATIVE_sendfile_compatibler$r%rrr}r~s@rrr\s4+$22==48$(' &0r>rceZdZfdZ ddZ dddddddddZ ddZ d dZ d d Z d d Z fd Z d Z d Z dZ d!dZdZdZdZdZdZdZdZdZddZdZ d"dZdZdZdZxZS)#rct|tjd|jj ||_||_d|_i|_ |j||jtjtjur.tj |j"j%yy)NzUsing proactor: %s)r#r$r rdr=rCr _selector_self_reading_future_accept_futuresset_loop_make_self_pipe threadingcurrent_thread main_threadsignal set_wakeup_fd_csockrE)r7proactorr=s rr$zBaseProactorEventLoop.__init__xs  )8+=+=+F+FG!!$(!!$   # # %)>)>)@ @  !3!3!5 6 Ar>Nc"t||||||SrO)r)r7rr9r:r;r<s r_make_socket_transportz,BaseProactorEventLoop._make_socket_transports'dHf(-v7 7r>F) server_sideserver_hostnamer;r<ssl_handshake_timeoutssl_shutdown_timeoutc ttj||||||| | } t||| ||| jS)N)rrr;r<)r SSLProtocolr_app_transport) r7rawsockr9 sslcontextr:rrr;r<rr ssl_protocols r_make_ssl_transportz)BaseProactorEventLoop._make_ssl_transportsI  ++h F_&;%9 ; !w ',V =***r>c"t||||||SrO)r)r7rr9rr:r;s r_make_datagram_transportz.BaseProactorEventLoop._make_datagram_transports)$h*0%9 9r>c t|||||SrO)rr7rr9r:r;s r_make_duplex_pipe_transportz1BaseProactorEventLoop._make_duplex_pipe_transports+D,0(FEK Kr>c t|||||SrO)rrs r_make_read_pipe_transportz/BaseProactorEventLoop._make_read_pipe_transports)$hNNr>c t|||||SrO)rrs r_make_write_pipe_transportz0BaseProactorEventLoop._make_write_pipe_transports+4+/65J Jr>c|jr td|jrytjtj urt jd|j|j|jjd|_ d|_ t|-y)Nz!Cannot close a running event looprp) is_runningr is_closedrrrr r _stop_accept_futures_close_self_piperrYrr#)r7r=s rrYzBaseProactorEventLoop.closes ?? BC C >>    # # %)>)>)@ @   $ !!#    r>cVK|jj||d{S7wrO)rr)r7rns r sock_recvzBaseProactorEventLoop.sock_recvs#^^((q1111 )')cVK|jj||d{S7wrO)rr)r7rbufs rsock_recv_intoz$BaseProactorEventLoop.sock_recv_intos#^^--dC8888r,cVK|jj||d{S7wrO)rr)r7rbufsizes r sock_recvfromz#BaseProactorEventLoop.sock_recvfroms#^^,,T7;;;;r,crK|s t|}|jj|||d{S7wrO)rFr recvfrom_into)r7rr.nbytess rsock_recvfrom_intoz(BaseProactorEventLoop.sock_recvfrom_intos1XF^^11$VDDDDs .757cVK|jj||d{S7wrO)rr)r7rrs r sock_sendallz"BaseProactorEventLoop.sock_sendalls#^^((t4444r,cZK|jj||d|d{S7w)Nr)rr)r7rrrs r sock_sendtoz!BaseProactorEventLoop.sock_sendtos'^^**4q'BBBBs "+)+cK|jr|jdk7r td|jj ||d{S7w)Nrzthe socket must be non-blocking)_debug gettimeoutrrconnect)r7rrs r sock_connectz"BaseProactorEventLoop.sock_connectsD ;;4??,1>? ?^^++D'::::sA A A AcTK|jj|d{S7wrO)racceptrMs r sock_acceptz!BaseProactorEventLoop.sock_accepts!^^**40000s (&(cK |j} t j|j}|r|n|}|syt|d}|rt||z|n|} t||}d} t| |z |}|dkr| | dkDr|j|SS|jj||||d{||z }| |z } ^#ttjf$r}t j dd}~wwxYw#t$rt j dwxYw7g#| dkDr|j|wwxYww)Nznot a regular filerl)rEAttributeErrorioUnsupportedOperationrSendfileNotAvailableErrorosfstatst_sizercminseekrsendfile) r7rfileoffsetcountrEerrfsize blocksizeend_pos total_sents r_sock_sendfile_nativez+BaseProactorEventLoop._sock_sendfile_natives_ M[[]F MHHV$,,E#E  ;/ 05#fune,5VU#  "& 0)< >% A~ &! nn--dD&)LLL)#i'  7 78 M667KL L M M667KL L MMA~ &!shEC D6E+D$E!D$:D";D$ C=#C88C==EDE"D$$D==EcjK|j}|j|jd{ |j|j|||dd{|j |r|j SS7P7)#|j |r|j wwxYww)NF)fallback)rrr sock_sendfiler&rr)r7transprNrOrPrs r_sendfile_nativez&BaseProactorEventLoop._sendfile_natives**,''))) (++FLL$5:,<<  & & (%%' *<  & & (%%'s84B3BB3#B B  B #%B3 B %B00B3c |j!|jjd|_|jjd|_|jjd|_|xj dzc_y)Nr)rrX_ssockrYr  _internal_fdsrRs rr(z&BaseProactorEventLoop._close_self_pipesg  $ $ 0  % % , , .(,D %     ar>ctj\|_|_|jj d|jj d|xj dz c_y)NFr)r socketpairr]r  setblockingr^rRs rrz%BaseProactorEventLoop._make_self_pipesN#)#4#4#6  T[ & & ar>ct ||j|j|ury|jj|jd}||_|j |j y#tj$rYyttf$rt$r}|jd||dYd}~yd}~wwxYw)Niz.Error on reading from the event loop self pipe)r`rar8) rrrrr]r_loop_self_readingrrrrrre)r7rrgs rrcz(BaseProactorEventLoop._loop_self_readings 9} ((1##DKK6A)*D %   7 7 8((  -.     ' 'K )   s" A,&A,,B7B7B22B7c|j}|y |jdy#t$r(|jrt j ddYyYywxYw)Nz3Fail to write a null byte into the self-pipe socketTr)r rrcr<r rd)r7csocks r_write_to_selfz$BaseProactorEventLoop._write_to_self4sU   =  , JJu  ,{{ 0&*, ,s#,AAc Pdfd jy)Nc  |s|j\}}jrtjd||} j || dd|i nj ||d|ij ryjj }|j j<|jy#t$r} jdk7r9jd|tj d j!n.jrtjd d Yd}~yYd}~yYd}~yd}~wt"j$$r j!YywxYw) Nz#%r got a new connection from %r: %rTr)rr;r<rrrrpzAccept failed on a socket)r`rarzAccept failed on socket %rr)rr<r rdrrr&rrArrErrcrer rrYrr) rconnrr9rgr8protocol_factoryr7r<rrrrs rr8z2BaseProactorEventLoop._start_serving..loopKsw# *=!"JD${{ %J%+T49/1H!-00 (JD#-t"4V2G1E 1G 33 (#-t"4V4E>>#NN))$/78$$T[[]3##D) 6;;=B&//#>%("("8"8">1 JJL[[LL!=!%66!!,,   s%BC C FA0E&FFrO)r2) r7rkrrr<backlogrrr8s ````` ``@r_start_servingz$BaseProactorEventLoop._start_servingFs $ *$ *L tr>cyrOr)r7 event_lists r_process_eventsz%BaseProactorEventLoop._process_eventsss r>c|jjD]}|j|jjyrO)rvaluesrXclear)r7futures rr'z*BaseProactorEventLoop._stop_accept_futuresws6**113F MMO4 ""$r>c|jj|jd}|r|j|jj ||j yrO)rpoprErXr _stop_servingrY)r7rrts rrwz#BaseProactorEventLoop._stop_serving|sG%%))$++->  MMO $$T* r>rxrOr)r)NNdNN)rCryrzr$rrrrr!r#rYr+r/r2r6r8r:r?rBrVr[r(rrcrgrmrpr'rwr}r~s@rrrvs 7=A267 9= + $t"&!% + CG9 BF*.K @D(,OAE)-J (29<E 5C; 1": (  98,&>A-1,0+Z % r>r)#__all__rErHrr{r rrrrrrr r r r logr r_FlowControlMixin BaseTransportr! ReadTransportrWriteTransportrrDatagramTransportr Transportrr BaseEventLooprrr>rrs #  0$D!=!=!+!9!9DNP2!;!+!9!9P2fk"&@&0&?&?k"\"A,A=!;!+!=!=A=H "#=#B#-#7#7 "09>)3304KK55Kr>__pycache__/mixins.cpython-312.opt-2.pyc000064400000001747152527367570013762 0ustar00 {|jP ddlZddlmZejZGddZy)N)eventsceZdZdZdZy)_LoopBoundMixinNctj}|j"t5|j||_ddd||jurt |d|S#1swY'xYw)Nz# is bound to a different event loop)r_get_running_loop_loop _global_lock RuntimeError)selfloops '/usr/lib64/python3.12/asyncio/mixins.py _get_loopz_LoopBoundMixin._get_loop sa'') :: ::%!%DJ tzz !$)LMN N s A!!A*)__name__ __module__ __qualname__r rrrr s E rr) threadingrLockr rrrrrs&y~~   r__pycache__/protocols.cpython-312.opt-1.pyc000064400000021120152527367570014461 0ustar00 {|j-~dZdZGddZGddeZGddeZGdd eZGd d eZd Zy )zAbstract Protocol base classes.) BaseProtocolProtocolDatagramProtocolSubprocessProtocolBufferedProtocolc,eZdZdZdZdZdZdZdZy)ra Common base class for protocol interfaces. Usually user implements protocols that derived from BaseProtocol like Protocol or ProcessProtocol. The only case when BaseProtocol should be implemented directly is write-only transport like write pipe cy)zCalled when a connection is made. The argument is the transport representing the pipe connection. To receive data, wait for data_received() calls. When the connection is closed, connection_lost() is called. Nr)self transports */usr/lib64/python3.12/asyncio/protocols.pyconnection_madezBaseProtocol.connection_madecy)zCalled when the connection is lost or closed. The argument is an exception object or None (the latter meaning a regular EOF is received or the connection was aborted or closed). Nrr excs r connection_lostzBaseProtocol.connection_lostrrcy)aCalled when the transport's buffer goes over the high-water mark. Pause and resume calls are paired -- pause_writing() is called once when the buffer goes strictly over the high-water mark (even if subsequent writes increases the buffer size even more), and eventually resume_writing() is called once when the buffer size reaches the low-water mark. Note that if the buffer size equals the high-water mark, pause_writing() is not called -- it must go strictly over. Conversely, resume_writing() is called when the buffer size is equal or lower than the low-water mark. These end conditions are important to ensure that things go as expected when either mark is zero. NOTE: This is the only Protocol callback that is not called through EventLoop.call_soon() -- if it were, it would have no effect when it's most needed (when the app keeps writing without yielding until pause_writing() is called). Nrr s r pause_writingzBaseProtocol.pause_writing%rrcy)zvCalled when the transport's buffer drains below the low-water mark. See pause_writing() for details. Nrrs r resume_writingzBaseProtocol.resume_writing;rrN) __name__ __module__ __qualname____doc__ __slots__r rrrrrr rr s"I   , rrc eZdZdZdZdZdZy)ranInterface for stream protocol. The user should implement this interface. They can inherit from this class but don't need to. The implementations here do nothing (they don't raise exceptions). When the user wants to requests a transport, they pass a protocol factory to a utility function (e.g., EventLoop.create_connection()). When the connection is made successfully, connection_made() is called with a suitable transport object. Then data_received() will be called 0 or more times with data (bytes) received from the transport; finally, connection_lost() will be called exactly once with either an exception object or None as an argument. State machine of calls: start -> CM [-> DR*] [-> ER?] -> CL -> end * CM: connection_made() * DR: data_received() * ER: eof_received() * CL: connection_lost() rcy)zTCalled when some data is received. The argument is a bytes object. Nr)r datas r data_receivedzProtocol.data_received^rrcyzCalled when the other end calls write_eof() or equivalent. If this returns a false value (including None), the transport will close itself. If it returns a true value, closing the transport is up to the protocol. Nrrs r eof_receivedzProtocol.eof_receiveddrrN)rrrrrr!r$rrr rrBs2I  rrc&eZdZdZdZdZdZdZy)ra:Interface for stream protocol with manual buffer control. Event methods, such as `create_server` and `create_connection`, accept factories that return protocols that implement this interface. The idea of BufferedProtocol is that it allows to manually allocate and control the receive buffer. Event loops can then use the buffer provided by the protocol to avoid unnecessary data copies. This can result in noticeable performance improvement for protocols that receive big amounts of data. Sophisticated protocols can allocate the buffer only once at creation time. State machine of calls: start -> CM [-> GB [-> BU?]]* [-> ER?] -> CL -> end * CM: connection_made() * GB: get_buffer() * BU: buffer_updated() * ER: eof_received() * CL: connection_lost() rcy)aPCalled to allocate a new receive buffer. *sizehint* is a recommended minimal size for the returned buffer. When set to -1, the buffer size can be arbitrary. Must return an object that implements the :ref:`buffer protocol `. It is an error to return a zero-sized buffer. Nr)r sizehints r get_bufferzBufferedProtocol.get_bufferrrcy)zCalled when the buffer was updated with the received data. *nbytes* is the total number of bytes that were written to the buffer. Nr)r nbytess r buffer_updatedzBufferedProtocol.buffer_updatedrrcyr#rrs r r$zBufferedProtocol.eof_receivedrrN)rrrrrr(r+r$rrr rrms.I    rrc eZdZdZdZdZdZy)rz Interface for datagram protocol.rcy)z&Called when some datagram is received.Nr)r r addrs r datagram_receivedz"DatagramProtocol.datagram_receivedrrcy)z~Called when a send or receive operation raises an OSError. (Other than BlockingIOError or InterruptedError.) Nrrs r error_receivedzDatagramProtocol.error_receivedrrN)rrrrrr0r2rrr rrs*I5 rrc&eZdZdZdZdZdZdZy)rz,Interface for protocol for subprocess calls.rcy)zCalled when the subprocess writes data into stdout/stderr pipe. fd is int file descriptor. data is bytes object. Nr)r fdr s r pipe_data_receivedz%SubprocessProtocol.pipe_data_receivedrrcy)zCalled when a file descriptor associated with the child process is closed. fd is the int file descriptor that was closed. Nr)r r5rs r pipe_connection_lostz'SubprocessProtocol.pipe_connection_lostrrcy)z"Called when subprocess has exited.Nrrs r process_exitedz!SubprocessProtocol.process_exitedrrN)rrrrrr6r8r:rrr rrs6I  1rrct|}|rr|j|}t|}|s td||k\r||d||j|y|d||d||j|||d}t|}|rqyy)Nz%get_buffer() returned an empty buffer)lenr( RuntimeErrorr+)protor data_lenbufbuf_lens r _feed_data_to_buffered_protorBs4yH x(c(FG G h !C N   *  'NCM   )>D4yH rN)r__all__rrrrrrBrrr rDsQ%  6 6 r( |( V2 |2 j  |  11.!r__pycache__/base_subprocess.cpython-312.opt-1.pyc000064400000037003152527367570015626 0ustar00 {|j"ddlZddlZddlZddlmZddlmZddlmZGddejZ Gdd ejZ Gd d e ejZ y) N) protocols) transports)loggerceZdZ dfd ZdZdZdZdZdZdZ e jfdZ d Z d Zd Zd Zd ZdZdZdZdZdZdZdZdZdZdZxZS)BaseSubprocessTransportc nt || d|_||_||_d|_d|_d|_g|_tj|_ i|_ d|_ |tjk(rd|jd<|tjk(rd|jd<|tjk(rd|jd< |j d||||||d| |j j$|_|j |j&d<|jj)r?t+|t,t.fr|} n|d} t1j2d| |j |jj5|j7| y#|j#xYw) NFrr)argsshellstdinstdoutstderrbufsize subprocesszprocess %r created: pid %s)super__init___closed _protocol_loop_proc_pid _returncode _exit_waiters collectionsdeque_pending_calls_pipes _finishedrPIPE_startclosepid_extra get_debug isinstancebytesstrrdebug create_task_connect_pipes)selfloopprotocolr r r rrrwaiterextrakwargsprogram __class__s 0/usr/lib64/python3.12/asyncio/base_subprocess.pyrz BaseSubprocessTransport.__init__ sx  !   )//1  JOO #!DKKN Z__ $!DKKN Z__ $!DKKN  DKK BTeF%w B:@ B JJNN $(JJ L! ::   !$ -q' LL5 $)) - t226:;  JJL s F!!F4c^|jjg}|jr|jd|j|jd|j|j |jd|j n/|j|jdn|jd|j jd}||jd|j|j jd}|j jd }|#||ur|jd |jn@||jd |j||jd |jd jdj|S)Nclosedzpid=z returncode=runningz not startedrzstdin=rr zstdout=stderr=zstdout=zstderr=z<{}> ) r4__name__rappendrrrgetpipeformatjoin)r-infor rrs r5__repr__z BaseSubprocessTransport.__repr__7sX''( << KK ! 99 KK$tyyk* +    ' KK+d&6&6%78 9 YY " KK " KK & "   KK& - .##  &F"2 KK. 6 7! gfkk]34! gfkk]34}}SXXd^,,c tN)NotImplementedError)r-r r r rrrr2s r5r"zBaseSubprocessTransport._startTs!!rBc||_yrDr)r-r/s r5 set_protocolz$BaseSubprocessTransport.set_protocolWs !rBc|jSrDrGr-s r5 get_protocolz$BaseSubprocessTransport.get_protocolZs ~~rBc|jSrD)rrJs r5 is_closingz"BaseSubprocessTransport.is_closing]s ||rBc|jryd|_|jjD]}||jj !|j t|j g|j jL|jjrtjd| |j jyyyy#t$rYywxYw)NTz$Close running child process: kill %r)rrvaluesr=r#rrpollrr&rwarningkillProcessLookupError)r-protos r5r#zBaseSubprocessTransport.close`s <<  [['')E} JJ   * JJ "  ( !)zz##%EtL  ! *) #&  s4C CCcb|js#|d|t||jyy)Nzunclosed transport )source)rResourceWarningr#)r-_warns r5__del__zBaseSubprocessTransport.__del__{s+|| 'x0/$ O JJLrBc|jSrD)rrJs r5get_pidzBaseSubprocessTransport.get_pids yyrBc|jSrD)rrJs r5get_returncodez&BaseSubprocessTransport.get_returncodesrBcR||jvr|j|jSyrD)rr=)r-fds r5get_pipe_transportz*BaseSubprocessTransport.get_pipe_transports%  ;;r?'' 'rBc0|j tyrD)rrSrJs r5 _check_procz#BaseSubprocessTransport._check_procs :: $& & rBcZ|j|jj|yrD)rbr send_signal)r-signals r5rdz#BaseSubprocessTransport.send_signals   v&rBcX|j|jjyrD)rbr terminaterJs r5rgz!BaseSubprocessTransport.terminates  rBcX|j|jjyrD)rbrrRrJs r5rRzBaseSubprocessTransport.kills  rBcK j}j}|j9|jfd|jd{\}}|jd<|j 9|j fd|j d{\}}|jd<|j9|j fd|jd{\}}|jd<|jjjjD]\}}|j|g|d_ |#|js|jdyyy777#ttf$rt $r7}|+|js|j#|Yd}~yYd}~yYd}~yd}~wwxYww)NctdS)Nr)WriteSubprocessPipeProtorJsr5z8BaseSubprocessTransport._connect_pipes..s 4T1=rBrctdS)NrReadSubprocessPipeProtorJsr5rlz8BaseSubprocessTransport._connect_pipes.. 3D!.rprBr )rrr connect_write_piperrconnect_read_piper call_soonrconnection_mader cancelled set_result SystemExitKeyboardInterrupt BaseException set_exception) r-r0procr._r=callbackdataexcs ` r5r,z&BaseSubprocessTransport._connect_pipess# (::D::Dzz% $ 7 7=JJ!  4"& A{{& $ 6 6<KK!!!4"& A{{& $ 6 6<KK!!!4"& A NN4>>994 @"&"5"5$x/$/#6"&D !&*:*:*<!!$'+=!; ! !-.   *!&*:*:*<$$S))+=! *shF?AE- E& AE-E)AE-E+A*E-&F?&E-)E-+E--F<#F7(F?7F<<F?c|j|jj||fy|jj|g|yrD)rr;rrt)r-cbrs r5_callzBaseSubprocessTransport._calls?    *    & &Dz 2 DJJ  +d +rBcr|j|jj|||jyrD)rrpipe_connection_lost _try_finish)r-r_rs r5_pipe_connection_lostz-BaseSubprocessTransport._pipe_connection_losts( 4>>66C@ rBcR|j|jj||yrD)rrpipe_data_received)r-r_rs r5_pipe_data_receivedz+BaseSubprocessTransport._pipe_data_receiveds 4>>44b$?rBc,|jjrtjd||||_|j j ||j _|j|jj|jy)Nz%r exited with return code %r) rr&rr@rr returncoderrprocess_exitedr)r-rs r5_process_exitedz'BaseSubprocessTransport._process_exitedsm ::   ! KK7z J% :: (%/DJJ ! 4>>001 rBcK|j |jS|jj}|jj ||d{S7w)zdWait until the process exit and return the process return code. This method is a coroutine.N)rr create_futurerr;)r-r0s r5_waitzBaseSubprocessTransport._waitsP    '## #))+ !!&)||sAAAAc|jytd|jjDr$d|_|j |j dyy)Nc3@K|]}|duxr |jywrD) disconnected).0ps r5 z6BaseSubprocessTransport._try_finish..s(.,1}//,sT)rallrrOr r_call_connection_lostrJs r5rz#BaseSubprocessTransport._try_finishsS    #  . **,. .!DN JJt114 8 .rBc |jj||jD].}|jr|j |j 0d|_d|_d|_d|_y#|jD].}|jr|j |j 0d|_d|_d|_d|_wxYwrD)rconnection_lostrrvrwrrr)r-rr0s r5rz-BaseSubprocessTransport._call_connection_losts " NN * *3 /,,'')%%d&6&67-"&D DJDJ!DN ,,'')%%d&6&67-"&D DJDJ!DNsA77 C:C)NN)r: __module__ __qualname__rrAr"rHrKrMr#warningswarnrYr[r]r`rbrdrgrRr,rrrrrrr __classcell__)r4s@r5rr s%)))r4r:r_r=rJs r5rAz!WriteSubprocessPipeProto.__repr__ s04>>**+4ytyym1MMrBcld|_|jj|j|d|_y)NT)rr|rr_)r-rs r5rz(WriteSubprocessPipeProto.connection_lost s)  ''5 rBcL|jjjyrD)r|r pause_writingrJs r5rz&WriteSubprocessPipeProto.pause_writings ))+rBcL|jjjyrD)r|rresume_writingrJs r5rz'WriteSubprocessPipeProto.resume_writings **,rBN) r:rrrrurArrrrrBr5rkrks!" N ,-rBrkceZdZdZy)rocP|jj|j|yrD)r|rr_)r-rs r5 data_receivedz%ReadSubprocessPipeProto.data_receiveds %%dggt4rBN)r:rrrrrBr5roros5rBro)rrrrrlogrSubprocessTransportr BaseProtocolrkProtocolrorrBr5rsTr"j<<r"j-y55-456'005rB__pycache__/windows_utils.cpython-312.opt-1.pyc000064400000016013152527367570015354 0ustar00 {|jdZddlZejdk7redddlZddlZddlZddlZddlZddl Z ddl Z dZ dZ ejZ ejZejZdde d d ZGd d ZGd dej&Zy)z)Various Windows specific bits and pieces.Nwin32z win32 only)pipePopenPIPE PipeHandlei F)TT)duplex overlappedbufsizec tjdjtjt t }|r6tj}tjtjz}||}}n$tj}tj}d|}}|tjz}|dr|tjz}|drtj}nd}dx} } tj||tjd||tj tj"} tj$||dtj"tj&|tj"} tj(| d} | j+d| | fS#| tj,| | tj,| xYw)zELike os.pipe() but with overlapped support and using handles not fds.z\\.\pipe\python-pipe-{:d}-{:d}-)prefixrNTr )tempfilemktempformatosgetpidnext _mmap_counter_winapiPIPE_ACCESS_DUPLEX GENERIC_READ GENERIC_WRITEPIPE_ACCESS_INBOUNDFILE_FLAG_FIRST_PIPE_INSTANCEFILE_FLAG_OVERLAPPEDCreateNamedPipe PIPE_WAITNMPWAIT_WAIT_FOREVERNULL CreateFile OPEN_EXISTINGConnectNamedPipeGetOverlappedResult CloseHandle) rr r addressopenmodeaccessobsizeibsizeflags_and_attribsh1h2ovs ./usr/lib64/python3.12/asyncio/windows_utils.pyrr soo188 IIKm,./G--%%(=(== '..&&G 555H!}G000!}#88NB  $ $ Xw00 vvw;;W\\K   VQ g.C.C w||- % %bT : t$2v  >    # >    # s *B6F!!1Gc|eZdZdZdZdZedZdZe jddZ e jfdZd Zd Zy ) rzWrapper for an overlapped pipe handle which is vaguely file-object like. The IOCP event loop can use these instead of socket objects. c||_yN_handleselfhandles r/__init__zPipeHandle.__init__Vs  cx|jd|j}nd}d|jjd|dS)Nzhandle=closed< >)r4 __class____name__r5s r/__repr__zPipeHandle.__repr__YsB << #t||./FF4>>**+1VHA66r9c|jSr2r3r6s r/r7zPipeHandle.handle`s ||r9cH|j td|jS)NzI/O operation on closed pipe)r4 ValueErrorrCs r/filenozPipeHandle.filenods" << ;< <||r9)r%cP|j||jd|_yyr2r3)r6r%s r/closezPipeHandle.closeis$ << #  %DL $r9cb|j#|d|t||jyy)Nz unclosed )source)r4ResourceWarningrH)r6_warns r/__del__zPipeHandle.__del__ns- << # IdX& E JJL $r9c|Sr2rCs r/ __enter__zPipeHandle.__enter__ss r9c$|jyr2)rH)r6tvtbs r/__exit__zPipeHandle.__exit__vs  r9N)r@ __module__ __qualname____doc__r8rApropertyr7rFrr%rHwarningswarnrMrPrUrOr9r/rrQsR7 $+#6#6 %MM r9rc$eZdZdZdfd ZxZS)rzReplacement for subprocess.Popen using overlapped pipe handles. The stdin, stdout, stderr are None or instances of PipeHandle. c dx}x}}dx} x} } |tk(r5tdd\} } tj| tj }n|}|tk(r&td\} } tj| d}n|}|tk(r&td\} }tj|d}n|t k(r|}n|} t| |f|||d|| t| |_ | t| |_ | t| |_ |tk(rt j||tk(rt j||tk(rt j|yy#| | | fD]}|tj|xYw#|tk(rt j||tk(rt j||tk(rt j|wwxYw)N)FTT)r r)TFrr)stdinstdoutstderr)rrmsvcrtopen_osfhandlerO_RDONLYSTDOUTsuperr8rr^r_r`rr%rH)r6argsr^r_r`kwds stdin_rfd stdout_wfd stderr_wfdstdin_wh stdout_rh stderr_rhstdin_rh stdout_wh stderr_whhr?s r/r8zPopen.__init__s/32 2J+///9y D=!%t!L Hh--h DII T>#'=#A Iy..y!#'=#A Iy..y!r{s/ <<7 l ##  0     ! \7+b&&X0%J  0%r9__pycache__/base_futures.cpython-312.opt-2.pyc000064400000005442152527367570015136 0ustar00 {|jhdZddlZddlmZdZdZdZdZd Zd Z ejd Z y) N)format_helpersPENDING CANCELLEDFINISHEDcP t|jdxr|jduS)N_asyncio_future_blocking)hasattr __class__r )objs -/usr/lib64/python3.12/asyncio/base_futures.pyisfuturer s0 CMM#= > 5  ( ( 46c" t|}|sd}d}|dk(r||dd}nc|dk(r+dj||dd||dd}n3|dkDr.dj||dd|dz ||dd}d |d S) Nc.tj|dS)Nr)r_format_callback_source)callbacks r format_cbz$_format_callbacks..format_cbs55hCCrrrz{}, {}z{}, <{} more>, {}zcb=[])lenformat)cbsizers r_format_callbacksrs- r7D  D qy r!uQx   __Yr!uQx0)BqE!H2E F  ' ' "Q%((;(,q(1"R&)(<>"Q<rc |jjg}|jtk(r^|j|j d|jn3t j |j}|j d||jr$|j t|j|jr,|jd}|j d|dd|d|S)Nz exception=zresult=rz created at r:r) _statelower _FINISHED _exceptionappendreprlibrepr_result _callbacksr_source_traceback)futureinforesultframes r_future_repr_infor/,s- MM   ! "D }} !    ( KK*V%6%6$9: ;\\&..1F KK'&* +  %f&7&789 ((, k%(1U1XJ78 Krcpdjt|}d|jjd|dS)N <>)joinr/r __name__)r+r,s r _future_reprr6@s8 88%f- .D v(()4& 22r) __all__r&rr_PENDING _CANCELLEDr#rrr/recursive_reprr6rrrr;sO     6((33r__pycache__/tasks.cpython-312.opt-1.pyc000064400000116372152527367570013600 0ustar00 {|jdZdZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddlm Z ddl m Z ddl mZddl mZdd l mZdd l mZdd l mZej&dj(Zd/d Zd/d ZdZGddej2ZeZ ddlZej4xZZddddZej"j@Z ej"jBZ!ej"jDZ"de"ddZ#dZ$dZ%dZ&dZ'dddZ(ejRdZ*d/dZ+dddZ,Gdd ejZZ.d!d"d#Z/d$Z0d%Z1d&Z2e2eZ3e jhZ5e6Z7iZ8d'Z9d(Z:d)Z;d*Zd-Z?eZ@e9ZAe:ZBe>ZCe?ZDe;ZEeZ>m?Z?m;Z;mZKe?ZLe;ZMeD!  #t+AFFH D >>   FADy   >sB0B"BBc| |j}||yy#t$rtjdtdYywxYw)Nz~Task.set_name() was added in Python 3.8, the method support will be mandatory for third-party task implementations since 3.13.) stacklevel)set_nameAttributeErrorwarningswarnDeprecationWarning)tasknamer8s r&_set_task_namer?FsM  }}H TN 8 MM9)Q 8 8s %AAceZdZdZdZdddddfd ZfdZeeZ dZ d Z d Z d Z d Zd ZdZdddZddddZddZdZdZdZddZfdZdZxZS)rz A coroutine wrapped in a Future.TNFr%r>context eager_startcFt|||jr |jd=tj|sd|_t d||dt|_nt||_d|_ d|_ d|_ ||_ |tj|_n||_|r+|j"j%r|j'y|j"j)|j*|j t-|y)Nr$Fza coroutine was expected, got zTask-rrB)super__init___source_tracebackr iscoroutine_log_destroy_pending TypeError_task_name_counter_namestr_num_cancels_requested _must_cancel _fut_waiter_coro contextvars copy_context_context_loop is_running_Task__eager_start call_soon _Task__stepr)selfcoror%r>rBrC __class__s r&rHz Task.__init__os d#  ! !&&r*%%d+).D %>r'cd|_|jry|xjdz c_|j|jj |ryd|_||_y)aRequest 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). This also increases the task's count of cancellation requests. FrmsgT)_log_tracebackr0rPrRcancelrQ_cancel_message)r\rs r&rz Task.cancelsf,$ 99; ##q(#    '&&3&/ "r'c|jS)zReturn the count of the task's cancellation requests. This count is incremented when .cancel() is called and may be decremented using .uncancel(). rPris r& cancellingzTask.cancellings ***r'cb|jdkDr|xjdzc_|jS)zDecrement the task's count of cancellation requests. This should be called by the party that called `cancel()` on the task beforehand. Returns the remaining number of cancellation requests. rrrris r&uncancelz Task.uncancels/  & & *  ' '1 , '***r'cpt|j|} t| |jj |j dt | t|j|}|jr d|_d}yt|y#t |wxYw#|jr d|_d}wt|wxYw# t|j|}|jr d|_d}wt|w#|jr d|_d}wt|wxYwxYwrg) _swap_current_taskrW_register_eager_taskrVrun!_Task__step_run_and_handle_result_unregister_eager_taskr0rSr)r\ prev_taskcurtasks r& __eager_startzTask.__eager_starts&tzz48  )  & - !!$"C"CTJ&t, ),TZZC99;!%DJD"4('t, 99;!%DJD"4( ),TZZC99;!%DJD"4( 99;!%DJD"4(sF C &B C B# B  C #'C  D5D %&D5 'D22D5c|jrtjd|d||jr1t |tj s|j }d|_d|_t|j| |j|t|j|d}y#t|j|d}wxYw)Nz_step(): already done: z, F) r0rInvalidStateErrorrQ isinstanceCancelledError_make_cancelled_errorrRrrWrr)r\excs r&__stepz Task.__step#s 99;..)$C7;= =   c:#<#<=002 %D DJJ%   - -c 2  D )D  D )Ds B11C c|j} ||jd}n|j|}t|dd}|lt j ||j urGtd|d|d}|j j|j||jd}y|r||urCtd|}|j j|j||jd}yd|_ |j|j|j||_|jrN|jj!|j"r'd|_ d}ytd |d |}|j j|j||j d}y|4|j j|j|jd}yt%j&|rFtd |d |}|j j|j||jd}ytd |}|j j|j||j d}yd}y#t($rS}|jr"d|_t*|A|j"nt*|Y|j.Yd}~d}yd}~wt0j2$r!}||_t*|AYd}~d}yd}~wt6t8f$r}t*|u|d}~wt<$r}t*|u|Yd}~d}yd}~wwxYw#d}wxYw) N_asyncio_future_blockingzTask z got Future z attached to a different looprFzTask cannot await on itself: Frz-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: )rSsendthrowgetattrrr/rWr,rZr[rVradd_done_callback _Task__wakeuprRrQrrinspect isgenerator StopIterationrGrwrsrr_cancelled_excKeyboardInterrupt SystemExitrz BaseException)r\rr]rvblockingnew_excr^s r&__step_run_and_handle_resultz!Task.__step_run_and_handle_result4sezzG {4C$v'A4HH#$$V,DJJ>*x|!*$ACDGJJ(( Wdmm)EPDM~".;D8D#F ,, KK$---IDD?;@700 MM4==1B+1(,,#//66(,(<(< 7 >49 10D-+##'(& <=GJJ(( Wdmm)E&D! $$T[[$--$HD$$V,&))-vjBC $$KK$--%AD ')=fZ'HI $$KK$--%AD4DA .  $)!4#7#78"399-tDs(( "%D  GN  lDk":.  G !# &  ' G !# & &bDe 'dDs%JA5M,AM5A0M)AM03M&AMAM MAKMM5L MM#L33 M?MMMMM!c |j|jd}y#t$r}|j|Yd}~d}yd}~wwxYwrg)rvr[r)r\futurers r&__wakeupz Task.__wakeupsH  MMO KKM  KK   s% A AA rg)__name__ __module__ __qualname____doc__rKrHre classmethodr__class_getitem__rjrlrorqr8rwrzr~rrrrrYr[rr __classcell__r^s@r&rrSs+. %)d"!> $L1+ IL"&7.$(d ?(T+ +)&"IVr'rr>rBctj}||j|}n|j||}t|||S)z]Schedule the execution of a coroutine object in a spawn task. Return a Task object. rF)rr!rr?)r]r>rBr%r=s r&rrsK  " " $D%g64 Kr')timeout return_whencKtj|stj|r!t dt |j |s td|tttfvrtd|t|}td|Dr t dtj}t||||d{S7w)a}Wait for the Futures or Tasks 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 zSet of Tasks/Futures is empty.zInvalid return_when value: c3FK|]}tj|ywrg)rrJ).0fs r& zwait..s 1b: ! !! $bs!z6Passing coroutines is forbidden, use tasks explicitly.N)risfuturerrJrLtyper ValueErrorrrrsetanyrr!_wait)fsrrr%s r&rrs z55b98b9J9J8KLMM 9::?O]KK6{mDEE RB 1b 11PQQ  " " $Dr7K6 66 6sCC C CcH|js|jdyyrg)r0rw)waiterargss r&_release_waiterrs ;;=$ r'cK|T|dkrOt|}|jr|jSt|d{ |jStj|4d{|d{cdddd{S7N#tj $r }t |d}~wwxYw7C7;7-#1d{7swYyxYww)aWait 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. If the task suppresses the cancellation and returns a value instead, that value is returned. This function is a coroutine. Nr) r r0rv_cancel_and_waitrr TimeoutErrorrr)futrrs r&rrsFw!|C  88:::< s### (::< ((y)(( $(( (C ' ())(((sACBC BC2B63C6B<<B8=B< C B: CB3'B..B33C8B<:C<CC C Cc0 K|j d ||j|t  t| fd}|D]}|j | d{  j |D]}|j | tt}}|D]5}|jr|j|%|j|7||fS7#  j |D]}|j |wxYww)zVInternal helper for wait(). The fs argument must be a collection of Futures. Ncdzdks2tk(s)tk(rW|jsF|j5j j sj dyyyyy)Nrr)rr cancelledryrr0rw)rcounterrtimeout_handlers r&_on_completionz_wait.._on_completionst1  qL ? * ? *AKKM01 0I)%%';;=!!$'!1J5B *r') create_future call_laterrlenrrremove_done_callbackrr0add) rrrr%rrr0pendingrrrs ` @@@r&rr s    !FN/6J"gG ( N+3  %  ! ! #A " "> 2E35'D  668 HHQK KKN  =   %  ! ! #A " "> 2s1ADC'#C%$C'(A=D%C'',DDc2Ktj}|j}tjt |}|j | |j|d{|j|y7#|j|wxYww)z._on_timeoutds2A " "> 2 OOD ! r'c|syj|j|sjyyyrg)removerr)rr0rrs r&rz$as_completed.._on_completionjs;  A 2  ! ! #3tr'cKjd{}|tj|jS7&wrg)r#rrrv)rr0s r& _wait_for_onez#as_completed.._wait_for_oners7((*  9)) )xxz sA>'A)rrrrJrLrrqueuesrrget_event_looprr rrranger) rrrr%rrr_rr0rrs @@@@r&r r Hs$z55b9=d2h>O>O=PQRR 7D  "D14R 9AM!$ ' 9DN $ N+ #+> 3t9 o9 :sA:DC=A.Dc#Kdyw)zSkip 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. Nrr'r&__sleep0rs  sc0K|dkrtd{|Stj}|j}|j |t j ||} |d{|jS7g7#|jwxYww)z9Coroutine that completes after a given time (in seconds).rN)rrr!rrr_set_result_unless_cancelledr)delayrvr%rhs r&r r s zj  " " $D    !F << (A|     s:BA=A B#B(A?)B,B?BBBr$ctj|r&|"|tj|ur td|Sd}t j |s.t j|rd}||}d}n td|tj} |j|S#t$r|r|jwxYw)zmWrap a coroutine or an awaitable in a future. If the argument is a Future, it is returned directly. zRThe future belongs to a different loop than the one specified as the loop argumentTc"K|d{S7wrgr) awaitables r&_wrap_awaitablez&ensure_future.._wrap_awaitables&&s  Fz:An asyncio.Future, a coroutine or an awaitable is required)rrr/rrrJr isawaitablerLrrrr,close)coro_or_futurer% should_closers r&r r s '  G,=,=n,M MEF FL  ! !. 1   ~ . '-^._done_callbacks,Q =EJJL==?   }}//1##C(mmo?'',  G==?%33!119++-C--/C{!jjls# "&&//1##C(  ); r'rNr$Fr) rrrrwr rr/rKr0r rr) r coros_or_futuresr%r arg_to_fut done_futsargrrrrrs ` @@@@r&r r s < $$&""$  5*5*nJH EII D E j $/C|((-#~ ,1( QJE!JsOxxz  %%%n5S/C/ 2 XD 1E s Lr'ct|jrStj}|j fdfd}j j |S)aWait for a future, shielding it from cancellation. The statement task = asyncio.create_task(something()) res = await shield(task) 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: task = asyncio.create_task(something()) try: res = await shield(task) except CancelledError: res = None Save a reference to tasks passed to this function, to avoid a task disappearing mid-execution. The event loop only keeps weak references to tasks. A task that isn't referenced elsewhere may get garbage collected at any time, even before it's done. c0jr!|js|jy|jrjy|j}|j|yj |j yrg)rryrrzrwrv)innerrrs r&_inner_done_callbackz$shield.._inner_done_callbacksj ?? ??$!  ??  LLN//#C##C(  0r'cJjsjyyrg)r0r)rrrs r&_outer_done_callbackz$shield.._outer_done_callbacks zz|  & &'; <r')r r0rr/rr)rr%rrrrs @@@r&r r askB # E zz|   U #D    E1"= 01 01 Lr'ctjs tdtjj fd}j |S)zsSubmit a coroutine object to a given event loop. Return a concurrent.futures.Future to access the result. zA coroutine object is requiredc tjty#ttf$rt $r'}j rj|d}~wwxYw)Nr$)r _chain_futurer rrrset_running_or_notify_cancelrz)rr]rr%s r&callbackz*run_coroutine_threadsafe..callbacks]   ! !-4"@& I-.   224$$S)  s!%A$"AA$)rrJrL concurrentrFuturecall_soon_threadsafe)r]r%r"rs`` @r&rrsM  ! !$ '899    & & (F h' Mr'cdddfd }|S)a=Create a function suitable for use as a task factory on an event-loop. Example usage: loop.set_task_factory( asyncio.create_eager_task_factory(my_task_constructor)) Now, tasks created will be started immediately (rather than being first scheduled to an event loop). The constructor argument can be any callable that returns a Task-compatible object and has a signature compatible with `Task.__init__`; it must have the `eager_start` keyword argument. Most applications will use `Task` for `custom_task_constructor` and in this case there's no need to call `create_eager_task_factory()` directly. Instead the global `eager_task_factory` instance can be used. E.g. `loop.set_task_factory(asyncio.eager_task_factory)`. Nrc||||dS)NTrAr)r%r]r>rBcustom_task_constructors r&factoryz*create_eager_task_factory..factorys& t$TK Kr'r)r(r)s` r&rrs&%)$K Nr'c.tj|y)z;Register an asyncio Task scheduled to run on an event loop.N)r+rr=s r&rrsr'c.tj|y)z6Register an asyncio Task about to be eagerly executed.N)r*rr+s r&rrsTr'chtj|}|td|d|d|t|<y)NzCannot enter into task z while another task z is being executed.r"r#r,r%r=rs r&rrsL!%%d+L4TH=##/"22EGH HN4r'chtj|}||urtd|d|dt|=y)Nz Leaving task z! does not match the current task .r.r/s r&rrsJ!%%d+L4]4(3//;.>aAB Btr'cXtj|}| t|=|S|t|<|Srg)r"r#)r%r=rs r&rrs9""4(I | 4   $t r'c.tj|y)z'Unregister a completed, scheduled Task.N)r+discardr+s r&rrsT"r'c.tj|y)z6Unregister a task which finished its first eager step.N)r*r4r+s r&rr sr') rrrrrrrr+r*r"rrg)Pr__all__concurrent.futuresr#rTrrr-typesr:weakrefrr rrrrrrcount__next__rMrrr? _PyFuturer_PyTask_asyncio_CTask ImportErrorrrrrrrrrrr coroutinerr r r$rr r rrrWeakSetr+rr*r"rrrrrrr_py_current_task_py_register_task_py_register_eager_task_py_unregister_task_py_unregister_eager_task_py_enter_task_py_leave_task_py_swap_current_task_c_current_task_c_register_task_c_register_eager_task_c_unregister_task_c_unregister_eager_task _c_enter_task _c_leave_task_c_swap_current_taskrr'r&rSsM6   %Y__Q'00$>6 z7  zz " MM!D6#D $$$44$$44""00 # 7@ 0d)X%$!%6r  "+/@w~~:16CL?D.4/t4 #7??$u    #   ".&2*.((((#O%1)5MM-i  T  s$F5 G5F>=F>G G __pycache__/unix_events.cpython-312.opt-1.pyc000064400000202743152527367570015020 0ustar00 {|jdZddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl Z ddl mZddl mZddl mZddl mZddl mZdd l mZdd l mZdd l mZdd l mZdd l mZddlmZdZe j6dk(reddZdZGddej>Z GddejBZ"GddejFejHZ%GddejLZ'GddZ(Gdde(Z)Gd d!e(Z*Gd"d#e*Z+Gd$d%e*Z,Gd&d'e(Z-Gd(d)e(Z.d*Z/Gd+d,ej`Z1e Z2e1Z3y)-z2Selector event loop for Unix with signal handling.N) base_events)base_subprocess) constants) coroutines)events) exceptions)futures)selector_events)tasks) transports)logger)SelectorEventLoopAbstractChildWatcherSafeChildWatcherFastChildWatcherPidfdChildWatcherMultiLoopChildWatcherThreadedChildWatcherDefaultEventLoopPolicywin32z+Signals are not really supported on Windowscy)zDummy signal handler.N)signumframes ,/usr/lib64/python3.12/asyncio/unix_events.py_sighandler_noopr*scP tj|S#t$r|cYSwxYwN)oswaitstatus_to_exitcode ValueError)statuss rr"r"/s.((00  s  %%ceZdZdZdfd ZfdZdZdZdZdZ d Z dd Z dd Z dd Z d Z ddddddddZ dddddddddZdZdZdZdZxZS)_UnixSelectorEventLoopzdUnix event loop. Adds signal handling and UNIX Domain Socket support to SelectorEventLoop. Nc2t||i|_yr )super__init___signal_handlers)selfselector __class__s rr)z_UnixSelectorEventLoop.__init__?s " "rc0t|tjs,t |j D]}|j |y|j r;tjd|dt||j jyy)NzClosing the loop z@ on interpreter shutdown stage, skipping signal handlers removalsource) r(closesys is_finalizinglistr*remove_signal_handlerwarningswarnResourceWarningclear)r+sigr-s rr1z_UnixSelectorEventLoop.closeCs    "D112**3/3$$ 1$:HI.%) + %%++- %rc:|D]}|s|j|yr )_handle_signal)r+datars r_process_self_dataz)_UnixSelectorEventLoop._process_self_dataQs F    ' rcRtj|stj|r td|j ||j  t j|jjtj|||d}||j |< t j |t"t j$|dy#ttf$r}tt|d}~wwxYw#t$r}|j |=|j sI t jdn2#ttf$r }t'j(d|Yd}~nd}~wwxYw|j*t*j,k(rtd|dd}~wwxYw)zAdd a handler for a signal. UNIX only. Raise ValueError if the signal number is invalid or uncatchable. Raise RuntimeError if there is a problem setting up the handler. z3coroutines cannot be used with add_signal_handler()NFset_wakeup_fd(-1) failed: %ssig  cannot be caught)r iscoroutineiscoroutinefunction TypeError _check_signal _check_closedsignal set_wakeup_fd_csockfilenor#OSError RuntimeErrorstrrHandler*r siginterruptrinfoerrnoEINVAL)r+r:callbackargsexchandlenexcs radd_signal_handlerz)_UnixSelectorEventLoop.add_signal_handlerXsq  " "8 ,..x889 9 3  )  !3!3!5 6xtT:%+c"  MM#/ 0   U +G$ )s3x( ( ) %%c*((F((,"G,FKK >EEFyyELL("T#.?#@AA sZ-C-0D D-DD F&F!,EF!E1E,'F!,E110F!!F&c|jj|}|y|jr|j|y|j |y)z2Internal helper that is the actual signal handler.N)r*get _cancelledr5_add_callback_signalsafe)r+r:rXs rr<z%_UnixSelectorEventLoop._handle_signalsE&&**3/ >      & &s +  ) )& 1rc|j| |j|=|tjk(rtj }ntj } tj|||js tjdyy#t$rYywxYw#t$r2}|jtjk(rtd|dd}~wwxYw#ttf$r }tjd|Yd}~yd}~wwxYw)zwRemove a handler for a signal. UNIX only. Return True if a signal handler was removed, False if not. FrBrCNr@rAT)rGr*KeyErrorrISIGINTdefault_int_handlerSIG_DFLrMrSrTrNrJr#rrR)r+r:handlerrWs rr5z,_UnixSelectorEventLoop.remove_signal_handlers 3 %%c* &-- 00GnnG  MM#w '$$ A$$R(-   yyELL("T#.?#@AA  ( A :C@@ AsA BB8C BB C'-CCD +DD ct|tstd||tjvrt d|y)zInternal helper to validate a signal. Raise ValueError if the signal number is invalid or uncatchable. Raise RuntimeError if there is a problem setting up the handler. zsig must be an int, not zinvalid signal number N) isinstanceintrFrI valid_signalsr#)r+r:s rrGz$_UnixSelectorEventLoop._check_signalsJ #s#6sg>? ? f**, ,5cU;< < -rc t|||||Sr )_UnixReadPipeTransportr+pipeprotocolwaiterextras r_make_read_pipe_transportz0_UnixSelectorEventLoop._make_read_pipe_transports%dD(FEJJrc t|||||Sr )_UnixWritePipeTransportrks r_make_write_pipe_transportz1_UnixSelectorEventLoop._make_write_pipe_transports&tT8VUKKrc lKtj5tjdtt j } ddd 5| j s td|j} t||||||||f| |d| } | j| j|j|  | d{ ddd| S#1swYxYw7#ttf$rt$r+| j!| j#d{7wxYw#1swY SxYww)NignorezRasyncio.get_child_watcher() is not activated, subprocess support is not installed.)rnro)r6catch_warnings simplefilterDeprecationWarningrget_child_watcher is_activerN create_future_UnixSubprocessTransportadd_child_handlerget_pid_child_watcher_callback SystemExitKeyboardInterrupt BaseExceptionr1_wait) r+rmrVshellstdinstdoutstderrbufsizerokwargswatcherrntransps r_make_subprocess_transportz1_UnixSelectorEventLoop._make_subprocess_transports/ $ $ &  ! !(,> ?..0G'$$& #$GHH'')F-dHdE,16676396/56F  % %fnn&6$($@$@& J  !0 9' &( 12    lln$$ '0 seD4/C D4A-D'>C!CC! D4CD4C!!;D$DD$$D''D1,D4c<|j|j|yr )call_soon_threadsafe_process_exited)r+pid returncoders rrz._UnixSelectorEventLoop._child_watcher_callbacks !!&"8"8*Er)sslsockserver_hostnamessl_handshake_timeoutssl_shutdown_timeoutcK|r |2td| td| td| td|| tdtj|}tjtjtj d} |j d|j||d{nf| td|jtjk7s|jtj k7rtd ||j d|j|||||| d{\}} || fS7#|jxYw7#w) Nz/you have to pass server_hostname when using sslz+server_hostname is only meaningful with ssl1ssl_handshake_timeout is only meaningful with ssl0ssl_shutdown_timeout is only meaningful with ssl3path and sock can not be specified at the same timerFzno path and sock were specified.A UNIX Domain Stream Socket was expected, got )rr) r#r!fspathsocketAF_UNIX SOCK_STREAM setblocking sock_connectr1familytype_create_connection_transport) r+protocol_factorypathrrrrr transportrms rcreate_unix_connectionz-_UnixSelectorEventLoop.create_unix_connections & EGG* !NOO$0 GII#/ FHH   IKK99T?D==1C1CQGD   '''d333 | !BCC v~~-II!3!33 DTHMOO   U #$($E$E "C"7!5%F%77 8(""%4  7s=BE#&E 7E 8E E# E EE#dT)rbacklogrrr start_servingc Kt|tr td| |s td| |s td|| tdt j |}t j t jt j}|ddvrH tjt j|jrt j| |j#|nU| td |j*t jk7s|j,t jk7rtd ||j/d t1j2||g|||||} |r-| j5t7j8dd{| S#t$rYt$r!} tj d|| Yd} ~ d} ~ wwxYw#t$rT} |j%| j&t&j(k(r!d|d } tt&j(| dd} ~ w|j%xYw7w) Nz*ssl argument must be an SSLContext or Nonerrrr)rz2Unable to check or remove stale UNIX socket %r: %rzAddress z is already in usez-path was not specified, and no sock specifiedrF)rfboolrFr#r!rrrrstatS_ISSOCKst_moderemoveFileNotFoundErrorrMrerrorbindr1rS EADDRINUSErrrrServer_start_servingr sleep) r+rrrrrrrrerrrWmsgservers rcreate_unix_serverz)_UnixSelectorEventLoop.create_unix_servers7 c4 HI I ,SCE E +CBD D   IKK99T?D==1C1CDDAwk)6}}RWWT]%:%:; $  $| CEE v~~-II!3!33 DTHMOO ##D4&2B$'2G$8:   ! ! #++a.  S)6LL"*+/666  99 0 00%TH,>?C!%"2"2C8dB  & !siBIAF'"G3B-I I!I' G0I2G:GIGI I 'AH66I  Ic K tj |j } tj|j}|r|n|}|sy|j} |j| d|||||d| d{S#t$rtjdwxYw#tt jf$r}tjdd}~wwxYw#t$rtjdwxYw7~w)Nzos.sendfile() is not availableznot a regular filer) r!sendfileAttributeErrorr SendfileNotAvailableErrorrLioUnsupportedOperationfstatst_sizerMr{_sock_sendfile_native_impl) r+rfileoffsetcountrLrfsize blocksizefuts r_sock_sendfile_nativez,_UnixSelectorEventLoop._sock_sendfile_nativebs 2 KK M[[]F MHHV$,,E#E   " ''T4(.y! Ey% 26602 2 2  7 78 M667KL L M M667KL L MsVC<BB"C6C<;C:<C<BC<"C;CCC<C77C<c |j} ||j||jr|j|||y|r/||z }|dkr%|j||||j |y t j | |||} | dk(r%|j||||j |y|| z }|| z }||j|||j| |j|| |||||| y#ttf$r;||j|||j| |j|| |||||| Yyt$r} |Q| jtjk(r4t| t ur#t!dtj} | | _| } |dk(r:t%j&d} |j||||j)| n)|j||||j)| Yd} ~ yYd} ~ yd} ~ wt*t,f$rt.$r.} |j||||j)| Yd} ~ yd} ~ wwxYw)Nrzsocket is not connectedzos.sendfile call failed)rL remove_writer cancelled_sock_sendfile_update_filepos set_resultr!r_sock_add_cancellation_callback add_writerrBlockingIOErrorInterruptedErrorrMrSENOTCONNrConnectionError __cause__r r set_exceptionrrr)r+r registered_fdrrLrrr total_sentfdsentrWnew_excrs rrz1_UnixSelectorEventLoop._sock_sendfile_native_implysT [[]  $   } - ==?  . .vvz J   *IA~2266:Nz*1 F;;r669=DJqy2266:Nz*$d"  (88dCD$C$CS "D& &y*F[ !12 B$44S$? OOB ? ?f"E9j B ')II/I_4 *-u~~?$'!Q !::-/2266:N!!#&2266:N!!#&&'-.   #  . .vvz J   c " " #s,:C??AIIB6HI+$IIcZ|dkDr&tj||tjyyNr)r!lseekSEEK_SET)r+rLrrs rrz4_UnixSelectorEventLoop._sock_sendfile_update_fileposs" > HHVVR[[ 1 rc6fd}|j|y)Ncv|jr(j}|dk7rj|yyy)Nr@)rrLr)rrr+rs rcbzB_UnixSelectorEventLoop._sock_add_cancellation_callback..cbs6}}[[]8&&r*r)add_done_callback)r+rrrs` ` rrz6_UnixSelectorEventLoop._sock_add_cancellation_callbacks + b!rr NN)__name__ __module__ __qualname____doc__r)r1r>rZr<r5rGrprsrrrrrrrr __classcell__r-s@rr&r&9s # .(+Z2@ =@D(,KAE)-L 04BF*.0#4 "&!% 0#f*.Gs"&!% GR.DFL2"rr&ceZdZdZdfd ZdZdZdZdZdZ dZ d Z d Z d Z d Zej fd ZddZdZdZxZS)rjic4t||||jd<||_||_|j |_||_d|_d|_ tj|j j}tj|sJtj|s5tj |s d|_d|_d|_t#dtj$|j d|jj'|jj(||jj'|j*|j |j,|,|jj't.j0|dyy)NrlFz)Pipe transport is for pipes/sockets only.)r(r)_extra_loop_piperL_fileno _protocol_closing_pausedr!rrrS_ISFIFOrS_ISCHRr# set_blocking call_soonconnection_made _add_reader _read_readyr _set_result_unless_cancelled)r+looprlrmrnromoder-s rr)z_UnixReadPipeTransport.__init__s. " F  {{} !  xx %-- d# d# T"DJDL!DNHI I  e, T^^;;TB T--!\\4+;+; =   JJ !E!E!' / rc^|jsy|jj||yr ) is_readingrr)r+rrUs rrz"_UnixReadPipeTransport._add_readers#  r8,rc:|j xr |j Sr )rrr+s rrz!_UnixReadPipeTransport.is_readings<<5 $55rct|jjg}|j|jdn|jr|jd|jd|j t |jdd}|jW|Utj||j tj}|r|jdnA|jdn/|j|jdn|jddjd j|S) Nclosedclosingfd= _selectorpollingidleopen<{}> )r-rrappendrrgetattrrr _test_selector_event selectors EVENT_READformatjoin)r+rRr,r s r__repr__z_UnixReadPipeTransport.__repr__s''( ::  KK ! ]] KK " c$,,()4::{D9 :: !h&:%::$,, (<(<>G I& F# ZZ # KK  KK !}}SXXd^,,rch tj|j|j}|r|jj |y|j jrtjd|d|_ |j j|j|j j|jj|j j|jdy#tt f$rYyt"$r}|j%|dYd}~yd}~wwxYw)N%r was closed by peerTz"Fatal read error on pipe transport)r!readrmax_sizer data_receivedr get_debugrrRr_remove_readerr eof_received_call_connection_lostrrrM _fatal_error)r+r=rWs rrz"_UnixReadPipeTransport._read_ready s G774<<7D ,,T2::'')KK 7> $  ))$,,7 $$T^^%@%@A $$T%?%?F !12   I   c#G H H Is*C<<D1 D1D,,D1c|jsyd|_|jj|j|jj rt jd|yy)NTz%r pauses reading)rrrrrrrdebugrs r pause_readingz$_UnixReadPipeTransport.pause_readingsP   !!$,,/ ::   ! LL,d 3 "rc|js |jsyd|_|jj|j|j |jj rtjd|yy)NFz%r resumes reading) rrrrrrrrr#rs rresume_readingz%_UnixReadPipeTransport.resume_reading%s[ ==   t||T-=-=> ::   ! LL-t 4 "rc||_yr rr+rms r set_protocolz#_UnixReadPipeTransport.set_protocol- !rc|jSr r(rs r get_protocolz#_UnixReadPipeTransport.get_protocol0 ~~rc|jSr rrs r is_closingz!_UnixReadPipeTransport.is_closing3 }}rc@|js|jdyyr )r_closers rr1z_UnixReadPipeTransport.close6s}} KK rcv|j-|d|t||jjyyNzunclosed transport r/rr8r1r+_warns r__del__z_UnixReadPipeTransport.__del__:5 :: ! 'x0/$ O JJ    "rc<t|trQ|jtjk(r4|jj rDt jd||dn*|jj||||jd|j|yNz%r: %sTexc_info)message exceptionrrm) rfrMrSEIOrrrr#call_exception_handlerrr4r+rWr@s rr!z#_UnixReadPipeTransport._fatal_error?sr sG $eii)?zz##% XtWtD JJ - -" ! NN /  Crcd|_|jj|j|jj |j |yNT)rrrrrr r+rWs rr4z_UnixReadPipeTransport._closeMs9  !!$,,/ T77=rc |jj||jjd|_d|_d|_y#|jjd|_d|_d|_wxYwr rconnection_lostrr1rrGs rr z,_UnixReadPipeTransport._call_connection_lostRg  NN * *3 / JJ   DJ!DNDJ JJ   DJ!DNDJ A 1A>rzFatal error on pipe transport)rrrrr)rrrrr$r&r*r-r1r1r6r7r:r!r4r rrs@rrjrjs]H/<- 6-*G$45"%MM > rrjceZdZdfd ZdZdZdZdZdZdZ dZ d Z d Z d Z d Zej fd ZdZddZddZdZxZS)rrct |||||jd<||_|j |_||_t|_d|_ d|_ tj|j j}tj|}tj |}tj"|} |s$|s"| s d|_d|_d|_t%dtj&|j d|j(j+|j j,|| s!|rdt.j0j3dsE|j(j+|j(j4|j |j6|,|j(j+t8j:|dyy)NrlrFz?Pipe transport is only for pipes, sockets and character devicesaix)r(r)rrrLrr bytearray_buffer _conn_lostrr!rrrrrrr#rrrrr2platform startswithrrr r) r+rrlrmrnroris_charis_fifo is_socketr-s rr)z _UnixWritePipeTransport.__init___si %" F {{} ! {  xx %--,,t$--%MM$' 7iDJDL!DNDE E  e, T^^;;TB )@)@)G JJ !7!7!%t/?/? A   JJ !E!E!' / rc|jjg}|j|jdn|jr|jd|jd|j t |jdd}|j{|ytj||j tj}|r|jdn|jd|j}|jd|n/|j|jdn|jdd jd j|S) Nrrr r r r zbufsize=r rr)r-rrrrrrrr rr EVENT_WRITEget_write_buffer_sizerr)r+rRr,r rs rrz _UnixWritePipeTransport.__repr__s ''( ::  KK ! ]] KK " c$,,()4::{D9 :: !h&:%::$,, (=(=?G I& F#002G KK(7), - ZZ # KK  KK !}}SXXd^,,rc,t|jSr )lenrRrs rr[z-_UnixWritePipeTransport.get_write_buffer_sizes4<<  rc|jjrtjd||jr|j t y|j y)Nr)rrrrRrRr4BrokenPipeErrorrs rrz#_UnixWritePipeTransport._read_readys@ ::   ! KK/ 6 << KK) * KKMrct|tr t|}|sy|js |jrH|jt j k\rtjd|xjdz c_y|jss tj|j|}|t'|k(ry|dkDrt||d}|j(j+|j|j,|xj|z c_ |j/y#ttf$rd}Ytt f$rt"$r1}|xjdz c_|j%|dYd}~yd}~wwxYw)Nz=pipe closed by peer or os.write(pipe, data) raised exception.rr#Fatal write error on pipe transport)rfrQ memoryviewrSrr!LOG_THRESHOLD_FOR_CONNLOST_WRITESrwarningrRr!writerrrrrrr!r]r _add_writer _write_ready_maybe_pause_protocol)r+r=nrWs rrez_UnixWritePipeTransport.writes7 dI &d#D  ??dmm)"M"MM HI OOq O || HHT\\40CI~Q!$'+ JJ " "4<<1B1B C   ""$$%56  12   1$!!#'LM s D$$E?7E?'E::E?c tj|j|j}|t |jk(r|jj |j j|j|j|jr6|j j|j|jdy|dkDr|jd|=yy#ttf$rYyttf$rt $rp}|jj |xj"dz c_|j j|j|j%|dYd}~yd}~wwxYw)Nrrra)r!rerrRr]r9r_remove_writer_maybe_resume_protocolrrr rrrrrrSr!)r+rirWs rrgz$_UnixWritePipeTransport._write_readys. %t||4AC %% ""$ ))$,,7++-==JJ--dll;..t4QLL!$) !12  -.   J LL   OOq O JJ % %dll 3   c#H I I  Js*C,,F=FA&E??FcyrFrrs r can_write_eofz%_UnixWritePipeTransport.can_write_eofrc|jryd|_|jsL|jj|j|jj |j dyyrF)rrRrrrrr rs r write_eofz!_UnixWritePipeTransport.write_eofsO ==  || JJ % %dll 3 JJ !;!;T Brc||_yr r(r)s rr*z$_UnixWritePipeTransport.set_protocolr+rc|jSr r(rs rr-z$_UnixWritePipeTransport.get_protocolr.rc|jSr r0rs rr1z"_UnixWritePipeTransport.is_closingr2rcX|j|js|jyyyr )rrrqrs rr1z_UnixWritePipeTransport.closes$ :: !$-- NN +8 !rcv|j-|d|t||jjyyr6r7r8s rr:z_UnixWritePipeTransport.__del__r;rc&|jdyr )r4rs rabortz_UnixWritePipeTransport.aborts Drct|tr4|jjrDt j d||dn*|jj ||||jd|j|yr=) rfrMrrrr#rCrr4rDs rr!z$_UnixWritePipeTransport._fatal_error sc c7 #zz##% XtWtD JJ - -" ! NN /  Crc>d|_|jr%|jj|j|jj |jj |j|jj|j|yrF) rrRrrkrr9rrr rGs rr4z_UnixWritePipeTransport._closesf << JJ % %dll 3  !!$,,/ T77=rc |jj||jjd|_d|_d|_y#|jjd|_d|_d|_wxYwr rIrGs rr z-_UnixWritePipeTransport._call_connection_lostrKrLrrMr )rrrr)rr[rrergrnrqr*r-r1r1r6r7r:rxr!r4r rrs@rrrrr\sd#/J-0!!%F%8C" %MM  >rrrceZdZdZy)r|c d}|tjk(r6tjj drt j \}} tj|f||||d|d||_|=|jt|jd||j_ d}|!|j|jyy#|!|j|jwwxYw)NrPF)rrrruniversal_newlinesrwb) buffering) subprocessPIPEr2rTrUr socketpairPopen_procr1r detachr) r+rVrrrrrrstdin_ws r_startz_UnixSubprocessTransport._start+s JOO # (?(?(F $..0NE7 #))E!vf#('E=CEDJ" #'(8$'#R  "  #w"  #s A!C%C7N)rrrrrrrr|r|)s rr|cBeZdZdZd dZdZdZdZdZdZ d Z d Z y) raHAbstract base class for monitoring child processes. Objects derived from this class monitor a collection of subprocesses and report their termination or interruption by a signal. New callbacks are registered with .add_child_handler(). Starting a new process must be done within a 'with' block to allow the watcher to suspend its activity until the new process if fully registered (this is needed to prevent a race condition in some implementations). Example: with watcher: proc = subprocess.Popen("sleep 1") watcher.add_child_handler(proc.pid, callback) Notes: Implementations of this class must be thread-safe. Since child watcher objects may catch the SIGCHLD signal and call waitpid(-1), there should be only one active object per process. Nc\|jtk7rtjdddyy)NrP{name!r} is deprecated as of Python 3.12 and will be removed in Python {remove}.r)rrr6 _deprecated)clss r__init_subclass__z&AbstractChildWatcher.__init_subclass__Xs, >>X %  !7;%, . &rct)aRegister a new child handler. Arrange for callback(pid, returncode, *args) to be called when process 'pid' terminates. Specifying another callback for the same process replaces the previous handler. Note: callback() must be thread-safe. NotImplementedErrorr+rrUrVs rr}z&AbstractChildWatcher.add_child_handler_s "##rct)zRemoves the handler for process 'pid'. The function returns True if the handler was successfully removed, False if there was nothing to remove.rr+rs rremove_child_handlerz)AbstractChildWatcher.remove_child_handlerjs "##rct)zAttach the watcher to an event loop. If the watcher was previously attached to an event loop, then it is first detached before attaching to the new loop. Note: loop may be None. rr+rs r attach_loopz AbstractChildWatcher.attach_looprs "##rct)zlClose the watcher. This must be called to make sure that any underlying resource is freed. rrs rr1zAbstractChildWatcher.close|s "##rct)zReturn ``True`` if the watcher is active and is used by the event loop. Return True if the watcher is installed and ready to handle process exit notifications. rrs rrzzAbstractChildWatcher.is_actives "##rct)zdEnter the watcher's context and allow starting new processes This function must return selfrrs r __enter__zAbstractChildWatcher.__enter__s "##rct)zExit the watcher's contextrr+abcs r__exit__zAbstractChildWatcher.__exit__s !##r)returnN) rrrrrr}rrr1rzrrrrrrrAs/,. $$$$$$ $rrc@eZdZdZdZdZdZdZdZdZ dZ d Z y ) ra6Child watcher implementation using Linux's pid file descriptors. This child watcher polls process file descriptors (pidfds) to await child process termination. In some respects, PidfdChildWatcher is a "Goldilocks" child watcher implementation. It doesn't require signals or threads, doesn't interfere with any processes launched outside the event loop, and scales linearly with the number of subprocesses launched by the event loop. The main disadvantage is that pidfds are specific to Linux, and only work on recent (5.3+) kernels. c|Sr rrs rrzPidfdChildWatcher.__enter__ rcyr r)r+exc_type exc_value exc_tracebacks rrzPidfdChildWatcher.__exit__ rcyrFrrs rrzzPidfdChildWatcher.is_activerorcyr rrs rr1zPidfdChildWatcher.closerrcyr rrs rrzPidfdChildWatcher.attach_looprrctj}tj|}|j ||j ||||yr )rget_running_loopr! pidfd_openr_do_wait)r+rrUrVrpidfds rr}z#PidfdChildWatcher.add_child_handlers:&&( c"  sE8TJrc$tj}|j| tj|d\}}t |}tj||||g|y#t $rd}tjd|YCwxYw)NrzJchild process pid %d exit status already read: will report returncode 255) rrrr!waitpidr"ChildProcessErrorrrdr1) r+rrrUrVr_r$rs rrzPidfdChildWatcher._do_waits&&( E" 8 3*IAv07J j(4(! J NN.   sA++!BBcyrFrrs rrz&PidfdChildWatcher.remove_child_handlerrN) rrrrrrrzr1rr}rrrrrrrs0    K )&rrc6eZdZdZdZdZdZdZdZdZ y) BaseChildWatcherc d|_i|_yr )r _callbacksrs rr)zBaseChildWatcher.__init__s rc&|jdyr )rrs rr1zBaseChildWatcher.closes rcV|jduxr|jjSr )r is_runningrs rrzzBaseChildWatcher.is_actives#zz%A$***?*?*AArctr r)r+ expected_pids r _do_waitpidzBaseChildWatcher._do_waitpid !##rctr rrs r_do_waitpid_allz BaseChildWatcher._do_waitpid_allrrc^|j(|&|jrtjdt|j)|jj t j||_|;|jt j|j|jyy)NzCA loop is being detached from a child watcher with pending handlers) rrr6r7RuntimeWarningr5rISIGCHLDrZ _sig_chldrrs rrzBaseChildWatcher.attach_loops :: !dlt MM= :: ! JJ , ,V^^ <    # #FNNDNN C  " rc |jy#ttf$rt$r(}|jj d|dYd}~yd}~wwxYw)N$Unknown exception in SIGCHLD handler)r@rA)rrrrrrCrGs rrzBaseChildWatcher._sig_chldsX   "-.    JJ - -A /    sAAAN) rrrr)r1rzrrrrrrrrrs&B$$#( rrcPeZdZdZfdZfdZdZdZdZdZ dZ d Z xZ S) rad'Safe' child watcher implementation. This implementation avoids disrupting other code spawning processes by polling explicitly each process in the SIGCHLD handler instead of calling os.waitpid(-1). This is a safe solution but it has a significant overhead when handling a big number of children (O(n) each time SIGCHLD is raised) cRt|tjdddy)Nrrrr)r(r)r6rr+r-s rr)zSafeChildWatcher.__init__s' /;%, .rcV|jjt| yr )rr9r(r1rs rr1zSafeChildWatcher.closes   rc|Sr rrs rrzSafeChildWatcher.__enter__rrcyr rrs rrzSafeChildWatcher.__exit__rrcH||f|j|<|j|yr )rrrs rr}z"SafeChildWatcher.add_child_handler"s% ($/ rc> |j|=y#t$rYywxYwNTFrr`rs rrz%SafeChildWatcher.remove_child_handler(( $    cZt|jD]}|j|yr r4rrrs rrz SafeChildWatcher._do_waitpid_all/s#(C   S !)rc tj|tj\}}|dk(ryt|}|jj rt jd|| |jj|\}}|||g|y#t$r|}d}t jd|YOwxYw#t$r7|jj rt jd|dYyYywxYw)Nr$process %s exited with returncode %sr8Unknown child process pid %d, will report returncode 255'Child watcher got an unexpected pid: %rTr>) r!rWNOHANGr"rrrr#rrdrpopr`)r+rrr$rrUrVs rrzSafeChildWatcher._do_waitpid4s 7**\2::>KCax/7Jzz##% C):7 -!__005NHd S* ,t ,7! CJ NNJ   ( 3zz##%H"T3& 3s#'B-B?#B<;B<?;C?>C?) rrrrr)r1rrr}rrrrrs@rrrs0.  " -rrcJeZdZdZfdZfdZdZdZdZdZ dZ xZ S) raW'Fast' child watcher implementation. This implementation reaps every terminated processes by calling os.waitpid(-1) directly, possibly breaking other code spawning processes and waiting for their termination. There is no noticeable overhead when handling a big number of children (O(1) each time a child terminates). ct|tj|_i|_d|_tjdddy)Nrrrrr) r(r) threadingLock_lock_zombies_forksr6rrs rr)zFastChildWatcher.__init__asC ^^%   /;%, .rc|jj|jjt|yr )rr9rr(r1rs rr1zFastChildWatcher.closeks,    rct|j5|xjdz c_|cdddS#1swYyxYw)Nr)rrrs rrzFastChildWatcher.__enter__ps$ ZZ KK1 KZZs.7c>|j5|xjdzc_|js |js dddyt|j}|jj dddt j dy#1swY xYw)Nrz5Caught subprocesses termination from unknown pids: %s)rrrrOr9rrd)r+rrrcollateral_victimss rrzFastChildWatcher.__exit__vsp ZZ KK1 K{{$-- Z "%T]]!3  MM   !  C  Zs/B/BBc|j5 |jj|} ddd||g|y#t$r||f|j|<YdddywxYw#1swYA#A&"A##A&&A/c> |j|=y#t$rYywxYwrrrs rrz%FastChildWatcher.remove_child_handlerrrc tjdtj\}}|dk(ryt|}|j 5 |j j|\}}|jjrtjd|| dddtjd||n |||g#t$rYywxYw#t$r\|jrK||j|<|jjrtjd||Yddd4d}YwxYw#1swYxYw)Nr@rrz,unknown process %s exited with returncode %sz8Caught subprocess termination from unknown pid: %d -> %d)r!rrr"rrrrrrrr#r`rrrd)r+rr$rrUrVs rrz FastChildWatcher._do_waitpid_alls8 < jjRZZ8 V !83F; 6%)__%8%8%=NHdzz++- %K%(*6!& #Z1j040K%   ${{-7 c*:://1"LL*>),j:! $H $sN'CD= C'2D= CCAD:*D=5D:7D=9D::D==E) rrrrr)r1rrr}rrrrs@rrrWs+.    )(1rrcReZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zy )ra~A watcher that doesn't require running loop in the main thread. This implementation registers a SIGCHLD signal handler on instantiation (which may conflict with other code that install own handler for this signal). The solution is safe but it has a significant overhead when handling a big number of processes (*O(n)* each time a SIGCHLD is received). cPi|_d|_tjdddy)Nrrrr)r_saved_sighandlerr6rrs rr)zMultiLoopChildWatcher.__init__s*!%4;%, .rc|jduSr )rrs rrzzMultiLoopChildWatcher.is_actives%%T11rcZ|jj|jytjtj }||j k7rtjdd|_ytjtj |jd|_y)Nz+SIGCHLD handler was changed by outside code) rr9rrI getsignalrrrrd)r+rds rr1zMultiLoopChildWatcher.closesz   ! ! ) ""6>>2 dnn $ NNH I"& MM&..$*@*@ A!%rc|Sr rrs rrzMultiLoopChildWatcher.__enter__rrcyr rr+rexc_valexc_tbs rrzMultiLoopChildWatcher.__exit__rrcrtj}|||f|j|<|j|yr )rrrr)r+rrUrVrs rr}z'MultiLoopChildWatcher.add_child_handlers5&&( $h5 rc> |j|=y#t$rYywxYwrrrs rrz*MultiLoopChildWatcher.remove_child_handlerrrc8|jytjtj|j|_|j*t j dtj |_tjtjdy)NzaPrevious SIGCHLD handler was set by non-Python code, restore to default handler on watcher close.F)rrIrrrrdrcrQrs rrz!MultiLoopChildWatcher.attach_loopso  ! ! - !'v~~t~~!N  ! ! ) NNJ K%+^^D " FNNE2rcZt|jD]}|j|yr rrs rrz%MultiLoopChildWatcher._do_waitpid_alls#(C   S !)rc* tj|tj\}}|dk(ryt|}d} |jj|\}}}|jrt j d||y|r'|jrt jd|||j|||g|y#t$r|}d}t j d|d}YwxYw#t$rt j d|d YywxYw) NrTrrF%Loop %r that handles pid %r is closedrrr>)r!rrr"rrrdrr is_closedrr#rr`) r+rrr$r debug_logrrUrVs rrz!MultiLoopChildWatcher._do_waitpids  **\2::>KCax/7JI L#'??#6#6s#; D(D~~FcR!1LL!G!-z;)))(CKdK=! CJ NNJ I $ / NND / /s"'CC.%C+*C+.!DDc |jy#ttf$rt$rt j ddYywxYw)NrTr>)rrrrrrd)r+rrs rrzMultiLoopChildWatcher._sig_chld<sE R  "-.   R NNAD Q Rs/AAN)rrrrr)rzr1rrr}rrrrrrrrrrsA $.2 & 3""#LJRrrcdeZdZdZdZdZdZdZdZe jfdZ dZ d Z d Zd Zy ) raAThreaded child watcher implementation. The watcher uses a thread per process for waiting for the process finish. It doesn't require subscription on POSIX signal but a thread creation is not free. The watcher has O(1) complexity, its performance doesn't depend on amount of spawn processes. cFtjd|_i|_yr) itertoolsr _pid_counter_threadsrs rr)zThreadedChildWatcher.__init__Rs%OOA. rcyrFrrs rrzzThreadedChildWatcher.is_activeVrorcyr rrs rr1zThreadedChildWatcher.closeYrrc|Sr rrs rrzThreadedChildWatcher.__enter__\rrcyr rrs rrzThreadedChildWatcher.__exit___rrct|jjDcgc]}|jr|}}|r||jdt |yycc}w)Nz0 has registered but not finished child processesr/)r4r valuesis_aliver-r8)r+r9threadthreadss rr:zThreadedChildWatcher.__del__bse(,T]]-A-A-C(D)(Dfoo'(D)  T^^$$TU!  )sA!ctj}tj|jdt |j ||||fd}||j|<|jy)Nzasyncio-waitpid-T)targetnamerVdaemon) rrrThreadrnextr r start)r+rrUrVrrs rr}z&ThreadedChildWatcher.add_child_handlerjsf&&(!!)9)9)9$t?P?P:Q9R'S(,c8T'B)-/$ c rcyrFrrs rrz)ThreadedChildWatcher.remove_child_handlersrrcyr rrs rrz ThreadedChildWatcher.attach_loopyrrc tj|d\}}t|}|jrt j d|| |jrt jd||n|j|||g||jj|y#t $r|}d}t jd|Y~wxYw)Nrrrrr) r!rr"rrr#rrdrrr r)r+rrrUrVrr$rs rrz ThreadedChildWatcher._do_waitpid|s 7**\15KC07J~~ C):7 >>  NNBD# N %D % %hZ G$ G ,''! CJ NNJ   sB''#C  C N)rrrrr)rzr1rrr6r7r:r}rrrrrrrrEsB   %MM  (rrcttdsy tj}tjtj|dy#t $rYywxYw)NrFrT)hasattrr!getpidr1rrM)rs r can_use_pidfdr#sO 2| $iik sA&'  s=A AAcBeZdZdZeZfdZdZfdZdZ dZ xZ S)_UnixDefaultEventLoopPolicyz:UNIX event loop policy with a watcher for child processes.c0t|d|_yr )r(r)_watcherrs rr)z$_UnixDefaultEventLoopPolicy.__init__s  rctj5|j)trt |_nt |_dddy#1swYyxYwr )rrr'r#rrrs r _init_watcherz)_UnixDefaultEventLoopPolicy._init_watchers6 \\}}$ ?$5$7DM$8$:DM \\s 6AAct|||jEtjtj ur|jj |yyy)zSet the event loop. As a side effect, if a child watcher was set before, then calling .set_event_loop() from the main thread will call .attach_loop(loop) on the child watcher. N)r(set_event_loopr'rcurrent_thread main_threadr)r+rr-s rr+z*_UnixDefaultEventLoopPolicy.set_event_loopsS t$ MM %((*i.C.C.EE MM % %d +F &rc|j|jtjddd|jS)z~Get the watcher for child processes. If not yet set, a ThreadedChildWatcher object is automatically created. ryrrr)r'r)r6rrs rryz-_UnixDefaultEventLoopPolicy.get_child_watchers@ ==    0:BI K}}rc|j|jj||_tjdddy)z$Set the watcher for child processes.Nset_child_watcherrrr)r'r1r6r)r+rs rr0z-_UnixDefaultEventLoopPolicy.set_child_watchers? == $ MM   ! 0:BI Kr) rrrrr& _loop_factoryr)r)r+ryr0rrs@rr%r%s%D*M; ,  Krr%)4rrSrr r!rrIrrrr2rr6rrrrrr r r r r logr__all__rT ImportErrorrr"BaseSelectorEventLoopr& ReadTransportrj_FlowControlMixinWriteTransportrrBaseSubprocessTransportr|rrrrrrrr#BaseDefaultEventLoopPolicyr%rrrrrr<se8     <<7 C DD P"_BBP"f MZ55M`Jj::(77JZ FF 0S$S$l7,7t2+2jN-'N-bj1'j1Z~R0~RBO(/O(b 6K&"C"C6Kr+4r__pycache__/sslproto.cpython-312.pyc000064400000121646152527367570013401 0ustar00 {|j|zddlZddlZddlZ ddlZddlmZddlmZddlmZddlm Z ddl m Z eejejfZGdd ejZGd d ejZd Zd ZGdde j(e j*ZGddej.Zy#e$rdZYwxYw)N) constants) exceptions) protocols) transports)loggerc eZdZdZdZdZdZdZy)SSLProtocolState UNWRAPPED DO_HANDSHAKEWRAPPEDFLUSHINGSHUTDOWNN)__name__ __module__ __qualname__r r r rr)/usr/lib64/python3.12/asyncio/sslproto.pyr r sI!LGHHrr ceZdZdZdZdZdZy)AppProtocolState STATE_INITSTATE_CON_MADE STATE_EOFSTATE_CON_LOSTN)rrrrrrrrrrrrsJ%NI%NrrcZ|r tdtj}|sd|_|S)Nz(Server side SSL needs a valid SSLContextF) ValueErrorsslcreate_default_contextcheck_hostname) server_sideserver_hostname sslcontexts r_create_transport_contextr$/s2CDD ++-J $) ! rc|||dz}n |}d|z}n|}||dz}n|}||cxk\rdk\sntd|d|d||fS)Nirzhigh (z) must be >= low (z) must be >= 0)r)highlowkbhilos radd_flowcontrol_defaultsr,=sh | ;dBBRB  { 1W  =q=b"# # r6MrceZdZdZej j ZdZddZ dZ dZ dZ dZ efd Zd Zd Zd Zdd ZdZdZddZdZdZedZdZdZdZdZdZdZ dZ!y)_SSLProtocolTransportTc.||_||_d|_y)NF)_loop _ssl_protocol_closed)selfloop ssl_protocols r__init__z_SSLProtocolTransport.__init__Xs ) rNc:|jj||S)z#Get optional transport information.)r1_get_extra_infor3namedefaults rget_extra_infoz$_SSLProtocolTransport.get_extra_info]s!!11$@@rc:|jj|yN)r1_set_app_protocol)r3protocols r set_protocolz"_SSLProtocolTransport.set_protocolas ,,X6rc.|jjSr>)r1 _app_protocolr3s r get_protocolz"_SSLProtocolTransport.get_protocolds!!///rcR|jxs|jjSr>)r2r1_is_transport_closingrDs r is_closingz _SSLProtocolTransport.is_closinggs ||It11GGIIrcn|js"d|_|jjyd|_y)a Close the transport. Buffered data will be flushed asynchronously. No more data will be received. After all buffered data is flushed, the protocol's connection_lost() method will (eventually) called with None as its argument. TN)r2r1_start_shutdownrDs rclosez_SSLProtocolTransport.closejs,||DL    . . 0!%D rcX|jsd|_|jdtyy)NTz9unclosed transport )r2warnResourceWarning)r3 _warningss r__del__z_SSLProtocolTransport.__del__xs)||DL NN* ,rc0|jj Sr>)r1_app_reading_pausedrDs r is_readingz _SSLProtocolTransport.is_readings%%9999rc8|jjy)zPause the receiving end. No data will be passed to the protocol's data_received() method until resume_reading() is called. N)r1_pause_readingrDs r pause_readingz#_SSLProtocolTransport.pause_readings ))+rc8|jjy)zResume the receiving end. Data received will once again be passed to the protocol's data_received() method. N)r1_resume_readingrDs rresume_readingz$_SSLProtocolTransport.resume_readings **,rcp|jj|||jjy)aSet the high- and low-water limits for write flow control. These two values control when to call the protocol's pause_writing() and resume_writing() methods. If specified, the low-water limit must be less than or equal to the high-water limit. Neither value can be negative. The defaults are implementation-specific. If only the high-water limit is given, the low-water limit defaults to an implementation-specific value less than or equal to the high-water limit. Setting high to zero forces low to zero as well, and causes pause_writing() to be called whenever the buffer becomes non-empty. Setting low to zero causes resume_writing() to be called only once the buffer is empty. Use of zero for either limit is generally sub-optimal as it reduces opportunities for doing I/O and computation concurrently. N)r1_set_write_buffer_limits_control_app_writingr3r'r(s rset_write_buffer_limitsz-_SSLProtocolTransport.set_write_buffer_limitss,& 33D#> //1rcZ|jj|jjfSr>)r1_outgoing_low_water_outgoing_high_waterrDs rget_write_buffer_limitsz-_SSLProtocolTransport.get_write_buffer_limits*""66""779 9rc6|jjS)z-Return the current size of the write buffers.)r1_get_write_buffer_sizerDs rget_write_buffer_sizez+_SSLProtocolTransport.get_write_buffer_sizes!!88::rcp|jj|||jjy)aSet the high- and low-water limits for read flow control. These two values control when to call the upstream transport's pause_reading() and resume_reading() methods. If specified, the low-water limit must be less than or equal to the high-water limit. Neither value can be negative. The defaults are implementation-specific. If only the high-water limit is given, the low-water limit defaults to an implementation-specific value less than or equal to the high-water limit. Setting high to zero forces low to zero as well, and causes pause_reading() to be called whenever the buffer becomes non-empty. Setting low to zero causes resume_reading() to be called only once the buffer is empty. Use of zero for either limit is generally sub-optimal as it reduces opportunities for doing I/O and computation concurrently. N)r1_set_read_buffer_limits_control_ssl_readingr]s rset_read_buffer_limitsz,_SSLProtocolTransport.set_read_buffer_limitss,& 224= //1rcZ|jj|jjfSr>)r1_incoming_low_water_incoming_high_waterrDs rget_read_buffer_limitsz,_SSLProtocolTransport.get_read_buffer_limitsrcrc6|jjS)z+Return the current size of the read buffer.)r1_get_read_buffer_sizerDs rget_read_buffer_sizez*_SSLProtocolTransport.get_read_buffer_sizes!!7799rc.|jjSr>)r1_app_writing_pausedrDs r_protocol_pausedz&_SSLProtocolTransport._protocol_pauseds!!555rct|tttfs!t dt |j |sy|jj|fy)zWrite some data bytes to the transport. This does not block; it buffers the data and arranges for it to be sent out asynchronously. z+data: expecting a bytes-like instance, got N) isinstancebytes bytearray memoryview TypeErrortyperr1_write_appdatar3datas rwritez_SSLProtocolTransport.writesX $ : >?##':#6#6"79: :  ))4'2rc:|jj|y)zWrite a list (or any iterable) of data bytes to the transport. The default implementation concatenates the arguments and calls write() on the result. N)r1r|)r3 list_of_datas r writelinesz _SSLProtocolTransport.writeliness )),7rct)zuClose the write end after flushing buffered data. This raises :exc:`NotImplementedError` right now. )NotImplementedErrorrDs r write_eofz_SSLProtocolTransport.write_eofs "!rcy)zAReturn True if this transport supports write_eof(), False if not.FrrDs r can_write_eofz#_SSLProtocolTransport.can_write_eofsrc&|jdy)zClose the transport immediately. Buffered data will be lost. No more data will be received. The protocol's connection_lost() method will (eventually) be called with None as its argument. N) _force_closerDs rabortz_SSLProtocolTransport.aborts $rcbd|_|j|jj|yyNT)r2r1_abortr3excs rrz"_SSLProtocolTransport._force_closes.    )    % %c * *rc|jjj||jxjt |z c_yr>)r1_write_backlogappend_write_buffer_sizelenr}s r_test__append_write_backlogz1_SSLProtocolTransport._test__append_write_backlogs7 ))006 --T:-rr>NN)"rrr_start_tls_compatibler _SendfileModeFALLBACK_sendfile_compatibler6r<rArErHrKwarningsrPrSrVrYr^rbrfrjrnrqpropertyrtrrrrrrrrrrr.r.Rs!$22;; A70J &!),:,-2,9;2,9:66 38" + ;rr.c eZdZdZdZdZdZ d+dZdZd,dZ dZ dZ dZ d Z d Zd Zd Zd,d ZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZ dZ!dZ"dZ#d Z$d!Z%d-d"Z&d#Z'd$Z(d%Z)d-d&Z*d'Z+d(Z,d)Z-d.d*Z.y)/ SSLProtocoliNc t tdt|j|_t |j|_|tj}n|dkrtd|| tj} n| dkrtd| |s t||}||_ |r |s||_ nd|_ ||_t||_t#j$|_d|_||_||_|j/|d|_d|_d|_||_| |_tj:|_tj:|_t@jB|_"d|_#|rtHjJ|_&ntHjN|_&|jjQ|j<|j>|j|j|_)d|_*d|_+d|_,d|_-d|_.|j_d|_0d|_1d|_2d|_3|ji|jky)Nzstdlib ssl module not availablerz7ssl_handshake_timeout should be a positive number, got z6ssl_shutdown_timeout should be a positive number, got )r#F)r!r")6r RuntimeErrorrxmax_size _ssl_bufferry_ssl_buffer_viewrSSL_HANDSHAKE_TIMEOUTrSSL_SHUTDOWN_TIMEOUTr$ _server_side_server_hostname _sslcontextdict_extra collectionsdequerr_waiterr0r?_app_transport_app_transport_created _transport_ssl_handshake_timeout_ssl_shutdown_timeout MemoryBIO _incoming _outgoingr r _state _conn_lostrr _app_staterwrap_bio_sslobj_ssl_writing_pausedrR_ssl_reading_pausedrmrlrh _eof_receivedrsrar`r[_get_app_transport) r3r4 app_protocolr#waiterr!r"call_connection_madessl_handshake_timeoutssl_shutdown_timeouts rr6zSSLProtocol.__init__sE ;@A A$T]]3 *4+;+; < ($-$C$C ! "a ',-/0 0 '#,#A#A !Q &+,./ /2_.J( ;$3D !$(D !%j1 *//1"#   |,"&+#&;#%9"&00  .99DO.==DO''00 NNDNN)) 1113 $) #( #( $%!#$  $$&"#( $%!#$  %%' !rc||_t|drDt|tjr*|j |_|j|_d|_ yd|_ y)N get_bufferTF) rChasattrrvrBufferedProtocolr_app_protocol_get_bufferbuffer_updated_app_protocol_buffer_updated_app_protocol_is_buffer)r3rs rr?zSSLProtocol._set_app_protocolasP) L, /<)C)CD,8,C,CD )0<0K0KD -+/D (+0D (rc|jy|jjs@|#|jj|d|_y|jjdd|_yr>)r cancelled set_exception set_resultrs r_wakeup_waiterzSSLProtocol._wakeup_waiterlsZ <<  ||%%' **3/  ''- rc|j9|jr tdt|j||_d|_|jS)Nz$Creating _SSLProtocolTransport twiceT)rrrr.r0rDs rrzSSLProtocol._get_app_transportvsJ    &**"#IJJ"7 D"ID *.D '"""rcV|jduxr|jjSr>)rrHrDs rrGz!SSLProtocol._is_transport_closing~s#d*Kt/I/I/KKrc2||_|jy)zXCalled when the low-level connection is made. Start the SSL handshake. N)r_start_handshake)r3 transports rconnection_madezSSLProtocol.connection_mades $ rcH|jj|jj|xjdz c_|j d|j _|jtjk7r|jtjk(s|jtjk(rEtj|_ |jj!|j"j$||j'tj(d|_d|_d|_|j-||j.r!|j.j1d|_|j2r"|j2j1d|_yy)zCalled when the low-level connection is lost or closed. The argument is an exception object or None (the latter meaning a regular EOF is received or the connection was aborted or closed). rNT)rclearrreadrrr2rr r rrrrrr0 call_soonrCconnection_lost _set_stater rr_shutdown_timeout_handlecancel_handshake_timeout_handlers rrzSSLProtocol.connection_losts9 !!#  1    **.D   ' ;;*77 7#3#B#BB#3#=#=="2"A"A $$T%7%7%G%GM (223"! C  ( (  ) ) 0 0 2,0D )  ) )  * * 1 1 3-1D * *rc|}|dks||jkDr |j}t|j|kr*t||_t |j|_|j SNr)rrrrxryr)r3nwants rrzSSLProtocol.get_buffers` 19t}},==D t 4 '(D $.t/?/?$@D !$$$rc|jj|jd||jtj k(r|j y|jtjk(r|jy|jtjk(r|jy|jtjk(r|jyyr>) rrrrr r _do_handshaker _do_readr _do_flushr _do_shutdown)r3nbytess rrzSSLProtocol.buffer_updateds T227F;< ;;*77 7    [[,44 4 MMO [[,55 5 NN  [[,55 5    6rcd|_ |jjrtjd||j t jk(r|jty|j t jk(r=|jt j|jry|jy|j t jk(r@|j|jt j |j#y|j t j k(r|j#yy#t$$r|j&j)wxYw)aCalled when the other end of the low-level stream is half-closed. If this returns a false value (including None), the transport will close itself. If it returns a true value, closing the transport is up to the protocol. Tz%r received EOFN)rr0 get_debugrdebugrr r _on_handshake_completeConnectionResetErrorr rrrRr _do_writerr ExceptionrrKrDs r eof_receivedzSSLProtocol.eof_receiveds" zz##% .5{{.;;;++,@A 0 8 88 0 9 9:++NN$ 0 9 99  0 9 9:!!# 0 9 99!!#:  OO ! ! #  s&A"E,AE5EAE#-E%E7c||jvr|j|S|j|jj||S|Sr>)rrr<r9s rr8zSSLProtocol._get_extra_infosC 4;; ;;t$ $ __ (??11$@ @Nrc&d}|tjk(rd}n|jtjk(r|tjk(rd}n|jtjk(r|tjk(rd}ne|jtjk(r|tj k(rd}n2|jtj k(r|tj k(rd}|r||_ytdj|j|)NFTz!cannot switch state from {} to {}) r r rr r rrrformat)r3 new_statealloweds rrzSSLProtocol._set_states (22 2G KK+55 5 )66 6G KK+88 8 )11 1G KK+33 3 )22 2G KK+44 4 )22 2G #DK3::KK,- -rcnjjr6tjdjj _nd_j tjjjjfd_ jy)Nz%r starts SSL handshakec$jSr>)_check_handshake_timeoutrDsrz.SSLProtocol._start_handshake..$s$*G*G*Ir) r0rrrtime_handshake_start_timerr r call_laterrrrrDs`rrzSSLProtocol._start_handshakes ::   ! LL2D 9)-):D &)-D & (556 JJ ! !$"="="I K & rc|jtjk(r+d|jd}|j t |yy)Nz$SSL handshake is taking longer than z! seconds: aborting the connection)rr r r _fatal_errorConnectionAbortedError)r3msgs rrz$SSLProtocol._check_handshake_timeout(sN ;;*77 76../0*+    4S9 : 8rc |jj|jdy#t$r|j Yyt j $r}|j|Yd}~yd}~wwxYwr>)r do_handshakerSSLAgainErrors_process_outgoingrSSLErrorrs rrzSSLProtocol._do_handshake1sb . LL % % '  ' ' -  %  " " $|| -  ' ' , , -s.A6 A6A11A6c|j!|jjd|_|j} | |jtj n||j }|jjrA|jj!|j"z }t%j&d||dz|j(j+||j-|j/||j0t2j4k(r>t2j6|_|j8j;|j=|j|j?y#t$rm}d}|jtjt|tjrd}nd}|j|||j|Yd}~yd}~wwxYw)Nz1SSL handshake failed on verifying the certificatezSSL handshake failedz%r: SSL handshake took %.1f msg@@)peercertcipher compression ssl_object) rrrrr r getpeercertrr rvrCertificateErrorrrr0rrrrrrupdater r rrrrrCrrr)r3 handshake_excsslobjrrrdts rrz"SSLProtocol._on_handshake_complete;s  ) ) 5  * * 1 1 3-1D * $ 0 8 89##))+H ::   !"T%?%??B LL94c J H"(--/'-'9'9';&,  . ??.99 9.==DO    . .t/F/F/H I  1  M OO,66 7#s334I,   c3 '    $  s4F G7 A#G22G7cjtjtjtjfvryj dj _jtjk(rjdyjtjjjjfd_ jy)NTc$jSr>)_check_shutdown_timeoutrDsrrz-SSLProtocol._start_shutdown..us446r)rr rrr rr2r rrr0rrrrrDs`rrJzSSLProtocol._start_shutdownds KK )) )) **      **.D   ' ;;*77 7 KK  OO,55 6,0JJ,A,A**6-D ) NN rc|jtjtjfvr/|jj t jdyy)NzSSL shutdown timed out)rr rrrrr TimeoutErrorrDs rrz#SSLProtocol._check_shutdown_timeoutysN KK )) ))  OO ( (''(@A C  rc|j|jtj|j yr>)rrr rrrDs rrzSSLProtocol._do_flushs*  (112 rcJ |js|jj|j|j |j dy#t $r|jYytj$r}|j |Yd}~yd}~wwxYwr>) rrunwrapr_call_eof_received_on_shutdown_completerrrrs rrzSSLProtocol._do_shutdowns -%% ##%  " " $  # # %  & &t , %  " " $|| ,  & &s + + ,s&AB"5B"BB"c|j!|jjd|_|r|j|y|jj |j j yr>)rrrr0rrrK)r3 shutdown_excs rrz!SSLProtocol._on_shutdown_completesU  ( ( 4  ) ) 0 0 2,0D )    l + JJ !6!6 7rc|jtj|j|jj |yyr>)rr r rrrs rrzSSLProtocol._aborts6 (223 ?? & OO ( ( - 'rc8|jtjtjtjfvrH|j t jk\rtjd|xj dz c_y|D];}|jj||xjt|z c_ = |jtjk(r|jyy#t $r}|j#|dYd}~yd}~wwxYw)NzSSL connection is closedrFatal error on SSL protocol)rr rrr rr!LOG_THRESHOLD_FOR_CONNLOST_WRITESrwarningrrrrr rrr)r3rr~exs rr|zSSLProtocol._write_appdatas KK )) )) **  )"M"MM9: OOq O  D    & &t ,  # #s4y 0 #! A{{.666 7 A   b"? @ @ As-C44 D=DDc~ |jr|jd}|jj|}t|}||kr(||d|jd<|xj|zc_n"|jd=|xj|zc_|jr|j y#t $rYwxYwr)rrrrrrr)r3r~countdata_lens rrzSSLProtocol._do_writes %%**1- **40t98#-1%&\D''*++u4+++A.++x7+%%     sBB00 B<;B<c|js@|jj}t|r|jj ||j yr>)rrrrrrr\r}s rrzSSLProtocol._process_outgoingsB''>>&&(D4y%%d+ !!#rc|jtjtjfvry |jsZ|j r|j n|j|jr|jn|j|jy#t$r}|j|dYd}~yd}~wwxYw)Nr )rr r rrRr_do_read__buffered_do_read__copiedrrrrirr)r3r#s rrzSSLProtocol._do_reads KK (( ))    A++//++-))+&&NN$**,  % % ' A   b"? @ @ AsA6B&& C /CC cd}d}jj}t|} jj ||}|dkDrY|}||kr4jj ||z ||d}|dkDr||z }nn$||kr4j j fd|dkDrj||s!jjyy#t$rYEwxYw)Nrrc$jSr>)rrDsrrz0SSLProtocol._do_read__buffered..s r) rrprrrr0rrrrrJ)r3offsetr%bufwantss` rr)zSSLProtocol._do_read__buffereds++D,F,F,HIC LL%%eS1Eqyun LL--efnc&'lKEqy% unJJ(()@A A:  - -f 5  # # %  "    sAC% C%% C10C1cd}d}d} |jj|j}|sn$|rd}d}|}n|rd}|g}nj|L |r|j j n,|s*|j j dj|s!|j|jyy#t$rYywxYw)N1TFr) rrrrrrC data_receivedjoinrrJ)r3chunkzeroonefirstr~s rr*zSSLProtocol._do_read__copied s  ))$--8 DC!EC!5>DKK&     , ,U 3    , ,SXXd^ <  # # %  "    sA C CCc> |jtjk(rHtj|_|jj }|rt jdyyy#ttf$rt$r}|j|dYd}~yd}~wwxYw)Nz?returning true from eof_received() has no effect when using sslzError calling eof_received()) rrrrrCrrr"KeyboardInterrupt SystemExit BaseExceptionr)r3 keep_openr#s rrzSSLProtocol._call_eof_received(s B"2"A"AA"2"<"< ..;;= NN$BCB ":.   B   b"@ A A BsA#A((BBBcZ|j}||jk\r/|js#d|_ |jj y||jkr0|jr#d|_ |jjyyy#t t f$rt$r4}|jjd||j|dYd}~yd}~wwxYw#t t f$rt$r4}|jjd||j|dYd}~yd}~wwxYw)NTzprotocol.pause_writing() failedmessage exceptionrr@Fz protocol.resume_writing() failed) rerarsrC pause_writingr9r:r;r0call_exception_handlerrr`resume_writing)r3sizers rr\z SSLProtocol._control_app_writing7s$**, 4,, ,T5M5M'+D $ ""002T-- -$2J2J',D $ ""1133K -&z2    11@!$!%!4!4 $ 3 &z2    11A!$!%!4!4 $ 3 s/B2CC'*CCD*6*D%%D*cH|jj|jzSr>)rpendingrrDs rrez"SSLProtocol._get_write_buffer_sizeTs~~%%(?(???rc\t||tj\}}||_||_yr>)r,r!FLOW_CONTROL_HIGH_WATER_SSL_WRITErar`r]s rr[z$SSLProtocol._set_write_buffer_limitsWs., #yBBD c$(!#& rcd|_yr)rRrDs rrUzSSLProtocol._pause_reading_s #' rcnjr(d_fd}jj|yy)NFcjtjk(rjyjtjk(rj yjtj k(rjyyr>)rr r rrrrrrDsrresumez+SSLProtocol._resume_reading..resumefs`;;"2":"::MMO[[$4$=$==NN$[[$4$=$==%%'>r)rRr0r)r3rLs` rrXzSSLProtocol._resume_readingbs2  # #',D $ ( JJ  ( $rc|j}||jk\r.|js"d|_|jj y||j kr/|jr"d|_|jj yyy)NTF)rprmrrrVrlrY)r3rDs rriz SSLProtocol._control_ssl_readingqsu))+ 4,, ,T5M5M'+D $ OO ) ) + T-- -$2J2J',D $ OO * * ,3K -rc\t||tj\}}||_||_yr>)r,r FLOW_CONTROL_HIGH_WATER_SSL_READrmrlr]s rrhz#SSLProtocol._set_read_buffer_limitszs., #yAAC c$(!#& rc.|jjSr>)rrFrDs rrpz!SSLProtocol._get_read_buffer_sizes~~%%%rc.|jrJd|_y)z\Called when the low-level transport's buffer goes over the high-water mark. TN)rrDs rrAzSSLProtocol.pause_writings++++#' rcN|jsJd|_|jy)z^Called when the low-level transport's buffer drains below the low-water mark. FN)rrrDs rrCzSSLProtocol.resume_writings'''''#(   rcf|jr|jj|t|tr5|jj rt jd||dyyt|tjs+|jj|||j|dyy)Nz%r: %sT)exc_infor>) rrrvOSErrorr0rrrrCancelledErrorrB)r3rr?s rrzSSLProtocol._fatal_errors ?? OO ( ( - c7 #zz##% XtWtD&C!:!:; JJ - -" !__ / r)zFatal error on transport)/rrrrrrrr6r?rrrGrrrrrr8rrrrrrJrrrrrr|rrrr)r*rr\rer[rUrXrirhrprArCrrrrrrsH  $#59&*'+&* Q"f 1#L "2H%  !F$-P ;.%R*C -8.A0! $A,#:#< B:@'( )-' & (! rr)renumrr ImportErrorrrrrlogrSSLWantReadErrorSSLSyscallErrorrEnumr rr$r,_FlowControlMixin Transportr.rrrrrr`s  ?**C,?,?@Ntyy &tyy & *r;J88&00r;jZ ),,Z { CsB00B:9B:__pycache__/trsock.cpython-312.opt-1.pyc000064400000011731152527367570013751 0ustar00 {|j  ddlZGddZy)NceZdZdZdZdej fdZedZedZ edZ dZ d Z d Z d Zd Zd ZdZdZdZdZdZdZdZdZy)TransportSocketzA socket-like wrapper for exposing real transport sockets. These objects can be safely returned by APIs like `transport.get_extra_info('socket')`. All potentially disruptive operations (like "socket.close()") are banned. _socksockc||_yNr)selfrs '/usr/lib64/python3.12/asyncio/trsock.py__init__zTransportSocket.__init__s  c.|jjSr )rfamilyr s r rzTransportSocket.familyszz   r c.|jjSr )rtypers r rzTransportSocket.typeszzr c.|jjSr )rprotors r rzTransportSocket.protoszzr crd|jd|jd|jd|j}|jdk7r4 |j }|r|d|} |j}|r|d|}|dS#t j $rY4wxYw#t j $rY3wxYw) Nz)filenorrr getsocknamesocketerror getpeername)r sladdrraddrs r __repr__zTransportSocket.__repr__s*4;;=/:kk_GDII=9ZZL " ;;=B  ((*#XeW-A ((*#XeW-AAw<<   <<  s$B)B BB B65B6ctd)Nz/Cannot serialize asyncio.TransportSocket object) TypeErrorrs r __getstate__zTransportSocket.__getstate__5sIJJr c6|jjSr )rrrs r rzTransportSocket.fileno8szz  ""r c6|jjSr )rduprs r r&zTransportSocket.dup;szz~~r c6|jjSr )rget_inheritablers r r(zTransportSocket.get_inheritable>szz))++r c:|jj|yr )rshutdown)r hows r r*zTransportSocket.shutdownAs C r c:|jj|i|Sr )r getsockoptr argskwargss r r-zTransportSocket.getsockoptFs$tzz$$d5f55r c<|jj|i|yr )r setsockoptr.s r r2zTransportSocket.setsockoptIs t.v.r c6|jjSr )rrrs r rzTransportSocket.getpeernameLzz%%''r c6|jjSr )rrrs r rzTransportSocket.getsocknameOr4r c6|jjSr )r getsockbynamers r r7zTransportSocket.getsockbynameRszz''))r c$|dk(rytd)Nrzr r rrsIV]]!!  .K# ,! 6/((*L Cr r)rrr>r r rIs ^C^Cr __pycache__/unix_events.cpython-312.opt-2.pyc000064400000171054152527367570015021 0ustar00 {|j ddlZddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl m Z ddl mZddl mZddl mZddl mZddl mZdd l mZdd l mZdd l mZdd l mZdd lmZdZe j4dk(reddZdZGddej<ZGddej@Z!GddejDejFZ$GddejJZ&GddZ'Gdde'Z(Gdd e'Z)Gd!d"e)Z*Gd#d$e)Z+Gd%d&e'Z,Gd'd(e'Z-d)Z.Gd*d+ej^Z0eZ1e0Z2y),N) base_events)base_subprocess) constants) coroutines)events) exceptions)futures)selector_events)tasks) transports)logger)SelectorEventLoopAbstractChildWatcherSafeChildWatcherFastChildWatcherPidfdChildWatcherMultiLoopChildWatcherThreadedChildWatcherDefaultEventLoopPolicywin32z+Signals are not really supported on Windowsc yN)signumframes ,/usr/lib64/python3.12/asyncio/unix_events.py_sighandler_noopr*scP tj|S#t$r|cYSwxYwr)oswaitstatus_to_exitcode ValueError)statuss rr"r"/s.((00  s  %%ceZdZ dfd ZfdZdZdZdZdZdZ dd Z dd Z dd Z d Z ddddddd dZ dddddddddZdZdZdZdZxZS)_UnixSelectorEventLoopNc2t||i|_yr)super__init___signal_handlers)selfselector __class__s rr)z_UnixSelectorEventLoop.__init__?s " "rc0t|tjs,t |j D]}|j |y|j r;tjd|dt||j jyy)NzClosing the loop z@ on interpreter shutdown stage, skipping signal handlers removalsource) r(closesys is_finalizinglistr*remove_signal_handlerwarningswarnResourceWarningclear)r+sigr-s rr1z_UnixSelectorEventLoop.closeCs    "D112**3/3$$ 1$:HI.%) + %%++- %rc:|D]}|s|j|yr)_handle_signal)r+datars r_process_self_dataz)_UnixSelectorEventLoop._process_self_dataQs F    ' rcT tj|stj|r td|j ||j  t j|jjtj|||d}||j |< t j |t"t j$|dy#ttf$r}tt|d}~wwxYw#t$r}|j |=|j sI t jdn2#ttf$r }t'j(d|Yd}~nd}~wwxYw|j*t*j,k(rtd|dd}~wwxYw)Nz3coroutines cannot be used with add_signal_handler()Fset_wakeup_fd(-1) failed: %ssig  cannot be caught)r iscoroutineiscoroutinefunction TypeError _check_signal _check_closedsignal set_wakeup_fd_csockfilenor#OSError RuntimeErrorstrrHandler*r siginterruptrinfoerrnoEINVAL)r+r:callbackargsexchandlenexcs radd_signal_handlerz)_UnixSelectorEventLoop.add_signal_handlerXsv  " "8 ,..x889 9 3  )  !3!3!5 6xtT:%+c"  MM#/ 0   U +G$ )s3x( ( ) %%c*((F((,"G,FKK >EEFyyELL("T#.?#@AA sZ-C.0D D.DD F'F"-EF"E2E-(F"-E220F""F'c |jj|}|y|jr|j|y|j |yr)r*get _cancelledr5_add_callback_signalsafe)r+r:rXs rr<z%_UnixSelectorEventLoop._handle_signalsH@&&**3/ >      & &s +  ) )& 1rc |j| |j|=|tjk(rtj }ntj } tj|||js tjdyy#t$rYywxYw#t$r2}|jtjk(rtd|dd}~wwxYw#ttf$r }tjd|Yd}~yd}~wwxYw)NFrBrCr@rAT)rGr*KeyErrorrISIGINTdefault_int_handlerSIG_DFLrMrSrTrNrJr#rrR)r+r:handlerrWs rr5z,_UnixSelectorEventLoop.remove_signal_handlers  3 %%c* &-- 00GnnG  MM#w '$$ A$$R(-   yyELL("T#.?#@AA  ( A :C@@ AsA BB9C BB C(-CCD ,DD c t|tstd||tjvrt d|y)Nzsig must be an int, not zinvalid signal number ) isinstanceintrFrI valid_signalsr#)r+r:s rrGz$_UnixSelectorEventLoop._check_signalsO #s#6sg>? ? f**, ,5cU;< < -rc t|||||Sr)_UnixReadPipeTransportr+pipeprotocolwaiterextras r_make_read_pipe_transportz0_UnixSelectorEventLoop._make_read_pipe_transports%dD(FEJJrc t|||||Sr)_UnixWritePipeTransportrks r_make_write_pipe_transportz1_UnixSelectorEventLoop._make_write_pipe_transports&tT8VUKKrc lKtj5tjdtt j } ddd 5| j s td|j} t||||||||f| |d| } | j| j|j|  | d{ ddd| S#1swYxYw7#ttf$rt$r+| j!| j#d{7wxYw#1swY SxYww)NignorezRasyncio.get_child_watcher() is not activated, subprocess support is not installed.)rnro)r6catch_warnings simplefilterDeprecationWarningrget_child_watcher is_activerN create_future_UnixSubprocessTransportadd_child_handlerget_pid_child_watcher_callback SystemExitKeyboardInterrupt BaseExceptionr1_wait) r+rmrVshellstdinstdoutstderrbufsizerokwargswatcherrntransps r_make_subprocess_transportz1_UnixSelectorEventLoop._make_subprocess_transports/ $ $ &  ! !(,> ?..0G'$$& #$GHH'')F-dHdE,16676396/56F  % %fnn&6$($@$@& J  !0 9' &( 12    lln$$ '0 seD4/C D4A-D'>C!CC! D4CD4C!!;D$DD$$D''D1,D4c<|j|j|yr)call_soon_threadsafe_process_exited)r+pid returncoders rrz._UnixSelectorEventLoop._child_watcher_callbacks !!&"8"8*Er)sslsockserver_hostnamessl_handshake_timeoutssl_shutdown_timeoutcK|r |2td| td| td| td|| tdtj|}tjtjtj d} |j d|j||d{nf| td|jtjk7s|jtj k7rtd ||j d|j|||||| d{\}} || fS7#|jxYw7#w) Nz/you have to pass server_hostname when using sslz+server_hostname is only meaningful with ssl1ssl_handshake_timeout is only meaningful with ssl0ssl_shutdown_timeout is only meaningful with ssl3path and sock can not be specified at the same timerFzno path and sock were specified.A UNIX Domain Stream Socket was expected, got )rr) r#r!fspathsocketAF_UNIX SOCK_STREAM setblocking sock_connectr1familytype_create_connection_transport) r+protocol_factorypathrrrrr transportrms rcreate_unix_connectionz-_UnixSelectorEventLoop.create_unix_connections & EGG* !NOO$0 GII#/ FHH   IKK99T?D==1C1CQGD   '''d333 | !BCC v~~-II!3!33 DTHMOO   U #$($E$E "C"7!5%F%77 8(""%4  7s=BE#&E 7E 8E E# E EE#dT)rbacklogrrr start_servingc Kt|tr td| |s td| |s td|| tdt j |}t j t jt j}|ddvrH tjt j|jrt j| |j#|nU| td |j*t jk7s|j,t jk7rtd ||j/d t1j2||g|||||} |r-| j5t7j8dd{| S#t$rYt$r!} tj d|| Yd} ~ d} ~ wwxYw#t$rT} |j%| j&t&j(k(r!d|d } tt&j(| dd} ~ w|j%xYw7w) Nz*ssl argument must be an SSLContext or Nonerrrr)rz2Unable to check or remove stale UNIX socket %r: %rzAddress z is already in usez-path was not specified, and no sock specifiedrF)rfboolrFr#r!rrrrstatS_ISSOCKst_moderemoveFileNotFoundErrorrMrerrorbindr1rS EADDRINUSErrrrServer_start_servingr sleep) r+rrrrrrrrerrrWmsgservers rcreate_unix_serverz)_UnixSelectorEventLoop.create_unix_servers7 c4 HI I ,SCE E +CBD D   IKK99T?D==1C1CDDAwk)6}}RWWT]%:%:; $  $| CEE v~~-II!3!33 DTHMOO ##D4&2B$'2G$8:   ! ! #++a.  S)6LL"*+/666  99 0 00%TH,>?C!%"2"2C8dB  & !siBIAF'"G3B-I I!I' G0I2G:GIGI I 'AH66I  Ic K tj |j } tj|j}|r|n|}|sy|j} |j| d|||||d| d{S#t$rtjdwxYw#tt jf$r}tjdd}~wwxYw#t$rtjdwxYw7~w)Nzos.sendfile() is not availableznot a regular filer) r!sendfileAttributeErrorr SendfileNotAvailableErrorrLioUnsupportedOperationfstatst_sizerMr{_sock_sendfile_native_impl) r+rfileoffsetcountrLrfsize blocksizefuts r_sock_sendfile_nativez,_UnixSelectorEventLoop._sock_sendfile_nativebs 2 KK M[[]F MHHV$,,E#E   " ''T4(.y! Ey% 26602 2 2  7 78 M667KL L M M667KL L MsVC<BB"C6C<;C:<C<BC<"C;CCC<C77C<c |j} ||j||jr|j|||y|r/||z }|dkr%|j||||j |y t j | |||} | dk(r%|j||||j |y|| z }|| z }||j|||j| |j|| |||||| y#ttf$r;||j|||j| |j|| |||||| Yyt$r} |Q| jtjk(r4t| t ur#t!dtj} | | _| } |dk(r:t%j&d} |j||||j)| n)|j||||j)| Yd} ~ yYd} ~ yd} ~ wt*t,f$rt.$r.} |j||||j)| Yd} ~ yd} ~ wwxYw)Nrzsocket is not connectedzos.sendfile call failed)rL remove_writer cancelled_sock_sendfile_update_filepos set_resultr!r_sock_add_cancellation_callback add_writerrBlockingIOErrorInterruptedErrorrMrSENOTCONNrConnectionError __cause__r r set_exceptionrrr)r+r registered_fdrrLrrr total_sentfdsentrWnew_excrs rrz1_UnixSelectorEventLoop._sock_sendfile_native_implysT [[]  $   } - ==?  . .vvz J   *IA~2266:Nz*1 F;;r669=DJqy2266:Nz*$d"  (88dCD$C$CS "D& &y*F[ !12 B$44S$? OOB ? ?f"E9j B ')II/I_4 *-u~~?$'!Q !::-/2266:N!!#&2266:N!!#&&'-.   #  . .vvz J   c " " #s,:C??AIIB6HI+$IIcZ|dkDr&tj||tjyyNr)r!lseekSEEK_SET)r+rLrrs rrz4_UnixSelectorEventLoop._sock_sendfile_update_fileposs" > HHVVR[[ 1 rc6fd}|j|y)Ncv|jr(j}|dk7rj|yyy)Nr@)rrLr)rrr+rs rcbzB_UnixSelectorEventLoop._sock_add_cancellation_callback..cbs6}}[[]8&&r*r)add_done_callback)r+rrrs` ` rrz6_UnixSelectorEventLoop._sock_add_cancellation_callbacks + b!rrNN)__name__ __module__ __qualname__r)r1r>rZr<r5rGrprsrrrrrrrr __classcell__r-s@rr&r&9s # .(+Z2@ =@D(,KAE)-L 04BF*.0#4 "&!% 0#f*.Gs"&!% GR.DFL2"rr&ceZdZdZdfd ZdZdZdZdZdZ dZ d Z d Z d Z d Zej fd ZddZdZdZxZS)rjic4t||||jd<||_||_|j |_||_d|_d|_ tj|j j}tj|sJtj|s5tj |s d|_d|_d|_t#dtj$|j d|jj'|jj(||jj'|j*|j |j,|,|jj't.j0|dyy)NrlFz)Pipe transport is for pipes/sockets only.)r(r)_extra_loop_piperL_fileno _protocol_closing_pausedr!rrrS_ISFIFOrS_ISCHRr# set_blocking call_soonconnection_made _add_reader _read_readyr _set_result_unless_cancelled)r+looprlrmrnromoder-s rr)z_UnixReadPipeTransport.__init__s. " F  {{} !  xx %-- d# d# T"DJDL!DNHI I  e, T^^;;TB T--!\\4+;+; =   JJ !E!E!' / rc^|jsy|jj||yr) is_readingrr)r+rrUs rrz"_UnixReadPipeTransport._add_readers#  r8,rc:|j xr |j Sr)rrr+s rrz!_UnixReadPipeTransport.is_readings<<5 $55rct|jjg}|j|jdn|jr|jd|jd|j t |jdd}|jW|Utj||j tj}|r|jdnA|jdn/|j|jdn|jddjd j|S) Nclosedclosingfd= _selectorpollingidleopen<{}> )r-rrappendrrgetattrrr _test_selector_event selectors EVENT_READformatjoin)r+rRr,r s r__repr__z_UnixReadPipeTransport.__repr__s''( ::  KK ! ]] KK " c$,,()4::{D9 :: !h&:%::$,, (<(<>G I& F# ZZ # KK  KK !}}SXXd^,,rch tj|j|j}|r|jj |y|j jrtjd|d|_ |j j|j|j j|jj|j j|jdy#tt f$rYyt"$r}|j%|dYd}~yd}~wwxYw)N%r was closed by peerTz"Fatal read error on pipe transport)r!readrmax_sizer data_receivedr get_debugrrRr_remove_readerr eof_received_call_connection_lostrrrM _fatal_error)r+r=rWs rrz"_UnixReadPipeTransport._read_ready s G774<<7D ,,T2::'')KK 7> $  ))$,,7 $$T^^%@%@A $$T%?%?F !12   I   c#G H H Is*C<<D1 D1D,,D1c|jsyd|_|jj|j|jj rt jd|yy)NTz%r pauses reading)rrrrrrrdebugrs r pause_readingz$_UnixReadPipeTransport.pause_readingsP   !!$,,/ ::   ! LL,d 3 "rc|js |jsyd|_|jj|j|j |jj rtjd|yy)NFz%r resumes reading) rrrrrrrrr"rs rresume_readingz%_UnixReadPipeTransport.resume_reading%s[ ==   t||T-=-=> ::   ! LL-t 4 "rc||_yrrr+rms r set_protocolz#_UnixReadPipeTransport.set_protocol- !rc|jSrr'rs r get_protocolz#_UnixReadPipeTransport.get_protocol0 ~~rc|jSrrrs r is_closingz!_UnixReadPipeTransport.is_closing3 }}rc@|js|jdyyr)r_closers rr1z_UnixReadPipeTransport.close6s}} KK rcv|j-|d|t||jjyyNzunclosed transport r/rr8r1r+_warns r__del__z_UnixReadPipeTransport.__del__:5 :: ! 'x0/$ O JJ    "rc<t|trQ|jtjk(r4|jj rDt jd||dn*|jj||||jd|j|yNz%r: %sTexc_info)message exceptionrrm) rfrMrSEIOrrrr"call_exception_handlerrr3r+rWr?s rr z#_UnixReadPipeTransport._fatal_error?sr sG $eii)?zz##% XtWtD JJ - -" ! NN /  Crcd|_|jj|j|jj |j |yNT)rrrrrrr+rWs rr3z_UnixReadPipeTransport._closeMs9  !!$,,/ T77=rc |jj||jjd|_d|_d|_y#|jjd|_d|_d|_wxYwrrconnection_lostrr1rrFs rrz,_UnixReadPipeTransport._call_connection_lostRg  NN * *3 / JJ   DJ!DNDJ JJ   DJ!DNDJ A 1A>rzFatal error on pipe transport)rrrrr)rrrrr#r%r)r,r0r1r6r7r9r r3rrrs@rrjrjs]H/<- 6-*G$45"%MM > rrjceZdZdfd ZdZdZdZdZdZdZ dZ d Z d Z d Z d Zej fd ZdZddZddZdZxZS)rrct |||||jd<||_|j |_||_t|_d|_ d|_ tj|j j}tj|}tj |}tj"|} |s$|s"| s d|_d|_d|_t%dtj&|j d|j(j+|j j,|| s!|rdt.j0j3dsE|j(j+|j(j4|j |j6|,|j(j+t8j:|dyy)NrlrFz?Pipe transport is only for pipes, sockets and character devicesaix)r(r)rrrLrr bytearray_buffer _conn_lostrr!rrrrrrr#rrrrr2platform startswithrrr r) r+rrlrmrnroris_charis_fifo is_socketr-s rr)z _UnixWritePipeTransport.__init___si %" F {{} ! {  xx %--,,t$--%MM$' 7iDJDL!DNDE E  e, T^^;;TB )@)@)G JJ !7!7!%t/?/? A   JJ !E!E!' / rc|jjg}|j|jdn|jr|jd|jd|j t |jdd}|j{|ytj||j tj}|r|jdn|jd|j}|jd|n/|j|jdn|jdd jd j|S) Nrrrr r r zbufsize=r r r)r-rrrrrrrr rr EVENT_WRITEget_write_buffer_sizerr)r+rRr,r rs rrz _UnixWritePipeTransport.__repr__s ''( ::  KK ! ]] KK " c$,,()4::{D9 :: !h&:%::$,, (=(=?G I& F#002G KK(7), - ZZ # KK  KK !}}SXXd^,,rc,t|jSr)lenrQrs rrZz-_UnixWritePipeTransport.get_write_buffer_sizes4<<  rc|jjrtjd||jr|j t y|j y)Nr)rrrrRrQr3BrokenPipeErrorrs rrz#_UnixWritePipeTransport._read_readys@ ::   ! KK/ 6 << KK) * KKMrct|tr t|}|sy|js |jrH|jt j k\rtjd|xjdz c_y|jss tj|j|}|t'|k(ry|dkDrt||d}|j(j+|j|j,|xj|z c_ |j/y#ttf$rd}Ytt f$rt"$r1}|xjdz c_|j%|dYd}~yd}~wwxYw)Nz=pipe closed by peer or os.write(pipe, data) raised exception.rr#Fatal write error on pipe transport)rfrP memoryviewrRrr!LOG_THRESHOLD_FOR_CONNLOST_WRITESrwarningrQr!writerrrrrrr r\r _add_writer _write_ready_maybe_pause_protocol)r+r=nrWs rrdz_UnixWritePipeTransport.writes7 dI &d#D  ??dmm)"M"MM HI OOq O || HHT\\40CI~Q!$'+ JJ " "4<<1B1B C   ""$$%56  12   1$!!#'LM s D$$E?7E?'E::E?c tj|j|j}|t |jk(r|jj |j j|j|j|jr6|j j|j|jdy|dkDr|jd|=yy#ttf$rYyttf$rt $rp}|jj |xj"dz c_|j j|j|j%|dYd}~yd}~wwxYw)Nrrr`)r!rdrrQr\r9r_remove_writer_maybe_resume_protocolrrrrrrrrrRr )r+rhrWs rrfz$_UnixWritePipeTransport._write_readys. %t||4AC %% ""$ ))$,,7++-==JJ--dll;..t4QLL!$) !12  -.   J LL   OOq O JJ % %dll 3   c#H I I  Js*C,,F=FA&E??FcyrErrs r can_write_eofz%_UnixWritePipeTransport.can_write_eofrc|jryd|_|jsL|jj|j|jj |j dyyrE)rrQrrrrrrs r write_eofz!_UnixWritePipeTransport.write_eofsO ==  || JJ % %dll 3 JJ !;!;T Brc||_yrr'r(s rr)z$_UnixWritePipeTransport.set_protocolr*rc|jSrr'rs rr,z$_UnixWritePipeTransport.get_protocolr-rc|jSrr/rs rr0z"_UnixWritePipeTransport.is_closingr1rcX|j|js|jyyyr)rrrprs rr1z_UnixWritePipeTransport.closes$ :: !$-- NN +8 !rcv|j-|d|t||jjyyr5r6r7s rr9z_UnixWritePipeTransport.__del__r:rc&|jdyr)r3rs rabortz_UnixWritePipeTransport.aborts Drct|tr4|jjrDt j d||dn*|jj ||||jd|j|yr<) rfrMrrrr"rBrr3rCs rr z$_UnixWritePipeTransport._fatal_error sc c7 #zz##% XtWtD JJ - -" ! NN /  Crc>d|_|jr%|jj|j|jj |jj |j|jj|j|yrE) rrQrrjrr9rrrrFs rr3z_UnixWritePipeTransport._closesf << JJ % %dll 3  !!$,,/ T77=rc |jj||jjd|_d|_d|_y#|jjd|_d|_d|_wxYwrrHrFs rrz-_UnixWritePipeTransport._call_connection_lostrJrKrrLr)rrrr)rrZrrdrfrmrpr)r,r0r1r6r7r9rwr r3rrrs@rrrrr\sd#/J-0!!%F%8C" %MM  >rrrceZdZdZy)r|c d}|tjk(r6tjj drt j \}} tj|f||||d|d||_|=|jt|jd||j_ d}|!|j|jyy#|!|j|jwwxYw)NrOF)rrrruniversal_newlinesrwb) buffering) subprocessPIPEr2rSrTr socketpairPopen_procr1r detachr) r+rVrrrrrrstdin_ws r_startz_UnixSubprocessTransport._start+s JOO # (?(?(F $..0NE7 #))E!vf#('E=CEDJ" #'(8$'#R  "  #w"  #s A!C%C7N)rrrrrrrr|r|)s rr|c@eZdZ d dZdZdZdZdZdZdZ d Z y) rNc\|jtk7rtjdddyy)NrP{name!r} is deprecated as of Python 3.12 and will be removed in Python {remove}.r)rrr6 _deprecated)clss r__init_subclass__z&AbstractChildWatcher.__init_subclass__Xs, >>X %  !7;%, . &rc trNotImplementedErrorr+rrUrVs rr}z&AbstractChildWatcher.add_child_handler_s "##rc trrr+rs rremove_child_handlerz)AbstractChildWatcher.remove_child_handlerjs 1 "##rc trrr+rs r attach_loopz AbstractChildWatcher.attach_looprs "##rc trrrs rr1zAbstractChildWatcher.close|s "##rc trrrs rrzzAbstractChildWatcher.is_actives "##rc trrrs r __enter__zAbstractChildWatcher.__enter__s *"##rc trrr+abcs r__exit__zAbstractChildWatcher.__exit__s(!##r)returnN) rrrrr}rrr1rzrrrrrrrAs/,. $$$$$$ $rrc>eZdZ dZdZdZdZdZdZdZ dZ y ) rc|Srrrs rrzPidfdChildWatcher.__enter__ rcyrr)r+exc_type exc_value exc_tracebacks rrzPidfdChildWatcher.__exit__ rcyrErrs rrzzPidfdChildWatcher.is_activernrcyrrrs rr1zPidfdChildWatcher.closerrcyrrrs rrzPidfdChildWatcher.attach_looprrctj}tj|}|j ||j ||||yr)rget_running_loopr! pidfd_openr_do_wait)r+rrUrVrpidfds rr}z#PidfdChildWatcher.add_child_handlers:&&( c"  sE8TJrc$tj}|j| tj|d\}}t |}tj||||g|y#t $rd}tjd|YCwxYw)NrzJchild process pid %d exit status already read: will report returncode 255) rrrr!waitpidr"ChildProcessErrorrrcr1) r+rrrUrVr_r$rs rrzPidfdChildWatcher._do_waits&&( E" 8 3*IAv07J j(4(! J NN.   sA++!BBcyrErrs rrz&PidfdChildWatcher.remove_child_handlerrN) rrrrrrzr1rr}rrrrrrrs0    K )&rrc6eZdZdZdZdZdZdZdZdZ y) BaseChildWatcherc d|_i|_yr)r _callbacksrs rr)zBaseChildWatcher.__init__s rc&|jdyr)rrs rr1zBaseChildWatcher.closes rcV|jduxr|jjSr)r is_runningrs rrzzBaseChildWatcher.is_actives#zz%A$***?*?*AArctrr)r+ expected_pids r _do_waitpidzBaseChildWatcher._do_waitpid !##rctrrrs r_do_waitpid_allz BaseChildWatcher._do_waitpid_allrrc^|j(|&|jrtjdt|j)|jj t j||_|;|jt j|j|jyy)NzCA loop is being detached from a child watcher with pending handlers) rrr6r7RuntimeWarningr5rISIGCHLDrZ _sig_chldrrs rrzBaseChildWatcher.attach_loops :: !dlt MM= :: ! JJ , ,V^^ <    # #FNNDNN C  " rc |jy#ttf$rt$r(}|jj d|dYd}~yd}~wwxYw)N$Unknown exception in SIGCHLD handler)r?r@)rrrrrrBrFs rrzBaseChildWatcher._sig_chldsX   "-.    JJ - -A /    sAAAN) rrrr)r1rzrrrrrrrrrs&B$$#( rrcNeZdZ fdZfdZdZdZdZdZdZ dZ xZ S) rcRt|tjdddy)Nrrrr)r(r)r6rr+r-s rr)zSafeChildWatcher.__init__s' /;%, .rcV|jjt| yr)rr9r(r1rs rr1zSafeChildWatcher.closes   rc|Srrrs rrzSafeChildWatcher.__enter__rrcyrrrs rrzSafeChildWatcher.__exit__rrcH||f|j|<|j|yr)rrrs rr}z"SafeChildWatcher.add_child_handler"s% ($/ rc> |j|=y#t$rYywxYwNTFrr`rs rrz%SafeChildWatcher.remove_child_handler(( $    cZt|jD]}|j|yrr4rrrs rrz SafeChildWatcher._do_waitpid_all/s#(C   S !)rc tj|tj\}}|dk(ryt|}|jj rt jd|| |jj|\}}|||g|y#t$r|}d}t jd|YOwxYw#t$r7|jj rt jd|dYyYywxYw)Nr$process %s exited with returncode %sr8Unknown child process pid %d, will report returncode 255'Child watcher got an unexpected pid: %rTr=) r!rWNOHANGr"rrrr"rrcrpopr`)r+rrr$rrUrVs rrzSafeChildWatcher._do_waitpid4s 7**\2::>KCax/7Jzz##% C):7 -!__005NHd S* ,t ,7! CJ NNJ   ( 3zz##%H"T3& 3s#'B-B?#B<;B<?;C?>C?) rrrr)r1rrr}rrrrrs@rrrs0.  " -rrcHeZdZ fdZfdZdZdZdZdZdZ xZ S)rct|tj|_i|_d|_tjdddy)Nrrrrr) r(r) threadingLock_lock_zombies_forksr6rrs rr)zFastChildWatcher.__init__asC ^^%   /;%, .rc|jj|jjt|yr)rr9rr(r1rs rr1zFastChildWatcher.closeks,    rct|j5|xjdz c_|cdddS#1swYyxYw)Nr)rrrs rrzFastChildWatcher.__enter__ps$ ZZ KK1 KZZs.7c>|j5|xjdzc_|js |js dddyt|j}|jj dddt j dy#1swY xYw)Nrz5Caught subprocesses termination from unknown pids: %s)rrrrOr9rrc)r+rrrcollateral_victimss rrzFastChildWatcher.__exit__vsp ZZ KK1 K{{$-- Z "%T]]!3  MM   !  C  Zs/B/BBc|j5 |jj|} ddd||g|y#t$r||f|j|<YdddywxYw#1swYA#A&"A##A&&A/c> |j|=y#t$rYywxYwrrrs rrz%FastChildWatcher.remove_child_handlerrrc tjdtj\}}|dk(ryt|}|j 5 |j j|\}}|jjrtjd|| dddtjd||n |||g#t$rYywxYw#t$r\|jrK||j|<|jjrtjd||Yddd4d}YwxYw#1swYxYw)Nr@rrz,unknown process %s exited with returncode %sz8Caught subprocess termination from unknown pid: %d -> %d)r!rrr"rrrrrrrr"r`rrrc)r+rr$rrUrVs rrz FastChildWatcher._do_waitpid_alls8 < jjRZZ8 V !83F; 6%)__%8%8%=NHdzz++- %K%(*6!& #Z1j040K%   ${{-7 c*:://1"LL*>),j:! $H $sN'CD= C'2D= CCAD:*D=5D:7D=9D::D==E) rrrr)r1rrr}rrrrs@rrrWs+.    )(1rrcPeZdZ dZdZdZdZdZdZdZ dZ d Z d Z d Z y ) rcPi|_d|_tjdddy)Nrrrr)r_saved_sighandlerr6rrs rr)zMultiLoopChildWatcher.__init__s*!%4;%, .rc|jduSr)rrs rrzzMultiLoopChildWatcher.is_actives%%T11rcZ|jj|jytjtj }||j k7rtjdd|_ytjtj |jd|_y)Nz+SIGCHLD handler was changed by outside code) rr9rrI getsignalrrrrc)r+rds rr1zMultiLoopChildWatcher.closesz   ! ! ) ""6>>2 dnn $ NNH I"& MM&..$*@*@ A!%rc|Srrrs rrzMultiLoopChildWatcher.__enter__rrcyrrr+rexc_valexc_tbs rrzMultiLoopChildWatcher.__exit__rrcrtj}|||f|j|<|j|yr)rrrr)r+rrUrVrs rr}z'MultiLoopChildWatcher.add_child_handlers5&&( $h5 rc> |j|=y#t$rYywxYwrrrs rrz*MultiLoopChildWatcher.remove_child_handlerrrc8|jytjtj|j|_|j*t j dtj |_tjtjdy)NzaPrevious SIGCHLD handler was set by non-Python code, restore to default handler on watcher close.F)rrIrrrrcrcrQrs rrz!MultiLoopChildWatcher.attach_loopso  ! ! - !'v~~t~~!N  ! ! ) NNJ K%+^^D " FNNE2rcZt|jD]}|j|yrrrs rrz%MultiLoopChildWatcher._do_waitpid_alls#(C   S !)rc* tj|tj\}}|dk(ryt|}d} |jj|\}}}|jrt j d||y|r'|jrt jd|||j|||g|y#t$r|}d}t j d|d}YwxYw#t$rt j d|d YywxYw) NrTrrF%Loop %r that handles pid %r is closedrrr=)r!rrr"rrrcrr is_closedrr"rr`) r+rrr$r debug_logrrUrVs rrz!MultiLoopChildWatcher._do_waitpids  **\2::>KCax/7JI L#'??#6#6s#; D(D~~FcR!1LL!G!-z;)))(CKdK=! CJ NNJ I $ / NND / /s"'CC.%C+*C+.!DDc |jy#ttf$rt$rt j ddYywxYw)NrTr=)rrrrrrc)r+rrs rrzMultiLoopChildWatcher._sig_chld<sE R  "-.   R NNAD Q Rs/AAN)rrrr)rzr1rrr}rrrrrrrrrrsA $.2 & 3""#LJRrrcbeZdZ dZdZdZdZdZejfdZ dZ dZ d Z d Zy ) rcFtjd|_i|_yr) itertoolsr _pid_counter_threadsrs rr)zThreadedChildWatcher.__init__Rs%OOA. rcyrErrs rrzzThreadedChildWatcher.is_activeVrnrcyrrrs rr1zThreadedChildWatcher.closeYrrc|Srrrs rrzThreadedChildWatcher.__enter__\rrcyrrrs rrzThreadedChildWatcher.__exit___rrct|jjDcgc]}|jr|}}|r||jdt |yycc}w)Nz0 has registered but not finished child processesr/)r4r valuesis_aliver-r8)r+r8threadthreadss rr9zThreadedChildWatcher.__del__bse(,T]]-A-A-C(D)(Dfoo'(D)  T^^$$TU!  )sA!ctj}tj|jdt |j ||||fd}||j|<|jy)Nzasyncio-waitpid-T)targetnamerVdaemon) rrrThreadrnextr r start)r+rrUrVrrs rr}z&ThreadedChildWatcher.add_child_handlerjsf&&(!!)9)9)9$t?P?P:Q9R'S(,c8T'B)-/$ c rcyrErrs rrz)ThreadedChildWatcher.remove_child_handlersrrcyrrrs rrz ThreadedChildWatcher.attach_loopyrrc tj|d\}}t|}|jrt j d|| |jrt jd||n|j|||g||jj|y#t $r|}d}t jd|Y~wxYw)Nrrrrr) r!rr"rrr"rrcrrr r)r+rrrUrVrr$rs rrz ThreadedChildWatcher._do_waitpid|s 7**\15KC07J~~ C):7 >>  NNBD# N %D % %hZ G$ G ,''! CJ NNJ   sB''#C  C N)rrrr)rzr1rrr6r7r9r}rrrrrrrrEsB   %MM  (rrcttdsy tj}tjtj|dy#t $rYywxYw)NrFrT)hasattrr!getpidr1rrM)rs r can_use_pidfdr"sO 2| $iik sA&'  s=A AAc@eZdZ eZfdZdZfdZdZdZ xZ S)_UnixDefaultEventLoopPolicyc0t|d|_yr)r(r)_watcherrs rr)z$_UnixDefaultEventLoopPolicy.__init__s  rctj5|j)trt |_nt |_dddy#1swYyxYwr)rrr&r"rrrs r _init_watcherz)_UnixDefaultEventLoopPolicy._init_watchers6 \\}}$ ?$5$7DM$8$:DM \\s 6AAc t|||jEtjtj ur|jj |yyyr)r(set_event_loopr&rcurrent_thread main_threadr)r+rr-s rr*z*_UnixDefaultEventLoopPolicy.set_event_loopsX  t$ MM %((*i.C.C.EE MM % %d +F &rc |j|jtjddd|jS)Nryrrr)r&r(r6rrs rryz-_UnixDefaultEventLoopPolicy.get_child_watchersE  ==    0:BI K}}rc |j|jj||_tjdddy)Nset_child_watcherrrr)r&r1r6r)r+rs rr/z-_UnixDefaultEventLoopPolicy.set_child_watchersB2 == $ MM   ! 0:BI Kr) rrrr& _loop_factoryr)r(r*ryr/rrs@rr$r$s%D*M; ,  Krr$)3rSrr r!rrIrrrr2rr6rrrrrr r r r r logr__all__rS ImportErrorrr"BaseSelectorEventLoopr& ReadTransportrj_FlowControlMixinWriteTransportrrBaseSubprocessTransportr|rrrrrrrr"BaseDefaultEventLoopPolicyr$rrrrrr;se8     <<7 C DD P"_BBP"f MZ55M`Jj::(77JZ FF 0S$S$l7,7t2+2jN-'N-bj1'j1Z~R0~RBO(/O(b 6K&"C"C6Kr+4r__pycache__/events.cpython-312.opt-2.pyc000064400000065513152527367570013760 0ustar00 {|jr dZddlZddlZddlZddlZddlZddlZddlZddlm Z GddZ Gdde Z Gd d Z Gd d Z Gd dZGddeZdaej"ZGddej&ZeZdZdZdZdZdZdZdZdZdZdZdZ eZ!eZ"eZ#eZ$ ddl%mZmZmZmZeZ&eZ'eZ(eZ)e+edrd Z,ejZe,!yy#e*$rY(wxYw)")AbstractEventLoopPolicyAbstractEventLoopAbstractServerHandle TimerHandleget_event_loop_policyset_event_loop_policyget_event_loopset_event_loopnew_event_loopget_child_watcherset_child_watcher_set_running_loopget_running_loop_get_running_loopN)format_helpersc>eZdZ dZd dZdZdZdZdZdZ d Z y) r) _callback_args _cancelled_loop_source_traceback_repr __weakref___contextNc"|tj}||_||_||_||_d|_d|_|jjr.tjtjd|_ yd|_ y)NFr) contextvars copy_contextrrrrrr get_debugr extract_stacksys _getframer)selfcallbackargsloopcontexts '/usr/lib64/python3.12/asyncio/events.py__init__zHandle.__init__$sx ?!..0G  !  ::   !%3%A%A a &"D "&*D "ch|jjg}|jr|jd|j9|jt j |j|j|jr,|jd}|jd|dd|d|S)N cancelledz created at r:r) __class____name__rappendrr_format_callback_sourcerr)r$infoframes r) _repr_infozHandle._repr_info3s''( ?? KK $ >> % KK>> , -  ! !**2.E KK+eAhZqq ; < r+c|j |jS|j}djdj|S)Nz<{}> )rr6formatjoin)r$r4s r)__repr__zHandle.__repr__?s9 :: !::  }}SXXd^,,r+c|jSN)rr$s r) get_contextzHandle.get_contextEs }}r+c|js@d|_|jjrt||_d|_d|_yy)NT)rrr reprrrrr>s r)cancelz Handle.cancelHs@"DOzz##%"$Z !DNDJr+c|jSr=)rr>s r)r-zHandle.cancelledSs r+c |jj|jg|jd}y#tt f$rt $rw}tj|j|j}d|}|||d}|jr|j|d<|jj|Yd}~d}yd}~wwxYw)NzException in callback )message exceptionhandlesource_traceback) rrunrr SystemExitKeyboardInterrupt BaseExceptionrr3rrcall_exception_handler)r$exccbmsgr(s r)_runz Handle._runVs 7 DMM  dnn :tzz :-.   777 ,B*2$/C G %%.2.D.D*+ JJ - -g 6 6 7s16CA+CCr=) r1 __module__ __qualname__ __slots__r*r6r;r?rBr-rQr+r)rrs/;I * -  r+rcheZdZ ddgZd fd ZfdZdZdZdZdZ d Z d Z fd Z d Z xZS)r _scheduled_whencxt||||||jr |jd=||_d|_y)Nr.F)superr*rrXrW)r$whenr%r&r'r(r0s r)r*zTimerHandle.__init__os; 4w7  ! !&&r* r+ct|}|jrdnd}|j|d|j|S)Nrzwhen=)rZr6rinsertrX)r$r4posr0s r)r6zTimerHandle._repr_infovs;w!#??a C5 -. r+c,t|jSr=)hashrXr>s r)__hash__zTimerHandle.__hash__|sDJJr+c`t|tr|j|jkStSr= isinstancerrXNotImplementedr$others r)__lt__zTimerHandle.__lt__% e[ ):: + +r+ct|tr,|j|jkxs|j|StSr=rerrX__eq__rfrgs r)__le__zTimerHandle.__le__3 e[ ):: +At{{5/A Ar+c`t|tr|j|jkDStSr=rdrgs r)__gt__zTimerHandle.__gt__rjr+ct|tr,|j|jkDxs|j|StSr=rlrgs r)__ge__zTimerHandle.__ge__ror+ct|trj|j|jk(xrO|j|jk(xr4|j|jk(xr|j |j k(St Sr=)rerrXrrrrfrgs r)rmzTimerHandle.__eq__sl e[ )JJ%++-8NNeoo58JJ%++-8OOu'7'77 9r+cp|js|jj|t|yr=)rr_timer_handle_cancelledrZrB)r$r0s r)rBzTimerHandle.cancels& JJ . .t 4 r+c |jSr=)rXr>s r)r[zTimerHandle.whens zzr+r=)r1rRrSrTr*r6rbrirnrqrsrmrBr[ __classcell__)r0s@r)rrjsBAw'I        r+rc>eZdZ dZdZdZdZdZdZdZ dZ y ) rc tr=NotImplementedErrorr>s r)closezAbstractServer.closes C!!r+c tr=r{r>s r)get_loopzAbstractServer.get_loops B!!r+c tr=r{r>s r) is_servingzAbstractServer.is_serving A!!r+cK twr=r{r>s r) start_servingzAbstractServer.start_servings "! cK twr=r{r>s r) serve_foreverzAbstractServer.serve_forevers "!rcK twr=r{r>s r) wait_closedzAbstractServer.wait_closeds8!!rcK|Swr=rUr>s r) __aenter__zAbstractServer.__aenter__s  sc`K|j|jd{y7wr=)r}r)r$rNs r) __aexit__zAbstractServer.__aexit__s!    s $.,.N) r1rRrSr}rrrrrrrrUr+r)rrs-6""""""!r+rc eZdZ dZdZdZdZdZdZdZ dZ d Z d d d Z d d d Z d d dZdZdZd d ddZd d dZdZdZddddddZdIdZ dJd dddd d d d d d d d dZ dJej2ej4d dd d d d d dd dZdKdd d!Zd"d d d d#d$Z dLd d d d d d%d&Z dLd dd d d dd'd(Zd d d d)d*Z dJdddd d d d d+d,Z!d-Z"d.Z#e$jJe$jJe$jJd/d0Z&e$jJe$jJe$jJd/d1Z'd2Z(d3Z)d4Z*d5Z+d6Z,d7Z-d8Z.dId9Z/d:Z0d;Z1d<Z2d=Z3dKd d d>Z4d?Z5d@Z6dAZ7dBZ8dCZ9dDZ:dEZ;dFZy )Mrc tr=r{r>s r) run_foreverzAbstractEventLoop.run_forever 8!!r+c tr=r{)r$futures r)run_until_completez$AbstractEventLoop.run_until_completes "!r+c tr=r{r>s r)stopzAbstractEventLoop.stops "!r+c tr=r{r>s r) is_runningzAbstractEventLoop.is_runningrr+c tr=r{r>s r) is_closedzAbstractEventLoop.is_closedrr+c tr=r{r>s r)r}zAbstractEventLoop.closes "!r+cK twr=r{r>s r)shutdown_asyncgensz$AbstractEventLoop.shutdown_asyncgenss:!!rcK twr=r{r>s r)shutdown_default_executorz+AbstractEventLoop.shutdown_default_executors<!!rc tr=r{)r$rGs r)rvz)AbstractEventLoop._timer_handle_cancelledrr+N)r(c0|jd|g|d|iS)Nrr() call_laterr$r%r(r&s r) call_soonzAbstractEventLoop.call_soon stq(CTC7CCr+ctr=r{)r$delayr%r(r&s r)rzAbstractEventLoop.call_later!!r+ctr=r{)r$r[r%r(r&s r)call_atzAbstractEventLoop.call_atrr+ctr=r{r>s r)timezAbstractEventLoop.timerr+ctr=r{r>s r) create_futurezAbstractEventLoop.create_futurerr+)namer(ctr=r{)r$cororr(s r) create_taskzAbstractEventLoop.create_taskrr+ctr=r{rs r)call_soon_threadsafez&AbstractEventLoop.call_soon_threadsafe"rr+ctr=r{)r$executorfuncr&s r)run_in_executorz!AbstractEventLoop.run_in_executor%rr+ctr=r{)r$rs r)set_default_executorz&AbstractEventLoop.set_default_executor(rr+r)familytypeprotoflagscKtwr=r{)r$hostportrrrrs r) getaddrinfozAbstractEventLoop.getaddrinfo- !! cKtwr=r{)r$sockaddrrs r) getnameinfozAbstractEventLoop.getnameinfo1 !!r) sslrrrsock local_addrserver_hostnamessl_handshake_timeoutssl_shutdown_timeouthappy_eyeballs_delay interleavec Ktwr=r{)r$protocol_factoryrrrrrrrrrrrrrs r)create_connectionz#AbstractEventLoop.create_connection4s"!rdT) rrrbacklogr reuse_address reuse_portrrrc K twr=r{)r$rrrrrrrrrrrrrs r) create_serverzAbstractEventLoop.create_server>s/ `"!r)fallbackcK twr=r{)r$ transportfileoffsetcountrs r)sendfilezAbstractEventLoop.sendfilexs "!rF) server_siderrrcK twr=r{)r$rprotocol sslcontextrrrrs r) start_tlszAbstractEventLoop.start_tlss  "!r)rrrrrcKtwr=r{)r$rpathrrrrrs r)create_unix_connectionz(AbstractEventLoop.create_unix_connections "!r)rrrrrrcK twr=r{) r$rrrrrrrrs r)create_unix_serverz$AbstractEventLoop.create_unix_servers  8"!r)rrrcK twr=r{)r$rrrrrs r)connect_accepted_socketz)AbstractEventLoop.connect_accepted_sockets  "!r)rrrrrallow_broadcastrcK twr=r{) r$rr remote_addrrrrrrrrs r)create_datagram_endpointz*AbstractEventLoop.create_datagram_endpoints  8"!rcK twr=r{r$rpipes r)connect_read_pipez#AbstractEventLoop.connect_read_pipes $"!rcK twr=r{rs r)connect_write_pipez$AbstractEventLoop.connect_write_pipes %"!r)stdinstdoutstderrcKtwr=r{)r$rcmdrrrkwargss r)subprocess_shellz"AbstractEventLoop.subprocess_shell "!rcKtwr=r{)r$rrrrr&rs r)subprocess_execz!AbstractEventLoop.subprocess_exec rrctr=r{r$fdr%r&s r) add_readerzAbstractEventLoop.add_readerrr+ctr=r{r$rs r) remove_readerzAbstractEventLoop.remove_readerrr+ctr=r{rs r) add_writerzAbstractEventLoop.add_writerrr+ctr=r{rs r) remove_writerzAbstractEventLoop.remove_writer"rr+cKtwr=r{)r$rnbytess r) sock_recvzAbstractEventLoop.sock_recv'rrcKtwr=r{)r$rbufs r)sock_recv_intoz AbstractEventLoop.sock_recv_into*rrcKtwr=r{)r$rbufsizes r) sock_recvfromzAbstractEventLoop.sock_recvfrom-rrcKtwr=r{)r$rrr s r)sock_recvfrom_intoz$AbstractEventLoop.sock_recvfrom_into0rrcKtwr=r{)r$rdatas r) sock_sendallzAbstractEventLoop.sock_sendall3rrcKtwr=r{)r$rraddresss r) sock_sendtozAbstractEventLoop.sock_sendto6rrcKtwr=r{)r$rrs r) sock_connectzAbstractEventLoop.sock_connect9rrcKtwr=r{)r$rs r) sock_acceptzAbstractEventLoop.sock_accept<rrcKtwr=r{)r$rrrrrs r) sock_sendfilezAbstractEventLoop.sock_sendfile?rrctr=r{)r$sigr%r&s r)add_signal_handlerz$AbstractEventLoop.add_signal_handlerErr+ctr=r{)r$r#s r)remove_signal_handlerz'AbstractEventLoop.remove_signal_handlerHrr+ctr=r{)r$factorys r)set_task_factoryz"AbstractEventLoop.set_task_factoryMrr+ctr=r{r>s r)get_task_factoryz"AbstractEventLoop.get_task_factoryPrr+ctr=r{r>s r)get_exception_handlerz'AbstractEventLoop.get_exception_handlerUrr+ctr=r{)r$handlers r)set_exception_handlerz'AbstractEventLoop.set_exception_handlerXrr+ctr=r{r$r(s r)default_exception_handlerz+AbstractEventLoop.default_exception_handler[rr+ctr=r{r2s r)rMz(AbstractEventLoop.call_exception_handler^rr+ctr=r{r>s r)r zAbstractEventLoop.get_debugcrr+ctr=r{)r$enableds r) set_debugzAbstractEventLoop.set_debugfrr+)rNN)rNr=)?r1rRrSrrrrrr}rrrvrrrrrrrrrrrrsocket AF_UNSPEC AI_PASSIVErrrrrrrrr subprocessPIPErrrrrr r rrrrrrrr!r$r&r)r+r-r0r3rMr r8rUr+r)rrs?""""" """ "26D:>"6:""" )-d" =A""" "#!1""59"$4 "&!%!%$"598"&&##$DT"&!%8"t"#'"%*(,.2-1 "*."4 "&!% "*.""s"&!% ""L"&!% " EI!"./q59d7;$ !"J " "&0__&0oo&0oo"%/OO%/__%/__""""" """""""""(," "" "" """" ""r+rc,eZdZ dZdZdZdZdZy)rc tr=r{r>s r)r z&AbstractEventLoopPolicy.get_event_loopms ("!r+c tr=r{r$r's r)r z&AbstractEventLoopPolicy.set_event_loopwrr+c tr=r{r>s r)r z&AbstractEventLoopPolicy.new_event_loop{s J"!r+c tr=r{r>s r)r z)AbstractEventLoopPolicy.get_child_watchers .!!r+c tr=r{)r$watchers r)r z)AbstractEventLoopPolicy.set_child_watchers 2!!r+N)r1rRrSr r r r r rUr+r)rrjs7"""""r+rcTeZdZ dZGddej ZdZdZdZ dZ y)BaseDefaultEventLoopPolicyNceZdZdZdZy)!BaseDefaultEventLoopPolicy._LocalNF)r1rRrSr _set_calledrUr+r)_LocalrJs  r+rLc.|j|_yr=)rL_localr>s r)r*z#BaseDefaultEventLoopPolicy.__init__skkm r+c |jj|jjstjtj urd} t jd}|rG|jjd}|dk(s|jdsn|j}|dz }|rF ddl }|jdt||j!|j#|jj*t%d tjj&z|jjS#t$rYwxYw) Nr]rr1asynciozasyncio.rzThere is no current event loop) stacklevelz,There is no current event loop in thread %r.)rNrrK threadingcurrent_thread main_threadr"r# f_globalsget startswithf_backAttributeErrorwarningswarnDeprecationWarningr r RuntimeErrorr)r$rQfmodulerZs r)r z)BaseDefaultEventLoopPolicy.get_event_loops4  KK   %KK++((*i.C.C.EEJ $MM!$ [[__Z8F"i/63D3DZ3PA!OJ   MM:,  E    3 3 5 6 ;;   $M!*!9!9!;!@!@ AB B{{   )"  sE EEc d|j_|2t|ts"t dt |j d||j_y)NTzs r)r z)BaseDefaultEventLoopPolicy.new_event_loops !!##r+) r1rRrSrdrRlocalrLr*r r r rUr+r)rHrHs3 M$!B!$r+rHceZdZdZy) _RunningLoopr9N)r1rRrSloop_pidrUr+r)rgrgsHr+rgc6 t}| td|S)Nzno running event loop)rr]r's r)rrs'  D |233 Kr+cd tj\}}||tjk(r|Syyr=) _running_looprhosgetpid) running_looppids r)rrs: &..L#C299;$6%7r+cD |tjft_yr=)rmrnrlrhrjs r)rrs #BIIK0Mr+c`t5t ddlm}|adddy#1swYyxYw)NrDefaultEventLoopPolicy)_lock_event_loop_policyrtrss r)_init_event_loop_policyrxs!   % 0!7!9  s$-c0 t ttSr=)rvrxrUr+r)rrs,!! r+cr |2t|ts"tdt|jd|ay)NzDpolicy must be an instance of AbstractEventLoopPolicy or None, not 'ra)rerrbrr1rv)policys r)rrsC:*V5L"M^_cdj_k_t_t^uuvwxxr+cP t}||StjSr=)rrr ) current_loops r)r r s/%&L " 1 1 33r+c8 tj|yr=)rr rjs r)r r 0sM**40r+c4 tjSr=)rr rUr+r)r r 5sI " 1 1 33r+c4 tjSr=)rr rUr+r)r r :sL " 4 4 66r+c6 tj|Sr=)rr )rFs r)r r ?s; " 4 4W ==r+)rrrr forkcttjt_t dt j dy)Nr.)rvrHrLrNrsignal set_wakeup_fdrUr+r)on_forkr]s0  )(B(I(I(K  %$R r+)after_in_child).__all__rrmrr:r=r"rRrwrrrrrrrHrvLockrurergrlrrrrxrrr r r r r _py__get_running_loop_py__set_running_loop_py_get_running_loop_py_get_event_loop_asyncio_c__get_running_loop_c__set_running_loop_c_get_running_loop_c_get_event_loop ImportErrorhasattrrregister_at_forkrUr+r)rs]'   JJZ<&<~'!'!TT"T"n ""DD$!8D$V  9??   1:  4 1 4 7 >*)'# '<< -,*& 2v!Bw/  s= C22C:9C:__pycache__/threads.cpython-312.pyc000064400000002354152527367570013140 0ustar00 {|j.dZddlZddlZddlmZdZdZy)z6High-level support for working with threads in asyncioN)events) to_threadcKtj}tj}t j |j |g|i|}|jd|d{S7w)aAsynchronously run function *func* in a separate thread. Any *args and **kwargs supplied for this function are directly passed to *func*. Also, the current :class:`contextvars.Context` is propagated, allowing context variables from the main thread to be accessed in the separate thread. Return a coroutine that can be awaited to get the eventual result of *func*. N)rget_running_loop contextvars copy_context functoolspartialrunrun_in_executor)funcargskwargsloopctx func_calls (/usr/lib64/python3.12/asyncio/threads.pyrr s]  " " $D  " " $C!!#''4A$A&AI%%dI6 66 6sA"A+$A)%A+)__doc__r rr__all__rrrs<  7r__pycache__/__main__.cpython-312.opt-1.pyc000064400000012521152527367570014162 0ustar00 {|j jddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl m Z GddejZGddejZedk(rej$d ej&Zej*ed eiZd D]Zeeee<eeeZdad a ddlZeZd e_ejA ejCyy#e$rY9wxYw#e"$r3t4r*t4jGst4jId aYVwxYw)N)futuresc$eZdZfdZdZxZS)AsyncIOInteractiveConsolect|||jjxjt j zc_||_tj|_ y)N) super__init__compilecompilerflagsastPyCF_ALLOW_TOP_LEVEL_AWAITloop contextvars copy_contextcontext)selflocalsr __class__s )/usr/lib64/python3.12/asyncio/__main__.pyr z"AsyncIOInteractiveConsole.__init__sH   ##s'E'EE# "//1 c8tjjfd}tj |j  j S#t$rt$r,trjdYyjYywxYw)Nc&dadatjj} |}tj|sj|y jj|jatj ty#t $rt $r}daj|Yd}~yd}~wt$r}j|Yd}~yd}~wwxYw#t$r}j|Yd}~yd}~wwxYw)NFTr) repl_futurerepl_future_interruptedtypes FunctionTyper SystemExitKeyboardInterrupt set_exception BaseExceptioninspect iscoroutine set_resultr create_taskrr _chain_future)funccoroexexccodefuturers rcallbackz3AsyncIOInteractiveConsole.runcode..callbacksK&+ #%%dDKK8D v&&t,!!$' *"ii33D$,,3O %%k6:! $ *.'$$R(  $$R( ! *$$S)) *s<BAC,C)*C C)C$$C), D5D  Drz KeyboardInterrupt ) concurrentrFuturercall_soon_threadsaferresultrr"rwrite showtraceback)rr,r.r-s`` @rruncodez!AsyncIOInteractiveConsole.runcodes|##**, *< !!(DLL!A %==? "   %& 23""$  %s A)BBB)__name__ __module__ __qualname__r r5 __classcell__)rs@rrrs 2 +%rrceZdZdZy) REPLThreadc  dtjdtjdttddd}tj |dt jd d t tjtjy#t jd d t tjtjwxYw) Nz asyncio REPL z on zy Use "await" directly instead of "asyncio.run()". Type "help", "copyright", "credits" or "license" for more information. ps1z>>> zimport asynciozexiting asyncio REPL...)bannerexitmsgignorez ^coroutine .* was never awaited$)messagecategory) sysversionplatformgetattrconsoleinteractwarningsfilterwarningsRuntimeWarningrr1stop)rr>s rrunzREPLThread.runGs 1 }D?*3v./~ ?    1  3  # #;' )  % %dii 0  # #;' )  % %dii 0s ABACN)r6r7r8rMrrr;r;Es1rr;__main__zcpython.run_stdinasyncio>__file__r6__spec__ __loader__ __package__ __builtins__FT)%r rPr,concurrent.futuresr/rr#rC threadingrrIrInteractiveConsolerThreadr;r6auditnew_event_looprset_event_loop repl_localskeyrrGrrreadline ImportError repl_threaddaemonstart run_foreverr donecancelrNrrrhsP    3% 7 73%l1!!10 z CII!" !7 ! ! #DG4 g&K,"8C= C, ( T:GK# ,KK       G&    ! ;#3#3#5""$*.'   s$9C/C:/C76C7:5D21D2__pycache__/transports.cpython-312.pyc000064400000033266152527367570013733 0ustar00 {|j)dZdZGddZGddeZGddeZGdd eeZGd d eZGd d eZGddeZy)zAbstract Transport class.) BaseTransport ReadTransportWriteTransport TransportDatagramTransportSubprocessTransportc<eZdZdZdZd dZd dZdZdZdZ d Z y) rzBase class for transports._extraNc|i}||_yNr )selfextras +/usr/lib64/python3.12/asyncio/transports.py__init__zBaseTransport.__init__s =E c:|jj||S)z#Get optional transport information.)r get)r namedefaults rget_extra_infozBaseTransport.get_extra_infos{{tW--rct)z2Return True if the transport is closing or closed.NotImplementedErrorr s r is_closingzBaseTransport.is_closing!!rct)aClose the transport. Buffered data will be flushed asynchronously. No more data will be received. After all buffered data is flushed, the protocol's connection_lost() method will (eventually) be called with None as its argument. rrs rclosezBaseTransport.close "!rct)zSet a new protocol.r)r protocols r set_protocolzBaseTransport.set_protocol%rrct)zReturn the current protocol.rrs r get_protocolzBaseTransport.get_protocol)rrr ) __name__ __module__ __qualname____doc__ __slots__rrrrr"r$rrrr s($I .""""rrc&eZdZdZdZdZdZdZy)rz#Interface for read-only transports.r*ct)z*Return True if the transport is receiving.rrs r is_readingzReadTransport.is_reading3rrct)zPause the receiving end. No data will be passed to the protocol's data_received() method until resume_reading() is called. rrs r pause_readingzReadTransport.pause_reading7 "!rct)zResume the receiving end. Data received will once again be passed to the protocol's data_received() method. rrs rresume_readingzReadTransport.resume_reading?r0rN)r%r&r'r(r)r-r/r2r*rrrr.s-I"""rrcFeZdZdZdZd dZdZdZdZdZ d Z d Z d Z y) rz$Interface for write-only transports.r*Nct)aSet the high- and low-water limits for write flow control. These two values control when to call the protocol's pause_writing() and resume_writing() methods. If specified, the low-water limit must be less than or equal to the high-water limit. Neither value can be negative. The defaults are implementation-specific. If only the high-water limit is given, the low-water limit defaults to an implementation-specific value less than or equal to the high-water limit. Setting high to zero forces low to zero as well, and causes pause_writing() to be called whenever the buffer becomes non-empty. Setting low to zero causes resume_writing() to be called only once the buffer is empty. Use of zero for either limit is generally sub-optimal as it reduces opportunities for doing I/O and computation concurrently. rr highlows rset_write_buffer_limitsz&WriteTransport.set_write_buffer_limitsMs &"!rct)z,Return the current size of the write buffer.rrs rget_write_buffer_sizez$WriteTransport.get_write_buffer_sizebrrct)zGet the high and low watermarks for write flow control. Return a tuple (low, high) where low and high are positive number of bytes.rrs rget_write_buffer_limitsz&WriteTransport.get_write_buffer_limitsfs "!rct)zWrite some data bytes to the transport. This does not block; it buffers the data and arranges for it to be sent out asynchronously. r)r datas rwritezWriteTransport.writelr0rcHdj|}|j|y)zWrite a list (or any iterable) of data bytes to the transport. The default implementation concatenates the arguments and calls write() on the result. rN)joinr?)r list_of_datar>s r writelineszWriteTransport.writelinests xx % 4rct)zClose the write end after flushing buffered data. (This is like typing ^D into a UNIX program reading from stdin.) Data may still be received. rrs r write_eofzWriteTransport.write_eof} "!rct)zAReturn True if this transport supports write_eof(), False if not.rrs r can_write_eofzWriteTransport.can_write_eofrrctzClose the transport immediately. Buffered data will be lost. No more data will be received. The protocol's connection_lost() method will (eventually) be called with None as its argument. rrs rabortzWriteTransport.abortrFrNN) r%r&r'r(r)r8r:r<r?rCrErHrKr*rrrrHs2.I"*"" """"rrceZdZdZdZy)raSInterface representing a bidirectional transport. There may be several implementations, but typically, the user does not implement new transports; rather, the platform provides some useful transports that are implemented using the platform's best practices. The user never instantiates a transport directly; they call a utility function, passing it a protocol factory and other information necessary to create the transport and protocol. (E.g. EventLoop.create_connection() or EventLoop.create_server().) The utility function will asynchronously create a transport and a protocol and hook them up by calling the protocol's connection_made() method, passing it the transport. The implementation here raises NotImplemented for every method except writelines(), which calls write() in a loop. r*N)r%r&r'r(r)r*rrrrs(Irrc"eZdZdZdZddZdZy)rz(Interface for datagram (UDP) transports.r*Nct)aSend data to the transport. This does not block; it buffers the data and arranges for it to be sent out asynchronously. addr is target socket address. If addr is None use target address pointed on transport creation. r)r r>addrs rsendtozDatagramTransport.sendtorrctrJrrs rrKzDatagramTransport.abortrFrr )r%r&r'r(r)rQrKr*rrrrs2I""rrc4eZdZdZdZdZdZdZdZdZ y) rr*ct)zGet subprocess id.rrs rget_pidzSubprocessTransport.get_pidrrct)zGet subprocess returncode. See also http://docs.python.org/3/library/subprocess#subprocess.Popen.returncode rrs rget_returncodez"SubprocessTransport.get_returncoder0rct)z&Get transport for pipe with number fd.r)r fds rget_pipe_transportz&SubprocessTransport.get_pipe_transportrrct)zSend signal to subprocess. See also: docs.python.org/3/library/subprocess#subprocess.Popen.send_signal r)r signals r send_signalzSubprocessTransport.send_signalr0rct)aLStop the subprocess. Alias for close() method. On Posix OSs the method sends SIGTERM to the subprocess. On Windows the Win32 API function TerminateProcess() is called to stop the subprocess. See also: http://docs.python.org/3/library/subprocess#subprocess.Popen.terminate rrs r terminatezSubprocessTransport.terminates "!rct)zKill the subprocess. On Posix OSs the function sends SIGKILL to the subprocess. On Windows kill() is an alias for terminate(). See also: http://docs.python.org/3/library/subprocess#subprocess.Popen.kill rrs rkillzSubprocessTransport.kills "!rN) r%r&r'r)rUrWrZr]r_rar*rrrrs%I"""" " "rrcPeZdZdZdZd fd ZdZdZdZd dZ d dZ d Z xZ S) _FlowControlMixinavAll the logic for (write) flow control in a mix-in base class. The subclass must implement get_write_buffer_size(). It must call _maybe_pause_protocol() whenever the write buffer size increases, and _maybe_resume_protocol() whenever it decreases. It may also override set_write_buffer_limits() (e.g. to specify different defaults). The subclass constructor must call super().__init__(extra). This will call set_write_buffer_limits(). The user may call set_write_buffer_limits() and get_write_buffer_size(), and their protocol's pause_writing() and resume_writing() may be called. )_loop_protocol_paused _high_water _low_watercht|||J||_d|_|j y)NF)superrrdre_set_write_buffer_limits)r rloop __class__s rrz_FlowControlMixin.__init__s7  % %%'rc@|j}||jkry|js#d|_ |jj yy#t t f$rt$r4}|jjd|||jdYd}~yd}~wwxYw)NTzprotocol.pause_writing() failedmessage exception transportr!) r:rfre _protocol pause_writing SystemExitKeyboardInterrupt BaseExceptionrdcall_exception_handler)r sizeexcs r_maybe_pause_protocolz'_FlowControlMixin._maybe_pause_protocols))+ 4## # $$$(D ! ,,.% 12    11@!$!% $ 3 sAB)*BBc<|jrA|j|jkr#d|_ |jj yyy#t t f$rt$r4}|jjd|||jdYd}~yd}~wwxYw)NFz protocol.resume_writing() failedrn) rer:rgrrresume_writingrtrurvrdrw)r rys r_maybe_resume_protocolz(_FlowControlMixin._maybe_resume_protocol's  ! !**,?$)D ! --/@ "  12    11A!$!% $ 3 sAB'*BBc2|j|jfSr )rgrfrs rr<z)_FlowControlMixin.get_write_buffer_limits7s!1!122rc| |d}nd|z}||dz}||cxk\rdk\sntd|d|d||_||_y)Nizhigh (z) must be >= low (z) must be >= 0) ValueErrorrfrgr5s rrjz*_FlowControlMixin._set_write_buffer_limits:sh <{ 3w ;!)Csa 23'HJ J rcJ|j|||jy)N)r6r7)rjrzr5s rr8z)_FlowControlMixin.set_write_buffer_limitsJs! %%4S%9 ""$rctr rrs rr:z'_FlowControlMixin.get_write_buffer_sizeNs!!rrL) r%r&r'r(r)rrzr}r<rjr8r: __classcell__)rls@rrcrcs3 KI($ 3 %"rrcN) r(__all__rrrrrrrcr*rrrsj  """"J"M"4I"]I"X ~0" "23"-3"lT" T"r__pycache__/trsock.cpython-312.pyc000064400000011731152527367570013012 0ustar00 {|j  ddlZGddZy)NceZdZdZdZdej fdZedZedZ edZ dZ d Z d Z d Zd Zd ZdZdZdZdZdZdZdZdZy)TransportSocketzA socket-like wrapper for exposing real transport sockets. These objects can be safely returned by APIs like `transport.get_extra_info('socket')`. All potentially disruptive operations (like "socket.close()") are banned. _socksockc||_yNr)selfrs '/usr/lib64/python3.12/asyncio/trsock.py__init__zTransportSocket.__init__s  c.|jjSr )rfamilyr s r rzTransportSocket.familyszz   r c.|jjSr )rtypers r rzTransportSocket.typeszzr c.|jjSr )rprotors r rzTransportSocket.protoszzr crd|jd|jd|jd|j}|jdk7r4 |j }|r|d|} |j}|r|d|}|dS#t j $rY4wxYw#t j $rY3wxYw) Nz)filenorrr getsocknamesocketerror getpeername)r sladdrraddrs r __repr__zTransportSocket.__repr__s*4;;=/:kk_GDII=9ZZL " ;;=B  ((*#XeW-A ((*#XeW-AAw<<   <<  s$B)B BB B65B6ctd)Nz/Cannot serialize asyncio.TransportSocket object) TypeErrorrs r __getstate__zTransportSocket.__getstate__5sIJJr c6|jjSr )rrrs r rzTransportSocket.fileno8szz  ""r c6|jjSr )rduprs r r&zTransportSocket.dup;szz~~r c6|jjSr )rget_inheritablers r r(zTransportSocket.get_inheritable>szz))++r c:|jj|yr )rshutdown)r hows r r*zTransportSocket.shutdownAs C r c:|jj|i|Sr )r getsockoptr argskwargss r r-zTransportSocket.getsockoptFs$tzz$$d5f55r c<|jj|i|yr )r setsockoptr.s r r2zTransportSocket.setsockoptIs t.v.r c6|jjSr )rrrs r rzTransportSocket.getpeernameLzz%%''r c6|jjSr )rrrs r rzTransportSocket.getsocknameOr4r c6|jjSr )r getsockbynamers r r7zTransportSocket.getsockbynameRszz''))r c$|dk(rytd)Nrzr r rrsIV]]!!  .K# ,! 6/((*L Cr r)rrr>r r rIs ^C^Cr __pycache__/futures.cpython-312.opt-2.pyc000064400000032401152527367570014137 0ustar00 {|j8h dZddlZddlZddlZddlZddlmZddlm Z ddlm Z ddlm Z ddlm Z e jZ e jZe jZe j Zej"dz ZGd d ZeZd Zd Zd ZdZdZdZdddZ ddlZej&xZZy#e$rYywxYw))Future wrap_futureisfutureN) GenericAlias) base_futures)events) exceptions)format_helpersceZdZ eZdZdZdZdZdZ dZ dZ dZ dddZ dZdZeeZedZej*dZd Zd Zdd Zd Zd ZdZdZdZdddZdZdZ dZ!dZ"e"Z#y)rNFloopc |tj|_n||_g|_|jj r.t j tjd|_ yy)Nr) r get_event_loop_loop _callbacks get_debugr extract_stacksys _getframe_source_tracebackselfrs (/usr/lib64/python3.12/asyncio/futures.py__init__zFuture.__init__Hs` <..0DJDJ ::   !%3%A%A a &"D " "c,tj|SN)r _future_reprrs r__repr__zFuture.__repr__Xs((..rc|jsy|j}|jjd||d}|jr|j|d<|j j |y)Nz exception was never retrieved)message exceptionfuturesource_traceback)_Future__log_traceback _exception __class____name__rrcall_exception_handler)rexccontexts r__del__zFuture.__del__[sl## oo>>**++IJ    ! !*.*@*@G& ' ))'2rc|jSr)r'r s r_log_tracebackzFuture._log_tracebackms###rc,|r tdd|_y)Nz'_log_traceback can only be set to FalseF) ValueErrorr')rvals rr0zFuture._log_tracebackqs FG G$rc: |j}| td|S)Nz!Future object is not initialized.)r RuntimeErrorrs rget_loopzFuture.get_loopws$;zz <BC C rc |j|j}d|_|S|jtj}ntj|j}|j|_d|_|Sr)_cancelled_exc_cancel_messager CancelledError __context__)rr,s r_make_cancelled_errorzFuture._make_cancelled_error~sw    *%%C"&D J    '++-C++D,@,@AC--" rc d|_|jtk7ryt|_||_|j y)NFT)r'_state_PENDING _CANCELLEDr9_Future__schedule_callbacks)rmsgs rcancelz Future.cancels> % ;;( "  " !!#rc |jdd}|syg|jdd|D]#\}}|jj|||%yNr-)rr call_soon)r callbackscallbackctxs r__schedule_callbackszFuture.__schedule_callbackssR OOA&  &MHc JJ 4 ='rc* |jtk(Sr)r>r@r s r cancelledzFuture.cancelleds6{{j((rc* |jtk7Sr)r>r?r s rdonez Future.dones {{h&&rc" |jtk(r|j|jtk7rt j dd|_|j%|jj|j|jS)NzResult is not ready.F) r>r@r< _FINISHEDr InvalidStateErrorr'r(with_traceback _exception_tb_resultr s rresultz Future.resultsy ;;* $,,. . ;;) #../EF F$ ?? &//001C1CD D||rc |jtk(r|j|jtk7rt j dd|_|jS)NzException is not set.F)r>r@r<rQr rRr'r(r s rr$zFuture.exceptionsT  ;;* $,,. . ;;) #../FG G$rrFc |jtk7r|jj|||y|t j }|j j||fyrE)r>r?rrG contextvars copy_contextrappend)rfnr-s radd_done_callbackzFuture.add_done_callbacksW ;;( " JJ T7 ;%224 OO " "B= 1rc |jDcgc]\}}||k7r||f}}}t|jt|z }|r||jdd|Scc}}wr)rlen)rr\frJfiltered_callbacks removed_counts rremove_done_callbackzFuture.remove_done_callbackss /3oo*.=(1c!"b !#h.= *DOO,s3E/FF !3DOOA  *sAc |jtk7r$tj|jd|||_t |_|j y)N: )r>r?r rRrUrQrA)rrVs r set_resultzFuture.set_resultsO ;;( "..$++b/IJ J   !!#rcl |jtk7r$tj|jd|t |t r|}t |t rtd}||_||_ |}||_ |j|_ t|_|jd|_y)NrezPStopIteration interacts badly with generators and cannot be raised into a FutureT)r>r?r rR isinstancetype StopIterationr5 __cause__r;r( __traceback__rTrQrAr')rr$new_excs r set_exceptionzFuture.set_exceptions ;;( "..$++b/IJ J i &! I i /"$,-G!*G "+G I#&44  !!##rc#K|js d|_||js td|jSw)NTzawait wasn't used with future)rO_asyncio_future_blockingr5rVr s r __await__zFuture.__await__s=yy{,0D )Jyy{>? ?{{}sAA r)$r* __module__ __qualname__r?r>rUr(rrr9r8rpr'rr!r. classmethodr__class_getitem__propertyr0setterr6r<rCrArMrOrVr$r]rcrfrnrq__iter__rrrrs&FGJ EON %O#" /3 $L1 $$%% (  >) ' 04 2  $$.Hrrc^ |j}|S#t$rY|jSwxYwr)r6AttributeErrorr)futr6s r _get_loopr}-s:<<z    99  s  ,,cJ |jry|j|yr)rMrf)r|rVs r_set_result_unless_cancelledr9sI }}NN6rclt|}|tjjurt j|j S|tjj urt j |j S|tjjurt j|j S|Sr)ri concurrentfuturesr:r args TimeoutErrorrR)r, exc_classs r_convert_future_excr@sS IJ&&555((#((33 j((55 5&&11 j((:: :++SXX66 rc  |jr|j|jsy|j}||jt |y|j }|j|yr)rMrCset_running_or_notify_cancelr$rnrrVrf)rsourcer$rVs r_set_concurrent_future_staterLsuB   2: 2 2 4  "I   !4Y!?@ f%rc |jry|jr|jy|j}||jt |y|j }|j |yr)rMrCr$rnrrVrf)rdestr$rVs r_copy_future_stater[sj  ~~  $$&    29= >]]_F OOF #rc ts/ttjjs t dts/ttjjs t dtr t ndtr t nddfd}fd}j|j|y)Nz(A future is required for source argumentz-A future is required for destination argumentcLt|r t||yt||yr)rrr)r%others r _set_statez!_chain_future.._set_states F  uf - ( 7rc|jr3urjyjjyyr)rMrCcall_soon_threadsafe) destination dest_loopr source_loops r_call_check_cancelz)_chain_future.._call_check_cancels<  ""kY&> 00? #rcjrjryur |yjryj|yr)rM is_closedr)rrrrrs r_call_set_statez&_chain_future.._call_set_states[  ! ! #%)*=*=*?    [ 8 {F +""$  * *:{F Kr)rrhrrr TypeErrorr}r])rrrrrrrs`` @@@r _chain_futureros F Jv/9/A/A/H/H%JBCC K K4>4F4F4M4M*OGHH'/'7)F#TK*2;*? +&TI8 @ L!!"45 _-rr c t|r|S|tj}|j}t |||Sr)rr r create_futurer)r%r new_futures rrrsE0  |$$&##%J&*% r)__all__concurrent.futuresrrYloggingrtypesrrr r r rr?r@rQDEBUG STACK_DEBUGr _PyFuturer}rrrrrr_asyncio_CFuture ImportErrorryrrrs4        $ $  " " mma HHX     &$().X!% ( !'FX   sB))B10B1__pycache__/taskgroups.cpython-312.opt-1.pyc000064400000020233152527367570014643 0ustar00 {|jW%@dZddlmZddlmZddlmZGddZy)) TaskGroup)events) exceptions)taskscXeZdZdZdZdZdZdZdZdddd Z d e d e fd Z d Z dZy)ra9Asynchronous context manager for managing groups of tasks. Example use: async with asyncio.TaskGroup() as group: task1 = group.create_task(some_coroutine(...)) task2 = group.create_task(other_coroutine(...)) print("Both tasks have completed now.") All tasks are awaited when the context manager exits. Any exceptions other than `asyncio.CancelledError` raised within a task will cancel all remaining tasks and wait for them to exit. The exceptions are then combined and raised as an `ExceptionGroup`. cd|_d|_d|_d|_d|_d|_t |_g|_d|_ d|_ y)NF) _entered_exiting _aborting_loop _parent_task_parent_cancel_requestedset_tasks_errors _base_error_on_completed_futselfs +/usr/lib64/python3.12/asyncio/taskgroups.py__init__zTaskGroup.__init__sN    (-%e  !%cxdg}|jr'|jdt|j|jr'|jdt|j|jr|jdn|j r|jddj |}d|dS) Nztasks=zerrors= cancellingentered z )rappendlenrr r join)rinfoinfo_strs r__repr__zTaskGroup.__repr__(st ;; KK&T[[!1 23 4 << KK'#dll"3!45 6 >> KK % ]] KK "88D>H:Q''rcK|jrtd|d|jtj|_t j |j|_|jtd|dd|_|Sw)N TaskGroup z has already been enteredz! cannot determine the parent taskT)r RuntimeErrorr rget_running_loopr current_taskr rs r __aenter__zTaskGroup.__aenter__6s ==TH$=>@ @ :: 002DJ!..tzz:    $TH$EFH H  sB B cKd} |j||d{d|_d|_d|_d}S7#d|_d|_d|_d}wxYwwN)_aexitr rr)retexctbs r __aexit__zTaskGroup.__aexit__Dsc  R-- !%D DL#D C. !%D DL#D Cs%A979A9AAcKd|_|$|j|r|j||_|tjur|nd}|j r|j jdk(rd}||js|j|jrT|j|jj|_ |jd{d|_ |jrT|j |j |r|js |d}|-|tjur|jj||jr t!d|jdy7#tj$r(}|js|}|jYd}~d}~wwxYw#d}wxYw#d}wxYw#d}wxYw#d}wxYww)NTzunhandled errors in a TaskGroup)r _is_base_errorrrCancelledErrorrr uncancelr _abortrrr create_futurerrBaseExceptionGroup)rr.r/propagate_cancellation_errorexs rr-zTaskGroup._aexitRs O##C(  ("D 222C %  ( (  ))+q004, >>> kk%%-)-)A)A)C& ",,,,&*D "'kk.    ' &&&  0+DLL66,0 ( >b (A(AA LL   $ << (5LL M-,, "~~460KKM "*C+/ (sCG E2E0E2G / G < F0 F>F7=G G/G 0E22F-F(#G (F--G 0F44G 7F;;F>>GG G  G N)namecontextc|jstd|d|jr|jstd|d|jrtd|d||j j |}n|j j ||}tj|||jj||j|j |~S#~wxYw)zbCreate a new task in this group and return it. Similar to `asyncio.create_task`. r&z has not been enteredz is finishedz is shutting down)r=) r r'r rr r create_taskr_set_task_nameaddadd_done_callback _on_task_done)rcoror<r=tasks rr?zTaskGroup.create_tasks }}D83HIJ J ==D8<@A A >>D83DEF F ?::))$/D::))$)@D T4(  t112 s &C))C,r/returnc.t|ttfSr,) isinstance SystemExitKeyboardInterrupt)rr/s rr4zTaskGroup._is_base_errors# ,=>??rcvd|_|jD]#}|jr|j%y)NT)r rdonecancel)rts rr7zTaskGroup._aborts)A668 rc|jj||jA|js5|jjs|jj d|j ry|j }|y|jj||j|r|j||_ |jjr1|jjd|d|jd||dy|js?|js2|j!d|_|jj#yyy)NTzTask z% has errored out but its parent task z is already completed)message exceptionrE)rdiscardrrL set_result cancelledrQrrr4rr r call_exception_handlerr rr7rM)rrEr/s rrCzTaskGroup._on_task_dones3 D!  ! ! -dkk))..0&&11$7 >>  nn ;  C   s #(8(8(@"D     ! ! # JJ - -"4(+##'#4#4"55JL  /  ~~d&C&C& KKM,0D )    $ $ &+'D~r)__name__ __module__ __qualname____doc__rr$r*r1r-r? BaseExceptionboolr4r7rCrrrr sO & (  Wt)-dF@-@D@2'rrN)__all__rrrrrr\rrr^s! @'@'r__pycache__/windows_events.cpython-312.opt-2.pyc000064400000116736152527367570015536 0ustar00 {|jK ddlZejdk7redddlZddlZddlZddlmZddlZddl Z ddl Z ddl Z ddl Z ddl Z ddlmZddlmZddlmZdd lmZdd lmZdd lmZdd lmZdd lmZddlmZdZej4Zej6ZdZdZdZdZGddej@Z!Gddej@Z"Gdde"Z#Gdde"Z$Gdde%Z&GddejNZ(Gd d!ejRZ*Gd"d#Z+Gd$d%ejXZ-e(Z.Gd&d'ej^Z0Gd(d)ej^Z1e1Z2y)*Nwin32z win32 only)partial)events)base_subprocess)futures) exceptions)proactor_events)selector_events)tasks) windows_utils)logger)SelectorEventLoopProactorEventLoop IocpProactorDefaultEventLoopPolicyWindowsSelectorEventLoopPolicyWindowsProactorEventLoopPolicyiigMbP?g?cVeZdZ ddfd ZfdZdZd fd ZfdZfdZxZ S) _OverlappedFutureNloopcft|||jr |jd=||_yNr)super__init___source_traceback_ov)selfovr __class__s //usr/lib64/python3.12/asyncio/windows_events.pyrz_OverlappedFuture.__init__7s1 d#  ! !&&r*ct|}|jH|jjrdnd}|j dd|d|jj dd|S)Npending completedrz overlapped=)r _repr_inforr&insertaddressr infostater"s r#r*z_OverlappedFuture._repr_info=s\w!# 88 !%!1!1I{E KK\%4883C3CB2GqI J r$c|jy |jjd|_y#t$rM}d||d}|jr|j|d<|jj |Yd}~d|_yd}~wwxYw)Nz&Cancelling an overlapped future failedmessage exceptionfuturesource_traceback)rcancelOSErrorr_loopcall_exception_handler)r exccontexts r#_cancel_overlappedz$_OverlappedFuture._cancel_overlappedDs 88   7 HHOO  7C G %%.2.D.D*+ JJ - -g 6 6 7s1 B r$cd|_yrB)r)r futs r#_unregister_wait_cbz)_BaseWaitHandleFuture._unregister_wait_cbs r$c|jsyd|_|j}d|_ tj||jdy#t$rh}|j tj k7rAd||d}|jr|j|d<|jj|Yd}~yYd}~~d}~wwxYwNFz$Failed to unregister the wait handler1r5) rSrR _overlappedUnregisterWaitr7winerrorERROR_IO_PENDINGrr8r9rcr rUr:r;s r#_unregister_waitz&_BaseWaitHandleFuture._unregister_waits  ''     & &{ 3   & ||{;;;E!$" ))262H2HG./ 11':< sA CAB<<CcD|jt| |Sr>)rkrr6r@s r#r6z_BaseWaitHandleFuture.cancels  w~#~&&r$cD|jt| |yrB)rkrrCrDs r#rCz#_BaseWaitHandleFuture.set_exceptions  i(r$cD|jt| |yrB)rkrrFrGs r#rFz _BaseWaitHandleFuture.set_results  6"r$rB) rIrJrKrr\r*rcrkr6rCrFrLrMs@r#rOrOas6<8<  '  '0')##r$rOc@eZdZ ddfd ZdZfdZfdZxZS)_WaitCancelFutureNrc:t|||||d|_y)Nr)rr_done_callback)r r!eventrUrr"s r#rz_WaitCancelFuture.__init__s! UKd;"r$ctd)Nz'_WaitCancelFuture must not be cancelled) RuntimeErrorr[s r#r6z_WaitCancelFuture.cancelsDEEr$c`t|||j|j|yyrB)rrFrrrGs r#rFz_WaitCancelFuture.set_results/ 6"    *    % +r$c`t|||j|j|yyrB)rrCrrrDs r#rCz_WaitCancelFuture.set_exceptions/ i(    *    % +r$)rIrJrKrr6rFrCrLrMs@r#rprps'8<# F& &&r$rpc4eZdZddfd ZfdZdZxZS)_WaitHandleFutureNrct|||||||_d|_t j dddd|_d|_y)NrTF)rr _proactor_unregister_proactorrf CreateEvent_event _event_fut)r r!rTrUproactorrr"s r#rz_WaitHandleFuture.__init__sG V[t<!$(!!--dD%F r$c|j-tj|jd|_d|_|jj |j d|_t|!|yrB) r~rX CloseHandlerr{ _unregisterrrrc)r rbr"s r#rcz%_WaitHandleFuture._unregister_wait_cbsY ;; "    ,DK"DO ""488, #C(r$c|jsyd|_|j}d|_ tj||j|jj|j|j|_y#t $rh}|j tjk7rAd||d}|jr|j|d<|jj|Yd}~yYd}~d}~wwxYwre)rSrRrfUnregisterWaitExr~r7rhrirr8r9r{ _wait_cancelrcrrjs r#rkz"_WaitHandleFuture._unregister_waits  ''     ( (dkk B..55dkk6:6N6NP ||{;;;E!$" ))262H2HG./ 11':< s A?? C0AC++C0)rIrJrKrrcrkrLrMs@r#ryrysBF)$Pr$ryc0eZdZ dZdZdZdZdZeZy) PipeServerc||_tj|_d|_d|_|j d|_yNT)_addressweakrefWeakSet_free_instances_pipe_accept_pipe_future_server_pipe_handle)r r,s r#rzPipeServer.__init__s; &0 #' --d3 r$cL|j|jdc}|_|SNF)rr)r tmps r#_get_unconnected_pipez PipeServer._get_unconnected_pipes% **d&>&>u&ETZ r$c ,|jrytjtjz}|r|tjz}tj |j |tjtjztjztjtjtjtjtj}tj|}|j j#||SrB)closedrXPIPE_ACCESS_DUPLEXFILE_FLAG_OVERLAPPEDFILE_FLAG_FIRST_PIPE_INSTANCECreateNamedPiperPIPE_TYPE_MESSAGEPIPE_READMODE_MESSAGE PIPE_WAITPIPE_UNLIMITED_INSTANCESr BUFSIZENMPWAIT_WAIT_FOREVERNULL PipeHandleradd)r firstflagshpipes r#rzPipeServer._server_pipe_handles ;;=**W-I-II  W:: :E  # # MM5  % %(E(E E      , ,  ! !=#8#8  ( (',,  8''*   & r$c|jduSrB)rr[s r#rzPipeServer.closed s %&r$c |j!|jjd|_|jJ|jD]}|j d|_d|_|jj yyrB)rr6rrcloserclear)r rs r#rzPipeServer.close#sp  # # /  $ $ + + -'+D $ == $,, -DJ DM  & & ( %r$N) rIrJrKrrrrr__del__r$r#rrs'4$' )Gr$rc eZdZy)_WindowsSelectorEventLoopN)rIrJrKrr$r#rr2s1r$rcBeZdZ dfd ZfdZdZdZ ddZxZS)rc<| t}t| |yrB)rrr)r rr"s r#rzProactorEventLoop.__init__9s  #~H "r$c |j|jt| |ja|jj }|jj |'|js|jj|d|_yy#|ja|jj }|jj |'|js|jj|d|_wwxYwrB) call_soon_loop_self_readingr run_forever_self_reading_futurerr6r&r{r)r r!r"s r#rzProactorEventLoop.run_forever>s 1 NN422 3 G  !((4..22))002>"**NN..r2,0)5t((4..22))002>"**NN..r2,0)5s )BA/D cK|jj|}|d{}|}|j||d|i}||fS7%w)Naddrextra)r{ connect_pipe_make_duplex_pipe_transport)r protocol_factoryr,frprotocoltranss r#create_pipe_connectionz(ProactorEventLoop.create_pipe_connectionQsZ NN ' ' 0w#%00x8>7H1Jh s!A A &A cfKtdfd jgSw)NcJd} |ri|j}jj|jr|j y}j ||dij }|yjj|}|_ |jy#t$r9|r#|jdk7r|j jYyt$rz}|r9|jdk7r&jd||d|j n$j rt#j$d|djYd}~yd}~wt&j($r|r|j YyYywxYw) NrrrzPipe accept failed)r2r3rzAccept pipe failed on pipe %rT)exc_info)rHrdiscardrrrrr{ accept_piperadd_done_callbackBrokenPipeErrorfilenorr7r9_debugrwarningr CancelledError) rrrr:r,loop_accept_piperr servers r#rz>ProactorEventLoop.start_serving_pipe..loop_accept_pipe\stD) 688:D**2248}} /1H44hvw.?5A335<NN..t4*./*##$45+# 1DKKMR/JJL/0 1DKKMR///#7%( $1 JJL[[NN#B#'$8/00,, !JJL !s1A B7/B7B77?F"8F"A0E55(F"!F"rB)rr)r rr,rrs```@@r#start_serving_pipez$ProactorEventLoop.start_serving_pipeYs2G$+ 6+ 6Z '(xs*1c K|j} t||||||||f| |d| } | d{| S7#ttf$rt$r+| j | j d{7wxYww)N)waiterr) create_future_WindowsSubprocessTransport SystemExitKeyboardInterrupt BaseExceptionr_wait) r rargsshellstdinstdoutstderrbufsizerkwargsrtransps r#_make_subprocess_transportz,ProactorEventLoop._make_subprocess_transports##%,T8T5-2FFG74:%7067 LL  -.    LLN,,.  s1'A>868A>8;A;3A64A;;A>rB) rIrJrKrrrrrrLrMs@r#rr6s%<# 1&1j04r$rceZdZ efdZdZdZdZd dZdZ e dZ e d Z d!d Zd!d Zd!d Zd!d Zd"dZd!dZdZdZdZdZdZd dZdZdZdZdZdZdZd dZ dZ!dZ"dZ#y)#rcd|_g|_tjtjt d||_i|_tj|_ g|_ tj|_ yrW) r8_resultsrfCreateIoCompletionPortINVALID_HANDLE_VALUEr_iocp_cacherrrS _unregistered_stopped_serving)r concurrencys r#rzIocpProactor.__init__s_   77  , ,dA{D  "??, ' 1r$c2|j tdy)NzIocpProactor is closed)rrur[s r# _check_closedzIocpProactor._check_closeds :: 78 8 r$cdt|jzdt|jzg}|j|j dd|j j ddj|dS)Nzoverlapped#=%sz result#=%sr< r))lenrrrr`r"rIjoin)r r.s r#__repr__zIocpProactor.__repr__s_ 3t{{#33s4==113 ::  KK ! NN33SXXd^DDr$c||_yrB)r8)r rs r#set_loopzIocpProactor.set_loops  r$Ncz|js|j||j}g|_ |d}S#d}wxYwrB)rr\)r timeoutrs r#selectzIocpProactor.selects:}} JJw mm  C$Cs6:c\|jj}|j||SrB)r8rrF)r valuerbs r#_resultzIocpProactor._results%jj&&( u r$c |jS#t$rD}|jtjtj fvrt |jd}~wwxYwrB) getresultr7rhrfERROR_NETNAME_DELETEDERROR_OPERATION_ABORTEDConnectionResetErrorr)rkeyr!r:s r#finish_socket_funczIocpProactor.finish_socket_funcsY <<> ! || A A + C C EE*CHH55  s A?AAc |j|||S#t$r,}|jtjk(r |dfcYd}~Sd}~wwxYwrB)rr7rhrfERROR_PORT_UNREACHABLE)clsrrr! empty_resultr:s r#_finish_recvfromzIocpProactor._finish_recvfromsN ))%b9 9 ||{AAA#T))  s A  AA AA c|j|tjt} t |t j r"|j |j||n |j|j||j|||jS#t$r|jdcYSwxYw)Nr$) _register_with_iocprf Overlappedr isinstancesocketWSARecvrReadFilerr _registerrr connnbytesrr!s r#recvzIocpProactor.recvs   &  # #D ) %$ . 4;;=&%8 DKKM62~~b$(?(?@@ %<<$ $ %AB%%CCc|j|tjt} t |t j r"|j |j||n |j|j||j|||jS#t$r|jdcYSwxYwrW) r rfr rr r  WSARecvIntor ReadFileIntorrrrr rbufrr!s r# recv_intozIocpProactor.recv_intos   &  # #D ) #$ .t{{}c59 s3~~b$(?(?@@ #<<? " #rc*|j|tjt} |j |j |||j||t|jdS#t $r|jdcYSwxYw)N)r$Nr$r) r rfr r WSARecvFromrrrrrrrs r#recvfromzIocpProactor.recvfroms   &  # #D ) - NN4;;=&% 8~~b$0E0E=@)BC C -<< , , -!A55BBc*|j|tjt} |j |j |||j||t|jdS#t $r|jdcYSwxYw)NrNrr) r rfr rWSARecvFromIntorrrrrrrs r# recvfrom_intozIocpProactor.recvfrom_intos   &  # #D ) +   t{{}c5 9~~b$0E0E=>)@A A +<< * * +rc|j|tjt}|j |j ||||j |||jSrB)r rfr r WSASendTorrr)r rrrrr!s r#sendtozIocpProactor.sendtosQ   &  # #D ) T[[]C5~~b$(?(?@@r$cH|j|tjt}t |t j r"|j |j||n |j|j||j|||jSrB) r rfr rr r WSASendr WriteFilerrrs r#sendzIocpProactor.sendsq   &  # #D ) dFMM * JJt{{}c5 1 LL ,~~b$(?(?@@r$c||j|jjtjt }|j jjfd}d}|j||}||}tj||j|S)Nc,|jtjdj}j t j tj|jjjfS)Nz@P) rstructpackr setsockoptr  SOL_SOCKETrfSO_UPDATE_ACCEPT_CONTEXT settimeout gettimeout getpeername)rrr!rrlisteners r# finish_acceptz*IocpProactor.accept..finish_accept*sl LLN++dHOO$56C OOF--'@@# G OOH//1 2))++ +r$cvK |d{y7#tj$r|jwxYwwrB)r rr)r4rs r# accept_coroz(IocpProactor.accept..accept_coro3s2  ,,   s 99%69r) r _get_accept_socketfamilyrfr rAcceptExrrr ensure_futurer8)r r5r!r6r8r4corors ` @r#acceptzIocpProactor.accept$s   *&&x7  # #D ) HOO%t{{}5 , Hm<64( Dtzz2 r$cjtjk(rQtjj ||j j}|jd|S|j tjj jtj"t$}|j'j |fd}|j)||S#t$r?}|jtjk7rj!ddk(rYd}~d}~wwxYw)Nrrc|jjtjtj dSrW)rr/r r0rfSO_UPDATE_CONNECT_CONTEXT)rrr!rs r#finish_connectz,IocpProactor.connect..finish_connectVs1 LLN OOF--'AA1 FKr$)typer  SOCK_DGRAMrf WSAConnectrr8rrFr  BindLocalr:r7rherrno WSAEINVAL getsocknamer r ConnectExr)r rr,rber!rBs ` r#connectzIocpProactor.connect@s 99)) )  " "4;;=' :****,C NN4 J   &   ! !$++- = # #D ) T[[]G, ~~b$77! zzU__,!!$)*  s.D E  5EE c 6|j|tjt}|dz}|dz dz}|j |j t j|j |||dd|j|||jS)Nl r) r rfr r TransmitFilermsvcrt get_osfhandlerr)r sockfileoffsetcountr! offset_low offset_highs r#sendfilezIocpProactor.sendfile_s   &  # #D )k) |{2   ,,T[[];"Kq! % ~~b$(?(?@@r$c|jtjt}|j j }|r|j Sfd}|j||S)Nc(|jSrB)r)rrr!rs r#finish_accept_pipez4IocpProactor.accept_pipe..finish_accept_pipevs LLNKr$)r rfr rConnectNamedPiperrr)r rr! connectedr[s ` r#rzIocpProactor.accept_pipeksf   &  # #D )'' 6 <<% % ~~b$(:;;r$c<Kt} tj|} tj|S#t$r(}|jtj k7rYd}~nd}~wwxYwt |dzt}tj|d{7w)N) CONNECT_PIPE_INIT_DELAYrf ConnectPiper7rhERROR_PIPE_BUSYminCONNECT_PIPE_MAX_DELAYr sleepr r)r r,delayrTr:s r#rzIocpProactor.connect_pipe|s' $009''// <<;#>#>>?   #9:E++e$ $ $s6B6B A'A"B"A''.BBBc* |j||dSr)_wait_for_handle)r rTrs r#wait_for_handlezIocpProactor.wait_for_handles $$VWe<.finish_wait_for_handles779 r$r)rrXINFINITEmathceilrfr rRegisterWaitWithQueuerr,rpr8ryrr) r rTr _is_cancelmsr!rUrors @r#rhzIocpProactor._wait_for_handles  ?!!B7S=)B # #D )!77 DJJ B0 !"fk KA!"fk4'+zz3A  ##B' $%b!-C"D BJJr$c||jvrL|jj|tj|j |j ddyyrW)rSrrfrrrr objs r#r z IocpProactor._register_with_iocpsI d&& &     %  . .szz|TZZA N 'r$c^|jt||j}|jr |jd=|js |dd|}|j |||||f|j|j<|S#t $r}|j|Yd}~>d}~wwxYwr) rrr8rr&rFr7rCrr,)r r!rxcallbackrrrKs r#rzIocpProactor._registers  btzz 2  ##B'zz  $ tR0 U#$%b#x"8 BJJ #"" #s B B,B''B,c\ |j|jj|yrB)rrr`)r r!s r#rzIocpProactor._unregisters)  !!"%r$cRtj|}|jd|SrW)r r2)r r:ss r#r9zIocpProactor._get_accept_sockets MM& ! Qr$c "|t}n<|dkr tdtj|dz}|tk\r td t j |j |}|nd}|\}}}} |jj|\}} } } | |j vr|j#nI|j%s9 | ||| } |j'| |j(j+|d}|j0D](} |jj| j2d*|j0j5y#t$rl|jjr%|jjdd||||fzd|dtjfvrtj|Y}wxYw#t,$r7} |j/| |j(j+|Yd} ~ d} ~ wwxYw#d}wxYw)Nrznegative timeoutrmztimeout too bigz8GetQueuedCompletionStatus() returned an unexpected eventz)err=%s transferred=%s key=%#x address=%#x)r2status)rp ValueErrorrqrrrfGetQueuedCompletionStatusrrpopKeyErrorr8 get_debugr9rrXrrr6donerFrr`r7rCrr,r)r rrurerr transferredrr,rr!rxrzrrKs r#r\zIocpProactor._polls ?B q[/0 07S=)BX~ !233 ::4::rJF~B-3 *Cc7 '+{{w'?$2sH d+++ VVX $[#r:E LL'MM((+AMR$$B KKOOBJJ -%   "E ::'')JJ55%7#N&);W%E$F7q+"B"BCC'', ,,OOA&MM((++,AsC4 E G,H A1GG H,H<H HH Hc:|jj|yrB)rrrws r# _stop_servingzIocpProactor._stop_serving2s !!#&r$c4|jyt|jjD]:\}}}}|j rt |t r* |j<d}tj}||z} |jrx| tjkrCtjd|tj|z tj|z} |j!||jrxg|_t%j&|jd|_y#t$rS}|j>++ K!4>>#3j#@B>>+j8 JJz "kk DJJ' ; Czz-'C),&)# 00:=:O:OG$67 99'B CsD;; FAFFc$|jyrB)rr[s r#rzIocpProactor.__del__gs  r$rB)rr!)$rIrJrKrprrrrrr staticmethodr classmethodrrrrr#r&r*r>rLrXrrrirrhr rrr9r\rrrrr$r#rrs-#+29E     A A C AAA88> A<"0&= DO@& 7#r' -^r$rceZdZdZy)rc tj|f|||||d|_fd}jjj t jj} | j|y)N)rrrrrc\jj}j|yrB)_procpoll_process_exited)r returncoder s r#rzz4_WindowsSubprocessTransport._start..callbackrs!*J   ,r$) r Popenrr8r{riintrQr) r rrrrrrrrzrs ` r#_startz"_WindowsSubprocessTransport._startmso"(( 'U6&'%'  - JJ 0 0TZZ5G5G1H I H%r$N)rIrJrKrrr$r#rrks &r$rceZdZeZy)rN)rIrJrKr _loop_factoryrr$r#rr}%Mr$rceZdZeZy)rN)rIrJrKrrrr$r#rrrr$r)3sysplatform ImportErrorrfrXrG functoolsrrqrPr r-rrrrrr r r r r logr__all__rrpERROR_CONNECTION_REFUSEDERROR_CONNECTION_ABORTEDr`rdFuturerrOrpryobjectrBaseSelectorEventLooprBaseProactorEventLooprrBaseSubprocessTransportrrBaseDefaultEventLoopPolicyrrrrr$r#rs\4 <<7 l ##   ||    --`G#GNNG#T&-&01P-1Ph88v2 E E2g==gTHHV &/"I"I &.&V%F%F&&V%F%F&8r$__pycache__/base_events.cpython-312.pyc000064400000251334152527367570014010 0ustar00 {|j26dZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl Z ddl Z ddlZddlZddlZddlZ ddlZddlmZddlmZddlmZddlmZddlmZdd lmZdd lmZdd lmZdd lmZdd lmZddlmZddlm Z ddl!m"Z"dZ#dZ$dZ%e&e dZ'dZ(dZ)dZ*dZ+d&dZ,d'dZ-dZ.e&e drdZ/ndZ/dZ0Gd d!ejbZ2Gd"d#ejfZ4Gd$d%ejjZ6y#e$rdZYwxYw)(aBase implementation of event loop. The event loop can be broken up into a multiplexer (the part responsible for notifying us of I/O events) and the event loop proper, which wraps a multiplexer with functionality for scheduling callbacks, immediately or at a given time in the future. Whenever a public API takes a callback, subsequent positional arguments will be passed to the callback if/when it is called. This avoids the proliferation of trivial lambdas implementing closures. Keyword arguments for the callback are not supported; this is a conscious design decision, leaving the door open for keyword arguments to modify the meaning of the API call itself. N) constants) coroutines)events) exceptions)futures) protocols)sslproto) staggered)tasks)timeouts) transports)trsock)logger) BaseEventLoopServerdg?AF_INET6iQc|j}tt|ddtjrt |j St|S)N__self__) _callback isinstancegetattrr Taskreprrstr)handlecbs ,/usr/lib64/python3.12/asyncio/base_events.py_format_handler Gs=   B'"j$/<BKK  6{ch|tjk(ry|tjk(ryt|S)Nzz) subprocessPIPESTDOUTr)fds r _format_piper'Ps+ Z__ z  Bxr!cttds td |jtjtj dy#t $r tdwxYw)N SO_REUSEPORTz)reuse_port not supported by socket modulerzTreuse_port not supported by socket module, SO_REUSEPORT defined but not implemented.)hasattrsocket ValueError setsockopt SOL_SOCKETr)OSErrorsocks r_set_reuseportr2Ys` 6> *DEE J OOF--v/B/BA F JIJ J Js /A A"c Pttdsy|dtjtjhvs|y|tjk(rtj}n%|tj k(rtj}ny|d}n,>?? L v!!!"" "" """ | D% TS[ D# 42: t9D!!!~~  JJv 'h${{6" d{    R &R6??24T47,KKK4T4L88 ;:&  2   s*7 F;9F7FFF F%$F%ctj}|D]$}|d}||vrg||<||j|&t|j }g}|dkDr%|j |dd|dz |dd|dz =|j dt jjt j|D|S)z-Interleave list of addrinfo tuples by family.rrNc3$K|]}|| ywN).0as r z(_interleave_addrinfos..s! a ]  s) collections OrderedDictrBlistvaluesextend itertoolschain from_iterable zip_longest) addrinfosfirst_address_family_countaddrinfos_by_familyaddrrFaddrinfos_lists reordereds r_interleave_addrinfosrds&113a , ,*,  'F#**40  .5578OI!A%+,K-G!-KLM A > :Q >> ? ??00  ! !? 3  r!c|js'|j}t|ttfryt j |jyrP) cancelled exceptionr SystemExitKeyboardInterruptr _get_loopstop)futexcs r_run_until_complete_cbrnsB ==?mmo cJ(9: ;  c!r! TCP_NODELAYc4|jtjtjhvrl|jtj k(rN|j tjk(r0|jtjtjdyyyyNr) rFr+r@rrGr:rHr8r-ror0s r _set_nodelayrrsj KKFNNFOO< < V/// f000 OOF..0B0BA F10 =r!cyrPrQr0s rrrrrs r!c\t&t|tjr tdyy)Nz"Socket cannot be of type SSLSocket)sslr SSLSocketr>r0s r_check_ssl_socketrws' :dCMM:<==;r!cBeZdZdZdZdZdZdZdZdZ dZ d Z y ) _SendfileFallbackProtocolct|tjs td||_|j |_|j|_|j|_ |j|j||jr*|jjj|_yd|_y)Nz.transport should be _FlowControlMixin instance)rr_FlowControlMixinr> _transport get_protocol_proto is_reading_should_resume_reading_protocol_paused_should_resume_writing pause_reading set_protocol_loop create_future_write_ready_fut)selftransps r__init__z"_SendfileFallbackProtocol.__init__s&*">">?LM M ))+ &,&7&7&9#&,&=&=#D!  & &$(OO$9$9$G$G$ID !$(D !r!cK|jjr td|j}|y|d{y7w)NzConnection closed by peer)r| is_closingConnectionErrorr)rrls rdrainz_SendfileFallbackProtocol.drains< ?? % % '!"=> >## ;  s:AAActd)Nz?Invalid state: connection should have been established already. RuntimeError)r transports rconnection_madez)_SendfileFallbackProtocol.connection_madesNO Or!c|jB|%|jjtdn|jj||jj |y)NzConnection is closed by peer)r set_exceptionrr~connection_lost)rrms rrz)_SendfileFallbackProtocol.connection_losts[  ,{%%33#$BCE%%33C8 ##C(r!cp|jy|jjj|_yrP)rr|rrrs r pause_writingz'_SendfileFallbackProtocol.pause_writings,  ,  $ 5 5 C C Er!cb|jy|jjdd|_y)NF)r set_resultrs rresume_writingz(_SendfileFallbackProtocol.resume_writings-  (  ((/ $r!ctdNz'Invalid state: reading should be pausedr)rdatas r data_receivedz'_SendfileFallbackProtocol.data_receivedDEEr!ctdrrrs r eof_receivedz&_SendfileFallbackProtocol.eof_receivedrr!c<K|jj|j|jr|jj |j |j j |jr|jjyywrP) r|rr~rresume_readingrcancelrrrs rrestorez!_SendfileFallbackProtocol.restoress $$T[[1  & & OO * * ,  ,  ! ! ( ( *  & & KK & & ( 'sBBN) __name__ __module__ __qualname__rrrrrrrrrrQr!rryrys3 )O )F % FF )r!rycheZdZ ddZdZdZdZdZdZdZ d Z e d Z d Z d Zd ZdZy)rNc||_||_d|_g|_||_||_||_||_||_d|_ d|_ y)NrF) r_sockets _active_count_waiters_protocol_factory_backlog _ssl_context_ssl_handshake_timeout_ssl_shutdown_timeout_serving_serving_forever_fut)rloopsocketsprotocol_factory ssl_contextbacklogssl_handshake_timeoutssl_shutdown_timeouts rrzServer.__init__sU   !1 '&;#%9" $(!r!cPd|jjd|jdS)N) __class__rrrs r__repr__zServer.__repr__#s'4>>**+9T\\4DAFFr!cJ|jJ|xjdz c_yrq)rrrs r_attachzServer._attach&s#}}((( ar!c|jdkDsJ|xjdzc_|jdk(r|j|jyyy)Nrr)rr_wakeuprs r_detachzServer._detach*sO!!A%%% a    "t}}'< LLN(= "r!c||j}d|_|D]$}|jr|jd&yrP)rdoner)rwaiterswaiters rrzServer._wakeup0s3-- F;;=!!$'r!c *|jryd|_|jD]p}|j|j|jj |j ||j||j|j|jry)NT) rrlistenrr_start_servingrrrr)rr1s rrzServer._start_serving7sp ==  MMD KK & JJ % %&&d.?.?dmmT%@%@** ,"r!c|jSrP)rrs rget_loopzServer.get_loopBs zzr!c|jSrP)rrs r is_servingzServer.is_servingEs }}r!cT|jytd|jDS)NrQc3FK|]}tj|ywrP)rTransportSocket)rRss rrTz!Server.sockets..LsF 1V++A. s!)rtuplers rrzServer.socketsHs$ == F FFFr!cP|j}|yd|_|D]}|jj|d|_|j;|jj s!|jj d|_|jdk(r|jyy)NFr) rr _stop_servingrrrrrr)rrr1s rclosez Server.closeNs-- ?  D JJ $ $T *  % % 1--224  % % , , .(,D %    " LLN #r!cjK|jtjdd{y7w)Nr)rr sleeprs r start_servingzServer.start_servingas% kk!ns )313cK|jtd|d|jtd|d|j|jj |_ |jd{ d|_y7 #t j$r1 |j|jd{7#xYwwxYw#d|_wxYww)Nzserver z, is already being awaited on serve_forever()z is closed) rrrrrrrCancelledErrorr wait_closedrs r serve_foreverzServer.serve_forevergs  $ $ 0$!MNP P ==  ;< < $(JJ$<$<$>! -++ + +)-D % ,((   &&(((  )-D %s`A&C)B8B9B>CBC #C?CCC CC  C CCcK|jy|jj}|jj||d{y7w)aWait until server is closed and all connections are dropped. - If the server is not closed, wait. - If it is closed, but there are still active connections, wait. Anyone waiting here will be unblocked once both conditions (server is closed and all connections have been dropped) have become true, in either order. Historical note: In 3.11 and before, this was broken, returning immediately if the server was already closed, even if there were still active connections. An attempted fix in 3.12.0 was still broken, returning immediately if the server was still open and there were no active connections. Hopefully in 3.12.1 we have it right. N)rrrrB)rrs rrzServer.wait_closed|s@* == ))+ V$ sAA A ArP)rrrrrrrrrrrpropertyrrrrrrQr!rrrs[>B )G  ( ,GG & -*r!rceZdZdZdZdZddddZdZdZd\ddd d Z d\d dddddd d dZ d]dZ d^dZ d^dZ d\dZdZdZdZdZdZdZdZd\dZdZdZdZdZdZd Zd!Zej>fd"Z d#Z!d$Z"dd%d&Z#dd%d'Z$dd%d(Z%d)Z&d*Z'd+Z(dd%d,Z)d-Z*d.Z+d/Z,d0d0d0d0d1d2Z-d_d3Z.d`d d4d5Z/d6Z0d7Z1d8Z2d\d9Z3 d^dd0d0d0dddddddd d: d;Z4 dad<Z5d`d d4d=Z6d>Z7d?Z8d dddd@dAZ9 d^d0d0d0ddddBdCZ:d0e;jxd0d0d1dDZ=dEZ> d^e;j~e;jddFdddddd dG dHZAddddIdJZBdKZCdLZDdMZEeFjeFjeFjd d d0ddddN dOZHeFjeFjeFjd d d0ddddN dPZIdQZJdRZKdSZLdTZMdUZNdVZOdWZPdXZQdYZRdZZSd[ZTy)brcd|_d|_d|_tj|_g|_d|_d|_d|_ tjdj|_ d|_|jt!j"d|_d|_d|_d|_d|_t/j0|_d|_d|_y)NrF monotonicg?)_timer_cancelled_count_closed _stoppingrUdeque_ready _scheduled_default_executor _internal_fds _thread_idtimeget_clock_info resolution_clock_resolution_exception_handler set_debugr_is_debug_modeslow_callback_duration_current_handle _task_factory"_coroutine_origin_tracking_enabled&_coroutine_origin_tracking_saved_depthweakrefWeakSet _asyncgens_asyncgens_shutdown_called_executor_shutdown_calledrs rrzBaseEventLoop.__init__s&'# !'') !%!%!4!4[!A!L!L"& z0023'*##!27/6:3"//+*/').&r!c d|jjd|jd|jd|j d S)Nrz running=z closed=z debug=r)rr is_running is_closed get_debugrs rrzBaseEventLoop.__repr__sP''( $//2C1DEnn&'wt~~/?.@ C r!c.tj|S)z,Create a Future object attached to the loop.r)rFuturers rrzBaseEventLoop.create_futures~~4((r!N)namecontextc2|j|j3tj||||}|jrM|jd=n?||j||}n|j|||}tj || |~S#~wxYw)zDSchedule a coroutine object. Return a task object. )rrr r ) _check_closedrr r_source_traceback_set_task_name)rcororr tasks r create_taskzBaseEventLoop.create_tasks     %::dD'JD%%**2.))$5))$g)F  t , s BBcB|t|s td||_y)awSet a task factory that will be used by loop.create_task(). If factory is None the default task factory will be set. If factory is a callable, it should have a signature matching '(loop, coro)', where 'loop' will be a reference to the active event loop, 'coro' will be a coroutine object. The callable must return a Future. Nz'task factory must be a callable or None)callabler>r)rfactorys rset_task_factoryzBaseEventLoop.set_task_factorys%  x'8EF F$r!c|jS)z3B#4B>7B)=B%>B) B> B'B>D #B>%B)'B>)B;/B2 0B;7B>>ADD DD cZ |jjd|js"|jtj |dyy#t $rP}|js6|js!|j|j|Yd}~yYd}~yYd}~yd}~wwxYw)NTrd) rrnrrDr_set_result_unless_cancelledrYrfr)rroexs rrhzBaseEventLoop._do_shutdownfs D  " " + + + 6>>#))'*N*N*0$8$ D>>#F,<,<,>))&*>*>CC-?# DsA A B* ?? CD D  # # % 1IK K 2r!c|j|j|j|jt j } t j|_t j|j|jtj| |j|jrn d|_d|_tjd|jdt j|y#d|_d|_tjd|jdt j|wxYw)zRun until stop() is called.) firstiter finalizerFN)r rw_set_coroutine_origin_tracking_debugsysget_asyncgen_hooksrf get_identrset_asyncgen_hooksrPrHr_set_running_loop _run_oncer)rold_agen_hookss r run_foreverzBaseEventLoop.run_foreverws   ++DKK8//1 4'113DO  " "T-J-J-1-J-J L  $ $T * >>"DN"DO  $ $T *  / / 6  " "N 3 #DN"DO  $ $T *  / / 6  " "N 3sA8DAEc |j|jtj| }t j ||}|rd|_|jt |j |jt|js td|jS#|r0|jr |js|jxYw#|jtwxYw)a\Run until the Future is done. If the argument is a coroutine, it is wrapped in a Task. WARNING: It would be disastrous to call run_until_complete() with the same coroutine twice -- it would wrap it in two different Tasks and that can't be good. Return the Future's result, or raise its exception. rFz+Event loop stopped before Future completed.)r rwrisfuturer ensure_future_log_destroy_pendingadd_done_callbackrnrrrfrgremove_done_callbackrr^)rronew_tasks rrun_until_completez BaseEventLoop.run_until_completes  ''//$$V$7 +0F '  !78 @      ' '(> ?{{}LM M}} FKKM&2B2B2D  "   ' '(> ?s-B>>5C33C66D cd|_y)zStop running the event loop. Every callback already scheduled will still run. This simply informs run_forever to stop looping after a complete iteration. TN)rrs rrkzBaseEventLoop.stops r!cl|jr td|jry|jrt j d|d|_|j j|jjd|_ |j}|d|_ |jdyy)zClose the event loop. This clears the queues and shuts down the executor, but does not wait for the executor to finish. The event loop must not be running. z!Cannot close a running event loopNzClose %rTFrd) rrrr|rdebugrrVrrrrnrexecutors rrzBaseEventLoop.closes ?? BC C <<  ;; LLT *   )-&))  %)D "   5  ) r!c|jS)z*Returns True if the event loop was closed.)rrs rrzBaseEventLoop.is_closeds ||r!c|js4|d|t||js|jyyy)Nzunclosed event loop rJ)rrNrr)r_warns r__del__zBaseEventLoop.__del__s=~~ (1?4 P??$ % r!c|jduS)z*Returns True if the event loop is running.N)rrs rrzBaseEventLoop.is_runningst+,r!c*tjS)zReturn the time according to the event loop's clock. This is a float expressed in seconds since an epoch, but the epoch, precision, accuracy and drift are unspecified and may differ per event loop. )rrrs rrzBaseEventLoop.times~~r!r c| td|j|j|z|g|d|i}|jr |jd=|S)a;Arrange for a callback to be called at a given time. Return a Handle: an opaque object with a cancel() method that can be used to cancel the call. The delay can be an int or float, expressed in seconds. It is always relative to the current time. Each callback will be called exactly once. If two callbacks are scheduled for exactly the same time, it is undefined which will be called first. Any positional arguments after the callback will be passed to the callback when it is called. zdelay must not be Noner r )r>call_atrr)rdelaycallbackr r2timers r call_laterzBaseEventLoop.call_laters_ =45 5 TYY[50(.T.%,.  " "''+ r!cN| td|j|jr"|j|j |dt j |||||}|jr |jd=tj|j|d|_ |S)z|Like call_later(), but uses an absolute time. Absolute time corresponds to the event loop's time() method. zwhen cannot be Nonerr T) r>r r| _check_thread_check_callbackr TimerHandlerheapqheappushr)rwhenrr r2rs rrzBaseEventLoop.call_ats <12 2  ;;     9 5""44wG  " "''+ t. r!c|j|jr"|j|j|d|j |||}|j r |j d=|S)aTArrange for a callback to be called as soon as possible. This operates as a FIFO queue: callbacks are called in the order in which they are registered. Each callback will be called exactly once. Any positional arguments after the callback will be passed to the callback when it is called. call_soonr )r r|rr _call_soonrrrr r2rs rrzBaseEventLoop.call_soonsa  ;;     ; 749  # #((, r!ctj|stj|rtd|dt |std|d|y)Nzcoroutines cannot be used with z()z"a callable object was expected by z(), got )r iscoroutineiscoroutinefunctionr>r)rrmethods rrzBaseEventLoop._check_callback(sg  " "8 ,..x81&<> >!4VH=l$% %"r!ctj||||}|jr |jd=|jj ||S)Nr )rHandlerrrB)rrr2r rs rrzBaseEventLoop._call_soon2sDxtW=  # #((, 6" r!cz|jytj}||jk7r tdy)aoCheck that the current thread is the thread running the event loop. Non-thread-safe methods of this class make this assumption and will likely behave incorrectly when the assumption is violated. Should only be called when (self._debug == True). The caller is responsible for checking this condition for performance reasons. NzMNon-thread-safe operation invoked on an event loop other than the current one)rrfrr)r thread_ids rrzBaseEventLoop._check_thread9sB ?? " '')  ''( ( (r!c|j|jr|j|d|j|||}|jr |jd=|j |S)z"Like call_soon(), but thread-safe.rDr )r r|rrrr;rs rrDz"BaseEventLoop.call_soon_threadsafeJs`  ;;  +A B49  # #((,  r!c<|j|jr|j|d|E|j}|j |'t j jd}||_t j|j|g||S)Nrun_in_executorasyncio)thread_name_prefixr) r r|rrrA concurrentrThreadPoolExecutor wrap_futuresubmit)rrfuncr2s rrzBaseEventLoop.run_in_executorUs  ;;  '8 9  --H  ( ( *%--@@'0A*2&"" HOOD (4 (t5 5r!cpt|tjjs t d||_y)Nz,executor must be ThreadPoolExecutor instance)rrrrr>rrs rset_default_executorz"BaseEventLoop.set_default_executores,(J$6$6$I$IJJK K!)r!c"|d|g}|r|jd||r|jd||r|jd||r|jd|dj|}tjd||j }t j ||||||} |j |z } d|d | d zd d | }| |jk\rtj|| Stj|| S) N:zfamily=ztype=zproto=zflags=, zGet address info %szGetting address info z took g@@z.3fzms: ) rBrkrrrr+ getaddrinforinfo) rrDrErFrGrHflagsmsgt0addrinfodts r_getaddrinfo_debugz BaseEventLoop._getaddrinfo_debugjsq!"  JJ + ,  JJth' (  JJy) *  JJy) *iin *C0 YY[%%dD&$uM YY[2 %cU&c#d8,O ,, , KK  LL r!rrFrGrHrc K|jr |j}ntj}|j d|||||||d{S7wrP)r|rr+rr)rrDrErFrGrHr getaddr_funcs rrzBaseEventLoop.getaddrinfosU ;;22L!--L)) ,dFD%HH HHsAAA AcbK|jdtj||d{S7wrP)rr+ getnameinfo)rsockaddrrs rrzBaseEventLoop.getnameinfos2)) &$$h77 77s &/-/)fallbackcZK|jr|jdk7r tdt||j |||| |j ||||d{S7#t j$r }|sYd}~nd}~wwxYw|j||||d{7Sw)Nrzthe socket must be non-blocking) r| gettimeoutr,rw_check_sendfile_params_sock_sendfile_nativerSendfileNotAvailableError_sock_sendfile_fallback)rr1fileoffsetcountrrms r sock_sendfilezBaseEventLoop.sock_sendfiles ;;4??,1>? ?$ ##D$> 33D$4:ECC CC33  11$28%AAA AsNA B+ A+$A)%A+(B+)A++B >BB+B  B+%B(&B+cBKtjd|d|dw)Nz-syscall sendfile is not available for socket z and file z combinationrrrr1rrrs rrz#BaseEventLoop._sock_sendfile_natives422;D8Dx| -. .sc8K|r|j||rt|tjntj}t |}d} |rt||z |}|dkrnYt |d|}|j d|j|d{} | sn#|j||d| d{|| z }p||dkDr"t|dr|j||zSSS7S75#|dkDr"t|dr|j||zwwwxYww)Nrseek) rminr!SENDFILE_FALLBACK_READBUFFER_SIZE bytearray memoryviewrreadinto sock_sendallr*) rr1rrr blocksizebuf total_sentviewreads rrz%BaseEventLoop._sock_sendfile_fallbacks1  IIf  yBB C#EE  "  / #EJ$6 BI A~!#z 2!11$ tLL''d5Dk:::d" A~'$"7 &:-.#8~M;A~'$"7 &:-.#8~sCA DAC.C*C.6C,7 C.(D*C.,C..)DDcdt|ddvr td|jtjk(s td|It |t stdj||dkrtdj|t |t stdj||dkrtdj|y)Nbmodez$file should be opened in binary modez+only SOCK_STREAM type sockets are supportedz+count must be a positive integer (got {!r})rz0offset must be a non-negative integer (got {!r})) rr,rGr+r:rr=r>formatrs rrz$BaseEventLoop._check_sendfile_paramss gdFC0 0CD DyyF...JK K  eS)AHHOQQz AHHOQQ&#&BII  A:BII  r!cKg}|j||\}}}}} d} tj|||} | jd|G|D]!\} }}}} | |k7r | j| n"|r|jt d|d|j| | d{| dx}}S#t$rP} d| dt | j }t | j|} |j| Yd} ~ d} ~ wwxYw7f#t$r)} |j| | | jd} ~ w| | jxYw#dx}}wxYww)z$Create, bind and connect one socket.NrFrGrHF*error while attempting to bind on address : z&no matching local address with family=z found) rBr+ setblockingbindr/rlowererrnopop sock_connectr)rr addr_infolocal_addr_infos my_exceptionsrFtype_rH_r)r1lfamilyladdrrmrs r _connect_sockzBaseEventLoop._connect_socks  -(+4(ua# .==U%HD   U #+/?+GQ1e&(  2 %( 0@%+//11%(OyPV&WXX##D'2 2 2*. -J1#2'',ir#c(..2B1CE&cii5%,,S11 2 3    %   )- -JskE#z;BaseEventLoop.create_connection...]s$2D2D&+3r!NrQ)rRrrr rs rrTz2BaseEventLoop.create_connection..Zs' ).H)1).srrzcreate_connection failedc3:K|]}t|k(ywrPr)rRrmmodels rrTz2BaseEventLoop.create_connection..psGJSs3x50JszMultiple exceptions: {}rc32K|]}t|ywrPr)rRrms rrTz2BaseEventLoop.create_connection..us%E*3c#h*sz5host and port was not specified and no sock specified"A Stream Socket was expected, got )rrr+z%r connected to %s:%r: (%r, %r))r,rw_ensure_resolvedr+r:r/rdrr staggered_raceExceptionGrouprUrallrrkrG_create_connection_transportr|get_extra_inforr)rrrDrErurFrHrr1rr"rrrrrinfosrsubrmrrrr rs` @@@rcreate_connectionzBaseEventLoop.create_connectionsq(  &sJK K  "s "ABB"O ,SCE E +CBD D   d #  + 0BJ  t/ NPP//t V''uE0NNEABB%$($9$9v++5d%:%,, #!"EFF" -eZ@J#+ %H!%)%7%7&+&? ? !&(66 ). )   |-7GZc3Cc3cZG &!,-GTT:!+(m+!$JqM 2GJGG",Q-/&&?&F&F II%E*%EE'GHH | KMMyyF...!8ACC%)$E$E "C"7!5%F%77 8 ;;++H5D LL:tT9h @(""mN," ?#! ! H "&J 7sBJI4;JI7*J>I=I:I=*JJ JJ"J'A8JAJ1J2AJ7J:I== J J J  JJJJc .K|jd|}|j} |r.t|trdn|} |j ||| | ||||} n|j ||| } | d{| |fS7#| j xYww)NFr!r"rr)rrrboolr'rr) rr1rrur"r!rrrrr&rs rrz*BaseEventLoop._create_connection_transports #%##% !+C!6CJ00h F'&;%9 1;I 33D(FKI LL (""   OO  s0A,B/A?4A=5A?9B=A??BBcK|jr tdt|dtjj }|tjj urtd||tjj ur |j||||d{S|std||j||||d{S70#tj$r }|sYd}~Id}~wwxYw7)w)aSend a file to transport. Return the total number of bytes which were sent. The method uses high-performance os.sendfile if available. file must be a regular file object opened in binary mode. offset tells from where to start reading the file. If specified, count is the total number of bytes to transmit as opposed to sending the file until EOF is reached. File position is updated on return or also in case of error in which case file.tell() can be used to figure out the number of bytes which were sent. fallback set to True makes asyncio to manually read and send the file when the platform does not support the sendfile syscall (e.g. Windows or SSL socket on Unix). Raise SendfileNotAvailableError if the system does not support sendfile syscall and fallback is False. zTransport is closing_sendfile_compatiblez(sendfile is not supported for transport NzHfallback is disabled and native sendfile is not supported for transport ) rrrr _SendfileMode UNSUPPORTED TRY_NATIVE_sendfile_nativerr_sendfile_fallback)rrrrrrrrms rsendfilezBaseEventLoop.sendfiles0    !56 6y"8 ..::< 9**66 6:9-HJ J 9**55 5 !229d395BBB ++4-9: :,,Y-3U<< <B77   rrr SSLProtocolrrrrr BaseExceptionrr_app_transport) rrrr&r!r"rrr ssl_protocol conmade_cb resume_cbs r start_tlszBaseEventLoop.start_tlss= ;CD D*cnn5!n&' 'y"95AYM)IJL L##%++ (J "7!5!& (  !|,^^L$@$@)L NN9#;#;<  LL***   OO            s0CD5C7$C5%C7) D55C77;D22D5)rFrHr reuse_portallow_broadcastr1c DK| | jtjk(rtd| |s |s |s|s|s|s|rGt |||||||} dj d| j D} td| d| jdd} nb|s|s|d k(r td ||fd ff} nttd r|tjk(r||fD] }|t|trtd |rO|d dvrH tjtj|j rtj"|||f||fff} ni}d |fd|ffD]\}}| t|t,rt/|dk(s td|j1||tj2|||d{}|s t'd|D]\}}}}}||f}||vrddg||<||||<!|j Dcgc]\}}|r|d  |r|d||f} }}| s tdg}| D]\\}}\}}d} d} tj|tj2|} |r t5| |r/| j7tj8tj:d| jd|r| j=||r|s|j?| |d{|} n|d |}|jE}|jG| || |}|jHr4|rt)jJd||||nt)jLd||| |d{||fS#t$$rY0t&$r"}t)j*d||Yd}~Ud}~wwxYw7cc}}w7#t&$r/}| | jA|jB|Yd}~d}~w| | jAxYw7#|jAxYww)zCreate datagram connection.Nz$A datagram socket was expected, got )r remote_addrrFrHrr3r4rc36K|]\}}|s |d|yw)=NrQ)rRkvs rrTz9BaseEventLoop.create_datagram_endpoint..=s!$NLDAqAs!A3ZLs  zKsocket modifier keyword arguments can not be used when sock is specified. ()Frzunexpected address familyNNAF_UNIXzstring is expected)rz2Unable to check or remove stale UNIX socket %r: %rrrbz2-tuple is expectedrrzcan not get address informationrz@Datagram endpoint local_addr=%r remote_addr=%r created: (%r, %r)z2Datagram endpoint remote_addr=%r created: (%r, %r))'rGr+r:r,dictrkitemsrr*r=rrr>statS_ISSOCKosst_moderemoveFileNotFoundErrorr/rerrorrrUrr;r2r-r. SO_BROADCASTrrrrBrr*r|rr) rrrr6rFrHrr3r4r1optsproblemsr_addraddr_pairs_inforaerr addr_infosidxrfamrpror)key addr_pairr local_addressremote_addressrmrrrs rcreate_datagram_endpointz&BaseEventLoop.create_datagram_endpoint+s  yyF... :4(CEEkeu/z{#)e'1,;= 99$NDJJL$NN 008z<==   U #F+Q;$%@AA%+UO\#B"D+&..0H'5D' 40E'(<==6*Q-{"B 6==)<)D)DEIIj1&,UO%/$=$?#B #$j/A{3C!DIC' *4 7CIN"+,A"BB&*&;&; f6G6G"'u4'<'A!A %")*M"NN7<3CCG#&*C"*437, 33:JsOC0 8="E&r,rwrCrr}platformrrUabcIterablerYr rWsetrZr[r\r+rGr|rwarningrBr-r. SO_REUSEADDRr@rr2rAr*r` IPV6_V6ONLYrr/rr EADDRNOTAVAILrrrGr:rrrrr)rrrDrErFrr1rrurZr3rrrrhostsfsr completedresrLsocktyperH canonnamesarMrrrs r create_serverzBaseEventLoop.create_servers8 c4 HI I ,CE E + BD D   d #  t/ NPP$ "7 2 Os||x7O GrzT3' {'?'?@$%#d11$V8=2?# % ,,++E 55e<=EI4 % C9<6B%B!%}}R5ANN4($"--v/B/BDJ"bV^^V__,M&M&t,"&//1#FN;(;(;(.(:(:(,. @ " ;!V!:?%@%$d1g%%@#CDD!  ' !(| !LMMyyF... #EdX!NOOfGD   U #g'7W&;,.   ! ! #++a. ;; KK 0 c%,"<<!;;"NN,G+-xO! !4# @#%c#hnn&6 899(;(;;#KKM JJL#{{ &s 3$%cii54? @&A! ' !(!( !sC QL'*QL,.Q1 P?L/C P M/1P? P PB(Q>P>?.Q/9M,(P+M,,P/ P8A=P5P;PPPP;;Q)rurrc rK|jtjk7rtd|| |s td| |s td| t ||j |||dd||d{\}}|j r)|jd}tjd|||||fS7@w) Nrrrr5T)r!rrr+z%r handled: (%r, %r)) rGr+r:r,rwrr|rrr)rrr1rurrrrs rconnect_accepted_socketz%BaseEventLoop.connect_accepted_socketRs 99** *A$JK K ,SCE E +CBD D   d #$($E$E "C"7!5%F%77 8 ;;++H5D LL/y( K(""7sA2B74B55AB7cK|}|j}|j|||} |d{|jr&t j d|j ||||fS7:#|jxYww)Nz Read pipe %r connected: (%r, %r))rr.rr|rrfilenorrr-rrrs rconnect_read_pipezBaseEventLoop.connect_read_pipeps#%##%2246J  LL ;; LL; 8 =(""   OO  ++BA0A.A06B.A00BBcK|}|j}|j|||} |d{|jr&t j d|j ||||fS7:#|jxYww)Nz!Write pipe %r connected: (%r, %r))rr0rr|rrrurvs rconnect_write_pipez BaseEventLoop.connect_write_pipes#%##%33D(FK  LL ;; LL< 8 =(""   OO  rxcr|g}||jdt||1|tjk(r|jdt|n>||jdt|||jdt|t j dj |y)Nzstdin=zstdout=stderr=zstdout=zstderr= )rBr'r#r%rrrk)rrr4r5r6rs r_log_subprocesszBaseEventLoop._log_subprocesssu   KK&e!4 56 7  &J,=,="= KK.f)=(>? @! gl6&:%;<=! gl6&:%;<= SXXd^$r!) r4r5r6universal_newlinesr3r7encodingerrorstextc Kt|ttfs td|r td|s td|dk7r td| r td| td| td|} d}|jrd |z}|j |||||j | |d ||||fi| d{}|jr|tjd |||| fS7-w) Nzcmd must be a string universal_newlines must be Falsezshell must be Truerbufsize must be 0text must be Falseencoding must be Noneerrors must be Nonezrun shell command %rT%s: %r) rr<rr,r|r}r9rr)rrcmdr4r5r6r~r3r7rrrr8r debug_logrs rsubprocess_shellzBaseEventLoop.subprocess_shells#s|,34 4 ?@ @12 2 a<01 1 12 2  45 5  23 3#% ;;/4I  E66 B9$99 c4KCIKK ;;90 KK)Y 7("" KsB=C/?C-.C/c K|r td|r td|dk7r td| r td| td| td|f| z}|}d}|jrd|}|j|||||j||d ||||fi| d{}|jr|t j d ||||fS7-w) Nrzshell must be Falserrrrrzexecute program Fr)r,r|r}r9rr)rrprogramr4r5r6r~r3r7rrrr2r8 popen_argsrrrs rsubprocess_execzBaseEventLoop.subprocess_execs  ?@ @ 23 3 a<01 1 12 2  45 5  23 3Z$& #% ;;+7+6I  E66 B9$99 j%   ;;90 KK)Y 7("" sB"C$C%.Cc|jS)zKReturn an exception handler, or None if the default one is in use. )rrs rget_exception_handlerz#BaseEventLoop.get_exception_handlers&&&r!cH|t|std|||_y)aSet handler as the new event loop exception handler. If handler is None, the default exception handler will be set. If handler is a callable object, it should have a signature matching '(loop, context)', where 'loop' will be a reference to the active event loop, 'context' will be a dict object (see `call_exception_handler()` documentation for details about context). Nz+A callable object or None is expected, got )rr>r)rhandlers rset_exception_handlerz#BaseEventLoop.set_exception_handlers5  x'8##*+/0 0")r!c|jd}|sd}|jd}|t|||jf}nd}d|vr;|j/|jjr|jj|d<|g}t |D]}|dvr||}|dk(r:d j tj|}d }||jz }nJ|dk(r:d j tj|}d }||jz }n t|}|j|d |tjd j ||y)aEDefault exception handler. This is called when an exception occurs and no exception handler is set, and can be called by a custom exception handler that wants to defer to the default behavior. This default handler logs the error message and other context-dependent information. In debug mode, a truncated stack trace is also appended showing where the given object (e.g. a handle or future or task) was created, if any. The context parameter has the same meaning as in `call_exception_handler()`. rSz!Unhandled exception in event looprgNFsource_tracebackhandle_traceback>rSrgr5z+Object created at (most recent call last): z+Handle created at (most recent call last): r r^)getrG __traceback__rrsortedrk traceback format_listrstriprrBrrG) rr rSrgr_ log_linesrRvaluetbs rdefault_exception_handlerz'BaseEventLoop.default_exception_handlers[++i(9GKK ,  YI4K4KLHH g -$$0$$66$$66 & 'I '?C..CLE((WWY2259:F$**WWY2259:F$U    uBug. /#  TYYy)H=r!c|j |j|y d}|jd}||jd}||jd}|t|dr|j}|*t|d r|j|j||y|j||y#ttf$rt$rt j ddYywxYw#ttf$rt$r[} |jd ||d n:#ttf$rt$rt j d dYnwxYwYd}~yYd}~yd}~wwxYw) aDCall the current event loop's exception handler. The context argument is a dict containing the following keys: - 'message': Error message; - 'exception' (optional): Exception object; - 'future' (optional): Future instance; - 'task' (optional): Task instance; - 'handle' (optional): Handle instance; - 'protocol' (optional): Protocol instance; - 'transport' (optional): Transport instance; - 'socket' (optional): Socket instance; - 'asyncgen' (optional): Asynchronous generator that caused the exception. New keys maybe introduced in the future. Note: do not overload this method in an event loop subclass. For custom exception handling, use the `set_exception_handler()` method. Nz&Exception in default exception handlerTr^rror get_contextrunz$Unhandled error in exception handler)rSrgr zeException in default exception handler while handling an unexpected error in custom exception handler) rrrhrir-rrGrr*rr)rr ctxthingrms rrZz$BaseEventLoop.call_exception_handler+sq,  " " * ,..w7$ 0 F+=$KK1E=#KK1E$ )F++-C?wsE':GGD33T7C++D':3 12   , E&*,  ,0 12   0022#I%(#*4 #$56$0LL"?+/000  0sMB7BC,$C,7/C)(C),EDE/E  E E  EEcT|js|jj|yy)zAdd a Handle to _ready.N) _cancelledrrBrrs r _add_callbackzBaseEventLoop._add_callbackss"  KK  v &!r!cF|j||jy)z6Like _add_callback() but called from a signal handler.N)rr;rs r_add_callback_signalsafez&BaseEventLoop._add_callback_signalsafexs 6" r!cH|jr|xjdz c_yy)z3Notification that a TimerHandle has been cancelled.rN)rrrs r_timer_handle_cancelledz%BaseEventLoop._timer_handle_cancelled}s!     ' '1 , ' r!cbt|j}|tkDrr|j|z tkDr\g}|jD]'}|j rd|_|j |)tj|||_d|_n|jrz|jdj ra|xjdzc_tj|j}d|_|jr|jdj rad}|js |jrd}nP|jrD|jdj}ttd||jz t }|j"j%|}|j'|d}|j|j(z}|jrm|jd}|j|k\rnNtj|j}d|_|jj ||jrmt|j}t+|D]} |jj-}|j r*|j.rr ||_|j} |j3|j| z } | |j4k\r t7j8dt;|| d|_|j3d}y#d|_wxYw)zRun one full iteration of the event loop. This calls all currently ready callbacks, polls for I/O, schedules the resulting callbacks, and finally schedules 'call_later' callbacks. FrrNzExecuting %s took %.3f seconds)rUr_MIN_SCHEDULED_TIMER_HANDLESr%_MIN_CANCELLED_TIMER_HANDLES_FRACTIONrrBrheapifyheappoprr_whenrmaxrMAXIMUM_SELECT_TIMEOUT _selectorselectr>rrangepopleftr|r_runrrrfr ) r sched_count new_scheduledrrjrr=end_timentodoirrs rrzBaseEventLoop._run_onces$//* 6 6  ' '+ 55 6M//$$(-F%!((0 * MM- (+DO*+D '//dooa&8&C&C++q0+t7$)!//dooa&8&C&C  ;;$..G __??1%++D#a !346LMG^^**73  Z( 99;!7!77oo__Q'F||x']]4??3F %F  KK  v & ooDKK uA[[((*F  {{ 0+1D(BKKMr)BT888'G'5f'=rC,0D( !",0D(s A)L%% L.c t|t|jk(ry|rDtj|_tj t j||_ytj |j||_yrP)rrr}#get_coroutine_origin_tracking_depthr#set_coroutine_origin_tracking_depthrDEBUG_STACK_DEPTHrenableds rr{z,BaseEventLoop._set_coroutine_origin_trackingsw =D!H!HI I  779  7  3 3++ - 3:/  3 3;; =3:/r!c|jSrP)r|rs rrzBaseEventLoop.get_debugs {{r!cl||_|jr|j|j|yyrP)r|rrDr{rs rrzBaseEventLoop.set_debugs. ??   % %d&I&I7 S r!rP)NNNr<)r)rN)FNN)Urrrrrrrrrrr'r*r.r0r9r;r>r rArHrPr_rqrhrwrrrkrrrLrMrrrrrrrrrrDrrrrrrrrrrrrr%r#r$r2rVr+r:rrYr? AI_PASSIVErqrsrwrzr}r#r$rrrrrrZrrrrr{rrrQr!rrrs/< ))-d4 %""%)$" 9=" $t"&!%!% "CG" @D(," AE)-"04" ""7DG "20DK40$L*.%MM - :>06:$26&%("=A 5 * 2"#!1H7 A(, A./4*).X59Q#14T"&!%!%$Q#j*/"&!% #8-<#'-<^1"4%*(,.2-1 .+bEID#./q267;$ D#N'(f.@.@%&a D59K####"&!%K^"&!% #<# # %&0__&0oo&0oo27%)1(,T "#J%/OOJOO%/__$)1'+Dt #D' *"0>dF0P'  - N` :Tr!r)rr)r)7__doc__rUcollections.abcconcurrent.futuresrrrrZrCr+rAr#rfrrr}rLrru ImportErrorr5rrrrrr r r r r rrlogr__all__rrr*rArr r'r2rMrdrnrrrwProtocolryAbstractServerrAbstractEventLooprrQr!rrs-      $ #),% FJ ' #J8v," 6=!G  > A) 2 2A)HBV " "BJPTF,,PTk  CsDDD__pycache__/log.cpython-312.opt-1.pyc000064400000000433152527367570013222 0ustar00 {|j|4dZddlZejeZy)zLogging configuration.N)__doc__logging getLogger __package__logger$/usr/lib64/python3.12/asyncio/log.pyr s   ; 'r __pycache__/exceptions.cpython-312.opt-1.pyc000064400000006013152527367570014622 0ustar00 {|jdZdZGddeZeZGddeZGddeZGdd e Z Gd d eZ Gd d eZ y)zasyncio exceptions.)BrokenBarrierErrorCancelledErrorInvalidStateError TimeoutErrorIncompleteReadErrorLimitOverrunErrorSendfileNotAvailableErrorceZdZdZy)rz!The Future or Task was cancelled.N__name__ __module__ __qualname____doc__+/usr/lib64/python3.12/asyncio/exceptions.pyrr s+rrceZdZdZy)rz+The operation is not allowed in this state.Nr rrrrrs5rrceZdZdZy)rz~Sendfile syscall is not available. Raised if OS does not support sendfile syscall for given socket or file type. Nr rrrrrsrrc(eZdZdZfdZdZxZS)rz Incomplete read error. Attributes: - partial: read bytes string before the end of stream was reached - expected: total number of expected bytes (or None if unknown) c||dn t|}t| t|d|d||_||_y)N undefinedz bytes read on a total of z expected bytes)reprsuper__init__lenpartialexpected)selfrr r_expected __class__s rrzIncompleteReadError.__init__$sE$,$4[$x.  CL>)C&<8 9   rcHt||j|jffSN)typerrrs r __reduce__zIncompleteReadError.__reduce__+sDzDLL$--888rr r r rrr$ __classcell__rs@rrrs !9rrc(eZdZdZfdZdZxZS)rzReached the buffer limit while looking for a separator. Attributes: - consumed: total number of to be consumed bytes. c2t||||_yr!)rrconsumed)rmessager*rs rrzLimitOverrunError.__init__5s !  rcNt||jd|jffS)N)r"argsr*r#s rr$zLimitOverrunError.__reduce__9s"DzDIIaL$--888rr%r's@rrr/s !9rrceZdZdZy)rz*Barrier is broken by barrier.abort() call.Nr rrrrr=s4rrN) r__all__ BaseExceptionrr Exceptionr RuntimeErrorrEOFErrorrrrrrrr5s^ ( ,], 6 6 9(9$ 9 955r__pycache__/staggered.cpython-312.opt-1.pyc000064400000014376152527367570014421 0ustar00 {|jPdZdZddlZddlmZddlmZddlmZddlmZdd d Z y) zFSupport for running coroutines in parallel with staggered start times.)staggered_raceN)events) exceptions)locks)tasks)loopc t Kxstjt|ddgg t d fd d  f d d} t j }j  |d} j||j |jd} r j d{d r || f ~S7#tj$r,}|} D]}|j|jYd}~Nd}~wwxYw# ~wxYww)aRun coroutines with staggered start times and take the first to finish. This method takes an iterable of coroutine functions. The first one is started immediately. From then on, whenever the immediately preceding one fails (raises an exception), or when *delay* seconds has passed, the next coroutine is started. This continues until one of the coroutines complete successfully, in which case all others are cancelled, or until all coroutines fail. The coroutines provided should be well-behaved in the following way: * They should only ``return`` if completed successfully. * They should always raise an exception if they did not complete successfully. In particular, if they handle cancellation, they should probably reraise, like this:: try: # do work except asyncio.CancelledError: # undo partially completed work raise Args: coro_fns: an iterable of coroutine functions, i.e. callables that return a coroutine object when called. Use ``functools.partial`` or lambdas to pass arguments. delay: amount of time, in seconds, between starting coroutines. If ``None``, the coroutines will run sequentially. loop: the event loop to use. Returns: tuple *(winner_result, winner_index, exceptions)* where - *winner_result*: the result of the winning coroutine, or ``None`` if no coroutines won. - *winner_index*: the index of the winning coroutine in ``coro_fns``, or ``None`` if no coroutines won. If the winning coroutine may return None on success, *winner_index* can be used to definitively determine whether any coroutine won. - *exceptions*: list of exceptions returned by the coroutines. ``len(exceptions)`` is equal to the number of coroutines actually started, and the order is the same as in ``coro_fns``. The winning coroutine's entry is ``None``. Ncj|#jssjd|jry|j }|yj |yN)discarddone set_result cancelled exceptionappend)taskexcon_completed_fut running_tasksunhandled_exceptionss */usr/lib64/python3.12/asyncio/staggered.py task_donez!staggered_race..task_doneJscd#  ($))+!  ' ' - >>  nn ; ##C(cX K|jd{|Xtjtj5t j |j d{ddd t \}}tj}tj}j||}j||j|j jd |d{}||t j }D]} | |us| j#y777#1swYxYw#t$rYywxYw7Z#t$t&f$rt($r} | |<|jYd} ~ yd} ~ wwxYwwr )wait contextlibsuppressexceptions_mod TimeoutErrorrwait_fornext StopIterationrEvent create_taskaddadd_done_callbacksetr current_taskcancel SystemExitKeyboardInterrupt BaseException) ok_to_startprevious_failed this_indexcoro_fn this_failednext_ok_to_start next_taskresultr)tedelay enum_coro_fnsrr run_one_cororr winner_index winner_results rr:z$staggered_race..run_one_coro[s    &$$^%@%@A nn_%9%9%;UCCC B "&}"5 Jkkm  ;;=$$\2BK%PQ )$##I. $ "9_F&L"M!--d3L"L(HHJ#a !D BA    %-.   %&Jz " OO   sF*E)F*(E)E*E.F*7EBF* E0E.E0"F*;F*EEF* E+(F**E++F*.E00F'F"F*"F''F*)returnN)rget_running_loop enumerater(rr$r%r&r' create_futurerCancelledErrorr*argsExceptionGroup)coro_fnsr8r propagate_cancellation_errorr. first_taskexrr9rrr:rrrr;r<s `` @@@@@@@@@rrr sQh  ,6**,Dh'MMLJEM)"66p$( Kkkm %%l;&EF *%$$Y/'+$#113  *&&& $   ( 3. .lJ6 46J'!00 */1,)DDKK)* * 46JsaAD8A2D0C.C,C.D0 D0(D8,C..D-"D(#D0(D--D00D55D8) __doc____all__rrrrrrrrrrLs(L *37aKr__pycache__/coroutines.cpython-312.pyc000064400000007273152527367570013705 0ustar00 {|j dZddlZddlZddlZddlZddlZdZeZ dZ ejejjfZeZdZdZy))iscoroutinefunction iscoroutineNctjjxsEtjj xr(t t j jdS)NPYTHONASYNCIODEBUG)sysflagsdev_modeignore_environmentboolosenvironget+/usr/lib64/python3.12/asyncio/coroutines.py_is_debug_moder sF 99   Ncii&B&B"B#M"&rzz~~6J'K"LNrcVtj|xst|ddtuS)z6Return True if func is a decorated coroutine function. _is_coroutineN)inspectrgetattrr)funcs rrrs-  ' ' - B D/4 0M ACrct|tvryt|tr1t tdkrtj t|yy)z)Return True if obj is a coroutine object.TdF)type_iscoroutine_typecache isinstance_COROUTINE_TYPESlenadd)objs rrr sE Cy**#'( % & , " & &tCy 1rct|sJd}d}d}t|dr|jr |j}n$t|dr|jr |j}||}|s||r|dS|Sd}t|dr|jr |j}n$t|dr|j r |j }|j xsd}d }||j}|d |d |}|S|j}|d |d |}|S) Nct|dr|jr |j}n>t|dr|jr |j}ndt|jd}|dS)N __qualname____name__z())hasattrr#r$r)coro coro_names rget_namez#_format_coroutine..get_name3sc 4 (T->->))I T: &4== IDJ//00BCIBrct |jS#t$r  |jcYS#t$rYYywxYwwxYw)NF) cr_runningAttributeError gi_running)r's r is_runningz%_format_coroutine..is_runningAsA ?? "  &!   s  7 &7 3737cr_codegi_codez runninggi_framecr_framezrz running at :z done, defined at ) rr&r/r0r1r2 co_filenamef_linenoco_firstlineno) r'r)r. coro_coder( coro_framefilenamelineno coro_reprs r_format_coroutiner<0s" t    ItYDLLLL y !dllLL I  d [) ) JtZ T]]]] z "t}}]] $$=(=H F$$ khZqA )) k!3H:QvhG r)__all__collections.abc collectionsrr rtypesrobjectrr CoroutineTypeabc Coroutinersetrrr<rrrrFs] . N C'')B)BC  =r__pycache__/queues.cpython-312.pyc000064400000027247152527367570013025 0ustar00 {|j&dZddlZddlZddlmZddlmZddlmZGddeZ Gd d eZ Gd d ejZ Gd de Z Gdde Zy))Queue PriorityQueue LifoQueue QueueFull QueueEmptyN) GenericAlias)locks)mixinsceZdZdZy)rz;Raised when Queue.get_nowait() is called on an empty Queue.N__name__ __module__ __qualname____doc__'/usr/lib64/python3.12/asyncio/queues.pyrr sErrceZdZdZy)rzDRaised when the Queue.put_nowait() method is called on a full Queue.Nr rrrrrsNrrceZdZdZddZdZdZdZdZdZ dZ e e Z d Zd Zed Zd Zd ZdZdZdZdZdZdZy)raA queue, useful for coordinating producer and consumer coroutines. If maxsize is less than or equal to zero, the queue size is infinite. If it is an integer greater than 0, then "await put()" will block when the queue reaches maxsize, until an item is removed by get(). Unlike the standard library Queue, you can reliably know this Queue's size with qsize(), since your single-threaded asyncio application won't be interrupted between calling qsize() and doing an operation on the Queue. c ||_tj|_tj|_d|_t j|_|jj|j|y)Nr) _maxsize collectionsdeque_getters_putters_unfinished_tasksr Event _finishedset_initselfmaxsizes r__init__zQueue.__init__!s\ $))+ #))+ !"  7rc6tj|_yN)rr_queuer"s rr!z Queue._init/s!'') rc6|jjSr')r(popleftr#s r_getz Queue._get2s{{""$$rc:|jj|yr'r(appendr#items r_putz Queue._put5 4 rct|r6|j}|js|jdy|r5yyr')r*done set_result)r#waiterswaiters r _wakeup_nextzQueue._wakeup_next:s0__&F;;=!!$' rcpdt|jdt|dd|jdS)N)typerid_formatr+s r__repr__zQueue.__repr__Bs54:&&'tBtHR=$,,.9IKKrcVdt|jd|jdS)Nr;r<r=)r>rr@r+s r__str__z Queue.__str__Es)4:&&'q(8::rcPd|j}t|ddr|dt|jz }|jr|dt |jdz }|j r|dt |j dz }|jr|d|jz }|S)Nzmaxsize=r(z _queue=z _getters[]z _putters[z tasks=)rgetattrlistr(rlenrr)r#results rr@z Queue._formatJsDMM,- 44 ( dkk!2 56 6F ==  3t}}#5"6a8 8F ==  3t}}#5"6a8 8F  ! !  6 678 8F rc,t|jS)zNumber of items in the queue.)rHr(r+s rqsizez Queue.qsizeVs4;;rc|jS)z%Number of items allowed in the queue.)rr+s rr$z Queue.maxsizeZs}}rc|j S)z3Return True if the queue is empty, False otherwise.r(r+s remptyz Queue.empty_s;;rc\|jdkry|j|jk\S)zReturn True if there are maxsize items in the queue. Note: if the Queue was initialized with maxsize=0 (the default), then full() is never True. rF)rrKr+s rfullz Queue.fullcs( ==A ::<4==0 0rcK|jrU|jj}|jj | |d{|jrU|j|S7&#|j  |jj |n#t$rYnwxYw|js+|js|j|jxYww)zPut an item into the queue. Put an item into the queue. If the queue is full, wait until a free slot is available before adding item. N) rQ _get_loop create_futurerr/cancelremove ValueError cancelledr9 put_nowait)r#r1putters rputz Queue.putns iik^^%335F MM  (  iik&t$$  MM((0!yy{6+;+;+=%%dmm4sZA C8 A;A9A;C8(C89A;;C5B*)C5* B63C55B66?C55C8c|jrt|j||xjdz c_|jj |j |jy)zyPut an item into the queue without blocking. If no free slot is immediately available, raise QueueFull. r N)rQrr2rrclearr9rr0s rrYzQueue.put_nowaitsP 99;O $ !#  $--(rcK|jrU|jj}|jj | |d{|jrU|jS7%#|j  |jj |n#t$rYnwxYw|js+|js|j|jxYww)zoRemove and return an item from the queue. If queue is empty, wait until an item is available. N) rOrSrTrr/rUrVrWrXr9 get_nowait)r#getters rgetz Queue.gets jjl^^%335F MM  (  jjl&    MM((0!zz|F,<,<,>%%dmm4sZA C7 A:A8A:C7(C78A::C4 B)(C4) B52C44B55?C44C7c|jrt|j}|j|j|S)zRemove and return an item from the queue. Return an item if one is immediately available, else raise QueueEmpty. )rOrr,r9rr0s rr_zQueue.get_nowaits5 ::< yy{ $--( rc|jdkr td|xjdzc_|jdk(r|jjyy)a$Indicate that a formerly enqueued task is complete. Used by queue consumers. For each get() used to fetch a task, a subsequent call to task_done() tells the queue that the processing on the task is complete. If a join() is currently blocking, it will resume when all items have been processed (meaning that a task_done() call was received for every item that had been put() into the queue). Raises ValueError if called more times than there were items placed in the queue. rz!task_done() called too many timesr N)rrWrr r+s r task_donezQueue.task_donesR  ! !Q &@A A !#  ! !Q & NN    'rctK|jdkDr#|jjd{yy7w)aBlock until all items in the queue have been gotten and processed. The count of unfinished tasks goes up whenever an item is added to the queue. The count goes down whenever a consumer calls task_done() to indicate that the item was retrieved and all work on it is complete. When the count of unfinished tasks drops to zero, join() unblocks. rN)rrwaitr+s rjoinz Queue.joins4  ! !A %..%%' ' ' & 's -868N)r)rrrrr%r!r,r2r9rArC classmethodr__class_getitem__r@rKpropertyr$rOrQr[rYrar_rdrgrrrrrs~  *%! L;$L1   1%6 )!4 !( (rrcReZdZdZdZej fdZejfdZ y)rzA subclass of Queue; retrieves entries in priority order (lowest first). Entries are typically tuples of the form: (priority number, data). cg|_yr'rNr"s rr!zPriorityQueue._init  rc*||j|yr'rN)r#r1heappushs rr2zPriorityQueue._putsd#rc&||jSr'rN)r#heappops rr,zPriorityQueue._getst{{##rN) rrrrr!heapqror2rqr,rrrrrs( #(..$!==$rrc"eZdZdZdZdZdZy)rzEA subclass of Queue that retrieves most recently added entries first.cg|_yr'rNr"s rr!zLifoQueue._initrmrc:|jj|yr'r.r0s rr2zLifoQueue._putr3rc6|jjSr')r(popr+s rr,zLifoQueue._gets{{  rN)rrrrr!r2r,rrrrrsO!!rr)__all__rrrtypesrr r Exceptionrr_LoopBoundMixinrrrrrrr}s^ L     B(F " "B(J $E $ ! !r__pycache__/unix_events.cpython-312.pyc000064400000204222152527367570014053 0ustar00 {|jdZddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl Z ddl mZddl mZddl mZddl mZddl mZdd l mZdd l mZdd l mZdd l mZdd l mZddlmZdZe j6dk(reddZdZGddej>Z GddejBZ"GddejFejHZ%GddejLZ'GddZ(Gdde(Z)Gd d!e(Z*Gd"d#e*Z+Gd$d%e*Z,Gd&d'e(Z-Gd(d)e(Z.d*Z/Gd+d,ej`Z1e Z2e1Z3y)-z2Selector event loop for Unix with signal handling.N) base_events)base_subprocess) constants) coroutines)events) exceptions)futures)selector_events)tasks) transports)logger)SelectorEventLoopAbstractChildWatcherSafeChildWatcherFastChildWatcherPidfdChildWatcherMultiLoopChildWatcherThreadedChildWatcherDefaultEventLoopPolicywin32z+Signals are not really supported on Windowscy)zDummy signal handler.N)signumframes ,/usr/lib64/python3.12/asyncio/unix_events.py_sighandler_noopr*scP tj|S#t$r|cYSwxYwN)oswaitstatus_to_exitcode ValueError)statuss rr"r"/s.((00  s  %%ceZdZdZdfd ZfdZdZdZdZdZ d Z dd Z dd Z dd Z d Z ddddddddZ dddddddddZdZdZdZdZxZS)_UnixSelectorEventLoopzdUnix event loop. Adds signal handling and UNIX Domain Socket support to SelectorEventLoop. Nc2t||i|_yr )super__init___signal_handlers)selfselector __class__s rr)z_UnixSelectorEventLoop.__init__?s " "rc0t|tjs,t |j D]}|j |y|j r;tjd|dt||j jyy)NzClosing the loop z@ on interpreter shutdown stage, skipping signal handlers removalsource) r(closesys is_finalizinglistr*remove_signal_handlerwarningswarnResourceWarningclear)r+sigr-s rr1z_UnixSelectorEventLoop.closeCs    "D112**3/3$$ 1$:HI.%) + %%++- %rc:|D]}|s|j|yr )_handle_signal)r+datars r_process_self_dataz)_UnixSelectorEventLoop._process_self_dataQs F    ' rcRtj|stj|r td|j ||j  t j|jjtj|||d}||j |< t j |t"t j$|dy#ttf$r}tt|d}~wwxYw#t$r}|j |=|j sI t jdn2#ttf$r }t'j(d|Yd}~nd}~wwxYw|j*t*j,k(rtd|dd}~wwxYw)zAdd a handler for a signal. UNIX only. Raise ValueError if the signal number is invalid or uncatchable. Raise RuntimeError if there is a problem setting up the handler. z3coroutines cannot be used with add_signal_handler()NFset_wakeup_fd(-1) failed: %ssig  cannot be caught)r iscoroutineiscoroutinefunction TypeError _check_signal _check_closedsignal set_wakeup_fd_csockfilenor#OSError RuntimeErrorstrrHandler*r siginterruptrinfoerrnoEINVAL)r+r:callbackargsexchandlenexcs radd_signal_handlerz)_UnixSelectorEventLoop.add_signal_handlerXsq  " "8 ,..x889 9 3  )  !3!3!5 6xtT:%+c"  MM#/ 0   U +G$ )s3x( ( ) %%c*((F((,"G,FKK >EEFyyELL("T#.?#@AA sZ-C-0D D-DD F&F!,EF!E1E,'F!,E110F!!F&c|jj|}|y|jr|j|y|j |y)z2Internal helper that is the actual signal handler.N)r*get _cancelledr5_add_callback_signalsafe)r+r:rXs rr<z%_UnixSelectorEventLoop._handle_signalsE&&**3/ >      & &s +  ) )& 1rc|j| |j|=|tjk(rtj }ntj } tj|||js tjdyy#t$rYywxYw#t$r2}|jtjk(rtd|dd}~wwxYw#ttf$r }tjd|Yd}~yd}~wwxYw)zwRemove a handler for a signal. UNIX only. Return True if a signal handler was removed, False if not. FrBrCNr@rAT)rGr*KeyErrorrISIGINTdefault_int_handlerSIG_DFLrMrSrTrNrJr#rrR)r+r:handlerrWs rr5z,_UnixSelectorEventLoop.remove_signal_handlers 3 %%c* &-- 00GnnG  MM#w '$$ A$$R(-   yyELL("T#.?#@AA  ( A :C@@ AsA BB8C BB C'-CCD +DD ct|tstd||tjvrt d|y)zInternal helper to validate a signal. Raise ValueError if the signal number is invalid or uncatchable. Raise RuntimeError if there is a problem setting up the handler. zsig must be an int, not zinvalid signal number N) isinstanceintrFrI valid_signalsr#)r+r:s rrGz$_UnixSelectorEventLoop._check_signalsJ #s#6sg>? ? f**, ,5cU;< < -rc t|||||Sr )_UnixReadPipeTransportr+pipeprotocolwaiterextras r_make_read_pipe_transportz0_UnixSelectorEventLoop._make_read_pipe_transports%dD(FEJJrc t|||||Sr )_UnixWritePipeTransportrks r_make_write_pipe_transportz1_UnixSelectorEventLoop._make_write_pipe_transports&tT8VUKKrc lKtj5tjdtt j } ddd 5| j s td|j} t||||||||f| |d| } | j| j|j|  | d{ ddd| S#1swYxYw7#ttf$rt$r+| j!| j#d{7wxYw#1swY SxYww)NignorezRasyncio.get_child_watcher() is not activated, subprocess support is not installed.)rnro)r6catch_warnings simplefilterDeprecationWarningrget_child_watcher is_activerN create_future_UnixSubprocessTransportadd_child_handlerget_pid_child_watcher_callback SystemExitKeyboardInterrupt BaseExceptionr1_wait) r+rmrVshellstdinstdoutstderrbufsizerokwargswatcherrntransps r_make_subprocess_transportz1_UnixSelectorEventLoop._make_subprocess_transports/ $ $ &  ! !(,> ?..0G'$$& #$GHH'')F-dHdE,16676396/56F  % %fnn&6$($@$@& J  !0 9' &( 12    lln$$ '0 seD4/C D4A-D'>C!CC! D4CD4C!!;D$DD$$D''D1,D4c<|j|j|yr )call_soon_threadsafe_process_exited)r+pid returncoders rrz._UnixSelectorEventLoop._child_watcher_callbacks !!&"8"8*Er)sslsockserver_hostnamessl_handshake_timeoutssl_shutdown_timeoutcK|t|tsJ|r |2td| td| td| td|| tdtj|}t j t j t jd} |jd|j||d{nf| td|jt j k7s|jt jk7rtd ||jd|j|||||| d{\}} || fS7#|jxYw7#w) Nz/you have to pass server_hostname when using sslz+server_hostname is only meaningful with ssl1ssl_handshake_timeout is only meaningful with ssl0ssl_shutdown_timeout is only meaningful with ssl3path and sock can not be specified at the same timerFzno path and sock were specified.A UNIX Domain Stream Socket was expected, got )rr)rfrOr#r!fspathsocketAF_UNIX SOCK_STREAM setblocking sock_connectr1familytype_create_connection_transport) r+protocol_factorypathrrrrr transportrms rcreate_unix_connectionz-_UnixSelectorEventLoop.create_unix_connections &*_c*JJJ & EGG* !NOO$0 GII#/ FHH   IKK99T?D==1C1CQGD   '''d333 | !BCC v~~-II!3!33 DTHMOO   U #$($E$E "C"7!5%F%77 8(""%4  7s=B"E7%&E E EBE7E5 E7EE22E7dT)rbacklogrrr start_servingc Kt|tr td| |s td| |s td|| tdt j |}t j t jt j}|ddvrH tjt j|jrt j| |j#|nU| td |j*t jk7s|j,t jk7rtd ||j/d t1j2||g|||||} |r-| j5t7j8dd{| S#t$rYt$r!} tj d|| Yd} ~ d} ~ wwxYw#t$rT} |j%| j&t&j(k(r!d|d } tt&j(| dd} ~ w|j%xYw7w) Nz*ssl argument must be an SSLContext or Nonerrrr)rz2Unable to check or remove stale UNIX socket %r: %rzAddress z is already in usez-path was not specified, and no sock specifiedrF)rfboolrFr#r!rrrrstatS_ISSOCKst_moderemoveFileNotFoundErrorrMrerrorbindr1rS EADDRINUSErrrrServer_start_servingr sleep) r+rrrrrrrrerrrWmsgservers rcreate_unix_serverz)_UnixSelectorEventLoop.create_unix_servers7 c4 HI I ,SCE E +CBD D   IKK99T?D==1C1CDDAwk)6}}RWWT]%:%:; $  $| CEE v~~-II!3!33 DTHMOO ##D4&2B$'2G$8:   ! ! #++a.  S)6LL"*+/666  99 0 00%TH,>?C!%"2"2C8dB  & !siBIAF'"G3B-I I!I' G0I2G:GIGI I 'AH66I  Ic K tj |j } tj|j}|r|n|}|sy|j} |j| d|||||d| d{S#t$rtjdwxYw#tt jf$r}tjdd}~wwxYw#t$rtjdwxYw7~w)Nzos.sendfile() is not availableznot a regular filer) r!sendfileAttributeErrorr SendfileNotAvailableErrorrLioUnsupportedOperationfstatst_sizerMr{_sock_sendfile_native_impl) r+rfileoffsetcountrLrfsize blocksizefuts r_sock_sendfile_nativez,_UnixSelectorEventLoop._sock_sendfile_nativebs 2 KK M[[]F MHHV$,,E#E   " ''T4(.y! Ey% 26602 2 2  7 78 M667KL L M M667KL L MsVC<BB"C6C<;C:<C<BC<"C;CCC<C77C<c |j} ||j||jr|j|||y|r/||z }|dkr%|j||||j |y t j | |||} | dk(r%|j||||j |y|| z }|| z }||j|||j| |j|| |||||| y#ttf$r;||j|||j| |j|| |||||| Yyt$r} |Q| jtjk(r4t| t ur#t!dtj} | | _| } |dk(r:t%j&d} |j||||j)| n)|j||||j)| Yd} ~ yYd} ~ yd} ~ wt*t,f$rt.$r.} |j||||j)| Yd} ~ yd} ~ wwxYw)Nrzsocket is not connectedzos.sendfile call failed)rL remove_writer cancelled_sock_sendfile_update_filepos set_resultr!r_sock_add_cancellation_callback add_writerrBlockingIOErrorInterruptedErrorrMrSENOTCONNrConnectionError __cause__r r set_exceptionrrr)r+r registered_fdrrLrrr total_sentfdsentrWnew_excrs rrz1_UnixSelectorEventLoop._sock_sendfile_native_implysT [[]  $   } - ==?  . .vvz J   *IA~2266:Nz*1 F;;r669=DJqy2266:Nz*$d"  (88dCD$C$CS "D& &y*F[ !12 B$44S$? OOB ? ?f"E9j B ')II/I_4 *-u~~?$'!Q !::-/2266:N!!#&2266:N!!#&&'-.   #  . .vvz J   c " " #s,:C??AIIB6HI+$IIcZ|dkDr&tj||tjyyNr)r!lseekSEEK_SET)r+rLrrs rrz4_UnixSelectorEventLoop._sock_sendfile_update_fileposs" > HHVVR[[ 1 rc6fd}|j|y)Ncv|jr(j}|dk7rj|yyy)Nr@)rrLr)rrr+rs rcbzB_UnixSelectorEventLoop._sock_add_cancellation_callback..cbs6}}[[]8&&r*r)add_done_callback)r+rrrs` ` rrz6_UnixSelectorEventLoop._sock_add_cancellation_callbacks + b!rr NN)__name__ __module__ __qualname____doc__r)r1r>rZr<r5rGrprsrrrrrrrr __classcell__r-s@rr&r&9s # .(+Z2@ =@D(,KAE)-L 04BF*.0#4 "&!% 0#f*.Gs"&!% GR.DFL2"rr&ceZdZdZdfd ZdZdZdZdZdZ dZ d Z d Z d Z d Zej fd ZddZdZdZxZS)rjic4t||||jd<||_||_|j |_||_d|_d|_ tj|j j}tj|sJtj|s5tj |s d|_d|_d|_t#dtj$|j d|jj'|jj(||jj'|j*|j |j,|,|jj't.j0|dyy)NrlFz)Pipe transport is for pipes/sockets only.)r(r)_extra_loop_piperL_fileno _protocol_closing_pausedr!rrrS_ISFIFOrS_ISCHRr# set_blocking call_soonconnection_made _add_reader _read_readyr _set_result_unless_cancelled)r+looprlrmrnromoder-s rr)z_UnixReadPipeTransport.__init__s. " F  {{} !  xx %-- d# d# T"DJDL!DNHI I  e, T^^;;TB T--!\\4+;+; =   JJ !E!E!' / rc^|jsy|jj||yr ) is_readingrr)r+rrUs rrz"_UnixReadPipeTransport._add_readers#  r8,rc:|j xr |j Sr )rrr+s rrz!_UnixReadPipeTransport.is_readings<<5 $55rct|jjg}|j|jdn|jr|jd|jd|j t |jdd}|jW|Utj||j tj}|r|jdnA|jdn/|j|jdn|jddjd j|S) Nclosedclosingfd= _selectorpollingidleopen<{}> )r-rrappendrrgetattrrr _test_selector_event selectors EVENT_READformatjoin)r+rRr,r s r__repr__z_UnixReadPipeTransport.__repr__s''( ::  KK ! ]] KK " c$,,()4::{D9 :: !h&:%::$,, (<(<>G I& F# ZZ # KK  KK !}}SXXd^,,rch tj|j|j}|r|jj |y|j jrtjd|d|_ |j j|j|j j|jj|j j|jdy#tt f$rYyt"$r}|j%|dYd}~yd}~wwxYw)N%r was closed by peerTz"Fatal read error on pipe transport)r!readrmax_sizer data_receivedr get_debugrrRr_remove_readerr eof_received_call_connection_lostrrrM _fatal_error)r+r=rWs rrz"_UnixReadPipeTransport._read_ready s G774<<7D ,,T2::'')KK 7> $  ))$,,7 $$T^^%@%@A $$T%?%?F !12   I   c#G H H Is*C<<D1 D1D,,D1c|jsyd|_|jj|j|jj rt jd|yy)NTz%r pauses reading)rrrrrrrdebugrs r pause_readingz$_UnixReadPipeTransport.pause_readingsP   !!$,,/ ::   ! LL,d 3 "rc|js |jsyd|_|jj|j|j |jj rtjd|yy)NFz%r resumes reading) rrrrrrrrr#rs rresume_readingz%_UnixReadPipeTransport.resume_reading%s[ ==   t||T-=-=> ::   ! LL-t 4 "rc||_yr rr+rms r set_protocolz#_UnixReadPipeTransport.set_protocol- !rc|jSr r(rs r get_protocolz#_UnixReadPipeTransport.get_protocol0 ~~rc|jSr rrs r is_closingz!_UnixReadPipeTransport.is_closing3 }}rc@|js|jdyyr )r_closers rr1z_UnixReadPipeTransport.close6s}} KK rcv|j-|d|t||jjyyNzunclosed transport r/rr8r1r+_warns r__del__z_UnixReadPipeTransport.__del__:5 :: ! 'x0/$ O JJ    "rc<t|trQ|jtjk(r4|jj rDt jd||dn*|jj||||jd|j|yNz%r: %sTexc_info)message exceptionrrm) rfrMrSEIOrrrr#call_exception_handlerrr4r+rWr@s rr!z#_UnixReadPipeTransport._fatal_error?sr sG $eii)?zz##% XtWtD JJ - -" ! NN /  Crcd|_|jj|j|jj |j |yNT)rrrrrr r+rWs rr4z_UnixReadPipeTransport._closeMs9  !!$,,/ T77=rc |jj||jjd|_d|_d|_y#|jjd|_d|_d|_wxYwr rconnection_lostrr1rrGs rr z,_UnixReadPipeTransport._call_connection_lostRg  NN * *3 / JJ   DJ!DNDJ JJ   DJ!DNDJ A 1A>rzFatal error on pipe transport)rrrrr)rrrrr$r&r*r-r1r1r6r7r:r!r4r rrs@rrjrjs]H/<- 6-*G$45"%MM > rrjceZdZdfd ZdZdZdZdZdZdZ dZ d Z d Z d Z d Zej fd ZdZddZddZdZxZS)rrct |||||jd<||_|j |_||_t|_d|_ d|_ tj|j j}tj|}tj |}tj"|} |s$|s"| s d|_d|_d|_t%dtj&|j d|j(j+|j j,|| s!|rdt.j0j3dsE|j(j+|j(j4|j |j6|,|j(j+t8j:|dyy)NrlrFz?Pipe transport is only for pipes, sockets and character devicesaix)r(r)rrrLrr bytearray_buffer _conn_lostrr!rrrrrrr#rrrrr2platform startswithrrr r) r+rrlrmrnroris_charis_fifo is_socketr-s rr)z _UnixWritePipeTransport.__init___si %" F {{} ! {  xx %--,,t$--%MM$' 7iDJDL!DNDE E  e, T^^;;TB )@)@)G JJ !7!7!%t/?/? A   JJ !E!E!' / rc|jjg}|j|jdn|jr|jd|jd|j t |jdd}|j{|ytj||j tj}|r|jdn|jd|j}|jd|n/|j|jdn|jdd jd j|S) Nrrr r r r zbufsize=r rr)r-rrrrrrrr rr EVENT_WRITEget_write_buffer_sizerr)r+rRr,r rs rrz _UnixWritePipeTransport.__repr__s ''( ::  KK ! ]] KK " c$,,()4::{D9 :: !h&:%::$,, (=(=?G I& F#002G KK(7), - ZZ # KK  KK !}}SXXd^,,rc,t|jSr )lenrRrs rr[z-_UnixWritePipeTransport.get_write_buffer_sizes4<<  rc|jjrtjd||jr|j t y|j y)Nr)rrrrRrRr4BrokenPipeErrorrs rrz#_UnixWritePipeTransport._read_readys@ ::   ! KK/ 6 << KK) * KKMrcZt|tttfsJt |t|tr t|}|sy|j s |j rH|j tjk\rtjd|xj dz c_y|jss tj|j|}|t+|k(ry|dkDrt||d}|j,j/|j|j0|xj|z c_ |j3y#tt f$rd}Yt"t$f$rt&$r1}|xj dz c_|j)|dYd}~yd}~wwxYw)Nz=pipe closed by peer or os.write(pipe, data) raised exception.rr#Fatal write error on pipe transport)rfbytesrQ memoryviewreprrSrr!LOG_THRESHOLD_FOR_CONNLOST_WRITESrwarningrRr!writerrrrrrr!r]r _add_writer _write_ready_maybe_pause_protocol)r+r=nrWs rrgz_UnixWritePipeTransport.writesW$ : >?KdK? dI &d#D  ??dmm)"M"MM HI OOq O || HHT\\40CI~Q!$'+ JJ " "4<<1B1B C   ""$$%56  12   1$!!#'LM s7 EF*"F*9'F%%F*c4|jsJd tj|j|j}|t |jk(r|jj |j j|j|j|jr6|j j|j|jdy|dkDr|jd|=yy#ttf$rYyttf$rt $rp}|jj |xj"dz c_|j j|j|j%|dYd}~yd}~wwxYw)NzData should not be emptyrrra)rRr!rgrr]r9r_remove_writer_maybe_resume_protocolrrr rrrrrrSr!)r+rkrWs rriz$_UnixWritePipeTransport._write_readys@||777| %t||4AC %% ""$ ))$,,7++-==JJ--dll;..t4QLL!$) !12  -.   J LL   OOq O JJ % %dll 3   c#H I I  Js*C??FF'A&FFcyrFrrs r can_write_eofz%_UnixWritePipeTransport.can_write_eofrc|jry|jsJd|_|jsL|jj |j |jj |jdyyrF)rrrRrrrrr rs r write_eofz!_UnixWritePipeTransport.write_eofs[ == zzz || JJ % %dll 3 JJ !;!;T Brc||_yr r(r)s rr*z$_UnixWritePipeTransport.set_protocolr+rc|jSr r(rs rr-z$_UnixWritePipeTransport.get_protocolr.rc|jSr r0rs rr1z"_UnixWritePipeTransport.is_closingr2rcX|j|js|jyyyr )rrrsrs rr1z_UnixWritePipeTransport.closes$ :: !$-- NN +8 !rcv|j-|d|t||jjyyr6r7r8s rr:z_UnixWritePipeTransport.__del__r;rc&|jdyr )r4rs rabortz_UnixWritePipeTransport.aborts Drct|tr4|jjrDt j d||dn*|jj ||||jd|j|yr=) rfrMrrrr#rCrr4rDs rr!z$_UnixWritePipeTransport._fatal_error sc c7 #zz##% XtWtD JJ - -" ! NN /  Crc>d|_|jr%|jj|j|jj |jj |j|jj|j|yrF) rrRrrmrr9rrr rGs rr4z_UnixWritePipeTransport._closesf << JJ % %dll 3  !!$,,/ T77=rc |jj||jjd|_d|_d|_y#|jjd|_d|_d|_wxYwr rIrGs rr z-_UnixWritePipeTransport._call_connection_lostrKrLrrMr )rrrr)rr[rrgrirprsr*r-r1r1r6r7r:rzr!r4r rrs@rrrrr\sd#/J-0!!%F%8C" %MM  >rrrceZdZdZy)r|c d}|tjk(r6tjj drt j \}} tj|f||||d|d||_|=|jt|jd||j_ d}|!|j|jyy#|!|j|jwwxYw)NrPF)rrrruniversal_newlinesrwb) buffering) subprocessPIPEr2rTrUr socketpairPopen_procr1r detachr) r+rVrrrrrrstdin_ws r_startz_UnixSubprocessTransport._start+s JOO # (?(?(F $..0NE7 #))E!vf#('E=CEDJ" #'(8$'#R  "  #w"  #s A!C%C7N)rrrrrrrr|r|)s rr|cBeZdZdZd dZdZdZdZdZdZ d Z d Z y) raHAbstract base class for monitoring child processes. Objects derived from this class monitor a collection of subprocesses and report their termination or interruption by a signal. New callbacks are registered with .add_child_handler(). Starting a new process must be done within a 'with' block to allow the watcher to suspend its activity until the new process if fully registered (this is needed to prevent a race condition in some implementations). Example: with watcher: proc = subprocess.Popen("sleep 1") watcher.add_child_handler(proc.pid, callback) Notes: Implementations of this class must be thread-safe. Since child watcher objects may catch the SIGCHLD signal and call waitpid(-1), there should be only one active object per process. Nc\|jtk7rtjdddyy)NrP{name!r} is deprecated as of Python 3.12 and will be removed in Python {remove}.r)rrr6 _deprecated)clss r__init_subclass__z&AbstractChildWatcher.__init_subclass__Xs, >>X %  !7;%, . &rct)aRegister a new child handler. Arrange for callback(pid, returncode, *args) to be called when process 'pid' terminates. Specifying another callback for the same process replaces the previous handler. Note: callback() must be thread-safe. NotImplementedErrorr+rrUrVs rr}z&AbstractChildWatcher.add_child_handler_s "##rct)zRemoves the handler for process 'pid'. The function returns True if the handler was successfully removed, False if there was nothing to remove.rr+rs rremove_child_handlerz)AbstractChildWatcher.remove_child_handlerjs "##rct)zAttach the watcher to an event loop. If the watcher was previously attached to an event loop, then it is first detached before attaching to the new loop. Note: loop may be None. rr+rs r attach_loopz AbstractChildWatcher.attach_looprs "##rct)zlClose the watcher. This must be called to make sure that any underlying resource is freed. rrs rr1zAbstractChildWatcher.close|s "##rct)zReturn ``True`` if the watcher is active and is used by the event loop. Return True if the watcher is installed and ready to handle process exit notifications. rrs rrzzAbstractChildWatcher.is_actives "##rct)zdEnter the watcher's context and allow starting new processes This function must return selfrrs r __enter__zAbstractChildWatcher.__enter__s "##rct)zExit the watcher's contextrr+abcs r__exit__zAbstractChildWatcher.__exit__s !##r)returnN) rrrrrr}rrr1rzrrrrrrrAs/,. $$$$$$ $rrc@eZdZdZdZdZdZdZdZdZ dZ d Z y ) ra6Child watcher implementation using Linux's pid file descriptors. This child watcher polls process file descriptors (pidfds) to await child process termination. In some respects, PidfdChildWatcher is a "Goldilocks" child watcher implementation. It doesn't require signals or threads, doesn't interfere with any processes launched outside the event loop, and scales linearly with the number of subprocesses launched by the event loop. The main disadvantage is that pidfds are specific to Linux, and only work on recent (5.3+) kernels. c|Sr rrs rrzPidfdChildWatcher.__enter__ rcyr r)r+exc_type exc_value exc_tracebacks rrzPidfdChildWatcher.__exit__ rcyrFrrs rrzzPidfdChildWatcher.is_activerqrcyr rrs rr1zPidfdChildWatcher.closerrcyr rrs rrzPidfdChildWatcher.attach_looprrctj}tj|}|j ||j ||||yr )rget_running_loopr! pidfd_openr_do_wait)r+rrUrVrpidfds rr}z#PidfdChildWatcher.add_child_handlers:&&( c"  sE8TJrc$tj}|j| tj|d\}}t |}tj||||g|y#t $rd}tjd|YCwxYw)NrzJchild process pid %d exit status already read: will report returncode 255) rrrr!waitpidr"ChildProcessErrorrrfr1) r+rrrUrVr_r$rs rrzPidfdChildWatcher._do_waits&&( E" 8 3*IAv07J j(4(! J NN.   sA++!BBcyrFrrs rrz&PidfdChildWatcher.remove_child_handlerrN) rrrrrrrzr1rr}rrrrrrrs0    K )&rrc6eZdZdZdZdZdZdZdZdZ y) BaseChildWatcherc d|_i|_yr )r _callbacksrs rr)zBaseChildWatcher.__init__s rc&|jdyr )rrs rr1zBaseChildWatcher.closes rcV|jduxr|jjSr )r is_runningrs rrzzBaseChildWatcher.is_actives#zz%A$***?*?*AArctr r)r+ expected_pids r _do_waitpidzBaseChildWatcher._do_waitpid !##rctr rrs r_do_waitpid_allz BaseChildWatcher._do_waitpid_allrrc|t|tjsJ|j(|&|jrt j dt|j)|jjtj||_|;|jtj|j|jyy)NzCA loop is being detached from a child watcher with pending handlers)rfrAbstractEventLooprrr6r7RuntimeWarningr5rISIGCHLDrZ _sig_chldrrs rrzBaseChildWatcher.attach_loops|z$0H0HIII :: !dlt MM= :: ! JJ , ,V^^ <    # #FNNDNN C  " rc |jy#ttf$rt$r(}|jj d|dYd}~yd}~wwxYw)N$Unknown exception in SIGCHLD handler)r@rA)rrrrrrCrGs rrzBaseChildWatcher._sig_chldsX   "-.    JJ - -A /    sAAAN) rrrr)r1rzrrrrrrrrrs&B$$#( rrcPeZdZdZfdZfdZdZdZdZdZ dZ d Z xZ S) rad'Safe' child watcher implementation. This implementation avoids disrupting other code spawning processes by polling explicitly each process in the SIGCHLD handler instead of calling os.waitpid(-1). This is a safe solution but it has a significant overhead when handling a big number of children (O(n) each time SIGCHLD is raised) cRt|tjdddy)Nrrrr)r(r)r6rr+r-s rr)zSafeChildWatcher.__init__s' /;%, .rcV|jjt| yr )rr9r(r1rs rr1zSafeChildWatcher.closes   rc|Sr rrs rrzSafeChildWatcher.__enter__rrcyr rrs rrzSafeChildWatcher.__exit__rrcH||f|j|<|j|yr )rrrs rr}z"SafeChildWatcher.add_child_handler"s% ($/ rc> |j|=y#t$rYywxYwNTFrr`rs rrz%SafeChildWatcher.remove_child_handler(( $    cZt|jD]}|j|yr r4rrrs rrz SafeChildWatcher._do_waitpid_all/s#(C   S !)rc|dkDsJ tj|tj\}}|dk(ryt|}|jj rt jd|| |jj|\}}|||g|y#t$r|}d}t jd|YOwxYw#t$r7|jj rt jd|dYyYywxYw)Nr$process %s exited with returncode %sr8Unknown child process pid %d, will report returncode 255'Child watcher got an unexpected pid: %rTr>) r!rWNOHANGr"rrrr#rrfrpopr`)r+rrr$rrUrVs rrzSafeChildWatcher._do_waitpid4sa 7**\2::>KCax/7Jzz##% C):7 -!__005NHd S* ,t ,7! CJ NNJ   ( 3zz##%H"T3& 3s#'B4C#CC;DD) rrrrr)r1rrr}rrrrrs@rrrs0.  " -rrcJeZdZdZfdZfdZdZdZdZdZ dZ xZ S) raW'Fast' child watcher implementation. This implementation reaps every terminated processes by calling os.waitpid(-1) directly, possibly breaking other code spawning processes and waiting for their termination. There is no noticeable overhead when handling a big number of children (O(1) each time a child terminates). ct|tj|_i|_d|_tjdddy)Nrrrrr) r(r) threadingLock_lock_zombies_forksr6rrs rr)zFastChildWatcher.__init__asC ^^%   /;%, .rc|jj|jjt|yr )rr9rr(r1rs rr1zFastChildWatcher.closeks,    rct|j5|xjdz c_|cdddS#1swYyxYw)Nr)rrrs rrzFastChildWatcher.__enter__ps$ ZZ KK1 KZZs.7c>|j5|xjdzc_|js |js dddyt|j}|jj dddt j dy#1swY xYw)Nrz5Caught subprocesses termination from unknown pids: %s)rrrrOr9rrf)r+rrrcollateral_victimss rrzFastChildWatcher.__exit__vsp ZZ KK1 K{{$-- Z "%T]]!3  MM   !  C  Zs/B/BBc |jsJd|j5 |jj|} ddd||g|y#t$r||f|j |<YdddywxYw#1swY |j|=y#t$rYywxYwrrrs rrz%FastChildWatcher.remove_child_handlerrrc tjdtj\}}|dk(ryt|}|j 5 |j j|\}}|jjrtjd|| dddtjd||n |||g#t$rYywxYw#t$r\|jrK||j|<|jjrtjd||Yddd4d}YwxYw#1swYxYw)Nr@rrz,unknown process %s exited with returncode %sz8Caught subprocess termination from unknown pid: %d -> %d)r!rrr"rrrrrrrr#r`rrrf)r+rr$rrUrVs rrz FastChildWatcher._do_waitpid_alls8 < jjRZZ8 V !83F; 6%)__%8%8%=NHdzz++- %K%(*6!& #Z1j040K%   ${{-7 c*:://1"LL*>),j:! $H $sN'CD= C'2D= CCAD:*D=5D:7D=9D::D==E) rrrrr)r1rrr}rrrrs@rrrWs+.    )(1rrcReZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zy )ra~A watcher that doesn't require running loop in the main thread. This implementation registers a SIGCHLD signal handler on instantiation (which may conflict with other code that install own handler for this signal). The solution is safe but it has a significant overhead when handling a big number of processes (*O(n)* each time a SIGCHLD is received). cPi|_d|_tjdddy)Nrrrr)r_saved_sighandlerr6rrs rr)zMultiLoopChildWatcher.__init__s*!%4;%, .rc|jduSr )rrs rrzzMultiLoopChildWatcher.is_actives%%T11rcZ|jj|jytjtj }||j k7rtjdd|_ytjtj |jd|_y)Nz+SIGCHLD handler was changed by outside code) rr9rrI getsignalrrrrf)r+rds rr1zMultiLoopChildWatcher.closesz   ! ! ) ""6>>2 dnn $ NNH I"& MM&..$*@*@ A!%rc|Sr rrs rrzMultiLoopChildWatcher.__enter__rrcyr rr+rexc_valexc_tbs rrzMultiLoopChildWatcher.__exit__rrcrtj}|||f|j|<|j|yr )rrrr)r+rrUrVrs rr}z'MultiLoopChildWatcher.add_child_handlers5&&( $h5 rc> |j|=y#t$rYywxYwrrrs rrz*MultiLoopChildWatcher.remove_child_handlerrrc8|jytjtj|j|_|j*t j dtj |_tjtjdy)NzaPrevious SIGCHLD handler was set by non-Python code, restore to default handler on watcher close.F)rrIrrrrfrcrQrs rrz!MultiLoopChildWatcher.attach_loopso  ! ! - !'v~~t~~!N  ! ! ) NNJ K%+^^D " FNNE2rcZt|jD]}|j|yr rrs rrz%MultiLoopChildWatcher._do_waitpid_alls#(C   S !)rc8|dkDsJ tj|tj\}}|dk(ryt|}d} |jj|\}}}|jrt j d||y|r'|jrt jd|||j|||g|y#t$r|}d}t j d|d}YwxYw#t$rt j d|d YywxYw) NrTrrF%Loop %r that handles pid %r is closedrrr>)r!rrr"rrrfrr is_closedrr#rr`) r+rrr$r debug_logrrUrVs rrz!MultiLoopChildWatcher._do_waitpidsa **\2::>KCax/7JI L#'??#6#6s#; D(D~~FcR!1LL!G!-z;)))(CKdK=! CJ NNJ I $ / NND / /s#'C C5 %C21C25!DDc |jy#ttf$rt$rt j ddYywxYw)NrTr>)rrrrrrf)r+rrs rrzMultiLoopChildWatcher._sig_chld<sE R  "-.   R NNAD Q Rs/AAN)rrrrr)rzr1rrr}rrrrrrrrrrsA $.2 & 3""#LJRrrcdeZdZdZdZdZdZdZdZe jfdZ dZ d Z d Zd Zy ) raAThreaded child watcher implementation. The watcher uses a thread per process for waiting for the process finish. It doesn't require subscription on POSIX signal but a thread creation is not free. The watcher has O(1) complexity, its performance doesn't depend on amount of spawn processes. cFtjd|_i|_yr) itertoolsr _pid_counter_threadsrs rr)zThreadedChildWatcher.__init__Rs%OOA. rcyrFrrs rrzzThreadedChildWatcher.is_activeVrqrcyr rrs rr1zThreadedChildWatcher.closeYrrc|Sr rrs rrzThreadedChildWatcher.__enter__\rrcyr rrs rrzThreadedChildWatcher.__exit___rrct|jjDcgc]}|jr|}}|r||jdt |yycc}w)Nz0 has registered but not finished child processesr/)r4rvaluesis_aliver-r8)r+r9threadthreadss rr:zThreadedChildWatcher.__del__bse(,T]]-A-A-C(D)(Dfoo'(D)  T^^$$TU!  )sA!ctj}tj|jdt |j ||||fd}||j|<|jy)Nzasyncio-waitpid-T)targetnamerVdaemon) rrrThreadrnextrrstart)r+rrUrVrrs rr}z&ThreadedChildWatcher.add_child_handlerjsf&&(!!)9)9)9$t?P?P:Q9R'S(,c8T'B)-/$ c rcyrFrrs rrz)ThreadedChildWatcher.remove_child_handlersrrcyr rrs rrz ThreadedChildWatcher.attach_loopyrrc|dkDsJ tj|d\}}t|}|jrt j d|| |jrt jd||n|j|||g||jj|y#t $r|}d}t jd|Y~wxYw)Nrrrrr) r!rr"rrr#rrfrrrr)r+rrrUrVrr$rs rrz ThreadedChildWatcher._do_waitpid|sa 7**\15KC07J~~ C):7 >>  NNBD# N %D % %hZ G$ G ,''! CJ NNJ   sB..#CCN)rrrrr)rzr1rrr6r7r:r}rrrrrrrrEsB   %MM  (rrcttdsy tj}tjtj|dy#t $rYywxYw)NrFrT)hasattrr!getpidr1rrM)rs r can_use_pidfdr&sO 2| $iik sA&'  s=A AAcBeZdZdZeZfdZdZfdZdZ dZ xZ S)_UnixDefaultEventLoopPolicyz:UNIX event loop policy with a watcher for child processes.c0t|d|_yr )r(r)_watcherrs rr)z$_UnixDefaultEventLoopPolicy.__init__s  rctj5|j)trt |_nt |_dddy#1swYyxYwr )rrr*r&rrrs r _init_watcherz)_UnixDefaultEventLoopPolicy._init_watchers6 \\}}$ ?$5$7DM$8$:DM \\s 6AAct|||jEtjtj ur|jj |yyy)zSet the event loop. As a side effect, if a child watcher was set before, then calling .set_event_loop() from the main thread will call .attach_loop(loop) on the child watcher. N)r(set_event_loopr*rcurrent_thread main_threadr)r+rr-s rr.z*_UnixDefaultEventLoopPolicy.set_event_loopsS t$ MM %((*i.C.C.EE MM % %d +F &rc|j|jtjddd|jS)z~Get the watcher for child processes. If not yet set, a ThreadedChildWatcher object is automatically created. ryrrr)r*r,r6rrs rryz-_UnixDefaultEventLoopPolicy.get_child_watchers@ ==    0:BI K}}rc|t|tsJ|j|jj||_t j dddy)z$Set the watcher for child processes.Nset_child_watcherrrr)rfrr*r1r6r)r+rs rr3z-_UnixDefaultEventLoopPolicy.set_child_watchersT*W6J"KKK == $ MM   ! 0:BI Kr) rrrrr& _loop_factoryr)r,r.ryr3rrs@rr(r(s%D*M; ,  Krr()4rrSrr r!rrIrrrr2rr6rrrrrr r r r r logr__all__rT ImportErrorrr"BaseSelectorEventLoopr& ReadTransportrj_FlowControlMixinWriteTransportrrBaseSubprocessTransportr|rrrrrrrr&BaseDefaultEventLoopPolicyr(rrrrrr?se8     <<7 C DD P"_BBP"f MZ55M`Jj::(77JZ FF 0S$S$l7,7t2+2jN-'N-bj1'j1Z~R0~RBO(/O(b 6K&"C"C6Kr+4r__pycache__/base_futures.cpython-312.pyc000064400000006020152527367570014167 0ustar00 {|jhdZddlZddlmZdZdZdZdZd Zd Z ejd Z y) N)format_helpersPENDING CANCELLEDFINISHEDcNt|jdxr|jduS)zCheck for a Future. This returns True when obj is a Future instance or is advertising itself as duck-type compatible by setting _asyncio_future_blocking. See comment in Future for more details. _asyncio_future_blockingN)hasattr __class__r )objs -/usr/lib64/python3.12/asyncio/base_futures.pyisfuturer s+ CMM#= > 5  ( ( 46c t|}|sd}d}|dk(r||dd}nc|dk(r+dj||dd||dd}n3|dkDr.dj||dd|dz ||dd}d |d S) #helper function for Future.__repr__c.tj|dS)Nr)r_format_callback_source)callbacks r format_cbz$_format_callbacks..format_cbs55hCCrrrz{}, {}z{}, <{} more>, {}zcb=[])lenformat)cbsizers r_format_callbacksrs r7D  D qy r!uQx   __Yr!uQx0)BqE!H2E F  ' ' "Q%((;(,q(1"R&)(<>"Q<rc|jjg}|jtk(r^|j|j d|jn3t j |j}|j d||jr$|j t|j|jr,|jd}|j d|dd|d|S)rz exception=zresult=rz created at r:r) _statelower _FINISHED _exceptionappendreprlibrepr_result _callbacksr_source_traceback)futureinforesultframes r_future_repr_infor0,s MM   ! "D }} !    ( KK*V%6%6$9: ;\\&..1F KK'&* +  %f&7&789 ((, k%(1U1XJ78 Krcpdjt|}d|jjd|dS)N <>)joinr0r __name__)r,r-s r _future_reprr7@s8 88%f- .D v(()4& 22r) __all__r'rr_PENDING _CANCELLEDr$rrr0recursive_reprr7rrrr<sO     6((33r__pycache__/coroutines.cpython-312.opt-2.pyc000064400000007066152527367570014645 0ustar00 {|j dZddlZddlZddlZddlZddlZdZeZ dZ ejejjfZeZdZdZy))iscoroutinefunction iscoroutineNctjjxsEtjj xr(t t j jdS)NPYTHONASYNCIODEBUG)sysflagsdev_modeignore_environmentboolosenvironget+/usr/lib64/python3.12/asyncio/coroutines.py_is_debug_moder sF 99   Ncii&B&B"B#M"&rzz~~6J'K"LNrcX tj|xst|ddtuS)N _is_coroutine)inspectrgetattrr)funcs rrrs0@  ' ' - B D/4 0M ACrc t|tvryt|tr1t tdkrtj t|yy)NTdF)type_iscoroutine_typecache isinstance_COROUTINE_TYPESlenadd)objs rrr sH3 Cy**#'( % & , " & &tCy 1rcd}d}d}t|dr|jr |j}n$t|dr|jr |j}||}|s||r|dS|Sd}t|dr|jr |j}n$t|dr|jr |j}|j xsd}d }||j }|d |d |}|S|j}|d |d |}|S) Nct|dr|jr |j}n>t|dr|jr |j}ndt|jd}|dS)N __qualname____name__z())hasattrr#r$r)coro coro_names rget_namez#_format_coroutine..get_name3sc 4 (T->->))I T: &4== IDJ//00BCIBrct |jS#t$r  |jcYS#t$rYYywxYwwxYw)NF) cr_runningAttributeError gi_running)r's r is_runningz%_format_coroutine..is_runningAsA ?? "  &!   s  7 &7 3737cr_codegi_codez runninggi_framecr_framezrz running at :z done, defined at )r&r/r0r1r2 co_filenamef_linenoco_firstlineno) r'r)r. coro_coder( coro_framefilenamelineno coro_reprs r_format_coroutiner<0s  ItYDLLLL y !dllLL I  d [) ) JtZ T]]]] z "t}}]] $$=(=H F$$ khZqA )) k!3H:QvhG r)__all__collections.abc collectionsrr rtypesrobjectrr CoroutineTypeabc Coroutinersetrrr<rrrrFs] . N C'')B)BC  =r__pycache__/base_events.cpython-312.opt-1.pyc000064400000251165152527367570014751 0ustar00 {|j26dZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl Z ddl Z ddlZddlZddlZddlZ ddlZddlmZddlmZddlmZddlmZddlmZdd lmZdd lmZdd lmZdd lmZdd lmZddlmZddlm Z ddl!m"Z"dZ#dZ$dZ%e&e dZ'dZ(dZ)dZ*dZ+d&dZ,d'dZ-dZ.e&e drdZ/ndZ/dZ0Gd d!ejbZ2Gd"d#ejfZ4Gd$d%ejjZ6y#e$rdZYwxYw)(aBase implementation of event loop. The event loop can be broken up into a multiplexer (the part responsible for notifying us of I/O events) and the event loop proper, which wraps a multiplexer with functionality for scheduling callbacks, immediately or at a given time in the future. Whenever a public API takes a callback, subsequent positional arguments will be passed to the callback if/when it is called. This avoids the proliferation of trivial lambdas implementing closures. Keyword arguments for the callback are not supported; this is a conscious design decision, leaving the door open for keyword arguments to modify the meaning of the API call itself. N) constants) coroutines)events) exceptions)futures) protocols)sslproto) staggered)tasks)timeouts) transports)trsock)logger) BaseEventLoopServerdg?AF_INET6iQc|j}tt|ddtjrt |j St|S)N__self__) _callback isinstancegetattrr Taskreprrstr)handlecbs ,/usr/lib64/python3.12/asyncio/base_events.py_format_handler Gs=   B'"j$/<BKK  6{ch|tjk(ry|tjk(ryt|S)Nzz) subprocessPIPESTDOUTr)fds r _format_piper'Ps+ Z__ z  Bxr!cttds td |jtjtj dy#t $r tdwxYw)N SO_REUSEPORTz)reuse_port not supported by socket modulerzTreuse_port not supported by socket module, SO_REUSEPORT defined but not implemented.)hasattrsocket ValueError setsockopt SOL_SOCKETr)OSErrorsocks r_set_reuseportr2Ys` 6> *DEE J OOF--v/B/BA F JIJ J Js /A A"c Pttdsy|dtjtjhvs|y|tjk(rtj}n%|tj k(rtj}ny|d}n,>?? L v!!!"" "" """ | D% TS[ D# 42: t9D!!!~~  JJv 'h${{6" d{    R &R6??24T47,KKK4T4L88 ;:&  2   s*7 F;9F7FFF F%$F%ctj}|D]$}|d}||vrg||<||j|&t|j }g}|dkDr%|j |dd|dz |dd|dz =|j dt jjt j|D|S)z-Interleave list of addrinfo tuples by family.rrNc3$K|]}|| ywN).0as r z(_interleave_addrinfos..s! a ]  s) collections OrderedDictrBlistvaluesextend itertoolschain from_iterable zip_longest) addrinfosfirst_address_family_countaddrinfos_by_familyaddrrFaddrinfos_lists reordereds r_interleave_addrinfosrds&113a , ,*,  'F#**40  .5578OI!A%+,K-G!-KLM A > :Q >> ? ??00  ! !? 3  r!c|js'|j}t|ttfryt j |jyrP) cancelled exceptionr SystemExitKeyboardInterruptr _get_loopstop)futexcs r_run_until_complete_cbrnsB ==?mmo cJ(9: ;  c!r! TCP_NODELAYc4|jtjtjhvrl|jtj k(rN|j tjk(r0|jtjtjdyyyyNr) rFr+r@rrGr:rHr8r-ror0s r _set_nodelayrrsj KKFNNFOO< < V/// f000 OOF..0B0BA F10 =r!cyrPrQr0s rrrrrs r!c\t&t|tjr tdyy)Nz"Socket cannot be of type SSLSocket)sslr SSLSocketr>r0s r_check_ssl_socketrws' :dCMM:<==;r!cBeZdZdZdZdZdZdZdZdZ dZ d Z y ) _SendfileFallbackProtocolct|tjs td||_|j |_|j|_|j|_ |j|j||jr*|jjj|_yd|_y)Nz.transport should be _FlowControlMixin instance)rr_FlowControlMixinr> _transport get_protocol_proto is_reading_should_resume_reading_protocol_paused_should_resume_writing pause_reading set_protocol_loop create_future_write_ready_fut)selftransps r__init__z"_SendfileFallbackProtocol.__init__s&*">">?LM M ))+ &,&7&7&9#&,&=&=#D!  & &$(OO$9$9$G$G$ID !$(D !r!cK|jjr td|j}|y|d{y7w)NzConnection closed by peer)r| is_closingConnectionErrorr)rrls rdrainz_SendfileFallbackProtocol.drains< ?? % % '!"=> >## ;  s:AAActd)Nz?Invalid state: connection should have been established already. RuntimeError)r transports rconnection_madez)_SendfileFallbackProtocol.connection_madesNO Or!c|jB|%|jjtdn|jj||jj |y)NzConnection is closed by peer)r set_exceptionrr~connection_lost)rrms rrz)_SendfileFallbackProtocol.connection_losts[  ,{%%33#$BCE%%33C8 ##C(r!cp|jy|jjj|_yrP)rr|rrrs r pause_writingz'_SendfileFallbackProtocol.pause_writings,  ,  $ 5 5 C C Er!cb|jy|jjdd|_y)NF)r set_resultrs rresume_writingz(_SendfileFallbackProtocol.resume_writings-  (  ((/ $r!ctdNz'Invalid state: reading should be pausedr)rdatas r data_receivedz'_SendfileFallbackProtocol.data_receivedDEEr!ctdrrrs r eof_receivedz&_SendfileFallbackProtocol.eof_receivedrr!c<K|jj|j|jr|jj |j |j j |jr|jjyywrP) r|rr~rresume_readingrcancelrrrs rrestorez!_SendfileFallbackProtocol.restoress $$T[[1  & & OO * * ,  ,  ! ! ( ( *  & & KK & & ( 'sBBN) __name__ __module__ __qualname__rrrrrrrrrrQr!rryrys3 )O )F % FF )r!rycheZdZ ddZdZdZdZdZdZdZ d Z e d Z d Z d Zd ZdZy)rNc||_||_d|_g|_||_||_||_||_||_d|_ d|_ y)NrF) r_sockets _active_count_waiters_protocol_factory_backlog _ssl_context_ssl_handshake_timeout_ssl_shutdown_timeout_serving_serving_forever_fut)rloopsocketsprotocol_factory ssl_contextbacklogssl_handshake_timeoutssl_shutdown_timeouts rrzServer.__init__sU   !1 '&;#%9" $(!r!cPd|jjd|jdS)N) __class__rrrs r__repr__zServer.__repr__#s'4>>**+9T\\4DAFFr!c.|xjdz c_yrq)rrs r_attachzServer._attach&s ar!c|xjdzc_|jdk(r|j|jyyy)Nrr)rr_wakeuprs r_detachzServer._detach*s; a    "t}}'< LLN(= "r!c||j}d|_|D]$}|jr|jd&yrP)rdoner)rwaiterswaiters rrzServer._wakeup0s3-- F;;=!!$'r!c *|jryd|_|jD]p}|j|j|jj |j ||j||j|j|jry)NT) rrlistenrr_start_servingrrrr)rr1s rrzServer._start_serving7sp ==  MMD KK & JJ % %&&d.?.?dmmT%@%@** ,"r!c|jSrP)rrs rget_loopzServer.get_loopBs zzr!c|jSrP)rrs r is_servingzServer.is_servingEs }}r!cT|jytd|jDS)NrQc3FK|]}tj|ywrP)rTransportSocket)rRss rrTz!Server.sockets..LsF 1V++A. s!)rtuplers rrzServer.socketsHs$ == F FFFr!cP|j}|yd|_|D]}|jj|d|_|j;|jj s!|jj d|_|jdk(r|jyy)NFr) rr _stop_servingrrrrrr)rrr1s rclosez Server.closeNs-- ?  D JJ $ $T *  % % 1--224  % % , , .(,D %    " LLN #r!cjK|jtjdd{y7w)Nr)rr sleeprs r start_servingzServer.start_servingas% kk!ns )313cK|jtd|d|jtd|d|j|jj |_ |jd{ d|_y7 #t j$r1 |j|jd{7#xYwwxYw#d|_wxYww)Nzserver z, is already being awaited on serve_forever()z is closed) rrrrrrrCancelledErrorr wait_closedrs r serve_foreverzServer.serve_forevergs  $ $ 0$!MNP P ==  ;< < $(JJ$<$<$>! -++ + +)-D % ,((   &&(((  )-D %s`A&C)B8B9B>CBC #C?CCC CC  C CCcK|jy|jj}|jj||d{y7w)aWait until server is closed and all connections are dropped. - If the server is not closed, wait. - If it is closed, but there are still active connections, wait. Anyone waiting here will be unblocked once both conditions (server is closed and all connections have been dropped) have become true, in either order. Historical note: In 3.11 and before, this was broken, returning immediately if the server was already closed, even if there were still active connections. An attempted fix in 3.12.0 was still broken, returning immediately if the server was still open and there were no active connections. Hopefully in 3.12.1 we have it right. N)rrrrB)rrs rrzServer.wait_closed|s@* == ))+ V$ sAA A ArP)rrrrrrrrrrrpropertyrrrrrrQr!rrrs[>B )G  ( ,GG & -*r!rceZdZdZdZdZddddZdZdZd\ddd d Z d\d dddddd d dZ d]dZ d^dZ d^dZ d\dZdZdZdZdZdZdZdZd\dZdZdZdZdZdZd Zd!Zej>fd"Z d#Z!d$Z"dd%d&Z#dd%d'Z$dd%d(Z%d)Z&d*Z'd+Z(dd%d,Z)d-Z*d.Z+d/Z,d0d0d0d0d1d2Z-d_d3Z.d`d d4d5Z/d6Z0d7Z1d8Z2d\d9Z3 d^dd0d0d0dddddddd d: d;Z4 dad<Z5d`d d4d=Z6d>Z7d?Z8d dddd@dAZ9 d^d0d0d0ddddBdCZ:d0e;jxd0d0d1dDZ=dEZ> d^e;j~e;jddFdddddd dG dHZAddddIdJZBdKZCdLZDdMZEeFjeFjeFjd d d0ddddN dOZHeFjeFjeFjd d d0ddddN dPZIdQZJdRZKdSZLdTZMdUZNdVZOdWZPdXZQdYZRdZZSd[ZTy)brcd|_d|_d|_tj|_g|_d|_d|_d|_ tjdj|_ d|_|jt!j"d|_d|_d|_d|_d|_t/j0|_d|_d|_y)NrF monotonicg?)_timer_cancelled_count_closed _stoppingrUdeque_ready _scheduled_default_executor _internal_fds _thread_idtimeget_clock_info resolution_clock_resolution_exception_handler set_debugr_is_debug_modeslow_callback_duration_current_handle _task_factory"_coroutine_origin_tracking_enabled&_coroutine_origin_tracking_saved_depthweakrefWeakSet _asyncgens_asyncgens_shutdown_called_executor_shutdown_calledrs rrzBaseEventLoop.__init__s&'# !'') !%!%!4!4[!A!L!L"& z0023'*##!27/6:3"//+*/').&r!c d|jjd|jd|jd|j d S)Nrz running=z closed=z debug=r)rr is_running is_closed get_debugrs rrzBaseEventLoop.__repr__sP''( $//2C1DEnn&'wt~~/?.@ C r!c.tj|S)z,Create a Future object attached to the loop.r)rFuturers rrzBaseEventLoop.create_futures~~4((r!N)namecontextc2|j|j3tj||||}|jrM|jd=n?||j||}n|j|||}tj || |~S#~wxYw)zDSchedule a coroutine object. Return a task object. )rrr r ) _check_closedrr r_source_traceback_set_task_name)rcororr tasks r create_taskzBaseEventLoop.create_tasks     %::dD'JD%%**2.))$5))$g)F  t , s BBcB|t|s td||_y)awSet a task factory that will be used by loop.create_task(). If factory is None the default task factory will be set. If factory is a callable, it should have a signature matching '(loop, coro)', where 'loop' will be a reference to the active event loop, 'coro' will be a coroutine object. The callable must return a Future. Nz'task factory must be a callable or None)callabler>r)rfactorys rset_task_factoryzBaseEventLoop.set_task_factorys%  x'8EF F$r!c|jS)z3B#4B>7B)=B%>B) B> B'B>D #B>%B)'B>)B;/B2 0B;7B>>ADD DD cZ |jjd|js"|jtj |dyy#t $rP}|js6|js!|j|j|Yd}~yYd}~yYd}~yd}~wwxYw)NTrd) rrnrrDr_set_result_unless_cancelledrYrfr)rroexs rrhzBaseEventLoop._do_shutdownfs D  " " + + + 6>>#))'*N*N*0$8$ D>>#F,<,<,>))&*>*>CC-?# DsA A B* ?? CD D  # # % 1IK K 2r!c|j|j|j|jt j } t j|_t j|j|jtj| |j|jrn d|_d|_tjd|jdt j|y#d|_d|_tjd|jdt j|wxYw)zRun until stop() is called.) firstiter finalizerFN)r rw_set_coroutine_origin_tracking_debugsysget_asyncgen_hooksrf get_identrset_asyncgen_hooksrPrHr_set_running_loop _run_oncer)rold_agen_hookss r run_foreverzBaseEventLoop.run_foreverws   ++DKK8//1 4'113DO  " "T-J-J-1-J-J L  $ $T * >>"DN"DO  $ $T *  / / 6  " "N 3 #DN"DO  $ $T *  / / 6  " "N 3sA8DAEc |j|jtj| }t j ||}|rd|_|jt |j |jt|js td|jS#|r0|jr |js|jxYw#|jtwxYw)a\Run until the Future is done. If the argument is a coroutine, it is wrapped in a Task. WARNING: It would be disastrous to call run_until_complete() with the same coroutine twice -- it would wrap it in two different Tasks and that can't be good. Return the Future's result, or raise its exception. rFz+Event loop stopped before Future completed.)r rwrisfuturer ensure_future_log_destroy_pendingadd_done_callbackrnrrrfrgremove_done_callbackrr^)rronew_tasks rrun_until_completez BaseEventLoop.run_until_completes  ''//$$V$7 +0F '  !78 @      ' '(> ?{{}LM M}} FKKM&2B2B2D  "   ' '(> ?s-B>>5C33C66D cd|_y)zStop running the event loop. Every callback already scheduled will still run. This simply informs run_forever to stop looping after a complete iteration. TN)rrs rrkzBaseEventLoop.stops r!cl|jr td|jry|jrt j d|d|_|j j|jjd|_ |j}|d|_ |jdyy)zClose the event loop. This clears the queues and shuts down the executor, but does not wait for the executor to finish. The event loop must not be running. z!Cannot close a running event loopNzClose %rTFrd) rrrr|rdebugrrVrrrrnrexecutors rrzBaseEventLoop.closes ?? BC C <<  ;; LLT *   )-&))  %)D "   5  ) r!c|jS)z*Returns True if the event loop was closed.)rrs rrzBaseEventLoop.is_closeds ||r!c|js4|d|t||js|jyyy)Nzunclosed event loop rJ)rrNrr)r_warns r__del__zBaseEventLoop.__del__s=~~ (1?4 P??$ % r!c|jduS)z*Returns True if the event loop is running.N)rrs rrzBaseEventLoop.is_runningst+,r!c*tjS)zReturn the time according to the event loop's clock. This is a float expressed in seconds since an epoch, but the epoch, precision, accuracy and drift are unspecified and may differ per event loop. )rrrs rrzBaseEventLoop.times~~r!r c| td|j|j|z|g|d|i}|jr |jd=|S)a;Arrange for a callback to be called at a given time. Return a Handle: an opaque object with a cancel() method that can be used to cancel the call. The delay can be an int or float, expressed in seconds. It is always relative to the current time. Each callback will be called exactly once. If two callbacks are scheduled for exactly the same time, it is undefined which will be called first. Any positional arguments after the callback will be passed to the callback when it is called. zdelay must not be Noner r )r>call_atrr)rdelaycallbackr r2timers r call_laterzBaseEventLoop.call_laters_ =45 5 TYY[50(.T.%,.  " "''+ r!cN| td|j|jr"|j|j |dt j |||||}|jr |jd=tj|j|d|_ |S)z|Like call_later(), but uses an absolute time. Absolute time corresponds to the event loop's time() method. zwhen cannot be Nonerr T) r>r r| _check_thread_check_callbackr TimerHandlerheapqheappushr)rwhenrr r2rs rrzBaseEventLoop.call_ats <12 2  ;;     9 5""44wG  " "''+ t. r!c|j|jr"|j|j|d|j |||}|j r |j d=|S)aTArrange for a callback to be called as soon as possible. This operates as a FIFO queue: callbacks are called in the order in which they are registered. Each callback will be called exactly once. Any positional arguments after the callback will be passed to the callback when it is called. call_soonr )r r|rr _call_soonrrrr r2rs rrzBaseEventLoop.call_soonsa  ;;     ; 749  # #((, r!ctj|stj|rtd|dt |std|d|y)Nzcoroutines cannot be used with z()z"a callable object was expected by z(), got )r iscoroutineiscoroutinefunctionr>r)rrmethods rrzBaseEventLoop._check_callback(sg  " "8 ,..x81&<> >!4VH=l$% %"r!ctj||||}|jr |jd=|jj ||S)Nr )rHandlerrrB)rrr2r rs rrzBaseEventLoop._call_soon2sDxtW=  # #((, 6" r!cz|jytj}||jk7r tdy)aoCheck that the current thread is the thread running the event loop. Non-thread-safe methods of this class make this assumption and will likely behave incorrectly when the assumption is violated. Should only be called when (self._debug == True). The caller is responsible for checking this condition for performance reasons. NzMNon-thread-safe operation invoked on an event loop other than the current one)rrfrr)r thread_ids rrzBaseEventLoop._check_thread9sB ?? " '')  ''( ( (r!c|j|jr|j|d|j|||}|jr |jd=|j |S)z"Like call_soon(), but thread-safe.rDr )r r|rrrr;rs rrDz"BaseEventLoop.call_soon_threadsafeJs`  ;;  +A B49  # #((,  r!c<|j|jr|j|d|E|j}|j |'t j jd}||_t j|j|g||S)Nrun_in_executorasyncio)thread_name_prefixr) r r|rrrA concurrentrThreadPoolExecutor wrap_futuresubmit)rrfuncr2s rrzBaseEventLoop.run_in_executorUs  ;;  '8 9  --H  ( ( *%--@@'0A*2&"" HOOD (4 (t5 5r!cpt|tjjs t d||_y)Nz,executor must be ThreadPoolExecutor instance)rrrrr>rrs rset_default_executorz"BaseEventLoop.set_default_executores,(J$6$6$I$IJJK K!)r!c"|d|g}|r|jd||r|jd||r|jd||r|jd|dj|}tjd||j }t j ||||||} |j |z } d|d | d zd d | }| |jk\rtj|| Stj|| S) N:zfamily=ztype=zproto=zflags=, zGet address info %szGetting address info z took g@@z.3fzms: ) rBrkrrrr+ getaddrinforinfo) rrDrErFrGrHflagsmsgt0addrinfodts r_getaddrinfo_debugz BaseEventLoop._getaddrinfo_debugjsq!"  JJ + ,  JJth' (  JJy) *  JJy) *iin *C0 YY[%%dD&$uM YY[2 %cU&c#d8,O ,, , KK  LL r!rrFrGrHrc K|jr |j}ntj}|j d|||||||d{S7wrP)r|rr+rr)rrDrErFrGrHr getaddr_funcs rrzBaseEventLoop.getaddrinfosU ;;22L!--L)) ,dFD%HH HHsAAA AcbK|jdtj||d{S7wrP)rr+ getnameinfo)rsockaddrrs rrzBaseEventLoop.getnameinfos2)) &$$h77 77s &/-/)fallbackcZK|jr|jdk7r tdt||j |||| |j ||||d{S7#t j$r }|sYd}~nd}~wwxYw|j||||d{7Sw)Nrzthe socket must be non-blocking) r| gettimeoutr,rw_check_sendfile_params_sock_sendfile_nativerSendfileNotAvailableError_sock_sendfile_fallback)rr1fileoffsetcountrrms r sock_sendfilezBaseEventLoop.sock_sendfiles ;;4??,1>? ?$ ##D$> 33D$4:ECC CC33  11$28%AAA AsNA B+ A+$A)%A+(B+)A++B >BB+B  B+%B(&B+cBKtjd|d|dw)Nz-syscall sendfile is not available for socket z and file z combinationrrrr1rrrs rrz#BaseEventLoop._sock_sendfile_natives422;D8Dx| -. .sc8K|r|j||rt|tjntj}t |}d} |rt||z |}|dkrnYt |d|}|j d|j|d{} | sn#|j||d| d{|| z }p||dkDr"t|dr|j||zSSS7S75#|dkDr"t|dr|j||zwwwxYww)Nrseek) rminr!SENDFILE_FALLBACK_READBUFFER_SIZE bytearray memoryviewrreadinto sock_sendallr*) rr1rrr blocksizebuf total_sentviewreads rrz%BaseEventLoop._sock_sendfile_fallbacks1  IIf  yBB C#EE  "  / #EJ$6 BI A~!#z 2!11$ tLL''d5Dk:::d" A~'$"7 &:-.#8~M;A~'$"7 &:-.#8~sCA DAC.C*C.6C,7 C.(D*C.,C..)DDcdt|ddvr td|jtjk(s td|It |t stdj||dkrtdj|t |t stdj||dkrtdj|y)Nbmodez$file should be opened in binary modez+only SOCK_STREAM type sockets are supportedz+count must be a positive integer (got {!r})rz0offset must be a non-negative integer (got {!r})) rr,rGr+r:rr=r>formatrs rrz$BaseEventLoop._check_sendfile_paramss gdFC0 0CD DyyF...JK K  eS)AHHOQQz AHHOQQ&#&BII  A:BII  r!cKg}|j||\}}}}} d} tj|||} | jd|G|D]!\} }}}} | |k7r | j| n"|r|jt d|d|j| | d{| dx}}S#t$rP} d| dt | j }t | j|} |j| Yd} ~ d} ~ wwxYw7f#t$r)} |j| | | jd} ~ w| | jxYw#dx}}wxYww)z$Create, bind and connect one socket.NrFrGrHF*error while attempting to bind on address : z&no matching local address with family=z found) rBr+ setblockingbindr/rlowererrnopop sock_connectr)rr addr_infolocal_addr_infos my_exceptionsrFtype_rH_r)r1lfamilyladdrrmrs r _connect_sockzBaseEventLoop._connect_socks  -(+4(ua# .==U%HD   U #+/?+GQ1e&(  2 %( 0@%+//11%(OyPV&WXX##D'2 2 2*. -J1#2'',ir#c(..2B1CE&cii5%,,S11 2 3    %   )- -JskE#z;BaseEventLoop.create_connection...]s$2D2D&+3r!NrQ)rRrrr rs rrTz2BaseEventLoop.create_connection..Zs' ).H)1).srrzcreate_connection failedc3:K|]}t|k(ywrPr)rRrmmodels rrTz2BaseEventLoop.create_connection..psGJSs3x50JszMultiple exceptions: {}rc32K|]}t|ywrPr)rRrms rrTz2BaseEventLoop.create_connection..us%E*3c#h*sz5host and port was not specified and no sock specified"A Stream Socket was expected, got )rrr+z%r connected to %s:%r: (%r, %r))r,rw_ensure_resolvedr+r:r/rdrr staggered_raceExceptionGrouprUrallrrkrG_create_connection_transportr|get_extra_inforr)rrrDrErurFrHrr1rr"rrrrrinfosrsubrmrrrr rs` @@@rcreate_connectionzBaseEventLoop.create_connectionsq(  &sJK K  "s "ABB"O ,SCE E +CBD D   d #  + 0BJ  t/ NPP//t V''uE0NNEABB%$($9$9v++5d%:%,, #!"EFF" -eZ@J#+ %H!%)%7%7&+&? ? !&(66 ). )   |-7GZc3Cc3cZG &!,-GTT:!+(m+!$JqM 2GJGG",Q-/&&?&F&F II%E*%EE'GHH | KMMyyF...!8ACC%)$E$E "C"7!5%F%77 8 ;;++H5D LL:tT9h @(""mN," ?#! ! H "&J 7sBJI4;JI7*J>I=I:I=*JJ JJ"J'A8JAJ1J2AJ7J:I== J J J  JJJJc .K|jd|}|j} |r.t|trdn|} |j ||| | ||||} n|j ||| } | d{| |fS7#| j xYww)NFr!r"rr)rrrboolr'rr) rr1rrur"r!rrrrr&rs rrz*BaseEventLoop._create_connection_transports #%##% !+C!6CJ00h F'&;%9 1;I 33D(FKI LL (""   OO  s0A,B/A?4A=5A?9B=A??BBcK|jr tdt|dtjj }|tjj urtd||tjj ur |j||||d{S|std||j||||d{S70#tj$r }|sYd}~Id}~wwxYw7)w)aSend a file to transport. Return the total number of bytes which were sent. The method uses high-performance os.sendfile if available. file must be a regular file object opened in binary mode. offset tells from where to start reading the file. If specified, count is the total number of bytes to transmit as opposed to sending the file until EOF is reached. File position is updated on return or also in case of error in which case file.tell() can be used to figure out the number of bytes which were sent. fallback set to True makes asyncio to manually read and send the file when the platform does not support the sendfile syscall (e.g. Windows or SSL socket on Unix). Raise SendfileNotAvailableError if the system does not support sendfile syscall and fallback is False. zTransport is closing_sendfile_compatiblez(sendfile is not supported for transport NzHfallback is disabled and native sendfile is not supported for transport ) rrrr _SendfileMode UNSUPPORTED TRY_NATIVE_sendfile_nativerr_sendfile_fallback)rrrrrrrrms rsendfilezBaseEventLoop.sendfiles0    !56 6y"8 ..::< 9**66 6:9-HJ J 9**55 5 !229d395BBB ++4-9: :,,Y-3U<< <B77   rrr SSLProtocolrrrrr BaseExceptionrr_app_transport) rrrr&r!r"rrr ssl_protocol conmade_cb resume_cbs r start_tlszBaseEventLoop.start_tlss= ;CD D*cnn5!n&' 'y"95AYM)IJL L##%++ (J "7!5!& (  !|,^^L$@$@)L NN9#;#;<  LL***   OO            s0CD5C7$C5%C7) D55C77;D22D5)rFrHr reuse_portallow_broadcastr1c DK| | jtjk(rtd| |s |s |s|s|s|s|rGt |||||||} dj d| j D} td| d| jdd} nb|s|s|d k(r td ||fd ff} nttd r|tjk(r||fD] }|t|trtd |rO|d dvrH tjtj|j rtj"|||f||fff} ni}d |fd|ffD]\}}| t|t,rt/|dk(s td|j1||tj2|||d{}|s t'd|D]\}}}}}||f}||vrddg||<||||<!|j Dcgc]\}}|r|d  |r|d||f} }}| s tdg}| D]\\}}\}}d} d} tj|tj2|} |r t5| |r/| j7tj8tj:d| jd|r| j=||r|s|j?| |d{|} n|d |}|jE}|jG| || |}|jHr4|rt)jJd||||nt)jLd||| |d{||fS#t$$rY0t&$r"}t)j*d||Yd}~Ud}~wwxYw7cc}}w7#t&$r/}| | jA|jB|Yd}~d}~w| | jAxYw7#|jAxYww)zCreate datagram connection.Nz$A datagram socket was expected, got )r remote_addrrFrHrr3r4rc36K|]\}}|s |d|yw)=NrQ)rRkvs rrTz9BaseEventLoop.create_datagram_endpoint..=s!$NLDAqAs!A3ZLs  zKsocket modifier keyword arguments can not be used when sock is specified. ()Frzunexpected address familyNNAF_UNIXzstring is expected)rz2Unable to check or remove stale UNIX socket %r: %rrrbz2-tuple is expectedrrzcan not get address informationrz@Datagram endpoint local_addr=%r remote_addr=%r created: (%r, %r)z2Datagram endpoint remote_addr=%r created: (%r, %r))'rGr+r:r,dictrkitemsrr*r=rrr>statS_ISSOCKosst_moderemoveFileNotFoundErrorr/rerrorrrUrr;r2r-r. SO_BROADCASTrrrrBrr*r|rr) rrrr6rFrHrr3r4r1optsproblemsr_addraddr_pairs_inforaerr addr_infosidxrfamrpror)key addr_pairr local_addressremote_addressrmrrrs rcreate_datagram_endpointz&BaseEventLoop.create_datagram_endpoint+s  yyF... :4(CEEkeu/z{#)e'1,;= 99$NDJJL$NN 008z<==   U #F+Q;$%@AA%+UO\#B"D+&..0H'5D' 40E'(<==6*Q-{"B 6==)<)D)DEIIj1&,UO%/$=$?#B #$j/A{3C!DIC' *4 7CIN"+,A"BB&*&;&; f6G6G"'u4'<'A!A %")*M"NN7<3CCG#&*C"*437, 33:JsOC0 8="E&r,rwrCrr}platformrrUabcIterablerYr rWsetrZr[r\r+rGr|rwarningrBr-r. SO_REUSEADDRr@rr2rAr*r` IPV6_V6ONLYrr/rr EADDRNOTAVAILrrrGr:rrrrr)rrrDrErFrr1rrurZr3rrrrhostsfsr completedresrLsocktyperH canonnamesarMrrrs r create_serverzBaseEventLoop.create_servers8 c4 HI I ,CE E + BD D   d #  t/ NPP$ "7 2 Os||x7O GrzT3' {'?'?@$%#d11$V8=2?# % ,,++E 55e<=EI4 % C9<6B%B!%}}R5ANN4($"--v/B/BDJ"bV^^V__,M&M&t,"&//1#FN;(;(;(.(:(:(,. @ " ;!V!:?%@%$d1g%%@#CDD!  ' !(| !LMMyyF... #EdX!NOOfGD   U #g'7W&;,.   ! ! #++a. ;; KK 0 c%,"<<!;;"NN,G+-xO! !4# @#%c#hnn&6 899(;(;;#KKM JJL#{{ &s 3$%cii54? @&A! ' !(!( !sC QL'*QL,.Q1 P?L/C P M/1P? P PB(Q>P>?.Q/9M,(P+M,,P/ P8A=P5P;PPPP;;Q)rurrc rK|jtjk7rtd|| |s td| |s td| t ||j |||dd||d{\}}|j r)|jd}tjd|||||fS7@w) Nrrrr5T)r!rrr+z%r handled: (%r, %r)) rGr+r:r,rwrr|rrr)rrr1rurrrrs rconnect_accepted_socketz%BaseEventLoop.connect_accepted_socketRs 99** *A$JK K ,SCE E +CBD D   d #$($E$E "C"7!5%F%77 8 ;;++H5D LL/y( K(""7sA2B74B55AB7cK|}|j}|j|||} |d{|jr&t j d|j ||||fS7:#|jxYww)Nz Read pipe %r connected: (%r, %r))rr.rr|rrfilenorrr-rrrs rconnect_read_pipezBaseEventLoop.connect_read_pipeps#%##%2246J  LL ;; LL; 8 =(""   OO  ++BA0A.A06B.A00BBcK|}|j}|j|||} |d{|jr&t j d|j ||||fS7:#|jxYww)Nz!Write pipe %r connected: (%r, %r))rr0rr|rrrurvs rconnect_write_pipez BaseEventLoop.connect_write_pipes#%##%33D(FK  LL ;; LL< 8 =(""   OO  rxcr|g}||jdt||1|tjk(r|jdt|n>||jdt|||jdt|t j dj |y)Nzstdin=zstdout=stderr=zstdout=zstderr= )rBr'r#r%rrrk)rrr4r5r6rs r_log_subprocesszBaseEventLoop._log_subprocesssu   KK&e!4 56 7  &J,=,="= KK.f)=(>? @! gl6&:%;<=! gl6&:%;<= SXXd^$r!) r4r5r6universal_newlinesr3r7encodingerrorstextc Kt|ttfs td|r td|s td|dk7r td| r td| td| td|} d}|jrd |z}|j |||||j | |d ||||fi| d{}|jr|tjd |||| fS7-w) Nzcmd must be a string universal_newlines must be Falsezshell must be Truerbufsize must be 0text must be Falseencoding must be Noneerrors must be Nonezrun shell command %rT%s: %r) rr<rr,r|r}r9rr)rrcmdr4r5r6r~r3r7rrrr8r debug_logrs rsubprocess_shellzBaseEventLoop.subprocess_shells#s|,34 4 ?@ @12 2 a<01 1 12 2  45 5  23 3#% ;;/4I  E66 B9$99 c4KCIKK ;;90 KK)Y 7("" KsB=C/?C-.C/c K|r td|r td|dk7r td| r td| td| td|f| z}|}d}|jrd|}|j|||||j||d ||||fi| d{}|jr|t j d ||||fS7-w) Nrzshell must be Falserrrrrzexecute program Fr)r,r|r}r9rr)rrprogramr4r5r6r~r3r7rrrr2r8 popen_argsrrrs rsubprocess_execzBaseEventLoop.subprocess_execs  ?@ @ 23 3 a<01 1 12 2  45 5  23 3Z$& #% ;;+7+6I  E66 B9$99 j%   ;;90 KK)Y 7("" sB"C$C%.Cc|jS)zKReturn an exception handler, or None if the default one is in use. )rrs rget_exception_handlerz#BaseEventLoop.get_exception_handlers&&&r!cH|t|std|||_y)aSet handler as the new event loop exception handler. If handler is None, the default exception handler will be set. If handler is a callable object, it should have a signature matching '(loop, context)', where 'loop' will be a reference to the active event loop, 'context' will be a dict object (see `call_exception_handler()` documentation for details about context). Nz+A callable object or None is expected, got )rr>r)rhandlers rset_exception_handlerz#BaseEventLoop.set_exception_handlers5  x'8##*+/0 0")r!c|jd}|sd}|jd}|t|||jf}nd}d|vr;|j/|jjr|jj|d<|g}t |D]}|dvr||}|dk(r:d j tj|}d }||jz }nJ|dk(r:d j tj|}d }||jz }n t|}|j|d |tjd j ||y)aEDefault exception handler. This is called when an exception occurs and no exception handler is set, and can be called by a custom exception handler that wants to defer to the default behavior. This default handler logs the error message and other context-dependent information. In debug mode, a truncated stack trace is also appended showing where the given object (e.g. a handle or future or task) was created, if any. The context parameter has the same meaning as in `call_exception_handler()`. rSz!Unhandled exception in event looprgNFsource_tracebackhandle_traceback>rSrgr5z+Object created at (most recent call last): z+Handle created at (most recent call last): r r^)getrG __traceback__rrsortedrk traceback format_listrstriprrBrrG) rr rSrgr_ log_linesrRvaluetbs rdefault_exception_handlerz'BaseEventLoop.default_exception_handlers[++i(9GKK ,  YI4K4KLHH g -$$0$$66$$66 & 'I '?C..CLE((WWY2259:F$**WWY2259:F$U    uBug. /#  TYYy)H=r!c|j |j|y d}|jd}||jd}||jd}|t|dr|j}|*t|d r|j|j||y|j||y#ttf$rt$rt j ddYywxYw#ttf$rt$r[} |jd ||d n:#ttf$rt$rt j d dYnwxYwYd}~yYd}~yd}~wwxYw) aDCall the current event loop's exception handler. The context argument is a dict containing the following keys: - 'message': Error message; - 'exception' (optional): Exception object; - 'future' (optional): Future instance; - 'task' (optional): Task instance; - 'handle' (optional): Handle instance; - 'protocol' (optional): Protocol instance; - 'transport' (optional): Transport instance; - 'socket' (optional): Socket instance; - 'asyncgen' (optional): Asynchronous generator that caused the exception. New keys maybe introduced in the future. Note: do not overload this method in an event loop subclass. For custom exception handling, use the `set_exception_handler()` method. Nz&Exception in default exception handlerTr^rror get_contextrunz$Unhandled error in exception handler)rSrgr zeException in default exception handler while handling an unexpected error in custom exception handler) rrrhrir-rrGrr*rr)rr ctxthingrms rrZz$BaseEventLoop.call_exception_handler+sq,  " " * ,..w7$ 0 F+=$KK1E=#KK1E$ )F++-C?wsE':GGD33T7C++D':3 12   , E&*,  ,0 12   0022#I%(#*4 #$56$0LL"?+/000  0sMB7BC,$C,7/C)(C),EDE/E  E E  EEcT|js|jj|yy)zAdd a Handle to _ready.N) _cancelledrrBrrs r _add_callbackzBaseEventLoop._add_callbackss"  KK  v &!r!cF|j||jy)z6Like _add_callback() but called from a signal handler.N)rr;rs r_add_callback_signalsafez&BaseEventLoop._add_callback_signalsafexs 6" r!cH|jr|xjdz c_yy)z3Notification that a TimerHandle has been cancelled.rN)rrrs r_timer_handle_cancelledz%BaseEventLoop._timer_handle_cancelled}s!     ' '1 , ' r!cbt|j}|tkDrr|j|z tkDr\g}|jD]'}|j rd|_|j |)tj|||_d|_n|jrz|jdj ra|xjdzc_tj|j}d|_|jr|jdj rad}|js |jrd}nP|jrD|jdj}ttd||jz t }|j"j%|}|j'|d}|j|j(z}|jrm|jd}|j|k\rnNtj|j}d|_|jj ||jrmt|j}t+|D]} |jj-}|j r*|j.rr ||_|j} |j3|j| z } | |j4k\r t7j8dt;|| d|_|j3d}y#d|_wxYw)zRun one full iteration of the event loop. This calls all currently ready callbacks, polls for I/O, schedules the resulting callbacks, and finally schedules 'call_later' callbacks. FrrNzExecuting %s took %.3f seconds)rUr_MIN_SCHEDULED_TIMER_HANDLESr%_MIN_CANCELLED_TIMER_HANDLES_FRACTIONrrBrheapifyheappoprr_whenrmaxrMAXIMUM_SELECT_TIMEOUT _selectorselectr>rrangepopleftr|r_runrrrfr ) r sched_count new_scheduledrrjrr=end_timentodoirrs rrzBaseEventLoop._run_onces$//* 6 6  ' '+ 55 6M//$$(-F%!((0 * MM- (+DO*+D '//dooa&8&C&C++q0+t7$)!//dooa&8&C&C  ;;$..G __??1%++D#a !346LMG^^**73  Z( 99;!7!77oo__Q'F||x']]4??3F %F  KK  v & ooDKK uA[[((*F  {{ 0+1D(BKKMr)BT888'G'5f'=rC,0D( !",0D(s A)L%% L.c t|t|jk(ry|rDtj|_tj t j||_ytj |j||_yrP)rrr}#get_coroutine_origin_tracking_depthr#set_coroutine_origin_tracking_depthrDEBUG_STACK_DEPTHrenableds rr{z,BaseEventLoop._set_coroutine_origin_trackingsw =D!H!HI I  779  7  3 3++ - 3:/  3 3;; =3:/r!c|jSrP)r|rs rrzBaseEventLoop.get_debugs {{r!cl||_|jr|j|j|yyrP)r|rrDr{rs rrzBaseEventLoop.set_debugs. ??   % %d&I&I7 S r!rP)NNNr<)r)rN)FNN)Urrrrrrrrrrr'r*r.r0r9r;r>r rArHrPr_rqrhrwrrrkrrrLrMrrrrrrrrrrDrrrrrrrrrrrrr%r#r$r2rVr+r:rrYr? AI_PASSIVErqrsrwrzr}r#r$rrrrrrZrrrrr{rrrQr!rrrs/< ))-d4 %""%)$" 9=" $t"&!%!% "CG" @D(," AE)-"04" ""7DG "20DK40$L*.%MM - :>06:$26&%("=A 5 * 2"#!1H7 A(, A./4*).X59Q#14T"&!%!%$Q#j*/"&!% #8-<#'-<^1"4%*(,.2-1 .+bEID#./q267;$ D#N'(f.@.@%&a D59K####"&!%K^"&!% #<# # %&0__&0oo&0oo27%)1(,T "#J%/OOJOO%/__$)1'+Dt #D' *"0>dF0P'  - N` :Tr!r)rr)r)7__doc__rUcollections.abcconcurrent.futuresrrrrZrCr+rAr#rfrrr}rLrru ImportErrorr5rrrrrr r r r r rrlogr__all__rrr*rArr r'r2rMrdrnrrrwProtocolryAbstractServerrAbstractEventLooprrQr!rrs-      $ #),% FJ ' #J8v," 6=!G  > A) 2 2A)HBV " "BJPTF,,PTk  CsDDD__pycache__/tasks.cpython-312.opt-2.pyc000064400000075231152527367570013577 0ustar00 {|j dZddlZddlZddlZddlZddlZddlZddlZddl Z ddlm Z ddl m Z ddl m Z ddl mZddl mZdd l mZdd l mZej$dj&Zd.d Zd.d Zd ZGddej0ZeZ ddlZej2xZZddddZej j>Zej j@Z ej jBZ!de!ddZ"dZ#dZ$dZ%dZ&dddZ'ejPdZ)d.dZ*dddZ+GddejXZ-d d!d"Z.d#Z/d$Z0d%Z1e1eZ2e jfZ4e5Z6iZ7d&Z8d'Z9d(Z:d)Z;d*ZeZ?e8Z@e9ZAe=ZBe>ZCe:ZDe;ZEeZ>m:Z:m;Z;mZKe:ZLe;ZMeD!  #t+AFFH D >>   FADy   >sB0B#BBc| |j}||yy#t$rtjdtdYywxYw)Nz~Task.set_name() was added in Python 3.8, the method support will be mandatory for third-party task implementations since 3.13.) stacklevel)set_nameAttributeErrorwarningswarnDeprecationWarning)tasknamer9s r'_set_task_namer@FsM  }}H TN 8 MM9)Q 8 8s %AAceZdZ dZdddddfd ZfdZeeZdZ dZ d Z d Z d Z d Zd ZdddZddddZddZdZdZdZddZfdZdZxZS)rTNFr&r?context eager_startcFt|||jr |jd=tj|sd|_t d||dt|_nt||_d|_ d|_ d|_ ||_ |tj|_n||_|r+|j"j%r|j'y|j"j)|j*|j t-|y)Nr%Fza coroutine was expected, got zTask-rrC)super__init___source_tracebackr iscoroutine_log_destroy_pending TypeError_task_name_counter_namestr_num_cancels_requested _must_cancel _fut_waiter_coro contextvars copy_context_context_loop is_running_Task__eager_start call_soon _Task__stepr)selfcoror&r?rCrD __class__s r'rIz Task.__init__os d#  ! !&&r*%%d+).D %messagesource_traceback) _stater_PENDINGrLrJrXcall_exception_handlerrH__del__)r]rCr_s r'rfz Task.__del__sb ;;'** *t/H/HBG%%.2.D.D*+ JJ - -g 6 r(c,tj|Sr!)r _task_reprr]s r'__repr__z Task.__repr__s$$T**r(c|jSr!)rTris r'get_coroz Task.get_coro zzr(c|jSr!)rWris r' get_contextzTask.get_contexts }}r(c|jSr!)rOris r'get_namez Task.get_namermr(c$t||_yr!)rPrO)r]values r'r9z Task.set_names Z r(ctd)Nz*Task does not support set_result operationr-)r]results r' set_resultzTask.set_resultsGHHr(ctd)Nz-Task does not support set_exception operationru)r] exceptions r' set_exceptionzTask.set_exceptionsJKKr()limitc0 tj||Sr!)r_task_get_stack)r]r{s r' get_stackzTask.get_stacks ())$66r()r{filec2 tj|||Sr!)r_task_print_stack)r]r{rs r' print_stackzTask.print_stacks ++D%>>r(c d|_|jry|xjdz c_|j|jj |ryd|_||_y)NFrmsgT)_log_tracebackr1rQrScancelrR_cancel_message)r]rs r'rz Task.cancelsk *$ 99; ##q(#    '&&3&/ "r(c |jSr!rQris r' cancellingzTask.cancellings ***r(cd |jdkDr|xjdzc_|jS)Nrrrris r'uncancelz Task.uncancels4   & & *  ' '1 , '***r(cpt|j|} t| |jj |j dt | t|j|}|jr d|_d}yt|y#t |wxYw#|jr d|_d}wt|wxYw# t|j|}|jr d|_d}wt|w#|jr d|_d}wt|wxYwxYwr!) _swap_current_taskrX_register_eager_taskrWrun!_Task__step_run_and_handle_result_unregister_eager_taskr1rTr)r] prev_taskcurtasks r' __eager_startzTask.__eager_starts&tzz48  )  & - !!$"C"CTJ&t, ),TZZC99;!%DJD"4('t, 99;!%DJD"4( ),TZZC99;!%DJD"4( 99;!%DJD"4(sF C &B C B# B  C #'C  D5D %&D5 'D22D5c|jrtjd|d||jr1t |tj s|j }d|_d|_t|j| |j|t|j|d}y#t|j|d}wxYw)Nz_step(): already done: z, F) r1rInvalidStateErrorrR isinstanceCancelledError_make_cancelled_errorrSrrXrr)r]excs r'__stepz Task.__step#s 99;..)$C7;= =   c:#<#<=002 %D DJJ%   - -c 2  D )D  D )Ds B11C c|j} ||jd}n|j|}t|dd}|lt j ||j urGtd|d|d}|j j|j||jd}y|r||urCtd|}|j j|j||jd}yd|_ |j|j|j||_|jrN|jj!|j"r'd|_ d}ytd |d |}|j j|j||j d}y|4|j j|j|jd}yt%j&|rFtd |d |}|j j|j||jd}ytd |}|j j|j||j d}yd}y#t($rS}|jr"d|_t*|A|j"nt*|Y|j.Yd}~d}yd}~wt0j2$r!}||_t*|AYd}~d}yd}~wt6t8f$r}t*|u|d}~wt<$r}t*|u|Yd}~d}yd}~wwxYw#d}wxYw) N_asyncio_future_blockingzTask z got Future z attached to a different looprGzTask cannot await on itself: Frz-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: )rTsendthrowgetattrrr0rXr-r[r\rWradd_done_callback _Task__wakeuprSrRrrinspect isgenerator StopIterationrHrwrsrr_cancelled_excKeyboardInterrupt SystemExitrz BaseException)r]rr^rvblockingnew_excr_s r'__step_run_and_handle_resultz!Task.__step_run_and_handle_result4sezzG {4C$v'A4HH#$$V,DJJ>*x|!*$ACDGJJ(( Wdmm)EPDM~".;D8D#F ,, KK$---IDD?;@700 MM4==1B+1(,,#//66(,(<(< 7 >49 10D-+##'(& <=GJJ(( Wdmm)E&D! $$T[[$--$HD$$V,&))-vjBC $$KK$--%AD ')=fZ'HI $$KK$--%AD4DA .  $)!4#7#78"399-tDs(( "%D  GN  lDk":.  G !# &  ' G !# & &bDe 'dDs%JA5M,AM5A0M)AM03M&AMAM MAKMM5L MM#L33 M?MMMMM!c |j|jd}y#t$r}|j|Yd}~d}yd}~wwxYwr!)rvr\r)r]futurers r'__wakeupz Task.__wakeupsH  MMO KKM  KK   s% A AA r!)__name__ __module__ __qualname__rLrIrf classmethodr__class_getitem__rjrlrorqr9rwrzr~rrrrrZr\rr __classcell__r_s@r'rrSs+. %)d"!> $L1+ IL"&7.$(d ?(T+ +)&"IVr(rr?rCc tj}||j|}n|j||}t|||S)NrG)rr"rr@)r^r?rCr&r>s r'rrsP  " " $D%g64 Kr()timeout return_whencK tj|stj|r!t dt |j |s td|tttfvrtd|t|}td|Dr t dtj}t||||d{S7w)Nzexpect a list of futures, not zSet of Tasks/Futures is empty.zInvalid return_when value: c3FK|]}tj|ywr!)rrK).0fs r' zwait..s 1b: ! !! $bs!z6Passing coroutines is forbidden, use tasks explicitly.)risfuturerrKrMtyper ValueErrorrrrsetanyrr"_wait)fsrrr&s r'rrsz55b98b9J9J8KLMM 9::?O]KK6{mDEE RB 1b 11PQQ  " " $Dr7K6 66 6sCC C CcH|js|jdyyr!)r1rw)waiterargss r'_release_waiterrs ;;=$ r(cK |T|dkrOt|}|jr|jSt|d{ |jStj|4d{|d{cdddd{S7N#tj $r }t |d}~wwxYw7C7;7-#1d{7swYyxYwwNr) r r1rv_cancel_and_waitrr TimeoutErrorrr)futrrs r'rrsDw!|C  88:::< s### (::< ((y)(( $(( (C ' ())(((sACBC BC3B74C7B==B9>B= C B;CB4(B//B44C9B=;C=CC C Cc2 K |j d ||j|t  t| fd}|D]}|j | d{  j |D]}|j | tt}}|D]5}|jr|j|%|j|7||fS7#  j |D]}|j |wxYww)Ncdzdks2tk(s)tk(rW|jsF|j5j j sj dyyyyy)Nrr)rr cancelledryrr1rw)rcounterrtimeout_handlers r'_on_completionz_wait.._on_completionst1  qL ? * ? *AKKM01 0I)%%';;=!!$'!1J5B *r() create_future call_laterrlenrrremove_done_callbackrr1add) rrrr&rrr1pendingrrrs ` @@@r'rr s     !FN/6J"gG ( N+3  %  ! ! #A " "> 2E35'D  668 HHQK KKN  =   %  ! ! #A " "> 2s1ADC($C&%C()A=D&C((,DDc4K tj}|j}tjt |}|j | |j|d{|j|y7#|j|wxYwwr!) rr"r functoolspartialrrrr)rr&rcbs r'rr6s~F  " " $D    !F   ?F 3B"%     $    $s0ABB)B*B.BBBB)rc#  K tj|stj|r!t dt |j ddlm}| tj}t|Dchc]}t||c} d  fd} fd fd} D]}|j r||j|| tt! D] }| ycc}ww)Nz#expect an iterable of futures, not r)Queuer%cxD]$}|jjd&jyr!)r put_nowaitclear)rrr1todos r' _on_timeoutz!as_completed.._on_timeoutds2A " "> 2 OOD ! r(c|syj|j|sjyyyr!)removerr)rr1rrs r'rz$as_completed.._on_completionjs;  A 2  ! ! #3tr(cKjd{}|tj|jS7&wr!)r$rrrv)rr1s r' _wait_for_onez#as_completed.._wait_for_oners7((*  9)) )xxz sA>'A)rrrrKrMrrqueuesrrget_event_looprr rrranger) rrrr&rrr_rr1rrs @@@@r'r r Hs"z55b9=d2h>O>O=PQRR 7D  "D14R 9AM!$ ' 9DN $ N+ #+> 3t9 o9 :sA;DC>A.Dc#K dywr!rr(r'__sleep0rs s c2K |dkrtd{|Stj}|j}|j |t j ||} |d{|jS7g7#|jwxYwwr)rrr"rrr_set_result_unless_cancelledr)delayrvr&rhs r'r r sC zj  " " $D    !F << (A|     s:BA>A B$B)B*B-BBBBr%c tj|r&|"|tj|ur td|Sd}t j |s.t j|rd}||}d}n td|tj} |j|S#t$r|r|jwxYw)NzRThe future belongs to a different loop than the one specified as the loop argumentTc"K|d{S7wr!r) awaitables r'_wrap_awaitablez&ensure_future.._wrap_awaitables&&s  Fz:An asyncio.Future, a coroutine or an awaitable is required)rrr0rrrKr isawaitablerMrrrr-close)coro_or_futurer& should_closers r'r r s'  G,=,=n,M MEF FL  ! !. 1   ~ . '-^._done_callbacks,Q =EJJL==?   }}//1##C(mmo?'',  G==?%33!119++-C--/C{!jjls# "&&//1##C(  ); r(rr%Fr) rrrrwr rr0rLr1r rr) r coros_or_futuresr&r arg_to_fut done_futsargrrrrrs ` @@@@r'r r s%: $$&""$  5*5*nJH EII D E j $/C|((-#~ ,1( QJE!JsOxxz  %%%n5S/C/ 2 XD 1E s Lr(c t|jrStj}|j fdfd}j j |S)Nc0jr!|js|jy|jrjy|j}|j|yj |j yr!)rryrrzrwrv)innerrrs r'_inner_done_callbackz$shield.._inner_done_callbacksj ?? ??$!  ??  LLN//#C##C(  0r(cJjsjyyr!)r1r)rrrs r'_outer_done_callbackz$shield.._outer_done_callbacks zz|  & &'; <r()r r1rr0rr)rr&rrrrs @@@r'r r asp@ # E zz|   U #D    E1"= 01 01 Lr(c tjs tdtjj fd}j |S)NzA coroutine object is requiredc tjty#ttf$rt $r'}j rj|d}~wwxYw)Nr%)r _chain_futurer rrrset_running_or_notify_cancelrz)rr^rr&s r'callbackz*run_coroutine_threadsafe..callbacks]   ! !-4"@& I-.   224$$S)  s!%A$"AA$)rrKrM concurrentrFuturecall_soon_threadsafe)r^r&r"rs`` @r'rrsR  ! !$ '899    & & (F h' Mr(c dddfd }|S)Nrc||||dS)NTrBr)r&r^r?rCcustom_task_constructors r'factoryz*create_eager_task_factory..factorys& t$TK Kr(r)r(r)s` r'rrs $%)$K Nr(c0 tj|yr!)r,rr>s r'rrsEr(c0 tj|yr!)r+rr+s r'rrs@Tr(chtj|}|td|d|d|t|<y)NzCannot enter into task z while another task z is being executed.r#r$r-r&r>rs r'rrsL!%%d+L4TH=##/"22EGH HN4r(chtj|}||urtd|d|dt|=y)Nz Leaving task z! does not match the current task .r.r/s r'rrsJ!%%d+L4]4(3//;.>aAB Btr(cXtj|}| t|=|S|t|<|Sr!)r#r$)r&r>rs r'rrs9""4(I | 4   $t r(c0 tj|yr!)r,discardr+s r'rrs1T"r(c0 tj|yr!)r+r4r+s r'rr s@r() rrrrrrrr,r+r#rr!)O__all__concurrent.futuresr#rUrrr.typesr;weakrefrr rrrrrrcount__next__rNrrr@ _PyFuturer_PyTask_asyncio_CTask ImportErrorrrrrrrrrrr coroutinerr r r$rr r rrrWeakSetr,rr+r#rrrrrrr_py_current_task_py_register_task_py_register_eager_task_py_unregister_task_py_unregister_eager_task_py_enter_task_py_leave_task_py_swap_current_task_c_current_task_c_register_task_c_register_eager_task_c_unregister_task_c_unregister_eager_task _c_enter_task _c_leave_task_c_swap_current_taskrr(r'rSsM6   %Y__Q'00$>6 z7  zz " MM!D6#D $$$44$$44""00 # 7@ 0d)X%$!%6r  "+/@w~~:16CL?D.4/t4 #7??$u    #   ".&2*.((((#O%1)5MM-i  T  s$ F4 G4F=<F=GG__pycache__/events.cpython-312.opt-1.pyc000064400000107610152527367570013752 0ustar00 {|jrdZdZddlZddlZddlZddlZddlZddlZddlZddl m Z GddZ Gdd e Z Gd d Z Gd d ZGddZGddeZdaej$ZGddej(ZeZdZdZdZdZdZdZdZdZdZdZ dZ!eZ"eZ#eZ$eZ% ddl&mZmZmZmZeZ'eZ(eZ)eZ*e,ed rd!Z-ej\e-"yy#e+$rY(wxYw)#z!Event loop and event loop policy.)AbstractEventLoopPolicyAbstractEventLoopAbstractServerHandle TimerHandleget_event_loop_policyset_event_loop_policyget_event_loopset_event_loopnew_event_loopget_child_watcherset_child_watcher_set_running_loopget_running_loop_get_running_loopN)format_helpersc@eZdZdZdZd dZdZdZdZdZ d Z d Z y) rz1Object returned by callback registration methods.) _callback_args _cancelled_loop_source_traceback_repr __weakref___contextNc"|tj}||_||_||_||_d|_d|_|jjr.tjtjd|_ yd|_ y)NFr) contextvars copy_contextrrrrrr get_debugr extract_stacksys _getframer)selfcallbackargsloopcontexts '/usr/lib64/python3.12/asyncio/events.py__init__zHandle.__init__$sx ?!..0G  !  ::   !%3%A%A a &"D "&*D "ch|jjg}|jr|jd|j9|jt j |j|j|jr,|jd}|jd|dd|d|S)N cancelledz created at r:r) __class____name__rappendrr_format_callback_sourcerr)r$infoframes r) _repr_infozHandle._repr_info3s''( ?? KK $ >> % KK>> , -  ! !**2.E KK+eAhZqq ; < r+c|j |jS|j}djdj|S)Nz<{}> )rr6formatjoin)r$r4s r)__repr__zHandle.__repr__?s9 :: !::  }}SXXd^,,r+c|jSN)rr$s r) get_contextzHandle.get_contextEs }}r+c|js@d|_|jjrt||_d|_d|_yy)NT)rrr reprrrrr>s r)cancelz Handle.cancelHs@"DOzz##%"$Z !DNDJr+c|jSr=)rr>s r)r-zHandle.cancelledSs r+c |jj|jg|jd}y#tt f$rt $rw}tj|j|j}d|}|||d}|jr|j|d<|jj|Yd}~d}yd}~wwxYw)NzException in callback )message exceptionhandlesource_traceback) rrunrr SystemExitKeyboardInterrupt BaseExceptionrr3rrcall_exception_handler)r$exccbmsgr(s r)_runz Handle._runVs 7 DMM  dnn :tzz :-.   777 ,B*2$/C G %%.2.D.D*+ JJ - -g 6 6 7s16CA+CCr=) r1 __module__ __qualname____doc__ __slots__r*r6r;r?rBr-rQr+r)rrs/;I * -  r+rcjeZdZdZddgZdfd ZfdZdZdZdZ d Z d Z d Z fd Z d ZxZS)rz7Object returned by timed callback registration methods. _scheduled_whencxt||||||jr |jd=||_d|_y)Nr.F)superr*rrYrX)r$whenr%r&r'r(r0s r)r*zTimerHandle.__init__os; 4w7  ! !&&r* r+ct|}|jrdnd}|j|d|j|S)Nrzwhen=)r[r6rinsertrY)r$r4posr0s r)r6zTimerHandle._repr_infovs;w!#??a C5 -. r+c,t|jSr=)hashrYr>s r)__hash__zTimerHandle.__hash__|sDJJr+c`t|tr|j|jkStSr= isinstancerrYNotImplementedr$others r)__lt__zTimerHandle.__lt__% e[ ):: + +r+ct|tr,|j|jkxs|j|StSr=rfrrY__eq__rgrhs r)__le__zTimerHandle.__le__3 e[ ):: +At{{5/A Ar+c`t|tr|j|jkDStSr=rerhs r)__gt__zTimerHandle.__gt__rkr+ct|tr,|j|jkDxs|j|StSr=rmrhs r)__ge__zTimerHandle.__ge__rpr+ct|trj|j|jk(xrO|j|jk(xr4|j|jk(xr|j |j k(St Sr=)rfrrYrrrrgrhs r)rnzTimerHandle.__eq__sl e[ )JJ%++-8NNeoo58JJ%++-8OOu'7'77 9r+cp|js|jj|t|yr=)rr_timer_handle_cancelledr[rB)r$r0s r)rBzTimerHandle.cancels& JJ . .t 4 r+c|jS)zReturn a scheduled callback time. The time is an absolute timestamp, using the same time reference as loop.time(). )rYr>s r)r\zTimerHandle.whens zzr+r=)r1rRrSrTrUr*r6rcrjrorrrtrnrBr\ __classcell__)r0s@r)rrjsBAw'I        r+rc@eZdZdZdZdZdZdZdZdZ dZ d Z y ) rz,Abstract server returned by create_server().ct)z5Stop serving. This leaves existing connections open.NotImplementedErrorr>s r)closezAbstractServer.close!!r+ct)z4Get the event loop the Server object is attached to.r|r>s r)get_loopzAbstractServer.get_looprr+ct)z3Return True if the server is accepting connections.r|r>s r) is_servingzAbstractServer.is_servingrr+cKtw)zStart accepting connections. This method is idempotent, so it can be called when the server is already being serving. r|r>s r) start_servingzAbstractServer.start_serving "! cKtw)zStart accepting connections until the coroutine is cancelled. The server is closed when the coroutine is cancelled. r|r>s r) serve_foreverzAbstractServer.serve_forever "!rcKtw)z*Coroutine to wait until service is closed.r|r>s r) wait_closedzAbstractServer.wait_closed !!rcK|Swr=rVr>s r) __aenter__zAbstractServer.__aenter__s  sc`K|j|jd{y7wr=)r~r)r$rNs r) __aexit__zAbstractServer.__aexit__s!    s $.,.N) r1rRrSrTr~rrrrrrrrVr+r)rrs-6""""""!r+rc eZdZdZdZdZdZdZdZdZ dZ d Z d Z d d d Z d d dZd d dZdZdZd d ddZd d dZdZdZddddddZdJdZ dKd dddd d d d d d d d dZ dKej4ej6d dd d d d d dd d ZdLdd!d"Zd#d d d d$d%Z dMd d d d d d&d'Z dMd dd d d dd(d)Z d d d d*d+Z! dKdddd d d d d,d-Z"d.Z#d/Z$e%jLe%jLe%jLd0d1Z'e%jLe%jLe%jLd0d2Z(d3Z)d4Z*d5Z+d6Z,d7Z-d8Z.d9Z/dJd:Z0d;Z1d<Z2d=Z3d>Z4dLd d!d?Z5d@Z6dAZ7dBZ8dCZ9dDZ:dEZ;dFZdIZ?y )NrzAbstract event loop.ct)z*Run the event loop until stop() is called.r|r>s r) run_foreverzAbstractEventLoop.run_foreverrr+ct)zpRun the event loop until a Future is done. Return the Future's result, or raise its exception. r|)r$futures r)run_until_completez$AbstractEventLoop.run_until_completes "!r+ct)zStop the event loop as soon as reasonable. Exactly how soon that is may depend on the implementation, but no more I/O callbacks should be scheduled. r|r>s r)stopzAbstractEventLoop.stops "!r+ct)z3Return whether the event loop is currently running.r|r>s r) is_runningzAbstractEventLoop.is_runningrr+ct)z*Returns True if the event loop was closed.r|r>s r) is_closedzAbstractEventLoop.is_closedrr+ct)zClose the loop. The loop should not be running. This is idempotent and irreversible. No other methods should be called after this one. r|r>s r)r~zAbstractEventLoop.closes "!r+cKtw)z,Shutdown all active asynchronous generators.r|r>s r)shutdown_asyncgensz$AbstractEventLoop.shutdown_asyncgensrrcKtw)z.Schedule the shutdown of the default executor.r|r>s r)shutdown_default_executorz+AbstractEventLoop.shutdown_default_executorrrct)z3Notification that a TimerHandle has been cancelled.r|)r$rGs r)rwz)AbstractEventLoop._timer_handle_cancelledrr+N)r(c0|jd|g|d|iS)Nrr() call_laterr$r%r(r&s r) call_soonzAbstractEventLoop.call_soon stq(CTC7CCr+ctr=r|)r$delayr%r(r&s r)rzAbstractEventLoop.call_later!!r+ctr=r|)r$r\r%r(r&s r)call_atzAbstractEventLoop.call_atrr+ctr=r|r>s r)timezAbstractEventLoop.timerr+ctr=r|r>s r) create_futurezAbstractEventLoop.create_futurerr+)namer(ctr=r|)r$cororr(s r) create_taskzAbstractEventLoop.create_taskrr+ctr=r|rs r)call_soon_threadsafez&AbstractEventLoop.call_soon_threadsafe"rr+ctr=r|)r$executorfuncr&s r)run_in_executorz!AbstractEventLoop.run_in_executor%rr+ctr=r|)r$rs r)set_default_executorz&AbstractEventLoop.set_default_executor(rr+r)familytypeprotoflagscKtwr=r|)r$hostportrrrrs r) getaddrinfozAbstractEventLoop.getaddrinfo-rrcKtwr=r|)r$sockaddrrs r) getnameinfozAbstractEventLoop.getnameinfo1 !!r) sslrrrsock local_addrserver_hostnamessl_handshake_timeoutssl_shutdown_timeouthappy_eyeballs_delay interleavec Ktwr=r|)r$protocol_factoryrrrrrrrrrrrrrs r)create_connectionz#AbstractEventLoop.create_connection4s"!rdT) rrrbacklogr reuse_address reuse_portrrrc Ktw)a#A coroutine which creates a TCP server bound to host and port. The return value is a Server object which can be used to stop the service. If host is an empty string or None all interfaces are assumed and a list of multiple sockets will be returned (most likely one for IPv4 and another one for IPv6). The host parameter can also be a sequence (e.g. list) of hosts to bind to. family can be set to either AF_INET or AF_INET6 to force the socket to use IPv4 or IPv6. If not set it will be determined from host (defaults to AF_UNSPEC). flags is a bitmask for getaddrinfo(). sock can optionally be specified in order to use a preexisting socket object. backlog is the maximum number of queued connections passed to listen() (defaults to 100). ssl can be set to an SSLContext to enable SSL over the accepted connections. reuse_address tells the kernel to reuse a local socket in TIME_WAIT state, without waiting for its natural timeout to expire. If not specified will automatically be set to True on UNIX. reuse_port tells the kernel to allow this endpoint to be bound to the same port as other existing endpoints are bound to, so long as they all set this flag when being created. This option is not supported on Windows. ssl_handshake_timeout is the time in seconds that an SSL server will wait for completion of the SSL handshake before aborting the connection. Default is 60s. ssl_shutdown_timeout is the time in seconds that an SSL server will wait for completion of the SSL shutdown procedure before aborting the connection. Default is 30s. start_serving set to True (default) causes the created server to start accepting connections immediately. When set to False, the user should await Server.start_serving() or Server.serve_forever() to make the server to start accepting connections. r|)r$rrrrrrrrrrrrrs r) create_serverzAbstractEventLoop.create_server>sp"!r)fallbackcKtw)zRSend a file through a transport. Return an amount of sent bytes. r|)r$ transportfileoffsetcountrs r)sendfilezAbstractEventLoop.sendfilexrrF) server_siderrrcKtw)z|Upgrade a transport to TLS. Return a new transport that *protocol* should start using immediately. r|)r$rprotocol sslcontextrrrrs r) start_tlszAbstractEventLoop.start_tlss"!r)rrrrrcKtwr=r|)r$rpathrrrrrs r)create_unix_connectionz(AbstractEventLoop.create_unix_connectionrr)rrrrrrcKtw)aWA coroutine which creates a UNIX Domain Socket server. The return value is a Server object, which can be used to stop the service. path is a str, representing a file system path to bind the server socket to. sock can optionally be specified in order to use a preexisting socket object. backlog is the maximum number of queued connections passed to listen() (defaults to 100). ssl can be set to an SSLContext to enable SSL over the accepted connections. ssl_handshake_timeout is the time in seconds that an SSL server will wait for the SSL handshake to complete (defaults to 60s). ssl_shutdown_timeout is the time in seconds that an SSL server will wait for the SSL shutdown to finish (defaults to 30s). start_serving set to True (default) causes the created server to start accepting connections immediately. When set to False, the user should await Server.start_serving() or Server.serve_forever() to make the server to start accepting connections. r|) r$rrrrrrrrs r)create_unix_serverz$AbstractEventLoop.create_unix_serversD"!r)rrrcKtw)aHandle an accepted connection. This is used by servers that accept connections outside of asyncio, but use asyncio to handle connections. This method is a coroutine. When completed, the coroutine returns a (transport, protocol) pair. r|)r$rrrrrs r)connect_accepted_socketz)AbstractEventLoop.connect_accepted_sockets"!r)rrrrrallow_broadcastrcKtw)aA coroutine which creates a datagram endpoint. This method will try to establish the endpoint in the background. When successful, the coroutine returns a (transport, protocol) pair. protocol_factory must be a callable returning a protocol instance. socket family AF_INET, socket.AF_INET6 or socket.AF_UNIX depending on host (or family if specified), socket type SOCK_DGRAM. reuse_address tells the kernel to reuse a local socket in TIME_WAIT state, without waiting for its natural timeout to expire. If not specified it will automatically be set to True on UNIX. reuse_port tells the kernel to allow this endpoint to be bound to the same port as other existing endpoints are bound to, so long as they all set this flag when being created. This option is not supported on Windows and some UNIX's. If the :py:data:`~socket.SO_REUSEPORT` constant is not defined then this capability is unsupported. allow_broadcast tells the kernel to allow this endpoint to send messages to the broadcast address. sock can optionally be specified in order to use a preexisting socket object. r|) r$rr remote_addrrrrrrrrs r)create_datagram_endpointz*AbstractEventLoop.create_datagram_endpointsB"!rcKtw)aRegister read pipe in event loop. Set the pipe to non-blocking mode. protocol_factory should instantiate object with Protocol interface. pipe is a file-like object. Return pair (transport, protocol), where transport supports the ReadTransport interface.r|r$rpipes r)connect_read_pipez#AbstractEventLoop.connect_read_pipe"!rcKtw)aRegister write pipe in event loop. protocol_factory should instantiate object with BaseProtocol interface. Pipe is file-like object already switched to nonblocking. Return pair (transport, protocol), where transport support WriteTransport interface.r|rs r)connect_write_pipez$AbstractEventLoop.connect_write_piperr)stdinstdoutstderrcKtwr=r|)r$rcmdrrrkwargss r)subprocess_shellz"AbstractEventLoop.subprocess_shellrrcKtwr=r|)r$rrrrr&rs r)subprocess_execz!AbstractEventLoop.subprocess_exec rrctr=r|r$fdr%r&s r) add_readerzAbstractEventLoop.add_readerrr+ctr=r|r$rs r) remove_readerzAbstractEventLoop.remove_readerrr+ctr=r|rs r) add_writerzAbstractEventLoop.add_writerrr+ctr=r|rs r) remove_writerzAbstractEventLoop.remove_writer"rr+cKtwr=r|)r$rnbytess r) sock_recvzAbstractEventLoop.sock_recv'rrcKtwr=r|)r$rbufs r)sock_recv_intoz AbstractEventLoop.sock_recv_into*rrcKtwr=r|)r$rbufsizes r) sock_recvfromzAbstractEventLoop.sock_recvfrom-rrcKtwr=r|)r$rrr s r)sock_recvfrom_intoz$AbstractEventLoop.sock_recvfrom_into0rrcKtwr=r|)r$rdatas r) sock_sendallzAbstractEventLoop.sock_sendall3rrcKtwr=r|)r$rraddresss r) sock_sendtozAbstractEventLoop.sock_sendto6rrcKtwr=r|)r$rrs r) sock_connectzAbstractEventLoop.sock_connect9rrcKtwr=r|)r$rs r) sock_acceptzAbstractEventLoop.sock_accept<rrcKtwr=r|)r$rrrrrs r) sock_sendfilezAbstractEventLoop.sock_sendfile?rrctr=r|)r$sigr%r&s r)add_signal_handlerz$AbstractEventLoop.add_signal_handlerErr+ctr=r|)r$r$s r)remove_signal_handlerz'AbstractEventLoop.remove_signal_handlerHrr+ctr=r|)r$factorys r)set_task_factoryz"AbstractEventLoop.set_task_factoryMrr+ctr=r|r>s r)get_task_factoryz"AbstractEventLoop.get_task_factoryPrr+ctr=r|r>s r)get_exception_handlerz'AbstractEventLoop.get_exception_handlerUrr+ctr=r|)r$handlers r)set_exception_handlerz'AbstractEventLoop.set_exception_handlerXrr+ctr=r|r$r(s r)default_exception_handlerz+AbstractEventLoop.default_exception_handler[rr+ctr=r|r3s r)rMz(AbstractEventLoop.call_exception_handler^rr+ctr=r|r>s r)r zAbstractEventLoop.get_debugcrr+ctr=r|)r$enableds r) set_debugzAbstractEventLoop.set_debugfrr+)rNN)rNr=)@r1rRrSrTrrrrrr~rrrwrrrrrrrrrrrrsocket AF_UNSPEC AI_PASSIVErrrrrrrrr subprocessPIPErrrrr r rrrrrrrr r"r%r'r*r,r.r1r4rMr r9rVr+r)rrs?""""" """ "26D:>"6:""" )-d" =A""" "#!1""59"$4 "&!%!%$"598"&&##$DT"&!%8"t"#'"%*(,.2-1 "*."4 "&!% "*.""s"&!% ""L"&!% " EI!"./q59d7;$ !"J " "&0__&0oo&0oo"%/OO%/__%/__""""" """""""""(," "" "" """" ""r+rc.eZdZdZdZdZdZdZdZy)rz-Abstract policy for accessing the event loop.ct)a>Get the event loop for the current context. Returns an event loop object implementing the AbstractEventLoop interface, or raises an exception in case no event loop has been set for the current context and the current policy does not specify to create one. It should never return None.r|r>s r)r z&AbstractEventLoopPolicy.get_event_loopms "!r+ct)z3Set the event loop for the current context to loop.r|r$r's r)r z&AbstractEventLoopPolicy.set_event_loopwrr+ct)zCreate and return a new event loop object according to this policy's rules. If there's need to set this loop as the event loop for the current context, set_event_loop must be called explicitly.r|r>s r)r z&AbstractEventLoopPolicy.new_event_loop{s "!r+ct)z$Get the watcher for child processes.r|r>s r)r z)AbstractEventLoopPolicy.get_child_watcherrr+ct)z$Set the watcher for child processes.r|)r$watchers r)r z)AbstractEventLoopPolicy.set_child_watcherrr+N) r1rRrSrTr r r r r rVr+r)rrjs7"""""r+rcVeZdZdZdZGddej ZdZdZ dZ dZ y) BaseDefaultEventLoopPolicyaDefault policy implementation for accessing the event loop. In this policy, each thread has its own event loop. However, we only automatically create an event loop by default for the main thread; other threads by default have no event loop. Other policies may have different rules (e.g. a single global event loop, or automatically creating an event loop per thread, or using some other notion of context to which an event loop is associated). NceZdZdZdZy)!BaseDefaultEventLoopPolicy._LocalNF)r1rRrSr _set_calledrVr+r)_LocalrKs  r+rMc.|j|_yr=)rM_localr>s r)r*z#BaseDefaultEventLoopPolicy.__init__skkm r+c|jj|jjstjtj urd} t jd}|rG|jjd}|dk(s|jdsn|j}|dz }|rF ddl }|jdt| |j!|j#|jj*t%d tjj&z|jjS#t$rYwxYw) zvGet the event loop for the current context. Returns an instance of EventLoop or raises an exception. Nr^rr1asynciozasyncio.rzThere is no current event loop) stacklevelz,There is no current event loop in thread %r.)rOrrL threadingcurrent_thread main_threadr"r# f_globalsget startswithf_backAttributeErrorwarningswarnDeprecationWarningr r RuntimeErrorr)r$rRfmoduler[s r)r z)BaseDefaultEventLoopPolicy.get_event_loops/ KK   %KK++((*i.C.C.EEJ $MM!$ [[__Z8F"i/63D3DZ3PA!OJ   MM:,  E    3 3 5 6 ;;   $M!*!9!9!;!@!@ AB B{{   )"  sE EEcd|j_|2t|ts"t dt |j d||j_y)zSet the event loop.TNzs r)r z)BaseDefaultEventLoopPolicy.new_event_loops !!##r+) r1rRrSrTrerSlocalrMr*r r r rVr+r)rIrIs3 M$!B!$r+rIceZdZdZy) _RunningLoopr:N)r1rRrSloop_pidrVr+r)rhrhsHr+rhc4t}| td|S)zrReturn the running event loop. Raise a RuntimeError if there is none. This function is thread-specific. zno running event loop)rr^r's r)rrs"  D |233 Kr+cbtj\}}||tjk(r|Syy)zReturn the running event loop or None. This is a low-level function intended to be used by event loops. This function is thread-specific. N) _running_loopriosgetpid) running_looppids r)rrs5&..L#C299;$6%7r+cB|tjft_y)zSet the running event loop. This is a low-level function intended to be used by event loops. This function is thread-specific. N)rnrormrirks r)rrs#BIIK0Mr+c`t5t ddlm}|adddy#1swYyxYw)NrDefaultEventLoopPolicy)_lock_event_loop_policyrurts r)_init_event_loop_policyrys!   % 0!7!9  s$-c.t ttS)z"Get the current event loop policy.)rwryrVr+r)rrs!! r+cp|2t|ts"tdt|jd|ay)zZSet the current event loop policy. If policy is None, the default policy is restored.NzDpolicy must be an instance of AbstractEventLoopPolicy or None, not 'rb)rfrrcrr1rw)policys r)rrs> *V5L"M^_cdj_k_t_t^uuvwxxr+cNt}||StjS)aGReturn an asyncio event loop. When called from a coroutine or a callback (e.g. scheduled with call_soon or similar API), this function will always return the running event loop. If there is no running event loop set, the function will return the result of `get_event_loop_policy().get_event_loop()` call. )rrr ) current_loops r)r r s*%&L " 1 1 33r+c6tj|y)zCEquivalent to calling get_event_loop_policy().set_event_loop(loop).N)rr rks r)r r 0s**40r+c2tjS)z?Equivalent to calling get_event_loop_policy().new_event_loop().)rr rVr+r)r r 5s " 1 1 33r+c2tjS)zBEquivalent to calling get_event_loop_policy().get_child_watcher().)rr rVr+r)r r :s " 4 4 66r+c4tj|S)zMEquivalent to calling get_event_loop_policy().set_child_watcher(watcher).)rr )rGs r)r r ?s ! " 4 4W ==r+)rrrr forkcttjt_t dt j dy)Nr.)rwrIrMrOrsignal set_wakeup_fdrVr+r)on_forkr]s0  )(B(I(I(K  %$R r+)after_in_child)/rT__all__rrnrr;r>r"rSrxrrrrrrrIrwLockrvrfrhrmrrrryrrr r r r r _py__get_running_loop_py__set_running_loop_py_get_running_loop_py_get_event_loop_asyncio_c__get_running_loop_c__set_running_loop_c_get_running_loop_c_get_event_loop ImportErrorhasattrrregister_at_forkrVr+r)rs]'   JJZ<&<~'!'!TT"T"n ""DD$!8D$V  9??   1:  4 1 4 7 >*)'# '<< -,*& 2v!Bw/  s> C33C;:C;__pycache__/runners.cpython-312.opt-2.pyc000064400000017652152527367570014151 0ustar00 {|j>dZddlZddlZddlZddlZddlZddlmZddlmZddlm Z ddlm Z ddlm Z Gd d ejZ Gd d Zddd dZdZy))RunnerrunN) coroutines)events) exceptions)tasks) constantsceZdZdZdZdZy)_Statecreated initializedclosedN)__name__ __module__ __qualname__CREATED INITIALIZEDCLOSED(/usr/lib64/python3.12/asyncio/runners.pyr r sGK Frr cLeZdZ ddddZdZdZdZdZddd Zd Z d Z y) rNdebug loop_factoryctj|_||_||_d|_d|_d|_d|_y)NrF) r r_state_debug _loop_factory_loop_context_interrupt_count_set_event_loop)selfrrs r__init__zRunner.__init__0s:nn  )  !$rc&|j|SN) _lazy_initr%s r __enter__zRunner.__enter__9s  rc$|jyr()close)r%exc_typeexc_valexc_tbs r__exit__zRunner.__exit__=s  rcH |jtjury |j}t ||j |j |j |jtj|jrtjd|jd|_tj|_y#|jrtjdjd|_tj|_wxYwr()rr rr!_cancel_all_tasksrun_until_completeshutdown_asyncgensshutdown_default_executorr THREAD_JOIN_TIMEOUTr$rset_event_loopr-r)r%loops rr-z Runner.close@s, ;;f00 0  (::D d #  # #D$;$;$= >  # #..y/L/LM O##%%d+ JJLDJ --DK ##%%d+ JJLDJ --DKs A$CAD!c< |j|jSr()r)r!r*s rget_loopzRunner.get_loopQs) zzrcontextc tj|stdj|t j t d|j| |j}|jj||}tjtjurztjtj tj"urGt%j&|j(|} tjtj |nd}d|_ |jj-||Ytjtj |ur3tjtj tj"SSS#t$rd}YwxYw#t.j0$r4|j*dkDr#t3|dd}||dk(r t5wxYw#|Ytjtj |ur3tjtj tj"wwwxYw)Nz"a coroutine was expected, got {!r}z7Runner.run() cannot be called from a running event loopr<) main_taskruncancel)r iscoroutine ValueErrorformatr_get_running_loop RuntimeErrorr)r"r! create_task threadingcurrent_thread main_threadsignal getsignalSIGINTdefault_int_handler functoolspartial _on_sigintr#r4rCancelledErrorgetattrKeyboardInterrupt)r%coror=tasksigint_handlerr@s rrz Runner.runVs=%%d+AHHNO O  # # % 1IK K  ?mmGzz%%dG%<  $ $ &)*?*?*A A  /63M3MM&..t$ON & fmm^<"N ! I::006*$$V]]3~E fmmV-G-GHF+% &"&  &(( $$q("4T:'HJ!O+--   *$$V]]3~E fmmV-G-GHF+s,$F-7F>- F;:F;>AHHAI%c$|jtjur td|jtjury|j Lt j|_|jsz#Runner._on_sigint..sDr)r#donecancelr!call_soon_threadsaferS)r%signumframer?s rrPzRunner._on_sigintsT "  A %inn.>     JJ + +L 9 !!r) rrrr&r+r1r-r;rr)rPrrrrrs=6!%4%(" $(+IZ)&"rrrc tj tdt||5}|j |cdddS#1swYyxYw)Nz8asyncio.run() cannot be called from a running event loopr)rrDrErr)mainrrrunners rrrsP8!- FH H e, 76zz$ 8 7 7s A  AcBtj|}|sy|D]}|j|jtj|ddi|D]G}|j r|j %|jd|j |dIy)Nreturn_exceptionsTz1unhandled exception during asyncio.run() shutdown)message exceptionrU)r all_tasksr`r4gather cancelledrjcall_exception_handler)r9 to_cancelrUs rr3r3s%I   ELL)LtLM >>   >>  '  ' 'N!^^-)  r)__all__rZenumrNrGrJrrrr r Enumr rrr3rrrrtsW   TYY I"I"X$# Lr__pycache__/format_helpers.cpython-312.opt-1.pyc000064400000007435152527367570015464 0ustar00 {|jd ZddlZddlZddlZddlZddlZddlmZdZdZdZ d dZ d dZ y) N) constantsc\tj|}tj|r$|j}|j|j fSt |tjrt|jSt |tjrt|jSyN) inspectunwrap isfunction__code__ co_filenameco_firstlineno isinstance functoolspartial_get_function_sourcefunc partialmethod)rcodes //usr/lib64/python3.12/asyncio/format_helpers.pyrr s >>$ D$}}  $"5"566$ ))*#DII..$ //0#DII.. c\t||d}t|}|r|d|dd|dz }|S)Nz at r:r)_format_callbackr)rargs func_reprsources r_format_callback_sourcersB tT2I !$ 'F tF1I;aq {33 rcg}|r|jd|D|r&|jd|jDdjdj|S)zFormat function arguments and keyword arguments. Special case for a single parameter: ('hello',) is formatted as ('hello'). c3FK|]}tj|ywrreprlibrepr).0args r z*_format_args_and_kwargs..&s7$3W\\#&$s!c3VK|]!\}}|dtj|#yw)=Nr)r"kvs rr$z*_format_args_and_kwargs..(s)I.$!Qs!GLLO,-.s')z({})z, )extenditemsformatjoin)rkwargsr*s r_format_args_and_kwargsr.sQ E  7$77  I&,,.II ==5) **rct|tjr;t|||z}t |j |j |j|St|dr|jr |j}n0t|dr|jr |j}n t|}|t||z }|r||z }|S)N __qualname____name__) r rrr.rrrkeywordshasattrr0r1r!)rrr-suffixrs rrr,s$ ))*(v6? 499dmmVLLt^$):):%% z "t}}MM J  (v66I V rc|tjj}|tj}t j jt j||d}|j|S)zlReplacement for traceback.extract_stack() that only does the necessary work for asyncio debug mode. F)limit lookup_lines) sys _getframef_backrDEBUG_STACK_DEPTH traceback StackSummaryextract walk_stackreverse)fr6stacks r extract_stackrC>sj y MMO " " }++  " " * *9+?+?+B168= + ?E MMO Lr))NN) rrr r8r<rDrrrr.rrCrrrFs0   +$r__pycache__/format_helpers.cpython-312.opt-2.pyc000064400000007070152527367570015460 0ustar00 {|jd ZddlZddlZddlZddlZddlZddlmZdZdZdZ d dZ d dZ y) N) constantsc\tj|}tj|r$|j}|j|j fSt |tjrt|jSt |tjrt|jSyN) inspectunwrap isfunction__code__ co_filenameco_firstlineno isinstance functoolspartial_get_function_sourcefunc partialmethod)rcodes //usr/lib64/python3.12/asyncio/format_helpers.pyrr s >>$ D$}}  $"5"566$ ))*#DII..$ //0#DII.. c\t||d}t|}|r|d|dd|dz }|S)Nz at r:r)_format_callbackr)rargs func_reprsources r_format_callback_sourcersB tT2I !$ 'F tF1I;aq {33 rc g}|r|jd|D|r&|jd|jDdjdj|S)Nc3FK|]}tj|ywrreprlibrepr).0args r z*_format_args_and_kwargs..&s7$3W\\#&$s!c3VK|]!\}}|dtj|#yw)=Nr)r"kvs rr$z*_format_args_and_kwargs..(s)I.$!Qs!GLLO,-.s')z({})z, )extenditemsformatjoin)rkwargsr*s r_format_args_and_kwargsr.sV E  7$77  I&,,.II ==5) **rct|tjr;t|||z}t |j |j |j|St|dr|jr |j}n0t|dr|jr |j}n t|}|t||z }|r||z }|S)N __qualname____name__) r rrr.rrrkeywordshasattrr0r1r!)rrr-suffixrs rrr,s$ ))*(v6? 499dmmVLLt^$):):%% z "t}}MM J  (v66I V rc |tjj}|tj}t j jt j||d}|j|S)NF)limit lookup_lines) sys _getframef_backrDEBUG_STACK_DEPTH traceback StackSummaryextract walk_stackreverse)fr6stacks r extract_stackrC>so y MMO " " }++  " " * *9+?+?+B168= + ?E MMO Lr))NN) rrr r8r<rDrrrr.rrCrrrFs0   +$r__pycache__/log.cpython-312.pyc000064400000000433152527367570012263 0ustar00 {|j|4dZddlZejeZy)zLogging configuration.N)__doc__logging getLogger __package__logger$/usr/lib64/python3.12/asyncio/log.pyr s   ; 'r __pycache__/base_tasks.cpython-312.opt-2.pyc000064400000007760152527367570014573 0ustar00 {|jp tddlZddlZddlZddlmZddlmZdZejdZdZ dZ y) N) base_futures) coroutinesctj|}|jr|jsd|d<|j dd|j z|j |j dd|j |jr5tj|j}|j dd|d|S) N cancellingrrzname=%rz wait_for=zcoro=<>) r_future_repr_infordoneinsertget_name _fut_waiter_coror_format_coroutine)taskinfocoros +/usr/lib64/python3.12/asyncio/base_tasks.py_task_repr_infor s  ) )$ /D QKK9t}}./ # A4#3#3"678 zz++DJJ7 AvQ'( Kcpdjt|}d|jjd|dS)N >zz 7 " KK !   *  61;;?xt<=) //C  dX&T2  th&?@tL 4(";<4H d3 33CMM3GD $Tr *Hr) r:reprlibr?r1rrrrecursive_reprrr.rJrrrNsC&11 F+r__pycache__/streams.cpython-312.opt-2.pyc000064400000065042152527367570014127 0ustar00 {|jkldZddlZddlZddlZddlZddlZeedredz ZddlmZddlm Z ddlm Z dd lm Z dd lm Z dd l mZdd lmZd ZdeddZdeddZeedrdeddZdeddZGdde j,ZGddee j,ZGddZGddZy)) StreamReader StreamWriterStreamReaderProtocolopen_connection start_serverNAF_UNIX)open_unix_connectionstart_unix_server) coroutines)events) exceptions)format_helpers) protocols)logger)sleepi)limitc K tj}t||}t|| |j fd||fi|d{\}}t | ||}||fS7w)NrlooprcSNprotocols(/usr/lib64/python3.12/asyncio/streams.pyz!open_connection..1s)r get_running_looprrcreate_connectionr) hostportrkwdsrreader transport_writerrs @rrrs}"  " " $D D 1F#F6H///$.(,..LIq )Xvt .sA A*A(A*cK tjfd}j|||fi|d{S7w)Nc>t}t|}|SNrrrrr%rclient_connected_cbrrs rfactoryzstart_server..factoryNs&E5'0C-13r)r r create_server)r.r"r#rr$r/rs` ` @rrr6sE(  " " $D $##GT4@4@ @@ @s5A?AcK tj}t||}t|||jfd|fi|d{\}}t |||}||fS7w)NrrcSrrrsrrz&open_unix_connection..bsHr)r r rrcreate_unix_connectionr) pathrr$rr%r&r'r(rs @rr r ZswN&&(E5'T:8T88 d,&*,, 1i64@v~,sA A) A'A)cK tjfd}j||fi|d{S7w)Nc>t}t|}|Sr+r,r-s rr/z"start_unix_server..factoryks&!D9F+F4G157HOr)r r create_unix_server)r.r4rr$r/rs` ` @rr r fs?K&&(  -T,,WdCdCCCCs4A>Ac4eZdZ ddZdZdZdZdZdZy) FlowControlMixinNc|tj|_n||_d|_t j |_d|_yNF)r get_event_loop_loop_paused collectionsdeque_drain_waiters_connection_lost)selfrs r__init__zFlowControlMixin.__init__~s> <..0DJDJ )//1 %rctd|_|jjrtjd|yy)NTz%r pauses writing)r>r= get_debugrdebugrCs r pause_writingzFlowControlMixin.pause_writings- ::   ! LL,d 3 "rcd|_|jjrtjd||j D]$}|j r|jd&y)NFz%r resumes writing)r>r=rFrrGrAdone set_resultrCwaiters rresume_writingzFlowControlMixin.resume_writingsO ::   ! LL-t 4))F;;=!!$'*rcd|_|jsy|jD]8}|jr||j d(|j |:yNT)rBr>rArKrL set_exceptionrCexcrNs rconnection_lostz FlowControlMixin.connection_lostsN $|| ))F;;=;%%d+((- *rcNK|jr td|jsy|jj }|j j | |d{|j j|y7 #|j j|wxYww)NzConnection lost)rBConnectionResetErrorr>r= create_futurerAappendremoverMs r _drain_helperzFlowControlMixin._drain_helpers  &'89 9|| ))+ ""6* /LL    & &v .     & &v .s0AB%B"B#B'B%BB""B%ctr)NotImplementedErrorrCstreams r_get_close_waiterz"FlowControlMixin._get_close_waiters!!rr) __name__ __module__ __qualname__rDrIrOrUr[r`rrrr9r9ts%&4 ( . /"rr9cdeZdZ dZd fd ZedZdZdZfdZ dZ dZ d Z d Z xZS) rNc4t|||,tj||_|j |_nd|_|||_d|_d|_d|_ d|_ ||_ d|_ |jj|_y)NrF)superrDweakrefref_stream_reader_wr_source_traceback_strong_reader_reject_connection_stream_writer_task _transport_client_connected_cb _over_sslr=rX_closed)rC stream_readerr.r __class__s rrDzStreamReaderProtocol.__init__s d#  $%,[[%?D "%2%D%DD "%)D "  *#0D "'" $7!zz//1 rc<|jy|jSr)rirHs r_stream_readerz#StreamReaderProtocol._stream_readers  ! ! )%%''rc|j}|j}||_||_|j ddu|_y)N sslcontext)r=r&rmroget_extra_inforq)rCr(rr&s r_replace_writerz$StreamReaderProtocol._replace_writers<zz$$ $#"11,?tKrcxjrKddi}jrj|d<jj|j y_j }||jjddu_ jt|j_ j|j}tj|rAfd}jj|_j j#|d_yy)NmessagezpAn open stream was garbage collected prior to establishing network connection; call "stream.close()" explicitly.source_tracebackrxc|jrjy|j}|0jj d|djyy)Nz*Unhandled exception in client_connected_cb)r| exceptionr&) cancelledcloserr=call_exception_handler)taskrTrCr&s rcallbackz6StreamReaderProtocol.connection_made..callbacks\~~'!)..*C 99'S),)2; ") 'r)rlrjr=rabortrorv set_transportryrqrprrmr iscoroutine create_taskrnadd_done_callbackrk)rCr&contextr%resrs`` rconnection_madez$StreamReaderProtocol.connection_mades#  " "@G %%.2.D.D*+ JJ - -g 6 OO  #$$     +"11,?tK  $ $ 0".y$/5/3zz#;D ++F,0,?,?AC%%c* *"ZZ33C8  ,,X6"&D / 1rcf|j}|$||jn|j||jj s9||jj dn|jj|t ||d|_d|_ d|_ d|_ yr) rvfeed_eofrRrrrKrLrfrUrirmrnro)rCrTr%rts rrUz$StreamReaderProtocol.connection_lost s$$  {!$$S)||  "{ ''- **3/ $!%" rcD|j}||j|yyr)rv feed_data)rCdatar%s r data_receivedz"StreamReaderProtocol.data_receiveds&$$     T " rcZ|j}||j|jryy)NFT)rvrrq)rCr%s r eof_receivedz!StreamReaderProtocol.eof_received!s,$$   OO  >>rc|jSr)rrr^s rr`z&StreamReaderProtocol._get_close_waiter,s ||rc |j}|jr"|js|jyyy#t$rYywxYwr)rrrKrrAttributeError)rCcloseds r__del__zStreamReaderProtocol.__del__/sM #\\F{{}V%5%5%7  "&8}   s A A  A NN)rarbrcrjrDpropertyrvrzrrUrrr`r __classcell__)rts@rrrsN2((( L('T$#  #rrcxeZdZ dZdZedZdZdZdZ dZ dZ d Z d Z dd Zd Zd d d ddZdZy )rc||_||_||_||_|jj |_|j j dyr)ro _protocol_readerr=rX _complete_futrL)rCr&rr%rs rrDzStreamWriter.__init__EsI#!  !ZZ557 %%d+rc|jjd|jg}|j|j d|jdj dj |S)N transport=zreader=<{}> )rtrarorrYformatjoinrCinfos r__repr__zStreamWriter.__repr__Os['':doo5H)IJ << # KK'$,,!12 3}}SXXd^,,rc|jSrrorHs rr&zStreamWriter.transportUs rc:|jj|yr)rowriterCrs rrzStreamWriter.writeYs d#rc:|jj|yr)ro writelinesrs rrzStreamWriter.writelines\s ""4(rc6|jjSr)ro write_eofrHs rrzStreamWriter.write_eof_s((**rc6|jjSr)ro can_write_eofrHs rrzStreamWriter.can_write_eofbs,,..rc6|jjSr)rorrHs rrzStreamWriter.closees$$&&rc6|jjSr)ro is_closingrHs rrzStreamWriter.is_closinghs))++rcVK|jj|d{y7wr)rr`rHs r wait_closedzStreamWriter.wait_closedksnn..t444s )')Nc:|jj||Sr)rory)rCnamedefaults rryzStreamWriter.get_extra_infons--dG<!B8B9BB)server_hostnamessl_handshake_timeoutssl_shutdown_timeoutc &K |jjdu}|j}|jd{|jj |j ||||||d{}||_|j |y7Q7w)N) server_siderrr)rrprr= start_tlsrorz)rCrxrrrrr new_transports rrzStreamWriter.start_tlss Bnn99E >>jjl"jj22 OOXz#_"7!5 377 (  & 7s!9BB 3B/B0BBc|jjsc|jjrt j dt y|jt j d|t yy)Nzloop is closedz unclosed )rorr= is_closedwarningswarnResourceWarningrrHs rrzStreamWriter.__del__sT))+zz##% .@  $2OD ,rr)rarbrcrDrrr&rrrrrrrryrrrrrrrr;sh,- $)+/',5=-4)-.2-1' ErrceZdZdZedfdZdZdZdZdZ dZ dZ d Z d Z d Zd Zd ZddZddZdZdZdZy)rNcl|dkr td||_|tj|_n||_t |_d|_d|_d|_ d|_ d|_ |jjr.tjtj d|_yy)NrzLimit cannot be <= 0Fr ) ValueError_limitr r<r= bytearray_buffer_eof_waiter _exceptionror>rFr extract_stacksys _getframerj)rCrrs rrDzStreamReader.__init__s A:34 4 <..0DJDJ {    ::   !%3%A%A a &"D " "rcdg}|jr'|jt|jd|jr|jd|jt k7r|jd|j|j r|jd|j |jr|jd|j|jr|jd|j|jr|jdd jd j|S) Nrz byteseofzlimit=zwaiter=z exception=rpausedrr) rrYlenrr_DEFAULT_LIMITrrror>rrrs rrzStreamReader.__repr__s << KK3t||,-V4 5 99 KK  ;;. ( KK& . / << KK'$,,!12 3 ?? KK*T__$78 9 ?? KK*T__$78 9 << KK !}}SXXd^,,rc|jSr)rrHs rrzStreamReader.exceptions rc||_|j}|*d|_|js|j|yyyr)rrrrRrSs rrRzStreamReader.set_exceptionsC  DL##%$$S)& rcv |j}|*d|_|js|jdyyyr)rrrLrMs r_wakeup_waiterzStreamReader._wakeup_waiters??  DL##%!!$'& rc||_yrr)rCr&s rrzStreamReader.set_transports #rc|jrEt|j|jkr"d|_|jj yyyr;)r>rrrroresume_readingrHs r_maybe_resume_transportz$StreamReader._maybe_resume_transports; <rr pause_readingr]rs rrzStreamReader.feed_datas  D!  OO 'LLDLL!A O3 $--/ $ 4! ( ' '#'  's-BB%$B%c.K |jt|d|jr!d|_|jj |j j |_ |jd{d|_y7 #d|_wxYww)NzF() called while another coroutine is already waiting for incoming dataF)r RuntimeErrorr>rorr=rX)rC func_names r_wait_for_datazStreamReader._wait_for_data s  << #+456 6 << DL OO * * ,zz//1  ,,  DL DLs0A(B+B :B;B ?BB BBcK d}t|} |j|d{}|S7#tj$r}|jcYd}~Sd}~wtj $r}|j j||jr|j d|j|z=n|j j|jt|jdd}~wwxYww)N r) r readuntilrIncompleteReadErrorpartialLimitOverrunErrorr startswithconsumedclearrrargs)rCsepseplenlinees rreadlinezStreamReader.readline%s S (,,D --- 99 ++ (||&&sAJJ7LL!5!**v"5!56 ""$  ( ( *QVVAY' '  (sJC6/-/C6/C3 A C3C6C3)BC..C33C6cK t|}|dk(r td|j |jd} t|j}||z |k\rO|jj ||}|dk7rn|dz|z }||j kDrt jd||jrEt|j}|jjt j|d|jdd{||j kDrt jd||jd||z}|jd||z=|jt|S7iw)Nrz,Separator should be at least one-byte stringr z2Separator is not found, and chunk exceed the limitrz2Separator is found, but chunk is longer than limit)rrrrfindrrrrbytesrrrr)rC separatorroffsetbuflenisepchunks rrzStreamReader.readuntilDs &Y Q;KL L ?? &// !*&F&(||((F;2: !f,DKK'$66L  yydll+ ""$ 44UDAA%%k2 2 2=@ $++ ..DdL L ^dVm, LL$- ( $$&U| 3sD E7 E5 A*E7cK |j |j|dk(ry|dkrLg} |j|jd{}|sn|j|8dj |S|j s%|j s|jdd{tt|j d|}|j d|=|j|S77Hw)Nrrread) rr rrYrrrrr memoryviewr)rCnblocksblockrs rr zStreamReader.reads * ?? &// ! 6 q5 F"ii 44 e$  88F# #||DII%%f- - -Z -bq12 LL!  $$& 5 .s&AC*C& AC*C( AC*(C*cK |dkr td|j |j|dk(ryt|j|kr|jrEt |j}|jj tj|||jdd{t|j|krt|j|k(r0t |j}|jj n0t t|jd|}|jd|=|j|S7w)Nrz*readexactly size can not be less than zeror readexactly) rrrrrrrrrrr r)rCr  incompleters rrzStreamReader.readexactlys  q5IJ J ?? &// ! 6$,,!#yy"4<<0  ""$ 44ZCC%%m4 4 4 $,,!# t||  !&D LL   DLL1"156D RaR  $$&  5sB-E/E0E B Ec|SrrrHs r __aiter__zStreamReader.__aiter__s rcXK|jd{}|dk(rt|S7w)Nr)rStopAsyncIteration)rCvals r __anext__zStreamReader.__anext__s+MMO# #:$ $ $s *(*)r)r)rarbrcrjrrDrrrRrrrrrrrrrr rrrrrrrrsf+$",-$*($- .$, 8>Yv1f'Rrrrr)__all__r?socketrrrghasattrr r rrrlogrtasksrrrrr r Protocolr9rrrrrrrs '  69 <)filenorrr getsocknamesocketerror getpeername)r sladdrraddrs r __repr__zTransportSocket.__repr__s*4;;=/:kk_GDII=9ZZL " ;;=B  ((*#XeW-A ((*#XeW-AAw<<   <<  s$B)B BB B65B6ctd)Nz/Cannot serialize asyncio.TransportSocket object) TypeErrorrs r __getstate__zTransportSocket.__getstate__5sIJJr c6|jjSr )rrrs r rzTransportSocket.fileno8szz  ""r c6|jjSr )rduprs r r&zTransportSocket.dup;szz~~r c6|jjSr )rget_inheritablers r r(zTransportSocket.get_inheritable>szz))++r c:|jj|yr )rshutdown)r hows r r*zTransportSocket.shutdownAs C r c:|jj|i|Sr )r getsockoptr argskwargss r r-zTransportSocket.getsockoptFs$tzz$$d5f55r c<|jj|i|yr )r setsockoptr.s r r2zTransportSocket.setsockoptIs t.v.r c6|jjSr )rrrs r rzTransportSocket.getpeernameLzz%%''r c6|jjSr )rrrs r rzTransportSocket.getsocknameOr4r c6|jjSr )r getsockbynamers r r7zTransportSocket.getsockbynameRszz''))r c$|dk(rytd)Nrzr r rrsIV]]!!  .K# ,! 6/((*L Cr r)rrr>r r rHs ^C^Cr __pycache__/taskgroups.cpython-312.pyc000064400000020374152527367570013712 0ustar00 {|jW%@dZddlmZddlmZddlmZGddZy)) TaskGroup)events) exceptions)taskscXeZdZdZdZdZdZdZdZdddd Z d e d e fd Z d Z dZy)ra9Asynchronous context manager for managing groups of tasks. Example use: async with asyncio.TaskGroup() as group: task1 = group.create_task(some_coroutine(...)) task2 = group.create_task(other_coroutine(...)) print("Both tasks have completed now.") All tasks are awaited when the context manager exits. Any exceptions other than `asyncio.CancelledError` raised within a task will cancel all remaining tasks and wait for them to exit. The exceptions are then combined and raised as an `ExceptionGroup`. cd|_d|_d|_d|_d|_d|_t |_g|_d|_ d|_ y)NF) _entered_exiting _aborting_loop _parent_task_parent_cancel_requestedset_tasks_errors _base_error_on_completed_futselfs +/usr/lib64/python3.12/asyncio/taskgroups.py__init__zTaskGroup.__init__sN    (-%e  !%cxdg}|jr'|jdt|j|jr'|jdt|j|jr|jdn|j r|jddj |}d|dS) Nztasks=zerrors= cancellingentered z )rappendlenrr r join)rinfoinfo_strs r__repr__zTaskGroup.__repr__(st ;; KK&T[[!1 23 4 << KK'#dll"3!45 6 >> KK % ]] KK "88D>H:Q''rcK|jrtd|d|jtj|_t j |j|_|jtd|dd|_|Sw)N TaskGroup z has already been enteredz! cannot determine the parent taskT)r RuntimeErrorr rget_running_loopr current_taskr rs r __aenter__zTaskGroup.__aenter__6s ==TH$=>@ @ :: 002DJ!..tzz:    $TH$EFH H  sB B cKd} |j||d{d|_d|_d|_d}S7#d|_d|_d|_d}wxYwwN)_aexitr rr)retexctbs r __aexit__zTaskGroup.__aexit__Dsc  R-- !%D DL#D C. !%D DL#D Cs%A979A9AAcKd|_|$|j|r|j||_|tjur|nd}|j r|j jdk(rd}||js|j|jrT|j|jj|_ |jd{d|_ |jrT|jrJ|j |j |r|js |d}|-|tjur|jj||jr t!d|jdy7#tj$r(}|js|}|jYd}~d}~wwxYw#d}wxYw#d}wxYw#d}wxYw#d}wxYww)NTzunhandled errors in a TaskGroup)r _is_base_errorrrCancelledErrorrr uncancelr _abortrrr create_futurerrBaseExceptionGroup)rr.r/propagate_cancellation_errorexs rr-zTaskGroup._aexitRs O##C(  ("D 222C %  ( (  ))+q004, >>> kk%%-)-)A)A)C& ",,,,&*D "'kk*;;    ' &&&  0+DLL66,0 ( >b (A(AA LL   $ << (5LL M-,, "~~460KKM "*C+/ (sCGFE>FG/G F>G &G(=G&G=G>FF;F61G6F;;G>GGG  G GGGGN)namecontextc|jstd|d|jr|jstd|d|jrtd|d||j j |}n|j j ||}tj|||jj||j|j |~S#~wxYw)zbCreate a new task in this group and return it. Similar to `asyncio.create_task`. r&z has not been enteredz is finishedz is shutting down)r=) r r'r rr r create_taskr_set_task_nameaddadd_done_callback _on_task_done)rcoror<r=tasks rr?zTaskGroup.create_tasks }}D83HIJ J ==D8<@A A >>D83DEF F ?::))$/D::))$)@D T4(  t112 s &C))C,r/returncRt|tsJt|ttfSr,) isinstance BaseException SystemExitKeyboardInterrupt)rr/s rr4zTaskGroup._is_base_errors%#}---# ,=>??rcvd|_|jD]#}|jr|j%y)NT)r rdonecancel)rts rr7zTaskGroup._aborts)A668 rc|jj||jA|js5|jjs|jj d|j ry|j }|y|jj||j|r|j||_ |jjr1|jjd|d|jd||dy|js?|js2|j!d|_|jj#yyy)NTzTask z% has errored out but its parent task z is already completed)message exceptionrE)rdiscardrrM set_result cancelledrRrrr4rr r call_exception_handlerr rr7rN)rrEr/s rrCzTaskGroup._on_task_dones3 D!  ! ! -dkk))..0&&11$7 >>  nn ;  C   s #(8(8(@"D     ! ! # JJ - -"4(+##'#4#4"55JL  /  ~~d&C&C& KKM,0D )    $ $ &+'D~r)__name__ __module__ __qualname____doc__rr$r*r1r-r?rIboolr4r7rCrrrr sO & (  Wt)-dF@-@D@2'rrN)__all__rrrrrr\rrr^s! @'@'r__pycache__/format_helpers.cpython-312.pyc000064400000007435152527367570014525 0ustar00 {|jd ZddlZddlZddlZddlZddlZddlmZdZdZdZ d dZ d dZ y) N) constantsc\tj|}tj|r$|j}|j|j fSt |tjrt|jSt |tjrt|jSyN) inspectunwrap isfunction__code__ co_filenameco_firstlineno isinstance functoolspartial_get_function_sourcefunc partialmethod)rcodes //usr/lib64/python3.12/asyncio/format_helpers.pyrr s >>$ D$}}  $"5"566$ ))*#DII..$ //0#DII.. c\t||d}t|}|r|d|dd|dz }|S)Nz at r:r)_format_callbackr)rargs func_reprsources r_format_callback_sourcersB tT2I !$ 'F tF1I;aq {33 rcg}|r|jd|D|r&|jd|jDdjdj|S)zFormat function arguments and keyword arguments. Special case for a single parameter: ('hello',) is formatted as ('hello'). c3FK|]}tj|ywrreprlibrepr).0args r z*_format_args_and_kwargs..&s7$3W\\#&$s!c3VK|]!\}}|dtj|#yw)=Nr)r"kvs rr$z*_format_args_and_kwargs..(s)I.$!Qs!GLLO,-.s')z({})z, )extenditemsformatjoin)rkwargsr*s r_format_args_and_kwargsr.sQ E  7$77  I&,,.II ==5) **rct|tjr;t|||z}t |j |j |j|St|dr|jr |j}n0t|dr|jr |j}n t|}|t||z }|r||z }|S)N __qualname____name__) r rrr.rrrkeywordshasattrr0r1r!)rrr-suffixrs rrr,s$ ))*(v6? 499dmmVLLt^$):):%% z "t}}MM J  (v66I V rc|tjj}|tj}t j jt j||d}|j|S)zlReplacement for traceback.extract_stack() that only does the necessary work for asyncio debug mode. F)limit lookup_lines) sys _getframef_backrDEBUG_STACK_DEPTH traceback StackSummaryextract walk_stackreverse)fr6stacks r extract_stackrC>sj y MMO " " }++  " " * *9+?+?+B168= + ?E MMO Lr))NN) rrr r8r<rDrrrr.rrCrrrFs0   +$r__pycache__/threads.cpython-312.opt-1.pyc000064400000002354152527367570014077 0ustar00 {|j.dZddlZddlZddlmZdZdZy)z6High-level support for working with threads in asyncioN)events) to_threadcKtj}tj}t j |j |g|i|}|jd|d{S7w)aAsynchronously run function *func* in a separate thread. Any *args and **kwargs supplied for this function are directly passed to *func*. Also, the current :class:`contextvars.Context` is propagated, allowing context variables from the main thread to be accessed in the separate thread. Return a coroutine that can be awaited to get the eventual result of *func*. N)rget_running_loop contextvars copy_context functoolspartialrunrun_in_executor)funcargskwargsloopctx func_calls (/usr/lib64/python3.12/asyncio/threads.pyrr s]  " " $D  " " $C!!#''4A$A&AI%%dI6 66 6sA"A+$A)%A+)__doc__r rr__all__rrrs<  7r__pycache__/tasks.cpython-312.pyc000064400000116570152527367570012641 0ustar00 {|jdZdZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddlm Z ddl m Z ddl mZddl mZdd l mZdd l mZdd l mZej&dj(Zd/d Zd/d ZdZGddej2ZeZ ddlZej4xZZddddZej"j@Z ej"jBZ!ej"jDZ"de"ddZ#dZ$dZ%dZ&dZ'dddZ(ejRdZ*d/dZ+dddZ,Gdd ejZZ.d!d"d#Z/d$Z0d%Z1d&Z2e2eZ3e jhZ5e6Z7iZ8d'Z9d(Z:d)Z;d*Zd-Z?eZ@e9ZAe:ZBe>ZCe?ZDe;ZEeZ>m?Z?m;Z;mZKe?ZLe;ZMeD!  #t+AFFH D >>   FADy   >sB0B"BBc| |j}||yy#t$rtjdtdYywxYw)Nz~Task.set_name() was added in Python 3.8, the method support will be mandatory for third-party task implementations since 3.13.) stacklevel)set_nameAttributeErrorwarningswarnDeprecationWarning)tasknamer8s r&_set_task_namer?FsM  }}H TN 8 MM9)Q 8 8s %AAceZdZdZdZdddddfd ZfdZeeZ dZ d Z d Z d Z d Zd ZdZdddZddddZddZdZdZdZddZfdZdZxZS)rz A coroutine wrapped in a Future.TNFr%r>context eager_startcFt|||jr |jd=tj|sd|_t d||dt|_nt||_d|_ d|_ d|_ ||_ |tj|_n||_|r+|j"j%r|j'y|j"j)|j*|j t-|y)Nr$Fza coroutine was expected, got zTask-rrB)super__init___source_tracebackr iscoroutine_log_destroy_pending TypeError_task_name_counter_namestr_num_cancels_requested _must_cancel _fut_waiter_coro contextvars copy_context_context_loop is_running_Task__eager_start call_soon _Task__stepr)selfcoror%r>rBrC __class__s r&rHz Task.__init__os d#  ! !&&r*%%d+).D %>r'cd|_|jry|xjdz c_|j|jj |ryd|_||_y)aRequest 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). This also increases the task's count of cancellation requests. FrmsgT)_log_tracebackr0rPrRcancelrQ_cancel_message)r\rs r&rz Task.cancelsf,$ 99; ##q(#    '&&3&/ "r'c|jS)zReturn the count of the task's cancellation requests. This count is incremented when .cancel() is called and may be decremented using .uncancel(). rPris r& cancellingzTask.cancellings ***r'cb|jdkDr|xjdzc_|jS)zDecrement the task's count of cancellation requests. This should be called by the party that called `cancel()` on the task beforehand. Returns the remaining number of cancellation requests. rrrris r&uncancelz Task.uncancels/  & & *  ' '1 , '***r'ct|j|} t| |jj |j dt | t|j|}||usJ |jr d|_d}yt|y#t |wxYw#|jr d|_d}wt|wxYw# t|j|}||usJ |jr d|_d}wt|w#|jr d|_d}wt|wxYwxYwrg) _swap_current_taskrW_register_eager_taskrVrun!_Task__step_run_and_handle_result_unregister_eager_taskr0rSr)r\ prev_taskcurtasks r& __eager_startzTask.__eager_starts&tzz48  )  & - !!$"C"CTJ&t, ),TZZC$&99;!%DJD"4('t, 99;!%DJD"4( ),TZZC$&99;!%DJD"4( 99;!%DJD"4(sF C&B CB* B''C*'CED3&E'EEc|jrtjd|d||jr1t |tj s|j }d|_d|_t|j| |j|t|j|d}y#t|j|d}wxYw)Nz_step(): already done: z, F) r0rInvalidStateErrorrQ isinstanceCancelledError_make_cancelled_errorrRrrWrr)r\excs r&__stepz Task.__step#s 99;..)$C7;= =   c:#<#<=002 %D DJJ%   - -c 2  D )D  D )Ds B11C c|j} ||jd}n|j|}t|dd}|lt j ||j urGtd|d|d}|j j|j||jd}y|r||urCtd|}|j j|j||jd}yd|_ |j|j|j||_|jrN|jj!|j"r'd|_ d}ytd |d |}|j j|j||j d}y|4|j j|j|jd}yt%j&|rFtd |d |}|j j|j||jd}ytd |}|j j|j||j d}yd}y#t($rS}|jr"d|_t*|A|j"nt*|Y|j.Yd}~d}yd}~wt0j2$r!}||_t*|AYd}~d}yd}~wt6t8f$r}t*|u|d}~wt<$r}t*|u|Yd}~d}yd}~wwxYw#d}wxYw) N_asyncio_future_blockingzTask z got Future z attached to a different looprFzTask cannot await on itself: Frz-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: )rSsendthrowgetattrrr/rWr,rZr[rVradd_done_callback _Task__wakeuprRrQrrinspect isgenerator StopIterationrGrwrsrr_cancelled_excKeyboardInterrupt SystemExitrz BaseException)r\rr]rvblockingnew_excr^s r&__step_run_and_handle_resultz!Task.__step_run_and_handle_result4sezzG {4C$v'A4HH#$$V,DJJ>*x|!*$ACDGJJ(( Wdmm)EPDM~".;D8D#F ,, KK$---IDD?;@700 MM4==1B+1(,,#//66(,(<(< 7 >49 10D-+##'(& <=GJJ(( Wdmm)E&D! $$T[[$--$HD$$V,&))-vjBC $$KK$--%AD ')=fZ'HI $$KK$--%AD4DA .  $)!4#7#78"399-tDs(( "%D  GN  lDk":.  G !# &  ' G !# & &bDe 'dDs%JA5M,AM5A0M)AM03M&AMAM MAKMM5L MM#L33 M?MMMMM!c |j|jd}y#t$r}|j|Yd}~d}yd}~wwxYwrg)rvr[r)r\futurers r&__wakeupz Task.__wakeupsH  MMO KKM  KK   s% A AA rg)__name__ __module__ __qualname____doc__rKrHre classmethodr__class_getitem__rjrlrorqr8rwrzr~rrrrrYr[rr __classcell__r^s@r&rrSs+. %)d"!> $L1+ IL"&7.$(d ?(T+ +)&"IVr'rr>rBctj}||j|}n|j||}t|||S)z]Schedule the execution of a coroutine object in a spawn task. Return a Task object. rF)rr!rr?)r]r>rBr%r=s r&rrsK  " " $D%g64 Kr')timeout return_whencKtj|stj|r!t dt |j |s td|tttfvrtd|t|}td|Dr t dtj}t||||d{S7w)a}Wait for the Futures or Tasks 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 zSet of Tasks/Futures is empty.zInvalid return_when value: c3FK|]}tj|ywrg)rrJ).0fs r& zwait..s 1b: ! !! $bs!z6Passing coroutines is forbidden, use tasks explicitly.N)risfuturerrJrLtyper ValueErrorrrrsetanyrr!_wait)fsrrr%s r&rrs z55b98b9J9J8KLMM 9::?O]KK6{mDEE RB 1b 11PQQ  " " $Dr7K6 66 6sCC C CcH|js|jdyyrg)r0rw)waiterargss r&_release_waiterrs ;;=$ r'cK|T|dkrOt|}|jr|jSt|d{ |jStj|4d{|d{cdddd{S7N#tj $r }t |d}~wwxYw7C7;7-#1d{7swYyxYww)aWait 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. If the task suppresses the cancellation and returns a value instead, that value is returned. This function is a coroutine. Nr) r r0rv_cancel_and_waitrr TimeoutErrorrr)futrrs r&rrsFw!|C  88:::< s### (::< ((y)(( $(( (C ' ())(((sACBC BC2B63C6B<<B8=B< C B: CB3'B..B33C8B<:C<CC C CcB K|sJd|j d ||j|t  t| fd}|D]}|j | d{  j |D]}|j | tt}}|D]5}|jr|j|%|j|7||fS7#  j |D]}|j |wxYww)zVInternal helper for wait(). The fs argument must be a collection of Futures. zSet of Futures is empty.Ncdzdks2tk(s)tk(rW|jsF|j5j j sj dyyyyy)Nrr)rr cancelledryrr0rw)rcounterrtimeout_handlers r&_on_completionz_wait.._on_completionst1  qL ? * ? *AKKM01 0I)%%';;=!!$'!1J5B *r') create_future call_laterrlenrrremove_done_callbackrr0add) rrrr%rrr0pendingrrrs ` @@@r&rr s )))2    !FN/6J"gG ( N+3  %  ! ! #A " "> 2E35'D  668 HHQK KKN  =   %  ! ! #A " "> 2s1A D'C0,C.-C01A=D.C00,DDc2Ktj}|j}tjt |}|j | |j|d{|j|y7#|j|wxYww)z._on_timeoutds2A " "> 2 OOD ! r'c|syj|j|sjyyyrg)removerr)rr0rrs r&rz$as_completed.._on_completionjs;  A 2  ! ! #3tr'cKjd{}|tj|jS7&wrg)r#rrrv)rr0s r& _wait_for_onez#as_completed.._wait_for_oners7((*  9)) )xxz sA>'A)rrrrJrLrrqueuesrrget_event_looprr rrranger) rrrr%rrr_rr0rrs @@@@r&r r Hs$z55b9=d2h>O>O=PQRR 7D  "D14R 9AM!$ ' 9DN $ N+ #+> 3t9 o9 :sA:DC=A.Dc#Kdyw)zSkip 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. Nrr'r&__sleep0rs  sc0K|dkrtd{|Stj}|j}|j |t j ||} |d{|jS7g7#|jwxYww)z9Coroutine that completes after a given time (in seconds).rN)rrr!rrr_set_result_unless_cancelledr)delayrvr%rhs r&r r s zj  " " $D    !F << (A|     s:BA=A B#B(A?)B,B?BBBr$ctj|r&|"|tj|ur td|Sd}t j |s.t j|rd}||}d}n td|tj} |j|S#t$r|r|jwxYw)zmWrap a coroutine or an awaitable in a future. If the argument is a Future, it is returned directly. zRThe future belongs to a different loop than the one specified as the loop argumentTc"K|d{S7wrgr) awaitables r&_wrap_awaitablez&ensure_future.._wrap_awaitables&&s  Fz:An asyncio.Future, a coroutine or an awaitable is required)rrr/rrrJr isawaitablerLrrrr,close)coro_or_futurer% should_closers r&r r s '  G,=,=n,M MEF FL  ! !. 1   ~ . '-^._done_callbacks,Q =EJJL==?   }}//1##C(mmo?'',  G==?%33!119++-C--/C{!jjls# "&&//1##C(  ); r'rNr$Fr) rrrrwr rr/rKr0r rr) r coros_or_futuresr%r arg_to_fut done_futsargrrrrrs ` @@@@r&r r s < $$&""$  5*5*nJH EII D E j $/C|((-#~ ,1( QJE!JsOxxz  %%%n5S/C/ 2 XD 1E s Lr'ct|jrStj}|j fdfd}j j |S)aWait for a future, shielding it from cancellation. The statement task = asyncio.create_task(something()) res = await shield(task) 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: task = asyncio.create_task(something()) try: res = await shield(task) except CancelledError: res = None Save a reference to tasks passed to this function, to avoid a task disappearing mid-execution. The event loop only keeps weak references to tasks. A task that isn't referenced elsewhere may get garbage collected at any time, even before it's done. c0jr!|js|jy|jrjy|j}|j|yj |j yrg)rryrrzrwrv)innerrrs r&_inner_done_callbackz$shield.._inner_done_callbacksj ?? ??$!  ??  LLN//#C##C(  0r'cJjsjyyrg)r0r)rrrs r&_outer_done_callbackz$shield.._outer_done_callbacks zz|  & &'; <r')r r0rr/rr)rr%rrrrs @@@r&r r askB # E zz|   U #D    E1"= 01 01 Lr'ctjs tdtjj fd}j |S)zsSubmit a coroutine object to a given event loop. Return a concurrent.futures.Future to access the result. zA coroutine object is requiredc tjty#ttf$rt $r'}j rj|d}~wwxYw)Nr$)r _chain_futurer rrrset_running_or_notify_cancelrz)rr]rr%s r&callbackz*run_coroutine_threadsafe..callbacks]   ! !-4"@& I-.   224$$S)  s!%A$"AA$)rrJrL concurrentrFuturecall_soon_threadsafe)r]r%r"rs`` @r&rrsM  ! !$ '899    & & (F h' Mr'cdddfd }|S)a=Create a function suitable for use as a task factory on an event-loop. Example usage: loop.set_task_factory( asyncio.create_eager_task_factory(my_task_constructor)) Now, tasks created will be started immediately (rather than being first scheduled to an event loop). The constructor argument can be any callable that returns a Task-compatible object and has a signature compatible with `Task.__init__`; it must have the `eager_start` keyword argument. Most applications will use `Task` for `custom_task_constructor` and in this case there's no need to call `create_eager_task_factory()` directly. Instead the global `eager_task_factory` instance can be used. E.g. `loop.set_task_factory(asyncio.eager_task_factory)`. Nrc||||dS)NTrAr)r%r]r>rBcustom_task_constructors r&factoryz*create_eager_task_factory..factorys& t$TK Kr'r)r(r)s` r&rrs&%)$K Nr'c.tj|y)z;Register an asyncio Task scheduled to run on an event loop.N)r+rr=s r&rrsr'c.tj|y)z6Register an asyncio Task about to be eagerly executed.N)r*rr+s r&rrsTr'chtj|}|td|d|d|t|<y)NzCannot enter into task z while another task z is being executed.r"r#r,r%r=rs r&rrsL!%%d+L4TH=##/"22EGH HN4r'chtj|}||urtd|d|dt|=y)Nz Leaving task z! does not match the current task .r.r/s r&rrsJ!%%d+L4]4(3//;.>aAB Btr'cXtj|}| t|=|S|t|<|Srg)r"r#)r%r=rs r&rrs9""4(I | 4   $t r'c.tj|y)z'Unregister a completed, scheduled Task.N)r+discardr+s r&rrsT"r'c.tj|y)z6Unregister a task which finished its first eager step.N)r*r4r+s r&rr sr') rrrrrrrr+r*r"rrg)Pr__all__concurrent.futuresr#rTrrr-typesr:weakrefrr rrrrrrcount__next__rMrrr? _PyFuturer_PyTask_asyncio_CTask ImportErrorrrrrrrrrrr coroutinerr r r$rr r rrrWeakSetr+rr*r"rrrrrrr_py_current_task_py_register_task_py_register_eager_task_py_unregister_task_py_unregister_eager_task_py_enter_task_py_leave_task_py_swap_current_task_c_current_task_c_register_task_c_register_eager_task_c_unregister_task_c_unregister_eager_task _c_enter_task _c_leave_task_c_swap_current_taskrr'r&rSsM6   %Y__Q'00$>6 z7  zz " MM!D6#D $$$44$$44""00 # 7@ 0d)X%$!%6r  "+/@w~~:16CL?D.4/t4 #7??$u    #   ".&2*.((((#O%1)5MM-i  T  s$F5 G5F>=F>G G __pycache__/__init__.cpython-312.opt-1.pyc000064400000002663152527367570014207 0ustar00 {|jdZddlZddlddlddlddlddlddlddlddl ddl ddl ddl ddl ddlddlddlddlej$ej$zej$zej$zej$zej$zej$ze j$ze j$ze j$ze j$ze j$zej$zej$zej$zej$zZej&dk(rddleej$z Zyddleej$z Zy)z'The asyncio package, tracking PEP 3156.N)*win32)__doc__sys base_events coroutinesevents exceptionsfutureslocks protocolsrunnersqueuesstreams subprocesstasks taskgroupstimeoutsthreads transports__all__platformwindows_events unix_events)/usr/lib64/python3.12/asyncio/__init__.pyrsZ-         >>      ??   ==        ??  >>  ??      ==      ??         "<<7! ~%%%G {"""Gr__pycache__/constants.cpython-312.opt-2.pyc000064400000001675152527367570014467 0ustar00 {|jZddlZdZdZdZdZdZdZdZd Zd Z Gd d ejZ y) N gN@g>@iii,creZdZejZejZejZy) _SendfileModeN)__name__ __module__ __qualname__enumauto UNSUPPORTED TRY_NATIVEFALLBACK*/usr/lib64/python3.12/asyncio/constants.pyrr&s)$))+KJtyy{Hrr) r !LOG_THRESHOLD_FOR_CONNLOST_WRITESACCEPT_RETRY_DELAYDEBUG_STACK_DEPTHSSL_HANDSHAKE_TIMEOUTSSL_SHUTDOWN_TIMEOUT!SENDFILE_FALLBACK_READBUFFER_SIZE FLOW_CONTROL_HIGH_WATER_SSL_READ!FLOW_CONTROL_HIGH_WATER_SSL_WRITETHREAD_JOIN_TIMEOUTEnumrrrrrs^  %&! %/!#& $'!DIIr__pycache__/locks.cpython-312.pyc000064400000065435152527367570012632 0ustar00 {|j3J`dZdZddlZddlZddlmZddlmZGddZGd d eejZ Gd d ejZ Gd deejZ GddeejZ Gdde Z GddejZGddejZy)zSynchronization primitives.)LockEvent Condition SemaphoreBoundedSemaphoreBarrierN) exceptions)mixinsceZdZdZdZy)_ContextManagerMixinc@K|jd{y7wN)acquireselfs &/usr/lib64/python3.12/asyncio/locks.py __aenter__z_ContextManagerMixin.__aenter__ slln s c,K|jywr)release)rexc_typeexctbs r __aexit__z_ContextManagerMixin.__aexit__s sN)__name__ __module__ __qualname__rrrr r s  rr c@eZdZdZdZfdZdZdZdZdZ xZ S)raPrimitive lock objects. A primitive lock is a synchronization primitive that is not owned by a particular coroutine when locked. A primitive lock is in one of two states, 'locked' or 'unlocked'. It is created in the unlocked state. It has two basic methods, acquire() and release(). When the state is unlocked, acquire() changes the state to locked and returns immediately. When the state is locked, acquire() blocks until a call to release() in another coroutine changes it to unlocked, then the acquire() call resets it to locked and returns. The release() method should only be called in the locked state; it changes the state to unlocked and returns immediately. If an attempt is made to release an unlocked lock, a RuntimeError will be raised. When more than one coroutine is blocked in acquire() waiting for the state to turn to unlocked, only one coroutine proceeds when a release() call resets the state to unlocked; first coroutine which is blocked in acquire() is being processed. acquire() is a coroutine and should be called with 'await'. Locks also support the asynchronous context management protocol. 'async with lock' statement should be used. Usage: lock = Lock() ... await lock.acquire() try: ... finally: lock.release() Context manager usage: lock = Lock() ... async with lock: ... Lock objects can be tested for locking state: if not lock.locked(): await lock.acquire() else: # lock is acquired ... c d|_d|_yNF)_waiters_lockedrs r__init__z Lock.__init__Ms  rct|}|jrdnd}|jr|dt |j}d|ddd|dS Nlockedunlocked , waiters:)super__repr__r$r#lenrresextra __class__s rr0z Lock.__repr__QsYg  LLj ==gZDMM(:';zLock.acquire..cs9=aAKKM=sT) r$r#all collectionsdeque _get_loop create_futureappendremover CancelledError_wake_up_firstrfuts rrz Lock.acquire\s  $--"794==99DL == '--/DMnn,,. S!   *  $$S)   $$S)(( <<##%  sBBD#C$C %C)C/D# CC,,C//1D  D#c`|jrd|_|jytd)aGRelease a lock. When the lock is locked, reset it to unlocked, and return. If any other coroutines are blocked waiting for the lock to become unlocked, allow exactly one of them to proceed. When invoked on an unlocked lock, a RuntimeError is raised. There is no return value. FzLock is not acquired.N)r$rG RuntimeErrorrs rrz Lock.release|s* << DL    !67 7rc|jsy tt|j}|j s|j dyy#t$rYywxYw)z*Wake up the first waiter if it isn't done.NT)r#nextiter StopIterationdone set_resultrHs rrGzLock._wake_up_firstsT}}  tDMM*+Cxxz NN4     sA AA) rrr__doc__r%r0r(rrrG __classcell__r5s@rrrs(3j*@8" !rrc@eZdZdZdZfdZdZdZdZdZ xZ S)ra#Asynchronous equivalent to threading.Event. Class implementing event objects. An event manages a flag that can be set to true with the set() method and reset to false with the clear() method. The wait() method blocks until the flag is true. The flag is initially false. cDtj|_d|_yr")r@rAr#_valuers rr%zEvent.__init__s#))+  rct|}|jrdnd}|jr|dt |j}d|ddd|dS) Nsetunsetr*r+r r,r-r.)r/r0rWr#r1r2s rr0zEvent.__repr__sYg ' ==gZDMM(:';= 0) ValueErrorr#rW)rvalues rr%zSemaphore.__init__Ys# 19CD D  rct|}|jrdnd|j}|jr|dt |j}d|ddd|dS) Nr(zunlocked, value:r*r+r r,r-r.)r/r0r(rWr#r1r2s rr0zSemaphore.__repr___sgg  KKM1A$++/O ==gZDMM(:';K|]}|j ywrr9r;s rr>z#Semaphore.locked..isA,?aAKKM!,?sr)rWanyr#rs rr(zSemaphore.lockedfs4{{aC ADMM,?R,?A A CrcK|js|xjdzc_y|jtj|_|j j }|jj| |d{|jj| |jdkDr|jy7@#|jj|wxYw#tj$r7|js%|xjdz c_|jwxYww)a5Acquire a semaphore. If the internal counter is larger than zero on entry, decrement it by one and return True immediately. If it is zero on entry, block, waiting until some other coroutine has called release() to make it larger than 0, and then return True. r TNr) r(rWr#r@rArBrCrDrEr rFr: _wake_up_nextrHs rrzSemaphore.acquireks{{} KK1 K == '--/DMnn,,. S!  *  $$S) ;;?     $$S)(( ==? q ""$   sCBD> CCCC1.!D>CC..C11A D;;D>cN|xjdz c_|jy)zRelease a semaphore, incrementing the internal counter by one. When it was zero on entry and another coroutine is waiting for it to become larger than zero again, wake up that coroutine. r N)rWr~rs rrzSemaphore.releases q  rc|jsy|jD]:}|jr|xjdzc_|jdyy)z)Wake up the first waiter that isn't done.Nr T)r#rPrWrQrHs rr~zSemaphore._wake_up_nexts@}} ==C88: q t$ !rrt) rrrrRr%r0r(rrr~rSrTs@rrrJs(  *C "H rrc.eZdZdZdfd ZfdZxZS)rzA bounded semaphore implementation. This raises ValueError in release() if it would increase the value above the initial value. c2||_t| |yr) _bound_valuer/r%)rrxr5s rr%zBoundedSemaphore.__init__s! rcj|j|jk\r tdt|y)Nz(BoundedSemaphore released too many times)rWrrwr/r)rr5s rrzBoundedSemaphore.releases+ ;;$++ +GH H rrt)rrrrRr%rrSrTs@rrrs  rrceZdZdZdZdZdZy) _BarrierStatefillingdraining resettingbrokenN)rrrFILLINGDRAINING RESETTINGBROKENrrrrrsGHI FrrceZdZdZdZfdZdZdZdZdZ dZ d Z d Z d Z d Zed ZedZedZxZS)ra Asyncio equivalent to threading.Barrier Implements a Barrier primitive. Useful for synchronizing a fixed number of tasks at known synchronization points. Tasks block on 'wait()' and are simultaneously awoken once they have all made their call. c|dkr tdt|_||_tj |_d|_y)z1Create a barrier, initialised to 'parties' tasks.r zparties must be >= 1rN)rwr_cond_partiesrr_state_count)rpartiess rr%zBarrier.__init__s9 Q;34 4[  #++  rct|}|jj}|js|d|j d|j z }d|ddd|dS)Nr*/r+r r,r-r.)r/r0rrxr n_waitingrr2s rr0zBarrier.__repr__sdg ;;$$%{{ z$..!14<<.A AE3q9+Rwb))rc>K|jd{S7wrrjrs rrzBarrier.__aenter__sYY[   s c Kywrr)rargss rrzBarrier.__aexit__s  sc0K|j4d{|jd{ |j}|xjdz c_|dz|jk(r|j d{n|j d{||xjdzc_|j cdddd{S777Y7B7 #|xjdzc_|j wxYw#1d{7swYyxYww)zWait for the barrier. When the specified number of tasks have started waiting, they are all simultaneously awoken. Returns an unique and individual index number from 0 to 'parties-1'. Nr )r_blockrr_release_wait_exit)rindexs rrbz Barrier.waits:::++-     q 19 ---/))**,&& q  ::  *& q  ::sDC DDCDAC7C8CCC%D; DCDDCCD'C>>DDD DDcKjjfdd{jtjurt j dy76w)Nc\jtjtjfvSr)rrrrrsrz Barrier._block..s$DKK&& (?(?(rzBarrier aborted)rrmrrrr BrokenBarrierErrorrs`rrzBarrier._blocksZ jj!!     ;;-.. .//0AB B / s"AA7AcjKtj|_|jj ywr)rrrrrsrs rrzBarrier._releases% $,,  s13cKjjfdd{jtjtj fvrt jdy7Fw)Nc<jtjuSr)rrrrsrrzBarrier._wait..s$++]=R=R*RrzAbort or reset of barrier)rrmrrrrr rrs`rrz Barrier._waits] jj!!"RSSS ;;=//1H1HI I//0KL L J Ts"A.A,AA.c|jdk(r\|jtjtjfvrtj |_|j jyy)Nr)rrrrrrrrsrs rrz Barrier._exitsO ;;! {{}66 8N8NOO+33 JJ ! ! # rchK|j4d{|jdkDr2|jtjur+tj|_ntj |_|jj dddd{y77#1d{7swYyxYww)zReset the barrier to the initial state. Any tasks currently waiting will get the BrokenBarrier exception raised. Nr)rrrrrrrsrs rresetz Barrier.reset"sk :::{{Q;;m&=&=="/"9"9DK+33 JJ ! ! #::::::sEB2BB2A1B B2BB2B2B/#B& $B/+B2cK|j4d{tj|_|jj dddd{y7D7#1d{7swYyxYww)zPlace the barrier into a 'broken' state. Useful in case of error. Any currently waiting tasks and tasks attempting to 'wait()' will have BrokenBarrierError raised. N)rrrrrsrs rabortz Barrier.abort1sA :::'..DK JJ ! ! #::::::sDA1AA10A A1AA1A1A."A% #A.*A1c|jS)z8Return the number of tasks required to trip the barrier.)rrs rrzBarrier.parties;s}}rcT|jtjur |jSy)zrs! * C! !7!7C!L:&F " ":&zm($f&<&<m(`W$f&<&<Wty$DIIM3f$$M3r__pycache__/__init__.cpython-312.opt-2.pyc000064400000002577152527367570014214 0ustar00 {|j ddlZddlddlddlddlddlddlddlddlddl ddl ddl ddl ddl ddlddlddlej"ej"zej"zej"zej"zej"zej"zej"ze j"ze j"ze j"ze j"ze j"zej"zej"zej"zZej$dk(rddleej"z Zyddleej"z Zy)N)*win32)sys base_events coroutinesevents exceptionsfutureslocks protocolsrunnersqueuesstreams subprocesstasks taskgroupstimeoutsthreads transports__all__platformwindows_events unix_events)/usr/lib64/python3.12/asyncio/__init__.pyrsZ-         >>      ??   ==        ??  >>  ??      ==      ??         "<<7! ~%%%G {"""Gr__pycache__/streams.cpython-312.pyc000064400000101130152527367570013154 0ustar00 {|jkldZddlZddlZddlZddlZddlZeedredz ZddlmZddlm Z ddlm Z dd lm Z dd lm Z dd l mZdd lmZd ZdeddZdeddZeedrdeddZdeddZGdde j,ZGddee j,ZGddZGddZy)) StreamReader StreamWriterStreamReaderProtocolopen_connection start_serverNAF_UNIX)open_unix_connectionstart_unix_server) coroutines)events) exceptions)format_helpers) protocols)logger)sleepi)limitc Ktj}t||}t|| |j fd||fi|d{\}}t | ||}||fS7w)aA wrapper for create_connection() returning a (reader, writer) pair. The reader returned is a StreamReader instance; the writer is a StreamWriter instance. The arguments are all the usual arguments to create_connection() except protocol_factory; most common are positional host and port, with various optional keyword arguments following. Additional optional keyword arguments are loop (to set the event loop instance to use) and limit (to set the buffer limit passed to the StreamReader). (If you want to customize the StreamReader and/or StreamReaderProtocol classes, just copy the code -- there's really nothing special here except some convenience.) rlooprcSNprotocols(/usr/lib64/python3.12/asyncio/streams.pyz!open_connection..1sN)r get_running_looprrcreate_connectionr) hostportrkwdsrreader transport_writerrs @rrrsx&  " " $D D 1F#F6H///$.(,..LIq )Xvt .sA A) A'A)cKtjfd}j|||fi|d{S7w)aStart a socket server, call back for each client connected. The first parameter, `client_connected_cb`, takes two parameters: client_reader, client_writer. client_reader is a StreamReader object, while client_writer is a StreamWriter object. This parameter can either be a plain callback function or a coroutine; if it is a coroutine, it will be automatically converted into a Task. The rest of the arguments are all the usual arguments to loop.create_server() except protocol_factory; most common are positional host and port, with various optional keyword arguments following. The return value is the same as loop.create_server(). Additional optional keyword argument is limit (to set the buffer limit passed to the StreamReader). The return value is the same as loop.create_server(), i.e. a Server object which can be used to stop the service. c>t}t|}|SNrrrrr%rclient_connected_cbrrs rfactoryzstart_server..factoryNs&E5'0C-13rN)r r create_server)r.r"r#rr$r/rs` ` @rrr6s@,  " " $D $##GT4@4@ @@ @s4A>AcKtj}t||}t|||jfd|fi|d{\}}t |||}||fS7w)z@Similar to `open_connection` but works with UNIX Domain Sockets.rrcSrrrsrrz&open_unix_connection..bsHrN)r r rrcreate_unix_connectionr) pathrr$rr%r&r'r(rs @rr r Zsv&&(E5'T:8T88 d,&*,, 1i64@v~,sA A( A& A(cKtjfd}j||fi|d{S7w)z=Similar to `start_server` but works with UNIX Domain Sockets.c>t}t|}|Sr+r,r-s rr/z"start_unix_server..factoryks&!D9F+F4G157HOrN)r r create_unix_server)r.r4rr$r/rs` ` @rr r fs>&&(  -T,,WdCdCCCCs 3?=?c6eZdZdZd dZdZdZdZdZdZ y) FlowControlMixina)Reusable flow control logic for StreamWriter.drain(). This implements the protocol methods pause_writing(), resume_writing() and connection_lost(). If the subclass overrides these it must call the super methods. StreamWriter.drain() must wait for _drain_helper() coroutine. Nc|tj|_n||_d|_t j |_d|_yNF)r get_event_loop_loop_paused collectionsdeque_drain_waiters_connection_lost)selfrs r__init__zFlowControlMixin.__init__~s> <..0DJDJ )//1 %rc|jrJd|_|jjrtjd|yy)NTz%r pauses writing)r>r= get_debugrdebugrCs r pause_writingzFlowControlMixin.pause_writings:<< ::   ! LL,d 3 "rc|jsJd|_|jjrtjd||j D]$}|j r|jd&y)NFz%r resumes writing)r>r=rFrrGrAdone set_resultrCwaiters rresume_writingzFlowControlMixin.resume_writings[||| ::   ! LL-t 4))F;;=!!$'*rcd|_|jsy|jD]8}|jr||j d(|j |:yNT)rBr>rArKrL set_exceptionrCexcrNs rconnection_lostz FlowControlMixin.connection_lostsN $|| ))F;;=;%%d+((- *rcNK|jr td|jsy|jj }|j j | |d{|j j|y7 #|j j|wxYww)NzConnection lost)rBConnectionResetErrorr>r= create_futurerAappendremoverMs r _drain_helperzFlowControlMixin._drain_helpers  &'89 9|| ))+ ""6* /LL    & &v .     & &v .s0AB%B"B#B'B%BB""B%ctr)NotImplementedErrorrCstreams r_get_close_waiterz"FlowControlMixin._get_close_waiters!!rr) __name__ __module__ __qualname____doc__rDrIrOrUr[r`rrrr9r9ts%&4 ( . /"rr9cfeZdZdZdZd fd ZedZdZdZ fdZ dZ d Z d Z d ZxZS) ra=Helper class to adapt between Protocol and StreamReader. (This is a helper class instead of making StreamReader itself a Protocol subclass, because the StreamReader has other potential uses, and to prevent the user of the StreamReader to accidentally call inappropriate methods of the protocol.) Nc4t|||,tj||_|j |_nd|_|||_d|_d|_d|_ d|_ ||_ d|_ |jj|_y)NrF)superrDweakrefref_stream_reader_wr_source_traceback_strong_reader_reject_connection_stream_writer_task _transport_client_connected_cb _over_sslr=rX_closed)rC stream_readerr.r __class__s rrDzStreamReaderProtocol.__init__s d#  $%,[[%?D "%2%D%DD "%)D "  *#0D "'" $7!zz//1 rc<|jy|jSr)rjrHs r_stream_readerz#StreamReaderProtocol._stream_readers  ! ! )%%''rc|j}|j}||_||_|j ddu|_y)N sslcontext)r=r&rnrpget_extra_inforr)rCr(rr&s r_replace_writerz$StreamReaderProtocol._replace_writers<zz$$ $#"11,?tKrcxjrKddi}jrj|d<jj|j y_j }||jjddu_ jt|j_ j|j}tj|rAfd}jj|_j j#|d_yy)NmessagezpAn open stream was garbage collected prior to establishing network connection; call "stream.close()" explicitly.source_tracebackryc|jrjy|j}|0jj d|djyy)Nz*Unhandled exception in client_connected_cb)r} exceptionr&) cancelledcloserr=call_exception_handler)taskrTrCr&s rcallbackz6StreamReaderProtocol.connection_made..callbacks\~~'!)..*C 99'S),)2; ") 'r)rmrkr=rabortrprw set_transportrzrrrqrrnr iscoroutine create_taskroadd_done_callbackrl)rCr&contextr%resrs`` rconnection_madez$StreamReaderProtocol.connection_mades#  " "@G %%.2.D.D*+ JJ - -g 6 OO  #$$     +"11,?tK  $ $ 0".y$/5/3zz#;D ++F,0,?,?AC%%c* *"ZZ33C8  ,,X6"&D / 1rcf|j}|$||jn|j||jj s9||jj dn|jj|t ||d|_d|_ d|_ d|_ yr) rwfeed_eofrRrsrKrLrgrUrjrnrorp)rCrTr%rus rrUz$StreamReaderProtocol.connection_lost s$$  {!$$S)||  "{ ''- **3/ $!%" rcD|j}||j|yyr)rw feed_data)rCdatar%s r data_receivedz"StreamReaderProtocol.data_receiveds&$$     T " rcZ|j}||j|jryy)NFT)rwrrr)rCr%s r eof_receivedz!StreamReaderProtocol.eof_received!s,$$   OO  >>rc|jSr)rsr^s rr`z&StreamReaderProtocol._get_close_waiter,s ||rc |j}|jr"|js|jyyy#t$rYywxYwr)rsrKrrAttributeError)rCcloseds r__del__zStreamReaderProtocol.__del__/sM #\\F{{}V%5%5%7  "&8}   s A A  A NN)rarbrcrdrkrDpropertyrwr{rrUrrr`r __classcell__)rus@rrrsN2((( L('T$#  #rrczeZdZdZdZdZedZdZdZ dZ dZ d Z d Z d Zdd ZdZd d d ddZdZy )ra'Wraps a Transport. This exposes write(), writelines(), [can_]write_eof(), get_extra_info() and close(). It adds drain() which returns an optional Future on which you can wait for flow control. It also adds a transport property which references the Transport directly. c||_||_|t|tsJ||_||_|j j |_|jjdyr) rp _protocol isinstancer_readerr=rX _complete_futrL)rCr&rr%rs rrDzStreamWriter.__init__Es[#!~FL!AAA  !ZZ557 %%d+rc|jjd|jg}|j|j d|jdj dj |S)N transport=zreader=<{}> )rurarprrYformatjoinrCinfos r__repr__zStreamWriter.__repr__Os['':doo5H)IJ << # KK'$,,!12 3}}SXXd^,,rc|jSrrprHs rr&zStreamWriter.transportUs rc:|jj|yr)rpwriterCrs rrzStreamWriter.writeYs d#rc:|jj|yr)rp writelinesrs rrzStreamWriter.writelines\s ""4(rc6|jjSr)rp write_eofrHs rrzStreamWriter.write_eof_s((**rc6|jjSr)rp can_write_eofrHs rrzStreamWriter.can_write_eofbs,,..rc6|jjSr)rprrHs rrzStreamWriter.closees$$&&rc6|jjSr)rp is_closingrHs rrzStreamWriter.is_closinghs))++rcVK|jj|d{y7wr)rr`rHs r wait_closedzStreamWriter.wait_closedksnn..t444s )')Nc:|jj||Sr)rprz)rCnamedefaults rrzzStreamWriter.get_extra_infons--dG<>jjl"jj22 OOXz#_"7!5 377 (  & 7s!8BB 3B.B/BBc|jjsc|jjrt j dt y|jt j d|t yy)Nzloop is closedz unclosed )rprr= is_closedwarningswarnResourceWarningrrHs rrzStreamWriter.__del__sT))+zz##% .@  $2OD ,rr)rarbrcrdrDrrr&rrrrrrrrzrrrrrrrr;sh,- $)+/',5=-4)-.2-1' ErrceZdZdZedfdZdZdZdZdZ dZ dZ d Z d Z d Zd Zd ZddZddZdZdZdZy)rNcl|dkr td||_|tj|_n||_t |_d|_d|_d|_ d|_ d|_ |jjr.tjtj d|_yy)NrzLimit cannot be <= 0Fr ) ValueError_limitr r<r= bytearray_buffer_eof_waiter _exceptionrpr>rFr extract_stacksys _getframerk)rCrrs rrDzStreamReader.__init__s A:34 4 <..0DJDJ {    ::   !%3%A%A a &"D " "rcdg}|jr'|jt|jd|jr|jd|jt k7r|jd|j|j r|jd|j |jr|jd|j|jr|jd|j|jr|jdd jd j|S) Nrz byteseofzlimit=zwaiter=z exception=rpausedrr) rrYlenrr_DEFAULT_LIMITrrrpr>rrrs rrzStreamReader.__repr__s << KK3t||,-V4 5 99 KK  ;;. ( KK& . / << KK'$,,!12 3 ?? KK*T__$78 9 ?? KK*T__$78 9 << KK !}}SXXd^,,rc|jSr)rrHs rrzStreamReader.exceptions rc||_|j}|*d|_|js|j|yyyr)rrrrRrSs rrRzStreamReader.set_exceptionsC  DL##%$$S)& rct|j}|*d|_|js|jdyyy)z1Wakeup read*() functions waiting for data or EOF.N)rrrLrMs r_wakeup_waiterzStreamReader._wakeup_waiters<  DL##%!!$'& rc8|jJd||_y)NzTransport already setr)rCr&s rrzStreamReader.set_transports&?(??&#rc|jrEt|j|jkr"d|_|jj yyyr;)r>rrrrpresume_readingrHs r_maybe_resume_transportz$StreamReader._maybe_resume_transports; <rr pause_readingr]rs rrzStreamReader.feed_datas99888}  D!  OO 'LLDLL!A O3 $--/ $ 4! ( ' '#'  'sB%%B87B8cRK|jt|d|jrJd|jr!d|_|jj |j j|_ |jd{d|_y7 #d|_wxYww)zpWait until feed_data() or feed_eof() is called. If stream was paused, automatically resume it. NzF() called while another coroutine is already waiting for incoming dataz_wait_for_data after EOFF)r RuntimeErrorrr>rprr=rX)rC func_names r_wait_for_datazStreamReader._wait_for_data s << #+456 699888} << DL OO * * ,zz//1  ,,  DL DLs0A:B'=B B BB'B B$$B'cKd}t|} |j|d{}|S7#tj$r}|jcYd}~Sd}~wtj $r}|j j||jr|j d|j|z=n|j j|jt|jdd}~wwxYww)aRead chunk of data from the stream until newline (b' ') is found. On success, return chunk that ends with newline. If only partial line can be read due to EOF, return incomplete line without terminating newline. When EOF was reached while no bytes read, empty bytes object is returned. If limit is reached, ValueError will be raised. In that case, if newline was found, complete line including newline will be removed from internal buffer. Else, internal buffer will be cleared. Limit is compared against part of the line without newline. If stream was paused, this function will automatically resume it if needed.  Nr) r readuntilrIncompleteReadErrorpartialLimitOverrunErrorr startswithconsumedclearrrargs)rCsepseplenlinees rreadlinezStreamReader.readline%s S (,,D --- 99 ++ (||&&sAJJ7LL!5!**v"5!56 ""$  ( ( *QVVAY' '  (sJC5.,.C5.C2 A C2 C5C2(BC--C22C5cKt|}|dk(r td|j |jd} t|j}||z |k\rO|jj ||}|dk7rn|dz|z }||j kDrt jd||jrEt|j}|jjt j|d|jdd{||j kDrt jd||jd||z}|jd||z=|jt|S7iw) aVRead data from the stream until ``separator`` is found. On success, the data and separator will be removed from the internal buffer (consumed). Returned data will include the separator at the end. Configured stream limit is used to check result. Limit sets the maximal length of data that can be returned, not counting the separator. If an EOF occurs and the complete separator is still not found, an IncompleteReadError exception will be raised, and the internal buffer will be reset. The IncompleteReadError.partial attribute may contain the separator partially. If the data cannot be read because of over limit, a LimitOverrunError exception will be raised, and the data will be left in the internal buffer, so it can be read again. rz,Separator should be at least one-byte stringNr z2Separator is not found, and chunk exceed the limitrz2Separator is found, but chunk is longer than limit)rrrrfindrrrrbytesrrrr)rC separatorroffsetbuflenisepchunks rrzStreamReader.readuntilDsz(Y Q;KL L ?? &// !*&F&(||((F;2: !f,DKK'$66L  yydll+ ""$ 44UDAA%%k2 2 2=@ $++ ..DdL L ^dVm, LL$- ( $$&U| 3sDE6 E4 A*E6cK|j |j|dk(ry|dkrLg} |j|jd{}|sn|j|8dj |S|j s%|j s|jdd{tt|j d|}|j d|=|j|S77Hw)aRead up to `n` bytes from the stream. If `n` is not provided or set to -1, read until EOF, then return all read bytes. If EOF was received and the internal buffer is empty, return an empty bytes object. If `n` is 0, return an empty bytes object immediately. If `n` is positive, return at most `n` available bytes as soon as at least 1 byte is available in the internal buffer. If EOF is received before any byte is read, return an empty bytes object. Returned value is not limited with limit, configured at stream creation. If stream was paused, this function will automatically resume it if needed. Nrrread) rr rrYrrrrr memoryviewr)rCnblocksblockrs rr zStreamReader.reads, ?? &// ! 6 q5 F"ii 44 e$  88F# #||DII%%f- - -Z -bq12 LL!  $$& 5 .s&AC)C%AC)C'AC)'C)cK|dkr td|j |j|dk(ryt|j|kr|jrEt |j}|jj tj|||jdd{t|j|krt|j|k(r0t |j}|jj n0t t|jd|}|jd|=|j|S7w)aRead exactly `n` bytes. Raise an IncompleteReadError if EOF is reached before `n` bytes can be read. The IncompleteReadError.partial attribute of the exception will contain the partial read bytes. if n is zero, return empty bytes object. Returned value is not limited with limit, configured at stream creation. If stream was paused, this function will automatically resume it if needed. rz*readexactly size can not be less than zeroNr readexactly) rrrrrrrrrrr r)rCr  incompleters rrzStreamReader.readexactlys q5IJ J ?? &// ! 6$,,!#yy"4<<0  ""$ 44ZCC%%m4 4 4 $,,!# t||  !&D LL   DLL1"156D RaR  $$&  5sB,E.E/E B Ec|SrrrHs r __aiter__zStreamReader.__aiter__s rcXK|jd{}|dk(rt|S7w)Nr)rStopAsyncIteration)rCvals r __anext__zStreamReader.__anext__s+MMO# #:$ $ $s *(*)r)r)rarbrcrkrrDrrrRrrrrrrrrrr rrrrrrrrsf+$",-$*($- .$, 8>Yv1f'Rrrrr)__all__r?socketrrrhhasattrr r rrrlogrtasksrrrrr r Protocolr9rrrrrrr s '  69 <> % KK>> , -  ! !**2.E KK+eAhZqq ; < r+c|j |jS|j}djdj|S)Nz<{}> )rr6formatjoin)r$r4s r)__repr__zHandle.__repr__?s9 :: !::  }}SXXd^,,r+c|jSN)rr$s r) get_contextzHandle.get_contextEs }}r+c|js@d|_|jjrt||_d|_d|_yy)NT)rrr reprrrrr>s r)cancelz Handle.cancelHs@"DOzz##%"$Z !DNDJr+c|jSr=)rr>s r)r-zHandle.cancelledSs r+c |jj|jg|jd}y#tt f$rt $rw}tj|j|j}d|}|||d}|jr|j|d<|jj|Yd}~d}yd}~wwxYw)NzException in callback )message exceptionhandlesource_traceback) rrunrr SystemExitKeyboardInterrupt BaseExceptionrr3rrcall_exception_handler)r$exccbmsgr(s r)_runz Handle._runVs 7 DMM  dnn :tzz :-.   777 ,B*2$/C G %%.2.D.D*+ JJ - -g 6 6 7s16CA+CCr=) r1 __module__ __qualname____doc__ __slots__r*r6r;r?rBr-rQr+r)rrs/;I * -  r+rcjeZdZdZddgZdfd ZfdZdZdZdZ d Z d Z d Z fd Z d ZxZS)rz7Object returned by timed callback registration methods. _scheduled_whencxt||||||jr |jd=||_d|_y)Nr.F)superr*rrYrX)r$whenr%r&r'r(r0s r)r*zTimerHandle.__init__os; 4w7  ! !&&r* r+ct|}|jrdnd}|j|d|j|S)Nrzwhen=)r[r6rinsertrY)r$r4posr0s r)r6zTimerHandle._repr_infovs;w!#??a C5 -. r+c,t|jSr=)hashrYr>s r)__hash__zTimerHandle.__hash__|sDJJr+c`t|tr|j|jkStSr= isinstancerrYNotImplementedr$others r)__lt__zTimerHandle.__lt__% e[ ):: + +r+ct|tr,|j|jkxs|j|StSr=rfrrY__eq__rgrhs r)__le__zTimerHandle.__le__3 e[ ):: +At{{5/A Ar+c`t|tr|j|jkDStSr=rerhs r)__gt__zTimerHandle.__gt__rkr+ct|tr,|j|jkDxs|j|StSr=rmrhs r)__ge__zTimerHandle.__ge__rpr+ct|trj|j|jk(xrO|j|jk(xr4|j|jk(xr|j |j k(St Sr=)rfrrYrrrrgrhs r)rnzTimerHandle.__eq__sl e[ )JJ%++-8NNeoo58JJ%++-8OOu'7'77 9r+cp|js|jj|t|yr=)rr_timer_handle_cancelledr[rB)r$r0s r)rBzTimerHandle.cancels& JJ . .t 4 r+c|jS)zReturn a scheduled callback time. The time is an absolute timestamp, using the same time reference as loop.time(). )rYr>s r)r\zTimerHandle.whens zzr+r=)r1rRrSrTrUr*r6rcrjrorrrtrnrBr\ __classcell__)r0s@r)rrjsBAw'I        r+rc@eZdZdZdZdZdZdZdZdZ dZ d Z y ) rz,Abstract server returned by create_server().ct)z5Stop serving. This leaves existing connections open.NotImplementedErrorr>s r)closezAbstractServer.close!!r+ct)z4Get the event loop the Server object is attached to.r|r>s r)get_loopzAbstractServer.get_looprr+ct)z3Return True if the server is accepting connections.r|r>s r) is_servingzAbstractServer.is_servingrr+cKtw)zStart accepting connections. This method is idempotent, so it can be called when the server is already being serving. r|r>s r) start_servingzAbstractServer.start_serving "! cKtw)zStart accepting connections until the coroutine is cancelled. The server is closed when the coroutine is cancelled. r|r>s r) serve_foreverzAbstractServer.serve_forever "!rcKtw)z*Coroutine to wait until service is closed.r|r>s r) wait_closedzAbstractServer.wait_closed !!rcK|Swr=rVr>s r) __aenter__zAbstractServer.__aenter__s  sc`K|j|jd{y7wr=)r~r)r$rNs r) __aexit__zAbstractServer.__aexit__s!    s $.,.N) r1rRrSrTr~rrrrrrrrVr+r)rrs-6""""""!r+rc eZdZdZdZdZdZdZdZdZ dZ d Z d Z d d d Z d d dZd d dZdZdZd d ddZd d dZdZdZddddddZdJdZ dKd dddd d d d d d d d dZ dKej4ej6d dd d d d d dd d ZdLdd!d"Zd#d d d d$d%Z dMd d d d d d&d'Z dMd dd d d dd(d)Z d d d d*d+Z! dKdddd d d d d,d-Z"d.Z#d/Z$e%jLe%jLe%jLd0d1Z'e%jLe%jLe%jLd0d2Z(d3Z)d4Z*d5Z+d6Z,d7Z-d8Z.d9Z/dJd:Z0d;Z1d<Z2d=Z3d>Z4dLd d!d?Z5d@Z6dAZ7dBZ8dCZ9dDZ:dEZ;dFZdIZ?y )NrzAbstract event loop.ct)z*Run the event loop until stop() is called.r|r>s r) run_foreverzAbstractEventLoop.run_foreverrr+ct)zpRun the event loop until a Future is done. Return the Future's result, or raise its exception. r|)r$futures r)run_until_completez$AbstractEventLoop.run_until_completes "!r+ct)zStop the event loop as soon as reasonable. Exactly how soon that is may depend on the implementation, but no more I/O callbacks should be scheduled. r|r>s r)stopzAbstractEventLoop.stops "!r+ct)z3Return whether the event loop is currently running.r|r>s r) is_runningzAbstractEventLoop.is_runningrr+ct)z*Returns True if the event loop was closed.r|r>s r) is_closedzAbstractEventLoop.is_closedrr+ct)zClose the loop. The loop should not be running. This is idempotent and irreversible. No other methods should be called after this one. r|r>s r)r~zAbstractEventLoop.closes "!r+cKtw)z,Shutdown all active asynchronous generators.r|r>s r)shutdown_asyncgensz$AbstractEventLoop.shutdown_asyncgensrrcKtw)z.Schedule the shutdown of the default executor.r|r>s r)shutdown_default_executorz+AbstractEventLoop.shutdown_default_executorrrct)z3Notification that a TimerHandle has been cancelled.r|)r$rGs r)rwz)AbstractEventLoop._timer_handle_cancelledrr+N)r(c0|jd|g|d|iS)Nrr() call_laterr$r%r(r&s r) call_soonzAbstractEventLoop.call_soon stq(CTC7CCr+ctr=r|)r$delayr%r(r&s r)rzAbstractEventLoop.call_later!!r+ctr=r|)r$r\r%r(r&s r)call_atzAbstractEventLoop.call_atrr+ctr=r|r>s r)timezAbstractEventLoop.timerr+ctr=r|r>s r) create_futurezAbstractEventLoop.create_futurerr+)namer(ctr=r|)r$cororr(s r) create_taskzAbstractEventLoop.create_taskrr+ctr=r|rs r)call_soon_threadsafez&AbstractEventLoop.call_soon_threadsafe"rr+ctr=r|)r$executorfuncr&s r)run_in_executorz!AbstractEventLoop.run_in_executor%rr+ctr=r|)r$rs r)set_default_executorz&AbstractEventLoop.set_default_executor(rr+r)familytypeprotoflagscKtwr=r|)r$hostportrrrrs r) getaddrinfozAbstractEventLoop.getaddrinfo-rrcKtwr=r|)r$sockaddrrs r) getnameinfozAbstractEventLoop.getnameinfo1 !!r) sslrrrsock local_addrserver_hostnamessl_handshake_timeoutssl_shutdown_timeouthappy_eyeballs_delay interleavec Ktwr=r|)r$protocol_factoryrrrrrrrrrrrrrs r)create_connectionz#AbstractEventLoop.create_connection4s"!rdT) rrrbacklogr reuse_address reuse_portrrrc Ktw)a#A coroutine which creates a TCP server bound to host and port. The return value is a Server object which can be used to stop the service. If host is an empty string or None all interfaces are assumed and a list of multiple sockets will be returned (most likely one for IPv4 and another one for IPv6). The host parameter can also be a sequence (e.g. list) of hosts to bind to. family can be set to either AF_INET or AF_INET6 to force the socket to use IPv4 or IPv6. If not set it will be determined from host (defaults to AF_UNSPEC). flags is a bitmask for getaddrinfo(). sock can optionally be specified in order to use a preexisting socket object. backlog is the maximum number of queued connections passed to listen() (defaults to 100). ssl can be set to an SSLContext to enable SSL over the accepted connections. reuse_address tells the kernel to reuse a local socket in TIME_WAIT state, without waiting for its natural timeout to expire. If not specified will automatically be set to True on UNIX. reuse_port tells the kernel to allow this endpoint to be bound to the same port as other existing endpoints are bound to, so long as they all set this flag when being created. This option is not supported on Windows. ssl_handshake_timeout is the time in seconds that an SSL server will wait for completion of the SSL handshake before aborting the connection. Default is 60s. ssl_shutdown_timeout is the time in seconds that an SSL server will wait for completion of the SSL shutdown procedure before aborting the connection. Default is 30s. start_serving set to True (default) causes the created server to start accepting connections immediately. When set to False, the user should await Server.start_serving() or Server.serve_forever() to make the server to start accepting connections. r|)r$rrrrrrrrrrrrrs r) create_serverzAbstractEventLoop.create_server>sp"!r)fallbackcKtw)zRSend a file through a transport. Return an amount of sent bytes. r|)r$ transportfileoffsetcountrs r)sendfilezAbstractEventLoop.sendfilexrrF) server_siderrrcKtw)z|Upgrade a transport to TLS. Return a new transport that *protocol* should start using immediately. r|)r$rprotocol sslcontextrrrrs r) start_tlszAbstractEventLoop.start_tlss"!r)rrrrrcKtwr=r|)r$rpathrrrrrs r)create_unix_connectionz(AbstractEventLoop.create_unix_connectionrr)rrrrrrcKtw)aWA coroutine which creates a UNIX Domain Socket server. The return value is a Server object, which can be used to stop the service. path is a str, representing a file system path to bind the server socket to. sock can optionally be specified in order to use a preexisting socket object. backlog is the maximum number of queued connections passed to listen() (defaults to 100). ssl can be set to an SSLContext to enable SSL over the accepted connections. ssl_handshake_timeout is the time in seconds that an SSL server will wait for the SSL handshake to complete (defaults to 60s). ssl_shutdown_timeout is the time in seconds that an SSL server will wait for the SSL shutdown to finish (defaults to 30s). start_serving set to True (default) causes the created server to start accepting connections immediately. When set to False, the user should await Server.start_serving() or Server.serve_forever() to make the server to start accepting connections. r|) r$rrrrrrrrs r)create_unix_serverz$AbstractEventLoop.create_unix_serversD"!r)rrrcKtw)aHandle an accepted connection. This is used by servers that accept connections outside of asyncio, but use asyncio to handle connections. This method is a coroutine. When completed, the coroutine returns a (transport, protocol) pair. r|)r$rrrrrs r)connect_accepted_socketz)AbstractEventLoop.connect_accepted_sockets"!r)rrrrrallow_broadcastrcKtw)aA coroutine which creates a datagram endpoint. This method will try to establish the endpoint in the background. When successful, the coroutine returns a (transport, protocol) pair. protocol_factory must be a callable returning a protocol instance. socket family AF_INET, socket.AF_INET6 or socket.AF_UNIX depending on host (or family if specified), socket type SOCK_DGRAM. reuse_address tells the kernel to reuse a local socket in TIME_WAIT state, without waiting for its natural timeout to expire. If not specified it will automatically be set to True on UNIX. reuse_port tells the kernel to allow this endpoint to be bound to the same port as other existing endpoints are bound to, so long as they all set this flag when being created. This option is not supported on Windows and some UNIX's. If the :py:data:`~socket.SO_REUSEPORT` constant is not defined then this capability is unsupported. allow_broadcast tells the kernel to allow this endpoint to send messages to the broadcast address. sock can optionally be specified in order to use a preexisting socket object. r|) r$rr remote_addrrrrrrrrs r)create_datagram_endpointz*AbstractEventLoop.create_datagram_endpointsB"!rcKtw)aRegister read pipe in event loop. Set the pipe to non-blocking mode. protocol_factory should instantiate object with Protocol interface. pipe is a file-like object. Return pair (transport, protocol), where transport supports the ReadTransport interface.r|r$rpipes r)connect_read_pipez#AbstractEventLoop.connect_read_pipe"!rcKtw)aRegister write pipe in event loop. protocol_factory should instantiate object with BaseProtocol interface. Pipe is file-like object already switched to nonblocking. Return pair (transport, protocol), where transport support WriteTransport interface.r|rs r)connect_write_pipez$AbstractEventLoop.connect_write_piperr)stdinstdoutstderrcKtwr=r|)r$rcmdrrrkwargss r)subprocess_shellz"AbstractEventLoop.subprocess_shellrrcKtwr=r|)r$rrrrr&rs r)subprocess_execz!AbstractEventLoop.subprocess_exec rrctr=r|r$fdr%r&s r) add_readerzAbstractEventLoop.add_readerrr+ctr=r|r$rs r) remove_readerzAbstractEventLoop.remove_readerrr+ctr=r|rs r) add_writerzAbstractEventLoop.add_writerrr+ctr=r|rs r) remove_writerzAbstractEventLoop.remove_writer"rr+cKtwr=r|)r$rnbytess r) sock_recvzAbstractEventLoop.sock_recv'rrcKtwr=r|)r$rbufs r)sock_recv_intoz AbstractEventLoop.sock_recv_into*rrcKtwr=r|)r$rbufsizes r) sock_recvfromzAbstractEventLoop.sock_recvfrom-rrcKtwr=r|)r$rrr s r)sock_recvfrom_intoz$AbstractEventLoop.sock_recvfrom_into0rrcKtwr=r|)r$rdatas r) sock_sendallzAbstractEventLoop.sock_sendall3rrcKtwr=r|)r$rraddresss r) sock_sendtozAbstractEventLoop.sock_sendto6rrcKtwr=r|)r$rrs r) sock_connectzAbstractEventLoop.sock_connect9rrcKtwr=r|)r$rs r) sock_acceptzAbstractEventLoop.sock_accept<rrcKtwr=r|)r$rrrrrs r) sock_sendfilezAbstractEventLoop.sock_sendfile?rrctr=r|)r$sigr%r&s r)add_signal_handlerz$AbstractEventLoop.add_signal_handlerErr+ctr=r|)r$r$s r)remove_signal_handlerz'AbstractEventLoop.remove_signal_handlerHrr+ctr=r|)r$factorys r)set_task_factoryz"AbstractEventLoop.set_task_factoryMrr+ctr=r|r>s r)get_task_factoryz"AbstractEventLoop.get_task_factoryPrr+ctr=r|r>s r)get_exception_handlerz'AbstractEventLoop.get_exception_handlerUrr+ctr=r|)r$handlers r)set_exception_handlerz'AbstractEventLoop.set_exception_handlerXrr+ctr=r|r$r(s r)default_exception_handlerz+AbstractEventLoop.default_exception_handler[rr+ctr=r|r3s r)rMz(AbstractEventLoop.call_exception_handler^rr+ctr=r|r>s r)r zAbstractEventLoop.get_debugcrr+ctr=r|)r$enableds r) set_debugzAbstractEventLoop.set_debugfrr+)rNN)rNr=)@r1rRrSrTrrrrrr~rrrwrrrrrrrrrrrrsocket AF_UNSPEC AI_PASSIVErrrrrrrrr subprocessPIPErrrrr r rrrrrrrr r"r%r'r*r,r.r1r4rMr r9rVr+r)rrs?""""" """ "26D:>"6:""" )-d" =A""" "#!1""59"$4 "&!%!%$"598"&&##$DT"&!%8"t"#'"%*(,.2-1 "*."4 "&!% "*.""s"&!% ""L"&!% " EI!"./q59d7;$ !"J " "&0__&0oo&0oo"%/OO%/__%/__""""" """""""""(," "" "" """" ""r+rc.eZdZdZdZdZdZdZdZy)rz-Abstract policy for accessing the event loop.ct)a>Get the event loop for the current context. Returns an event loop object implementing the AbstractEventLoop interface, or raises an exception in case no event loop has been set for the current context and the current policy does not specify to create one. It should never return None.r|r>s r)r z&AbstractEventLoopPolicy.get_event_loopms "!r+ct)z3Set the event loop for the current context to loop.r|r$r's r)r z&AbstractEventLoopPolicy.set_event_loopwrr+ct)zCreate and return a new event loop object according to this policy's rules. If there's need to set this loop as the event loop for the current context, set_event_loop must be called explicitly.r|r>s r)r z&AbstractEventLoopPolicy.new_event_loop{s "!r+ct)z$Get the watcher for child processes.r|r>s r)r z)AbstractEventLoopPolicy.get_child_watcherrr+ct)z$Set the watcher for child processes.r|)r$watchers r)r z)AbstractEventLoopPolicy.set_child_watcherrr+N) r1rRrSrTr r r r r rVr+r)rrjs7"""""r+rcVeZdZdZdZGddej ZdZdZ dZ dZ y) BaseDefaultEventLoopPolicyaDefault policy implementation for accessing the event loop. In this policy, each thread has its own event loop. However, we only automatically create an event loop by default for the main thread; other threads by default have no event loop. Other policies may have different rules (e.g. a single global event loop, or automatically creating an event loop per thread, or using some other notion of context to which an event loop is associated). NceZdZdZdZy)!BaseDefaultEventLoopPolicy._LocalNF)r1rRrSr _set_calledrVr+r)_LocalrKs  r+rMc.|j|_yr=)rM_localr>s r)r*z#BaseDefaultEventLoopPolicy.__init__skkm r+c|jj|jjstjtj urd} t jd}|rG|jjd}|dk(s|jdsn|j}|dz }|rF ddl }|jdt| |j!|j#|jj*t%d tjj&z|jjS#t$rYwxYw) zvGet the event loop for the current context. Returns an instance of EventLoop or raises an exception. Nr^rr1asynciozasyncio.rzThere is no current event loop) stacklevelz,There is no current event loop in thread %r.)rOrrL threadingcurrent_thread main_threadr"r# f_globalsget startswithf_backAttributeErrorwarningswarnDeprecationWarningr r RuntimeErrorr)r$rRfmoduler[s r)r z)BaseDefaultEventLoopPolicy.get_event_loops/ KK   %KK++((*i.C.C.EEJ $MM!$ [[__Z8F"i/63D3DZ3PA!OJ   MM:,  E    3 3 5 6 ;;   $M!*!9!9!;!@!@ AB B{{   )"  sE EEcd|j_|2t|ts"t dt |j d||j_y)zSet the event loop.TNzs r)r z)BaseDefaultEventLoopPolicy.new_event_loops !!##r+) r1rRrSrTrerSlocalrMr*r r r rVr+r)rIrIs3 M$!B!$r+rIceZdZdZy) _RunningLoopr:N)r1rRrSloop_pidrVr+r)rhrhsHr+rhc4t}| td|S)zrReturn the running event loop. Raise a RuntimeError if there is none. This function is thread-specific. zno running event loop)rr^r's r)rrs"  D |233 Kr+cbtj\}}||tjk(r|Syy)zReturn the running event loop or None. This is a low-level function intended to be used by event loops. This function is thread-specific. N) _running_loopriosgetpid) running_looppids r)rrs5&..L#C299;$6%7r+cB|tjft_y)zSet the running event loop. This is a low-level function intended to be used by event loops. This function is thread-specific. N)rnrormrirks r)rrs#BIIK0Mr+c`t5t ddlm}|adddy#1swYyxYw)NrDefaultEventLoopPolicy)_lock_event_loop_policyrurts r)_init_event_loop_policyrys!   % 0!7!9  s$-c.t ttS)z"Get the current event loop policy.)rwryrVr+r)rrs!! r+cp|2t|ts"tdt|jd|ay)zZSet the current event loop policy. If policy is None, the default policy is restored.NzDpolicy must be an instance of AbstractEventLoopPolicy or None, not 'rb)rfrrcrr1rw)policys r)rrs> *V5L"M^_cdj_k_t_t^uuvwxxr+cNt}||StjS)aGReturn an asyncio event loop. When called from a coroutine or a callback (e.g. scheduled with call_soon or similar API), this function will always return the running event loop. If there is no running event loop set, the function will return the result of `get_event_loop_policy().get_event_loop()` call. )rrr ) current_loops r)r r s*%&L " 1 1 33r+c6tj|y)zCEquivalent to calling get_event_loop_policy().set_event_loop(loop).N)rr rks r)r r 0s**40r+c2tjS)z?Equivalent to calling get_event_loop_policy().new_event_loop().)rr rVr+r)r r 5s " 1 1 33r+c2tjS)zBEquivalent to calling get_event_loop_policy().get_child_watcher().)rr rVr+r)r r :s " 4 4 66r+c4tj|S)zMEquivalent to calling get_event_loop_policy().set_child_watcher(watcher).)rr )rGs r)r r ?s ! " 4 4W ==r+)rrrr forkcttjt_t dt j dy)Nr.)rwrIrMrOrsignal set_wakeup_fdrVr+r)on_forkr]s0  )(B(I(I(K  %$R r+)after_in_child)/rT__all__rrnrr;r>r"rSrxrrrrrrrIrwLockrvrfrhrmrrrryrrr r r r r _py__get_running_loop_py__set_running_loop_py_get_running_loop_py_get_event_loop_asyncio_c__get_running_loop_c__set_running_loop_c_get_running_loop_c_get_event_loop ImportErrorhasattrrregister_at_forkrVr+r)rs]'   JJZ<&<~'!'!TT"T"n ""DD$!8D$V  9??   1:  4 1 4 7 >*)'# '<< -,*& 2v!Bw/  s> C33C;:C;__pycache__/locks.cpython-312.opt-1.pyc000064400000065435152527367570013571 0ustar00 {|j3J`dZdZddlZddlZddlmZddlmZGddZGd d eejZ Gd d ejZ Gd deejZ GddeejZ Gdde Z GddejZGddejZy)zSynchronization primitives.)LockEvent Condition SemaphoreBoundedSemaphoreBarrierN) exceptions)mixinsceZdZdZdZy)_ContextManagerMixinc@K|jd{y7wN)acquireselfs &/usr/lib64/python3.12/asyncio/locks.py __aenter__z_ContextManagerMixin.__aenter__ slln s c,K|jywr)release)rexc_typeexctbs r __aexit__z_ContextManagerMixin.__aexit__s sN)__name__ __module__ __qualname__rrrr r s  rr c@eZdZdZdZfdZdZdZdZdZ xZ S)raPrimitive lock objects. A primitive lock is a synchronization primitive that is not owned by a particular coroutine when locked. A primitive lock is in one of two states, 'locked' or 'unlocked'. It is created in the unlocked state. It has two basic methods, acquire() and release(). When the state is unlocked, acquire() changes the state to locked and returns immediately. When the state is locked, acquire() blocks until a call to release() in another coroutine changes it to unlocked, then the acquire() call resets it to locked and returns. The release() method should only be called in the locked state; it changes the state to unlocked and returns immediately. If an attempt is made to release an unlocked lock, a RuntimeError will be raised. When more than one coroutine is blocked in acquire() waiting for the state to turn to unlocked, only one coroutine proceeds when a release() call resets the state to unlocked; first coroutine which is blocked in acquire() is being processed. acquire() is a coroutine and should be called with 'await'. Locks also support the asynchronous context management protocol. 'async with lock' statement should be used. Usage: lock = Lock() ... await lock.acquire() try: ... finally: lock.release() Context manager usage: lock = Lock() ... async with lock: ... Lock objects can be tested for locking state: if not lock.locked(): await lock.acquire() else: # lock is acquired ... c d|_d|_yNF)_waiters_lockedrs r__init__z Lock.__init__Ms  rct|}|jrdnd}|jr|dt |j}d|ddd|dS Nlockedunlocked , waiters:)super__repr__r$r#lenrresextra __class__s rr0z Lock.__repr__QsYg  LLj ==gZDMM(:';zLock.acquire..cs9=aAKKM=sT) r$r#all collectionsdeque _get_loop create_futureappendremover CancelledError_wake_up_firstrfuts rrz Lock.acquire\s  $--"794==99DL == '--/DMnn,,. S!   *  $$S)   $$S)(( <<##%  sBBD#C$C %C)C/D# CC,,C//1D  D#c`|jrd|_|jytd)aGRelease a lock. When the lock is locked, reset it to unlocked, and return. If any other coroutines are blocked waiting for the lock to become unlocked, allow exactly one of them to proceed. When invoked on an unlocked lock, a RuntimeError is raised. There is no return value. FzLock is not acquired.N)r$rG RuntimeErrorrs rrz Lock.release|s* << DL    !67 7rc|jsy tt|j}|j s|j dyy#t$rYywxYw)z*Wake up the first waiter if it isn't done.NT)r#nextiter StopIterationdone set_resultrHs rrGzLock._wake_up_firstsT}}  tDMM*+Cxxz NN4     sA AA) rrr__doc__r%r0r(rrrG __classcell__r5s@rrrs(3j*@8" !rrc@eZdZdZdZfdZdZdZdZdZ xZ S)ra#Asynchronous equivalent to threading.Event. Class implementing event objects. An event manages a flag that can be set to true with the set() method and reset to false with the clear() method. The wait() method blocks until the flag is true. The flag is initially false. cDtj|_d|_yr")r@rAr#_valuers rr%zEvent.__init__s#))+  rct|}|jrdnd}|jr|dt |j}d|ddd|dS) Nsetunsetr*r+r r,r-r.)r/r0rWr#r1r2s rr0zEvent.__repr__sYg ' ==gZDMM(:';= 0) ValueErrorr#rW)rvalues rr%zSemaphore.__init__Ys# 19CD D  rct|}|jrdnd|j}|jr|dt |j}d|ddd|dS) Nr(zunlocked, value:r*r+r r,r-r.)r/r0r(rWr#r1r2s rr0zSemaphore.__repr___sgg  KKM1A$++/O ==gZDMM(:';K|]}|j ywrr9r;s rr>z#Semaphore.locked..isA,?aAKKM!,?sr)rWanyr#rs rr(zSemaphore.lockedfs4{{aC ADMM,?R,?A A CrcK|js|xjdzc_y|jtj|_|j j }|jj| |d{|jj| |jdkDr|jy7@#|jj|wxYw#tj$r7|js%|xjdz c_|jwxYww)a5Acquire a semaphore. If the internal counter is larger than zero on entry, decrement it by one and return True immediately. If it is zero on entry, block, waiting until some other coroutine has called release() to make it larger than 0, and then return True. r TNr) r(rWr#r@rArBrCrDrEr rFr: _wake_up_nextrHs rrzSemaphore.acquireks{{} KK1 K == '--/DMnn,,. S!  *  $$S) ;;?     $$S)(( ==? q ""$   sCBD> CCCC1.!D>CC..C11A D;;D>cN|xjdz c_|jy)zRelease a semaphore, incrementing the internal counter by one. When it was zero on entry and another coroutine is waiting for it to become larger than zero again, wake up that coroutine. r N)rWr~rs rrzSemaphore.releases q  rc|jsy|jD]:}|jr|xjdzc_|jdyy)z)Wake up the first waiter that isn't done.Nr T)r#rPrWrQrHs rr~zSemaphore._wake_up_nexts@}} ==C88: q t$ !rrt) rrrrRr%r0r(rrr~rSrTs@rrrJs(  *C "H rrc.eZdZdZdfd ZfdZxZS)rzA bounded semaphore implementation. This raises ValueError in release() if it would increase the value above the initial value. c2||_t| |yr) _bound_valuer/r%)rrxr5s rr%zBoundedSemaphore.__init__s! rcj|j|jk\r tdt|y)Nz(BoundedSemaphore released too many times)rWrrwr/r)rr5s rrzBoundedSemaphore.releases+ ;;$++ +GH H rrt)rrrrRr%rrSrTs@rrrs  rrceZdZdZdZdZdZy) _BarrierStatefillingdraining resettingbrokenN)rrrFILLINGDRAINING RESETTINGBROKENrrrrrsGHI FrrceZdZdZdZfdZdZdZdZdZ dZ d Z d Z d Z d Zed ZedZedZxZS)ra Asyncio equivalent to threading.Barrier Implements a Barrier primitive. Useful for synchronizing a fixed number of tasks at known synchronization points. Tasks block on 'wait()' and are simultaneously awoken once they have all made their call. c|dkr tdt|_||_tj |_d|_y)z1Create a barrier, initialised to 'parties' tasks.r zparties must be >= 1rN)rwr_cond_partiesrr_state_count)rpartiess rr%zBarrier.__init__s9 Q;34 4[  #++  rct|}|jj}|js|d|j d|j z }d|ddd|dS)Nr*/r+r r,r-r.)r/r0rrxr n_waitingrr2s rr0zBarrier.__repr__sdg ;;$$%{{ z$..!14<<.A AE3q9+Rwb))rc>K|jd{S7wrrjrs rrzBarrier.__aenter__sYY[   s c Kywrr)rargss rrzBarrier.__aexit__s  sc0K|j4d{|jd{ |j}|xjdz c_|dz|jk(r|j d{n|j d{||xjdzc_|j cdddd{S777Y7B7 #|xjdzc_|j wxYw#1d{7swYyxYww)zWait for the barrier. When the specified number of tasks have started waiting, they are all simultaneously awoken. Returns an unique and individual index number from 0 to 'parties-1'. Nr )r_blockrr_release_wait_exit)rindexs rrbz Barrier.waits:::++-     q 19 ---/))**,&& q  ::  *& q  ::sDC DDCDAC7C8CCC%D; DCDDCCD'C>>DDD DDcKjjfdd{jtjurt j dy76w)Nc\jtjtjfvSr)rrrrrsrz Barrier._block..s$DKK&& (?(?(rzBarrier aborted)rrmrrrr BrokenBarrierErrorrs`rrzBarrier._blocksZ jj!!     ;;-.. .//0AB B / s"AA7AcjKtj|_|jj ywr)rrrrrsrs rrzBarrier._releases% $,,  s13cKjjfdd{jtjtj fvrt jdy7Fw)Nc<jtjuSr)rrrrsrrzBarrier._wait..s$++]=R=R*RrzAbort or reset of barrier)rrmrrrrr rrs`rrz Barrier._waits] jj!!"RSSS ;;=//1H1HI I//0KL L J Ts"A.A,AA.c|jdk(r\|jtjtjfvrtj |_|j jyy)Nr)rrrrrrrrsrs rrz Barrier._exitsO ;;! {{}66 8N8NOO+33 JJ ! ! # rchK|j4d{|jdkDr2|jtjur+tj|_ntj |_|jj dddd{y77#1d{7swYyxYww)zReset the barrier to the initial state. Any tasks currently waiting will get the BrokenBarrier exception raised. Nr)rrrrrrrsrs rresetz Barrier.reset"sk :::{{Q;;m&=&=="/"9"9DK+33 JJ ! ! #::::::sEB2BB2A1B B2BB2B2B/#B& $B/+B2cK|j4d{tj|_|jj dddd{y7D7#1d{7swYyxYww)zPlace the barrier into a 'broken' state. Useful in case of error. Any currently waiting tasks and tasks attempting to 'wait()' will have BrokenBarrierError raised. N)rrrrrsrs rabortz Barrier.abort1sA :::'..DK JJ ! ! #::::::sDA1AA10A A1AA1A1A."A% #A.*A1c|jS)z8Return the number of tasks required to trip the barrier.)rrs rrzBarrier.parties;s}}rcT|jtjur |jSy)zrs! * C! !7!7C!L:&F " ":&zm($f&<&<m(`W$f&<&<Wty$DIIM3f$$M3r__pycache__/windows_events.cpython-312.pyc000064400000121065152527367570014565 0ustar00 {|jKdZddlZejdk7redddlZddlZddlZddlmZddl Z ddl Z ddl Z ddl Z ddl Z ddlZddlmZddlmZdd lmZdd lmZdd lmZdd lmZdd lmZddlmZddlmZdZej6Zej8ZdZdZdZdZ GddejBZ"GddejBZ#Gdde#Z$Gdde#Z%Gdde&Z'Gdd ejPZ)Gd!d"ejTZ+Gd#d$Z,Gd%d&ejZZ.e)Z/Gd'd(ej`Z1Gd)d*ej`Z2e2Z3y)+z.Selector and proactor event loops for Windows.Nwin32z win32 only)partial)events)base_subprocess)futures) exceptions)proactor_events)selector_events)tasks) windows_utils)logger)SelectorEventLoopProactorEventLoop IocpProactorDefaultEventLoopPolicyWindowsSelectorEventLoopPolicyWindowsProactorEventLoopPolicyiigMbP?g?cXeZdZdZddfd ZfdZdZd fd ZfdZfd Z xZ S) _OverlappedFuturezSubclass of Future which represents an overlapped operation. Cancelling it will immediately cancel the overlapped operation. Nloopcft|||jr |jd=||_yNr)super__init___source_traceback_ov)selfovr __class__s //usr/lib64/python3.12/asyncio/windows_events.pyrz_OverlappedFuture.__init__7s1 d#  ! !&&r*ct|}|jH|jjrdnd}|j dd|d|jj dd|S)Npending completedrz overlapped=)r _repr_inforr&insertaddressr infostater"s r#r*z_OverlappedFuture._repr_info=s\w!# 88 !%!1!1I{E KK\%4883C3CB2GqI J r$c|jy |jjd|_y#t$rM}d||d}|jr|j|d<|jj |Yd}~d|_yd}~wwxYw)Nz&Cancelling an overlapped future failedmessage exceptionfuturesource_traceback)rcancelOSErrorr_loopcall_exception_handler)r exccontexts r#_cancel_overlappedz$_OverlappedFuture._cancel_overlappedDs 88   7 HHOO  7C G %%.2.D.D*+ JJ - -g 6 6 7s1 B r$cd|_yrB)r)r futs r#_unregister_wait_cbz)_BaseWaitHandleFuture._unregister_wait_cbs r$c|jsyd|_|j}d|_ tj||jdy#t$rh}|j tj k7rAd||d}|jr|j|d<|jj|Yd}~yYd}~~d}~wwxYwNFz$Failed to unregister the wait handler1r5) rTrS _overlappedUnregisterWaitr7winerrorERROR_IO_PENDINGrr8r9rdr rVr:r;s r#_unregister_waitz&_BaseWaitHandleFuture._unregister_waits  ''     & &{ 3   & ||{;;;E!$" ))262H2HG./ 11':< sA CAB<<CcD|jt| |Sr>)rlrr6r@s r#r6z_BaseWaitHandleFuture.cancels  w~#~&&r$cD|jt| |yrB)rlrrCrDs r#rCz#_BaseWaitHandleFuture.set_exceptions  i(r$cD|jt| |yrB)rlrrFrGs r#rFz _BaseWaitHandleFuture.set_results  6"r$rB) rIrJrKrLrr]r*rdrlr6rCrFrMrNs@r#rPrPas6<8<  '  '0')##r$rPcBeZdZdZddfd ZdZfdZfdZxZS)_WaitCancelFuturezoSubclass of Future which represents a wait for the cancellation of a _WaitHandleFuture using an event. Nrc:t|||||d|_y)Nr)rr_done_callback)r r!eventrVrr"s r#rz_WaitCancelFuture.__init__s! UKd;"r$ctd)Nz'_WaitCancelFuture must not be cancelled) RuntimeErrorr\s r#r6z_WaitCancelFuture.cancelsDEEr$c`t|||j|j|yyrB)rrFrsrGs r#rFz_WaitCancelFuture.set_results/ 6"    *    % +r$c`t|||j|j|yyrB)rrCrsrDs r#rCz_WaitCancelFuture.set_exceptions/ i(    *    % +r$) rIrJrKrLrr6rFrCrMrNs@r#rqrqs'8<# F& &&r$rqc4eZdZddfd ZfdZdZxZS)_WaitHandleFutureNrct|||||||_d|_t j dddd|_d|_y)NrTF)rr _proactor_unregister_proactorrg CreateEvent_event _event_fut)r r!rUrVproactorrr"s r#rz_WaitHandleFuture.__init__sG V[t<!$(!!--dD%F r$c|j-tj|jd|_d|_|jj |j d|_t|!|yrB) rrY CloseHandlerr| _unregisterrrrd)r rcr"s r#rdz%_WaitHandleFuture._unregister_wait_cbsY ;; "    ,DK"DO ""488, #C(r$c|jsyd|_|j}d|_ tj||j|jj|j|j|_y#t $rh}|j tjk7rAd||d}|jr|j|d<|jj|Yd}~yYd}~d}~wwxYwrf)rTrSrgUnregisterWaitExrr7rirjrr8r9r| _wait_cancelrdrrks r#rlz"_WaitHandleFuture._unregister_waits  ''     ( (dkk B..55dkk6:6N6NP ||{;;;E!$" ))262H2HG./ 11':< s A?? C0AC++C0)rIrJrKrrdrlrMrNs@r#rzrzsBF)$Pr$rzc2eZdZdZdZdZdZdZdZeZ y) PipeServerzXClass representing a pipe server. This is much like a bound, listening socket. c||_tj|_d|_d|_|j d|_yNT)_addressweakrefWeakSet_free_instances_pipe_accept_pipe_future_server_pipe_handle)r r,s r#rzPipeServer.__init__s; &0 #' --d3 r$cL|j|jdc}|_|S)NF)rr)r tmps r#_get_unconnected_pipez PipeServer._get_unconnected_pipes% **d&>&>u&ETZ r$c ,|jrytjtjz}|r|tjz}tj |j |tjtjztjztjtjtjtjtj}tj|}|j j#||SrB)closedrYPIPE_ACCESS_DUPLEXFILE_FLAG_OVERLAPPEDFILE_FLAG_FIRST_PIPE_INSTANCECreateNamedPiperPIPE_TYPE_MESSAGEPIPE_READMODE_MESSAGE PIPE_WAITPIPE_UNLIMITED_INSTANCESr BUFSIZENMPWAIT_WAIT_FOREVERNULL PipeHandleradd)r firstflagshpipes r#rzPipeServer._server_pipe_handles ;;=**W-I-II  W:: :E  # # MM5  % %(E(E E      , ,  ! !=#8#8  ( (',,  8''*   & r$c|jduSrB)rr\s r#rzPipeServer.closed s %&r$c |j!|jjd|_|jJ|jD]}|j d|_d|_|jj yyrB)rr6rrcloserclear)r rs r#rzPipeServer.close#sp  # # /  $ $ + + -'+D $ == $,, -DJ DM  & & ( %r$N) rIrJrKrLrrrrr__del__r$r#rrs'4$' )Gr$rceZdZdZy)_WindowsSelectorEventLoopz'Windows version of selector event loop.N)rIrJrKrLrr$r#rr2s1r$rcDeZdZdZdfd ZfdZdZdZ ddZxZ S)rz2Windows version of proactor event loop using IOCP.c<| t}t| |yrB)rrr)r rr"s r#rzProactorEventLoop.__init__9s  #~H "r$c4 |jJ|j|jt||ja|jj }|jj |'|js|jj|d|_yy#|ja|jj }|jj |'|js|jj|d|_wwxYwrB) _self_reading_future call_soon_loop_self_readingr run_foreverrr6r&r|r)r r!r"s r#rzProactorEventLoop.run_forever>s 1,,4 44 NN422 3 G  !((4..22))002>"**NN..r2,0)5t((4..22))002>"**NN..r2,0)5s 7B((A/DcK|jj|}|d{}|}|j||d|i}||fS7%w)Naddrextra)r| connect_pipe_make_duplex_pipe_transport)r protocol_factoryr,frprotocoltranss r#create_pipe_connectionz(ProactorEventLoop.create_pipe_connectionQsZ NN ' ' 0w#%00x8>7H1Jh s!A A &A cfKtdfd jgSw)NcJd} |ri|j}jj|jr|j y}j ||dij }|yjj|}|_ |jy#t$r9|r#|jdk7r|j jYyt$rz}|r9|jdk7r&jd||d|j n$j rt#j$d|djYd}~yd}~wt&j($r|r|j YyYywxYw) NrrrzPipe accept failed)r2r3rzAccept pipe failed on pipe %rT)exc_info)rHrdiscardrrrrr| accept_piperadd_done_callbackBrokenPipeErrorfilenorr7r9_debugrwarningr CancelledError) rrrr:r,loop_accept_piperr servers r#rz>ProactorEventLoop.start_serving_pipe..loop_accept_pipe\stD) 688:D**2248}} /1H44hvw.?5A335<NN..t4*./*##$45+# 1DKKMR/JJL/0 1DKKMR///#7%( $1 JJL[[NN#B#'$8/00,, !JJL !s1A B7/B7B77?F"8F"A0E55(F"!F"rB)rr)r rr,rrs```@@r#start_serving_pipez$ProactorEventLoop.start_serving_pipeYs2G$+ 6+ 6Z '(xs*1c K|j} t||||||||f| |d| } | d{| S7#ttf$rt$r+| j | j d{7wxYww)N)waiterr) create_future_WindowsSubprocessTransport SystemExitKeyboardInterrupt BaseExceptionr_wait) r rargsshellstdinstdoutstderrbufsizerkwargsrtransps r#_make_subprocess_transportz,ProactorEventLoop._make_subprocess_transports##%,T8T5-2FFG74:%7067 LL  -.    LLN,,.  s1'A>868A>8;A;3A64A;;A>rB) rIrJrKrLrrrrrrMrNs@r#rr6s%<# 1&1j04r$rceZdZdZefdZdZdZdZd!dZ dZ e d Z e d Zd"d Zd"d Zd"d Zd"dZd#dZd"dZdZdZdZdZdZd!dZdZdZdZdZdZdZ d!dZ!dZ"dZ#d Z$y)$rz#Proactor implementation using IOCP.cd|_g|_tjtjt d||_i|_tj|_ g|_ tj|_ yrX) r8_resultsrgCreateIoCompletionPortINVALID_HANDLE_VALUEr_iocp_cacherrrT _unregistered_stopped_serving)r concurrencys r#rzIocpProactor.__init__s_   77  , ,dA{D  "??, ' 1r$c2|j tdy)NzIocpProactor is closed)rrvr\s r# _check_closedzIocpProactor._check_closeds :: 78 8 r$cdt|jzdt|jzg}|j|j dd|j j ddj|dS)Nzoverlapped#=%sz result#=%sr< r))lenrrrrar"rIjoin)r r.s r#__repr__zIocpProactor.__repr__s_ 3t{{#33s4==113 ::  KK ! NN33SXXd^DDr$c||_yrB)r8)r rs r#set_loopzIocpProactor.set_loops  r$Ncz|js|j||j}g|_ |d}S#d}wxYwrB)rr])r timeoutrs r#selectzIocpProactor.selects:}} JJw mm  C$Cs6:c\|jj}|j||SrB)r8rrF)r valuercs r#_resultzIocpProactor._results%jj&&( u r$c |jS#t$rD}|jtjtj fvrt |jd}~wwxYwrB) getresultr7rirgERROR_NETNAME_DELETEDERROR_OPERATION_ABORTEDConnectionResetErrorr)rkeyr!r:s r#finish_socket_funczIocpProactor.finish_socket_funcsY <<> ! || A A + C C EE*CHH55  s A?AAc |j|||S#t$r,}|jtjk(r |dfcYd}~Sd}~wwxYwrB)rr7rirgERROR_PORT_UNREACHABLE)clsrrr! empty_resultr:s r#_finish_recvfromzIocpProactor._finish_recvfromsN ))%b9 9 ||{AAA#T))  s A  AA AA c|j|tjt} t |t j r"|j |j||n |j|j||j|||jS#t$r|jdcYSwxYw)Nr$) _register_with_iocprg Overlappedr isinstancesocketWSARecvrReadFilerr _registerrr connnbytesrr!s r#recvzIocpProactor.recvs   &  # #D ) %$ . 4;;=&%8 DKKM62~~b$(?(?@@ %<<$ $ %AB%%CCc|j|tjt} t |t j r"|j |j||n |j|j||j|||jS#t$r|jdcYSwxYwrX) r rgr rr r  WSARecvIntor ReadFileIntorrrrr rbufrr!s r# recv_intozIocpProactor.recv_intos   &  # #D ) #$ .t{{}c59 s3~~b$(?(?@@ #<<? " #rc*|j|tjt} |j |j |||j||t|jdS#t $r|jdcYSwxYw)N)r$Nr$r) r rgr r WSARecvFromrrrrrrrs r#recvfromzIocpProactor.recvfroms   &  # #D ) - NN4;;=&% 8~~b$0E0E=@)BC C -<< , , -!A55BBc*|j|tjt} |j |j |||j||t|jdS#t $r|jdcYSwxYw)NrNrr) r rgr rWSARecvFromIntorrrrrrrs r# recvfrom_intozIocpProactor.recvfrom_intos   &  # #D ) +   t{{}c5 9~~b$0E0E=>)@A A +<< * * +rc|j|tjt}|j |j ||||j |||jSrB)r rgr r WSASendTorrr)r rrrrr!s r#sendtozIocpProactor.sendtosQ   &  # #D ) T[[]C5~~b$(?(?@@r$cH|j|tjt}t |t j r"|j |j||n |j|j||j|||jSrB) r rgr rr r WSASendr WriteFilerrrs r#sendzIocpProactor.sendsq   &  # #D ) dFMM * JJt{{}c5 1 LL ,~~b$(?(?@@r$c||j|jjtjt }|j jjfd}d}|j||}||}tj||j|S)Nc,|jtjdj}j t j tj|jjjfS)Nz@P) rstructpackr setsockoptr  SOL_SOCKETrgSO_UPDATE_ACCEPT_CONTEXT settimeout gettimeout getpeername)rrr!rrlisteners r# finish_acceptz*IocpProactor.accept..finish_accept*sl LLN++dHOO$56C OOF--'@@# G OOH//1 2))++ +r$cvK |d{y7#tj$r|jwxYwwrB)r rr)r4rs r# accept_coroz(IocpProactor.accept..accept_coro3s2  ,,   s 99%69r) r _get_accept_socketfamilyrgr rAcceptExrrr ensure_futurer8)r r5r!r6r8r4corors ` @r#acceptzIocpProactor.accept$s   *&&x7  # #D ) HOO%t{{}5 , Hm<64( Dtzz2 r$cjtjk(rQtjj ||j j}|jd|S|j tjj jtj"t$}|j'j |fd}|j)||S#t$r?}|jtjk7rj!ddk(rYd}~d}~wwxYw)Nrrc|jjtjtj dSrX)rr/r r0rgSO_UPDATE_CONNECT_CONTEXT)rrr!rs r#finish_connectz,IocpProactor.connect..finish_connectVs1 LLN OOF--'AA1 FKr$)typer  SOCK_DGRAMrg WSAConnectrr8rrFr  BindLocalr:r7rierrno WSAEINVAL getsocknamer r ConnectExr)r rr,rcer!rBs ` r#connectzIocpProactor.connect@s 99)) )  " "4;;=' :****,C NN4 J   &   ! !$++- = # #D ) T[[]G, ~~b$77! zzU__,!!$)*  s.D E  5EE c 6|j|tjt}|dz}|dz dz}|j |j t j|j |||dd|j|||jS)Nl r) r rgr r TransmitFilermsvcrt get_osfhandlerr)r sockfileoffsetcountr! offset_low offset_highs r#sendfilezIocpProactor.sendfile_s   &  # #D )k) |{2   ,,T[[];"Kq! % ~~b$(?(?@@r$c|jtjt}|j j }|r|j Sfd}|j||S)Nc(|jSrB)r)rrr!rs r#finish_accept_pipez4IocpProactor.accept_pipe..finish_accept_pipevs LLNKr$)r rgr rConnectNamedPiperrr)r rr! connectedr[s ` r#rzIocpProactor.accept_pipeksf   &  # #D )'' 6 <<% % ~~b$(:;;r$c<Kt} tj|} tj|S#t$r(}|jtj k7rYd}~nd}~wwxYwt |dzt}tj|d{7w)N) CONNECT_PIPE_INIT_DELAYrg ConnectPiper7riERROR_PIPE_BUSYminCONNECT_PIPE_MAX_DELAYr sleepr r)r r,delayrUr:s r#rzIocpProactor.connect_pipe|s' $009''// <<;#>#>>?   #9:E++e$ $ $s6B6B A'A"B"A''.BBBc(|j||dS)zWait for a handle. Return a Future object. The result of the future is True if the wait completed, or False if the wait did not complete (on timeout). F)_wait_for_handle)r rUrs r#wait_for_handlezIocpProactor.wait_for_handles $$VWe<.finish_wait_for_handles779 r$r)rrYINFINITEmathceilrgr rRegisterWaitWithQueuerr,rqr8rzrr) r rUr _is_cancelmsr!rVrors @r#rhzIocpProactor._wait_for_handles  ?!!B7S=)B # #D )!77 DJJ B0 !"fk KA!"fk4'+zz3A  ##B' $%b!-C"D BJJr$c||jvrL|jj|tj|j |j ddyyrX)rTrrgrrrr objs r#r z IocpProactor._register_with_iocpsI d&& &     %  . .szz|TZZA N 'r$c^|jt||j}|jr |jd=|js |dd|}|j |||||f|j|j<|S#t $r}|j|Yd}~>d}~wwxYwr) rrr8rr&rFr7rCrr,)r r!rxcallbackrrrKs r#rzIocpProactor._registers  btzz 2  ##B'zz  $ tR0 U#$%b#x"8 BJJ #"" #s B B,B''B,cZ|j|jj|y)a Unregister an overlapped object. Call this method when its future has been cancelled. The event can already be signalled (pending in the proactor event queue). It is also safe if the event is never signalled (because it was cancelled). N)rrra)r r!s r#rzIocpProactor._unregisters$  !!"%r$cRtj|}|jd|SrX)r r2)r r:ss r#r9zIocpProactor._get_accept_sockets MM& ! Qr$c "|t}n<|dkr tdtj|dz}|tk\r td t j |j |}|nd}|\}}}} |jj|\}} } } | |j vr|j#nI|j%s9 | ||| } |j'| |j(j+|d}|j0D](} |jj| j2d*|j0j5y#t$rl|jjr%|jjdd||||fzd|dtjfvrtj|Y}wxYw#t,$r7} |j/| |j(j+|Yd} ~ d} ~ wwxYw#d}wxYw)Nrznegative timeoutrmztimeout too bigz8GetQueuedCompletionStatus() returned an unexpected eventz)err=%s transferred=%s key=%#x address=%#x)r2status)rp ValueErrorrqrrrgGetQueuedCompletionStatusrrpopKeyErrorr8 get_debugr9rrYrrr6donerFrrar7rCrr,r)r rrurerr transferredrr,rr!rxrzrrKs r#r]zIocpProactor._polls ?B q[/0 07S=)BX~ !233 ::4::rJF~B-3 *Cc7 '+{{w'?$2sH d+++ VVX $[#r:E LL'MM((+AMR$$B KKOOBJJ -%   "E ::'')JJ55%7#N&);W%E$F7q+"B"BCC'', ,,OOA&MM((++,AsC4 E G,H A1GG H,H<H HH Hc:|jj|yrB)rrrws r# _stop_servingzIocpProactor._stop_serving2s !!#&r$c4|jyt|jjD]:\}}}}|j rt |t r* |j<d}tj}||z} |jrx| tjkrCtjd|tj|z tj|z} |j!||jrxg|_t%j&|jd|_y#t$rS}|j>++ K!4>>#3j#@B>>+j8 JJz "kk DJJ' ; Czz-'C),&)# 00:=:O:OG$67 99'B CsD;; FAFFc$|jyrB)rr\s r#rzIocpProactor.__del__gs  r$rB)rr!)%rIrJrKrLrprrrrrr staticmethodr classmethodrrrrr#r&r*r>rLrXrrrirrhr rrr9r]rrrrr$r#rrs-#+29E     A A C AAA88> A<"0&= DO@& 7#r' -^r$rceZdZdZy)rc tj|f|||||d|_fd}jjj t jj} | j|y)N)rrrrrc\jj}j|yrB)_procpoll_process_exited)r returncoder s r#rzz4_WindowsSubprocessTransport._start..callbackrs!*J   ,r$) r Popenrr8r|riintrRr) r rrrrrrrrzrs ` r#_startz"_WindowsSubprocessTransport._startmso"(( 'U6&'%'  - JJ 0 0TZZ5G5G1H I H%r$N)rIrJrKrrr$r#rrks &r$rceZdZeZy)rN)rIrJrKr _loop_factoryrr$r#rr}%Mr$rceZdZeZy)rN)rIrJrKrrrr$r#rrrr$r)4rLsysplatform ImportErrorrgrYrG functoolsrrqrPr r-rrrrrr r r r r logr__all__rrpERROR_CONNECTION_REFUSEDERROR_CONNECTION_ABORTEDr`rdFuturerrPrqrzobjectrBaseSelectorEventLooprBaseProactorEventLooprrBaseSubprocessTransportrrBaseDefaultEventLoopPolicyrrrrr$r#rs\4 <<7 l ##   ||    --`G#GNNG#T&-&01P-1Ph88v2 E E2g==gTHHV &/"I"I &.&V%F%F&&V%F%F&8r$__pycache__/queues.cpython-312.opt-1.pyc000064400000027247152527367570013764 0ustar00 {|j&dZddlZddlZddlmZddlmZddlmZGddeZ Gd d eZ Gd d ejZ Gd de Z Gdde Zy))Queue PriorityQueue LifoQueue QueueFull QueueEmptyN) GenericAlias)locks)mixinsceZdZdZy)rz;Raised when Queue.get_nowait() is called on an empty Queue.N__name__ __module__ __qualname____doc__'/usr/lib64/python3.12/asyncio/queues.pyrr sErrceZdZdZy)rzDRaised when the Queue.put_nowait() method is called on a full Queue.Nr rrrrrsNrrceZdZdZddZdZdZdZdZdZ dZ e e Z d Zd Zed Zd Zd ZdZdZdZdZdZdZy)raA queue, useful for coordinating producer and consumer coroutines. If maxsize is less than or equal to zero, the queue size is infinite. If it is an integer greater than 0, then "await put()" will block when the queue reaches maxsize, until an item is removed by get(). Unlike the standard library Queue, you can reliably know this Queue's size with qsize(), since your single-threaded asyncio application won't be interrupted between calling qsize() and doing an operation on the Queue. c ||_tj|_tj|_d|_t j|_|jj|j|y)Nr) _maxsize collectionsdeque_getters_putters_unfinished_tasksr Event _finishedset_initselfmaxsizes r__init__zQueue.__init__!s\ $))+ #))+ !"  7rc6tj|_yN)rr_queuer"s rr!z Queue._init/s!'') rc6|jjSr')r(popleftr#s r_getz Queue._get2s{{""$$rc:|jj|yr'r(appendr#items r_putz Queue._put5 4 rct|r6|j}|js|jdy|r5yyr')r*done set_result)r#waiterswaiters r _wakeup_nextzQueue._wakeup_next:s0__&F;;=!!$' rcpdt|jdt|dd|jdS)N)typerid_formatr+s r__repr__zQueue.__repr__Bs54:&&'tBtHR=$,,.9IKKrcVdt|jd|jdS)Nr;r<r=)r>rr@r+s r__str__z Queue.__str__Es)4:&&'q(8::rcPd|j}t|ddr|dt|jz }|jr|dt |jdz }|j r|dt |j dz }|jr|d|jz }|S)Nzmaxsize=r(z _queue=z _getters[]z _putters[z tasks=)rgetattrlistr(rlenrr)r#results rr@z Queue._formatJsDMM,- 44 ( dkk!2 56 6F ==  3t}}#5"6a8 8F ==  3t}}#5"6a8 8F  ! !  6 678 8F rc,t|jS)zNumber of items in the queue.)rHr(r+s rqsizez Queue.qsizeVs4;;rc|jS)z%Number of items allowed in the queue.)rr+s rr$z Queue.maxsizeZs}}rc|j S)z3Return True if the queue is empty, False otherwise.r(r+s remptyz Queue.empty_s;;rc\|jdkry|j|jk\S)zReturn True if there are maxsize items in the queue. Note: if the Queue was initialized with maxsize=0 (the default), then full() is never True. rF)rrKr+s rfullz Queue.fullcs( ==A ::<4==0 0rcK|jrU|jj}|jj | |d{|jrU|j|S7&#|j  |jj |n#t$rYnwxYw|js+|js|j|jxYww)zPut an item into the queue. Put an item into the queue. If the queue is full, wait until a free slot is available before adding item. N) rQ _get_loop create_futurerr/cancelremove ValueError cancelledr9 put_nowait)r#r1putters rputz Queue.putns iik^^%335F MM  (  iik&t$$  MM((0!yy{6+;+;+=%%dmm4sZA C8 A;A9A;C8(C89A;;C5B*)C5* B63C55B66?C55C8c|jrt|j||xjdz c_|jj |j |jy)zyPut an item into the queue without blocking. If no free slot is immediately available, raise QueueFull. r N)rQrr2rrclearr9rr0s rrYzQueue.put_nowaitsP 99;O $ !#  $--(rcK|jrU|jj}|jj | |d{|jrU|jS7%#|j  |jj |n#t$rYnwxYw|js+|js|j|jxYww)zoRemove and return an item from the queue. If queue is empty, wait until an item is available. N) rOrSrTrr/rUrVrWrXr9 get_nowait)r#getters rgetz Queue.gets jjl^^%335F MM  (  jjl&    MM((0!zz|F,<,<,>%%dmm4sZA C7 A:A8A:C7(C78A::C4 B)(C4) B52C44B55?C44C7c|jrt|j}|j|j|S)zRemove and return an item from the queue. Return an item if one is immediately available, else raise QueueEmpty. )rOrr,r9rr0s rr_zQueue.get_nowaits5 ::< yy{ $--( rc|jdkr td|xjdzc_|jdk(r|jjyy)a$Indicate that a formerly enqueued task is complete. Used by queue consumers. For each get() used to fetch a task, a subsequent call to task_done() tells the queue that the processing on the task is complete. If a join() is currently blocking, it will resume when all items have been processed (meaning that a task_done() call was received for every item that had been put() into the queue). Raises ValueError if called more times than there were items placed in the queue. rz!task_done() called too many timesr N)rrWrr r+s r task_donezQueue.task_donesR  ! !Q &@A A !#  ! !Q & NN    'rctK|jdkDr#|jjd{yy7w)aBlock until all items in the queue have been gotten and processed. The count of unfinished tasks goes up whenever an item is added to the queue. The count goes down whenever a consumer calls task_done() to indicate that the item was retrieved and all work on it is complete. When the count of unfinished tasks drops to zero, join() unblocks. rN)rrwaitr+s rjoinz Queue.joins4  ! !A %..%%' ' ' & 's -868N)r)rrrrr%r!r,r2r9rArC classmethodr__class_getitem__r@rKpropertyr$rOrQr[rYrar_rdrgrrrrrs~  *%! L;$L1   1%6 )!4 !( (rrcReZdZdZdZej fdZejfdZ y)rzA subclass of Queue; retrieves entries in priority order (lowest first). Entries are typically tuples of the form: (priority number, data). cg|_yr'rNr"s rr!zPriorityQueue._init  rc*||j|yr'rN)r#r1heappushs rr2zPriorityQueue._putsd#rc&||jSr'rN)r#heappops rr,zPriorityQueue._getst{{##rN) rrrrr!heapqror2rqr,rrrrrs( #(..$!==$rrc"eZdZdZdZdZdZy)rzEA subclass of Queue that retrieves most recently added entries first.cg|_yr'rNr"s rr!zLifoQueue._initrmrc:|jj|yr'r.r0s rr2zLifoQueue._putr3rc6|jjSr')r(popr+s rr,zLifoQueue._gets{{  rN)rrrrr!r2r,rrrrrsO!!rr)__all__rrrtypesrr r Exceptionrr_LoopBoundMixinrrrrrrr}s^ L     B(F " "B(J $E $ ! !r__pycache__/runners.cpython-312.opt-1.pyc000064400000023410152527367570014135 0ustar00 {|j>dZddlZddlZddlZddlZddlZddlmZddlmZddlm Z ddlm Z ddlm Z Gd d ejZ Gd d Zddd dZdZy))RunnerrunN) coroutines)events) exceptions)tasks) constantsceZdZdZdZdZy)_Statecreated initializedclosedN)__name__ __module__ __qualname__CREATED INITIALIZEDCLOSED(/usr/lib64/python3.12/asyncio/runners.pyr r sGK Frr cNeZdZdZddddZdZdZdZdZdd d Z d Z d Z y) ra5A context manager that controls event loop life cycle. The context manager always creates a new event loop, allows to run async functions inside it, and properly finalizes the loop at the context manager exit. If debug is True, the event loop will be run in debug mode. If loop_factory is passed, it is used for new event loop creation. asyncio.run(main(), debug=True) is a shortcut for with asyncio.Runner(debug=True) as runner: runner.run(main()) The run() method can be called multiple times within the runner's context. This can be useful for interactive console (e.g. IPython), unittest runners, console tools, -- everywhere when async code is called from existing sync framework and where the preferred single asyncio.run() call doesn't work. Ndebug loop_factoryctj|_||_||_d|_d|_d|_d|_y)NrF) r r_state_debug _loop_factory_loop_context_interrupt_count_set_event_loop)selfrrs r__init__zRunner.__init__0s:nn  )  !$rc&|j|SN) _lazy_initr%s r __enter__zRunner.__enter__9s  rc$|jyr()close)r%exc_typeexc_valexc_tbs r__exit__zRunner.__exit__=s  rcF|jtjury |j}t ||j |j |j |jtj|jrtjd|jd|_tj|_y#|jrtjdjd|_tj|_wxYw)zShutdown and close event loop.N)rr rr!_cancel_all_tasksrun_until_completeshutdown_asyncgensshutdown_default_executorr THREAD_JOIN_TIMEOUTr$rset_event_loopr-r)r%loops rr-z Runner.close@s ;;f00 0  (::D d #  # #D$;$;$= >  # #..y/L/LM O##%%d+ JJLDJ --DK ##%%d+ JJLDJ --DKs A$CAD c:|j|jS)zReturn embedded event loop.)r)r!r*s rget_loopzRunner.get_loopQs zzrcontextctj|stdj|t j t d|j| |j}|jj||}tjtjurztjtj tj"urGt%j&|j(|} tjtj |nd}d|_ |jj-||Ytjtj |ur3tjtj tj"SSS#t$rd}YwxYw#t.j0$r4|j*dkDr#t3|dd}||dk(r t5wxYw#|Ytjtj |ur3tjtj tj"wwwxYw)z/Run a coroutine inside the embedded event loop.z"a coroutine was expected, got {!r}Nz7Runner.run() cannot be called from a running event loopr<) main_taskruncancel)r iscoroutine ValueErrorformatr_get_running_loop RuntimeErrorr)r"r! create_task threadingcurrent_thread main_threadsignal getsignalSIGINTdefault_int_handler functoolspartial _on_sigintr#r4rCancelledErrorgetattrKeyboardInterrupt)r%coror=tasksigint_handlerr@s rrz Runner.runVs%%d+AHHNO O  # # % 1IK K  ?mmGzz%%dG%<  $ $ &)*?*?*A A  /63M3MM&..t$ON & fmm^<"N ! I::006*$$V]]3~E fmmV-G-GHF+% &"&  &(( $$q("4T:'HJ!O+--   *$$V]]3~E fmmV-G-GHF+s,$F,6F=, F:9F:=AHHAI$c$|jtjur td|jtjury|j Lt j|_|jsz#Runner._on_sigint..sDr)r#donecancelr!call_soon_threadsaferS)r%signumframer?s rrPzRunner._on_sigintsT "  A %inn.>     JJ + +L 9 !!r) rrr__doc__r&r+r1r-r;rr)rPrrrrrs=6!%4%(" $(+IZ)&"rrrctj tdt||5}|j |cdddS#1swYyxYw)aExecute the coroutine and return the result. This function runs the passed coroutine, taking care of managing the asyncio event loop, finalizing asynchronous generators and closing the default executor. This function cannot be called when another asyncio event loop is running in the same thread. If debug is True, the event loop will be run in debug mode. If loop_factory is passed, it is used for new event loop creation. This function always creates a new event loop and closes it at the end. It should be used as a main entry point for asyncio programs, and should ideally only be called once. The executor is given a timeout duration of 5 minutes to shutdown. If the executor hasn't finished within that duration, a warning is emitted and the executor is closed. Example: async def main(): await asyncio.sleep(1) print('hello') asyncio.run(main()) Nz8asyncio.run() cannot be called from a running event loopr)rrDrErr)mainrrrunners rrrsK:!- FH H e, 76zz$ 8 7 7s AAcBtj|}|sy|D]}|j|jtj|ddi|D]G}|j r|j %|jd|j |dIy)Nreturn_exceptionsTz1unhandled exception during asyncio.run() shutdown)message exceptionrU)r all_tasksr`r4gather cancelledrkcall_exception_handler)r9 to_cancelrUs rr3r3s%I   ELL)LtLM >>   >>  '  ' 'N!^^-)  r)__all__rZenumrNrGrJrrrr r Enumr rrr3rrrrusW   TYY I"I"X$# Lr__pycache__/protocols.cpython-312.pyc000064400000021120152527367570013522 0ustar00 {|j-~dZdZGddZGddeZGddeZGdd eZGd d eZd Zy )zAbstract Protocol base classes.) BaseProtocolProtocolDatagramProtocolSubprocessProtocolBufferedProtocolc,eZdZdZdZdZdZdZdZy)ra Common base class for protocol interfaces. Usually user implements protocols that derived from BaseProtocol like Protocol or ProcessProtocol. The only case when BaseProtocol should be implemented directly is write-only transport like write pipe cy)zCalled when a connection is made. The argument is the transport representing the pipe connection. To receive data, wait for data_received() calls. When the connection is closed, connection_lost() is called. Nr)self transports */usr/lib64/python3.12/asyncio/protocols.pyconnection_madezBaseProtocol.connection_madecy)zCalled when the connection is lost or closed. The argument is an exception object or None (the latter meaning a regular EOF is received or the connection was aborted or closed). Nrr excs r connection_lostzBaseProtocol.connection_lostrrcy)aCalled when the transport's buffer goes over the high-water mark. Pause and resume calls are paired -- pause_writing() is called once when the buffer goes strictly over the high-water mark (even if subsequent writes increases the buffer size even more), and eventually resume_writing() is called once when the buffer size reaches the low-water mark. Note that if the buffer size equals the high-water mark, pause_writing() is not called -- it must go strictly over. Conversely, resume_writing() is called when the buffer size is equal or lower than the low-water mark. These end conditions are important to ensure that things go as expected when either mark is zero. NOTE: This is the only Protocol callback that is not called through EventLoop.call_soon() -- if it were, it would have no effect when it's most needed (when the app keeps writing without yielding until pause_writing() is called). Nrr s r pause_writingzBaseProtocol.pause_writing%rrcy)zvCalled when the transport's buffer drains below the low-water mark. See pause_writing() for details. Nrrs r resume_writingzBaseProtocol.resume_writing;rrN) __name__ __module__ __qualname____doc__ __slots__r rrrrrr rr s"I   , rrc eZdZdZdZdZdZy)ranInterface for stream protocol. The user should implement this interface. They can inherit from this class but don't need to. The implementations here do nothing (they don't raise exceptions). When the user wants to requests a transport, they pass a protocol factory to a utility function (e.g., EventLoop.create_connection()). When the connection is made successfully, connection_made() is called with a suitable transport object. Then data_received() will be called 0 or more times with data (bytes) received from the transport; finally, connection_lost() will be called exactly once with either an exception object or None as an argument. State machine of calls: start -> CM [-> DR*] [-> ER?] -> CL -> end * CM: connection_made() * DR: data_received() * ER: eof_received() * CL: connection_lost() rcy)zTCalled when some data is received. The argument is a bytes object. Nr)r datas r data_receivedzProtocol.data_received^rrcyzCalled when the other end calls write_eof() or equivalent. If this returns a false value (including None), the transport will close itself. If it returns a true value, closing the transport is up to the protocol. Nrrs r eof_receivedzProtocol.eof_receiveddrrN)rrrrrr!r$rrr rrBs2I  rrc&eZdZdZdZdZdZdZy)ra:Interface for stream protocol with manual buffer control. Event methods, such as `create_server` and `create_connection`, accept factories that return protocols that implement this interface. The idea of BufferedProtocol is that it allows to manually allocate and control the receive buffer. Event loops can then use the buffer provided by the protocol to avoid unnecessary data copies. This can result in noticeable performance improvement for protocols that receive big amounts of data. Sophisticated protocols can allocate the buffer only once at creation time. State machine of calls: start -> CM [-> GB [-> BU?]]* [-> ER?] -> CL -> end * CM: connection_made() * GB: get_buffer() * BU: buffer_updated() * ER: eof_received() * CL: connection_lost() rcy)aPCalled to allocate a new receive buffer. *sizehint* is a recommended minimal size for the returned buffer. When set to -1, the buffer size can be arbitrary. Must return an object that implements the :ref:`buffer protocol `. It is an error to return a zero-sized buffer. Nr)r sizehints r get_bufferzBufferedProtocol.get_bufferrrcy)zCalled when the buffer was updated with the received data. *nbytes* is the total number of bytes that were written to the buffer. Nr)r nbytess r buffer_updatedzBufferedProtocol.buffer_updatedrrcyr#rrs r r$zBufferedProtocol.eof_receivedrrN)rrrrrr(r+r$rrr rrms.I    rrc eZdZdZdZdZdZy)rz Interface for datagram protocol.rcy)z&Called when some datagram is received.Nr)r r addrs r datagram_receivedz"DatagramProtocol.datagram_receivedrrcy)z~Called when a send or receive operation raises an OSError. (Other than BlockingIOError or InterruptedError.) Nrrs r error_receivedzDatagramProtocol.error_receivedrrN)rrrrrr0r2rrr rrs*I5 rrc&eZdZdZdZdZdZdZy)rz,Interface for protocol for subprocess calls.rcy)zCalled when the subprocess writes data into stdout/stderr pipe. fd is int file descriptor. data is bytes object. Nr)r fdr s r pipe_data_receivedz%SubprocessProtocol.pipe_data_receivedrrcy)zCalled when a file descriptor associated with the child process is closed. fd is the int file descriptor that was closed. Nr)r r5rs r pipe_connection_lostz'SubprocessProtocol.pipe_connection_lostrrcy)z"Called when subprocess has exited.Nrrs r process_exitedz!SubprocessProtocol.process_exitedrrN)rrrrrr6r8r:rrr rrs6I  1rrct|}|rr|j|}t|}|s td||k\r||d||j|y|d||d||j|||d}t|}|rqyy)Nz%get_buffer() returned an empty buffer)lenr( RuntimeErrorr+)protor data_lenbufbuf_lens r _feed_data_to_buffered_protorBs4yH x(c(FG G h !C N   *  'NCM   )>D4yH rN)r__all__rrrrrrBrrr rDsQ%  6 6 r( |( V2 |2 j  |  11.!r__pycache__/runners.cpython-312.pyc000064400000023410152527367570013176 0ustar00 {|j>dZddlZddlZddlZddlZddlZddlmZddlmZddlm Z ddlm Z ddlm Z Gd d ejZ Gd d Zddd dZdZy))RunnerrunN) coroutines)events) exceptions)tasks) constantsceZdZdZdZdZy)_Statecreated initializedclosedN)__name__ __module__ __qualname__CREATED INITIALIZEDCLOSED(/usr/lib64/python3.12/asyncio/runners.pyr r sGK Frr cNeZdZdZddddZdZdZdZdZdd d Z d Z d Z y) ra5A context manager that controls event loop life cycle. The context manager always creates a new event loop, allows to run async functions inside it, and properly finalizes the loop at the context manager exit. If debug is True, the event loop will be run in debug mode. If loop_factory is passed, it is used for new event loop creation. asyncio.run(main(), debug=True) is a shortcut for with asyncio.Runner(debug=True) as runner: runner.run(main()) The run() method can be called multiple times within the runner's context. This can be useful for interactive console (e.g. IPython), unittest runners, console tools, -- everywhere when async code is called from existing sync framework and where the preferred single asyncio.run() call doesn't work. Ndebug loop_factoryctj|_||_||_d|_d|_d|_d|_y)NrF) r r_state_debug _loop_factory_loop_context_interrupt_count_set_event_loop)selfrrs r__init__zRunner.__init__0s:nn  )  !$rc&|j|SN) _lazy_initr%s r __enter__zRunner.__enter__9s  rc$|jyr()close)r%exc_typeexc_valexc_tbs r__exit__zRunner.__exit__=s  rcF|jtjury |j}t ||j |j |j |jtj|jrtjd|jd|_tj|_y#|jrtjdjd|_tj|_wxYw)zShutdown and close event loop.N)rr rr!_cancel_all_tasksrun_until_completeshutdown_asyncgensshutdown_default_executorr THREAD_JOIN_TIMEOUTr$rset_event_loopr-r)r%loops rr-z Runner.close@s ;;f00 0  (::D d #  # #D$;$;$= >  # #..y/L/LM O##%%d+ JJLDJ --DK ##%%d+ JJLDJ --DKs A$CAD c:|j|jS)zReturn embedded event loop.)r)r!r*s rget_loopzRunner.get_loopQs zzrcontextctj|stdj|t j t d|j| |j}|jj||}tjtjurztjtj tj"urGt%j&|j(|} tjtj |nd}d|_ |jj-||Ytjtj |ur3tjtj tj"SSS#t$rd}YwxYw#t.j0$r4|j*dkDr#t3|dd}||dk(r t5wxYw#|Ytjtj |ur3tjtj tj"wwwxYw)z/Run a coroutine inside the embedded event loop.z"a coroutine was expected, got {!r}Nz7Runner.run() cannot be called from a running event loopr<) main_taskruncancel)r iscoroutine ValueErrorformatr_get_running_loop RuntimeErrorr)r"r! create_task threadingcurrent_thread main_threadsignal getsignalSIGINTdefault_int_handler functoolspartial _on_sigintr#r4rCancelledErrorgetattrKeyboardInterrupt)r%coror=tasksigint_handlerr@s rrz Runner.runVs%%d+AHHNO O  # # % 1IK K  ?mmGzz%%dG%<  $ $ &)*?*?*A A  /63M3MM&..t$ON & fmm^<"N ! I::006*$$V]]3~E fmmV-G-GHF+% &"&  &(( $$q("4T:'HJ!O+--   *$$V]]3~E fmmV-G-GHF+s,$F,6F=, F:9F:=AHHAI$c$|jtjur td|jtjury|j Lt j|_|jsz#Runner._on_sigint..sDr)r#donecancelr!call_soon_threadsaferS)r%signumframer?s rrPzRunner._on_sigintsT "  A %inn.>     JJ + +L 9 !!r) rrr__doc__r&r+r1r-r;rr)rPrrrrrs=6!%4%(" $(+IZ)&"rrrctj tdt||5}|j |cdddS#1swYyxYw)aExecute the coroutine and return the result. This function runs the passed coroutine, taking care of managing the asyncio event loop, finalizing asynchronous generators and closing the default executor. This function cannot be called when another asyncio event loop is running in the same thread. If debug is True, the event loop will be run in debug mode. If loop_factory is passed, it is used for new event loop creation. This function always creates a new event loop and closes it at the end. It should be used as a main entry point for asyncio programs, and should ideally only be called once. The executor is given a timeout duration of 5 minutes to shutdown. If the executor hasn't finished within that duration, a warning is emitted and the executor is closed. Example: async def main(): await asyncio.sleep(1) print('hello') asyncio.run(main()) Nz8asyncio.run() cannot be called from a running event loopr)rrDrErr)mainrrrunners rrrsK:!- FH H e, 76zz$ 8 7 7s AAcBtj|}|sy|D]}|j|jtj|ddi|D]G}|j r|j %|jd|j |dIy)Nreturn_exceptionsTz1unhandled exception during asyncio.run() shutdown)message exceptionrU)r all_tasksr`r4gather cancelledrkcall_exception_handler)r9 to_cancelrUs rr3r3s%I   ELL)LtLM >>   >>  '  ' 'N!^^-)  r)__all__rZenumrNrGrJrrrr r Enumr rrr3rrrrusW   TYY I"I"X$# Lr__pycache__/base_futures.cpython-312.opt-1.pyc000064400000006020152527367570015126 0ustar00 {|jhdZddlZddlmZdZdZdZdZd Zd Z ejd Z y) N)format_helpersPENDING CANCELLEDFINISHEDcNt|jdxr|jduS)zCheck for a Future. This returns True when obj is a Future instance or is advertising itself as duck-type compatible by setting _asyncio_future_blocking. See comment in Future for more details. _asyncio_future_blockingN)hasattr __class__r )objs -/usr/lib64/python3.12/asyncio/base_futures.pyisfuturer s+ CMM#= > 5  ( ( 46c t|}|sd}d}|dk(r||dd}nc|dk(r+dj||dd||dd}n3|dkDr.dj||dd|dz ||dd}d |d S) #helper function for Future.__repr__c.tj|dS)Nr)r_format_callback_source)callbacks r format_cbz$_format_callbacks..format_cbs55hCCrrrz{}, {}z{}, <{} more>, {}zcb=[])lenformat)cbsizers r_format_callbacksrs r7D  D qy r!uQx   __Yr!uQx0)BqE!H2E F  ' ' "Q%((;(,q(1"R&)(<>"Q<rc|jjg}|jtk(r^|j|j d|jn3t j |j}|j d||jr$|j t|j|jr,|jd}|j d|dd|d|S)rz exception=zresult=rz created at r:r) _statelower _FINISHED _exceptionappendreprlibrepr_result _callbacksr_source_traceback)futureinforesultframes r_future_repr_infor0,s MM   ! "D }} !    ( KK*V%6%6$9: ;\\&..1F KK'&* +  %f&7&789 ((, k%(1U1XJ78 Krcpdjt|}d|jjd|dS)N <>)joinr0r __name__)r,r-s r _future_reprr7@s8 88%f- .D v(()4& 22r) __all__r'rr_PENDING _CANCELLEDr$rrr0recursive_reprr7rrrr<sO     6((33r__pycache__/queues.cpython-312.opt-2.pyc000064400000022200152527367570013745 0ustar00 {|j&dZddlZddlZddlmZddlmZddlmZGddeZ Gd d eZ Gd d ejZ Gd de Z Gdde Zy))Queue PriorityQueue LifoQueue QueueFull QueueEmptyN) GenericAlias)locks)mixinsceZdZ y)rN__name__ __module__ __qualname__'/usr/lib64/python3.12/asyncio/queues.pyrr sErrceZdZ y)rNr rrrrrsNrrceZdZ ddZdZdZdZdZdZdZ e e Z dZ d Zed Zd Zd Zd ZdZdZdZdZdZy)rc ||_tj|_tj|_d|_t j|_|jj|j|yNr) _maxsize collectionsdeque_getters_putters_unfinished_tasksr Event _finishedset_initselfmaxsizes r__init__zQueue.__init__!s\ $))+ #))+ !"  7rc6tj|_yN)rr_queuer"s rr!z Queue._init/s!'') rc6|jjSr')r(popleftr#s r_getz Queue._get2s{{""$$rc:|jj|yr'r(appendr#items r_putz Queue._put5 4 rct|r6|j}|js|jdy|r5yyr')r*done set_result)r#waiterswaiters r _wakeup_nextzQueue._wakeup_next:s0__&F;;=!!$' rcpdt|jdt|dd|jdS)N)typerid_formatr+s r__repr__zQueue.__repr__Bs54:&&'tBtHR=$,,.9IKKrcVdt|jd|jdS)Nr;r<r=)r>rr@r+s r__str__z Queue.__str__Es)4:&&'q(8::rcPd|j}t|ddr|dt|jz }|jr|dt |jdz }|j r|dt |j dz }|jr|d|jz }|S)Nzmaxsize=r(z _queue=z _getters[]z _putters[z tasks=)rgetattrlistr(rlenrr)r#results rr@z Queue._formatJsDMM,- 44 ( dkk!2 56 6F ==  3t}}#5"6a8 8F ==  3t}}#5"6a8 8F  ! !  6 678 8F rc. t|jSr')rHr(r+s rqsizez Queue.qsizeVs+4;;rc |jSr')rr+s rr$z Queue.maxsizeZs3}}rc |j Sr'r(r+s remptyz Queue.empty_sA;;rc^ |jdkry|j|jk\S)NrF)rrKr+s rfullz Queue.fullcs- ==A ::<4==0 0rcK |jrU|jj}|jj | |d{|jrU|j|S7&#|j  |jj |n#t$rYnwxYw|js+|js|j|jxYwwr') rQ _get_loop create_futurerr/cancelremove ValueError cancelledr9 put_nowait)r#r1putters rputz Queue.putns iik^^%335F MM  (  iik&t$$  MM((0!yy{6+;+;+=%%dmm4sZA C9A<A:A<C9)C9:A<<C6B+*C6+ B74C66B77?C66C9c |jrt|j||xjdz c_|jj |j |jy)Nr )rQrr2rrclearr9rr0s rrYzQueue.put_nowaitsU  99;O $ !#  $--(rcK |jrU|jj}|jj | |d{|jrU|jS7%#|j  |jj |n#t$rYnwxYw|js+|js|j|jxYwwr') rOrSrTrr/rUrVrWrXr9 get_nowait)r#getters rgetz Queue.gets jjl^^%335F MM  (  jjl&    MM((0!zz|F,<,<,>%%dmm4sZA C8A;A9A;C8)C89A;;C5B*)C5* B63C55B66?C55C8c |jrt|j}|j|j|Sr')rOrr,r9rr0s rr_zQueue.get_nowaits:  ::< yy{ $--( rc |jdkr td|xjdzc_|jdk(r|jjyy)Nrz!task_done() called too many timesr )rrWrr r+s r task_donezQueue.task_donesW   ! !Q &@A A !#  ! !Q & NN    'rcvK |jdkDr#|jjd{yy7wr)rrwaitr+s rjoinz Queue.joins9   ! !A %..%%' ' ' & 's .979N)r)rrrr%r!r,r2r9rArC classmethodr__class_getitem__r@rKpropertyr$rOrQr[rYrar_rdrgrrrrrs~  *%! L;$L1   1%6 )!4 !( (rrcPeZdZ dZej fdZejfdZy)rcg|_yr'rNr"s rr!zPriorityQueue._init  rc*||j|yr'rN)r#r1heappushs rr2zPriorityQueue._putsd#rc&||jSr'rN)r#heappops rr,zPriorityQueue._getst{{##rN) rrrr!heapqror2rqr,rrrrrs( #(..$!==$rrc eZdZ dZdZdZy)rcg|_yr'rNr"s rr!zLifoQueue._initrmrc:|jj|yr'r.r0s rr2zLifoQueue._putr3rc6|jjSr')r(popr+s rr,zLifoQueue._gets{{  rN)rrrr!r2r,rrrrrsO!!rr)__all__rrrtypesrr r Exceptionrr_LoopBoundMixinrrrrrrr}s^ L     B(F " "B(J $E $ ! !r__pycache__/__main__.cpython-312.pyc000064400000012521152527367570013223 0ustar00 {|j jddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl m Z GddejZGddejZedk(rej$d ej&Zej*ed eiZd D]Zeeee<eeeZdad a ddlZeZd e_ejA ejCyy#e$rY9wxYw#e"$r3t4r*t4jGst4jId aYVwxYw)N)futuresc$eZdZfdZdZxZS)AsyncIOInteractiveConsolect|||jjxjt j zc_||_tj|_ y)N) super__init__compilecompilerflagsastPyCF_ALLOW_TOP_LEVEL_AWAITloop contextvars copy_contextcontext)selflocalsr __class__s )/usr/lib64/python3.12/asyncio/__main__.pyr z"AsyncIOInteractiveConsole.__init__sH   ##s'E'EE# "//1 c8tjjfd}tj |j  j S#t$rt$r,trjdYyjYywxYw)Nc&dadatjj} |}tj|sj|y jj|jatj ty#t $rt $r}daj|Yd}~yd}~wt$r}j|Yd}~yd}~wwxYw#t$r}j|Yd}~yd}~wwxYw)NFTr) repl_futurerepl_future_interruptedtypes FunctionTyper SystemExitKeyboardInterrupt set_exception BaseExceptioninspect iscoroutine set_resultr create_taskrr _chain_future)funccoroexexccodefuturers rcallbackz3AsyncIOInteractiveConsole.runcode..callbacksK&+ #%%dDKK8D v&&t,!!$' *"ii33D$,,3O %%k6:! $ *.'$$R(  $$R( ! *$$S)) *s<BAC,C)*C C)C$$C), D5D  Drz KeyboardInterrupt ) concurrentrFuturercall_soon_threadsaferresultrr"rwrite showtraceback)rr,r.r-s`` @rruncodez!AsyncIOInteractiveConsole.runcodes|##**, *< !!(DLL!A %==? "   %& 23""$  %s A)BBB)__name__ __module__ __qualname__r r5 __classcell__)rs@rrrs 2 +%rrceZdZdZy) REPLThreadc  dtjdtjdttddd}tj |dt jd d t tjtjy#t jd d t tjtjwxYw) Nz asyncio REPL z on zy Use "await" directly instead of "asyncio.run()". Type "help", "copyright", "credits" or "license" for more information. ps1z>>> zimport asynciozexiting asyncio REPL...)bannerexitmsgignorez ^coroutine .* was never awaited$)messagecategory) sysversionplatformgetattrconsoleinteractwarningsfilterwarningsRuntimeWarningrr1stop)rr>s rrunzREPLThread.runGs 1 }D?*3v./~ ?    1  3  # #;' )  % %dii 0  # #;' )  % %dii 0s ABACN)r6r7r8rMrrr;r;Es1rr;__main__zcpython.run_stdinasyncio>__file__r6__spec__ __loader__ __package__ __builtins__FT)%r rPr,concurrent.futuresr/rr#rC threadingrrIrInteractiveConsolerThreadr;r6auditnew_event_looprset_event_loop repl_localskeyrrGrrreadline ImportError repl_threaddaemonstart run_foreverr donecancelrNrrrhsP    3% 7 73%l1!!10 z CII!" !7 ! ! #DG4 g&K,"8C= C, ( T:GK# ,KK       G&    ! ;#3#3#5""$*.'   s$9C/C:/C76C7:5D21D2__pycache__/coroutines.cpython-312.opt-1.pyc000064400000007216152527367570014641 0ustar00 {|j dZddlZddlZddlZddlZddlZdZeZ dZ ejejjfZeZdZdZy))iscoroutinefunction iscoroutineNctjjxsEtjj xr(t t j jdS)NPYTHONASYNCIODEBUG)sysflagsdev_modeignore_environmentboolosenvironget+/usr/lib64/python3.12/asyncio/coroutines.py_is_debug_moder sF 99   Ncii&B&B"B#M"&rzz~~6J'K"LNrcVtj|xst|ddtuS)z6Return True if func is a decorated coroutine function. _is_coroutineN)inspectrgetattrr)funcs rrrs-  ' ' - B D/4 0M ACrct|tvryt|tr1t tdkrtj t|yy)z)Return True if obj is a coroutine object.TdF)type_iscoroutine_typecache isinstance_COROUTINE_TYPESlenadd)objs rrr sE Cy**#'( % & , " & &tCy 1rcd}d}d}t|dr|jr |j}n$t|dr|jr |j}||}|s||r|dS|Sd}t|dr|jr |j}n$t|dr|jr |j}|j xsd}d }||j }|d |d |}|S|j}|d |d |}|S) Nct|dr|jr |j}n>t|dr|jr |j}ndt|jd}|dS)N __qualname____name__z())hasattrr#r$r)coro coro_names rget_namez#_format_coroutine..get_name3sc 4 (T->->))I T: &4== IDJ//00BCIBrct |jS#t$r  |jcYS#t$rYYywxYwwxYw)NF) cr_runningAttributeError gi_running)r's r is_runningz%_format_coroutine..is_runningAsA ?? "  &!   s  7 &7 3737cr_codegi_codez runninggi_framecr_framezrz running at :z done, defined at )r&r/r0r1r2 co_filenamef_linenoco_firstlineno) r'r)r. coro_coder( coro_framefilenamelineno coro_reprs r_format_coroutiner<0s  ItYDLLLL y !dllLL I  d [) ) JtZ T]]]] z "t}}]] $$=(=H F$$ khZqA )) k!3H:QvhG r)__all__collections.abc collectionsrr rtypesrobjectrr CoroutineTypeabc Coroutinersetrrr<rrrrFs] . N C'')B)BC  =r__pycache__/mixins.cpython-312.opt-1.pyc000064400000002006152527367570013746 0ustar00 {|jRdZddlZddlmZejZGddZy)zEvent loop mixins.N)eventsceZdZdZdZy)_LoopBoundMixinNctj}|j"t5|j||_ddd||jurt |d|S#1swY'xYw)Nz# is bound to a different event loop)r_get_running_loop_loop _global_lock RuntimeError)selfloops '/usr/lib64/python3.12/asyncio/mixins.py _get_loopz_LoopBoundMixin._get_loop sa'') :: ::%!%DJ tzz !$)LMN N s A!!A*)__name__ __module__ __qualname__r rrrr s E rr)__doc__ threadingrLockr rrrrrs&y~~   r__pycache__/proactor_events.cpython-312.opt-1.pyc000064400000126012152527367570015660 0ustar00 {|j܂dZdZddlZddlZddlZddlZddlZddlZddlZddl m Z ddl m Z ddl m Z ddl m Z dd l mZdd l mZdd l mZdd l mZdd lmZdZGddej*ej,ZGddeej0ZGddeej4ZGddeZGddeej:ZGddeeej>Z Gddeeej>Z!Gdde jDZ#y)zEvent loop using a proactor and related classes. A proactor is a "notify-on-completion" multiplexer. Currently a proactor is only implemented on Windows with IOCP. )BaseProactorEventLoopN) base_events) constants)futures) exceptions) protocols)sslproto) transports)trsock)loggerctj||jd< |j|jd<d|jvr |j|jd<yy#tj $r5|j jrtjd|dYuwxYw#tj $rd|jd<YywxYw)Nsocketsocknamezgetsockname() failed on %rTexc_infopeername) r TransportSocket_extra getsocknamererror_loop get_debugr warning getpeername) transportsocks 0/usr/lib64/python3.12/asyncio/proactor_events.py_set_socket_extrars!'!7!7!=IXC'+'7'7'9 $ ))) 0+/+;+;+=I  Z (* <<C ?? $ $ & NN,dT CC|| 0+/I  Z ( 0s$A/B:/AB76B7:"CCceZdZdZ dfd ZdZdZdZdZdZ dZ e jfd Z dd Zd Zd Zd ZxZS)_ProactorBasePipeTransportz*Base class for pipe and socket transports.ct||||j|||_|j |||_d|_d|_d|_d|_ d|_ d|_ d|_ d|_ |j |j j|jj!|j"j$||,|jj!t&j(|dyy)NrF)super__init__ _set_extra_sock set_protocol_server_buffer _read_fut _write_fut_pending_write _conn_lost_closing_called_connection_lost _eof_written_attachr call_soon _protocolconnection_mader_set_result_unless_cancelledselflooprprotocolwaiterextraserver __class__s rr$z#_ProactorBasePipeTransport.__init__2s %   (#   ',$! << # LL " T^^;;TB   JJ !E!E!' / c|jjg}|j|jdn|jr|jd|j,|jd|jj |j |jd|j |j|jd|j|jr'|jdt|j|jr|jddjd j|S) Nclosedclosingzfd=zread=zwrite=zwrite_bufsize=z EOF writtenz<{}> ) r=__name__r&appendr.filenor*r+r)lenr0formatjoin)r7infos r__repr__z#_ProactorBasePipeTransport.__repr__Is''( ::  KK ! ]] KK " :: ! KK#djj//123 4 >> % KK%12 3 ?? & KK& 34 5 << KK.T\\):(;< =    KK &}}SXXd^,,r>c"||jd<y)Npipe)rr7rs rr%z%_ProactorBasePipeTransport._set_extra[s" Fr>c||_yNr3)r7r9s rr'z'_ProactorBasePipeTransport.set_protocol^s !r>c|jSrOrPr7s r get_protocolz'_ProactorBasePipeTransport.get_protocolas ~~r>c|jSrO)r.rRs r is_closingz%_ProactorBasePipeTransport.is_closingds }}r>c.|jryd|_|xjdz c_|js2|j&|jj |j d|j"|jjd|_yy)NTr) r.r-r)r+rr2_call_connection_lostr*cancelrRs rclosez _ProactorBasePipeTransport.closegsq ==   1|| 7 JJ !;!;T B >> % NN ! ! #!DN &r>cv|j-|d|t||jjyy)Nzunclosed transport )source)r&ResourceWarningrY)r7_warns r__del__z"_ProactorBasePipeTransport.__del__rs5 :: ! 'x0/$ O JJ    "r>c0 t|tr4|jjrDt j d||dn*|jj ||||jd|j|y#|j|wxYw)Nz%r: %sTr)message exceptionrr9) isinstanceOSErrorrrr debugcall_exception_handlerr3 _force_close)r7excr`s r _fatal_errorz'_ProactorBasePipeTransport._fatal_errorwsy ##w'::'')LL44H 11&!$!% $ 3   c "D  c "s A.BBcH|jS|jjs9||jjdn|jj||jr |j ryd|_|xj dz c_|jr!|jjd|_|jr!|jjd|_ d|_ d|_ |jj|j|y)NTrr) _empty_waiterdone set_result set_exceptionr.r/r-r+rXr*r,r)rr2rW)r7rgs rrfz'_ProactorBasePipeTransport._force_closes    )$2D2D2I2I2K{""--d3""005 ==T99   1 ?? OO " " $"DO >> NN ! ! #!DN  T77=r>c|jry |jj|t|jdrF|jj dk7r)|jj tj|jjd|_|j}||jd|_ d|_y#t|jdrF|jj dk7r)|jj tj|jjd|_|j}||jd|_ d|_wxYw)NshutdownT) r/r3connection_losthasattrr&rEror SHUT_RDWRrYr(_detach)r7rgr<s rrWz0_ProactorBasePipeTransport._call_connection_losts  ' '  0 NN * *3 / tzz:.4::3D3D3F"3L ##F$4$45 JJ   DJ\\F! # +/D (tzz:.4::3D3D3F"3L ##F$4$45 JJ   DJ\\F! # +/D (s CB+E?cf|j}|j|t|jz }|SrO)r,r)rF)r7sizes rget_write_buffer_sizez0_ProactorBasePipeTransport.get_write_buffer_sizes/"" << # C % %D r>NNN)zFatal error on pipe transport)rC __module__ __qualname____doc__r$rJr%r'rSrUrYwarningswarnr^rhrfrWrw __classcell__r=s@rr!r!.sQ448$(/.-$#" "%MM #>(0(r>r!cNeZdZdZ d fd ZdZdZdZdZdZ d dZ xZ S) _ProactorReadPipeTransportzTransport for read pipes.cd|_d|_t| ||||||t ||_|j j|jd|_y)NrpTF) _pending_data_length_pausedr#r$ bytearray_datarr2 _loop_reading) r7r8rr9r:r;r< buffer_sizer=s rr$z#_ProactorReadPipeTransport.__init__sT$&!  tXvufE{+  T//0 r>c:|j xr |j SrO)rr.rRs r is_readingz%_ProactorReadPipeTransport.is_readings<<5 $55r>c|js |jryd|_|jjrt j d|yy)NTz%r pauses reading)r.rrrr rdrRs r pause_readingz(_ProactorReadPipeTransport.pause_readings? ==DLL   ::   ! LL,d 3 "r>c|js |jsyd|_|j&|jj |j d|j }d|_|dkDr4|jj |j|jd|||jjrtjd|yy)NFrpz%r resumes reading) r.rr*rr2rr_data_receivedrrr rd)r7lengths rresume_readingz)_ProactorReadPipeTransport.resume_readings ==  >> ! JJ !3!3T :**$&! B; JJ !4!4djj&6I6 R ::   ! LL-t 4 "r>c.|jjrtjd| |jj }|s|jyy#t tf$rt$r}|j|dYd}~yd}~wwxYw)Nz%r received EOFz1Fatal error: protocol.eof_received() call failed.) rrr rdr3 eof_received SystemExitKeyboardInterrupt BaseExceptionrhrY)r7 keep_openrgs r _eof_receivedz(_ProactorReadPipeTransport._eof_receiveds ::   ! LL*D 1 335I JJL-.      H J  sA B8BBc|jr||_y|dk(r|jyt|jt j r" t j|j|y|jj|y#ttf$rt$r}|j|dYd}~yd}~wwxYw)Nrz3Fatal error: protocol.buffer_updated() call failed.) rrrrbr3r BufferedProtocol_feed_data_to_buffered_protorrrrh data_received)r7datarrgs rrz)_ProactorReadPipeTransport._data_receiveds <<)/D %  Q;     dnni&@&@ A 66t~~tL NN ( ( . 12   !!##12  s B C%B<<CcJd}d} |xd|_|jrQ|j}|dk(r |dkDr|j||yyt t |j d|}n|j|jr |dkDr|j||yy|js?|jjj|j|j |_|js&|jj|j |dkDr|j||yy#t $rZ}|js|j#|dn1|jj%rt'j(ddYd}~wd}~wt*$r}|j-|Yd}~d}~wt.$r}|j#|dYd}~d}~wt0j2$r|jsYwxYw#|dkDr|j||wwxYw)Nrprz"Fatal read error on pipe transportz*Read error on pipe transport while closingTr)r*rkresultrbytes memoryviewrrXr.rr _proactor recv_intor&add_done_callbackrConnectionAbortedErrorrhrr rdConnectionResetErrorrfrcrCancelledError)r7futrrrgs rrz(_ProactorReadPipeTransport._loop_readings. 2"&88: ZZ\F{F{##D&1A!DJJ!7!@ADJJL}}2{##D&1)<D<&A D<12H< HAFH H&F<7H< HGH#HHHHH")NNNirO) rCryrzr{r$rrrrrrr~rs@rrrs/#486;64&5$ /212r>rcReZdZdZdZfdZdZd dZdZdZ dZ d Z d Z xZ S) _ProactorBaseWritePipeTransportzTransport for write pipes.Tc2t||i|d|_yrO)r#r$rjr7argskwr=s rr$z(_ProactorBaseWritePipeTransport.__init__Ns $%"%!r>ct|tttfs!t dt |j |jr td|j td|sy|jrH|jtjk\rtjd|xjdz c_ y|j|j!t|y|j"s!t||_|j%y|j"j'||j%y)Nz/data argument must be a bytes-like object, not zwrite_eof() already calledz(unable to write; sendfile is in progresszsocket.send() raised exception.r)r)rbrrr TypeErrortyperCr0 RuntimeErrorrjr-r!LOG_THRESHOLD_FOR_CONNLOST_WRITESr rr+ _loop_writingr)_maybe_pause_protocolextend)r7rs rwritez%_ProactorBaseWritePipeTransport.writeRs$ : >?Dz**+-. .   ;< <    )IJ J  ??)"M"MM@A OOq O  ?? "   E$K  0$T?DL  & & ( LL   %  & & (r>c  ||j |jryd|_d|_|r|j||j}d|_|sx|jr&|j j |jd|jr)|jjtj|jn|j jj|j||_|jj!sFt#||_|jj%|j&|j)n%|jj%|j&|j*)|j|j*j-dyyy#t.$r}|j1|Yd}~yd}~wt2$r}|j5|dYd}~yd}~wwxYw)Nrz#Fatal write error on pipe transport)r+r.r,rr)rr2rWr0r&rorSHUT_WR_maybe_resume_protocolrsendrkrFrrrrjrlrrfrcrh)r7frrgs rrz-_ProactorBaseWritePipeTransport._loop_writingxs& J}!8T]]"DO"#D  |||# ==JJ(()C)CTJ$$JJ''7 ++-"&**"6"6";";DJJ"M++-*-d)D'OO55d6H6HI..0OO55d6H6HI!!-$//2I""--d33J-# #   c " " J   c#H I I Js)F<FF<< HG H'G>>HcyNTrRs r can_write_eofz-_ProactorBaseWritePipeTransport.can_write_eofr>c$|jyrO)rYrRs r write_eofz)_ProactorBaseWritePipeTransport.write_eofs  r>c&|jdyrOrfrRs rabortz%_ProactorBaseWritePipeTransport.abort $r>c|j td|jj|_|j|jj d|jS)NzEmpty waiter is already set)rjrr create_futurer+rlrRs r_make_empty_waiterz2_ProactorBaseWritePipeTransport._make_empty_waitersY    )<= =!ZZ557 ?? "    ) )$ /!!!r>cd|_yrO)rjrRs r_reset_empty_waiterz3_ProactorBaseWritePipeTransport._reset_empty_waiters !r>NN)rCryrzr{_start_tls_compatibler$rrrrrrrr~rs@rrrHs7$ "$)L'JR ""r>rc$eZdZfdZdZxZS)_ProactorWritePipeTransportct||i||jjj |j d|_|j j|jy)N) r#r$rrrecvr&r*r _pipe_closedrs rr$z$_ProactorWritePipeTransport.__init__sO $%"%--224::rB (():):;r>c|jry|jryd|_|j|j t y|j yrO) cancelledr.r*r+rfBrokenPipeErrorrY)r7rs rrz(_ProactorWritePipeTransport._pipe_closedsC ==?  ==  ?? &   o/ 0 JJLr>)rCryrzr$rr~rs@rrrs < r>rcReZdZdZ d fd ZdZdZdZd dZd dZ d dZ xZ S) _ProactorDatagramTransportic||_d|_d|_t||||||t j |_|jj|jy)Nr)r:r;) _addressrj _buffer_sizer#r$ collectionsdequer)rr2r)r7r8rr9addressr:r;r=s rr$z#_ProactorDatagramTransport.__init__s^ ! tXfEJ#((*  T//0r>ct||yrOrrMs rr%z%_ProactorDatagramTransport._set_extra $%r>c|jSrO)rrRs rrwz0_ProactorDatagramTransport.get_write_buffer_sizes   r>c&|jdyrOrrRs rrz _ProactorDatagramTransport.abortrr>crt|tttfst dt ||sy|j (|d|j fvrtd|j |jrT|j rH|jtjk\rtjd|xjdz c_y|jjt||f|xjt!|z c_|j"|j%|j'y)Nz,data argument must be bytes-like object (%r)z!Invalid address: must be None or z!socket.sendto() raised exception.r)rbrrrrrr ValueErrorr-rrr rr)rDrrFr+rr)r7raddrs rsendtoz!_ProactorDatagramTransport.sendtos$ : >?J J( (  == $dDMM5J)J3DMM?CE E ??t}})"M"MMBC OOq O  U4[$/0 SY& ?? "     ""$r>cz |jryd|_|r|j|jr|jr?|jr3|j r&|j j|jdy|jj\}}|xjt|zc_ |j6|j jj|j||_n7|j jj|j|||_|jj!|j"|j%y#t&$r%}|j(j+|Yd}~yd}~wt,$r}|j/|dYd}~yd}~wwxYw)N)rz'Fatal write error on datagram transport)r-r+rr)rr.rr2rWpopleftrrFrrr&rrrrrcr3error_received Exceptionrh)r7rrrrgs rrz(_ProactorDatagramTransport._loop_writingsT *#DO <!>tzz?C}}"N~~)001C1CD00t< / NN ) )# . .(( ==! 00t<sM F#'F#9,F#B F#2G5# G2,G G5 #G2/G51G22G55!HrxrO) rCryrzrr$r%rwrrrrr~rs@rrrs2H59$( 1&! %: *D)=r>rceZdZdZdZdZy)_ProactorDuplexPipeTransportzTransport for duplex pipes.cy)NFrrRs rrz*_ProactorDuplexPipeTransport.can_write_eofUsr>ctrO)NotImplementedErrorrRs rrz&_ProactorDuplexPipeTransport.write_eofXs!!r>N)rCryrzr{rrrr>rrrPs&"r>rcfeZdZdZej j Z dfd ZdZ dZ dZ xZ S)_ProactorSocketTransportz Transport for connected sockets.cXt|||||||tj|yrO)r#r$r _set_nodelayr6s rr$z!_ProactorSocketTransport.__init__cs( tXvufE  &r>ct||yrOrrMs rr%z#_ProactorSocketTransport._set_extrahrr>cyrrrRs rrz&_ProactorSocketTransport.can_write_eofkrr>c|js |jryd|_|j*|jj t j yyr)r.r0r+r&rorrrRs rrz"_ProactorSocketTransport.write_eofnsA ==D--   ?? " JJ   / #r>rx) rCryrzr{r _SendfileMode TRY_NATIVE_sendfile_compatibler$r%rrr~rs@rrr\s4+$22==48$(' &0r>rceZdZfdZ ddZ dddddddddZ ddZ d dZ d d Z d d Z fd Z d Z d Z dZ d!dZdZdZdZdZdZdZdZdZddZdZ d"dZdZdZdZxZS)#rct|tjd|jj ||_||_d|_i|_ |j||jtjtjur.tj |j"j%yy)NzUsing proactor: %s)r#r$r rdr=rCr _selector_self_reading_future_accept_futuresset_loop_make_self_pipe threadingcurrent_thread main_threadsignal set_wakeup_fd_csockrE)r7proactorr=s rr$zBaseProactorEventLoop.__init__xs  )8+=+=+F+FG!!$(!!$   # # %)>)>)@ @  !3!3!5 6 Ar>Nc"t||||||SrO)r)r7rr9r:r;r<s r_make_socket_transportz,BaseProactorEventLoop._make_socket_transports'dHf(-v7 7r>F) server_sideserver_hostnamer;r<ssl_handshake_timeoutssl_shutdown_timeoutc ttj||||||| | } t||| ||| jS)N)rrr;r<)r SSLProtocolr_app_transport) r7rawsockr9 sslcontextr:rrr;r<rr ssl_protocols r_make_ssl_transportz)BaseProactorEventLoop._make_ssl_transportsI  ++h F_&;%9 ; !w ',V =***r>c"t||||||SrO)r)r7rr9rr:r;s r_make_datagram_transportz.BaseProactorEventLoop._make_datagram_transports)$h*0%9 9r>c t|||||SrO)rr7rr9r:r;s r_make_duplex_pipe_transportz1BaseProactorEventLoop._make_duplex_pipe_transports+D,0(FEK Kr>c t|||||SrO)rrs r_make_read_pipe_transportz/BaseProactorEventLoop._make_read_pipe_transports)$hNNr>c t|||||SrO)rrs r_make_write_pipe_transportz0BaseProactorEventLoop._make_write_pipe_transports+4+/65J Jr>c|jr td|jrytjtj urt jd|j|j|jjd|_ d|_ t|-y)Nz!Cannot close a running event looprp) is_runningr is_closedrrr r r _stop_accept_futures_close_self_piperrYrr#)r7r=s rrYzBaseProactorEventLoop.closes ?? BC C >>    # # %)>)>)@ @   $ !!#    r>cVK|jj||d{S7wrO)rr)r7rns r sock_recvzBaseProactorEventLoop.sock_recvs#^^((q1111 )')cVK|jj||d{S7wrO)rr)r7rbufs rsock_recv_intoz$BaseProactorEventLoop.sock_recv_intos#^^--dC8888r-cVK|jj||d{S7wrO)rr)r7rbufsizes r sock_recvfromz#BaseProactorEventLoop.sock_recvfroms#^^,,T7;;;;r-crK|s t|}|jj|||d{S7wrO)rFr recvfrom_into)r7rr/nbytess rsock_recvfrom_intoz(BaseProactorEventLoop.sock_recvfrom_intos1XF^^11$VDDDDs .757cVK|jj||d{S7wrO)rr)r7rrs r sock_sendallz"BaseProactorEventLoop.sock_sendalls#^^((t4444r-cZK|jj||d|d{S7w)Nr)rr)r7rrrs r sock_sendtoz!BaseProactorEventLoop.sock_sendtos'^^**4q'BBBBs "+)+cK|jr|jdk7r td|jj ||d{S7w)Nrzthe socket must be non-blocking)_debug gettimeoutrrconnect)r7rrs r sock_connectz"BaseProactorEventLoop.sock_connectsD ;;4??,1>? ?^^++D'::::sA A A AcTK|jj|d{S7wrO)racceptrMs r sock_acceptz!BaseProactorEventLoop.sock_accepts!^^**40000s (&(cK |j} t j|j}|r|n|}|syt|d}|rt||z|n|} t||}d} t| |z |}|dkr| | dkDr|j|SS|jj||||d{||z }| |z } ^#ttjf$r}t j dd}~wwxYw#t$rt j dwxYw7g#| dkDr|j|wwxYww)Nznot a regular filerl)rEAttributeErrorioUnsupportedOperationrSendfileNotAvailableErrorosfstatst_sizercminseekrsendfile) r7rfileoffsetcountrEerrfsize blocksizeend_pos total_sents r_sock_sendfile_nativez+BaseProactorEventLoop._sock_sendfile_natives_ M[[]F MHHV$,,E#E  ;/ 05#fune,5VU#  "& 0)< >% A~ &! nn--dD&)LLL)#i'  7 78 M667KL L M M667KL L MMA~ &!shEC D6E+D$E!D$:D";D$ C=#C88C==EDE"D$$D==EcjK|j}|j|jd{ |j|j|||dd{|j |r|j SS7P7)#|j |r|j wwxYww)NF)fallback)rrr sock_sendfiler&rr)r7transprOrPrQrs r_sendfile_nativez&BaseProactorEventLoop._sendfile_natives**,''))) (++FLL$5:,<<  & & (%%' *<  & & (%%'s84B3BB3#B B  B #%B3 B %B00B3c |j!|jjd|_|jjd|_|jjd|_|xj dzc_y)Nr)rrX_ssockrYr  _internal_fdsrRs rr)z&BaseProactorEventLoop._close_self_pipesg  $ $ 0  % % , , .(,D %     ar>ctj\|_|_|jj d|jj d|xj dz c_y)NFr)r socketpairr^r  setblockingr_rRs rrz%BaseProactorEventLoop._make_self_pipesN#)#4#4#6  T[ & & ar>ct ||j|j|ury|jj|jd}||_|j |j y#tj$rYyttf$rt$r}|jd||dYd}~yd}~wwxYw)Niz.Error on reading from the event loop self pipe)r`rar8) rrrrr^r_loop_self_readingrrrrrre)r7rrgs rrdz(BaseProactorEventLoop._loop_self_readings 9} ((1##DKK6A)*D %   7 7 8((  -.     ' 'K )   s" A,&A,,B7B7B22B7c|j}|y |jdy#t$r(|jrt j ddYyYywxYw)Nz3Fail to write a null byte into the self-pipe socketTr)r rrcr=r rd)r7csocks r_write_to_selfz$BaseProactorEventLoop._write_to_self4sU   =  , JJu  ,{{ 0&*, ,s#,AAc Pdfd jy)Nc  |s|j\}}jrtjd||} j || dd|i nj ||d|ij ryjj }|j j<|jy#t$r} jdk7r9jd|tj d j!n.jrtjd d Yd}~yYd}~yYd}~yd}~wt"j$$r j!YywxYw) Nz#%r got a new connection from %r: %rTr)rr;r<rrrrpzAccept failed on a socket)r`rarzAccept failed on socket %rr)rr=r rdrrr'rrBrrErrcrer rrYrr) rconnrr9rgr8protocol_factoryr7r<rrrrs rr8z2BaseProactorEventLoop._start_serving..loopKsw# *=!"JD${{ %J%+T49/1H!-00 (JD#-t"4V2G1E 1G 33 (#-t"4V4E>>#NN))$/78$$T[[]3##D) 6;;=B&//#>%("("8"8">1 JJL[[LL!=!%66!!,,   s%BC C FA0E&FFrO)r2) r7rlrrr<backlogrrr8s ````` ``@r_start_servingz$BaseProactorEventLoop._start_servingFs $ *$ *L tr>cyrOr)r7 event_lists r_process_eventsz%BaseProactorEventLoop._process_eventsss r>c|jjD]}|j|jjyrO)rvaluesrXclear)r7futures rr(z*BaseProactorEventLoop._stop_accept_futuresws6**113F MMO4 ""$r>c|jj|jd}|r|j|jj ||j yrO)rpoprErXr _stop_servingrY)r7rrus rrxz#BaseProactorEventLoop._stop_serving|sG%%))$++->  MMO $$T* r>rxrOr)r)NNdNN)rCryrzr$rrrr r"r$rYr,r0r3r7r9r;r@rCrWr\r)rrdrhrnrqr(rxr~rs@rrrvs 7=A267 9= + $t"&!% + CG9 BF*.K @D(,OAE)-J (29<E 5C; 1": (  98,&>A-1,0+Z % r>r)$r{__all__rFrIrr|r rrrrrrr r r r logr r_FlowControlMixin BaseTransportr! ReadTransportrWriteTransportrrDatagramTransportr Transportrr BaseEventLooprrr>rrs #  0$D!=!=!+!9!9DNP2!;!+!9!9P2fk"&@&0&?&?k"\"A,A=!;!+!=!=A=H "#=#B#-#7#7 "09>)3304KK55Kr>__pycache__/selector_events.cpython-312.pyc000064400000173530152527367570014717 0ustar00 {|j̼dZdZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl mZddl mZddl mZddl mZdd l mZdd l mZdd l mZdd l mZdd lmZeejdZer ej4dZdZGddej<ZGddej@ejBZ"Gdde"Z#Gdde"ejHZ%y#e $rdZ YwxYw#e$rdZYpwxYw)zEvent loop using a selector and related classes. A selector is a "notify-when-ready" multiplexer. For a subclass which also includes support for signal handling, see the unix_events sub-module. )BaseSelectorEventLoopN) base_events) constants)events)futures) protocols)sslproto) transports)trsock)loggersendmsg SC_IOV_MAXFct |j|}t|j|zS#t$rYywxYwNF)get_keyboolrKeyError)selectorfdeventkeys 0/usr/lib64/python3.12/asyncio/selector_events.py_test_selector_eventr*sA(r"CJJ&'' s + 77ceZdZdZd3fd Zd3ddddZ d3ddddejejddZ d4d Z fd Z d Z d Z d ZdZdZdddejejfdZdddejejfdZddejejfdZdZdZdZdZdZdZdZdZdZdZd3dZdZd Z d!Z!d"Z"d#Z#d5d$Z$d%Z%d&Z&d'Z'd(Z(d)Z)d*Z*d+Z+d3d,Z,d-Z-d.Z.d/Z/d0Z0d1Z1d2Z2xZ3S)6rzJSelector event loop. See events.EventLoop for API specification. Nct||tj}t j d|j j||_|jtj|_ y)NzUsing selector: %s) super__init__ selectorsDefaultSelectorr debug __class____name__ _selector_make_self_pipeweakrefWeakValueDictionary _transports)selfrr"s rrzBaseSelectorEventLoop.__init__;sa    002H )8+=+=+F+FG! "668extraservercD|j|t||||||SN)_ensure_fd_no_transport_SelectorSocketTransport)r)sockprotocolwaiterr,r-s r_make_socket_transportz,BaseSelectorEventLoop._make_socket_transportEs* $$T*'dHf(-v7 7r*F) server_sideserver_hostnamer,r-ssl_handshake_timeoutssl_shutdown_timeoutc |j|tj||||||| | } t||| ||| jS)N)r8r9r+)r0r SSLProtocolr1_app_transport) r)rawsockr3 sslcontextr4r6r7r,r-r8r9 ssl_protocols r_make_ssl_transportz)BaseSelectorEventLoop._make_ssl_transportKsW $$W-++ (J "7!5  !w ',V =***r*cD|j|t||||||Sr/)r0_SelectorDatagramTransport)r)r2r3addressr4r,s r_make_datagram_transportz.BaseSelectorEventLoop._make_datagram_transport]s, $$T*)$h*165B Br*c|jr td|jry|jt||j "|j j d|_yy)Nz!Cannot close a running event loop) is_running RuntimeError is_closed_close_self_pipercloser$r)r"s rrJzBaseSelectorEventLoop.closecsa ?? BC C >>      >> % NN "!DN &r*c|j|jj|jjd|_|jjd|_|xj dzc_y)Nr)_remove_reader_ssockfilenorJ_csock _internal_fdsr)s rrIz&BaseSelectorEventLoop._close_self_pipens\ DKK..01     ar*cDtj\|_|_|jj d|jj d|xj dz c_|j |jj|jy)NFr) socket socketpairrNrP setblockingrQ _add_readerrO_read_from_selfrRs rr%z%BaseSelectorEventLoop._make_self_pipevsq#)#4#4#6  T[ & & a ++-t/C/CDr*cyr/r)datas r_process_self_dataz(BaseSelectorEventLoop._process_self_data~s r*c |jjd}|sy|j|1#t$rY=t$rYywxYw)Ni)rNrecvr]InterruptedErrorBlockingIOErrorr[s rrXz%BaseSelectorEventLoop._read_from_selfsV {{''-''-  $ "  s33 A A A c|j}|y |jdy#t$r(|jrt j ddYyYywxYw)Nz3Fail to write a null byte into the self-pipe socketTexc_info)rPsendOSError_debugr r!)r)csocks r_write_to_selfz$BaseSelectorEventLoop._write_to_selfsU   =  , JJu  ,{{ 0&*, ,s#,AAdc f|j|j|j||||||| yr/)rWrO_accept_connection)r)protocol_factoryr2r>r-backlogr8r9s r_start_servingz$BaseSelectorEventLoop._start_servings4 (?(?)4VW.0D Fr*c t|D]w} |j\} } |jrtjd|| | | j dd| i} |j || | ||||} |j| yy#tttf$rYyt$r} | jtjtjtjtj fvry|j#d| t%j&|d|j)|j+|j-t.j0|j2||||||| nYd} ~ dd} ~ wwxYw)Nz#%r got a new connection from %r: %rFpeernamez&socket.accept() out of system resource)message exceptionrT)rangeacceptrhr r!rV_accept_connection2 create_taskrar`ConnectionAbortedErrorrgerrnoEMFILEENFILEENOBUFSENOMEMcall_exception_handlerr TransportSocketrMrO call_laterrACCEPT_RETRY_DELAYrp)r)rnr2r>r-ror8r9_connaddrr,rvexcs rrmz(BaseSelectorEventLoop._accept_connectionsXwA" )![[] d;;LL!F!'t5  '2$T*11$dE:v)+?A  (G $%57MN  99u||!& !>> //#K%("("8"8">1 '' 6OOI$@$@$($7$7$4dJ$+-B$8 :  : sABE5E5&CE00E5c Kd}d} |}|j} |r|j|||| d|||| } n|j||| ||} | d{y7#t$r| j d} wxYw#t t f$rt$r?} |jr)d| d} ||| d<| | | d<|j| Yd} ~ yYd} ~ yd} ~ wwxYww)NT)r4r6r,r-r8r9)r4r,r-z3Error on transport creation for incoming connection)rsrtr3 transport) create_futurer@r5 BaseExceptionrJ SystemExitKeyboardInterruptrhr) r)rnrr,r>r-r8r9r3rr4rcontexts rrwz)BaseSelectorEventLoop._accept_connection2s  & 5')H'')F 44(Jv $E&*?)= 5? !77(6!8#     !  -.   5{{N!$ '*2GJ'(+4GK(++G44 5sSCA BA AA CA A==BC0C CCCc*|}t|ts t|j} |j |}|jstd|d|y#ttt f$rt d|dwxYw#t$rYywxYw)NzInvalid file object: zFile descriptor z is used by transport ) isinstanceintrOAttributeError TypeError ValueErrorr( is_closingrGr)r)rrOrs rr0z-BaseSelectorEventLoop._ensure_fd_no_transports&#& KV]]_- &((0I'')"&rf,B m%&&*#Iz: K #8!?@dJ K    sAB$B BBc|jtj|||d} |jj |}|j|j c}\}}|jj ||tjz||f||j|S#t$r1|jj|tj|dfY|SwxYwr/) _check_closedrHandler$rr\modifyr EVENT_READcancelrregister r)rcallbackargshandlermaskreaderwriters rrWz!BaseSelectorEventLoop._add_readers xtT: ..((,C &)ZZ "D"66 NN ! !"dY-A-A&A#)6"2 4!   4 NN # #B (<(<%+TN 4  4B%%6CCc||jry |jj|}|j|jc}\}}|t j z}|s|jj|n|jj||d|f||jyy#t$rYywxYw)NFT) rHr$rrr\rr unregisterrrrr)rrrrrs rrMz$BaseSelectorEventLoop._remove_reader&s >>  ..((,C&)ZZ "D"66 Y))) )D))"-%%b$v?!   B// B;:B;c|jtj|||d} |jj |}|j|j c}\}}|jj ||tjz||f||j|S#t$r1|jj|tjd|fY|SwxYwr/) rrrr$rr\rr EVENT_WRITErrrrs r _add_writerz!BaseSelectorEventLoop._add_writer;s xtT: ..((,C &)ZZ "D"66 NN ! !"dY-B-B&B#)6"2 4!   4 NN # #B (=(=%)6N 4  4rc||jry |jj|}|j|jc}\}}|t j z}|s|jj|n|jj|||df||jyy#t$rYywxYw)Remove a writer callback.FNT) rHr$rrr\rrrrrrrs r_remove_writerz$BaseSelectorEventLoop._remove_writerKs >>  ..((,C&)ZZ "D"66 Y*** *D))"-%%b$?!   rcN|j||j||g|y)zAdd a reader callback.N)r0rWr)rrrs r add_readerz BaseSelectorEventLoop.add_readerb' $$R(X--r*cF|j||j|S)zRemove a reader callback.)r0rMr)rs r remove_readerz#BaseSelectorEventLoop.remove_readerg! $$R(""2&&r*cN|j||j||g|y)zAdd a writer callback..N)r0rrs r add_writerz BaseSelectorEventLoop.add_writerlrr*cF|j||j|S)r)r0rrs r remove_writerz#BaseSelectorEventLoop.remove_writerqrr*cKtj||jr|jdk7r t d |j |S#t tf$rYnwxYw|j}|j}|j||j||j|||}|jtj|j |||d{7Sw)zReceive data from the socket. The return value is a bytes object representing the data received. The maximum amount of data to be received at once is specified by nbytes. rthe socket must be non-blockingrN)r_check_ssl_socketrh gettimeoutrr_rar`rrOr0rW _sock_recvadd_done_callback functoolspartial_sock_read_done)r)r2nfutrrs r sock_recvzBaseSelectorEventLoop.sock_recvvs %%d+ ;;4??,1>? ? 99Q< !12     " [[] $$R(!!"doosD!D    d22Bv F Hyy7AC5AC5A&#C5%A&&B C5/C20C5cL||js|j|yyr/) cancelledrr)rrrs rrz%BaseSelectorEventLoop._sock_read_done% >!1!1!3   r ""4r*c|jry |j|}|j|y#ttf$rYyt t f$rt$r}|j|Yd}~yd}~wwxYwr/) doner_ set_resultrar`rrr set_exception)r)rr2rr\rs rrz BaseSelectorEventLoop._sock_recvsu 88:  !99Q? ? >>#& &!12     " [[] $$R(!!"d&:&:CsK    d22Bv F Hyyrc|jry |j|}|j|y#ttf$rYyt t f$rt$r}|j|Yd}~yd}~wwxYwr/) rrrrar`rrrr)r)rr2rnbytesrs rrz%BaseSelectorEventLoop._sock_recv_intosv 88:  #^^C(F NN6 " !12  -.   #   c " " #rcKtj||jr|jdk7r t d |j |S#t tf$rYnwxYw|j}|j}|j||j||j|||}|jtj|j |||d{7Sw)aReceive a datagram from a datagram socket. The return value is a tuple of (bytes, address) representing the datagram received and the address it came from. The maximum amount of data to be received at once is specified by nbytes. rrrN)rrrhrrrecvfromrar`rrOr0rW_sock_recvfromrrrr)r)r2bufsizerrrs r sock_recvfromz#BaseSelectorEventLoop.sock_recvfroms %%d+ ;;4??,1>? ? ==) )!12     " [[] $$R(!!"d&9&93gN    d22Bv F Hyyrc|jry |j|}|j|y#ttf$rYyt t f$rt$r}|j|Yd}~yd}~wwxYwr/) rrrrar`rrrr)r)rr2rresultrs rrz$BaseSelectorEventLoop._sock_recvfromsv 88:  #]]7+F NN6 " !12  -.   #   c " " #rc Ktj||jr|jdk7r t d|s t |} |j ||S#ttf$rYnwxYw|j}|j}|j||j||j||||}|jtj |j"|||d{7Sw)zReceive data from the socket. The received data is written into *buf* (a writable buffer). The return value is a tuple of (number of bytes written, address). rrrN)rrrhrrlen recvfrom_intorar`rrOr0rW_sock_recvfrom_intorrrr)r)r2rrrrrs rsock_recvfrom_intoz(BaseSelectorEventLoop.sock_recvfrom_intos %%d+ ;;4??,1>? ?XF %%c62 2!12     " [[] $$R(!!"d&>&>T3"(*    d22Bv F Hyys7A DA"!D"A41D3A44B D>D?Dc|jry |j||}|j|y#ttf$rYyt t f$rt$r}|j|Yd}~yd}~wwxYwr/) rrrrar`rrrr)r)rr2rrrrs rrz)BaseSelectorEventLoop._sock_recvfrom_intosz 88:  #''W5F NN6 " !12  -.   #   c " " #s7A:A:A55A:c (Ktj||jr|jdk7r t d |j |}|t|k(ry|j}|j}|j||j||j||t||g}|jt!j"|j$|||d{S#t tf$rd}YwxYw7w)Send data to the socket. The socket must be connected to a remote socket. This method continues to send data from data until either all data has been sent or an error occurs. None is returned on success. On error, an exception is raised, and there is no way to determine how much data, if any, was successfully processed by the receiving end of the connection. rrNr)rrrhrrrfrar`rrrOr0r _sock_sendall memoryviewrrr_sock_write_done)r)r2r\rrrrs r sock_sendallz"BaseSelectorEventLoop.sock_sendalls %%d+ ;;4??,1>? ?  $A D >   " [[] $$R(!!"d&8&8#t",T"2QC9    d33R G Iy !12 A s7ADC9B D4D5D9D  D D  Dc:|jry|d} |j||d}||z }|t|k(r|jdy||d<y#ttf$rYytt f$rt $r}|j|Yd}~yd}~wwxYwNr) rrfrar`rrrrrr)r)rr2viewposstartrrs rrz#BaseSelectorEventLoop._sock_sendall7s 88: A  $uv,'A   CI  NN4 CF !12  -.      c "  sAB(B?BBcKtj||jr|jdk7r t d |j ||S#t tf$rYnwxYw|j}|j}|j||j||j||||}|jtj|j |||d{7Sw)rrrrN)rrrhrrsendtorar`rrOr0r _sock_sendtorrrr)r)r2r\rCrrrs r sock_sendtoz!BaseSelectorEventLoop.sock_sendtoMs %%d+ ;;4??,1>? ? ;;tW- -!12     " [[] $$R(!!"d&7&7dD")+    d33R G Iyys7AC7AC7A'$C7&A''B C71C42C7c|jry |j|d|}|j|y#ttf$rYyt t f$rt$r}|j|Yd}~yd}~wwxYwr) rrrrar`rrrr)r)rr2r\rCrrs rrz"BaseSelectorEventLoop._sock_sendtohsx 88:   D!W-A NN1  !12  -.   #   c " " #s8A; A; A66A;c Ktj||jr|jdk7r t d|j t jk(s-tjrd|j t jk(rG|j||j |j|j|d{}|d\}}}}}|j}|j||| |d{d}S7?7#d}wxYww)zTConnect to a remote socket at address. This method is a coroutine. rr)familytypeprotoloopN)rrrhrrrrTAF_INET _HAS_IPv6AF_INET6_ensure_resolvedrrr _sock_connect)r)r2rCresolvedrrs r sock_connectz"BaseSelectorEventLoop.sock_connectws %%d+ ;;4??,1>? ? ;;&.. (%%$++*H!22 $))4::3H#+1+ Aq!Q  " 3g. 9CCs<CDD2D7D<D=DDDD  Dc|j} |j||jdd}y#ttf$rf|j ||j ||j|||}|jtj|j||Yd}yttf$rt$r}|j|Yd}~d}yd}~wwxYw#d}wxYw)Nr)rOconnectrrar`r0r_sock_connect_cbrrrrrrrr)r)rr2rCrrrs rrz#BaseSelectorEventLoop._sock_connects [[]  LL ! NN4 C# !12 M  ( ( ,%%D))3g?F  ! !!!$"7"7FK MC-.   #   c " "C  # Cs97C"A0C'C"+CCC"CC""C&cL||js|j|yyr/)rrrs rrz&BaseSelectorEventLoop._sock_write_donerr*cv|jry |jtjtj}|dk7rt |d| |j dd}y#ttf$rYd}yttf$rt$r}|j|Yd}~d}yd}~wwxYw#d}wxYw)NrzConnect call failed ) r getsockoptrT SOL_SOCKETSO_ERRORrgrrar`rrrr)r)rr2rCerrrs rrz&BaseSelectorEventLoop._sock_connect_cbs 88:  //&"3"3V__ECaxc%9'#CDD NN4 C !12  C-.   #   c " "C  # Cs<AA*B4*B19B4=B1B,%B4,B11B44B8cKtj||jr|jdk7r t d|j }|j |||d{S7w)aWAccept a connection. The socket must be bound to an address and listening for connections. The return value is a pair (conn, address) where conn is a new socket object usable to send and receive data on the connection, and address is the address bound to the socket on the other end of the connection. rrN)rrrhrrr _sock_accept)r)r2rs r sock_acceptz!BaseSelectorEventLoop.sock_accepts_ %%d+ ;;4??,1>? ?  " #t$yysA'A0)A.*A0c|j} |j\}}|jd|j||fy#tt f$rc|j ||j||j||}|jtj|j||Yyttf$rt$r}|j!|Yd}~yd}~wwxYw)NFr)rOrvrVrrar`r0rWr rrrrrrrr)r)rr2rrrCrrs rr z"BaseSelectorEventLoop._sock_accepts [[] , KKMMD'   U # NND'? + !12 L  ( ( ,%%b$*;*;S$GF  ! !!!$"6"66J L-.   #   c " " #s$A A/C-;C-C((C-cK|j|j=|j}|j|j d{ |j |j |||dd{|j|r|j||j|j<S7h7A#|j|r|j||j|j<wxYww)NF)fallback) r(_sock_fd is_reading pause_reading_make_empty_waiter sock_sendfile_sock_reset_empty_waiterresume_reading)r)transpfileoffsetcountrs r_sendfile_nativez&BaseSelectorEventLoop._sendfile_natives   V__ -**,''))) 7++FLL$5:,<<  & & (%%'06D  V__ - *<  & & (%%'06D  V__ -s<A C: B6C:#B:6B87B::=C:8B::=C77C:cd|D]\}}|j|jc}\}}|tjzr1|/|jr|j |n|j ||tjzsz|}|jr|j||j |yr/) fileobjr\rr _cancelledrM _add_callbackrr)r) event_listrrrrrs r_process_eventsz%BaseSelectorEventLoop._process_eventss#IC(+ SXX %G%ffi***v/A$$''0&&v.i+++0B$$''0&&v.$r*cb|j|j|jyr/)rMrOrJ)r)r2s r _stop_servingz#BaseSelectorEventLoop._stop_servings DKKM* r*r/NNN)r)4r# __module__ __qualname____doc__rr5rSSL_HANDSHAKE_TIMEOUTSSL_SHUTDOWN_TIMEOUTr@rDrJrIr%r]rXrjrprmrwr0rWrMrrrrrrrrrrrrrrrrrrrrrrrr r rr"r$ __classcell__r"s@rrr5so 97%)$79=+ $t"+"A"A!*!?!? +&CGB " E  ,&#'tS-6-L-L,5,J,JFD#"+"A"A!*!?!? ,)`D"+"A"A!*!?!? -5^&$ * .. ' . ' ,#! *#".#"2#">,6 2.#* ," 7 /r*rceZdZdZdZdfd ZdZdZdZdZ dZ d Z d Z d Z d Zej fd ZddZdZdZdZdZxZS)_SelectorTransportiNct|||tj||jd< |j |jd<d|jvr |j|jd<||_ |j|_ d|_ |j|||_t!j"|_d|_d|_d|_|j|jj-||j.|j<y#t $rd|jd<YwxYw#tj$rd|jd<YwxYw)NrTsocknamerrFr)rrr r_extra getsocknamerg getpeernamerTerrorrrOr_protocol_connected set_protocol_server collectionsdeque_buffer _conn_lost_closing_paused_attachr()r)rr2r3r,r-r"s rrz_SelectorTransport.__init__ s8 % & 6 6t < H +&*&6&6&8DKK # T[[ ( /*.*:*:*< J'   #(  (# "((*   << # LL "*.'+ +&*DKK # + << /*. J' /s#D'!E'EE"E*)E*c|jjg}|j|jdn|jr|jd|jd|j |j |j jst|j j|j tj}|r|jdn|jdt|j j|j tj}|rd}nd}|j}|jd|d |d d jd j|S) Nclosedclosingzfd=z read=pollingz read=idlepollingidlezwrite=z<{}> )r"r#rappendr<r_looprHrr$rrrget_write_buffer_sizeformatjoin)r)inforBstaters r__repr__z_SelectorTransport.__repr__'s$''( ::  KK ! ]] KK " c$--)* :: !$***>*>*@*4::+?+?+/==):N:NPG N+ K(*4::+?+?+/==+4+@+@BG!002G KK'% 7)1= >}}SXXd^,,r*c&|jdyr/) _force_closerRs rabortz_SelectorTransport.abortCs $r*c ||_d|_yNT) _protocolr5)r)r3s rr6z_SelectorTransport.set_protocolFs!#' r*c|jSr/)rSrRs r get_protocolz_SelectorTransport.get_protocolJs ~~r*c|jSr/)r<rRs rrz_SelectorTransport.is_closingMs }}r*cB|j xr |j Sr/)rr=rRs rrz_SelectorTransport.is_readingPs??$$9T\\)99r*c|jsyd|_|jj|j|jj rt jd|yy)NTz%r pauses reading)rr=rGrMr get_debugr r!rRs rrz _SelectorTransport.pause_readingSsP   !!$--0 ::   ! LL,d 3 "r*c|js |jsyd|_|j|j|j|j j rtjd|yy)NFz%r resumes reading) r<r=rWr _read_readyrGrYr r!rRs rrz!_SelectorTransport.resume_reading[sW ==   (8(89 ::   ! LL-t 4 "r*cP|jryd|_|jj|j|jsa|xj dz c_|jj |j|jj|jdyyNTr) r<rGrMrr:r;r call_soon_call_connection_lostrRs rrJz_SelectorTransport.closecss ==   !!$--0|| OOq O JJ % %dmm 4 JJ !;!;T Br*cv|j-|d|t||jjyy)Nzunclosed transport )source)rResourceWarningrJ)r)_warns r__del__z_SelectorTransport.__del__ms5 :: ! 'x0/$ O JJ    "r*ct|tr4|jjrDt j d||dn*|jj ||||jd|j|y)Nz%r: %sTrd)rsrtrr3) rrgrGrYr r!rrSrO)r)rrss r _fatal_errorz_SelectorTransport._fatal_errorrse c7 #zz##% XtWtD JJ - -" ! NN /  #r*c|jry|jr?|jj|jj |j |j s,d|_|jj|j |xjdz c_|jj|j|yr]) r;r:clearrGrrr<rMr^r_)r)rs rrOz_SelectorTransport._force_closes ??  << LL   JJ % %dmm 4}} DM JJ % %dmm 4 1 T77=r*c |jr|jj||jj d|_d|_d|_|j }||jd|_yy#|jj d|_d|_d|_|j }||jd|_wwxYwr/)r5rSconnection_lostrrJrGr7_detach)r)rr-s rr_z(_SelectorTransport._call_connection_losts $''..s3 JJ   DJ!DNDJ\\F! # " JJ   DJ!DNDJ\\F! # "s 'A??ACcHttt|jSr/)summaprr:rRs rrHz(_SelectorTransport.get_write_buffer_sizes3sDLL)**r*cb|jsy|jj||g|yr/)rrGrWrs rrWz_SelectorTransport._add_readers*  r83d3r*)NN)zFatal error on transport)r#r&r'max_sizerrrMrPr6rUrrrrrJwarningswarnrdrfrOr_rHrWr+r,s@rr.r.skH E/8-8 (:45C%MM  > $+4r*r.ceZdZdZej j Z dfd ZfdZ dZ dZ dZ dZ d Zd Zd Zd ed dfdZdZdZdZdZfdZdZdZfdZxZS)r1TNcd|_t| |||||d|_d|_t r|j |_n|j|_tj|j|jj|jj||jj|j |j"|j$|,|jjt&j(|dyyr)_read_ready_cbrr_eof _empty_waiter _HAS_SENDMSG_write_sendmsg _write_ready _write_sendr _set_nodelayrrGr^rSconnection_maderWrr[r_set_result_unless_cancelled)r)rr2r3r4r,r-r"s rrz!_SelectorSocketTransport.__init__s# tXuf= !  $ 3 3D  $ 0 0D    , T^^;;TB T--!]]D,<,< >   JJ !E!E!' / r*ct|tjr|j|_n|j |_t ||yr/)rr BufferedProtocol_read_ready__get_bufferru_read_ready__data_receivedrr6)r)r3r"s rr6z%_SelectorSocketTransport.set_protocols< h : : ;"&">">D "&"A"AD  X&r*c$|jyr/)rurRs rr[z$_SelectorSocketTransport._read_readys r*c|jry |jjd}t|s t d |jj|}|s|jy |jj|y#t t f$rt$r}|j|dYd}~yd}~wwxYw#ttf$rYyt t f$rt$r}|j|dYd}~yd}~wwxYw#t t f$rt$r}|j|dYd}~yd}~wwxYw)Nz%get_buffer() returned an empty bufferz/Fatal error: protocol.get_buffer() call failed.$Fatal read error on socket transportz3Fatal error: protocol.buffer_updated() call failed.)r;rS get_bufferrrGrrrrfrrrar`_read_ready__on_eofbuffer_updated)r)rrrs rrz0_SelectorSocketTransport._read_ready__get_buffersC ??  ..++B/Cs8"#JKK ZZ))#.F  $ $ &  L NN ) )& 1--.      F H   !12  -.      c#I J  -.   L   J L L LsM1B C1D C%B<<CDD,DD D?#D::D?c|jry |jj|j}|s|jy |jj|y#tt f$rYyt tf$rt$r}|j|dYd}~yd}~wwxYw#t tf$rt$r}|j|dYd}~yd}~wwxYw)Nrz2Fatal error: protocol.data_received() call failed.) r;rr_rprar`rrrrfrrS data_received)r)r\rs rrz3_SelectorSocketTransport._read_ready__data_receiveds ??  ::??4==1D  $ $ &  K NN ( ( . !12  -.      c#I J  -.   K   I K K Ks5%A$B+$B(5B( B##B(+CCCcx|jjrtjd| |jj }|r&|jj|jy|jy#t tf$rt$r}|j|dYd}~yd}~wwxYw)Nz%r received EOFz1Fatal error: protocol.eof_received() call failed.) rGrYr r!rS eof_receivedrrrrfrMrrJ)r) keep_openrs rrz,_SelectorSocketTransport._read_ready__on_eof s ::   ! LL*D 1 335I  JJ % %dmm 4 JJL-.      H J  sBB9B44B9c<t|tttfs!t dt |j |jr td|j td|sy|jrH|jtjk\rtjd|xjdz c_ y|js] |j j#|}t||d}|sy|j0j3|j4|j6|jj9||j;y#t$t&f$rYmt(t*f$rt,$r}|j/|dYd}~yd}~wwxYw)N/data argument must be a bytes-like object, not z%Cannot call write() after write_eof()z(unable to write; sendfile is in progresssocket.send() raised exception.r%Fatal write error on socket transport)rbytes bytearrayrrrr#rvrGrwr;r!LOG_THRESHOLD_FOR_CONNLOST_WRITESr warningr:rrfrar`rrrrfrGrrrzrF_maybe_pause_protocol)r)r\rrs rwritez_SelectorSocketTransport.writes_$ : >?##':#6#6"9;< < 99FG G    )IJ J  ??)"M"MM@A OOq O || JJOOD)"$'+ JJ " "4==$2C2C D D! ""$!$%56  12   !!#'NO sEF(F?FFcJtj|jtSr/) itertoolsislicer:rrRs r_get_sendmsg_bufferz,_SelectorSocketTransport._get_sendmsg_bufferFs j99r*c|jsJd|jry |jj|j }|j ||j |js|jj|j|j|jjd|jr|jdy|jr*|jjt j"yyy#t$t&f$rYyt(t*f$rt,$r}|jj|j|jj/|j1|d|j |jj3|Yd}~yYd}~yd}~wwxYwNzData should not be emptyr)r:r;rrr_adjust_leftover_buffer_maybe_resume_protocolrGrrrwrr<r_rvshutdownrTSHUT_WRrar`rrrrhrfr)r)rrs rryz'_SelectorSocketTransport._write_sendmsgIsh||777| ??  8ZZ''(@(@(BCF  ( ( 0  ' ' )<< ))$--8%%1&&11$7==..t4YYJJ''7   !12  -.   6 JJ % %dmm 4 LL     c#J K!!-""0055.  6s:DG +G A8GG rreturnc|j}|r?|j}t|}||kr||z}n|j||dy|r>yyr/)r:popleftr appendleft)r)rbufferbb_lens rrz0_SelectorSocketTransport._adjust_leftover_bufferesO AFE%!!!FG*-r*c|jsJd|jry |jj}|jj |}|t |k7r|jj ||d|j|js|jj|j|j|jjd|jr|jdy|jr*|jj!t"j$yyy#t&t(f$rYyt*t,f$rt.$r}|jj|j|jj1|j3|d|j |jj5|Yd}~yYd}~yd}~wwxYwr)r:r;rrrfrrrrGrrrwrr<r_rvrrTrrar`rrrrhrfr)r)rrrs rr{z$_SelectorSocketTransport._write_sendps||777| ??  8\\))+F 'ACK ''qr 3  ' ' )<< ))$--8%%1&&11$7==..t4YYJJ''7   !12  -.   6 JJ % %dmm 4 LL     c#J K!!-""0055.  6sA!EG0G0)A8G++G0c|js |jryd|_|js*|jj t j yyrR)r<rvr:rrrTrrRs r write_eofz"_SelectorSocketTransport.write_eofs; ==DII  || JJ   /r*c|jr td|j td|sy|jj |Dcgc] }t |c}|j |jrA|jj|j|j |jyycc}w)Nz*Cannot call writelines() after write_eof()z-unable to writelines; sendfile is in progress) rvrGrwr:extendrrzrGrrr)r) list_of_datar\s r writelinesz#_SelectorSocketTransport.writeliness 99KL L    )NO O  ,G,$Z-,GH  << JJ " "4==$2C2C D  & & ( Hs CcyrRrZrRs r can_write_eofz&_SelectorSocketTransport.can_write_eofsr*c t||d|_|j%|jj t dyy#d|_|j%|jj t dwwxYw)NzConnection is closed by peer)rr_rzrwrConnectionError)r)rr"s rr_z._SelectorSocketTransport._call_connection_losts E G )# . $D !!-""00#$BCE.!%D !!-""00#$BCE.s A :Bc|j td|jj|_|js|jj d|jS)NzEmpty waiter is already set)rwrGrGrr:rrRs rrz+_SelectorSocketTransport._make_empty_waitersV    )<= =!ZZ557||    ) )$ /!!!r*cd|_yr/)rwrRs rrz,_SelectorSocketTransport._reset_empty_waiters !r*c0d|_t| yr/)rurrJrKs rrJz_SelectorSocketTransport.closes"  r*r%)r#r&r'_start_tls_compatibler _SendfileMode TRY_NATIVE_sendfile_compatiblerr6r[rrrrrryrrr{rrrr_rrrJr+r,s@rr1r1s $22==48$(/2'#LJK2*%%N:88 c d 8>0 )E""r*r1cVeZdZejZ dfd ZdZdZddZ dZ xZ S)rBcxt|||||||_d|_|jj |j j||jj |j|j|j|,|jj tj|dyyr) rr_address _buffer_sizerGr^rSr}rWrr[rr~)r)rr2r3rCr4r,r"s rrz#_SelectorDatagramTransport.__init__s tXu5  T^^;;TB T--!]]D,<,< >   JJ !E!E!' / r*c|jSr/)rrRs rrHz0_SelectorDatagramTransport.get_write_buffer_sizes   r*c|jry |jj|j\}}|jj ||y#t tf$rYyt$r%}|jj|Yd}~yd}~wttf$rt$r}|j|dYd}~yd}~wwxYw)Nz&Fatal read error on datagram transport)r;rrrprSdatagram_receivedrar`rgerror_receivedrrrrfr)r\rrs rr[z&_SelectorDatagramTransport._read_readys ??  9,,T]];JD$ NN , ,T4 8 !12   / NN ) )# . .-.   M   c#K L L Ms)(AC%C-B  C(B??CcZt|tttfs!t dt |j |sy|jr4|d|jfvrtd|j|j}|jrT|jrH|jtjk\rtjd|xjdz c_ y|jsI |jdr|j j#|y|j j%||y|jjAt||f|xjBtE|z c_!|jGy#t&t(f$r3|j*j-|j.|j0Yt2$r%}|j4j7|Yd}~yd}~wt8t:f$rt<$r}|j?|dYd}~yd}~wwxYw)Nrz!Invalid address: must be None or rrrr'Fatal write error on datagram transport)$rrrrrrr#rrr;rrr rr:r1rrfrrar`rGrr _sendto_readyrgrSrrrrrfrFrrrrs rrz!_SelectorDatagramTransport.sendtos$ : >?##':#6#6"9;< <  ==D$--00 7 GII==D ??t}})"M"MM@A OOq O || ;;z*JJOOD)JJ%%dD1 U4[$/0 SY& ""$$%56 J &&t}}d6H6HI --c2 12   !!BD s0-*F F ?H* H*G33H*H%%H*cX|jr|jj\}}|xjt|zc_ |jdr|j j |n|j j|||jr|j%|jsD|j&j)|j*|j,r|j/dyyy#ttf$r>|jj||f|xjt|z c_Yt$r%}|jj|Yd}~yd}~wttf$rt $r}|j#|dYd}~yd}~wwxYw)Nrrr)r:rrrr1rrfrrar`rrgrSrrrrrfrrGrrr<r_rs rrz(_SelectorDatagramTransport._sendto_readysQll--/JD$   T *  ;;z*JJOOD)JJ%%dD1ll, ##%|| JJ % %dmm 4}}**40$%56  ''t 5!!SY.! --c2 12   !!BD s, AC>>A F) F)E22F) F$$F)r%r/) r#r&r'r8r9_buffer_factoryrrHr[rrr+r,s@rrBrBs.!''O59$( /!9 *%X1r*rB)&r(__all__r8rzrrosrrTrqr&ssl ImportErrorrrrrr r r r logr hasattrrxsysconfrrgr BaseEventLoopr_FlowControlMixin Transportr.r1DatagramTransportrBrZr*rrs #   v}}i0 RZZ - (I K55I X_455#--_4DZ1Zzl1!3Z5Q5Ql1Y% C$  s#C&:C3&C0/C03C=<C=__pycache__/timeouts.cpython-312.pyc000064400000017167152527367570013367 0ustar00 {|jddlZddlmZddlmZmZmZddlmZddlm Z ddlm Z dZ Gd d ejZ eGd d Zd eedefdZdeedefdZy)N) TracebackType)finalOptionalType)events) exceptions)tasks)Timeouttimeout timeout_atc eZdZdZdZdZdZdZy)_StatecreatedactiveexpiringexpiredfinishedN)__name__ __module__ __qualname__CREATEDENTEREDEXPIRINGEXPIREDEXITED)/usr/lib64/python3.12/asyncio/timeouts.pyrrsGGHG Frrc eZdZdZdeeddfdZdeefdZdeeddfdZde fdZ de fd Z dd Z d eeed eed eedee fdZddZy)r zAsynchronous context manager for cancelling overdue coroutines. Use `timeout()` or `timeout_at()` rather than instantiating this class directly. whenreturnNcXtj|_d|_d|_||_y)zSchedule a timeout that will trigger at a given loop time. - If `when` is `None`, the timeout will never trigger. - If `when < loop.time()`, the timeout will trigger on the next iteration of the event loop. N)rr_state_timeout_handler_task_when)selfr!s r__init__zTimeout.__init__!s%nn >B+/  rc|jS)zReturn the current deadline.)r'r(s rr!z Timeout.when.s zzrc|jtjurJ|jtjur t dt d|jj d||_|j|jj|d|_ytj}||jkr!|j|j|_y|j||j|_y)zReschedule the timeout.zTimeout has not been enteredzCannot change state of z TimeoutN)r$rrr RuntimeErrorvaluer'r%cancelrget_running_looptime call_soon _on_timeoutcall_at)r(r!loops r reschedulezTimeout.reschedule2s ;;fnn ,{{fnn,"#ABB)$++*;*;))r$rrr'roundappendjoinr.)r(infor!info_strs r__repr__zTimeout.__repr__Msst ;;&.. (+/::+A5Q'tD KK%v '88D>DKK--.az;;rcJK|jtjur tdt j }| tdtj |_||_|jj|_ |j|j|Sw)Nz Timeout has already been enteredz$Timeout should be used inside a task) r$rrr-r current_taskrr& cancelling _cancellingr6r')r(tasks r __aenter__zTimeout.__aenter__Us} ;;fnn ,AB B!!# <EF Fnn  ::002  # sB!B#exc_typeexc_valexc_tbcK|jtjtjfvsJ|j!|jj d|_|jtjurVtj |_|jj|jkr|tjurt|y|jtjurtj|_ywN)r$rrrr%r/rr&uncancelrGr CancelledError TimeoutErrorr)r(rJrKrLs r __aexit__zTimeout.__aexit__as {{v~~v????  ,  ! ! ( ( *$(D ! ;;&// ) ..DKzz""$(8(88XIbIb=b#/[[FNN * --DKsDDc|jtjusJ|jj tj |_d|_yrN)r$rrr&r/rr%r+s rr3zTimeout._on_timeoutys;{{fnn,,, oo $r)r"r )r"N)rrr__doc__rfloatr)r!r6boolrstrrCrIr BaseExceptionrrRr3rrrr r s Xe_  huoMxM4M.@@<#< 4 ./-('  $ 0%rr delayr"crtj}t||j|zSdS)a Timeout async context manager. Useful in cases when you want to apply timeout logic around block of code or in cases when asyncio.wait_for is not suitable. For example: >>> async with asyncio.timeout(10): # 10 seconds timeout ... await long_running_task() delay - value in seconds or None to disable timeout logic long_running_task() is interrupted by raising asyncio.CancelledError, the top-most affected timeout() context manager converts CancelledError into TimeoutError. N)rr0r r1)rYr5s rr r s5  " " $D %*;499;& FF FFrr!ct|S)abSchedule the timeout at absolute time. Like timeout() but argument gives absolute time in the same clock system as loop.time(). Please note: it is not POSIX time but a time with undefined starting base, e.g. the time of the system power on. >>> async with asyncio.timeout_at(loop.time() + 10): ... await long_running_task() when - a deadline when timeout occurs or None to disable timeout logic long_running_task() is interrupted by raising asyncio.CancelledError, the top-most affected timeout() context manager converts CancelledError into TimeoutError. )r )r!s rr r s& 4=r)enumtypesrtypingrrrr9rr r __all__Enumrr rUr r rrrras (( TYYc%c%c%LG8E?GwG(Xe_r__pycache__/taskgroups.cpython-312.opt-2.pyc000064400000016766152527367570014664 0ustar00 {|jW%@dZddlmZddlmZddlmZGddZy)) TaskGroup)events) exceptions)taskscVeZdZ dZdZdZdZdZddddZd e d e fd Z d Z d Z y)rcd|_d|_d|_d|_d|_d|_t |_g|_d|_ d|_ y)NF) _entered_exiting _aborting_loop _parent_task_parent_cancel_requestedset_tasks_errors _base_error_on_completed_futselfs +/usr/lib64/python3.12/asyncio/taskgroups.py__init__zTaskGroup.__init__sN    (-%e  !%cxdg}|jr'|jdt|j|jr'|jdt|j|jr|jdn|j r|jddj |}d|dS) Nztasks=zerrors= cancellingentered z )rappendlenrr r join)rinfoinfo_strs r__repr__zTaskGroup.__repr__(st ;; KK&T[[!1 23 4 << KK'#dll"3!45 6 >> KK % ]] KK "88D>H:Q''rcK|jrtd|d|jtj|_t j |j|_|jtd|dd|_|Sw)N TaskGroup z has already been enteredz! cannot determine the parent taskT)r RuntimeErrorr rget_running_loopr current_taskr rs r __aenter__zTaskGroup.__aenter__6s ==TH$=>@ @ :: 002DJ!..tzz:    $TH$EFH H  sB B cKd} |j||d{d|_d|_d|_d}S7#d|_d|_d|_d}wxYwwN)_aexitr rr)retexctbs r __aexit__zTaskGroup.__aexit__Dsc  R-- !%D DL#D C. !%D DL#D Cs%A979A9AAcKd|_|$|j|r|j||_|tjur|nd}|j r|j jdk(rd}||js|j|jrT|j|jj|_ |jd{d|_ |jrT|j |j |r|js |d}|-|tjur|jj||jr t!d|jdy7#tj$r(}|js|}|jYd}~d}~wwxYw#d}wxYw#d}wxYw#d}wxYw#d}wxYww)NTzunhandled errors in a TaskGroup)r _is_base_errorrrCancelledErrorrr uncancelr _abortrrr create_futurerrBaseExceptionGroup)rr.r/propagate_cancellation_errorexs rr-zTaskGroup._aexitRs O##C(  ("D 222C %  ( (  ))+q004, >>> kk%%-)-)A)A)C& ",,,,&*D "'kk.    ' &&&  0+DLL66,0 ( >b (A(AA LL   $ << (5LL M-,, "~~460KKM "*C+/ (sCG E2E0E2G / G < F0 F>F7=G G/G 0E22F-F(#G (F--G 0F44G 7F;;F>>GG G  G N)namecontextc |jstd|d|jr|jstd|d|jrtd|d||j j |}n|j j ||}tj|||jj||j|j |~S#~wxYw)Nr&z has not been enteredz is finishedz is shutting down)r=) r r'r rr r create_taskr_set_task_nameaddadd_done_callback _on_task_done)rcoror<r=tasks rr?zTaskGroup.create_tasks }}D83HIJ J ==D8<@A A >>D83DEF F ?::))$/D::))$)@D T4(  t112 s 'C**C-r/returnc.t|ttfSr,) isinstance SystemExitKeyboardInterrupt)rr/s rr4zTaskGroup._is_base_errors# ,=>??rcvd|_|jD]#}|jr|j%y)NT)r rdonecancel)rts rr7zTaskGroup._aborts)A668 rc|jj||jA|js5|jjs|jj d|j ry|j }|y|jj||j|r|j||_ |jjr1|jjd|d|jd||dy|js?|js2|j!d|_|jj#yyy)NTzTask z% has errored out but its parent task z is already completed)message exceptionrE)rdiscardrrL set_result cancelledrQrrr4rr r call_exception_handlerr rr7rM)rrEr/s rrCzTaskGroup._on_task_dones3 D!  ! ! -dkk))..0&&11$7 >>  nn ;  C   s #(8(8(@"D     ! ! # JJ - -"4(+##'#4#4"55JL  /  ~~d&C&C& KKM,0D )    $ $ &+'D~r)__name__ __module__ __qualname__rr$r*r1r-r? BaseExceptionboolr4r7rCrrrr sO & (  Wt)-dF@-@D@2'rrN)__all__rrrrrr[rrr]s! @'@'r__pycache__/locks.cpython-312.opt-2.pyc000064400000047435152527367570013572 0ustar00 {|j3J^ dZddlZddlZddlmZddlmZGddZGdd eejZGd d ejZ Gd d eejZ GddeejZ Gdde Z GddejZGddejZy))LockEvent Condition SemaphoreBoundedSemaphoreBarrierN) exceptions)mixinsceZdZdZdZy)_ContextManagerMixinc@K|jd{y7wN)acquireselfs &/usr/lib64/python3.12/asyncio/locks.py __aenter__z_ContextManagerMixin.__aenter__ slln s c,K|jywr)release)rexc_typeexctbs r __aexit__z_ContextManagerMixin.__aexit__s sN)__name__ __module__ __qualname__rrrr r s  rr c>eZdZ dZfdZdZdZdZdZxZ S)rc d|_d|_yNF)_waiters_lockedrs r__init__z Lock.__init__Ms  rct|}|jrdnd}|jr|dt |j}d|ddd|dS Nlockedunlocked , waiters:)super__repr__r$r#lenrresextra __class__s rr0z Lock.__repr__QsYg  LLj ==gZDMM(:';zLock.acquire..cs9=aAKKM=sT) r$r#all collectionsdeque _get_loop create_futureappendremover CancelledError_wake_up_firstrfuts rrz Lock.acquire\s  $--"794==99DL == '--/DMnn,,. S!   *  $$S)   $$S)(( <<##%  sBBD$ C%C&C*C0D$CC--C001D!!D$cb |jrd|_|jytd)NFzLock is not acquired.)r$rG RuntimeErrorrs rrz Lock.release|s/  << DL    !67 7rc |jsy tt|j}|j s|j dyy#t$rYywxYwNT)r#nextiter StopIterationdone set_resultrHs rrGzLock._wake_up_firstsW8}}  tDMM*+Cxxz NN4     sA AA) rrrr%r0r(rrrG __classcell__r5s@rrrs(3j*@8" !rrc>eZdZ dZfdZdZdZdZdZxZ S)rcDtj|_d|_yr")r@rAr#_valuers rr%zEvent.__init__s#))+  rct|}|jrdnd}|jr|dt |j}d|ddd|dS) Nsetunsetr*r+r r,r-r.)r/r0rWr#r1r2s rr0zEvent.__repr__sYg ' ==gZDMM(:'; ))+  [F  s31 33c |js tdd}|jD]0}||k\ry|jr|dz }|j d2y)Nz!cannot notify on un-acquired lockrr F)r(rKr#rQrR)rnidxrIs rnotifyzCondition.notify)sY {{}BC C==Cax88:qu% !rcN |jt|jyr)rqr1r#rs r notify_allzCondition.notify_allAs C &'rrr ) rrrr%r0rbrmrqrsrSrTs@rrrs' ,*#0J &0(rrc@eZdZ ddZfdZdZdZdZdZxZ S)rc@|dkr tdd|_||_y)Nrz$Semaphore initial value must be >= 0) ValueErrorr#rW)rvalues rr%zSemaphore.__init__Ys# 19CD D  rct|}|jrdnd|j}|jr|dt |j}d|ddd|dS) Nr(zunlocked, value:r*r+r r,r-r.)r/r0r(rWr#r1r2s rr0zSemaphore.__repr___sgg  KKM1A$++/O ==gZDMM(:';K|]}|j ywrr9r;s rr>z#Semaphore.locked..isA,?aAKKM!,?sr)rWanyr#rs rr(zSemaphore.lockedfs7G{{aC ADMM,?R,?A A CrcK |js|xjdzc_y|jtj|_|j j }|jj| |d{|jj| |jdkDr|jy7@#|jj|wxYw#tj$r7|js%|xjdz c_|jwxYww)Nr Tr) r(rWr#r@rArBrCrDrEr rFr: _wake_up_nextrHs rrzSemaphore.acquireks {{} KK1 K == '--/DMnn,,. S!  *  $$S) ;;?     $$S)(( ==? q ""$   sCBD? CCCC2/!D?CC//C22A D<<D?cP |xjdz c_|jyNr )rWr~rs rrzSemaphore.releases# q  rc |jsy|jD]:}|jr|xjdzc_|jdyy)Nr T)r#rQrWrRrHs rr~zSemaphore._wake_up_nextsC7}} ==C88: q t$ !rrt) rrrr%r0r(rrr~rSrTs@rrrJs(  *C "H rrc,eZdZ dfd ZfdZxZS)rc2||_t| |yr) _bound_valuer/r%)rrxr5s rr%zBoundedSemaphore.__init__s! rcj|j|jk\r tdt|y)Nz(BoundedSemaphore released too many times)rWrrwr/r)rr5s rrzBoundedSemaphore.releases+ ;;$++ +GH H rrt)rrrr%rrSrTs@rrrs  rrceZdZdZdZdZdZy) _BarrierStatefillingdraining resettingbrokenN)rrrFILLINGDRAINING RESETTINGBROKENrrrrrsGHI FrrceZdZ dZfdZdZdZdZdZdZ dZ d Z d Z d Z ed Zed ZedZxZS)rc |dkr tdt|_||_tj |_d|_y)Nr zparties must be >= 1r)rwr_cond_partiesrr_state_count)rpartiess rr%zBarrier.__init__s<? Q;34 4[  #++  rct|}|jj}|js|d|j d|j z }d|ddd|dS)Nr*/r+r r,r-r.)r/r0rrxr n_waitingrr2s rr0zBarrier.__repr__sdg ;;$$%{{ z$..!14<<.A AE3q9+Rwb))rc>K|jd{S7wrrjrs rrzBarrier.__aenter__sYY[   s c Kywrr)rargss rrzBarrier.__aexit__s  sc2K |j4d{|jd{ |j}|xjdz c_|dz|jk(r|j d{n|j d{||xjdzc_|j cdddd{S777Y7B7 #|xjdzc_|j wxYw#1d{7swYyxYwwr)r_blockrr_release_wait_exit)rindexs rrbz Barrier.waits :::++-     q 19 ---/))**,&& q  ::  *& q  ::sDCDDCDAC8C9CCC%D< DC DDCCD'C??DDD DDcKjjfdd{jtjurt j dy76w)Nc\jtjtjfvSr)rrrrrsrz Barrier._block..s$DKK&& (?(?(rzBarrier aborted)rrmrrrr BrokenBarrierErrorrs`rrzBarrier._blocksZ jj!!     ;;-.. .//0AB B / s"AA7AcjKtj|_|jj ywr)rrrrrsrs rrzBarrier._releases% $,,  s13cKjjfdd{jtjtj fvrt jdy7Fw)Nc<jtjuSr)rrrrsrrzBarrier._wait..s$++]=R=R*RrzAbort or reset of barrier)rrmrrrrr rrs`rrz Barrier._waits] jj!!"RSSS ;;=//1H1HI I//0KL L J Ts"A.A,AA.c|jdk(r\|jtjtjfvrtj |_|j jyyNr)rrrrrrrrsrs rrz Barrier._exitsO ;;! {{}66 8N8NOO+33 JJ ! ! # rcjK |j4d{|jdkDr2|jtjur+tj|_ntj |_|jj dddd{y77#1d{7swYyxYwwr)rrrrrrrsrs rresetz Barrier.reset"sp :::{{Q;;m&=&=="/"9"9DK+33 JJ ! ! #::::::sEB3BB3A1B B3BB3B3B0$B' %B0,B3cK |j4d{tj|_|jj dddd{y7D7#1d{7swYyxYwwr)rrrrrsrs rabortz Barrier.abort1sF :::'..DK JJ ! ! #::::::sDA2AA20A A2AA2A2A/#A& $A/+A2c |jSr)rrs rrzBarrier.parties;sF}}rcV |jtjur |jSyr)rrrrrs rrzBarrier.n_waiting@s$J ;;-// /;; rc< |jtjuSr)rrrrs rrzBarrier.brokenGs>{{m2222r)rrrr%r0rrrbrrrrrrpropertyrrrrSrTs@rrrs} *!  .C   M$ $$ 33rr)__all__r@enumr r r _LoopBoundMixinrrrrrEnumrrrrrrs! * C! !7!7C!L:&F " ":&zm($f&<&<m(`W$f&<&<Wty$DIIM3f$$M3r__pycache__/timeouts.cpython-312.opt-2.pyc000064400000013551152527367570014320 0ustar00 {|jddlZddlmZddlmZmZmZddlmZddlm Z ddlm Z dZ Gd d ejZ eGd d Zd eedefdZdeedefdZy)N) TracebackType)finalOptionalType)events) exceptions)tasks)Timeouttimeout timeout_atc eZdZdZdZdZdZdZy)_StatecreatedactiveexpiringexpiredfinishedN)__name__ __module__ __qualname__CREATEDENTEREDEXPIRINGEXPIREDEXITED)/usr/lib64/python3.12/asyncio/timeouts.pyrrsGGHG Frrc eZdZ deeddfdZdeefdZdeeddfdZdefdZ de fdZ dd Z d ee ed eed eedeefd ZddZy)r whenreturnNcZ tj|_d|_d|_||_yN)rr_state_timeout_handler_task_when)selfr!s r__init__zTimeout.__init__!s* nn >B+/  rc |jSr$)r(r)s rr!z Timeout.when.s*zzrc |jtjurJ|jtjur t dt d|jj d||_|j|jj|d|_ytj}||jkr!|j|j|_y|j||j|_y)NzTimeout has not been enteredzCannot change state of z Timeout)r%rrr RuntimeErrorvaluer(r&cancelrget_running_looptime call_soon _on_timeoutcall_at)r)r!loops r reschedulezTimeout.reschedule2s% ;;fnn ,{{fnn,"#ABB)$++*;*;))r%rrr(roundappendjoinr/)r)infor!info_strs r__repr__zTimeout.__repr__Msst ;;&.. (+/::+A5Q'tD KK%v '88D>DKK--.az;;rcJK|jtjur tdt j }| tdtj |_||_|jj|_ |j|j|Sw)Nz Timeout has already been enteredz$Timeout should be used inside a task) r%rrr.r current_taskrr' cancelling _cancellingr7r()r)tasks r __aenter__zTimeout.__aenter__Us} ;;fnn ,AB B!!# <EF Fnn  ::002  # sB!B#exc_typeexc_valexc_tbcK|j!|jjd|_|jtjurVtj |_|j j|jkr|tjurt|y|jtjurtj|_ywr$)r&r0r%rrrr'uncancelrHr CancelledError TimeoutErrorrr)r)rKrLrMs r __aexit__zTimeout.__aexit__as  ,  ! ! ( ( *$(D ! ;;&// ) ..DKzz""$(8(88XIbIb=b#/[[FNN * --DKsCCcp|jjtj|_d|_yr$)r'r0rrr%r&r,s rr4zTimeout._on_timeoutys% oo $r)r"r )r"N)rrrrfloatr*r!r7boolrstrrDrJr BaseExceptionrrRr4rrrr r s Xe_  huoMxM4M.@@<#< 4 ./-('  $ 0%rr delayr"ct tj}t||j|zSdSr$)rr1r r2)rXr6s rr r s:  " " $D %*;499;& FF FFrr!c t|Sr$)r )r!s rr r s$ 4=r)enumtypesrtypingrrrr:rr r __all__Enumrr rTr r rrrr`s (( TYYc%c%c%LG8E?GwG(Xe_r__pycache__/futures.cpython-312.pyc000064400000041634152527367570013207 0ustar00 {|j8jdZdZddlZddlZddlZddlZddlmZddl m Z ddl m Z ddl m Z dd l m Z e jZe jZe j Ze j"Zej$dz ZGd d ZeZd Zd ZdZdZdZdZdddZ ddlZej(xZZy#e$rYywxYw)z.A Future class similar to the one in PEP 3148.)Future wrap_futureisfutureN) GenericAlias) base_futures)events) exceptions)format_helpersceZdZdZeZdZdZdZdZ dZ dZ dZ dZ dddZdZdZeeZedZej,d Zd Zd Zdd Zd ZdZdZdZdZdddZdZ dZ!dZ"dZ#e#Z$y)ra,This class is *almost* compatible with concurrent.futures.Future. Differences: - This class is not thread-safe. - result() and exception() do not take a timeout argument and raise an exception when the future isn't done yet. - Callbacks registered with add_done_callback() are always called via the event loop's call_soon(). - This class is not compatible with the wait() and as_completed() methods in the concurrent.futures package. (In Python 3.4 or later we may be able to unify the implementations.) NFloopc|tj|_n||_g|_|jj r.t j tjd|_ yy)zInitialize the future. The optional event_loop argument allows explicitly setting the event loop object used by the future. If it's not provided, the future uses the default event loop. Nr) r get_event_loop_loop _callbacks get_debugr extract_stacksys _getframe_source_tracebackselfrs (/usr/lib64/python3.12/asyncio/futures.py__init__zFuture.__init__Hs[ <..0DJDJ ::   !%3%A%A a &"D " "c,tj|SN)r _future_reprrs r__repr__zFuture.__repr__Xs((..rc|jsy|j}|jjd||d}|jr|j|d<|j j |y)Nz exception was never retrieved)message exceptionfuturesource_traceback)_Future__log_traceback _exception __class____name__rrcall_exception_handler)rexccontexts r__del__zFuture.__del__[sl## oo>>**++IJ    ! !*.*@*@G& ' ))'2rc|jSr)r'r s r_log_tracebackzFuture._log_tracebackms###rc,|r tdd|_y)Nz'_log_traceback can only be set to FalseF) ValueErrorr')rvals rr0zFuture._log_tracebackqs FG G$rc8|j}| td|S)z-Return the event loop the Future is bound to.z!Future object is not initialized.)r RuntimeErrorrs rget_loopzFuture.get_loopws!zz <BC C rc|j|j}d|_|S|jtj}ntj|j}|j|_d|_|S)zCreate the CancelledError to raise if the Future is cancelled. This should only be called once when handling a cancellation since it erases the saved context exception value. N)_cancelled_exc_cancel_messager CancelledError __context__)rr,s r_make_cancelled_errorzFuture._make_cancelled_error~sr    *%%C"&D J    '++-C++D,@,@AC--" rc~d|_|jtk7ryt|_||_|j y)zCancel the future and schedule callbacks. If the future is already done or cancelled, return False. Otherwise, change the future's state to cancelled, schedule the callbacks and return True. FT)r'_state_PENDING _CANCELLEDr9_Future__schedule_callbacks)rmsgs rcancelz Future.cancels9 % ;;( "  " !!#rc|jdd}|syg|jdd|D]#\}}|jj|||%y)zInternal: Ask the event loop to call all callbacks. The callbacks are scheduled to be called as soon as possible. Also clears the callback list. Nr-)rr call_soon)r callbackscallbackctxs r__schedule_callbackszFuture.__schedule_callbackssM OOA&  &MHc JJ 4 ='rc(|jtk(S)z(Return True if the future was cancelled.)r>r@r s r cancelledzFuture.cancelleds{{j((rc(|jtk7S)zReturn True if the future is done. Done means either that a result / exception are available, or that the future was cancelled. )r>r?r s rdonez Future.dones {{h&&rc |jtk(r|j|jtk7rt j dd|_|j%|jj|j|jS)aReturn the result this future represents. If the future has been cancelled, raises CancelledError. If the future's result isn't yet available, raises InvalidStateError. If the future is done and has an exception set, this exception is raised. zResult is not ready.F) r>r@r< _FINISHEDr InvalidStateErrorr'r(with_traceback _exception_tb_resultr s rresultz Future.resultst ;;* $,,. . ;;) #../EF F$ ?? &//001C1CD D||rc|jtk(r|j|jtk7rt j dd|_|jS)a&Return the exception that was set on this future. The exception (or None if no exception was set) is returned only if the future is done. If the future has been cancelled, raises CancelledError. If the future isn't done yet, raises InvalidStateError. zException is not set.F)r>r@r<rPr rQr'r(r s rr$zFuture.exceptionsO ;;* $,,. . ;;) #../FG G$rrEc|jtk7r|jj|||y|t j }|j j||fy)zAdd a callback to be run when the future becomes done. The callback is called with a single argument - the future object. If the future is already done when this is called, the callback is scheduled with call_soon. rEN)r>r?rrF contextvars copy_contextrappend)rfnr-s radd_done_callbackzFuture.add_done_callbacksR ;;( " JJ T7 ;%224 OO " "B= 1rc|jDcgc]\}}||k7r||f}}}t|jt|z }|r||jdd|Scc}}w)z}Remove all instances of a callback from the "call when done" list. Returns the number of callbacks removed. N)rlen)rr[frIfiltered_callbacks removed_counts rremove_done_callbackzFuture.remove_done_callbacksn /3oo*.=(1c!"b !#h.= *DOO,s3E/FF !3DOOA  *sAc|jtk7r$tj|jd|||_t |_|j y)zMark the future done and set its result. If the future is already done when this method is called, raises InvalidStateError. : N)r>r?r rQrTrPrA)rrUs r set_resultzFuture.set_resultsJ ;;( "..$++b/IJ J   !!#rcj|jtk7r$tj|jd|t |t r|}t |t rtd}||_||_ |}||_ |j|_ t|_|jd|_y)zMark the future done and set an exception. If the future is already done when this method is called, raises InvalidStateError. rdzPStopIteration interacts badly with generators and cannot be raised into a FutureTN)r>r?r rQ isinstancetype StopIterationr5 __cause__r;r( __traceback__rSrPrAr')rr$new_excs r set_exceptionzFuture.set_exceptions ;;( "..$++b/IJ J i &! I i /"$,-G!*G "+G I#&44  !!##rc#K|js d|_||js td|jSw)NTzawait wasn't used with future)rN_asyncio_future_blockingr5rUr s r __await__zFuture.__await__s=yy{,0D )Jyy{>? ?{{}sAA r)%r* __module__ __qualname____doc__r?r>rTr(rrr9r8ror'rr!r. classmethodr__class_getitem__propertyr0setterr6r<rCrArLrNrUr$r\rbrermrp__iter__rrrrs&FGJ EON %O#" /3 $L1 $$%% (  >) ' 04 2  $$.Hrrc^ |j}|S#t$rY|jSwxYwr)r6AttributeErrorr)futr6s r _get_loopr}-s:<<z    99  s  ,,cH|jry|j|y)z?Helper setting the result only if the future was not cancelled.N)rLre)r|rUs r_set_result_unless_cancelledr9s }}NN6rclt|}|tjjurt j|j S|tjj urt j |j S|tjjurt j|j S|Sr)rh concurrentfuturesr:r args TimeoutErrorrQ)r, exc_classs r_convert_future_excr@sS IJ&&555((#((33 j((55 5&&11 j((:: :++SXX66 rc.|jsJ|jr|j|jsy|j }||j t |y|j}|j|y)z8Copy state from a future to a concurrent.futures.Future.N) rNrLrCset_running_or_notify_cancelr$rmrrUre)rsourcer$rUs r_set_concurrent_future_staterLs ;;==   2: 2 2 4  "I   !4Y!?@ f%rcL|jsJ|jry|jrJ|jr|jy|j}||j t |y|j }|j|y)zqInternal helper to copy state from another Future. The other Future may be a concurrent.futures.Future. N)rNrLrCr$rmrrUre)rdestr$rUs r_copy_future_stater[s ;;== ~~yy{?  $$&    29= >]]_F OOF #rcts/ttjjs t dts/ttjjs t dtr t ndtr t nddfd}fd}j|j|y)aChain two futures so that when one completes, so does the other. The result (or exception) of source will be copied to destination. If destination is cancelled, source gets cancelled too. Compatible with both asyncio.Future and concurrent.futures.Future. z(A future is required for source argumentz-A future is required for destination argumentNcLt|r t||yt||yr)rrr)r%others r _set_statez!_chain_future.._set_states F  uf - ( 7rc|jr3urjyjjyyr)rLrCcall_soon_threadsafe) destination dest_loopr source_loops r_call_check_cancelz)_chain_future.._call_check_cancels<  ""kY&> 00? #rcjrjryur |yjryj|yr)rL is_closedr)rrrrrs r_call_set_statez&_chain_future.._call_set_states[  ! ! #%)*=*=*?    [ 8 {F +""$  * *:{F Kr)rrgrrr TypeErrorr}r\)rrrrrrrs`` @@@r _chain_futureros F Jv/9/A/A/H/H%JBCC K K4>4F4F4M4M*OGHH'/'7)F#TK*2;*? +&TI8 @ L!!"45 _-rr ct|r|St|tjjs Jd||t j }|j}t|||S)z&Wrap concurrent.futures.Future object.z+concurrent.futures.Future is expected, got ) rrgrrrr r create_futurer)r%r new_futures rrrso fj0077 8A 5fZ@A 8 |$$&##%J&*% r) rs__all__concurrent.futuresrrXloggingrtypesrrr r r rr?r@rPDEBUG STACK_DEBUGr _PyFuturer}rrrrrr_asyncio_CFuture ImportErrorryrrrs4        $ $  " " mma HHX     &$().X!% ( !'FX   sB**B21B2__pycache__/windows_utils.cpython-312.pyc000064400000016247152527367570014426 0ustar00 {|jdZddlZejdk7redddlZddlZddlZddlZddlZddl Z ddl Z dZ dZ ejZ ejZejZdde d d ZGd d ZGd dej&Zy)z)Various Windows specific bits and pieces.Nwin32z win32 only)pipePopenPIPE PipeHandlei F)TT)duplex overlappedbufsizec tjdjtjt t }|r6tj}tjtjz}||}}n$tj}tj}d|}}|tjz}|dr|tjz}|drtj}nd}dx} } tj||tjd||tj tj"} tj$||dtj"tj&|tj"} tj(| d} | j+d| | fS#| tj,| | tj,| xYw)zELike os.pipe() but with overlapped support and using handles not fds.z\\.\pipe\python-pipe-{:d}-{:d}-)prefixrNTr )tempfilemktempformatosgetpidnext _mmap_counter_winapiPIPE_ACCESS_DUPLEX GENERIC_READ GENERIC_WRITEPIPE_ACCESS_INBOUNDFILE_FLAG_FIRST_PIPE_INSTANCEFILE_FLAG_OVERLAPPEDCreateNamedPipe PIPE_WAITNMPWAIT_WAIT_FOREVERNULL CreateFile OPEN_EXISTINGConnectNamedPipeGetOverlappedResult CloseHandle) rr r addressopenmodeaccessobsizeibsizeflags_and_attribsh1h2ovs ./usr/lib64/python3.12/asyncio/windows_utils.pyrr soo188 IIKm,./G--%%(=(== '..&&G 555H!}G000!}#88NB  $ $ Xw00 vvw;;W\\K   VQ g.C.C w||- % %bT : t$2v  >    # >    # s *B6F!!1Gc|eZdZdZdZdZedZdZe jddZ e jfdZd Zd Zy ) rzWrapper for an overlapped pipe handle which is vaguely file-object like. The IOCP event loop can use these instead of socket objects. c||_yN_handleselfhandles r/__init__zPipeHandle.__init__Vs  cx|jd|j}nd}d|jjd|dS)Nzhandle=closed< >)r4 __class____name__r5s r/__repr__zPipeHandle.__repr__YsB << #t||./FF4>>**+1VHA66r9c|jSr2r3r6s r/r7zPipeHandle.handle`s ||r9cH|j td|jS)NzI/O operation on closed pipe)r4 ValueErrorrCs r/filenozPipeHandle.filenods" << ;< <||r9)r%cP|j||jd|_yyr2r3)r6r%s r/closezPipeHandle.closeis$ << #  %DL $r9cb|j#|d|t||jyy)Nz unclosed )source)r4ResourceWarningrH)r6_warns r/__del__zPipeHandle.__del__ns- << # IdX& E JJL $r9c|Sr2rCs r/ __enter__zPipeHandle.__enter__ss r9c$|jyr2)rH)r6tvtbs r/__exit__zPipeHandle.__exit__vs  r9N)r@ __module__ __qualname____doc__r8rApropertyr7rFrr%rHwarningswarnrMrPrUrOr9r/rrQsR7 $+#6#6 %MM r9rc$eZdZdZdfd ZxZS)rzReplacement for subprocess.Popen using overlapped pipe handles. The stdin, stdout, stderr are None or instances of PipeHandle. c ,|jdrJ|jdddk(sJdx}x}}dx} x} } |tk(r5tdd\} } tj| t j }n|}|tk(r&td\} } tj| d}n|}|tk(r&td\} }tj|d}n|tk(r|}n|} t|$|f|||d || t| |_ | t| |_ | t| |_ |tk(rt j ||tk(rt j ||tk(rt j |yy#| | | fD]}|tj|xYw#|tk(rt j ||tk(rt j ||tk(rt j |wwxYw) Nuniversal_newlinesr r)FTT)r r)TFr)stdinstdoutstderr)getrrmsvcrtopen_osfhandlerO_RDONLYSTDOUTsuperr8rr_r`rarr%rH)r6argsr_r`rakwds stdin_rfd stdout_wfd stderr_wfdstdin_wh stdout_rh stderr_rhstdin_rh stdout_wh stderr_whhr?s r/r8zPopen.__init__s880111xx 1%***.22 2J+///9y D=!%t!L Hh--h DII T>#'=#A Iy..y!#'=#A Iy..y!r}s/ <<7 l ##  0     ! \7+b&&X0%J  0%r9__pycache__/futures.cpython-312.opt-1.pyc000064400000041064152527367570014143 0ustar00 {|j8jdZdZddlZddlZddlZddlZddlmZddl m Z ddl m Z ddl m Z dd l m Z e jZe jZe j Ze j"Zej$dz ZGd d ZeZd Zd ZdZdZdZdZdddZ ddlZej(xZZy#e$rYywxYw)z.A Future class similar to the one in PEP 3148.)Future wrap_futureisfutureN) GenericAlias) base_futures)events) exceptions)format_helpersceZdZdZeZdZdZdZdZ dZ dZ dZ dZ dddZdZdZeeZedZej,d Zd Zd Zdd Zd ZdZdZdZdZdddZdZ dZ!dZ"dZ#e#Z$y)ra,This class is *almost* compatible with concurrent.futures.Future. Differences: - This class is not thread-safe. - result() and exception() do not take a timeout argument and raise an exception when the future isn't done yet. - Callbacks registered with add_done_callback() are always called via the event loop's call_soon(). - This class is not compatible with the wait() and as_completed() methods in the concurrent.futures package. (In Python 3.4 or later we may be able to unify the implementations.) NFloopc|tj|_n||_g|_|jj r.t j tjd|_ yy)zInitialize the future. The optional event_loop argument allows explicitly setting the event loop object used by the future. If it's not provided, the future uses the default event loop. Nr) r get_event_loop_loop _callbacks get_debugr extract_stacksys _getframe_source_tracebackselfrs (/usr/lib64/python3.12/asyncio/futures.py__init__zFuture.__init__Hs[ <..0DJDJ ::   !%3%A%A a &"D " "c,tj|SN)r _future_reprrs r__repr__zFuture.__repr__Xs((..rc|jsy|j}|jjd||d}|jr|j|d<|j j |y)Nz exception was never retrieved)message exceptionfuturesource_traceback)_Future__log_traceback _exception __class____name__rrcall_exception_handler)rexccontexts r__del__zFuture.__del__[sl## oo>>**++IJ    ! !*.*@*@G& ' ))'2rc|jSr)r'r s r_log_tracebackzFuture._log_tracebackms###rc,|r tdd|_y)Nz'_log_traceback can only be set to FalseF) ValueErrorr')rvals rr0zFuture._log_tracebackqs FG G$rc8|j}| td|S)z-Return the event loop the Future is bound to.z!Future object is not initialized.)r RuntimeErrorrs rget_loopzFuture.get_loopws!zz <BC C rc|j|j}d|_|S|jtj}ntj|j}|j|_d|_|S)zCreate the CancelledError to raise if the Future is cancelled. This should only be called once when handling a cancellation since it erases the saved context exception value. N)_cancelled_exc_cancel_messager CancelledError __context__)rr,s r_make_cancelled_errorzFuture._make_cancelled_error~sr    *%%C"&D J    '++-C++D,@,@AC--" rc~d|_|jtk7ryt|_||_|j y)zCancel the future and schedule callbacks. If the future is already done or cancelled, return False. Otherwise, change the future's state to cancelled, schedule the callbacks and return True. FT)r'_state_PENDING _CANCELLEDr9_Future__schedule_callbacks)rmsgs rcancelz Future.cancels9 % ;;( "  " !!#rc|jdd}|syg|jdd|D]#\}}|jj|||%y)zInternal: Ask the event loop to call all callbacks. The callbacks are scheduled to be called as soon as possible. Also clears the callback list. Nr-)rr call_soon)r callbackscallbackctxs r__schedule_callbackszFuture.__schedule_callbackssM OOA&  &MHc JJ 4 ='rc(|jtk(S)z(Return True if the future was cancelled.)r>r@r s r cancelledzFuture.cancelleds{{j((rc(|jtk7S)zReturn True if the future is done. Done means either that a result / exception are available, or that the future was cancelled. )r>r?r s rdonez Future.dones {{h&&rc |jtk(r|j|jtk7rt j dd|_|j%|jj|j|jS)aReturn the result this future represents. If the future has been cancelled, raises CancelledError. If the future's result isn't yet available, raises InvalidStateError. If the future is done and has an exception set, this exception is raised. zResult is not ready.F) r>r@r< _FINISHEDr InvalidStateErrorr'r(with_traceback _exception_tb_resultr s rresultz Future.resultst ;;* $,,. . ;;) #../EF F$ ?? &//001C1CD D||rc|jtk(r|j|jtk7rt j dd|_|jS)a&Return the exception that was set on this future. The exception (or None if no exception was set) is returned only if the future is done. If the future has been cancelled, raises CancelledError. If the future isn't done yet, raises InvalidStateError. zException is not set.F)r>r@r<rPr rQr'r(r s rr$zFuture.exceptionsO ;;* $,,. . ;;) #../FG G$rrEc|jtk7r|jj|||y|t j }|j j||fy)zAdd a callback to be run when the future becomes done. The callback is called with a single argument - the future object. If the future is already done when this is called, the callback is scheduled with call_soon. rEN)r>r?rrF contextvars copy_contextrappend)rfnr-s radd_done_callbackzFuture.add_done_callbacksR ;;( " JJ T7 ;%224 OO " "B= 1rc|jDcgc]\}}||k7r||f}}}t|jt|z }|r||jdd|Scc}}w)z}Remove all instances of a callback from the "call when done" list. Returns the number of callbacks removed. N)rlen)rr[frIfiltered_callbacks removed_counts rremove_done_callbackzFuture.remove_done_callbacksn /3oo*.=(1c!"b !#h.= *DOO,s3E/FF !3DOOA  *sAc|jtk7r$tj|jd|||_t |_|j y)zMark the future done and set its result. If the future is already done when this method is called, raises InvalidStateError. : N)r>r?r rQrTrPrA)rrUs r set_resultzFuture.set_resultsJ ;;( "..$++b/IJ J   !!#rcj|jtk7r$tj|jd|t |t r|}t |t rtd}||_||_ |}||_ |j|_ t|_|jd|_y)zMark the future done and set an exception. If the future is already done when this method is called, raises InvalidStateError. rdzPStopIteration interacts badly with generators and cannot be raised into a FutureTN)r>r?r rQ isinstancetype StopIterationr5 __cause__r;r( __traceback__rSrPrAr')rr$new_excs r set_exceptionzFuture.set_exceptions ;;( "..$++b/IJ J i &! I i /"$,-G!*G "+G I#&44  !!##rc#K|js d|_||js td|jSw)NTzawait wasn't used with future)rN_asyncio_future_blockingr5rUr s r __await__zFuture.__await__s=yy{,0D )Jyy{>? ?{{}sAA r)%r* __module__ __qualname____doc__r?r>rTr(rrr9r8ror'rr!r. classmethodr__class_getitem__propertyr0setterr6r<rCrArLrNrUr$r\rbrermrp__iter__rrrrs&FGJ EON %O#" /3 $L1 $$%% (  >) ' 04 2  $$.Hrrc^ |j}|S#t$rY|jSwxYwr)r6AttributeErrorr)futr6s r _get_loopr}-s:<<z    99  s  ,,cH|jry|j|y)z?Helper setting the result only if the future was not cancelled.N)rLre)r|rUs r_set_result_unless_cancelledr9s }}NN6rclt|}|tjjurt j|j S|tjj urt j |j S|tjjurt j|j S|Sr)rh concurrentfuturesr:r args TimeoutErrorrQ)r, exc_classs r_convert_future_excr@sS IJ&&555((#((33 j((55 5&&11 j((:: :++SXX66 rc |jr|j|jsy|j}||jt |y|j }|j|y)z8Copy state from a future to a concurrent.futures.Future.N)rLrCset_running_or_notify_cancelr$rmrrUre)rsourcer$rUs r_set_concurrent_future_staterLst  2: 2 2 4  "I   !4Y!?@ f%rc|jry|jr|jy|j}||jt |y|j }|j |y)zqInternal helper to copy state from another Future. The other Future may be a concurrent.futures.Future. N)rLrCr$rmrrUre)rdestr$rUs r_copy_future_stater[se  ~~  $$&    29= >]]_F OOF #rcts/ttjjs t dts/ttjjs t dtr t ndtr t nddfd}fd}j|j|y)aChain two futures so that when one completes, so does the other. The result (or exception) of source will be copied to destination. If destination is cancelled, source gets cancelled too. Compatible with both asyncio.Future and concurrent.futures.Future. z(A future is required for source argumentz-A future is required for destination argumentNcLt|r t||yt||yr)rrr)r%others r _set_statez!_chain_future.._set_states F  uf - ( 7rc|jr3urjyjjyyr)rLrCcall_soon_threadsafe) destination dest_loopr source_loops r_call_check_cancelz)_chain_future.._call_check_cancels<  ""kY&> 00? #rcjrjryur |yjryj|yr)rL is_closedr)rrrrrs r_call_set_statez&_chain_future.._call_set_states[  ! ! #%)*=*=*?    [ 8 {F +""$  * *:{F Kr)rrgrrr TypeErrorr}r\)rrrrrrrs`` @@@r _chain_futureros F Jv/9/A/A/H/H%JBCC K K4>4F4F4M4M*OGHH'/'7)F#TK*2;*? +&TI8 @ L!!"45 _-rr ct|r|S|tj}|j}t |||S)z&Wrap concurrent.futures.Future object.)rr r create_futurer)r%r new_futures rrrsB  |$$&##%J&*% r) rs__all__concurrent.futuresrrXloggingrtypesrrr r r rr?r@rPDEBUG STACK_DEBUGr _PyFuturer}rrrrrr_asyncio_CFuture ImportErrorryrrrs4        $ $  " " mma HHX     &$().X!% ( !'FX   sB**B21B2__pycache__/protocols.cpython-312.opt-2.pyc000064400000007273152527367570014477 0ustar00 {|j-| dZGddZGddeZGddeZGddeZGd d eZd Zy ) ) BaseProtocolProtocolDatagramProtocolSubprocessProtocolBufferedProtocolc*eZdZ dZdZdZdZdZy)rcyNr)self transports */usr/lib64/python3.12/asyncio/protocols.pyconnection_madezBaseProtocol.connection_made cyr rr excs r connection_lostzBaseProtocol.connection_lostrrcyr rr s r pause_writingzBaseProtocol.pause_writing%s rcyr rrs r resume_writingzBaseProtocol.resume_writing; rN)__name__ __module__ __qualname__ __slots__rrrrrrr rr s"I   , rrceZdZ dZdZdZy)rrcyr r)r datas r data_receivedzProtocol.data_received^rrcyr rrs r eof_receivedzProtocol.eof_receiveddrrN)rrrrr"r$rrr rrBs2I  rrc$eZdZ dZdZdZdZy)rrcyr r)r sizehints r get_bufferzBufferedProtocol.get_buffers rcyr r)r nbytess r buffer_updatedzBufferedProtocol.buffer_updated rcyr rrs r r$zBufferedProtocol.eof_receivedrrN)rrrrr(r+r$rrr rrms.I    rrceZdZ dZdZdZy)rrcyr r)r r!addrs r datagram_receivedz"DatagramProtocol.datagram_receiveds4rcyr rrs r error_receivedzDatagramProtocol.error_receivedrrN)rrrrr1r3rrr rrs*I5 rrc$eZdZ dZdZdZdZy)rrcyr r)r fdr!s r pipe_data_receivedz%SubprocessProtocol.pipe_data_receivedr,rcyr r)r r6rs r pipe_connection_lostz'SubprocessProtocol.pipe_connection_lostr,rcyr rrs r process_exitedz!SubprocessProtocol.process_exiteds0rN)rrrrr7r9r;rrr rrs6I  1rrct|}|rr|j|}t|}|s td||k\r||d||j|y|d||d||j|||d}t|}|rqyy)Nz%get_buffer() returned an empty buffer)lenr( RuntimeErrorr+)protor!data_lenbufbuf_lens r _feed_data_to_buffered_protorCs4yH x(c(FG G h !C N   *  'NCM   )>D4yH rN)__all__rrrrrrCrrr rEsQ%  6 6 r( |( V2 |2 j  |  11.!r__pycache__/threads.cpython-312.opt-2.pyc000064400000001445152527367570014100 0ustar00 {|j, ddlZddlZddlmZdZdZy)N)events) to_threadcK tj}tj}t j |j |g|i|}|jd|d{S7w)N)rget_running_loop contextvars copy_context functoolspartialrunrun_in_executor)funcargskwargsloopctx func_calls (/usr/lib64/python3.12/asyncio/threads.pyrr sb  " " $D  " " $C!!#''4A$A&AI%%dI6 66 6sA#A,%A*&A,)r rr__all__rrrs<  7r__pycache__/transports.cpython-312.opt-2.pyc000064400000020722152527367570014664 0ustar00 {|j) dZGddZGddeZGddeZGddeeZGd d eZGd d eZGd deZy)) BaseTransport ReadTransportWriteTransport TransportDatagramTransportSubprocessTransportc:eZdZ dZd dZd dZdZdZdZdZ y) r_extraNc|i}||_yNr )selfextras +/usr/lib64/python3.12/asyncio/transports.py__init__zBaseTransport.__init__s =E c< |jj||Sr )r get)r namedefaults rget_extra_infozBaseTransport.get_extra_infos1{{tW--rc tr NotImplementedErrorr s r is_closingzBaseTransport.is_closings @!!rc tr rrs rclosezBaseTransport.close "!rc tr r)r protocols r set_protocolzBaseTransport.set_protocol%s !!!rc tr rrs r get_protocolzBaseTransport.get_protocol)s *!!rr ) __name__ __module__ __qualname__ __slots__rrrrr!r#rrrr s($I .""""rrc$eZdZ dZdZdZdZy)rr(c tr rrs r is_readingzReadTransport.is_reading3s 8!!rc tr rrs r pause_readingzReadTransport.pause_reading7 "!rc tr rrs rresume_readingzReadTransport.resume_reading?r.rN)r$r%r&r'r+r-r0r(rrrr.s-I"""rrcDeZdZ dZd dZdZdZdZdZdZ d Z d Z y) rr(Nc tr rr highlows rset_write_buffer_limitsz&WriteTransport.set_write_buffer_limitsMs $"!rc tr rrs rget_write_buffer_sizez$WriteTransport.get_write_buffer_sizebs :!!rc tr rrs rget_write_buffer_limitsz&WriteTransport.get_write_buffer_limitsfs %"!rc tr r)r datas rwritezWriteTransport.writelr.rcJ dj|}|j|y)Nr)joinr=)r list_of_datar<s r writelineszWriteTransport.writelinests# xx % 4rc tr rrs r write_eofzWriteTransport.write_eof} "!rc tr rrs r can_write_eofzWriteTransport.can_write_eofs O!!rc tr rrs rabortzWriteTransport.abortrDrNN) r$r%r&r'r6r8r:r=rArCrFrHr(rrrrHs2.I"*"" """"rrceZdZ dZy)rr(N)r$r%r&r'r(rrrrs(Irrc eZdZ dZddZdZy)rr(Nc tr r)r r<addrs rsendtozDatagramTransport.sendtorrc tr rrs rrHzDatagramTransport.abortrDrr )r$r%r&r'rNrHr(rrrrs2I""rrc4eZdZdZdZdZdZdZdZdZ y) rr(c tr rrs rget_pidzSubprocessTransport.get_pids  !!rc tr rrs rget_returncodez"SubprocessTransport.get_returncoder.rc tr r)r fds rget_pipe_transportz&SubprocessTransport.get_pipe_transports 4!!rc tr r)r signals r send_signalzSubprocessTransport.send_signalr.rc tr rrs r terminatezSubprocessTransport.terminates "!rc tr rrs rkillzSubprocessTransport.kills "!rN) r$r%r&r'rRrTrWrZr\r^r(rrrrs%I"""" " "rrcNeZdZ dZd fd ZdZdZdZd dZd dZ dZ xZ S) _FlowControlMixin)_loop_protocol_paused _high_water _low_waterc`t||||_d|_|j y)NF)superrrarb_set_write_buffer_limits)r rloop __class__s rrz_FlowControlMixin.__init__s+  % %%'rc@|j}||jkry|js#d|_ |jj yy#t t f$rt$r4}|jjd|||jdYd}~yd}~wwxYw)NTzprotocol.pause_writing() failedmessage exception transportr ) r8rcrb _protocol pause_writing SystemExitKeyboardInterrupt BaseExceptionracall_exception_handler)r sizeexcs r_maybe_pause_protocolz'_FlowControlMixin._maybe_pause_protocols))+ 4## # $$$(D ! ,,.% 12    11@!$!% $ 3 sAB)*BBc<|jrA|j|jkr#d|_ |jj yyy#t t f$rt$r4}|jjd|||jdYd}~yd}~wwxYw)NFz protocol.resume_writing() failedrk) rbr8rdroresume_writingrqrrrsrart)r rvs r_maybe_resume_protocolz(_FlowControlMixin._maybe_resume_protocol's  ! !**,?$)D ! --/@ "  12    11A!$!% $ 3 sAB'*BBc2|j|jfSr )rdrcrs rr:z)_FlowControlMixin.get_write_buffer_limits7s!1!122rc| |d}nd|z}||dz}||cxk\rdk\sntd|d|d||_||_y)Nizhigh (z) must be >= low (z) must be >= 0) ValueErrorrcrdr3s rrgz*_FlowControlMixin._set_write_buffer_limits:sh <{ 3w ;!)Csa 23'HJ J rcJ|j|||jy)N)r4r5)rgrwr3s rr6z)_FlowControlMixin.set_write_buffer_limitsJs! %%4S%9 ""$rctr rrs rr8z'_FlowControlMixin.get_write_buffer_sizeNs!!rrI) r$r%r&r'rrwrzr:rgr6r8 __classcell__)ris@rr`r`s3 KI($ 3 %"rr`N)__all__rrrrrrr`r(rrrsj  """"J"M"4I"]I"X ~0" "23"-3"lT" T"r__pycache__/subprocess.cpython-312.opt-2.pyc000064400000027262152527367570014643 0ustar00 {|j92dZddlZddlmZddlmZddlmZddlmZddlmZejZ ejZ ejZ Gd d ejejZGd d Zdddej fd Zdddej ddZy))create_subprocess_execcreate_subprocess_shellN)events) protocols)streams)tasks)loggercJeZdZ fdZdZdZdZdZdZdZ dZ xZ S) SubprocessStreamProtocolct||||_dx|_x|_|_d|_d|_g|_|jj|_ y)N)loopF) super__init___limitstdinstdoutstderr _transport_process_exited _pipe_fds_loop create_future _stdin_closed)selflimitr __class__s +/usr/lib64/python3.12/asyncio/subprocess.pyrz!SubprocessStreamProtocol.__init__sZ d# 155 5T[4;$!ZZ557cl|jjg}|j|jd|j|j|jd|j|j |jd|j dj dj|S)Nzstdin=zstdout=zstderr=z<{}> )r__name__rappendrrformatjoin)rinfos r__repr__z!SubprocessStreamProtocol.__repr__s''( :: ! KK&/ 0 ;; " KK'$++1 2 ;; " KK'$++1 2}}SXXd^,,rcn||_|jd}|ftj|j|j |_|j j||jjd|jd}|ftj|j|j |_ |jj||jjd|jd}|)tj||d|j |_ yy)Nrrrr)protocolreaderr) rget_pipe_transportr StreamReaderrrr set_transportrr#r StreamWriterr)r transportstdout_transportstderr_transportstdin_transports rconnection_madez(SubprocessStreamProtocol.connection_made(s#$77:  '!..T[[48JJ@DK KK % %&6 7 NN ! !! $$77:  '!..T[[48JJ@DK KK % %&6 7 NN ! !! $#66q9  & --o7;5937::?DJ 'rcx|dk(r |j}n|dk(r |j}nd}||j|yyNrr*)rr feed_data)rfddatar,s rpipe_data_receivedz+SubprocessStreamProtocol.pipe_data_received@s@ 7[[F 1W[[FF     T " rc |dk(rz|j}||j|j|||jj dy|jj |d|j_y|dk(r |j}n|dk(r |j}nd}|$||jn|j |||jvr|jj||jy)NrFrr*) rcloseconnection_lostr set_result set_exception_log_tracebackrrfeed_eofrremove_maybe_close_transport)rr9excpiper,s rpipe_connection_lostz-SubprocessStreamProtocol.pipe_connection_lostJs 7::D   %{""--d3  ""0055:""1  7[[F 1W[[FF  {!$$S)   NN ! !" % ##%rc2d|_|jy)NT)rrDrs rprocess_exitedz'SubprocessStreamProtocol.process_exitedhs# ##%rct|jdk(r/|jr"|jj d|_yyy)Nr)lenrrrr=rIs rrDz/SubprocessStreamProtocol._maybe_close_transportls: t~~ ! #(<(< OO ! ! #"DO)= #rc8||jur |jSyN)rr)rstreams r_get_close_waiterz*SubprocessStreamProtocol._get_close_waiterqs TZZ %% % r) r" __module__ __qualname__rr'r5r;rGrJrDrP __classcell__)rs@rr r s.:8-?0#&<&# &rr cZeZdZdZdZedZdZdZdZ dZ dZ d Z d Z d d Zy )Processc||_||_||_|j|_|j|_|j |_|j |_yrN)r _protocolrrrrget_pidpid)rr1r+rs rrzProcess.__init__wsH#! ^^ oo oo $$&rcPd|jjd|jdS)N)rr"rYrIs rr'zProcess.__repr__s&4>>**+1TXXJa88rc6|jjSrN)rget_returncoderIs r returncodezProcess.returncodes--//rcTK |jjd{S7wrN)r_waitrIs rwaitz Process.waits"M__**,,,,s (&(c:|jj|yrN)r send_signal)rsignals rrdzProcess.send_signals ##F+rc8|jjyrN)r terminaterIs rrgzProcess.terminates !!#rc8|jjyrN)rkillrIs rriz Process.kills rcK|jj} |=|jj||r t j d|t ||jjd{|rt j d||jjy77#ttf$r#}|rt j d||Yd}~bd}~wwxYww)Nz%%r communicate: feed stdin (%s bytes)z%r communicate: stdin got %rz%r communicate: close stdin) r get_debugrwriter debugrLdrainBrokenPipeErrorConnectionResetErrorr=)rinputrmrEs r _feed_stdinzProcess._feed_stdins $$& H    'LL?s5zS**""$ $ $  LL6 =  %!56 H ;T3G  HsAC)AB4:B2;B4?3C)2B44C&C!C)!C&&C)c KywrNrIs r_noopz Process._noops scK|jj|}|dk(r |j}n |j}|jj r |dk(rdnd}t jd|||jd{}|jj r |dk(rdnd}t jd|||j|S7Pw)Nr*rrrz%r communicate: read %sz%r communicate: close %s) rr-rrrrkr rmreadr=)rr9r1rOnameoutputs r _read_streamzProcess._read_streamsOO66r: 7[[F[[F ::   !!Qw8HD LL2D$ ?{{}$ ::   !!Qw8HD LL3T4 @ %sBC C ACNcK|j|j|}n|j}|j|j d}n|j}|j |j d}n|j}t j|||d{\}}}|jd{||fS7$7 wr7) rrrrurrzrr gatherrb)rrqrrrs r communicatezProcess.communicates :: !$$U+EJJLE ;; "&&q)FZZ\F ;; "&&q)FZZ\F&+ll5&&&I Ivviik!Js$B%C'C (CC CCrN)r"rQrRrr'propertyr_rbrdrgrirrrurzr}rtrrrUrUvsH'900-,$(" rrUc Ktj  fd} j||f|||d|d{\}}t|| S7w)NctSNr)r r)srz)create_subprocess_shell..7e=A Crrrr)rget_running_loopsubprocess_shellrU) cmdrrrrkwdsprotocol_factoryr1r+rs ` @rrrsm  " " $DC 5 5 5 !!!Ix 9h -- s6AAA)rrrrc Ktj  fd} j||g||||d|d{\}} t|| S7w)NctSrrr)srrz(create_subprocess_exec..rrr)rrsubprocess_execrU) programrrrrargsrrr1r+rs ` @rrrsy  " " $DC 4 4 4!!F ! !Ix 9h -- s9AAA)__all__ subprocessrrrr logr PIPESTDOUTDEVNULLFlowControlMixinSubprocessProtocolr rU_DEFAULT_LIMITrrrtrrrs =      b&w77(;;b&JU U p.2$t(/(>(> .8.task_doneJscd#  ($))+!  ' ' - >>  nn ; ##C(cX K|jd{|Xtjtj5t j |j d{ddd t \}}tj}tj}j||}j||j|j jd |d{}||t j }D]} | |us| j#y777#1swYxYw#t$rYywxYw7Z#t$t&f$rt($r} | |<|jYd} ~ yd} ~ wwxYwwr )wait contextlibsuppressexceptions_mod TimeoutErrorrwait_fornext StopIterationrEvent create_taskaddadd_done_callbacksetr current_taskcancel SystemExitKeyboardInterrupt BaseException) ok_to_startprevious_failed this_indexcoro_fn this_failednext_ok_to_start next_taskresultr)tedelay enum_coro_fnsrr run_one_cororr winner_index winner_results rr:z$staggered_race..run_one_coro[s    &$$^%@%@A nn_%9%9%;UCCC B "&}"5 Jkkm  ;;=$$\2BK%PQ )$##I. $ "9_F&L"M!--d3L"L(HHJ#a !D BA    %-.   %&Jz " OO   sF*E)F*(E)E*E.F*7EBF* E0E.E0"F*;F*EEF* E+(F**E++F*.E00F'F"F*"F''F*)returnN)rget_running_loop enumerater(rr$r%r&r' create_futurerCancelledErrorr*argsExceptionGroup)coro_fnsr8r propagate_cancellation_errorr. first_taskexrr9rrr:rrrr;r<s `` @@@@@@@@@rrr sV1f  ,6**,Dh'MMLJEM)"66p$( Kkkm %%l;&EF *%$$Y/'+$#113  *&&& $   ( 3. .lJ6 46J'!00 */1,)DDKK)* * 46JsaAD9A2D1C/C-C/D1 D1)D9-C//D."D)$D1)D..D11D66D9) __all__rrrrrrrrrrKs(L *37aKr__pycache__/subprocess.cpython-312.opt-1.pyc000064400000027451152527367570014642 0ustar00 {|j92dZddlZddlmZddlmZddlmZddlmZddlmZejZ ejZ ejZ Gd d ejejZGd d Zdddej fd Zdddej ddZy))create_subprocess_execcreate_subprocess_shellN)events) protocols)streams)tasks)loggercLeZdZdZfdZdZdZdZdZdZ dZ d Z xZ S) SubprocessStreamProtocolz0Like StreamReaderProtocol, but for a subprocess.ct||||_dx|_x|_|_d|_d|_g|_|jj|_ y)N)loopF) super__init___limitstdinstdoutstderr _transport_process_exited _pipe_fds_loop create_future _stdin_closed)selflimitr __class__s +/usr/lib64/python3.12/asyncio/subprocess.pyrz!SubprocessStreamProtocol.__init__sZ d# 155 5T[4;$!ZZ557cl|jjg}|j|jd|j|j|jd|j|j |jd|j dj dj|S)Nzstdin=zstdout=zstderr=z<{}> )r__name__rappendrrformatjoin)rinfos r__repr__z!SubprocessStreamProtocol.__repr__s''( :: ! KK&/ 0 ;; " KK'$++1 2 ;; " KK'$++1 2}}SXXd^,,rcn||_|jd}|ftj|j|j |_|j j||jjd|jd}|ftj|j|j |_ |jj||jjd|jd}|)tj||d|j |_ yy)Nrrrr)protocolreaderr) rget_pipe_transportr StreamReaderrrr set_transportrr#r StreamWriterr)r transportstdout_transportstderr_transportstdin_transports rconnection_madez(SubprocessStreamProtocol.connection_made(s#$77:  '!..T[[48JJ@DK KK % %&6 7 NN ! !! $$77:  '!..T[[48JJ@DK KK % %&6 7 NN ! !! $#66q9  & --o7;5937::?DJ 'rcx|dk(r |j}n|dk(r |j}nd}||j|yyNrr*)rr feed_data)rfddatar,s rpipe_data_receivedz+SubprocessStreamProtocol.pipe_data_received@s@ 7[[F 1W[[FF     T " rc |dk(rz|j}||j|j|||jj dy|jj |d|j_y|dk(r |j}n|dk(r |j}nd}|$||jn|j |||jvr|jj||jy)NrFrr*) rcloseconnection_lostr set_result set_exception_log_tracebackrrfeed_eofrremove_maybe_close_transport)rr9excpiper,s rpipe_connection_lostz-SubprocessStreamProtocol.pipe_connection_lostJs 7::D   %{""--d3  ""0055:""1  7[[F 1W[[FF  {!$$S)   NN ! !" % ##%rc2d|_|jy)NT)rrDrs rprocess_exitedz'SubprocessStreamProtocol.process_exitedhs# ##%rct|jdk(r/|jr"|jj d|_yyy)Nr)lenrrrr=rIs rrDz/SubprocessStreamProtocol._maybe_close_transportls: t~~ ! #(<(< OO ! ! #"DO)= #rc8||jur |jSyN)rr)rstreams r_get_close_waiterz*SubprocessStreamProtocol._get_close_waiterqs TZZ %% % r) r" __module__ __qualname____doc__rr'r5r;rGrJrDrP __classcell__)rs@rr r s.:8-?0#&<&# &rr cZeZdZdZdZedZdZdZdZ dZ dZ d Z d Z d d Zy )Processc||_||_||_|j|_|j|_|j |_|j |_yrN)r _protocolrrrrget_pidpid)rr1r+rs rrzProcess.__init__wsH#! ^^ oo oo $$&rcPd|jjd|jdS)N)rr"rZrIs rr'zProcess.__repr__s&4>>**+1TXXJa88rc6|jjSrN)rget_returncoderIs r returncodezProcess.returncodes--//rcRK|jjd{S7w)z?Wait until the process exit and return the process return code.N)r_waitrIs rwaitz Process.waits__**,,,,s '%'c:|jj|yrN)r send_signal)rsignals rrezProcess.send_signals ##F+rc8|jjyrN)r terminaterIs rrhzProcess.terminates !!#rc8|jjyrN)rkillrIs rrjz Process.kills rcK|jj} |=|jj||r t j d|t ||jjd{|rt j d||jjy77#ttf$r#}|rt j d||Yd}~bd}~wwxYww)Nz%%r communicate: feed stdin (%s bytes)z%r communicate: stdin got %rz%r communicate: close stdin) r get_debugrwriter debugrLdrainBrokenPipeErrorConnectionResetErrorr=)rinputrnrEs r _feed_stdinzProcess._feed_stdins $$& H    'LL?s5zS**""$ $ $  LL6 =  %!56 H ;T3G  HsAC)AB4:B2;B4?3C)2B44C&C!C)!C&&C)c KywrNrIs r_noopz Process._noops scK|jj|}|dk(r |j}n |j}|jj r |dk(rdnd}t jd|||jd{}|jj r |dk(rdnd}t jd|||j|S7Pw)Nr*rrrz%r communicate: read %sz%r communicate: close %s) rr-rrrrlr rnreadr=)rr9r1rOnameoutputs r _read_streamzProcess._read_streamsOO66r: 7[[F[[F ::   !!Qw8HD LL2D$ ?{{}$ ::   !!Qw8HD LL3T4 @ %sBC C ACNcK|j|j|}n|j}|j|j d}n|j}|j |j d}n|j}t j|||d{\}}}|jd{||fS7$7 wr7) rrsrvrr{rr gatherrc)rrrrrrs r communicatezProcess.communicates :: !$$U+EJJLE ;; "&&q)FZZ\F ;; "&&q)FZZ\F&+ll5&&&I Ivviik!Js$B%C'C (CC CCrN)r"rQrRrr'propertyr`rcrerhrjrsrvr{r~rurrrVrVvsH'900-,$(" rrVc Ktj  fd} j||f|||d|d{\}}t|| S7w)NctSNr)r r)srz)create_subprocess_shell..7e=A Crrrr)rget_running_loopsubprocess_shellrV) cmdrrrrkwdsprotocol_factoryr1r+rs ` @rrrsm  " " $DC 5 5 5 !!!Ix 9h -- s6AAA)rrrrc Ktj  fd} j||g||||d|d{\}} t|| S7w)NctSrrr)srrz(create_subprocess_exec..rrr)rrsubprocess_execrV) programrrrrargsrrr1r+rs ` @rrrsy  " " $DC 4 4 4!!F ! !Ix 9h -- s9AAA)__all__ subprocessrrrr logr PIPESTDOUTDEVNULLFlowControlMixinSubprocessProtocolr rV_DEFAULT_LIMITrrrurrrs =      b&w77(;;b&JU U p.2$t(/(>(> .8ej@Z!Gdde!Z"Gdde!ejFZ$y#e $rdZ YwxYw#e$rdZYpwxYw))BaseSelectorEventLoopN) base_events) constants)events)futures) protocols)sslproto) transports)trsock)loggersendmsg SC_IOV_MAXFct |j|}t|j|zS#t$rYywxYwNF)get_keyboolrKeyError)selectorfdeventkeys 0/usr/lib64/python3.12/asyncio/selector_events.py_test_selector_eventr*sA(r"CJJ&'' s + 77ceZdZ d2fd Zd2ddddZ d2ddddej ejddZ d3dZ fd Z d Z d Z d Z d ZdZdddej ejfdZdddej ejfdZddej ejfdZdZdZdZdZdZdZdZdZdZdZd2dZdZdZd Z d!Z!d"Z"d4d#Z#d$Z$d%Z%d&Z&d'Z'd(Z(d)Z)d*Z*d2d+Z+d,Z,d-Z-d.Z.d/Z/d0Z0d1Z1xZ2S)5rNct||tj}t j d|j j||_|jtj|_ y)NzUsing selector: %s) super__init__ selectorsDefaultSelectorr debug __class____name__ _selector_make_self_pipeweakrefWeakValueDictionary _transports)selfrr"s rrzBaseSelectorEventLoop.__init__;sa    002H )8+=+=+F+FG! "668extraservercD|j|t||||||SN)_ensure_fd_no_transport_SelectorSocketTransport)r)sockprotocolwaiterr,r-s r_make_socket_transportz,BaseSelectorEventLoop._make_socket_transportEs* $$T*'dHf(-v7 7r*F) server_sideserver_hostnamer,r-ssl_handshake_timeoutssl_shutdown_timeoutc |j|tj||||||| | } t||| ||| jS)N)r8r9r+)r0r SSLProtocolr1_app_transport) r)rawsockr3 sslcontextr4r6r7r,r-r8r9 ssl_protocols r_make_ssl_transportz)BaseSelectorEventLoop._make_ssl_transportKsW $$W-++ (J "7!5  !w ',V =***r*cD|j|t||||||Sr/)r0_SelectorDatagramTransport)r)r2r3addressr4r,s r_make_datagram_transportz.BaseSelectorEventLoop._make_datagram_transport]s, $$T*)$h*165B Br*c|jr td|jry|jt||j "|j j d|_yy)Nz!Cannot close a running event loop) is_running RuntimeError is_closed_close_self_pipercloser$r)r"s rrJzBaseSelectorEventLoop.closecsa ?? BC C >>      >> % NN "!DN &r*c|j|jj|jjd|_|jjd|_|xj dzc_y)Nr)_remove_reader_ssockfilenorJ_csock _internal_fdsr)s rrIz&BaseSelectorEventLoop._close_self_pipens\ DKK..01     ar*cDtj\|_|_|jj d|jj d|xj dz c_|j |jj|jy)NFr) socket socketpairrNrP setblockingrQ _add_readerrO_read_from_selfrRs rr%z%BaseSelectorEventLoop._make_self_pipevsq#)#4#4#6  T[ & & a ++-t/C/CDr*cyr/r)datas r_process_self_dataz(BaseSelectorEventLoop._process_self_data~s r*c |jjd}|sy|j|1#t$rY=t$rYywxYw)Ni)rNrecvr]InterruptedErrorBlockingIOErrorr[s rrXz%BaseSelectorEventLoop._read_from_selfsV {{''-''-  $ "  s33 A A A c|j}|y |jdy#t$r(|jrt j ddYyYywxYw)Nz3Fail to write a null byte into the self-pipe socketTexc_info)rPsendOSError_debugr r!)r)csocks r_write_to_selfz$BaseSelectorEventLoop._write_to_selfsU   =  , JJu  ,{{ 0&*, ,s#,AAdc f|j|j|j||||||| yr/)rWrO_accept_connection)r)protocol_factoryr2r>r-backlogr8r9s r_start_servingz$BaseSelectorEventLoop._start_servings4 (?(?)4VW.0D Fr*c t|D]w} |j\} } |jrtjd|| | | j dd| i} |j || | ||||} |j| yy#tttf$rYyt$r} | jtjtjtjtj fvry|j#d| t%j&|d|j)|j+|j-t.j0|j2||||||| nYd} ~ dd} ~ wwxYw)Nz#%r got a new connection from %r: %rFpeernamez&socket.accept() out of system resource)message exceptionrT)rangeacceptrhr r!rV_accept_connection2 create_taskrar`ConnectionAbortedErrorrgerrnoEMFILEENFILEENOBUFSENOMEMcall_exception_handlerr TransportSocketrMrO call_laterrACCEPT_RETRY_DELAYrp)r)rnr2r>r-ror8r9_connaddrr,rvexcs rrmz(BaseSelectorEventLoop._accept_connectionsXwA" )![[] d;;LL!F!'t5  '2$T*11$dE:v)+?A  (G $%57MN  99u||!& !>> //#K%("("8"8">1 '' 6OOI$@$@$($7$7$4dJ$+-B$8 :  : sABE5E5&CE00E5c Kd}d} |}|j} |r|j|||| d|||| } n|j||| ||} | d{y7#t$r| j d} wxYw#t t f$rt$r?} |jr)d| d} ||| d<| | | d<|j| Yd} ~ yYd} ~ yd} ~ wwxYww)NT)r4r6r,r-r8r9)r4r,r-z3Error on transport creation for incoming connection)rsrtr3 transport) create_futurer@r5 BaseExceptionrJ SystemExitKeyboardInterruptrhr) r)rnrr,r>r-r8r9r3rr4rcontexts rrwz)BaseSelectorEventLoop._accept_connection2s  & 5')H'')F 44(Jv $E&*?)= 5? !77(6!8#     !  -.   5{{N!$ '*2GJ'(+4GK(++G44 5sSCA BA AA CA A==BC0C CCCc*|}t|ts t|j} |j |}|jstd|d|y#ttt f$rt d|dwxYw#t$rYywxYw)NzInvalid file object: zFile descriptor z is used by transport ) isinstanceintrOAttributeError TypeError ValueErrorr( is_closingrGr)r)rrOrs rr0z-BaseSelectorEventLoop._ensure_fd_no_transports&#& KV]]_- &((0I'')"&rf,B m%&&*#Iz: K #8!?@dJ K    sAB$B BBc|jtj|||d} |jj |}|j|j c}\}}|jj ||tjz||f||j|S#t$r1|jj|tj|dfY|SwxYwr/) _check_closedrHandler$rr\modifyr EVENT_READcancelrregister r)rcallbackargshandlermaskreaderwriters rrWz!BaseSelectorEventLoop._add_readers xtT: ..((,C &)ZZ "D"66 NN ! !"dY-A-A&A#)6"2 4!   4 NN # #B (<(<%+TN 4  4B%%6CCc||jry |jj|}|j|jc}\}}|t j z}|s|jj|n|jj||d|f||jyy#t$rYywxYwNFT) rHr$rrr\rr unregisterrrrr)rrrrrs rrMz$BaseSelectorEventLoop._remove_reader&s >>  ..((,C&)ZZ "D"66 Y))) )D))"-%%b$v?!   sB// B;:B;c|jtj|||d} |jj |}|j|j c}\}}|jj ||tjz||f||j|S#t$r1|jj|tjd|fY|SwxYwr/) rrrr$rr\rr EVENT_WRITErrrrs r _add_writerz!BaseSelectorEventLoop._add_writer;s xtT: ..((,C &)ZZ "D"66 NN ! !"dY-B-B&B#)6"2 4!   4 NN # #B (=(=%)6N 4  4rc~ |jry |jj|}|j|jc}\}}|t j z}|s|jj|n|jj|||df||jyy#t$rYywxYwr) rHr$rrr\rrrrrrrs r_remove_writerz$BaseSelectorEventLoop._remove_writerKs' >>  ..((,C&)ZZ "D"66 Y*** *D))"-%%b$?!   sB00 B<;B<cP |j||j||g|yr/)r0rWr)rrrs r add_readerz BaseSelectorEventLoop.add_readerbs*$ $$R(X--r*cH |j||j|Sr/)r0rMr)rs r remove_readerz#BaseSelectorEventLoop.remove_readerg$' $$R(""2&&r*cP |j||j||g|yr/)r0rrs r add_writerz BaseSelectorEventLoop.add_writerls*% $$R(X--r*cH |j||j|Sr/)r0rrs r remove_writerz#BaseSelectorEventLoop.remove_writerqrr*cK tj||jr|jdk7r t d |j |S#t tf$rYnwxYw|j}|j}|j||j||j|||}|jtj|j |||d{7SwNrthe socket must be non-blockingr)r_check_ssl_socketrh gettimeoutrr_rar`rrOr0rW _sock_recvadd_done_callback functoolspartial_sock_read_done)r)r2nfutrrs r sock_recvzBaseSelectorEventLoop.sock_recvvs %%d+ ;;4??,1>? ? 99Q< !12     " [[] $$R(!!"doosD!D    d22Bv F Hyy7AC6AC6A'$C6&A''B C60C31C6cL||js|j|yyr/) cancelledrr)rrrs rrz%BaseSelectorEventLoop._sock_read_done% >!1!1!3   r ""4r*c|jry |j|}|j|y#ttf$rYyt t f$rt$r}|j|Yd}~yd}~wwxYwr/) doner_ set_resultrar`rrr set_exception)r)rr2rr\rs rrz BaseSelectorEventLoop._sock_recvsu 88:  !99Q? ? >>#& &!12     " [[] $$R(!!"d&:&:CsK    d22Bv F Hyyrc|jry |j|}|j|y#ttf$rYyt t f$rt$r}|j|Yd}~yd}~wwxYwr/) rrrrar`rrrr)r)rr2rnbytesrs rrz%BaseSelectorEventLoop._sock_recv_intosv 88:  #^^C(F NN6 " !12  -.   #   c " " #rcK tj||jr|jdk7r t d |j |S#t tf$rYnwxYw|j}|j}|j||j||j|||}|jtj|j |||d{7Swr)rrrhrrrecvfromrar`rrOr0rW_sock_recvfromrrrr)r)r2bufsizerrrs r sock_recvfromz#BaseSelectorEventLoop.sock_recvfroms  %%d+ ;;4??,1>? ? ==) )!12     " [[] $$R(!!"d&9&93gN    d22Bv F Hyyrc|jry |j|}|j|y#ttf$rYyt t f$rt$r}|j|Yd}~yd}~wwxYwr/) rrrrar`rrrr)r)rr2rresultrs rrz$BaseSelectorEventLoop._sock_recvfromsv 88:  #]]7+F NN6 " !12  -.   #   c " " #rcK tj||jr|jdk7r t d|s t |} |j ||S#ttf$rYnwxYw|j}|j}|j||j||j||||}|jtj |j"|||d{7Swr)rrrhrrlen recvfrom_intorar`rrOr0rW_sock_recvfrom_intorrrr)r)r2rrrrrs rsock_recvfrom_intoz(BaseSelectorEventLoop.sock_recvfrom_intos %%d+ ;;4??,1>? ?XF %%c62 2!12     " [[] $$R(!!"d&>&>T3"(*    d22Bv F Hyys7ADA#"D#A52D4A55B D?DDc|jry |j||}|j|y#ttf$rYyt t f$rt$r}|j|Yd}~yd}~wwxYwr/) rrrrar`rrrr)r)rr2rrrrs rrz)BaseSelectorEventLoop._sock_recvfrom_intosz 88:  #''W5F NN6 " !12  -.   #   c " " #s7A:A:A55A:c *K tj||jr|jdk7r t d |j |}|t|k(ry|j}|j}|j||j||j||t||g}|jt!j"|j$|||d{S#t tf$rd}YwxYw7wr)rrrhrrrfrar`rrrOr0r _sock_sendall memoryviewrrr_sock_write_done)r)r2r\rrrrs r sock_sendallz"BaseSelectorEventLoop.sock_sendalls  %%d+ ;;4??,1>? ?  $A D >   " [[] $$R(!!"d&8&8#t",T"2QC9    d33R G Iy !12 A s7ADC:B D5D6D:D D DDc:|jry|d} |j||d}||z }|t|k(r|jdy||d<y#ttf$rYytt f$rt $r}|j|Yd}~yd}~wwxYwNr) rrfrar`rrrrrr)r)rr2viewposstartrrs rrz#BaseSelectorEventLoop._sock_sendall7s 88: A  $uv,'A   CI  NN4 CF !12  -.      c "  sAB(B?BBcK tj||jr|jdk7r t d |j ||S#t tf$rYnwxYw|j}|j}|j||j||j||||}|jtj|j |||d{7Swr)rrrhrrsendtorar`rrOr0r _sock_sendtorrrr)r)r2r\rCrrrs r sock_sendtoz!BaseSelectorEventLoop.sock_sendtoMs  %%d+ ;;4??,1>? ? ;;tW- -!12     " [[] $$R(!!"d&7&7dD")+    d33R G Iyys7AC8AC8A(%C8'A((B C82C53C8c|jry |j|d|}|j|y#ttf$rYyt t f$rt$r}|j|Yd}~yd}~wwxYwr) rrrrar`rrrr)r)rr2r\rCrrs rrz"BaseSelectorEventLoop._sock_sendtohsx 88:   D!W-A NN1  !12  -.   #   c " " #s8A; A; A66A;c"K tj||jr|jdk7r t d|j t jk(s-tjrd|j t jk(rG|j||j |j|j|d{}|d\}}}}}|j}|j||| |d{d}S7?7#d}wxYww)Nrr)familytypeprotoloop)rrrhrrrrTAF_INET _HAS_IPv6AF_INET6_ensure_resolvedrrr _sock_connect)r)r2rCresolvedrrs r sock_connectz"BaseSelectorEventLoop.sock_connectws  %%d+ ;;4??,1>? ? ;;&.. (%%$++*H!22 $))4::3H#+1+ Aq!Q  " 3g. 9CCs<CDD2D8D=D>DDDD  Dc|j} |j||jdd}y#ttf$rf|j ||j ||j|||}|jtj|j||Yd}yttf$rt$r}|j|Yd}~d}yd}~wwxYw#d}wxYw)Nr)rOconnectrrar`r0r_sock_connect_cbrrrrrrrr)r)rr2rCrrrs rrz#BaseSelectorEventLoop._sock_connects [[]  LL ! NN4 C# !12 M  ( ( ,%%D))3g?F  ! !!!$"7"7FK MC-.   #   c " "C  # Cs97C"A0C'C"+CCC"CC""C&cL||js|j|yyr/)rrrs rrz&BaseSelectorEventLoop._sock_write_donerr*cv|jry |jtjtj}|dk7rt |d| |j dd}y#ttf$rYd}yttf$rt$r}|j|Yd}~d}yd}~wwxYw#d}wxYw)NrzConnect call failed ) r getsockoptrT SOL_SOCKETSO_ERRORrgrrar`rrrr)r)rr2rCerrrs rrz&BaseSelectorEventLoop._sock_connect_cbs 88:  //&"3"3V__ECaxc%9'#CDD NN4 C !12  C-.   #   c " "C  # Cs<AA*B4*B19B4=B1B,%B4,B11B44B8cK tj||jr|jdk7r t d|j }|j |||d{S7w)Nrr)rrrhrrr _sock_accept)r)r2rs r sock_acceptz!BaseSelectorEventLoop.sock_acceptsd  %%d+ ;;4??,1>? ?  " #t$yysA(A1*A/+A1c|j} |j\}}|jd|j||fy#tt f$rc|j ||j||j||}|jtj|j||Yyttf$rt$r}|j!|Yd}~yd}~wwxYw)NFr)rOrvrVrrar`r0rWr rrrrrrrr)r)rr2rrrCrrs rr z"BaseSelectorEventLoop._sock_accepts [[] , KKMMD'   U # NND'? + !12 L  ( ( ,%%b$*;*;S$GF  ! !!!$"6"66J L-.   #   c " " #s$A A/C-;C-C((C-cK|j|j=|j}|j|j d{ |j |j |||dd{|j|r|j||j|j<S7h7A#|j|r|j||j|j<wxYww)NF)fallback) r(_sock_fd is_reading pause_reading_make_empty_waiter sock_sendfile_sock_reset_empty_waiterresume_reading)r)transpfileoffsetcountrs r_sendfile_nativez&BaseSelectorEventLoop._sendfile_natives   V__ -**,''))) 7++FLL$5:,<<  & & (%%'06D  V__ - *<  & & (%%'06D  V__ -s<A C: B6C:#B:6B87B::=C:8B::=C77C:cd|D]\}}|j|jc}\}}|tjzr1|/|jr|j |n|j ||tjzsz|}|jr|j||j |yr/) fileobjr\rr _cancelledrM _add_callbackrr)r) event_listrrrrrs r_process_eventsz%BaseSelectorEventLoop._process_eventss#IC(+ SXX %G%ffi***v/A$$''0&&v.i+++0B$$''0&&v.$r*cb|j|j|jyr/)rMrOrJ)r)r2s r _stop_servingz#BaseSelectorEventLoop._stop_servings DKKM* r*r/NNN)r)3r# __module__ __qualname__rr5rSSL_HANDSHAKE_TIMEOUTSSL_SHUTDOWN_TIMEOUTr@rDrJrIr%r]rXrjrprmrwr0rWrMrrrrrrrrrrrrrrrrrrrrrrrr r rr r" __classcell__r"s@rrr5so 97%)$79=+ $t"+"A"A!*!?!? +&CGB " E  ,&#'tS-6-L-L,5,J,JFD#"+"A"A!*!?!? ,)`D"+"A"A!*!?!? -5^&$ * .. ' . ' ,#! *#".#"2#">,6 2.#* ," 7 /r*rceZdZdZdZdfd ZdZdZdZdZ dZ d Z d Z d Z d Zej fd ZddZdZdZdZdZxZS)_SelectorTransportiNct|||tj||jd< |j |jd<d|jvr |j|jd<||_ |j|_ d|_ |j|||_t!j"|_d|_d|_d|_|j|jj-||j.|j<y#t $rd|jd<YwxYw#tj$rd|jd<YwxYw)NrTsocknamerrFr)rrr r_extra getsocknamerg getpeernamerTerrorrrOr_protocol_connected set_protocol_server collectionsdeque_buffer _conn_lost_closing_paused_attachr()r)rr2r3r,r-r"s rrz_SelectorTransport.__init__ s8 % & 6 6t < H +&*&6&6&8DKK # T[[ ( /*.*:*:*< J'   #(  (# "((*   << # LL "*.'+ +&*DKK # + << /*. J' /s#D'!E'EE"E*)E*c|jjg}|j|jdn|jr|jd|jd|j |j |j jst|j j|j tj}|r|jdn|jdt|j j|j tj}|rd}nd}|j}|jd|d |d d jd j|S) Nclosedclosingzfd=z read=pollingz read=idlepollingidlezwrite=z<{}> )r"r#rappendr9r_looprHrr$rrrget_write_buffer_sizeformatjoin)r)infor?staters r__repr__z_SelectorTransport.__repr__'s$''( ::  KK ! ]] KK " c$--)* :: !$***>*>*@*4::+?+?+/==):N:NPG N+ K(*4::+?+?+/==+4+@+@BG!002G KK'% 7)1= >}}SXXd^,,r*c&|jdyr/) _force_closerRs rabortz_SelectorTransport.abortCs $r*c ||_d|_yNT) _protocolr2)r)r3s rr3z_SelectorTransport.set_protocolFs!#' r*c|jSr/)rPrRs r get_protocolz_SelectorTransport.get_protocolJs ~~r*c|jSr/)r9rRs rrz_SelectorTransport.is_closingMs }}r*cB|j xr |j Sr/)rr:rRs rrz_SelectorTransport.is_readingPs??$$9T\\)99r*c|jsyd|_|jj|j|jj rt jd|yy)NTz%r pauses reading)rr:rDrMr get_debugr r!rRs rrz _SelectorTransport.pause_readingSsP   !!$--0 ::   ! LL,d 3 "r*c|js |jsyd|_|j|j|j|j j rtjd|yy)NFz%r resumes reading) r9r:rWr _read_readyrDrVr r!rRs rrz!_SelectorTransport.resume_reading[sW ==   (8(89 ::   ! LL-t 4 "r*cP|jryd|_|jj|j|jsa|xj dz c_|jj |j|jj|jdyyNTr) r9rDrMrr7r8r call_soon_call_connection_lostrRs rrJz_SelectorTransport.closecss ==   !!$--0|| OOq O JJ % %dmm 4 JJ !;!;T Br*cv|j-|d|t||jjyy)Nzunclosed transport )source)rResourceWarningrJ)r)_warns r__del__z_SelectorTransport.__del__ms5 :: ! 'x0/$ O JJ    "r*ct|tr4|jjrDt j d||dn*|jj ||||jd|j|y)Nz%r: %sTrd)rsrtrr3) rrgrDrVr r!rrPrL)r)rrss r _fatal_errorz_SelectorTransport._fatal_errorrse c7 #zz##% XtWtD JJ - -" ! NN /  #r*c|jry|jr?|jj|jj |j |j s,d|_|jj|j |xjdz c_|jj|j|yrZ) r8r7clearrDrrr9rMr[r\)r)rs rrLz_SelectorTransport._force_closes ??  << LL   JJ % %dmm 4}} DM JJ % %dmm 4 1 T77=r*c |jr|jj||jj d|_d|_d|_|j }||jd|_yy#|jj d|_d|_d|_|j }||jd|_wwxYwr/)r2rPconnection_lostrrJrDr4_detach)r)rr-s rr\z(_SelectorTransport._call_connection_losts $''..s3 JJ   DJ!DNDJ\\F! # " JJ   DJ!DNDJ\\F! # "s 'A??ACcHttt|jSr/)summaprr7rRs rrEz(_SelectorTransport.get_write_buffer_sizes3sDLL)**r*cb|jsy|jj||g|yr/)rrDrWrs rrWz_SelectorTransport._add_readers*  r83d3r*)NN)zFatal error on transport)r#r$r%max_sizerrrJrMr3rRrrrrrJwarningswarnrarcrLr\rErWr(r)s@rr+r+skH E/8-8 (:45C%MM  > $+4r*r+ceZdZdZej j Z dfd ZfdZ dZ dZ dZ dZ d Zd Zd Zd ed dfdZdZdZdZdZfdZdZdZfdZxZS)r1TNcd|_t| |||||d|_d|_t r|j |_n|j|_tj|j|jj|jj||jj|j |j"|j$|,|jjt&j(|dyyr)_read_ready_cbrr_eof _empty_waiter _HAS_SENDMSG_write_sendmsg _write_ready _write_sendr _set_nodelayrrDr[rPconnection_maderWrrXr_set_result_unless_cancelled)r)rr2r3r4r,r-r"s rrz!_SelectorSocketTransport.__init__s# tXuf= !  $ 3 3D  $ 0 0D    , T^^;;TB T--!]]D,<,< >   JJ !E!E!' / r*ct|tjr|j|_n|j |_t ||yr/)rr BufferedProtocol_read_ready__get_bufferrr_read_ready__data_receivedrr3)r)r3r"s rr3z%_SelectorSocketTransport.set_protocols< h : : ;"&">">D "&"A"AD  X&r*c$|jyr/)rrrRs rrXz$_SelectorSocketTransport._read_readys r*c|jry |jjd}t|s t d |jj|}|s|jy |jj|y#t t f$rt$r}|j|dYd}~yd}~wwxYw#ttf$rYyt t f$rt$r}|j|dYd}~yd}~wwxYw#t t f$rt$r}|j|dYd}~yd}~wwxYw)Nz%get_buffer() returned an empty bufferz/Fatal error: protocol.get_buffer() call failed.$Fatal read error on socket transportz3Fatal error: protocol.buffer_updated() call failed.)r8rP get_bufferrrGrrrrcrrrar`_read_ready__on_eofbuffer_updated)r)rrrs rr~z0_SelectorSocketTransport._read_ready__get_buffersC ??  ..++B/Cs8"#JKK ZZ))#.F  $ $ &  L NN ) )& 1--.      F H   !12  -.      c#I J  -.   L   J L L LsM1B C1D C%B<<CDD,DD D?#D::D?c|jry |jj|j}|s|jy |jj|y#tt f$rYyt tf$rt$r}|j|dYd}~yd}~wwxYw#t tf$rt$r}|j|dYd}~yd}~wwxYw)Nrz2Fatal error: protocol.data_received() call failed.) r8rr_rmrar`rrrrcrrP data_received)r)r\rs rrz3_SelectorSocketTransport._read_ready__data_receiveds ??  ::??4==1D  $ $ &  K NN ( ( . !12  -.      c#I J  -.   K   I K K Ks5%A$B+$B(5B( B##B(+CCCcx|jjrtjd| |jj }|r&|jj|jy|jy#t tf$rt$r}|j|dYd}~yd}~wwxYw)Nz%r received EOFz1Fatal error: protocol.eof_received() call failed.) rDrVr r!rP eof_receivedrrrrcrMrrJ)r) keep_openrs rrz,_SelectorSocketTransport._read_ready__on_eof s ::   ! LL*D 1 335I  JJ % %dmm 4 JJL-.      H J  sBB9B44B9c<t|tttfs!t dt |j |jr td|j td|sy|jrH|jtjk\rtjd|xjdz c_ y|js] |j j#|}t||d}|sy|j0j3|j4|j6|jj9||j;y#t$t&f$rYmt(t*f$rt,$r}|j/|dYd}~yd}~wwxYw)N/data argument must be a bytes-like object, not z%Cannot call write() after write_eof()z(unable to write; sendfile is in progresssocket.send() raised exception.r%Fatal write error on socket transport)rbytes bytearrayrrrr#rsrGrtr8r!LOG_THRESHOLD_FOR_CONNLOST_WRITESr warningr7rrfrar`rrrrcrDrrrwrC_maybe_pause_protocol)r)r\rrs rwritez_SelectorSocketTransport.writes_$ : >?##':#6#6"9;< < 99FG G    )IJ J  ??)"M"MM@A OOq O || JJOOD)"$'+ JJ " "4==$2C2C D D! ""$!$%56  12   !!#'NO sEF(F?FFcJtj|jtSr/) itertoolsislicer7rrRs r_get_sendmsg_bufferz,_SelectorSocketTransport._get_sendmsg_bufferFs j99r*cr|jry |jj|j}|j ||j |j s|jj|j|j|jjd|jr|jdy|jr*|jjt j"yyy#t$t&f$rYyt(t*f$rt,$r}|jj|j|j j/|j1|d|j |jj3|Yd}~yYd}~yd}~wwxYwNr)r8rrr_adjust_leftover_buffer_maybe_resume_protocolr7rDrrrtrr9r\rsshutdownrTSHUT_WRrar`rrrrercr)r)rrs rrvz'_SelectorSocketTransport._write_sendmsgIsV ??  8ZZ''(@(@(BCF  ( ( 0  ' ' )<< ))$--8%%1&&11$7==..t4YYJJ''7   !12  -.   6 JJ % %dmm 4 LL     c#J K!!-""0055.  6s:DF6F6/A8F11F6rreturnc|j}|r?|j}t|}||kr||z}n|j||dy|r>yyr/)r7popleftr appendleft)r)rbufferbb_lens rrz0_SelectorSocketTransport._adjust_leftover_bufferesO AFE%!!!FG*-r*c|jry |jj}|jj |}|t |k7r|jj ||d|j|js|jj|j|j|jjd|jr|jdy|jr*|jj!t"j$yyy#t&t(f$rYyt*t,f$rt.$r}|jj|j|jj1|j3|d|j |jj5|Yd}~yYd}~yd}~wwxYwr)r8r7rrrfrrrrDrrrtrr9r\rsrrTrrar`rrrrercr)r)rrrs rrxz$_SelectorSocketTransport._write_sendpss ??  8\\))+F 'ACK ''qr 3  ' ' )<< ))$--8%%1&&11$7==..t4YYJJ''7   !12  -.   6 JJ % %dmm 4 LL     c#J K!!-""0055.  6sA!D..G?GA8GGc|js |jryd|_|js*|jj t j yyrO)r9rsr7rrrTrrRs r write_eofz"_SelectorSocketTransport.write_eofs; ==DII  || JJ   /r*c|jr td|j td|sy|jj |Dcgc] }t |c}|j |jrA|jj|j|j |jyycc}w)Nz*Cannot call writelines() after write_eof()z-unable to writelines; sendfile is in progress) rsrGrtr7extendrrwrDrrr)r) list_of_datar\s r writelinesz#_SelectorSocketTransport.writeliness 99KL L    )NO O  ,G,$Z-,GH  << JJ " "4==$2C2C D  & & ( Hs CcyrOrZrRs r can_write_eofz&_SelectorSocketTransport.can_write_eofsr*c t||d|_|j%|jj t dyy#d|_|j%|jj t dwwxYw)NzConnection is closed by peer)rr\rwrtrConnectionError)r)rr"s rr\z._SelectorSocketTransport._call_connection_losts E G )# . $D !!-""00#$BCE.!%D !!-""00#$BCE.s A :Bc|j td|jj|_|js|jj d|jS)NzEmpty waiter is already set)rtrGrDrr7rrRs rrz+_SelectorSocketTransport._make_empty_waitersV    )<= =!ZZ557||    ) )$ /!!!r*cd|_yr/)rtrRs rrz,_SelectorSocketTransport._reset_empty_waiters !r*c0d|_t| yr/)rrrrJrKs rrJz_SelectorSocketTransport.closes"  r*r#)r#r$r%_start_tls_compatibler _SendfileMode TRY_NATIVE_sendfile_compatiblerr3rXr~rrrrrvrrrxrrrr\rrrJr(r)s@rr1r1s $22==48$(/2'#LJK2*%%N:88 c d 8>0 )E""r*r1cVeZdZejZ dfd ZdZdZddZ dZ xZ S)rBcxt|||||||_d|_|jj |j j||jj |j|j|j|,|jj tj|dyyr) rr_address _buffer_sizerDr[rPrzrWrrXrr{)r)rr2r3rCr4r,r"s rrz#_SelectorDatagramTransport.__init__s tXu5  T^^;;TB T--!]]D,<,< >   JJ !E!E!' / r*c|jSr/)rrRs rrEz0_SelectorDatagramTransport.get_write_buffer_sizes   r*c|jry |jj|j\}}|jj ||y#t tf$rYyt$r%}|jj|Yd}~yd}~wttf$rt$r}|j|dYd}~yd}~wwxYw)Nz&Fatal read error on datagram transport)r8rrrmrPdatagram_receivedrar`rgerror_receivedrrrrcr)r\rrs rrXz&_SelectorDatagramTransport._read_readys ??  9,,T]];JD$ NN , ,T4 8 !12   / NN ) )# . .-.   M   c#K L L Ms)(AC%C-B  C(B??CcZt|tttfs!t dt |j |sy|jr4|d|jfvrtd|j|j}|jrT|jrH|jtjk\rtjd|xjdz c_ y|jsI |jdr|j j#|y|j j%||y|jjAt||f|xjBtE|z c_!|jGy#t&t(f$r3|j*j-|j.|j0Yt2$r%}|j4j7|Yd}~yd}~wt8t:f$rt<$r}|j?|dYd}~yd}~wwxYw)Nrz!Invalid address: must be None or rrrr'Fatal write error on datagram transport)$rrrrrrr#rrr8rrr rr7r.rrfrrar`rDrr _sendto_readyrgrPrrrrrcrCrrrrs rrz!_SelectorDatagramTransport.sendtos$ : >?##':#6#6"9;< <  ==D$--00 7 GII==D ??t}})"M"MM@A OOq O || ;;z*JJOOD)JJ%%dD1 U4[$/0 SY& ""$$%56 J &&t}}d6H6HI --c2 12   !!BD s0-*F F ?H* H*G33H*H%%H*cX|jr|jj\}}|xjt|zc_ |jdr|j j |n|j j|||jr|j%|jsD|j&j)|j*|j,r|j/dyyy#ttf$r>|jj||f|xjt|z c_Yt$r%}|jj|Yd}~yd}~wttf$rt $r}|j#|dYd}~yd}~wwxYw)Nrrr)r7rrrr.rrfrrar`rrgrPrrrrrcrrDrrr9r\rs rrz(_SelectorDatagramTransport._sendto_readysQll--/JD$   T *  ;;z*JJOOD)JJ%%dD1ll, ##%|| JJ % %dmm 4}}**40$%56  ''t 5!!SY.! --c2 12   !!BD s, AC>>A F) F)E22F) F$$F)r#r/) r#r$r%r5r6_buffer_factoryrrErXrrr(r)s@rrBrBs.!''O59$( /!9 *%X1r*rB)%__all__r5rzrrosrrTrnr&ssl ImportErrorrrrrr r r r logr hasattrrusysconfrrgr BaseEventLoopr_FlowControlMixin Transportr+r1DatagramTransportrBrZr*rrs #   v}}i0 RZZ - (I K55I X_455#--_4DZ1Zzl1!3Z5Q5Ql1Y% C$  s#C%9C2%C/.C/2C<;C<__pycache__/base_subprocess.cpython-312.pyc000064400000037320152527367570014671 0ustar00 {|j"ddlZddlZddlZddlmZddlmZddlmZGddejZ Gdd ejZ Gd d e ejZ y) N) protocols) transports)loggerceZdZ dfd ZdZdZdZdZdZdZ e jfdZ d Z d Zd Zd Zd ZdZdZdZdZdZdZdZdZdZdZxZS)BaseSubprocessTransportc nt || d|_||_||_d|_d|_d|_g|_tj|_ i|_ d|_ |tjk(rd|jd<|tjk(rd|jd<|tjk(rd|jd< |j d||||||d| |j j$|_|j |j&d<|jj)r?t+|t,t.fr|} n|d} t1j2d| |j |jj5|j7| y#|j#xYw) NFrr)argsshellstdinstdoutstderrbufsize subprocesszprocess %r created: pid %s)super__init___closed _protocol_loop_proc_pid _returncode _exit_waiters collectionsdeque_pending_calls_pipes _finishedrPIPE_startclosepid_extra get_debug isinstancebytesstrrdebug create_task_connect_pipes)selfloopprotocolr r r rrrwaiterextrakwargsprogram __class__s 0/usr/lib64/python3.12/asyncio/base_subprocess.pyrz BaseSubprocessTransport.__init__ sx  !   )//1  JOO #!DKKN Z__ $!DKKN Z__ $!DKKN  DKK BTeF%w B:@ B JJNN $(JJ L! ::   !$ -q' LL5 $)) - t226:;  JJL s F!!F4c^|jjg}|jr|jd|j|jd|j|j |jd|j n/|j|jdn|jd|j jd}||jd|j|j jd}|j jd }|#||ur|jd |jn@||jd |j||jd |jd jdj|S)Nclosedzpid=z returncode=runningz not startedrzstdin=rr zstdout=stderr=zstdout=zstderr=z<{}> ) r4__name__rappendrrrgetpipeformatjoin)r-infor rrs r5__repr__z BaseSubprocessTransport.__repr__7sX''( << KK ! 99 KK$tyyk* +    ' KK+d&6&6%78 9 YY " KK " KK & "   KK& - .##  &F"2 KK. 6 7! gfkk]34! gfkk]34}}SXXd^,,c tN)NotImplementedError)r-r r r rrrr2s r5r"zBaseSubprocessTransport._startTs!!rBc||_yrDr)r-r/s r5 set_protocolz$BaseSubprocessTransport.set_protocolWs !rBc|jSrDrGr-s r5 get_protocolz$BaseSubprocessTransport.get_protocolZs ~~rBc|jSrD)rrJs r5 is_closingz"BaseSubprocessTransport.is_closing]s ||rBc|jryd|_|jjD]}||jj !|j t|j g|j jL|jjrtjd| |j jyyyy#t$rYywxYw)NTz$Close running child process: kill %r)rrvaluesr=r#rrpollrr&rwarningkillProcessLookupError)r-protos r5r#zBaseSubprocessTransport.close`s <<  [['')E} JJ   * JJ "  ( !)zz##%EtL  ! *) #&  s4C CCcb|js#|d|t||jyy)Nzunclosed transport )source)rResourceWarningr#)r-_warns r5__del__zBaseSubprocessTransport.__del__{s+|| 'x0/$ O JJLrBc|jSrD)rrJs r5get_pidzBaseSubprocessTransport.get_pids yyrBc|jSrD)rrJs r5get_returncodez&BaseSubprocessTransport.get_returncodesrBcR||jvr|j|jSyrD)rr=)r-fds r5get_pipe_transportz*BaseSubprocessTransport.get_pipe_transports%  ;;r?'' 'rBc0|j tyrD)rrSrJs r5 _check_procz#BaseSubprocessTransport._check_procs :: $& & rBcZ|j|jj|yrD)rbr send_signal)r-signals r5rdz#BaseSubprocessTransport.send_signals   v&rBcX|j|jjyrD)rbr terminaterJs r5rgz!BaseSubprocessTransport.terminates  rBcX|j|jjyrD)rbrrRrJs r5rRzBaseSubprocessTransport.kills  rBcK j}j}|j9|jfd|jd{\}}|jd<|j 9|j fd|j d{\}}|jd<|j9|j fd|jd{\}}|jd<jJ|jjjjD]\}}|j|g|d_|#|js|jdyyy7)77#ttf$rt $r7}|+|js|j#|Yd}~yYd}~yYd}~yd}~wwxYww)NctdS)Nr)WriteSubprocessPipeProtorJsr5z8BaseSubprocessTransport._connect_pipes..s 4T1=rBrctdS)NrReadSubprocessPipeProtorJsr5rlz8BaseSubprocessTransport._connect_pipes.. 3D!.rprBr )rrr connect_write_piperrconnect_read_piperr call_soonrconnection_made cancelled set_result SystemExitKeyboardInterrupt BaseException set_exception) r-r0procr._r=callbackdataexcs ` r5r,z&BaseSubprocessTransport._connect_pipess# (::D::Dzz% $ 7 7=JJ!  4"& A{{& $ 6 6<KK!!!4"& A{{& $ 6 6<KK!!!4"& A&&2 22 NN4>>994 @"&"5"5$x/$/#6"&D !&*:*:*<!!$'+=!; ! !-.   *!&*:*:*<$$S))+=! *shG AE; E4 AE;E7AE;E9A8E;&G 4E;7E;9E;;G #G6G G  G c|j|jj||fy|jj|g|yrD)rr;rrt)r-cbrs r5_callzBaseSubprocessTransport._calls?    *    & &Dz 2 DJJ  +d +rBcr|j|jj|||jyrD)rrpipe_connection_lost _try_finish)r-r_rs r5_pipe_connection_lostz-BaseSubprocessTransport._pipe_connection_losts( 4>>66C@ rBcR|j|jj||yrD)rrpipe_data_received)r-r_rs r5_pipe_data_receivedz+BaseSubprocessTransport._pipe_data_receiveds 4>>44b$?rBcx|J||jJ|j|jjrtjd||||_|j j ||j _|j|jj|jy)Nz%r exited with return code %r) rrr&rr@r returncoderrprocess_exitedr)r-rs r5_process_exitedz'BaseSubprocessTransport._process_exiteds%1z1%'9)9)99' ::   ! KK7z J% :: (%/DJJ ! 4>>001 rBcK|j |jS|jj}|jj ||d{S7w)zdWait until the process exit and return the process return code. This method is a coroutine.N)rr create_futurerr;)r-r0s r5_waitzBaseSubprocessTransport._waitsP    '## #))+ !!&)||sAAAAc|jrJ|jytd|jj Dr$d|_|j |j dyy)Nc3@K|]}|duxr |jywrD) disconnected).0ps r5 z6BaseSubprocessTransport._try_finish..s(.,1}//,sT)r rallrrOr_call_connection_lostrJs r5rz#BaseSubprocessTransport._try_finishs`>>!!    #  . **,. .!DN JJt114 8 .rBc |jj||jD].}|jr|j |j 0d|_d|_d|_d|_y#|jD].}|jr|j |j 0d|_d|_d|_d|_wxYwrD)rconnection_lostrrvrwrrr)r-rr0s r5rz-BaseSubprocessTransport._call_connection_losts " NN * *3 /,,'')%%d&6&67-"&D DJDJ!DN ,,'')%%d&6&67-"&D DJDJ!DNsA77 C:C)NN)r: __module__ __qualname__rrAr"rHrKrMr#warningswarnrYr[r]r`rbrdrgrRr,rrrrrrr __classcell__)r4s@r5rr s%)))r4r:r_r=rJs r5rAz!WriteSubprocessPipeProto.__repr__ s04>>**+4ytyym1MMrBcld|_|jj|j|d|_y)NT)rr|rr_)r-rs r5rz(WriteSubprocessPipeProto.connection_lost s)  ''5 rBcL|jjjyrD)r|r pause_writingrJs r5rz&WriteSubprocessPipeProto.pause_writings ))+rBcL|jjjyrD)r|rresume_writingrJs r5rz'WriteSubprocessPipeProto.resume_writings **,rBN) r:rrrrurArrrrrBr5rkrks!" N ,-rBrkceZdZdZy)rocP|jj|j|yrD)r|rr_)r-rs r5 data_receivedz%ReadSubprocessPipeProto.data_receiveds %%dggt4rBN)r:rrrrrBr5roros5rBro)rrrrrlogrSubprocessTransportr BaseProtocolrkProtocolrorrBr5rsTr"j<<r"j-y55-456'005rBwindows_utils.py000064400000011704152527367570010056 0ustar00"""Various Windows specific bits and pieces.""" import sys if sys.platform != 'win32': # pragma: no cover raise ImportError('win32 only') import _winapi import itertools import msvcrt import os import subprocess import tempfile import warnings __all__ = 'pipe', 'Popen', 'PIPE', 'PipeHandle' # Constants/globals BUFSIZE = 8192 PIPE = subprocess.PIPE STDOUT = subprocess.STDOUT _mmap_counter = itertools.count() # Replacement for os.pipe() using handles instead of fds def pipe(*, duplex=False, overlapped=(True, True), bufsize=BUFSIZE): """Like os.pipe() but with overlapped support and using handles not fds.""" address = tempfile.mktemp( prefix=r'\\.\pipe\python-pipe-{:d}-{:d}-'.format( os.getpid(), next(_mmap_counter))) if duplex: openmode = _winapi.PIPE_ACCESS_DUPLEX access = _winapi.GENERIC_READ | _winapi.GENERIC_WRITE obsize, ibsize = bufsize, bufsize else: openmode = _winapi.PIPE_ACCESS_INBOUND access = _winapi.GENERIC_WRITE obsize, ibsize = 0, bufsize openmode |= _winapi.FILE_FLAG_FIRST_PIPE_INSTANCE if overlapped[0]: openmode |= _winapi.FILE_FLAG_OVERLAPPED if overlapped[1]: flags_and_attribs = _winapi.FILE_FLAG_OVERLAPPED else: flags_and_attribs = 0 h1 = h2 = None try: h1 = _winapi.CreateNamedPipe( address, openmode, _winapi.PIPE_WAIT, 1, obsize, ibsize, _winapi.NMPWAIT_WAIT_FOREVER, _winapi.NULL) h2 = _winapi.CreateFile( address, access, 0, _winapi.NULL, _winapi.OPEN_EXISTING, flags_and_attribs, _winapi.NULL) ov = _winapi.ConnectNamedPipe(h1, overlapped=True) ov.GetOverlappedResult(True) return h1, h2 except: if h1 is not None: _winapi.CloseHandle(h1) if h2 is not None: _winapi.CloseHandle(h2) raise # Wrapper for a pipe handle class PipeHandle: """Wrapper for an overlapped pipe handle which is vaguely file-object like. The IOCP event loop can use these instead of socket objects. """ def __init__(self, handle): self._handle = handle def __repr__(self): if self._handle is not None: handle = f'handle={self._handle!r}' else: handle = 'closed' return f'<{self.__class__.__name__} {handle}>' @property def handle(self): return self._handle def fileno(self): if self._handle is None: raise ValueError("I/O operation on closed pipe") return self._handle def close(self, *, CloseHandle=_winapi.CloseHandle): if self._handle is not None: CloseHandle(self._handle) self._handle = None def __del__(self, _warn=warnings.warn): if self._handle is not None: _warn(f"unclosed {self!r}", ResourceWarning, source=self) self.close() def __enter__(self): return self def __exit__(self, t, v, tb): self.close() # Replacement for subprocess.Popen using overlapped pipe handles class Popen(subprocess.Popen): """Replacement for subprocess.Popen using overlapped pipe handles. The stdin, stdout, stderr are None or instances of PipeHandle. """ def __init__(self, args, stdin=None, stdout=None, stderr=None, **kwds): assert not kwds.get('universal_newlines') assert kwds.get('bufsize', 0) == 0 stdin_rfd = stdout_wfd = stderr_wfd = None stdin_wh = stdout_rh = stderr_rh = None if stdin == PIPE: stdin_rh, stdin_wh = pipe(overlapped=(False, True), duplex=True) stdin_rfd = msvcrt.open_osfhandle(stdin_rh, os.O_RDONLY) else: stdin_rfd = stdin if stdout == PIPE: stdout_rh, stdout_wh = pipe(overlapped=(True, False)) stdout_wfd = msvcrt.open_osfhandle(stdout_wh, 0) else: stdout_wfd = stdout if stderr == PIPE: stderr_rh, stderr_wh = pipe(overlapped=(True, False)) stderr_wfd = msvcrt.open_osfhandle(stderr_wh, 0) elif stderr == STDOUT: stderr_wfd = stdout_wfd else: stderr_wfd = stderr try: super().__init__(args, stdin=stdin_rfd, stdout=stdout_wfd, stderr=stderr_wfd, **kwds) except: for h in (stdin_wh, stdout_rh, stderr_rh): if h is not None: _winapi.CloseHandle(h) raise else: if stdin_wh is not None: self.stdin = PipeHandle(stdin_wh) if stdout_rh is not None: self.stdout = PipeHandle(stdout_rh) if stderr_rh is not None: self.stderr = PipeHandle(stderr_rh) finally: if stdin == PIPE: os.close(stdin_rfd) if stdout == PIPE: os.close(stdout_wfd) if stderr == PIPE: os.close(stderr_wfd) transports.py000064400000024742152527367570007371 0ustar00"""Abstract Transport class.""" __all__ = ( 'BaseTransport', 'ReadTransport', 'WriteTransport', 'Transport', 'DatagramTransport', 'SubprocessTransport', ) class BaseTransport: """Base class for transports.""" __slots__ = ('_extra',) def __init__(self, extra=None): if extra is None: extra = {} self._extra = extra def get_extra_info(self, name, default=None): """Get optional transport information.""" return self._extra.get(name, default) def is_closing(self): """Return True if the transport is closing or closed.""" raise NotImplementedError def close(self): """Close the transport. Buffered data will be flushed asynchronously. No more data will be received. After all buffered data is flushed, the protocol's connection_lost() method will (eventually) be called with None as its argument. """ raise NotImplementedError def set_protocol(self, protocol): """Set a new protocol.""" raise NotImplementedError def get_protocol(self): """Return the current protocol.""" raise NotImplementedError class ReadTransport(BaseTransport): """Interface for read-only transports.""" __slots__ = () def is_reading(self): """Return True if the transport is receiving.""" raise NotImplementedError def pause_reading(self): """Pause the receiving end. No data will be passed to the protocol's data_received() method until resume_reading() is called. """ raise NotImplementedError def resume_reading(self): """Resume the receiving end. Data received will once again be passed to the protocol's data_received() method. """ raise NotImplementedError class WriteTransport(BaseTransport): """Interface for write-only transports.""" __slots__ = () def set_write_buffer_limits(self, high=None, low=None): """Set the high- and low-water limits for write flow control. These two values control when to call the protocol's pause_writing() and resume_writing() methods. If specified, the low-water limit must be less than or equal to the high-water limit. Neither value can be negative. The defaults are implementation-specific. If only the high-water limit is given, the low-water limit defaults to an implementation-specific value less than or equal to the high-water limit. Setting high to zero forces low to zero as well, and causes pause_writing() to be called whenever the buffer becomes non-empty. Setting low to zero causes resume_writing() to be called only once the buffer is empty. Use of zero for either limit is generally sub-optimal as it reduces opportunities for doing I/O and computation concurrently. """ raise NotImplementedError def get_write_buffer_size(self): """Return the current size of the write buffer.""" raise NotImplementedError def get_write_buffer_limits(self): """Get the high and low watermarks for write flow control. Return a tuple (low, high) where low and high are positive number of bytes.""" raise NotImplementedError def write(self, data): """Write some data bytes to the transport. This does not block; it buffers the data and arranges for it to be sent out asynchronously. """ raise NotImplementedError def writelines(self, list_of_data): """Write a list (or any iterable) of data bytes to the transport. The default implementation concatenates the arguments and calls write() on the result. """ data = b''.join(list_of_data) self.write(data) def write_eof(self): """Close the write end after flushing buffered data. (This is like typing ^D into a UNIX program reading from stdin.) Data may still be received. """ raise NotImplementedError def can_write_eof(self): """Return True if this transport supports write_eof(), False if not.""" raise NotImplementedError def abort(self): """Close the transport immediately. Buffered data will be lost. No more data will be received. The protocol's connection_lost() method will (eventually) be called with None as its argument. """ raise NotImplementedError class Transport(ReadTransport, WriteTransport): """Interface representing a bidirectional transport. There may be several implementations, but typically, the user does not implement new transports; rather, the platform provides some useful transports that are implemented using the platform's best practices. The user never instantiates a transport directly; they call a utility function, passing it a protocol factory and other information necessary to create the transport and protocol. (E.g. EventLoop.create_connection() or EventLoop.create_server().) The utility function will asynchronously create a transport and a protocol and hook them up by calling the protocol's connection_made() method, passing it the transport. The implementation here raises NotImplemented for every method except writelines(), which calls write() in a loop. """ __slots__ = () class DatagramTransport(BaseTransport): """Interface for datagram (UDP) transports.""" __slots__ = () def sendto(self, data, addr=None): """Send data to the transport. This does not block; it buffers the data and arranges for it to be sent out asynchronously. addr is target socket address. If addr is None use target address pointed on transport creation. """ raise NotImplementedError def abort(self): """Close the transport immediately. Buffered data will be lost. No more data will be received. The protocol's connection_lost() method will (eventually) be called with None as its argument. """ raise NotImplementedError class SubprocessTransport(BaseTransport): __slots__ = () def get_pid(self): """Get subprocess id.""" raise NotImplementedError def get_returncode(self): """Get subprocess returncode. See also http://docs.python.org/3/library/subprocess#subprocess.Popen.returncode """ raise NotImplementedError def get_pipe_transport(self, fd): """Get transport for pipe with number fd.""" raise NotImplementedError def send_signal(self, signal): """Send signal to subprocess. See also: docs.python.org/3/library/subprocess#subprocess.Popen.send_signal """ raise NotImplementedError def terminate(self): """Stop the subprocess. Alias for close() method. On Posix OSs the method sends SIGTERM to the subprocess. On Windows the Win32 API function TerminateProcess() is called to stop the subprocess. See also: http://docs.python.org/3/library/subprocess#subprocess.Popen.terminate """ raise NotImplementedError def kill(self): """Kill the subprocess. On Posix OSs the function sends SIGKILL to the subprocess. On Windows kill() is an alias for terminate(). See also: http://docs.python.org/3/library/subprocess#subprocess.Popen.kill """ raise NotImplementedError class _FlowControlMixin(Transport): """All the logic for (write) flow control in a mix-in base class. The subclass must implement get_write_buffer_size(). It must call _maybe_pause_protocol() whenever the write buffer size increases, and _maybe_resume_protocol() whenever it decreases. It may also override set_write_buffer_limits() (e.g. to specify different defaults). The subclass constructor must call super().__init__(extra). This will call set_write_buffer_limits(). The user may call set_write_buffer_limits() and get_write_buffer_size(), and their protocol's pause_writing() and resume_writing() may be called. """ __slots__ = ('_loop', '_protocol_paused', '_high_water', '_low_water') def __init__(self, extra=None, loop=None): super().__init__(extra) assert loop is not None self._loop = loop self._protocol_paused = False self._set_write_buffer_limits() def _maybe_pause_protocol(self): size = self.get_write_buffer_size() if size <= self._high_water: return if not self._protocol_paused: self._protocol_paused = True try: self._protocol.pause_writing() except (SystemExit, KeyboardInterrupt): raise except BaseException as exc: self._loop.call_exception_handler({ 'message': 'protocol.pause_writing() failed', 'exception': exc, 'transport': self, 'protocol': self._protocol, }) def _maybe_resume_protocol(self): if (self._protocol_paused and self.get_write_buffer_size() <= self._low_water): self._protocol_paused = False try: self._protocol.resume_writing() except (SystemExit, KeyboardInterrupt): raise except BaseException as exc: self._loop.call_exception_handler({ 'message': 'protocol.resume_writing() failed', 'exception': exc, 'transport': self, 'protocol': self._protocol, }) def get_write_buffer_limits(self): return (self._low_water, self._high_water) def _set_write_buffer_limits(self, high=None, low=None): if high is None: if low is None: high = 64 * 1024 else: high = 4 * low if low is None: low = high // 4 if not high >= low >= 0: raise ValueError( f'high ({high!r}) must be >= low ({low!r}) must be >= 0') self._high_water = high self._low_water = low def set_write_buffer_limits(self, high=None, low=None): self._set_write_buffer_limits(high=high, low=low) self._maybe_pause_protocol() def get_write_buffer_size(self): raise NotImplementedError threads.py000064400000001426152527367570006576 0ustar00"""High-level support for working with threads in asyncio""" import functools import contextvars from . import events __all__ = "to_thread", async def to_thread(func, /, *args, **kwargs): """Asynchronously run function *func* in a separate thread. Any *args and **kwargs supplied for this function are directly passed to *func*. Also, the current :class:`contextvars.Context` is propagated, allowing context variables from the main thread to be accessed in the separate thread. Return a coroutine that can be awaited to get the eventual result of *func*. """ loop = events.get_running_loop() ctx = contextvars.copy_context() func_call = functools.partial(ctx.run, func, *args, **kwargs) return await loop.run_in_executor(None, func_call) exceptions.py000064400000003330152527367570007321 0ustar00"""asyncio exceptions.""" __all__ = ('BrokenBarrierError', 'CancelledError', 'InvalidStateError', 'TimeoutError', 'IncompleteReadError', 'LimitOverrunError', 'SendfileNotAvailableError') class CancelledError(BaseException): """The Future or Task was cancelled.""" TimeoutError = TimeoutError # make local alias for the standard exception class InvalidStateError(Exception): """The operation is not allowed in this state.""" class SendfileNotAvailableError(RuntimeError): """Sendfile syscall is not available. Raised if OS does not support sendfile syscall for given socket or file type. """ class IncompleteReadError(EOFError): """ Incomplete read error. Attributes: - partial: read bytes string before the end of stream was reached - expected: total number of expected bytes (or None if unknown) """ def __init__(self, partial, expected): r_expected = 'undefined' if expected is None else repr(expected) super().__init__(f'{len(partial)} bytes read on a total of ' f'{r_expected} expected bytes') self.partial = partial self.expected = expected def __reduce__(self): return type(self), (self.partial, self.expected) class LimitOverrunError(Exception): """Reached the buffer limit while looking for a separator. Attributes: - consumed: total number of to be consumed bytes. """ def __init__(self, message, consumed): super().__init__(message) self.consumed = consumed def __reduce__(self): return type(self), (self.args[0], self.consumed) class BrokenBarrierError(RuntimeError): """Barrier is broken by barrier.abort() call.""" proactor_events.py000064400000100760152527367570010362 0ustar00"""Event loop using a proactor and related classes. A proactor is a "notify-on-completion" multiplexer. Currently a proactor is only implemented on Windows with IOCP. """ __all__ = 'BaseProactorEventLoop', import io import os import socket import warnings import signal import threading import collections from . import base_events from . import constants from . import futures from . import exceptions from . import protocols from . import sslproto from . import transports from . import trsock from .log import logger def _set_socket_extra(transport, sock): transport._extra['socket'] = trsock.TransportSocket(sock) try: transport._extra['sockname'] = sock.getsockname() except socket.error: if transport._loop.get_debug(): logger.warning( "getsockname() failed on %r", sock, exc_info=True) if 'peername' not in transport._extra: try: transport._extra['peername'] = sock.getpeername() except socket.error: # UDP sockets may not have a peer name transport._extra['peername'] = None class _ProactorBasePipeTransport(transports._FlowControlMixin, transports.BaseTransport): """Base class for pipe and socket transports.""" def __init__(self, loop, sock, protocol, waiter=None, extra=None, server=None): super().__init__(extra, loop) self._set_extra(sock) self._sock = sock self.set_protocol(protocol) self._server = server self._buffer = None # None or bytearray. self._read_fut = None self._write_fut = None self._pending_write = 0 self._conn_lost = 0 self._closing = False # Set when close() called. self._called_connection_lost = False self._eof_written = False if self._server is not None: self._server._attach() self._loop.call_soon(self._protocol.connection_made, self) if waiter is not None: # only wake up the waiter when connection_made() has been called self._loop.call_soon(futures._set_result_unless_cancelled, waiter, None) def __repr__(self): info = [self.__class__.__name__] if self._sock is None: info.append('closed') elif self._closing: info.append('closing') if self._sock is not None: info.append(f'fd={self._sock.fileno()}') if self._read_fut is not None: info.append(f'read={self._read_fut!r}') if self._write_fut is not None: info.append(f'write={self._write_fut!r}') if self._buffer: info.append(f'write_bufsize={len(self._buffer)}') if self._eof_written: info.append('EOF written') return '<{}>'.format(' '.join(info)) def _set_extra(self, sock): self._extra['pipe'] = sock def set_protocol(self, protocol): self._protocol = protocol def get_protocol(self): return self._protocol def is_closing(self): return self._closing def close(self): if self._closing: return self._closing = True self._conn_lost += 1 if not self._buffer and self._write_fut is None: self._loop.call_soon(self._call_connection_lost, None) if self._read_fut is not None: self._read_fut.cancel() self._read_fut = None def __del__(self, _warn=warnings.warn): if self._sock is not None: _warn(f"unclosed transport {self!r}", ResourceWarning, source=self) self._sock.close() def _fatal_error(self, exc, message='Fatal error on pipe transport'): try: if isinstance(exc, OSError): if self._loop.get_debug(): logger.debug("%r: %s", self, message, exc_info=True) else: self._loop.call_exception_handler({ 'message': message, 'exception': exc, 'transport': self, 'protocol': self._protocol, }) finally: self._force_close(exc) def _force_close(self, exc): if self._empty_waiter is not None and not self._empty_waiter.done(): if exc is None: self._empty_waiter.set_result(None) else: self._empty_waiter.set_exception(exc) if self._closing and self._called_connection_lost: return self._closing = True self._conn_lost += 1 if self._write_fut: self._write_fut.cancel() self._write_fut = None if self._read_fut: self._read_fut.cancel() self._read_fut = None self._pending_write = 0 self._buffer = None self._loop.call_soon(self._call_connection_lost, exc) def _call_connection_lost(self, exc): if self._called_connection_lost: return try: self._protocol.connection_lost(exc) finally: # XXX If there is a pending overlapped read on the other # end then it may fail with ERROR_NETNAME_DELETED if we # just close our end. First calling shutdown() seems to # cure it, but maybe using DisconnectEx() would be better. if hasattr(self._sock, 'shutdown') and self._sock.fileno() != -1: self._sock.shutdown(socket.SHUT_RDWR) self._sock.close() self._sock = None server = self._server if server is not None: server._detach() self._server = None self._called_connection_lost = True def get_write_buffer_size(self): size = self._pending_write if self._buffer is not None: size += len(self._buffer) return size class _ProactorReadPipeTransport(_ProactorBasePipeTransport, transports.ReadTransport): """Transport for read pipes.""" def __init__(self, loop, sock, protocol, waiter=None, extra=None, server=None, buffer_size=65536): self._pending_data_length = -1 self._paused = True super().__init__(loop, sock, protocol, waiter, extra, server) self._data = bytearray(buffer_size) self._loop.call_soon(self._loop_reading) self._paused = False def is_reading(self): return not self._paused and not self._closing def pause_reading(self): if self._closing or self._paused: return self._paused = True # bpo-33694: Don't cancel self._read_fut because cancelling an # overlapped WSASend() loss silently data with the current proactor # implementation. # # If CancelIoEx() fails with ERROR_NOT_FOUND, it means that WSASend() # completed (even if HasOverlappedIoCompleted() returns 0), but # Overlapped.cancel() currently silently ignores the ERROR_NOT_FOUND # error. Once the overlapped is ignored, the IOCP loop will ignores the # completion I/O event and so not read the result of the overlapped # WSARecv(). if self._loop.get_debug(): logger.debug("%r pauses reading", self) def resume_reading(self): if self._closing or not self._paused: return self._paused = False if self._read_fut is None: self._loop.call_soon(self._loop_reading, None) length = self._pending_data_length self._pending_data_length = -1 if length > -1: # Call the protocol method after calling _loop_reading(), # since the protocol can decide to pause reading again. self._loop.call_soon(self._data_received, self._data[:length], length) if self._loop.get_debug(): logger.debug("%r resumes reading", self) def _eof_received(self): if self._loop.get_debug(): logger.debug("%r received EOF", self) try: keep_open = self._protocol.eof_received() except (SystemExit, KeyboardInterrupt): raise except BaseException as exc: self._fatal_error( exc, 'Fatal error: protocol.eof_received() call failed.') return if not keep_open: self.close() def _data_received(self, data, length): if self._paused: # Don't call any protocol method while reading is paused. # The protocol will be called on resume_reading(). assert self._pending_data_length == -1 self._pending_data_length = length return if length == 0: self._eof_received() return if isinstance(self._protocol, protocols.BufferedProtocol): try: protocols._feed_data_to_buffered_proto(self._protocol, data) except (SystemExit, KeyboardInterrupt): raise except BaseException as exc: self._fatal_error(exc, 'Fatal error: protocol.buffer_updated() ' 'call failed.') return else: self._protocol.data_received(data) def _loop_reading(self, fut=None): length = -1 data = None try: if fut is not None: assert self._read_fut is fut or (self._read_fut is None and self._closing) self._read_fut = None if fut.done(): # deliver data later in "finally" clause length = fut.result() if length == 0: # we got end-of-file so no need to reschedule a new read return data = self._data[:length] else: # the future will be replaced by next proactor.recv call fut.cancel() if self._closing: # since close() has been called we ignore any read data return # bpo-33694: buffer_updated() has currently no fast path because of # a data loss issue caused by overlapped WSASend() cancellation. if not self._paused: # reschedule a new read self._read_fut = self._loop._proactor.recv_into(self._sock, self._data) except ConnectionAbortedError as exc: if not self._closing: self._fatal_error(exc, 'Fatal read error on pipe transport') elif self._loop.get_debug(): logger.debug("Read error on pipe transport while closing", exc_info=True) except ConnectionResetError as exc: self._force_close(exc) except OSError as exc: self._fatal_error(exc, 'Fatal read error on pipe transport') except exceptions.CancelledError: if not self._closing: raise else: if not self._paused: self._read_fut.add_done_callback(self._loop_reading) finally: if length > -1: self._data_received(data, length) class _ProactorBaseWritePipeTransport(_ProactorBasePipeTransport, transports.WriteTransport): """Transport for write pipes.""" _start_tls_compatible = True def __init__(self, *args, **kw): super().__init__(*args, **kw) self._empty_waiter = None def write(self, data): if not isinstance(data, (bytes, bytearray, memoryview)): raise TypeError( f"data argument must be a bytes-like object, " f"not {type(data).__name__}") if self._eof_written: raise RuntimeError('write_eof() already called') if self._empty_waiter is not None: raise RuntimeError('unable to write; sendfile is in progress') if not data: return if self._conn_lost: if self._conn_lost >= constants.LOG_THRESHOLD_FOR_CONNLOST_WRITES: logger.warning('socket.send() raised exception.') self._conn_lost += 1 return # Observable states: # 1. IDLE: _write_fut and _buffer both None # 2. WRITING: _write_fut set; _buffer None # 3. BACKED UP: _write_fut set; _buffer a bytearray # We always copy the data, so the caller can't modify it # while we're still waiting for the I/O to happen. if self._write_fut is None: # IDLE -> WRITING assert self._buffer is None # Pass a copy, except if it's already immutable. self._loop_writing(data=bytes(data)) elif not self._buffer: # WRITING -> BACKED UP # Make a mutable copy which we can extend. self._buffer = bytearray(data) self._maybe_pause_protocol() else: # BACKED UP # Append to buffer (also copies). self._buffer.extend(data) self._maybe_pause_protocol() def _loop_writing(self, f=None, data=None): try: if f is not None and self._write_fut is None and self._closing: # XXX most likely self._force_close() has been called, and # it has set self._write_fut to None. return assert f is self._write_fut self._write_fut = None self._pending_write = 0 if f: f.result() if data is None: data = self._buffer self._buffer = None if not data: if self._closing: self._loop.call_soon(self._call_connection_lost, None) if self._eof_written: self._sock.shutdown(socket.SHUT_WR) # Now that we've reduced the buffer size, tell the # protocol to resume writing if it was paused. Note that # we do this last since the callback is called immediately # and it may add more data to the buffer (even causing the # protocol to be paused again). self._maybe_resume_protocol() else: self._write_fut = self._loop._proactor.send(self._sock, data) if not self._write_fut.done(): assert self._pending_write == 0 self._pending_write = len(data) self._write_fut.add_done_callback(self._loop_writing) self._maybe_pause_protocol() else: self._write_fut.add_done_callback(self._loop_writing) if self._empty_waiter is not None and self._write_fut is None: self._empty_waiter.set_result(None) except ConnectionResetError as exc: self._force_close(exc) except OSError as exc: self._fatal_error(exc, 'Fatal write error on pipe transport') def can_write_eof(self): return True def write_eof(self): self.close() def abort(self): self._force_close(None) def _make_empty_waiter(self): if self._empty_waiter is not None: raise RuntimeError("Empty waiter is already set") self._empty_waiter = self._loop.create_future() if self._write_fut is None: self._empty_waiter.set_result(None) return self._empty_waiter def _reset_empty_waiter(self): self._empty_waiter = None class _ProactorWritePipeTransport(_ProactorBaseWritePipeTransport): def __init__(self, *args, **kw): super().__init__(*args, **kw) self._read_fut = self._loop._proactor.recv(self._sock, 16) self._read_fut.add_done_callback(self._pipe_closed) def _pipe_closed(self, fut): if fut.cancelled(): # the transport has been closed return assert fut.result() == b'' if self._closing: assert self._read_fut is None return assert fut is self._read_fut, (fut, self._read_fut) self._read_fut = None if self._write_fut is not None: self._force_close(BrokenPipeError()) else: self.close() class _ProactorDatagramTransport(_ProactorBasePipeTransport, transports.DatagramTransport): max_size = 256 * 1024 def __init__(self, loop, sock, protocol, address=None, waiter=None, extra=None): self._address = address self._empty_waiter = None self._buffer_size = 0 # We don't need to call _protocol.connection_made() since our base # constructor does it for us. super().__init__(loop, sock, protocol, waiter=waiter, extra=extra) # The base constructor sets _buffer = None, so we set it here self._buffer = collections.deque() self._loop.call_soon(self._loop_reading) def _set_extra(self, sock): _set_socket_extra(self, sock) def get_write_buffer_size(self): return self._buffer_size def abort(self): self._force_close(None) def sendto(self, data, addr=None): if not isinstance(data, (bytes, bytearray, memoryview)): raise TypeError('data argument must be bytes-like object (%r)', type(data)) if not data: return if self._address is not None and addr not in (None, self._address): raise ValueError( f'Invalid address: must be None or {self._address}') if self._conn_lost and self._address: if self._conn_lost >= constants.LOG_THRESHOLD_FOR_CONNLOST_WRITES: logger.warning('socket.sendto() raised exception.') self._conn_lost += 1 return # Ensure that what we buffer is immutable. self._buffer.append((bytes(data), addr)) self._buffer_size += len(data) if self._write_fut is None: # No current write operations are active, kick one off self._loop_writing() # else: A write operation is already kicked off self._maybe_pause_protocol() def _loop_writing(self, fut=None): try: if self._conn_lost: return assert fut is self._write_fut self._write_fut = None if fut: # We are in a _loop_writing() done callback, get the result fut.result() if not self._buffer or (self._conn_lost and self._address): # The connection has been closed if self._closing: self._loop.call_soon(self._call_connection_lost, None) return data, addr = self._buffer.popleft() self._buffer_size -= len(data) if self._address is not None: self._write_fut = self._loop._proactor.send(self._sock, data) else: self._write_fut = self._loop._proactor.sendto(self._sock, data, addr=addr) except OSError as exc: self._protocol.error_received(exc) except Exception as exc: self._fatal_error(exc, 'Fatal write error on datagram transport') else: self._write_fut.add_done_callback(self._loop_writing) self._maybe_resume_protocol() def _loop_reading(self, fut=None): data = None try: if self._conn_lost: return assert self._read_fut is fut or (self._read_fut is None and self._closing) self._read_fut = None if fut is not None: res = fut.result() if self._closing: # since close() has been called we ignore any read data data = None return if self._address is not None: data, addr = res, self._address else: data, addr = res if self._conn_lost: return if self._address is not None: self._read_fut = self._loop._proactor.recv(self._sock, self.max_size) else: self._read_fut = self._loop._proactor.recvfrom(self._sock, self.max_size) except OSError as exc: self._protocol.error_received(exc) except exceptions.CancelledError: if not self._closing: raise else: if self._read_fut is not None: self._read_fut.add_done_callback(self._loop_reading) finally: if data: self._protocol.datagram_received(data, addr) class _ProactorDuplexPipeTransport(_ProactorReadPipeTransport, _ProactorBaseWritePipeTransport, transports.Transport): """Transport for duplex pipes.""" def can_write_eof(self): return False def write_eof(self): raise NotImplementedError class _ProactorSocketTransport(_ProactorReadPipeTransport, _ProactorBaseWritePipeTransport, transports.Transport): """Transport for connected sockets.""" _sendfile_compatible = constants._SendfileMode.TRY_NATIVE def __init__(self, loop, sock, protocol, waiter=None, extra=None, server=None): super().__init__(loop, sock, protocol, waiter, extra, server) base_events._set_nodelay(sock) def _set_extra(self, sock): _set_socket_extra(self, sock) def can_write_eof(self): return True def write_eof(self): if self._closing or self._eof_written: return self._eof_written = True if self._write_fut is None: self._sock.shutdown(socket.SHUT_WR) class BaseProactorEventLoop(base_events.BaseEventLoop): def __init__(self, proactor): super().__init__() logger.debug('Using proactor: %s', proactor.__class__.__name__) self._proactor = proactor self._selector = proactor # convenient alias self._self_reading_future = None self._accept_futures = {} # socket file descriptor => Future proactor.set_loop(self) self._make_self_pipe() if threading.current_thread() is threading.main_thread(): # wakeup fd can only be installed to a file descriptor from the main thread signal.set_wakeup_fd(self._csock.fileno()) def _make_socket_transport(self, sock, protocol, waiter=None, extra=None, server=None): return _ProactorSocketTransport(self, sock, protocol, waiter, extra, server) def _make_ssl_transport( self, rawsock, protocol, sslcontext, waiter=None, *, server_side=False, server_hostname=None, extra=None, server=None, ssl_handshake_timeout=None, ssl_shutdown_timeout=None): ssl_protocol = sslproto.SSLProtocol( self, protocol, sslcontext, waiter, server_side, server_hostname, ssl_handshake_timeout=ssl_handshake_timeout, ssl_shutdown_timeout=ssl_shutdown_timeout) _ProactorSocketTransport(self, rawsock, ssl_protocol, extra=extra, server=server) return ssl_protocol._app_transport def _make_datagram_transport(self, sock, protocol, address=None, waiter=None, extra=None): return _ProactorDatagramTransport(self, sock, protocol, address, waiter, extra) def _make_duplex_pipe_transport(self, sock, protocol, waiter=None, extra=None): return _ProactorDuplexPipeTransport(self, sock, protocol, waiter, extra) def _make_read_pipe_transport(self, sock, protocol, waiter=None, extra=None): return _ProactorReadPipeTransport(self, sock, protocol, waiter, extra) def _make_write_pipe_transport(self, sock, protocol, waiter=None, extra=None): # We want connection_lost() to be called when other end closes return _ProactorWritePipeTransport(self, sock, protocol, waiter, extra) def close(self): if self.is_running(): raise RuntimeError("Cannot close a running event loop") if self.is_closed(): return if threading.current_thread() is threading.main_thread(): signal.set_wakeup_fd(-1) # Call these methods before closing the event loop (before calling # BaseEventLoop.close), because they can schedule callbacks with # call_soon(), which is forbidden when the event loop is closed. self._stop_accept_futures() self._close_self_pipe() self._proactor.close() self._proactor = None self._selector = None # Close the event loop super().close() async def sock_recv(self, sock, n): return await self._proactor.recv(sock, n) async def sock_recv_into(self, sock, buf): return await self._proactor.recv_into(sock, buf) async def sock_recvfrom(self, sock, bufsize): return await self._proactor.recvfrom(sock, bufsize) async def sock_recvfrom_into(self, sock, buf, nbytes=0): if not nbytes: nbytes = len(buf) return await self._proactor.recvfrom_into(sock, buf, nbytes) async def sock_sendall(self, sock, data): return await self._proactor.send(sock, data) async def sock_sendto(self, sock, data, address): return await self._proactor.sendto(sock, data, 0, address) async def sock_connect(self, sock, address): return await self._proactor.connect(sock, address) async def sock_accept(self, sock): return await self._proactor.accept(sock) async def _sock_sendfile_native(self, sock, file, offset, count): try: fileno = file.fileno() except (AttributeError, io.UnsupportedOperation) as err: raise exceptions.SendfileNotAvailableError("not a regular file") try: fsize = os.fstat(fileno).st_size except OSError: raise exceptions.SendfileNotAvailableError("not a regular file") blocksize = count if count else fsize if not blocksize: return 0 # empty file blocksize = min(blocksize, 0xffff_ffff) end_pos = min(offset + count, fsize) if count else fsize offset = min(offset, fsize) total_sent = 0 try: while True: blocksize = min(end_pos - offset, blocksize) if blocksize <= 0: return total_sent await self._proactor.sendfile(sock, file, offset, blocksize) offset += blocksize total_sent += blocksize finally: if total_sent > 0: file.seek(offset) async def _sendfile_native(self, transp, file, offset, count): resume_reading = transp.is_reading() transp.pause_reading() await transp._make_empty_waiter() try: return await self.sock_sendfile(transp._sock, file, offset, count, fallback=False) finally: transp._reset_empty_waiter() if resume_reading: transp.resume_reading() def _close_self_pipe(self): if self._self_reading_future is not None: self._self_reading_future.cancel() self._self_reading_future = None self._ssock.close() self._ssock = None self._csock.close() self._csock = None self._internal_fds -= 1 def _make_self_pipe(self): # A self-socket, really. :-) self._ssock, self._csock = socket.socketpair() self._ssock.setblocking(False) self._csock.setblocking(False) self._internal_fds += 1 def _loop_self_reading(self, f=None): try: if f is not None: f.result() # may raise if self._self_reading_future is not f: # When we scheduled this Future, we assigned it to # _self_reading_future. If it's not there now, something has # tried to cancel the loop while this callback was still in the # queue (see windows_events.ProactorEventLoop.run_forever). In # that case stop here instead of continuing to schedule a new # iteration. return f = self._proactor.recv(self._ssock, 4096) except exceptions.CancelledError: # _close_self_pipe() has been called, stop waiting for data return except (SystemExit, KeyboardInterrupt): raise except BaseException as exc: self.call_exception_handler({ 'message': 'Error on reading from the event loop self pipe', 'exception': exc, 'loop': self, }) else: self._self_reading_future = f f.add_done_callback(self._loop_self_reading) def _write_to_self(self): # This may be called from a different thread, possibly after # _close_self_pipe() has been called or even while it is # running. Guard for self._csock being None or closed. When # a socket is closed, send() raises OSError (with errno set to # EBADF, but let's not rely on the exact error code). csock = self._csock if csock is None: return try: csock.send(b'\0') except OSError: if self._debug: logger.debug("Fail to write a null byte into the " "self-pipe socket", exc_info=True) def _start_serving(self, protocol_factory, sock, sslcontext=None, server=None, backlog=100, ssl_handshake_timeout=None, ssl_shutdown_timeout=None): def loop(f=None): try: if f is not None: conn, addr = f.result() if self._debug: logger.debug("%r got a new connection from %r: %r", server, addr, conn) protocol = protocol_factory() if sslcontext is not None: self._make_ssl_transport( conn, protocol, sslcontext, server_side=True, extra={'peername': addr}, server=server, ssl_handshake_timeout=ssl_handshake_timeout, ssl_shutdown_timeout=ssl_shutdown_timeout) else: self._make_socket_transport( conn, protocol, extra={'peername': addr}, server=server) if self.is_closed(): return f = self._proactor.accept(sock) except OSError as exc: if sock.fileno() != -1: self.call_exception_handler({ 'message': 'Accept failed on a socket', 'exception': exc, 'socket': trsock.TransportSocket(sock), }) sock.close() elif self._debug: logger.debug("Accept failed on socket %r", sock, exc_info=True) except exceptions.CancelledError: sock.close() else: self._accept_futures[sock.fileno()] = f f.add_done_callback(loop) self.call_soon(loop) def _process_events(self, event_list): # Events are processed in the IocpProactor._poll() method pass def _stop_accept_futures(self): for future in self._accept_futures.values(): future.cancel() self._accept_futures.clear() def _stop_serving(self, sock): future = self._accept_futures.pop(sock.fileno(), None) if future: future.cancel() self._proactor._stop_serving(sock) sock.close() base_tasks.py000064400000005124152527367570007262 0ustar00import linecache import reprlib import traceback from . import base_futures from . import coroutines def _task_repr_info(task): info = base_futures._future_repr_info(task) if task.cancelling() and not task.done(): # replace status info[0] = 'cancelling' info.insert(1, 'name=%r' % task.get_name()) coro = coroutines._format_coroutine(task._coro) info.insert(2, f'coro=<{coro}>') if task._fut_waiter is not None: info.insert(3, f'wait_for={task._fut_waiter!r}') return info @reprlib.recursive_repr() def _task_repr(task): info = ' '.join(_task_repr_info(task)) return f'<{task.__class__.__name__} {info}>' def _task_get_stack(task, limit): frames = [] if hasattr(task._coro, 'cr_frame'): # case 1: 'async def' coroutines f = task._coro.cr_frame elif hasattr(task._coro, 'gi_frame'): # case 2: legacy coroutines f = task._coro.gi_frame elif hasattr(task._coro, 'ag_frame'): # case 3: async generators f = task._coro.ag_frame else: # case 4: unknown objects f = None if f is not None: while f is not None: if limit is not None: if limit <= 0: break limit -= 1 frames.append(f) f = f.f_back frames.reverse() elif task._exception is not None: tb = task._exception.__traceback__ while tb is not None: if limit is not None: if limit <= 0: break limit -= 1 frames.append(tb.tb_frame) tb = tb.tb_next return frames def _task_print_stack(task, limit, file): extracted_list = [] checked = set() for f in task.get_stack(limit=limit): lineno = f.f_lineno co = f.f_code filename = co.co_filename name = co.co_name if filename not in checked: checked.add(filename) linecache.checkcache(filename) line = linecache.getline(filename, lineno, f.f_globals) extracted_list.append((filename, lineno, name, line)) exc = task._exception if not extracted_list: print(f'No stack for {task!r}', file=file) elif exc is not None: print(f'Traceback for {task!r} (most recent call last):', file=file) else: print(f'Stack for {task!r} (most recent call last):', file=file) traceback.print_list(extracted_list, file=file) if exc is not None: for line in traceback.format_exception_only(exc.__class__, exc): print(line, file=file, end='') taskgroups.py000064400000020427152527367570007350 0ustar00# Adapted with permission from the EdgeDB project; # license: PSFL. __all__ = ["TaskGroup"] from . import events from . import exceptions from . import tasks class TaskGroup: """Asynchronous context manager for managing groups of tasks. Example use: async with asyncio.TaskGroup() as group: task1 = group.create_task(some_coroutine(...)) task2 = group.create_task(other_coroutine(...)) print("Both tasks have completed now.") All tasks are awaited when the context manager exits. Any exceptions other than `asyncio.CancelledError` raised within a task will cancel all remaining tasks and wait for them to exit. The exceptions are then combined and raised as an `ExceptionGroup`. """ def __init__(self): self._entered = False self._exiting = False self._aborting = False self._loop = None self._parent_task = None self._parent_cancel_requested = False self._tasks = set() self._errors = [] self._base_error = None self._on_completed_fut = None def __repr__(self): info = [''] if self._tasks: info.append(f'tasks={len(self._tasks)}') if self._errors: info.append(f'errors={len(self._errors)}') if self._aborting: info.append('cancelling') elif self._entered: info.append('entered') info_str = ' '.join(info) return f'' async def __aenter__(self): if self._entered: raise RuntimeError( f"TaskGroup {self!r} has already been entered") if self._loop is None: self._loop = events.get_running_loop() self._parent_task = tasks.current_task(self._loop) if self._parent_task is None: raise RuntimeError( f'TaskGroup {self!r} cannot determine the parent task') self._entered = True return self async def __aexit__(self, et, exc, tb): self._exiting = True if (exc is not None and self._is_base_error(exc) and self._base_error is None): self._base_error = exc propagate_cancellation_error = \ exc if et is exceptions.CancelledError else None if self._parent_cancel_requested: # If this flag is set we *must* call uncancel(). if self._parent_task.uncancel() == 0: # If there are no pending cancellations left, # don't propagate CancelledError. propagate_cancellation_error = None if et is not None: if not self._aborting: # Our parent task is being cancelled: # # async with TaskGroup() as g: # g.create_task(...) # await ... # <- CancelledError # # or there's an exception in "async with": # # async with TaskGroup() as g: # g.create_task(...) # 1 / 0 # self._abort() # We use while-loop here because "self._on_completed_fut" # can be cancelled multiple times if our parent task # is being cancelled repeatedly (or even once, when # our own cancellation is already in progress) while self._tasks: if self._on_completed_fut is None: self._on_completed_fut = self._loop.create_future() try: await self._on_completed_fut except exceptions.CancelledError as ex: if not self._aborting: # Our parent task is being cancelled: # # async def wrapper(): # async with TaskGroup() as g: # g.create_task(foo) # # "wrapper" is being cancelled while "foo" is # still running. propagate_cancellation_error = ex self._abort() self._on_completed_fut = None assert not self._tasks if self._base_error is not None: raise self._base_error # Propagate CancelledError if there is one, except if there # are other errors -- those have priority. if propagate_cancellation_error and not self._errors: raise propagate_cancellation_error if et is not None and et is not exceptions.CancelledError: self._errors.append(exc) if self._errors: # Exceptions are heavy objects that can have object # cycles (bad for GC); let's not keep a reference to # a bunch of them. try: me = BaseExceptionGroup('unhandled errors in a TaskGroup', self._errors) raise me from None finally: self._errors = None def create_task(self, coro, *, name=None, context=None): """Create a new task in this group and return it. Similar to `asyncio.create_task`. """ if not self._entered: raise RuntimeError(f"TaskGroup {self!r} has not been entered") if self._exiting and not self._tasks: raise RuntimeError(f"TaskGroup {self!r} is finished") if self._aborting: raise RuntimeError(f"TaskGroup {self!r} is shutting down") if context is None: task = self._loop.create_task(coro) else: task = self._loop.create_task(coro, context=context) tasks._set_task_name(task, name) task.add_done_callback(self._on_task_done) self._tasks.add(task) return task # Since Python 3.8 Tasks propagate all exceptions correctly, # except for KeyboardInterrupt and SystemExit which are # still considered special. def _is_base_error(self, exc: BaseException) -> bool: assert isinstance(exc, BaseException) return isinstance(exc, (SystemExit, KeyboardInterrupt)) def _abort(self): self._aborting = True for t in self._tasks: if not t.done(): t.cancel() def _on_task_done(self, task): self._tasks.discard(task) if self._on_completed_fut is not None and not self._tasks: if not self._on_completed_fut.done(): self._on_completed_fut.set_result(True) if task.cancelled(): return exc = task.exception() if exc is None: return self._errors.append(exc) if self._is_base_error(exc) and self._base_error is None: self._base_error = exc if self._parent_task.done(): # Not sure if this case is possible, but we want to handle # it anyways. self._loop.call_exception_handler({ 'message': f'Task {task!r} has errored out but its parent ' f'task {self._parent_task} is already completed', 'exception': exc, 'task': task, }) return if not self._aborting and not self._parent_cancel_requested: # If parent task *is not* being cancelled, it means that we want # to manually cancel it to abort whatever is being run right now # in the TaskGroup. But we want to mark parent task as # "not cancelled" later in __aexit__. Example situation that # we need to handle: # # async def foo(): # try: # async with TaskGroup() as g: # g.create_task(crash_soon()) # await something # <- this needs to be canceled # # by the TaskGroup, e.g. # # foo() needs to be cancelled # except Exception: # # Ignore any exceptions raised in the TaskGroup # pass # await something_else # this line has to be called # # after TaskGroup is finished. self._abort() self._parent_cancel_requested = True self._parent_task.cancel() base_subprocess.py000064400000021245152527367570010327 0ustar00import collections import subprocess import warnings from . import protocols from . import transports from .log import logger class BaseSubprocessTransport(transports.SubprocessTransport): def __init__(self, loop, protocol, args, shell, stdin, stdout, stderr, bufsize, waiter=None, extra=None, **kwargs): super().__init__(extra) self._closed = False self._protocol = protocol self._loop = loop self._proc = None self._pid = None self._returncode = None self._exit_waiters = [] self._pending_calls = collections.deque() self._pipes = {} self._finished = False if stdin == subprocess.PIPE: self._pipes[0] = None if stdout == subprocess.PIPE: self._pipes[1] = None if stderr == subprocess.PIPE: self._pipes[2] = None # Create the child process: set the _proc attribute try: self._start(args=args, shell=shell, stdin=stdin, stdout=stdout, stderr=stderr, bufsize=bufsize, **kwargs) except: self.close() raise self._pid = self._proc.pid self._extra['subprocess'] = self._proc if self._loop.get_debug(): if isinstance(args, (bytes, str)): program = args else: program = args[0] logger.debug('process %r created: pid %s', program, self._pid) self._loop.create_task(self._connect_pipes(waiter)) def __repr__(self): info = [self.__class__.__name__] if self._closed: info.append('closed') if self._pid is not None: info.append(f'pid={self._pid}') if self._returncode is not None: info.append(f'returncode={self._returncode}') elif self._pid is not None: info.append('running') else: info.append('not started') stdin = self._pipes.get(0) if stdin is not None: info.append(f'stdin={stdin.pipe}') stdout = self._pipes.get(1) stderr = self._pipes.get(2) if stdout is not None and stderr is stdout: info.append(f'stdout=stderr={stdout.pipe}') else: if stdout is not None: info.append(f'stdout={stdout.pipe}') if stderr is not None: info.append(f'stderr={stderr.pipe}') return '<{}>'.format(' '.join(info)) def _start(self, args, shell, stdin, stdout, stderr, bufsize, **kwargs): raise NotImplementedError def set_protocol(self, protocol): self._protocol = protocol def get_protocol(self): return self._protocol def is_closing(self): return self._closed def close(self): if self._closed: return self._closed = True for proto in self._pipes.values(): if proto is None: continue proto.pipe.close() if (self._proc is not None and # has the child process finished? self._returncode is None and # the child process has finished, but the # transport hasn't been notified yet? self._proc.poll() is None): if self._loop.get_debug(): logger.warning('Close running child process: kill %r', self) try: self._proc.kill() except ProcessLookupError: pass # Don't clear the _proc reference yet: _post_init() may still run def __del__(self, _warn=warnings.warn): if not self._closed: _warn(f"unclosed transport {self!r}", ResourceWarning, source=self) self.close() def get_pid(self): return self._pid def get_returncode(self): return self._returncode def get_pipe_transport(self, fd): if fd in self._pipes: return self._pipes[fd].pipe else: return None def _check_proc(self): if self._proc is None: raise ProcessLookupError() def send_signal(self, signal): self._check_proc() self._proc.send_signal(signal) def terminate(self): self._check_proc() self._proc.terminate() def kill(self): self._check_proc() self._proc.kill() async def _connect_pipes(self, waiter): try: proc = self._proc loop = self._loop if proc.stdin is not None: _, pipe = await loop.connect_write_pipe( lambda: WriteSubprocessPipeProto(self, 0), proc.stdin) self._pipes[0] = pipe if proc.stdout is not None: _, pipe = await loop.connect_read_pipe( lambda: ReadSubprocessPipeProto(self, 1), proc.stdout) self._pipes[1] = pipe if proc.stderr is not None: _, pipe = await loop.connect_read_pipe( lambda: ReadSubprocessPipeProto(self, 2), proc.stderr) self._pipes[2] = pipe assert self._pending_calls is not None loop.call_soon(self._protocol.connection_made, self) for callback, data in self._pending_calls: loop.call_soon(callback, *data) self._pending_calls = None except (SystemExit, KeyboardInterrupt): raise except BaseException as exc: if waiter is not None and not waiter.cancelled(): waiter.set_exception(exc) else: if waiter is not None and not waiter.cancelled(): waiter.set_result(None) def _call(self, cb, *data): if self._pending_calls is not None: self._pending_calls.append((cb, data)) else: self._loop.call_soon(cb, *data) def _pipe_connection_lost(self, fd, exc): self._call(self._protocol.pipe_connection_lost, fd, exc) self._try_finish() def _pipe_data_received(self, fd, data): self._call(self._protocol.pipe_data_received, fd, data) def _process_exited(self, returncode): assert returncode is not None, returncode assert self._returncode is None, self._returncode if self._loop.get_debug(): logger.info('%r exited with return code %r', self, returncode) self._returncode = returncode if self._proc.returncode is None: # asyncio uses a child watcher: copy the status into the Popen # object. On Python 3.6, it is required to avoid a ResourceWarning. self._proc.returncode = returncode self._call(self._protocol.process_exited) self._try_finish() async def _wait(self): """Wait until the process exit and return the process return code. This method is a coroutine.""" if self._returncode is not None: return self._returncode waiter = self._loop.create_future() self._exit_waiters.append(waiter) return await waiter def _try_finish(self): assert not self._finished if self._returncode is None: return if all(p is not None and p.disconnected for p in self._pipes.values()): self._finished = True self._call(self._call_connection_lost, None) def _call_connection_lost(self, exc): try: self._protocol.connection_lost(exc) finally: # wake up futures waiting for wait() for waiter in self._exit_waiters: if not waiter.cancelled(): waiter.set_result(self._returncode) self._exit_waiters = None self._loop = None self._proc = None self._protocol = None class WriteSubprocessPipeProto(protocols.BaseProtocol): def __init__(self, proc, fd): self.proc = proc self.fd = fd self.pipe = None self.disconnected = False def connection_made(self, transport): self.pipe = transport def __repr__(self): return f'<{self.__class__.__name__} fd={self.fd} pipe={self.pipe!r}>' def connection_lost(self, exc): self.disconnected = True self.proc._pipe_connection_lost(self.fd, exc) self.proc = None def pause_writing(self): self.proc._protocol.pause_writing() def resume_writing(self): self.proc._protocol.resume_writing() class ReadSubprocessPipeProto(WriteSubprocessPipeProto, protocols.Protocol): def data_received(self, data): self.proc._pipe_data_received(self.fd, data) base_events.py000064400000223170152527367570007444 0ustar00"""Base implementation of event loop. The event loop can be broken up into a multiplexer (the part responsible for notifying us of I/O events) and the event loop proper, which wraps a multiplexer with functionality for scheduling callbacks, immediately or at a given time in the future. Whenever a public API takes a callback, subsequent positional arguments will be passed to the callback if/when it is called. This avoids the proliferation of trivial lambdas implementing closures. Keyword arguments for the callback are not supported; this is a conscious design decision, leaving the door open for keyword arguments to modify the meaning of the API call itself. """ import collections import collections.abc import concurrent.futures import errno import functools import heapq import itertools import os import socket import stat import subprocess import threading import time import traceback import sys import warnings import weakref try: import ssl except ImportError: # pragma: no cover ssl = None from . import constants from . import coroutines from . import events from . import exceptions from . import futures from . import protocols from . import sslproto from . import staggered from . import tasks from . import transports from . import trsock from .log import logger __all__ = 'BaseEventLoop','Server', # Minimum number of _scheduled timer handles before cleanup of # cancelled handles is performed. _MIN_SCHEDULED_TIMER_HANDLES = 100 # Minimum fraction of _scheduled timer handles that are cancelled # before cleanup of cancelled handles is performed. _MIN_CANCELLED_TIMER_HANDLES_FRACTION = 0.5 _HAS_IPv6 = hasattr(socket, 'AF_INET6') # Maximum timeout passed to select to avoid OS limitations MAXIMUM_SELECT_TIMEOUT = 24 * 3600 def _format_handle(handle): cb = handle._callback if isinstance(getattr(cb, '__self__', None), tasks.Task): # format the task return repr(cb.__self__) else: return str(handle) def _format_pipe(fd): if fd == subprocess.PIPE: return '' elif fd == subprocess.STDOUT: return '' else: return repr(fd) def _set_reuseport(sock): if not hasattr(socket, 'SO_REUSEPORT'): raise ValueError('reuse_port not supported by socket module') else: try: sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEPORT, 1) except OSError: raise ValueError('reuse_port not supported by socket module, ' 'SO_REUSEPORT defined but not implemented.') def _ipaddr_info(host, port, family, type, proto, flowinfo=0, scopeid=0): # Try to skip getaddrinfo if "host" is already an IP. Users might have # handled name resolution in their own code and pass in resolved IPs. if not hasattr(socket, 'inet_pton'): return if proto not in {0, socket.IPPROTO_TCP, socket.IPPROTO_UDP} or \ host is None: return None if type == socket.SOCK_STREAM: proto = socket.IPPROTO_TCP elif type == socket.SOCK_DGRAM: proto = socket.IPPROTO_UDP else: return None if port is None: port = 0 elif isinstance(port, bytes) and port == b'': port = 0 elif isinstance(port, str) and port == '': port = 0 else: # If port's a service name like "http", don't skip getaddrinfo. try: port = int(port) except (TypeError, ValueError): return None if family == socket.AF_UNSPEC: afs = [socket.AF_INET] if _HAS_IPv6: afs.append(socket.AF_INET6) else: afs = [family] if isinstance(host, bytes): host = host.decode('idna') if '%' in host: # Linux's inet_pton doesn't accept an IPv6 zone index after host, # like '::1%lo0'. return None for af in afs: try: socket.inet_pton(af, host) # The host has already been resolved. if _HAS_IPv6 and af == socket.AF_INET6: return af, type, proto, '', (host, port, flowinfo, scopeid) else: return af, type, proto, '', (host, port) except OSError: pass # "host" is not an IP address. return None def _interleave_addrinfos(addrinfos, first_address_family_count=1): """Interleave list of addrinfo tuples by family.""" # Group addresses by family addrinfos_by_family = collections.OrderedDict() for addr in addrinfos: family = addr[0] if family not in addrinfos_by_family: addrinfos_by_family[family] = [] addrinfos_by_family[family].append(addr) addrinfos_lists = list(addrinfos_by_family.values()) reordered = [] if first_address_family_count > 1: reordered.extend(addrinfos_lists[0][:first_address_family_count - 1]) del addrinfos_lists[0][:first_address_family_count - 1] reordered.extend( a for a in itertools.chain.from_iterable( itertools.zip_longest(*addrinfos_lists) ) if a is not None) return reordered def _run_until_complete_cb(fut): if not fut.cancelled(): exc = fut.exception() if isinstance(exc, (SystemExit, KeyboardInterrupt)): # Issue #22429: run_forever() already finished, no need to # stop it. return futures._get_loop(fut).stop() if hasattr(socket, 'TCP_NODELAY'): def _set_nodelay(sock): if (sock.family in {socket.AF_INET, socket.AF_INET6} and sock.type == socket.SOCK_STREAM and sock.proto == socket.IPPROTO_TCP): sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1) else: def _set_nodelay(sock): pass def _check_ssl_socket(sock): if ssl is not None and isinstance(sock, ssl.SSLSocket): raise TypeError("Socket cannot be of type SSLSocket") class _SendfileFallbackProtocol(protocols.Protocol): def __init__(self, transp): if not isinstance(transp, transports._FlowControlMixin): raise TypeError("transport should be _FlowControlMixin instance") self._transport = transp self._proto = transp.get_protocol() self._should_resume_reading = transp.is_reading() self._should_resume_writing = transp._protocol_paused transp.pause_reading() transp.set_protocol(self) if self._should_resume_writing: self._write_ready_fut = self._transport._loop.create_future() else: self._write_ready_fut = None async def drain(self): if self._transport.is_closing(): raise ConnectionError("Connection closed by peer") fut = self._write_ready_fut if fut is None: return await fut def connection_made(self, transport): raise RuntimeError("Invalid state: " "connection should have been established already.") def connection_lost(self, exc): if self._write_ready_fut is not None: # Never happens if peer disconnects after sending the whole content # Thus disconnection is always an exception from user perspective if exc is None: self._write_ready_fut.set_exception( ConnectionError("Connection is closed by peer")) else: self._write_ready_fut.set_exception(exc) self._proto.connection_lost(exc) def pause_writing(self): if self._write_ready_fut is not None: return self._write_ready_fut = self._transport._loop.create_future() def resume_writing(self): if self._write_ready_fut is None: return self._write_ready_fut.set_result(False) self._write_ready_fut = None def data_received(self, data): raise RuntimeError("Invalid state: reading should be paused") def eof_received(self): raise RuntimeError("Invalid state: reading should be paused") async def restore(self): self._transport.set_protocol(self._proto) if self._should_resume_reading: self._transport.resume_reading() if self._write_ready_fut is not None: # Cancel the future. # Basically it has no effect because protocol is switched back, # no code should wait for it anymore. self._write_ready_fut.cancel() if self._should_resume_writing: self._proto.resume_writing() class Server(events.AbstractServer): def __init__(self, loop, sockets, protocol_factory, ssl_context, backlog, ssl_handshake_timeout, ssl_shutdown_timeout=None): self._loop = loop self._sockets = sockets self._active_count = 0 self._waiters = [] self._protocol_factory = protocol_factory self._backlog = backlog self._ssl_context = ssl_context self._ssl_handshake_timeout = ssl_handshake_timeout self._ssl_shutdown_timeout = ssl_shutdown_timeout self._serving = False self._serving_forever_fut = None def __repr__(self): return f'<{self.__class__.__name__} sockets={self.sockets!r}>' def _attach(self): assert self._sockets is not None self._active_count += 1 def _detach(self): assert self._active_count > 0 self._active_count -= 1 if self._active_count == 0 and self._sockets is None: self._wakeup() def _wakeup(self): waiters = self._waiters self._waiters = None for waiter in waiters: if not waiter.done(): waiter.set_result(waiter) def _start_serving(self): if self._serving: return self._serving = True for sock in self._sockets: sock.listen(self._backlog) self._loop._start_serving( self._protocol_factory, sock, self._ssl_context, self, self._backlog, self._ssl_handshake_timeout, self._ssl_shutdown_timeout) def get_loop(self): return self._loop def is_serving(self): return self._serving @property def sockets(self): if self._sockets is None: return () return tuple(trsock.TransportSocket(s) for s in self._sockets) def close(self): sockets = self._sockets if sockets is None: return self._sockets = None for sock in sockets: self._loop._stop_serving(sock) self._serving = False if (self._serving_forever_fut is not None and not self._serving_forever_fut.done()): self._serving_forever_fut.cancel() self._serving_forever_fut = None if self._active_count == 0: self._wakeup() async def start_serving(self): self._start_serving() # Skip one loop iteration so that all 'loop.add_reader' # go through. await tasks.sleep(0) async def serve_forever(self): if self._serving_forever_fut is not None: raise RuntimeError( f'server {self!r} is already being awaited on serve_forever()') if self._sockets is None: raise RuntimeError(f'server {self!r} is closed') self._start_serving() self._serving_forever_fut = self._loop.create_future() try: await self._serving_forever_fut except exceptions.CancelledError: try: self.close() await self.wait_closed() finally: raise finally: self._serving_forever_fut = None async def wait_closed(self): if self._sockets is None or self._waiters is None: return waiter = self._loop.create_future() self._waiters.append(waiter) await waiter class BaseEventLoop(events.AbstractEventLoop): def __init__(self): self._timer_cancelled_count = 0 self._closed = False self._stopping = False self._ready = collections.deque() self._scheduled = [] self._default_executor = None self._internal_fds = 0 # Identifier of the thread running the event loop, or None if the # event loop is not running self._thread_id = None self._clock_resolution = time.get_clock_info('monotonic').resolution self._exception_handler = None self.set_debug(coroutines._is_debug_mode()) # In debug mode, if the execution of a callback or a step of a task # exceed this duration in seconds, the slow callback/task is logged. self.slow_callback_duration = 0.1 self._current_handle = None self._task_factory = None self._coroutine_origin_tracking_enabled = False self._coroutine_origin_tracking_saved_depth = None # A weak set of all asynchronous generators that are # being iterated by the loop. self._asyncgens = weakref.WeakSet() # Set to True when `loop.shutdown_asyncgens` is called. self._asyncgens_shutdown_called = False # Set to True when `loop.shutdown_default_executor` is called. self._executor_shutdown_called = False def __repr__(self): return ( f'<{self.__class__.__name__} running={self.is_running()} ' f'closed={self.is_closed()} debug={self.get_debug()}>' ) def create_future(self): """Create a Future object attached to the loop.""" return futures.Future(loop=self) def create_task(self, coro, *, name=None, context=None): """Schedule a coroutine object. Return a task object. """ self._check_closed() if self._task_factory is None: task = tasks.Task(coro, loop=self, name=name, context=context) if task._source_traceback: del task._source_traceback[-1] else: if context is None: # Use legacy API if context is not needed task = self._task_factory(self, coro) else: task = self._task_factory(self, coro, context=context) tasks._set_task_name(task, name) return task def set_task_factory(self, factory): """Set a task factory that will be used by loop.create_task(). If factory is None the default task factory will be set. If factory is a callable, it should have a signature matching '(loop, coro)', where 'loop' will be a reference to the active event loop, 'coro' will be a coroutine object. The callable must return a Future. """ if factory is not None and not callable(factory): raise TypeError('task factory must be a callable or None') self._task_factory = factory def get_task_factory(self): """Return a task factory, or None if the default one is in use.""" return self._task_factory def _make_socket_transport(self, sock, protocol, waiter=None, *, extra=None, server=None): """Create socket transport.""" raise NotImplementedError def _make_ssl_transport( self, rawsock, protocol, sslcontext, waiter=None, *, server_side=False, server_hostname=None, extra=None, server=None, ssl_handshake_timeout=None, ssl_shutdown_timeout=None, call_connection_made=True): """Create SSL transport.""" raise NotImplementedError def _make_datagram_transport(self, sock, protocol, address=None, waiter=None, extra=None): """Create datagram transport.""" raise NotImplementedError def _make_read_pipe_transport(self, pipe, protocol, waiter=None, extra=None): """Create read pipe transport.""" raise NotImplementedError def _make_write_pipe_transport(self, pipe, protocol, waiter=None, extra=None): """Create write pipe transport.""" raise NotImplementedError async def _make_subprocess_transport(self, protocol, args, shell, stdin, stdout, stderr, bufsize, extra=None, **kwargs): """Create subprocess transport.""" raise NotImplementedError def _write_to_self(self): """Write a byte to self-pipe, to wake up the event loop. This may be called from a different thread. The subclass is responsible for implementing the self-pipe. """ raise NotImplementedError def _process_events(self, event_list): """Process selector events.""" raise NotImplementedError def _check_closed(self): if self._closed: raise RuntimeError('Event loop is closed') def _check_default_executor(self): if self._executor_shutdown_called: raise RuntimeError('Executor shutdown has been called') def _asyncgen_finalizer_hook(self, agen): self._asyncgens.discard(agen) if not self.is_closed(): self.call_soon_threadsafe(self.create_task, agen.aclose()) def _asyncgen_firstiter_hook(self, agen): if self._asyncgens_shutdown_called: warnings.warn( f"asynchronous generator {agen!r} was scheduled after " f"loop.shutdown_asyncgens() call", ResourceWarning, source=self) self._asyncgens.add(agen) async def shutdown_asyncgens(self): """Shutdown all active asynchronous generators.""" self._asyncgens_shutdown_called = True if not len(self._asyncgens): # If Python version is <3.6 or we don't have any asynchronous # generators alive. return closing_agens = list(self._asyncgens) self._asyncgens.clear() results = await tasks.gather( *[ag.aclose() for ag in closing_agens], return_exceptions=True) for result, agen in zip(results, closing_agens): if isinstance(result, Exception): self.call_exception_handler({ 'message': f'an error occurred during closing of ' f'asynchronous generator {agen!r}', 'exception': result, 'asyncgen': agen }) async def shutdown_default_executor(self): """Schedule the shutdown of the default executor.""" self._executor_shutdown_called = True if self._default_executor is None: return future = self.create_future() thread = threading.Thread(target=self._do_shutdown, args=(future,)) thread.start() try: await future finally: thread.join() def _do_shutdown(self, future): try: self._default_executor.shutdown(wait=True) if not self.is_closed(): self.call_soon_threadsafe(future.set_result, None) except Exception as ex: if not self.is_closed(): self.call_soon_threadsafe(future.set_exception, ex) def _check_running(self): if self.is_running(): raise RuntimeError('This event loop is already running') if events._get_running_loop() is not None: raise RuntimeError( 'Cannot run the event loop while another loop is running') def run_forever(self): """Run until stop() is called.""" self._check_closed() self._check_running() self._set_coroutine_origin_tracking(self._debug) old_agen_hooks = sys.get_asyncgen_hooks() try: self._thread_id = threading.get_ident() sys.set_asyncgen_hooks(firstiter=self._asyncgen_firstiter_hook, finalizer=self._asyncgen_finalizer_hook) events._set_running_loop(self) while True: self._run_once() if self._stopping: break finally: self._stopping = False self._thread_id = None events._set_running_loop(None) self._set_coroutine_origin_tracking(False) sys.set_asyncgen_hooks(*old_agen_hooks) def run_until_complete(self, future): """Run until the Future is done. If the argument is a coroutine, it is wrapped in a Task. WARNING: It would be disastrous to call run_until_complete() with the same coroutine twice -- it would wrap it in two different Tasks and that can't be good. Return the Future's result, or raise its exception. """ self._check_closed() self._check_running() new_task = not futures.isfuture(future) future = tasks.ensure_future(future, loop=self) if new_task: # An exception is raised if the future didn't complete, so there # is no need to log the "destroy pending task" message future._log_destroy_pending = False future.add_done_callback(_run_until_complete_cb) try: self.run_forever() except: if new_task and future.done() and not future.cancelled(): # The coroutine raised a BaseException. Consume the exception # to not log a warning, the caller doesn't have access to the # local task. future.exception() raise finally: future.remove_done_callback(_run_until_complete_cb) if not future.done(): raise RuntimeError('Event loop stopped before Future completed.') return future.result() def stop(self): """Stop running the event loop. Every callback already scheduled will still run. This simply informs run_forever to stop looping after a complete iteration. """ self._stopping = True def close(self): """Close the event loop. This clears the queues and shuts down the executor, but does not wait for the executor to finish. The event loop must not be running. """ if self.is_running(): raise RuntimeError("Cannot close a running event loop") if self._closed: return if self._debug: logger.debug("Close %r", self) self._closed = True self._ready.clear() self._scheduled.clear() self._executor_shutdown_called = True executor = self._default_executor if executor is not None: self._default_executor = None executor.shutdown(wait=False) def is_closed(self): """Returns True if the event loop was closed.""" return self._closed def __del__(self, _warn=warnings.warn): if not self.is_closed(): _warn(f"unclosed event loop {self!r}", ResourceWarning, source=self) if not self.is_running(): self.close() def is_running(self): """Returns True if the event loop is running.""" return (self._thread_id is not None) def time(self): """Return the time according to the event loop's clock. This is a float expressed in seconds since an epoch, but the epoch, precision, accuracy and drift are unspecified and may differ per event loop. """ return time.monotonic() def call_later(self, delay, callback, *args, context=None): """Arrange for a callback to be called at a given time. Return a Handle: an opaque object with a cancel() method that can be used to cancel the call. The delay can be an int or float, expressed in seconds. It is always relative to the current time. Each callback will be called exactly once. If two callbacks are scheduled for exactly the same time, it is undefined which will be called first. Any positional arguments after the callback will be passed to the callback when it is called. """ if delay is None: raise TypeError('delay must not be None') timer = self.call_at(self.time() + delay, callback, *args, context=context) if timer._source_traceback: del timer._source_traceback[-1] return timer def call_at(self, when, callback, *args, context=None): """Like call_later(), but uses an absolute time. Absolute time corresponds to the event loop's time() method. """ if when is None: raise TypeError("when cannot be None") self._check_closed() if self._debug: self._check_thread() self._check_callback(callback, 'call_at') timer = events.TimerHandle(when, callback, args, self, context) if timer._source_traceback: del timer._source_traceback[-1] heapq.heappush(self._scheduled, timer) timer._scheduled = True return timer def call_soon(self, callback, *args, context=None): """Arrange for a callback to be called as soon as possible. This operates as a FIFO queue: callbacks are called in the order in which they are registered. Each callback will be called exactly once. Any positional arguments after the callback will be passed to the callback when it is called. """ self._check_closed() if self._debug: self._check_thread() self._check_callback(callback, 'call_soon') handle = self._call_soon(callback, args, context) if handle._source_traceback: del handle._source_traceback[-1] return handle def _check_callback(self, callback, method): if (coroutines.iscoroutine(callback) or coroutines.iscoroutinefunction(callback)): raise TypeError( f"coroutines cannot be used with {method}()") if not callable(callback): raise TypeError( f'a callable object was expected by {method}(), ' f'got {callback!r}') def _call_soon(self, callback, args, context): handle = events.Handle(callback, args, self, context) if handle._source_traceback: del handle._source_traceback[-1] self._ready.append(handle) return handle def _check_thread(self): """Check that the current thread is the thread running the event loop. Non-thread-safe methods of this class make this assumption and will likely behave incorrectly when the assumption is violated. Should only be called when (self._debug == True). The caller is responsible for checking this condition for performance reasons. """ if self._thread_id is None: return thread_id = threading.get_ident() if thread_id != self._thread_id: raise RuntimeError( "Non-thread-safe operation invoked on an event loop other " "than the current one") def call_soon_threadsafe(self, callback, *args, context=None): """Like call_soon(), but thread-safe.""" self._check_closed() if self._debug: self._check_callback(callback, 'call_soon_threadsafe') handle = self._call_soon(callback, args, context) if handle._source_traceback: del handle._source_traceback[-1] self._write_to_self() return handle def run_in_executor(self, executor, func, *args): self._check_closed() if self._debug: self._check_callback(func, 'run_in_executor') if executor is None: executor = self._default_executor # Only check when the default executor is being used self._check_default_executor() if executor is None: executor = concurrent.futures.ThreadPoolExecutor( thread_name_prefix='asyncio' ) self._default_executor = executor return futures.wrap_future( executor.submit(func, *args), loop=self) def set_default_executor(self, executor): if not isinstance(executor, concurrent.futures.ThreadPoolExecutor): raise TypeError('executor must be ThreadPoolExecutor instance') self._default_executor = executor def _getaddrinfo_debug(self, host, port, family, type, proto, flags): msg = [f"{host}:{port!r}"] if family: msg.append(f'family={family!r}') if type: msg.append(f'type={type!r}') if proto: msg.append(f'proto={proto!r}') if flags: msg.append(f'flags={flags!r}') msg = ', '.join(msg) logger.debug('Get address info %s', msg) t0 = self.time() addrinfo = socket.getaddrinfo(host, port, family, type, proto, flags) dt = self.time() - t0 msg = f'Getting address info {msg} took {dt * 1e3:.3f}ms: {addrinfo!r}' if dt >= self.slow_callback_duration: logger.info(msg) else: logger.debug(msg) return addrinfo async def getaddrinfo(self, host, port, *, family=0, type=0, proto=0, flags=0): if self._debug: getaddr_func = self._getaddrinfo_debug else: getaddr_func = socket.getaddrinfo return await self.run_in_executor( None, getaddr_func, host, port, family, type, proto, flags) async def getnameinfo(self, sockaddr, flags=0): return await self.run_in_executor( None, socket.getnameinfo, sockaddr, flags) async def sock_sendfile(self, sock, file, offset=0, count=None, *, fallback=True): if self._debug and sock.gettimeout() != 0: raise ValueError("the socket must be non-blocking") _check_ssl_socket(sock) self._check_sendfile_params(sock, file, offset, count) try: return await self._sock_sendfile_native(sock, file, offset, count) except exceptions.SendfileNotAvailableError as exc: if not fallback: raise return await self._sock_sendfile_fallback(sock, file, offset, count) async def _sock_sendfile_native(self, sock, file, offset, count): # NB: sendfile syscall is not supported for SSL sockets and # non-mmap files even if sendfile is supported by OS raise exceptions.SendfileNotAvailableError( f"syscall sendfile is not available for socket {sock!r} " f"and file {file!r} combination") async def _sock_sendfile_fallback(self, sock, file, offset, count): if offset: file.seek(offset) blocksize = ( min(count, constants.SENDFILE_FALLBACK_READBUFFER_SIZE) if count else constants.SENDFILE_FALLBACK_READBUFFER_SIZE ) buf = bytearray(blocksize) total_sent = 0 try: while True: if count: blocksize = min(count - total_sent, blocksize) if blocksize <= 0: break view = memoryview(buf)[:blocksize] read = await self.run_in_executor(None, file.readinto, view) if not read: break # EOF await self.sock_sendall(sock, view[:read]) total_sent += read return total_sent finally: if total_sent > 0 and hasattr(file, 'seek'): file.seek(offset + total_sent) def _check_sendfile_params(self, sock, file, offset, count): if 'b' not in getattr(file, 'mode', 'b'): raise ValueError("file should be opened in binary mode") if not sock.type == socket.SOCK_STREAM: raise ValueError("only SOCK_STREAM type sockets are supported") if count is not None: if not isinstance(count, int): raise TypeError( "count must be a positive integer (got {!r})".format(count)) if count <= 0: raise ValueError( "count must be a positive integer (got {!r})".format(count)) if not isinstance(offset, int): raise TypeError( "offset must be a non-negative integer (got {!r})".format( offset)) if offset < 0: raise ValueError( "offset must be a non-negative integer (got {!r})".format( offset)) async def _connect_sock(self, exceptions, addr_info, local_addr_infos=None): """Create, bind and connect one socket.""" my_exceptions = [] exceptions.append(my_exceptions) family, type_, proto, _, address = addr_info sock = None try: sock = socket.socket(family=family, type=type_, proto=proto) sock.setblocking(False) if local_addr_infos is not None: for lfamily, _, _, _, laddr in local_addr_infos: # skip local addresses of different family if lfamily != family: continue try: sock.bind(laddr) break except OSError as exc: msg = ( f'error while attempting to bind on ' f'address {laddr!r}: ' f'{exc.strerror.lower()}' ) exc = OSError(exc.errno, msg) my_exceptions.append(exc) else: # all bind attempts failed if my_exceptions: raise my_exceptions.pop() else: raise OSError(f"no matching local address with {family=} found") await self.sock_connect(sock, address) return sock except OSError as exc: my_exceptions.append(exc) if sock is not None: sock.close() raise except: if sock is not None: sock.close() raise finally: exceptions = my_exceptions = None async def create_connection( self, protocol_factory, host=None, port=None, *, ssl=None, family=0, proto=0, flags=0, sock=None, local_addr=None, server_hostname=None, ssl_handshake_timeout=None, ssl_shutdown_timeout=None, happy_eyeballs_delay=None, interleave=None): """Connect to a TCP server. Create a streaming transport connection to a given internet host and port: socket family AF_INET or socket.AF_INET6 depending on host (or family if specified), socket type SOCK_STREAM. protocol_factory must be a callable returning a protocol instance. This method is a coroutine which will try to establish the connection in the background. When successful, the coroutine returns a (transport, protocol) pair. """ if server_hostname is not None and not ssl: raise ValueError('server_hostname is only meaningful with ssl') if server_hostname is None and ssl: # Use host as default for server_hostname. It is an error # if host is empty or not set, e.g. when an # already-connected socket was passed or when only a port # is given. To avoid this error, you can pass # server_hostname='' -- this will bypass the hostname # check. (This also means that if host is a numeric # IP/IPv6 address, we will attempt to verify that exact # address; this will probably fail, but it is possible to # create a certificate for a specific IP address, so we # don't judge it here.) if not host: raise ValueError('You must set server_hostname ' 'when using ssl without a host') server_hostname = host if ssl_handshake_timeout is not None and not ssl: raise ValueError( 'ssl_handshake_timeout is only meaningful with ssl') if ssl_shutdown_timeout is not None and not ssl: raise ValueError( 'ssl_shutdown_timeout is only meaningful with ssl') if sock is not None: _check_ssl_socket(sock) if happy_eyeballs_delay is not None and interleave is None: # If using happy eyeballs, default to interleave addresses by family interleave = 1 if host is not None or port is not None: if sock is not None: raise ValueError( 'host/port and sock can not be specified at the same time') infos = await self._ensure_resolved( (host, port), family=family, type=socket.SOCK_STREAM, proto=proto, flags=flags, loop=self) if not infos: raise OSError('getaddrinfo() returned empty list') if local_addr is not None: laddr_infos = await self._ensure_resolved( local_addr, family=family, type=socket.SOCK_STREAM, proto=proto, flags=flags, loop=self) if not laddr_infos: raise OSError('getaddrinfo() returned empty list') else: laddr_infos = None if interleave: infos = _interleave_addrinfos(infos, interleave) exceptions = [] if happy_eyeballs_delay is None: # not using happy eyeballs for addrinfo in infos: try: sock = await self._connect_sock( exceptions, addrinfo, laddr_infos) break except OSError: continue else: # using happy eyeballs sock, _, _ = await staggered.staggered_race( (functools.partial(self._connect_sock, exceptions, addrinfo, laddr_infos) for addrinfo in infos), happy_eyeballs_delay, loop=self) if sock is None: exceptions = [exc for sub in exceptions for exc in sub] try: if len(exceptions) == 1: raise exceptions[0] else: # If they all have the same str(), raise one. model = str(exceptions[0]) if all(str(exc) == model for exc in exceptions): raise exceptions[0] # Raise a combined exception so the user can see all # the various error messages. raise OSError('Multiple exceptions: {}'.format( ', '.join(str(exc) for exc in exceptions))) finally: exceptions = None else: if sock is None: raise ValueError( 'host and port was not specified and no sock specified') if sock.type != socket.SOCK_STREAM: # We allow AF_INET, AF_INET6, AF_UNIX as long as they # are SOCK_STREAM. # We support passing AF_UNIX sockets even though we have # a dedicated API for that: create_unix_connection. # Disallowing AF_UNIX in this method, breaks backwards # compatibility. raise ValueError( f'A Stream Socket was expected, got {sock!r}') transport, protocol = await self._create_connection_transport( sock, protocol_factory, ssl, server_hostname, ssl_handshake_timeout=ssl_handshake_timeout, ssl_shutdown_timeout=ssl_shutdown_timeout) if self._debug: # Get the socket from the transport because SSL transport closes # the old socket and creates a new SSL socket sock = transport.get_extra_info('socket') logger.debug("%r connected to %s:%r: (%r, %r)", sock, host, port, transport, protocol) return transport, protocol async def _create_connection_transport( self, sock, protocol_factory, ssl, server_hostname, server_side=False, ssl_handshake_timeout=None, ssl_shutdown_timeout=None): sock.setblocking(False) protocol = protocol_factory() waiter = self.create_future() if ssl: sslcontext = None if isinstance(ssl, bool) else ssl transport = self._make_ssl_transport( sock, protocol, sslcontext, waiter, server_side=server_side, server_hostname=server_hostname, ssl_handshake_timeout=ssl_handshake_timeout, ssl_shutdown_timeout=ssl_shutdown_timeout) else: transport = self._make_socket_transport(sock, protocol, waiter) try: await waiter except: transport.close() raise return transport, protocol async def sendfile(self, transport, file, offset=0, count=None, *, fallback=True): """Send a file to transport. Return the total number of bytes which were sent. The method uses high-performance os.sendfile if available. file must be a regular file object opened in binary mode. offset tells from where to start reading the file. If specified, count is the total number of bytes to transmit as opposed to sending the file until EOF is reached. File position is updated on return or also in case of error in which case file.tell() can be used to figure out the number of bytes which were sent. fallback set to True makes asyncio to manually read and send the file when the platform does not support the sendfile syscall (e.g. Windows or SSL socket on Unix). Raise SendfileNotAvailableError if the system does not support sendfile syscall and fallback is False. """ if transport.is_closing(): raise RuntimeError("Transport is closing") mode = getattr(transport, '_sendfile_compatible', constants._SendfileMode.UNSUPPORTED) if mode is constants._SendfileMode.UNSUPPORTED: raise RuntimeError( f"sendfile is not supported for transport {transport!r}") if mode is constants._SendfileMode.TRY_NATIVE: try: return await self._sendfile_native(transport, file, offset, count) except exceptions.SendfileNotAvailableError as exc: if not fallback: raise if not fallback: raise RuntimeError( f"fallback is disabled and native sendfile is not " f"supported for transport {transport!r}") return await self._sendfile_fallback(transport, file, offset, count) async def _sendfile_native(self, transp, file, offset, count): raise exceptions.SendfileNotAvailableError( "sendfile syscall is not supported") async def _sendfile_fallback(self, transp, file, offset, count): if offset: file.seek(offset) blocksize = min(count, 16384) if count else 16384 buf = bytearray(blocksize) total_sent = 0 proto = _SendfileFallbackProtocol(transp) try: while True: if count: blocksize = min(count - total_sent, blocksize) if blocksize <= 0: return total_sent view = memoryview(buf)[:blocksize] read = await self.run_in_executor(None, file.readinto, view) if not read: return total_sent # EOF await proto.drain() transp.write(view[:read]) total_sent += read finally: if total_sent > 0 and hasattr(file, 'seek'): file.seek(offset + total_sent) await proto.restore() async def start_tls(self, transport, protocol, sslcontext, *, server_side=False, server_hostname=None, ssl_handshake_timeout=None, ssl_shutdown_timeout=None): """Upgrade transport to TLS. Return a new transport that *protocol* should start using immediately. """ if ssl is None: raise RuntimeError('Python ssl module is not available') if not isinstance(sslcontext, ssl.SSLContext): raise TypeError( f'sslcontext is expected to be an instance of ssl.SSLContext, ' f'got {sslcontext!r}') if not getattr(transport, '_start_tls_compatible', False): raise TypeError( f'transport {transport!r} is not supported by start_tls()') waiter = self.create_future() ssl_protocol = sslproto.SSLProtocol( self, protocol, sslcontext, waiter, server_side, server_hostname, ssl_handshake_timeout=ssl_handshake_timeout, ssl_shutdown_timeout=ssl_shutdown_timeout, call_connection_made=False) # Pause early so that "ssl_protocol.data_received()" doesn't # have a chance to get called before "ssl_protocol.connection_made()". transport.pause_reading() transport.set_protocol(ssl_protocol) conmade_cb = self.call_soon(ssl_protocol.connection_made, transport) resume_cb = self.call_soon(transport.resume_reading) try: await waiter except BaseException: transport.close() conmade_cb.cancel() resume_cb.cancel() raise return ssl_protocol._app_transport async def create_datagram_endpoint(self, protocol_factory, local_addr=None, remote_addr=None, *, family=0, proto=0, flags=0, reuse_port=None, allow_broadcast=None, sock=None): """Create datagram connection.""" if sock is not None: if sock.type == socket.SOCK_STREAM: raise ValueError( f'A datagram socket was expected, got {sock!r}') if (local_addr or remote_addr or family or proto or flags or reuse_port or allow_broadcast): # show the problematic kwargs in exception msg opts = dict(local_addr=local_addr, remote_addr=remote_addr, family=family, proto=proto, flags=flags, reuse_port=reuse_port, allow_broadcast=allow_broadcast) problems = ', '.join(f'{k}={v}' for k, v in opts.items() if v) raise ValueError( f'socket modifier keyword arguments can not be used ' f'when sock is specified. ({problems})') sock.setblocking(False) r_addr = None else: if not (local_addr or remote_addr): if family == 0: raise ValueError('unexpected address family') addr_pairs_info = (((family, proto), (None, None)),) elif hasattr(socket, 'AF_UNIX') and family == socket.AF_UNIX: for addr in (local_addr, remote_addr): if addr is not None and not isinstance(addr, str): raise TypeError('string is expected') if local_addr and local_addr[0] not in (0, '\x00'): try: if stat.S_ISSOCK(os.stat(local_addr).st_mode): os.remove(local_addr) except FileNotFoundError: pass except OSError as err: # Directory may have permissions only to create socket. logger.error('Unable to check or remove stale UNIX ' 'socket %r: %r', local_addr, err) addr_pairs_info = (((family, proto), (local_addr, remote_addr)), ) else: # join address by (family, protocol) addr_infos = {} # Using order preserving dict for idx, addr in ((0, local_addr), (1, remote_addr)): if addr is not None: if not (isinstance(addr, tuple) and len(addr) == 2): raise TypeError('2-tuple is expected') infos = await self._ensure_resolved( addr, family=family, type=socket.SOCK_DGRAM, proto=proto, flags=flags, loop=self) if not infos: raise OSError('getaddrinfo() returned empty list') for fam, _, pro, _, address in infos: key = (fam, pro) if key not in addr_infos: addr_infos[key] = [None, None] addr_infos[key][idx] = address # each addr has to have info for each (family, proto) pair addr_pairs_info = [ (key, addr_pair) for key, addr_pair in addr_infos.items() if not ((local_addr and addr_pair[0] is None) or (remote_addr and addr_pair[1] is None))] if not addr_pairs_info: raise ValueError('can not get address information') exceptions = [] for ((family, proto), (local_address, remote_address)) in addr_pairs_info: sock = None r_addr = None try: sock = socket.socket( family=family, type=socket.SOCK_DGRAM, proto=proto) if reuse_port: _set_reuseport(sock) if allow_broadcast: sock.setsockopt( socket.SOL_SOCKET, socket.SO_BROADCAST, 1) sock.setblocking(False) if local_addr: sock.bind(local_address) if remote_addr: if not allow_broadcast: await self.sock_connect(sock, remote_address) r_addr = remote_address except OSError as exc: if sock is not None: sock.close() exceptions.append(exc) except: if sock is not None: sock.close() raise else: break else: raise exceptions[0] protocol = protocol_factory() waiter = self.create_future() transport = self._make_datagram_transport( sock, protocol, r_addr, waiter) if self._debug: if local_addr: logger.info("Datagram endpoint local_addr=%r remote_addr=%r " "created: (%r, %r)", local_addr, remote_addr, transport, protocol) else: logger.debug("Datagram endpoint remote_addr=%r created: " "(%r, %r)", remote_addr, transport, protocol) try: await waiter except: transport.close() raise return transport, protocol async def _ensure_resolved(self, address, *, family=0, type=socket.SOCK_STREAM, proto=0, flags=0, loop): host, port = address[:2] info = _ipaddr_info(host, port, family, type, proto, *address[2:]) if info is not None: # "host" is already a resolved IP. return [info] else: return await loop.getaddrinfo(host, port, family=family, type=type, proto=proto, flags=flags) async def _create_server_getaddrinfo(self, host, port, family, flags): infos = await self._ensure_resolved((host, port), family=family, type=socket.SOCK_STREAM, flags=flags, loop=self) if not infos: raise OSError(f'getaddrinfo({host!r}) returned empty list') return infos async def create_server( self, protocol_factory, host=None, port=None, *, family=socket.AF_UNSPEC, flags=socket.AI_PASSIVE, sock=None, backlog=100, ssl=None, reuse_address=None, reuse_port=None, ssl_handshake_timeout=None, ssl_shutdown_timeout=None, start_serving=True): """Create a TCP server. The host parameter can be a string, in that case the TCP server is bound to host and port. The host parameter can also be a sequence of strings and in that case the TCP server is bound to all hosts of the sequence. If a host appears multiple times (possibly indirectly e.g. when hostnames resolve to the same IP address), the server is only bound once to that host. Return a Server object which can be used to stop the service. This method is a coroutine. """ if isinstance(ssl, bool): raise TypeError('ssl argument must be an SSLContext or None') if ssl_handshake_timeout is not None and ssl is None: raise ValueError( 'ssl_handshake_timeout is only meaningful with ssl') if ssl_shutdown_timeout is not None and ssl is None: raise ValueError( 'ssl_shutdown_timeout is only meaningful with ssl') if sock is not None: _check_ssl_socket(sock) if host is not None or port is not None: if sock is not None: raise ValueError( 'host/port and sock can not be specified at the same time') if reuse_address is None: reuse_address = os.name == "posix" and sys.platform != "cygwin" sockets = [] if host == '': hosts = [None] elif (isinstance(host, str) or not isinstance(host, collections.abc.Iterable)): hosts = [host] else: hosts = host fs = [self._create_server_getaddrinfo(host, port, family=family, flags=flags) for host in hosts] infos = await tasks.gather(*fs) infos = set(itertools.chain.from_iterable(infos)) completed = False try: for res in infos: af, socktype, proto, canonname, sa = res try: sock = socket.socket(af, socktype, proto) except socket.error: # Assume it's a bad family/type/protocol combination. if self._debug: logger.warning('create_server() failed to create ' 'socket.socket(%r, %r, %r)', af, socktype, proto, exc_info=True) continue sockets.append(sock) if reuse_address: sock.setsockopt( socket.SOL_SOCKET, socket.SO_REUSEADDR, True) if reuse_port: _set_reuseport(sock) # Disable IPv4/IPv6 dual stack support (enabled by # default on Linux) which makes a single socket # listen on both address families. if (_HAS_IPv6 and af == socket.AF_INET6 and hasattr(socket, 'IPPROTO_IPV6')): sock.setsockopt(socket.IPPROTO_IPV6, socket.IPV6_V6ONLY, True) try: sock.bind(sa) except OSError as err: msg = ('error while attempting ' 'to bind on address %r: %s' % (sa, err.strerror.lower())) if err.errno == errno.EADDRNOTAVAIL: # Assume the family is not enabled (bpo-30945) sockets.pop() sock.close() if self._debug: logger.warning(msg) continue raise OSError(err.errno, msg) from None if not sockets: raise OSError('could not bind on any address out of %r' % ([info[4] for info in infos],)) completed = True finally: if not completed: for sock in sockets: sock.close() else: if sock is None: raise ValueError('Neither host/port nor sock were specified') if sock.type != socket.SOCK_STREAM: raise ValueError(f'A Stream Socket was expected, got {sock!r}') sockets = [sock] for sock in sockets: sock.setblocking(False) server = Server(self, sockets, protocol_factory, ssl, backlog, ssl_handshake_timeout, ssl_shutdown_timeout) if start_serving: server._start_serving() # Skip one loop iteration so that all 'loop.add_reader' # go through. await tasks.sleep(0) if self._debug: logger.info("%r is serving", server) return server async def connect_accepted_socket( self, protocol_factory, sock, *, ssl=None, ssl_handshake_timeout=None, ssl_shutdown_timeout=None): if sock.type != socket.SOCK_STREAM: raise ValueError(f'A Stream Socket was expected, got {sock!r}') if ssl_handshake_timeout is not None and not ssl: raise ValueError( 'ssl_handshake_timeout is only meaningful with ssl') if ssl_shutdown_timeout is not None and not ssl: raise ValueError( 'ssl_shutdown_timeout is only meaningful with ssl') if sock is not None: _check_ssl_socket(sock) transport, protocol = await self._create_connection_transport( sock, protocol_factory, ssl, '', server_side=True, ssl_handshake_timeout=ssl_handshake_timeout, ssl_shutdown_timeout=ssl_shutdown_timeout) if self._debug: # Get the socket from the transport because SSL transport closes # the old socket and creates a new SSL socket sock = transport.get_extra_info('socket') logger.debug("%r handled: (%r, %r)", sock, transport, protocol) return transport, protocol async def connect_read_pipe(self, protocol_factory, pipe): protocol = protocol_factory() waiter = self.create_future() transport = self._make_read_pipe_transport(pipe, protocol, waiter) try: await waiter except: transport.close() raise if self._debug: logger.debug('Read pipe %r connected: (%r, %r)', pipe.fileno(), transport, protocol) return transport, protocol async def connect_write_pipe(self, protocol_factory, pipe): protocol = protocol_factory() waiter = self.create_future() transport = self._make_write_pipe_transport(pipe, protocol, waiter) try: await waiter except: transport.close() raise if self._debug: logger.debug('Write pipe %r connected: (%r, %r)', pipe.fileno(), transport, protocol) return transport, protocol def _log_subprocess(self, msg, stdin, stdout, stderr): info = [msg] if stdin is not None: info.append(f'stdin={_format_pipe(stdin)}') if stdout is not None and stderr == subprocess.STDOUT: info.append(f'stdout=stderr={_format_pipe(stdout)}') else: if stdout is not None: info.append(f'stdout={_format_pipe(stdout)}') if stderr is not None: info.append(f'stderr={_format_pipe(stderr)}') logger.debug(' '.join(info)) async def subprocess_shell(self, protocol_factory, cmd, *, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=False, shell=True, bufsize=0, encoding=None, errors=None, text=None, **kwargs): if not isinstance(cmd, (bytes, str)): raise ValueError("cmd must be a string") if universal_newlines: raise ValueError("universal_newlines must be False") if not shell: raise ValueError("shell must be True") if bufsize != 0: raise ValueError("bufsize must be 0") if text: raise ValueError("text must be False") if encoding is not None: raise ValueError("encoding must be None") if errors is not None: raise ValueError("errors must be None") protocol = protocol_factory() debug_log = None if self._debug: # don't log parameters: they may contain sensitive information # (password) and may be too long debug_log = 'run shell command %r' % cmd self._log_subprocess(debug_log, stdin, stdout, stderr) transport = await self._make_subprocess_transport( protocol, cmd, True, stdin, stdout, stderr, bufsize, **kwargs) if self._debug and debug_log is not None: logger.info('%s: %r', debug_log, transport) return transport, protocol async def subprocess_exec(self, protocol_factory, program, *args, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=False, shell=False, bufsize=0, encoding=None, errors=None, text=None, **kwargs): if universal_newlines: raise ValueError("universal_newlines must be False") if shell: raise ValueError("shell must be False") if bufsize != 0: raise ValueError("bufsize must be 0") if text: raise ValueError("text must be False") if encoding is not None: raise ValueError("encoding must be None") if errors is not None: raise ValueError("errors must be None") popen_args = (program,) + args protocol = protocol_factory() debug_log = None if self._debug: # don't log parameters: they may contain sensitive information # (password) and may be too long debug_log = f'execute program {program!r}' self._log_subprocess(debug_log, stdin, stdout, stderr) transport = await self._make_subprocess_transport( protocol, popen_args, False, stdin, stdout, stderr, bufsize, **kwargs) if self._debug and debug_log is not None: logger.info('%s: %r', debug_log, transport) return transport, protocol def get_exception_handler(self): """Return an exception handler, or None if the default one is in use. """ return self._exception_handler def set_exception_handler(self, handler): """Set handler as the new event loop exception handler. If handler is None, the default exception handler will be set. If handler is a callable object, it should have a signature matching '(loop, context)', where 'loop' will be a reference to the active event loop, 'context' will be a dict object (see `call_exception_handler()` documentation for details about context). """ if handler is not None and not callable(handler): raise TypeError(f'A callable object or None is expected, ' f'got {handler!r}') self._exception_handler = handler def default_exception_handler(self, context): """Default exception handler. This is called when an exception occurs and no exception handler is set, and can be called by a custom exception handler that wants to defer to the default behavior. This default handler logs the error message and other context-dependent information. In debug mode, a truncated stack trace is also appended showing where the given object (e.g. a handle or future or task) was created, if any. The context parameter has the same meaning as in `call_exception_handler()`. """ message = context.get('message') if not message: message = 'Unhandled exception in event loop' exception = context.get('exception') if exception is not None: exc_info = (type(exception), exception, exception.__traceback__) else: exc_info = False if ('source_traceback' not in context and self._current_handle is not None and self._current_handle._source_traceback): context['handle_traceback'] = \ self._current_handle._source_traceback log_lines = [message] for key in sorted(context): if key in {'message', 'exception'}: continue value = context[key] if key == 'source_traceback': tb = ''.join(traceback.format_list(value)) value = 'Object created at (most recent call last):\n' value += tb.rstrip() elif key == 'handle_traceback': tb = ''.join(traceback.format_list(value)) value = 'Handle created at (most recent call last):\n' value += tb.rstrip() else: value = repr(value) log_lines.append(f'{key}: {value}') logger.error('\n'.join(log_lines), exc_info=exc_info) def call_exception_handler(self, context): """Call the current event loop's exception handler. The context argument is a dict containing the following keys: - 'message': Error message; - 'exception' (optional): Exception object; - 'future' (optional): Future instance; - 'task' (optional): Task instance; - 'handle' (optional): Handle instance; - 'protocol' (optional): Protocol instance; - 'transport' (optional): Transport instance; - 'socket' (optional): Socket instance; - 'asyncgen' (optional): Asynchronous generator that caused the exception. New keys maybe introduced in the future. Note: do not overload this method in an event loop subclass. For custom exception handling, use the `set_exception_handler()` method. """ if self._exception_handler is None: try: self.default_exception_handler(context) except (SystemExit, KeyboardInterrupt): raise except BaseException: # Second protection layer for unexpected errors # in the default implementation, as well as for subclassed # event loops with overloaded "default_exception_handler". logger.error('Exception in default exception handler', exc_info=True) else: try: self._exception_handler(self, context) except (SystemExit, KeyboardInterrupt): raise except BaseException as exc: # Exception in the user set custom exception handler. try: # Let's try default handler. self.default_exception_handler({ 'message': 'Unhandled error in exception handler', 'exception': exc, 'context': context, }) except (SystemExit, KeyboardInterrupt): raise except BaseException: # Guard 'default_exception_handler' in case it is # overloaded. logger.error('Exception in default exception handler ' 'while handling an unexpected error ' 'in custom exception handler', exc_info=True) def _add_callback(self, handle): """Add a Handle to _ready.""" if not handle._cancelled: self._ready.append(handle) def _add_callback_signalsafe(self, handle): """Like _add_callback() but called from a signal handler.""" self._add_callback(handle) self._write_to_self() def _timer_handle_cancelled(self, handle): """Notification that a TimerHandle has been cancelled.""" if handle._scheduled: self._timer_cancelled_count += 1 def _run_once(self): """Run one full iteration of the event loop. This calls all currently ready callbacks, polls for I/O, schedules the resulting callbacks, and finally schedules 'call_later' callbacks. """ sched_count = len(self._scheduled) if (sched_count > _MIN_SCHEDULED_TIMER_HANDLES and self._timer_cancelled_count / sched_count > _MIN_CANCELLED_TIMER_HANDLES_FRACTION): # Remove delayed calls that were cancelled if their number # is too high new_scheduled = [] for handle in self._scheduled: if handle._cancelled: handle._scheduled = False else: new_scheduled.append(handle) heapq.heapify(new_scheduled) self._scheduled = new_scheduled self._timer_cancelled_count = 0 else: # Remove delayed calls that were cancelled from head of queue. while self._scheduled and self._scheduled[0]._cancelled: self._timer_cancelled_count -= 1 handle = heapq.heappop(self._scheduled) handle._scheduled = False timeout = None if self._ready or self._stopping: timeout = 0 elif self._scheduled: # Compute the desired timeout. when = self._scheduled[0]._when timeout = min(max(0, when - self.time()), MAXIMUM_SELECT_TIMEOUT) event_list = self._selector.select(timeout) self._process_events(event_list) # Needed to break cycles when an exception occurs. event_list = None # Handle 'later' callbacks that are ready. end_time = self.time() + self._clock_resolution while self._scheduled: handle = self._scheduled[0] if handle._when >= end_time: break handle = heapq.heappop(self._scheduled) handle._scheduled = False self._ready.append(handle) # This is the only place where callbacks are actually *called*. # All other places just add them to ready. # Note: We run all currently scheduled callbacks, but not any # callbacks scheduled by callbacks run this time around -- # they will be run the next time (after another I/O poll). # Use an idiom that is thread-safe without using locks. ntodo = len(self._ready) for i in range(ntodo): handle = self._ready.popleft() if handle._cancelled: continue if self._debug: try: self._current_handle = handle t0 = self.time() handle._run() dt = self.time() - t0 if dt >= self.slow_callback_duration: logger.warning('Executing %s took %.3f seconds', _format_handle(handle), dt) finally: self._current_handle = None else: handle._run() handle = None # Needed to break cycles when an exception occurs. def _set_coroutine_origin_tracking(self, enabled): if bool(enabled) == bool(self._coroutine_origin_tracking_enabled): return if enabled: self._coroutine_origin_tracking_saved_depth = ( sys.get_coroutine_origin_tracking_depth()) sys.set_coroutine_origin_tracking_depth( constants.DEBUG_STACK_DEPTH) else: sys.set_coroutine_origin_tracking_depth( self._coroutine_origin_tracking_saved_depth) self._coroutine_origin_tracking_enabled = enabled def get_debug(self): return self._debug def set_debug(self, enabled): self._debug = enabled if self.is_running(): self.call_soon_threadsafe(self._set_coroutine_origin_tracking, enabled) staggered.py000064400000013550152527367570007112 0ustar00"""Support for running coroutines in parallel with staggered start times.""" __all__ = 'staggered_race', import contextlib import typing from . import events from . import exceptions as exceptions_mod from . import locks from . import tasks async def staggered_race( coro_fns: typing.Iterable[typing.Callable[[], typing.Awaitable]], delay: typing.Optional[float], *, loop: events.AbstractEventLoop = None, ) -> typing.Tuple[ typing.Any, typing.Optional[int], typing.List[typing.Optional[Exception]] ]: """Run coroutines with staggered start times and take the first to finish. This method takes an iterable of coroutine functions. The first one is started immediately. From then on, whenever the immediately preceding one fails (raises an exception), or when *delay* seconds has passed, the next coroutine is started. This continues until one of the coroutines complete successfully, in which case all others are cancelled, or until all coroutines fail. The coroutines provided should be well-behaved in the following way: * They should only ``return`` if completed successfully. * They should always raise an exception if they did not complete successfully. In particular, if they handle cancellation, they should probably reraise, like this:: try: # do work except asyncio.CancelledError: # undo partially completed work raise Args: coro_fns: an iterable of coroutine functions, i.e. callables that return a coroutine object when called. Use ``functools.partial`` or lambdas to pass arguments. delay: amount of time, in seconds, between starting coroutines. If ``None``, the coroutines will run sequentially. loop: the event loop to use. Returns: tuple *(winner_result, winner_index, exceptions)* where - *winner_result*: the result of the winning coroutine, or ``None`` if no coroutines won. - *winner_index*: the index of the winning coroutine in ``coro_fns``, or ``None`` if no coroutines won. If the winning coroutine may return None on success, *winner_index* can be used to definitively determine whether any coroutine won. - *exceptions*: list of exceptions returned by the coroutines. ``len(exceptions)`` is equal to the number of coroutines actually started, and the order is the same as in ``coro_fns``. The winning coroutine's entry is ``None``. """ # TODO: when we have aiter() and anext(), allow async iterables in coro_fns. loop = loop or events.get_running_loop() enum_coro_fns = enumerate(coro_fns) winner_result = None winner_index = None exceptions = [] running_tasks = [] async def run_one_coro( previous_failed: typing.Optional[locks.Event]) -> None: # Wait for the previous task to finish, or for delay seconds if previous_failed is not None: with contextlib.suppress(exceptions_mod.TimeoutError): # Use asyncio.wait_for() instead of asyncio.wait() here, so # that if we get cancelled at this point, Event.wait() is also # cancelled, otherwise there will be a "Task destroyed but it is # pending" later. await tasks.wait_for(previous_failed.wait(), delay) # Get the next coroutine to run try: this_index, coro_fn = next(enum_coro_fns) except StopIteration: return # Start task that will run the next coroutine this_failed = locks.Event() next_task = loop.create_task(run_one_coro(this_failed)) running_tasks.append(next_task) assert len(running_tasks) == this_index + 2 # Prepare place to put this coroutine's exceptions if not won exceptions.append(None) assert len(exceptions) == this_index + 1 try: result = await coro_fn() except (SystemExit, KeyboardInterrupt): raise except BaseException as e: exceptions[this_index] = e this_failed.set() # Kickstart the next coroutine else: # Store winner's results nonlocal winner_index, winner_result assert winner_index is None winner_index = this_index winner_result = result # Cancel all other tasks. We take care to not cancel the current # task as well. If we do so, then since there is no `await` after # here and CancelledError are usually thrown at one, we will # encounter a curious corner case where the current task will end # up as done() == True, cancelled() == False, exception() == # asyncio.CancelledError. This behavior is specified in # https://bugs.python.org/issue30048 for i, t in enumerate(running_tasks): if i != this_index: t.cancel() first_task = loop.create_task(run_one_coro(None)) running_tasks.append(first_task) try: # Wait for a growing list of tasks to all finish: poor man's version of # curio's TaskGroup or trio's nursery done_count = 0 while done_count != len(running_tasks): done, _ = await tasks.wait(running_tasks) done_count = len(done) # If run_one_coro raises an unhandled exception, it's probably a # programming error, and I want to see it. if __debug__: for d in done: if d.done() and not d.cancelled() and d.exception(): raise d.exception() return winner_result, winner_index, exceptions finally: # Make sure no tasks are left running if we leave this function for t in running_tasks: t.cancel() futures.py000064400000033604152527367570006644 0ustar00"""A Future class similar to the one in PEP 3148.""" __all__ = ( 'Future', 'wrap_future', 'isfuture', ) import concurrent.futures import contextvars import logging import sys from types import GenericAlias from . import base_futures from . import events from . import exceptions from . import format_helpers isfuture = base_futures.isfuture _PENDING = base_futures._PENDING _CANCELLED = base_futures._CANCELLED _FINISHED = base_futures._FINISHED STACK_DEBUG = logging.DEBUG - 1 # heavy-duty debugging class Future: """This class is *almost* compatible with concurrent.futures.Future. Differences: - This class is not thread-safe. - result() and exception() do not take a timeout argument and raise an exception when the future isn't done yet. - Callbacks registered with add_done_callback() are always called via the event loop's call_soon(). - This class is not compatible with the wait() and as_completed() methods in the concurrent.futures package. (In Python 3.4 or later we may be able to unify the implementations.) """ # Class variables serving as defaults for instance variables. _state = _PENDING _result = None _exception = None _loop = None _source_traceback = None _cancel_message = None # A saved CancelledError for later chaining as an exception context. _cancelled_exc = None # This field is used for a dual purpose: # - Its presence is a marker to declare that a class implements # the Future protocol (i.e. is intended to be duck-type compatible). # The value must also be not-None, to enable a subclass to declare # that it is not compatible by setting this to None. # - It is set by __iter__() below so that Task._step() can tell # the difference between # `await Future()` or`yield from Future()` (correct) vs. # `yield Future()` (incorrect). _asyncio_future_blocking = False __log_traceback = False def __init__(self, *, loop=None): """Initialize the future. The optional event_loop argument allows explicitly setting the event loop object used by the future. If it's not provided, the future uses the default event loop. """ if loop is None: self._loop = events._get_event_loop() else: self._loop = loop self._callbacks = [] if self._loop.get_debug(): self._source_traceback = format_helpers.extract_stack( sys._getframe(1)) def __repr__(self): return base_futures._future_repr(self) def __del__(self): if not self.__log_traceback: # set_exception() was not called, or result() or exception() # has consumed the exception return exc = self._exception context = { 'message': f'{self.__class__.__name__} exception was never retrieved', 'exception': exc, 'future': self, } if self._source_traceback: context['source_traceback'] = self._source_traceback self._loop.call_exception_handler(context) __class_getitem__ = classmethod(GenericAlias) @property def _log_traceback(self): return self.__log_traceback @_log_traceback.setter def _log_traceback(self, val): if val: raise ValueError('_log_traceback can only be set to False') self.__log_traceback = False def get_loop(self): """Return the event loop the Future is bound to.""" loop = self._loop if loop is None: raise RuntimeError("Future object is not initialized.") return loop def _make_cancelled_error(self): """Create the CancelledError to raise if the Future is cancelled. This should only be called once when handling a cancellation since it erases the saved context exception value. """ if self._cancelled_exc is not None: exc = self._cancelled_exc self._cancelled_exc = None return exc if self._cancel_message is None: exc = exceptions.CancelledError() else: exc = exceptions.CancelledError(self._cancel_message) exc.__context__ = self._cancelled_exc # Remove the reference since we don't need this anymore. self._cancelled_exc = None return exc def cancel(self, msg=None): """Cancel the future and schedule callbacks. If the future is already done or cancelled, return False. Otherwise, change the future's state to cancelled, schedule the callbacks and return True. """ self.__log_traceback = False if self._state != _PENDING: return False self._state = _CANCELLED self._cancel_message = msg self.__schedule_callbacks() return True def __schedule_callbacks(self): """Internal: Ask the event loop to call all callbacks. The callbacks are scheduled to be called as soon as possible. Also clears the callback list. """ callbacks = self._callbacks[:] if not callbacks: return self._callbacks[:] = [] for callback, ctx in callbacks: self._loop.call_soon(callback, self, context=ctx) def cancelled(self): """Return True if the future was cancelled.""" return self._state == _CANCELLED # Don't implement running(); see http://bugs.python.org/issue18699 def done(self): """Return True if the future is done. Done means either that a result / exception are available, or that the future was cancelled. """ return self._state != _PENDING def result(self): """Return the result this future represents. If the future has been cancelled, raises CancelledError. If the future's result isn't yet available, raises InvalidStateError. If the future is done and has an exception set, this exception is raised. """ if self._state == _CANCELLED: exc = self._make_cancelled_error() raise exc if self._state != _FINISHED: raise exceptions.InvalidStateError('Result is not ready.') self.__log_traceback = False if self._exception is not None: raise self._exception.with_traceback(self._exception_tb) return self._result def exception(self): """Return the exception that was set on this future. The exception (or None if no exception was set) is returned only if the future is done. If the future has been cancelled, raises CancelledError. If the future isn't done yet, raises InvalidStateError. """ if self._state == _CANCELLED: exc = self._make_cancelled_error() raise exc if self._state != _FINISHED: raise exceptions.InvalidStateError('Exception is not set.') self.__log_traceback = False return self._exception def add_done_callback(self, fn, *, context=None): """Add a callback to be run when the future becomes done. The callback is called with a single argument - the future object. If the future is already done when this is called, the callback is scheduled with call_soon. """ if self._state != _PENDING: self._loop.call_soon(fn, self, context=context) else: if context is None: context = contextvars.copy_context() self._callbacks.append((fn, context)) # New method not in PEP 3148. def remove_done_callback(self, fn): """Remove all instances of a callback from the "call when done" list. Returns the number of callbacks removed. """ filtered_callbacks = [(f, ctx) for (f, ctx) in self._callbacks if f != fn] removed_count = len(self._callbacks) - len(filtered_callbacks) if removed_count: self._callbacks[:] = filtered_callbacks return removed_count # So-called internal methods (note: no set_running_or_notify_cancel()). def set_result(self, result): """Mark the future done and set its result. If the future is already done when this method is called, raises InvalidStateError. """ if self._state != _PENDING: raise exceptions.InvalidStateError(f'{self._state}: {self!r}') self._result = result self._state = _FINISHED self.__schedule_callbacks() def set_exception(self, exception): """Mark the future done and set an exception. If the future is already done when this method is called, raises InvalidStateError. """ if self._state != _PENDING: raise exceptions.InvalidStateError(f'{self._state}: {self!r}') if isinstance(exception, type): exception = exception() if type(exception) is StopIteration: raise TypeError("StopIteration interacts badly with generators " "and cannot be raised into a Future") self._exception = exception self._exception_tb = exception.__traceback__ self._state = _FINISHED self.__schedule_callbacks() self.__log_traceback = True def __await__(self): if not self.done(): self._asyncio_future_blocking = True yield self # This tells Task to wait for completion. if not self.done(): raise RuntimeError("await wasn't used with future") return self.result() # May raise too. __iter__ = __await__ # make compatible with 'yield from'. # Needed for testing purposes. _PyFuture = Future def _get_loop(fut): # Tries to call Future.get_loop() if it's available. # Otherwise fallbacks to using the old '_loop' property. try: get_loop = fut.get_loop except AttributeError: pass else: return get_loop() return fut._loop def _set_result_unless_cancelled(fut, result): """Helper setting the result only if the future was not cancelled.""" if fut.cancelled(): return fut.set_result(result) def _convert_future_exc(exc): exc_class = type(exc) if exc_class is concurrent.futures.CancelledError: return exceptions.CancelledError(*exc.args) elif exc_class is concurrent.futures.TimeoutError: return exceptions.TimeoutError(*exc.args) elif exc_class is concurrent.futures.InvalidStateError: return exceptions.InvalidStateError(*exc.args) else: return exc def _set_concurrent_future_state(concurrent, source): """Copy state from a future to a concurrent.futures.Future.""" assert source.done() if source.cancelled(): concurrent.cancel() if not concurrent.set_running_or_notify_cancel(): return exception = source.exception() if exception is not None: concurrent.set_exception(_convert_future_exc(exception)) else: result = source.result() concurrent.set_result(result) def _copy_future_state(source, dest): """Internal helper to copy state from another Future. The other Future may be a concurrent.futures.Future. """ assert source.done() if dest.cancelled(): return assert not dest.done() if source.cancelled(): dest.cancel() else: exception = source.exception() if exception is not None: dest.set_exception(_convert_future_exc(exception)) else: result = source.result() dest.set_result(result) def _chain_future(source, destination): """Chain two futures so that when one completes, so does the other. The result (or exception) of source will be copied to destination. If destination is cancelled, source gets cancelled too. Compatible with both asyncio.Future and concurrent.futures.Future. """ if not isfuture(source) and not isinstance(source, concurrent.futures.Future): raise TypeError('A future is required for source argument') if not isfuture(destination) and not isinstance(destination, concurrent.futures.Future): raise TypeError('A future is required for destination argument') source_loop = _get_loop(source) if isfuture(source) else None dest_loop = _get_loop(destination) if isfuture(destination) else None def _set_state(future, other): if isfuture(future): _copy_future_state(other, future) else: _set_concurrent_future_state(future, other) def _call_check_cancel(destination): if destination.cancelled(): if source_loop is None or source_loop is dest_loop: source.cancel() else: source_loop.call_soon_threadsafe(source.cancel) def _call_set_state(source): if (destination.cancelled() and dest_loop is not None and dest_loop.is_closed()): return if dest_loop is None or dest_loop is source_loop: _set_state(destination, source) else: if dest_loop.is_closed(): return dest_loop.call_soon_threadsafe(_set_state, destination, source) destination.add_done_callback(_call_check_cancel) source.add_done_callback(_call_set_state) def wrap_future(future, *, loop=None): """Wrap concurrent.futures.Future object.""" if isfuture(future): return future assert isinstance(future, concurrent.futures.Future), \ f'concurrent.futures.Future is expected, got {future!r}' if loop is None: loop = events._get_event_loop() new_future = loop.create_future() _chain_future(future, new_future) return new_future try: import _asyncio except ImportError: pass else: # _CFuture is needed for tests. Future = _CFuture = _asyncio.Future unix_events.py000064400000145313152527367570007517 0ustar00"""Selector event loop for Unix with signal handling.""" import errno import io import itertools import os import selectors import signal import socket import stat import subprocess import sys import threading import warnings from . import base_events from . import base_subprocess from . import constants from . import coroutines from . import events from . import exceptions from . import futures from . import selector_events from . import tasks from . import transports from .log import logger __all__ = ( 'SelectorEventLoop', 'AbstractChildWatcher', 'SafeChildWatcher', 'FastChildWatcher', 'PidfdChildWatcher', 'MultiLoopChildWatcher', 'ThreadedChildWatcher', 'DefaultEventLoopPolicy', ) if sys.platform == 'win32': # pragma: no cover raise ImportError('Signals are not really supported on Windows') def _sighandler_noop(signum, frame): """Dummy signal handler.""" pass def waitstatus_to_exitcode(status): try: return os.waitstatus_to_exitcode(status) except ValueError: # The child exited, but we don't understand its status. # This shouldn't happen, but if it does, let's just # return that status; perhaps that helps debug it. return status class _UnixSelectorEventLoop(selector_events.BaseSelectorEventLoop): """Unix event loop. Adds signal handling and UNIX Domain Socket support to SelectorEventLoop. """ def __init__(self, selector=None): super().__init__(selector) self._signal_handlers = {} def close(self): super().close() if not sys.is_finalizing(): for sig in list(self._signal_handlers): self.remove_signal_handler(sig) else: if self._signal_handlers: warnings.warn(f"Closing the loop {self!r} " f"on interpreter shutdown " f"stage, skipping signal handlers removal", ResourceWarning, source=self) self._signal_handlers.clear() def _process_self_data(self, data): for signum in data: if not signum: # ignore null bytes written by _write_to_self() continue self._handle_signal(signum) def add_signal_handler(self, sig, callback, *args): """Add a handler for a signal. UNIX only. Raise ValueError if the signal number is invalid or uncatchable. Raise RuntimeError if there is a problem setting up the handler. """ if (coroutines.iscoroutine(callback) or coroutines.iscoroutinefunction(callback)): raise TypeError("coroutines cannot be used " "with add_signal_handler()") self._check_signal(sig) self._check_closed() try: # set_wakeup_fd() raises ValueError if this is not the # main thread. By calling it early we ensure that an # event loop running in another thread cannot add a signal # handler. signal.set_wakeup_fd(self._csock.fileno()) except (ValueError, OSError) as exc: raise RuntimeError(str(exc)) handle = events.Handle(callback, args, self, None) self._signal_handlers[sig] = handle try: # Register a dummy signal handler to ask Python to write the signal # number in the wakeup file descriptor. _process_self_data() will # read signal numbers from this file descriptor to handle signals. signal.signal(sig, _sighandler_noop) # Set SA_RESTART to limit EINTR occurrences. signal.siginterrupt(sig, False) except OSError as exc: del self._signal_handlers[sig] if not self._signal_handlers: try: signal.set_wakeup_fd(-1) except (ValueError, OSError) as nexc: logger.info('set_wakeup_fd(-1) failed: %s', nexc) if exc.errno == errno.EINVAL: raise RuntimeError(f'sig {sig} cannot be caught') else: raise def _handle_signal(self, sig): """Internal helper that is the actual signal handler.""" handle = self._signal_handlers.get(sig) if handle is None: return # Assume it's some race condition. if handle._cancelled: self.remove_signal_handler(sig) # Remove it properly. else: self._add_callback_signalsafe(handle) def remove_signal_handler(self, sig): """Remove a handler for a signal. UNIX only. Return True if a signal handler was removed, False if not. """ self._check_signal(sig) try: del self._signal_handlers[sig] except KeyError: return False if sig == signal.SIGINT: handler = signal.default_int_handler else: handler = signal.SIG_DFL try: signal.signal(sig, handler) except OSError as exc: if exc.errno == errno.EINVAL: raise RuntimeError(f'sig {sig} cannot be caught') else: raise if not self._signal_handlers: try: signal.set_wakeup_fd(-1) except (ValueError, OSError) as exc: logger.info('set_wakeup_fd(-1) failed: %s', exc) return True def _check_signal(self, sig): """Internal helper to validate a signal. Raise ValueError if the signal number is invalid or uncatchable. Raise RuntimeError if there is a problem setting up the handler. """ if not isinstance(sig, int): raise TypeError(f'sig must be an int, not {sig!r}') if sig not in signal.valid_signals(): raise ValueError(f'invalid signal number {sig}') def _make_read_pipe_transport(self, pipe, protocol, waiter=None, extra=None): return _UnixReadPipeTransport(self, pipe, protocol, waiter, extra) def _make_write_pipe_transport(self, pipe, protocol, waiter=None, extra=None): return _UnixWritePipeTransport(self, pipe, protocol, waiter, extra) async def _make_subprocess_transport(self, protocol, args, shell, stdin, stdout, stderr, bufsize, extra=None, **kwargs): with events.get_child_watcher() as watcher: if not watcher.is_active(): # Check early. # Raising exception before process creation # prevents subprocess execution if the watcher # is not ready to handle it. raise RuntimeError("asyncio.get_child_watcher() is not activated, " "subprocess support is not installed.") waiter = self.create_future() transp = _UnixSubprocessTransport(self, protocol, args, shell, stdin, stdout, stderr, bufsize, waiter=waiter, extra=extra, **kwargs) watcher.add_child_handler(transp.get_pid(), self._child_watcher_callback, transp) try: await waiter except (SystemExit, KeyboardInterrupt): raise except BaseException: transp.close() await transp._wait() raise return transp def _child_watcher_callback(self, pid, returncode, transp): # Skip one iteration for callbacks to be executed self.call_soon_threadsafe(self.call_soon, transp._process_exited, returncode) async def create_unix_connection( self, protocol_factory, path=None, *, ssl=None, sock=None, server_hostname=None, ssl_handshake_timeout=None, ssl_shutdown_timeout=None): assert server_hostname is None or isinstance(server_hostname, str) if ssl: if server_hostname is None: raise ValueError( 'you have to pass server_hostname when using ssl') else: if server_hostname is not None: raise ValueError('server_hostname is only meaningful with ssl') if ssl_handshake_timeout is not None: raise ValueError( 'ssl_handshake_timeout is only meaningful with ssl') if ssl_shutdown_timeout is not None: raise ValueError( 'ssl_shutdown_timeout is only meaningful with ssl') if path is not None: if sock is not None: raise ValueError( 'path and sock can not be specified at the same time') path = os.fspath(path) sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM, 0) try: sock.setblocking(False) await self.sock_connect(sock, path) except: sock.close() raise else: if sock is None: raise ValueError('no path and sock were specified') if (sock.family != socket.AF_UNIX or sock.type != socket.SOCK_STREAM): raise ValueError( f'A UNIX Domain Stream Socket was expected, got {sock!r}') sock.setblocking(False) transport, protocol = await self._create_connection_transport( sock, protocol_factory, ssl, server_hostname, ssl_handshake_timeout=ssl_handshake_timeout, ssl_shutdown_timeout=ssl_shutdown_timeout) return transport, protocol async def create_unix_server( self, protocol_factory, path=None, *, sock=None, backlog=100, ssl=None, ssl_handshake_timeout=None, ssl_shutdown_timeout=None, start_serving=True): if isinstance(ssl, bool): raise TypeError('ssl argument must be an SSLContext or None') if ssl_handshake_timeout is not None and not ssl: raise ValueError( 'ssl_handshake_timeout is only meaningful with ssl') if ssl_shutdown_timeout is not None and not ssl: raise ValueError( 'ssl_shutdown_timeout is only meaningful with ssl') if path is not None: if sock is not None: raise ValueError( 'path and sock can not be specified at the same time') path = os.fspath(path) sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) # Check for abstract socket. `str` and `bytes` paths are supported. if path[0] not in (0, '\x00'): try: if stat.S_ISSOCK(os.stat(path).st_mode): os.remove(path) except FileNotFoundError: pass except OSError as err: # Directory may have permissions only to create socket. logger.error('Unable to check or remove stale UNIX socket ' '%r: %r', path, err) try: sock.bind(path) except OSError as exc: sock.close() if exc.errno == errno.EADDRINUSE: # Let's improve the error message by adding # with what exact address it occurs. msg = f'Address {path!r} is already in use' raise OSError(errno.EADDRINUSE, msg) from None else: raise except: sock.close() raise else: if sock is None: raise ValueError( 'path was not specified, and no sock specified') if (sock.family != socket.AF_UNIX or sock.type != socket.SOCK_STREAM): raise ValueError( f'A UNIX Domain Stream Socket was expected, got {sock!r}') sock.setblocking(False) server = base_events.Server(self, [sock], protocol_factory, ssl, backlog, ssl_handshake_timeout, ssl_shutdown_timeout) if start_serving: server._start_serving() # Skip one loop iteration so that all 'loop.add_reader' # go through. await tasks.sleep(0) return server async def _sock_sendfile_native(self, sock, file, offset, count): try: os.sendfile except AttributeError: raise exceptions.SendfileNotAvailableError( "os.sendfile() is not available") try: fileno = file.fileno() except (AttributeError, io.UnsupportedOperation) as err: raise exceptions.SendfileNotAvailableError("not a regular file") try: fsize = os.fstat(fileno).st_size except OSError: raise exceptions.SendfileNotAvailableError("not a regular file") blocksize = count if count else fsize if not blocksize: return 0 # empty file fut = self.create_future() self._sock_sendfile_native_impl(fut, None, sock, fileno, offset, count, blocksize, 0) return await fut def _sock_sendfile_native_impl(self, fut, registered_fd, sock, fileno, offset, count, blocksize, total_sent): fd = sock.fileno() if registered_fd is not None: # Remove the callback early. It should be rare that the # selector says the fd is ready but the call still returns # EAGAIN, and I am willing to take a hit in that case in # order to simplify the common case. self.remove_writer(registered_fd) if fut.cancelled(): self._sock_sendfile_update_filepos(fileno, offset, total_sent) return if count: blocksize = count - total_sent if blocksize <= 0: self._sock_sendfile_update_filepos(fileno, offset, total_sent) fut.set_result(total_sent) return try: sent = os.sendfile(fd, fileno, offset, blocksize) except (BlockingIOError, InterruptedError): if registered_fd is None: self._sock_add_cancellation_callback(fut, sock) self.add_writer(fd, self._sock_sendfile_native_impl, fut, fd, sock, fileno, offset, count, blocksize, total_sent) except OSError as exc: if (registered_fd is not None and exc.errno == errno.ENOTCONN and type(exc) is not ConnectionError): # If we have an ENOTCONN and this isn't a first call to # sendfile(), i.e. the connection was closed in the middle # of the operation, normalize the error to ConnectionError # to make it consistent across all Posix systems. new_exc = ConnectionError( "socket is not connected", errno.ENOTCONN) new_exc.__cause__ = exc exc = new_exc if total_sent == 0: # We can get here for different reasons, the main # one being 'file' is not a regular mmap(2)-like # file, in which case we'll fall back on using # plain send(). err = exceptions.SendfileNotAvailableError( "os.sendfile call failed") self._sock_sendfile_update_filepos(fileno, offset, total_sent) fut.set_exception(err) else: self._sock_sendfile_update_filepos(fileno, offset, total_sent) fut.set_exception(exc) except (SystemExit, KeyboardInterrupt): raise except BaseException as exc: self._sock_sendfile_update_filepos(fileno, offset, total_sent) fut.set_exception(exc) else: if sent == 0: # EOF self._sock_sendfile_update_filepos(fileno, offset, total_sent) fut.set_result(total_sent) else: offset += sent total_sent += sent if registered_fd is None: self._sock_add_cancellation_callback(fut, sock) self.add_writer(fd, self._sock_sendfile_native_impl, fut, fd, sock, fileno, offset, count, blocksize, total_sent) def _sock_sendfile_update_filepos(self, fileno, offset, total_sent): if total_sent > 0: os.lseek(fileno, offset, os.SEEK_SET) def _sock_add_cancellation_callback(self, fut, sock): def cb(fut): if fut.cancelled(): fd = sock.fileno() if fd != -1: self.remove_writer(fd) fut.add_done_callback(cb) class _UnixReadPipeTransport(transports.ReadTransport): max_size = 256 * 1024 # max bytes we read in one event loop iteration def __init__(self, loop, pipe, protocol, waiter=None, extra=None): super().__init__(extra) self._extra['pipe'] = pipe self._loop = loop self._pipe = pipe self._fileno = pipe.fileno() self._protocol = protocol self._closing = False self._paused = False mode = os.fstat(self._fileno).st_mode if not (stat.S_ISFIFO(mode) or stat.S_ISSOCK(mode) or stat.S_ISCHR(mode)): self._pipe = None self._fileno = None self._protocol = None raise ValueError("Pipe transport is for pipes/sockets only.") os.set_blocking(self._fileno, False) self._loop.call_soon(self._protocol.connection_made, self) # only start reading when connection_made() has been called self._loop.call_soon(self._add_reader, self._fileno, self._read_ready) if waiter is not None: # only wake up the waiter when connection_made() has been called self._loop.call_soon(futures._set_result_unless_cancelled, waiter, None) def _add_reader(self, fd, callback): if not self.is_reading(): return self._loop._add_reader(fd, callback) def is_reading(self): return not self._paused and not self._closing def __repr__(self): info = [self.__class__.__name__] if self._pipe is None: info.append('closed') elif self._closing: info.append('closing') info.append(f'fd={self._fileno}') selector = getattr(self._loop, '_selector', None) if self._pipe is not None and selector is not None: polling = selector_events._test_selector_event( selector, self._fileno, selectors.EVENT_READ) if polling: info.append('polling') else: info.append('idle') elif self._pipe is not None: info.append('open') else: info.append('closed') return '<{}>'.format(' '.join(info)) def _read_ready(self): try: data = os.read(self._fileno, self.max_size) except (BlockingIOError, InterruptedError): pass except OSError as exc: self._fatal_error(exc, 'Fatal read error on pipe transport') else: if data: self._protocol.data_received(data) else: if self._loop.get_debug(): logger.info("%r was closed by peer", self) self._closing = True self._loop._remove_reader(self._fileno) self._loop.call_soon(self._protocol.eof_received) self._loop.call_soon(self._call_connection_lost, None) def pause_reading(self): if not self.is_reading(): return self._paused = True self._loop._remove_reader(self._fileno) if self._loop.get_debug(): logger.debug("%r pauses reading", self) def resume_reading(self): if self._closing or not self._paused: return self._paused = False self._loop._add_reader(self._fileno, self._read_ready) if self._loop.get_debug(): logger.debug("%r resumes reading", self) def set_protocol(self, protocol): self._protocol = protocol def get_protocol(self): return self._protocol def is_closing(self): return self._closing def close(self): if not self._closing: self._close(None) def __del__(self, _warn=warnings.warn): if self._pipe is not None: _warn(f"unclosed transport {self!r}", ResourceWarning, source=self) self._pipe.close() def _fatal_error(self, exc, message='Fatal error on pipe transport'): # should be called by exception handler only if (isinstance(exc, OSError) and exc.errno == errno.EIO): if self._loop.get_debug(): logger.debug("%r: %s", self, message, exc_info=True) else: self._loop.call_exception_handler({ 'message': message, 'exception': exc, 'transport': self, 'protocol': self._protocol, }) self._close(exc) def _close(self, exc): self._closing = True self._loop._remove_reader(self._fileno) self._loop.call_soon(self._call_connection_lost, exc) def _call_connection_lost(self, exc): try: self._protocol.connection_lost(exc) finally: self._pipe.close() self._pipe = None self._protocol = None self._loop = None class _UnixWritePipeTransport(transports._FlowControlMixin, transports.WriteTransport): def __init__(self, loop, pipe, protocol, waiter=None, extra=None): super().__init__(extra, loop) self._extra['pipe'] = pipe self._pipe = pipe self._fileno = pipe.fileno() self._protocol = protocol self._buffer = bytearray() self._conn_lost = 0 self._closing = False # Set when close() or write_eof() called. mode = os.fstat(self._fileno).st_mode is_char = stat.S_ISCHR(mode) is_fifo = stat.S_ISFIFO(mode) is_socket = stat.S_ISSOCK(mode) if not (is_char or is_fifo or is_socket): self._pipe = None self._fileno = None self._protocol = None raise ValueError("Pipe transport is only for " "pipes, sockets and character devices") os.set_blocking(self._fileno, False) self._loop.call_soon(self._protocol.connection_made, self) # On AIX, the reader trick (to be notified when the read end of the # socket is closed) only works for sockets. On other platforms it # works for pipes and sockets. (Exception: OS X 10.4? Issue #19294.) if is_socket or (is_fifo and not sys.platform.startswith("aix")): # only start reading when connection_made() has been called self._loop.call_soon(self._loop._add_reader, self._fileno, self._read_ready) if waiter is not None: # only wake up the waiter when connection_made() has been called self._loop.call_soon(futures._set_result_unless_cancelled, waiter, None) def __repr__(self): info = [self.__class__.__name__] if self._pipe is None: info.append('closed') elif self._closing: info.append('closing') info.append(f'fd={self._fileno}') selector = getattr(self._loop, '_selector', None) if self._pipe is not None and selector is not None: polling = selector_events._test_selector_event( selector, self._fileno, selectors.EVENT_WRITE) if polling: info.append('polling') else: info.append('idle') bufsize = self.get_write_buffer_size() info.append(f'bufsize={bufsize}') elif self._pipe is not None: info.append('open') else: info.append('closed') return '<{}>'.format(' '.join(info)) def get_write_buffer_size(self): return len(self._buffer) def _read_ready(self): # Pipe was closed by peer. if self._loop.get_debug(): logger.info("%r was closed by peer", self) if self._buffer: self._close(BrokenPipeError()) else: self._close() def write(self, data): assert isinstance(data, (bytes, bytearray, memoryview)), repr(data) if isinstance(data, bytearray): data = memoryview(data) if not data: return if self._conn_lost or self._closing: if self._conn_lost >= constants.LOG_THRESHOLD_FOR_CONNLOST_WRITES: logger.warning('pipe closed by peer or ' 'os.write(pipe, data) raised exception.') self._conn_lost += 1 return if not self._buffer: # Attempt to send it right away first. try: n = os.write(self._fileno, data) except (BlockingIOError, InterruptedError): n = 0 except (SystemExit, KeyboardInterrupt): raise except BaseException as exc: self._conn_lost += 1 self._fatal_error(exc, 'Fatal write error on pipe transport') return if n == len(data): return elif n > 0: data = memoryview(data)[n:] self._loop._add_writer(self._fileno, self._write_ready) self._buffer += data self._maybe_pause_protocol() def _write_ready(self): assert self._buffer, 'Data should not be empty' try: n = os.write(self._fileno, self._buffer) except (BlockingIOError, InterruptedError): pass except (SystemExit, KeyboardInterrupt): raise except BaseException as exc: self._buffer.clear() self._conn_lost += 1 # Remove writer here, _fatal_error() doesn't it # because _buffer is empty. self._loop._remove_writer(self._fileno) self._fatal_error(exc, 'Fatal write error on pipe transport') else: if n == len(self._buffer): self._buffer.clear() self._loop._remove_writer(self._fileno) self._maybe_resume_protocol() # May append to buffer. if self._closing: self._loop._remove_reader(self._fileno) self._call_connection_lost(None) return elif n > 0: del self._buffer[:n] def can_write_eof(self): return True def write_eof(self): if self._closing: return assert self._pipe self._closing = True if not self._buffer: self._loop._remove_reader(self._fileno) self._loop.call_soon(self._call_connection_lost, None) def set_protocol(self, protocol): self._protocol = protocol def get_protocol(self): return self._protocol def is_closing(self): return self._closing def close(self): if self._pipe is not None and not self._closing: # write_eof is all what we needed to close the write pipe self.write_eof() def __del__(self, _warn=warnings.warn): if self._pipe is not None: _warn(f"unclosed transport {self!r}", ResourceWarning, source=self) self._pipe.close() def abort(self): self._close(None) def _fatal_error(self, exc, message='Fatal error on pipe transport'): # should be called by exception handler only if isinstance(exc, OSError): if self._loop.get_debug(): logger.debug("%r: %s", self, message, exc_info=True) else: self._loop.call_exception_handler({ 'message': message, 'exception': exc, 'transport': self, 'protocol': self._protocol, }) self._close(exc) def _close(self, exc=None): self._closing = True if self._buffer: self._loop._remove_writer(self._fileno) self._buffer.clear() self._loop._remove_reader(self._fileno) self._loop.call_soon(self._call_connection_lost, exc) def _call_connection_lost(self, exc): try: self._protocol.connection_lost(exc) finally: self._pipe.close() self._pipe = None self._protocol = None self._loop = None class _UnixSubprocessTransport(base_subprocess.BaseSubprocessTransport): def _start(self, args, shell, stdin, stdout, stderr, bufsize, **kwargs): stdin_w = None if stdin == subprocess.PIPE and sys.platform.startswith('aix'): # Use a socket pair for stdin on AIX, since it does not # support selecting read events on the write end of a # socket (which we use in order to detect closing of the # other end). stdin, stdin_w = socket.socketpair() try: self._proc = subprocess.Popen( args, shell=shell, stdin=stdin, stdout=stdout, stderr=stderr, universal_newlines=False, bufsize=bufsize, **kwargs) if stdin_w is not None: stdin.close() self._proc.stdin = open(stdin_w.detach(), 'wb', buffering=bufsize) stdin_w = None finally: if stdin_w is not None: stdin.close() stdin_w.close() class AbstractChildWatcher: """Abstract base class for monitoring child processes. Objects derived from this class monitor a collection of subprocesses and report their termination or interruption by a signal. New callbacks are registered with .add_child_handler(). Starting a new process must be done within a 'with' block to allow the watcher to suspend its activity until the new process if fully registered (this is needed to prevent a race condition in some implementations). Example: with watcher: proc = subprocess.Popen("sleep 1") watcher.add_child_handler(proc.pid, callback) Notes: Implementations of this class must be thread-safe. Since child watcher objects may catch the SIGCHLD signal and call waitpid(-1), there should be only one active object per process. """ def add_child_handler(self, pid, callback, *args): """Register a new child handler. Arrange for callback(pid, returncode, *args) to be called when process 'pid' terminates. Specifying another callback for the same process replaces the previous handler. Note: callback() must be thread-safe. """ raise NotImplementedError() def remove_child_handler(self, pid): """Removes the handler for process 'pid'. The function returns True if the handler was successfully removed, False if there was nothing to remove.""" raise NotImplementedError() def attach_loop(self, loop): """Attach the watcher to an event loop. If the watcher was previously attached to an event loop, then it is first detached before attaching to the new loop. Note: loop may be None. """ raise NotImplementedError() def close(self): """Close the watcher. This must be called to make sure that any underlying resource is freed. """ raise NotImplementedError() def is_active(self): """Return ``True`` if the watcher is active and is used by the event loop. Return True if the watcher is installed and ready to handle process exit notifications. """ raise NotImplementedError() def __enter__(self): """Enter the watcher's context and allow starting new processes This function must return self""" raise NotImplementedError() def __exit__(self, a, b, c): """Exit the watcher's context""" raise NotImplementedError() class PidfdChildWatcher(AbstractChildWatcher): """Child watcher implementation using Linux's pid file descriptors. This child watcher polls process file descriptors (pidfds) to await child process termination. In some respects, PidfdChildWatcher is a "Goldilocks" child watcher implementation. It doesn't require signals or threads, doesn't interfere with any processes launched outside the event loop, and scales linearly with the number of subprocesses launched by the event loop. The main disadvantage is that pidfds are specific to Linux, and only work on recent (5.3+) kernels. """ def __init__(self): self._loop = None self._callbacks = {} def __enter__(self): return self def __exit__(self, exc_type, exc_value, exc_traceback): pass def is_active(self): return self._loop is not None and self._loop.is_running() def close(self): self.attach_loop(None) def attach_loop(self, loop): if self._loop is not None and loop is None and self._callbacks: warnings.warn( 'A loop is being detached ' 'from a child watcher with pending handlers', RuntimeWarning) for pidfd, _, _ in self._callbacks.values(): self._loop._remove_reader(pidfd) os.close(pidfd) self._callbacks.clear() self._loop = loop def add_child_handler(self, pid, callback, *args): existing = self._callbacks.get(pid) if existing is not None: self._callbacks[pid] = existing[0], callback, args else: pidfd = os.pidfd_open(pid) self._loop._add_reader(pidfd, self._do_wait, pid) self._callbacks[pid] = pidfd, callback, args def _do_wait(self, pid): pidfd, callback, args = self._callbacks.pop(pid) self._loop._remove_reader(pidfd) try: _, status = os.waitpid(pid, 0) except ChildProcessError: # The child process is already reaped # (may happen if waitpid() is called elsewhere). returncode = 255 logger.warning( "child process pid %d exit status already read: " " will report returncode 255", pid) else: returncode = waitstatus_to_exitcode(status) os.close(pidfd) callback(pid, returncode, *args) def remove_child_handler(self, pid): try: pidfd, _, _ = self._callbacks.pop(pid) except KeyError: return False self._loop._remove_reader(pidfd) os.close(pidfd) return True class BaseChildWatcher(AbstractChildWatcher): def __init__(self): self._loop = None self._callbacks = {} def close(self): self.attach_loop(None) def is_active(self): return self._loop is not None and self._loop.is_running() def _do_waitpid(self, expected_pid): raise NotImplementedError() def _do_waitpid_all(self): raise NotImplementedError() def attach_loop(self, loop): assert loop is None or isinstance(loop, events.AbstractEventLoop) if self._loop is not None and loop is None and self._callbacks: warnings.warn( 'A loop is being detached ' 'from a child watcher with pending handlers', RuntimeWarning) if self._loop is not None: self._loop.remove_signal_handler(signal.SIGCHLD) self._loop = loop if loop is not None: loop.add_signal_handler(signal.SIGCHLD, self._sig_chld) # Prevent a race condition in case a child terminated # during the switch. self._do_waitpid_all() def _sig_chld(self): try: self._do_waitpid_all() except (SystemExit, KeyboardInterrupt): raise except BaseException as exc: # self._loop should always be available here # as '_sig_chld' is added as a signal handler # in 'attach_loop' self._loop.call_exception_handler({ 'message': 'Unknown exception in SIGCHLD handler', 'exception': exc, }) class SafeChildWatcher(BaseChildWatcher): """'Safe' child watcher implementation. This implementation avoids disrupting other code spawning processes by polling explicitly each process in the SIGCHLD handler instead of calling os.waitpid(-1). This is a safe solution but it has a significant overhead when handling a big number of children (O(n) each time SIGCHLD is raised) """ def close(self): self._callbacks.clear() super().close() def __enter__(self): return self def __exit__(self, a, b, c): pass def add_child_handler(self, pid, callback, *args): self._callbacks[pid] = (callback, args) # Prevent a race condition in case the child is already terminated. self._do_waitpid(pid) def remove_child_handler(self, pid): try: del self._callbacks[pid] return True except KeyError: return False def _do_waitpid_all(self): for pid in list(self._callbacks): self._do_waitpid(pid) def _do_waitpid(self, expected_pid): assert expected_pid > 0 try: pid, status = os.waitpid(expected_pid, os.WNOHANG) except ChildProcessError: # The child process is already reaped # (may happen if waitpid() is called elsewhere). pid = expected_pid returncode = 255 logger.warning( "Unknown child process pid %d, will report returncode 255", pid) else: if pid == 0: # The child process is still alive. return returncode = waitstatus_to_exitcode(status) if self._loop.get_debug(): logger.debug('process %s exited with returncode %s', expected_pid, returncode) try: callback, args = self._callbacks.pop(pid) except KeyError: # pragma: no cover # May happen if .remove_child_handler() is called # after os.waitpid() returns. if self._loop.get_debug(): logger.warning("Child watcher got an unexpected pid: %r", pid, exc_info=True) else: callback(pid, returncode, *args) class FastChildWatcher(BaseChildWatcher): """'Fast' child watcher implementation. This implementation reaps every terminated processes by calling os.waitpid(-1) directly, possibly breaking other code spawning processes and waiting for their termination. There is no noticeable overhead when handling a big number of children (O(1) each time a child terminates). """ def __init__(self): super().__init__() self._lock = threading.Lock() self._zombies = {} self._forks = 0 def close(self): self._callbacks.clear() self._zombies.clear() super().close() def __enter__(self): with self._lock: self._forks += 1 return self def __exit__(self, a, b, c): with self._lock: self._forks -= 1 if self._forks or not self._zombies: return collateral_victims = str(self._zombies) self._zombies.clear() logger.warning( "Caught subprocesses termination from unknown pids: %s", collateral_victims) def add_child_handler(self, pid, callback, *args): assert self._forks, "Must use the context manager" with self._lock: try: returncode = self._zombies.pop(pid) except KeyError: # The child is running. self._callbacks[pid] = callback, args return # The child is dead already. We can fire the callback. callback(pid, returncode, *args) def remove_child_handler(self, pid): try: del self._callbacks[pid] return True except KeyError: return False def _do_waitpid_all(self): # Because of signal coalescing, we must keep calling waitpid() as # long as we're able to reap a child. while True: try: pid, status = os.waitpid(-1, os.WNOHANG) except ChildProcessError: # No more child processes exist. return else: if pid == 0: # A child process is still alive. return returncode = waitstatus_to_exitcode(status) with self._lock: try: callback, args = self._callbacks.pop(pid) except KeyError: # unknown child if self._forks: # It may not be registered yet. self._zombies[pid] = returncode if self._loop.get_debug(): logger.debug('unknown process %s exited ' 'with returncode %s', pid, returncode) continue callback = None else: if self._loop.get_debug(): logger.debug('process %s exited with returncode %s', pid, returncode) if callback is None: logger.warning( "Caught subprocess termination from unknown pid: " "%d -> %d", pid, returncode) else: callback(pid, returncode, *args) class MultiLoopChildWatcher(AbstractChildWatcher): """A watcher that doesn't require running loop in the main thread. This implementation registers a SIGCHLD signal handler on instantiation (which may conflict with other code that install own handler for this signal). The solution is safe but it has a significant overhead when handling a big number of processes (*O(n)* each time a SIGCHLD is received). """ # Implementation note: # The class keeps compatibility with AbstractChildWatcher ABC # To achieve this it has empty attach_loop() method # and doesn't accept explicit loop argument # for add_child_handler()/remove_child_handler() # but retrieves the current loop by get_running_loop() def __init__(self): self._callbacks = {} self._saved_sighandler = None def is_active(self): return self._saved_sighandler is not None def close(self): self._callbacks.clear() if self._saved_sighandler is None: return handler = signal.getsignal(signal.SIGCHLD) if handler != self._sig_chld: logger.warning("SIGCHLD handler was changed by outside code") else: signal.signal(signal.SIGCHLD, self._saved_sighandler) self._saved_sighandler = None def __enter__(self): return self def __exit__(self, exc_type, exc_val, exc_tb): pass def add_child_handler(self, pid, callback, *args): loop = events.get_running_loop() self._callbacks[pid] = (loop, callback, args) # Prevent a race condition in case the child is already terminated. self._do_waitpid(pid) def remove_child_handler(self, pid): try: del self._callbacks[pid] return True except KeyError: return False def attach_loop(self, loop): # Don't save the loop but initialize itself if called first time # The reason to do it here is that attach_loop() is called from # unix policy only for the main thread. # Main thread is required for subscription on SIGCHLD signal if self._saved_sighandler is not None: return self._saved_sighandler = signal.signal(signal.SIGCHLD, self._sig_chld) if self._saved_sighandler is None: logger.warning("Previous SIGCHLD handler was set by non-Python code, " "restore to default handler on watcher close.") self._saved_sighandler = signal.SIG_DFL # Set SA_RESTART to limit EINTR occurrences. signal.siginterrupt(signal.SIGCHLD, False) def _do_waitpid_all(self): for pid in list(self._callbacks): self._do_waitpid(pid) def _do_waitpid(self, expected_pid): assert expected_pid > 0 try: pid, status = os.waitpid(expected_pid, os.WNOHANG) except ChildProcessError: # The child process is already reaped # (may happen if waitpid() is called elsewhere). pid = expected_pid returncode = 255 logger.warning( "Unknown child process pid %d, will report returncode 255", pid) debug_log = False else: if pid == 0: # The child process is still alive. return returncode = waitstatus_to_exitcode(status) debug_log = True try: loop, callback, args = self._callbacks.pop(pid) except KeyError: # pragma: no cover # May happen if .remove_child_handler() is called # after os.waitpid() returns. logger.warning("Child watcher got an unexpected pid: %r", pid, exc_info=True) else: if loop.is_closed(): logger.warning("Loop %r that handles pid %r is closed", loop, pid) else: if debug_log and loop.get_debug(): logger.debug('process %s exited with returncode %s', expected_pid, returncode) loop.call_soon_threadsafe(callback, pid, returncode, *args) def _sig_chld(self, signum, frame): try: self._do_waitpid_all() except (SystemExit, KeyboardInterrupt): raise except BaseException: logger.warning('Unknown exception in SIGCHLD handler', exc_info=True) class ThreadedChildWatcher(AbstractChildWatcher): """Threaded child watcher implementation. The watcher uses a thread per process for waiting for the process finish. It doesn't require subscription on POSIX signal but a thread creation is not free. The watcher has O(1) complexity, its performance doesn't depend on amount of spawn processes. """ def __init__(self): self._pid_counter = itertools.count(0) self._threads = {} def is_active(self): return True def close(self): pass def __enter__(self): return self def __exit__(self, exc_type, exc_val, exc_tb): pass def __del__(self, _warn=warnings.warn): threads = [thread for thread in list(self._threads.values()) if thread.is_alive()] if threads: _warn(f"{self.__class__} has registered but not finished child processes", ResourceWarning, source=self) def add_child_handler(self, pid, callback, *args): loop = events.get_running_loop() thread = threading.Thread(target=self._do_waitpid, name=f"asyncio-waitpid-{next(self._pid_counter)}", args=(loop, pid, callback, args), daemon=True) self._threads[pid] = thread thread.start() def remove_child_handler(self, pid): # asyncio never calls remove_child_handler() !!! # The method is no-op but is implemented because # abstract base classes require it. return True def attach_loop(self, loop): pass def _do_waitpid(self, loop, expected_pid, callback, args): assert expected_pid > 0 try: pid, status = os.waitpid(expected_pid, 0) except ChildProcessError: # The child process is already reaped # (may happen if waitpid() is called elsewhere). pid = expected_pid returncode = 255 logger.warning( "Unknown child process pid %d, will report returncode 255", pid) else: returncode = waitstatus_to_exitcode(status) if loop.get_debug(): logger.debug('process %s exited with returncode %s', expected_pid, returncode) if loop.is_closed(): logger.warning("Loop %r that handles pid %r is closed", loop, pid) else: loop.call_soon_threadsafe(callback, pid, returncode, *args) self._threads.pop(expected_pid) class _UnixDefaultEventLoopPolicy(events.BaseDefaultEventLoopPolicy): """UNIX event loop policy with a watcher for child processes.""" _loop_factory = _UnixSelectorEventLoop def __init__(self): super().__init__() self._watcher = None def _init_watcher(self): with events._lock: if self._watcher is None: # pragma: no branch self._watcher = ThreadedChildWatcher() def set_event_loop(self, loop): """Set the event loop. As a side effect, if a child watcher was set before, then calling .set_event_loop() from the main thread will call .attach_loop(loop) on the child watcher. """ super().set_event_loop(loop) if (self._watcher is not None and threading.current_thread() is threading.main_thread()): self._watcher.attach_loop(loop) def get_child_watcher(self): """Get the watcher for child processes. If not yet set, a ThreadedChildWatcher object is automatically created. """ if self._watcher is None: self._init_watcher() return self._watcher def set_child_watcher(self, watcher): """Set the watcher for child processes.""" assert watcher is None or isinstance(watcher, AbstractChildWatcher) if self._watcher is not None: self._watcher.close() self._watcher = watcher SelectorEventLoop = _UnixSelectorEventLoop DefaultEventLoopPolicy = _UnixDefaultEventLoopPolicy queues.py000064400000017446152527367570006464 0ustar00__all__ = ('Queue', 'PriorityQueue', 'LifoQueue', 'QueueFull', 'QueueEmpty') import collections import heapq from types import GenericAlias from . import locks from . import mixins class QueueEmpty(Exception): """Raised when Queue.get_nowait() is called on an empty Queue.""" pass class QueueFull(Exception): """Raised when the Queue.put_nowait() method is called on a full Queue.""" pass class Queue(mixins._LoopBoundMixin): """A queue, useful for coordinating producer and consumer coroutines. If maxsize is less than or equal to zero, the queue size is infinite. If it is an integer greater than 0, then "await put()" will block when the queue reaches maxsize, until an item is removed by get(). Unlike the standard library Queue, you can reliably know this Queue's size with qsize(), since your single-threaded asyncio application won't be interrupted between calling qsize() and doing an operation on the Queue. """ def __init__(self, maxsize=0): self._maxsize = maxsize # Futures. self._getters = collections.deque() # Futures. self._putters = collections.deque() self._unfinished_tasks = 0 self._finished = locks.Event() self._finished.set() self._init(maxsize) # These three are overridable in subclasses. def _init(self, maxsize): self._queue = collections.deque() def _get(self): return self._queue.popleft() def _put(self, item): self._queue.append(item) # End of the overridable methods. def _wakeup_next(self, waiters): # Wake up the next waiter (if any) that isn't cancelled. while waiters: waiter = waiters.popleft() if not waiter.done(): waiter.set_result(None) break def __repr__(self): return f'<{type(self).__name__} at {id(self):#x} {self._format()}>' def __str__(self): return f'<{type(self).__name__} {self._format()}>' __class_getitem__ = classmethod(GenericAlias) def _format(self): result = f'maxsize={self._maxsize!r}' if getattr(self, '_queue', None): result += f' _queue={list(self._queue)!r}' if self._getters: result += f' _getters[{len(self._getters)}]' if self._putters: result += f' _putters[{len(self._putters)}]' if self._unfinished_tasks: result += f' tasks={self._unfinished_tasks}' return result def qsize(self): """Number of items in the queue.""" return len(self._queue) @property def maxsize(self): """Number of items allowed in the queue.""" return self._maxsize def empty(self): """Return True if the queue is empty, False otherwise.""" return not self._queue def full(self): """Return True if there are maxsize items in the queue. Note: if the Queue was initialized with maxsize=0 (the default), then full() is never True. """ if self._maxsize <= 0: return False else: return self.qsize() >= self._maxsize async def put(self, item): """Put an item into the queue. Put an item into the queue. If the queue is full, wait until a free slot is available before adding item. """ while self.full(): putter = self._get_loop().create_future() self._putters.append(putter) try: await putter except: putter.cancel() # Just in case putter is not done yet. try: # Clean self._putters from canceled putters. self._putters.remove(putter) except ValueError: # The putter could be removed from self._putters by a # previous get_nowait call. pass if not self.full() and not putter.cancelled(): # We were woken up by get_nowait(), but can't take # the call. Wake up the next in line. self._wakeup_next(self._putters) raise return self.put_nowait(item) def put_nowait(self, item): """Put an item into the queue without blocking. If no free slot is immediately available, raise QueueFull. """ if self.full(): raise QueueFull self._put(item) self._unfinished_tasks += 1 self._finished.clear() self._wakeup_next(self._getters) async def get(self): """Remove and return an item from the queue. If queue is empty, wait until an item is available. """ while self.empty(): getter = self._get_loop().create_future() self._getters.append(getter) try: await getter except: getter.cancel() # Just in case getter is not done yet. try: # Clean self._getters from canceled getters. self._getters.remove(getter) except ValueError: # The getter could be removed from self._getters by a # previous put_nowait call. pass if not self.empty() and not getter.cancelled(): # We were woken up by put_nowait(), but can't take # the call. Wake up the next in line. self._wakeup_next(self._getters) raise return self.get_nowait() def get_nowait(self): """Remove and return an item from the queue. Return an item if one is immediately available, else raise QueueEmpty. """ if self.empty(): raise QueueEmpty item = self._get() self._wakeup_next(self._putters) return item def task_done(self): """Indicate that a formerly enqueued task is complete. Used by queue consumers. For each get() used to fetch a task, a subsequent call to task_done() tells the queue that the processing on the task is complete. If a join() is currently blocking, it will resume when all items have been processed (meaning that a task_done() call was received for every item that had been put() into the queue). Raises ValueError if called more times than there were items placed in the queue. """ if self._unfinished_tasks <= 0: raise ValueError('task_done() called too many times') self._unfinished_tasks -= 1 if self._unfinished_tasks == 0: self._finished.set() async def join(self): """Block until all items in the queue have been gotten and processed. The count of unfinished tasks goes up whenever an item is added to the queue. The count goes down whenever a consumer calls task_done() to indicate that the item was retrieved and all work on it is complete. When the count of unfinished tasks drops to zero, join() unblocks. """ if self._unfinished_tasks > 0: await self._finished.wait() class PriorityQueue(Queue): """A subclass of Queue; retrieves entries in priority order (lowest first). Entries are typically tuples of the form: (priority number, data). """ def _init(self, maxsize): self._queue = [] def _put(self, item, heappush=heapq.heappush): heappush(self._queue, item) def _get(self, heappop=heapq.heappop): return heappop(self._queue) class LifoQueue(Queue): """A subclass of Queue that retrieves most recently added entries first.""" def _init(self, maxsize): self._queue = [] def _put(self, item): self._queue.append(item) def _get(self): return self._queue.pop() sslproto.py000064400000075773152527367570007051 0ustar00# Contains code from https://github.com/MagicStack/uvloop/tree/v0.16.0 # SPDX-License-Identifier: PSF-2.0 AND (MIT OR Apache-2.0) # SPDX-FileCopyrightText: Copyright (c) 2015-2021 MagicStack Inc. http://magic.io import collections import enum import warnings try: import ssl except ImportError: # pragma: no cover ssl = None from . import constants from . import exceptions from . import protocols from . import transports from .log import logger if ssl is not None: SSLAgainErrors = (ssl.SSLWantReadError, ssl.SSLSyscallError) class SSLProtocolState(enum.Enum): UNWRAPPED = "UNWRAPPED" DO_HANDSHAKE = "DO_HANDSHAKE" WRAPPED = "WRAPPED" FLUSHING = "FLUSHING" SHUTDOWN = "SHUTDOWN" class AppProtocolState(enum.Enum): # This tracks the state of app protocol (https://git.io/fj59P): # # INIT -cm-> CON_MADE [-dr*->] [-er-> EOF?] -cl-> CON_LOST # # * cm: connection_made() # * dr: data_received() # * er: eof_received() # * cl: connection_lost() STATE_INIT = "STATE_INIT" STATE_CON_MADE = "STATE_CON_MADE" STATE_EOF = "STATE_EOF" STATE_CON_LOST = "STATE_CON_LOST" def _create_transport_context(server_side, server_hostname): if server_side: raise ValueError('Server side SSL needs a valid SSLContext') # Client side may pass ssl=True to use a default # context; in that case the sslcontext passed is None. # The default is secure for client connections. # Python 3.4+: use up-to-date strong settings. sslcontext = ssl.create_default_context() if not server_hostname: sslcontext.check_hostname = False return sslcontext def add_flowcontrol_defaults(high, low, kb): if high is None: if low is None: hi = kb * 1024 else: lo = low hi = 4 * lo else: hi = high if low is None: lo = hi // 4 else: lo = low if not hi >= lo >= 0: raise ValueError('high (%r) must be >= low (%r) must be >= 0' % (hi, lo)) return hi, lo class _SSLProtocolTransport(transports._FlowControlMixin, transports.Transport): _start_tls_compatible = True _sendfile_compatible = constants._SendfileMode.FALLBACK def __init__(self, loop, ssl_protocol): self._loop = loop self._ssl_protocol = ssl_protocol self._closed = False def get_extra_info(self, name, default=None): """Get optional transport information.""" return self._ssl_protocol._get_extra_info(name, default) def set_protocol(self, protocol): self._ssl_protocol._set_app_protocol(protocol) def get_protocol(self): return self._ssl_protocol._app_protocol def is_closing(self): return self._closed def close(self): """Close the transport. Buffered data will be flushed asynchronously. No more data will be received. After all buffered data is flushed, the protocol's connection_lost() method will (eventually) called with None as its argument. """ if not self._closed: self._closed = True self._ssl_protocol._start_shutdown() else: self._ssl_protocol = None def __del__(self, _warnings=warnings): if not self._closed: self._closed = True _warnings.warn( "unclosed transport ", ResourceWarning) def is_reading(self): return not self._ssl_protocol._app_reading_paused def pause_reading(self): """Pause the receiving end. No data will be passed to the protocol's data_received() method until resume_reading() is called. """ self._ssl_protocol._pause_reading() def resume_reading(self): """Resume the receiving end. Data received will once again be passed to the protocol's data_received() method. """ self._ssl_protocol._resume_reading() def set_write_buffer_limits(self, high=None, low=None): """Set the high- and low-water limits for write flow control. These two values control when to call the protocol's pause_writing() and resume_writing() methods. If specified, the low-water limit must be less than or equal to the high-water limit. Neither value can be negative. The defaults are implementation-specific. If only the high-water limit is given, the low-water limit defaults to an implementation-specific value less than or equal to the high-water limit. Setting high to zero forces low to zero as well, and causes pause_writing() to be called whenever the buffer becomes non-empty. Setting low to zero causes resume_writing() to be called only once the buffer is empty. Use of zero for either limit is generally sub-optimal as it reduces opportunities for doing I/O and computation concurrently. """ self._ssl_protocol._set_write_buffer_limits(high, low) self._ssl_protocol._control_app_writing() def get_write_buffer_limits(self): return (self._ssl_protocol._outgoing_low_water, self._ssl_protocol._outgoing_high_water) def get_write_buffer_size(self): """Return the current size of the write buffers.""" return self._ssl_protocol._get_write_buffer_size() def set_read_buffer_limits(self, high=None, low=None): """Set the high- and low-water limits for read flow control. These two values control when to call the upstream transport's pause_reading() and resume_reading() methods. If specified, the low-water limit must be less than or equal to the high-water limit. Neither value can be negative. The defaults are implementation-specific. If only the high-water limit is given, the low-water limit defaults to an implementation-specific value less than or equal to the high-water limit. Setting high to zero forces low to zero as well, and causes pause_reading() to be called whenever the buffer becomes non-empty. Setting low to zero causes resume_reading() to be called only once the buffer is empty. Use of zero for either limit is generally sub-optimal as it reduces opportunities for doing I/O and computation concurrently. """ self._ssl_protocol._set_read_buffer_limits(high, low) self._ssl_protocol._control_ssl_reading() def get_read_buffer_limits(self): return (self._ssl_protocol._incoming_low_water, self._ssl_protocol._incoming_high_water) def get_read_buffer_size(self): """Return the current size of the read buffer.""" return self._ssl_protocol._get_read_buffer_size() @property def _protocol_paused(self): # Required for sendfile fallback pause_writing/resume_writing logic return self._ssl_protocol._app_writing_paused def write(self, data): """Write some data bytes to the transport. This does not block; it buffers the data and arranges for it to be sent out asynchronously. """ if not isinstance(data, (bytes, bytearray, memoryview)): raise TypeError(f"data: expecting a bytes-like instance, " f"got {type(data).__name__}") if not data: return self._ssl_protocol._write_appdata((data,)) def writelines(self, list_of_data): """Write a list (or any iterable) of data bytes to the transport. The default implementation concatenates the arguments and calls write() on the result. """ self._ssl_protocol._write_appdata(list_of_data) def write_eof(self): """Close the write end after flushing buffered data. This raises :exc:`NotImplementedError` right now. """ raise NotImplementedError def can_write_eof(self): """Return True if this transport supports write_eof(), False if not.""" return False def abort(self): """Close the transport immediately. Buffered data will be lost. No more data will be received. The protocol's connection_lost() method will (eventually) be called with None as its argument. """ self._force_close(None) def _force_close(self, exc): self._closed = True if self._ssl_protocol is not None: self._ssl_protocol._abort(exc) def _test__append_write_backlog(self, data): # for test only self._ssl_protocol._write_backlog.append(data) self._ssl_protocol._write_buffer_size += len(data) class SSLProtocol(protocols.BufferedProtocol): max_size = 256 * 1024 # Buffer size passed to read() _handshake_start_time = None _handshake_timeout_handle = None _shutdown_timeout_handle = None def __init__(self, loop, app_protocol, sslcontext, waiter, server_side=False, server_hostname=None, call_connection_made=True, ssl_handshake_timeout=None, ssl_shutdown_timeout=None): if ssl is None: raise RuntimeError("stdlib ssl module not available") self._ssl_buffer = bytearray(self.max_size) self._ssl_buffer_view = memoryview(self._ssl_buffer) if ssl_handshake_timeout is None: ssl_handshake_timeout = constants.SSL_HANDSHAKE_TIMEOUT elif ssl_handshake_timeout <= 0: raise ValueError( f"ssl_handshake_timeout should be a positive number, " f"got {ssl_handshake_timeout}") if ssl_shutdown_timeout is None: ssl_shutdown_timeout = constants.SSL_SHUTDOWN_TIMEOUT elif ssl_shutdown_timeout <= 0: raise ValueError( f"ssl_shutdown_timeout should be a positive number, " f"got {ssl_shutdown_timeout}") if not sslcontext: sslcontext = _create_transport_context( server_side, server_hostname) self._server_side = server_side if server_hostname and not server_side: self._server_hostname = server_hostname else: self._server_hostname = None self._sslcontext = sslcontext # SSL-specific extra info. More info are set when the handshake # completes. self._extra = dict(sslcontext=sslcontext) # App data write buffering self._write_backlog = collections.deque() self._write_buffer_size = 0 self._waiter = waiter self._loop = loop self._set_app_protocol(app_protocol) self._app_transport = None self._app_transport_created = False # transport, ex: SelectorSocketTransport self._transport = None self._ssl_handshake_timeout = ssl_handshake_timeout self._ssl_shutdown_timeout = ssl_shutdown_timeout # SSL and state machine self._incoming = ssl.MemoryBIO() self._outgoing = ssl.MemoryBIO() self._state = SSLProtocolState.UNWRAPPED self._conn_lost = 0 # Set when connection_lost called if call_connection_made: self._app_state = AppProtocolState.STATE_INIT else: self._app_state = AppProtocolState.STATE_CON_MADE self._sslobj = self._sslcontext.wrap_bio( self._incoming, self._outgoing, server_side=self._server_side, server_hostname=self._server_hostname) # Flow Control self._ssl_writing_paused = False self._app_reading_paused = False self._ssl_reading_paused = False self._incoming_high_water = 0 self._incoming_low_water = 0 self._set_read_buffer_limits() self._eof_received = False self._app_writing_paused = False self._outgoing_high_water = 0 self._outgoing_low_water = 0 self._set_write_buffer_limits() self._get_app_transport() def _set_app_protocol(self, app_protocol): self._app_protocol = app_protocol # Make fast hasattr check first if (hasattr(app_protocol, 'get_buffer') and isinstance(app_protocol, protocols.BufferedProtocol)): self._app_protocol_get_buffer = app_protocol.get_buffer self._app_protocol_buffer_updated = app_protocol.buffer_updated self._app_protocol_is_buffer = True else: self._app_protocol_is_buffer = False def _wakeup_waiter(self, exc=None): if self._waiter is None: return if not self._waiter.cancelled(): if exc is not None: self._waiter.set_exception(exc) else: self._waiter.set_result(None) self._waiter = None def _get_app_transport(self): if self._app_transport is None: if self._app_transport_created: raise RuntimeError('Creating _SSLProtocolTransport twice') self._app_transport = _SSLProtocolTransport(self._loop, self) self._app_transport_created = True return self._app_transport def connection_made(self, transport): """Called when the low-level connection is made. Start the SSL handshake. """ self._transport = transport self._start_handshake() def connection_lost(self, exc): """Called when the low-level connection is lost or closed. The argument is an exception object or None (the latter meaning a regular EOF is received or the connection was aborted or closed). """ self._write_backlog.clear() self._outgoing.read() self._conn_lost += 1 # Just mark the app transport as closed so that its __dealloc__ # doesn't complain. if self._app_transport is not None: self._app_transport._closed = True if self._state != SSLProtocolState.DO_HANDSHAKE: if ( self._app_state == AppProtocolState.STATE_CON_MADE or self._app_state == AppProtocolState.STATE_EOF ): self._app_state = AppProtocolState.STATE_CON_LOST self._loop.call_soon(self._app_protocol.connection_lost, exc) self._set_state(SSLProtocolState.UNWRAPPED) self._transport = None self._app_transport = None self._app_protocol = None self._wakeup_waiter(exc) if self._shutdown_timeout_handle: self._shutdown_timeout_handle.cancel() self._shutdown_timeout_handle = None if self._handshake_timeout_handle: self._handshake_timeout_handle.cancel() self._handshake_timeout_handle = None def get_buffer(self, n): want = n if want <= 0 or want > self.max_size: want = self.max_size if len(self._ssl_buffer) < want: self._ssl_buffer = bytearray(want) self._ssl_buffer_view = memoryview(self._ssl_buffer) return self._ssl_buffer_view def buffer_updated(self, nbytes): self._incoming.write(self._ssl_buffer_view[:nbytes]) if self._state == SSLProtocolState.DO_HANDSHAKE: self._do_handshake() elif self._state == SSLProtocolState.WRAPPED: self._do_read() elif self._state == SSLProtocolState.FLUSHING: self._do_flush() elif self._state == SSLProtocolState.SHUTDOWN: self._do_shutdown() def eof_received(self): """Called when the other end of the low-level stream is half-closed. If this returns a false value (including None), the transport will close itself. If it returns a true value, closing the transport is up to the protocol. """ self._eof_received = True try: if self._loop.get_debug(): logger.debug("%r received EOF", self) if self._state == SSLProtocolState.DO_HANDSHAKE: self._on_handshake_complete(ConnectionResetError) elif self._state == SSLProtocolState.WRAPPED: self._set_state(SSLProtocolState.FLUSHING) if self._app_reading_paused: return True else: self._do_flush() elif self._state == SSLProtocolState.FLUSHING: self._do_write() self._set_state(SSLProtocolState.SHUTDOWN) self._do_shutdown() elif self._state == SSLProtocolState.SHUTDOWN: self._do_shutdown() except Exception: self._transport.close() raise def _get_extra_info(self, name, default=None): if name in self._extra: return self._extra[name] elif self._transport is not None: return self._transport.get_extra_info(name, default) else: return default def _set_state(self, new_state): allowed = False if new_state == SSLProtocolState.UNWRAPPED: allowed = True elif ( self._state == SSLProtocolState.UNWRAPPED and new_state == SSLProtocolState.DO_HANDSHAKE ): allowed = True elif ( self._state == SSLProtocolState.DO_HANDSHAKE and new_state == SSLProtocolState.WRAPPED ): allowed = True elif ( self._state == SSLProtocolState.WRAPPED and new_state == SSLProtocolState.FLUSHING ): allowed = True elif ( self._state == SSLProtocolState.FLUSHING and new_state == SSLProtocolState.SHUTDOWN ): allowed = True if allowed: self._state = new_state else: raise RuntimeError( 'cannot switch state from {} to {}'.format( self._state, new_state)) # Handshake flow def _start_handshake(self): if self._loop.get_debug(): logger.debug("%r starts SSL handshake", self) self._handshake_start_time = self._loop.time() else: self._handshake_start_time = None self._set_state(SSLProtocolState.DO_HANDSHAKE) # start handshake timeout count down self._handshake_timeout_handle = \ self._loop.call_later(self._ssl_handshake_timeout, lambda: self._check_handshake_timeout()) self._do_handshake() def _check_handshake_timeout(self): if self._state == SSLProtocolState.DO_HANDSHAKE: msg = ( f"SSL handshake is taking longer than " f"{self._ssl_handshake_timeout} seconds: " f"aborting the connection" ) self._fatal_error(ConnectionAbortedError(msg)) def _do_handshake(self): try: self._sslobj.do_handshake() except SSLAgainErrors: self._process_outgoing() except ssl.SSLError as exc: self._on_handshake_complete(exc) else: self._on_handshake_complete(None) def _on_handshake_complete(self, handshake_exc): if self._handshake_timeout_handle is not None: self._handshake_timeout_handle.cancel() self._handshake_timeout_handle = None sslobj = self._sslobj try: if handshake_exc is None: self._set_state(SSLProtocolState.WRAPPED) else: raise handshake_exc peercert = sslobj.getpeercert() except Exception as exc: handshake_exc = None self._set_state(SSLProtocolState.UNWRAPPED) if isinstance(exc, ssl.CertificateError): msg = 'SSL handshake failed on verifying the certificate' else: msg = 'SSL handshake failed' self._fatal_error(exc, msg) self._wakeup_waiter(exc) return if self._loop.get_debug(): dt = self._loop.time() - self._handshake_start_time logger.debug("%r: SSL handshake took %.1f ms", self, dt * 1e3) # Add extra info that becomes available after handshake. self._extra.update(peercert=peercert, cipher=sslobj.cipher(), compression=sslobj.compression(), ssl_object=sslobj) if self._app_state == AppProtocolState.STATE_INIT: self._app_state = AppProtocolState.STATE_CON_MADE self._app_protocol.connection_made(self._get_app_transport()) self._wakeup_waiter() self._do_read() # Shutdown flow def _start_shutdown(self): if ( self._state in ( SSLProtocolState.FLUSHING, SSLProtocolState.SHUTDOWN, SSLProtocolState.UNWRAPPED ) ): return if self._app_transport is not None: self._app_transport._closed = True if self._state == SSLProtocolState.DO_HANDSHAKE: self._abort(None) else: self._set_state(SSLProtocolState.FLUSHING) self._shutdown_timeout_handle = self._loop.call_later( self._ssl_shutdown_timeout, lambda: self._check_shutdown_timeout() ) self._do_flush() def _check_shutdown_timeout(self): if ( self._state in ( SSLProtocolState.FLUSHING, SSLProtocolState.SHUTDOWN ) ): self._transport._force_close( exceptions.TimeoutError('SSL shutdown timed out')) def _do_flush(self): self._do_read() self._set_state(SSLProtocolState.SHUTDOWN) self._do_shutdown() def _do_shutdown(self): try: if not self._eof_received: self._sslobj.unwrap() except SSLAgainErrors: self._process_outgoing() except ssl.SSLError as exc: self._on_shutdown_complete(exc) else: self._process_outgoing() self._call_eof_received() self._on_shutdown_complete(None) def _on_shutdown_complete(self, shutdown_exc): if self._shutdown_timeout_handle is not None: self._shutdown_timeout_handle.cancel() self._shutdown_timeout_handle = None if shutdown_exc: self._fatal_error(shutdown_exc) else: self._loop.call_soon(self._transport.close) def _abort(self, exc): self._set_state(SSLProtocolState.UNWRAPPED) if self._transport is not None: self._transport._force_close(exc) # Outgoing flow def _write_appdata(self, list_of_data): if ( self._state in ( SSLProtocolState.FLUSHING, SSLProtocolState.SHUTDOWN, SSLProtocolState.UNWRAPPED ) ): if self._conn_lost >= constants.LOG_THRESHOLD_FOR_CONNLOST_WRITES: logger.warning('SSL connection is closed') self._conn_lost += 1 return for data in list_of_data: self._write_backlog.append(data) self._write_buffer_size += len(data) try: if self._state == SSLProtocolState.WRAPPED: self._do_write() except Exception as ex: self._fatal_error(ex, 'Fatal error on SSL protocol') def _do_write(self): try: while self._write_backlog: data = self._write_backlog[0] count = self._sslobj.write(data) data_len = len(data) if count < data_len: self._write_backlog[0] = data[count:] self._write_buffer_size -= count else: del self._write_backlog[0] self._write_buffer_size -= data_len except SSLAgainErrors: pass self._process_outgoing() def _process_outgoing(self): if not self._ssl_writing_paused: data = self._outgoing.read() if len(data): self._transport.write(data) self._control_app_writing() # Incoming flow def _do_read(self): if ( self._state not in ( SSLProtocolState.WRAPPED, SSLProtocolState.FLUSHING, ) ): return try: if not self._app_reading_paused: if self._app_protocol_is_buffer: self._do_read__buffered() else: self._do_read__copied() if self._write_backlog: self._do_write() else: self._process_outgoing() self._control_ssl_reading() except Exception as ex: self._fatal_error(ex, 'Fatal error on SSL protocol') def _do_read__buffered(self): offset = 0 count = 1 buf = self._app_protocol_get_buffer(self._get_read_buffer_size()) wants = len(buf) try: count = self._sslobj.read(wants, buf) if count > 0: offset = count while offset < wants: count = self._sslobj.read(wants - offset, buf[offset:]) if count > 0: offset += count else: break else: self._loop.call_soon(lambda: self._do_read()) except SSLAgainErrors: pass if offset > 0: self._app_protocol_buffer_updated(offset) if not count: # close_notify self._call_eof_received() self._start_shutdown() def _do_read__copied(self): chunk = b'1' zero = True one = False try: while True: chunk = self._sslobj.read(self.max_size) if not chunk: break if zero: zero = False one = True first = chunk elif one: one = False data = [first, chunk] else: data.append(chunk) except SSLAgainErrors: pass if one: self._app_protocol.data_received(first) elif not zero: self._app_protocol.data_received(b''.join(data)) if not chunk: # close_notify self._call_eof_received() self._start_shutdown() def _call_eof_received(self): try: if self._app_state == AppProtocolState.STATE_CON_MADE: self._app_state = AppProtocolState.STATE_EOF keep_open = self._app_protocol.eof_received() if keep_open: logger.warning('returning true from eof_received() ' 'has no effect when using ssl') except (KeyboardInterrupt, SystemExit): raise except BaseException as ex: self._fatal_error(ex, 'Error calling eof_received()') # Flow control for writes from APP socket def _control_app_writing(self): size = self._get_write_buffer_size() if size >= self._outgoing_high_water and not self._app_writing_paused: self._app_writing_paused = True try: self._app_protocol.pause_writing() except (KeyboardInterrupt, SystemExit): raise except BaseException as exc: self._loop.call_exception_handler({ 'message': 'protocol.pause_writing() failed', 'exception': exc, 'transport': self._app_transport, 'protocol': self, }) elif size <= self._outgoing_low_water and self._app_writing_paused: self._app_writing_paused = False try: self._app_protocol.resume_writing() except (KeyboardInterrupt, SystemExit): raise except BaseException as exc: self._loop.call_exception_handler({ 'message': 'protocol.resume_writing() failed', 'exception': exc, 'transport': self._app_transport, 'protocol': self, }) def _get_write_buffer_size(self): return self._outgoing.pending + self._write_buffer_size def _set_write_buffer_limits(self, high=None, low=None): high, low = add_flowcontrol_defaults( high, low, constants.FLOW_CONTROL_HIGH_WATER_SSL_WRITE) self._outgoing_high_water = high self._outgoing_low_water = low # Flow control for reads to APP socket def _pause_reading(self): self._app_reading_paused = True def _resume_reading(self): if self._app_reading_paused: self._app_reading_paused = False def resume(): if self._state == SSLProtocolState.WRAPPED: self._do_read() elif self._state == SSLProtocolState.FLUSHING: self._do_flush() elif self._state == SSLProtocolState.SHUTDOWN: self._do_shutdown() self._loop.call_soon(resume) # Flow control for reads from SSL socket def _control_ssl_reading(self): size = self._get_read_buffer_size() if size >= self._incoming_high_water and not self._ssl_reading_paused: self._ssl_reading_paused = True self._transport.pause_reading() elif size <= self._incoming_low_water and self._ssl_reading_paused: self._ssl_reading_paused = False self._transport.resume_reading() def _set_read_buffer_limits(self, high=None, low=None): high, low = add_flowcontrol_defaults( high, low, constants.FLOW_CONTROL_HIGH_WATER_SSL_READ) self._incoming_high_water = high self._incoming_low_water = low def _get_read_buffer_size(self): return self._incoming.pending # Flow control for writes to SSL socket def pause_writing(self): """Called when the low-level transport's buffer goes over the high-water mark. """ assert not self._ssl_writing_paused self._ssl_writing_paused = True def resume_writing(self): """Called when the low-level transport's buffer drains below the low-water mark. """ assert self._ssl_writing_paused self._ssl_writing_paused = False self._process_outgoing() def _fatal_error(self, exc, message='Fatal error on transport'): if self._transport: self._transport._force_close(exc) if isinstance(exc, OSError): if self._loop.get_debug(): logger.debug("%r: %s", self, message, exc_info=True) elif not isinstance(exc, exceptions.CancelledError): self._loop.call_exception_handler({ 'message': message, 'exception': exc, 'transport': self._transport, 'protocol': self, }) runners.py000064400000015272152527367570006644 0ustar00__all__ = ('Runner', 'run') import contextvars import enum import functools import threading import signal import sys from . import coroutines from . import events from . import exceptions from . import tasks class _State(enum.Enum): CREATED = "created" INITIALIZED = "initialized" CLOSED = "closed" class Runner: """A context manager that controls event loop life cycle. The context manager always creates a new event loop, allows to run async functions inside it, and properly finalizes the loop at the context manager exit. If debug is True, the event loop will be run in debug mode. If loop_factory is passed, it is used for new event loop creation. asyncio.run(main(), debug=True) is a shortcut for with asyncio.Runner(debug=True) as runner: runner.run(main()) The run() method can be called multiple times within the runner's context. This can be useful for interactive console (e.g. IPython), unittest runners, console tools, -- everywhere when async code is called from existing sync framework and where the preferred single asyncio.run() call doesn't work. """ # Note: the class is final, it is not intended for inheritance. def __init__(self, *, debug=None, loop_factory=None): self._state = _State.CREATED self._debug = debug self._loop_factory = loop_factory self._loop = None self._context = None self._interrupt_count = 0 self._set_event_loop = False def __enter__(self): self._lazy_init() return self def __exit__(self, exc_type, exc_val, exc_tb): self.close() def close(self): """Shutdown and close event loop.""" if self._state is not _State.INITIALIZED: return try: loop = self._loop _cancel_all_tasks(loop) loop.run_until_complete(loop.shutdown_asyncgens()) loop.run_until_complete(loop.shutdown_default_executor()) finally: if self._set_event_loop: events.set_event_loop(None) loop.close() self._loop = None self._state = _State.CLOSED def get_loop(self): """Return embedded event loop.""" self._lazy_init() return self._loop def run(self, coro, *, context=None): """Run a coroutine inside the embedded event loop.""" if not coroutines.iscoroutine(coro): raise ValueError("a coroutine was expected, got {!r}".format(coro)) if events._get_running_loop() is not None: # fail fast with short traceback raise RuntimeError( "Runner.run() cannot be called from a running event loop") self._lazy_init() if context is None: context = self._context task = self._loop.create_task(coro, context=context) if (threading.current_thread() is threading.main_thread() and signal.getsignal(signal.SIGINT) is signal.default_int_handler ): sigint_handler = functools.partial(self._on_sigint, main_task=task) try: signal.signal(signal.SIGINT, sigint_handler) except ValueError: # `signal.signal` may throw if `threading.main_thread` does # not support signals (e.g. embedded interpreter with signals # not registered - see gh-91880) sigint_handler = None else: sigint_handler = None self._interrupt_count = 0 try: return self._loop.run_until_complete(task) except exceptions.CancelledError: if self._interrupt_count > 0: uncancel = getattr(task, "uncancel", None) if uncancel is not None and uncancel() == 0: raise KeyboardInterrupt() raise # CancelledError finally: if (sigint_handler is not None and signal.getsignal(signal.SIGINT) is sigint_handler ): signal.signal(signal.SIGINT, signal.default_int_handler) def _lazy_init(self): if self._state is _State.CLOSED: raise RuntimeError("Runner is closed") if self._state is _State.INITIALIZED: return if self._loop_factory is None: self._loop = events.new_event_loop() if not self._set_event_loop: # Call set_event_loop only once to avoid calling # attach_loop multiple times on child watchers events.set_event_loop(self._loop) self._set_event_loop = True else: self._loop = self._loop_factory() if self._debug is not None: self._loop.set_debug(self._debug) self._context = contextvars.copy_context() self._state = _State.INITIALIZED def _on_sigint(self, signum, frame, main_task): self._interrupt_count += 1 if self._interrupt_count == 1 and not main_task.done(): main_task.cancel() # wakeup loop if it is blocked by select() with long timeout self._loop.call_soon_threadsafe(lambda: None) return raise KeyboardInterrupt() def run(main, *, debug=None): """Execute the coroutine and return the result. This function runs the passed coroutine, taking care of managing the asyncio event loop and finalizing asynchronous generators. This function cannot be called when another asyncio event loop is running in the same thread. If debug is True, the event loop will be run in debug mode. This function always creates a new event loop and closes it at the end. It should be used as a main entry point for asyncio programs, and should ideally only be called once. Example: async def main(): await asyncio.sleep(1) print('hello') asyncio.run(main()) """ if events._get_running_loop() is not None: # fail fast with short traceback raise RuntimeError( "asyncio.run() cannot be called from a running event loop") with Runner(debug=debug) as runner: return runner.run(main) def _cancel_all_tasks(loop): to_cancel = tasks.all_tasks(loop) if not to_cancel: return for task in to_cancel: task.cancel() loop.run_until_complete(tasks.gather(*to_cancel, return_exceptions=True)) for task in to_cancel: if task.cancelled(): continue if task.exception() is not None: loop.call_exception_handler({ 'message': 'unhandled exception during asyncio.run() shutdown', 'exception': task.exception(), 'task': task, }) protocols.py000064400000015455152527367570007177 0ustar00"""Abstract Protocol base classes.""" __all__ = ( 'BaseProtocol', 'Protocol', 'DatagramProtocol', 'SubprocessProtocol', 'BufferedProtocol', ) class BaseProtocol: """Common base class for protocol interfaces. Usually user implements protocols that derived from BaseProtocol like Protocol or ProcessProtocol. The only case when BaseProtocol should be implemented directly is write-only transport like write pipe """ __slots__ = () def connection_made(self, transport): """Called when a connection is made. The argument is the transport representing the pipe connection. To receive data, wait for data_received() calls. When the connection is closed, connection_lost() is called. """ def connection_lost(self, exc): """Called when the connection is lost or closed. The argument is an exception object or None (the latter meaning a regular EOF is received or the connection was aborted or closed). """ def pause_writing(self): """Called when the transport's buffer goes over the high-water mark. Pause and resume calls are paired -- pause_writing() is called once when the buffer goes strictly over the high-water mark (even if subsequent writes increases the buffer size even more), and eventually resume_writing() is called once when the buffer size reaches the low-water mark. Note that if the buffer size equals the high-water mark, pause_writing() is not called -- it must go strictly over. Conversely, resume_writing() is called when the buffer size is equal or lower than the low-water mark. These end conditions are important to ensure that things go as expected when either mark is zero. NOTE: This is the only Protocol callback that is not called through EventLoop.call_soon() -- if it were, it would have no effect when it's most needed (when the app keeps writing without yielding until pause_writing() is called). """ def resume_writing(self): """Called when the transport's buffer drains below the low-water mark. See pause_writing() for details. """ class Protocol(BaseProtocol): """Interface for stream protocol. The user should implement this interface. They can inherit from this class but don't need to. The implementations here do nothing (they don't raise exceptions). When the user wants to requests a transport, they pass a protocol factory to a utility function (e.g., EventLoop.create_connection()). When the connection is made successfully, connection_made() is called with a suitable transport object. Then data_received() will be called 0 or more times with data (bytes) received from the transport; finally, connection_lost() will be called exactly once with either an exception object or None as an argument. State machine of calls: start -> CM [-> DR*] [-> ER?] -> CL -> end * CM: connection_made() * DR: data_received() * ER: eof_received() * CL: connection_lost() """ __slots__ = () def data_received(self, data): """Called when some data is received. The argument is a bytes object. """ def eof_received(self): """Called when the other end calls write_eof() or equivalent. If this returns a false value (including None), the transport will close itself. If it returns a true value, closing the transport is up to the protocol. """ class BufferedProtocol(BaseProtocol): """Interface for stream protocol with manual buffer control. Event methods, such as `create_server` and `create_connection`, accept factories that return protocols that implement this interface. The idea of BufferedProtocol is that it allows to manually allocate and control the receive buffer. Event loops can then use the buffer provided by the protocol to avoid unnecessary data copies. This can result in noticeable performance improvement for protocols that receive big amounts of data. Sophisticated protocols can allocate the buffer only once at creation time. State machine of calls: start -> CM [-> GB [-> BU?]]* [-> ER?] -> CL -> end * CM: connection_made() * GB: get_buffer() * BU: buffer_updated() * ER: eof_received() * CL: connection_lost() """ __slots__ = () def get_buffer(self, sizehint): """Called to allocate a new receive buffer. *sizehint* is a recommended minimal size for the returned buffer. When set to -1, the buffer size can be arbitrary. Must return an object that implements the :ref:`buffer protocol `. It is an error to return a zero-sized buffer. """ def buffer_updated(self, nbytes): """Called when the buffer was updated with the received data. *nbytes* is the total number of bytes that were written to the buffer. """ def eof_received(self): """Called when the other end calls write_eof() or equivalent. If this returns a false value (including None), the transport will close itself. If it returns a true value, closing the transport is up to the protocol. """ class DatagramProtocol(BaseProtocol): """Interface for datagram protocol.""" __slots__ = () def datagram_received(self, data, addr): """Called when some datagram is received.""" def error_received(self, exc): """Called when a send or receive operation raises an OSError. (Other than BlockingIOError or InterruptedError.) """ class SubprocessProtocol(BaseProtocol): """Interface for protocol for subprocess calls.""" __slots__ = () def pipe_data_received(self, fd, data): """Called when the subprocess writes data into stdout/stderr pipe. fd is int file descriptor. data is bytes object. """ def pipe_connection_lost(self, fd, exc): """Called when a file descriptor associated with the child process is closed. fd is the int file descriptor that was closed. """ def process_exited(self): """Called when subprocess has exited.""" def _feed_data_to_buffered_proto(proto, data): data_len = len(data) while data_len: buf = proto.get_buffer(data_len) buf_len = len(buf) if not buf_len: raise RuntimeError('get_buffer() returned an empty buffer') if buf_len >= data_len: buf[:data_len] = data proto.buffer_updated(data_len) return else: buf[:buf_len] = data[:buf_len] proto.buffer_updated(buf_len) data = data[buf_len:] data_len = len(data) __init__.py000064400000002244152527367570006702 0ustar00"""The asyncio package, tracking PEP 3156.""" # flake8: noqa import sys # This relies on each of the submodules having an __all__ variable. from .base_events import * from .coroutines import * from .events import * from .exceptions import * from .futures import * from .locks import * from .protocols import * from .runners import * from .queues import * from .streams import * from .subprocess import * from .tasks import * from .taskgroups import * from .timeouts import * from .threads import * from .transports import * __all__ = (base_events.__all__ + coroutines.__all__ + events.__all__ + exceptions.__all__ + futures.__all__ + locks.__all__ + protocols.__all__ + runners.__all__ + queues.__all__ + streams.__all__ + subprocess.__all__ + tasks.__all__ + threads.__all__ + timeouts.__all__ + transports.__all__) if sys.platform == 'win32': # pragma: no cover from .windows_events import * __all__ += windows_events.__all__ else: from .unix_events import * # pragma: no cover __all__ += unix_events.__all__ format_helpers.py000064400000004544152527367570010162 0ustar00import functools import inspect import reprlib import sys import traceback from . import constants def _get_function_source(func): func = inspect.unwrap(func) if inspect.isfunction(func): code = func.__code__ return (code.co_filename, code.co_firstlineno) if isinstance(func, functools.partial): return _get_function_source(func.func) if isinstance(func, functools.partialmethod): return _get_function_source(func.func) return None def _format_callback_source(func, args): func_repr = _format_callback(func, args, None) source = _get_function_source(func) if source: func_repr += f' at {source[0]}:{source[1]}' return func_repr def _format_args_and_kwargs(args, kwargs): """Format function arguments and keyword arguments. Special case for a single parameter: ('hello',) is formatted as ('hello'). """ # use reprlib to limit the length of the output items = [] if args: items.extend(reprlib.repr(arg) for arg in args) if kwargs: items.extend(f'{k}={reprlib.repr(v)}' for k, v in kwargs.items()) return '({})'.format(', '.join(items)) def _format_callback(func, args, kwargs, suffix=''): if isinstance(func, functools.partial): suffix = _format_args_and_kwargs(args, kwargs) + suffix return _format_callback(func.func, func.args, func.keywords, suffix) if hasattr(func, '__qualname__') and func.__qualname__: func_repr = func.__qualname__ elif hasattr(func, '__name__') and func.__name__: func_repr = func.__name__ else: func_repr = repr(func) func_repr += _format_args_and_kwargs(args, kwargs) if suffix: func_repr += suffix return func_repr def extract_stack(f=None, limit=None): """Replacement for traceback.extract_stack() that only does the necessary work for asyncio debug mode. """ if f is None: f = sys._getframe().f_back if limit is None: # Limit the amount of work to a reasonable amount, as extract_stack() # can be called for each coroutine and future in debug mode. limit = constants.DEBUG_STACK_DEPTH stack = traceback.StackSummary.extract(traceback.walk_stack(f), limit=limit, lookup_lines=False) stack.reverse() return stack constants.py000064400000002456152527367570007164 0ustar00# Contains code from https://github.com/MagicStack/uvloop/tree/v0.16.0 # SPDX-License-Identifier: PSF-2.0 AND (MIT OR Apache-2.0) # SPDX-FileCopyrightText: Copyright (c) 2015-2021 MagicStack Inc. http://magic.io import enum # After the connection is lost, log warnings after this many write()s. LOG_THRESHOLD_FOR_CONNLOST_WRITES = 5 # Seconds to wait before retrying accept(). ACCEPT_RETRY_DELAY = 1 # Number of stack entries to capture in debug mode. # The larger the number, the slower the operation in debug mode # (see extract_stack() in format_helpers.py). DEBUG_STACK_DEPTH = 10 # Number of seconds to wait for SSL handshake to complete # The default timeout matches that of Nginx. SSL_HANDSHAKE_TIMEOUT = 60.0 # Number of seconds to wait for SSL shutdown to complete # The default timeout mimics lingering_time SSL_SHUTDOWN_TIMEOUT = 30.0 # Used in sendfile fallback code. We use fallback for platforms # that don't support sendfile, or for TLS connections. SENDFILE_FALLBACK_READBUFFER_SIZE = 1024 * 256 FLOW_CONTROL_HIGH_WATER_SSL_READ = 256 # KiB FLOW_CONTROL_HIGH_WATER_SSL_WRITE = 512 # KiB # The enum should be here to break circular dependencies between # base_events and sslproto class _SendfileMode(enum.Enum): UNSUPPORTED = enum.auto() TRY_NATIVE = enum.auto() FALLBACK = enum.auto() streams.py000064400000065557152527367570006641 0ustar00__all__ = ( 'StreamReader', 'StreamWriter', 'StreamReaderProtocol', 'open_connection', 'start_server') import collections import socket import sys import warnings import weakref if hasattr(socket, 'AF_UNIX'): __all__ += ('open_unix_connection', 'start_unix_server') from . import coroutines from . import events from . import exceptions from . import format_helpers from . import protocols from .log import logger from .tasks import sleep _DEFAULT_LIMIT = 2 ** 16 # 64 KiB async def open_connection(host=None, port=None, *, limit=_DEFAULT_LIMIT, **kwds): """A wrapper for create_connection() returning a (reader, writer) pair. The reader returned is a StreamReader instance; the writer is a StreamWriter instance. The arguments are all the usual arguments to create_connection() except protocol_factory; most common are positional host and port, with various optional keyword arguments following. Additional optional keyword arguments are loop (to set the event loop instance to use) and limit (to set the buffer limit passed to the StreamReader). (If you want to customize the StreamReader and/or StreamReaderProtocol classes, just copy the code -- there's really nothing special here except some convenience.) """ loop = events.get_running_loop() reader = StreamReader(limit=limit, loop=loop) protocol = StreamReaderProtocol(reader, loop=loop) transport, _ = await loop.create_connection( lambda: protocol, host, port, **kwds) writer = StreamWriter(transport, protocol, reader, loop) return reader, writer async def start_server(client_connected_cb, host=None, port=None, *, limit=_DEFAULT_LIMIT, **kwds): """Start a socket server, call back for each client connected. The first parameter, `client_connected_cb`, takes two parameters: client_reader, client_writer. client_reader is a StreamReader object, while client_writer is a StreamWriter object. This parameter can either be a plain callback function or a coroutine; if it is a coroutine, it will be automatically converted into a Task. The rest of the arguments are all the usual arguments to loop.create_server() except protocol_factory; most common are positional host and port, with various optional keyword arguments following. The return value is the same as loop.create_server(). Additional optional keyword argument is limit (to set the buffer limit passed to the StreamReader). The return value is the same as loop.create_server(), i.e. a Server object which can be used to stop the service. """ loop = events.get_running_loop() def factory(): reader = StreamReader(limit=limit, loop=loop) protocol = StreamReaderProtocol(reader, client_connected_cb, loop=loop) return protocol return await loop.create_server(factory, host, port, **kwds) if hasattr(socket, 'AF_UNIX'): # UNIX Domain Sockets are supported on this platform async def open_unix_connection(path=None, *, limit=_DEFAULT_LIMIT, **kwds): """Similar to `open_connection` but works with UNIX Domain Sockets.""" loop = events.get_running_loop() reader = StreamReader(limit=limit, loop=loop) protocol = StreamReaderProtocol(reader, loop=loop) transport, _ = await loop.create_unix_connection( lambda: protocol, path, **kwds) writer = StreamWriter(transport, protocol, reader, loop) return reader, writer async def start_unix_server(client_connected_cb, path=None, *, limit=_DEFAULT_LIMIT, **kwds): """Similar to `start_server` but works with UNIX Domain Sockets.""" loop = events.get_running_loop() def factory(): reader = StreamReader(limit=limit, loop=loop) protocol = StreamReaderProtocol(reader, client_connected_cb, loop=loop) return protocol return await loop.create_unix_server(factory, path, **kwds) class FlowControlMixin(protocols.Protocol): """Reusable flow control logic for StreamWriter.drain(). This implements the protocol methods pause_writing(), resume_writing() and connection_lost(). If the subclass overrides these it must call the super methods. StreamWriter.drain() must wait for _drain_helper() coroutine. """ def __init__(self, loop=None): if loop is None: self._loop = events._get_event_loop(stacklevel=4) else: self._loop = loop self._paused = False self._drain_waiters = collections.deque() self._connection_lost = False def pause_writing(self): assert not self._paused self._paused = True if self._loop.get_debug(): logger.debug("%r pauses writing", self) def resume_writing(self): assert self._paused self._paused = False if self._loop.get_debug(): logger.debug("%r resumes writing", self) for waiter in self._drain_waiters: if not waiter.done(): waiter.set_result(None) def connection_lost(self, exc): self._connection_lost = True # Wake up the writer(s) if currently paused. if not self._paused: return for waiter in self._drain_waiters: if not waiter.done(): if exc is None: waiter.set_result(None) else: waiter.set_exception(exc) async def _drain_helper(self): if self._connection_lost: raise ConnectionResetError('Connection lost') if not self._paused: return waiter = self._loop.create_future() self._drain_waiters.append(waiter) try: await waiter finally: self._drain_waiters.remove(waiter) def _get_close_waiter(self, stream): raise NotImplementedError class StreamReaderProtocol(FlowControlMixin, protocols.Protocol): """Helper class to adapt between Protocol and StreamReader. (This is a helper class instead of making StreamReader itself a Protocol subclass, because the StreamReader has other potential uses, and to prevent the user of the StreamReader to accidentally call inappropriate methods of the protocol.) """ _source_traceback = None def __init__(self, stream_reader, client_connected_cb=None, loop=None): super().__init__(loop=loop) if stream_reader is not None: self._stream_reader_wr = weakref.ref(stream_reader) self._source_traceback = stream_reader._source_traceback else: self._stream_reader_wr = None if client_connected_cb is not None: # This is a stream created by the `create_server()` function. # Keep a strong reference to the reader until a connection # is established. self._strong_reader = stream_reader self._reject_connection = False self._stream_writer = None self._task = None self._transport = None self._client_connected_cb = client_connected_cb self._over_ssl = False self._closed = self._loop.create_future() @property def _stream_reader(self): if self._stream_reader_wr is None: return None return self._stream_reader_wr() def _replace_writer(self, writer): loop = self._loop transport = writer.transport self._stream_writer = writer self._transport = transport self._over_ssl = transport.get_extra_info('sslcontext') is not None def connection_made(self, transport): if self._reject_connection: context = { 'message': ('An open stream was garbage collected prior to ' 'establishing network connection; ' 'call "stream.close()" explicitly.') } if self._source_traceback: context['source_traceback'] = self._source_traceback self._loop.call_exception_handler(context) transport.abort() return self._transport = transport reader = self._stream_reader if reader is not None: reader.set_transport(transport) self._over_ssl = transport.get_extra_info('sslcontext') is not None if self._client_connected_cb is not None: self._stream_writer = StreamWriter(transport, self, reader, self._loop) res = self._client_connected_cb(reader, self._stream_writer) if coroutines.iscoroutine(res): def callback(task): if task.cancelled(): transport.close() return exc = task.exception() if exc is not None: self._loop.call_exception_handler({ 'message': 'Unhandled exception in client_connected_cb', 'exception': exc, 'transport': transport, }) transport.close() self._task = self._loop.create_task(res) self._task.add_done_callback(callback) self._strong_reader = None def connection_lost(self, exc): reader = self._stream_reader if reader is not None: if exc is None: reader.feed_eof() else: reader.set_exception(exc) if not self._closed.done(): if exc is None: self._closed.set_result(None) else: self._closed.set_exception(exc) super().connection_lost(exc) self._stream_reader_wr = None self._stream_writer = None self._task = None self._transport = None def data_received(self, data): reader = self._stream_reader if reader is not None: reader.feed_data(data) def eof_received(self): reader = self._stream_reader if reader is not None: reader.feed_eof() if self._over_ssl: # Prevent a warning in SSLProtocol.eof_received: # "returning true from eof_received() # has no effect when using ssl" return False return True def _get_close_waiter(self, stream): return self._closed def __del__(self): # Prevent reports about unhandled exceptions. # Better than self._closed._log_traceback = False hack try: closed = self._closed except AttributeError: pass # failed constructor else: if closed.done() and not closed.cancelled(): closed.exception() class StreamWriter: """Wraps a Transport. This exposes write(), writelines(), [can_]write_eof(), get_extra_info() and close(). It adds drain() which returns an optional Future on which you can wait for flow control. It also adds a transport property which references the Transport directly. """ def __init__(self, transport, protocol, reader, loop): self._transport = transport self._protocol = protocol # drain() expects that the reader has an exception() method assert reader is None or isinstance(reader, StreamReader) self._reader = reader self._loop = loop self._complete_fut = self._loop.create_future() self._complete_fut.set_result(None) def __repr__(self): info = [self.__class__.__name__, f'transport={self._transport!r}'] if self._reader is not None: info.append(f'reader={self._reader!r}') return '<{}>'.format(' '.join(info)) @property def transport(self): return self._transport def write(self, data): self._transport.write(data) def writelines(self, data): self._transport.writelines(data) def write_eof(self): return self._transport.write_eof() def can_write_eof(self): return self._transport.can_write_eof() def close(self): return self._transport.close() def is_closing(self): return self._transport.is_closing() async def wait_closed(self): await self._protocol._get_close_waiter(self) def get_extra_info(self, name, default=None): return self._transport.get_extra_info(name, default) async def drain(self): """Flush the write buffer. The intended use is to write w.write(data) await w.drain() """ if self._reader is not None: exc = self._reader.exception() if exc is not None: raise exc if self._transport.is_closing(): # Wait for protocol.connection_lost() call # Raise connection closing error if any, # ConnectionResetError otherwise # Yield to the event loop so connection_lost() may be # called. Without this, _drain_helper() would return # immediately, and code that calls # write(...); await drain() # in a loop would never call connection_lost(), so it # would not see an error when the socket is closed. await sleep(0) await self._protocol._drain_helper() async def start_tls(self, sslcontext, *, server_hostname=None, ssl_handshake_timeout=None): """Upgrade an existing stream-based connection to TLS.""" server_side = self._protocol._client_connected_cb is not None protocol = self._protocol await self.drain() new_transport = await self._loop.start_tls( # type: ignore self._transport, protocol, sslcontext, server_side=server_side, server_hostname=server_hostname, ssl_handshake_timeout=ssl_handshake_timeout) self._transport = new_transport protocol._replace_writer(self) def __del__(self): if not self._transport.is_closing(): if self._loop.is_closed(): warnings.warn("loop is closed", ResourceWarning) else: self.close() warnings.warn(f"unclosed {self!r}", ResourceWarning) class StreamReader: _source_traceback = None def __init__(self, limit=_DEFAULT_LIMIT, loop=None): # The line length limit is a security feature; # it also doubles as half the buffer limit. if limit <= 0: raise ValueError('Limit cannot be <= 0') self._limit = limit if loop is None: self._loop = events._get_event_loop() else: self._loop = loop self._buffer = bytearray() self._eof = False # Whether we're done. self._waiter = None # A future used by _wait_for_data() self._exception = None self._transport = None self._paused = False if self._loop.get_debug(): self._source_traceback = format_helpers.extract_stack( sys._getframe(1)) def __repr__(self): info = ['StreamReader'] if self._buffer: info.append(f'{len(self._buffer)} bytes') if self._eof: info.append('eof') if self._limit != _DEFAULT_LIMIT: info.append(f'limit={self._limit}') if self._waiter: info.append(f'waiter={self._waiter!r}') if self._exception: info.append(f'exception={self._exception!r}') if self._transport: info.append(f'transport={self._transport!r}') if self._paused: info.append('paused') return '<{}>'.format(' '.join(info)) def exception(self): return self._exception def set_exception(self, exc): self._exception = exc waiter = self._waiter if waiter is not None: self._waiter = None if not waiter.cancelled(): waiter.set_exception(exc) def _wakeup_waiter(self): """Wakeup read*() functions waiting for data or EOF.""" waiter = self._waiter if waiter is not None: self._waiter = None if not waiter.cancelled(): waiter.set_result(None) def set_transport(self, transport): assert self._transport is None, 'Transport already set' self._transport = transport def _maybe_resume_transport(self): if self._paused and len(self._buffer) <= self._limit: self._paused = False self._transport.resume_reading() def feed_eof(self): self._eof = True self._wakeup_waiter() def at_eof(self): """Return True if the buffer is empty and 'feed_eof' was called.""" return self._eof and not self._buffer def feed_data(self, data): assert not self._eof, 'feed_data after feed_eof' if not data: return self._buffer.extend(data) self._wakeup_waiter() if (self._transport is not None and not self._paused and len(self._buffer) > 2 * self._limit): try: self._transport.pause_reading() except NotImplementedError: # The transport can't be paused. # We'll just have to buffer all data. # Forget the transport so we don't keep trying. self._transport = None else: self._paused = True async def _wait_for_data(self, func_name): """Wait until feed_data() or feed_eof() is called. If stream was paused, automatically resume it. """ # StreamReader uses a future to link the protocol feed_data() method # to a read coroutine. Running two read coroutines at the same time # would have an unexpected behaviour. It would not possible to know # which coroutine would get the next data. if self._waiter is not None: raise RuntimeError( f'{func_name}() called while another coroutine is ' f'already waiting for incoming data') assert not self._eof, '_wait_for_data after EOF' # Waiting for data while paused will make deadlock, so prevent it. # This is essential for readexactly(n) for case when n > self._limit. if self._paused: self._paused = False self._transport.resume_reading() self._waiter = self._loop.create_future() try: await self._waiter finally: self._waiter = None async def readline(self): """Read chunk of data from the stream until newline (b'\n') is found. On success, return chunk that ends with newline. If only partial line can be read due to EOF, return incomplete line without terminating newline. When EOF was reached while no bytes read, empty bytes object is returned. If limit is reached, ValueError will be raised. In that case, if newline was found, complete line including newline will be removed from internal buffer. Else, internal buffer will be cleared. Limit is compared against part of the line without newline. If stream was paused, this function will automatically resume it if needed. """ sep = b'\n' seplen = len(sep) try: line = await self.readuntil(sep) except exceptions.IncompleteReadError as e: return e.partial except exceptions.LimitOverrunError as e: if self._buffer.startswith(sep, e.consumed): del self._buffer[:e.consumed + seplen] else: self._buffer.clear() self._maybe_resume_transport() raise ValueError(e.args[0]) return line async def readuntil(self, separator=b'\n'): """Read data from the stream until ``separator`` is found. On success, the data and separator will be removed from the internal buffer (consumed). Returned data will include the separator at the end. Configured stream limit is used to check result. Limit sets the maximal length of data that can be returned, not counting the separator. If an EOF occurs and the complete separator is still not found, an IncompleteReadError exception will be raised, and the internal buffer will be reset. The IncompleteReadError.partial attribute may contain the separator partially. If the data cannot be read because of over limit, a LimitOverrunError exception will be raised, and the data will be left in the internal buffer, so it can be read again. """ seplen = len(separator) if seplen == 0: raise ValueError('Separator should be at least one-byte string') if self._exception is not None: raise self._exception # Consume whole buffer except last bytes, which length is # one less than seplen. Let's check corner cases with # separator='SEPARATOR': # * we have received almost complete separator (without last # byte). i.e buffer='some textSEPARATO'. In this case we # can safely consume len(separator) - 1 bytes. # * last byte of buffer is first byte of separator, i.e. # buffer='abcdefghijklmnopqrS'. We may safely consume # everything except that last byte, but this require to # analyze bytes of buffer that match partial separator. # This is slow and/or require FSM. For this case our # implementation is not optimal, since require rescanning # of data that is known to not belong to separator. In # real world, separator will not be so long to notice # performance problems. Even when reading MIME-encoded # messages :) # `offset` is the number of bytes from the beginning of the buffer # where there is no occurrence of `separator`. offset = 0 # Loop until we find `separator` in the buffer, exceed the buffer size, # or an EOF has happened. while True: buflen = len(self._buffer) # Check if we now have enough data in the buffer for `separator` to # fit. if buflen - offset >= seplen: isep = self._buffer.find(separator, offset) if isep != -1: # `separator` is in the buffer. `isep` will be used later # to retrieve the data. break # see upper comment for explanation. offset = buflen + 1 - seplen if offset > self._limit: raise exceptions.LimitOverrunError( 'Separator is not found, and chunk exceed the limit', offset) # Complete message (with full separator) may be present in buffer # even when EOF flag is set. This may happen when the last chunk # adds data which makes separator be found. That's why we check for # EOF *ater* inspecting the buffer. if self._eof: chunk = bytes(self._buffer) self._buffer.clear() raise exceptions.IncompleteReadError(chunk, None) # _wait_for_data() will resume reading if stream was paused. await self._wait_for_data('readuntil') if isep > self._limit: raise exceptions.LimitOverrunError( 'Separator is found, but chunk is longer than limit', isep) chunk = self._buffer[:isep + seplen] del self._buffer[:isep + seplen] self._maybe_resume_transport() return bytes(chunk) async def read(self, n=-1): """Read up to `n` bytes from the stream. If `n` is not provided or set to -1, read until EOF, then return all read bytes. If EOF was received and the internal buffer is empty, return an empty bytes object. If `n` is 0, return an empty bytes object immediately. If `n` is positive, return at most `n` available bytes as soon as at least 1 byte is available in the internal buffer. If EOF is received before any byte is read, return an empty bytes object. Returned value is not limited with limit, configured at stream creation. If stream was paused, this function will automatically resume it if needed. """ if self._exception is not None: raise self._exception if n == 0: return b'' if n < 0: # This used to just loop creating a new waiter hoping to # collect everything in self._buffer, but that would # deadlock if the subprocess sends more than self.limit # bytes. So just call self.read(self._limit) until EOF. blocks = [] while True: block = await self.read(self._limit) if not block: break blocks.append(block) return b''.join(blocks) if not self._buffer and not self._eof: await self._wait_for_data('read') # This will work right even if buffer is less than n bytes data = bytes(self._buffer[:n]) del self._buffer[:n] self._maybe_resume_transport() return data async def readexactly(self, n): """Read exactly `n` bytes. Raise an IncompleteReadError if EOF is reached before `n` bytes can be read. The IncompleteReadError.partial attribute of the exception will contain the partial read bytes. if n is zero, return empty bytes object. Returned value is not limited with limit, configured at stream creation. If stream was paused, this function will automatically resume it if needed. """ if n < 0: raise ValueError('readexactly size can not be less than zero') if self._exception is not None: raise self._exception if n == 0: return b'' while len(self._buffer) < n: if self._eof: incomplete = bytes(self._buffer) self._buffer.clear() raise exceptions.IncompleteReadError(incomplete, n) await self._wait_for_data('readexactly') if len(self._buffer) == n: data = bytes(self._buffer) self._buffer.clear() else: data = bytes(self._buffer[:n]) del self._buffer[:n] self._maybe_resume_transport() return data def __aiter__(self): return self async def __anext__(self): val = await self.readline() if val == b'': raise StopAsyncIteration return val __pycache__/streams.cpython-311.opt-1.pyc000064400000103456152533123130014102 0ustar00 !A?hok~dZddlZddlZddlZddlZddlZeedredz ZddlmZddlm Z ddlm Z dd lm Z dd lm Z dd l mZdd lmZd ZdeddZdeddZeedrdeddZdeddZGdde jZGddee jZGddZGddZdS)) StreamReader StreamWriterStreamReaderProtocolopen_connection start_serverNAF_UNIX)open_unix_connectionstart_unix_server) coroutines)events) exceptions)format_helpers) protocols)logger)sleepi)limitc Ktj}t||}t|| |j fd||fi|d{V\}}t | ||}||fS)aA wrapper for create_connection() returning a (reader, writer) pair. The reader returned is a StreamReader instance; the writer is a StreamWriter instance. The arguments are all the usual arguments to create_connection() except protocol_factory; most common are positional host and port, with various optional keyword arguments following. Additional optional keyword arguments are loop (to set the event loop instance to use) and limit (to set the buffer limit passed to the StreamReader). (If you want to customize the StreamReader and/or StreamReaderProtocol classes, just copy the code -- there's really nothing special here except some convenience.) rlooprcSNprotocolsz!open_connection..1sN)r get_running_looprrcreate_connectionr) hostportrkwdsrreader transport_writerrs @rrrs&  " $ $D D 1 1 1F#F666H//$..(,........LIq )Xvt < rclKtjfd}j|||fi|d{VS)aStart a socket server, call back for each client connected. The first parameter, `client_connected_cb`, takes two parameters: client_reader, client_writer. client_reader is a StreamReader object, while client_writer is a StreamWriter object. This parameter can either be a plain callback function or a coroutine; if it is a coroutine, it will be automatically converted into a Task. The rest of the arguments are all the usual arguments to loop.create_server() except protocol_factory; most common are positional host and port, with various optional keyword arguments following. The return value is the same as loop.create_server(). Additional optional keyword argument is limit (to set the buffer limit passed to the StreamReader). The return value is the same as loop.create_server(), i.e. a Server object which can be used to stop the service. cNt}t|}|SNrrrrr%rclient_connected_cbrrs rfactoryzstart_server..factoryNs6E555'0C-1333rN)r r create_server)r.r"r#rr$r/rs` ` @rrr6so,  " $ $D $#GT4@@4@@ @ @ @ @ @ @@rcKtj}t||}t|||jfd|fi|d{V\}}t |||}||fS)z@Similar to `open_connection` but works with UNIX Domain Sockets.rrcSrrrsrrz&open_unix_connection..bsHrN)r r rrcreate_unix_connectionr) pathrr$rr%r&r'r(rs @rr r Zs&((E555'T:::8T8    d,,&*,,,,,,,, 1i64@@v~rcjKtjfd}j||fi|d{VS)z=Similar to `start_server` but works with UNIX Domain Sockets.cNt}t|}|Sr+r,r-s rr/z"start_unix_server..factoryks6!D999F+F4G15777HOrN)r r create_unix_server)r.r4rr$r/rs` ` @rr r fsm&((        -T,WdCCdCCCCCCCCCrc8eZdZdZd dZdZdZdZdZdZ dS) FlowControlMixina)Reusable flow control logic for StreamWriter.drain(). This implements the protocol methods pause_writing(), resume_writing() and connection_lost(). If the subclass overrides these it must call the super methods. StreamWriter.drain() must wait for _drain_helper() coroutine. Nc|tjd|_n||_d|_t j|_d|_dS)N) stacklevelF)r _get_event_loop_loop_paused collectionsdeque_drain_waiters_connection_lost)selfrs r__init__zFlowControlMixin.__init__~sK </1===DJJDJ )/11 %rctd|_|jrtjd|dSdS)NTz%r pauses writing)r?r> get_debugrdebugrDs r pause_writingzFlowControlMixin.pause_writingsB :   ! ! 4 L,d 3 3 3 3 3 4 4rcd|_|jrtjd||jD]+}|s|d,dS)NFz%r resumes writing)r?r>rGrrHrBdone set_resultrDwaiters rresume_writingzFlowControlMixin.resume_writingss :   ! ! 5 L-t 4 4 4) ( (F;;== (!!$''' ( (rcd|_|jsdS|jD]C}|s-||d.||DdSNT)rCr?rBrLrM set_exceptionrDexcrOs rconnection_lostz FlowControlMixin.connection_lostsv $|  F) . .F;;== .;%%d++++((---  . .rc2K|jrtd|jsdS|j}|j| |d{V|j|dS#|j|wxYw)NzConnection lost)rCConnectionResetErrorr?r> create_futurerBappendremoverNs r _drain_helperzFlowControlMixin._drain_helpers   :&'899 9|  F))++ ""6*** /LLLLLLL   & &v . . . . .D  & &v . . . .s A::Bctr)NotImplementedErrorrDstreams r_get_close_waiterz"FlowControlMixin._get_close_waiters!!rr) __name__ __module__ __qualname____doc__rErJrPrVr\rarrrr9r9ts}&&&&444 ((( . . . / / /"""""rr9cleZdZdZdZd fd ZedZdZdZ fdZ dZ d Z d Z d ZxZS) ra=Helper class to adapt between Protocol and StreamReader. (This is a helper class instead of making StreamReader itself a Protocol subclass, because the StreamReader has other potential uses, and to prevent the user of the StreamReader to accidentally call inappropriate methods of the protocol.) NcLt||&tj||_|j|_nd|_|||_d|_d|_d|_ d|_ ||_ d|_ |j |_dS)NrF)superrEweakrefref_stream_reader_wr_source_traceback_strong_reader_reject_connection_stream_writer_task _transport_client_connected_cb _over_sslr>rY_closed)rD stream_readerr.r __class__s rrEzStreamReaderProtocol.__init__s d###  $%,[%?%?D "%2%DD " "%)D "  *#0D "'" $7!z//11 rc<|jdS|Sr)rkrIs r_stream_readerz#StreamReaderProtocol._stream_readers"  ! )4%%'''rcv|j}|j}||_||_|ddu|_dS)N sslcontext)r>r&rorqget_extra_infors)rDr(rr&s r_replace_writerz$StreamReaderProtocol._replace_writers>z$ $#"11,??tKrcXjrEddi}jr j|d<j|dS_j}||ddu_ j t|j_ |j }tj|r?fd}j|_j|d_dSdS)NmessagezpAn open stream was garbage collected prior to establishing network connection; call "stream.close()" explicitly.source_tracebackrzc|rdS|}|4jd|ddSdS)Nz*Unhandled exception in client_connected_cb)r~ exceptionr&) cancelledcloserr>call_exception_handler)taskrUrDr&s rcallbackz6StreamReaderProtocol.connection_made..callbacks~~''!)))..**C 99'S),)2;; "))))) 'r)rnrlr>rabortrqrx set_transportr{rsrrrror iscoroutine create_taskrpadd_done_callbackrm)rDr&contextr%resrs`` rconnection_madez$StreamReaderProtocol.connection_madesg  " @G % E.2.D*+ J - -g 6 6 6 OO    F#$     + + +"11,??tK  $ 0".y$/5/3z#;#;D ++F,0,?AAC%c** 7 * * * * * *"Z33C88  ,,X666"&D   / 1 0rc|j}|,||n|||js7||jdn|j|t |d|_d|_ d|_ d|_ dSr) rxfeed_eofrSrtrLrMrhrVrkrorprq)rDrUr%rvs rrVz$StreamReaderProtocol.connection_lost s$  {!!!!$$S)))|  "" 0{ ''---- **3/// $$$!%" rcF|j}|||dSdSr)rx feed_data)rDdatar%s r data_receivedz"StreamReaderProtocol.data_receiveds2$     T " " " " "  rcR|j}|||jrdSdS)NFT)rxrrs)rDr%s r eof_receivedz!StreamReaderProtocol.eof_received!s6$   OO    > 5trc|jSr)rtr_s rraz&StreamReaderProtocol._get_close_waiter,s |rc |j}|r*|s|dSdSdS#t$rYdSwxYwr)rtrLrrAttributeError)rDcloseds r__del__zStreamReaderProtocol.__del__/s #\F{{}} #V%5%5%7%7 #  """"" # # # #    DD sA AANN)rbrcrdrerlrEpropertyrxr|rrVrrrar __classcell__)rvs@rrrs222222(((X( LLL('('('T$###    # # # # # # #rrceZdZdZdZdZedZdZdZ dZ dZ d Z d Z d Zdd ZdZd d ddZdZd S)ra'Wraps a Transport. This exposes write(), writelines(), [can_]write_eof(), get_extra_info() and close(). It adds drain() which returns an optional Future on which you can wait for flow control. It also adds a transport property which references the Transport directly. c||_||_||_||_|j|_|jddSr)rq _protocol_readerr>rY _complete_futrM)rDr&rr%rs rrEzStreamWriter.__init__EsS#!  !Z5577 %%d+++++rc|jjd|jg}|j|d|jdd|S)N transport=zreader=<{}> )rvrbrqrrZformatjoinrDinfos r__repr__zStreamWriter.__repr__Os]')Ido)I)IJ < # KK2$,22 3 3 3}}SXXd^^,,,rc|jSrrqrIs rr&zStreamWriter.transportUs rc:|j|dSr)rqwriterDrs rrzStreamWriter.writeYs d#####rc:|j|dSr)rq writelinesrs rrzStreamWriter.writelines\s ""4(((((rc4|jSr)rq write_eofrIs rrzStreamWriter.write_eof_s((***rc4|jSr)rq can_write_eofrIs rrzStreamWriter.can_write_eofbs,,...rc4|jSr)rqrrIs rrzStreamWriter.closees$$&&&rc4|jSr)rq is_closingrIs rrzStreamWriter.is_closinghs))+++rcJK|j|d{VdSr)rrarIs r wait_closedzStreamWriter.wait_closedks4n..t44444444444rNc8|j||Sr)rqr{)rDnamedefaults rr{zStreamWriter.get_extra_infons--dG<< start_tlsrqr|)rDrzrrrr new_transports rrzStreamWriter.start_tlssn9E >jjll"j22 OXz#_"7399999999 (  &&&&&rc|jsh|jrt jdt dS|t jd|t dSdS)Nzloop is closedz unclosed )rqrr> is_closedwarningswarnResourceWarningrrIs rrzStreamWriter.__del__s))++ Ez##%% E .@@@@@  2$22ODDDDD  E Err)rbrcrdrerErrr&rrrrrrrr{rrrrrrrr;s,,,--- X$$$)))+++///''',,,555====---4)-.2 ' ' ' ' 'EEEEErrceZdZdZedfdZdZdZdZdZ dZ dZ d Z d Z d Zd Zd ZddZddZdZdZdZdS)rNcz|dkrtd||_|tj|_n||_t |_d|_d|_d|_ d|_ d|_ |j r-tjtjd|_dSdS)NrzLimit cannot be <= 0Fr ) ValueError_limitr r=r> bytearray_buffer_eof_waiter _exceptionrqr?rGr extract_stacksys _getframerl)rDrrs rrEzStreamReader.__init__s A::344 4 </11DJJDJ {{    :   ! ! "%3%A a  &"&"D " " " " "rc\dg}|jr*|t|jd|jr|d|jt kr|d|j|jr|d|j|jr|d|j|jr|d|j|j r|dd d |S) Nrz byteseofzlimit=zwaiter=z exception=rpausedrr) rrZlenrr_DEFAULT_LIMITrrrqr?rrrs rrzStreamReader.__repr__s, < 6 KK3t|,,444 5 5 5 9  KK    ;. ( ( KK... / / / < 4 KK2$,22 3 3 3 ? : KK8T_88 9 9 9 ? : KK8T_88 9 9 9 < " KK ! ! !}}SXXd^^,,,rc|jSr)rrIs rrzStreamReader.exceptions rc||_|j}|2d|_|s||dSdSdSr)rrrrSrTs rrSzStreamReader.set_exceptions]  DL##%% *$$S)))))   * *rc|j}|2d|_|s|ddSdSdS)z1Wakeup read*() functions waiting for data or EOF.N)rrrMrNs r_wakeup_waiterzStreamReader._wakeup_waitersV  DL##%% (!!$'''''   ( (rc||_dSrr)rDr&s rrzStreamReader.set_transports #rc|jr?t|j|jkr$d|_|jdSdSdS)NF)r?rrrrqresume_readingrIs r_maybe_resume_transportz$StreamReader._maybe_resume_transportsS < -C --<< DL O * * , , , , , - -<rY)rD func_names r_wait_for_datazStreamReader._wait_for_datas < #55566 6 < - DL O * * , , ,z//11  ,       DLLL4DL    s " A88 BcKd}t|} ||d{V}n#tj$r}|jcYd}~Sd}~wtj$r}|j||jr|jd|j|z=n|j | t|j dd}~wwxYw|S)aRead chunk of data from the stream until newline (b' ') is found. On success, return chunk that ends with newline. If only partial line can be read due to EOF, return incomplete line without terminating newline. When EOF was reached while no bytes read, empty bytes object is returned. If limit is reached, ValueError will be raised. In that case, if newline was found, complete line including newline will be removed from internal buffer. Else, internal buffer will be cleared. Limit is compared against part of the line without newline. If stream was paused, this function will automatically resume it if needed.  Nr) r readuntilrIncompleteReadErrorpartialLimitOverrunErrorr startswithconsumedclearrrargs)rDsepseplenlinees rreadlinezStreamReader.readline#s  S (,,,,,,,,DD-   9      + ( ( (|&&sAJ77 %L!5!*v"5!566 ""$$$  ( ( * * *QVAY'' '  ( s(1CA C CA:CCrcKt|}|dkrtd|j|jd} t|j}||z |krJ|j||}|dkrn|dz|z }||jkrt jd||jrBt|j}|j t j |d| dd{V||jkrt jd ||jd||z}|jd||z=| t|S) aVRead data from the stream until ``separator`` is found. On success, the data and separator will be removed from the internal buffer (consumed). Returned data will include the separator at the end. Configured stream limit is used to check result. Limit sets the maximal length of data that can be returned, not counting the separator. If an EOF occurs and the complete separator is still not found, an IncompleteReadError exception will be raised, and the internal buffer will be reset. The IncompleteReadError.partial attribute may contain the separator partially. If the data cannot be read because of over limit, a LimitOverrunError exception will be raised, and the data will be left in the internal buffer, so it can be read again. rz,Separator should be at least one-byte stringNTr z2Separator is not found, and chunk exceed the limitrz2Separator is found, but chunk is longer than limit)rrrrfindrrrrbytesrrrr)rD separatorroffsetbuflenisepchunks rrzStreamReader.readuntilBs(Y Q;;KLL L ? &/ !* 3&&F&((|((F;;2:: !f,DK''$6L   y Bdl++ ""$$$ 4UDAAA%%k22 2 2 2 2 2 2 2= 3@ $+  .DdLL L ^dVm^, L$- ( $$&&&U||rrcK|j|j|dkrdS|dkrQg} ||jd{V}|sn||9d|S|js"|js|dd{Vt|jd|}|jd|=| |S)aRead up to `n` bytes from the stream. If `n` is not provided or set to -1, read until EOF, then return all read bytes. If EOF was received and the internal buffer is empty, return an empty bytes object. If `n` is 0, return an empty bytes object immediately. If `n` is positive, return at most `n` available bytes as soon as at least 1 byte is available in the internal buffer. If EOF is received before any byte is read, return an empty bytes object. Returned value is not limited with limit, configured at stream creation. If stream was paused, this function will automatically resume it if needed. NrrTread) rr rrZrrrrrr)rDnblocksblockrs rr zStreamReader.reads, ? &/ ! 663 q55 F %"ii 44444444 e$$$  % 88F## #| .DI .%%f-- - - - - - - -T\"1"%&& L!  $$&&& rcK|dkrtd|j|j|dkrdSt|j|kr||jrBt |j}|jtj||| dd{Vt|j|k|t|j|kr.t |j}|jn&t |jd|}|jd|=| |S)aRead exactly `n` bytes. Raise an IncompleteReadError if EOF is reached before `n` bytes can be read. The IncompleteReadError.partial attribute of the exception will contain the partial read bytes. if n is zero, return empty bytes object. Returned value is not limited with limit, configured at stream creation. If stream was paused, this function will automatically resume it if needed. rz*readexactly size can not be less than zeroNr readexactly) rrrrrrrrrrr)rDr  incompleters rrzStreamReader.readexactlysK q55IJJ J ? &/ ! 663$,!##y D"4<00  ""$$$ 4ZCCC%%m44 4 4 4 4 4 4 4 $,!## t|   ! !&&D L   bqb)**D RaR  $$&&& rc|SrrrIs r __aiter__zStreamReader.__aiter__s rcXK|d{V}|dkrt|S)Nr)rStopAsyncIteration)rDvals r __anext__zStreamReader.__anext__s9MMOO###### #::$ $ r)r)r)rbrcrdrlrrErrrSrrrrrrrrrr rrrrrrrrs4+$"""",---$***((($$$--- ...$$$,   8>YYYYv1111f'''Rrrrr)__all__r@socketrrrihasattrr r rrrlogrtasksrrrrr r Protocolr9rrrrrrrsf '  769= <rsjy~           r__pycache__/transports.cpython-311.opt-1.pyc000064400000035501152533123130014636 0ustar00 !A?h)dZdZGddZGddeZGddeZGdd eeZGd d eZGd d eZGddeZdS)zAbstract Transport class.) BaseTransport ReadTransportWriteTransport TransportDatagramTransportSubprocessTransportc>eZdZdZdZd dZd dZdZdZdZ d Z dS) rzBase class for transports._extraNc|i}||_dSNr )selfextras ?/opt/alt/python-internal/lib64/python3.11/asyncio/transports.py__init__zBaseTransport.__init__s =E c8|j||S)z#Get optional transport information.)r get)r namedefaults rget_extra_infozBaseTransport.get_extra_infos{tW---rct)z2Return True if the transport is closing or closed.NotImplementedErrorr s r is_closingzBaseTransport.is_closing!!rct)aClose the transport. Buffered data will be flushed asynchronously. No more data will be received. After all buffered data is flushed, the protocol's connection_lost() method will (eventually) be called with None as its argument. rrs rclosezBaseTransport.close "!rct)zSet a new protocol.r)r protocols r set_protocolzBaseTransport.set_protocol%rrct)zReturn the current protocol.rrs r get_protocolzBaseTransport.get_protocol)rrr ) __name__ __module__ __qualname____doc__ __slots__rrrrr"r$rrrr s$$I ....""""""""""""""rrc(eZdZdZdZdZdZdZdS)rz#Interface for read-only transports.r*ct)z*Return True if the transport is receiving.rrs r is_readingzReadTransport.is_reading3rrct)zPause the receiving end. No data will be passed to the protocol's data_received() method until resume_reading() is called. rrs r pause_readingzReadTransport.pause_reading7 "!rct)zResume the receiving end. Data received will once again be passed to the protocol's data_received() method. rrs rresume_readingzReadTransport.resume_reading?r0rN)r%r&r'r(r)r-r/r2r*rrrr.sL--I"""""""""""rrcHeZdZdZdZd dZdZdZdZdZ d Z d Z d Z dS) rz$Interface for write-only transports.r*Nct)aSet the high- and low-water limits for write flow control. These two values control when to call the protocol's pause_writing() and resume_writing() methods. If specified, the low-water limit must be less than or equal to the high-water limit. Neither value can be negative. The defaults are implementation-specific. If only the high-water limit is given, the low-water limit defaults to an implementation-specific value less than or equal to the high-water limit. Setting high to zero forces low to zero as well, and causes pause_writing() to be called whenever the buffer becomes non-empty. Setting low to zero causes resume_writing() to be called only once the buffer is empty. Use of zero for either limit is generally sub-optimal as it reduces opportunities for doing I/O and computation concurrently. rr highlows rset_write_buffer_limitsz&WriteTransport.set_write_buffer_limitsMs &"!rct)z,Return the current size of the write buffer.rrs rget_write_buffer_sizez$WriteTransport.get_write_buffer_sizebrrct)zGet the high and low watermarks for write flow control. Return a tuple (low, high) where low and high are positive number of bytes.rrs rget_write_buffer_limitsz&WriteTransport.get_write_buffer_limitsfs "!rct)zWrite some data bytes to the transport. This does not block; it buffers the data and arranges for it to be sent out asynchronously. r)r datas rwritezWriteTransport.writelr0rcZd|}||dS)zWrite a list (or any iterable) of data bytes to the transport. The default implementation concatenates the arguments and calls write() on the result. rN)joinr?)r list_of_datar>s r writelineszWriteTransport.writelinests- xx %% 4rct)zClose the write end after flushing buffered data. (This is like typing ^D into a UNIX program reading from stdin.) Data may still be received. rrs r write_eofzWriteTransport.write_eof} "!rct)zAReturn True if this transport supports write_eof(), False if not.rrs r can_write_eofzWriteTransport.can_write_eofrrctzClose the transport immediately. Buffered data will be lost. No more data will be received. The protocol's connection_lost() method will (eventually) be called with None as its argument. rrs rabortzWriteTransport.abortrFrNN) r%r&r'r(r)r8r:r<r?rCrErHrKr*rrrrHs..I""""*"""""" """"""""""""""rrceZdZdZdZdS)raSInterface representing a bidirectional transport. There may be several implementations, but typically, the user does not implement new transports; rather, the platform provides some useful transports that are implemented using the platform's best practices. The user never instantiates a transport directly; they call a utility function, passing it a protocol factory and other information necessary to create the transport and protocol. (E.g. EventLoop.create_connection() or EventLoop.create_server().) The utility function will asynchronously create a transport and a protocol and hook them up by calling the protocol's connection_made() method, passing it the transport. The implementation here raises NotImplemented for every method except writelines(), which calls write() in a loop. r*N)r%r&r'r(r)r*rrrrs(IIIrrc$eZdZdZdZddZdZdS)rz(Interface for datagram (UDP) transports.r*Nct)aSend data to the transport. This does not block; it buffers the data and arranges for it to be sent out asynchronously. addr is target socket address. If addr is None use target address pointed on transport creation. r)r r>addrs rsendtozDatagramTransport.sendtorrctrJrrs rrKzDatagramTransport.abortrFrr )r%r&r'r(r)rQrKr*rrrrsB22I"""""""""rrc6eZdZdZdZdZdZdZdZdZ dS) rr*ct)zGet subprocess id.rrs rget_pidzSubprocessTransport.get_pidrrct)zGet subprocess returncode. See also http://docs.python.org/3/library/subprocess#subprocess.Popen.returncode rrs rget_returncodez"SubprocessTransport.get_returncoder0rct)z&Get transport for pipe with number fd.r)r fds rget_pipe_transportz&SubprocessTransport.get_pipe_transportrrct)zSend signal to subprocess. See also: docs.python.org/3/library/subprocess#subprocess.Popen.send_signal r)r signals r send_signalzSubprocessTransport.send_signalr0rct)aLStop the subprocess. Alias for close() method. On Posix OSs the method sends SIGTERM to the subprocess. On Windows the Win32 API function TerminateProcess() is called to stop the subprocess. See also: http://docs.python.org/3/library/subprocess#subprocess.Popen.terminate rrs r terminatezSubprocessTransport.terminates "!rct)zKill the subprocess. On Posix OSs the function sends SIGKILL to the subprocess. On Windows kill() is an alias for terminate(). See also: http://docs.python.org/3/library/subprocess#subprocess.Popen.kill rrs rkillzSubprocessTransport.kills "!rN) r%r&r'r)rUrWrZr]r_rar*rrrrssI"""""""""""" " " " " " " " "rrcPeZdZdZdZd fd ZdZdZdZd dZ d d Z d Z xZ S) _FlowControlMixinavAll the logic for (write) flow control in a mix-in base class. The subclass must implement get_write_buffer_size(). It must call _maybe_pause_protocol() whenever the write buffer size increases, and _maybe_resume_protocol() whenever it decreases. It may also override set_write_buffer_limits() (e.g. to specify different defaults). The subclass constructor must call super().__init__(extra). This will call set_write_buffer_limits(). The user may call set_write_buffer_limits() and get_write_buffer_size(), and their protocol's pause_writing() and resume_writing() may be called. )_loop_protocol_paused _high_water _low_waterNct|||_d|_|dS)NF)superrrdre_set_write_buffer_limits)r rloop __class__s rrz_FlowControlMixin.__init__sB  % %%'''''rc6|}||jkrdS|jspd|_ |jdS#t t f$rt$r/}|j d|||jdYd}~dSd}~wwxYwdS)NTzprotocol.pause_writing() failedmessage exception transportr!) r:rfre _protocol pause_writing SystemExitKeyboardInterrupt BaseExceptionrdcall_exception_handler)r sizeexcs r_maybe_pause_protocolz'_FlowControlMixin._maybe_pause_protocols))++ 4# # # F$ $(D ! ,,..... 12        11@!$!% $ 33   sA B'$BBc2|jr||jkrrd|_ |jdS#t t f$rt$r/}|j d|||jdYd}~dSd}~wwxYwdSdS)NFz protocol.resume_writing() failedrn) rer:rgrrresume_writingrtrurvrdrw)r rys r_maybe_resume_protocolz(_FlowControlMixin._maybe_resume_protocol's  ! **,,??$)D ! --///// 12        11A!$!% $ 33   ??sAB#$B  Bc|j|jfSr )rgrfrs rr<z)_FlowControlMixin.get_write_buffer_limits7s!122rc| |d}nd|z}||dz}||cxkrdksntd|d|d||_||_dS)Nizhigh (z) must be >= low (z) must be >= 0) ValueErrorrfrgr5s rrjz*_FlowControlMixin._set_write_buffer_limits:s <{ 3w ;!)CsaHHH3HHHJJ J rc\||||dS)N)r6r7)rjrzr5s rr8z)_FlowControlMixin.set_write_buffer_limitsJs3 %%4S%999 ""$$$$$rctr rrs rr:z'_FlowControlMixin.get_write_buffer_sizeNs!!rrL) r%r&r'r(r)rrzr}r<rjr8r: __classcell__)rls@rrcrcs KI(((((($ 333 %%%%"""""""rrcN) r(__all__rrrrrrrcr*rrrsW  """"""""""""""""J"""""M"""4I"I"I"I"I"]I"I"I"X ~0""""" """23"3"3"3"3"-3"3"3"lT"T"T"T"T" T"T"T"T"T"r__pycache__/streams.cpython-311.pyc000064400000104302152533123130013132 0ustar00 !A?hok~dZddlZddlZddlZddlZddlZeedredz ZddlmZddlm Z ddlm Z dd lm Z dd lm Z dd l mZdd lmZd ZdeddZdeddZeedrdeddZdeddZGdde jZGddee jZGddZGddZdS)) StreamReader StreamWriterStreamReaderProtocolopen_connection start_serverNAF_UNIX)open_unix_connectionstart_unix_server) coroutines)events) exceptions)format_helpers) protocols)logger)sleepi)limitc Ktj}t||}t|| |j fd||fi|d{V\}}t | ||}||fS)aA wrapper for create_connection() returning a (reader, writer) pair. The reader returned is a StreamReader instance; the writer is a StreamWriter instance. The arguments are all the usual arguments to create_connection() except protocol_factory; most common are positional host and port, with various optional keyword arguments following. Additional optional keyword arguments are loop (to set the event loop instance to use) and limit (to set the buffer limit passed to the StreamReader). (If you want to customize the StreamReader and/or StreamReaderProtocol classes, just copy the code -- there's really nothing special here except some convenience.) rlooprcSNprotocolsz!open_connection..1sN)r get_running_looprrcreate_connectionr) hostportrkwdsrreader transport_writerrs @rrrs&  " $ $D D 1 1 1F#F666H//$..(,........LIq )Xvt < rclKtjfd}j|||fi|d{VS)aStart a socket server, call back for each client connected. The first parameter, `client_connected_cb`, takes two parameters: client_reader, client_writer. client_reader is a StreamReader object, while client_writer is a StreamWriter object. This parameter can either be a plain callback function or a coroutine; if it is a coroutine, it will be automatically converted into a Task. The rest of the arguments are all the usual arguments to loop.create_server() except protocol_factory; most common are positional host and port, with various optional keyword arguments following. The return value is the same as loop.create_server(). Additional optional keyword argument is limit (to set the buffer limit passed to the StreamReader). The return value is the same as loop.create_server(), i.e. a Server object which can be used to stop the service. cNt}t|}|SNrrrrr%rclient_connected_cbrrs rfactoryzstart_server..factoryNs6E555'0C-1333rN)r r create_server)r.r"r#rr$r/rs` ` @rrr6so,  " $ $D $#GT4@@4@@ @ @ @ @ @ @@rcKtj}t||}t|||jfd|fi|d{V\}}t |||}||fS)z@Similar to `open_connection` but works with UNIX Domain Sockets.rrcSrrrsrrz&open_unix_connection..bsHrN)r r rrcreate_unix_connectionr) pathrr$rr%r&r'r(rs @rr r Zs&((E555'T:::8T8    d,,&*,,,,,,,, 1i64@@v~rcjKtjfd}j||fi|d{VS)z=Similar to `start_server` but works with UNIX Domain Sockets.cNt}t|}|Sr+r,r-s rr/z"start_unix_server..factoryks6!D999F+F4G15777HOrN)r r create_unix_server)r.r4rr$r/rs` ` @rr r fsm&((        -T,WdCCdCCCCCCCCCrc8eZdZdZd dZdZdZdZdZdZ dS) FlowControlMixina)Reusable flow control logic for StreamWriter.drain(). This implements the protocol methods pause_writing(), resume_writing() and connection_lost(). If the subclass overrides these it must call the super methods. StreamWriter.drain() must wait for _drain_helper() coroutine. Nc|tjd|_n||_d|_t j|_d|_dS)N) stacklevelF)r _get_event_loop_loop_paused collectionsdeque_drain_waiters_connection_lost)selfrs r__init__zFlowControlMixin.__init__~sK </1===DJJDJ )/11 %rc|jrJd|_|jrtjd|dSdS)NTz%r pauses writing)r?r> get_debugrdebugrDs r pause_writingzFlowControlMixin.pause_writingsP< :   ! ! 4 L,d 3 3 3 3 3 4 4rc|jsJd|_|jrtjd||jD]+}|s|d,dS)NFz%r resumes writing)r?r>rGrrHrBdone set_resultrDwaiters rresume_writingzFlowControlMixin.resume_writings|| :   ! ! 5 L-t 4 4 4) ( (F;;== (!!$''' ( (rcd|_|jsdS|jD]C}|s-||d.||DdSNT)rCr?rBrLrM set_exceptionrDexcrOs rconnection_lostz FlowControlMixin.connection_lostsv $|  F) . .F;;== .;%%d++++((---  . .rc2K|jrtd|jsdS|j}|j| |d{V|j|dS#|j|wxYw)NzConnection lost)rCConnectionResetErrorr?r> create_futurerBappendremoverNs r _drain_helperzFlowControlMixin._drain_helpers   :&'899 9|  F))++ ""6*** /LLLLLLL   & &v . . . . .D  & &v . . . .s A::Bctr)NotImplementedErrorrDstreams r_get_close_waiterz"FlowControlMixin._get_close_waiters!!rr) __name__ __module__ __qualname____doc__rErJrPrVr\rarrrr9r9ts}&&&&444 ((( . . . / / /"""""rr9cleZdZdZdZd fd ZedZdZdZ fdZ dZ d Z d Z d ZxZS) ra=Helper class to adapt between Protocol and StreamReader. (This is a helper class instead of making StreamReader itself a Protocol subclass, because the StreamReader has other potential uses, and to prevent the user of the StreamReader to accidentally call inappropriate methods of the protocol.) NcLt||&tj||_|j|_nd|_|||_d|_d|_d|_ d|_ ||_ d|_ |j |_dS)NrF)superrEweakrefref_stream_reader_wr_source_traceback_strong_reader_reject_connection_stream_writer_task _transport_client_connected_cb _over_sslr>rY_closed)rD stream_readerr.r __class__s rrEzStreamReaderProtocol.__init__s d###  $%,[%?%?D "%2%DD " "%)D "  *#0D "'" $7!z//11 rc<|jdS|Sr)rkrIs r_stream_readerz#StreamReaderProtocol._stream_readers"  ! )4%%'''rcv|j}|j}||_||_|ddu|_dS)N sslcontext)r>r&rorqget_extra_infors)rDr(rr&s r_replace_writerz$StreamReaderProtocol._replace_writers>z$ $#"11,??tKrcXjrEddi}jr j|d<j|dS_j}||ddu_ j t|j_ |j }tj|r?fd}j|_j|d_dSdS)NmessagezpAn open stream was garbage collected prior to establishing network connection; call "stream.close()" explicitly.source_tracebackrzc|rdS|}|4jd|ddSdS)Nz*Unhandled exception in client_connected_cb)r~ exceptionr&) cancelledcloserr>call_exception_handler)taskrUrDr&s rcallbackz6StreamReaderProtocol.connection_made..callbacks~~''!)))..**C 99'S),)2;; "))))) 'r)rnrlr>rabortrqrx set_transportr{rsrrrror iscoroutine create_taskrpadd_done_callbackrm)rDr&contextr%resrs`` rconnection_madez$StreamReaderProtocol.connection_madesg  " @G % E.2.D*+ J - -g 6 6 6 OO    F#$     + + +"11,??tK  $ 0".y$/5/3z#;#;D ++F,0,?AAC%c** 7 * * * * * *"Z33C88  ,,X666"&D   / 1 0rc|j}|,||n|||js7||jdn|j|t |d|_d|_ d|_ d|_ dSr) rxfeed_eofrSrtrLrMrhrVrkrorprq)rDrUr%rvs rrVz$StreamReaderProtocol.connection_lost s$  {!!!!$$S)))|  "" 0{ ''---- **3/// $$$!%" rcF|j}|||dSdSr)rx feed_data)rDdatar%s r data_receivedz"StreamReaderProtocol.data_receiveds2$     T " " " " "  rcR|j}|||jrdSdS)NFT)rxrrs)rDr%s r eof_receivedz!StreamReaderProtocol.eof_received!s6$   OO    > 5trc|jSr)rtr_s rraz&StreamReaderProtocol._get_close_waiter,s |rc |j}|r*|s|dSdSdS#t$rYdSwxYwr)rtrLrrAttributeError)rDcloseds r__del__zStreamReaderProtocol.__del__/s #\F{{}} #V%5%5%7%7 #  """"" # # # #    DD sA AANN)rbrcrdrerlrEpropertyrxr|rrVrrrar __classcell__)rvs@rrrs222222(((X( LLL('('('T$###    # # # # # # #rrceZdZdZdZdZedZdZdZ dZ dZ d Z d Z d Zdd ZdZd d ddZdZd S)ra'Wraps a Transport. This exposes write(), writelines(), [can_]write_eof(), get_extra_info() and close(). It adds drain() which returns an optional Future on which you can wait for flow control. It also adds a transport property which references the Transport directly. c||_||_|t|tsJ||_||_|j|_|jddSr) rq _protocol isinstancer_readerr>rY _complete_futrM)rDr&rr%rs rrEzStreamWriter.__init__Esi#!~FL!A!A~~A  !Z5577 %%d+++++rc|jjd|jg}|j|d|jdd|S)N transport=zreader=<{}> )rvrbrqrrZformatjoinrDinfos r__repr__zStreamWriter.__repr__Os]')Ido)I)IJ < # KK2$,22 3 3 3}}SXXd^^,,,rc|jSrrqrIs rr&zStreamWriter.transportUs rc:|j|dSr)rqwriterDrs rrzStreamWriter.writeYs d#####rc:|j|dSr)rq writelinesrs rrzStreamWriter.writelines\s ""4(((((rc4|jSr)rq write_eofrIs rrzStreamWriter.write_eof_s((***rc4|jSr)rq can_write_eofrIs rrzStreamWriter.can_write_eofbs,,...rc4|jSr)rqrrIs rrzStreamWriter.closees$$&&&rc4|jSr)rq is_closingrIs rrzStreamWriter.is_closinghs))+++rcJK|j|d{VdSr)rrarIs r wait_closedzStreamWriter.wait_closedks4n..t44444444444rNc8|j||Sr)rqr{)rDnamedefaults rr{zStreamWriter.get_extra_infons--dG<< start_tlsrqr|)rDrzrrrr new_transports rrzStreamWriter.start_tlssn9E >jjll"j22 OXz#_"7399999999 (  &&&&&rc|jsh|jrt jdt dS|t jd|t dSdS)Nzloop is closedz unclosed )rqrr> is_closedwarningswarnResourceWarningrrIs rrzStreamWriter.__del__s))++ Ez##%% E .@@@@@  2$22ODDDDD  E Err)rbrcrdrerErrr&rrrrrrrr{rrrrrrrr;s,,,--- X$$$)))+++///''',,,555====---4)-.2 ' ' ' ' 'EEEEErrceZdZdZedfdZdZdZdZdZ dZ dZ d Z d Z d Zd Zd ZddZddZdZdZdZdS)rNcz|dkrtd||_|tj|_n||_t |_d|_d|_d|_ d|_ d|_ |j r-tjtjd|_dSdS)NrzLimit cannot be <= 0Fr ) ValueError_limitr r=r> bytearray_buffer_eof_waiter _exceptionrqr?rGr extract_stacksys _getframerl)rDrrs rrEzStreamReader.__init__s A::344 4 </11DJJDJ {{    :   ! ! "%3%A a  &"&"D " " " " "rc\dg}|jr*|t|jd|jr|d|jt kr|d|j|jr|d|j|jr|d|j|jr|d|j|j r|dd d |S) Nrz byteseofzlimit=zwaiter=z exception=rpausedrr) rrZlenrr_DEFAULT_LIMITrrrqr?rrrs rrzStreamReader.__repr__s, < 6 KK3t|,,444 5 5 5 9  KK    ;. ( ( KK... / / / < 4 KK2$,22 3 3 3 ? : KK8T_88 9 9 9 ? : KK8T_88 9 9 9 < " KK ! ! !}}SXXd^^,,,rc|jSr)rrIs rrzStreamReader.exceptions rc||_|j}|2d|_|s||dSdSdSr)rrrrSrTs rrSzStreamReader.set_exceptions]  DL##%% *$$S)))))   * *rc|j}|2d|_|s|ddSdSdS)z1Wakeup read*() functions waiting for data or EOF.N)rrrMrNs r_wakeup_waiterzStreamReader._wakeup_waitersV  DL##%% (!!$'''''   ( (rc6|j Jd||_dS)NzTransport already setr)rDr&s rrzStreamReader.set_transports$&&(?&&&#rc|jr?t|j|jkr$d|_|jdSdSdS)NF)r?rrrrqresume_readingrIs r_maybe_resume_transportz$StreamReader._maybe_resume_transportsS < -C --<< DL O * * , , , , , - -<rY)rD func_names r_wait_for_datazStreamReader._wait_for_datas < #55566 6988888} < - DL O * * , , ,z//11  ,       DLLL4DL    s 3 B BcKd}t|} ||d{V}n#tj$r}|jcYd}~Sd}~wtj$r}|j||jr|jd|j|z=n|j | t|j dd}~wwxYw|S)aRead chunk of data from the stream until newline (b' ') is found. On success, return chunk that ends with newline. If only partial line can be read due to EOF, return incomplete line without terminating newline. When EOF was reached while no bytes read, empty bytes object is returned. If limit is reached, ValueError will be raised. In that case, if newline was found, complete line including newline will be removed from internal buffer. Else, internal buffer will be cleared. Limit is compared against part of the line without newline. If stream was paused, this function will automatically resume it if needed.  Nr) r readuntilrIncompleteReadErrorpartialLimitOverrunErrorr startswithconsumedclearrrargs)rDsepseplenlinees rreadlinezStreamReader.readline#s  S (,,,,,,,,DD-   9      + ( ( (|&&sAJ77 %L!5!*v"5!566 ""$$$  ( ( * * *QVAY'' '  ( s(1CA C CA:CCrcKt|}|dkrtd|j|jd} t|j}||z |krJ|j||}|dkrn|dz|z }||jkrt jd||jrBt|j}|j t j |d| dd{V||jkrt jd ||jd||z}|jd||z=| t|S) aVRead data from the stream until ``separator`` is found. On success, the data and separator will be removed from the internal buffer (consumed). Returned data will include the separator at the end. Configured stream limit is used to check result. Limit sets the maximal length of data that can be returned, not counting the separator. If an EOF occurs and the complete separator is still not found, an IncompleteReadError exception will be raised, and the internal buffer will be reset. The IncompleteReadError.partial attribute may contain the separator partially. If the data cannot be read because of over limit, a LimitOverrunError exception will be raised, and the data will be left in the internal buffer, so it can be read again. rz,Separator should be at least one-byte stringNTr z2Separator is not found, and chunk exceed the limitrz2Separator is found, but chunk is longer than limit)rrrrfindrrrrbytesrrrr)rD separatorroffsetbuflenisepchunks rrzStreamReader.readuntilBs(Y Q;;KLL L ? &/ !* 3&&F&((|((F;;2:: !f,DK''$6L   y Bdl++ ""$$$ 4UDAAA%%k22 2 2 2 2 2 2 2= 3@ $+  .DdLL L ^dVm^, L$- ( $$&&&U||rrcK|j|j|dkrdS|dkrQg} ||jd{V}|sn||9d|S|js"|js|dd{Vt|jd|}|jd|=| |S)aRead up to `n` bytes from the stream. If `n` is not provided or set to -1, read until EOF, then return all read bytes. If EOF was received and the internal buffer is empty, return an empty bytes object. If `n` is 0, return an empty bytes object immediately. If `n` is positive, return at most `n` available bytes as soon as at least 1 byte is available in the internal buffer. If EOF is received before any byte is read, return an empty bytes object. Returned value is not limited with limit, configured at stream creation. If stream was paused, this function will automatically resume it if needed. NrrTread) rr rrZrrrrrr)rDnblocksblockrs rr zStreamReader.reads, ? &/ ! 663 q55 F %"ii 44444444 e$$$  % 88F## #| .DI .%%f-- - - - - - - -T\"1"%&& L!  $$&&& rcK|dkrtd|j|j|dkrdSt|j|kr||jrBt |j}|jtj||| dd{Vt|j|k|t|j|kr.t |j}|jn&t |jd|}|jd|=| |S)aRead exactly `n` bytes. Raise an IncompleteReadError if EOF is reached before `n` bytes can be read. The IncompleteReadError.partial attribute of the exception will contain the partial read bytes. if n is zero, return empty bytes object. Returned value is not limited with limit, configured at stream creation. If stream was paused, this function will automatically resume it if needed. rz*readexactly size can not be less than zeroNr readexactly) rrrrrrrrrrr)rDr  incompleters rrzStreamReader.readexactlysK q55IJJ J ? &/ ! 663$,!##y D"4<00  ""$$$ 4ZCCC%%m44 4 4 4 4 4 4 4 $,!## t|   ! !&&D L   bqb)**D RaR  $$&&& rc|SrrrIs r __aiter__zStreamReader.__aiter__s rcXK|d{V}|dkrt|S)Nr)rStopAsyncIteration)rDvals r __anext__zStreamReader.__anext__s9MMOO###### #::$ $ r)r)r)rbrcrdrlrrErrrSrrrrrrrrrr rrrrrrrrs4+$"""",---$***((($$$--- ...$$$,   8>YYYYv1111f'''Rrrrr)__all__r@socketrrrihasattrr r rrrlogrtasksrrrrr r Protocolr9rrrrrrrsf '  769= <$  D$7} $"566$ )**/#DI...$ /00/#DI... 4cxt||d}t|}|r|d|dd|dz }|S)Nz at r:r)_format_callbackr)rargs func_reprsources r_format_callback_sourcersQ tT22I !$ ' 'F 43F1I33q 333 rc g}|r|d|D|r1|d|Ddd|S)Nc3>K|]}tj|VdSrreprlibrepr).0args r z*_format_args_and_kwargs..&s,773W\#&&777777rc3NK|] \}}|dtj|V!dS)=Nr)r"kvs rr$z*_format_args_and_kwargs..(s<II$!Q--GLOO--IIIIIIrz({})z, )extenditemsformatjoin)rkwargsr*s r_format_args_and_kwargsr.s E 8 77$777777 J II&,,..IIIIII ==5)) * **rcpt|tjr4t|||z}t |j|j|j|St|dr|j r|j }n.t|dr|j r|j }nt|}|t||z }|r||z }|S)N __qualname____name__) r rrr.rrrkeywordshasattrr1r2r!)rrr-suffixrs rrr,s$ )**M(v66? 49dmVLLLt^$$):% z " "t}M JJ  (v666I V rc |tjj}| tj}t jt j||d}| |S)NF)limit lookup_lines) sys _getframef_backrDEBUG_STACK_DEPTH traceback StackSummaryextract walk_stackreverse)fr7stacks r extract_stackrD>so y MOO " }+  " * *9+?+B+B168= + ? ?E MMOOO Lr)r/)NN) rrr r9r=r/rrrr.rrDrrrFs     + + +$r__pycache__/windows_utils.cpython-311.pyc000064400000017140152533123130014371 0ustar00 !A?hdZddlZejdkr edddlZddlZddlZddlZddlZddl Z ddl Z dZ dZ ej Z ejZejZdde d d ZGd d ZGd dejZdS)z)Various Windows specific bits and pieces.Nwin32z win32 only)pipePopenPIPE PipeHandlei F)TT)duplex overlappedbufsizec Rtjdtjt t }|r*tj}tj tj z}||}}ntj }tj }d|}}|tj z}|dr|tj z}|dr tj }nd}dx} } tj||tjd||tjtj} tj||dtjtj|tj} tj| d} | d| | fS#| tj| | tj| xYw)zELike os.pipe() but with overlapped support and using handles not fds.z\\.\pipe\python-pipe-{:d}-{:d}-)prefixrNTr )tempfilemktempformatosgetpidnext _mmap_counter_winapiPIPE_ACCESS_DUPLEX GENERIC_READ GENERIC_WRITEPIPE_ACCESS_INBOUNDFILE_FLAG_FIRST_PIPE_INSTANCEFILE_FLAG_OVERLAPPEDCreateNamedPipe PIPE_WAITNMPWAIT_WAIT_FOREVERNULL CreateFile OPEN_EXISTINGConnectNamedPipeGetOverlappedResult CloseHandle) rr r addressopenmodeaccessobsizeibsizeflags_and_attribsh1h2ovs B/opt/alt/python-internal/lib64/python3.11/asyncio/windows_utils.pyrr so188 IKKm,,..///G$-%(== '.&G 55H!}1G00!}#8NB  $ Xw0 vvw;W\KK  VQ g.C w|-- %bT : : : t$$$2v  >   # # # >   # # # s BE77/F&cpeZdZdZdZdZedZdZe j ddZ e j fdZd Zd Zd S) rzWrapper for an overlapped pipe handle which is vaguely file-object like. The IOCP event loop can use these instead of socket objects. c||_dSN_handleselfhandles r/__init__zPipeHandle.__init__Vs  cP|j d|j}nd}d|jjd|dS)Nzhandle=closed< >)r4 __class____name__r5s r/__repr__zPipeHandle.__repr__Ys> < #/t|//FFF64>*66V6666r9c|jSr2r3r6s r/r7zPipeHandle.handle`s |r9c<|jtd|jS)NzI/O operation on closed pipe)r4 ValueErrorrCs r/filenozPipeHandle.filenods! < ;<< <|r9)r%cF|j||jd|_dSdSr2r3)r6r%s r/closezPipeHandle.closeis/ < # K % % %DLLL $ #r9cl|j,|d|t||dSdS)Nz unclosed )source)r4ResourceWarningrH)r6_warns r/__del__zPipeHandle.__del__nsC < # E&d&& E E E E JJLLLLL $ #r9c|Sr2rCs r/ __enter__zPipeHandle.__enter__ss r9c.|dSr2)rH)r6tvtbs r/__exit__zPipeHandle.__exit__vs r9N)r@ __module__ __qualname____doc__r8rApropertyr7rFrr%rHwarningswarnrMrPrUrOr9r/rrQs777X $+#6     %M r9rc$eZdZdZdfd ZxZS)rzReplacement for subprocess.Popen using overlapped pipe handles. The stdin, stdout, stderr are None or instances of PipeHandle. Nc |drJ|dddksJdx}x}}dx} x} } |tkr4tdd\} } tj| t j}n|}|tkr)td\} } tj| d}n|}|tkr)td\} }tj|d}n|tkr|}n|} tj |f|||d || t| |_ | t| |_ | t| |_ n$#| | | fD]}|tj|xYw|tkrt j||tkrt j||tkrt j|dSdS#|tkrt j||tkrt j||tkrt j|wwxYw) Nuniversal_newlinesr r)FTT)r r)TFr)stdinstdoutstderr)getrrmsvcrtopen_osfhandlerO_RDONLYSTDOUTsuperr8rr_r`rarr%rH)r6argsr_r`rakwds stdin_rfd stdout_wfd stderr_wfdstdin_wh stdout_rh stderr_rhstdin_rh stdout_wh stderr_whhr?s r/r8zPopen.__init__s}88011111xx 1%%****.22 2J+///9y D==!%t!L!L!L Hh-h DDIII T>>#'=#A#A#A Iy.y!<>#'=#A#A#A Iy.y!<r}s%// <7 +l # ##  0    !! \7+++++b&&&&&&&&X0%0%0%0%0%J 0%0%0%0%0%r9__pycache__/sslproto.cpython-311.pyc000064400000125014152533123130013344 0ustar00 !A?h{PddlZddlZddlZ ddlZn #e$rdZYnwxYwddlmZddlmZddlmZddlm Z ddl m Z eej ej fZGdd ejZGd d ejZd Zd ZGdde je jZGddejZdS)N) constants) exceptions) protocols) transports)loggerc"eZdZdZdZdZdZdZdS)SSLProtocolState UNWRAPPED DO_HANDSHAKEWRAPPEDFLUSHINGSHUTDOWNN)__name__ __module__ __qualname__r r r rr=/opt/alt/python-internal/lib64/python3.11/asyncio/sslproto.pyr r s'I!LGHHHHrr ceZdZdZdZdZdZdS)AppProtocolState STATE_INITSTATE_CON_MADE STATE_EOFSTATE_CON_LOSTN)rrrrrrrrrrrrs$J%NI%NNNrrc`|rtdtj}|sd|_|S)Nz(Server side SSL needs a valid SSLContextF) ValueErrorsslcreate_default_contextcheck_hostname) server_sideserver_hostname sslcontexts r_create_transport_contextr$/s@ECDDD +--J *$) ! rc|||dz}n |}d|z}n|}||dz}n|}||cxkrdksntd|d|d||fS)Nirzhigh (z) must be >= low (z) must be >= 0)r)highlowkbhilos radd_flowcontrol_defaultsr,=s | ;dBBBRBB  { 1W  ====q====j""bbb"## # r6MrceZdZdZejjZdZddZ dZ dZ dZ dZ efd Zd Zd Zd Zdd ZdZdZddZdZdZedZdZdZdZdZdZdZ dZ!dS)_SSLProtocolTransportTc0||_||_d|_dS)NF)_loop _ssl_protocol_closed)selfloop ssl_protocols r__init__z_SSLProtocolTransport.__init__Xs ) rNc8|j||S)z#Get optional transport information.)r1_get_extra_infor3namedefaults rget_extra_infoz$_SSLProtocolTransport.get_extra_info]s!11$@@@rc:|j|dSN)r1_set_app_protocol)r3protocols r set_protocolz"_SSLProtocolTransport.set_protocolas ,,X66666rc|jjSr>)r1 _app_protocolr3s r get_protocolz"_SSLProtocolTransport.get_protocolds!//rc|jSr>)r2rDs r is_closingz _SSLProtocolTransport.is_closinggs |rcf|js"d|_|jdSd|_dS)a Close the transport. Buffered data will be flushed asynchronously. No more data will be received. After all buffered data is flushed, the protocol's connection_lost() method will (eventually) called with None as its argument. TN)r2r1_start_shutdownrDs rclosez_SSLProtocolTransport.closejs>| &DL   . . 0 0 0 0 0!%D   rc\|js$d|_|dtdSdS)NTz9unclosed transport )r2warnResourceWarning)r3 _warningss r__del__z_SSLProtocolTransport.__del__xsE| ,DL NN* , , , , , , ,rc|jj Sr>)r1_app_reading_pausedrDs r is_readingz _SSLProtocolTransport.is_readings%999rc8|jdS)zPause the receiving end. No data will be passed to the protocol's data_received() method until resume_reading() is called. N)r1_pause_readingrDs r pause_readingz#_SSLProtocolTransport.pause_readings ))+++++rc8|jdS)zResume the receiving end. Data received will once again be passed to the protocol's data_received() method. N)r1_resume_readingrDs rresume_readingz$_SSLProtocolTransport.resume_readings **,,,,,rcn|j|||jdS)aSet the high- and low-water limits for write flow control. These two values control when to call the protocol's pause_writing() and resume_writing() methods. If specified, the low-water limit must be less than or equal to the high-water limit. Neither value can be negative. The defaults are implementation-specific. If only the high-water limit is given, the low-water limit defaults to an implementation-specific value less than or equal to the high-water limit. Setting high to zero forces low to zero as well, and causes pause_writing() to be called whenever the buffer becomes non-empty. Setting low to zero causes resume_writing() to be called only once the buffer is empty. Use of zero for either limit is generally sub-optimal as it reduces opportunities for doing I/O and computation concurrently. N)r1_set_write_buffer_limits_control_app_writingr3r'r(s rset_write_buffer_limitsz-_SSLProtocolTransport.set_write_buffer_limitss8& 33D#>>> //11111rc2|jj|jjfSr>)r1_outgoing_low_water_outgoing_high_waterrDs rget_write_buffer_limitsz-_SSLProtocolTransport.get_write_buffer_limits"6"79 9rc4|jS)z-Return the current size of the write buffers.)r1_get_write_buffer_sizerDs rget_write_buffer_sizez+_SSLProtocolTransport.get_write_buffer_sizes!88:::rcn|j|||jdS)aSet the high- and low-water limits for read flow control. These two values control when to call the upstream transport's pause_reading() and resume_reading() methods. If specified, the low-water limit must be less than or equal to the high-water limit. Neither value can be negative. The defaults are implementation-specific. If only the high-water limit is given, the low-water limit defaults to an implementation-specific value less than or equal to the high-water limit. Setting high to zero forces low to zero as well, and causes pause_reading() to be called whenever the buffer becomes non-empty. Setting low to zero causes resume_reading() to be called only once the buffer is empty. Use of zero for either limit is generally sub-optimal as it reduces opportunities for doing I/O and computation concurrently. N)r1_set_read_buffer_limits_control_ssl_readingr\s rset_read_buffer_limitsz,_SSLProtocolTransport.set_read_buffer_limitss8& 224=== //11111rc2|jj|jjfSr>)r1_incoming_low_water_incoming_high_waterrDs rget_read_buffer_limitsz,_SSLProtocolTransport.get_read_buffer_limitsrbrc4|jS)z+Return the current size of the read buffer.)r1_get_read_buffer_sizerDs rget_read_buffer_sizez*_SSLProtocolTransport.get_read_buffer_sizes!77999rc|jjSr>)r1_app_writing_pausedrDs r_protocol_pausedz&_SSLProtocolTransport._protocol_pauseds!55rct|tttfs$t dt |j|sdS|j|fdS)zWrite some data bytes to the transport. This does not block; it buffers the data and arranges for it to be sent out asynchronously. z+data: expecting a bytes-like instance, got N) isinstancebytes bytearray memoryview TypeErrortyperr1_write_appdatar3datas rwritez_SSLProtocolTransport.writesv $ : >?? :9#'::#699:: :  F ))4'22222rc:|j|dS)zWrite a list (or any iterable) of data bytes to the transport. The default implementation concatenates the arguments and calls write() on the result. N)r1r{)r3 list_of_datas r writelinesz _SSLProtocolTransport.writeliness! )),77777rct)zuClose the write end after flushing buffered data. This raises :exc:`NotImplementedError` right now. )NotImplementedErrorrDs r write_eofz_SSLProtocolTransport.write_eofs "!rcdS)zAReturn True if this transport supports write_eof(), False if not.FrrDs r can_write_eofz#_SSLProtocolTransport.can_write_eofsurc0|ddS)zClose the transport immediately. Buffered data will be lost. No more data will be received. The protocol's connection_lost() method will (eventually) be called with None as its argument. N) _force_closerDs rabortz_SSLProtocolTransport.aborts $rcZd|_|j|j|dSdSNT)r2r1_abortr3excs rrz"_SSLProtocolTransport._force_closes7   )   % %c * * * * * * )rc|jj||jxjt |z c_dSr>)r1_write_backlogappend_write_buffer_sizelenr|s r_test__append_write_backlogz1_SSLProtocolTransport._test__append_write_backlogs? )00666 --T:----rr>NN)"rrr_start_tls_compatibler _SendfileModeFALLBACK_sendfile_compatibler6r<rArErGrJwarningsrOrRrUrXr]rarerirmrppropertyrsr~rrrrrrrrrr.r.Rs!$2; AAAA777000 & & &!),,,,:::,,,---2222,999;;;2222,999:::66X6 3 3 3888"""   +++ ;;;;;rr.ceZdZdZdZdZdZ d-dZdZd.dZ dZ d Z d Z d Z d Zd Zd.dZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZ dZ!d Z"d!Z#d"Z$d/d#Z%d$Z&d%Z'd&Z(d/d'Z)d(Z*d)Z+d*Z,d0d,Z-dS)1 SSLProtocoliNFTc ttdt|j|_t |j|_| tj}n|dkrtd|| tj } n| dkrtd| |st||}||_ |r |s||_ nd|_ ||_t||_t#j|_d|_||_||_||d|_d|_d|_||_| |_tj|_tj|_t@j!|_"d|_#|rtHj%|_&ntHj'|_&|j(|j|j|j |j |_)d|_*d|_+d|_,d|_-d|_.|/d|_0d|_1d|_2d|_3|4|5dS)Nzstdlib ssl module not availablerz7ssl_handshake_timeout should be a positive number, got z6ssl_shutdown_timeout should be a positive number, got )r#F)r!r")6r RuntimeErrorrwmax_size _ssl_bufferrx_ssl_buffer_viewrSSL_HANDSHAKE_TIMEOUTrSSL_SHUTDOWN_TIMEOUTr$ _server_side_server_hostname _sslcontextdict_extra collectionsdequerr_waiterr0r?_app_transport_app_transport_created _transport_ssl_handshake_timeout_ssl_shutdown_timeout MemoryBIO _incoming _outgoingr r _state _conn_lostrr _app_staterwrap_bio_sslobj_ssl_writing_pausedrQ_ssl_reading_pausedrlrkrg _eof_receivedrrr`r_rZ_get_app_transport) r3r4 app_protocolr#waiterr!r"call_connection_madessl_handshake_timeoutssl_shutdown_timeouts rr6zSSLProtocol.__init__s ;@AA A$T]33 *4+; < < ($-$C ! ! "a ' '/,//00 0 '#,#A !Q & &.+..// / .2_..J(  ); )$3D ! !$(D !%j111 */11"#   |,,,"&+#&;#%9"&0   >.9DOO.=DO'00 NDN) 1133 $) #( #( $%!#$  $$&&&"#( $%!#$  %%''' !!!!!rc||_t|dr;t|tjr!|j|_|j|_d|_ dSd|_ dS)N get_bufferTF) rChasattrrurBufferedProtocolr_app_protocol_get_bufferbuffer_updated_app_protocol_buffer_updated_app_protocol_is_buffer)r3rs rr?zSSLProtocol._set_app_protocolasc) L, / / 1<)CDD 1,8,CD )0<0KD -+/D ( ( (+0D ( ( (rc|jdS|js7||j|n|jdd|_dSr>)r cancelled set_exception set_resultrs r_wakeup_waiterzSSLProtocol._wakeup_waiterlsd <  F|%%'' . **3//// ''--- rc|j7|jrtdt|j||_d|_|jS)Nz$Creating _SSLProtocolTransport twiceT)rrrr.r0rDs rrzSSLProtocol._get_app_transportvsK   &* K"#IJJJ"7 D"I"ID *.D '""rc<||_|dS)zXCalled when the low-level connection is made. Start the SSL handshake. N)r_start_handshake)r3 transports rconnection_madezSSLProtocol.connection_made~s# $ rc|j|j|xjdz c_|j d|j_|jtj kr`|j tj ks|j tj kr6tj|_ |j|jj||tjd|_d|_d|_|||jr |jd|_|jr"|jd|_dSdS)zCalled when the low-level connection is lost or closed. The argument is an exception object or None (the latter meaning a regular EOF is received or the connection was aborted or closed). rNT)rclearrreadrrr2rr r rrrrrr0 call_soonrCconnection_lost _set_stater rr_shutdown_timeout_handlecancel_handshake_timeout_handlers rrzSSLProtocol.connection_lostsO !!###  1   **.D  ' ;*7 7 7#3#BBB#3#==="2"A $$T%7%GMMM (2333"! C    ( 1  ) 0 0 2 2 2,0D )  ) 2  * 1 1 3 3 3-1D * * * 2 2rc|}|dks ||jkr|j}t|j|kr-t||_t |j|_|jSNr)rrrrwrxr)r3nwants rrzSSLProtocol.get_buffersc 199t},,=D t 4 ' '(D $.t/?$@$@D !$$rc|j|jd||jtjkr|dS|jtjkr|dS|jtj kr| dS|jtj kr| dSdSr>) rr~rrr r _do_handshaker _do_readr _do_flushr _do_shutdown)r3nbytess rrzSSLProtocol.buffer_updateds T27F7;<<< ;*7 7 7    [,4 4 4 MMOOOOO [,5 5 5 NN      [,5 5 5        6 5rcd|_ |jrtjd||jt jkr|tdS|jt j kr>| t j |j rdS|dS|jt j krI|| t j|dS|jt jkr|dSdS#t$$r|jwxYw)aCalled when the other end of the low-level stream is half-closed. If this returns a false value (including None), the transport will close itself. If it returns a true value, closing the transport is up to the protocol. Tz%r received EOFN)rr0 get_debugrdebugrr r _on_handshake_completeConnectionResetErrorr rrrQr _do_writerr ExceptionrrJrDs r eof_receivedzSSLProtocol.eof_receivedsg" z##%% 6 .555{.;;;++,@AAAAA 0 888 0 9:::+%4NN$$$$$ 0 999    0 9:::!!##### 0 999!!#####:9    O ! ! # # #  s%AE(;E%E;AE)E%E+cv||jvr |j|S|j|j||S|Sr>)rrr<r9s rr8zSSLProtocol._get_extra_infosA 4;  ;t$ $ _ (?11$@@ @Nrcd}|tjkrd}n|jtjkr|tjkrd}nw|jtjkr|tjkrd}nO|jtjkr|tjkrd}n'|jtjkr|tjkrd}|r ||_dStd|j|)NFTz!cannot switch state from {} to {}) r r rr r rrrformat)r3 new_statealloweds rrzSSLProtocol._set_states (2 2 2GG K+5 5 5 )6 6 6GG K+8 8 8 )1 1 1GG K+3 3 3 )2 2 2GG K+4 4 4 )2 2 2G  -#DKKK3::K,,-- -rcfjr4tjdj_nd_tjj j fd_ dS)Nz%r starts SSL handshakec,Sr>)_check_handshake_timeoutrDsrz.SSLProtocol._start_handshake..!s$*G*G*I*Ir) r0rrrtime_handshake_start_timerr r call_laterrrrrDs`rrzSSLProtocol._start_handshakes :   ! ! . L2D 9 9 9)-):):D & &)-D & (5666 J ! !$"="I"I"I"I K K & rc|jtjkr/d|jd}|t |dSdS)Nz$SSL handshake is taking longer than z! seconds: aborting the connection)rr r r _fatal_errorConnectionAbortedError)r3msgs rrz$SSLProtocol._check_handshake_timeout%s_ ;*7 7 7+.+++    4S99 : : : : : 8 7rc |j|ddS#t$r|YdSt j$r }||Yd}~dSd}~wwxYwr>)r do_handshakerSSLAgainErrors_process_outgoingrSSLErrorrs rrzSSLProtocol._do_handshake.s . L % % ' ' '  ' ' - - - - -  % % %  " " $ $ $ $ $ $| - - -  ' ' , , , , , , , , , -s2BB!A<<Bc|j |jd|_|j} | |tjn||}n#t$rv}d}|tjt|tj rd}nd}| ||| |Yd}~dSd}~wwxYw|jr:|j|jz }t%jd||dz|j|||||jt2jkr=t2j|_|j|| |dS)Nz1SSL handshake failed on verifying the certificatezSSL handshake failedz%r: SSL handshake took %.1f msg@@)peercertcipher compression ssl_object) rrrrr r getpeercertrr rurCertificateErrorrrr0rrrrrrupdaterrrrrrrCrrr)r3 handshake_excsslobjrrrdts rrz"SSLProtocol._on_handshake_complete8s  ) 5  * 1 1 3 3 3-1D * $ 0 89999##))++HH    M OO,6 7 7 7#s344 -I,   c3 ' ' '    $ $ $ FFFFF  :   ! ! K""T%??B L94c J J J H"(--//'-'9'9';';&,  . . . ?.9 9 9.=DO   . .t/F/F/H/H I I I  s8A)) C)3A+C$$C)cjtjtjtjfvrdSj dj_jtjkrddS tjj j fd_ dS)NTc,Sr>)_check_shutdown_timeoutrDsrrz-SSLProtocol._start_shutdown..rs4466r)rr rrr rr2r rrr0rrrrrDs`rrIzSSLProtocol._start_shutdownas K ) ) *   F   **.D  ' ;*7 7 7 KK      OO,5 6 6 6,0J,A,A*6666--D ) NN     rc|jtjtjfvr.|jt jddSdS)NzSSL shutdown timed out)rr rrrrr TimeoutErrorrDs rrz#SSLProtocol._check_shutdown_timeoutvsf K ) )   O ( ('(@AA C C C C C   rc||tj|dSr>)rrr rrrDs rrzSSLProtocol._do_flushs=  (1222 rcf |js|j|||ddS#t $r|YdStj$r }||Yd}~dSd}~wwxYwr>) rrunwrapr_call_eof_received_on_shutdown_completerrrrs rrzSSLProtocol._do_shutdowns -% & ##%%%  " " $ $ $  # # % % %  & &t , , , , , % % %  " " $ $ $ $ $ $| , , ,  & &s + + + + + + + + + ,s A!!B0B0B++B0c|j |jd|_|r||dS|j|jjdSr>)rrrr0rrrJ)r3 shutdown_excs rrz!SSLProtocol._on_shutdown_completesk  ( 4  ) 0 0 2 2 2,0D )  8   l + + + + + J !6 7 7 7 7 7rc|tj|j|j|dSdSr>)rr r rrrs rrzSSLProtocol._abortsD (2333 ? & O ( ( - - - - - ' &rc|jtjtjtjfvr;|jt jkrtj d|xjdz c_dS|D]9}|j ||xj t|z c_ : |jtjkr|dSdS#t $r!}||dYd}~dSd}~wwxYw)NzSSL connection is closedrFatal error on SSL protocol)rr rrr rr!LOG_THRESHOLD_FOR_CONNLOST_WRITESrwarningrrrrr rrr)r3rr}exs rr{zSSLProtocol._write_appdatas& K ) ) *   )"MMM9::: OOq OO F  1 1D   & &t , , ,  # #s4yy 0 # # # A{.666     76 A A A   b"? @ @ @ @ @ @ @ @ @ As#)C C;C66C;c\ |jr~|jd}|j|}t|}||kr#||d|jd<|xj|zc_n|jd=|xj|zc_|j~n#t $rYnwxYw|dSr)rrr~rrrr)r3r}countdata_lens rrzSSLProtocol._do_writes % 8*1- **400t998##-1%&&\D'*++u4++++A.++x7++% 8    D       sBB BBc|jsB|j}t|r|j||dSr>)rrrrrr~r[r|s rrzSSLProtocol._process_outgoings\' ,>&&((D4yy ,%%d+++ !!#####rc|jtjtjfvrdS |js`|jr|n||jr| n| | dS#t$r!}| |dYd}~dSd}~wwxYw)Nr)rr r rrQr_do_read__buffered_do_read__copiedrrrrhrr)r3r!s rrzSSLProtocol._do_reads K ( )    F A+ -/,++----))+++&-NN$$$$**,,,  % % ' ' ' ' ' A A A   b"? @ @ @ @ @ @ @ @ @ AsA;B C *CC c,d}d}}t|} j||}|dkr^|}||kr9j||z ||d}|dkr||z }nn#||k9jfdn#t$rYnwxYw|dkr||s*  dSdS)Nrrc,Sr>)rrDsrrz0SSLProtocol._do_read__buffered..sr) rrorrrr0rrrrrI)r3offsetr#bufwantss` rr'zSSLProtocol._do_read__bufferedsK++D,F,F,H,HIIC L%%eS11Eqyyunn L--efnc&''lKKEqyy% unnJ(()@)@)@)@AAA    D  A::  - -f 5 5 5 #  # # % % %  " " " " " # #sA?B== C  C cd}d}d} |j|j}|sn(|rd}d}|}n|rd}||g}n||Jn#t$rYnwxYw|r|j|n/|s-|jd||s*|| dSdS)N1TFr) rrrrrrC data_receivedjoinrrI)r3chunkzeroonefirstr}s rr(zSSLProtocol._do_read__copieds3  ' ))$-88' DC!EE'C!5>DDKK&&& '    D   =   , ,U 3 3 3 3 =   , ,SXXd^^ < < < #  # # % % %  " " " " " # #sA A A! A!c8 |jtjkrBtj|_|j}|rt jddSdSdS#ttf$rt$r!}| |dYd}~dSd}~wwxYw)Nz?returning true from eof_received() has no effect when using sslzError calling eof_received()) rrrrrCrrr KeyboardInterrupt SystemExit BaseExceptionr)r3 keep_openr!s rrzSSLProtocol._call_eof_received%s B"2"AAA"2"< .;;== CN$BCCCCC BACC":.     B B B   b"@ A A A A A A A A A BsAAB8BBc:|}||jkrw|jspd|_ |jdS#t t f$rt$r/}|j d||j |dYd}~dSd}~wwxYw||j krw|jrrd|_ |j dS#t t f$rt$r/}|j d||j |dYd}~dSd}~wwxYwdSdS)NTzprotocol.pause_writing() failedmessage exceptionrr@Fz protocol.resume_writing() failed) rdr`rrrC pause_writingr7r8r9r0call_exception_handlerrr_resume_writing)r3sizers rr[z SSLProtocol._control_app_writing4s**,, 4, , ,T5M ,'+D $ "0022222%z2        11@!$!%!4 $ 33 T- - -$2J -',D $ "1133333%z2        11A!$!%!4 $ 33  . - - -s/A B%$BB1C D'$DDc*|jj|jzSr>)rpendingrrDs rrdz"SSLProtocol._get_write_buffer_sizeQs~%(???rc^t||tj\}}||_||_dSr>)r,r!FLOW_CONTROL_HIGH_WATER_SSL_WRITEr`r_r\s rrZz$SSLProtocol._set_write_buffer_limitsTs7, #yBDD c$(!#&   rcd|_dSr)rQrDs rrTzSSLProtocol._pause_reading\s#'   rcfjr(d_fd}j|dSdS)NFc jtjkrdSjtjkrdSjtjkrdSdSr>)rr r rrrrrrDsrresumez+SSLProtocol._resume_reading..resumecs};"2":::MMOOOOO[$4$===NN$$$$$[$4$===%%'''''>=r)rQr0r)r3rJs` rrWzSSLProtocol._resume_reading_sW  # )',D $ ( ( ( ( ( J  ( ( ( ( ( ) )rc|}||jkr)|js"d|_|jdS||jkr)|jr$d|_|jdSdSdS)NTF)rorlrrrUrkrX)r3rBs rrhz SSLProtocol._control_ssl_readingns))++ 4, , ,T5M ,'+D $ O ) ) + + + + + T- - -$2J -',D $ O * * , , , , ,. - - -rc^t||tj\}}||_||_dSr>)r,r FLOW_CONTROL_HIGH_WATER_SSL_READrlrkr\s rrgz#SSLProtocol._set_read_buffer_limitsws7, #yACC c$(!#&   rc|jjSr>)rrDrDs rroz!SSLProtocol._get_read_buffer_size}s ~%%rc&|jrJd|_dS)z\Called when the low-level transport's buffer goes over the high-water mark. TN)rrDs rr?zSSLProtocol.pause_writings!++++#'   rcN|jsJd|_|dS)z^Called when the low-level transport's buffer drains below the low-water mark. FN)rrrDs rrAzSSLProtocol.resume_writings3''''#(       rFatal error on transportc\|jr|j|t|tr5|jrt jd||ddSdSt|tj s&|j |||j|ddSdS)Nz%r: %sT)exc_infor<) rrruOSErrorr0rrrrCancelledErrorr@)r3rr=s rrzSSLProtocol._fatal_errors ? . O ( ( - - - c7 # # z##%% E XtWtDDDDDD E EC!:;;  J - -" !_ //       r)FNTNNr>r)rQ).rrrrrrrr6r?rrrrrrrr8rrrrrrIrrrrrr{rrrr'r(rr[rdrZrTrWrhrgror?rArrrrrrsH  $#59&*'+&* Q"Q"Q"Q"f 1 1 1###   "2"2"2H%%%    !!!F$-$-$-P ;;;...%%%R*CCC - - -888...AAA0!!! $$$AAA,###:###< B B B:@@@''''((( ) ) )---'''' &&& (((!!!      rr)renumrr ImportErrorrrrrlogrSSLWantReadErrorSSLSyscallErrorrEnumr rr$r,_FlowControlMixin Transportr.rrrrrr_s  JJJJ CCC?*C,?@Nty & & & & &ty & & &   *r;r;r;r;r;J8&0r;r;r;jW W W W W ),W W W W W s __pycache__/log.cpython-311.opt-1.pyc000064400000000472152533123130013177 0ustar00 !A?h|2dZddlZejeZdS)zLogging configuration.N)__doc__logging getLogger __package__logger8/opt/alt/python-internal/lib64/python3.11/asyncio/log.pyr s,  ; ' 'r __pycache__/protocols.cpython-311.opt-1.pyc000064400000022371152533123130014444 0ustar00 !A?h-dZdZGddZGddeZGddeZGdd eZGd d eZd Zd S)zAbstract Protocol base classes.) BaseProtocolProtocolDatagramProtocolSubprocessProtocolBufferedProtocolc.eZdZdZdZdZdZdZdZdS)ra Common base class for protocol interfaces. Usually user implements protocols that derived from BaseProtocol like Protocol or ProcessProtocol. The only case when BaseProtocol should be implemented directly is write-only transport like write pipe cdS)zCalled when a connection is made. The argument is the transport representing the pipe connection. To receive data, wait for data_received() calls. When the connection is closed, connection_lost() is called. Nr)self transports >/opt/alt/python-internal/lib64/python3.11/asyncio/protocols.pyconnection_madezBaseProtocol.connection_madecdS)zCalled when the connection is lost or closed. The argument is an exception object or None (the latter meaning a regular EOF is received or the connection was aborted or closed). Nrr excs r connection_lostzBaseProtocol.connection_lostrrcdS)aCalled when the transport's buffer goes over the high-water mark. Pause and resume calls are paired -- pause_writing() is called once when the buffer goes strictly over the high-water mark (even if subsequent writes increases the buffer size even more), and eventually resume_writing() is called once when the buffer size reaches the low-water mark. Note that if the buffer size equals the high-water mark, pause_writing() is not called -- it must go strictly over. Conversely, resume_writing() is called when the buffer size is equal or lower than the low-water mark. These end conditions are important to ensure that things go as expected when either mark is zero. NOTE: This is the only Protocol callback that is not called through EventLoop.call_soon() -- if it were, it would have no effect when it's most needed (when the app keeps writing without yielding until pause_writing() is called). Nrr s r pause_writingzBaseProtocol.pause_writing%rrcdS)zvCalled when the transport's buffer drains below the low-water mark. See pause_writing() for details. Nrrs r resume_writingzBaseProtocol.resume_writing;rrN) __name__ __module__ __qualname____doc__ __slots__r rrrrrr rr saI         ,     rrc"eZdZdZdZdZdZdS)ranInterface for stream protocol. The user should implement this interface. They can inherit from this class but don't need to. The implementations here do nothing (they don't raise exceptions). When the user wants to requests a transport, they pass a protocol factory to a utility function (e.g., EventLoop.create_connection()). When the connection is made successfully, connection_made() is called with a suitable transport object. Then data_received() will be called 0 or more times with data (bytes) received from the transport; finally, connection_lost() will be called exactly once with either an exception object or None as an argument. State machine of calls: start -> CM [-> DR*] [-> ER?] -> CL -> end * CM: connection_made() * DR: data_received() * ER: eof_received() * CL: connection_lost() rcdS)zTCalled when some data is received. The argument is a bytes object. Nr)r datas r data_receivedzProtocol.data_received^rrcdSzCalled when the other end calls write_eof() or equivalent. If this returns a false value (including None), the transport will close itself. If it returns a true value, closing the transport is up to the protocol. Nrrs r eof_receivedzProtocol.eof_receiveddrrN)rrrrrr!r$rrr rrBsC2I        rrc(eZdZdZdZdZdZdZdS)ra:Interface for stream protocol with manual buffer control. Event methods, such as `create_server` and `create_connection`, accept factories that return protocols that implement this interface. The idea of BufferedProtocol is that it allows to manually allocate and control the receive buffer. Event loops can then use the buffer provided by the protocol to avoid unnecessary data copies. This can result in noticeable performance improvement for protocols that receive big amounts of data. Sophisticated protocols can allocate the buffer only once at creation time. State machine of calls: start -> CM [-> GB [-> BU?]]* [-> ER?] -> CL -> end * CM: connection_made() * GB: get_buffer() * BU: buffer_updated() * ER: eof_received() * CL: connection_lost() rcdS)aPCalled to allocate a new receive buffer. *sizehint* is a recommended minimal size for the returned buffer. When set to -1, the buffer size can be arbitrary. Must return an object that implements the :ref:`buffer protocol `. It is an error to return a zero-sized buffer. Nr)r sizehints r get_bufferzBufferedProtocol.get_bufferrrcdS)zCalled when the buffer was updated with the received data. *nbytes* is the total number of bytes that were written to the buffer. Nr)r nbytess r buffer_updatedzBufferedProtocol.buffer_updatedrrcdSr#rrs r r$zBufferedProtocol.eof_receivedrrN)rrrrrr(r+r$rrr rrmsR.I            rrc"eZdZdZdZdZdZdS)rz Interface for datagram protocol.rcdS)z&Called when some datagram is received.Nr)r r addrs r datagram_receivedz"DatagramProtocol.datagram_receivedrrcdS)z~Called when a send or receive operation raises an OSError. (Other than BlockingIOError or InterruptedError.) Nrrs r error_receivedzDatagramProtocol.error_receivedrrN)rrrrrr0r2rrr rrs=**I555     rrc(eZdZdZdZdZdZdZdS)rz,Interface for protocol for subprocess calls.rcdS)zCalled when the subprocess writes data into stdout/stderr pipe. fd is int file descriptor. data is bytes object. Nr)r fdr s r pipe_data_receivedz%SubprocessProtocol.pipe_data_receivedrrcdS)zCalled when a file descriptor associated with the child process is closed. fd is the int file descriptor that was closed. Nr)r r5rs r pipe_connection_lostz'SubprocessProtocol.pipe_connection_lostrrcdS)z"Called when subprocess has exited.Nrrs r process_exitedz!SubprocessProtocol.process_exitedrrN)rrrrrr6r8r:rrr rrsL66I      11111rrc\t|}|r||}t|}|std||kr||d|<||dS|d||d|<||||d}t|}|dSdS)Nz%get_buffer() returned an empty buffer)lenr( RuntimeErrorr+)protor data_lenbufbuf_lens r _feed_data_to_buffered_protorBs4yyH !x((c(( HFGG G h  !C  N   * * * F 'NCM   ) ) )>D4yyH !!!!!rN)r__all__rrrrrrBrrr rDs%%  6 6 6 6 6 6 6 6 r( ( ( ( ( |( ( ( V2 2 2 2 2 |2 2 2 j      |    11111111.!!!!!r__pycache__/protocols.cpython-311.pyc000064400000022371152533123130013505 0ustar00 !A?h-dZdZGddZGddeZGddeZGdd eZGd d eZd Zd S)zAbstract Protocol base classes.) BaseProtocolProtocolDatagramProtocolSubprocessProtocolBufferedProtocolc.eZdZdZdZdZdZdZdZdS)ra Common base class for protocol interfaces. Usually user implements protocols that derived from BaseProtocol like Protocol or ProcessProtocol. The only case when BaseProtocol should be implemented directly is write-only transport like write pipe cdS)zCalled when a connection is made. The argument is the transport representing the pipe connection. To receive data, wait for data_received() calls. When the connection is closed, connection_lost() is called. Nr)self transports >/opt/alt/python-internal/lib64/python3.11/asyncio/protocols.pyconnection_madezBaseProtocol.connection_madecdS)zCalled when the connection is lost or closed. The argument is an exception object or None (the latter meaning a regular EOF is received or the connection was aborted or closed). Nrr excs r connection_lostzBaseProtocol.connection_lostrrcdS)aCalled when the transport's buffer goes over the high-water mark. Pause and resume calls are paired -- pause_writing() is called once when the buffer goes strictly over the high-water mark (even if subsequent writes increases the buffer size even more), and eventually resume_writing() is called once when the buffer size reaches the low-water mark. Note that if the buffer size equals the high-water mark, pause_writing() is not called -- it must go strictly over. Conversely, resume_writing() is called when the buffer size is equal or lower than the low-water mark. These end conditions are important to ensure that things go as expected when either mark is zero. NOTE: This is the only Protocol callback that is not called through EventLoop.call_soon() -- if it were, it would have no effect when it's most needed (when the app keeps writing without yielding until pause_writing() is called). Nrr s r pause_writingzBaseProtocol.pause_writing%rrcdS)zvCalled when the transport's buffer drains below the low-water mark. See pause_writing() for details. Nrrs r resume_writingzBaseProtocol.resume_writing;rrN) __name__ __module__ __qualname____doc__ __slots__r rrrrrr rr saI         ,     rrc"eZdZdZdZdZdZdS)ranInterface for stream protocol. The user should implement this interface. They can inherit from this class but don't need to. The implementations here do nothing (they don't raise exceptions). When the user wants to requests a transport, they pass a protocol factory to a utility function (e.g., EventLoop.create_connection()). When the connection is made successfully, connection_made() is called with a suitable transport object. Then data_received() will be called 0 or more times with data (bytes) received from the transport; finally, connection_lost() will be called exactly once with either an exception object or None as an argument. State machine of calls: start -> CM [-> DR*] [-> ER?] -> CL -> end * CM: connection_made() * DR: data_received() * ER: eof_received() * CL: connection_lost() rcdS)zTCalled when some data is received. The argument is a bytes object. Nr)r datas r data_receivedzProtocol.data_received^rrcdSzCalled when the other end calls write_eof() or equivalent. If this returns a false value (including None), the transport will close itself. If it returns a true value, closing the transport is up to the protocol. Nrrs r eof_receivedzProtocol.eof_receiveddrrN)rrrrrr!r$rrr rrBsC2I        rrc(eZdZdZdZdZdZdZdS)ra:Interface for stream protocol with manual buffer control. Event methods, such as `create_server` and `create_connection`, accept factories that return protocols that implement this interface. The idea of BufferedProtocol is that it allows to manually allocate and control the receive buffer. Event loops can then use the buffer provided by the protocol to avoid unnecessary data copies. This can result in noticeable performance improvement for protocols that receive big amounts of data. Sophisticated protocols can allocate the buffer only once at creation time. State machine of calls: start -> CM [-> GB [-> BU?]]* [-> ER?] -> CL -> end * CM: connection_made() * GB: get_buffer() * BU: buffer_updated() * ER: eof_received() * CL: connection_lost() rcdS)aPCalled to allocate a new receive buffer. *sizehint* is a recommended minimal size for the returned buffer. When set to -1, the buffer size can be arbitrary. Must return an object that implements the :ref:`buffer protocol `. It is an error to return a zero-sized buffer. Nr)r sizehints r get_bufferzBufferedProtocol.get_bufferrrcdS)zCalled when the buffer was updated with the received data. *nbytes* is the total number of bytes that were written to the buffer. Nr)r nbytess r buffer_updatedzBufferedProtocol.buffer_updatedrrcdSr#rrs r r$zBufferedProtocol.eof_receivedrrN)rrrrrr(r+r$rrr rrmsR.I            rrc"eZdZdZdZdZdZdS)rz Interface for datagram protocol.rcdS)z&Called when some datagram is received.Nr)r r addrs r datagram_receivedz"DatagramProtocol.datagram_receivedrrcdS)z~Called when a send or receive operation raises an OSError. (Other than BlockingIOError or InterruptedError.) Nrrs r error_receivedzDatagramProtocol.error_receivedrrN)rrrrrr0r2rrr rrs=**I555     rrc(eZdZdZdZdZdZdZdS)rz,Interface for protocol for subprocess calls.rcdS)zCalled when the subprocess writes data into stdout/stderr pipe. fd is int file descriptor. data is bytes object. Nr)r fdr s r pipe_data_receivedz%SubprocessProtocol.pipe_data_receivedrrcdS)zCalled when a file descriptor associated with the child process is closed. fd is the int file descriptor that was closed. Nr)r r5rs r pipe_connection_lostz'SubprocessProtocol.pipe_connection_lostrrcdS)z"Called when subprocess has exited.Nrrs r process_exitedz!SubprocessProtocol.process_exitedrrN)rrrrrr6r8r:rrr rrsL66I      11111rrc\t|}|r||}t|}|std||kr||d|<||dS|d||d|<||||d}t|}|dSdS)Nz%get_buffer() returned an empty buffer)lenr( RuntimeErrorr+)protor data_lenbufbuf_lens r _feed_data_to_buffered_protorBs4yyH !x((c(( HFGG G h  !C  N   * * * F 'NCM   ) ) )>D4yyH !!!!!rN)r__all__rrrrrrBrrr rDs%%  6 6 6 6 6 6 6 6 r( ( ( ( ( |( ( ( V2 2 2 2 2 |2 2 2 j      |    11111111.!!!!!r__pycache__/windows_events.cpython-311.opt-1.pyc000064400000133641152533123130015501 0ustar00 !A?hdZddlZejdkr edddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl Z ddl mZddl mZddl mZdd l mZdd l mZdd l mZdd l mZdd l mZddlmZdZejZejZdZdZdZdZGddejZ GddejZ!Gdde!Z"Gdde!Z#Gdde$Z%Gddej&Z'Gd d!ej(Z)Gd"d#Z*Gd$d%ej+Z,e'Z-Gd&d'ej.Z/Gd(d)ej.Z0e0Z1dS)*z.Selector and proactor event loops for Windows.Nwin32z win32 only)events)base_subprocess)futures) exceptions)proactor_events)selector_events)tasks) windows_utils)logger)SelectorEventLoopProactorEventLoop IocpProactorDefaultEventLoopPolicyWindowsSelectorEventLoopPolicyWindowsProactorEventLoopPolicyiigMbP?g?cXeZdZdZddfd ZfdZdZd fd ZfdZfd Z xZ S) _OverlappedFuturezSubclass of Future which represents an overlapped operation. Cancelling it will immediately cancel the overlapped operation. Nloopcxt||jr|jd=||_dSNr)super__init___source_traceback_ov)selfovr __class__s C/opt/alt/python-internal/lib64/python3.11/asyncio/windows_events.pyrz_OverlappedFuture.__init__6s? d###  ! +&r*ct}|j8|jjrdnd}|dd|d|jjdd|S)Npending completedrz overlapped=)r _repr_inforr%insertaddressrinfostater!s r"r)z_OverlappedFuture._repr_info<shww!!## 8 !%!1BII{E KKI%II483CIIII J J J r#c|jdS |jnH#t$r;}d||d}|jr |j|d<|j|Yd}~nd}~wwxYwd|_dS)Nz&Cancelling an overlapped future failedmessage exceptionfuturesource_traceback)rcancelOSErrorr_loopcall_exception_handler)rexccontexts r"_cancel_overlappedz$_OverlappedFuture._cancel_overlappedCs 8  F 7 HOO     7 7 7C G % E.2.D*+ J - -g 6 6 6 6 6 6 6 6 7s% A*1A%%A*cp|t|SN)msg)r;rr5rr>r!s r"r5z_OverlappedFuture.cancelSs- !!!ww~~#~&&&r#crt||dSN)r set_exceptionr;rr2r!s r"rBz_OverlappedFuture.set_exceptionWs3 i((( !!!!!r#cXt|d|_dSrA)r set_resultrrresultr!s r"rEz_OverlappedFuture.set_result[s& 6"""r#rA) __name__ __module__ __qualname____doc__rr)r;r5rBrE __classcell__r!s@r"rr0s $(  ''''''"""""r#rcdeZdZdZddfd ZdZfdZdZdZd fd Z fd Z fd Z xZ S) _BaseWaitHandleFuturez2Subclass of Future which represents a wait handle.Nrct||jr|jd=||_||_||_d|_dS)NrrT)rrrr_handle _wait_handle _registered)rr handle wait_handlerr!s r"rz_BaseWaitHandleFuture.__init__cs\ d###  ! +&r* ' r#cRtj|jdtjkSNr)_winapiWaitForSingleObjectrQ WAIT_OBJECT_0rs r"_pollz_BaseWaitHandleFuture._pollqs$+DL!<<%& 'r#c6t}|d|jd|j-|rdnd}|||j|d|jd|S)Nzhandle=r'signaledwaitingz wait_handle=)rr)appendrQr\rRr,s r"r)z _BaseWaitHandleFuture._repr_infovsww!!## /dl///000 < #"&**,,=JJIE KK      ( KK=t'8=== > > > r#cd|_dSrA)r)rfuts r"_unregister_wait_cbz)_BaseWaitHandleFuture._unregister_wait_cbsr#c^|jsdSd|_|j}d|_ tj|nc#t$rV}|jtjkr7d||d}|jr |j|d<|j |Yd}~dSYd}~nd}~wwxYw| ddSNFz$Failed to unregister the wait handler0r4) rSrR _overlappedUnregisterWaitr6winerrorERROR_IO_PENDINGrr7r8rcrrUr9r:s r"_unregister_waitz&_BaseWaitHandleFuture._unregister_waits  F '     &{ 3 3 3 3   |{;;;E!$" )I262HG./ 11':::<;;;;    &&&&&s5 BABBcp|t|Sr=)rkrr5r?s r"r5z_BaseWaitHandleFuture.cancels- ww~~#~&&&r#cr|t|dSrA)rkrrBrCs r"rBz#_BaseWaitHandleFuture.set_exceptions3  i(((((r#cr|t|dSrA)rkrrErFs r"rEz _BaseWaitHandleFuture.set_results3  6"""""r#rA) rHrIrJrKrr\r)rcrkr5rBrErLrMs@r"rOrO`s<<8<        '''  '''0'''''')))))#########r#rOcBeZdZdZddfd ZdZfdZfdZxZS)_WaitCancelFuturezoSubclass of Future which represents a wait for the cancellation of a _WaitHandleFuture using an event. Nrc`t||||d|_dS)Nr)rr_done_callback)rr eventrUrr!s r"rz_WaitCancelFuture.__init__s2 UKd;;;"r#c td)Nz'_WaitCancelFuture must not be cancelled) RuntimeErrorr[s r"r5z_WaitCancelFuture.cancelsDEEEr#ct||j||dSdSrA)rrErrrFs r"rEz_WaitCancelFuture.set_resultsF 6"""   *    % % % % % + *r#ct||j||dSdSrA)rrBrrrCs r"rBz_WaitCancelFuture.set_exceptionsF i(((   *    % % % % % + *r#) rHrIrJrKrr5rErBrLrMs@r"rprps8<####### FFF&&&&& &&&&&&&&&r#rpc4eZdZddfd ZfdZdZxZS)_WaitHandleFutureNrct||||||_d|_t jdddd|_d|_dS)NrTF)rr _proactor_unregister_proactorrf CreateEvent_event _event_fut)rr rTrUproactorrr!s r"rz_WaitHandleFuture.__init__sV V[t<<<!$(!!-dD%FF r#c|j'tj|jd|_d|_|j|jd|_t|dSrA) r~rX CloseHandlerr{ _unregisterrrrc)rrbr!s r"rcz%_WaitHandleFuture._unregister_wait_cbsk ; "   , , ,DK"DO ""48,,, ##C(((((r#c|jsdSd|_|j}d|_ tj||jnc#t $rV}|jtjkr7d||d}|jr |j|d<|j |Yd}~dSYd}~nd}~wwxYw|j |j|j |_dSre)rSrRrfUnregisterWaitExr~r6rhrirr7r8r{ _wait_cancelrcrrjs r"rkz"_WaitHandleFuture._unregister_waits  F '     (dk B B B B   |{;;;E!$" )I262HG./ 11':::<;;;; .55dk6:6NPPs; BABB)rHrIrJrrcrkrLrMs@r"ryrystBF)))))$PPPPPPPr#ryc4eZdZdZdZdZdZdZdZeZ dS) PipeServerzXClass representing a pipe server. This is much like a bound, listening socket. c||_tj|_d|_d|_|d|_dSNT)_addressweakrefWeakSet_free_instances_pipe_accept_pipe_future_server_pipe_handle)rr+s r"rzPipeServer.__init__sC &00 #' --d33 r#cJ|j|dc}|_|S)NF)rr)rtmps r"_get_unconnected_pipez PipeServer._get_unconnected_pipes& *d&>&>u&E&ETZ r#c |rdStjtjz}|r|tjz}tj|j|tjtjztj ztj tj tj tj tj}tj|}|j||SrA)closedrXPIPE_ACCESS_DUPLEXFILE_FLAG_OVERLAPPEDFILE_FLAG_FIRST_PIPE_INSTANCECreateNamedPiperPIPE_TYPE_MESSAGEPIPE_READMODE_MESSAGE PIPE_WAITPIPE_UNLIMITED_INSTANCESr BUFSIZENMPWAIT_WAIT_FOREVERNULL PipeHandleradd)rfirstflagshpipes r"rzPipeServer._server_pipe_handle s ;;== 4*W-II  ; W: :E  # M5  %(E E     ,  !=#8  (',  8 8'**   &&& r#c|jduSrA)rr[s r"rzPipeServer.closeds %&r#c|j |jd|_|jG|jD]}|d|_d|_|jdSdSrA)rr5rrcloserclear)rrs r"rzPipeServer.close"s  # /  $ + + - - -'+D $ = $,   DJ DM  & & ( ( ( ( ( % $r#N) rHrIrJrKrrrrr__del__r#r"rrsj444$''' ) ) )GGGr#rceZdZdZdS)_WindowsSelectorEventLoopz'Windows version of selector event loop.N)rHrIrJrKrr#r"rr1s1111r#rcDeZdZdZdfd ZfdZdZdZ ddZxZ S) rz2Windows version of proactor event loop using IOCP.Ncj|t}t|dSrA)rrr)rrr!s r"rzProactorEventLoop.__init__8s0  #~~H """""r#c ||jt|jQ|jj}|j|!|js|j |d|_dSdS#|jO|jj}|j|!|js|j |d|_wxYwrA) call_soon_loop_self_readingr run_forever_self_reading_futurerr5r%r{r)rr r!s r"rzProactorEventLoop.run_forever=s 1 NN42 3 3 3 GG   ! ! !(4.2)00222>"*>N..r222,0)))54t(4.2)00222>"*>N..r222,0)0000s :BAC/cK|j|}|d{V}|}|||d|i}||fS)Naddrextra)r{ connect_pipe_make_duplex_pipe_transport)rprotocol_factoryr+frprotocoltranss r"create_pipe_connectionz(ProactorEventLoop.create_pipe_connectionPsl N ' ' 0 0wwwwww##%%00x8>7H1JJhr#crKtdfd gS)Ncd} |r||}j|r|dS}||di}|dSj|}|_ | dS#t$rG|r,| dkr| YdSt$r}|rF| dkr.d||d|njrt#jd|d Yd}~dSd}~wt&j$r|r|YdSYdSwxYw) NrrrzPipe accept failed)r1r2rzAccept pipe failed on pipe %rT)exc_info)rGrdiscardrrrrr{ accept_piperadd_done_callbackBrokenPipeErrorfilenorr6r8_debugr warningrCancelledError) rrrr9r+loop_accept_piperrservers r"rz>ProactorEventLoop.start_serving_pipe..loop_accept_pipe[sJD) 6 A88::D*224888}} //11H44hvw.?5AAA3355<FN..t44*./*##$455555+# 1 1 1!DKKMMR//JJLLL/000000 1 1 1 8DKKMMR////#7%( $11 JJLLLL[8N#B#'$8888/000000000, ! ! !!JJLLLLLL!!! !s2AC:CCA G# G,A;F--(GGrA)rr)rrr+rrs```@@r"start_serving_pipez$ProactorEventLoop.start_serving_pipeXsgG$$+ 6+ 6+ 6+ 6+ 6+ 6+ 6+ 6+ 6+ 6Z '(((xr#c K|} t||||||||f| |d| } | d{VnN#ttf$rt$r0| | d{VwxYw| S)N)waiterr) create_future_WindowsSubprocessTransport SystemExitKeyboardInterrupt BaseExceptionr_wait) rrargsshellstdinstdoutstderrbufsizerkwargsrtransps r"_make_subprocess_transportz,ProactorEventLoop._make_subprocess_transports##%%,T8T5-2FFG74:%770677 LLLLLLLL-.        LLNNN,,..    s 8A BrA) rHrIrJrKrrrrrrLrMs@r"rr5s<<###### 11111&111j04r#rceZdZdZefdZdZdZdZd dZ dZ d!d Z d!d Z d!d Z d!d Zd"dZd!dZdZdZdZdZdZd dZdZdZdZdZdZdZd dZdZdZdZ dS)#rz#Proactor implementation using IOCP.cd|_g|_tjtjt d||_i|_tj |_ g|_ tj |_ dSrW) r7_resultsrfCreateIoCompletionPortINVALID_HANDLE_VALUEr_iocp_cacherrrS _unregistered_stopped_serving)r concurrencys r"rzIocpProactor.__init__sg   7  ,dA{DD  "?,, ' 1 1r#c2|jtddS)NzIocpProactor is closed)rrur[s r" _check_closedzIocpProactor._check_closeds! : 788 8  r#cdt|jzdt|jzg}|j|dd|jjdd|dS)Nzoverlapped#=%sz result#=%sr< r()lenrrrr`r!rHjoin)rr-s r"__repr__zIocpProactor.__repr__sl 3t{#3#33s4=1113 :  KK ! ! ! N333SXXd^^^^DDr#c||_dSrA)r7)rrs r"set_loopzIocpProactor.set_loops  r#Ncn|js|||j}g|_ |d}S#d}wxYwrA)rr\)rtimeoutrs r"selectzIocpProactor.selectsJ} JJw   m  CC$CJJJJs04cb|j}|||SrA)r7rrE)rvaluerbs r"_resultzIocpProactor._results,j&&(( u r#rc||tjt} t |t jr*||||n(|||n%#t$r| dcYSwxYwd}| |||S)Nr#c |S#t$r3}|jtjtjfvrt |jd}~wwxYwrA getresultr6rhrfERROR_NETNAME_DELETEDERROR_OPERATION_ABORTEDConnectionResetErrorrrkeyr r9s r" finish_recvz&IocpProactor.recv..finish_recvf ||~~%   B?c||tjt} t |t jr*||||n(|||n%#t$r| dcYSwxYwd}| |||S)Nrc |S#t$r3}|jtjtjfvrt |jd}~wwxYwrArrs r"rz+IocpProactor.recv_into..finish_recvrr) rrfrrr r  WSARecvIntor ReadFileIntorrr rrbufrr rs r" recv_intozIocpProactor.recv_intos   &&&  #D ) ) #$ .. 4t{{}}c59999 s333 # # #<<?? " " " #   ~~b$ 444rc2||tjt} ||||n%#t $r|dcYSwxYwd}||||S)Nr#Nc |S#t$rN}|jtjkrYd}~dS|jtjtjfvrt|jd}~wwxYw)Nr rr6rhrfERROR_PORT_UNREACHABLErrrrrs r"rz*IocpProactor.recvfrom..finish_recvs ||~~%   <;#EEE$99999.finish_recvs ||~~%   <;#EEE"77777.finish_send.rr)rrfrr WSASendTorr )rrrrrr r*s r"sendtozIocpProactor.sendto(sm   &&&  #D ) ) T[[]]C555   ~~b$ 444r#cj||tjt}t |t jr*||||n(|||d}| |||S)Nc |S#t$r3}|jtjtjfvrt |jd}~wwxYwrArrs r"r*z&IocpProactor.send..finish_sendBrr) rrfrrr r WSASendr WriteFiler )rrrrr r*s r"sendzIocpProactor.send:s   &&&  #D ) ) dFM * * - JJt{{}}c5 1 1 1 1 LL , , ,   ~~b$ 444r#c||jtjt }|fd}d}|||}||}tj ||j |S)NcJ|tjd}t jtj|   fS)Nz@P) rstructpackr setsockoptr  SOL_SOCKETrfSO_UPDATE_ACCEPT_CONTEXT settimeout gettimeout getpeername)rrr rrlisteners r" finish_acceptz*IocpProactor.accept..finish_acceptTs LLNNN+dHOO$5$566C OOF-'@# G G G OOH//11 2 2 2))+++ +r#clK |d{VdS#tj$r|wxYwrA)rrr)r3rs r" accept_coroz(IocpProactor.accept..accept_coro]sN  ,     s%3r) r_get_accept_socketfamilyrfrrAcceptExrr r ensure_futurer7)rr<r r=r?r3corors ` @r"acceptzIocpProactor.acceptNs   ***&&x77  #D ) ) HOO%%t{{}}555 , , , , , ,   Hm<<{64(( Dtz2222 r#cjtjkrWtj||j}|d|S|  tj j nL#t$r?}|j tjkrddkrYd}~nd}~wwxYwtjt$}||fd}|||S)Nrrc|tjtjdSrW)rr6r r7rfSO_UPDATE_CONNECT_CONTEXT)rrr rs r"finish_connectz,IocpProactor.connect..finish_connects; LLNNN OOF-'A1 F F FKr#)typer  SOCK_DGRAMrf WSAConnectrr7rrEr BindLocalrAr6rherrno WSAEINVAL getsocknamerr ConnectExr )rrr+rber rIs ` r"connectzIocpProactor.connectjsS 9) ) )  "4;;==' : : :***,,C NN4 J   &&&   !$++-- = = = =   zU_,,!!!$))*))))    #D ) ) T[[]]G,,,     ~~b$777s,B11 C:;5C55C:c N||tjt}|dz}|dz dz}||t j||||ddd}||||S)Nl rc |S#t$r3}|jtjtjfvrt |jd}~wwxYwrArrs r"finish_sendfilez.IocpProactor.sendfile..finish_sendfilerr) rrfrr TransmitFilermsvcrt get_osfhandler ) rsockfileoffsetcountr offset_low offset_highrWs r"sendfilezIocpProactor.sendfiles   &&&  #D ) )k) |{2   ,T[[]];;"Kq! % % %    ~~b$888r#c|tjt}|}|r|Sfd}|||S)Nc0|SrA)r)rrr rs r"finish_accept_pipez4IocpProactor.accept_pipe..finish_accept_pipes LLNNNKr#)rrfrrConnectNamedPiperrr )rrr connectedrds ` r"rzIocpProactor.accept_pipes   &&&  #D ) )'' 66  &<<%% %     ~~b$(:;;;r#c*Kt} tj|}n`#t$r }|jtjkrYd}~nd}~wwxYwt |dzt}tj |d{Vvtj |S)NT) CONNECT_PIPE_INIT_DELAYrf ConnectPiper6rhERROR_PIPE_BUSYminCONNECT_PIPE_MAX_DELAYr sleepr r)rr+delayrTr9s r"rzIocpProactor.connect_pipes' % $099   <;#>>>?>>>>   #9::E+e$$ $ $ $ $ $ $ $ %'///s! A AA c0|||dS)zWait for a handle. Return a Future object. The result of the future is True if the wait completed, or False if the wait did not complete (on timeout). F)_wait_for_handle)rrTrs r"wait_for_handlezIocpProactor.wait_for_handles $$VWe<<.finish_wait_for_handles7799 r#r)rrXINFINITEmathceilrfrrRegisterWaitWithQueuerr+rpr7ryrr) rrTr _is_cancelmsr rUrxrs @r"rqzIocpProactor._wait_for_handles  ?!BB7S=))B #D ) )!7 DJ B00  3!"fk KKKAA!"fk4'+z333A  (#B'     $%b!-C"D BJr#c||jvrJ|j|tj||jdddSdSrW)rSrrfrrrrobjs r"rz IocpProactor._register_with_iocpsX d& & &    % % %  .szz||TZA N N N N N ' &r#cL|t||j}|jr|jd=|jsP |dd|}||n,#t $r}||Yd}~nd}~wwxYw||||f|j|j <|Sr) rrr7rr%rEr6rBrr+)rr rcallbackrrrRs r"r zIocpProactor._registers  btz 2 2 2  (#B'z $  $ tR00 U#### # # #"""""""" #$%b#x"8 BJs A%% B/B  Bcb||j|dS)a Unregister an overlapped object. Call this method when its future has been cancelled. The event can already be signalled (pending in the proactor event queue). It is also safe if the event is never signalled (because it was cancelled). N)rrr`)rr s r"rzIocpProactor._unregisters3  !!"%%%%%r#cXtj|}|d|SrW)r r9)rrAss r"r@zIocpProactor._get_accept_socket's% M& ! ! Qr#c $|t}nF|dkrtdtj|dz}|tkrtd t j|j|}|n]d}|\}}}} |j|\}} } } nq#t$rd|j r$|j dd||||fzd|dtj fvrtj|YwxYw| |jvr|n|s | ||| } || |j|nF#t,$r9} || |j|Yd} ~ nd} ~ wwxYwd}n#d}wxYw{|jD]"} |j| jd#|jdS) Nrznegative timeoutrvztimeout too bigTz8GetQueuedCompletionStatus() returned an unexpected eventz)err=%s transferred=%s key=%#x address=%#x)r1status)ry ValueErrorrzr{rfGetQueuedCompletionStatusrrpopKeyErrorr7 get_debugr8rrXrrr5donerErr`r6rBrr+r)rrr~rerr transferredrr+rr rrrrRs r"r\zIocpProactor._poll,sy ?BB q[[/00 07S=))BX~~ !2333&  :4:rJJF~B-3 *Cc7 '+{w'?'?$2sHH   :''))J55%7#N&);W%E$F77q+"BCCC',,, d+++ VVXX  $H[#r::E LL'''M((++++ ,,,OOA&&&M((++++++++,AAAHHHHM& R$ . .B KOOBJ - - - -   """""sC:BA+DD> E; 0G; F>/F94G9F>>GGc:|j|dSrA)rrrs r" _stop_servingzIocpProactor._stop_servinges! !!#&&&&&r#c|jdSt|jD]\}}}}|rt |t r2 |H#t$rB}|j 1d||d}|j r |j |d<|j |Yd}~d}~wwxYwd}tj }||z} |jrs| tj kr@tjd|tj |z tj |z} |||jsg|_t%j|jd|_dS)NzCancelling a future failedr0r4g?z,%r is running after closing for %.1f seconds)rlistrvalues cancelledr rpr5r6r7rr8time monotonicr debugr\rrXr) rrbr rrr9r: msg_update start_timenext_msgs r"rzIocpProactor.closeks :  F'+4;+=+=+?+?&@&@ C C "CS(}} CC!233 C CJJLLLL C C Cz-'C),&)## 0P:=:OG$67 99'BBB C ^%%  *k #4>++++ K!4>#3#3j#@BBB>++j8 JJz " " "k # DJ''' s#A88 C8B??Cc.|dSrA)rr[s r"rzIocpProactor.__del__s r#rA)rr$)!rHrIrJrKryrrrrrrrrr!r'r,r1rErSrarrrrrrqrr rr@r\rrrrr#r"rrs--#+2222999EEE     5555.5555.55550555505555$5555(8888>999*<<<"000&====   DOOO@&&& 7#7#7#7#r''' ---^r#rceZdZdZdS)rc tj|f|||||d|_fd}jjt jj} | |dS)N)rrrrrcdj}|dSrA)_procpoll_process_exited)r returncoders r"rz4_WindowsSubprocessTransport._start..callbacks.**J   , , , , ,r#) r Popenrr7r{rrintrQr) rrrrrrrrrrs ` r"_startz"_WindowsSubprocessTransport._starts"( 'U6&''%''  - - - - - J 0 0TZ5G1H1H I I H%%%%%r#N)rHrIrJrrr#r"rrs# & & & & &r#rceZdZeZdS)rN)rHrIrJr _loop_factoryrr#r"rr%MMMr#rceZdZeZdS)rN)rHrIrJrrrr#r"rrrr#r)2rKsysplatform ImportErrorrfrXrNrzrYr r4rrrrrrr r r r logr __all__rryERROR_CONNECTION_REFUSEDERROR_CONNECTION_ABORTEDrirmFuturerrOrpryobjectrBaseSelectorEventLooprBaseProactorEventLooprrBaseSubprocessTransportrrBaseDefaultEventLoopPolicyrrrrr#r"rsx44 <7 +l # ##  |   --------`G#G#G#G#G#GNG#G#G#T&&&&&-&&&01P1P1P1P1P-1P1P1Ph88888888v22222 E222ggggg=gggT||||||||~ & & & & &/"I & & &.&&&&&V%F&&&&&&&&V%F&&&8r#__pycache__/transports.cpython-311.opt-2.pyc000064400000023130152533123130014632 0ustar00 !A?h) dZGddZGddeZGddeZGddeeZGd d eZGd d eZGd deZdS)) BaseTransport ReadTransportWriteTransport TransportDatagramTransportSubprocessTransportc<eZdZ dZd dZd dZdZdZdZdZ dS) r_extraNc|i}||_dSNr )selfextras ?/opt/alt/python-internal/lib64/python3.11/asyncio/transports.py__init__zBaseTransport.__init__s =E c: |j||Sr )r get)r namedefaults rget_extra_infozBaseTransport.get_extra_infos1{tW---rc tr NotImplementedErrorr s r is_closingzBaseTransport.is_closings @!!rc tr rrs rclosezBaseTransport.close "!rc tr r)r protocols r set_protocolzBaseTransport.set_protocol%s !!!rc tr rrs r get_protocolzBaseTransport.get_protocol)s *!!rr ) __name__ __module__ __qualname__ __slots__rrrrr!r#rrrr s$I ....""""""""""""""rrc&eZdZ dZdZdZdZdS)rr(c tr rrs r is_readingzReadTransport.is_reading3s 8!!rc tr rrs r pause_readingzReadTransport.pause_reading7 "!rc tr rrs rresume_readingzReadTransport.resume_reading?r.rN)r$r%r&r'r+r-r0r(rrrr.sI-I"""""""""""rrcFeZdZ dZd dZdZdZdZdZdZ d Z d Z dS) rr(Nc tr rr highlows rset_write_buffer_limitsz&WriteTransport.set_write_buffer_limitsMs $"!rc tr rrs rget_write_buffer_sizez$WriteTransport.get_write_buffer_sizebs :!!rc tr rrs rget_write_buffer_limitsz&WriteTransport.get_write_buffer_limitsfs %"!rc tr r)r datas rwritezWriteTransport.writelr.rc\ d|}||dS)Nr)joinr=)r list_of_datar<s r writelineszWriteTransport.writelinests2 xx %% 4rc tr rrs r write_eofzWriteTransport.write_eof} "!rc tr rrs r can_write_eofzWriteTransport.can_write_eofs O!!rc tr rrs rabortzWriteTransport.abortrDrNN) r$r%r&r'r6r8r:r=rArCrFrHr(rrrrHs.I""""*"""""" """"""""""""""rrceZdZ dZdS)rr(N)r$r%r&r'r(rrrrs(IIIrrc"eZdZ dZddZdZdS)rr(Nc tr r)r r<addrs rsendtozDatagramTransport.sendtorrc tr rrs rrHzDatagramTransport.abortrDrr )r$r%r&r'rNrHr(rrrrs?2I"""""""""rrc6eZdZdZdZdZdZdZdZdZ dS) rr(c tr rrs rget_pidzSubprocessTransport.get_pids  !!rc tr rrs rget_returncodez"SubprocessTransport.get_returncoder.rc tr r)r fds rget_pipe_transportz&SubprocessTransport.get_pipe_transports 4!!rc tr r)r signals r send_signalzSubprocessTransport.send_signalr.rc tr rrs r terminatezSubprocessTransport.terminates "!rc tr rrs rkillzSubprocessTransport.kills "!rN) r$r%r&r'rRrTrWrZr\r^r(rrrrssI"""""""""""" " " " " " " " "rrcNeZdZ dZd fd ZdZdZdZd dZd dZ d Z xZ S) _FlowControlMixin)_loop_protocol_paused _high_water _low_waterNct|||_d|_|dS)NF)superrrarb_set_write_buffer_limits)r rloop __class__s rrz_FlowControlMixin.__init__sB  % %%'''''rc6|}||jkrdS|jspd|_ |jdS#t t f$rt$r/}|j d|||jdYd}~dSd}~wwxYwdS)NTzprotocol.pause_writing() failedmessage exception transportr ) r8rcrb _protocol pause_writing SystemExitKeyboardInterrupt BaseExceptionracall_exception_handler)r sizeexcs r_maybe_pause_protocolz'_FlowControlMixin._maybe_pause_protocols))++ 4# # # F$ $(D ! ,,..... 12        11@!$!% $ 33   sA B'$BBc2|jr||jkrrd|_ |jdS#t t f$rt$r/}|j d|||jdYd}~dSd}~wwxYwdSdS)NFz protocol.resume_writing() failedrk) rbr8rdroresume_writingrqrrrsrart)r rvs r_maybe_resume_protocolz(_FlowControlMixin._maybe_resume_protocol's  ! **,,??$)D ! --///// 12        11A!$!% $ 33   ??sAB#$B  Bc|j|jfSr )rdrcrs rr:z)_FlowControlMixin.get_write_buffer_limits7s!122rc| |d}nd|z}||dz}||cxkrdksntd|d|d||_||_dS)Nizhigh (z) must be >= low (z) must be >= 0) ValueErrorrcrdr3s rrgz*_FlowControlMixin._set_write_buffer_limits:s <{ 3w ;!)CsaHHH3HHHJJ J rc\||||dS)N)r4r5)rgrwr3s rr6z)_FlowControlMixin.set_write_buffer_limitsJs3 %%4S%999 ""$$$$$rctr rrs rr8z'_FlowControlMixin.get_write_buffer_sizeNs!!rrI) r$r%r&r'rrwrzr:rgr6r8 __classcell__)ris@rr`r`s KI(((((($ 333 %%%%"""""""rr`N)__all__rrrrrrr`r(rrrsT  """"""""""""""""J"""""M"""4I"I"I"I"I"]I"I"I"X ~0""""" """23"3"3"3"3"-3"3"3"lT"T"T"T"T" T"T"T"T"T"r__pycache__/__init__.cpython-311.opt-2.pyc000064400000002435152533123130014157 0ustar00 !A?h ddlZddlTddlTddlTddlTddlTddlTddlTddlTddl Tddl Tddl Tddl Tddl TddlTddlTddlTejejzejzejzejzejzejzejze jze jze jze jzejzejzejzZejdkrddlTeejz ZdSddlTeejz ZdS)N)*win32)sys base_events coroutinesevents exceptionsfutureslocks protocolsrunnersqueuesstreams subprocesstasks taskgroupstimeoutsthreads transports__all__platformwindows_events unix_events=/opt/alt/python-internal/lib64/python3.11/asyncio/__init__.pyrs-       >     ?   =       ?  >  ?     =  ?        <7!!!! ~%%GGG {""GGGr__pycache__/threads.cpython-311.opt-2.pyc000064400000001527152533123130014053 0ustar00 !A?h. ddlZddlZddlmZdZdZdS)N)events) to_threadcK tj}tj}t j|j|g|Ri|}|d|d{VS)N)rget_running_loop contextvars copy_context functoolspartialrunrun_in_executor)funcargskwargsloopctx func_calls rsR<  7 7 7 7 7r__pycache__/sslproto.cpython-311.opt-2.pyc000064400000115145152533123130014310 0ustar00 !A?h{PddlZddlZddlZ ddlZn #e$rdZYnwxYwddlmZddlmZddlmZddlm Z ddl m Z eej ej fZGdd ejZGd d ejZd Zd ZGdde je jZGddejZdS)N) constants) exceptions) protocols) transports)loggerc"eZdZdZdZdZdZdZdS)SSLProtocolState UNWRAPPED DO_HANDSHAKEWRAPPEDFLUSHINGSHUTDOWNN)__name__ __module__ __qualname__r r r rr=/opt/alt/python-internal/lib64/python3.11/asyncio/sslproto.pyr r s'I!LGHHHHrr ceZdZdZdZdZdZdS)AppProtocolState STATE_INITSTATE_CON_MADE STATE_EOFSTATE_CON_LOSTN)rrrrrrrrrrrrs$J%NI%NNNrrc`|rtdtj}|sd|_|S)Nz(Server side SSL needs a valid SSLContextF) ValueErrorsslcreate_default_contextcheck_hostname) server_sideserver_hostname sslcontexts r_create_transport_contextr$/s@ECDDD +--J *$) ! rc|||dz}n |}d|z}n|}||dz}n|}||cxkrdksntd|d|d||fS)Nirzhigh (z) must be >= low (z) must be >= 0)r)highlowkbhilos radd_flowcontrol_defaultsr,=s | ;dBBBRBB  { 1W  ====q====j""bbb"## # r6MrceZdZdZejjZdZddZ dZ dZ dZ dZ efd Zd Zd Zd Zdd ZdZdZddZdZdZedZdZdZdZdZdZdZ dZ!dS)_SSLProtocolTransportTc0||_||_d|_dSNF)_loop _ssl_protocol_closed)selfloop ssl_protocols r__init__z_SSLProtocolTransport.__init__Xs ) rNc: |j||SN)r2_get_extra_infor4namedefaults rget_extra_infoz$_SSLProtocolTransport.get_extra_info]s1!11$@@@rc:|j|dSr9)r2_set_app_protocol)r4protocols r set_protocolz"_SSLProtocolTransport.set_protocolas ,,X66666rc|jjSr9)r2 _app_protocolr4s r get_protocolz"_SSLProtocolTransport.get_protocolds!//rc|jSr9)r3rEs r is_closingz _SSLProtocolTransport.is_closinggs |rch |js"d|_|jdSd|_dSNT)r3r2_start_shutdownrEs rclosez_SSLProtocolTransport.closejsC | &DL   . . 0 0 0 0 0!%D   rc\|js$d|_|dtdSdS)NTz9unclosed transport )r3warnResourceWarning)r4 _warningss r__del__z_SSLProtocolTransport.__del__xsE| ,DL NN* , , , , , , ,rc|jj Sr9)r2_app_reading_pausedrEs r is_readingz _SSLProtocolTransport.is_readings%999rc: |jdSr9)r2_pause_readingrEs r pause_readingz#_SSLProtocolTransport.pause_readings$ ))+++++rc: |jdSr9)r2_resume_readingrEs rresume_readingz$_SSLProtocolTransport.resume_readings$ **,,,,,rcp |j|||jdSr9)r2_set_write_buffer_limits_control_app_writingr4r'r(s rset_write_buffer_limitsz-_SSLProtocolTransport.set_write_buffer_limitss= $ 33D#>>> //11111rc2|jj|jjfSr9)r2_outgoing_low_water_outgoing_high_waterrEs rget_write_buffer_limitsz-_SSLProtocolTransport.get_write_buffer_limits"6"79 9rc6 |jSr9)r2_get_write_buffer_sizerEs rget_write_buffer_sizez+_SSLProtocolTransport.get_write_buffer_sizes;!88:::rcp |j|||jdSr9)r2_set_read_buffer_limits_control_ssl_readingr^s rset_read_buffer_limitsz,_SSLProtocolTransport.set_read_buffer_limitss= $ 224=== //11111rc2|jj|jjfSr9)r2_incoming_low_water_incoming_high_waterrEs rget_read_buffer_limitsz,_SSLProtocolTransport.get_read_buffer_limitsrdrc6 |jSr9)r2_get_read_buffer_sizerEs rget_read_buffer_sizez*_SSLProtocolTransport.get_read_buffer_sizes9!77999rc|jjSr9)r2_app_writing_pausedrEs r_protocol_pausedz&_SSLProtocolTransport._protocol_pauseds!55rc t|tttfs$t dt |j|sdS|j|fdS)Nz+data: expecting a bytes-like instance, got ) isinstancebytes bytearray memoryview TypeErrortyperr2_write_appdatar4datas rwritez_SSLProtocolTransport.writes{ $ : >?? :9#'::#699:: :  F ))4'22222rc< |j|dSr9)r2r})r4 list_of_datas r writelinesz _SSLProtocolTransport.writeliness& )),77777rc tr9)NotImplementedErrorrEs r write_eofz_SSLProtocolTransport.write_eofs "!rc dSr0rrEs r can_write_eofz#_SSLProtocolTransport.can_write_eofs Ourc2 |ddSr9) _force_closerEs rabortz_SSLProtocolTransport.aborts# $rcZd|_|j|j|dSdSrJ)r3r2_abortr4excs rrz"_SSLProtocolTransport._force_closes7   )   % %c * * * * * * )rc|jj||jxjt |z c_dSr9)r2_write_backlogappend_write_buffer_sizelenr~s r_test__append_write_backlogz1_SSLProtocolTransport._test__append_write_backlogs? )00666 --T:----rr9NN)"rrr_start_tls_compatibler _SendfileModeFALLBACK_sendfile_compatibler7r>rBrFrHrLwarningsrQrTrWrZr_rcrgrkrorrpropertyrurrrrrrrrrrr.r.Rs!$2; AAAA777000 & & &!),,,,:::,,,---2222,999;;;2222,999:::66X6 3 3 3888"""   +++ ;;;;;rr.ceZdZdZdZdZdZ d-dZdZd.dZ dZ d Z d Z d Z d Zd Zd.dZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZ dZ!d Z"d!Z#d"Z$d/d#Z%d$Z&d%Z'd&Z(d/d'Z)d(Z*d)Z+d*Z,d0d,Z-dS)1 SSLProtocoliNFTc ttdt|j|_t |j|_| tj}n|dkrtd|| tj } n| dkrtd| |st||}||_ |r |s||_ nd|_ ||_t||_t#j|_d|_||_||_||d|_d|_d|_||_| |_tj|_tj|_t@j!|_"d|_#|rtHj%|_&ntHj'|_&|j(|j|j|j |j |_)d|_*d|_+d|_,d|_-d|_.|/d|_0d|_1d|_2d|_3|4|5dS)Nzstdlib ssl module not availablerz7ssl_handshake_timeout should be a positive number, got z6ssl_shutdown_timeout should be a positive number, got )r#F)r!r")6r RuntimeErrorrymax_size _ssl_bufferrz_ssl_buffer_viewrSSL_HANDSHAKE_TIMEOUTrSSL_SHUTDOWN_TIMEOUTr$ _server_side_server_hostname _sslcontextdict_extra collectionsdequerr_waiterr1r@_app_transport_app_transport_created _transport_ssl_handshake_timeout_ssl_shutdown_timeout MemoryBIO _incoming _outgoingr r _state _conn_lostrr _app_staterwrap_bio_sslobj_ssl_writing_pausedrS_ssl_reading_pausedrnrmri _eof_receivedrtrbrar\_get_app_transport) r4r5 app_protocolr#waiterr!r"call_connection_madessl_handshake_timeoutssl_shutdown_timeouts rr7zSSLProtocol.__init__s ;@AA A$T]33 *4+; < < ($-$C ! ! "a ' '/,//00 0 '#,#A !Q & &.+..// / .2_..J(  ); )$3D ! !$(D !%j111 */11"#   |,,,"&+#&;#%9"&0   >.9DOO.=DO'00 NDN) 1133 $) #( #( $%!#$  $$&&&"#( $%!#$  %%''' !!!!!rc||_t|dr;t|tjr!|j|_|j|_d|_ dSd|_ dS)N get_bufferTF) rDhasattrrwrBufferedProtocolr_app_protocol_get_bufferbuffer_updated_app_protocol_buffer_updated_app_protocol_is_buffer)r4rs rr@zSSLProtocol._set_app_protocolasc) L, / / 1<)CDD 1,8,CD )0<0KD -+/D ( ( (+0D ( ( (rc|jdS|js7||j|n|jdd|_dSr9)r cancelled set_exception set_resultrs r_wakeup_waiterzSSLProtocol._wakeup_waiterlsd <  F|%%'' . **3//// ''--- rc|j7|jrtdt|j||_d|_|jS)Nz$Creating _SSLProtocolTransport twiceT)rrrr.r1rEs rrzSSLProtocol._get_app_transportvsK   &* K"#IJJJ"7 D"I"ID *.D '""rc> ||_|dSr9)r_start_handshake)r4 transports rconnection_madezSSLProtocol.connection_made~s( $ rc |j|j|xjdz c_|j d|j_|jtj kr`|j tj ks|j tj kr6tj|_ |j|jj||tjd|_d|_d|_|||jr |jd|_|jr"|jd|_dSdS)NrT)rclearrreadrrr3rr r rrrrrr1 call_soonrDconnection_lost _set_stater rr_shutdown_timeout_handlecancel_handshake_timeout_handlers rrzSSLProtocol.connection_lostsT !!###  1   **.D  ' ;*7 7 7#3#BBB#3#==="2"A $$T%7%GMMM (2333"! C    ( 1  ) 0 0 2 2 2,0D )  ) 2  * 1 1 3 3 3-1D * * * 2 2rc|}|dks ||jkr|j}t|j|kr-t||_t |j|_|jSNr)rrrryrzr)r4nwants rrzSSLProtocol.get_buffersc 199t},,=D t 4 ' '(D $.t/?$@$@D !$$rc|j|jd||jtjkr|dS|jtjkr|dS|jtj kr| dS|jtj kr| dSdSr9) rrrrr r _do_handshaker _do_readr _do_flushr _do_shutdown)r4nbytess rrzSSLProtocol.buffer_updateds T27F7;<<< ;*7 7 7    [,4 4 4 MMOOOOO [,5 5 5 NN      [,5 5 5        6 5rc d|_ |jrtjd||jt jkr|tdS|jt j kr>| t j |j rdS|dS|jt j krI|| t j|dS|jt jkr|dSdS#t$$r|jwxYw)NTz%r received EOF)rr1 get_debugrdebugrr r _on_handshake_completeConnectionResetErrorr rrrSr _do_writerr ExceptionrrLrEs r eof_receivedzSSLProtocol.eof_receivedsl " z##%% 6 .555{.;;;++,@AAAAA 0 888 0 9:::+%4NN$$$$$ 0 999    0 9:::!!##### 0 999!!#####:9    O ! ! # # #  s%AE);E&Er;s rr:zSSLProtocol._get_extra_infosA 4;  ;t$ $ _ (?11$@@ @Nrcd}|tjkrd}n|jtjkr|tjkrd}nw|jtjkr|tjkrd}nO|jtjkr|tjkrd}n'|jtjkr|tjkrd}|r ||_dStd|j|)NFTz!cannot switch state from {} to {}) r r rr r rrrformat)r4 new_statealloweds rrzSSLProtocol._set_states (2 2 2GG K+5 5 5 )6 6 6GG K+8 8 8 )1 1 1GG K+3 3 3 )2 2 2GG K+4 4 4 )2 2 2G  -#DKKK3::K,,-- -rcfjr4tjdj_nd_tjj j fd_ dS)Nz%r starts SSL handshakec,Sr9)_check_handshake_timeoutrEsrz.SSLProtocol._start_handshake..!s$*G*G*I*Ir) r1rrrtime_handshake_start_timerr r call_laterrrrrEs`rrzSSLProtocol._start_handshakes :   ! ! . L2D 9 9 9)-):):D & &)-D & (5666 J ! !$"="I"I"I"I K K & rc|jtjkr/d|jd}|t |dSdS)Nz$SSL handshake is taking longer than z! seconds: aborting the connection)rr r r _fatal_errorConnectionAbortedError)r4msgs rrz$SSLProtocol._check_handshake_timeout%s_ ;*7 7 7+.+++    4S99 : : : : : 8 7rc |j|ddS#t$r|YdSt j$r }||Yd}~dSd}~wwxYwr9)r do_handshakerSSLAgainErrors_process_outgoingrSSLErrorrs rrzSSLProtocol._do_handshake.s . L % % ' ' '  ' ' - - - - -  % % %  " " $ $ $ $ $ $| - - -  ' ' , , , , , , , , , -s2BB!A<<Bc|j |jd|_|j} | |tjn||}n#t$rv}d}|tjt|tj rd}nd}| ||| |Yd}~dSd}~wwxYw|jr:|j|jz }t%jd||dz|j|||||jt2jkr=t2j|_|j|| |dS)Nz1SSL handshake failed on verifying the certificatezSSL handshake failedz%r: SSL handshake took %.1f msg@@)peercertcipher compression ssl_object) rrrrr r getpeercertrr rwrCertificateErrorrrr1rrrrrrupdaterr rrrrrDrrr)r4 handshake_excsslobjrrrdts rrz"SSLProtocol._on_handshake_complete8s  ) 5  * 1 1 3 3 3-1D * $ 0 89999##))++HH    M OO,6 7 7 7#s344 -I,   c3 ' ' '    $ $ $ FFFFF  :   ! ! K""T%??B L94c J J J H"(--//'-'9'9';';&,  . . . ?.9 9 9.=DO   . .t/F/F/H/H I I I  s8A)) C)3A+C$$C)cjtjtjtjfvrdSj dj_jtjkrddS tjj j fd_ dS)NTc,Sr9)_check_shutdown_timeoutrEsrrz-SSLProtocol._start_shutdown..rs4466r)rr rrr rr3r rrr1rrrrrEs`rrKzSSLProtocol._start_shutdownas K ) ) *   F   **.D  ' ;*7 7 7 KK      OO,5 6 6 6,0J,A,A*6666--D ) NN     rc|jtjtjfvr.|jt jddSdS)NzSSL shutdown timed out)rr rrrrr TimeoutErrorrEs rrz#SSLProtocol._check_shutdown_timeoutvsf K ) )   O ( ('(@AA C C C C C   rc||tj|dSr9)rrr rrrEs rrzSSLProtocol._do_flushs=  (1222 rcf |js|j|||ddS#t $r|YdStj$r }||Yd}~dSd}~wwxYwr9) rrunwrapr_call_eof_received_on_shutdown_completerrrrs rrzSSLProtocol._do_shutdowns -% & ##%%%  " " $ $ $  # # % % %  & &t , , , , , % % %  " " $ $ $ $ $ $| , , ,  & &s + + + + + + + + + ,s A!!B0B0B++B0c|j |jd|_|r||dS|j|jjdSr9)rrrr1rrrL)r4 shutdown_excs rrz!SSLProtocol._on_shutdown_completesk  ( 4  ) 0 0 2 2 2,0D )  8   l + + + + + J !6 7 7 7 7 7rc|tj|j|j|dSdSr9)rr r rrrs rrzSSLProtocol._abortsD (2333 ? & O ( ( - - - - - ' &rc|jtjtjtjfvr;|jt jkrtj d|xjdz c_dS|D]9}|j ||xj t|z c_ : |jtjkr|dSdS#t $r!}||dYd}~dSd}~wwxYw)NzSSL connection is closedrFatal error on SSL protocol)rr rrr rr!LOG_THRESHOLD_FOR_CONNLOST_WRITESrwarningrrrrr rrr)r4rrexs rr}zSSLProtocol._write_appdatas& K ) ) *   )"MMM9::: OOq OO F  1 1D   & &t , , ,  # #s4yy 0 # # # A{.666     76 A A A   b"? @ @ @ @ @ @ @ @ @ As#)C C;C66C;c\ |jr~|jd}|j|}t|}||kr#||d|jd<|xj|zc_n|jd=|xj|zc_|j~n#t $rYnwxYw|dSr)rrrrrrr)r4rcountdata_lens rrzSSLProtocol._do_writes % 8*1- **400t998##-1%&&\D'*++u4++++A.++x7++% 8    D       sBB BBc|jsB|j}t|r|j||dSr9)rrrrrrr]r~s rrzSSLProtocol._process_outgoings\' ,>&&((D4yy ,%%d+++ !!#####rc|jtjtjfvrdS |js`|jr|n||jr| n| | dS#t$r!}| |dYd}~dSd}~wwxYw)Nr)rr r rrSr_do_read__buffered_do_read__copiedrrrrjrr)r4r"s rrzSSLProtocol._do_reads K ( )    F A+ -/,++----))+++&-NN$$$$**,,,  % % ' ' ' ' ' A A A   b"? @ @ @ @ @ @ @ @ @ AsA;B C *CC c,d}d}}t|} j||}|dkr^|}||kr9j||z ||d}|dkr||z }nn#||k9jfdn#t$rYnwxYw|dkr||s*  dSdS)Nrrc,Sr9)rrEsrrz0SSLProtocol._do_read__buffered..sr) rrqrrrr1rrrrrK)r4offsetr$bufwantss` rr(zSSLProtocol._do_read__bufferedsK++D,F,F,H,HIIC L%%eS11Eqyyunn L--efnc&''lKKEqyy% unnJ(()@)@)@)@AAA    D  A::  - -f 5 5 5 #  # # % % %  " " " " " # #sA?B== C  C cd}d}d} |j|j}|sn(|rd}d}|}n|rd}||g}n||Jn#t$rYnwxYw|r|j|n/|s-|jd||s*|| dSdS)N1TFr) rrrrrrD data_receivedjoinrrK)r4chunkzeroonefirstrs rr)zSSLProtocol._do_read__copieds3  ' ))$-88' DC!EE'C!5>DDKK&&& '    D   =   , ,U 3 3 3 3 =   , ,SXXd^^ < < < #  # # % % %  " " " " " # #sA A A! A!c8 |jtjkrBtj|_|j}|rt jddSdSdS#ttf$rt$r!}| |dYd}~dSd}~wwxYw)Nz?returning true from eof_received() has no effect when using sslzError calling eof_received()) rrrrrDrrr!KeyboardInterrupt SystemExit BaseExceptionr)r4 keep_openr"s rrzSSLProtocol._call_eof_received%s B"2"AAA"2"< .;;== CN$BCCCCC BACC":.     B B B   b"@ A A A A A A A A A BsAAB8BBc:|}||jkrw|jspd|_ |jdS#t t f$rt$r/}|j d||j |dYd}~dSd}~wwxYw||j krw|jrrd|_ |j dS#t t f$rt$r/}|j d||j |dYd}~dSd}~wwxYwdSdS)NTzprotocol.pause_writing() failedmessage exceptionrrAFz protocol.resume_writing() failed) rfrbrtrD pause_writingr8r9r:r1call_exception_handlerrraresume_writing)r4sizers rr]z SSLProtocol._control_app_writing4s**,, 4, , ,T5M ,'+D $ "0022222%z2        11@!$!%!4 $ 33 T- - -$2J -',D $ "1133333%z2        11A!$!%!4 $ 33  . - - -s/A B%$BB1C D'$DDc*|jj|jzSr9)rpendingrrEs rrfz"SSLProtocol._get_write_buffer_sizeQs~%(???rc^t||tj\}}||_||_dSr9)r,r!FLOW_CONTROL_HIGH_WATER_SSL_WRITErbrar^s rr\z$SSLProtocol._set_write_buffer_limitsTs7, #yBDD c$(!#&   rcd|_dSrJ)rSrEs rrVzSSLProtocol._pause_reading\s#'   rcfjr(d_fd}j|dSdS)NFc jtjkrdSjtjkrdSjtjkrdSdSr9)rr r rrrrrrEsrresumez+SSLProtocol._resume_reading..resumecs};"2":::MMOOOOO[$4$===NN$$$$$[$4$===%%'''''>=r)rSr1r)r4rKs` rrYzSSLProtocol._resume_reading_sW  # )',D $ ( ( ( ( ( J  ( ( ( ( ( ) )rc|}||jkr)|js"d|_|jdS||jkr)|jr$d|_|jdSdSdS)NTF)rqrnrrrWrmrZ)r4rCs rrjz SSLProtocol._control_ssl_readingns))++ 4, , ,T5M ,'+D $ O ) ) + + + + + T- - -$2J -',D $ O * * , , , , ,. - - -rc^t||tj\}}||_||_dSr9)r,r FLOW_CONTROL_HIGH_WATER_SSL_READrnrmr^s rriz#SSLProtocol._set_read_buffer_limitsws7, #yACC c$(!#&   rc|jjSr9)rrErEs rrqz!SSLProtocol._get_read_buffer_size}s ~%%rc d|_dSrJ)rrEs rr@zSSLProtocol.pause_writings $(   rc> d|_|dSr0)rrrEs rrBzSSLProtocol.resume_writings) $)       rFatal error on transportc\|jr|j|t|tr5|jrt jd||ddSdSt|tj s&|j |||j|ddSdS)Nz%r: %sT)exc_infor=) rrrwOSErrorr1rrrrCancelledErrorrA)r4rr>s rrzSSLProtocol._fatal_errors ? . O ( ( - - - c7 # # z##%% E XtWtDDDDDD E EC!:;;  J - -" !_ //       r)FNTNNr9r)rR).rrrrrrrr7r@rrrrrrrr:rrrrrrKrrrrrr}rrrr(r)rr]rfr\rVrYrjrirqr@rBrrrrrrsH  $#59&*'+&* Q"Q"Q"Q"f 1 1 1###   "2"2"2H%%%    !!!F$-$-$-P ;;;...%%%R*CCC - - -888...AAA0!!! $$$AAA,###:###< B B B:@@@''''((( ) ) )---'''' &&& (((!!!      rr)renumrr ImportErrorrrrrlogrSSLWantReadErrorSSLSyscallErrorrEnumr rr$r,_FlowControlMixin Transportr.rrrrrr`s  JJJJ CCC?*C,?@Nty & & & & &ty & & &   *r;r;r;r;r;J8&0r;r;r;jW W W W W ),W W W W W s __pycache__/windows_utils.cpython-311.opt-2.pyc000064400000015770152533123130015340 0ustar00 !A?h ddlZejdkr edddlZddlZddlZddlZddlZddlZddl Z dZ dZ ej Z ej Z ejZdde dd ZGd d ZGd d ejZdS)Nwin32z win32 only)pipePopenPIPE PipeHandlei F)TT)duplex overlappedbufsizec T tjdtjt t }|r*tj}tj tj z}||}}ntj }tj }d|}}|tj z}|dr|tj z}|dr tj }nd}dx} } tj||tjd||tjtj} tj||dtjtj|tj} tj| d} | d| | fS#| tj| | tj| xYw)Nz\\.\pipe\python-pipe-{:d}-{:d}-)prefixrTr )tempfilemktempformatosgetpidnext _mmap_counter_winapiPIPE_ACCESS_DUPLEX GENERIC_READ GENERIC_WRITEPIPE_ACCESS_INBOUNDFILE_FLAG_FIRST_PIPE_INSTANCEFILE_FLAG_OVERLAPPEDCreateNamedPipe PIPE_WAITNMPWAIT_WAIT_FOREVERNULL CreateFile OPEN_EXISTINGConnectNamedPipeGetOverlappedResult CloseHandle) rr r addressopenmodeaccessobsizeibsizeflags_and_attribsh1h2ovs B/opt/alt/python-internal/lib64/python3.11/asyncio/windows_utils.pyrr sOo188 IKKm,,..///G$-%(== '.&G 55H!}1G00!}#8NB  $ Xw0 vvw;W\KK  VQ g.C w|-- %bT : : : t$$$2v  >   # # # >   # # # s BE88/F'cneZdZ dZdZedZdZej ddZ e j fdZ dZd Zd S) rc||_dSN_handleselfhandles r/__init__zPipeHandle.__init__Vs  cP|j d|j}nd}d|jjd|dS)Nzhandle=closed< >)r4 __class____name__r5s r/__repr__zPipeHandle.__repr__Ys> < #/t|//FFF64>*66V6666r9c|jSr2r3r6s r/r7zPipeHandle.handle`s |r9c<|jtd|jS)NzI/O operation on closed pipe)r4 ValueErrorrCs r/filenozPipeHandle.filenods! < ;<< <|r9)r%cF|j||jd|_dSdSr2r3)r6r%s r/closezPipeHandle.closeis/ < # K % % %DLLL $ #r9cl|j,|d|t||dSdS)Nz unclosed )source)r4ResourceWarningrH)r6_warns r/__del__zPipeHandle.__del__nsC < # E&d&& E E E E JJLLLLL $ #r9c|Sr2rCs r/ __enter__zPipeHandle.__enter__ss r9c.|dSr2)rH)r6tvtbs r/__exit__zPipeHandle.__exit__vs r9N)r@ __module__ __qualname__r8rApropertyr7rFrr%rHwarningswarnrMrPrUrOr9r/rrQs777X $+#6     %M r9rc"eZdZ dfd ZxZS)rNc &dx}x}}dx} x} } |tkr4tdd\} } tj| tj}n|}|tkr)td\} } tj| d}n|}|tkr)td\} }tj|d}n|t kr|}n|} tj|f|||d|| t| |_ | t| |_ | t| |_ n$#| | | fD]}|tj|xYw|tkrt j||tkrt j||tkrt j|dSdS#|tkrt j||tkrt j||tkrt j|wwxYw)N)FTT)r r)TFrr)stdinstdoutstderr)rrmsvcrtopen_osfhandlerO_RDONLYSTDOUTsuperr8rr]r^r_rr%rH)r6argsr]r^r_kwds stdin_rfd stdout_wfd stderr_wfdstdin_wh stdout_rh stderr_rhstdin_rh stdout_wh stderr_whhr?s r/r8zPopen.__init__sG/32 2J+///9y D==!%t!L!L!L Hh-h DDIII T>>#'=#A#A#A Iy.y!<>#'=#A#A#A Iy.y!<rzs"/ <7 +l # ##  0    !! \7+++++b&&&&&&&&X0%0%0%0%0%J 0%0%0%0%0%r9__pycache__/selector_events.cpython-311.opt-1.pyc000064400000175204152533123130015630 0ustar00 !A?hXndZdZddlZddlZddlZddlZddlZddlZddlZ ddl Z n #e $rdZ YnwxYwddl m Z ddl m Z ddl mZddl mZdd l mZdd l mZdd l mZdd l mZdd lmZdZGdde jZGddejejZGddeZGddeZdS)zEvent loop using a selector and related classes. A selector is a "notify-when-ready" multiplexer. For a subclass which also includes support for signal handling, see the unix_events sub-module. )BaseSelectorEventLoopN) base_events) constants)events)futures) protocols)sslproto) transports)trsock)loggerc~ ||}t|j|zS#t$rYdSwxYwNF)get_keyboolrKeyError)selectorfdeventkeys D/opt/alt/python-internal/lib64/python3.11/asyncio/selector_events.py_test_selector_eventr sU(r""CJ&''' uus . <<ceZdZdZd4fd Zd4ddddZ d4ddddejejddZ d5d Z fd Z d Z d Z d ZdZdZdddejejfdZdddejejfdZddejejfdZdZdZdZdZdZdZdZdZdZdZd4dZdZd Z d!Z!d"Z"d#Z#d6d%Z$d&Z%d'Z&d(Z'd)Z(d*Z)d+Z*d,Z+d4d-Z,d.Z-d/Z.d0Z/d1Z0d2Z1d3Z2xZ3S)7rzJSelector event loop. See events.EventLoop for API specification. Nct|tj}t jd|jj||_| tj |_ dS)NzUsing selector: %s) super__init__ selectorsDefaultSelectorr debug __class____name__ _selector_make_self_pipeweakrefWeakValueDictionary _transports)selfrr s rrzBaseSelectorEventLoop.__init__1sv    022H )8+=+FGGG! "688extraserverc*t||||||SN)_SelectorSocketTransport)r'sockprotocolwaiterr*r+s r_make_socket_transportz,BaseSelectorEventLoop._make_socket_transport;s!'dHf(-v77 7r(F) server_sideserver_hostnamer*r+ssl_handshake_timeoutssl_shutdown_timeoutc ptj||||||| | } t||| ||| jS)N)r5r6r))r SSLProtocolr._app_transport) r'rawsockr0 sslcontextr1r3r4r*r+r5r6 ssl_protocols r_make_ssl_transportz)BaseSelectorEventLoop._make_ssl_transport@s\ + (J "7!5    !w ',V = = = =**r(c*t||||||Sr-)_SelectorDatagramTransport)r'r/r0addressr1r*s r_make_datagram_transportz.BaseSelectorEventLoop._make_datagram_transportQs$)$h*165BB Br(c4|rtd|rdS|t |j"|jd|_dSdS)Nz!Cannot close a running event loop) is_running RuntimeError is_closed_close_self_pipercloser")r'r s rrGzBaseSelectorEventLoop.closeVs ??   DBCC C >>    F    > % N " " "!DNNN & %r(c||j|jd|_|jd|_|xjdzc_dS)Nr)_remove_reader_ssockfilenorG_csock _internal_fdsr's rrFz&BaseSelectorEventLoop._close_self_pipeast DK..00111     ar(c2tj\|_|_|jd|jd|xjdz c_||j|jdS)NFr) socket socketpairrJrL setblockingrM _add_readerrK_read_from_selfrNs rr#z%BaseSelectorEventLoop._make_self_pipeis#)#4#6#6  T[ &&& &&& a ++--t/CDDDDDr(cdSr-r'datas r_process_self_dataz(BaseSelectorEventLoop._process_self_dataqs r(c |jd}|sdS||n#t$rYBt$rYdSwxYwR)NTi)rJrecvrYInterruptedErrorBlockingIOErrorrWs rrTz%BaseSelectorEventLoop._read_from_selfts  {''--E''----#   "     s77 A AAc|j}|dS |ddS#t$r$|jrt jddYdSYdSwxYw)Nz3Fail to write a null byte into the self-pipe socketTexc_info)rLsendOSError_debugr r)r'csocks r_write_to_selfz$BaseSelectorEventLoop._write_to_selfs   = F , JJu      , , ,{ , 0&*,,,,,,, , , , ,s$'AAdc n|||j||||||| dSr-)rSrK_accept_connection)r'protocol_factoryr/r;r+backlogr5r6s r_start_servingz$BaseSelectorEventLoop._start_servingsK (?)4VW.0D F F F F Fr(c t|D]h} |\} } |jrtjd|| | | dd| i} ||| | ||||} || #tttf$rYdSt$r} | j tj tjtjtjfvr|d| t%j|d|||t.j|j||||||| nYd} ~ bd} ~ wwxYwdS)Nz#%r got a new connection from %r: %rFpeernamez&socket.accept() out of system resource)message exceptionrP)rangeacceptrdr rrR_accept_connection2 create_taskr]r\ConnectionAbortedErrorrcerrnoEMFILEENFILEENOBUFSENOMEMcall_exception_handlerr TransportSocketrIrK call_laterrACCEPT_RETRY_DELAYrl)r'rjr/r;r+rkr5r6_connaddrr*rrexcs rriz(BaseSelectorEventLoop._accept_connectionsw# )# )A" )![[]] d;5L!F!'t555  '''2$T*11$dE:v)+?AA  ((((9$%57MN   ttt   9u|!& !>>> //#K%("("8">">11 '' 666OOI$@$($7$4dJ$+-B$8 ::::  ::::: # )# )sA BE7. E77B5E22E7c Kd}d} |}|} |r||||| d|||| } n|||| ||} | d{VdS#t$r| d} wxYw#t t f$rt$r@} |jr.d| d} ||| d<| | | d<|| Yd} ~ dSYd} ~ dSd} ~ wwxYw)NT)r1r3r*r+r5r6)r1r*r+z3Error on transport creation for incoming connection)rorpr0 transport) create_futurer=r2 BaseExceptionrG SystemExitKeyboardInterruptrdr{) r'rjrr*r;r+r5r6r0rr1rcontexts rrsz)BaseSelectorEventLoop._accept_connection2s  & 5''))H''))F # 44(Jv $E&*?)= 5?? !77(6!8##       !!!  -.     5 5 5{ 5N!$ '*2GJ'(+4GK(++G444444444 5 5 5 5 5 5 5s*AB"A,,"BBC,,/C''C,cf|}t|tsQ t|}n.#ttt f$rt d|dwxYw |j|}|std|d|dS#t$rYdSwxYw)NzInvalid file object: zFile descriptor z is used by transport ) isinstanceintrKAttributeError TypeError ValueErrorr& is_closingrDr)r'rrKrs r_ensure_fd_no_transportz-BaseSelectorEventLoop._ensure_fd_no_transports&#&& K KV]]__--"Iz: K K K !?!?!?@@dJ K &(0I'')) &"%r%% %%&&& & &    DD s!;+A&* B"" B0/B0c|tj|||d} |j|}|j|jc}\}}|j||tjz||f|| n8#t$r+|j |tj|dfYnwxYw|Sr-) _check_closedrHandler"rrXmodifyr EVENT_READcancelrregister r'rcallbackargshandlermaskreaderwriters rrSz!BaseSelectorEventLoop._add_reader s xtT:: .((,,C &)Z "D"66 N ! !"dY-A&A#)6"2 4 4 4!  4 4 4 N # #B (<%+TN 4 4 4 4 4 4 B2CCct|rdS |j|}|j|jc}\}}|t jz}|s|j|n|j||d|f|| dSdS#t$rYdSwxYw)NFT) rEr"rrrXrr unregisterrrrr'rrrrrs rrIz$BaseSelectorEventLoop._remove_readers >>   5 .((,,C&)Z "D"66 Y)) )D @))"----%%b$v???! tu   55 B)) B76B7c|tj|||d} |j|}|j|jc}\}}|j||tjz||f|| n8#t$r+|j |tjd|fYnwxYw|Sr-) rrrr"rrXrr EVENT_WRITErrrrs r _add_writerz!BaseSelectorEventLoop._add_writer.s xtT:: .((,,C &)Z "D"66 N ! !"dY-B&B#)6"2 4 4 4!  4 4 4 N # #B (=%)6N 4 4 4 4 4 4 rct|rdS |j|}|j|jc}\}}|t jz}|s|j|n|j|||df|| dSdS#t$rYdSwxYw)Remove a writer callback.FNT) rEr"rrrXrrrrrrrs r_remove_writerz$BaseSelectorEventLoop._remove_writer>s >>   5 .((,,C&)Z "D"66 Y** *D @))"----%%b$???! tu   55 rcN|||j||g|RdS)zAdd a reader callback.N)rrSr'rrrs r add_readerz BaseSelectorEventLoop.add_readerU9 $$R(((X-------r(cV||||S)zRemove a reader callback.)rrIr'rs r remove_readerz#BaseSelectorEventLoop.remove_readerZ* $$R(((""2&&&r(cN|||j||g|RdS)zAdd a writer callback..N)rrrs r add_writerz BaseSelectorEventLoop.add_writer_rr(cV||||S)r)rrrs r remove_writerz#BaseSelectorEventLoop.remove_writerdrr(cKtj||jr'|dkrt d ||S#t tf$rYnwxYw|}| }| || ||j |||}| tj|j|||d{VS)zReceive data from the socket. The return value is a bytes object representing the data received. The maximum amount of data to be received at once is specified by nbytes. rthe socket must be non-blockingrN)r_check_ssl_socketrd gettimeoutrr[r]r\rrKrrS _sock_recvadd_done_callback functoolspartial_sock_read_done)r'r/nfutrrs r sock_recvzBaseSelectorEventLoop.sock_recvis %d+++ ; @4??,,11>?? ? 99Q<< !12    D   "" [[]] $$R(((!!"dosD!DD   d2Bv F F F H H HyyyyyyAA/.A/c`||s||dSdSr-) cancelledrr'rrrs rrz%BaseSelectorEventLoop._sock_read_done8 >!1!1!3!3>   r " " " " " >r(c*|rdS ||}||dS#ttf$rYdSt t f$rt$r }||Yd}~dSd}~wwxYwr-) doner[ set_resultr]r\rrr set_exception)r'rr/rrXrs rrz BaseSelectorEventLoop._sock_recvs 88::  F !99Q<?? ? >>#&& &!12    D   "" [[]] $$R(((!!"d&:CsKK   d2Bv F F F H H Hyyyyyyrc*|rdS ||}||dS#ttf$rYdSt t f$rt$r }||Yd}~dSd}~wwxYwr-) rrrr]r\rrrr)r'rr/rnbytesrs rrz%BaseSelectorEventLoop._sock_recv_intos 88::  F #^^C((F NN6 " " " " " !12    FF-.     # # #   c " " " " " " " " " #rcKtj||jr'|dkrt d ||S#t tf$rYnwxYw|}| }| || ||j |||}| tj|j|||d{VS)aReceive a datagram from a datagram socket. The return value is a tuple of (bytes, address) representing the datagram received and the address it came from. The maximum amount of data to be received at once is specified by nbytes. rrrN)rrrdrrrecvfromr]r\rrKrrS_sock_recvfromrrrr)r'r/bufsizerrrs r sock_recvfromz#BaseSelectorEventLoop.sock_recvfroms %d+++ ; @4??,,11>?? ? ==)) )!12    D   "" [[]] $$R(((!!"d&93gNN   d2Bv F F F H H Hyyyyyyrc*|rdS ||}||dS#ttf$rYdSt t f$rt$r }||Yd}~dSd}~wwxYwr-) rrrr]r\rrrr)r'rr/rresultrs rrz$BaseSelectorEventLoop._sock_recvfroms 88::  F #]]7++F NN6 " " " " " !12    FF-.     # # #   c " " " " " " " " " #rrc.Ktj||jr'|dkrt d|st |} |||S#ttf$rYnwxYw| }| }| || ||j ||||}|tj|j|||d{VS)zReceive data from the socket. The received data is written into *buf* (a writable buffer). The return value is a tuple of (number of bytes written, address). rrrN)rrrdrrlen recvfrom_intor]r\rrKrrS_sock_recvfrom_intorrrr)r'r/rrrrrs rsock_recvfrom_intoz(BaseSelectorEventLoop.sock_recvfrom_intos7 %d+++ ; @4??,,11>?? ? XXF %%c622 2!12    D   "" [[]] $$R(((!!"d&>T3"(**   d2Bv F F F H H HyyyyyysA--BBc,|rdS |||}||dS#ttf$rYdSt t f$rt$r }||Yd}~dSd}~wwxYwr-) rrrr]r\rrrr)r'rr/rrrrs rrz)BaseSelectorEventLoop._sock_recvfrom_intos 88::  F #''W55F NN6 " " " " " !12    FF-.     # # #   c " " " " " " " " " #sABB3BBc VKtj||jr'|dkrt d ||}n#t tf$rd}YnwxYw|t|krdS| }| }| || ||j ||t||g}|t!j|j|||d{VS)Send data to the socket. The socket must be connected to a remote socket. This method continues to send data from data until either all data has been sent or an error occurs. None is returned on success. On error, an exception is raised, and there is no way to determine how much data, if any, was successfully processed by the receiving end of the connection. rrNr)rrrdrrrbr]r\rrrKrr _sock_sendall memoryviewrrr_sock_write_done)r'r/rXrrrrs r sock_sendallz"BaseSelectorEventLoop.sock_sendall sC %d+++ ; @4??,,11>?? ?  $AA!12   AAA  D >> F  "" [[]] $$R(((!!"d&8#t",T"2"2QC99   d3R G G G I I IyyyyyysAA21A2c|rdS|d} |||d}nQ#ttf$rYdStt f$rt $r }||Yd}~dSd}~wwxYw||z }|t|kr| ddS||d<dSNr) rrbr]r\rrrrrr)r'rr/viewposstartrrs rrz#BaseSelectorEventLoop._sock_sendall*s 88::  FA  $uvv,''AA!12    FF-.          c " " " FFFFF    CII   NN4 CFFFs>B B ,BB c Ktj||jr'|dkrt d |||S#t tf$rYnwxYw|}| }| || ||j ||||}| tj|j|||d{VS)rrrrN)rrrdrrsendtor]r\rrKrr _sock_sendtorrrr)r'r/rXr@rrrs r sock_sendtoz!BaseSelectorEventLoop.sock_sendto@s$ %d+++ ; @4??,,11>?? ? ;;tW-- -!12    D   "" [[]] $$R(((!!"d&7dD")++   d3R G G G I I IyyyyyysAA0/A0c.|rdS ||d|}||dS#ttf$rYdSt t f$rt$r }||Yd}~dSd}~wwxYwr) rrrr]r\rrrr)r'rr/rXr@rrs rrz"BaseSelectorEventLoop._sock_sendto[s 88::  F  D!W--A NN1      !12    FF-.     # # #   c " " " " " " " " " #sABB4BBcKtj||jr'|dkrt d|jt jks!tjrR|jt j kr=| ||j|j |j |d{V}|d\}}}}}| }|||| |d{V d}S#d}wxYw)zTConnect to a remote socket at address. This method is a coroutine. rr)familytypeprotoloopN)rrrdrrrrPAF_INET _HAS_IPv6AF_INET6_ensure_resolvedrrr _sock_connect)r'r/r@resolvedrrs r sock_connectz"BaseSelectorEventLoop.sock_connectjs& %d+++ ; @4??,,11>?? ? ;&. ( (% )*.+*H*H!22 $)4:3H#+1+ Aq!Q  "" 3g... 999999 CC$CJJJJs $C//C3c|} |||dn#ttf$re|||||j|||}|tj |j ||YnCB>B94C9B>>CC cKtj||jr'|dkrt d|}||||d{VS)aWAccept a connection. The socket must be bound to an address and listening for connections. The return value is a pair (conn, address) where conn is a new socket object usable to send and receive data on the connection, and address is the address bound to the socket on the other end of the connection. rrN)rrrdrrr _sock_accept)r'r/rs r sock_acceptz!BaseSelectorEventLoop.sock_accepts %d+++ ; @4??,,11>?? ?  "" #t$$$yyyyyyr(c|} |\}}|d|||fdS#tt f$re|||||j||}| tj |j ||YdSttf$rt$r }||Yd}~dSd}~wwxYw)NFr)rKrrrRrr]r\rrSrrrrrrrrr)r'rr/rrr@rrs rrz"BaseSelectorEventLoop._sock_acceptsI [[]] , KKMMMD'   U # # # NND'? + + + + + !12 L L L  ( ( , , ,%%b$*;S$GGF  ! !!$"66JJJ L L L L L L-.     # # #   c " " " " " " " " " #s,AA2D D *DD cK|j|j=|}||d{V ||j|||dd{V ||r|||j|j<S#||r|||j|j<wxYw)NF)fallback) r&_sock_fd is_reading pause_reading_make_empty_waiter sock_sendfile_sock_reset_empty_waiterresume_reading)r'transpfileoffsetcountrs r_sendfile_nativez&BaseSelectorEventLoop._sendfile_natives1  V_ -**,,''))))))))) 7++FL$5:,<<<<<<<< <  & & ( ( ( (%%'''06D V_ - -  & & ( ( ( (%%'''06D V_ - 6 6 6 6s $B22;C-cF|D]\}}|j|jc}\}}|tjzr4|2|jr||n|||tjzr4|2|jr||||dSr-) fileobjrXrr _cancelledrI _add_callbackrr)r' event_listrrrrrs r_process_eventsz%BaseSelectorEventLoop._process_eventss# / /IC(+ SX %G%ffi** /v/A$/''0000&&v...i++ /0B$/''0000&&v... / /r(c||||dSr-)rIrKrG)r'r/s r _stop_servingz#BaseSelectorEventLoop._stop_servings/ DKKMM*** r(r-NNN)r)4r! __module__ __qualname____doc__rr2rSSL_HANDSHAKE_TIMEOUTSSL_SHUTDOWN_TIMEOUTr=rArGrFr#rYrTrfrlrirsrrSrIrrrrrrrrrrrrrrrrrrrrrrrr rrrr! __classcell__r s@rrr+s 9999997%)$77777 9=+ $t"+"A!*!? +++++$CGBBBB " " " " "   EEE      ,,,&#'tS-6-L,5,JFFFFD#"+"A!*!? ,),),),)`D"+"A!*!? -5-5-5-5^&&&$ * .... ''' ... ''' ,####!!! *###".###"2###">,6   2.####*   ,,," 7 7 7 / / /r(rceZdZdZeZdZdfd ZdZdZ dZ dZ dZ d Z d Zd Zd Zejfd ZddZdZdZdZdZxZS)_SelectorTransportiNct||tj||jd< ||jd<n#t $r d|jd<YnwxYwd|jvr= ||jd<n#tj $r d|jd<YnwxYw||_ | |_ d|_ ||||_||_d|_d|_d|_|j|j||j|j <dS)NrPsocknamernFr)rrr r|_extra getsocknamerc getpeernamerPerrorrrKr _protocol_connected set_protocol_server_buffer_factory_buffer _conn_lost_closing_paused_attachr&)r'rr/r0r*r+r s rrz_SelectorTransport.__init__so %%% & 6t < < H +&*&6&6&8&8DK # # + + +&*DK # # # + T[ ( ( /*.*:*:*<*< J''< / / /*. J''' /   #(  (### ++--   < # L " " "*.'''s$AA54A5BB;:B;c|jjg}|j|dn|jr|d|d|j|j|jst|jj |jtj }|r|dn|dt|jj |jtj }|rd}nd}| }|d|d |d d d |S) Nclosedclosingzfd=z read=pollingz read=idlepollingidlezwrite=z<{}> )r r!rappendr8r _looprErr"rrrget_write_buffer_sizeformatjoin)r'infor>staters r__repr__z_SelectorTransport.__repr__s]'( :  KK ! ! ! ! ] # KK " " " )$-))*** : !$**>*>*@*@ !*4:+?+/=):NPPG ) N++++ K(((*4:+?+/=+4+@BBG !0022G KK=%==7=== > > >}}SXXd^^,,,r(c0|ddSr-) _force_closerNs rabortz_SelectorTransport.abort8s $r(c"||_d|_dSNT) _protocolr2)r'r0s rr3z_SelectorTransport.set_protocol;s!#'   r(c|jSr-)rOrNs r get_protocolz_SelectorTransport.get_protocol?s ~r(c|jSr-)r8rNs rrz_SelectorTransport.is_closingBs }r(c<| o|j Sr-)rr9rNs rrz_SelectorTransport.is_readingEs??$$$9T\)99r(c|sdSd|_|j|j|jrt jd|dSdS)NTz%r pauses reading)rr9rCrIr  get_debugr rrNs rrz _SelectorTransport.pause_readingHsq    F  !!$-000 :   ! ! 4 L,d 3 3 3 3 3 4 4r(c|js|jsdSd|_||j|j|jrtjd|dSdS)NFz%r resumes reading) r8r9rSr  _read_readyrCrUr rrNs rrz!_SelectorTransport.resume_readingPsu =    F  (8999 :   ! ! 5 L-t 4 4 4 4 4 5 5r(c|jrdSd|_|j|j|jsQ|xjdz c_|j|j|j|jddSdSNTr) r8rCrIr r6r7r call_soon_call_connection_lostrNs rrGz_SelectorTransport.closeXs =  F  !!$-000| C OOq OO J % %dm 4 4 4 J !;T B B B B B C Cr(cv|j1|d|t||jdSdS)Nzunclosed transport )source)rResourceWarningrG)r'_warns r__del__z_SelectorTransport.__del__bsL : ! E000/$ O O O O J        " !r(Fatal error on transportct|tr2|jrt jd||dn$|j||||jd||dS)Nz%r: %sTr`)rorprr0) rrcrCrUr rr{rOrK)r'rros r _fatal_errorz_SelectorTransport._fatal_errorgs c7 # # z##%% E XtWtDDDD J - -" ! N //    #r(cP|jrdS|jr8|j|j|j|js&d|_|j|j|xjdz c_|j|j |dSrY) r7r6clearrCrr r8rIrZr[)r'rs rrKz_SelectorTransport._force_closeus ?  F < 5 L   J % %dm 4 4 4} 5 DM J % %dm 4 4 4 1 T7=====r(c |jr|j||jd|_d|_d|_|j}||d|_dSdS#|jd|_d|_d|_|j}||d|_wxYwr-)r2rOconnection_lostrrGrCr4_detach)r'rr+s rr[z(_SelectorTransport._call_connection_losts $' 4..s333 J     DJ!DNDJ\F!   # "! J     DJ!DNDJ\F!   # ####s !A99AC c*t|jSr-)rr6rNs rrDz(_SelectorTransport.get_write_buffer_sizes4<   r(cZ|sdS|jj||g|RdSr-)rrCrSrs rrSz_SelectorTransport._add_readers>    F r83d333333r()NN)ra)r!r#r$max_size bytearrayr5rrrIrLr3rQrrrrrGwarningswarnr`rcrKr[rDrSr(r)s@rr+r+sEHO E//////8---8   (((:::444555CCC%M     > > > $ $ $!!!4444444r(r+ceZdZdZejjZ dfd ZfdZ dZ dZ dZ dZ d Zd Zd Zd Zfd ZdZdZxZS)r.TNcd|_t|||||d|_d|_t j|j|j |j j ||j |j |j |j|(|j tj|ddSdSr)_read_ready_cbrr_eof _empty_waiterr _set_nodelayrrCrZrOconnection_maderSr rWr_set_result_unless_cancelled)r'rr/r0r1r*r+r s rrz!_SelectorSocketTransport.__init__s# tXuf=== !  ,,, T^;TBBB T-!]D,< > > >   J !E!' / / / / /  r(ct|tjr |j|_n |j|_t |dSr-)rr BufferedProtocol_read_ready__get_bufferrq_read_ready__data_receivedrr3)r'r0r s rr3z%_SelectorSocketTransport.set_protocolsP h : ; ; B"&">D  "&"AD  X&&&&&r(c.|dSr-)rqrNs rrWz$_SelectorSocketTransport._read_readys r(c|jrdS |jd}t|st dn?#t t f$rt$r!}||dYd}~dSd}~wwxYw |j |}nR#ttf$rYdSt t f$rt$r!}||dYd}~dSd}~wwxYw|s| dS |j|dS#t t f$rt$r!}||dYd}~dSd}~wwxYw)Nz%get_buffer() returned an empty bufferz/Fatal error: protocol.get_buffer() call failed.$Fatal read error on socket transportz3Fatal error: protocol.buffer_updated() call failed.)r7rO get_bufferrrDrrrrcrrr]r\_read_ready__on_eofbuffer_updated)r'rrrs rryz0_SelectorSocketTransport._read_ready__get_buffers ?  F .++B//Cs88 L"#JKKK L-.          F H H H FFFFF   Z))#..FF!12    FF-.          c#I J J J FFFFF    $ $ & & & F L N ) )& 1 1 1 1 1-.     L L L   J L L L L L L L L L LsM8ABA;;BBC.3C. C))C. D&&E"EE"c|jrdS |j|j}nR#tt f$rYdSt tf$rt$r!}| |dYd}~dSd}~wwxYw|s| dS |j |dS#t tf$rt$r!}| |dYd}~dSd}~wwxYw)Nr~z2Fatal error: protocol.data_received() call failed.) r7rr[rkr]r\rrrrcrrO data_received)r'rXrs rrzz3_SelectorSocketTransport._read_ready__data_receivedsp ?  F :??4=11DD!12    FF-.          c#I J J J FFFFF    $ $ & & & F K N ( ( . . . . .-.     K K K   I K K K K K K K K K Ks2+A:A:A55A:B22C. C))C.c|jrtjd| |j}n?#t tf$rt$r!}| |dYd}~dSd}~wwxYw|r!|j |j dS| dS)Nz%r received EOFz1Fatal error: protocol.eof_received() call failed.) rCrUr rrO eof_receivedrrrrcrIr rG)r' keep_openrs rrz,_SelectorSocketTransport._read_ready__on_eofs :   ! ! 2 L*D 1 1 1 3355II-.          H J J J FFFFF    J % %dm 4 4 4 4 4 JJLLLLLsA B%BBc t|tttfs$t dt |j|jrtd|j td|sdS|j r;|j tj krtjd|xj dz c_ dS|js |j|}||d}|sdSnQ#t$t&f$rYn>t(t*f$rt,$r!}||dYd}~dSd}~wwxYw|j|j|j|j||dS)N/data argument must be a bytes-like object, not z%Cannot call write() after write_eof()z(unable to write; sendfile is in progresssocket.send() raised exception.r%Fatal write error on socket transport)rbytesrlrrrr!rrrDrsr7r!LOG_THRESHOLD_FOR_CONNLOST_WRITESr warningr6rrbr]r\rrrrcrCrr  _write_readyextend_maybe_pause_protocol)r'rXrrs rwritez_SelectorSocketTransport.writes$ : >?? <;#'::#6;;<< < 9 HFGG G   )IJJ J  F ? )"MMM@AAA OOq OO F| E JOOD))ABBxF$%56    12       !!#'NOOO  J " "4=$2C D D D D!!! ""$$$$$sC**D8=D8D33D8c"|jrdS |j|j}|r |jd|=||js|j|j|j|j d|j r| ddS|j r(|j tjdSdSdS#t t"f$rYdSt$t&f$rt($r}|j|j|j||d|j |j|Yd}~dSYd}~dSd}~wwxYw)Nr)r7rrbr6_maybe_resume_protocolrCrr rsrr8r[rrshutdownrPSHUT_WRr]r\rrrrercr)r'rrs rrz%_SelectorSocketTransport._write_ready8s ?  F 8  --A %L!$  ' ' ) ) )< 8 ))$-888%1&11$777=8..t44444Y8J''77777 8 8 88) !12    DD-.     6 6 6 J % %dm 4 4 4 L     c#J K K K!-"00555555555.-----  6sC F4FA/F  Fc|js|jrdSd|_|js&|jt jdSdSrN)r8rrr6rrrPrrNs r write_eofz"_SelectorSocketTransport.write_eofVsS = DI  F | 0 J   / / / / / 0 0r(cdSrNrVrNs r can_write_eofz&_SelectorSocketTransport.can_write_eof]str(ct||j)|jt ddSdS)NzConnection is closed by peer)rr[rsrConnectionError)r'rr s rr[z._SelectorSocketTransport._call_connection_lost`sb %%c***   )   , , >?? A A A A A * )r(c|jtd|j|_|js|jd|jS)NzEmpty waiter is already set)rsrDrCrr6rrNs rrz+_SelectorSocketTransport._make_empty_waiterfsZ   )<== =!Z5577| 0   ) )$ / / /!!r(cd|_dSr-)rsrNs rrz,_SelectorSocketTransport._reset_empty_waiterns!r(r")r!r#r$_start_tls_compatibler _SendfileMode TRY_NATIVE_sendfile_compatiblerr3rWryrzrrrrrr[rrr(r)s@rr.r.s* $2=48$(//////,'''''#L#L#LJKKK2*%%%%%%N888<000AAAAA """"""""""r(r.cLeZdZejZ dfd ZdZdZddZ dZ xZ S) r?Nc`t||||||_d|_|j|jj||j|j|j |j |(|jtj |ddSdSr) rr_address _buffer_sizerCrZrOrurSr rWrrv)r'rr/r0r@r1r*r s rrz#_SelectorDatagramTransport.__init__vs tXu555  T^;TBBB T-!]D,< > > >   J !E!' / / / / /  r(c|jSr-)rrNs rrDz0_SelectorDatagramTransport.get_write_buffer_sizes   r(c|jrdS |j|j\}}|j||dS#t tf$rYdSt$r%}|j |Yd}~dSd}~wttf$rt$r!}| |dYd}~dSd}~wwxYw)Nz&Fatal read error on datagram transport)r7rrrkrOdatagram_receivedr]r\rcerror_receivedrrrrcr'rXrrs rrWz&_SelectorDatagramTransport._read_readys ?  F 9,,T];;JD$ N , ,T4 8 8 8 8 8 !12    DD / / / N ) )# . . . . . . . . .-.     M M M   c#K L L L L L L L L L Ms)"A C C'BC%CCc t|tttfs$t dt |j|sdS|jr)|d|jfvrtd|j|j}|j rB|jr;|j tj krtj d|xj dz c_ dS|js |jdr|j|n|j||dS#t&t(f$r(|j|j|jYnkt2$r%}|j|Yd}~dSd}~wt8t:f$rt<$r!}||dYd}~dSd}~wwxYw|j t||f|xj!tE|z c_!|#dS)Nrz!Invalid address: must be None or rrrn'Fatal write error on datagram transport)$rrrlrrrr!rrr7rrr rr6r.rrbrr]r\rCrr  _sendto_readyrcrOrrrrrcrBrrrrs rrz!_SelectorDatagramTransport.sendtosi$ : >?? <;#'::#6;;<< <  F = !D$-000 G GGIII=D ? t} )"MMM@AAA OOq OO F|  ;z*2JOOD))))J%%dD111#%56 J J J &&t}d6HIIIII   --c222 12       !!BDDD  U4[[$/000 SYY& ""$$$$$s+ AD6F1 F1E22F1F,,F1cD|jr=|j\}}|xjt|zc_ |jdr|j|n|j||n#ttf$r<|j ||f|xjt|z c_Ynst$r%}|j |Yd}~dSd}~wttf$rt $r!}||dYd}~dSd}~wwxYw|j=||js=|j|j|jr|ddSdSdS)Nrnr)r6popleftrrr.rrbrr]r\ appendleftrcrOrrrrrcrrCrr r8r[rs rrz(_SelectorDatagramTransport._sendto_readysl --//JD$   T *   ;z*2JOOD))))J%%dD111#%56    ''t 555!!SYY.!!   --c222 12       !!BDDD #l , ##%%%| 1 J % %dm 4 4 4} 1**400000 1 1 1 1s,ABA D; D;C<<D;D66D;r"r-) r!r#r$ collectionsdequer5rrDrWrrr(r)s@rr?r?rs!'O59$( / / / / / /!!!999 *%*%*%*%X1111111r(r?)r%__all__rrvrrrPrmr$ssl ImportErrorrrrrr r r r logr r BaseEventLoopr_FlowControlMixin Transportr+r.r?rVr(rrs* #  JJJJ CCC(((F F F F F K5F F F Ra4a4a4a4a45#-a4a4a4HW"W"W"W"W"1W"W"W"tl1l1l1l1l1!3l1l1l1l1l1s '11__pycache__/constants.cpython-311.pyc000064400000001727152533123130013477 0ustar00 !A?h.TddlZdZdZdZdZdZdZdZd ZGd d ej Z dS) N gN@g>@iicheZdZejZejZejZdS) _SendfileModeN)__name__ __module__ __qualname__enumauto UNSUPPORTED TRY_NATIVEFALLBACK>/opt/alt/python-internal/lib64/python3.11/asyncio/constants.pyrr#s5$)++KJty{{HHHrr) r !LOG_THRESHOLD_FOR_CONNLOST_WRITESACCEPT_RETRY_DELAYDEBUG_STACK_DEPTHSSL_HANDSHAKE_TIMEOUTSSL_SHUTDOWN_TIMEOUT!SENDFILE_FALLBACK_READBUFFER_SIZE FLOW_CONTROL_HIGH_WATER_SSL_READ!FLOW_CONTROL_HIGH_WATER_SSL_WRITEEnumrrrrrs  %&! %/!#& $'!DIr__pycache__/base_tasks.cpython-311.pyc000064400000010144152533123130013573 0ustar00 !A?hT xddlZddlZddlZddlmZddlmZdZejdZdZ dZ dS) N) base_futures) coroutinesctj|}|r|sd|d<|dd|zt j|j}|dd|d|j |dd |j |S) N cancellingrrzname=%rzcoro=<>z wait_for=) r_future_repr_infordoneinsertget_namer_format_coroutine_coro _fut_waiter)taskinfocoros ?/opt/alt/python-internal/lib64/python3.11/asyncio/base_tasks.py_task_repr_infor s  )$ / /D QKK9t}}.///  ' 3 3DKK#D###$$$ # A74#377888 Kcldt|}d|jjd|dS)N  > X>z 7 " " KK ! ! !   * * * 61;??xt<==== /C I &d&&T22222  @t@@@tLLLLL <4<<<4HHHH d3333 3CM3GG + +D $Tr * * * * * + +r) r;reprlibr@r2rrrrecursive_reprrr/rKrrrOs"111   F+++++r__pycache__/proactor_events.cpython-311.pyc000064400000135221152533123130014675 0ustar00 !A?hdZdZddlZddlZddlZddlZddlZddlZddlZddl m Z ddl m Z ddl m Z ddl m Z dd l mZdd l mZdd l mZdd l mZdd lmZdZGddejejZGddeejZGddeejZGddeZGddeejZGddeeejZ GddeeejZ!Gdde j"Z#dS)zEvent loop using a proactor and related classes. A proactor is a "notify-on-completion" multiplexer. Currently a proactor is only implemented on Windows with IOCP. )BaseProactorEventLoopN) base_events) constants)futures) exceptions) protocols)sslproto) transports)trsock)loggerctj||jd< ||jd<nE#tj$r3|jrtj d|dYnwxYwd|jvr? | |jd<dS#tj$rd|jd<YdSwxYwdS)Nsocketsocknamezgetsockname() failed on %rTexc_infopeername) r TransportSocket_extra getsocknamererror_loop get_debugr warning getpeername) transportsocks D/opt/alt/python-internal/lib64/python3.11/asyncio/proactor_events.py_set_socket_extrars !'!7!=!=IXC'+'7'7'9'9 $$ <CCC ? $ $ & & C N,dT C C C CC ))) 0+/+;+;+=+=I Z ( ( (| 0 0 0+/I Z ( ( ( ( 0*)s!;?A=<A= B((CCczeZdZdZ dfd ZdZdZdZdZdZ d Z e j fd Z dd Zd ZdZdZxZS)_ProactorBasePipeTransportz*Base class for pipe and socket transports.Nc t||||||_||||_d|_d|_d|_d|_ d|_ d|_ d|_ d|_ |j|j|j|jj||(|jt&j|ddSdS)NrF)super__init__ _set_extra_sock set_protocol_server_buffer _read_fut _write_fut_pending_write _conn_lost_closing_called_connection_lost _eof_written_attachr call_soon _protocolconnection_mader_set_result_unless_cancelledselflooprprotocolwaiterextraserver __class__s rr$z#_ProactorBasePipeTransport.__init__2s %%%   (###   ',$! < # L " " " T^;TBBB   J !E!' / / / / /  ct|jjg}|j|dn|jr|d|j/|d|j|j|d|j|j|d|j|jr*|dt|j|j r|dd d |S) Nclosedclosingzfd=zread=zwrite=zwrite_bufsize=z EOF writtenz<{}> ) r=__name__r&appendr.filenor*r+r)lenr0formatjoin)r7infos r__repr__z#_ProactorBasePipeTransport.__repr__Is+'( :  KK ! ! ! ! ] # KK " " " : ! KK3dj//1133 4 4 4 > % KK222 3 3 3 ? & KK444 5 5 5 < > KK<T\):):<< = = =   ' KK & & &}}SXXd^^,,,r>c||jd<dS)Npipe)rr7rs rr%z%_ProactorBasePipeTransport._set_extra[s" Fr>c||_dSNr3)r7r9s rr'z'_ProactorBasePipeTransport.set_protocol^s !r>c|jSrOrPr7s r get_protocolz'_ProactorBasePipeTransport.get_protocolas ~r>c|jSrO)r.rRs r is_closingz%_ProactorBasePipeTransport.is_closingds }r>c|jrdSd|_|xjdz c_|js'|j |j|jd|j"|jd|_dSdS)NTr) r.r-r)r+rr2_call_connection_lostr*cancelrRs rclosez _ProactorBasePipeTransport.closegs =  F  1| C 7 J !;T B B B > % N ! ! # # #!DNNN & %r>cv|j1|d|t||jdSdS)Nzunclosed transport )source)r&ResourceWarningrY)r7_warns r__del__z"_ProactorBasePipeTransport.__del__rsL : ! E000/$ O O O O J        " !r>Fatal error on pipe transportc< t|tr2|jrt jd||dn$|j||||jd||dS#||wxYw)Nz%r: %sTr)message exceptionrr9) isinstanceOSErrorrrr debugcall_exception_handlerr3 _force_close)r7excras r _fatal_errorz'_ProactorBasePipeTransport._fatal_errorws ##w'' :''))IL44HHHH 11&!$!% $ 33   c " " " " "D  c " " " "s A+BBc|jP|js7||jdn|j||jr |jrdSd|_|xjdz c_|jr |jd|_|j r |j d|_ d|_ d|_ |j |j|dS)NTrr) _empty_waiterdone set_result set_exceptionr.r/r-r+rXr*r,r)rr2rW)r7rhs rrgz'_ProactorBasePipeTransport._force_closes   )$2D2I2I2K2K ){"--d3333"00555 = T9  F  1 ? # O " " $ $ $"DO > " N ! ! # # #!DN  T7=====r>c|jrdS |j|t|jdrA|jdkr$|jtj|j d|_|j }|| d|_ d|_dS#t|jdrA|jdkr$|jtj|j d|_|j }|| d|_ d|_wxYw)NshutdownT) r/r3connection_losthasattrr&rErpr SHUT_RDWRrYr(_detach)r7rhr<s rrWz0_ProactorBasePipeTransport._call_connection_losts\  '  F 0 N * *3 / / / tz:.. 64:3D3D3F3F"3L3L ##F$4555 J     DJ\F!   # +/D ( ( (tz:.. 64:3D3D3F3F"3L3L ##F$4555 J     DJ\F!   # +/D ( / / / /s CB#E+cP|j}|j|t|jz }|SrO)r,r)rF)r7sizes rget_write_buffer_sizez0_ProactorBasePipeTransport.get_write_buffer_sizes+" < # C %% %D r>NNN)r_)rC __module__ __qualname____doc__r$rJr%r'rSrUrYwarningswarnr^rirgrWrx __classcell__r=s@rr!r!.s4448$(//////.---$###""" " " "%M # # # #>>>(000(r>r!cNeZdZdZ d fd ZdZdZdZdZd Z d d Z xZ S) _ProactorReadPipeTransportzTransport for read pipes.Ncd|_d|_t||||||t ||_|j|jd|_dS)NrqTF) _pending_data_length_pausedr#r$ bytearray_datarr2 _loop_reading) r7r8rr9r:r;r< buffer_sizer=s rr$z#_ProactorReadPipeTransport.__init__sg$&!  tXvufEEE{++  T/000 r>c"|j o|j SrO)rr.rRs r is_readingz%_ProactorReadPipeTransport.is_readings<5 $55r>c|js|jrdSd|_|jrt jd|dSdS)NTz%r pauses reading)r.rrrr rerRs r pause_readingz(_ProactorReadPipeTransport.pause_readings\ = DL  F  :   ! ! 4 L,d 3 3 3 3 3 4 4r>cf|js|jsdSd|_|j |j|jd|j}d|_|dkr.|j|j|jd|||j rtj d|dSdS)NFrqz%r resumes reading) r.rr*rr2rr_data_receivedrrr re)r7lengths rresume_readingz)_ProactorReadPipeTransport.resume_readings =    F > ! J !3T : : :*$&! B;; J !4dj&6I6 R R R :   ! ! 5 L-t 4 4 4 4 4 5 5r>cF|jrtjd| |j}n?#t tf$rt$r!}| |dYd}~dSd}~wwxYw|s| dSdS)Nz%r received EOFz1Fatal error: protocol.eof_received() call failed.) rrr rer3 eof_received SystemExitKeyboardInterrupt BaseExceptionrirY)r7 keep_openrhs r _eof_receivedz(_ProactorReadPipeTransport._eof_receiveds :   ! ! 2 L*D 1 1 1 3355II-.          H J J J FFFFF    JJLLLLL  sA B%BBc|jr|jdksJ||_dS|dkr|dSt|jt jr\ t j|j|dS#ttf$rt$r!}| |dYd}~dSd}~wwxYw|j |dS)Nrqrz3Fatal error: protocol.buffer_updated() call failed.) rrrrcr3r BufferedProtocol_feed_data_to_buffered_protorrrri data_received)r7datarrhs rrz)_ProactorReadPipeTransport._data_receiveds  < ,2222(.D % F Q;;    F dni&@ A A / 6t~tLLLLL 12       !!##1222   N ( ( . . . . .sA66B2B--B2cZd}d} ||j|us|j|jsJd|_|rK|}|dkr! |dkr|||dSdS|jd|}n||jr! |dkr|||dSdS|js/|jj |j |j|_|js|j |j n#t$rW}|js||dn/|jrt#jddYd}~nod}~wt&$r}||Yd}~nHd}~wt*$r }||dYd}~n d}~wt,j$r |jsYnwxYw|dkr|||dSdS#|dkr|||wwxYw)Nrqrz"Fatal read error on pipe transportz*Read error on pipe transport while closingTr)r*r.rlresultrrrXrr _proactor recv_intor&add_done_callbackrConnectionAbortedErrorrirr reConnectionResetErrorrgrdrCancelledError)r7futrrrhs rrz(_ProactorReadPipeTransport._loop_readings- 2~,,1G152H1G@!%88:: ! ZZ\\F{{D{{##D&11111{A :gvg.DDJJLLL} 2{{##D&11111{)< X!%!5!?!? DJ!W!W< E001CDDD& , , ,= ,!!#'KLLLL%%'' , I&*,,,,# # # #   c " " " " " " " " I I I   c#G H H H H H H H H(   =    {{##D&11111{v{{##D&1111smAD 7+D 6D 9'H G(*A E<7H < G( F#H # G(0G H G(%H 'G((H H*)NNNrrO) rCrzr{r|r$rrrrrrrrs@rrrs##486;666444&555$ ///20202020202020202r>rcReZdZdZdZfdZdZd dZdZdZ d Z d Z d Z xZ S) _ProactorBaseWritePipeTransportzTransport for write pipes.TcHtj|i|d|_dSrO)r#r$rkr7argskwr=s rr$z(_ProactorBaseWritePipeTransport.__init__Ms-$%"%%%!r>ct|tttfs$t dt |j|jrtd|j td|sdS|j r;|j tj krtjd|xj dz c_ dS|j.|jJ|t|dS|js*t||_|dS|j||dS)Nz/data argument must be a bytes-like object, not zwrite_eof() already calledz(unable to write; sendfile is in progresszsocket.send() raised exception.r)r)rcbytesr memoryview TypeErrortyperCr0 RuntimeErrorrkr-r!LOG_THRESHOLD_FOR_CONNLOST_WRITESr rr+r) _loop_writing_maybe_pause_protocolextend)r7rs rwritez%_ProactorBaseWritePipeTransport.writeQsc$ : >?? .-Dzz*--.. .   =;<< <   )IJJ J  F ? )"MMM@AAA OOq OO F ? "<'''   E$KK  0 0 0 0 0 )$T??DL  & & ( ( ( ( ( L   % % %  & & ( ( ( ( (r>Nc ||j |jrdS||jusJd|_d|_|r|||j}d|_|sg|jr |j|jd|jr$|j tj | n|jj|j ||_|jsU|jdksJt#||_|j|j|n|j|j|j#|j|jddSdSdS#t.$r }||Yd}~dSd}~wt2$r!}||dYd}~dSd}~wwxYw)Nrz#Fatal write error on pipe transport)r+r.r,rr)rr2rWr0r&rprSHUT_WR_maybe_resume_protocolrsendrlrFrrrrkrmrrgrdri)r7frrhs rrz-_ProactorBaseWritePipeTransport._loop_writingws6& J}!8T]!8''''"DO"#D   ||#  J=KJ(()CTJJJ$8J''777 ++----"&*"6";";DJ"M"M++--J.!3333*-d))D'O55d6HIII..0000O55d6HIII!-$/2I"--d33333.-2I2I# # # #   c " " " " " " " " " J J J   c#H I I I I I I I I I Js)F!FF!! G4+G G4G//G4cdSNTrRs r can_write_eofz-_ProactorBaseWritePipeTransport.can_write_eoftr>c.|dSrO)rYrRs r write_eofz)_ProactorBaseWritePipeTransport.write_eofs r>c0|ddSrOrgrRs rabortz%_ProactorBaseWritePipeTransport.abort $r>c|jtd|j|_|j|jd|jS)NzEmpty waiter is already set)rkrr create_futurer+rmrRs r_make_empty_waiterz2_ProactorBaseWritePipeTransport._make_empty_waitersX   )<== =!Z5577 ? "   ) )$ / / /!!r>cd|_dSrO)rkrRs r_reset_empty_waiterz3_ProactorBaseWritePipeTransport._reset_empty_waiters!r>NN)rCrzr{r|_start_tls_compatibler$rrrrrrrrrs@rrrGs$$ """""$)$)$)L'J'J'J'JR   """"""""""r>rc$eZdZfdZdZxZS)_ProactorWritePipeTransportctj|i||jj|jd|_|j|jdS)N) r#r$rrrecvr&r*r _pipe_closedrs rr$z$_ProactorWritePipeTransport.__init__s\$%"%%%-224:rBB (():;;;;;r>cH|rdS|dksJ|jr |jJdS||jusJ||jfd|_|j#|t dS|dS)Nr>) cancelledrr.r*r+rgBrokenPipeErrorrY)r7rs rrz(_ProactorWritePipeTransport._pipe_closeds ==??  Fzz||s"""" = >))) Fdn$$$sDN&;$$$ ? &   o// 0 0 0 0 0 JJLLLLLr>)rCrzr{r$rrrs@rrrsG<<<<<       r>rcReZdZdZ d fd ZdZdZdZd dZd dZ d d Z xZ S) _ProactorDatagramTransportiNc||_d|_d|_t|||||t j|_|j |j dS)Nr)r:r;) _addressrk _buffer_sizer#r$ collectionsdequer)rr2r)r7r8rr9addressr:r;r=s rr$z#_ProactorDatagramTransport.__init__sp ! tXfEJJJ#(**  T/00000r>c&t||dSrOrrMs rr%z%_ProactorDatagramTransport._set_extra$%%%%%r>c|jSrO)rrRs rrxz0_ProactorDatagramTransport.get_write_buffer_sizes   r>c0|ddSrOrrRs rrz _ProactorDatagramTransport.abortrr>cZt|tttfst dt ||sdS|j"|d|jfvrtd|j|jrB|jr;|jtj krtj d|xjdz c_dS|j t||f|xjt!|z c_|j||dS)Nz,data argument must be bytes-like object (%r)z!Invalid address: must be None or z!socket.sendto() raised exception.r)rcrrrrrr ValueErrorr-rrr rr)rDrrFr+rr)r7raddrs rsendtoz!_ProactorDatagramTransport.sendtos?$ : >?? (J JJ(( (  F = $dDM5J)J)JCDMCCEE E ? t} )"MMMBCCC OOq OO F U4[[$/000 SYY& ? "     ""$$$$$r>c0 |jrdS||jusJd|_|r||jr|jr0|jr)|jr |j|jddS|j \}}|xj t|zc_ |j+|jj |j||_n,|jj |j|||_|j|j|dS#t&$r%}|j|Yd}~dSd}~wt,$r!}||dYd}~dSd}~wwxYw)N)rz'Fatal write error on datagram transport)r-r+rr)rr.rr2rWpopleftrrFrrr&rrrrrdr3error_received Exceptionri)r7rrrrhs rrz(_ProactorDatagramTransport._loop_writings * $/))))"DO  < DO   =KJ(()CTJJJ--//JD$   T *  }("&*"6";";DJ<@#B#B#'*"6"="=dj>BCG#>#I#I O - -d.@ A A A  ' ' ) ) ) ) )  / / / N ) )# . . . . . . . . . N N N   c#L M M M M M M M M M Ns0D=A$D=1BD== FE'' F4FFcd} |jr" |r|j||dSdS|j|us|j|jsJd|_|U|}|jr$d} |r|j||dSdS|j ||j}}n|\}}|jr" |r|j||dSdS|j0|jj |j |j |_n/|jj |j |j |_|j|j |jnI#t$r$}|j|Yd}~n d}~wt"j$r |jsYnwxYw|r|j||dSdS#|r|j||wwxYwrO)r-r3datagram_receivedr*r.rrrrrr&max_sizerecvfromrrrdrrr)r7rrrresrhs rrz(_ProactorDatagramTransport._loop_reading#s' = H =00t<<<<< = =E>S((T^-C-1].D-C<"DNjjll=D0 =00t<<<<< = =-=,!$dm$DD!$JD$   =00t<<<<< = =}(!%!5!:!:4:;?="J"J"&!5!>!>tz?C}"N"N~)001CDDD / / / N ) )# . . . . . . . .(   =     =00t<<<<< = =t =00t<<<< =sME?EE A&E3'G F $F>GF GF  G G$ryrO) rCrzr{rr$r%rxrrrrrrs@rrrsH59$( 1 1 1 1 1 1&&&!!!   %%%%: * * * *D)=)=)=)=)=)=)=)=r>rceZdZdZdZdZdS)_ProactorDuplexPipeTransportzTransport for duplex pipes.cdS)NFrrRs rrz*_ProactorDuplexPipeTransport.can_write_eofTsur>ctrO)NotImplementedErrorrRs rrz&_ProactorDuplexPipeTransport.write_eofWs!!r>N)rCrzr{r|rrrr>rrrOs:&%"""""r>rcReZdZdZejjZ dfd ZdZ dZ dZ xZ S)_ProactorSocketTransportz Transport for connected sockets.Nc|t||||||tj|dSrO)r#r$r _set_nodelayr6s rr$z!_ProactorSocketTransport.__init__bs< tXvufEEE &&&&&r>c&t||dSrOrrMs rr%z#_ProactorSocketTransport._set_extragrr>cdSrrrRs rrz&_ProactorSocketTransport.can_write_eofjrr>c|js|jrdSd|_|j&|jt jdSdSr)r.r0r+r&rprrrRs rrz"_ProactorSocketTransport.write_eofmsQ = D-  F  ? " J   / / / / / # "r>ry) rCrzr{r|r _SendfileMode TRY_NATIVE_sendfile_compatibler$r%rrrrs@rrr[s+*$2=48$('''''' &&&0000000r>rceZdZfdZ d dZ d!ddddddddZ d dZ d"dZ d"d Z d"d Z fd Z d Z d Z dZ d#dZdZdZdZdZdZdZdZdZd!dZdZ d$dZdZdZdZxZS)%rcttjd|jj||_||_d|_i|_ | || tj tjur-tj|jdSdS)NzUsing proactor: %s)r#r$r rer=rCr _selector_self_reading_future_accept_futuresset_loop_make_self_pipe threadingcurrent_thread main_threadsignal set_wakeup_fd_csockrE)r7proactorr=s rr$zBaseProactorEventLoop.__init__ws  )8+=+FGGG!!$(!!$   # % %)>)@)@ @ @  !3!3!5!5 6 6 6 6 6 A @r>Nc*t||||||SrO)r)r7rr9r:r;r<s r_make_socket_transportz,BaseProactorEventLoop._make_socket_transports!'dHf(-v77 7r>F) server_sideserver_hostnamer;r<ssl_handshake_timeoutssl_shutdown_timeoutc ptj||||||| | } t||| ||| jS)N)rrr;r<)r SSLProtocolr_app_transport) r7rawsockr9 sslcontextr:rrr;r<rr ssl_protocols r_make_ssl_transportz)BaseProactorEventLoop._make_ssl_transports\  +h F_&;%9 ;;; !w ',V = = = =**r>c*t||||||SrO)r)r7rr9rr:r;s r_make_datagram_transportz.BaseProactorEventLoop._make_datagram_transports!)$h*0%99 9r>c(t|||||SrO)rr7rr9r:r;s r_make_duplex_pipe_transportz1BaseProactorEventLoop._make_duplex_pipe_transports"+D,0(FEKK Kr>c(t|||||SrO)rr!s r_make_read_pipe_transportz/BaseProactorEventLoop._make_read_pipe_transports)$hNNNr>c(t|||||SrO)rr!s r_make_write_pipe_transportz0BaseProactorEventLoop._make_write_pipe_transports$+4+/65JJ Jr>c|rtd|rdStjtjurt jd|| |j d|_ d|_ t dS)Nz!Cannot close a running event looprq) is_runningr is_closedr r r r r _stop_accept_futures_close_self_piperrYrr#)r7r=s rrYzBaseProactorEventLoop.closes ??   DBCC C >>    F  # % %)>)@)@ @ @   $ $ $ !!###    r>cHK|j||d{VSrO)rr)r7rns r sock_recvzBaseProactorEventLoop.sock_recvs0^((q111111111r>cHK|j||d{VSrO)rr)r7rbufs rsock_recv_intoz$BaseProactorEventLoop.sock_recv_intos0^--dC888888888r>cHK|j||d{VSrO)rr)r7rbufsizes r sock_recvfromz#BaseProactorEventLoop.sock_recvfroms0^,,T7;;;;;;;;;r>rclK|st|}|j|||d{VSrO)rFr recvfrom_into)r7rr0nbytess rsock_recvfrom_intoz(BaseProactorEventLoop.sock_recvfrom_intosE XXF^11$VDDDDDDDDDr>cHK|j||d{VSrO)rr)r7rrs r sock_sendallz"BaseProactorEventLoop.sock_sendalls0^((t444444444r>cLK|j||d|d{VS)Nr)rr)r7rrrs r sock_sendtoz!BaseProactorEventLoop.sock_sendtos4^**4q'BBBBBBBBBr>cHK|j||d{VSrO)rconnect)r7rrs r sock_connectz"BaseProactorEventLoop.sock_connects0^++D':::::::::r>cFK|j|d{VSrO)racceptrMs r sock_acceptz!BaseProactorEventLoop.sock_accepts.^**4000000000r>cK |}n2#ttjf$r}t jdd}~wwxYw t j|j}n"#t$rt jdwxYw|r|n|}|sdSt|d}|rt||z|n|} t||}d} t| |z |}|dkr| | dkr| |SS|j ||||d{V||z }| |z } e#| dkr| |wwxYw)Nznot a regular filerl)rEAttributeErrorioUnsupportedOperationrSendfileNotAvailableErrorosfstatst_sizerdminseekrsendfile) r7rfileoffsetcountrEerrfsize blocksizeend_pos total_sents r_sock_sendfile_nativez+BaseProactorEventLoop._sock_sendfile_natives M[[]]FF 78 M M M67KLL L M MHV$$,EE M M M67KLL L M"-EE  1 ;// 05@#fune,,,5VU##  " (& 0)<< >>% A~~ &!!!! n--dD&)LLLLLLLLL)#i'  (A~~ &!!!!s2AAA A&&B D2.D22EcK|}||d{V ||j|||dd{V ||r|SS#||r|wwxYw)NF)fallback)rrr sock_sendfiler&rr)r7transprNrOrPrs r_sendfile_nativez&BaseProactorEventLoop._sendfile_natives **,,''))))))))) (++FL$5:,<<<<<<<< <  & & ( ( ( (%%'''' (  & & ( ( ( (%%'''' (s $B-Cc|j |jd|_|jd|_|jd|_|xjdzc_dS)Nr)rrX_ssockrYr _internal_fdsrRs rr+z&BaseProactorEventLoop._close_self_pipesx  $ 0  % , , . . .(,D %     ar>ctj\|_|_|jd|jd|xjdz c_dS)NFr)r socketpairr]r setblockingr^rRs rrz%BaseProactorEventLoop._make_self_pipes_#)#4#6#6  T[ &&& &&& ar>cr |||j|urdS|j|jd}||_||jdS#tj$rYdSttf$rt$r$}| d||dYd}~dSd}~wwxYw)Niz.Error on reading from the event loop self pipe)rarbr8) rrrrr]r_loop_self_readingrrrrrrf)r7rrhs rrcz(BaseProactorEventLoop._loop_self_readings 9} (11##DK66A)*D %   7 8 8 8 8 8(    FF-.         ' 'K ))          s"A& A&&B68B6B11B6c|j}|dS |ddS#t$r$|jrt jddYdSYdSwxYw)Nz3Fail to write a null byte into the self-pipe socketTr)rrrd_debugr re)r7csocks r_write_to_selfz$BaseProactorEventLoop._write_to_self1s   = F , JJu      , , ,{ , 0&*,,,,,,, , , , ,s$'AAdc Zdfd dS)Nc F |||\}}jrtjd||} || dd|i n||d|irdSj }|j <| dS#t$r} dkr@ d|tj d n*jrtjd d Yd}~dSYd}~dSYd}~dSd}~wt"j$r YdSwxYw) Nz#%r got a new connection from %r: %rTr)rr;r<rrrrqzAccept failed on a socket)rarbrzAccept failed on socket %rr)rrfr rerrr)rrArrErrdrfr rrYrr) rconnrr9rhr8protocol_factoryr7r<rrrrs rr8z2BaseProactorEventLoop._start_serving..loopHsD# *=!"JD${9 %J%+T4999//11H!-00 (JD#-t"4V2G1E 1GGGG 33 (#-t"4V4EEE>>##FN))$//78$T[[]]3##D))))) 6 6 6;;==B&&//#>%("("8">">11 JJLLLL[6L!=!%6666666666666666!LLLLL,     s%BC$C$$ F .A6E66&F F rO)r2) r7rmrrr<backlogrrr8s ````` ``@r_start_servingz$BaseProactorEventLoop._start_servingCsf $ *$ *$ *$ *$ *$ *$ *$ *$ *$ *$ *$ *$ *L tr>cdSrOr)r7 event_lists r_process_eventsz%BaseProactorEventLoop._process_eventsps r>c|jD]}||jdSrO)rvaluesrXclear)r7futures rr*z*BaseProactorEventLoop._stop_accept_futurestsJ*1133  F MMOOOO ""$$$$$r>c|j|d}|r||j||dSrO)rpoprErXr _stop_servingrY)r7rrvs rryz#BaseProactorEventLoop._stop_servingys^%))$++-->>   MMOOO $$T*** r>ryrOr)r)NNriNN)rCrzr{r$rrrr"r$r&rYr.r1r4r8r:r<r?rBrVr[r+rrcrhrorrr*ryrrs@rrrusS 7 7 7 7 7=A267777 9= + $t"&!% + + + + + CG9999 BF*.KKKK @D(,OOOOAE)-JJJJ (222999<<<EEEE 555CCC;;;111""": ( ( (      99998,,,&>A-1,0++++Z   %%% r>r)$r|__all__rErHrr}r r rrrrrr r r r logr r_FlowControlMixin BaseTransportr! ReadTransportrWriteTransportrrDatagramTransportr Transportrr BaseEventLooprrr>rrs #  000$DDDDD!=!+!9DDDNO2O2O2O2O2!;!+!9O2O2O2dk"k"k"k"k"&@&0&?k"k"k"\"A,A=A=A=A=A=!;!+!=A=A=A=H " " " " "#=#B#-#7 " " "000009>)30004IIIIIK5IIIIIr>__pycache__/base_events.cpython-311.opt-1.pyc000064400000262006152533123130014717 0ustar00 !A?hx&6dZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl Z ddl Z ddlZddlZddlZddlZddlZ ddlZn #e$rdZYnwxYwddlmZddlmZddlmZddlmZddlmZdd lmZdd lmZdd lmZdd lmZdd lmZddlm Z ddl!m"Z"dZ#dZ$dZ%e&e dZ'dZ(dZ)dZ*dZ+d%dZ,d&dZ-dZ.e&e drdZ/ndZ/dZ0Gdd ej1Z2Gd!d"ej3Z4Gd#d$ej5Z6dS)'aBase implementation of event loop. The event loop can be broken up into a multiplexer (the part responsible for notifying us of I/O events) and the event loop proper, which wraps a multiplexer with functionality for scheduling callbacks, immediately or at a given time in the future. Whenever a public API takes a callback, subsequent positional arguments will be passed to the callback if/when it is called. This avoids the proliferation of trivial lambdas implementing closures. Keyword arguments for the callback are not supported; this is a conscious design decision, leaving the door open for keyword arguments to modify the meaning of the API call itself. N) constants) coroutines)events) exceptions)futures) protocols)sslproto) staggered)tasks) transports)trsock)logger) BaseEventLoopServerdg?AF_INET6iQc|j}tt|ddtjrt |jSt|S)N__self__) _callback isinstancegetattrr Taskreprrstr)handlecbs @/opt/alt/python-internal/lib64/python3.11/asyncio/base_events.py_format_handlerGsF  B'"j$//<<BK   6{{ch|tjkrdS|tjkrdSt|S)Nzz) subprocessPIPESTDOUTr)fds r _format_piper&Ps2 Z_x z zBxxr cttdstd |tjtjddS#t $rtdwxYw)N SO_REUSEPORTz)reuse_port not supported by socket modulerzTreuse_port not supported by socket module, SO_REUSEPORT defined but not implemented.)hasattrsocket ValueError setsockopt SOL_SOCKETr(OSErrorsocks r_set_reuseportr1Ys 6> * *JDEEE J OOF-v/BA F F F F F J J JIJJ J Js +AA-c ^ttdsdS|dtjtjhvs|dS|tjkr tj}n|tjkr tj}ndS|d}net |tr |dkrd}nGt |tr |dkrd}n) t|}n#ttf$rYdSwxYw|tj kr4tj g}tr|tjn|g}t |tr|d}d|vrdS|D]V} tj||tr|tjkr |||d||||ffcS|||d||ffcS#t&$rYSwxYwdS)N inet_ptonrr idna%)r)r* IPPROTO_TCP IPPROTO_UDP SOCK_STREAM SOCK_DGRAMrbytesrint TypeErrorr+ AF_UNSPECAF_INET _HAS_IPv6appendrdecoder3r.) hostportfamilytypeprotoflowinfoscopeidafsafs r _ipaddr_inforLds 6; ' ' Q*F,>??? Lt v!!!" " " ""t | D% TS[[ D#  42:: t99DD:&   44 !!!~  ( JJv ' ' 'h$#{{6"" d{{t     R & & & 9R6?224T47,KKKKK4T4L8888    D  4s*5CCC6FF F*)F*ctj}|D].}|d}||vrg||<|||/t|}g}|dkr4||dd|dz |dd|dz =|dt jt j |D|S)z-Interleave list of addrinfo tuples by family.rrNc3K|]}||V dSN).0as r z(_interleave_addrinfos..s0 ] ]]]r ) collections OrderedDictrAlistvaluesextend itertoolschain from_iterable zip_longest) addrinfosfirst_address_family_countaddrinfos_by_familyaddrrEaddrinfos_lists reordereds r_interleave_addrinfosrcs$&13311a , , ,*,  'F#**40000.557788OI!A%%+,K-G!-K,KLMMM A > :Q >> ? ?00  !? 3   r c|s2|}t|ttfrdSt j|dSrO) cancelled exceptionr SystemExitKeyboardInterruptr _get_loopstop)futexcs r_run_until_complete_cbrmsa ==??mmoo cJ(9: ; ;  F c!!!!!r TCP_NODELAYc|jtjtjhvrW|jtjkrD|jtjkr1|tjtj ddSdSdSdSNr) rEr*r?rrFr9rGr7r,rnr/s r _set_nodelayrqsn KFNFO< < < V/// f000 OOF.0BA F F F F F = <//00r cdSrOrPr/s rrqrqs r cjt)t|tjrtddSdS)Nz"Socket cannot be of type SSLSocket)sslr SSLSocketr=r/s r_check_ssl_socketrvs1 :dCM::<===r cDeZdZdZdZdZdZdZdZdZ dZ d Z d S) _SendfileFallbackProtocolct|tjstd||_||_||_|j |_ | | ||j r%|jj |_dSd|_dS)Nz.transport should be _FlowControlMixin instance)rr _FlowControlMixinr= _transport get_protocol_proto is_reading_should_resume_reading_protocol_paused_should_resume_writing pause_reading set_protocol_loop create_future_write_ready_fut)selftransps r__init__z"_SendfileFallbackProtocol.__init__s&*">?? NLMM M ))++ &,&7&7&9&9#&,&=#D!!!  & )$(O$9$G$G$I$ID ! ! !$(D ! ! !r cK|jrtd|j}|dS|d{VdS)NzConnection closed by peer)r{ is_closingConnectionErrorr)rrks rdrainz_SendfileFallbackProtocol.drainsR ? % % ' ' ?!"=>> ># ; F r c td)Nz?Invalid state: connection should have been established already. RuntimeError)r transports rconnection_madez)_SendfileFallbackProtocol.connection_madesNOO Or c|jD|(|jtdn|j||j|dS)NzConnection is closed by peer)r set_exceptionrr}connection_lost)rrls rrz)_SendfileFallbackProtocol.connection_lostsw  ,{%33#$BCCEEEE%33C888 ##C(((((r c^|jdS|jj|_dSrO)rr{rrrs r pause_writingz'_SendfileFallbackProtocol.pause_writings/  , F $ 5 C C E Er cZ|jdS|jdd|_dS)NF)r set_resultrs rresume_writingz(_SendfileFallbackProtocol.resume_writings5  ( F ((/// $r c tdNz'Invalid state: reading should be pausedr)rdatas r data_receivedz'_SendfileFallbackProtocol.data_receivedDEEEr c tdrrrs r eof_receivedz&_SendfileFallbackProtocol.eof_receivedrr c K|j|j|jr|j|j|j|jr|jdSdSrO) r{rr}rresume_readingrcancelrrrs rrestorez!_SendfileFallbackProtocol.restores $$T[111  & - O * * , , ,  ,  ! ( ( * * *  & ) K & & ( ( ( ( ( ) )r N) __name__ __module__ __qualname__rrrrrrrrrrPr rrxrxs ) ) )OOO ) ) )FFF %%% FFFFFF ) ) ) ) )r rxcpeZdZ ddZdZdZdZdZdZdZ d Z e d Z d Z d Zd ZdZdS)rNc||_||_d|_g|_||_||_||_||_||_d|_ d|_ dS)NrF) r_sockets _active_count_waiters_protocol_factory_backlog _ssl_context_ssl_handshake_timeout_ssl_shutdown_timeout_serving_serving_forever_fut)rloopsocketsprotocol_factory ssl_contextbacklogssl_handshake_timeoutssl_shutdown_timeouts rrzServer.__init__s[   !1 '&;#%9" $(!!!r c2d|jjd|jdS)N) __class__rrrs r__repr__zServer.__repr__#s"F4>*FFT\FFFFr c&|xjdz c_dSrp)rrs r_attachzServer._attach&s ar cz|xjdzc_|jdkr|j|dSdSdS)Nrr)rr_wakeuprs r_detachzServer._detach*sJ a   " "t}'< LLNNNNN # "'<'K|]}tj|VdSrO)rTransportSocket)rQss rrSz!Server.sockets..Ls-FF1V+A..FFFFFFr )rtuplers rrzServer.socketsHs. = 2FF FFFFFFr c8|j}|dSd|_|D]}|j|d|_|j9|js |jd|_|jdkr|dSdS)NFr) rr _stop_servingrrrrrr)rrr0s rclosez Server.closeNs- ? F  + +D J $ $T * * * *  % 1-2244 2  % , , . . .(,D %   " " LLNNNNN # "r cfK|tjdd{VdS)Nr)rr sleeprs r start_servingzServer.start_servingas@ k!nnr cK|jtd|d|jtd|d||j|_ |jd{VnH#t j$r6 || d{V#xYwwxYw d|_dS#d|_wxYw)Nzserver z, is already being awaited on serve_forever()z is closed) rrrrrrrCancelledErrorr wait_closedrs r serve_foreverzServer.serve_forevergs(  $ 0N$NNNPP P = ;;;;<< < $(J$<$<$>$>! -+ + + + + + + + +(     &&(((((((((   ,)-D % % %D % , , , ,s6* A87C 8B=.B76B=7B99B==C CcK|j|jdS|j}|j||d{VdSrO)rrrrrA)rrs rrzServer.wait_closed|sX = DM$9 F))++ V$$$ r rO)rrrrrrrrrrrpropertyrrrrrrPr rrrs>B ) ) ) )GGG    *** , , ,GGXG & ---*r rc JeZdZdZdZdZddddZdZdZd\ddd d Z d\d dddddd d dZ d]dZ d^dZ d^dZ d\dZdZdZdZdZdZdZdZdZdZdZdZdZdZd Zd!Zejfd"Z d#Z!d$Z"dd%d&Z#dd%d'Z$dd%d(Z%d)Z&d*Z'd+Z(dd%d,Z)d-Z*d.Z+d/Z,d0d0d0d0d1d2Z-d_d3Z.d`d d4d5Z/d6Z0d7Z1d8Z2d\d9Z3 d^dd0d0d0dddddddd: d;Z4 dad<Z5d`d d4d=Z6d>Z7d?Z8d dddd@dAZ9 d^d0d0d0ddddBdCZ:d0e;j<d0d0d1dDZ=dEZ> d^e;j?e;j@ddFdddddd dG dHZAddddIdJZBdKZCdLZDdMZEeFjGeFjGeFjGd d d0ddddN dOZHeFjGeFjGeFjGd d d0ddddN dPZIdQZJdRZKdSZLdTZMdUZNdVZOdWZPdXZQdYZRdZZSd[ZTdS)brcd|_d|_d|_tj|_g|_d|_d|_d|_ tj dj |_ d|_|t!jd|_d|_d|_d|_d|_t/j|_d|_d|_dS)NrF monotonicg?)_timer_cancelled_count_closed _stoppingrTdeque_ready _scheduled_default_executor _internal_fds _thread_idtimeget_clock_info resolution_clock_resolution_exception_handler set_debugr_is_debug_modeslow_callback_duration_current_handle _task_factory"_coroutine_origin_tracking_enabled&_coroutine_origin_tracking_saved_depthweakrefWeakSet _asyncgens_asyncgens_shutdown_called_executor_shutdown_calledrs rrzBaseEventLoop.__init__s&'# !')) !%!%!4[!A!A!L"& z022333'*##!27/6:3"/++*/').&&&r c d|jjd|d|d|d S)Nrz running=z closed=z debug=r)rr is_running is_closed get_debugrs rrzBaseEventLoop.__repr__sp C' C C$//2C2C C Cnn&& C C/3~~/?/? C C C r c,tj|S)z,Create a Future object attached to the loop.r)rFuturers rrzBaseEventLoop.create_futures~4((((r N)namecontextc||j(tj||||}|jr|jd=nF||||}n||||}tj|||S)zDSchedule a coroutine object. Return a task object. N)rrrr) _check_closedrr r_source_traceback_set_task_name)rcororrtasks r create_taskzBaseEventLoop.create_tasks    %:dD'JJJD% /*2.))$55))$g)FF  t , , , r cT|t|std||_dS)awSet a task factory that will be used by loop.create_task(). If factory is None the default task factory will be set. If factory is a callable, it should have a signature matching '(loop, coro)', where 'loop' will be a reference to the active event loop, 'coro' will be a coroutine object. The callable must return a Future. Nz'task factory must be a callable or None)callabler=r)rfactorys rset_task_factoryzBaseEventLoop.set_task_factorys4  x'8'8 EFF F$r c|jS)zz4BaseEventLoop.shutdown_asyncgens..)s 2 2 2bbiikk 2 2 2r return_exceptionsz;an error occurred during closing of asynchronous generator )messagerfasyncgen) rlenrrVclearr gatherzipr Exceptioncall_exception_handler)r closing_agensresultsresultrFs rshutdown_asyncgensz BaseEventLoop.shutdown_asyncgenss *.'4?##  FT_--   2 2M 2 2 2$"$$$$$$$$ 77  LFD&),, ++ B9= B B!' $ --  r cKd|_|jdS|}tj|j|f}| |d{V|dS#|wxYw)z.Schedule the shutdown of the default executor.TN)targetr1)rrr threadingThread _do_shutdownstartjoin)rfuturethreads rshutdown_default_executorz'BaseEventLoop.shutdown_default_executor5s)-&  ! ) F##%%!):&KKK  LLLLLLL KKMMMMMFKKMMMMs A66B c: |jd|s||jddSdS#t $r@}|s!||j|Yd}~dSYd}~dSd}~wwxYw)NTwait)rshutdownrrCrr[r)rrhexs rrezBaseEventLoop._do_shutdownBs D  " + + + 6 6 6>>## C))&*;TBBBBB C C D D D>>## D))&*>CCCCCCCCC D D D D D D DsA A B/BBc|rtdtjtddS)Nz"This event loop is already runningz7Cannot run the event loop while another loop is running)rrr_get_running_looprs r_check_runningzBaseEventLoop._check_runningKsS ??   ECDD D  # % % 1IKK K 2 1r c||||jt j} t j|_t j |j |j tj | ||jrn d|_d|_tj d|dt j |dS#d|_d|_tj d|dt j |wxYw)zRun until stop() is called.) firstiter finalizerTFN)r rr_set_coroutine_origin_tracking_debugsysget_asyncgen_hooksrc get_identrset_asyncgen_hooksrOrGr_set_running_loop _run_oncer)rold_agen_hookss r run_foreverzBaseEventLoop.run_foreverRsX   ++DK888/11 4'133DO  "T-J-1-J L L L L  $T * * *    > "DN"DO  $T * * *  / / 6 6 6  "N 3 3 3 3 #DN"DO  $T * * *  / / 6 6 6  "N 3 3 3sA*D AEc||tj| }t j||}|rd|_|t | nD#|r<| r(| s| xYw | tn#| twxYw| std|S)a\Run until the Future is done. If the argument is a coroutine, it is wrapped in a Task. WARNING: It would be disastrous to call run_until_complete() with the same coroutine twice -- it would wrap it in two different Tasks and that can't be good. Return the Future's result, or raise its exception. rFz+Event loop stopped before Future completed.)r rrrisfuturer ensure_future_log_destroy_pendingadd_done_callbackrmrrrerfremove_done_callbackrr_)rrhnew_tasks rrun_until_completez BaseEventLoop.run_until_completejsD  '///$V$777  0+0F '  !7888 @         #FKKMM #&2B2B2D2D #  """    ' '(> ? ? ? ?F ' '(> ? ? ? ?{{}} NLMM M}}s8B C- ACC--D cd|_dS)zStop running the event loop. Every callback already scheduled will still run. This simply informs run_forever to stop looping after a complete iteration. TN)rrs rrjzBaseEventLoop.stops r cf|rtd|jrdS|jrt jd|d|_|j|jd|_ |j }|d|_ | ddSdS)zClose the event loop. This clears the queues and shuts down the executor, but does not wait for the executor to finish. The event loop must not be running. z!Cannot close a running event loopNzClose %rTFrl) rrrrwrdebugrrXrrrrnrexecutors rrzBaseEventLoop.closes ??   DBCC C <  F ; + LT * * *   )-&)  %)D "   5  ) ) ) ) ) r c|jS)z*Returns True if the event loop was closed.)rrs rrzBaseEventLoop.is_closeds |r c|s@|d|t||s|dSdSdS)Nzunclosed event loop rI)rrMrr)r_warns r__del__zBaseEventLoop.__del__sk~~  E111?4 P P P P??$$      r c|jduS)z*Returns True if the event loop is running.N)rrs rrzBaseEventLoop.is_runningst+,r c(tjS)zReturn the time according to the event loop's clock. This is a float expressed in seconds since an epoch, but the epoch, precision, accuracy and drift are unspecified and may differ per event loop. )rrrs rrzBaseEventLoop.times~r r c|td|j||z|g|Rd|i}|jr|jd=|S)a;Arrange for a callback to be called at a given time. Return a Handle: an opaque object with a cancel() method that can be used to cancel the call. The delay can be an int or float, expressed in seconds. It is always relative to the current time. Each callback will be called exactly once. If two callbacks are scheduled for exactly the same time, it is undefined which will be called first. Any positional arguments after the callback will be passed to the callback when it is called. Nzdelay must not be Nonerr )r=call_atrr )rdelaycallbackrr1timers r call_laterzBaseEventLoop.call_latersp =455 5 TYY[[50(.T...%,..  " ,'+ r cB|td||jr*|||dt j|||||}|jr|jd=tj |j |d|_ |S)z|Like call_later(), but uses an absolute time. Absolute time corresponds to the event loop's time() method. Nzwhen cannot be Nonerr T) r=r rw _check_thread_check_callbackr TimerHandler heapqheappushr)rwhenrrr1rs rrzBaseEventLoop.call_ats <122 2  ; 6     9 5 5 5"44wGG  " ,'+ t... r c||jr*|||d||||}|jr|jd=|S)aTArrange for a callback to be called as soon as possible. This operates as a FIFO queue: callbacks are called in the order in which they are registered. Each callback will be called exactly once. Any positional arguments after the callback will be passed to the callback when it is called. call_soonr )r rwrr _call_soonr rrrr1rs rrzBaseEventLoop.call_soonsx  ; 8     ; 7 7 7499  # -(, r ctj|stj|rtd|dt |std|d|dS)Nzcoroutines cannot be used with z()z"a callable object was expected by z(), got )r iscoroutineiscoroutinefunctionr=r)rrmethods rrzBaseEventLoop._check_callbacks  "8 , , >.x88 ><&<<<>> >!! %$V$$$$%% % % %r ctj||||}|jr|jd=|j||S)Nr )rHandler rrA)rrr1rrs rrzBaseEventLoop._call_soon sHxtW==  # -(, 6""" r cr|jdStj}||jkrtddS)aoCheck that the current thread is the thread running the event loop. Non-thread-safe methods of this class make this assumption and will likely behave incorrectly when the assumption is violated. Should only be called when (self._debug == True). The caller is responsible for checking this condition for performance reasons. NzMNon-thread-safe operation invoked on an event loop other than the current one)rrcrzr)r thread_ids rrzBaseEventLoop._check_threadsK ? " F'))  ' ''(( ( ( 'r c||jr||d||||}|jr|jd=||S)z"Like call_soon(), but thread-safe.rCr )r rwrrr r:rs rrCz"BaseEventLoop.call_soon_threadsafe%sx  ; C  +A B B B499  # -(,  r c4||jr||d|D|j}||'t jd}||_t j|j |g|R|S)Nrun_in_executorasyncio)thread_name_prefixr) r rwrrr@ concurrentrThreadPoolExecutor wrap_futuresubmit)rrfuncr1s rrzBaseEventLoop.run_in_executor0s  ; :  '8 9 9 9  -H  ( ( * * *%-@@'0A*2&" HOD (4 ( ( (t555 5r cpt|tjjst d||_dS)Nz,executor must be ThreadPoolExecutor instance)rrrrr=rrs rset_default_executorz"BaseEventLoop.set_default_executor@s8(J$6$IJJ LJKK K!)r cH|d|g}|r|d||r|d||r|d||r|d|d|}tjd||}t j||||||} ||z } d|d | d zd d | }| |jkrtj|ntj|| S) N:zfamily=ztype=zproto=zflags=, zGet address info %szGetting address info z took g@@z.3fzms: ) rArgrrrr* getaddrinforinfo) rrCrDrErFrGflagsmsgt0addrinfodts r_getaddrinfo_debugz BaseEventLoop._getaddrinfo_debugEsY!!!!"  - JJ+++ , , ,  ) JJ't'' ( ( (  + JJ))) * * *  + JJ))) * * *iinn *C000 YY[[%dD&$uMM YY[[2 OcOOcOOO8OO , , , K     L   r rrErFrGrc K|jr|j}n tj}|d|||||||d{VSrO)rwrr*rr)rrCrDrErFrGr getaddr_funcs rrzBaseEventLoop.getaddrinfo]sr ; .2LL!-L)) ,dFD%HHHHHHHH Hr cVK|dtj||d{VSrO)rr* getnameinfo)rsockaddrrs rrzBaseEventLoop.getnameinfogsH)) &$h77777777 7r )fallbackchK|jr'|dkrtdt|||||| |||||d{VS#t j$r }|sYd}~nd}~wwxYw|||||d{VS)Nrzthe socket must be non-blocking) rw gettimeoutr+rv_check_sendfile_params_sock_sendfile_nativerSendfileNotAvailableError_sock_sendfile_fallback)rr0fileoffsetcountrrls r sock_sendfilezBaseEventLoop.sock_sendfileks9 ; @4??,,11>?? ?$ ##D$>>> 33D$4:ECCCCCCCC C3          11$28%AAAAAAAA AsA77BBBc<Ktjd|d|d)Nz-syscall sendfile is not available for socket z and file z combinationrrrr0rrrs rrz#BaseEventLoop._sock_sendfile_nativezs@2 -D - - - - -.. .r c|K|r|||rt|tjn tj}t |}d} |rt||z |}|dkrnft |d|}|d|j|d{V} | sn*|||d| d{V|| z }||dkr)t|dr|||zSSS#|dkr)t|dr|||zwwwxYw)NrTseek) rminr!SENDFILE_FALLBACK_READBUFFER_SIZE bytearray memoryviewrreadinto sock_sendallr)) rr0rrr blocksizebuf total_sentviewreads rrz%BaseEventLoop._sock_sendfile_fallbacks   IIf    FCyB C C C#E  ""  / # #EJ$6 B BI A~~!#z z2!11$ tLLLLLLLL''d5D5k:::::::::d"  #A~~'$"7"7~ &:-....~zA~~'$"7"7~ &:-....~s BD 2D;cdt|ddvrtd|jtjkstd|_t |t s"td||dkr"td|t |t s"td||dkr"td|dS)Nbmodez$file should be opened in binary modez+only SOCK_STREAM type sockets are supportedz+count must be a positive integer (got {!r})rz0offset must be a non-negative integer (got {!r})) rr+rFr*r9rr<r=formatrs rrz$BaseEventLoop._check_sendfile_paramss) gdFC00 0 0CDD DyF...JKK K  eS)) QAHHOOQQQzz AHHOOQQQ&#&& BII  A::BII  :r cKg}|j||\}}}}} d} tj|||} | d||D]\} }}}} | |kr | | n#t$rS} d| d| j}t | j|} || Yd} ~ d} ~ wwxYw|r|t d|d| | | d{V| dx}}S#t$r1} || | | d} ~ w| | xYw#dx}}wxYw)z$Create, bind and connect one socket.NrErFrGF*error while attempting to bind on address : z&no matching local address with family=z found) rAr* setblockingbindr.strerrorlowererrnopop sock_connectr)rr addr_infolocal_addr_infos my_exceptionsrEtype_rG_r(r0lfamilyladdrrlrs r _connect_sockzBaseEventLoop._connect_socks  -(((+4(ua$ .=U%HHHD   U # # #+/?YY+GQ1e&((  2 %((("2226',66"|113366 &ci55%,,S111111112%Y+//111%&W&W&W&WXXX##D'22 2 2 2 2 2 2 2*. -J      % % %   )- -J - - - -sO?D" A75D"7 CA C D"CA D"" E4,,EE44E77E=) rtrErGrr0 local_addrr!rrhappy_eyeballs_delay interleavec vK| |std| |r|std|} | |std| |std|t|| |d}|||td||f|tj||d{V}|st d | =| |tj||d{Vst d nd|rt ||}g| 5|D]1} |d{V}n#t $rY.wxYwn/tj fd |D| d{V\}}}|d D tdkrd td tfdDrd t d ddD#dwxYwn8|td|jtjkrtd||||| | | d{V\}}jr.|d}t'jd|||||||fS)aConnect to a TCP server. Create a streaming transport connection to a given internet host and port: socket family AF_INET or socket.AF_INET6 depending on host (or family if specified), socket type SOCK_STREAM. protocol_factory must be a callable returning a protocol instance. This method is a coroutine which will try to establish the connection in the background. When successful, the coroutine returns a (transport, protocol) pair. Nz+server_hostname is only meaningful with sslz:You must set server_hostname when using ssl without a host1ssl_handshake_timeout is only meaningful with ssl0ssl_shutdown_timeout is only meaningful with sslr8host/port and sock can not be specified at the same timerErFrGrr!getaddrinfo() returned empty listc3PK|] }tjj|V!dSrO) functoolspartialr)rQrr laddr_infosrs rrSz2BaseEventLoop.create_connection..5sR,,!&t'9'18[JJ,,,,,,r rcg|] }|D]}| SrPrP)rQsubrls rrSz3BaseEventLoop.create_connection..;s%GGGc3GGCcGGGGr rc3>K|]}t|kVdSrOr)rQrlmodels rrSz2BaseEventLoop.create_connection..Bs.GGSs3xx50GGGGGGr zMultiple exceptions: {}rc34K|]}t|VdSrOr )rQrls rrSz2BaseEventLoop.create_connection..Gs(%E%E3c#hh%E%E%E%E%E%Er z5host and port was not specified and no sock specified"A Stream Socket was expected, got )rrr*z%r connected to %s:%r: (%r, %r))r+rv_ensure_resolvedr*r9r.rcrr staggered_racerWrallrrgrF_create_connection_transportrwget_extra_inforr)rrrCrDrtrErGrr0rr!rrrrinfosrrrrrrr s` @@@rcreate_connectionzBaseEventLoop.create_connections&  &s &JKK K  "s " B "ABBB"O ,S ,CEE E +C +BDD D   d # # #  + 0BJ  t/ NPPP//t V'uE0NNNNNNNNE CABBB%$($9$9v+5d%:%,%,,,,,,, #G!"EFFFG#  A-eZ@@J#+ %!!H!%)%7%7&+&?&? ? ? ? ? ? ?"!!! !$-#;,,,,,,%*,,,)t $5$5$5555555 a |GGZGGG  &:!++(m+!$JqM 2 2GGGGJGGGGG0",Q-/&&?&F&F II%E%E*%E%E%EEE'G'GHHH"&J%%%%$| KMMMyF...!AAACCC%)$E$E "C"7!5%F%7%7777777 8 ; @++H55D L:tT9h @ @ @(""sD== E  E  BHH"c \K|d|}|} |r7t|trdn|} |||| | ||||} n|||| } | d{Vn#| xYw| |fS)NFr r!rr)rrrboolr&rr) rr0rrtr!r rrrrr%rs rrz*BaseEventLoop._create_connection_transportes ##%%##%%  L!+C!6!6?CJ00h F'&;%9 1;;II 33D(FKKI LLLLLLLL  OO    (""s BB'cK|rtdt|dtjj}|tjjurtd||tjjur> |||||d{VS#tj $r }|sYd}~nd}~wwxYw|std|| ||||d{VS)aSend a file to transport. Return the total number of bytes which were sent. The method uses high-performance os.sendfile if available. file must be a regular file object opened in binary mode. offset tells from where to start reading the file. If specified, count is the total number of bytes to transmit as opposed to sending the file until EOF is reached. File position is updated on return or also in case of error in which case file.tell() can be used to figure out the number of bytes which were sent. fallback set to True makes asyncio to manually read and send the file when the platform does not support the sendfile syscall (e.g. Windows or SSL socket on Unix). Raise SendfileNotAvailableError if the system does not support sendfile syscall and fallback is False. zTransport is closing_sendfile_compatiblez(sendfile is not supported for transport NzHfallback is disabled and native sendfile is not supported for transport ) rrrr _SendfileMode UNSUPPORTED TRY_NATIVE_sendfile_nativerr_sendfile_fallback)rrrrrrrrls rsendfilezBaseEventLoop.sendfiles0    ! ! 7566 6y"8 .:<< 9*6 6 6H9HHJJ J 9*5 5 5 !229d395BBBBBBBBB7     :9+499:: :,,Y-3U<<<<<<<< E88A Grc Kttdt|tjst d|t |ddst d|d|}tj||||||||d } | | | | | j |} | |j } |d{VnK#t$r>|| | wxYw| jS) zzUpgrade transport to TLS. Return a new transport that *protocol* should start using immediately. Nz"Python ssl module is not availablez@sslcontext is expected to be an instance of ssl.SSLContext, got _start_tls_compatibleFz transport z is not supported by start_tls())rrr")rtrr SSLContextr=rrr SSLProtocolrrrrr BaseExceptionrr_app_transport) rrrr%r r!rrr ssl_protocol conmade_cb resume_cbs r start_tlszBaseEventLoop.start_tlss ;CDD D*cn55 '&!&&'' 'y"95AA LJYJJJLL L##%%+ (J "7!5!& (((  !!!|,,,^^L$@)LL NN9#;<<  LLLLLLLL    OO                   **s 9DAE )rErGr reuse_portallow_broadcastr0c K| | jtjkrtd| s s |s|s|s|s|rZt |||||} dd| D} td| d| dd} ns s|d krtd ||fd ff} nttd r|tj krfD](}|$t|tstd )rd dvry tjtj jrtjn8#t$$rYn,t&$r }t)jd|Yd}~nd}~wwxYw||ffff} ni}d fdffD]\}}|t|t,rt/|dkstd|||tj|||d{V}|st'd|D]"\}}}}}||f}||vrddg||<||||<#fd|D} | stdg}| D]\\}}\}}d} d} tj|tj|} |rt5| |r+| tjtjd| dr| |r |s|| |d{V|} n\#t&$r0}| | |j!|Yd}~d}~w| | xYw|d |}|"}|#| || |}|j$r2rt)j%d||nt)j&d|| |d{Vn#| xYw||fS)zCreate datagram connection.Nz$A datagram socket was expected, got )r remote_addrrErGrr.r/rc3.K|]\}}||d|VdS)=NrP)rQkvs rrSz9BaseEventLoop.create_datagram_endpoint..s5$N$NDAqA$NZZAZZ$N$N$N$N$N$Nr zKsocket modifier keyword arguments can not be used when sock is specified. ()Frzunexpected address familyNNAF_UNIXzstring is expected)rz2Unable to check or remove stale UNIX socket %r: %rrz2-tuple is expectedrrcFg|]\}}r|dr|d||fS)rNrrP)rQkey addr_pairrr1s rrSz:BaseEventLoop.create_datagram_endpoint..BsU#E#E#E)7i'#E,5aL,@(-A-6q\-A)$-A-A-Ar zcan not get address informationrz@Datagram endpoint local_addr=%r remote_addr=%r created: (%r, %r)z2Datagram endpoint remote_addr=%r created: (%r, %r))'rFr*r9r+dictrgitemsrr)r8rrr=statS_ISSOCKosst_moderemoveFileNotFoundErrorr.rerrorrrWrr:r1r,r- SO_BROADCASTrrrrArr)rwrr)rrrr1rErGrr.r/r0optsproblemsr_addraddr_pairs_infor`err addr_infosidxrfamrpror(r<r local_addressremote_addressrlrrrs `` rcreate_datagram_endpointz&BaseEventLoop.create_datagram_endpointsO  yF... C4CCEEE =k = =# =', = ="1 =z{#)e'1,;=== 99$N$NDJJLL$N$N$NNN <08<<<===   U # # #FF2 H+2 HQ;;$%@AAA%+UO\#B"D++. H&.0H0H'5>>D' 40E0E''(<=== 6*Q-{"B"B 6=)<)<)DEE2Ij111,"666 &5%/666666666 &,UO%/$=$?#B #$j/A{3C!D;;IC' *4 7 7CCIINN"+,A"B"BB&*&;&; f6G"'u4'<'A'A!A!A!A!A!A!A %O")*M"N"NN7<;;3CCG#&*C"*4437, 33:JsOC00#E#E#E#E#E;E;K;K;M;M#E#E#E 'H$%FGGGJ6E $ $2&%0-!=%F,=ULLLD!-&t,,,&G"-v/BAGGG$$U+++!1 -000"0.J"&"3"3D."I"IIIIIIII!/E+++' %J%c********' !m###%%##%%11 (FF,, ; ? ? 0& YJJJJ (()X??? LLLLLLLL  OO    (""sC0?E00 F%< F%F  F%#B-M N#&NN#P''P>cK|dd\}}t|||||g|ddR} | | gS|||||||d{VS)Nr:r)rLr) rr(rErFrGrrrCrDrs rrzBaseEventLoop._ensure_resolvedsRaR[ dD$eJgabbkJJJ  6M))$V$05U*DDDDDDDD Dr cK|||f|tj||d{V}|std|d|S)N)rErFrrz getaddrinfo(z) returned empty list)rr*r9r.)rrCrDrErrs r_create_server_getaddrinfoz(BaseEventLoop._create_server_getaddrinfos++T4L171C27d,DDDDDDDD HFFFFGG G r r) rErr0rrt reuse_addressr.rrrc Kt|trtd| |td| |td|t |||td| t jdkotjdk} g}|dkrdg}n:t|tst|tj j s|g}n|}fd |D}tj|d{V}tt j|}d } |D]}|\}}}}} t'j|||}n5#t&j$r#jrt-jd |||d YTwxYw||| r+|t&jt&jd | rt9|t:rP|t&jkr@t?t&dr+|t&j t&j!d  |"|#tF$r}d|d|j$%}|j&tLj'krI|(|)jrt-j|Yd}~tG|j&|dd}~wwxYw|stGdd|Dd }|s|D]}|)n\#|s|D]}|)wwxYw|td|j*t&j+krtd||g}|D]}|,d t[||||| | }| r.|.tj/dd{Vjrt-j0d||S)a1Create a TCP server. The host parameter can be a string, in that case the TCP server is bound to host and port. The host parameter can also be a sequence of strings and in that case the TCP server is bound to all hosts of the sequence. If a host appears multiple times (possibly indirectly e.g. when hostnames resolve to the same IP address), the server is only bound once to that host. Return a Server object which can be used to stop the service. This method is a coroutine. z*ssl argument must be an SSLContext or NoneNrrrposixcygwinr4cBg|]}|S))rEr)rV)rQrCrErrDrs rrSz/BaseEventLoop.create_server..sG%%%11$V8=2??%%%r Fz:create_server() failed to create socket.socket(%r, %r, %r)Texc_info IPPROTO_IPV6rrz%could not bind on any address out of cg|] }|d S)rP)rQrs rrSz/BaseEventLoop.create_server..s%@%@%@$d1g%@%@%@r z)Neither host/port nor sock were specifiedrrz %r is serving)1rrr=r+rvrBrrxplatformrrTabcIterabler rYsetrYrZr[r*rFrwrwarningrAr,r- SO_REUSEADDRr1r@rr)r^ IPV6_V6ONLYrr.rrr EADDRNOTAVAILrrrFr9rrrrr)rrrCrDrErr0rrtrWr.rrrrhostsfsr completedresrKsocktyperG canonnamesarLrrs` ``` r create_serverzBaseEventLoop.create_servers-8 c4  JHII I ,CEE E + BDD D   d # # #  t/ NPPP$ "7 2 Os|x7O GrzzT3''  {'?@@ %%%%%%%#%%%B ,+++++++E 55e<<==EI2 % '@'@C9<6B%B!%}R5AA!<!!!;O"N,G+-xOOOO! !NN4((($J"-v/BDJJJ!-&t,,,".&/11#FN;;2(;(.(:(,... @ " " @ @ @ @#%""cl&8&8&:&:&: <9(;;;#KKMMM JJLLL#{4 &s 3 3 3$HHHH%ci554? @D!'%@%@%%@%@%@%@#CDDD!  % '%% !% '%% %%| !LMMMyF... !Nd!N!NOOOfG $ $D   U # # # #g'7W&;,..  !  ! ! # # #+a.. ; 1 K 0 0 0 sb4 L1EL1/F L1 F  B-L19IL1 K2A7K-L1K--K22#L11M)rtrrc zK|jtjkrtd|||std||std|t |||||dd||d{V\}}|jr,|d}tj d|||||fS) Nrrrr4T)r rrr*z%r handled: (%r, %r)) rFr*r9r+rvrrwrrr)rrr0rtrrrrs rconnect_accepted_socketz%BaseEventLoop.connect_accepted_socket"s! 9* * *J$JJKK K ,S ,CEE E +C +BDD D   d # # #$($E$E "C"7!5%F%7%7777777 8 ; L++H55D L/y( K K K(""r c K|}|}||||} |d{Vn#|xYw|jr)t jd|||||fS)Nz Read pipe %r connected: (%r, %r))rr-rrwrrfilenorrr,rrrs rconnect_read_pipezBaseEventLoop.connect_read_pipe@s##%%##%%2246JJ  LLLLLLLL  OO     ; = L; 8 = = =("" AAc K|}|}||||} |d{Vn#|xYw|jr)t jd|||||fS)Nz!Write pipe %r connected: (%r, %r))rr/rrwrrrtrus rconnect_write_pipez BaseEventLoop.connect_write_pipePs##%%##%%33D(FKK  LLLLLLLL  OO     ; = L< 8 = = =(""rwc|g}|%|dt||6|tjkr&|dt|nN|%|dt||%|dt|t jd|dS)Nzstdin=zstdout=stderr=zstdout=zstderr= )rAr&r"r$rrrg)rrr3r4r5rs r_log_subprocesszBaseEventLoop._log_subprocess`su   KK6e!4!466 7 7 7  &J,="="= KK?f)=)=?? @ @ @ @! rUrfr4z+Object created at (most recent call last): z+Handle created at (most recent call last): r r\)getrF __traceback__rr sortedrg traceback format_listrstriprrArrF) rrrUrfr] log_linesr<valuetbs rdefault_exception_handlerz'BaseEventLoop.default_exception_handlers++i(( :9GKK ,,  YI4KLHHH g - -$0$61$6 & 'I '?? 0 0C...CLE(((WWY2599::F$***WWY2599::F$U    ..u.. / / / / TYYy))H======r c|jP ||dS#ttf$rt$rt jddYdSwxYw |||dS#ttf$rt$rc} |d||dn7#ttf$rt$rt jddYn wxYwYd}~dSYd}~dSd}~wwxYw)aDCall the current event loop's exception handler. The context argument is a dict containing the following keys: - 'message': Error message; - 'exception' (optional): Exception object; - 'future' (optional): Future instance; - 'task' (optional): Task instance; - 'handle' (optional): Handle instance; - 'protocol' (optional): Protocol instance; - 'transport' (optional): Transport instance; - 'socket' (optional): Socket instance; - 'asyncgen' (optional): Asynchronous generator that caused the exception. New keys maybe introduced in the future. Note: do not overload this method in an event loop subclass. For custom exception handling, use the `set_exception_handler()` method. Nz&Exception in default exception handlerTr\z$Unhandled error in exception handler)rUrfrzeException in default exception handler while handling an unexpected error in custom exception handler)rrrgrhr(rrF)rrrls rr\z$BaseEventLoop.call_exception_handlers,  " * ,..w77777 12     , , , E&*,,,,,,,  , 0''g66666 12     0 0 0022#I%(#*44 #$56$000L"?+/0000000000000 0sE 1AAA11C/ B'&C*'1CC*CC**C/cL|js|j|dSdS)zAdd a Handle to _ready.N) _cancelledrrArrs r _add_callbackzBaseEventLoop._add_callback4s3  ' K  v & & & & & ' 'r cX|||dS)z6Like _add_callback() but called from a signal handler.N)rr:rs r_add_callback_signalsafez&BaseEventLoop._add_callback_signalsafe9s. 6""" r c8|jr|xjdz c_dSdS)z3Notification that a TimerHandle has been cancelled.rN)rrrs r_timer_handle_cancelledz%BaseEventLoop._timer_handle_cancelled>s1   -  ' '1 , ' ' ' ' - -r ct|j}|tkrf|j|z tkrSg}|jD]&}|jrd|_||'tj|||_d|_nb|jr[|jdjrI|xjdzc_tj |j}d|_|jr|jdjId}|j s|j rd}nQ|jrJ|jdj }ttd||z t }|j|}||d}||jz}|jrZ|jd}|j |krnAtj |j}d|_|j ||jZt|j }t+|D]} |j }|jr#|jr ||_|} ||| z } | |jkr#t7jdt;|| d|_#d|_wxYw|d}dS)zRun one full iteration of the event loop. This calls all currently ready callbacks, polls for I/O, schedules the resulting callbacks, and finally schedules 'call_later' callbacks. FrrNzExecuting %s took %.3f seconds)rWr_MIN_SCHEDULED_TIMER_HANDLESr%_MIN_CANCELLED_TIMER_HANDLES_FRACTIONrrArheapifyheappoprr_whenrmaxrMAXIMUM_SELECT_TIMEOUT _selectorselectr=rrangepopleftrwr_runrrrer) r sched_count new_scheduledrtimeoutrr<end_timentodoirrs rr}zBaseEventLoop._run_onceCs$/** 6 6 6  '+ 55 6 6M/ 1 1$1(-F%%!((0000 M- ( ( (+DO*+D ' '/ *doa&8&C *++q0++t77$)!/ *doa&8&C *  ; N$. NGG _ N?1%+D#a !3446LMMG^**733  Z((( 99;;!77o '_Q'F|x'']4?33F %F  K  v & & & o 'DK  u  A[((**F  {  0+1D(BKKMMMr)BT888'G'5f'='=rCCC,0D((4D(//// s A4K K ct|t|jkrdS|r7tj|_tjt jntj|j||_dSrO)rrrx#get_coroutine_origin_tracking_depthr#set_coroutine_origin_tracking_depthrDEBUG_STACK_DEPTHrenableds rrvz,BaseEventLoop._set_coroutine_origin_trackings ==D!HII I I F  =799  7  3+ - - - -  3; = = =3:///r c|jSrO)rwrs rrzBaseEventLoop.get_debugs {r cv||_|r||j|dSdSrO)rwrrCrvrs rrzBaseEventLoop.set_debugsG ??   T  % %d&I7 S S S S S T Tr rO)NNNr7)r)rN)FNN)Urrrrrrrrrrr&r)r-r/r8r:r=r r@rGrOr`rjrerrrrrjrrrKrLrrrrrrrrrrCrrrrrrrrrrrrr rrr-rSr*r9rrVr> AI_PASSIVErprrrvryr|r"r#rrrrrr\rrrr}rvrrrPr rrrs///<   ))))-d* % % %""""%)$""""" 9=" $t"&!%!% """""CG"""" @D(,"""" AE)-""""04"""" """"""777DDDGGG """2   DDDKKK4440$$$L***.%M ---   :>06:$26&%%%((("=A     555 *** 2"#!1HHHHH7777 A(, A A A A A...///4**.*.*.*.Z59G#14T"&!%!%$G#G#G#G#G#V*/"&!% ####8-<#'-<-<-<-<-<^111"""4%*(,.2-1 .+.+.+.+.+bEID#./q267;$ D#D#D#D#D#N'(f.@%&a D D D D D59I##"&!%IIIIIZ"&!% #####<### ### % % %&0_&0o&0o27%)1(,T "#"#"#"#"#J%/OJO%/_$)1'+Dt # # # # #D''' ***"0>0>0>d707070r'''  --- NNN` : : :TTTTTr r)rr)r)7__doc__rTcollections.abcconcurrent.futuresrrrrrYrBr*r@r"rcrrrxrKrrt ImportErrorr4rrrrrr r r r r rlogr__all__rrr)r@rrr&r1rLrcrmrqrvProtocolrxAbstractServerrAbstractEventLooprrPr rrsm       JJJJ CCC $ #),% GFJ ' ' #JJJ8888v,""" 76=!! GGGG    >>> A)A)A)A)A) 2A)A)A)HnnnnnV "nnnbeTeTeTeTeTF,eTeTeTeTeTsA AA__pycache__/subprocess.cpython-311.opt-2.pyc000064400000030365152533123130014613 0ustar00 !A?hdZddlZddlmZddlmZddlmZddlmZddlmZej Z ej Z ej Z Gd d ej ej ZGd d Zdddejfd ZdddejddZdS))create_subprocess_execcreate_subprocess_shellN)events) protocols)streams)tasks)loggercJeZdZ fdZdZdZdZdZdZdZ dZ xZ S) SubprocessStreamProtocolct|||_dx|_x|_|_d|_d|_g|_|j |_ dS)N)loopF) super__init___limitstdinstdoutstderr _transport_process_exited _pipe_fds_loop create_future _stdin_closed)selflimitr __class__s ?/opt/alt/python-internal/lib64/python3.11/asyncio/subprocess.pyrz!SubprocessStreamProtocol.__init__sl d### 155 5T[4;$!Z5577cD|jjg}|j|d|j|j|d|j|j|d|jdd|S)Nzstdin=zstdout=zstderr=z<{}> )r__name__rappendrrformatjoin)rinfos r__repr__z!SubprocessStreamProtocol.__repr__s'( : ! KK/// 0 0 0 ; " KK1$+11 2 2 2 ; " KK1$+11 2 2 2}}SXXd^^,,,rcJ||_|d}|Ytj|j|j|_|j||j d|d}|Ytj|j|j|_ |j ||j d|d}|$tj ||d|j|_ dSdS)Nrrrr)protocolreaderr) rget_pipe_transportr StreamReaderrrr set_transportrr#r StreamWriterr)r transportstdout_transportstderr_transportstdin_transports rconnection_madez(SubprocessStreamProtocol.connection_made(s,#$77::  '!.T[48J@@@DK K % %&6 7 7 7 N ! !! $ $ $$77::  '!.T[48J@@@DK K % %&6 7 7 7 N ! !! $ $ $#66q99  & -o7;5937:???DJJJ ' &rct|dkr|j}n|dkr|j}nd}|||dSdSNrr*)rr feed_data)rfddatar,s rpipe_data_receivedz+SubprocessStreamProtocol.pipe_data_received@sS 77[FF 1WW[FFF     T " " " " "  rc|dkrw|j}||||||jdn&|j|d|j_dS|dkr|j}n|dkr|j}nd}|,|| n||||j vr|j || dS)NrFrr*) rcloseconnection_lostr set_result set_exception_log_tracebackrrfeed_eofrremove_maybe_close_transport)rr9excpiper,s rpipe_connection_lostz-SubprocessStreamProtocol.pipe_connection_lostJs 77:D   % % %{"--d3333"005555:"1 F 77[FF 1WW[FFF  {!!!!$$S)))    N ! !" % % % ##%%%%%rc<d|_|dS)NT)rrDrs rprocess_exitedz'SubprocessStreamProtocol.process_exitedhs"# ##%%%%%rct|jdkr)|jr$|jd|_dSdSdS)Nr)lenrrrr=rIs rrDz/SubprocessStreamProtocol._maybe_close_transportlsL t~  ! # #(< # O ! ! # # #"DOOO $ # # #rc&||jur|jSdSN)rr)rstreams r_get_close_waiterz*SubprocessStreamProtocol._get_close_waiterqs TZ  % % r) r" __module__ __qualname__rr'r5r;rGrJrDrP __classcell__)rs@rr r s:88888---???0###&&&<&&&### &&&&&&&rr cbeZdZdZdZedZdZdZdZ dZ dZ d Z d Z d d Zd S)Processc||_||_||_|j|_|j|_|j|_||_dSrN)r _protocolrrrrget_pidpid)rr1r+rs rrzProcess.__init__wsI#! ^ o o $$&&rc2d|jjd|jdS)N)rr"rYrIs rr'zProcess.__repr__s"84>*88TX8888rc4|jSrN)rget_returncoderIs r returncodezProcess.returncodes--///rcFK |jd{VSrN)r_waitrIs rwaitz Process.waits/M_**,,,,,,,,,rc:|j|dSrN)r send_signal)rsignals rrdzProcess.send_signals ##F+++++rc8|jdSrN)r terminaterIs rrgzProcess.terminates !!#####rc8|jdSrN)rkillrIs rriz Process.kills rcK|j} |j||r#t jd|t ||jd{Vn6#ttf$r"}|rt jd||Yd}~nd}~wwxYw|rt jd||j dS)Nz%%r communicate: feed stdin (%s bytes)z%r communicate: stdin got %rz%r communicate: close stdin) r get_debugrwriter debugrLdrainBrokenPipeErrorConnectionResetErrorr=)rinputrmrEs r _feed_stdinzProcess._feed_stdins $$&& H J  U # # # O ;T3u::OOO*""$$ $ $ $ $ $ $ $ $!56 H H H H ;T3GGG  H  > L6 = = = sAA<<B/ B**B/c KdSrNrIs r_noopz Process._noops trcK|j|}|dkr|j}n|j}|jr |dkrdnd}t jd|||d{V}|jr |dkrdnd}t jd||| |S)Nr*rrrz%r communicate: read %sz%r communicate: close %s) rr-rrrrkr rmreadr=)rr9r1rOnameoutputs r _read_streamzProcess._read_streamsO66r:: 77[FF[F :   ! ! @!Qww88HD L2D$ ? ? ?{{}}$$$$$$ :   ! ! A!Qww88HD L3T4 @ @ @ rNcK|||}n|}|j|d}n|}|j|d}n|}t j|||d{V\}}}|d{V||fSr7)rrrurrzrr gatherrb)rrqrrrs r communicatezProcess.communicates  $$U++EEJJLLE ; "&&q))FFZZ\\F ; "&&q))FFZZ\\F&+l5&&&I&I I I I I I IvviikkrrN)r"rQrRrr'propertyr_rbrdrgrirrrurzr}rtrrrUrUvs'''99900X0---,,,$$$&"      rrUc Ktj  fd} j||f|||d|d{V\}}t|| S)Nc&tSNr)r r)srz)create_subprocess_shell..7e=A C C Crrrr)rget_running_loopsubprocess_shellrU) cmdrrrrkwdsprotocol_factoryr1r+rs ` @rrrs  " $ $DCCCCC 5 5 !!!!!Ix 9h - --r)rrrrc Ktj  fd} j||g|R|||d|d{V\}} t|| S)Nc&tSrrr)srrz(create_subprocess_exec..rrr)rrsubprocess_execrU) programrrrrargsrrr1r+rs ` @rrrs  " $ $DCCCCC 4 4!!!F !! !!Ix 9h - --r)__all__ subprocessrrrr logr PIPESTDOUTDEVNULLFlowControlMixinSubprocessProtocolr rU_DEFAULT_LIMITrrrtrrrsK =    b&b&b&b&b&w7(;b&b&b&JT T T T T T T T n.2$t(/(> . . . .8(000  s  %%ceZdZdZdfd ZfdZdZdZdZdZ d Z dd Z dd Z dd Z d Z ddddddddZ dddddddddZdZdZdZdZxZS)_UnixSelectorEventLoopzdUnix event loop. Adds signal handling and UNIX Domain Socket support to SelectorEventLoop. NcXt|i|_dSr )super__init___signal_handlers)selfselector __class__s rr)z_UnixSelectorEventLoop.__init__?s) """ "rcNttjs.t |jD]}||dS|jr;tjd|dt||j dSdS)NzClosing the loop z@ on interpreter shutdown stage, skipping signal handlers removalsource) r(closesys is_finalizinglistr*remove_signal_handlerwarningswarnResourceWarningclear)r+sigr-s rr1z_UnixSelectorEventLoop.closeCs   "" .D122 0 0**3//// 0 0$ . I$III.%) ++++ %++-----  . .rc@|D]}|s||dSr )_handle_signal)r+datars r_process_self_dataz)_UnixSelectorEventLoop._process_self_dataQs= ( (F     ' ' ' '  ( (rcRtj|stj|rtd||| t j|j n5#ttf$r!}tt|d}~wwxYwtj|||d}||j|< t j|t"t j|ddS#t$r}|j|=|jsI t jdn3#ttf$r}t'jd|Yd}~nd}~wwxYw|jt*jkrtd|dd}~wwxYw)zAdd a handler for a signal. UNIX only. Raise ValueError if the signal number is invalid or uncatchable. Raise RuntimeError if there is a problem setting up the handler. z3coroutines cannot be used with add_signal_handler()NFset_wakeup_fd(-1) failed: %ssig  cannot be caught)r iscoroutineiscoroutinefunction TypeError _check_signal _check_closedsignal set_wakeup_fd_csockfilenor#OSError RuntimeErrorstrrHandler*r siginterruptrinfoerrnoEINVAL)r+r:callbackargsexchandlenexcs radd_signal_handlerz)_UnixSelectorEventLoop.add_signal_handlerXs  "8 , , 9.x88 9899 9 3  )  !3!3!5!5 6 6 6 6G$ ) ) )s3xx(( ( )xtT::%+c"  M#/ 0 0 0  U + + + + +   %c*( FF(,,,,"G,FFFK >EEEEEEEEFyEL(("#@##@#@#@AAA sZ"+BCB;;C%/D F& F!0EF!E5E0+F!0E55,F!!F&c|j|}|dS|jr||dS||dS)z2Internal helper that is the actual signal handler.N)r*get _cancelledr5_add_callback_signalsafe)r+r:rXs rr<z%_UnixSelectorEventLoop._handle_signalsa&**3// > F   2  & &s + + + + +  ) )& 1 1 1 1 1rc|| |j|=n#t$rYdSwxYw|tjkr tj}n tj} tj||n;#t$r.}|jtj krtd|dd}~wwxYw|jsI tj dn3#ttf$r}tjd|Yd}~nd}~wwxYwdS)zwRemove a handler for a signal. UNIX only. Return True if a signal handler was removed, False if not. FrBrCNr@rAT)rGr*KeyErrorrISIGINTdefault_int_handlerSIG_DFLrMrSrTrNrJr#rrR)r+r:handlerrWs rr5z,_UnixSelectorEventLoop.remove_signal_handlersK 3 %c**   55  &-  0GGnG  M#w ' ' ' '   yEL(("#@##@#@#@AAA   $ A A$R((((( A A A :C@@@@@@@@ Ats< ..A11 B);)B$$B)4C C9C44C9ct|tstd||tjvrt d|dS)zInternal helper to validate a signal. Raise ValueError if the signal number is invalid or uncatchable. Raise RuntimeError if there is a problem setting up the handler. zsig must be an int, not zinvalid signal number N) isinstanceintrFrI valid_signalsr#)r+r:s rrGz$_UnixSelectorEventLoop._check_signalsa #s## @>s>>?? ? f*,, , ,;c;;<< < - ,rc(t|||||Sr )_UnixReadPipeTransportr+pipeprotocolwaiterextras r_make_read_pipe_transportz0_UnixSelectorEventLoop._make_read_pipe_transports%dD(FEJJJrc(t|||||Sr )_UnixWritePipeTransportrks r_make_write_pipe_transportz1_UnixSelectorEventLoop._make_write_pipe_transports&tT8VUKKKrc Ktj5} | std|} t ||||||||f| |d| } | | |j|  | d{VnN#ttf$rt$r0| | d{VwxYw dddn #1swxYwY| S)NzRasyncio.get_child_watcher() is not activated, subprocess support is not installed.)rnro)rget_child_watcher is_activerN create_future_UnixSubprocessTransportadd_child_handlerget_pid_child_watcher_callback SystemExitKeyboardInterrupt BaseExceptionr1_wait) r+rmrVshellstdinstdoutstderrbufsizerokwargswatcherrntransps r_make_subprocess_transportz1_UnixSelectorEventLoop._make_subprocess_transports % ' ' 7$$&& K #$JKKK''))F-dHdE.3VVW85;5881788F  % %fnn&6&6&*&BF L L L   12        llnn$$$$$$$ #               2 s+A=C8BC8A C((C88C<?C<cH||j|j|dSr )call_soon_threadsafe call_soon_process_exited)r+pid returncoders rr{z._UnixSelectorEventLoop._child_watcher_callbacks% !!$.&2H*UUUUUr)sslsockserver_hostnamessl_handshake_timeoutssl_shutdown_timeoutcK|r|tdn3|td|td|td||tdtj|}tjtjtjd} |d|||d{Vn|#|xYw|td|j tjks|j tjkrtd ||d| |||||| d{V\}} || fS) Nz/you have to pass server_hostname when using sslz+server_hostname is only meaningful with ssl1ssl_handshake_timeout is only meaningful with ssl0ssl_shutdown_timeout is only meaningful with ssl3path and sock can not be specified at the same timerFzno path and sock were specified.A UNIX Domain Stream Socket was expected, got )rr) r#r!fspathsocketAF_UNIX SOCK_STREAM setblocking sock_connectr1familytype_create_connection_transport) r+protocol_factorypathrrrrr transportrms rcreate_unix_connectionz-_UnixSelectorEventLoop.create_unix_connections  H& EGGG'* !NOOO$0 GIII#/ FHHH   IKKK9T??D=1CQGGD   '''''d3333333333  | !BCCC v~--I!333 MTMMOOO   U # # #$($E$E "C"7!5%F%7%7777777 8(""s 1CC%dT)rbacklogrrr start_servingc Kt|trtd||std||std|Z|tdt j|}t jt jt j}|ddvry tj t j |j rt j |n8#t$rYn,t$r } tjd|| Yd} ~ nd} ~ wwxYw ||n#t$rP} || jt&jkr!d|d } tt&j| dd} ~ w|xYw|td |jt jks|jt jkrtd ||d t1j||g|||||} |r.| t7jdd{V| S) Nz*ssl argument must be an SSLContext or Nonerrrr)rz2Unable to check or remove stale UNIX socket %r: %rzAddress z is already in usez-path was not specified, and no sock specifiedrF)rfboolrFr#r!rrrrstatS_ISSOCKst_moderemoveFileNotFoundErrorrMrerrorbindr1rS EADDRINUSErrrrServer_start_servingr sleep) r+rrrrrrrrerrrWmsgservers rcreate_unix_serverz)_UnixSelectorEventLoop.create_unix_servers c4  JHII I ,S ,CEE E +C +BDD D   IKKK9T??D=1CDDDAwk))6}RWT]]%:;;( $(D666L"*+/666666666  $    9 000@T???C!%"2C88dB  | CEEE v~--I!333 MTMMOOO #D4&2B$'2G$8::  !  ! ! # # #+a..  s7)?C)) D5 D>DD"D88 F'A F  F'c K tjn"#t$rtjdwxYw |}n2#tt jf$r}tjdd}~wwxYw tj|j }n"#t$rtjdwxYw|r|n|}|sdS| } | | d|||||d| d{VS)Nzos.sendfile() is not availableznot a regular filer) r!sendfileAttributeErrorr SendfileNotAvailableErrorrLioUnsupportedOperationfstatst_sizerMrw_sock_sendfile_native_impl) r+rfileoffsetcountrLrfsize blocksizefuts r_sock_sendfile_nativez,_UnixSelectorEventLoop._sock_sendfile_native`sN 2 KKK 2 2 26022 2 2 M[[]]FF 78 M M M67KLL L M MHV$$,EE M M M67KLL L M"-EE  1  "" ''T4(.y! E E Eyyyyyys+ 0A A8A33A8<BB5c L|} ||||r||||dS|r9||z }|dkr.||||||dS t j| |||} | dkr.||||||dS|| z }|| z }|||||| |j || |||||| dS#ttf$r?|||||| |j || |||||| YdSt$r} |N| j tjkr9t| t ur#t!dtj} | | _| } |dkrAt%jd} |||||| n2|||||| Yd} ~ dSYd} ~ dSd} ~ wt*t,f$rt.$r7} |||||| Yd} ~ dSd} ~ wwxYw)Nrzsocket is not connectedzos.sendfile call failed)rL remove_writer cancelled_sock_sendfile_update_filepos set_resultr!r_sock_add_cancellation_callback add_writerrBlockingIOErrorInterruptedErrorrMrSENOTCONNrConnectionError __cause__r r set_exceptionr|r}r~)r+r registered_fdrrLrrr total_sentfdsentrWnew_excrs rrz1_UnixSelectorEventLoop._sock_sendfile_native_implwsb [[]]  $   } - - - ==??   . .vvz J J J F   *IA~~2266:NNNz***1 F;r669==DJqyy2266:NNNz*****$d"  (88dCCCD$CS "D& &y*FFFFF[ !12 B B B$44S$??? OOB ?f"E9j B B B B B B ' ' ')I//II_44 *-u~??$'!Q !:-//2266:NNN!!#&&&&2266:NNN!!#&&&&&&&&&'&&&&&-.     # # #  . .vvz J J J   c " " " " " " " " " #s,D''A J#6 J#?CIJ#,,JJ#cV|dkr"tj||tjdSdSNr)r!lseekSEEK_SET)r+rLrrs rrz4_UnixSelectorEventLoop._sock_sendfile_update_fileposs. >> HVVR[ 1 1 1 1 1 >rc@fd}||dS)Nc|r1}|dkr|dSdSdS)Nr@)rrLr)rrr+rs rcbzB_UnixSelectorEventLoop._sock_add_cancellation_callback..cbsR}} +[[]]88&&r***** + +8r)add_done_callback)r+rrrs` ` rrz6_UnixSelectorEventLoop._sock_add_cancellation_callbacks> + + + + + + b!!!!!rr NN)__name__ __module__ __qualname____doc__r)r1r>rZr<r5rGrprsrr{rrrrrr __classcell__r-s@rr&r&9s ###### . . . . .(((+++Z222@ = = =@D(,KKKKAE)-LLLL 04<VVV *.0#4 "&!% 0#0#0#0#0#f*.Gs"&!% GGGGGR.DFDFDFL222"""""""rr&ceZdZdZdfd ZdZdZdZdZdZ d Z d Z d Z d Z d ZejfdZddZdZdZxZS)rjiNct|||jd<||_||_||_||_d|_d|_ tj |jj }tj|sLtj|s8tj|s$d|_d|_d|_t#dtj|jd|j|jj||j|j|j|j|(|jt.j|ddSdS)NrlFz)Pipe transport is for pipes/sockets only.)r(r)_extra_loop_piperL_fileno _protocol_closing_pausedr!rrrS_ISFIFOrS_ISCHRr# set_blockingrconnection_made _add_reader _read_readyr _set_result_unless_cancelled)r+looprlrmrnromoder-s rr)z_UnixReadPipeTransport.__init__sb " F  {{}} !  x %%- d## J d## J T"" JDJDL!DNHII I  e,,, T^;TBBB T-!\4+; = = =   J !E!' / / / / /  rch|sdS|j||dSr ) is_readingrr)r+rrUs rrz"_UnixReadPipeTransport._add_readers7    F r8,,,,,rc"|j o|j Sr )rrr+s rrz!_UnixReadPipeTransport.is_readings<5 $55rc`|jjg}|j|dn|jr|d|d|jt |jdd}|jU|Stj ||jtj }|r|dnH|dn2|j|dn|dd d |S) Nclosedclosingfd= _selectorpollingidleopen<{}> )r-rrappendrrgetattrrr _test_selector_event selectors EVENT_READformatjoin)r+rRr,rs r__repr__z_UnixReadPipeTransport.__repr__s '( :  KK ! ! ! ! ] # KK " " " ($,(()))4:{D99 : !h&:%:$, (<>>G $ I&&&& F#### Z # KK     KK ! ! !}}SXXd^^,,,rc4 tj|j|j}|r|j|dS|jrtj d|d|_ |j |j|j |jj |j |jddS#tt f$rYdSt"$r!}||dYd}~dSd}~wwxYw)N%r was closed by peerTz"Fatal read error on pipe transport)r!readrmax_sizer data_receivedr get_debugrrRr_remove_readerr eof_received_call_connection_lostrrrM _fatal_error)r+r=rWs rrz"_UnixReadPipeTransport._read_ready s5 G74<77D  G,,T22222:''))?K 7>>> $  ))$,777 $$T^%@AAA $$T%?FFFFF !12    DD I I I   c#G H H H H H H H H H IsCD- D6DDc|sdSd|_|j|j|jrt jd|dSdS)NTz%r pauses reading)rrrrrrrdebugrs r pause_readingz$_UnixReadPipeTransport.pause_readingsq    F  !!$,/// :   ! ! 4 L,d 3 3 3 3 3 4 4rc|js|jsdSd|_|j|j|j|jrtjd|dSdS)NFz%r resumes reading) rrrrrrrrrrs rresume_readingz%_UnixReadPipeTransport.resume_reading#sw =    F  t|T-=>>> :   ! ! 5 L-t 4 4 4 4 4 5 5rc||_dSr rr+rms r set_protocolz#_UnixReadPipeTransport.set_protocol+ !rc|jSr r$rs r get_protocolz#_UnixReadPipeTransport.get_protocol. ~rc|jSr rrs r is_closingz!_UnixReadPipeTransport.is_closing1 }rcB|js|ddSdSr )r_closers rr1z_UnixReadPipeTransport.close4s.}  KK       rcv|j1|d|t||jdSdSNzunclosed transport r/rr8r1r+_warns r__del__z_UnixReadPipeTransport.__del__8L : ! E000/$ O O O O J        " !rFatal error on pipe transportc0t|trG|jtjkr2|jrt jd||dn$|j||||j d| |dSNz%r: %sTexc_info)message exceptionrrm) rfrMrSEIOrrrrcall_exception_handlerrr0r+rWr=s rrz#_UnixReadPipeTransport._fatal_error=s sG $ $ ei)?)?z##%% E XtWtDDDD J - -" ! N //    Crcd|_|j|j|j|j|dSNT)rrrrrrr+rWs rr0z_UnixReadPipeTransport._closeKsB  !!$,/// T7=====rc |j||jd|_d|_d|_dS#|jd|_d|_d|_wxYwr rconnection_lostrr1rrDs rrz,_UnixReadPipeTransport._call_connection_lostP  N * *3 / / / J     DJ!DNDJJJ J     DJ!DNDJ     A 0A<rr8)rrrrr)rrrrr r"r&r)r-r1r6r7r6rr0rrrs@rrjrjs(H//////<--- 666---*GGG$444555"""%M    >>> rrjceZdZdfd ZdZdZdZdZdZdZ d Z d Z d Z d Z d ZejfdZdZddZddZdZxZS)rrNcpt||||jd<||_||_||_t|_d|_ d|_ tj |jj }tj|}tj|}tj|} |s(|s&| s$d|_d|_d|_t%dtj|jd|j|jj|| s!|rOt.jds0|j|jj|j|j|(|jt8j|ddSdS)NrlrFz?Pipe transport is only for pipes, sockets and character devicesaix)r(r)rrrLrr bytearray_buffer _conn_lostrr!rrrrrrr#rrrrr2platform startswithrrr r) r+rrlrmrnroris_charis_fifo is_socketr-s rr)z _UnixWritePipeTransport.__init__]s %%%" F {{}} ! {{  x %%-,t$$-%%M$''  E7 Ei EDJDL!DNDEE E  e,,, T^;TBBB  A A)@)@)G)G A J !7!%t/? A A A   J !E!' / / / / /  rc|jjg}|j|dn|jr|d|d|jt |jdd}|j|tj ||jtj }|r|dn|d| }|d|n2|j|dn|dd d |S) Nrrrrrrzbufsize=r r r )r-rrr rrr rr rr EVENT_WRITEget_write_buffer_sizerr)r+rRr,rrs rrz _UnixWritePipeTransport.__repr__sL'( :  KK ! ! ! ! ] # KK " " " ($,(()))4:{D99 : !h&:%:$, (=??G $ I&&&& F###0022G KK,7,, - - - - Z # KK     KK ! ! !}}SXXd^^,,,rc*t|jSr )lenrOrs rrXz-_UnixWritePipeTransport.get_write_buffer_sizes4<   rc|jrtjd||jr#|t dS|dS)Nr)rrrrRrOr0BrokenPipeErrorrs rrz#_UnixWritePipeTransport._read_readysd :   ! ! 7 K/ 6 6 6 <  KK)) * * * * * KKMMMMMrct|trt|}|sdS|js|jr;|jt jkrtjd|xjdz c_dS|j s tj |j |}nc#ttf$rd}YnNtt f$rt"$r1}|xjdz c_||dYd}~dSd}~wwxYw|t'|krdS|dkrt||d}|j|j |j|xj |z c_ |dS)Nz=pipe closed by peer or os.write(pipe, data) raised exception.rr#Fatal write error on pipe transport)rfrN memoryviewrPrr!LOG_THRESHOLD_FOR_CONNLOST_WRITESrwarningrOr!writerrrr|r}r~rrZr _add_writer _write_ready_maybe_pause_protocol)r+r=nrWs rrbz_UnixWritePipeTransport.writes dI & & $d##D  F ? dm )"MMM HIII OOq OO F| D HT\400#%56    12       1$!!#'LMMM CII~~Q!$''+ J " "4<1B C C C   ""$$$$$s:BC5*C5&C00C5c tj|j|j}|t |jkr|j|j|j||j r4|j |j| ddS|dkr |jd|=dSdS#ttf$rYdSttf$rt $ri}|j|xjdz c_|j|j||dYd}~dSd}~wwxYw)Nrrr^)r!rbrrOrZr9r_remove_writer_maybe_resume_protocolrrrrrr|r}r~rPr)r+rfrWs rrdz$_UnixWritePipeTransport._write_readys %t|44AC %%%% ""$$$ ))$,777++---=5J--dl;;;..t444QL!$$$) !12    DD-.     J J J L   OOq OO J % %dl 3 3 3   c#H I I I I I I I I I  JsCE-*E-AE((E-cdSrCrrs r can_write_eofz%_UnixWritePipeTransport.can_write_eoftrc|jrdSd|_|jsA|j|j|j|jddSdSrC)rrOrrrrrrs r write_eofz!_UnixWritePipeTransport.write_eofsh =  F | C J % %dl 3 3 3 J !;T B B B B B C Crc||_dSr r$r%s rr&z$_UnixWritePipeTransport.set_protocolr'rc|jSr r$rs rr)z$_UnixWritePipeTransport.get_protocolr*rc|jSr r,rs rr-z"_UnixWritePipeTransport.is_closingr.rcR|j|js|dSdSdSr )rrrnrs rr1z_UnixWritePipeTransport.closes5 : !$- ! NN      " ! ! !rcv|j1|d|t||jdSdSr2r3r4s rr6z_UnixWritePipeTransport.__del__r7rc0|ddSr )r0rs rabortz_UnixWritePipeTransport.aborts Drr8ct|tr2|jrt jd||dn$|j||||jd||dSr:) rfrMrrrrr@rr0rAs rrz$_UnixWritePipeTransport._fatal_errors c7 # # z##%% E XtWtDDDD J - -" ! N //    Crcd|_|jr|j|j|j|j|j|j|j|dSrC) rrOrrhrr9rrrrDs rr0z_UnixWritePipeTransport._closesx < 4 J % %dl 3 3 3  !!$,/// T7=====rc |j||jd|_d|_d|_dS#|jd|_d|_d|_wxYwr rFrDs rrz-_UnixWritePipeTransport._call_connection_lostrHrIrrJr )rrrr)rrXrrbrdrkrnr&r)r-r1r6r7r6rurr0rrrs@rrrrrZsH#/#/#/#/#/#/J---0!!!!%!%!%F%%%8CCC""" %M     >>>>rrrceZdZdZdS)rxc d}|tjkr5tjdrt j\}} tj|f||||d|d||_|D| t| d||j_ d}|*| | dSdS#|)| | wwxYw)NrMF)rrrruniversal_newlinesrwb) buffering) subprocessPIPEr2rQrRr socketpairPopen_procr1r detachr) r+rVrrrrrrstdin_ws r_startz_UnixSubprocessTransport._start)s JO # # (?(?(F(F # $.00NE7 #)E!vf#('EE=CEEDJ" #'(8(8$'#R#R#R  "  #"w"  #s A$C-DN)rrrrrrrrxrx's#     rrxc<eZdZdZdZdZdZdZdZdZ dZ d S) raHAbstract base class for monitoring child processes. Objects derived from this class monitor a collection of subprocesses and report their termination or interruption by a signal. New callbacks are registered with .add_child_handler(). Starting a new process must be done within a 'with' block to allow the watcher to suspend its activity until the new process if fully registered (this is needed to prevent a race condition in some implementations). Example: with watcher: proc = subprocess.Popen("sleep 1") watcher.add_child_handler(proc.pid, callback) Notes: Implementations of this class must be thread-safe. Since child watcher objects may catch the SIGCHLD signal and call waitpid(-1), there should be only one active object per process. ct)aRegister a new child handler. Arrange for callback(pid, returncode, *args) to be called when process 'pid' terminates. Specifying another callback for the same process replaces the previous handler. Note: callback() must be thread-safe. NotImplementedErrorr+rrUrVs rryz&AbstractChildWatcher.add_child_handlerVs"###rct)zRemoves the handler for process 'pid'. The function returns True if the handler was successfully removed, False if there was nothing to remove.rr+rs rremove_child_handlerz)AbstractChildWatcher.remove_child_handleras "###rct)zAttach the watcher to an event loop. If the watcher was previously attached to an event loop, then it is first detached before attaching to the new loop. Note: loop may be None. rr+rs r attach_loopz AbstractChildWatcher.attach_loopis"###rct)zlClose the watcher. This must be called to make sure that any underlying resource is freed. rrs rr1zAbstractChildWatcher.closess "###rct)zReturn ``True`` if the watcher is active and is used by the event loop. Return True if the watcher is installed and ready to handle process exit notifications. rrs rrvzAbstractChildWatcher.is_activezs"###rct)zdEnter the watcher's context and allow starting new processes This function must return selfrrs r __enter__zAbstractChildWatcher.__enter__s"###rct)zExit the watcher's contextrr+abcs r__exit__zAbstractChildWatcher.__exit__s!###rN) rrrrryrrr1rvrrrrrrr?s, $ $ $$$$$$$$$$$$$$$$ $$$$$rrcHeZdZdZdZdZdZdZdZdZ dZ d Z d Z d S) ra6Child watcher implementation using Linux's pid file descriptors. This child watcher polls process file descriptors (pidfds) to await child process termination. In some respects, PidfdChildWatcher is a "Goldilocks" child watcher implementation. It doesn't require signals or threads, doesn't interfere with any processes launched outside the event loop, and scales linearly with the number of subprocesses launched by the event loop. The main disadvantage is that pidfds are specific to Linux, and only work on recent (5.3+) kernels. c"d|_i|_dSr r _callbacksrs rr)zPidfdChildWatcher.__init__ rc|Sr rrs rrzPidfdChildWatcher.__enter__ rcdSr r)r+exc_type exc_value exc_tracebacks rrzPidfdChildWatcher.__exit__ rcF|jduo|jSr r is_runningrs rrvzPidfdChildWatcher.is_active"z%A$**?*?*A*AArc0|ddSr rrs rr1zPidfdChildWatcher.close rc6|j#|!|jrtjdt|jD]4\}}}|j|tj|5|j ||_dSNzCA loop is being detached from a child watcher with pending handlers) rrr6r7RuntimeWarningvaluesrr!r1r9)r+rpidfd_s rrzPidfdChildWatcher.attach_loops : !dltl M=    ?1133  KE1a J % %e , , , HUOOOO  rc|j|}||d||f|j|<dStj|}|j||j||||f|j|<dSr)rr\r! pidfd_openrr_do_wait)r+rrUrVexistingrs rryz#PidfdChildWatcher.add_child_handlers~?&&s++  #+A;$#>DOC M#&&E J " "5$- = = =#((D#8DOC rcR|j|\}}}|j| t j|d\}}t |}n'#t$rd}tj d|YnwxYwt j ||||g|RdS)NrzJchild process pid %d exit status already read: will report returncode 255) rpoprrr!waitpidr"ChildProcessErrorrrar1)r+rrrUrVrr$rs rrzPidfdChildWatcher._do_waits $ 3 3C 8 8x !!%((( 8 3**IAv077JJ!   J N.        j(4((((((sA""!BBc |j|\}}}n#t$rYdSwxYw|j|t j|dS)NFT)rrr`rrr!r1)r+rrrs rrz&PidfdChildWatcher.remove_child_handlersn /--c22KE1aa   55  !!%((( ts ! //N) rrrrr)rrrvr1rryrrrrrrrs     BBB   999)))&rrc8eZdZdZdZdZdZdZdZdZ dS) BaseChildWatcherc"d|_i|_dSr rrs rr)zBaseChildWatcher.__init__rrc0|ddSr rrs rr1zBaseChildWatcher.closerrcF|jduo|jSr rrs rrvzBaseChildWatcher.is_activerrctr r)r+ expected_pids r _do_waitpidzBaseChildWatcher._do_waitpid!###rctr rrs r_do_waitpid_allz BaseChildWatcher._do_waitpid_allrrc8|j#|!|jrtjdt|j$|jt j||_|;|t j|j | dSdSr) rrr6r7rr5rISIGCHLDrZ _sig_chldrrs rrzBaseChildWatcher.attach_loops : !dltl M=   : ! J , ,V^ < < <    # #FNDN C C C  " " " " "  rc |dS#ttf$rt$r(}|jd|dYd}~dSd}~wwxYw)N$Unknown exception in SIGCHLD handler)r=r>)rr|r}r~rr@rDs rrzBaseChildWatcher._sig_chlds   " " " " "-.        J - -A //           sAAAN) rrrr)r1rvrrrrrrrrrsBBB$$$$$$###(     rrcFeZdZdZfdZdZdZdZdZdZ dZ xZ S) rad'Safe' child watcher implementation. This implementation avoids disrupting other code spawning processes by polling explicitly each process in the SIGCHLD handler instead of calling os.waitpid(-1). This is a safe solution but it has a significant overhead when handling a big number of children (O(n) each time SIGCHLD is raised) cz|jtdSr )rr9r(r1r+r-s rr1zSafeChildWatcher.closes,   rc|Sr rrs rrzSafeChildWatcher.__enter__ rrcdSr rrs rrzSafeChildWatcher.__exit__#rrcH||f|j|<||dSr )rrrs rryz"SafeChildWatcher.add_child_handler&s/ ($/ rc: |j|=dS#t$rYdSwxYwNTFrr`rs rrz%SafeChildWatcher.remove_child_handler,8 $4   55   c^t|jD]}||dSr r4rrrs rrz SafeChildWatcher._do_waitpid_all3s<(( " "C   S ! ! ! ! " "rc tj|tj\}}|dkrdSt|}|jrt jd||n)#t$r|}d}t j d|YnwxYw |j |\}}|||g|RdS#t$r7|jrt j d|dYdSYdSwxYw)Nr$process %s exited with returncode %sr8Unknown child process pid %d, will report returncode 255'Child watcher got an unexpected pid: %rTr;) r!rWNOHANGr"rrrrrrarrr`)r+rrr$rrUrVs rrzSafeChildWatcher._do_waitpid8so 7*\2:>>KCaxx/77Jz##%% 7 C):777!   CJ NJ       $ -!_0055NHd HS* ,t , , , , , , 3 3 3z##%% 3H"T3333333 3 3 3 3s#"A++#BBB>>:C?>C?) rrrrr1rrryrrrrrs@rrrs    """ - - - - - - -rrcJeZdZdZfdZfdZdZdZdZdZ dZ xZ S) raW'Fast' child watcher implementation. This implementation reaps every terminated processes by calling os.waitpid(-1) directly, possibly breaking other code spawning processes and waiting for their termination. There is no noticeable overhead when handling a big number of children (O(1) each time a child terminates). cttj|_i|_d|_dSr)r(r) threadingLock_lock_zombies_forksrs rr)zFastChildWatcher.__init__es: ^%%   rc|j|jtdSr )rr9rr(r1rs rr1zFastChildWatcher.closeks@    rch|j5|xjdz c_|cdddS#1swxYwYdS)Nr)rrrs rrzFastChildWatcher.__enter__ps Z   KK1 KK                  s '++c |j5|xjdzc_|js|js ddddSt|j}|jdddn #1swxYwYt jd|dS)Nrz5Caught subprocesses termination from unknown pids: %s)rrrrOr9rra)r+rrrcollateral_victimss rrzFastChildWatcher.__exit__vs Z " " KK1 KK{ $-   " " " " " " " " "%T]!3!3  M   ! ! ! " " " " " " " " " " " " " " "  C      s A.-A..A25A2c|j5 |j|}n(#t$r||f|j|<YddddSwxYw dddn #1swxYwY|||g|RdSr )rrrr`r)r+rrUrVrs rryz"FastChildWatcher.add_child_handlersZ   !]..s33    '/~$                          j(4((((((s0A%AA A A  AA!Ac: |j|=dS#t$rYdSwxYwrrrs rrz%FastChildWatcher.remove_child_handlerrrc~ tjdtj\}}|dkrdSt|}n#t$rYdSwxYw|j5 |j|\}}|j rtj d||n_#t$rR|j rF||j|<|j rtj d||Ydddd}YnwxYwdddn #1swxYwY|tjd||n |||g|R=)NTr@rrz,unknown process %s exited with returncode %sz8Caught subprocess termination from unknown pid: %d -> %d)r!rrr"rrrrrrrrr`rrra)r+rr$rrUrVs rrz FastChildWatcher._do_waitpid_alls% 1 < jRZ88 V !88F3F;; %     6 66%)_%8%8%=%=NHdz++--6 %K%(*666 $ $ ${!-7 c*://11:"L*>),j:::! 6 6 6 6 6 6 6 $HHH $ 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6& #Z1111j040000K% 1sR"= A  A DB$40D$A D.D;D=D?DDDD) rrrrr)r1rrryrrrrs@rrr[s       ) ) )(1(1(1(1(1(1(1rrcTeZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd S)ra~A watcher that doesn't require running loop in the main thread. This implementation registers a SIGCHLD signal handler on instantiation (which may conflict with other code that install own handler for this signal). The solution is safe but it has a significant overhead when handling a big number of processes (*O(n)* each time a SIGCHLD is received). c"i|_d|_dSr )r_saved_sighandlerrs rr)zMultiLoopChildWatcher.__init__s!%rc|jduSr )rrs rrvzMultiLoopChildWatcher.is_actives%T11rc|j|jdStjtj}||jkrtjdn$tjtj|jd|_dS)Nz+SIGCHLD handler was changed by outside code) rr9rrI getsignalrrrra)r+rds rr1zMultiLoopChildWatcher.closes|   ! ) F"6>22 dn $ $ NH I I I I M&.$*@ A A A!%rc|Sr rrs rrzMultiLoopChildWatcher.__enter__rrcdSr rr+rexc_valexc_tbs rrzMultiLoopChildWatcher.__exit__rrcptj}|||f|j|<||dSr )rget_running_looprr)r+rrUrVrs rryz'MultiLoopChildWatcher.add_child_handlers?&(( $h5 rc: |j|=dS#t$rYdSwxYwrrrs rrz*MultiLoopChildWatcher.remove_child_handlerrrc|jdStjtj|j|_|j%t jdtj|_tjtjddS)NzaPrevious SIGCHLD handler was set by non-Python code, restore to default handler on watcher close.F)rrIrrrrarcrQrs rrz!MultiLoopChildWatcher.attach_loopsw  ! - F!'v~t~!N!N  ! ) NJ K K K%+^D " FNE22222rc^t|jD]}||dSr rrs rrz%MultiLoopChildWatcher._do_waitpid_alls<(( " "C   S ! ! ! ! " "rc4 tj|tj\}}|dkrdSt|}d}n+#t$r|}d}t jd|d}YnwxYw |j|\}}}| rt jd||dS|r*| rt j d|||j |||g|RdS#t$rt jd|d YdSwxYw) NrTrrF%Loop %r that handles pid %r is closedrrr;)r!rrr"rrrarr is_closedrrrr`) r+rrr$r debug_logrrUrVs rrz!MultiLoopChildWatcher._do_waitpids *\2:>>KCaxx/77JII!   CJ NJ   III   L#'?#6#6s#;#; D(D~~ LFcRRRRR;!1!1;L!G!-z;;;))(CKdKKKKKK / / / ND / / / / / / / /s!">%A&%A&*C22!DDc |dS#ttf$rt$rt jddYdSwxYw)NrTr;)rr|r}r~rra)r+rrs rrzMultiLoopChildWatcher._sig_chld8sy R  " " " " "-.     R R R NAD Q Q Q Q Q Q Q Rs1A  A N)rrrrr)rvr1rrryrrrrrrrrrrs  $&&&222 & & &   333""""#L#L#LJRRRRRrrc\eZdZdZdZdZdZdZdZe j fdZ dZ d Z d Zd Zd S) raAThreaded child watcher implementation. The watcher uses a thread per process for waiting for the process finish. It doesn't require subscription on POSIX signal but a thread creation is not free. The watcher has O(1) complexity, its performance doesn't depend on amount of spawn processes. cFtjd|_i|_dSr) itertoolsr _pid_counter_threadsrs rr)zThreadedChildWatcher.__init__Ns%OA.. rcdSrCrrs rrvzThreadedChildWatcher.is_activeRrlrcdSr rrs rr1zThreadedChildWatcher.closeUrrc|Sr rrs rrzThreadedChildWatcher.__enter__XrrcdSr rrs rrzThreadedChildWatcher.__exit__[rrcdt|jD}|r||jdt|dSdS)Nc:g|]}||Sr)is_alive).0threads r z0ThreadedChildWatcher.__del__.._s6)))foo'')6)))rz0 has registered but not finished child processesr/)r4rrr-r8)r+r5threadss rr6zThreadedChildWatcher.__del__^s}))T]-A-A-C-C(D(D)))   ET^UUU!        rctj}tj|jdt |j||||fd}||j|<|dS)Nzasyncio-waitpid-T)targetnamerVdaemon) rrrThreadrnextrrstart)r+rrUrVrrs rryz&ThreadedChildWatcher.add_child_handlerfsp&((!)9'S$t?P:Q:Q'S'S(,c8T'B)-///$ c rcdSrCrrs rrz)ThreadedChildWatcher.remove_child_handleros trcdSr rrs rrz ThreadedChildWatcher.attach_loopurrc tj|d\}}t|}|rt jd||n)#t $r|}d}t jd|YnwxYw|rt jd||n|j |||g|R|j |dS)Nrrrrr) r!rr"rrrrrarrrr)r+rrrUrVrr$rs rrz ThreadedChildWatcher._do_waitpidxs 7*\155KC077J~~ 7 C):777!   CJ NJ        >>   H NBD# N N N N %D %hZ G$ G G G G ,'''''sA#A:9A:N)rrrrr)rvr1rrr6r7r6ryrrrrrrrrAs        %M    (((((rrcBeZdZdZeZfdZdZfdZdZ dZ xZ S)_UnixDefaultEventLoopPolicyz:UNIX event loop policy with a watcher for child processes.cVtd|_dSr )r(r)_watcherrs rr)z$_UnixDefaultEventLoopPolicy.__init__s$  rctj5|jt|_ddddS#1swxYwYdSr )rrr rrs r _init_watcherz)_UnixDefaultEventLoopPolicy._init_watchers \ 7 7}$ 4 6 6  7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7s 599ct||jBtjtjur|j|dSdSdS)zSet the event loop. As a side effect, if a child watcher was set before, then calling .set_event_loop() from the main thread will call .attach_loop(loop) on the child watcher. N)r(set_event_loopr rcurrent_thread main_threadr)r+rr-s rr$z*_UnixDefaultEventLoopPolicy.set_event_loopsl t$$$ M %(**i.C.E.EEE M % %d + + + + + & %EErcF|j||jS)z~Get the watcher for child processes. If not yet set, a ThreadedChildWatcher object is automatically created. )r r"rs rruz-_UnixDefaultEventLoopPolicy.get_child_watchers& =    }rcT|j|j||_dS)z$Set the watcher for child processes.N)r r1)r+rs rset_child_watcherz-_UnixDefaultEventLoopPolicy.set_child_watchers+ = $ M   ! ! ! r) rrrrr& _loop_factoryr)r"r$rur)rrs@rrrsDD*M777 , , , , ,       rr)3rrSrrr!rrIrrr~r2rr6rrrrrr r r r r logr__all__rQ ImportErrorrr"BaseSelectorEventLoopr& ReadTransportrj_FlowControlMixinWriteTransportrrBaseSubprocessTransportrxrrrrrrrBaseDefaultEventLoopPolicyrrrrrrr5s88     <7 +C D DD   N"N"N"N"N"_BN"N"N"b MMMMMZ5MMM`JJJJJj:(7JJJZ     F   0L$L$L$L$L$L$L$L$^KKKKK,KKK\22222+222jG-G-G-G-G-'G-G-G-Tf1f1f1f1f1'f1f1f1RzRzRzRzRzR0zRzRzRzO(O(O(O(O(/O(O(O(d- - - - - &"C- - - `+4r__pycache__/base_subprocess.cpython-311.pyc000064400000040523152533123130014642 0ustar00 !A?h"ddlZddlZddlZddlmZddlmZddlmZGddejZ Gdd ej Z Gd d e ej Z dS) N) protocols) transports)loggerceZdZ dfd ZdZdZdZdZdZdZ e j fd Z d Z d Zd Zd ZdZdZdZdZdZdZdZdZdZdZdZxZS)BaseSubprocessTransportNc Dt| d|_||_||_d|_d|_d|_g|_tj |_ i|_ d|_ |tjkr d|j d<|tjkr d|j d<|tjkr d|j d< |jd||||||d| n#|xYw|jj|_|j|jd<|jrBt+|t,t.fr|} n|d} t1jd| |j|j|| dS) NFrr)argsshellstdinstdoutstderrbufsize subprocesszprocess %r created: pid %s)super__init___closed _protocol_loop_proc_pid _returncode _exit_waiters collectionsdeque_pending_calls_pipes _finishedrPIPE_startclosepid_extra get_debug isinstancebytesstrrdebug create_task_connect_pipes)selfloopprotocolr r r rrrwaiterextrakwargsprogram __class__s D/opt/alt/python-internal/lib64/python3.11/asyncio/base_subprocess.pyrz BaseSubprocessTransport.__init__ s  !   )/11  JO # #!DKN Z_ $ $!DKN Z_ $ $!DKN  DK BTeF%w B B:@ B B B B  JJLLL JN $(J L! :   ! ! -$ -- "q' L5 $) - - - t226::;;;;;s CC5c8|jjg}|jr|d|j|d|j|j|d|jn2|j|dn|d|jd}||d|j|jd}|jd }|"||ur|d |jn>||d |j||d |jd d |S)Nclosedzpid=z returncode=runningz not startedrzstdin=rr zstdout=stderr=zstdout=zstderr=z<{}> ) r4__name__rappendrrrgetpipeformatjoin)r-infor rrs r5__repr__z BaseSubprocessTransport.__repr__7s'( < " KK ! ! ! 9 KK*ty** + + +   ' KK8d&688 9 9 9 9 Y " KK " " " " KK & & & ""   KK--- . . .####  &F"2"2 KK666 7 7 7 7! 3fk33444! 3fk33444}}SXXd^^,,,c tN)NotImplementedError)r-r r r rrrr2s r5r"zBaseSubprocessTransport._startTs!!rBc||_dSrDr)r-r/s r5 set_protocolz$BaseSubprocessTransport.set_protocolWs !rBc|jSrDrGr-s r5 get_protocolz$BaseSubprocessTransport.get_protocolZs ~rBc|jSrD)rrJs r5 is_closingz"BaseSubprocessTransport.is_closing]s |rBc|jrdSd|_|jD]}||j|j{|jv|j_|j rtj d| |j dS#t$rYdSwxYwdSdSdS)NTz$Close running child process: kill %r)rrvaluesr=r#rrpollrr&rwarningkillProcessLookupError)r-protos r5r#zBaseSubprocessTransport.close`s <  F [''))  E} J       J " ( !!)z##%% MEtLLL  !!!!!%     # "((*)sB:: CCcl|js,|d|t||dSdS)Nzunclosed transport )source)rResourceWarningr#)r-_warns r5__del__zBaseSubprocessTransport.__del__{sG|  E000/$ O O O O JJLLLLL  rBc|jSrD)rrJs r5get_pidzBaseSubprocessTransport.get_pids yrBc|jSrD)rrJs r5get_returncodez&BaseSubprocessTransport.get_returncodes rBc<||jvr|j|jSdSrD)rr=)r-fds r5get_pipe_transportz*BaseSubprocessTransport.get_pipe_transports#   ;r?' '4rBc0|jtdSrD)rrSrJs r5 _check_procz#BaseSubprocessTransport._check_procs : $&& &  rBcb||j|dSrD)rbr send_signal)r-signals r5rdz#BaseSubprocessTransport.send_signals0  v&&&&&rBc`||jdSrD)rbr terminaterJs r5rgz!BaseSubprocessTransport.terminates.  rBc`||jdSrD)rbrrRrJs r5rRzBaseSubprocessTransport.kills,  rBc.K j}j}|j1|fd|jd{V\}}|jd<|j1|fd|jd{V\}}|jd<|j1|fd|jd{V\}}|jd<jJ| j j jD]\}}|j |g|Rd_|+| s| ddSdSdS#ttf$rt $rB}|/| s!||Yd}~dSYd}~dSYd}~dSd}~wwxYw)Nc$tdS)Nr)WriteSubprocessPipeProtorJsr5z8BaseSubprocessTransport._connect_pipes..s4T1==rBrc$tdS)NrReadSubprocessPipeProtorJsr5rlz8BaseSubprocessTransport._connect_pipes..3D!<<rBrc$tdS)Nr rnrJsr5rlz8BaseSubprocessTransport._connect_pipes..rprBr )rrr connect_write_piperrconnect_read_piperr call_soonrconnection_made cancelled set_result SystemExitKeyboardInterrupt BaseException set_exception) r-r0procr._r=callbackdataexcs ` r5r,z&BaseSubprocessTransport._connect_pipesst# (:D:Dz% $ 7 7====J! !       4"& A{& $ 6 6<<<<K!!!!!!!!!!4"& A{& $ 6 6<<<<K!!!!!!!!!!4"& A&222 NN4>94 @ @ @"&"5 0 0$x/$/////"&D !&*:*:*<*<!!!$'''''"!!! -.     * * *!&*:*:*<*<!$$S)))))))))"!!!!!!!!!!! *sDD77F+FFcv|j|j||fdS|jj|g|RdSrD)rr;rrt)r-cbrs r5_callzBaseSubprocessTransport._callsO   *   & &Dz 2 2 2 2 2 DJ  +d + + + + + +rBcp||jj|||dSrD)rrpipe_connection_lost _try_finish)r-r_rs r5_pipe_connection_lostz-BaseSubprocessTransport._pipe_connection_losts5 4>6C@@@ rBcH||jj||dSrD)rrpipe_data_received)r-r_rs r5_pipe_data_receivedz+BaseSubprocessTransport._pipe_data_receiveds# 4>4b$?????rBcL| J||jJ|j|jrtjd||||_|jj ||j_||jj | dS)Nz%r exited with return code %r) rrr&rr@r returncoderrprocess_exitedr)r-rs r5_process_exitedz'BaseSubprocessTransport._process_exiteds%%z%%%'')9''' :   ! ! K K7z J J J% : (%/DJ ! 4>0111 rBcK|j|jS|j}|j||d{VS)zdWait until the process exit and return the process return code. This method is a coroutine.N)rr create_futurerr;)r-r0s r5_waitzBaseSubprocessTransport._waitsV   '# #))++ !!&)))||||||rBc|jrJ|jdStd|jDr$d|_||jddSdS)Nc3,K|]}|duo|jVdSrD) disconnected).0ps r5 z6BaseSubprocessTransport._try_finish..sA..}/......rBT)r rallrrOr_call_connection_lostrJs r5rz#BaseSubprocessTransport._try_finishs>!!!   # F .. **,,... . . 9!DN JJt14 8 8 8 8 8 9 9rBc |j||jD]0}|s||j1d|_d|_d|_d|_dS#|jD]0}|s||j1d|_d|_d|_d|_wxYwrD)rconnection_lostrrvrwrrr)r-rr0s r5rz-BaseSubprocessTransport._call_connection_losts " N * *3 / / /, 8 8''))8%%d&6777!%D DJDJ!DNNN , 8 8''))8%%d&6777!%D DJDJ!DN ! ! ! !s A22AC)NN)r: __module__ __qualname__rrAr"rHrKrMr#warningswarnrYr[r]r`rbrdrgrRr,rrrrrrr __classcell__)r4s@r5rr s%))<)<)<)<)<)||_||_d|_d|_dS)NF)r|r_r=r)r-r|r_s r5rz!WriteSubprocessPipeProto.__init__s%  !rBc||_dSrD)r=)r- transports r5ruz(WriteSubprocessPipeProto.connection_mades  rBcBd|jjd|jd|jdS)N)r4r:r_r=rJs r5rAz!WriteSubprocessPipeProto.__repr__ s,M4>*MMMMtyMMMMrBcbd|_|j|j|d|_dS)NT)rr|rr_)r-rs r5rz(WriteSubprocessPipeProto.connection_lost s/  ''555 rBcB|jjdSrD)r|r pause_writingrJs r5rz&WriteSubprocessPipeProto.pause_writings ))+++++rBcB|jjdSrD)r|rresume_writingrJs r5rz'WriteSubprocessPipeProto.resume_writings **,,,,,rBN) r:rrrrurArrrrrBr5rkrksq""" NNN ,,,-----rBrkceZdZdZdS)rocF|j|j|dSrD)r|rr_)r-rs r5 data_receivedz%ReadSubprocessPipeProto.data_receiveds" %%dgt44444rBN)r:rrrrrBr5roros#55555rBro)rrrrrlogrSubprocessTransportr BaseProtocolrkProtocolrorrBr5rsr"r"r"r"r"j<r"r"r"j-----y5---4555556'055555rB__pycache__/runners.cpython-311.pyc000064400000024015152533123130013152 0ustar00 !A?hdZddlZddlZddlZddlZddlZddlZddlmZddlm Z ddlm Z ddlm Z Gdd ej Z Gd d Zdd d ZdZdS))RunnerrunN) coroutines)events) exceptions)tasksceZdZdZdZdZdS)_Statecreated initializedclosedN)__name__ __module__ __qualname__CREATED INITIALIZEDCLOSEDn  )  !$rc.||SN) _lazy_initr#s r __enter__zRunner.__enter__:s  rc.|dSr&)close)r#exc_typeexc_valexc_tbs r__exit__zRunner.__exit__>s rc |jtjurdS |j}t ||||||jrtj d| d|_tj |_dS#|jrtj d| d|_tj |_wxYw)zShutdown and close event loop.N) rr rr_cancel_all_tasksrun_until_completeshutdown_asyncgensshutdown_default_executorr"rset_event_loopr+r)r#loops rr+z Runner.closeAs ;f0 0 0 F (:D d # # #  # #D$;$;$=$= > > >  # #D$B$B$D$D E E E# ,%d+++ JJLLLDJ -DKKK # ,%d+++ JJLLLDJ -DK ' ' ' 's A$CA D c8||jS)zReturn embedded event loop.)r'rr(s rget_loopzRunner.get_loopQs zrcontextctj|s"td|t jt d|||j}|j ||}tj tj urxtjtjtjurNt%j|j|} tjtj|n#t$rd}YnwxYwd}d|_ |j ||Jtjtj|ur+tjtjtjSSS#t.j$r<|jdkr/t3|dd}||dkrt5wxYw#|Jtjtj|ur+tjtjtjwwwxYw)z/Run a coroutine inside the embedded event loop.z"a coroutine was expected, got {!r}Nz7Runner.run() cannot be called from a running event loopr9) main_taskruncancel)r iscoroutine ValueErrorformatr_get_running_loop RuntimeErrorr'r r create_task threadingcurrent_thread main_threadsignal getsignalSIGINTdefault_int_handler functoolspartial _on_sigintr!r2rCancelledErrorgetattrKeyboardInterrupt)r#coror:tasksigint_handlerr=s rrz Runner.runVs5%d++ PAHHNNOO O  # % % 1IKK K  ?mGz%%dG%<<  $ & &)*?*A*A A A //63MMM&.t$OOON & fm^<<<< & & &"&  & "N ! I:0066*$V]33~EE fmV-GHHHH+E(   $q(("4T::'HHJJ!OO+---   *$V]33~EE fmV-GHHHH+Es,>D D-,D-:F!!A G,,G//AH>c|jtjurtd|jtjurdS|j@t j|_|j s t j |jd|_ n||_|j |j |j tj|_tj|_dS)NzRunner is closedT)rr rrBrrrnew_event_looprr"r5r set_debug contextvars copy_contextr r(s rr'zRunner._lazy_inits ;&- ' '122 2 ;&, , , F   %.00DJ' ,%dj111'+$++--DJ ; " J  - - -#022 ( rc|xjdz c_|jdkrE|s1||jddSt )NrcdSr&rrrrz#Runner._on_sigint..sDr)r!donecancelrcall_soon_threadsaferP)r#signumframer<s rrMzRunner._on_sigintsn "  A % %inn.>.> %       J + +LL 9 9 9 F!!!r) rrr__doc__r$r)r/r+r8rr'rMrrrrrs6!%4%%%%%(((  $(+I+I+I+I+IZ)))&"""""rrrctjtdt|5}||cdddS#1swxYwYdS)aExecute the coroutine and return the result. This function runs the passed coroutine, taking care of managing the asyncio event loop and finalizing asynchronous generators. This function cannot be called when another asyncio event loop is running in the same thread. If debug is True, the event loop will be run in debug mode. This function always creates a new event loop and closes it at the end. It should be used as a main entry point for asyncio programs, and should ideally only be called once. Example: async def main(): await asyncio.sleep(1) print('hello') asyncio.run(main()) Nz8asyncio.run() cannot be called from a running event looprb)rrArBrr)mainrrunners rrrs0!!- FHH H e    zz$                  sAAAcbtj|}|sdS|D]}||tj|ddi|D]V}|r|+|d||dWdS)Nreturn_exceptionsTz1unhandled exception during asyncio.run() shutdown)message exceptionrR)r all_tasksr]r2gather cancelledricall_exception_handler)r6 to_cancelrRs rr1r1s%%I  EL)LtLLMMM >>     >>   '  ' 'N!^^--))    r)__all__rWenumrKrDrGsysrrrr Enumr rrr1rrrrts&   TY H"H"H"H"H"H"H"H"V     Br__pycache__/staggered.cpython-311.opt-2.pyc000064400000010004152533123130014354 0ustar00 !A?hh, dZddlZddlZddlmZddlmZddlmZddlmZddd ej ej gej fd ej e d ejd ejejej eejej effd ZdS))staggered_raceN)events) exceptions)locks)tasks)loopcoro_fnsdelayr returnc P K ptjt| dd g g dtjt jddf  fd  d} | d}|t kr@tj d{V\}}t|} |t k@ f D]}|S# D]}|wxYw)Nprevious_failedr cK|ctjtj5t j| d{Vdddn #1swxYwY t \}}n#t$rYdSwxYwtj }  |} | d |d{V}||tD]\}}||kr| dS#tt f$rt"$r$}| |<|Yd}~dSd}~wwxYw)N) contextlibsuppressexceptions_mod TimeoutErrorrwait_forwaitnext StopIterationrEvent create_taskappend enumeratecancel SystemExitKeyboardInterrupt BaseExceptionset)r this_indexcoro_fn this_failed next_taskresultiter enum_coro_fnsrr run_one_coro running_tasks winner_index winner_results >/opt/alt/python-internal/lib64/python3.11/asyncio/staggered.pyr*z$staggered_race..run_one_coroRs  &$^%@AA D D n_%9%9%;%;UCCCCCCCCC  D D D D D D D D D D D D D D D "&}"5"5 J    FF kmm $$\\+%>%>?? Y''' $ "799______F&L"M"-00  1 ??HHJJJ  %-.       %&Jz " OO          s;.AA"%A"*A== B  B *D//E. E))E.r)rget_running_looprtypingOptionalrrrrlenrrdone cancelled exceptionr)r r r first_task done_countr3_dr'r)rr*r+r,r-s `` @@@@@@r.rrs1f  ,6*,,Dh''MMLJM.#_U[9.>B.............`!!,,t"4"455J$$$ C ....!J}55555555GD!TJ , C ....lJ6  A HHJJJJ   A HHJJJJ s AD D%)__all__rr0rrrrrIterableCallable Awaitabler1floatAbstractEventLoopTupleAnyintList Exceptionrr.rHsL  *******. GGG/&/"f6F2F"GHGu%G& G  \ J OC K *+, GGGGGGrG__pycache__/windows_utils.cpython-311.opt-1.pyc000064400000016646152533123130015342 0ustar00 !A?hdZddlZejdkr edddlZddlZddlZddlZddlZddl Z ddl Z dZ dZ ej Z ejZejZdde d d ZGd d ZGd dejZdS)z)Various Windows specific bits and pieces.Nwin32z win32 only)pipePopenPIPE PipeHandlei F)TT)duplex overlappedbufsizec Rtjdtjt t }|r*tj}tj tj z}||}}ntj }tj }d|}}|tj z}|dr|tj z}|dr tj }nd}dx} } tj||tjd||tjtj} tj||dtjtj|tj} tj| d} | d| | fS#| tj| | tj| xYw)zELike os.pipe() but with overlapped support and using handles not fds.z\\.\pipe\python-pipe-{:d}-{:d}-)prefixrNTr )tempfilemktempformatosgetpidnext _mmap_counter_winapiPIPE_ACCESS_DUPLEX GENERIC_READ GENERIC_WRITEPIPE_ACCESS_INBOUNDFILE_FLAG_FIRST_PIPE_INSTANCEFILE_FLAG_OVERLAPPEDCreateNamedPipe PIPE_WAITNMPWAIT_WAIT_FOREVERNULL CreateFile OPEN_EXISTINGConnectNamedPipeGetOverlappedResult CloseHandle) rr r addressopenmodeaccessobsizeibsizeflags_and_attribsh1h2ovs B/opt/alt/python-internal/lib64/python3.11/asyncio/windows_utils.pyrr so188 IKKm,,..///G$-%(== '.&G 55H!}1G00!}#8NB  $ Xw0 vvw;W\KK  VQ g.C w|-- %bT : : : t$$$2v  >   # # # >   # # # s BE77/F&cpeZdZdZdZdZedZdZe j ddZ e j fdZd Zd Zd S) rzWrapper for an overlapped pipe handle which is vaguely file-object like. The IOCP event loop can use these instead of socket objects. c||_dSN_handleselfhandles r/__init__zPipeHandle.__init__Vs  cP|j d|j}nd}d|jjd|dS)Nzhandle=closed< >)r4 __class____name__r5s r/__repr__zPipeHandle.__repr__Ys> < #/t|//FFF64>*66V6666r9c|jSr2r3r6s r/r7zPipeHandle.handle`s |r9c<|jtd|jS)NzI/O operation on closed pipe)r4 ValueErrorrCs r/filenozPipeHandle.filenods! < ;<< <|r9)r%cF|j||jd|_dSdSr2r3)r6r%s r/closezPipeHandle.closeis/ < # K % % %DLLL $ #r9cl|j,|d|t||dSdS)Nz unclosed )source)r4ResourceWarningrH)r6_warns r/__del__zPipeHandle.__del__nsC < # E&d&& E E E E JJLLLLL $ #r9c|Sr2rCs r/ __enter__zPipeHandle.__enter__ss r9c.|dSr2)rH)r6tvtbs r/__exit__zPipeHandle.__exit__vs r9N)r@ __module__ __qualname____doc__r8rApropertyr7rFrr%rHwarningswarnrMrPrUrOr9r/rrQs777X $+#6     %M r9rc$eZdZdZdfd ZxZS)rzReplacement for subprocess.Popen using overlapped pipe handles. The stdin, stdout, stderr are None or instances of PipeHandle. Nc &dx}x}}dx} x} } |tkr4tdd\} } tj| tj}n|}|tkr)td\} } tj| d}n|}|tkr)td\} }tj|d}n|t kr|}n|} tj|f|||d|| t| |_ | t| |_ | t| |_ n$#| | | fD]}|tj|xYw|tkrt j||tkrt j||tkrt j|dSdS#|tkrt j||tkrt j||tkrt j|wwxYw)N)FTT)r r)TFrr)stdinstdoutstderr)rrmsvcrtopen_osfhandlerO_RDONLYSTDOUTsuperr8rr^r_r`rr%rH)r6argsr^r_r`kwds stdin_rfd stdout_wfd stderr_wfdstdin_wh stdout_rh stderr_rhstdin_rh stdout_wh stderr_whhr?s r/r8zPopen.__init__sG/32 2J+///9y D==!%t!L!L!L Hh-h DDIII T>>#'=#A#A#A Iy.y!<>#'=#A#A#A Iy.y!<r{s%// <7 +l # ##  0    !! \7+++++b&&&&&&&&X0%0%0%0%0%J 0%0%0%0%0%r9__pycache__/mixins.cpython-311.pyc000064400000002300152533123130012756 0ustar00 !A?hVdZddlZddlmZejZGddZdS)zEvent loop mixins.N)eventsceZdZdZdZdS)_LoopBoundMixinNctj}|j-t5|j||_dddn #1swxYwY||jurt |d|S)Nz# is bound to a different event loop)r_get_running_loop_loop _global_lock RuntimeError)selfloops ;/opt/alt/python-internal/lib64/python3.11/asyncio/mixins.py _get_loopz_LoopBoundMixin._get_loop s')) :  & &:%!%DJ & & & & & & & & & & & & & & & tz ! !$MMMNN N s=AA)__name__ __module__ __qualname__r rrrr s( E     rr)__doc__ threadingrLockr rrrrrsjy~           r__pycache__/timeouts.cpython-311.pyc000064400000017512152533123130013333 0ustar00 !A?hddlZddlmZddlmZmZmZddlmZddlm Z ddlm Z dZ Gd d ej Z eGd d Zd eedefdZdeedefdZdS)N) TracebackType)finalOptionalType)events) exceptions)tasks)Timeouttimeout timeout_atc"eZdZdZdZdZdZdZdS)_StatecreatedactiveexpiringexpiredfinishedN)__name__ __module__ __qualname__CREATEDENTEREDEXPIRINGEXPIREDEXITED=/opt/alt/python-internal/lib64/python3.11/asyncio/timeouts.pyrrs'GGHG FFFrrc eZdZdZdeeddfdZdeefdZdeeddfdZde fdZ de fd Z dd Z d eeed eed eedee fdZddZdS)r zAsynchronous context manager for cancelling overdue coroutines. Use `timeout()` or `timeout_at()` rather than instantiating this class directly. whenreturnNcRtj|_d|_d|_||_dS)zSchedule a timeout that will trigger at a given loop time. - If `when` is `None`, the timeout will never trigger. - If `when < loop.time()`, the timeout will trigger on the next iteration of the event loop. N)rr_state_timeout_handler_task_when)selfr!s r__init__zTimeout.__init__!s'n >B+/  rc|jS)zReturn the current deadline.)r'r(s rr!z Timeout.when.s zrc|jtjur?|jtjurt dt d|jjd||_|j|j| d|_dStj }|| kr!| |j |_dS|||j |_dS)zReschedule the timeout.zTimeout has not been enteredzCannot change state of z TimeoutN)r$rrr RuntimeErrorvaluer'r%cancelrget_running_looptime call_soon _on_timeoutcall_at)r(r!loops r reschedulezTimeout.reschedule2s ;fn , ,{fn,,"#ABBBE$+*;EEE   ,  ! ( ( * * * <$(D ! ! !*,,Dtyy{{""(,t7G(H(H%%%(, T4;K(L(L%%%rc@|jtjtjfvS)z$Is timeout expired during execution?)r$rrrr+s rrzTimeout.expiredIs{v???rcdg}|jtjur6|jt |jdnd}|d|d|}d|jjd|dS)Nzwhen= z )r$rrr'roundappendjoinr.)r(infor!info_strs r__repr__zTimeout.__repr__Mszt ;&. ( (+/:+A5Q'''tD KK ' ' '88D>>;DK-;;;;;;rc6K|jtjurtdt j}|tdtj|_||_|j|_ | |j |S)Nz Timeout has already been enteredz$Timeout should be used inside a task) r$rrr-r current_taskrr& cancelling _cancellingr6r')r(tasks r __aenter__zTimeout.__aenter__Us ;fn , ,ABB B!## <EFF Fn  :0022  ### rexc_typeexc_valexc_tbcK|jtjtjfvsJ|j |jd|_|jtjurJtj|_|j|j kr|tj urt|n$|jtjurtj |_dSN)r$rrrr%r/rr&uncancelrGr CancelledError TimeoutErrorr)r(rJrKrLs r __aexit__zTimeout.__aexit__as {v~v?????  ,  ! ( ( * * *$(D ! ;&/ ) ) .DKz""$$(888XIb=b=b#/ [FN * * -DKtrc|jtjusJ|jtj|_d|_dSrN)r$rrr&r/rr%r+s rr3zTimeout._on_timeoutysB{fn,,,, o $r)r"r )r"N)rrr__doc__rfloatr)r!r6boolrstrrCrIr BaseExceptionrrRr3rrrr r sD Xe_     huoMxM4MMMM.@@@@@<#<<<<    4 ./-('  $ 0%%%%%%rr delayr"cxtj}t|||zndS)a Timeout async context manager. Useful in cases when you want to apply timeout logic around block of code or in cases when asyncio.wait_for is not suitable. For example: >>> async with asyncio.timeout(10): # 10 seconds timeout ... await long_running_task() delay - value in seconds or None to disable timeout logic long_running_task() is interrupted by raising asyncio.CancelledError, the top-most affected timeout() context manager converts CancelledError into TimeoutError. N)rr0r r1)rYr5s rr r s7  " $ $D %*;499;;&& F FFrr!c t|S)abSchedule the timeout at absolute time. Like timeout() but argument gives absolute time in the same clock system as loop.time(). Please note: it is not POSIX time but a time with undefined starting base, e.g. the time of the system power on. >>> async with asyncio.timeout_at(loop.time() + 10): ... await long_running_task() when - a deadline when timeout occurs or None to disable timeout logic long_running_task() is interrupted by raising asyncio.CancelledError, the top-most affected timeout() context manager converts CancelledError into TimeoutError. )r )r!s rr r s& 4==r)enumtypesrtypingrrrr9rr r __all__Enumrr rUr r rrrras@ (((((((((( TYc%c%c%c%c%c%c%c%LG8E?GwGGGG(Xe_r__pycache__/constants.cpython-311.opt-2.pyc000064400000001727152533123130014437 0ustar00 !A?h.TddlZdZdZdZdZdZdZdZd ZGd d ej Z dS) N gN@g>@iicheZdZejZejZejZdS) _SendfileModeN)__name__ __module__ __qualname__enumauto UNSUPPORTED TRY_NATIVEFALLBACK>/opt/alt/python-internal/lib64/python3.11/asyncio/constants.pyrr#s5$)++KJty{{HHHrr) r !LOG_THRESHOLD_FOR_CONNLOST_WRITESACCEPT_RETRY_DELAYDEBUG_STACK_DEPTHSSL_HANDSHAKE_TIMEOUTSSL_SHUTDOWN_TIMEOUT!SENDFILE_FALLBACK_READBUFFER_SIZE FLOW_CONTROL_HIGH_WATER_SSL_READ!FLOW_CONTROL_HIGH_WATER_SSL_WRITEEnumrrrrrs  %&! %/!#& $'!DIr__pycache__/tasks.cpython-311.pyc000064400000120101152533123130012574 0ustar00 !A?hdZdZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddlm Z ddl m Z ddl mZddl mZdd l mZdd l mZdd lmZejdjZd-d Zd-d ZdZGddejZeZ ddlZejxZZn #e$rYnwxYwddddZejj Z ejj!Z!ejj"Z"de"ddZ#dZ$dZ%dZ&dZ'dddZ(ej)dZ*d-dZ+dddZ,dddZ-ej)d Z.ee._Gd!d"ej/Z0d#d$d%Z1d&Z2d'Z3e j4Z5iZ6d(Z7d)Z8d*Z9d+Z:e7Z;e:Z dd,lm7Z7m:Z:m8Z8m9Z9m5Z5m6Z6e7Z?e:Z@e8ZAe9ZBdS#e$rYdSwxYw).z0Support for tasks, coroutines and the scheduler.)Task create_taskFIRST_COMPLETEDFIRST_EXCEPTION ALL_COMPLETEDwaitwait_for as_completedsleepgathershield ensure_futurerun_coroutine_threadsafe current_task all_tasks_register_task_unregister_task _enter_task _leave_taskN) GenericAlias) base_tasks) coroutines)events) exceptions)futures) _is_coroutinecT|tj}tj|S)z!Return a currently executed task.)rget_running_loop_current_tasksgetloops :/opt/alt/python-internal/lib64/python3.11/asyncio/tasks.pyrr#s& |&((  d # ##ctjd} tt}n#t$r|dz }|dkrYnwxYw3fd|DS)z'Return a set of all tasks for the loop.NrTrichh|].}tj|u|,|/S)r _get_loopdone).0tr#s r$ zall_tasks..=sE > > >! ##t++AFFHH+ +++r%)rrlist _all_tasks RuntimeError)r#itaskss` r$rr*s |&(( A $$E      FADyyy  > > > >u > > >>s0A A c|B |j}||dS#t$r tjdtdYdSwxYwdS)Nz~Task.set_name() was added in Python 3.8, the method support will be mandatory for third-party task implementations since 3.13. stacklevel)set_nameAttributeErrorwarningswarnDeprecationWarning)tasknamer7s r$_set_task_namer>As  }H HTNNNNN  8 8 8 M9)Q 8 8 8 8 8 8 8 8s&AAceZdZdZdZddddfd ZfdZeeZ dZ dZ d Z d Z d Zd Zdd dZddddZddZdZdZdfd ZdZxZS)rz A coroutine wrapped in a Future.TN)r#r=contextct||jr|jd=tj|sd|_t d||dt|_nt||_d|_ d|_ d|_ ||_ |tj|_n||_|j|j|jt)|dS)Nr"Fza coroutine was expected, got zTask-rr@)super__init___source_tracebackr iscoroutine_log_destroy_pending TypeError_task_name_counter_namestr_num_cancels_requested _must_cancel _fut_waiter_coro contextvars copy_context_context_loop call_soon _Task__stepr)selfcoror#r=r@ __class__s r$rEz Task.__init__js d###  ! +&r*%d++ G).D %ETEEFF F <7!3!5!577DJJTDJ&'#! ?'466DMM#DM T[$-@@@tr%c|jtjkr7|jr0|dd}|jr |j|d<|j|tdS)Nz%Task was destroyed but it is pending!)r<messagesource_traceback) _stater_PENDINGrHrFrTcall_exception_handlerrD__del__)rWr@rYs r$r`z Task.__del__sy ;'* * *t/H *BG% E.2.D*+ J - -g 6 6 6 r%c*tj|SN)r _task_reprrWs r$__repr__z Task.__repr__s$T***r%c|jSrb)rPrds r$get_coroz Task.get_coro zr%c|jSrb)rKrds r$get_namez Task.get_namerhr%c.t||_dSrb)rLrK)rWvalues r$r7z Task.set_namesZZ r%c td)Nz*Task does not support set_result operationr0)rWresults r$ set_resultzTask.set_resultsGHHHr%c td)Nz-Task does not support set_exception operationrn)rW exceptions r$ set_exceptionzTask.set_exceptionsJKKKr%)limitc,tj||S)aReturn 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_task_get_stack)rWrts r$ get_stackzTask.get_stacks*)$666r%)rtfilec.tj|||S)anPrint 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_task_print_stack)rWrtrxs r$ print_stackzTask.print_stacks+D%>>>r%cd|_|rdS|xjdz c_|j|j|rdSd|_||_dS)aRequest 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). This also increases the task's count of cancellation requests. FrNmsgT)_log_tracebackr*rMrOcancelrN_cancel_message)rWr~s r$rz Task.cancelsx,$ 99;; 5 ##q(##   '&&3&// t "tr%c|jS)zReturn the count of the task's cancellation requests. This count is incremented when .cancel() is called and may be decremented using .uncancel(). rMrds r$ cancellingzTask.cancellings **r%cF|jdkr|xjdzc_|jS)zDecrement the task's count of cancellation requests. This should be called by the party that called `cancel()` on the task beforehand. Returns the remaining number of cancellation requests. rrrrds r$uncancelz Task.uncancels/  & * *  ' '1 , ' '**r%c|rtjd|d||jr5t |tjs|}d|_|j}d|_t|j | || d}n| |}t|dd}|8tj||j ur?t!d|d|d}|j |j||jn|r||ur;t!d |}|j |j||jnnd|_||j|j||_|jr'|j|j rd|_nt!d |d |}|j |j||jn|(|j |j|jnt3j|r>t!d |d |}|j |j||jnUt!d|}|j |j||jn#t6$rf}|jr/d|_t9|j n&t9|jYd}~nd}~wtj$r1}||_t9Yd}~nqd}~wt@tBf$r'}t9"|d}~wtF$r+}t9"|Yd}~nd}~wwxYwtI|j |d}dS#tI|j |d}wxYw)Nz_step(): already done: z, F_asyncio_future_blockingzTask z got Future z attached to a different looprCzTask cannot await on itself: r}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*rInvalidStateErrorrN isinstanceCancelledError_make_cancelled_errorrPrOrrTsendthrowgetattrrr)r0rUrVrSradd_done_callback _Task__wakeuprrinspect isgenerator StopIterationrDrprl_cancelled_excKeyboardInterrupt SystemExitrs BaseExceptionr)rWexcrXroblockingnew_excrYs r$__stepz Task.__steps 99;; =.;$;;C;;== =   &c:#<== 30022 %D zDJ%%%H {4C$v'A4HHH#$V,,DJ>>*CCC!CCCDDGJ(( Wdm)EEEEE~~".DDDD#F#F ,, K$--IIII;@700 M4=1BBB+1(,:#/66(,(< 7 > >:49 1*<#'<<17<<==GJ(( Wdm)EEEE $$T[$-$HHHH$V,, A&B)-BB7=BBCC $$K$-%AAAA''Hf'H'HII $$K$-%AAAA{ . . .  .$)!4#78888""39---(   "%D  GGNN        !:.    GG ! !# & & &  ' ' ' GG ! !# & & & & & & & & 'd  D ) ) )DDD  D ) ) )DKKKKsb-K=HO3 O AL+&O3+O='M)$O3)O="N O,!O O3OO33P c ||n,#t$r}||Yd}~nd}~wwxYwd}dSrb)rorVr)rWfuturers r$__wakeupz Task.__wakeup[sr  MMOOO KKMMMM    KK         s+ AAArb)__name__ __module__ __qualname____doc__rHrEr` classmethodr__class_getitem__rergrjr7rprsrwr{rrrrVr __classcell__rYs@r$rrNs+*. %)d6     $ L11+++   IIILLL"&77777.$(d ? ? ? ? ?((((T+++ + + +UUUUUUnr%r)r=r@ctj}|||}n|||}t|||S)z]Schedule the execution of a coroutine object in a spawn task. Return a Task object. NrC)rrrr>)rXr=r@r#r<s r$rrxsY  " $ $D%%g664 Kr%)timeout return_whencKtj|stj|r$t dt |j|std|tttfvrtd|t|}td|Drt dtj}t||||d{VS)a}Wait for the Futures or Tasks 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 zSet of Tasks/Futures is empty.zInvalid return_when value: c3>K|]}tj|VdSrb)rrG)r+fs r$ zwait..s- 1 1: !! $ $ 1 1 1 1 1 1r%z6Passing coroutines is forbidden, use tasks explicitly.N)risfuturerrGrItyper ValueErrorrrrsetanyrr_wait)fsrrr#s r$rrs Nz5b99NLb9JLLMMM ;9:::?O]KKKD{DDEEE RB 1 1b 1 1 111RPQQQ  " $ $Dr7K66 6 6 6 6 6 66r%c\|s|ddSdSrb)r*rp)waiterargss r$_release_waiterrs6 ;;== $  r%cKtj}||d{VS|dkrt||}|r|St ||d{V |S#t j$r}t j|d}~wwxYw| }| |t|}tj t|}t||}|| |d{Vn~#t j$rl|r*|cY|S||t ||d{VwxYw|r(||S||t ||d{V ||S#t j$r}t j|d}~wwxYw#|wxYw)aWait 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. Nrr")rrr r*ro_cancel_and_waitrr TimeoutError create_future call_laterr functoolspartialrrremove_done_callback)futrr#rrtimeout_handlecbs r$rrs  " $ $Dyyyyyy!||Cd+++ 88:: ::<< s.......... 5::<< ( 5 5 5)++ 4 5   ! !F__WovFFN  ?F 3 3B $ ' ' 'C"  LLLLLLLL(   xxzz zz||##2 /((,,,'s6666666666  88:: 9::<<   $ $R ( ( (#3T222 2 2 2 2 2 2 2 9zz|| , 9 9 9 -//S8 9 sf7B B3B..B3(D10I+17F,(I+>.F,,*I++,I+II(I##I((I++Jc K|s Jd| d |||t  t| fd}|D]}|| d{V  |D]}||n5#  |D]}||wxYwtt}}|D]A}|r| |,| |B||fS)zVInternal helper for wait(). The fs argument must be a collection of Futures. zSet of Futures is empty.Nc(dzdks>tks3tkri|sW|EsddSdSdSdSdS)Nrr)rr cancelledrrrr*rp)rcounterrrrs r$_on_completionz_wait.._on_completions1  qLL ? * * ? * *AKKMM *01 0I)%%''';;== (!!$''''' + * * *0I0I ( (r%) rrrlenrrrrr*add) rrrr#rrr*pendingrrrs ` @@@r$rrs )))))2    ! !FN/6JJ"ggG ( ( ( ( ( ( ( (,, N++++3  %  ! ! # # # 3 3A " "> 2 2 2 2 3  %  ! ! # # # 3 3A " "> 2 2 2 2 3EE355'D  6688  HHQKKKK KKNNNN =s 9B222C$c(K|}tjt|}|| ||d{V||dS#||wxYw)z.Qs& 9 9 9AM!$ ' ' ' 9 9 9r%NcD],}|d-dSrb)r put_nowaitclear)rrr*todos r$ _on_timeoutz!as_completed.._on_timeoutTsL " "A " "> 2 2 2 OOD ! ! ! ! r%csdS||sdSdSdSrb)removerr)rr*rrs r$rz$as_completed.._on_completionZsf  F A  $2  ! ! # # # # # $ $22r%cKd{V}| tj|Srb)r!rrro)rr*s r$ _wait_for_onez#as_completed.._wait_for_onebsB((**       9) )xxzzr%)rrrrGrIrrqueuesrr_get_event_looprrrranger) rrrrrr_rr*r#rrs @@@@@r$r r 8s$Sz5b99SQd2hh>OQQRRR 577D  ! # #D 9 9 9 9R 9 9 9DN $$$$$$$,, N++++ ?#+>> 3t99  moor%c#KdVdS)zSkip 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$__sleep0rqs EEEEEr%c>K|dkrtd{V|Stj}|}||t j||} |d{V |S#|wxYw)z9Coroutine that completes after a given time (in seconds).rN)rrrrrr_set_result_unless_cancelledr)delayror#rhs r$r r }s zzjj  " $ $D    ! !F < ( (A||||||   s )BBr"c$t||S)zmWrap a coroutine or an awaitable in a future. If the argument is a Future, it is returned directly. r")_ensure_future)coro_or_futurer#s r$r r s .t 4 4 44r%ctj|r)|%|tj|urtd|Sd}t j|s5t j|rt|}d}ntd|tj d} | |S#t$r|s|wxYw)NzRThe future belongs to a different loop than the one specified as the loop argumentFTz:An asyncio.Future, a coroutine or an awaitable is requiredr5)rrr)rrrGr isawaitable_wrap_awaitablerIrrrr0close)rr#called_wrap_awaitables r$rrs''  G,=n,M,M M MEFF F!  !. 1 1+  ~ . . +,^<tj}| g S fd}i}gd dd}d |D]u}||vrRt ||}|t j|}||urd|_ dz |||<||n||} |vt| S)aReturn 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. cdz r*|s|dSsl|r+|}|dS|}||dSkrg}D]x}|r#t j|jdn|j}n*|}||}| |yj r+|}|dS |dSdS)Nr) r*rrrrrsrrrroappendrrp) rrresultsresr nfinishednfutsouterrs r$_done_callbackzgather.._done_callbacksQ =EJJLL===??   F }} //11##C(((mmoo?'',,,F   G $ $==?? +%3!19+--CC--//C{!jjlls####& *//11##C(((((  )))));  r%rNr"Fr) rrrrprrr)rHrrr) rcoros_or_futuresr#r arg_to_futargrrrrrs ` @@@@r$r r sK< %''""$$  5*5*5*5*5*5*5*5*5*nJH EI D E j  4000C|(--#~~ ,1( QJE!JsO  ! !. 1 1 1 1S/C XD 1 1 1E Lr%ct|rStj}|fdfd}|S)aWait for a future, shielding it from cancellation. The statement task = asyncio.create_task(something()) res = await shield(task) 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: task = asyncio.create_task(something()) try: res = await shield(task) except CancelledError: res = None Save a reference to tasks passed to this function, to avoid a task disappearing mid-execution. The event loop only keeps weak references to tasks. A task that isn't referenced elsewhere may get garbage collected at any time, even before it's done. cr*|s|dS|rdS|}||dS|dSrb)rrrrrsrpro)innerrrs r$_inner_done_callbackz$shield.._inner_done_callback{s ??   ??$$ "!!! F ??   1 LLNNNNN//##C##C(((((  00000r%c^sdSdSrb)r*r)rr r s r$_outer_done_callbackz$shield.._outer_done_callbacks8zz|| =  & &'; < < < < < = =r%)rr*rr)rr)rr#r r r rs @@@r$r r SsB 3  E zz||  U # #D    E11111"====== 0111 0111 Lr%ctjstdtjfd}|S)zsSubmit a coroutine object to a given event loop. Return a concurrent.futures.Future to access the result. zA coroutine object is requiredc tjtdS#ttf$rt $r/}r|d}~wwxYw)Nr")r _chain_futurer rrrset_running_or_notify_cancelrs)rrXrr#s r$callbackz*run_coroutine_threadsafe..callbacks   !-4"@"@"@& I I I I I-.       2244 *$$S)))  s$)A3*A..A3)rrGrI concurrentrFuturecall_soon_threadsafe)rXr#rrs`` @r$rrs{  !$ ' ':8999   & & ( (F h''' Mr%c.tj|dS)z3Register a new task in asyncio as executed by loop.N)r/rr<s r$rrsN4r%crtj|}|td|d|d|t|<dS)NzCannot enter into task z while another task z is being executed.r r!r0r#r<rs r$rrsf!%d++LGTGG#/GGGHH HN4r%crtj|}||urtd|d|dt|=dS)Nz Leaving task z! does not match the current task .rrs r$rrsi!%d++L4A4AA/;AAABB Btr%c.tj|dS)zUnregister a task.N)r/discardrs r$rrstr%)rrrrr/r rb)Cr__all__concurrent.futuresrrQrr itertoolstypesr9weakrefrrrrrrrrcount__next__rJrrr> _PyFuturer_PyTask_asyncio_CTask ImportErrorrrrrrrrrrr coroutinerr r rrrrr r rWeakSetr/r rrrr_py_register_task_py_unregister_task_py_enter_task_py_leave_task_c_register_task_c_unregister_task _c_enter_task _c_leave_taskr(r%r$r4sy66  %%%%%% %Y_Q''0$$$$>>>>.   [[[[[7 [[[| "OOO M!D66    D #D     $$4$4"0 # 77777@   D D D N)))X % % %"!%66666r   "+/55555,02...!.w~:16xxxxxv???D0W_        #&  6666666666666666 &)MMMM    DD s$BBBE88FF__pycache__/taskgroups.cpython-311.pyc000064400000017657152533123130013676 0ustar00 !A?h!JdgZddlmZddlmZddlmZGddZdS) TaskGroup)events) exceptions)taskscTeZdZdZdZdZdZdZddddZd e d e fd Z d Z d Z dS)ra9Asynchronous context manager for managing groups of tasks. Example use: async with asyncio.TaskGroup() as group: task1 = group.create_task(some_coroutine(...)) task2 = group.create_task(other_coroutine(...)) print("Both tasks have completed now.") All tasks are awaited when the context manager exits. Any exceptions other than `asyncio.CancelledError` raised within a task will cancel all remaining tasks and wait for them to exit. The exceptions are then combined and raised as an `ExceptionGroup`. cd|_d|_d|_d|_d|_d|_t |_g|_d|_ d|_ dS)NF) _entered_exiting _aborting_loop _parent_task_parent_cancel_requestedset_tasks_errors _base_error_on_completed_futselfs ?/opt/alt/python-internal/lib64/python3.11/asyncio/taskgroups.py__init__zTaskGroup.__init__sV    (-%ee  !%ctdg}|jr*|dt|j|jr*|dt|j|jr|dn|jr|dd|}d|dS) Nztasks=zerrors= cancellingentered z )rappendlenrr r join)rinfoinfo_strs r__repr__zTaskGroup.__repr__(st ; 5 KK3T[!1!133 4 4 4 < 7 KK5#dl"3"355 6 6 6 > # KK % % % % ] # KK " " "88D>>'H''''rcK|jrtd|d|jtj|_t j|j|_|jtd|dd|_|S)N TaskGroup z has already been enteredz! cannot determine the parent taskT)r RuntimeErrorr rget_running_loopr current_taskr rs r __aenter__zTaskGroup.__aenter__6s = @>T>>>@@ @ : 022DJ!.tz::   $FTFFFHH H  rcKd|_|#||r|j||_|tjur|nd}|jr|jdkrd}||js| |j r{|j |j |_ |j d{Vn9#tj$r'}|js|}| Yd}~nd}~wwxYwd|_ |j {|j rJ|j|j|r |js||(|tjur|j||jr% t!d|j}|d#d|_wxYwdS)NTzunhandled errors in a TaskGroup)r _is_base_errorrrCancelledErrorrr uncancelr _abortrrr create_futurerrBaseExceptionGroup)retexctbpropagate_cancellation_errorexmes r __aexit__zTaskGroup.__aexit__Ds O##C((  ("D 222CC %  ( 4 ))++q0004, >>  k *%-)-)A)A)C)C& ",,,,,,,,,, " " "~ "460KKMMM "&*D "'k **;   '" " ( /  /. . >b (AAA L   $ $ $ < $ $'(I4<XXd"# #### $ $s$1 B??C5C00C5E22 E;N)namecontextc|jstd|d|jr|jstd|d|jrtd|d||j|}n|j||}tj||| |j |j ||S)zbCreate a new task in this group and return it. Similar to `asyncio.create_task`. r&z has not been enteredz is finishedz is shutting downN)r;) r r'r rr r create_taskr_set_task_nameadd_done_callback _on_task_doneadd)rcoror:r;tasks rr=zTaskGroup.create_tasks } KIDIIIJJ J = B B@D@@@AA A > GEDEEEFF F ?:))$//DD:))$)@@D T4((( t1222  rr4returncht|tsJt|ttfS)N) isinstance BaseException SystemExitKeyboardInterrupt)rr4s rr-zTaskGroup._is_base_errors.#}-----# ,=>???rcxd|_|jD]*}|s|+dS)NT)r rdonecancel)rts rr0zTaskGroup._abortsB  A6688    rc|j||j:|js3|js|jd|rdS|}|dS|j|| |r|j ||_ |j r,|j d|d|j d||ddS|js=|js8|d|_|j dSdSdS)NTzTask z% has errored out but its parent task z is already completed)message exceptionrC)rdiscardrrK set_result cancelledrPrrr-rr r call_exception_handlerr rr0rL)rrCr4s rr@zTaskGroup._on_task_dones D!!!  ! -dk -)..00 8&11$777 >>    Fnn ; F C     s # # #(8(@"D    ! ! # #  J - -L4LL#'#4LLL  //    F~ 'd&C '& KKMMM,0D )   $ $ & & & & &+ ' ' ' 'r)__name__ __module__ __qualname____doc__rr$r*r9r=rGboolr-r0r@rrrr s & & & ( ( (   O$O$O$b)-d0@-@D@@@@2'2'2'2'2'rN)__all__rrrrrrZrrr\s -^'^'^'^'^'^'^'^'^'^'r__pycache__/unix_events.cpython-311.opt-2.pyc000064400000203651152533123130014772 0ustar00 !A?h ddlZddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl m Z ddl mZddl mZddl mZddl mZddl mZdd l mZdd l mZdd l mZdd l mZdd lmZdZe jdkr eddZdZGddejZGddej Z!Gddej"ej#Z$Gddej%Z&GddZ'Gdde'Z(Gdd e'Z)Gd!d"e)Z*Gd#d$e)Z+Gd%d&e'Z,Gd'd(e'Z-Gd)d*ej.Z/eZ0e/Z1dS)+N) base_events)base_subprocess) constants) coroutines)events) exceptions)futures)selector_events)tasks) transports)logger)SelectorEventLoopAbstractChildWatcherSafeChildWatcherFastChildWatcherPidfdChildWatcherMultiLoopChildWatcherThreadedChildWatcherDefaultEventLoopPolicywin32z+Signals are not really supported on Windowsc dSN)signumframes @/opt/alt/python-internal/lib64/python3.11/asyncio/unix_events.py_sighandler_noopr*s DcP tj|S#t$r|cYSwxYwr)oswaitstatus_to_exitcode ValueError)statuss rr"r"/s>(000  s  %%ceZdZ dfd ZfdZdZdZdZdZdZ dd Z dd Z dd Z d Z ddddddd dZ dddddddddZdZdZdZdZxZS)_UnixSelectorEventLoopNcXt|i|_dSr)super__init___signal_handlers)selfselector __class__s rr)z_UnixSelectorEventLoop.__init__?s) """ "rcNttjs.t |jD]}||dS|jr;tjd|dt||j dSdS)NzClosing the loop z@ on interpreter shutdown stage, skipping signal handlers removalsource) r(closesys is_finalizinglistr*remove_signal_handlerwarningswarnResourceWarningclear)r+sigr-s rr1z_UnixSelectorEventLoop.closeCs   "" .D122 0 0**3//// 0 0$ . I$III.%) ++++ %++-----  . .rc@|D]}|s||dSr)_handle_signal)r+datars r_process_self_dataz)_UnixSelectorEventLoop._process_self_dataQs= ( (F     ' ' ' '  ( (rcT tj|stj|rtd||| t j|j n5#ttf$r!}tt|d}~wwxYwtj|||d}||j|< t j|t"t j|ddS#t$r}|j|=|jsI t jdn3#ttf$r}t'jd|Yd}~nd}~wwxYw|jt*jkrtd|dd}~wwxYw)Nz3coroutines cannot be used with add_signal_handler()Fset_wakeup_fd(-1) failed: %ssig  cannot be caught)r iscoroutineiscoroutinefunction TypeError _check_signal _check_closedsignal set_wakeup_fd_csockfilenor#OSError RuntimeErrorstrrHandler*r siginterruptrinfoerrnoEINVAL)r+r:callbackargsexchandlenexcs radd_signal_handlerz)_UnixSelectorEventLoop.add_signal_handlerXs  "8 , , 9.x88 9899 9 3  )  !3!3!5!5 6 6 6 6G$ ) ) )s3xx(( ( )xtT::%+c"  M#/ 0 0 0  U + + + + +   %c*( FF(,,,,"G,FFFK >EEEEEEEEFyEL(("#@##@#@#@AAA sZ#+BC B<<C&/D F'!F"1EF"E6E1,F"1E66,F""F'c |j|}|dS|jr||dS||dSr)r*get _cancelledr5_add_callback_signalsafe)r+r:rXs rr<z%_UnixSelectorEventLoop._handle_signalsd@&**3// > F   2  & &s + + + + +  ) )& 1 1 1 1 1rc || |j|=n#t$rYdSwxYw|tjkr tj}n tj} tj||n;#t$r.}|jtj krtd|dd}~wwxYw|jsI tj dn3#ttf$r}tjd|Yd}~nd}~wwxYwdS)NFrBrCr@rAT)rGr*KeyErrorrISIGINTdefault_int_handlerSIG_DFLrMrSrTrNrJr#rrR)r+r:handlerrWs rr5z,_UnixSelectorEventLoop.remove_signal_handlersP  3 %c**   55  &-  0GGnG  M#w ' ' ' '   yEL(("#@##@#@#@AAA   $ A A$R((((( A A A :C@@@@@@@@ Ats<! //A22 B*<)B%%B*5C C:C55C:c t|tstd||tjvrt d|dS)Nzsig must be an int, not zinvalid signal number ) isinstanceintrFrI valid_signalsr#)r+r:s rrGz$_UnixSelectorEventLoop._check_signalsf #s## @>s>>?? ? f*,, , ,;c;;<< < - ,rc(t|||||Sr)_UnixReadPipeTransportr+pipeprotocolwaiterextras r_make_read_pipe_transportz0_UnixSelectorEventLoop._make_read_pipe_transports%dD(FEJJJrc(t|||||Sr)_UnixWritePipeTransportrks r_make_write_pipe_transportz1_UnixSelectorEventLoop._make_write_pipe_transports&tT8VUKKKrc Ktj5} | std|} t ||||||||f| |d| } | | |j|  | d{VnN#ttf$rt$r0| | d{VwxYw dddn #1swxYwY| S)NzRasyncio.get_child_watcher() is not activated, subprocess support is not installed.)rnro)rget_child_watcher is_activerN create_future_UnixSubprocessTransportadd_child_handlerget_pid_child_watcher_callback SystemExitKeyboardInterrupt BaseExceptionr1_wait) r+rmrVshellstdinstdoutstderrbufsizerokwargswatcherrntransps r_make_subprocess_transportz1_UnixSelectorEventLoop._make_subprocess_transports % ' ' 7$$&& K #$JKKK''))F-dHdE.3VVW85;5881788F  % %fnn&6&6&*&BF L L L   12        llnn$$$$$$$ #               2 s+A=C8BC8A C((C88C<?C<cH||j|j|dSr)call_soon_threadsafe call_soon_process_exited)r+pid returncoders rr{z._UnixSelectorEventLoop._child_watcher_callbacks% !!$.&2H*UUUUUr)sslsockserver_hostnamessl_handshake_timeoutssl_shutdown_timeoutcK|r|tdn3|td|td|td||tdtj|}tjtjtjd} |d|||d{Vn|#|xYw|td|j tjks|j tjkrtd ||d| |||||| d{V\}} || fS) Nz/you have to pass server_hostname when using sslz+server_hostname is only meaningful with ssl1ssl_handshake_timeout is only meaningful with ssl0ssl_shutdown_timeout is only meaningful with ssl3path and sock can not be specified at the same timerFzno path and sock were specified.A UNIX Domain Stream Socket was expected, got )rr) r#r!fspathsocketAF_UNIX SOCK_STREAM setblocking sock_connectr1familytype_create_connection_transport) r+protocol_factorypathrrrrr transportrms rcreate_unix_connectionz-_UnixSelectorEventLoop.create_unix_connections  H& EGGG'* !NOOO$0 GIII#/ FHHH   IKKK9T??D=1CQGGD   '''''d3333333333  | !BCCC v~--I!333 MTMMOOO   U # # #$($E$E "C"7!5%F%7%7777777 8(""s 1CC%dT)rbacklogrrr start_servingc Kt|trtd||std||std|Z|tdt j|}t jt jt j}|ddvry tj t j |j rt j |n8#t$rYn,t$r } tjd|| Yd} ~ nd} ~ wwxYw ||n#t$rP} || jt&jkr!d|d } tt&j| dd} ~ w|xYw|td |jt jks|jt jkrtd ||d t1j||g|||||} |r.| t7jdd{V| S) Nz*ssl argument must be an SSLContext or Nonerrrr)rz2Unable to check or remove stale UNIX socket %r: %rzAddress z is already in usez-path was not specified, and no sock specifiedrF)rfboolrFr#r!rrrrstatS_ISSOCKst_moderemoveFileNotFoundErrorrMrerrorbindr1rS EADDRINUSErrrrServer_start_servingr sleep) r+rrrrrrrrerrrWmsgservers rcreate_unix_serverz)_UnixSelectorEventLoop.create_unix_servers c4  JHII I ,S ,CEE E +C +BDD D   IKKK9T??D=1CDDDAwk))6}RWT]]%:;;( $(D666L"*+/666666666  $    9 000@T???C!%"2C88dB  | CEEE v~--I!333 MTMMOOO #D4&2B$'2G$8::  !  ! ! # # #+a..  s7)?C)) D5 D>DD"D88 F'A F  F'c K tjn"#t$rtjdwxYw |}n2#tt jf$r}tjdd}~wwxYw tj|j }n"#t$rtjdwxYw|r|n|}|sdS| } | | d|||||d| d{VS)Nzos.sendfile() is not availableznot a regular filer) r!sendfileAttributeErrorr SendfileNotAvailableErrorrLioUnsupportedOperationfstatst_sizerMrw_sock_sendfile_native_impl) r+rfileoffsetcountrLrfsize blocksizefuts r_sock_sendfile_nativez,_UnixSelectorEventLoop._sock_sendfile_native`sN 2 KKK 2 2 26022 2 2 M[[]]FF 78 M M M67KLL L M MHV$$,EE M M M67KLL L M"-EE  1  "" ''T4(.y! E E Eyyyyyys+ 0A A8A33A8<BB5c L|} ||||r||||dS|r9||z }|dkr.||||||dS t j| |||} | dkr.||||||dS|| z }|| z }|||||| |j || |||||| dS#ttf$r?|||||| |j || |||||| YdSt$r} |N| j tjkr9t| t ur#t!dtj} | | _| } |dkrAt%jd} |||||| n2|||||| Yd} ~ dSYd} ~ dSd} ~ wt*t,f$rt.$r7} |||||| Yd} ~ dSd} ~ wwxYw)Nrzsocket is not connectedzos.sendfile call failed)rL remove_writer cancelled_sock_sendfile_update_filepos set_resultr!r_sock_add_cancellation_callback add_writerrBlockingIOErrorInterruptedErrorrMrSENOTCONNrConnectionError __cause__r r set_exceptionr|r}r~)r+r registered_fdrrLrrr total_sentfdsentrWnew_excrs rrz1_UnixSelectorEventLoop._sock_sendfile_native_implwsb [[]]  $   } - - - ==??   . .vvz J J J F   *IA~~2266:NNNz***1 F;r669==DJqyy2266:NNNz*****$d"  (88dCCCD$CS "D& &y*FFFFF[ !12 B B B$44S$??? OOB ?f"E9j B B B B B B ' ' ')I//II_44 *-u~??$'!Q !:-//2266:NNN!!#&&&&2266:NNN!!#&&&&&&&&&'&&&&&-.     # # #  . .vvz J J J   c " " " " " " " " " #s,D''A J#6 J#?CIJ#,,JJ#cV|dkr"tj||tjdSdSNr)r!lseekSEEK_SET)r+rLrrs rrz4_UnixSelectorEventLoop._sock_sendfile_update_fileposs. >> HVVR[ 1 1 1 1 1 >rc@fd}||dS)Nc|r1}|dkr|dSdSdS)Nr@)rrLr)rrr+rs rcbzB_UnixSelectorEventLoop._sock_add_cancellation_callback..cbsR}} +[[]]88&&r***** + +8r)add_done_callback)r+rrrs` ` rrz6_UnixSelectorEventLoop._sock_add_cancellation_callbacks> + + + + + + b!!!!!rrNN)__name__ __module__ __qualname__r)r1r>rZr<r5rGrprsrr{rrrrrr __classcell__r-s@rr&r&9s ###### . . . . .(((+++Z222@ = = =@D(,KKKKAE)-LLLL 04<VVV *.0#4 "&!% 0#0#0#0#0#f*.Gs"&!% GGGGGR.DFDFDFL222"""""""rr&ceZdZdZdfd ZdZdZdZdZdZ d Z d Z d Z d Z d ZejfdZddZdZdZxZS)rjiNct|||jd<||_||_||_||_d|_d|_ tj |jj }tj|sLtj|s8tj|s$d|_d|_d|_t#dtj|jd|j|jj||j|j|j|j|(|jt.j|ddSdS)NrlFz)Pipe transport is for pipes/sockets only.)r(r)_extra_loop_piperL_fileno _protocol_closing_pausedr!rrrS_ISFIFOrS_ISCHRr# set_blockingrconnection_made _add_reader _read_readyr _set_result_unless_cancelled)r+looprlrmrnromoder-s rr)z_UnixReadPipeTransport.__init__sb " F  {{}} !  x %%- d## J d## J T"" JDJDL!DNHII I  e,,, T^;TBBB T-!\4+; = = =   J !E!' / / / / /  rch|sdS|j||dSr) is_readingrr)r+rrUs rrz"_UnixReadPipeTransport._add_readers7    F r8,,,,,rc"|j o|j Sr)rrr+s rrz!_UnixReadPipeTransport.is_readings<5 $55rc`|jjg}|j|dn|jr|d|d|jt |jdd}|jU|Stj ||jtj }|r|dnH|dn2|j|dn|dd d |S) Nclosedclosingfd= _selectorpollingidleopen<{}> )r-rrappendrrgetattrrr _test_selector_event selectors EVENT_READformatjoin)r+rRr,rs r__repr__z_UnixReadPipeTransport.__repr__s '( :  KK ! ! ! ! ] # KK " " " ($,(()))4:{D99 : !h&:%:$, (<>>G $ I&&&& F#### Z # KK     KK ! ! !}}SXXd^^,,,rc4 tj|j|j}|r|j|dS|jrtj d|d|_ |j |j|j |jj |j |jddS#tt f$rYdSt"$r!}||dYd}~dSd}~wwxYw)N%r was closed by peerTz"Fatal read error on pipe transport)r!readrmax_sizer data_receivedr get_debugrrRr_remove_readerr eof_received_call_connection_lostrrrM _fatal_error)r+r=rWs rrz"_UnixReadPipeTransport._read_ready s5 G74<77D  G,,T22222:''))?K 7>>> $  ))$,777 $$T^%@AAA $$T%?FFFFF !12    DD I I I   c#G H H H H H H H H H IsCD- D6DDc|sdSd|_|j|j|jrt jd|dSdS)NTz%r pauses reading)rrrrrrrdebugrs r pause_readingz$_UnixReadPipeTransport.pause_readingsq    F  !!$,/// :   ! ! 4 L,d 3 3 3 3 3 4 4rc|js|jsdSd|_|j|j|j|jrtjd|dSdS)NFz%r resumes reading) rrrrrrrrrrs rresume_readingz%_UnixReadPipeTransport.resume_reading#sw =    F  t|T-=>>> :   ! ! 5 L-t 4 4 4 4 4 5 5rc||_dSrrr+rms r set_protocolz#_UnixReadPipeTransport.set_protocol+ !rc|jSrr#rs r get_protocolz#_UnixReadPipeTransport.get_protocol. ~rc|jSrrrs r is_closingz!_UnixReadPipeTransport.is_closing1 }rcB|js|ddSdSr)r_closers rr1z_UnixReadPipeTransport.close4s.}  KK       rcv|j1|d|t||jdSdSNzunclosed transport r/rr8r1r+_warns r__del__z_UnixReadPipeTransport.__del__8L : ! E000/$ O O O O J        " !rFatal error on pipe transportc0t|trG|jtjkr2|jrt jd||dn$|j||||j d| |dSNz%r: %sTexc_info)message exceptionrrm) rfrMrSEIOrrrrcall_exception_handlerrr/r+rWr<s rrz#_UnixReadPipeTransport._fatal_error=s sG $ $ ei)?)?z##%% E XtWtDDDD J - -" ! N //    Crcd|_|j|j|j|j|dSNT)rrrrrrr+rWs rr/z_UnixReadPipeTransport._closeKsB  !!$,/// T7=====rc |j||jd|_d|_d|_dS#|jd|_d|_d|_wxYwrrconnection_lostrr1rrCs rrz,_UnixReadPipeTransport._call_connection_lostP  N * *3 / / / J     DJ!DNDJJJ J     DJ!DNDJ     A 0A<rr7)rrrrr)rrrrrr!r%r(r,r1r6r7r5rr/rrrs@rrjrjs(H//////<--- 666---*GGG$444555"""%M    >>> rrjceZdZdfd ZdZdZdZdZdZdZ d Z d Z d Z d Z d ZejfdZdZddZddZdZxZS)rrNcpt||||jd<||_||_||_t|_d|_ d|_ tj |jj }tj|}tj|}tj|} |s(|s&| s$d|_d|_d|_t%dtj|jd|j|jj|| s!|rOt.jds0|j|jj|j|j|(|jt8j|ddSdS)NrlrFz?Pipe transport is only for pipes, sockets and character devicesaix)r(r)rrrLrr bytearray_buffer _conn_lostrr!rrrrrrr#rrrrr2platform startswithrrr r) r+rrlrmrnroris_charis_fifo is_socketr-s rr)z _UnixWritePipeTransport.__init__]s %%%" F {{}} ! {{  x %%-,t$$-%%M$''  E7 Ei EDJDL!DNDEE E  e,,, T^;TBBB  A A)@)@)G)G A J !7!%t/? A A A   J !E!' / / / / /  rc|jjg}|j|dn|jr|d|d|jt |jdd}|j|tj ||jtj }|r|dn|d| }|d|n2|j|dn|dd d |S) Nrrrrrrzbufsize=rr r )r-rrr rrr rr r r EVENT_WRITEget_write_buffer_sizerr)r+rRr,rrs rrz _UnixWritePipeTransport.__repr__sL'( :  KK ! ! ! ! ] # KK " " " ($,(()))4:{D99 : !h&:%:$, (=??G $ I&&&& F###0022G KK,7,, - - - - Z # KK     KK ! ! !}}SXXd^^,,,rc*t|jSr)lenrNrs rrWz-_UnixWritePipeTransport.get_write_buffer_sizes4<   rc|jrtjd||jr#|t dS|dS)Nr)rrrrRrNr/BrokenPipeErrorrs rrz#_UnixWritePipeTransport._read_readysd :   ! ! 7 K/ 6 6 6 <  KK)) * * * * * KKMMMMMrct|trt|}|sdS|js|jr;|jt jkrtjd|xjdz c_dS|j s tj |j |}nc#ttf$rd}YnNtt f$rt"$r1}|xjdz c_||dYd}~dSd}~wwxYw|t'|krdS|dkrt||d}|j|j |j|xj |z c_ |dS)Nz=pipe closed by peer or os.write(pipe, data) raised exception.rr#Fatal write error on pipe transport)rfrM memoryviewrOrr!LOG_THRESHOLD_FOR_CONNLOST_WRITESrwarningrNr!writerrrr|r}r~rrYr _add_writer _write_ready_maybe_pause_protocol)r+r=nrWs rraz_UnixWritePipeTransport.writes dI & & $d##D  F ? dm )"MMM HIII OOq OO F| D HT\400#%56    12       1$!!#'LMMM CII~~Q!$''+ J " "4<1B C C C   ""$$$$$s:BC5*C5&C00C5c tj|j|j}|t |jkr|j|j|j||j r4|j |j| ddS|dkr |jd|=dSdS#ttf$rYdSttf$rt $ri}|j|xjdz c_|j|j||dYd}~dSd}~wwxYw)Nrrr])r!rarrNrYr9r_remove_writer_maybe_resume_protocolrrrrrr|r}r~rOr)r+rerWs rrcz$_UnixWritePipeTransport._write_readys %t|44AC %%%% ""$$$ ))$,777++---=5J--dl;;;..t444QL!$$$) !12    DD-.     J J J L   OOq OO J % %dl 3 3 3   c#H I I I I I I I I I  JsCE-*E-AE((E-cdSrBrrs r can_write_eofz%_UnixWritePipeTransport.can_write_eoftrc|jrdSd|_|jsA|j|j|j|jddSdSrB)rrNrrrrrrs r write_eofz!_UnixWritePipeTransport.write_eofsh =  F | C J % %dl 3 3 3 J !;T B B B B B C Crc||_dSrr#r$s rr%z$_UnixWritePipeTransport.set_protocolr&rc|jSrr#rs rr(z$_UnixWritePipeTransport.get_protocolr)rc|jSrr+rs rr,z"_UnixWritePipeTransport.is_closingr-rcR|j|js|dSdSdSr)rrrmrs rr1z_UnixWritePipeTransport.closes5 : !$- ! NN      " ! ! !rcv|j1|d|t||jdSdSr1r2r3s rr5z_UnixWritePipeTransport.__del__r6rc0|ddSr)r/rs rabortz_UnixWritePipeTransport.aborts Drr7ct|tr2|jrt jd||dn$|j||||jd||dSr9) rfrMrrrrr?rr/r@s rrz$_UnixWritePipeTransport._fatal_errors c7 # # z##%% E XtWtDDDD J - -" ! N //    Crcd|_|jr|j|j|j|j|j|j|j|dSrB) rrNrrgrr9rrrrCs rr/z_UnixWritePipeTransport._closesx < 4 J % %dl 3 3 3  !!$,/// T7=====rc |j||jd|_d|_d|_dS#|jd|_d|_d|_wxYwrrErCs rrz-_UnixWritePipeTransport._call_connection_lostrGrHrrIr)rrrr)rrWrrarcrjrmr%r(r,r1r6r7r5rtrr/rrrs@rrrrrZsH#/#/#/#/#/#/J---0!!!!%!%!%F%%%8CCC""" %M     >>>>rrrceZdZdZdS)rxc d}|tjkr5tjdrt j\}} tj|f||||d|d||_|D| t| d||j_ d}|*| | dSdS#|)| | wwxYw)NrLF)rrrruniversal_newlinesrwb) buffering) subprocessPIPEr2rPrQr socketpairPopen_procr1rdetachr) r+rVrrrrrrstdin_ws r_startz_UnixSubprocessTransport._start)s JO # # (?(?(F(F # $.00NE7 #)E!vf#('EE=CEEDJ" #'(8(8$'#R#R#R  "  #"w"  #s A$C-DN)rrrrrrrrxrx's#     rrxc:eZdZ dZdZdZdZdZdZdZ dS) rc trNotImplementedErrorr+rrUrVs rryz&AbstractChildWatcher.add_child_handlerVs "###rc trrr+rs rremove_child_handlerz)AbstractChildWatcher.remove_child_handleras 1 "###rc trrr+rs r attach_loopz AbstractChildWatcher.attach_loopis "###rc trrrs rr1zAbstractChildWatcher.closess "###rc trrrs rrvzAbstractChildWatcher.is_activezs "###rc trrrs r __enter__zAbstractChildWatcher.__enter__s *"###rc trrr+abcs r__exit__zAbstractChildWatcher.__exit__s(!###rN) rrrryrrr1rvrrrrrrr?s, $ $ $$$$$$$$$$$$$$$$ $$$$$rrcFeZdZ dZdZdZdZdZdZdZ dZ d Z d S) rc"d|_i|_dSrr _callbacksrs rr)zPidfdChildWatcher.__init__ rc|Srrrs rrzPidfdChildWatcher.__enter__ rcdSrr)r+exc_type exc_value exc_tracebacks rrzPidfdChildWatcher.__exit__ rcF|jduo|jSrr is_runningrs rrvzPidfdChildWatcher.is_active"z%A$**?*?*A*AArc0|ddSrrrs rr1zPidfdChildWatcher.close rc6|j#|!|jrtjdt|jD]4\}}}|j|tj|5|j ||_dSNzCA loop is being detached from a child watcher with pending handlers) rrr6r7RuntimeWarningvaluesrr!r1r9)r+rpidfd_s rrzPidfdChildWatcher.attach_loops : !dltl M=    ?1133  KE1a J % %e , , , HUOOOO  rc|j|}||d||f|j|<dStj|}|j||j||||f|j|<dSr)rr\r! pidfd_openrr_do_wait)r+rrUrVexistingrs rryz#PidfdChildWatcher.add_child_handlers~?&&s++  #+A;$#>DOC M#&&E J " "5$- = = =#((D#8DOC rcR|j|\}}}|j| t j|d\}}t |}n'#t$rd}tj d|YnwxYwt j ||||g|RdS)NrzJchild process pid %d exit status already read: will report returncode 255) rpoprrr!waitpidr"ChildProcessErrorrr`r1)r+rrrUrVrr$rs rrzPidfdChildWatcher._do_waits $ 3 3C 8 8x !!%((( 8 3**IAv077JJ!   J N.        j(4((((((sA""!BBc |j|\}}}n#t$rYdSwxYw|j|t j|dS)NFT)rrr`rrr!r1)r+rrrs rrz&PidfdChildWatcher.remove_child_handlersn /--c22KE1aa   55  !!%((( ts ! //N) rrrr)rrrvr1rryrrrrrrrs    BBB   999)))&rrc8eZdZdZdZdZdZdZdZdZ dS) BaseChildWatcherc"d|_i|_dSrrrs rr)zBaseChildWatcher.__init__rrc0|ddSrrrs rr1zBaseChildWatcher.closerrcF|jduo|jSrrrs rrvzBaseChildWatcher.is_activerrctrr)r+ expected_pids r _do_waitpidzBaseChildWatcher._do_waitpid!###rctrrrs r_do_waitpid_allz BaseChildWatcher._do_waitpid_allrrc8|j#|!|jrtjdt|j$|jt j||_|;|t j|j | dSdSr) rrr6r7rr5rISIGCHLDrZ _sig_chldrrs rrzBaseChildWatcher.attach_loops : !dltl M=   : ! J , ,V^ < < <    # #FNDN C C C  " " " " "  rc |dS#ttf$rt$r(}|jd|dYd}~dSd}~wwxYw)N$Unknown exception in SIGCHLD handler)r<r=)rr|r}r~rr?rCs rrzBaseChildWatcher._sig_chlds   " " " " "-.        J - -A //           sAAAN) rrrr)r1rvrrrrrrrrrsBBB$$$$$$###(     rrcDeZdZ fdZdZdZdZdZdZdZ xZ S)rcz|jtdSr)rr9r(r1r+r-s rr1zSafeChildWatcher.closes,   rc|Srrrs rrzSafeChildWatcher.__enter__ rrcdSrrrs rrzSafeChildWatcher.__exit__#rrcH||f|j|<||dSr)rrrs rryz"SafeChildWatcher.add_child_handler&s/ ($/ rc: |j|=dS#t$rYdSwxYwNTFrr`rs rrz%SafeChildWatcher.remove_child_handler,8 $4   55   c^t|jD]}||dSrr4rrrs rrz SafeChildWatcher._do_waitpid_all3s<(( " "C   S ! ! ! ! " "rc tj|tj\}}|dkrdSt|}|jrt jd||n)#t$r|}d}t j d|YnwxYw |j |\}}|||g|RdS#t$r7|jrt j d|dYdSYdSwxYw)Nr$process %s exited with returncode %sr8Unknown child process pid %d, will report returncode 255'Child watcher got an unexpected pid: %rTr:) r!rWNOHANGr"rrrrrr`rrr`)r+rrr$rrUrVs rrzSafeChildWatcher._do_waitpid8so 7*\2:>>KCaxx/77Jz##%% 7 C):777!   CJ NJ       $ -!_0055NHd HS* ,t , , , , , , 3 3 3z##%% 3H"T3333333 3 3 3 3s#"A++#BBB>>:C?>C?) rrrr1rrryrrrrrs@rrrs    """ - - - - - - -rrcHeZdZ fdZfdZdZdZdZdZdZ xZ S)rcttj|_i|_d|_dSr)r(r) threadingLock_lock_zombies_forksrs rr)zFastChildWatcher.__init__es: ^%%   rc|j|jtdSr)rr9rr(r1rs rr1zFastChildWatcher.closeks@    rch|j5|xjdz c_|cdddS#1swxYwYdS)Nr)rrrs rrzFastChildWatcher.__enter__ps Z   KK1 KK                  s '++c |j5|xjdzc_|js|js ddddSt|j}|jdddn #1swxYwYt jd|dS)Nrz5Caught subprocesses termination from unknown pids: %s)rrrrOr9rr`)r+rrrcollateral_victimss rrzFastChildWatcher.__exit__vs Z " " KK1 KK{ $-   " " " " " " " " "%T]!3!3  M   ! ! ! " " " " " " " " " " " " " " "  C      s A.-A..A25A2c|j5 |j|}n(#t$r||f|j|<YddddSwxYw dddn #1swxYwY|||g|RdSr)rrrr`r)r+rrUrVrs rryz"FastChildWatcher.add_child_handlersZ   !]..s33    '/~$                          j(4((((((s0A%AA A A  AA!Ac: |j|=dS#t$rYdSwxYwrrrs rrz%FastChildWatcher.remove_child_handlerrrc~ tjdtj\}}|dkrdSt|}n#t$rYdSwxYw|j5 |j|\}}|j rtj d||n_#t$rR|j rF||j|<|j rtj d||Ydddd}YnwxYwdddn #1swxYwY|tjd||n |||g|R=)NTr@rrz,unknown process %s exited with returncode %sz8Caught subprocess termination from unknown pid: %d -> %d)r!rrr"rrrrrrrrr`rrr`)r+rr$rrUrVs rrz FastChildWatcher._do_waitpid_alls% 1 < jRZ88 V !88F3F;; %     6 66%)_%8%8%=%=NHdz++--6 %K%(*666 $ $ ${!-7 c*://11:"L*>),j:::! 6 6 6 6 6 6 6 $HHH $ 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6& #Z1111j040000K% 1sR"= A  A DB$40D$A D.D;D=D?DDDD) rrrr)r1rrryrrrrs@rrr[s       ) ) )(1(1(1(1(1(1(1rrcReZdZ dZdZdZdZdZdZdZ dZ d Z d Z d Z d S) rc"i|_d|_dSr)r_saved_sighandlerrs rr)zMultiLoopChildWatcher.__init__s!%rc|jduSr)rrs rrvzMultiLoopChildWatcher.is_actives%T11rc|j|jdStjtj}||jkrtjdn$tjtj|jd|_dS)Nz+SIGCHLD handler was changed by outside code) rr9rrI getsignalrrrr`)r+rds rr1zMultiLoopChildWatcher.closes|   ! ) F"6>22 dn $ $ NH I I I I M&.$*@ A A A!%rc|Srrrs rrzMultiLoopChildWatcher.__enter__rrcdSrrr+rexc_valexc_tbs rrzMultiLoopChildWatcher.__exit__rrcptj}|||f|j|<||dSr)rget_running_looprr)r+rrUrVrs rryz'MultiLoopChildWatcher.add_child_handlers?&(( $h5 rc: |j|=dS#t$rYdSwxYwrrrs rrz*MultiLoopChildWatcher.remove_child_handlerrrc|jdStjtj|j|_|j%t jdtj|_tjtjddS)NzaPrevious SIGCHLD handler was set by non-Python code, restore to default handler on watcher close.F)rrIrrrr`rcrQrs rrz!MultiLoopChildWatcher.attach_loopsw  ! - F!'v~t~!N!N  ! ) NJ K K K%+^D " FNE22222rc^t|jD]}||dSrrrs rrz%MultiLoopChildWatcher._do_waitpid_alls<(( " "C   S ! ! ! ! " "rc4 tj|tj\}}|dkrdSt|}d}n+#t$r|}d}t jd|d}YnwxYw |j|\}}}| rt jd||dS|r*| rt j d|||j |||g|RdS#t$rt jd|d YdSwxYw) NrTrrF%Loop %r that handles pid %r is closedrrr:)r!rrr"rrr`rr is_closedrrrr`) r+rrr$r debug_logrrUrVs rrz!MultiLoopChildWatcher._do_waitpids *\2:>>KCaxx/77JII!   CJ NJ   III   L#'?#6#6s#;#; D(D~~ LFcRRRRR;!1!1;L!G!-z;;;))(CKdKKKKKK / / / ND / / / / / / / /s!">%A&%A&*C22!DDc |dS#ttf$rt$rt jddYdSwxYw)NrTr:)rr|r}r~rr`)r+rrs rrzMultiLoopChildWatcher._sig_chld8sy R  " " " " "-.     R R R NAD Q Q Q Q Q Q Q Rs1A  A N)rrrr)rvr1rrryrrrrrrrrrrs $&&&222 & & &   333""""#L#L#LJRRRRRrrcZeZdZ dZdZdZdZdZej fdZ dZ dZ d Z d Zd S) rcFtjd|_i|_dSr) itertoolsr _pid_counter_threadsrs rr)zThreadedChildWatcher.__init__Ns%OA.. rcdSrBrrs rrvzThreadedChildWatcher.is_activeRrkrcdSrrrs rr1zThreadedChildWatcher.closeUrrc|Srrrs rrzThreadedChildWatcher.__enter__XrrcdSrrrs rrzThreadedChildWatcher.__exit__[rrcdt|jD}|r||jdt|dSdS)Nc:g|]}||Sr)is_alive).0threads r z0ThreadedChildWatcher.__del__.._s6)))foo'')6)))rz0 has registered but not finished child processesr/)r4rrr-r8)r+r4threadss rr5zThreadedChildWatcher.__del__^s}))T]-A-A-C-C(D(D)))   ET^UUU!        rctj}tj|jdt |j||||fd}||j|<|dS)Nzasyncio-waitpid-T)targetnamerVdaemon) rrrThreadrnextrrstart)r+rrUrVrrs rryz&ThreadedChildWatcher.add_child_handlerfsp&((!)9'S$t?P:Q:Q'S'S(,c8T'B)-///$ c rcdSrBrrs rrz)ThreadedChildWatcher.remove_child_handleros trcdSrrrs rrz ThreadedChildWatcher.attach_loopurrc tj|d\}}t|}|rt jd||n)#t $r|}d}t jd|YnwxYw|rt jd||n|j |||g|R|j |dS)Nrrrrr) r!rr"rrrrr`rrrr)r+rrrUrVrr$rs rrz ThreadedChildWatcher._do_waitpidxs 7*\155KC077J~~ 7 C):777!   CJ NJ        >>   H NBD# N N N N %D %hZ G$ G G G G ,'''''sA#A:9A:N)rrrr)rvr1rrr6r7r5ryrrrrrrrrAs       %M    (((((rrc@eZdZ eZfdZdZfdZdZdZ xZ S)_UnixDefaultEventLoopPolicycVtd|_dSr)r(r)_watcherrs rr)z$_UnixDefaultEventLoopPolicy.__init__s$  rctj5|jt|_ddddS#1swxYwYdSr)rrrrrs r _init_watcherz)_UnixDefaultEventLoopPolicy._init_watchers \ 7 7}$ 4 6 6  7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7s 599c t||jBtjtjur|j|dSdSdSr)r(set_event_looprrcurrent_thread main_threadr)r+rr-s rr#z*_UnixDefaultEventLoopPolicy.set_event_loopsq  t$$$ M %(**i.C.E.EEE M % %d + + + + + & %EErcH |j||jSr)rr!rs rruz-_UnixDefaultEventLoopPolicy.get_child_watchers+  =    }rcV |j|j||_dSr)rr1)r+rs rset_child_watcherz-_UnixDefaultEventLoopPolicy.set_child_watchers.2 = $ M   ! ! ! r) rrrr& _loop_factoryr)r!r#rur(rrs@rrrsD*M777 , , , , ,       rr)2rSrrr!rrIrrr}r2rr6rrrrrr r r r r logr__all__rP ImportErrorrr"BaseSelectorEventLoopr& ReadTransportrj_FlowControlMixinWriteTransportrrBaseSubprocessTransportrxrrrrrrrBaseDefaultEventLoopPolicyrrrrrrr4s 8     <7 +C D DD   N"N"N"N"N"_BN"N"N"b MMMMMZ5MMM`JJJJJj:(7JJJZ     F   0L$L$L$L$L$L$L$L$^KKKKK,KKK\22222+222jG-G-G-G-G-'G-G-G-Tf1f1f1f1f1'f1f1f1RzRzRzRzRzR0zRzRzRzO(O(O(O(O(/O(O(O(d- - - - - &"C- - - `+4r__pycache__/futures.cpython-311.opt-1.pyc000064400000043307152533123130014117 0ustar00 !A?h78dZdZddlZddlZddlZddlZddlmZddl m Z ddl m Z ddl m Z dd l m Z e jZe jZe jZe jZejdz ZGd d ZeZd Zd ZdZdZdZdZdddZ ddlZejxZZdS#e$rYdSwxYw)z.A Future class similar to the one in PEP 3148.)Future wrap_futureisfutureN) GenericAlias) base_futures)events) exceptions)format_helpersceZdZdZeZdZdZdZdZ dZ dZ dZ dZ dddZdZdZeeZedZejd Zd Zd Zdd Zd ZdZdZdZdZdddZdZ dZ!dZ"dZ#e#Z$dS)ra,This class is *almost* compatible with concurrent.futures.Future. Differences: - This class is not thread-safe. - result() and exception() do not take a timeout argument and raise an exception when the future isn't done yet. - Callbacks registered with add_done_callback() are always called via the event loop's call_soon(). - This class is not compatible with the wait() and as_completed() methods in the concurrent.futures package. (In Python 3.4 or later we may be able to unify the implementations.) NFloopc|tj|_n||_g|_|jr-t jtjd|_ dSdS)zInitialize the future. The optional event_loop argument allows explicitly setting the event loop object used by the future. If it's not provided, the future uses the default event loop. Nr) r _get_event_loop_loop _callbacks get_debugr extract_stacksys _getframe_source_tracebackselfrs *JJJ     ! A*.*@G& ' ))'22222rc|jSr)r'r s r_log_tracebackzFuture._log_tracebackms ##rc6|rtdd|_dS)Nz'_log_traceback can only be set to FalseF) ValueErrorr')rvals rr0zFuture._log_tracebackqs(  HFGG G$rc6|j}|td|S)z-Return the event loop the Future is bound to.Nz!Future object is not initialized.)r RuntimeErrorrs rget_loopzFuture.get_loopws"z <BCC C rc|j|j}d|_|S|jtj}ntj|j}|j|_d|_|S)zCreate the CancelledError to raise if the Future is cancelled. This should only be called once when handling a cancellation since it erases the saved context exception value. N)_cancelled_exc_cancel_messager CancelledError __context__rr,s r_make_cancelled_errorzFuture._make_cancelled_error~se   *%C"&D J   '+--CC+D,@AAC-" rcd|_|jtkrdSt|_||_|dS)zCancel the future and schedule callbacks. If the future is already done or cancelled, return False. Otherwise, change the future's state to cancelled, schedule the callbacks and return True. FT)r'_state_PENDING _CANCELLEDr9_Future__schedule_callbacks)rmsgs rcancelz Future.cancelsD % ;( " "5  " !!###trc|jdd}|sdSg|jdd<|D]"\}}|j|||#dS)zInternal: Ask the event loop to call all callbacks. The callbacks are scheduled to be called as soon as possible. Also clears the callback list. Nr-)rr call_soon)r callbackscallbackctxs r__schedule_callbackszFuture.__schedule_callbackssn OAAA&   F& > >MHc J 4 = = = = > >rc"|jtkS)z(Return True if the future was cancelled.)r?rAr s r cancelledzFuture.cancelleds{j((rc"|jtkS)zReturn True if the future is done. Done means either that a result / exception are available, or that the future was cancelled. )r?r@r s rdonez Future.dones {h&&rc|jtkr|}||jtkrt jdd|_|j|j|j |j S)aReturn the result this future represents. If the future has been cancelled, raises CancelledError. If the future's result isn't yet available, raises InvalidStateError. If the future is done and has an exception set, this exception is raised. zResult is not ready.F) r?rAr= _FINISHEDr InvalidStateErrorr'r(with_traceback _exception_tb_resultr<s rresultz Future.resultsw ;* $ $,,..CI ;) # #./EFF F$ ? &/001CDD D|rc|jtkr|}||jtkrt jdd|_|jS)a&Return the exception that was set on this future. The exception (or None if no exception was set) is returned only if the future is done. If the future has been cancelled, raises CancelledError. If the future isn't done yet, raises InvalidStateError. zException is not set.F)r?rAr=rQr rRr'r(r<s rr$zFuture.exceptionsV ;* $ $,,..CI ;) # #./FGG G$rrFc|jtkr|j|||dS|t j}|j||fdS)zAdd a callback to be run when the future becomes done. The callback is called with a single argument - the future object. If the future is already done when this is called, the callback is scheduled with call_soon. rFN)r?r@rrG contextvars copy_contextrappend)rfnr-s radd_done_callbackzFuture.add_done_callbacksg ;( " " J T7 ; ; ; ; ;%244 O " "B= 1 1 1 1 1rcfd|jD}t|jt|z }|r ||jdd<|S)z}Remove all instances of a callback from the "call when done" list. Returns the number of callbacks removed. c*g|]\}}|k ||fSr`).0frJr\s r z/Future.remove_done_callback..s2***"*1c!"b !#h!(rN)rlen)rr\filtered_callbacks removed_counts ` rremove_done_callbackzFuture.remove_done_callbacksk ****.2o***DO,,s3E/F/FF  4!3DOAAA rc|jtkrtj|jd|||_t |_|dS)zMark the future done and set its result. If the future is already done when this method is called, raises InvalidStateError. : N)r?r@r rRrUrQrB)rrVs r set_resultzFuture.set_resultsX ;( " ".$+/I/I/I/IJJ J   !!#####rc^|jtkrtj|jd|t |t r |}t |t urtd||_|j |_ t|_| d|_ dS)zMark the future done and set an exception. If the future is already done when this method is called, raises InvalidStateError. rizPStopIteration interacts badly with generators and cannot be raised into a FutureTN)r?r@r rR isinstancetype StopIteration TypeErrorr( __traceback__rTrQrBr')rr$s r set_exceptionzFuture.set_exception s ;( " ".$+/I/I/I/IJJ J i & & $! I  ??m + +ABB B#&4  !!####rc#K|s d|_|V|std|S)NTzawait wasn't used with future)rO_asyncio_future_blockingr5rVr s r __await__zFuture.__await__sUyy{{ ,0D )JJJyy{{ @>?? ?{{}}rr)%r* __module__ __qualname____doc__r@r?rUr(rrr9r8rsr'rr!r. classmethodr__class_getitem__propertyr0setterr6r=rDrBrMrOrVr$r]rgrjrqrt__iter__r`rrrrs&FGJ EON %O#""""" ///333 $ L11 $$X$%%% (     > > >))) '''" 04 2 2 2 2 2    $ $ $$$$&HHHrrcT |j}|S#t$rYnwxYw|jSr)r6AttributeErrorr)futr6s r _get_loopr+sH<xzz       9s   c\|rdS||dS)z?Helper setting the result only if the future was not cancelled.N)rMrj)rrVs r_set_result_unless_cancelledr7s/ }}NN6rct|}|tjjurt j|jS|tjjurt j|jS|tjjurt j|jS|Sr)rm concurrentfuturesr:r args TimeoutErrorrR)r, exc_classs r_convert_future_excr>suS IJ&555(#(33 j(5 5 5&11 j(: : :+SX66 rc |r|j|jsdS|}||jt |dS|}|j|dS)z8Copy state from a future to a concurrent.futures.Future.N)rMrDset_running_or_notify_cancelr$rqrrVrj)rsourcer$rVs r_set_concurrent_future_staterJs  2: 2 4 4  ""I  !4Y!?!?@@@@@ f%%%%%rcL|rdS|r|dS|}|$|t |dS|}||dS)zqInternal helper to copy state from another Future. The other Future may be a concurrent.futures.Future. N)rMrDr$rqrrVrj)rdestr$rVs r_copy_future_staterYs  ~~ $ $$&&    29== > > > > >]]__F OOF # # # # #rcts.ttjjst dts.ttjjst dtrt ndtrt nddfd}fd}||dS)aChain two futures so that when one completes, so does the other. The result (or exception) of source will be copied to destination. If destination is cancelled, source gets cancelled too. Compatible with both asyncio.Future and concurrent.futures.Future. z(A future is required for source argumentz-A future is required for destination argumentNcht|rt||dSt||dSr)rrr)r%others r _set_statez!_chain_future.._set_state}s> F   8 uf - - - - - ( 7 7 7 7 7rc|r8urdSjdSdSr)rMrDcall_soon_threadsafe) destination dest_loopr source_loops r_call_check_cancelz)_chain_future.._call_check_cancelsa  " " @"kY&>&> 00?????  @ @rcrrdSur|dSrdS|dSr)rM is_closedr)rrrrrs r_call_set_statez&_chain_future.._call_set_states  ! ! # # %)*=*=*?*?% F   [ 8 8 J{F + + + + +""$$   * *:{F K K K K Kr)rrlrrrrorr])rrrrrrrs`` @@@r _chain_futurerms_ F  DJv/9/A/H%J%JDBCCC K IK4>4F4M*O*OIGHHH'/'7'7A)F###TK*2;*?*?I +&&&TI888 @@@@@@@ L L L L L L L L!!"4555 _-----rr ct|r|S|tj}|}t |||S)z&Wrap concurrent.futures.Future object.)rr r create_futurer)r%r new_futures rrrsS  |%''##%%J&*%%% r) rw__all__concurrent.futuresrrYloggingrtypesrrr r r rr@rArQDEBUG STACK_DEBUGr _PyFuturerrrrrrr_asyncio_CFuture ImportErrorr`rrrs44        $  " ma FFFFFFFFT         & & &$$$().).).X!%     (OOO !'FXXX    DD sBBB__pycache__/queues.cpython-311.opt-1.pyc000064400000031056152533123130013727 0ustar00 !A?h&dZddlZddlZddlmZddlmZddlmZGddeZ Gd d eZ Gd d ej Z Gd de Z Gdde ZdS))Queue PriorityQueue LifoQueue QueueFull QueueEmptyN) GenericAlias)locks)mixinsceZdZdZdS)rz;Raised when Queue.get_nowait() is called on an empty Queue.N__name__ __module__ __qualname____doc__;/opt/alt/python-internal/lib64/python3.11/asyncio/queues.pyrr sEEDrrceZdZdZdS)rzDRaised when the Queue.put_nowait() method is called on a full Queue.Nr rrrrrsNNDrrceZdZdZddZdZdZdZdZdZ d Z e e Z d Zd Zed Zd ZdZdZdZdZdZdZdZdS)raA queue, useful for coordinating producer and consumer coroutines. If maxsize is less than or equal to zero, the queue size is infinite. If it is an integer greater than 0, then "await put()" will block when the queue reaches maxsize, until an item is removed by get(). Unlike the standard library Queue, you can reliably know this Queue's size with qsize(), since your single-threaded asyncio application won't be interrupted between calling qsize() and doing an operation on the Queue. rc||_tj|_tj|_d|_t j|_|j | |dS)Nr) _maxsize collectionsdeque_getters_putters_unfinished_tasksr Event _finishedset_initselfmaxsizes r__init__zQueue.__init__!sl $)++ #)++ !"  7rc6tj|_dSN)rr_queuer"s rr!z Queue._init/s!')) rc4|jSr')r(popleftr#s r_getz Queue._get2s{""$$$rc:|j|dSr'r(appendr#items r_putz Queue._put5 4     rc|rC|}|s|ddS|AdSdSr')r*done set_result)r#waiterswaiters r _wakeup_nextzQueue._wakeup_next:s` __&&F;;== !!$'''      rc~dt|jdt|dd|dS)N)typerid_formatr+s r__repr__zQueue.__repr__Bs=K4::&KKBtHHKKK$,,..KKKKrc\dt|jd|dS)Nr;r<r=)r>rr@r+s r__str__z Queue.__str__Es,:4::&::::::rc d|j}t|ddr|dt|jz }|jr|dt |jdz }|jr|dt |jdz }|jr |d|jz }|S)Nzmaxsize=r(z _queue=z _getters[]z _putters[z tasks=)rgetattrlistr(rlenrr)r#results rr@z Queue._formatJs-DM-- 44 ( ( 7 6dk!2!266 6F = 9 83t}#5#5888 8F = 9 83t}#5#5888 8F  ! 9 8 688 8F rc*t|jS)zNumber of items in the queue.)rHr(r+s rqsizez Queue.qsizeVs4;rc|jS)z%Number of items allowed in the queue.)rr+s rr$z Queue.maxsizeZs }rc|j S)z3Return True if the queue is empty, False otherwise.r(r+s remptyz Queue.empty_s ;rcV|jdkrdS||jkS)zReturn True if there are maxsize items in the queue. Note: if the Queue was initialized with maxsize=0 (the default), then full() is never True. rF)rrKr+s rfullz Queue.fullcs+ =A  5::<<4=0 0rc$K|r|}|j| |d{Vn#| |j|n#t$rYnwxYw|s.|s| |jxYw|| |S)zPut an item into the queue. Put an item into the queue. If the queue is full, wait until a free slot is available before adding item. N) rQ _get_loop create_futurerr/cancelremove ValueError cancelledr9 put_nowait)r#r1putters rputz Queue.putns iikk ^^%%3355F M  ( ( (    M((0000!Dyy{{56+;+;+=+=5%%dm444%iikk &t$$$1A!!C&8BC& B C&B  AC&c|rt|||xjdz c_|j||jdS)zyPut an item into the queue without blocking. If no free slot is immediately available, raise QueueFull. r N)rQrr2rrclearr9rr0s rrYzQueue.put_nowaitsl 99;; O $ !#  $-(((((rc"K|r|}|j| |d{Vn#| |j|n#t$rYnwxYw|s.|s| |jxYw|| S)zoRemove and return an item from the queue. If queue is empty, wait until an item is available. N) rOrSrTrr/rUrVrWrXr9 get_nowait)r#getters rgetz Queue.gets jjll ^^%%3355F M  ( ( (    M((0000!Dzz||5F,<,<,>,>5%%dm444%jjll &   r\c|rt|}||j|S)zRemove and return an item from the queue. Return an item if one is immediately available, else raise QueueEmpty. )rOrr,r9rr0s rr`zQueue.get_nowaitsB ::<<  yy{{ $-((( rc|jdkrtd|xjdzc_|jdkr|jdSdS)a$Indicate that a formerly enqueued task is complete. Used by queue consumers. For each get() used to fetch a task, a subsequent call to task_done() tells the queue that the processing on the task is complete. If a join() is currently blocking, it will resume when all items have been processed (meaning that a task_done() call was received for every item that had been put() into the queue). Raises ValueError if called more times than there were items placed in the queue. rz!task_done() called too many timesr N)rrWrr r+s r task_donezQueue.task_donese  !Q & &@AA A !#  !Q & & N    ' &rcbK|jdkr!|jd{VdSdS)aBlock until all items in the queue have been gotten and processed. The count of unfinished tasks goes up whenever an item is added to the queue. The count goes down whenever a consumer calls task_done() to indicate that the item was retrieved and all work on it is complete. When the count of unfinished tasks drops to zero, join() unblocks. rN)rrwaitr+s rjoinz Queue.joinsJ  !A % %.%%'' ' ' ' ' ' ' ' ' ' & %rN)r)rrrrr%r!r,r2r9rArC classmethodr__class_getitem__r@rKpropertyr$rOrQr[rYrbr`rerhrrrrrsR      ***%%%!!! LLL;;;$ L11      X 1 1 1%%%6 ) ) )!!!4   !!!( ( ( ( ( (rrc@eZdZdZdZejfdZejfdZ dS)rzA subclass of Queue; retrieves entries in priority order (lowest first). Entries are typically tuples of the form: (priority number, data). cg|_dSr'rNr"s rr!zPriorityQueue._init  rc(||j|dSr'rN)r#r1heappushs rr2zPriorityQueue._putsd#####rc"||jSr'rN)r#heappops rr,zPriorityQueue._getswt{###rN) rrrrr!heapqrpr2rrr,rrrrrsc #(.$$$$!=$$$$$$rrc$eZdZdZdZdZdZdS)rzEA subclass of Queue that retrieves most recently added entries first.cg|_dSr'rNr"s rr!zLifoQueue._initrnrc:|j|dSr'r.r0s rr2zLifoQueue._putr3rc4|jSr')r(popr+s rr,zLifoQueue._gets{   rN)rrrrr!r2r,rrrrrsGOO!!!!!!!!rr)__all__rrstypesrr r Exceptionrr_LoopBoundMixinrrrrrrr~s= L                 B(B(B(B(B(F "B(B(B(J $ $ $ $ $E $ $ $ ! ! ! ! ! ! ! ! ! !r__pycache__/__main__.cpython-311.opt-1.pyc000064400000013623152533123130014140 0ustar00 !A?h3 ddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl m Z Gddej Z GddejZedkrejd ejZejed eiZd D]Zeeee<e eeZdad a ddlZn #e$rYnwxYweZd e_e e dS#e!$r>t2r4t2"st2#d aYZwxYwdS)N)futuresc$eZdZfdZdZxZS)AsyncIOInteractiveConsolect||jjxjt jzc_||_dS)N)super__init__compilecompilerflagsastPyCF_ALLOW_TOP_LEVEL_AWAITloop)selflocalsr __class__s =/opt/alt/python-internal/lib64/python3.11/asyncio/__main__.pyr z"AsyncIOInteractiveConsole.__init__sB     ##s'EE## cLtjfd}t| S#t $rt$r7tr dYdS YdSwxYw)Nc8dadatjj} |}na#t $rt $r"}da|Yd}~dSd}~wt$r }|Yd}~dSd}~wwxYwtj |s |dS j |atjtdS#t$r }|Yd}~dSd}~wwxYw)NFT) repl_futurerepl_future_interruptedtypes FunctionTyper SystemExitKeyboardInterrupt set_exception BaseExceptioninspect iscoroutine set_resultr create_taskr _chain_future)funccoroexexccodefuturers rcallbackz3AsyncIOInteractiveConsole.runcode..callbacksnK&+ #%dDK88D tvv   $   *.'$$R(((    $$R((( &t,, !!$''' *"i33D99 %k6:::::  * * *$$S))))))))) *s9 ,B A B *BB 94C// D9DDz KeyboardInterrupt ) concurrentrFuturercall_soon_threadsaferesultrrrwrite showtraceback)rr(r*r)s`` @rruncodez!AsyncIOInteractiveConsole.runcodes#**,, * * * * * * *< !!(+++ %==?? "     % % %& % 2333333""$$$$$$  %sA0B# B#"B#)__name__ __module__ __qualname__r r1 __classcell__)rs@rrrsG +%+%+%+%+%+%+%rrceZdZdZdS) REPLThreadc  dtjdtjdttddd}t|dt jd d t t tj dS#t jd d t t tj wxYw) Nz asyncio REPL z on zy Use "await" directly instead of "asyncio.run()". Type "help", "copyright", "credits" or "license" for more information. ps1z>>> zimport asynciozexiting asyncio REPL...)bannerexitmsgignorez ^coroutine .* was never awaited$)messagecategory) sysversionplatformgetattrconsoleinteractwarningsfilterwarningsRuntimeWarningrr-stop)rr:s rrunzREPLThread.runFs 1? ????3v.. ???    1  3 3 3  #;' ) ) ) )  % %di 0 0 0 0 0  #;' ) ) ) )  % %di 0 0 0 0s ABACN)r2r3r4rIrrr7r7Ds#11111rr7__main__zcpython.run_stdinasyncio>__file__r2__spec__ __loader__ __package__ __builtins__FT)$r rLr(concurrent.futuresr+rr? threadingrrErInteractiveConsolerThreadr7r2auditnew_event_looprset_event_loop repl_localskeyrrCrrreadline ImportError repl_threaddaemonstart run_foreverrdonecancelrJrrrds4    3%3%3%3%3% 73%3%3%l11111!1110 z CI!""" !7 ! # #DG4   g&K,))"688C= C'' T::GK#       *,,KK         E !    /;#3#3#5#5 /""$$$*.' H  ;s%3B88C?C*DAEE__pycache__/taskgroups.cpython-311.opt-2.pyc000064400000016234152533123130014624 0ustar00 !A?h!JdgZddlmZddlmZddlmZGddZdS) TaskGroup)events) exceptions)taskscReZdZ dZdZdZdZddddZded e fd Z d Z d Z dS) rcd|_d|_d|_d|_d|_d|_t |_g|_d|_ d|_ dS)NF) _entered_exiting _aborting_loop _parent_task_parent_cancel_requestedset_tasks_errors _base_error_on_completed_futselfs ?/opt/alt/python-internal/lib64/python3.11/asyncio/taskgroups.py__init__zTaskGroup.__init__sV    (-%ee  !%ctdg}|jr*|dt|j|jr*|dt|j|jr|dn|jr|dd|}d|dS) Nztasks=zerrors= cancellingentered z )rappendlenrr r join)rinfoinfo_strs r__repr__zTaskGroup.__repr__(st ; 5 KK3T[!1!133 4 4 4 < 7 KK5#dl"3"355 6 6 6 > # KK % % % % ] # KK " " "88D>>'H''''rcK|jrtd|d|jtj|_t j|j|_|jtd|dd|_|S)N TaskGroup z has already been enteredz! cannot determine the parent taskT)r RuntimeErrorr rget_running_loopr current_taskr rs r __aenter__zTaskGroup.__aenter__6s = @>T>>>@@ @ : 022DJ!.tz::   $FTFFFHH H  rcKd|_|#||r|j||_|tjur|nd}|jr|jdkrd}||js| |j r{|j |j |_ |j d{Vn9#tj$r'}|js|}| Yd}~nd}~wwxYwd|_ |j {|j|j|r |js||(|tjur|j||jr% t!d|j}|d#d|_wxYwdS)NTzunhandled errors in a TaskGroup)r _is_base_errorrrCancelledErrorrr uncancelr _abortrrr create_futurerrBaseExceptionGroup)retexctbpropagate_cancellation_errorexmes r __aexit__zTaskGroup.__aexit__Ds O##C((  ("D 222CC %  ( 4 ))++q0004, >>  k *%-)-)A)A)C)C& ",,,,,,,,,, " " "~ "460KKMMM "&*D "'k *.   '" " ( /  /. . >b (AAA L   $ $ $ < $ $'(I4<XXd"# #### $ $s$1 B??C5C00C5E)) E2N)namecontextc |jstd|d|jr|jstd|d|jrtd|d||j|}n|j||}tj||| |j |j ||S)Nr&z has not been enteredz is finishedz is shutting down)r;) r r'r rr r create_taskr_set_task_nameadd_done_callback _on_task_doneadd)rcoror:r;tasks rr=zTaskGroup.create_tasks } KIDIIIJJ J = B B@D@@@AA A > GEDEEEFF F ?:))$//DD:))$)@@D T4((( t1222  rr4returnc:t|ttfS)N) isinstance SystemExitKeyboardInterrupt)rr4s rr-zTaskGroup._is_base_errors# ,=>???rcxd|_|jD]*}|s|+dS)NT)r rdonecancel)rts rr0zTaskGroup._abortsB  A6688    rc|j||j:|js3|js|jd|rdS|}|dS|j|| |r|j ||_ |j r,|j d|d|j d||ddS|js=|js8|d|_|j dSdSdS)NTzTask z% has errored out but its parent task z is already completed)message exceptionrC)rdiscardrrJ set_result cancelledrOrrr-rr r call_exception_handlerr rr0rK)rrCr4s rr@zTaskGroup._on_task_dones D!!!  ! -dk -)..00 8&11$777 >>    Fnn ; F C     s # # #(8(@"D    ! ! # #  J - -L4LL#'#4LLL  //    F~ 'd&C '& KKMMM,0D )   $ $ & & & & &+ ' ' ' 'r) __name__ __module__ __qualname__rr$r*r9r= BaseExceptionboolr-r0r@rrrr s & & & ( ( (   O$O$O$b)-d0@-@D@@@@2'2'2'2'2'rN)__all__rrrrrrYrrr[s -^'^'^'^'^'^'^'^'^'^'r__pycache__/exceptions.cpython-311.pyc000064400000007117152533123130013643 0ustar00 !A?hdZdZGddeZeZGddeZGddeZGdd e Z Gd d eZ Gd d eZ dS)zasyncio exceptions.)BrokenBarrierErrorCancelledErrorInvalidStateError TimeoutErrorIncompleteReadErrorLimitOverrunErrorSendfileNotAvailableErrorceZdZdZdS)rz!The Future or Task was cancelled.N__name__ __module__ __qualname____doc__?/opt/alt/python-internal/lib64/python3.11/asyncio/exceptions.pyrr s++++rrceZdZdZdS)rz+The operation is not allowed in this state.Nr rrrrrs5555rrceZdZdZdS)rz~Sendfile syscall is not available. Raised if OS does not support sendfile syscall for given socket or file type. Nr rrrrrsrrc(eZdZdZfdZdZxZS)rz Incomplete read error. Attributes: - partial: read bytes string before the end of stream was reached - expected: total number of expected bytes (or None if unknown) c|dnt|}tt|d|d||_||_dS)N undefinedz bytes read on a total of z expected bytes)reprsuper__init__lenpartialexpected)selfrr r_expected __class__s rrzIncompleteReadError.__init__$si$,$4[[$x..  CLL88&888 9 9 9   rc<t||j|jffSN)typerrrs r __reduce__zIncompleteReadError.__reduce__+sDzzDL$-888rr r r rrr$ __classcell__rs@rrrsQ !!!!!9999999rrc(eZdZdZfdZdZxZS)rzReached the buffer limit while looking for a separator. Attributes: - consumed: total number of to be consumed bytes. cXt|||_dSr!)rrconsumed)rmessager*rs rrzLimitOverrunError.__init__5s& !!!  rcHt||jd|jffS)N)r"argsr*r#s rr$zLimitOverrunError.__reduce__9s DzzDIaL$-888rr%r's@rrr/sQ !!!!!9999999rrceZdZdZdS)rz*Barrier is broken by barrier.abort() call.Nr rrrrr=s4444rrN) r__all__ BaseExceptionrr Exceptionr RuntimeErrorrEOFErrorrrrrrrr5s ( ,,,,,],,, 66666 666 99999(999$ 9 9 9 9 9 9 9 95555555555r__pycache__/transports.cpython-311.pyc000064400000035525152533123130013705 0ustar00 !A?h)dZdZGddZGddeZGddeZGdd eeZGd d eZGd d eZGddeZdS)zAbstract Transport class.) BaseTransport ReadTransportWriteTransport TransportDatagramTransportSubprocessTransportc>eZdZdZdZd dZd dZdZdZdZ d Z dS) rzBase class for transports._extraNc|i}||_dSNr )selfextras ?/opt/alt/python-internal/lib64/python3.11/asyncio/transports.py__init__zBaseTransport.__init__s =E c8|j||S)z#Get optional transport information.)r get)r namedefaults rget_extra_infozBaseTransport.get_extra_infos{tW---rct)z2Return True if the transport is closing or closed.NotImplementedErrorr s r is_closingzBaseTransport.is_closing!!rct)aClose the transport. Buffered data will be flushed asynchronously. No more data will be received. After all buffered data is flushed, the protocol's connection_lost() method will (eventually) be called with None as its argument. rrs rclosezBaseTransport.close "!rct)zSet a new protocol.r)r protocols r set_protocolzBaseTransport.set_protocol%rrct)zReturn the current protocol.rrs r get_protocolzBaseTransport.get_protocol)rrr ) __name__ __module__ __qualname____doc__ __slots__rrrrr"r$rrrr s$$I ....""""""""""""""rrc(eZdZdZdZdZdZdZdS)rz#Interface for read-only transports.r*ct)z*Return True if the transport is receiving.rrs r is_readingzReadTransport.is_reading3rrct)zPause the receiving end. No data will be passed to the protocol's data_received() method until resume_reading() is called. rrs r pause_readingzReadTransport.pause_reading7 "!rct)zResume the receiving end. Data received will once again be passed to the protocol's data_received() method. rrs rresume_readingzReadTransport.resume_reading?r0rN)r%r&r'r(r)r-r/r2r*rrrr.sL--I"""""""""""rrcHeZdZdZdZd dZdZdZdZdZ d Z d Z d Z dS) rz$Interface for write-only transports.r*Nct)aSet the high- and low-water limits for write flow control. These two values control when to call the protocol's pause_writing() and resume_writing() methods. If specified, the low-water limit must be less than or equal to the high-water limit. Neither value can be negative. The defaults are implementation-specific. If only the high-water limit is given, the low-water limit defaults to an implementation-specific value less than or equal to the high-water limit. Setting high to zero forces low to zero as well, and causes pause_writing() to be called whenever the buffer becomes non-empty. Setting low to zero causes resume_writing() to be called only once the buffer is empty. Use of zero for either limit is generally sub-optimal as it reduces opportunities for doing I/O and computation concurrently. rr highlows rset_write_buffer_limitsz&WriteTransport.set_write_buffer_limitsMs &"!rct)z,Return the current size of the write buffer.rrs rget_write_buffer_sizez$WriteTransport.get_write_buffer_sizebrrct)zGet the high and low watermarks for write flow control. Return a tuple (low, high) where low and high are positive number of bytes.rrs rget_write_buffer_limitsz&WriteTransport.get_write_buffer_limitsfs "!rct)zWrite some data bytes to the transport. This does not block; it buffers the data and arranges for it to be sent out asynchronously. r)r datas rwritezWriteTransport.writelr0rcZd|}||dS)zWrite a list (or any iterable) of data bytes to the transport. The default implementation concatenates the arguments and calls write() on the result. rN)joinr?)r list_of_datar>s r writelineszWriteTransport.writelinests- xx %% 4rct)zClose the write end after flushing buffered data. (This is like typing ^D into a UNIX program reading from stdin.) Data may still be received. rrs r write_eofzWriteTransport.write_eof} "!rct)zAReturn True if this transport supports write_eof(), False if not.rrs r can_write_eofzWriteTransport.can_write_eofrrctzClose the transport immediately. Buffered data will be lost. No more data will be received. The protocol's connection_lost() method will (eventually) be called with None as its argument. rrs rabortzWriteTransport.abortrFrNN) r%r&r'r(r)r8r:r<r?rCrErHrKr*rrrrHs..I""""*"""""" """"""""""""""rrceZdZdZdZdS)raSInterface representing a bidirectional transport. There may be several implementations, but typically, the user does not implement new transports; rather, the platform provides some useful transports that are implemented using the platform's best practices. The user never instantiates a transport directly; they call a utility function, passing it a protocol factory and other information necessary to create the transport and protocol. (E.g. EventLoop.create_connection() or EventLoop.create_server().) The utility function will asynchronously create a transport and a protocol and hook them up by calling the protocol's connection_made() method, passing it the transport. The implementation here raises NotImplemented for every method except writelines(), which calls write() in a loop. r*N)r%r&r'r(r)r*rrrrs(IIIrrc$eZdZdZdZddZdZdS)rz(Interface for datagram (UDP) transports.r*Nct)aSend data to the transport. This does not block; it buffers the data and arranges for it to be sent out asynchronously. addr is target socket address. If addr is None use target address pointed on transport creation. r)r r>addrs rsendtozDatagramTransport.sendtorrctrJrrs rrKzDatagramTransport.abortrFrr )r%r&r'r(r)rQrKr*rrrrsB22I"""""""""rrc6eZdZdZdZdZdZdZdZdZ dS) rr*ct)zGet subprocess id.rrs rget_pidzSubprocessTransport.get_pidrrct)zGet subprocess returncode. See also http://docs.python.org/3/library/subprocess#subprocess.Popen.returncode rrs rget_returncodez"SubprocessTransport.get_returncoder0rct)z&Get transport for pipe with number fd.r)r fds rget_pipe_transportz&SubprocessTransport.get_pipe_transportrrct)zSend signal to subprocess. See also: docs.python.org/3/library/subprocess#subprocess.Popen.send_signal r)r signals r send_signalzSubprocessTransport.send_signalr0rct)aLStop the subprocess. Alias for close() method. On Posix OSs the method sends SIGTERM to the subprocess. On Windows the Win32 API function TerminateProcess() is called to stop the subprocess. See also: http://docs.python.org/3/library/subprocess#subprocess.Popen.terminate rrs r terminatezSubprocessTransport.terminates "!rct)zKill the subprocess. On Posix OSs the function sends SIGKILL to the subprocess. On Windows kill() is an alias for terminate(). See also: http://docs.python.org/3/library/subprocess#subprocess.Popen.kill rrs rkillzSubprocessTransport.kills "!rN) r%r&r'r)rUrWrZr]r_rar*rrrrssI"""""""""""" " " " " " " " "rrcPeZdZdZdZd fd ZdZdZdZd dZ d d Z d Z xZ S) _FlowControlMixinavAll the logic for (write) flow control in a mix-in base class. The subclass must implement get_write_buffer_size(). It must call _maybe_pause_protocol() whenever the write buffer size increases, and _maybe_resume_protocol() whenever it decreases. It may also override set_write_buffer_limits() (e.g. to specify different defaults). The subclass constructor must call super().__init__(extra). This will call set_write_buffer_limits(). The user may call set_write_buffer_limits() and get_write_buffer_size(), and their protocol's pause_writing() and resume_writing() may be called. )_loop_protocol_paused _high_water _low_waterNct||J||_d|_|dS)NF)superrrdre_set_write_buffer_limits)r rloop __class__s rrz_FlowControlMixin.__init__sN  % %%'''''rc6|}||jkrdS|jspd|_ |jdS#t t f$rt$r/}|j d|||jdYd}~dSd}~wwxYwdS)NTzprotocol.pause_writing() failedmessage exception transportr!) r:rfre _protocol pause_writing SystemExitKeyboardInterrupt BaseExceptionrdcall_exception_handler)r sizeexcs r_maybe_pause_protocolz'_FlowControlMixin._maybe_pause_protocols))++ 4# # # F$ $(D ! ,,..... 12        11@!$!% $ 33   sA B'$BBc2|jr||jkrrd|_ |jdS#t t f$rt$r/}|j d|||jdYd}~dSd}~wwxYwdSdS)NFz protocol.resume_writing() failedrn) rer:rgrrresume_writingrtrurvrdrw)r rys r_maybe_resume_protocolz(_FlowControlMixin._maybe_resume_protocol's  ! **,,??$)D ! --///// 12        11A!$!% $ 33   ??sAB#$B  Bc|j|jfSr )rgrfrs rr<z)_FlowControlMixin.get_write_buffer_limits7s!122rc| |d}nd|z}||dz}||cxkrdksntd|d|d||_||_dS)Nizhigh (z) must be >= low (z) must be >= 0) ValueErrorrfrgr5s rrjz*_FlowControlMixin._set_write_buffer_limits:s <{ 3w ;!)CsaHHH3HHHJJ J rc\||||dS)N)r6r7)rjrzr5s rr8z)_FlowControlMixin.set_write_buffer_limitsJs3 %%4S%999 ""$$$$$rctr rrs rr:z'_FlowControlMixin.get_write_buffer_sizeNs!!rrL) r%r&r'r(r)rrzr}r<rjr8r: __classcell__)rls@rrcrcs KI(((((($ 333 %%%%"""""""rrcN) r(__all__rrrrrrrcr*rrrsW  """"""""""""""""J"""""M"""4I"I"I"I"I"]I"I"I"X ~0""""" """23"3"3"3"3"-3"3"3"lT"T"T"T"T" T"T"T"T"T"r__pycache__/coroutines.cpython-311.opt-1.pyc000064400000007566152533123130014623 0ustar00 !A?hH dZddlZddlZddlZddlZddlZddlZdZe Z dZ ej ej ejjfZeZdZdZdS))iscoroutinefunction iscoroutineNctjjp=tjj o+t t jdS)NPYTHONASYNCIODEBUG)sysflagsdev_modeignore_environmentboolosenvironget?/opt/alt/python-internal/lib64/python3.11/asyncio/coroutines.py_is_debug_moder s@ 9  Nci&B"B#M"&rz~~6J'K'K"L"LNrcZtj|pt|ddtuS)z6Return True if func is a decorated coroutine function. _is_coroutineN)inspectrgetattrr)funcs rrrs0  ' - - B D/4 0 0M ACrct|tvrdSt|trAt tdkr'tt|dSdS)z)Return True if obj is a coroutine object.TdF)type_iscoroutine_typecache isinstance_COROUTINE_TYPESlenadd)objs rrr"sf Cyy***t#'(( % & & , , " & &tCyy 1 1 1turcd}d}d}t|dr|jr|j}nt|dr|jr|j}||}|s||r|dS|Sd}t|dr|jr|j}nt|dr|jr|j}|jpd}d }||j}|d |d |}n|j}|d |d |}|S) Nct|dr|jr|j}n7t|dr|jr|j}ndt|jd}|dS)N __qualname____name__z())hasattrr#r$r)coro coro_names rget_namez#_format_coroutine..get_name5s} 4 ( ( DT-> D)II T: & & D4= D IIDDJJ/CCCIrcf |jS#t$r |jcYS#t$rYYdSwxYwwxYw)NF) cr_runningAttributeError gi_running)r's r is_runningz%_format_coroutine..is_runningCsa ? "    &&&!   uuu  s  00 ,0,0cr_codegi_codez runninggi_framecr_framezrz running at :z done, defined at )r&r/r0r1r2 co_filenamef_linenoco_firstlineno) r'r)r. coro_coder( coro_framefilenamelineno coro_reprs r_format_coroutiner<2s_    ItY!DL!L y ! !!dl!L I  :d   ))) ) JtZ  #T]#] z " "#t}#] $=(=H F$ AAhAAAA ) GGHGGvGG r)__all__collections.abc collectionsrr r tracebacktypesrobjectrr CoroutineType GeneratorTypeabc Coroutinersetrrr<rrrrHs .  NNN CCC')<O-/    =====r__pycache__/queues.cpython-311.opt-2.pyc000064400000023764152533123130013737 0ustar00 !A?h&dZddlZddlZddlmZddlmZddlmZGddeZ Gd d eZ Gd d ej Z Gd de Z Gdde ZdS))Queue PriorityQueue LifoQueue QueueFull QueueEmptyN) GenericAlias)locks)mixinsceZdZ dS)rN__name__ __module__ __qualname__;/opt/alt/python-internal/lib64/python3.11/asyncio/queues.pyrr sEDrrceZdZ dS)rNr rrrrrsNDrrceZdZ ddZdZdZdZdZdZdZ e e Z d Z d Zed Zd Zd ZdZdZdZdZdZdZdS)rrc||_tj|_tj|_d|_t j|_|j | |dSNr) _maxsize collectionsdeque_getters_putters_unfinished_tasksr Event _finishedset_initselfmaxsizes r__init__zQueue.__init__!sl $)++ #)++ !"  7rc6tj|_dSN)rr_queuer"s rr!z Queue._init/s!')) rc4|jSr')r(popleftr#s r_getz Queue._get2s{""$$$rc:|j|dSr'r(appendr#items r_putz Queue._put5 4     rc|rC|}|s|ddS|AdSdSr')r*done set_result)r#waiterswaiters r _wakeup_nextzQueue._wakeup_next:s` __&&F;;== !!$'''      rc~dt|jdt|dd|dS)N)typerid_formatr+s r__repr__zQueue.__repr__Bs=K4::&KKBtHHKKK$,,..KKKKrc\dt|jd|dS)Nr;r<r=)r>rr@r+s r__str__z Queue.__str__Es,:4::&::::::rc d|j}t|ddr|dt|jz }|jr|dt |jdz }|jr|dt |jdz }|jr |d|jz }|S)Nzmaxsize=r(z _queue=z _getters[]z _putters[z tasks=)rgetattrlistr(rlenrr)r#results rr@z Queue._formatJs-DM-- 44 ( ( 7 6dk!2!266 6F = 9 83t}#5#5888 8F = 9 83t}#5#5888 8F  ! 9 8 688 8F rc, t|jSr')rHr(r+s rqsizez Queue.qsizeVs+4;rc |jSr')rr+s rr$z Queue.maxsizeZs 3}rc |j Sr'r(r+s remptyz Queue.empty_sA;rcX |jdkrdS||jkS)NrF)rrKr+s rfullz Queue.fullcs0 =A  5::<<4=0 0rc&K |r|}|j| |d{Vn#| |j|n#t$rYnwxYw|s.|s| |jxYw|| |Sr') rQ _get_loop create_futurerr/cancelremove ValueError cancelledr9 put_nowait)r#r1putters rputz Queue.putns" iikk ^^%%3355F M  ( ( (    M((0000!Dyy{{56+;+;+=+=5%%dm444%iikk &t$$$1A""C'9BC' B!C' B!!AC'c |rt|||xjdz c_|j||jdS)Nr )rQrr2rrclearr9rr0s rrYzQueue.put_nowaitsq  99;; O $ !#  $-(((((rc$K |r|}|j| |d{Vn#| |j|n#t$rYnwxYw|s.|s| |jxYw|| Sr') rOrSrTrr/rUrVrWrXr9 get_nowait)r#getters rgetz Queue.gets  jjll ^^%%3355F M  ( ( (    M((0000!Dzz||5F,<,<,>,>5%%dm444%jjll &   r\c |rt|}||j|Sr')rOrr,r9rr0s rr`zQueue.get_nowaitsG  ::<<  yy{{ $-((( rc |jdkrtd|xjdzc_|jdkr|jdSdS)Nrz!task_done() called too many timesr )rrWrr r+s r task_donezQueue.task_donesj   !Q & &@AA A !#  !Q & & N    ' &rcdK |jdkr!|jd{VdSdSr)rrwaitr+s rjoinz Queue.joinsO   !A % %.%%'' ' ' ' ' ' ' ' ' ' & %rN)r)rrrr%r!r,r2r9rArC classmethodr__class_getitem__r@rKpropertyr$rOrQr[rYrbr`rerhrrrrrsM     ***%%%!!! LLL;;;$ L11      X 1 1 1%%%6 ) ) )!!!4   !!!( ( ( ( ( (rrc>eZdZ dZejfdZejfdZdS)rcg|_dSr'rNr"s rr!zPriorityQueue._init  rc(||j|dSr'rN)r#r1heappushs rr2zPriorityQueue._putsd#####rc"||jSr'rN)r#heappops rr,zPriorityQueue._getswt{###rN) rrrr!heapqrpr2rrr,rrrrrs^ #(.$$$$!=$$$$$$rrc"eZdZ dZdZdZdS)rcg|_dSr'rNr"s rr!zLifoQueue._initrnrc:|j|dSr'r.r0s rr2zLifoQueue._putr3rc4|jSr')r(popr+s rr,zLifoQueue._gets{   rN)rrrr!r2r,rrrrrsDO!!!!!!!!rr)__all__rrstypesrr r Exceptionrr_LoopBoundMixinrrrrrrr~s= L                 B(B(B(B(B(F "B(B(B(J $ $ $ $ $E $ $ $ ! ! ! ! ! ! ! ! ! !r__pycache__/proactor_events.cpython-311.opt-2.pyc000064400000133266152533123130015644 0ustar00 !A?h dZddlZddlZddlZddlZddlZddlZddlZddlm Z ddlm Z ddlm Z ddlm Z ddlm Z dd lmZdd lmZdd lmZdd lmZd ZGddejejZGddeejZGddeejZGddeZGddeejZGddeeejZGddeeejZ Gdde j!Z"dS))BaseProactorEventLoopN) base_events) constants)futures) exceptions) protocols)sslproto) transports)trsock)loggerctj||jd< ||jd<nE#tj$r3|jrtj d|dYnwxYwd|jvr? | |jd<dS#tj$rd|jd<YdSwxYwdS)Nsocketsocknamezgetsockname() failed on %rTexc_infopeername) r TransportSocket_extra getsocknamererror_loop get_debugr warning getpeername) transportsocks D/opt/alt/python-internal/lib64/python3.11/asyncio/proactor_events.py_set_socket_extrars !'!7!=!=IXC'+'7'7'9'9 $$ <CCC ? $ $ & & C N,dT C C C CC ))) 0+/+;+;+=+=I Z ( ( (| 0 0 0+/I Z ( ( ( ( 0*)s!;?A=<A= B((CCcxeZdZ dfd ZdZdZdZdZdZdZ e j fd Z dd Z d Zd ZdZxZS)_ProactorBasePipeTransportNc t||||||_||||_d|_d|_d|_d|_ d|_ d|_ d|_ d|_ |j|j|j|jj||(|jt&j|ddSdS)NrF)super__init__ _set_extra_sock set_protocol_server_buffer _read_fut _write_fut_pending_write _conn_lost_closing_called_connection_lost _eof_written_attachr call_soon _protocolconnection_mader_set_result_unless_cancelledselflooprprotocolwaiterextraserver __class__s rr$z#_ProactorBasePipeTransport.__init__2s %%%   (###   ',$! < # L " " " T^;TBBB   J !E!' / / / / /  ct|jjg}|j|dn|jr|d|j/|d|j|j|d|j|j|d|j|jr*|dt|j|j r|dd d |S) Nclosedclosingzfd=zread=zwrite=zwrite_bufsize=z EOF writtenz<{}> ) r=__name__r&appendr.filenor*r+r)lenr0formatjoin)r7infos r__repr__z#_ProactorBasePipeTransport.__repr__Is+'( :  KK ! ! ! ! ] # KK " " " : ! KK3dj//1133 4 4 4 > % KK222 3 3 3 ? & KK444 5 5 5 < > KK<T\):):<< = = =   ' KK & & &}}SXXd^^,,,r>c||jd<dS)Npipe)rr7rs rr%z%_ProactorBasePipeTransport._set_extra[s" Fr>c||_dSNr3)r7r9s rr'z'_ProactorBasePipeTransport.set_protocol^s !r>c|jSrOrPr7s r get_protocolz'_ProactorBasePipeTransport.get_protocolas ~r>c|jSrO)r.rRs r is_closingz%_ProactorBasePipeTransport.is_closingds }r>c|jrdSd|_|xjdz c_|js'|j |j|jd|j"|jd|_dSdS)NTr) r.r-r)r+rr2_call_connection_lostr*cancelrRs rclosez _ProactorBasePipeTransport.closegs =  F  1| C 7 J !;T B B B > % N ! ! # # #!DNNN & %r>cv|j1|d|t||jdSdS)Nzunclosed transport )source)r&ResourceWarningrY)r7_warns r__del__z"_ProactorBasePipeTransport.__del__rsL : ! E000/$ O O O O J        " !r>Fatal error on pipe transportc< t|tr2|jrt jd||dn$|j||||jd||dS#||wxYw)Nz%r: %sTr)message exceptionrr9) isinstanceOSErrorrrr debugcall_exception_handlerr3 _force_close)r7excras r _fatal_errorz'_ProactorBasePipeTransport._fatal_errorws ##w'' :''))IL44HHHH 11&!$!% $ 33   c " " " " "D  c " " " "s A+BBc|jP|js7||jdn|j||jr |jrdSd|_|xjdz c_|jr |jd|_|j r |j d|_ d|_ d|_ |j |j|dS)NTrr) _empty_waiterdone set_result set_exceptionr.r/r-r+rXr*r,r)rr2rW)r7rhs rrgz'_ProactorBasePipeTransport._force_closes   )$2D2I2I2K2K ){"--d3333"00555 = T9  F  1 ? # O " " $ $ $"DO > " N ! ! # # #!DN  T7=====r>c|jrdS |j|t|jdrA|jdkr$|jtj|j d|_|j }|| d|_ d|_dS#t|jdrA|jdkr$|jtj|j d|_|j }|| d|_ d|_wxYw)NshutdownT) r/r3connection_losthasattrr&rErpr SHUT_RDWRrYr(_detach)r7rhr<s rrWz0_ProactorBasePipeTransport._call_connection_losts\  '  F 0 N * *3 / / / tz:.. 64:3D3D3F3F"3L3L ##F$4555 J     DJ\F!   # +/D ( ( (tz:.. 64:3D3D3F3F"3L3L ##F$4555 J     DJ\F!   # +/D ( / / / /s CB#E+cP|j}|j|t|jz }|SrO)r,r)rF)r7sizes rget_write_buffer_sizez0_ProactorBasePipeTransport.get_write_buffer_sizes+" < # C %% %D r>NNN)r_)rC __module__ __qualname__r$rJr%r'rSrUrYwarningswarnr^rirgrWrx __classcell__r=s@rr!r!.s448$(//////.---$###""" " " "%M # # # #>>>(000(r>r!cLeZdZ d fd ZdZdZdZdZdZd d Z xZ S) _ProactorReadPipeTransportNcd|_d|_t||||||t ||_|j|jd|_dS)NrqTF) _pending_data_length_pausedr#r$ bytearray_datarr2 _loop_reading) r7r8rr9r:r;r< buffer_sizer=s rr$z#_ProactorReadPipeTransport.__init__sg$&!  tXvufEEE{++  T/000 r>c"|j o|j SrO)rr.rRs r is_readingz%_ProactorReadPipeTransport.is_readings<5 $55r>c|js|jrdSd|_|jrt jd|dSdS)NTz%r pauses reading)r.rrrr rerRs r pause_readingz(_ProactorReadPipeTransport.pause_readings\ = DL  F  :   ! ! 4 L,d 3 3 3 3 3 4 4r>cf|js|jsdSd|_|j |j|jd|j}d|_|dkr.|j|j|jd|||j rtj d|dSdS)NFrqz%r resumes reading) r.rr*rr2rr_data_receivedrrr re)r7lengths rresume_readingz)_ProactorReadPipeTransport.resume_readings =    F > ! J !3T : : :*$&! B;; J !4dj&6I6 R R R :   ! ! 5 L-t 4 4 4 4 4 5 5r>cF|jrtjd| |j}n?#t tf$rt$r!}| |dYd}~dSd}~wwxYw|s| dSdS)Nz%r received EOFz1Fatal error: protocol.eof_received() call failed.) rrr rer3 eof_received SystemExitKeyboardInterrupt BaseExceptionrirY)r7 keep_openrhs r _eof_receivedz(_ProactorReadPipeTransport._eof_receiveds :   ! ! 2 L*D 1 1 1 3355II-.          H J J J FFFFF    JJLLLLL  sA B%BBc|jr ||_dS|dkr|dSt|jt jr\ t j|j|dS#ttf$rt$r!}| |dYd}~dSd}~wwxYw|j |dS)Nrz3Fatal error: protocol.buffer_updated() call failed.) rrrrcr3r BufferedProtocol_feed_data_to_buffered_protorrrri data_received)r7datarrhs rrz)_ProactorReadPipeTransport._data_receiveds < )/D % F Q;;    F dni&@ A A / 6t~tLLLLL 12       !!##1222   N ( ( . . . . .s A))B%B  B%c(d}d} |zd|_|rK|}|dkr! |dkr|||dSdS|jd|}n||jr! |dkr|||dSdS|js/|jj |j |j|_|js|j |j n#t$rW}|js||dn/|jrt#jddYd}~nod}~wt&$r}||Yd}~nHd}~wt*$r }||dYd}~n d}~wt,j$r |jsYnwxYw|dkr|||dSdS#|dkr|||wwxYw)Nrqrz"Fatal read error on pipe transportz*Read error on pipe transport while closingTr)r*rlresultrrrXr.rr _proactor recv_intor&add_done_callbackrConnectionAbortedErrorrirr reConnectionResetErrorrgrdrCancelledError)r7futrrrhs rrz(_ProactorReadPipeTransport._loop_readings- 2"&88:: ! ZZ\\F{{D{{##D&11111{A :gvg.DDJJLLL} 2{{##D&11111{)< X!%!5!?!? DJ!W!W< E001CDDD& , , ,= ,!!#'KLLLL%%'' , I&*,,,,# # # #   c " " " " " " " " I I I   c#G H H H H H H H H(   =    {{##D&11111{v{{##D&1111sl7D+D*6D 'G2 GA E#G2# G0F G2 GF2-G22G G2GG22H)NNNrrO) rCrzr{r$rrrrrrr~rs@rrrs#486;666444&555$ ///20202020202020202r>rcPeZdZ dZfdZdZd dZdZdZdZ d Z d Z xZ S) _ProactorBaseWritePipeTransportTcHtj|i|d|_dSrO)r#r$rkr7argskwr=s rr$z(_ProactorBaseWritePipeTransport.__init__Ms-$%"%%%!r>ct|tttfs$t dt |j|jrtd|j td|sdS|j r;|j tj krtjd|xj dz c_ dS|j%|t|dS|js*t||_|dS|j||dS)Nz/data argument must be a bytes-like object, not zwrite_eof() already calledz(unable to write; sendfile is in progresszsocket.send() raised exception.r)r)rcbytesr memoryview TypeErrortyperCr0 RuntimeErrorrkr-r!LOG_THRESHOLD_FOR_CONNLOST_WRITESr rr+ _loop_writingr)_maybe_pause_protocolextend)r7rs rwritez%_ProactorBaseWritePipeTransport.writeQsW$ : >?? .-Dzz*--.. .   =;<< <   )IJJ J  F ? )"MMM@AAA OOq OO F ? "   E$KK  0 0 0 0 0 )$T??DL  & & ( ( ( ( ( L   % % %  & & ( ( ( ( (r>Nc ||j |jrdSd|_d|_|r|||j}d|_|sg|jr |j|jd|jr$|j tj | n|jj|j ||_|jsHt#||_|j|j|n|j|j|j#|j|jddSdSdS#t.$r }||Yd}~dSd}~wt2$r!}||dYd}~dSd}~wwxYw)Nrz#Fatal write error on pipe transport)r+r.r,rr)rr2rWr0r&rprSHUT_WR_maybe_resume_protocolrsendrlrFrrrrkrmrrgrdri)r7frrhs rrz-_ProactorBaseWritePipeTransport._loop_writingws& J}!8T]!8"DO"#D   ||#  J=KJ(()CTJJJ$8J''777 ++----"&*"6";";DJ"M"M++--J*-d))D'O55d6HIII..0000O55d6HIII!-$/2I"--d33333.-2I2I# # # #   c " " " " " " " " " J J J   c#H I I I I I I I I I Js)F E/F GF.. G;GGcdSNTrRs r can_write_eofz-_ProactorBaseWritePipeTransport.can_write_eoftr>c.|dSrO)rYrRs r write_eofz)_ProactorBaseWritePipeTransport.write_eofs r>c0|ddSrOrgrRs rabortz%_ProactorBaseWritePipeTransport.abort $r>c|jtd|j|_|j|jd|jS)NzEmpty waiter is already set)rkrr create_futurer+rmrRs r_make_empty_waiterz2_ProactorBaseWritePipeTransport._make_empty_waitersX   )<== =!Z5577 ? "   ) )$ / / /!!r>cd|_dSrO)rkrRs r_reset_empty_waiterz3_ProactorBaseWritePipeTransport._reset_empty_waiters!r>NN) rCrzr{_start_tls_compatibler$rrrrrrrr~rs@rrrGs$ """""$)$)$)L'J'J'J'JR   """"""""""r>rc$eZdZfdZdZxZS)_ProactorWritePipeTransportctj|i||jj|jd|_|j|jdS)N) r#r$rrrecvr&r*r _pipe_closedrs rr$z$_ProactorWritePipeTransport.__init__s\$%"%%%-224:rBB (():;;;;;r>c|rdS|jrdSd|_|j#|t dS|dSrO) cancelledr.r*r+rgBrokenPipeErrorrY)r7rs rrz(_ProactorWritePipeTransport._pipe_closedsf ==??  F =  F ? &   o// 0 0 0 0 0 JJLLLLLr>)rCrzr{r$rr~rs@rrrsG<<<<<       r>rcReZdZdZ d fd ZdZdZdZd dZd dZ d d Z xZ S) _ProactorDatagramTransportiNc||_d|_d|_t|||||t j|_|j |j dS)Nr)r:r;) _addressrk _buffer_sizer#r$ collectionsdequer)rr2r)r7r8rr9addressr:r;r=s rr$z#_ProactorDatagramTransport.__init__sp ! tXfEJJJ#(**  T/00000r>c&t||dSrOrrMs rr%z%_ProactorDatagramTransport._set_extra$%%%%%r>c|jSrO)rrRs rrxz0_ProactorDatagramTransport.get_write_buffer_sizes   r>c0|ddSrOrrRs rrz _ProactorDatagramTransport.abortrr>cZt|tttfst dt ||sdS|j"|d|jfvrtd|j|jrB|jr;|jtj krtj d|xjdz c_dS|j t||f|xjt!|z c_|j||dS)Nz,data argument must be bytes-like object (%r)z!Invalid address: must be None or z!socket.sendto() raised exception.r)rcrrrrrr ValueErrorr-rrr rr)rDrrFr+rr)r7raddrs rsendtoz!_ProactorDatagramTransport.sendtos?$ : >?? (J JJ(( (  F = $dDM5J)J)JCDMCCEE E ? t} )"MMMBCCC OOq OO F U4[[$/000 SYY& ? "     ""$$$$$r>c |jrdSd|_|r||jr|jr0|jr)|jr |j|jddS|j \}}|xj t|zc_ |j+|jj |j||_n,|jj |j|||_|j|j|dS#t&$r%}|j|Yd}~dSd}~wt,$r!}||dYd}~dSd}~wwxYw)N)rz'Fatal write error on datagram transport)r-r+rr)rr.rr2rWpopleftrrFrrr&rrrrrdr3error_received Exceptionri)r7rrrrhs rrz(_ProactorDatagramTransport._loop_writings * #DO  < DO   =KJ(()CTJJJ--//JD$   T *  }("&*"6";";DJ<@#B#B#'*"6"="=dj>BCG#>#I#I O - -d.@ A A A  ' ' ) ) ) ) )  / / / N ) )# . . . . . . . . . N N N   c#L M M M M M M M M M Ns0D2AD2&BD22 F <E F )FF cd} |jr" |r|j||dSdSd|_|U|}|jr$d} |r|j||dSdS|j ||j}}n|\}}|jr" |r|j||dSdS|j0|jj |j |j |_n/|jj |j |j |_|j|j |jnI#t$r$}|j|Yd}~n d}~wt"j$r |jsYnwxYw|r|j||dSdS#|r|j||wwxYwrO)r-r3datagram_receivedr*rr.rrrrr&max_sizerecvfromrrrdrrr)r7rrrresrhs rrz(_ProactorDatagramTransport._loop_reading#sY' = H =00t<<<<< = =?"DNjjll=D0 =00t<<<<< = =-=,!$dm$DD!$JD$   =00t<<<<< = =}(!%!5!:!:4:;?="J"J"&!5!>!>tz?C}"N"N~)001CDDD / / / N ) )# . . . . . . . .(   =     =00t<<<<< = =t =00t<<<< =sME&E5E4A&E'F+ F E*%F+*FF+FF++ G ryrO) rCrzr{rr$r%rxrrrrr~rs@rrrsH59$( 1 1 1 1 1 1&&&!!!   %%%%: * * * *D)=)=)=)=)=)=)=)=r>rceZdZ dZdZdS)_ProactorDuplexPipeTransportcdS)NFrrRs rrz*_ProactorDuplexPipeTransport.can_write_eofTsur>ctrO)NotImplementedErrorrRs rrz&_ProactorDuplexPipeTransport.write_eofWs!!r>N)rCrzr{rrrr>rrrOs7&"""""r>rcPeZdZ ejjZ dfd ZdZdZ dZ xZ S)_ProactorSocketTransportNc|t||||||tj|dSrO)r#r$r _set_nodelayr6s rr$z!_ProactorSocketTransport.__init__bs< tXvufEEE &&&&&r>c&t||dSrOrrMs rr%z#_ProactorSocketTransport._set_extragrr>cdSrrrRs rrz&_ProactorSocketTransport.can_write_eofjrr>c|js|jrdSd|_|j&|jt jdSdSr)r.r0r+r&rprrrRs rrz"_ProactorSocketTransport.write_eofmsQ = D-  F  ? " J   / / / / / # "r>ry) rCrzr{r _SendfileMode TRY_NATIVE_sendfile_compatibler$r%rrr~rs@rrr[s+$2=48$('''''' &&&0000000r>rceZdZfdZ d dZ d!ddddddddZ d dZ d"dZ d"d Z d"d Z fd Z d Z d Z dZ d#dZdZdZdZdZdZdZdZdZd!dZdZ d$dZdZdZdZxZS)%rcttjd|jj||_||_d|_i|_ | || tj tjur-tj|jdSdS)NzUsing proactor: %s)r#r$r rer=rCr _selector_self_reading_future_accept_futuresset_loop_make_self_pipe threadingcurrent_thread main_threadsignal set_wakeup_fd_csockrE)r7proactorr=s rr$zBaseProactorEventLoop.__init__ws  )8+=+FGGG!!$(!!$   # % %)>)@)@ @ @  !3!3!5!5 6 6 6 6 6 A @r>Nc*t||||||SrO)r)r7rr9r:r;r<s r_make_socket_transportz,BaseProactorEventLoop._make_socket_transports!'dHf(-v77 7r>F) server_sideserver_hostnamer;r<ssl_handshake_timeoutssl_shutdown_timeoutc ptj||||||| | } t||| ||| jS)N)rrr;r<)r SSLProtocolr_app_transport) r7rawsockr9 sslcontextr:rrr;r<rr ssl_protocols r_make_ssl_transportz)BaseProactorEventLoop._make_ssl_transports\  +h F_&;%9 ;;; !w ',V = = = =**r>c*t||||||SrO)r)r7rr9rr:r;s r_make_datagram_transportz.BaseProactorEventLoop._make_datagram_transports!)$h*0%99 9r>c(t|||||SrO)rr7rr9r:r;s r_make_duplex_pipe_transportz1BaseProactorEventLoop._make_duplex_pipe_transports"+D,0(FEKK Kr>c(t|||||SrO)rr s r_make_read_pipe_transportz/BaseProactorEventLoop._make_read_pipe_transports)$hNNNr>c(t|||||SrO)rr s r_make_write_pipe_transportz0BaseProactorEventLoop._make_write_pipe_transports$+4+/65JJ Jr>c|rtd|rdStjtjurt jd|| |j d|_ d|_ t dS)Nz!Cannot close a running event looprq) is_runningr is_closedrr r r r _stop_accept_futures_close_self_piperrYrr#)r7r=s rrYzBaseProactorEventLoop.closes ??   DBCC C >>    F  # % %)>)@)@ @ @   $ $ $ !!###    r>cHK|j||d{VSrO)rr)r7rns r sock_recvzBaseProactorEventLoop.sock_recvs0^((q111111111r>cHK|j||d{VSrO)rr)r7rbufs rsock_recv_intoz$BaseProactorEventLoop.sock_recv_intos0^--dC888888888r>cHK|j||d{VSrO)rr)r7rbufsizes r sock_recvfromz#BaseProactorEventLoop.sock_recvfroms0^,,T7;;;;;;;;;r>rclK|st|}|j|||d{VSrO)rFr recvfrom_into)r7rr/nbytess rsock_recvfrom_intoz(BaseProactorEventLoop.sock_recvfrom_intosE XXF^11$VDDDDDDDDDr>cHK|j||d{VSrO)rr)r7rrs r sock_sendallz"BaseProactorEventLoop.sock_sendalls0^((t444444444r>cLK|j||d|d{VS)Nr)rr)r7rrrs r sock_sendtoz!BaseProactorEventLoop.sock_sendtos4^**4q'BBBBBBBBBr>cHK|j||d{VSrO)rconnect)r7rrs r sock_connectz"BaseProactorEventLoop.sock_connects0^++D':::::::::r>cFK|j|d{VSrO)racceptrMs r sock_acceptz!BaseProactorEventLoop.sock_accepts.^**4000000000r>cK |}n2#ttjf$r}t jdd}~wwxYw t j|j}n"#t$rt jdwxYw|r|n|}|sdSt|d}|rt||z|n|} t||}d} t| |z |}|dkr| | dkr| |SS|j ||||d{V||z }| |z } e#| dkr| |wwxYw)Nznot a regular filerl)rEAttributeErrorioUnsupportedOperationrSendfileNotAvailableErrorosfstatst_sizerdminseekrsendfile) r7rfileoffsetcountrEerrfsize blocksizeend_pos total_sents r_sock_sendfile_nativez+BaseProactorEventLoop._sock_sendfile_natives M[[]]FF 78 M M M67KLL L M MHV$$,EE M M M67KLL L M"-EE  1 ;// 05@#fune,,,5VU##  " (& 0)<< >>% A~~ &!!!! n--dD&)LLLLLLLLL)#i'  (A~~ &!!!!s2AAA A&&B D2.D22EcK|}||d{V ||j|||dd{V ||r|SS#||r|wwxYw)NF)fallback)rrr sock_sendfiler&rr)r7transprMrNrOrs r_sendfile_nativez&BaseProactorEventLoop._sendfile_natives **,,''))))))))) (++FL$5:,<<<<<<<< <  & & ( ( ( (%%'''' (  & & ( ( ( (%%'''' (s $B-Cc|j |jd|_|jd|_|jd|_|xjdzc_dS)Nr)rrX_ssockrYr  _internal_fdsrRs rr*z&BaseProactorEventLoop._close_self_pipesx  $ 0  % , , . . .(,D %     ar>ctj\|_|_|jd|jd|xjdz c_dS)NFr)r socketpairr\r  setblockingr]rRs rrz%BaseProactorEventLoop._make_self_pipes_#)#4#6#6  T[ &&& &&& ar>cr |||j|urdS|j|jd}||_||jdS#tj$rYdSttf$rt$r$}| d||dYd}~dSd}~wwxYw)Niz.Error on reading from the event loop self pipe)rarbr8) rrrrr\r_loop_self_readingrrrrrrf)r7rrhs rrbz(BaseProactorEventLoop._loop_self_readings 9} (11##DK66A)*D %   7 8 8 8 8 8(    FF-.         ' 'K ))          s"A& A&&B68B6B11B6c|j}|dS |ddS#t$r$|jrt jddYdSYdSwxYw)Nz3Fail to write a null byte into the self-pipe socketTr)r rrd_debugr re)r7csocks r_write_to_selfz$BaseProactorEventLoop._write_to_self1s   = F , JJu      , , ,{ , 0&*,,,,,,, , , , ,s$'AAdc Zdfd dS)Nc F |||\}}jrtjd||} || dd|i n||d|irdSj }|j <| dS#t$r} dkr@ d|tj d n*jrtjd d Yd}~dSYd}~dSYd}~dSd}~wt"j$r YdSwxYw) Nz#%r got a new connection from %r: %rTr)rr;r<rrrrqzAccept failed on a socket)rarbrzAccept failed on socket %rr)rrer rerrr(rr@rrErrdrfr rrYrr) rconnrr9rhr8protocol_factoryr7r<rrrrs rr8z2BaseProactorEventLoop._start_serving..loopHsD# *=!"JD${9 %J%+T4999//11H!-00 (JD#-t"4V2G1E 1GGGG 33 (#-t"4V4EEE>>##FN))$//78$T[[]]3##D))))) 6 6 6;;==B&&//#>%("("8">">11 JJLLLL[6L!=!%6666666666666666!LLLLL,     s%BC$C$$ F .A6E66&F F rO)r2) r7rlrrr<backlogrrr8s ````` ``@r_start_servingz$BaseProactorEventLoop._start_servingCsf $ *$ *$ *$ *$ *$ *$ *$ *$ *$ *$ *$ *$ *L tr>cdSrOr)r7 event_lists r_process_eventsz%BaseProactorEventLoop._process_eventsps r>c|jD]}||jdSrO)rvaluesrXclear)r7futures rr)z*BaseProactorEventLoop._stop_accept_futurestsJ*1133  F MMOOOO ""$$$$$r>c|j|d}|r||j||dSrO)rpoprErXr _stop_servingrY)r7rrus rrxz#BaseProactorEventLoop._stop_servingys^%))$++-->>   MMOOO $$T*** r>ryrOr)r)NNrhNN)rCrzr{r$rrrr!r#r%rYr-r0r3r7r9r;r>rArUrZr*rrbrgrnrqr)rxr~rs@rrrusS 7 7 7 7 7=A267777 9= + $t"&!% + + + + + CG9999 BF*.KKKK @D(,OOOOAE)-JJJJ (222999<<<EEEE 555CCC;;;111""": ( ( (      99998,,,&>A-1,0++++Z   %%% r>r)#__all__rDrGrr|r rrrrrrr r r r logr r_FlowControlMixin BaseTransportr! ReadTransportrWriteTransportrrDatagramTransportr Transportrr BaseEventLooprrr>rrs #  000$DDDDD!=!+!9DDDNO2O2O2O2O2!;!+!9O2O2O2dk"k"k"k"k"&@&0&?k"k"k"\"A,A=A=A=A=A=!;!+!=A=A=A=H " " " " "#=#B#-#7 " " "000009>)30004IIIIIK5IIIIIr>__pycache__/events.cpython-311.opt-1.pyc000064400000111663152533123130013727 0ustar00 !A?hodZdZddlZddlZddlZddlZddlZddlZddlm Z GddZ Gdd e Z Gd d Z Gd d Z GddZGddeZdaejZGddejZeZdZdZdZdZdZdZdZd"dZdZdZdZ d Z!eZ"eZ#eZ$eZ%eZ& dd!l'mZmZmZmZmZeZ(eZ)eZ*eZ+eZ,dS#e-$rYdSwxYw)#z!Event loop and event loop policy.)AbstractEventLoopPolicyAbstractEventLoopAbstractServerHandle TimerHandleget_event_loop_policyset_event_loop_policyget_event_loopset_event_loopnew_event_loopget_child_watcherset_child_watcher_set_running_loopget_running_loop_get_running_loopN)format_helpersc<eZdZdZdZd dZdZdZdZdZ d Z dS) rz1Object returned by callback registration methods.) _callback_args _cancelled_loop_source_traceback_repr __weakref___contextNc|tj}||_||_||_||_d|_d|_|jr-tj tj d|_ dSd|_ dS)NFr) contextvars copy_contextrrrrrr get_debugr extract_stacksys _getframer)selfcallbackargsloopcontexts ;/opt/alt/python-internal/lib64/python3.11/asyncio/events.py__init__zHandle.__init__#s ?!.00G  !  :   ! ! *%3%A a  &"&"D " " "&*D " " "c@|jjg}|jr|d|j2|t j|j|j|jr4|jd}|d|dd|d|S)N cancelledz created at r:r) __class____name__rappendrr_format_callback_sourcerr)r$infoframes r) _repr_infozHandle._repr_info2s'( ? % KK $ $ $ > % KK> ,, - - -  ! =*2.E KK;eAh;;q;; < < < r+c|j|jS|}dd|S)Nz<{}> )rr6formatjoin)r$r4s r)__repr__zHandle.__repr__>s= : !:   }}SXXd^^,,,r+c|jsDd|_|jrt||_d|_d|_dSdS)NT)rrr reprrrrr$s r)cancelz Handle.cancelDsT "DOz##%% ("$ZZ !DNDJJJ  r+c|jSN)rr>s r)r-zHandle.cancelledOs r+cB |jj|jg|jRn}#tt f$rt $r_}tj|j|j}d|}|||d}|j r |j |d<|j |Yd}~nd}~wwxYwd}dS)NzException in callback )message exceptionhandlesource_traceback) rrunrr SystemExitKeyboardInterrupt BaseExceptionrr3rrcall_exception_handler)r$exccbmsgr(s r)_runz Handle._runRs 7 DM dn :tz : : : : :-.     7 7 77 ,,B/2//C G % E.2.D*+ J - -g 6 6 6 6 6 6 6 6 7s BABBrA) r1 __module__ __qualname____doc__ __slots__r*r6r;r?r-rOr+r)rrs;;I * * * *   ---   r+rcjeZdZdZddgZdfd ZfdZdZdZd Z d Z d Z d Z fd Z dZxZS)rz7Object returned by timed callback registration methods. _scheduled_whenNct|||||jr|jd=||_d|_dS)Nr.F)superr*rrWrV)r$whenr%r&r'r(r0s r)r*zTimerHandle.__init__ksI 4w777  ! +&r* r+ct}|jrdnd}||d|j|S)Nrzwhen=)rYr6rinsertrW)r$r4posr0s r)r6zTimerHandle._repr_inforsLww!!##?)aa C---... r+c*t|jSrA)hashrWr>s r)__hash__zTimerHandle.__hash__xsDJr+cZt|tr|j|jkStSrA isinstancerrWNotImplementedr$others r)__lt__zTimerHandle.__lt__{) e[ ) ) ,: + +r+ct|tr%|j|jkp||StSrArdrrW__eq__rerfs r)__le__zTimerHandle.__le__; e[ ) ) B: +At{{5/A/A Ar+cZt|tr|j|jkStSrArcrfs r)__gt__zTimerHandle.__gt__rir+ct|tr%|j|jkp||StSrArkrfs r)__ge__zTimerHandle.__ge__rnr+ct|tr@|j|jko/|j|jko|j|jko|j|jkSt SrA)rdrrWrrrrerfs r)rlzTimerHandle.__eq__sc e[ ) ) 9J%+-8Neo58J%+-8Ou'77 9r+c|js|j|tdSrA)rr_timer_handle_cancelledrYr?)r$r0s r)r?zTimerHandle.cancels= 5 J . .t 4 4 4 r+c|jS)zReturn a scheduled callback time. The time is an absolute timestamp, using the same time reference as loop.time(). )rWr>s r)rZzTimerHandle.whens zr+rA)r1rPrQrRrSr*r6rarhrmrprrrlr?rZ __classcell__)r0s@r)rrfsAAw'I               r+rcBeZdZdZdZdZdZdZdZdZ dZ d Z d S) rz,Abstract server returned by create_server().ct)z5Stop serving. This leaves existing connections open.NotImplementedErrorr>s r)closezAbstractServer.close!!r+ct)z4Get the event loop the Server object is attached to.rzr>s r)get_loopzAbstractServer.get_loopr}r+ct)z3Return True if the server is accepting connections.rzr>s r) is_servingzAbstractServer.is_servingr}r+cKt)zStart accepting connections. This method is idempotent, so it can be called when the server is already being serving. rzr>s r) start_servingzAbstractServer.start_serving "!r+cKt)zStart accepting connections until the coroutine is cancelled. The server is closed when the coroutine is cancelled. rzr>s r) serve_foreverzAbstractServer.serve_forever "!r+cKt)z*Coroutine to wait until service is closed.rzr>s r) wait_closedzAbstractServer.wait_closed !!r+c K|SrArTr>s r) __aenter__zAbstractServer.__aenter__s  r+cfK||d{VdSrA)r|r)r$rLs r) __aexit__zAbstractServer.__aexit__s=            r+N) r1rPrQrRr|rrrrrrrrTr+r)rrs66""""""""""""""""""!!!!!r+rc eZdZdZdZdZdZdZdZdZ dZ d Z d Z d d d Z d d dZd d dZdZdZd d ddZd d dZdZdZddddddZdJdZ dKd dddd d d d d d d d dZ dKejejd dd d d d d dd d ZdLdd!d"Zd#d d d d$d%Z dMd d d d d d&d'Z dMd dd d d dd(d)Z d d d d*d+Z! dKdddd d d d d,d-Z"d.Z#d/Z$e%j&e%j&e%j&d0d1Z'e%j&e%j&e%j&d0d2Z(d3Z)d4Z*d5Z+d6Z,d7Z-d8Z.d9Z/dJd:Z0d;Z1d<Z2d=Z3d>Z4dLd d!d?Z5d@Z6dAZ7dBZ8dCZ9dDZ:dEZ;dFZdIZ?d S)NrzAbstract event loop.ct)z*Run the event loop until stop() is called.rzr>s r) run_foreverzAbstractEventLoop.run_foreverr}r+ct)zpRun the event loop until a Future is done. Return the Future's result, or raise its exception. rz)r$futures r)run_until_completez$AbstractEventLoop.run_until_completes "!r+ct)zStop the event loop as soon as reasonable. Exactly how soon that is may depend on the implementation, but no more I/O callbacks should be scheduled. rzr>s r)stopzAbstractEventLoop.stops "!r+ct)z3Return whether the event loop is currently running.rzr>s r) is_runningzAbstractEventLoop.is_runningr}r+ct)z*Returns True if the event loop was closed.rzr>s r) is_closedzAbstractEventLoop.is_closedr}r+ct)zClose the loop. The loop should not be running. This is idempotent and irreversible. No other methods should be called after this one. rzr>s r)r|zAbstractEventLoop.closes "!r+cKt)z,Shutdown all active asynchronous generators.rzr>s r)shutdown_asyncgensz$AbstractEventLoop.shutdown_asyncgensrr+cKt)z.Schedule the shutdown of the default executor.rzr>s r)shutdown_default_executorz+AbstractEventLoop.shutdown_default_executorrr+ct)z3Notification that a TimerHandle has been cancelled.rz)r$rEs r)ruz)AbstractEventLoop._timer_handle_cancelledr}r+N)r(c&|jd|g|Rd|iS)Nrr() call_laterr$r%r(r&s r) call_soonzAbstractEventLoop.call_soons&tq(CTCCC7CCCr+ctrArz)r$delayr%r(r&s r)rzAbstractEventLoop.call_later !!r+ctrArz)r$rZr%r(r&s r)call_atzAbstractEventLoop.call_atrr+ctrArzr>s r)timezAbstractEventLoop.timerr+ctrArzr>s r) create_futurezAbstractEventLoop.create_futurerr+)namer(ctrArz)r$cororr(s r) create_taskzAbstractEventLoop.create_taskrr+ctrArzrs r)call_soon_threadsafez&AbstractEventLoop.call_soon_threadsaferr+ctrArz)r$executorfuncr&s r)run_in_executorz!AbstractEventLoop.run_in_executor!rr+ctrArz)r$rs r)set_default_executorz&AbstractEventLoop.set_default_executor$rr+r)familytypeprotoflagscKtrArz)r$hostportrrrrs r) getaddrinfozAbstractEventLoop.getaddrinfo)rr+cKtrArz)r$sockaddrrs r) getnameinfozAbstractEventLoop.getnameinfo- !!r+) sslrrrsock local_addrserver_hostnamessl_handshake_timeoutssl_shutdown_timeouthappy_eyeballs_delay interleavec KtrArz)r$protocol_factoryrrrrrrrrrrrrrs r)create_connectionz#AbstractEventLoop.create_connection0s"!r+dT) rrrbacklogr reuse_address reuse_portrrrc Kt)a#A coroutine which creates a TCP server bound to host and port. The return value is a Server object which can be used to stop the service. If host is an empty string or None all interfaces are assumed and a list of multiple sockets will be returned (most likely one for IPv4 and another one for IPv6). The host parameter can also be a sequence (e.g. list) of hosts to bind to. family can be set to either AF_INET or AF_INET6 to force the socket to use IPv4 or IPv6. If not set it will be determined from host (defaults to AF_UNSPEC). flags is a bitmask for getaddrinfo(). sock can optionally be specified in order to use a preexisting socket object. backlog is the maximum number of queued connections passed to listen() (defaults to 100). ssl can be set to an SSLContext to enable SSL over the accepted connections. reuse_address tells the kernel to reuse a local socket in TIME_WAIT state, without waiting for its natural timeout to expire. If not specified will automatically be set to True on UNIX. reuse_port tells the kernel to allow this endpoint to be bound to the same port as other existing endpoints are bound to, so long as they all set this flag when being created. This option is not supported on Windows. ssl_handshake_timeout is the time in seconds that an SSL server will wait for completion of the SSL handshake before aborting the connection. Default is 60s. ssl_shutdown_timeout is the time in seconds that an SSL server will wait for completion of the SSL shutdown procedure before aborting the connection. Default is 30s. start_serving set to True (default) causes the created server to start accepting connections immediately. When set to False, the user should await Server.start_serving() or Server.serve_forever() to make the server to start accepting connections. rz)r$rrrrrrrrrrrrrs r) create_serverzAbstractEventLoop.create_server:sp"!r+)fallbackcKt)zRSend a file through a transport. Return an amount of sent bytes. rz)r$ transportfileoffsetcountrs r)sendfilezAbstractEventLoop.sendfiletrr+F) server_siderrrcKt)z|Upgrade a transport to TLS. Return a new transport that *protocol* should start using immediately. rz)r$rprotocol sslcontextrrrrs r) start_tlszAbstractEventLoop.start_tls|s"!r+)rrrrrcKtrArz)r$rpathrrrrrs r)create_unix_connectionz(AbstractEventLoop.create_unix_connectionrr+)rrrrrrcKt)aWA coroutine which creates a UNIX Domain Socket server. The return value is a Server object, which can be used to stop the service. path is a str, representing a file system path to bind the server socket to. sock can optionally be specified in order to use a preexisting socket object. backlog is the maximum number of queued connections passed to listen() (defaults to 100). ssl can be set to an SSLContext to enable SSL over the accepted connections. ssl_handshake_timeout is the time in seconds that an SSL server will wait for the SSL handshake to complete (defaults to 60s). ssl_shutdown_timeout is the time in seconds that an SSL server will wait for the SSL shutdown to finish (defaults to 30s). start_serving set to True (default) causes the created server to start accepting connections immediately. When set to False, the user should await Server.start_serving() or Server.serve_forever() to make the server to start accepting connections. rz) r$rrrrrrrrs r)create_unix_serverz$AbstractEventLoop.create_unix_serversD"!r+)rrrcKt)aHandle an accepted connection. This is used by servers that accept connections outside of asyncio, but use asyncio to handle connections. This method is a coroutine. When completed, the coroutine returns a (transport, protocol) pair. rz)r$rrrrrs r)connect_accepted_socketz)AbstractEventLoop.connect_accepted_sockets"!r+)rrrrrallow_broadcastrcKt)aA coroutine which creates a datagram endpoint. This method will try to establish the endpoint in the background. When successful, the coroutine returns a (transport, protocol) pair. protocol_factory must be a callable returning a protocol instance. socket family AF_INET, socket.AF_INET6 or socket.AF_UNIX depending on host (or family if specified), socket type SOCK_DGRAM. reuse_address tells the kernel to reuse a local socket in TIME_WAIT state, without waiting for its natural timeout to expire. If not specified it will automatically be set to True on UNIX. reuse_port tells the kernel to allow this endpoint to be bound to the same port as other existing endpoints are bound to, so long as they all set this flag when being created. This option is not supported on Windows and some UNIX's. If the :py:data:`~socket.SO_REUSEPORT` constant is not defined then this capability is unsupported. allow_broadcast tells the kernel to allow this endpoint to send messages to the broadcast address. sock can optionally be specified in order to use a preexisting socket object. rz) r$rr remote_addrrrrrrrrs r)create_datagram_endpointz*AbstractEventLoop.create_datagram_endpointsB"!r+cKt)aRegister read pipe in event loop. Set the pipe to non-blocking mode. protocol_factory should instantiate object with Protocol interface. pipe is a file-like object. Return pair (transport, protocol), where transport supports the ReadTransport interface.rzr$rpipes r)connect_read_pipez#AbstractEventLoop.connect_read_pipe"!r+cKt)aRegister write pipe in event loop. protocol_factory should instantiate object with BaseProtocol interface. Pipe is file-like object already switched to nonblocking. Return pair (transport, protocol), where transport support WriteTransport interface.rzrs r)connect_write_pipez$AbstractEventLoop.connect_write_piperr+)stdinstdoutstderrcKtrArz)r$rcmdrrrkwargss r)subprocess_shellz"AbstractEventLoop.subprocess_shellrr+cKtrArz)r$rrrrr&rs r)subprocess_execz!AbstractEventLoop.subprocess_exec rr+ctrArzr$fdr%r&s r) add_readerzAbstractEventLoop.add_readerrr+ctrArzr$rs r) remove_readerzAbstractEventLoop.remove_readerrr+ctrArzrs r) add_writerzAbstractEventLoop.add_writerrr+ctrArzrs r) remove_writerzAbstractEventLoop.remove_writerrr+cKtrArz)r$rnbytess r) sock_recvzAbstractEventLoop.sock_recv#rr+cKtrArz)r$rbufs r)sock_recv_intoz AbstractEventLoop.sock_recv_into&rr+cKtrArz)r$rbufsizes r) sock_recvfromzAbstractEventLoop.sock_recvfrom)rr+cKtrArz)r$rr r s r)sock_recvfrom_intoz$AbstractEventLoop.sock_recvfrom_into,rr+cKtrArz)r$rdatas r) sock_sendallzAbstractEventLoop.sock_sendall/rr+cKtrArz)r$rraddresss r) sock_sendtozAbstractEventLoop.sock_sendto2rr+cKtrArz)r$rrs r) sock_connectzAbstractEventLoop.sock_connect5rr+cKtrArz)r$rs r) sock_acceptzAbstractEventLoop.sock_accept8rr+cKtrArz)r$rrrrrs r) sock_sendfilezAbstractEventLoop.sock_sendfile;rr+ctrArz)r$sigr%r&s r)add_signal_handlerz$AbstractEventLoop.add_signal_handlerArr+ctrArz)r$r!s r)remove_signal_handlerz'AbstractEventLoop.remove_signal_handlerDrr+ctrArz)r$factorys r)set_task_factoryz"AbstractEventLoop.set_task_factoryIrr+ctrArzr>s r)get_task_factoryz"AbstractEventLoop.get_task_factoryLrr+ctrArzr>s r)get_exception_handlerz'AbstractEventLoop.get_exception_handlerQrr+ctrArz)r$handlers r)set_exception_handlerz'AbstractEventLoop.set_exception_handlerTrr+ctrArzr$r(s r)default_exception_handlerz+AbstractEventLoop.default_exception_handlerWrr+ctrArzr0s r)rKz(AbstractEventLoop.call_exception_handlerZrr+ctrArzr>s r)r zAbstractEventLoop.get_debug_rr+ctrArz)r$enableds r) set_debugzAbstractEventLoop.set_debugbrr+)rNN)rNrA)@r1rPrQrRrrrrrr|rrrurrrrrrrrrrrrsocket AF_UNSPEC AI_PASSIVErrrrrrrrr subprocessPIPErrrrrrr rrrrrrrrr"r$r'r)r+r.r1rKr r6rTr+r)rrs """"""""""""""" " " """"""" """26DDDDD:>"""""6:""""""""""" )-d""""" =A""""""""""" "#!1"""""""""59"$4 "&!%!%$"""""598"&#$DT"&!%8"8"8"8"8"t"#'"""""%*(,.2-1 " " " " "*."4 "&!% """""*.""s"&!% """"""""""L"&!% " " " " " EI!"./q59d7;$ !"!"!"!"!"J " " " " " "&0_&0o&0o"""""%/O%/_%/_""""""""""""""""" """"""""""""""""""""""""""(,""""" """""" """""" """""""""""" """"""""r+rc0eZdZdZdZdZdZdZdZdS)rz-Abstract policy for accessing the event loop.ct)a>Get the event loop for the current context. Returns an event loop object implementing the AbstractEventLoop interface, or raises an exception in case no event loop has been set for the current context and the current policy does not specify to create one. It should never return None.rzr>s r)r z&AbstractEventLoopPolicy.get_event_loopis "!r+ct)z3Set the event loop for the current context to loop.rzr$r's r)r z&AbstractEventLoopPolicy.set_event_loopsr}r+ct)zCreate and return a new event loop object according to this policy's rules. If there's need to set this loop as the event loop for the current context, set_event_loop must be called explicitly.rzr>s r)r z&AbstractEventLoopPolicy.new_event_loopws "!r+ct)z$Get the watcher for child processes.rzr>s r)r z)AbstractEventLoopPolicy.get_child_watcherr}r+ct)z$Set the watcher for child processes.rz)r$watchers r)r z)AbstractEventLoopPolicy.set_child_watcherr}r+N) r1rPrQrRr r r r r rTr+r)rrfse77"""""""""""""""""r+rcTeZdZdZdZGddejZdZdZ dZ dZ dS) BaseDefaultEventLoopPolicyaDefault policy implementation for accessing the event loop. In this policy, each thread has its own event loop. However, we only automatically create an event loop by default for the main thread; other threads by default have no event loop. Other policies may have different rules (e.g. a single global event loop, or automatically creating an event loop per thread, or using some other notion of context to which an event loop is associated). NceZdZdZdZdS)!BaseDefaultEventLoopPolicy._LocalNF)r1rPrQr _set_calledrTr+r)_LocalrHs r+rJc8||_dSrA)rJ_localr>s r)r*z#BaseDefaultEventLoopPolicy.__init__skkmm r+cL|jjY|jjsMtjtjur'|||jj(tdtjj z|jjS)zvGet the event loop for the current context. Returns an instance of EventLoop or raises an exception. Nz,There is no current event loop in thread %r.) rLrrI threadingcurrent_thread main_threadr r RuntimeErrorrr>s r)r z)BaseDefaultEventLoopPolicy.get_event_loops K  %K+ &(**i.C.E.EEE    3 3 5 5 6 6 6 ;  $M!*!9!;!;!@ ABB B{  r+cd|j_|:t|ts%t dt |jd||j_dS)zSet the event loop.TNzs r)r z)BaseDefaultEventLoopPolicy.new_event_loops !!###r+) r1rPrQrRrVrNlocalrJr*r r r rTr+r)rFrFs  M$$$!!! !!!$$$$$r+rFceZdZdZdS) _RunningLoopr7N)r1rPrQloop_pidrTr+r)rYrYsHHHr+rYcDt}|td|S)zrReturn the running event loop. Raise a RuntimeError if there is none. This function is thread-specific. Nzno running event loop)rrQr's r)rrs(   D |2333 Kr+c^tj\}}||tjkr|SdSdS)zReturn the running event loop or None. This is a low-level function intended to be used by event loops. This function is thread-specific. N) _running_looprZosgetpid) running_looppids r)rrs;&.L#C29;;$6$6 $6$6r+cD|tjft_dS)zSet the running event loop. This is a low-level function intended to be used by event loops. This function is thread-specific. N)r_r`r^rZr\s r)rrs#BIKK0Mr+ctt5tddlm}|addddS#1swxYwYdS)NrDefaultEventLoopPolicy)_lock_event_loop_policyrfres r)_init_event_loop_policyrjs ::  % 0 0 0 0 0 0!7!7!9!9 ::::::::::::::::::s -11c:tttS)z"Get the current event loop policy.)rhrjrTr+r)rrs!!!! r+c|:t|ts%tdt|jd|adS)zZSet the current event loop policy. If policy is None, the default policy is restored.NzDpolicy must be an instance of AbstractEventLoopPolicy or None, not 'rS)rdrrTrr1rh)policys r)rrsM *V5L"M"Mw_cdj_k_k_twwwxxxr+ctS)aGReturn an asyncio event loop. When called from a coroutine or a callback (e.g. scheduled with call_soon or similar API), this function will always return the running event loop. If there is no running event loop set, the function will return the result of `get_event_loop_policy().get_event_loop()` call. )_py__get_event_looprTr+r)r r s   r+cft}||StSrA)rrr ) stacklevel current_loops r)_get_event_looprts3 %&&L " " 1 1 3 33r+cHt|dS)zCEquivalent to calling get_event_loop_policy().set_event_loop(loop).N)rr r\s r)r r #s"**400000r+cBtS)z?Equivalent to calling get_event_loop_policy().new_event_loop().)rr rTr+r)r r (s " " 1 1 3 33r+cBtS)zBEquivalent to calling get_event_loop_policy().get_child_watcher().)rr rTr+r)r r -s " " 4 4 6 66r+cDt|S)zMEquivalent to calling get_event_loop_policy().set_child_watcher(watcher).)rr )rDs r)r r 2s ! " " 4 4W = ==r+)rrrr rt)rp).rR__all__rr_r8r;r"rNrirrrrrrrFrhLockrgrWrYr^rrrrjrrr rtr r r r _py__get_running_loop_py__set_running_loop_py_get_running_loop_py_get_event_loopro_asyncio_c__get_running_loop_c__set_running_loop_c_get_running_loop_c_get_event_loop_c__get_event_loop ImportErrorrTr+r)rs>''   GGGGGGGGT<<<<<&<<<~'!'!'!'!'!'!'!'!TT"T"T"T"T"T"T"T"n """"""""D3$3$3$3$3$!83$3$3$t  9?        111:::    ! ! !4444111 444 777 >>>*)'#%)MMMMMMMMMMMMMM -,*&(   DD sC++C43C4__pycache__/log.cpython-311.pyc000064400000000472152533123130012240 0ustar00 !A?h|2dZddlZejeZdS)zLogging configuration.N)__doc__logging getLogger __package__logger8/opt/alt/python-internal/lib64/python3.11/asyncio/log.pyr s,  ; ' 'r __pycache__/base_tasks.cpython-311.opt-2.pyc000064400000010144152533123130014533 0ustar00 !A?hT xddlZddlZddlZddlmZddlmZdZejdZdZ dZ dS) N) base_futures) coroutinesctj|}|r|sd|d<|dd|zt j|j}|dd|d|j |dd |j |S) N cancellingrrzname=%rzcoro=<>z wait_for=) r_future_repr_infordoneinsertget_namer_format_coroutine_coro _fut_waiter)taskinfocoros ?/opt/alt/python-internal/lib64/python3.11/asyncio/base_tasks.py_task_repr_infor s  )$ / /D QKK9t}}.///  ' 3 3DKK#D###$$$ # A74#377888 Kcldt|}d|jjd|dS)N  > X>z 7 " " KK ! ! !   * * * 61;??xt<==== /C I &d&&T22222  @t@@@tLLLLL <4<<<4HHHH d3333 3CM3GG + +D $Tr * * * * * + +r) r;reprlibr@r2rrrrecursive_reprrr/rKrrrOs"111   F+++++r__pycache__/sslproto.cpython-311.opt-1.pyc000064400000124712152533123130014307 0ustar00 !A?h{PddlZddlZddlZ ddlZn #e$rdZYnwxYwddlmZddlmZddlmZddlm Z ddl m Z eej ej fZGdd ejZGd d ejZd Zd ZGdde je jZGddejZdS)N) constants) exceptions) protocols) transports)loggerc"eZdZdZdZdZdZdZdS)SSLProtocolState UNWRAPPED DO_HANDSHAKEWRAPPEDFLUSHINGSHUTDOWNN)__name__ __module__ __qualname__r r r rr=/opt/alt/python-internal/lib64/python3.11/asyncio/sslproto.pyr r s'I!LGHHHHrr ceZdZdZdZdZdZdS)AppProtocolState STATE_INITSTATE_CON_MADE STATE_EOFSTATE_CON_LOSTN)rrrrrrrrrrrrs$J%NI%NNNrrc`|rtdtj}|sd|_|S)Nz(Server side SSL needs a valid SSLContextF) ValueErrorsslcreate_default_contextcheck_hostname) server_sideserver_hostname sslcontexts r_create_transport_contextr$/s@ECDDD +--J *$) ! rc|||dz}n |}d|z}n|}||dz}n|}||cxkrdksntd|d|d||fS)Nirzhigh (z) must be >= low (z) must be >= 0)r)highlowkbhilos radd_flowcontrol_defaultsr,=s | ;dBBBRBB  { 1W  ====q====j""bbb"## # r6MrceZdZdZejjZdZddZ dZ dZ dZ dZ efd Zd Zd Zd Zdd ZdZdZddZdZdZedZdZdZdZdZdZdZ dZ!dS)_SSLProtocolTransportTc0||_||_d|_dS)NF)_loop _ssl_protocol_closed)selfloop ssl_protocols r__init__z_SSLProtocolTransport.__init__Xs ) rNc8|j||S)z#Get optional transport information.)r1_get_extra_infor3namedefaults rget_extra_infoz$_SSLProtocolTransport.get_extra_info]s!11$@@@rc:|j|dSN)r1_set_app_protocol)r3protocols r set_protocolz"_SSLProtocolTransport.set_protocolas ,,X66666rc|jjSr>)r1 _app_protocolr3s r get_protocolz"_SSLProtocolTransport.get_protocolds!//rc|jSr>)r2rDs r is_closingz _SSLProtocolTransport.is_closinggs |rcf|js"d|_|jdSd|_dS)a Close the transport. Buffered data will be flushed asynchronously. No more data will be received. After all buffered data is flushed, the protocol's connection_lost() method will (eventually) called with None as its argument. TN)r2r1_start_shutdownrDs rclosez_SSLProtocolTransport.closejs>| &DL   . . 0 0 0 0 0!%D   rc\|js$d|_|dtdSdS)NTz9unclosed transport )r2warnResourceWarning)r3 _warningss r__del__z_SSLProtocolTransport.__del__xsE| ,DL NN* , , , , , , ,rc|jj Sr>)r1_app_reading_pausedrDs r is_readingz _SSLProtocolTransport.is_readings%999rc8|jdS)zPause the receiving end. No data will be passed to the protocol's data_received() method until resume_reading() is called. N)r1_pause_readingrDs r pause_readingz#_SSLProtocolTransport.pause_readings ))+++++rc8|jdS)zResume the receiving end. Data received will once again be passed to the protocol's data_received() method. N)r1_resume_readingrDs rresume_readingz$_SSLProtocolTransport.resume_readings **,,,,,rcn|j|||jdS)aSet the high- and low-water limits for write flow control. These two values control when to call the protocol's pause_writing() and resume_writing() methods. If specified, the low-water limit must be less than or equal to the high-water limit. Neither value can be negative. The defaults are implementation-specific. If only the high-water limit is given, the low-water limit defaults to an implementation-specific value less than or equal to the high-water limit. Setting high to zero forces low to zero as well, and causes pause_writing() to be called whenever the buffer becomes non-empty. Setting low to zero causes resume_writing() to be called only once the buffer is empty. Use of zero for either limit is generally sub-optimal as it reduces opportunities for doing I/O and computation concurrently. N)r1_set_write_buffer_limits_control_app_writingr3r'r(s rset_write_buffer_limitsz-_SSLProtocolTransport.set_write_buffer_limitss8& 33D#>>> //11111rc2|jj|jjfSr>)r1_outgoing_low_water_outgoing_high_waterrDs rget_write_buffer_limitsz-_SSLProtocolTransport.get_write_buffer_limits"6"79 9rc4|jS)z-Return the current size of the write buffers.)r1_get_write_buffer_sizerDs rget_write_buffer_sizez+_SSLProtocolTransport.get_write_buffer_sizes!88:::rcn|j|||jdS)aSet the high- and low-water limits for read flow control. These two values control when to call the upstream transport's pause_reading() and resume_reading() methods. If specified, the low-water limit must be less than or equal to the high-water limit. Neither value can be negative. The defaults are implementation-specific. If only the high-water limit is given, the low-water limit defaults to an implementation-specific value less than or equal to the high-water limit. Setting high to zero forces low to zero as well, and causes pause_reading() to be called whenever the buffer becomes non-empty. Setting low to zero causes resume_reading() to be called only once the buffer is empty. Use of zero for either limit is generally sub-optimal as it reduces opportunities for doing I/O and computation concurrently. N)r1_set_read_buffer_limits_control_ssl_readingr\s rset_read_buffer_limitsz,_SSLProtocolTransport.set_read_buffer_limitss8& 224=== //11111rc2|jj|jjfSr>)r1_incoming_low_water_incoming_high_waterrDs rget_read_buffer_limitsz,_SSLProtocolTransport.get_read_buffer_limitsrbrc4|jS)z+Return the current size of the read buffer.)r1_get_read_buffer_sizerDs rget_read_buffer_sizez*_SSLProtocolTransport.get_read_buffer_sizes!77999rc|jjSr>)r1_app_writing_pausedrDs r_protocol_pausedz&_SSLProtocolTransport._protocol_pauseds!55rct|tttfs$t dt |j|sdS|j|fdS)zWrite some data bytes to the transport. This does not block; it buffers the data and arranges for it to be sent out asynchronously. z+data: expecting a bytes-like instance, got N) isinstancebytes bytearray memoryview TypeErrortyperr1_write_appdatar3datas rwritez_SSLProtocolTransport.writesv $ : >?? :9#'::#699:: :  F ))4'22222rc:|j|dS)zWrite a list (or any iterable) of data bytes to the transport. The default implementation concatenates the arguments and calls write() on the result. N)r1r{)r3 list_of_datas r writelinesz _SSLProtocolTransport.writeliness! )),77777rct)zuClose the write end after flushing buffered data. This raises :exc:`NotImplementedError` right now. )NotImplementedErrorrDs r write_eofz_SSLProtocolTransport.write_eofs "!rcdS)zAReturn True if this transport supports write_eof(), False if not.FrrDs r can_write_eofz#_SSLProtocolTransport.can_write_eofsurc0|ddS)zClose the transport immediately. Buffered data will be lost. No more data will be received. The protocol's connection_lost() method will (eventually) be called with None as its argument. N) _force_closerDs rabortz_SSLProtocolTransport.aborts $rcZd|_|j|j|dSdSNT)r2r1_abortr3excs rrz"_SSLProtocolTransport._force_closes7   )   % %c * * * * * * )rc|jj||jxjt |z c_dSr>)r1_write_backlogappend_write_buffer_sizelenr|s r_test__append_write_backlogz1_SSLProtocolTransport._test__append_write_backlogs? )00666 --T:----rr>NN)"rrr_start_tls_compatibler _SendfileModeFALLBACK_sendfile_compatibler6r<rArErGrJwarningsrOrRrUrXr]rarerirmrppropertyrsr~rrrrrrrrrr.r.Rs!$2; AAAA777000 & & &!),,,,:::,,,---2222,999;;;2222,999:::66X6 3 3 3888"""   +++ ;;;;;rr.ceZdZdZdZdZdZ d-dZdZd.dZ dZ d Z d Z d Z d Zd Zd.dZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZ dZ!d Z"d!Z#d"Z$d/d#Z%d$Z&d%Z'd&Z(d/d'Z)d(Z*d)Z+d*Z,d0d,Z-dS)1 SSLProtocoliNFTc ttdt|j|_t |j|_| tj}n|dkrtd|| tj } n| dkrtd| |st||}||_ |r |s||_ nd|_ ||_t||_t#j|_d|_||_||_||d|_d|_d|_||_| |_tj|_tj|_t@j!|_"d|_#|rtHj%|_&ntHj'|_&|j(|j|j|j |j |_)d|_*d|_+d|_,d|_-d|_.|/d|_0d|_1d|_2d|_3|4|5dS)Nzstdlib ssl module not availablerz7ssl_handshake_timeout should be a positive number, got z6ssl_shutdown_timeout should be a positive number, got )r#F)r!r")6r RuntimeErrorrwmax_size _ssl_bufferrx_ssl_buffer_viewrSSL_HANDSHAKE_TIMEOUTrSSL_SHUTDOWN_TIMEOUTr$ _server_side_server_hostname _sslcontextdict_extra collectionsdequerr_waiterr0r?_app_transport_app_transport_created _transport_ssl_handshake_timeout_ssl_shutdown_timeout MemoryBIO _incoming _outgoingr r _state _conn_lostrr _app_staterwrap_bio_sslobj_ssl_writing_pausedrQ_ssl_reading_pausedrlrkrg _eof_receivedrrr`r_rZ_get_app_transport) r3r4 app_protocolr#waiterr!r"call_connection_madessl_handshake_timeoutssl_shutdown_timeouts rr6zSSLProtocol.__init__s ;@AA A$T]33 *4+; < < ($-$C ! ! "a ' '/,//00 0 '#,#A !Q & &.+..// / .2_..J(  ); )$3D ! !$(D !%j111 */11"#   |,,,"&+#&;#%9"&0   >.9DOO.=DO'00 NDN) 1133 $) #( #( $%!#$  $$&&&"#( $%!#$  %%''' !!!!!rc||_t|dr;t|tjr!|j|_|j|_d|_ dSd|_ dS)N get_bufferTF) rChasattrrurBufferedProtocolr_app_protocol_get_bufferbuffer_updated_app_protocol_buffer_updated_app_protocol_is_buffer)r3rs rr?zSSLProtocol._set_app_protocolasc) L, / / 1<)CDD 1,8,CD )0<0KD -+/D ( ( (+0D ( ( (rc|jdS|js7||j|n|jdd|_dSr>)r cancelled set_exception set_resultrs r_wakeup_waiterzSSLProtocol._wakeup_waiterlsd <  F|%%'' . **3//// ''--- rc|j7|jrtdt|j||_d|_|jS)Nz$Creating _SSLProtocolTransport twiceT)rrrr.r0rDs rrzSSLProtocol._get_app_transportvsK   &* K"#IJJJ"7 D"I"ID *.D '""rc<||_|dS)zXCalled when the low-level connection is made. Start the SSL handshake. N)r_start_handshake)r3 transports rconnection_madezSSLProtocol.connection_made~s# $ rc|j|j|xjdz c_|j d|j_|jtj kr`|j tj ks|j tj kr6tj|_ |j|jj||tjd|_d|_d|_|||jr |jd|_|jr"|jd|_dSdS)zCalled when the low-level connection is lost or closed. The argument is an exception object or None (the latter meaning a regular EOF is received or the connection was aborted or closed). rNT)rclearrreadrrr2rr r rrrrrr0 call_soonrCconnection_lost _set_stater rr_shutdown_timeout_handlecancel_handshake_timeout_handlers rrzSSLProtocol.connection_lostsO !!###  1   **.D  ' ;*7 7 7#3#BBB#3#==="2"A $$T%7%GMMM (2333"! C    ( 1  ) 0 0 2 2 2,0D )  ) 2  * 1 1 3 3 3-1D * * * 2 2rc|}|dks ||jkr|j}t|j|kr-t||_t |j|_|jSNr)rrrrwrxr)r3nwants rrzSSLProtocol.get_buffersc 199t},,=D t 4 ' '(D $.t/?$@$@D !$$rc|j|jd||jtjkr|dS|jtjkr|dS|jtj kr| dS|jtj kr| dSdSr>) rr~rrr r _do_handshaker _do_readr _do_flushr _do_shutdown)r3nbytess rrzSSLProtocol.buffer_updateds T27F7;<<< ;*7 7 7    [,4 4 4 MMOOOOO [,5 5 5 NN      [,5 5 5        6 5rcd|_ |jrtjd||jt jkr|tdS|jt j kr>| t j |j rdS|dS|jt j krI|| t j|dS|jt jkr|dSdS#t$$r|jwxYw)aCalled when the other end of the low-level stream is half-closed. If this returns a false value (including None), the transport will close itself. If it returns a true value, closing the transport is up to the protocol. Tz%r received EOFN)rr0 get_debugrdebugrr r _on_handshake_completeConnectionResetErrorr rrrQr _do_writerr ExceptionrrJrDs r eof_receivedzSSLProtocol.eof_receivedsg" z##%% 6 .555{.;;;++,@AAAAA 0 888 0 9:::+%4NN$$$$$ 0 999    0 9:::!!##### 0 999!!#####:9    O ! ! # # #  s%AE(;E%E;AE)E%E+cv||jvr |j|S|j|j||S|Sr>)rrr<r9s rr8zSSLProtocol._get_extra_infosA 4;  ;t$ $ _ (?11$@@ @Nrcd}|tjkrd}n|jtjkr|tjkrd}nw|jtjkr|tjkrd}nO|jtjkr|tjkrd}n'|jtjkr|tjkrd}|r ||_dStd|j|)NFTz!cannot switch state from {} to {}) r r rr r rrrformat)r3 new_statealloweds rrzSSLProtocol._set_states (2 2 2GG K+5 5 5 )6 6 6GG K+8 8 8 )1 1 1GG K+3 3 3 )2 2 2GG K+4 4 4 )2 2 2G  -#DKKK3::K,,-- -rcfjr4tjdj_nd_tjj j fd_ dS)Nz%r starts SSL handshakec,Sr>)_check_handshake_timeoutrDsrz.SSLProtocol._start_handshake..!s$*G*G*I*Ir) r0rrrtime_handshake_start_timerr r call_laterrrrrDs`rrzSSLProtocol._start_handshakes :   ! ! . L2D 9 9 9)-):):D & &)-D & (5666 J ! !$"="I"I"I"I K K & rc|jtjkr/d|jd}|t |dSdS)Nz$SSL handshake is taking longer than z! seconds: aborting the connection)rr r r _fatal_errorConnectionAbortedError)r3msgs rrz$SSLProtocol._check_handshake_timeout%s_ ;*7 7 7+.+++    4S99 : : : : : 8 7rc |j|ddS#t$r|YdSt j$r }||Yd}~dSd}~wwxYwr>)r do_handshakerSSLAgainErrors_process_outgoingrSSLErrorrs rrzSSLProtocol._do_handshake.s . L % % ' ' '  ' ' - - - - -  % % %  " " $ $ $ $ $ $| - - -  ' ' , , , , , , , , , -s2BB!A<<Bc|j |jd|_|j} | |tjn||}n#t$rv}d}|tjt|tj rd}nd}| ||| |Yd}~dSd}~wwxYw|jr:|j|jz }t%jd||dz|j|||||jt2jkr=t2j|_|j|| |dS)Nz1SSL handshake failed on verifying the certificatezSSL handshake failedz%r: SSL handshake took %.1f msg@@)peercertcipher compression ssl_object) rrrrr r getpeercertrr rurCertificateErrorrrr0rrrrrrupdaterrrrrrrCrrr)r3 handshake_excsslobjrrrdts rrz"SSLProtocol._on_handshake_complete8s  ) 5  * 1 1 3 3 3-1D * $ 0 89999##))++HH    M OO,6 7 7 7#s344 -I,   c3 ' ' '    $ $ $ FFFFF  :   ! ! K""T%??B L94c J J J H"(--//'-'9'9';';&,  . . . ?.9 9 9.=DO   . .t/F/F/H/H I I I  s8A)) C)3A+C$$C)cjtjtjtjfvrdSj dj_jtjkrddS tjj j fd_ dS)NTc,Sr>)_check_shutdown_timeoutrDsrrz-SSLProtocol._start_shutdown..rs4466r)rr rrr rr2r rrr0rrrrrDs`rrIzSSLProtocol._start_shutdownas K ) ) *   F   **.D  ' ;*7 7 7 KK      OO,5 6 6 6,0J,A,A*6666--D ) NN     rc|jtjtjfvr.|jt jddSdS)NzSSL shutdown timed out)rr rrrrr TimeoutErrorrDs rrz#SSLProtocol._check_shutdown_timeoutvsf K ) )   O ( ('(@AA C C C C C   rc||tj|dSr>)rrr rrrDs rrzSSLProtocol._do_flushs=  (1222 rcf |js|j|||ddS#t $r|YdStj$r }||Yd}~dSd}~wwxYwr>) rrunwrapr_call_eof_received_on_shutdown_completerrrrs rrzSSLProtocol._do_shutdowns -% & ##%%%  " " $ $ $  # # % % %  & &t , , , , , % % %  " " $ $ $ $ $ $| , , ,  & &s + + + + + + + + + ,s A!!B0B0B++B0c|j |jd|_|r||dS|j|jjdSr>)rrrr0rrrJ)r3 shutdown_excs rrz!SSLProtocol._on_shutdown_completesk  ( 4  ) 0 0 2 2 2,0D )  8   l + + + + + J !6 7 7 7 7 7rc|tj|j|j|dSdSr>)rr r rrrs rrzSSLProtocol._abortsD (2333 ? & O ( ( - - - - - ' &rc|jtjtjtjfvr;|jt jkrtj d|xjdz c_dS|D]9}|j ||xj t|z c_ : |jtjkr|dSdS#t $r!}||dYd}~dSd}~wwxYw)NzSSL connection is closedrFatal error on SSL protocol)rr rrr rr!LOG_THRESHOLD_FOR_CONNLOST_WRITESrwarningrrrrr rrr)r3rr}exs rr{zSSLProtocol._write_appdatas& K ) ) *   )"MMM9::: OOq OO F  1 1D   & &t , , ,  # #s4yy 0 # # # A{.666     76 A A A   b"? @ @ @ @ @ @ @ @ @ As#)C C;C66C;c\ |jr~|jd}|j|}t|}||kr#||d|jd<|xj|zc_n|jd=|xj|zc_|j~n#t $rYnwxYw|dSr)rrr~rrrr)r3r}countdata_lens rrzSSLProtocol._do_writes % 8*1- **400t998##-1%&&\D'*++u4++++A.++x7++% 8    D       sBB BBc|jsB|j}t|r|j||dSr>)rrrrrr~r[r|s rrzSSLProtocol._process_outgoings\' ,>&&((D4yy ,%%d+++ !!#####rc|jtjtjfvrdS |js`|jr|n||jr| n| | dS#t$r!}| |dYd}~dSd}~wwxYw)Nr)rr r rrQr_do_read__buffered_do_read__copiedrrrrhrr)r3r!s rrzSSLProtocol._do_reads K ( )    F A+ -/,++----))+++&-NN$$$$**,,,  % % ' ' ' ' ' A A A   b"? @ @ @ @ @ @ @ @ @ AsA;B C *CC c,d}d}}t|} j||}|dkr^|}||kr9j||z ||d}|dkr||z }nn#||k9jfdn#t$rYnwxYw|dkr||s*  dSdS)Nrrc,Sr>)rrDsrrz0SSLProtocol._do_read__buffered..sr) rrorrrr0rrrrrI)r3offsetr#bufwantss` rr'zSSLProtocol._do_read__bufferedsK++D,F,F,H,HIIC L%%eS11Eqyyunn L--efnc&''lKKEqyy% unnJ(()@)@)@)@AAA    D  A::  - -f 5 5 5 #  # # % % %  " " " " " # #sA?B== C  C cd}d}d} |j|j}|sn(|rd}d}|}n|rd}||g}n||Jn#t$rYnwxYw|r|j|n/|s-|jd||s*|| dSdS)N1TFr) rrrrrrC data_receivedjoinrrI)r3chunkzeroonefirstr}s rr(zSSLProtocol._do_read__copieds3  ' ))$-88' DC!EE'C!5>DDKK&&& '    D   =   , ,U 3 3 3 3 =   , ,SXXd^^ < < < #  # # % % %  " " " " " # #sA A A! A!c8 |jtjkrBtj|_|j}|rt jddSdSdS#ttf$rt$r!}| |dYd}~dSd}~wwxYw)Nz?returning true from eof_received() has no effect when using sslzError calling eof_received()) rrrrrCrrr KeyboardInterrupt SystemExit BaseExceptionr)r3 keep_openr!s rrzSSLProtocol._call_eof_received%s B"2"AAA"2"< .;;== CN$BCCCCC BACC":.     B B B   b"@ A A A A A A A A A BsAAB8BBc:|}||jkrw|jspd|_ |jdS#t t f$rt$r/}|j d||j |dYd}~dSd}~wwxYw||j krw|jrrd|_ |j dS#t t f$rt$r/}|j d||j |dYd}~dSd}~wwxYwdSdS)NTzprotocol.pause_writing() failedmessage exceptionrr@Fz protocol.resume_writing() failed) rdr`rrrC pause_writingr7r8r9r0call_exception_handlerrr_resume_writing)r3sizers rr[z SSLProtocol._control_app_writing4s**,, 4, , ,T5M ,'+D $ "0022222%z2        11@!$!%!4 $ 33 T- - -$2J -',D $ "1133333%z2        11A!$!%!4 $ 33  . - - -s/A B%$BB1C D'$DDc*|jj|jzSr>)rpendingrrDs rrdz"SSLProtocol._get_write_buffer_sizeQs~%(???rc^t||tj\}}||_||_dSr>)r,r!FLOW_CONTROL_HIGH_WATER_SSL_WRITEr`r_r\s rrZz$SSLProtocol._set_write_buffer_limitsTs7, #yBDD c$(!#&   rcd|_dSr)rQrDs rrTzSSLProtocol._pause_reading\s#'   rcfjr(d_fd}j|dSdS)NFc jtjkrdSjtjkrdSjtjkrdSdSr>)rr r rrrrrrDsrresumez+SSLProtocol._resume_reading..resumecs};"2":::MMOOOOO[$4$===NN$$$$$[$4$===%%'''''>=r)rQr0r)r3rJs` rrWzSSLProtocol._resume_reading_sW  # )',D $ ( ( ( ( ( J  ( ( ( ( ( ) )rc|}||jkr)|js"d|_|jdS||jkr)|jr$d|_|jdSdSdS)NTF)rorlrrrUrkrX)r3rBs rrhz SSLProtocol._control_ssl_readingns))++ 4, , ,T5M ,'+D $ O ) ) + + + + + T- - -$2J -',D $ O * * , , , , ,. - - -rc^t||tj\}}||_||_dSr>)r,r FLOW_CONTROL_HIGH_WATER_SSL_READrlrkr\s rrgz#SSLProtocol._set_read_buffer_limitsws7, #yACC c$(!#&   rc|jjSr>)rrDrDs rroz!SSLProtocol._get_read_buffer_size}s ~%%rcd|_dS)z\Called when the low-level transport's buffer goes over the high-water mark. TN)rrDs rr?zSSLProtocol.pause_writings $(   rc<d|_|dS)z^Called when the low-level transport's buffer drains below the low-water mark. FN)rrrDs rrAzSSLProtocol.resume_writings$ $)       rFatal error on transportc\|jr|j|t|tr5|jrt jd||ddSdSt|tj s&|j |||j|ddSdS)Nz%r: %sT)exc_infor<) rrruOSErrorr0rrrrCancelledErrorr@)r3rr=s rrzSSLProtocol._fatal_errors ? . O ( ( - - - c7 # # z##%% E XtWtDDDDDD E EC!:;;  J - -" !_ //       r)FNTNNr>r)rQ).rrrrrrrr6r?rrrrrrrr8rrrrrrIrrrrrr{rrrr'r(rr[rdrZrTrWrhrgror?rArrrrrrsH  $#59&*'+&* Q"Q"Q"Q"f 1 1 1###   "2"2"2H%%%    !!!F$-$-$-P ;;;...%%%R*CCC - - -888...AAA0!!! $$$AAA,###:###< B B B:@@@''''((( ) ) )---'''' &&& (((!!!      rr)renumrr ImportErrorrrrrlogrSSLWantReadErrorSSLSyscallErrorrEnumr rr$r,_FlowControlMixin Transportr.rrrrrr_s  JJJJ CCC?*C,?@Nty & & & & &ty & & &   *r;r;r;r;r;J8&0r;r;r;jW W W W W ),W W W W W s __pycache__/exceptions.cpython-311.opt-1.pyc000064400000007117152533123130014602 0ustar00 !A?hdZdZGddeZeZGddeZGddeZGdd e Z Gd d eZ Gd d eZ dS)zasyncio exceptions.)BrokenBarrierErrorCancelledErrorInvalidStateError TimeoutErrorIncompleteReadErrorLimitOverrunErrorSendfileNotAvailableErrorceZdZdZdS)rz!The Future or Task was cancelled.N__name__ __module__ __qualname____doc__?/opt/alt/python-internal/lib64/python3.11/asyncio/exceptions.pyrr s++++rrceZdZdZdS)rz+The operation is not allowed in this state.Nr rrrrrs5555rrceZdZdZdS)rz~Sendfile syscall is not available. Raised if OS does not support sendfile syscall for given socket or file type. Nr rrrrrsrrc(eZdZdZfdZdZxZS)rz Incomplete read error. Attributes: - partial: read bytes string before the end of stream was reached - expected: total number of expected bytes (or None if unknown) c|dnt|}tt|d|d||_||_dS)N undefinedz bytes read on a total of z expected bytes)reprsuper__init__lenpartialexpected)selfrr r_expected __class__s rrzIncompleteReadError.__init__$si$,$4[[$x..  CLL88&888 9 9 9   rc<t||j|jffSN)typerrrs r __reduce__zIncompleteReadError.__reduce__+sDzzDL$-888rr r r rrr$ __classcell__rs@rrrsQ !!!!!9999999rrc(eZdZdZfdZdZxZS)rzReached the buffer limit while looking for a separator. Attributes: - consumed: total number of to be consumed bytes. cXt|||_dSr!)rrconsumed)rmessager*rs rrzLimitOverrunError.__init__5s& !!!  rcHt||jd|jffS)N)r"argsr*r#s rr$zLimitOverrunError.__reduce__9s DzzDIaL$-888rr%r's@rrr/sQ !!!!!9999999rrceZdZdZdS)rz*Barrier is broken by barrier.abort() call.Nr rrrrr=s4444rrN) r__all__ BaseExceptionrr Exceptionr RuntimeErrorrEOFErrorrrrrrrr5s ( ,,,,,],,, 66666 666 99999(999$ 9 9 9 9 9 9 9 95555555555r__pycache__/runners.cpython-311.opt-1.pyc000064400000024015152533123130014111 0ustar00 !A?hdZddlZddlZddlZddlZddlZddlZddlmZddlm Z ddlm Z ddlm Z Gdd ej Z Gd d Zdd d ZdZdS))RunnerrunN) coroutines)events) exceptions)tasksceZdZdZdZdZdS)_Statecreated initializedclosedN)__name__ __module__ __qualname__CREATED INITIALIZEDCLOSEDn  )  !$rc.||SN) _lazy_initr#s r __enter__zRunner.__enter__:s  rc.|dSr&)close)r#exc_typeexc_valexc_tbs r__exit__zRunner.__exit__>s rc |jtjurdS |j}t ||||||jrtj d| d|_tj |_dS#|jrtj d| d|_tj |_wxYw)zShutdown and close event loop.N) rr rr_cancel_all_tasksrun_until_completeshutdown_asyncgensshutdown_default_executorr"rset_event_loopr+r)r#loops rr+z Runner.closeAs ;f0 0 0 F (:D d # # #  # #D$;$;$=$= > > >  # #D$B$B$D$D E E E# ,%d+++ JJLLLDJ -DKKK # ,%d+++ JJLLLDJ -DK ' ' ' 's A$CA D c8||jS)zReturn embedded event loop.)r'rr(s rget_loopzRunner.get_loopQs zrcontextctj|s"td|t jt d|||j}|j ||}tj tj urxtjtjtjurNt%j|j|} tjtj|n#t$rd}YnwxYwd}d|_ |j ||Jtjtj|ur+tjtjtjSSS#t.j$r<|jdkr/t3|dd}||dkrt5wxYw#|Jtjtj|ur+tjtjtjwwwxYw)z/Run a coroutine inside the embedded event loop.z"a coroutine was expected, got {!r}Nz7Runner.run() cannot be called from a running event loopr9) main_taskruncancel)r iscoroutine ValueErrorformatr_get_running_loop RuntimeErrorr'r r create_task threadingcurrent_thread main_threadsignal getsignalSIGINTdefault_int_handler functoolspartial _on_sigintr!r2rCancelledErrorgetattrKeyboardInterrupt)r#coror:tasksigint_handlerr=s rrz Runner.runVs5%d++ PAHHNNOO O  # % % 1IKK K  ?mGz%%dG%<<  $ & &)*?*A*A A A //63MMM&.t$OOON & fm^<<<< & & &"&  & "N ! I:0066*$V]33~EE fmV-GHHHH+E(   $q(("4T::'HHJJ!OO+---   *$V]33~EE fmV-GHHHH+Es,>D D-,D-:F!!A G,,G//AH>c|jtjurtd|jtjurdS|j@t j|_|j s t j |jd|_ n||_|j |j |j tj|_tj|_dS)NzRunner is closedT)rr rrBrrrnew_event_looprr"r5r set_debug contextvars copy_contextr r(s rr'zRunner._lazy_inits ;&- ' '122 2 ;&, , , F   %.00DJ' ,%dj111'+$++--DJ ; " J  - - -#022 ( rc|xjdz c_|jdkrE|s1||jddSt )NrcdSr&rrrrz#Runner._on_sigint..sDr)r!donecancelrcall_soon_threadsaferP)r#signumframer<s rrMzRunner._on_sigintsn "  A % %inn.>.> %       J + +LL 9 9 9 F!!!r) rrr__doc__r$r)r/r+r8rr'rMrrrrrs6!%4%%%%%(((  $(+I+I+I+I+IZ)))&"""""rrrctjtdt|5}||cdddS#1swxYwYdS)aExecute the coroutine and return the result. This function runs the passed coroutine, taking care of managing the asyncio event loop and finalizing asynchronous generators. This function cannot be called when another asyncio event loop is running in the same thread. If debug is True, the event loop will be run in debug mode. This function always creates a new event loop and closes it at the end. It should be used as a main entry point for asyncio programs, and should ideally only be called once. Example: async def main(): await asyncio.sleep(1) print('hello') asyncio.run(main()) Nz8asyncio.run() cannot be called from a running event looprb)rrArBrr)mainrrunners rrrs0!!- FHH H e    zz$                  sAAAcbtj|}|sdS|D]}||tj|ddi|D]V}|r|+|d||dWdS)Nreturn_exceptionsTz1unhandled exception during asyncio.run() shutdown)message exceptionrR)r all_tasksr]r2gather cancelledricall_exception_handler)r6 to_cancelrRs rr1r1s%%I  EL)LtLLMMM >>     >>   '  ' 'N!^^--))    r)__all__rWenumrKrDrGsysrrrr Enumr rrr1rrrrts&   TY H"H"H"H"H"H"H"H"V     Br__pycache__/windows_events.cpython-311.pyc000064400000133703152533123130014541 0ustar00 !A?hdZddlZejdkr edddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl Z ddl mZddl mZddl mZdd l mZdd l mZdd l mZdd l mZdd l mZddlmZdZejZejZdZdZdZdZGddejZ GddejZ!Gdde!Z"Gdde!Z#Gdde$Z%Gddej&Z'Gd d!ej(Z)Gd"d#Z*Gd$d%ej+Z,e'Z-Gd&d'ej.Z/Gd(d)ej.Z0e0Z1dS)*z.Selector and proactor event loops for Windows.Nwin32z win32 only)events)base_subprocess)futures) exceptions)proactor_events)selector_events)tasks) windows_utils)logger)SelectorEventLoopProactorEventLoop IocpProactorDefaultEventLoopPolicyWindowsSelectorEventLoopPolicyWindowsProactorEventLoopPolicyiigMbP?g?cXeZdZdZddfd ZfdZdZd fd ZfdZfd Z xZ S) _OverlappedFuturezSubclass of Future which represents an overlapped operation. Cancelling it will immediately cancel the overlapped operation. Nloopcxt||jr|jd=||_dSNr)super__init___source_traceback_ov)selfovr __class__s C/opt/alt/python-internal/lib64/python3.11/asyncio/windows_events.pyrz_OverlappedFuture.__init__6s? d###  ! +&r*ct}|j8|jjrdnd}|dd|d|jjdd|S)Npending completedrz overlapped=)r _repr_inforr%insertaddressrinfostater!s r"r)z_OverlappedFuture._repr_info<shww!!## 8 !%!1BII{E KKI%II483CIIII J J J r#c|jdS |jnH#t$r;}d||d}|jr |j|d<|j|Yd}~nd}~wwxYwd|_dS)Nz&Cancelling an overlapped future failedmessage exceptionfuturesource_traceback)rcancelOSErrorr_loopcall_exception_handler)rexccontexts r"_cancel_overlappedz$_OverlappedFuture._cancel_overlappedCs 8  F 7 HOO     7 7 7C G % E.2.D*+ J - -g 6 6 6 6 6 6 6 6 7s% A*1A%%A*cp|t|SN)msg)r;rr5rr>r!s r"r5z_OverlappedFuture.cancelSs- !!!ww~~#~&&&r#crt||dSN)r set_exceptionr;rr2r!s r"rBz_OverlappedFuture.set_exceptionWs3 i((( !!!!!r#cXt|d|_dSrA)r set_resultrrresultr!s r"rEz_OverlappedFuture.set_result[s& 6"""r#rA) __name__ __module__ __qualname____doc__rr)r;r5rBrE __classcell__r!s@r"rr0s $(  ''''''"""""r#rcdeZdZdZddfd ZdZfdZdZdZd fd Z fd Z fd Z xZ S) _BaseWaitHandleFuturez2Subclass of Future which represents a wait handle.Nrct||jr|jd=||_||_||_d|_dS)NrrT)rrrr_handle _wait_handle _registered)rr handle wait_handlerr!s r"rz_BaseWaitHandleFuture.__init__cs\ d###  ! +&r* ' r#cRtj|jdtjkSNr)_winapiWaitForSingleObjectrQ WAIT_OBJECT_0rs r"_pollz_BaseWaitHandleFuture._pollqs$+DL!<<%& 'r#c6t}|d|jd|j-|rdnd}|||j|d|jd|S)Nzhandle=r'signaledwaitingz wait_handle=)rr)appendrQr\rRr,s r"r)z _BaseWaitHandleFuture._repr_infovsww!!## /dl///000 < #"&**,,=JJIE KK      ( KK=t'8=== > > > r#cd|_dSrA)r)rfuts r"_unregister_wait_cbz)_BaseWaitHandleFuture._unregister_wait_cbsr#c^|jsdSd|_|j}d|_ tj|nc#t$rV}|jtjkr7d||d}|jr |j|d<|j |Yd}~dSYd}~nd}~wwxYw| ddSNFz$Failed to unregister the wait handler0r4) rSrR _overlappedUnregisterWaitr6winerrorERROR_IO_PENDINGrr7r8rcrrUr9r:s r"_unregister_waitz&_BaseWaitHandleFuture._unregister_waits  F '     &{ 3 3 3 3   |{;;;E!$" )I262HG./ 11':::<;;;;    &&&&&s5 BABBcp|t|Sr=)rkrr5r?s r"r5z_BaseWaitHandleFuture.cancels- ww~~#~&&&r#cr|t|dSrA)rkrrBrCs r"rBz#_BaseWaitHandleFuture.set_exceptions3  i(((((r#cr|t|dSrA)rkrrErFs r"rEz _BaseWaitHandleFuture.set_results3  6"""""r#rA) rHrIrJrKrr\r)rcrkr5rBrErLrMs@r"rOrO`s<<8<        '''  '''0'''''')))))#########r#rOcBeZdZdZddfd ZdZfdZfdZxZS)_WaitCancelFuturezoSubclass of Future which represents a wait for the cancellation of a _WaitHandleFuture using an event. Nrc`t||||d|_dS)Nr)rr_done_callback)rr eventrUrr!s r"rz_WaitCancelFuture.__init__s2 UKd;;;"r#c td)Nz'_WaitCancelFuture must not be cancelled) RuntimeErrorr[s r"r5z_WaitCancelFuture.cancelsDEEEr#ct||j||dSdSrA)rrErrrFs r"rEz_WaitCancelFuture.set_resultsF 6"""   *    % % % % % + *r#ct||j||dSdSrA)rrBrrrCs r"rBz_WaitCancelFuture.set_exceptionsF i(((   *    % % % % % + *r#) rHrIrJrKrr5rErBrLrMs@r"rprps8<####### FFF&&&&& &&&&&&&&&r#rpc4eZdZddfd ZfdZdZxZS)_WaitHandleFutureNrct||||||_d|_t jdddd|_d|_dS)NrTF)rr _proactor_unregister_proactorrf CreateEvent_event _event_fut)rr rTrUproactorrr!s r"rz_WaitHandleFuture.__init__sV V[t<<<!$(!!-dD%FF r#c|j'tj|jd|_d|_|j|jd|_t|dSrA) r~rX CloseHandlerr{ _unregisterrrrc)rrbr!s r"rcz%_WaitHandleFuture._unregister_wait_cbsk ; "   , , ,DK"DO ""48,,, ##C(((((r#c|jsdSd|_|j}d|_ tj||jnc#t $rV}|jtjkr7d||d}|jr |j|d<|j |Yd}~dSYd}~nd}~wwxYw|j |j|j |_dSre)rSrRrfUnregisterWaitExr~r6rhrirr7r8r{ _wait_cancelrcrrjs r"rkz"_WaitHandleFuture._unregister_waits  F '     (dk B B B B   |{;;;E!$" )I262HG./ 11':::<;;;; .55dk6:6NPPs; BABB)rHrIrJrrcrkrLrMs@r"ryrystBF)))))$PPPPPPPr#ryc4eZdZdZdZdZdZdZdZeZ dS) PipeServerzXClass representing a pipe server. This is much like a bound, listening socket. c||_tj|_d|_d|_|d|_dSNT)_addressweakrefWeakSet_free_instances_pipe_accept_pipe_future_server_pipe_handle)rr+s r"rzPipeServer.__init__sC &00 #' --d33 r#cJ|j|dc}|_|S)NF)rr)rtmps r"_get_unconnected_pipez PipeServer._get_unconnected_pipes& *d&>&>u&E&ETZ r#c |rdStjtjz}|r|tjz}tj|j|tjtjztj ztj tj tj tj tj}tj|}|j||SrA)closedrXPIPE_ACCESS_DUPLEXFILE_FLAG_OVERLAPPEDFILE_FLAG_FIRST_PIPE_INSTANCECreateNamedPiperPIPE_TYPE_MESSAGEPIPE_READMODE_MESSAGE PIPE_WAITPIPE_UNLIMITED_INSTANCESr BUFSIZENMPWAIT_WAIT_FOREVERNULL PipeHandleradd)rfirstflagshpipes r"rzPipeServer._server_pipe_handle s ;;== 4*W-II  ; W: :E  # M5  %(E E     ,  !=#8  (',  8 8'**   &&& r#c|jduSrA)rr[s r"rzPipeServer.closeds %&r#c|j |jd|_|jG|jD]}|d|_d|_|jdSdSrA)rr5rrcloserclear)rrs r"rzPipeServer.close"s  # /  $ + + - - -'+D $ = $,   DJ DM  & & ( ( ( ( ( % $r#N) rHrIrJrKrrrrr__del__r#r"rrsj444$''' ) ) )GGGr#rceZdZdZdS)_WindowsSelectorEventLoopz'Windows version of selector event loop.N)rHrIrJrKrr#r"rr1s1111r#rcDeZdZdZdfd ZfdZdZdZ ddZxZ S) rz2Windows version of proactor event loop using IOCP.Ncj|t}t|dSrA)rrr)rrr!s r"rzProactorEventLoop.__init__8s0  #~~H """""r#c |jJ||jt|jQ|jj}|j|!|js|j |d|_dSdS#|jO|jj}|j|!|js|j |d|_wxYwrA) _self_reading_future call_soon_loop_self_readingr run_foreverrr5r%r{r)rr r!s r"rzProactorEventLoop.run_forever=s 1,444 NN42 3 3 3 GG   ! ! !(4.2)00222>"*>N..r222,0)))54t(4.2)00222>"*>N..r222,0)0000s AB AC8cK|j|}|d{V}|}|||d|i}||fS)Naddrextra)r{ connect_pipe_make_duplex_pipe_transport)rprotocol_factoryr+frprotocoltranss r"create_pipe_connectionz(ProactorEventLoop.create_pipe_connectionPsl N ' ' 0 0wwwwww##%%00x8>7H1JJhr#crKtdfd gS)Ncd} |r||}j|r|dS}||di}|dSj|}|_ | dS#t$rG|r,| dkr| YdSt$r}|rF| dkr.d||d|njrt#jd|d Yd}~dSd}~wt&j$r|r|YdSYdSwxYw) NrrrzPipe accept failed)r1r2rzAccept pipe failed on pipe %rT)exc_info)rGrdiscardrrrrr{ accept_piperadd_done_callbackBrokenPipeErrorfilenorr6r8_debugr warningrCancelledError) rrrr9r+loop_accept_piperrservers r"rz>ProactorEventLoop.start_serving_pipe..loop_accept_pipe[sJD) 6 A88::D*224888}} //11H44hvw.?5AAA3355<FN..t44*./*##$455555+# 1 1 1!DKKMMR//JJLLL/000000 1 1 1 8DKKMMR////#7%( $11 JJLLLL[8N#B#'$8888/000000000, ! ! !!JJLLLLLL!!! !s2AC:CCA G# G,A;F--(GGrA)rr)rrr+rrs```@@r"start_serving_pipez$ProactorEventLoop.start_serving_pipeXsgG$$+ 6+ 6+ 6+ 6+ 6+ 6+ 6+ 6+ 6+ 6Z '(((xr#c K|} t||||||||f| |d| } | d{VnN#ttf$rt$r0| | d{VwxYw| S)N)waiterr) create_future_WindowsSubprocessTransport SystemExitKeyboardInterrupt BaseExceptionr_wait) rrargsshellstdinstdoutstderrbufsizerkwargsrtransps r"_make_subprocess_transportz,ProactorEventLoop._make_subprocess_transports##%%,T8T5-2FFG74:%770677 LLLLLLLL-.        LLNNN,,..    s 8A BrA) rHrIrJrKrrrrrrLrMs@r"rr5s<<###### 11111&111j04r#rceZdZdZefdZdZdZdZd dZ dZ d!d Z d!d Z d!d Z d!d Zd"dZd!dZdZdZdZdZdZd dZdZdZdZdZdZdZd dZdZdZdZ dS)#rz#Proactor implementation using IOCP.cd|_g|_tjtjt d||_i|_tj |_ g|_ tj |_ dSrW) r7_resultsrfCreateIoCompletionPortINVALID_HANDLE_VALUEr_iocp_cacherrrS _unregistered_stopped_serving)r concurrencys r"rzIocpProactor.__init__sg   7  ,dA{DD  "?,, ' 1 1r#c2|jtddS)NzIocpProactor is closed)rrur[s r" _check_closedzIocpProactor._check_closeds! : 788 8  r#cdt|jzdt|jzg}|j|dd|jjdd|dS)Nzoverlapped#=%sz result#=%sr< r()lenrrrr`r!rHjoin)rr-s r"__repr__zIocpProactor.__repr__sl 3t{#3#33s4=1113 :  KK ! ! ! N333SXXd^^^^DDr#c||_dSrA)r7)rrs r"set_loopzIocpProactor.set_loops  r#Ncn|js|||j}g|_ |d}S#d}wxYwrA)rr\)rtimeoutrs r"selectzIocpProactor.selectsJ} JJw   m  CC$CJJJJs04cb|j}|||SrA)r7rrE)rvaluerbs r"_resultzIocpProactor._results,j&&(( u r#rc||tjt} t |t jr*||||n(|||n%#t$r| dcYSwxYwd}| |||S)Nr#c |S#t$r3}|jtjtjfvrt |jd}~wwxYwrA getresultr6rhrfERROR_NETNAME_DELETEDERROR_OPERATION_ABORTEDConnectionResetErrorrrkeyr r9s r" finish_recvz&IocpProactor.recv..finish_recvf ||~~%   B?c||tjt} t |t jr*||||n(|||n%#t$r| dcYSwxYwd}| |||S)Nrc |S#t$r3}|jtjtjfvrt |jd}~wwxYwrArrs r"rz+IocpProactor.recv_into..finish_recvrr) rrfrrr r  WSARecvIntor ReadFileIntorrr rrbufrr rs r" recv_intozIocpProactor.recv_intos   &&&  #D ) ) #$ .. 4t{{}}c59999 s333 # # #<<?? " " " #   ~~b$ 444rc2||tjt} ||||n%#t $r|dcYSwxYwd}||||S)Nr#Nc |S#t$rN}|jtjkrYd}~dS|jtjtjfvrt|jd}~wwxYw)Nr rr6rhrfERROR_PORT_UNREACHABLErrrrrs r"rz*IocpProactor.recvfrom..finish_recvs ||~~%   <;#EEE$99999.finish_recvs ||~~%   <;#EEE"77777.finish_send.rr)rrfrr WSASendTorr )rrrrrr r*s r"sendtozIocpProactor.sendto(sm   &&&  #D ) ) T[[]]C555   ~~b$ 444r#cj||tjt}t |t jr*||||n(|||d}| |||S)Nc |S#t$r3}|jtjtjfvrt |jd}~wwxYwrArrs r"r*z&IocpProactor.send..finish_sendBrr) rrfrrr r WSASendr WriteFiler )rrrrr r*s r"sendzIocpProactor.send:s   &&&  #D ) ) dFM * * - JJt{{}}c5 1 1 1 1 LL , , ,   ~~b$ 444r#c||jtjt }|fd}d}|||}||}tj ||j |S)NcJ|tjd}t jtj|   fS)Nz@P) rstructpackr setsockoptr  SOL_SOCKETrfSO_UPDATE_ACCEPT_CONTEXT settimeout gettimeout getpeername)rrr rrlisteners r" finish_acceptz*IocpProactor.accept..finish_acceptTs LLNNN+dHOO$5$566C OOF-'@# G G G OOH//11 2 2 2))+++ +r#clK |d{VdS#tj$r|wxYwrA)rrr)r3rs r" accept_coroz(IocpProactor.accept..accept_coro]sN  ,     s%3r) r_get_accept_socketfamilyrfrrAcceptExrr r ensure_futurer7)rr<r r=r?r3corors ` @r"acceptzIocpProactor.acceptNs   ***&&x77  #D ) ) HOO%%t{{}}555 , , , , , ,   Hm<<{64(( Dtz2222 r#cjtjkrWtj||j}|d|S|  tj j nL#t$r?}|j tjkrddkrYd}~nd}~wwxYwtjt$}||fd}|||S)Nrrc|tjtjdSrW)rr6r r7rfSO_UPDATE_CONNECT_CONTEXT)rrr rs r"finish_connectz,IocpProactor.connect..finish_connects; LLNNN OOF-'A1 F F FKr#)typer  SOCK_DGRAMrf WSAConnectrr7rrEr BindLocalrAr6rherrno WSAEINVAL getsocknamerr ConnectExr )rrr+rber rIs ` r"connectzIocpProactor.connectjsS 9) ) )  "4;;==' : : :***,,C NN4 J   &&&   !$++-- = = = =   zU_,,!!!$))*))))    #D ) ) T[[]]G,,,     ~~b$777s,B11 C:;5C55C:c N||tjt}|dz}|dz dz}||t j||||ddd}||||S)Nl rc |S#t$r3}|jtjtjfvrt |jd}~wwxYwrArrs r"finish_sendfilez.IocpProactor.sendfile..finish_sendfilerr) rrfrr TransmitFilermsvcrt get_osfhandler ) rsockfileoffsetcountr offset_low offset_highrWs r"sendfilezIocpProactor.sendfiles   &&&  #D ) )k) |{2   ,T[[]];;"Kq! % % %    ~~b$888r#c|tjt}|}|r|Sfd}|||S)Nc0|SrA)r)rrr rs r"finish_accept_pipez4IocpProactor.accept_pipe..finish_accept_pipes LLNNNKr#)rrfrrConnectNamedPiperrr )rrr connectedrds ` r"rzIocpProactor.accept_pipes   &&&  #D ) )'' 66  &<<%% %     ~~b$(:;;;r#c*Kt} tj|}n`#t$r }|jtjkrYd}~nd}~wwxYwt |dzt}tj |d{Vvtj |S)NT) CONNECT_PIPE_INIT_DELAYrf ConnectPiper6rhERROR_PIPE_BUSYminCONNECT_PIPE_MAX_DELAYr sleepr r)rr+delayrTr9s r"rzIocpProactor.connect_pipes' % $099   <;#>>>?>>>>   #9::E+e$$ $ $ $ $ $ $ $ %'///s! A AA c0|||dS)zWait for a handle. Return a Future object. The result of the future is True if the wait completed, or False if the wait did not complete (on timeout). F)_wait_for_handle)rrTrs r"wait_for_handlezIocpProactor.wait_for_handles $$VWe<<.finish_wait_for_handles7799 r#r)rrXINFINITEmathceilrfrrRegisterWaitWithQueuerr+rpr7ryrr) rrTr _is_cancelmsr rUrxrs @r"rqzIocpProactor._wait_for_handles  ?!BB7S=))B #D ) )!7 DJ B00  3!"fk KKKAA!"fk4'+z333A  (#B'     $%b!-C"D BJr#c||jvrJ|j|tj||jdddSdSrW)rSrrfrrrrobjs r"rz IocpProactor._register_with_iocpsX d& & &    % % %  .szz||TZA N N N N N ' &r#cL|t||j}|jr|jd=|jsP |dd|}||n,#t $r}||Yd}~nd}~wwxYw||||f|j|j <|Sr) rrr7rr%rEr6rBrr+)rr rcallbackrrrRs r"r zIocpProactor._registers  btz 2 2 2  (#B'z $  $ tR00 U#### # # #"""""""" #$%b#x"8 BJs A%% B/B  Bcb||j|dS)a Unregister an overlapped object. Call this method when its future has been cancelled. The event can already be signalled (pending in the proactor event queue). It is also safe if the event is never signalled (because it was cancelled). N)rrr`)rr s r"rzIocpProactor._unregisters3  !!"%%%%%r#cXtj|}|d|SrW)r r9)rrAss r"r@zIocpProactor._get_accept_socket's% M& ! ! Qr#c $|t}nF|dkrtdtj|dz}|tkrtd t j|j|}|n]d}|\}}}} |j|\}} } } nq#t$rd|j r$|j dd||||fzd|dtj fvrtj|YwxYw| |jvr|n|s | ||| } || |j|nF#t,$r9} || |j|Yd} ~ nd} ~ wwxYwd}n#d}wxYw{|jD]"} |j| jd#|jdS) Nrznegative timeoutrvztimeout too bigTz8GetQueuedCompletionStatus() returned an unexpected eventz)err=%s transferred=%s key=%#x address=%#x)r1status)ry ValueErrorrzr{rfGetQueuedCompletionStatusrrpopKeyErrorr7 get_debugr8rrXrrr5donerErr`r6rBrr+r)rrr~rerr transferredrr+rr rrrrRs r"r\zIocpProactor._poll,sy ?BB q[[/00 07S=))BX~~ !2333&  :4:rJJF~B-3 *Cc7 '+{w'?'?$2sHH   :''))J55%7#N&);W%E$F77q+"BCCC',,, d+++ VVXX  $H[#r::E LL'''M((++++ ,,,OOA&&&M((++++++++,AAAHHHHM& R$ . .B KOOBJ - - - -   """""sC:BA+DD> E; 0G; F>/F94G9F>>GGc:|j|dSrA)rrrs r" _stop_servingzIocpProactor._stop_servinges! !!#&&&&&r#c|jdSt|jD]\}}}}|rt |t r2 |H#t$rB}|j 1d||d}|j r |j |d<|j |Yd}~d}~wwxYwd}tj }||z} |jrs| tj kr@tjd|tj |z tj |z} |||jsg|_t%j|jd|_dS)NzCancelling a future failedr0r4g?z,%r is running after closing for %.1f seconds)rlistrvalues cancelledr rpr5r6r7rr8time monotonicr debugr\rrXr) rrbr rrr9r: msg_update start_timenext_msgs r"rzIocpProactor.closeks :  F'+4;+=+=+?+?&@&@ C C "CS(}} CC!233 C CJJLLLL C C Cz-'C),&)## 0P:=:OG$67 99'BBB C ^%%  *k #4>++++ K!4>#3#3j#@BBB>++j8 JJz " " "k # DJ''' s#A88 C8B??Cc.|dSrA)rr[s r"rzIocpProactor.__del__s r#rA)rr$)!rHrIrJrKryrrrrrrrrr!r'r,r1rErSrarrrrrrqrr rr@r\rrrrr#r"rrs--#+2222999EEE     5555.5555.55550555505555$5555(8888>999*<<<"000&====   DOOO@&&& 7#7#7#7#r''' ---^r#rceZdZdZdS)rc tj|f|||||d|_fd}jjt jj} | |dS)N)rrrrrcdj}|dSrA)_procpoll_process_exited)r returncoders r"rz4_WindowsSubprocessTransport._start..callbacks.**J   , , , , ,r#) r Popenrr7r{rrintrQr) rrrrrrrrrrs ` r"_startz"_WindowsSubprocessTransport._starts"( 'U6&''%''  - - - - - J 0 0TZ5G1H1H I I H%%%%%r#N)rHrIrJrrr#r"rrs# & & & & &r#rceZdZeZdS)rN)rHrIrJr _loop_factoryrr#r"rr%MMMr#rceZdZeZdS)rN)rHrIrJrrrr#r"rrrr#r)2rKsysplatform ImportErrorrfrXrNrzrYr r4rrrrrrr r r r logr __all__rryERROR_CONNECTION_REFUSEDERROR_CONNECTION_ABORTEDrirmFuturerrOrpryobjectrBaseSelectorEventLooprBaseProactorEventLooprrBaseSubprocessTransportrrBaseDefaultEventLoopPolicyrrrrr#r"rsx44 <7 +l # ##  |   --------`G#G#G#G#G#GNG#G#G#T&&&&&-&&&01P1P1P1P1P-1P1P1Ph88888888v22222 E222ggggg=gggT||||||||~ & & & & &/"I & & &.&&&&&V%F&&&&&&&&V%F&&&8r#__pycache__/base_futures.cpython-311.opt-1.pyc000064400000006520152533123130015105 0ustar00 !A?hxdZddlZddlmZddlmZdZdZdZd Z d Z d Z ej d Z dS) N) get_ident)format_helpersPENDING CANCELLEDFINISHEDc>t|jdo|jduS)zCheck for a Future. This returns True when obj is a Future instance or is advertising itself as duck-type compatible by setting _asyncio_future_blocking. See comment in Future for more details. _asyncio_future_blockingN)hasattr __class__r )objs A/opt/alt/python-internal/lib64/python3.11/asyncio/base_futures.pyisfuturers) CM#= > > 5  ( 46ct|}|sd}d}|dkr||dd}n|dkrAd||dd||dd}nJ|dkrDd||dd|dz ||dd}d |d S) #helper function for Future.__repr__c,tj|dS)Nr)r_format_callback_source)callbacks r format_cbz$_format_callbacks..format_cbs5hCCCrrrz{}, {}z{}, <{} more>, {}zcb=[])lenformat)cbsizers r_format_callbacksr s r77D  DDD qyy Yr!uQx   __YYr!uQx00))BqE!H2E2E F F  ' ' "Q%((;(;(,q(1 "R&)(<(<>> "<<<rc|jg}|jtkrV|j|d|jn1t j|j}|d||jr'|t|j|j r4|j d}|d|dd|d|S) rNz exception=zresult=rz created at r:r) _statelower _FINISHED _exceptionappendreprlibrepr_result _callbacksr _source_traceback)futureinforesultframes r_future_repr_infor1-s M   ! ! "D } !!   ( KK:V%6:: ; ; ; ;\&.11F KK*&** + + + : %f&788999 9(, 7%(77U1X77888 Krcldt|}d|jjd|dS)N <>)joinr1r __name__)r-r.s r _future_reprr8As; 88%f-- . .D 2v( 2 24 2 2 22r)__all__r(_threadrrr_PENDING _CANCELLEDr%rr r1recursive_reprr8rrrr>s     666((33333r__pycache__/trsock.cpython-311.pyc000064400000012434152533123130012765 0ustar00 !A?h (ddlZGddZdS)NceZdZdZdZdejfdZedZedZ edZ dZ d Z d Z d Zd Zd ZdZdZdZdZdZdZdZdZdS)TransportSocketzA socket-like wrapper for exposing real transport sockets. These objects can be safely returned by APIs like `transport.get_extra_info('socket')`. All potentially disruptive operations (like "socket.close()") are banned. _socksockc||_dSNr)selfrs ;/opt/alt/python-internal/lib64/python3.11/asyncio/trsock.py__init__zTransportSocket.__init__s  c|jjSr )rfamilyr s r rzTransportSocket.familys z  r c|jjSr )rtypers r rzTransportSocket.types zr c|jjSr )rprotors r rzTransportSocket.protos zr cjd|d|jd|jd|j}|dkrh |}|r|d|}n#t j$rYnwxYw |}|r|d|}n#t j$rYnwxYw|dS) Nz)filenorrr getsocknamesocketerror getpeername)r sladdrraddrs r __repr__zTransportSocket.__repr__s "4;;== " "k " ",0I " "Z " " ;;==B   ((**.--e--A<     ((**.--e--A<    wwws$ A''A98A9=BB-,B-c td)Nz/Cannot serialize asyncio.TransportSocket object) TypeErrorrs r __getstate__zTransportSocket.__getstate__5sIJJJr c4|jSr )rrrs r rzTransportSocket.fileno8sz  """r c4|jSr )rduprs r r&zTransportSocket.dup;sz~~r c4|jSr )rget_inheritablers r r(zTransportSocket.get_inheritable>sz))+++r c:|j|dSr )rshutdown)r hows r r*zTransportSocket.shutdownAs  C     r c&|jj|i|Sr )r getsockoptr argskwargss r r-zTransportSocket.getsockoptFs$tz$d5f555r c*|jj|i|dSr )r setsockoptr.s r r2zTransportSocket.setsockoptIs" t.v.....r c4|jSr )rrrs r rzTransportSocket.getpeernameLz%%'''r c4|jSr )rrrs r rzTransportSocket.getsocknameOr4r c4|jSr )r getsockbynamers r r7zTransportSocket.getsockbynameRsz'')))r c0|dkrdStd)Nrzr r rrspIV]!!X!X  X .KKK###   ,,,!!! 666///((((((***LLL CCCCCr r)rrr>r r rIsT ^C^C^C^C^C^C^C^C^C^Cr __pycache__/selector_events.cpython-311.opt-2.pyc000064400000171263152533123130015632 0ustar00 !A?hXl dZddlZddlZddlZddlZddlZddlZddlZ ddlZn #e $rdZYnwxYwddl m Z ddl m Z ddl m Z ddl mZddl mZdd l mZdd l mZdd l mZdd lmZd ZGdde jZGddejejZGddeZGddeZdS))BaseSelectorEventLoopN) base_events) constants)events)futures) protocols)sslproto) transports)trsock)loggerc~ ||}t|j|zS#t$rYdSwxYwNF)get_keyboolrKeyError)selectorfdeventkeys D/opt/alt/python-internal/lib64/python3.11/asyncio/selector_events.py_test_selector_eventr sU(r""CJ&''' uus . <<ceZdZ d3fd Zd3ddddZ d3ddddejejddZ d4dZ fd Z d Z d Z d Z d ZdZdddejejfdZdddejejfdZddejejfdZdZdZdZdZdZdZdZdZdZdZd3dZdZdZd Z d!Z!d"Z"d5d$Z#d%Z$d&Z%d'Z&d(Z'd)Z(d*Z)d+Z*d3d,Z+d-Z,d.Z-d/Z.d0Z/d1Z0d2Z1xZ2S)6rNct|tj}t jd|jj||_| tj |_ dS)NzUsing selector: %s) super__init__ selectorsDefaultSelectorr debug __class____name__ _selector_make_self_pipeweakrefWeakValueDictionary _transports)selfrr s rrzBaseSelectorEventLoop.__init__1sv    022H )8+=+FGGG! "688extraserverc*t||||||SN)_SelectorSocketTransport)r'sockprotocolwaiterr*r+s r_make_socket_transportz,BaseSelectorEventLoop._make_socket_transport;s!'dHf(-v77 7r(F) server_sideserver_hostnamer*r+ssl_handshake_timeoutssl_shutdown_timeoutc ptj||||||| | } t||| ||| jS)N)r5r6r))r SSLProtocolr._app_transport) r'rawsockr0 sslcontextr1r3r4r*r+r5r6 ssl_protocols r_make_ssl_transportz)BaseSelectorEventLoop._make_ssl_transport@s\ + (J "7!5    !w ',V = = = =**r(c*t||||||Sr-)_SelectorDatagramTransport)r'r/r0addressr1r*s r_make_datagram_transportz.BaseSelectorEventLoop._make_datagram_transportQs$)$h*165BB Br(c4|rtd|rdS|t |j"|jd|_dSdS)Nz!Cannot close a running event loop) is_running RuntimeError is_closed_close_self_pipercloser")r'r s rrGzBaseSelectorEventLoop.closeVs ??   DBCC C >>    F    > % N " " "!DNNN & %r(c||j|jd|_|jd|_|xjdzc_dS)Nr)_remove_reader_ssockfilenorG_csock _internal_fdsr's rrFz&BaseSelectorEventLoop._close_self_pipeast DK..00111     ar(c2tj\|_|_|jd|jd|xjdz c_||j|jdS)NFr) socket socketpairrJrL setblockingrM _add_readerrK_read_from_selfrNs rr#z%BaseSelectorEventLoop._make_self_pipeis#)#4#6#6  T[ &&& &&& a ++--t/CDDDDDr(cdSr-r'datas r_process_self_dataz(BaseSelectorEventLoop._process_self_dataqs r(c |jd}|sdS||n#t$rYBt$rYdSwxYwR)NTi)rJrecvrYInterruptedErrorBlockingIOErrorrWs rrTz%BaseSelectorEventLoop._read_from_selfts  {''--E''----#   "     s77 A AAc|j}|dS |ddS#t$r$|jrt jddYdSYdSwxYw)Nz3Fail to write a null byte into the self-pipe socketTexc_info)rLsendOSError_debugr r)r'csocks r_write_to_selfz$BaseSelectorEventLoop._write_to_selfs   = F , JJu      , , ,{ , 0&*,,,,,,, , , , ,s$'AAdc n|||j||||||| dSr-)rSrK_accept_connection)r'protocol_factoryr/r;r+backlogr5r6s r_start_servingz$BaseSelectorEventLoop._start_servingsK (?)4VW.0D F F F F Fr(c t|D]h} |\} } |jrtjd|| | | dd| i} ||| | ||||} || #tttf$rYdSt$r} | j tj tjtjtjfvr|d| t%j|d|||t.j|j||||||| nYd} ~ bd} ~ wwxYwdS)Nz#%r got a new connection from %r: %rFpeernamez&socket.accept() out of system resource)message exceptionrP)rangeacceptrdr rrR_accept_connection2 create_taskr]r\ConnectionAbortedErrorrcerrnoEMFILEENFILEENOBUFSENOMEMcall_exception_handlerr TransportSocketrIrK call_laterrACCEPT_RETRY_DELAYrl)r'rjr/r;r+rkr5r6_connaddrr*rrexcs rriz(BaseSelectorEventLoop._accept_connectionsw# )# )A" )![[]] d;5L!F!'t555  '''2$T*11$dE:v)+?AA  ((((9$%57MN   ttt   9u|!& !>>> //#K%("("8">">11 '' 666OOI$@$($7$4dJ$+-B$8 ::::  ::::: # )# )sA BE7. E77B5E22E7c Kd}d} |}|} |r||||| d|||| } n|||| ||} | d{VdS#t$r| d} wxYw#t t f$rt$r@} |jr.d| d} ||| d<| | | d<|| Yd} ~ dSYd} ~ dSd} ~ wwxYw)NT)r1r3r*r+r5r6)r1r*r+z3Error on transport creation for incoming connection)rorpr0 transport) create_futurer=r2 BaseExceptionrG SystemExitKeyboardInterruptrdr{) r'rjrr*r;r+r5r6r0rr1rcontexts rrsz)BaseSelectorEventLoop._accept_connection2s  & 5''))H''))F # 44(Jv $E&*?)= 5?? !77(6!8##       !!!  -.     5 5 5{ 5N!$ '*2GJ'(+4GK(++G444444444 5 5 5 5 5 5 5s*AB"A,,"BBC,,/C''C,cf|}t|tsQ t|}n.#ttt f$rt d|dwxYw |j|}|std|d|dS#t$rYdSwxYw)NzInvalid file object: zFile descriptor z is used by transport ) isinstanceintrKAttributeError TypeError ValueErrorr& is_closingrDr)r'rrKrs r_ensure_fd_no_transportz-BaseSelectorEventLoop._ensure_fd_no_transports&#&& K KV]]__--"Iz: K K K !?!?!?@@dJ K &(0I'')) &"%r%% %%&&& & &    DD s!;+A&* B"" B0/B0c|tj|||d} |j|}|j|jc}\}}|j||tjz||f|| n8#t$r+|j |tj|dfYnwxYw|Sr-) _check_closedrHandler"rrXmodifyr EVENT_READcancelrregister r'rcallbackargshandlermaskreaderwriters rrSz!BaseSelectorEventLoop._add_reader s xtT:: .((,,C &)Z "D"66 N ! !"dY-A&A#)6"2 4 4 4!  4 4 4 N # #B (<%+TN 4 4 4 4 4 4 B2CCct|rdS |j|}|j|jc}\}}|t jz}|s|j|n|j||d|f|| dSdS#t$rYdSwxYwNFT) rEr"rrrXrr unregisterrrrr'rrrrrs rrIz$BaseSelectorEventLoop._remove_readers >>   5 .((,,C&)Z "D"66 Y)) )D @))"----%%b$v???! tu   55 sB)) B76B7c|tj|||d} |j|}|j|jc}\}}|j||tjz||f|| n8#t$r+|j |tjd|fYnwxYw|Sr-) rrrr"rrXrr EVENT_WRITErrrrs r _add_writerz!BaseSelectorEventLoop._add_writer.s xtT:: .((,,C &)Z "D"66 N ! !"dY-B&B#)6"2 4 4 4!  4 4 4 N # #B (=%)6N 4 4 4 4 4 4 rcv |rdS |j|}|j|jc}\}}|t jz}|s|j|n|j|||df|| dSdS#t$rYdSwxYwr) rEr"rrrXrrrrrrrs r_remove_writerz$BaseSelectorEventLoop._remove_writer>s' >>   5 .((,,C&)Z "D"66 Y** *D @))"----%%b$???! tu   55 sB** B87B8cP |||j||g|RdSr-)rrSr'rrrs r add_readerz BaseSelectorEventLoop.add_readerUs<$ $$R(((X-------r(cX ||||Sr-)rrIr'rs r remove_readerz#BaseSelectorEventLoop.remove_readerZ-' $$R(((""2&&&r(cP |||j||g|RdSr-)rrrs r add_writerz BaseSelectorEventLoop.add_writer_s<% $$R(((X-------r(cX ||||Sr-)rrrs r remove_writerz#BaseSelectorEventLoop.remove_writerdrr(c K tj||jr'|dkrt d ||S#t tf$rYnwxYw|}| }| || ||j |||}| tj|j|||d{VSNrthe socket must be non-blockingr)r_check_ssl_socketrd gettimeoutrr[r]r\rrKrrS _sock_recvadd_done_callback functoolspartial_sock_read_done)r'r/nfutrrs r sock_recvzBaseSelectorEventLoop.sock_recvis %d+++ ; @4??,,11>?? ? 99Q<< !12    D   "" [[]] $$R(((!!"dosD!DD   d2Bv F F F H H HyyyyyyAA0/A0c`||s||dSdSr-) cancelledrr'rrrs rrz%BaseSelectorEventLoop._sock_read_done8 >!1!1!3!3>   r " " " " " >r(c*|rdS ||}||dS#ttf$rYdSt t f$rt$r }||Yd}~dSd}~wwxYwr-) doner[ set_resultr]r\rrr set_exception)r'rr/rrXrs rrz BaseSelectorEventLoop._sock_recvs 88::  F !99Q<?? ? >>#&& &!12    D   "" [[]] $$R(((!!"d&:CsKK   d2Bv F F F H H Hyyyyyyrc*|rdS ||}||dS#ttf$rYdSt t f$rt$r }||Yd}~dSd}~wwxYwr-) rrrr]r\rrrr)r'rr/rnbytesrs rrz%BaseSelectorEventLoop._sock_recv_intos 88::  F #^^C((F NN6 " " " " " !12    FF-.     # # #   c " " " " " " " " " #rc K tj||jr'|dkrt d ||S#t tf$rYnwxYw|}| }| || ||j |||}| tj|j|||d{VSr)rrrdrrrecvfromr]r\rrKrrS_sock_recvfromrrrr)r'r/bufsizerrrs r sock_recvfromz#BaseSelectorEventLoop.sock_recvfroms  %d+++ ; @4??,,11>?? ? ==)) )!12    D   "" [[]] $$R(((!!"d&93gNN   d2Bv F F F H H Hyyyyyyrc*|rdS ||}||dS#ttf$rYdSt t f$rt$r }||Yd}~dSd}~wwxYwr-) rrrr]r\rrrr)r'rr/rresultrs rrz$BaseSelectorEventLoop._sock_recvfroms 88::  F #]]7++F NN6 " " " " " !12    FF-.     # # #   c " " " " " " " " " #rrc0K tj||jr'|dkrt d|st |} |||S#ttf$rYnwxYw| }| }| || ||j ||||}|tj|j|||d{VSr)rrrdrrlen recvfrom_intor]r\rrKrrS_sock_recvfrom_intorrrr)r'r/rrrrrs rsock_recvfrom_intoz(BaseSelectorEventLoop.sock_recvfrom_intos< %d+++ ; @4??,,11>?? ? XXF %%c622 2!12    D   "" [[]] $$R(((!!"d&>T3"(**   d2Bv F F F H H HyyyyyysA..BBc,|rdS |||}||dS#ttf$rYdSt t f$rt$r }||Yd}~dSd}~wwxYwr-) rrrr]r\rrrr)r'rr/rrrrs rrz)BaseSelectorEventLoop._sock_recvfrom_intos 88::  F #''W55F NN6 " " " " " !12    FF-.     # # #   c " " " " " " " " " #sABB3BBc XK tj||jr'|dkrt d ||}n#t tf$rd}YnwxYw|t|krdS| }| }| || ||j ||t||g}|t!j|j|||d{VSr)rrrdrrrbr]r\rrrKrr _sock_sendall memoryviewrrr_sock_write_done)r'r/rXrrrrs r sock_sendallz"BaseSelectorEventLoop.sock_sendall sH  %d+++ ; @4??,,11>?? ?  $AA!12   AAA  D >> F  "" [[]] $$R(((!!"d&8#t",T"2"2QC99   d3R G G G I I IyyyyyysAA32A3c|rdS|d} |||d}nQ#ttf$rYdStt f$rt $r }||Yd}~dSd}~wwxYw||z }|t|kr| ddS||d<dSNr) rrbr]r\rrrrrr)r'rr/viewposstartrrs rrz#BaseSelectorEventLoop._sock_sendall*s 88::  FA  $uvv,''AA!12    FF-.          c " " " FFFFF    CII   NN4 CFFFs>B B ,BB cK tj||jr'|dkrt d |||S#t tf$rYnwxYw|}| }| || ||j ||||}| tj|j|||d{VSr)rrrdrrsendtor]r\rrKrr _sock_sendtorrrr)r'r/rXr@rrrs r sock_sendtoz!BaseSelectorEventLoop.sock_sendto@s)  %d+++ ; @4??,,11>?? ? ;;tW-- -!12    D   "" [[]] $$R(((!!"d&7dD")++   d3R G G G I I IyyyyyysAA10A1c.|rdS ||d|}||dS#ttf$rYdSt t f$rt$r }||Yd}~dSd}~wwxYwr) rrrr]r\rrrr)r'rr/rXr@rrs rrz"BaseSelectorEventLoop._sock_sendto[s 88::  F  D!W--A NN1      !12    FF-.     # # #   c " " " " " " " " " #sABB4BBcK tj||jr'|dkrt d|jt jks!tjrR|jt j kr=| ||j|j |j |d{V}|d\}}}}}| }|||| |d{V d}S#d}wxYw)Nrr)familytypeprotoloop)rrrdrrrrPAF_INET _HAS_IPv6AF_INET6_ensure_resolvedrrr _sock_connect)r'r/r@resolvedrrs r sock_connectz"BaseSelectorEventLoop.sock_connectjs+  %d+++ ; @4??,,11>?? ? ;&. ( (% )*.+*H*H!22 $)4:3H#+1+ Aq!Q  "" 3g... 999999 CC$CJJJJs %C00C4c|} |||dn#ttf$re|||||j|||}|tj |j ||YnCB>B94C9B>>CC cK tj||jr'|dkrt d|}||||d{VS)Nrr)rrrdrrr _sock_accept)r'r/rs r sock_acceptz!BaseSelectorEventLoop.sock_accepts  %d+++ ; @4??,,11>?? ?  "" #t$$$yyyyyyr(c|} |\}}|d|||fdS#tt f$re|||||j||}| tj |j ||YdSttf$rt$r }||Yd}~dSd}~wwxYw)NFr)rKrrrRrr]r\rrSrrrrrrrrr)r'rr/rrr@rrs rrz"BaseSelectorEventLoop._sock_acceptsI [[]] , KKMMMD'   U # # # NND'? + + + + + !12 L L L  ( ( , , ,%%b$*;S$GGF  ! !!$"66JJJ L L L L L L-.     # # #   c " " " " " " " " " #s,AA2D D *DD cK|j|j=|}||d{V ||j|||dd{V ||r|||j|j<S#||r|||j|j<wxYw)NF)fallback) r&_sock_fd is_reading pause_reading_make_empty_waiter sock_sendfile_sock_reset_empty_waiterresume_reading)r'transpfileoffsetcountrs r_sendfile_nativez&BaseSelectorEventLoop._sendfile_natives1  V_ -**,,''))))))))) 7++FL$5:,<<<<<<<< <  & & ( ( ( (%%'''06D V_ - -  & & ( ( ( (%%'''06D V_ - 6 6 6 6s $B22;C-cF|D]\}}|j|jc}\}}|tjzr4|2|jr||n|||tjzr4|2|jr||||dSr-) fileobjrXrr _cancelledrI _add_callbackrr)r' event_listrrrrrs r_process_eventsz%BaseSelectorEventLoop._process_eventss# / /IC(+ SX %G%ffi** /v/A$/''0000&&v...i++ /0B$/''0000&&v... / /r(c||||dSr-)rIrKrG)r'r/s r _stop_servingz#BaseSelectorEventLoop._stop_servings/ DKKMM*** r(r-NNN)r)3r! __module__ __qualname__rr2rSSL_HANDSHAKE_TIMEOUTSSL_SHUTDOWN_TIMEOUTr=rArGrFr#rYrTrfrlrirsrrSrIrrrrrrrrrrrrrrrrrrrrrrrrrrrr __classcell__r s@rrr+s 9999997%)$77777 9=+ $t"+"A!*!? +++++$CGBBBB " " " " "   EEE      ,,,&#'tS-6-L,5,JFFFFD#"+"A!*!? ,),),),)`D"+"A!*!? -5-5-5-5^&&&$ * .... ''' ... ''' ,####!!! *###".###"2###">,6   2.####*   ,,," 7 7 7 / / /r(rceZdZdZeZdZdfd ZdZdZ dZ dZ dZ d Z d Zd Zd Zejfd ZddZdZdZdZdZxZS)_SelectorTransportiNct||tj||jd< ||jd<n#t $r d|jd<YnwxYwd|jvr= ||jd<n#tj $r d|jd<YnwxYw||_ | |_ d|_ ||||_||_d|_d|_d|_|j|j||j|j <dS)NrPsocknamernFr)rrr r|_extra getsocknamerc getpeernamerPerrorrrKr _protocol_connected set_protocol_server_buffer_factory_buffer _conn_lost_closing_paused_attachr&)r'rr/r0r*r+r s rrz_SelectorTransport.__init__so %%% & 6t < < H +&*&6&6&8&8DK # # + + +&*DK # # # + T[ ( ( /*.*:*:*<*< J''< / / /*. J''' /   #(  (### ++--   < # L " " "*.'''s$AA54A5BB;:B;c|jjg}|j|dn|jr|d|d|j|j|jst|jj |jtj }|r|dn|dt|jj |jtj }|rd}nd}| }|d|d |d d d |S) Nclosedclosingzfd=z read=pollingz read=idlepollingidlezwrite=z<{}> )r r!rappendr5r _looprErr"rrrget_write_buffer_sizeformatjoin)r'infor;staters r__repr__z_SelectorTransport.__repr__s]'( :  KK ! ! ! ! ] # KK " " " )$-))*** : !$**>*>*@*@ !*4:+?+/=):NPPG ) N++++ K(((*4:+?+/=+4+@BBG !0022G KK=%==7=== > > >}}SXXd^^,,,r(c0|ddSr-) _force_closerNs rabortz_SelectorTransport.abort8s $r(c"||_d|_dSNT) _protocolr/)r'r0s rr0z_SelectorTransport.set_protocol;s!#'   r(c|jSr-)rLrNs r get_protocolz_SelectorTransport.get_protocol?s ~r(c|jSr-)r5rNs rrz_SelectorTransport.is_closingBs }r(c<| o|j Sr-)rr6rNs rr z_SelectorTransport.is_readingEs??$$$9T\)99r(c|sdSd|_|j|j|jrt jd|dSdS)NTz%r pauses reading)r r6r@rIr  get_debugr rrNs rr z _SelectorTransport.pause_readingHsq    F  !!$-000 :   ! ! 4 L,d 3 3 3 3 3 4 4r(c|js|jsdSd|_||j|j|jrtjd|dSdS)NFz%r resumes reading) r5r6rSr  _read_readyr@rRr rrNs rrz!_SelectorTransport.resume_readingPsu =    F  (8999 :   ! ! 5 L-t 4 4 4 4 4 5 5r(c|jrdSd|_|j|j|jsQ|xjdz c_|j|j|j|jddSdSNTr) r5r@rIr r3r4r call_soon_call_connection_lostrNs rrGz_SelectorTransport.closeXs =  F  !!$-000| C OOq OO J % %dm 4 4 4 J !;T B B B B B C Cr(cv|j1|d|t||jdSdS)Nzunclosed transport )source)rResourceWarningrG)r'_warns r__del__z_SelectorTransport.__del__bsL : ! E000/$ O O O O J        " !r(Fatal error on transportct|tr2|jrt jd||dn$|j||||jd||dS)Nz%r: %sTr`)rorprr0) rrcr@rRr rr{rLrH)r'rros r _fatal_errorz_SelectorTransport._fatal_errorgs c7 # # z##%% E XtWtDDDD J - -" ! N //    #r(cP|jrdS|jr8|j|j|j|js&d|_|j|j|xjdz c_|j|j |dSrV) r4r3clearr@rr r5rIrWrX)r'rs rrHz_SelectorTransport._force_closeus ?  F < 5 L   J % %dm 4 4 4} 5 DM J % %dm 4 4 4 1 T7=====r(c |jr|j||jd|_d|_d|_|j}||d|_dSdS#|jd|_d|_d|_|j}||d|_wxYwr-)r/rLconnection_lostrrGr@r1_detach)r'rr+s rrXz(_SelectorTransport._call_connection_losts $' 4..s333 J     DJ!DNDJ\F!   # "! J     DJ!DNDJ\F!   # ####s !A99AC c*t|jSr-)rr3rNs rrAz(_SelectorTransport.get_write_buffer_sizes4<   r(cZ|sdS|jj||g|RdSr-)r r@rSrs rrSz_SelectorTransport._add_readers>    F r83d333333r()NN)r^)r!r!r"max_size bytearrayr2rrrFrIr0rNrr r rrGwarningswarnr]r`rHrXrArSr%r&s@rr(r(sEHO E//////8---8   (((:::444555CCC%M     > > > $ $ $!!!4444444r(r(ceZdZdZejjZ dfd ZfdZ dZ dZ dZ dZ d Zd Zd Zd Zfd ZdZdZxZS)r.TNcd|_t|||||d|_d|_t j|j|j |j j ||j |j |j |j|(|j tj|ddSdSr)_read_ready_cbrr_eof _empty_waiterr _set_nodelayrr@rWrLconnection_maderSr rTr_set_result_unless_cancelled)r'rr/r0r1r*r+r s rrz!_SelectorSocketTransport.__init__s# tXuf=== !  ,,, T^;TBBB T-!]D,< > > >   J !E!' / / / / /  r(ct|tjr |j|_n |j|_t |dSr-)rr BufferedProtocol_read_ready__get_bufferrn_read_ready__data_receivedrr0)r'r0r s rr0z%_SelectorSocketTransport.set_protocolsP h : ; ; B"&">D  "&"AD  X&&&&&r(c.|dSr-)rnrNs rrTz$_SelectorSocketTransport._read_readys r(c|jrdS |jd}t|st dn?#t t f$rt$r!}||dYd}~dSd}~wwxYw |j |}nR#ttf$rYdSt t f$rt$r!}||dYd}~dSd}~wwxYw|s| dS |j|dS#t t f$rt$r!}||dYd}~dSd}~wwxYw)Nz%get_buffer() returned an empty bufferz/Fatal error: protocol.get_buffer() call failed.$Fatal read error on socket transportz3Fatal error: protocol.buffer_updated() call failed.)r4rL get_bufferrrDrrrr`rrr]r\_read_ready__on_eofbuffer_updated)r'rrrs rrvz0_SelectorSocketTransport._read_ready__get_buffers ?  F .++B//Cs88 L"#JKKK L-.          F H H H FFFFF   Z))#..FF!12    FF-.          c#I J J J FFFFF    $ $ & & & F L N ) )& 1 1 1 1 1-.     L L L   J L L L L L L L L L LsM8ABA;;BBC.3C. C))C. D&&E"EE"c|jrdS |j|j}nR#tt f$rYdSt tf$rt$r!}| |dYd}~dSd}~wwxYw|s| dS |j |dS#t tf$rt$r!}| |dYd}~dSd}~wwxYw)Nr{z2Fatal error: protocol.data_received() call failed.) r4rr[rhr]r\rrrr`r}rL data_received)r'rXrs rrwz3_SelectorSocketTransport._read_ready__data_receivedsp ?  F :??4=11DD!12    FF-.          c#I J J J FFFFF    $ $ & & & F K N ( ( . . . . .-.     K K K   I K K K K K K K K K Ks2+A:A:A55A:B22C. C))C.c|jrtjd| |j}n?#t tf$rt$r!}| |dYd}~dSd}~wwxYw|r!|j |j dS| dS)Nz%r received EOFz1Fatal error: protocol.eof_received() call failed.) r@rRr rrL eof_receivedrrrr`rIr rG)r' keep_openrs rr}z,_SelectorSocketTransport._read_ready__on_eofs :   ! ! 2 L*D 1 1 1 3355II-.          H J J J FFFFF    J % %dm 4 4 4 4 4 JJLLLLLsA B%BBc t|tttfs$t dt |j|jrtd|j td|sdS|j r;|j tj krtjd|xj dz c_ dS|js |j|}||d}|sdSnQ#t$t&f$rYn>t(t*f$rt,$r!}||dYd}~dSd}~wwxYw|j|j|j|j||dS)N/data argument must be a bytes-like object, not z%Cannot call write() after write_eof()z(unable to write; sendfile is in progresssocket.send() raised exception.r%Fatal write error on socket transport)rbytesrirrrr!rorDrpr4r!LOG_THRESHOLD_FOR_CONNLOST_WRITESr warningr3rrbr]r\rrrr`r@rr  _write_readyextend_maybe_pause_protocol)r'rXrrs rwritez_SelectorSocketTransport.writes$ : >?? <;#'::#6;;<< < 9 HFGG G   )IJJ J  F ? )"MMM@AAA OOq OO F| E JOOD))ABBxF$%56    12       !!#'NOOO  J " "4=$2C D D D D!!! ""$$$$$sC**D8=D8D33D8c"|jrdS |j|j}|r |jd|=||js|j|j|j|j d|j r| ddS|j r(|j tjdSdSdS#t t"f$rYdSt$t&f$rt($r}|j|j|j||d|j |j|Yd}~dSYd}~dSd}~wwxYw)Nr)r4rrbr3_maybe_resume_protocolr@rr rprr5rXroshutdownrPSHUT_WRr]r\rrrrbr`r)r'rrs rrz%_SelectorSocketTransport._write_ready8s ?  F 8  --A %L!$  ' ' ) ) )< 8 ))$-888%1&11$777=8..t44444Y8J''77777 8 8 88) !12    DD-.     6 6 6 J % %dm 4 4 4 L     c#J K K K!-"00555555555.-----  6sC F4FA/F  Fc|js|jrdSd|_|js&|jt jdSdSrK)r5ror3rrrPrrNs r write_eofz"_SelectorSocketTransport.write_eofVsS = DI  F | 0 J   / / / / / 0 0r(cdSrKrVrNs r can_write_eofz&_SelectorSocketTransport.can_write_eof]str(ct||j)|jt ddSdS)NzConnection is closed by peer)rrXrprConnectionError)r'rr s rrXz._SelectorSocketTransport._call_connection_lost`sb %%c***   )   , , >?? A A A A A * )r(c|jtd|j|_|js|jd|jS)NzEmpty waiter is already set)rprDr@rr3rrNs rrz+_SelectorSocketTransport._make_empty_waiterfsZ   )<== =!Z5577| 0   ) )$ / / /!!r(cd|_dSr-)rprNs rrz,_SelectorSocketTransport._reset_empty_waiterns!r(r )r!r!r"_start_tls_compatibler _SendfileMode TRY_NATIVE_sendfile_compatiblerr0rTrvrwr}rrrrrXrrr%r&s@rr.r.s* $2=48$(//////,'''''#L#L#LJKKK2*%%%%%%N888<000AAAAA """"""""""r(r.cLeZdZejZ dfd ZdZdZddZ dZ xZ S) r?Nc`t||||||_d|_|j|jj||j|j|j |j |(|jtj |ddSdSr) rr_address _buffer_sizer@rWrLrrrSr rTrrs)r'rr/r0r@r1r*r s rrz#_SelectorDatagramTransport.__init__vs tXu555  T^;TBBB T-!]D,< > > >   J !E!' / / / / /  r(c|jSr-)rrNs rrAz0_SelectorDatagramTransport.get_write_buffer_sizes   r(c|jrdS |j|j\}}|j||dS#t tf$rYdSt$r%}|j |Yd}~dSd}~wttf$rt$r!}| |dYd}~dSd}~wwxYw)Nz&Fatal read error on datagram transport)r4rrrhrLdatagram_receivedr]r\rcerror_receivedrrrr`r'rXrrs rrTz&_SelectorDatagramTransport._read_readys ?  F 9,,T];;JD$ N , ,T4 8 8 8 8 8 !12    DD / / / N ) )# . . . . . . . . .-.     M M M   c#K L L L L L L L L L Ms)"A C C'BC%CCc t|tttfs$t dt |j|sdS|jr)|d|jfvrtd|j|j}|j rB|jr;|j tj krtj d|xj dz c_ dS|js |jdr|j|n|j||dS#t&t(f$r(|j|j|jYnkt2$r%}|j|Yd}~dSd}~wt8t:f$rt<$r!}||dYd}~dSd}~wwxYw|j t||f|xj!tE|z c_!|#dS)Nrz!Invalid address: must be None or rrrn'Fatal write error on datagram transport)$rrrirrrr!rrr4rrr rr3r+rrbrr]r\r@rr  _sendto_readyrcrLrrrrr`r?rrrrs rrz!_SelectorDatagramTransport.sendtosi$ : >?? <;#'::#6;;<< <  F = !D$-000 G GGIII=D ? t} )"MMM@AAA OOq OO F|  ;z*2JOOD))))J%%dD111#%56 J J J &&t}d6HIIIII   --c222 12       !!BDDD  U4[[$/000 SYY& ""$$$$$s+ AD6F1 F1E22F1F,,F1cD|jr=|j\}}|xjt|zc_ |jdr|j|n|j||n#ttf$r<|j ||f|xjt|z c_Ynst$r%}|j |Yd}~dSd}~wttf$rt $r!}||dYd}~dSd}~wwxYw|j=||js=|j|j|jr|ddSdSdS)Nrnr)r3popleftrrr+rrbrr]r\ appendleftrcrLrrrrr`rr@rr r5rXrs rrz(_SelectorDatagramTransport._sendto_readysl --//JD$   T *   ;z*2JOOD))))J%%dD111#%56    ''t 555!!SYY.!!   --c222 12       !!BDDD #l , ##%%%| 1 J % %dm 4 4 4} 1**400000 1 1 1 1s,ABA D; D;C<<D;D66D;r r-) r!r!r" collectionsdequer2rrArTrrr%r&s@rr?r?rs!'O59$( / / / / / /!!!999 *%*%*%*%X1111111r(r?)__all__rrvrrrPrjr$ssl ImportErrorrrrrr r r r logr r BaseEventLoopr_FlowControlMixin Transportr(r.r?rVr(rrs% #  JJJJ CCC(((F F F F F K5F F F Ra4a4a4a4a45#-a4a4a4HW"W"W"W"W"1W"W"W"tl1l1l1l1l1!3l1l1l1l1l1s &00__pycache__/locks.cpython-311.opt-1.pyc000064400000071053152533123130013534 0ustar00 !A?hFJbdZdZddlZddlZddlmZddlmZddlmZGdd ZGd d eej Z Gd d ej Z Gddeej Z Gddeej Z Gdde ZGddejZGddej ZdS)zSynchronization primitives.)LockEvent Condition SemaphoreBoundedSemaphoreBarrierN) exceptions)mixins)tasksceZdZdZdZdS)_ContextManagerMixinc>K|d{VdSN)acquireselfs :/opt/alt/python-internal/lib64/python3.11/asyncio/locks.py __aenter__z_ContextManagerMixin.__aenter__s-llnntc2K|dSr)release)rexc_typeexctbs r __aexit__z_ContextManagerMixin.__aexit__s rN)__name__ __module__ __qualname__rrrrrr s2 rrc@eZdZdZdZfdZdZdZdZdZ xZ S)raPrimitive lock objects. A primitive lock is a synchronization primitive that is not owned by a particular coroutine when locked. A primitive lock is in one of two states, 'locked' or 'unlocked'. It is created in the unlocked state. It has two basic methods, acquire() and release(). When the state is unlocked, acquire() changes the state to locked and returns immediately. When the state is locked, acquire() blocks until a call to release() in another coroutine changes it to unlocked, then the acquire() call resets it to locked and returns. The release() method should only be called in the locked state; it changes the state to unlocked and returns immediately. If an attempt is made to release an unlocked lock, a RuntimeError will be raised. When more than one coroutine is blocked in acquire() waiting for the state to turn to unlocked, only one coroutine proceeds when a release() call resets the state to unlocked; first coroutine which is blocked in acquire() is being processed. acquire() is a coroutine and should be called with 'await'. Locks also support the asynchronous context management protocol. 'async with lock' statement should be used. Usage: lock = Lock() ... await lock.acquire() try: ... finally: lock.release() Context manager usage: lock = Lock() ... async with lock: ... Lock objects can be tested for locking state: if not lock.locked(): await lock.acquire() else: # lock is acquired ... c"d|_d|_dSNF)_waiters_lockedrs r__init__z Lock.__init__Ns  rct}|jrdnd}|jr|dt |j}d|ddd|dS Nlockedunlocked , waiters:)super__repr__r%r$lenrresextra __class__s rr1z Lock.__repr__Rspgg   L8j = =<<DM(:(:<K|]}|VdSr cancelled.0ws r zLock.acquire..ds*99aAKKMM999999rT) r%r$all collectionsdeque _get_loop create_futureappendremover CancelledError_wake_up_firstrfuts rrz Lock.acquire]s-   $-"7994=99999#8DL4 = '-//DMnn,,.. S!!!   *  $$S)))) $$S)))))(   < &##%%%    tsB<!C<CC,Dch|jrd|_|dStd)aGRelease a lock. When the lock is locked, reset it to unlocked, and return. If any other coroutines are blocked waiting for the lock to become unlocked, allow exactly one of them to proceed. When invoked on an unlocked lock, a RuntimeError is raised. There is no return value. FzLock is not acquired.N)r%rH RuntimeErrorrs rrz Lock.release}s< < 8 DL    ! ! ! ! !677 7rc|jsdS tt|j}n#t$rYdSwxYw|s|ddSdS)z*Wake up the first waiter if it isn't done.NT)r$nextiter StopIterationdone set_resultrIs rrHzLock._wake_up_firsts}  F tDM**++CC    FF  xxzz ! NN4  ! !s !- ;;) rrr__doc__r&r1r)rrrH __classcell__r6s@rrrs33j*****@888" ! ! ! ! ! ! !rrc@eZdZdZdZfdZdZdZdZdZ xZ S)ra#Asynchronous equivalent to threading.Event. Class implementing event objects. An event manages a flag that can be set to true with the set() method and reset to false with the clear() method. The wait() method blocks until the flag is true. The flag is initially false. cDtj|_d|_dSr#)rArBr$_valuers rr&zEvent.__init__s#)++  rct}|jrdnd}|jr|dt |j}d|ddd|dS) Nsetunsetr+r,r r-r.r/)r0r1rXr$r2r3s rr1zEvent.__repr__spgg  1' = =<<DM(:(:<>CC&DDE  D%$E %D96E 8D99E cnK|}|s&|d{V|}|&|S)zWait until a predicate becomes true. The predicate should be a callable which result will be interpreted as a boolean value. The final predicate value is the return value. Nrc)r predicateresults rwait_forzCondition.wait_forsW !))++       Y[[F ! rr c|stdd}|jD]9}||krdS|s|dz }|d:dS)aBy default, wake up one coroutine waiting on this condition, if any. If the calling coroutine has not acquired the lock when this method is called, a RuntimeError is raised. This method wakes up at most n of the coroutines waiting for the condition variable; it is a no-op if no coroutines are waiting. Note: an awakened coroutine does not actually return from its wait() call until it can reacquire the lock. Since notify() does not release the lock, its caller should. z!cannot notify on un-acquired lockrr FN)r)rLr$rQrR)rnidxrJs rnotifyzCondition.notify*s{{}} DBCC C= & &Caxx88:: &qu%%%  & &rcT|t|jdS)aWake up all threads waiting on this condition. This method acts like notify(), but wakes up all waiting threads instead of one. If the calling thread has not acquired the lock when this method is called, a RuntimeError is raised. N)rrr2r$rs r notify_allzCondition.notify_allBs& C &&'''''rrr ) rrrrSr&r1rcrnrrrtrTrUs@rrrs , , , ,*****#0#0#0J   &&&&0(((((((rrcBeZdZdZd dZfdZdZdZdZdZ xZ S) raA Semaphore implementation. A semaphore manages an internal counter which is decremented by each acquire() call and incremented by each release() call. The counter can never go below zero; when acquire() finds that it is zero, it blocks, waiting until some other thread calls release(). Semaphores also support the context management protocol. The optional argument gives the initial value for the internal counter; it defaults to 1. If the value given is less than 0, ValueError is raised. r cL|dkrtdd|_||_dS)Nrz$Semaphore initial value must be >= 0) ValueErrorr$rX)rvalues rr&zSemaphore.__init__Zs, 199CDD D  rct}|rdn d|j}|jr|dt |j}d|ddd|dS) Nr)zunlocked, value:r+r,r r-r.r/)r0r1r)rXr$r2r3s rr1zSemaphore.__repr__`sgg   KKMMO/O$+/O/O = =<<DM(:(:<.js-AAaAKKMM!AAAAAArr )rXanyr$rs rr)zSemaphore.lockedgs9{aC AADM,?RAAA A A CrctK|s|xjdzc_dS|jtj|_|}|j| |d{V|j|n#|j|wxYwnL#tj $r:| s$|xjdz c_| wxYw|jdkr| dS)a5Acquire a semaphore. If the internal counter is larger than zero on entry, decrement it by one and return True immediately. If it is zero on entry, block, waiting until some other coroutine has called release() to make it larger than 0, and then return True. r TNr) r)rXr$rArBrCrDrErFr rGr; _wake_up_nextrIs rrzSemaphore.acquirels@{{}}  KK1 KK4 = '-//DMnn,,.. S!!!  *  $$S)))) $$S)))))(   ==?? % q ""$$$    ;??    ts B-C -C  C A DcN|xjdz c_|dS)zRelease a semaphore, incrementing the internal counter by one. When it was zero on entry and another coroutine is waiting for it to become larger than zero again, wake up that coroutine. r N)rXrrs rrzSemaphore.releases, q  rc|jsdS|jD]>}|s(|xjdzc_|ddS?dS)z)Wake up the first waiter that isn't done.Nr T)r$rQrXrRrIs rrzSemaphore._wake_up_nextsj}  F=  C88::  q t$$$   rru) rrrrSr&r1r)rrrrTrUs@rrrKs   *****CCC """H       rrc.eZdZdZdfd ZfdZxZS)rzA bounded semaphore implementation. This raises ValueError in release() if it would increase the value above the initial value. r cX||_t|dSr) _bound_valuer0r&)rryr6s rr&zBoundedSemaphore.__init__s)! rc|j|jkrtdtdS)Nz(BoundedSemaphore released too many times)rXrrxr0r)rr6s rrzBoundedSemaphore.releases< ;$+ + +GHH H rru)rrrrSr&rrTrUs@rrrs`       rrceZdZdZdZdZdZdS) _BarrierStatefillingdraining resettingbrokenN)rrrFILLINGDRAINING RESETTINGBROKENr rrrrs"GHI FFFrrceZdZdZdZfdZdZdZdZdZ dZ d Z d Z d Z d Zed ZedZedZxZS)ra Asyncio equivalent to threading.Barrier Implements a Barrier primitive. Useful for synchronizing a fixed number of tasks at known synchronization points. Tasks block on 'wait()' and are simultaneously awoken once they have all made their call. c|dkrtdt|_||_tj|_d|_dS)z1Create a barrier, initialised to 'parties' tasks.r zparties must be > 0rN)rxr_cond_partiesrr_state_count)rpartiess rr&zBarrier.__init__sA Q;;233 3[[  #+  rct}|jj}|js|d|jd|jz }d|ddd|dS)Nr+/r,r r-r.r/)r0r1rryr n_waitingrr3s rr1zBarrier.__repr__spgg  ;$&{ B A$.AA4<AA AE)3qt9))))))rc:K|d{VSrrkrs rrzBarrier.__aenter__s(YY[[       rc KdSrr )rargss rrzBarrier.__aexit__s  rcK|j4d{V|d{V |j}|xjdz c_|dz|jkr|d{Vn|d{V||xjdzc_|cdddd{VS#|xjdzc_|wxYw#1d{VswxYwYdS)zWait for the barrier. When the specified number of tasks have started waiting, they are all simultaneously awoken. Returns an unique and individual index number from 0 to 'parties-1'. Nr )r_blockrr_release_wait_exit)rindexs rrcz Barrier.waits:        ++--          q 19 ----//))))))))**,,&&&&&&& q                 q                  s)C'AB>$C'>&C$$C'' C14C1cKjfdd{Vjtjurt jddS)NcBjtjtjfvSr)rrrrrsrz Barrier._block..sDK& (?(rzBarrier aborted)rrnrrrr BrokenBarrierErrorrs`rrzBarrier._blocks j!!              ;-. . ./0ABB B / .rc^Ktj|_|jdSr)rrrrrtrs rrzBarrier._releases, $,  rcKjfdd{Vjtjtjfvrt jddS)Nc*jtjuSr)rrrrsrrzBarrier._wait..s$+]=R*RrzAbort or reset of barrier)rrnrrrrr rrs`rrz Barrier._waitsn j!!"R"R"R"RSSSSSSSSS ;=/1HI I I/0KLL L J Irc|jdkrK|jtjtjfvrtj|_|jdSdS)Nr)rrrrrrrrtrs rrz Barrier._exitsU ;!  {}6 8NOOO+3 J ! ! # # # # #  rc"K|j4d{V|jdkr%|jtjurtj|_ntj|_|jdddd{VdS#1d{VswxYwYdS)zReset the barrier to the initial state. Any tasks currently waiting will get the BrokenBarrier exception raised. Nr)rrrrrrrtrs rresetz Barrier.reset#s : $ $ $ $ $ $ $ ${Q;m&==="/"9DK+3 J ! ! # # # $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $sAA>> B BcK|j4d{Vtj|_|jdddd{VdS#1d{VswxYwYdS)zPlace the barrier into a 'broken' state. Useful in case of error. Any currently waiting tasks and tasks attempting to 'wait()' will have BrokenBarrierError raised. N)rrrrrtrs rabortz Barrier.abort2s : $ $ $ $ $ $ $ $'.DK J ! ! # # # $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $s+A AAc|jS)z8Return the number of tasks required to trip the barrier.)rrs rrzBarrier.parties<s }rc:|jtjur|jSdS)zrs!! * C!C!C!C!C! !7C!C!C!L:&:&:&:&:&F ":&:&:&zm(m(m(m(m($f&<m(m(m(`WWWWW$f&<WWWty$DIM3M3M3M3M3f$M3M3M3M3M3r__pycache__/taskgroups.cpython-311.opt-1.pyc000064400000017507152533123130014627 0ustar00 !A?h!JdgZddlmZddlmZddlmZGddZdS) TaskGroup)events) exceptions)taskscTeZdZdZdZdZdZdZddddZd e d e fd Z d Z d Z dS)ra9Asynchronous context manager for managing groups of tasks. Example use: async with asyncio.TaskGroup() as group: task1 = group.create_task(some_coroutine(...)) task2 = group.create_task(other_coroutine(...)) print("Both tasks have completed now.") All tasks are awaited when the context manager exits. Any exceptions other than `asyncio.CancelledError` raised within a task will cancel all remaining tasks and wait for them to exit. The exceptions are then combined and raised as an `ExceptionGroup`. cd|_d|_d|_d|_d|_d|_t |_g|_d|_ d|_ dS)NF) _entered_exiting _aborting_loop _parent_task_parent_cancel_requestedset_tasks_errors _base_error_on_completed_futselfs ?/opt/alt/python-internal/lib64/python3.11/asyncio/taskgroups.py__init__zTaskGroup.__init__sV    (-%ee  !%ctdg}|jr*|dt|j|jr*|dt|j|jr|dn|jr|dd|}d|dS) Nztasks=zerrors= cancellingentered z )rappendlenrr r join)rinfoinfo_strs r__repr__zTaskGroup.__repr__(st ; 5 KK3T[!1!133 4 4 4 < 7 KK5#dl"3"355 6 6 6 > # KK % % % % ] # KK " " "88D>>'H''''rcK|jrtd|d|jtj|_t j|j|_|jtd|dd|_|S)N TaskGroup z has already been enteredz! cannot determine the parent taskT)r RuntimeErrorr rget_running_loopr current_taskr rs r __aenter__zTaskGroup.__aenter__6s = @>T>>>@@ @ : 022DJ!.tz::   $FTFFFHH H  rcKd|_|#||r|j||_|tjur|nd}|jr|jdkrd}||js| |j r{|j |j |_ |j d{Vn9#tj$r'}|js|}| Yd}~nd}~wwxYwd|_ |j {|j|j|r |js||(|tjur|j||jr% t!d|j}|d#d|_wxYwdS)NTzunhandled errors in a TaskGroup)r _is_base_errorrrCancelledErrorrr uncancelr _abortrrr create_futurerrBaseExceptionGroup)retexctbpropagate_cancellation_errorexmes r __aexit__zTaskGroup.__aexit__Ds O##C((  ("D 222CC %  ( 4 ))++q0004, >>  k *%-)-)A)A)C)C& ",,,,,,,,,, " " "~ "460KKMMM "&*D "'k *.   '" " ( /  /. . >b (AAA L   $ $ $ < $ $'(I4<XXd"# #### $ $s$1 B??C5C00C5E)) E2N)namecontextc|jstd|d|jr|jstd|d|jrtd|d||j|}n|j||}tj||| |j |j ||S)zbCreate a new task in this group and return it. Similar to `asyncio.create_task`. r&z has not been enteredz is finishedz is shutting downN)r;) r r'r rr r create_taskr_set_task_nameadd_done_callback _on_task_doneadd)rcoror:r;tasks rr=zTaskGroup.create_tasks } KIDIIIJJ J = B B@D@@@AA A > GEDEEEFF F ?:))$//DD:))$)@@D T4((( t1222  rr4returnc:t|ttfS)N) isinstance SystemExitKeyboardInterrupt)rr4s rr-zTaskGroup._is_base_errors# ,=>???rcxd|_|jD]*}|s|+dS)NT)r rdonecancel)rts rr0zTaskGroup._abortsB  A6688    rc|j||j:|js3|js|jd|rdS|}|dS|j|| |r|j ||_ |j r,|j d|d|j d||ddS|js=|js8|d|_|j dSdSdS)NTzTask z% has errored out but its parent task z is already completed)message exceptionrC)rdiscardrrJ set_result cancelledrOrrr-rr r call_exception_handlerr rr0rK)rrCr4s rr@zTaskGroup._on_task_dones D!!!  ! -dk -)..00 8&11$777 >>    Fnn ; F C     s # # #(8(@"D    ! ! # #  J - -L4LL#'#4LLL  //    F~ 'd&C '& KKMMM,0D )   $ $ & & & & &+ ' ' ' 'r)__name__ __module__ __qualname____doc__rr$r*r9r= BaseExceptionboolr-r0r@rrrr s & & & ( ( (   O$O$O$b)-d0@-@D@@@@2'2'2'2'2'rN)__all__rrrrrrZrrr\s -^'^'^'^'^'^'^'^'^'^'r__pycache__/locks.cpython-311.pyc000064400000071053152533123130012575 0ustar00 !A?hFJbdZdZddlZddlZddlmZddlmZddlmZGdd ZGd d eej Z Gd d ej Z Gddeej Z Gddeej Z Gdde ZGddejZGddej ZdS)zSynchronization primitives.)LockEvent Condition SemaphoreBoundedSemaphoreBarrierN) exceptions)mixins)tasksceZdZdZdZdS)_ContextManagerMixinc>K|d{VdSN)acquireselfs :/opt/alt/python-internal/lib64/python3.11/asyncio/locks.py __aenter__z_ContextManagerMixin.__aenter__s-llnntc2K|dSr)release)rexc_typeexctbs r __aexit__z_ContextManagerMixin.__aexit__s rN)__name__ __module__ __qualname__rrrrrr s2 rrc@eZdZdZdZfdZdZdZdZdZ xZ S)raPrimitive lock objects. A primitive lock is a synchronization primitive that is not owned by a particular coroutine when locked. A primitive lock is in one of two states, 'locked' or 'unlocked'. It is created in the unlocked state. It has two basic methods, acquire() and release(). When the state is unlocked, acquire() changes the state to locked and returns immediately. When the state is locked, acquire() blocks until a call to release() in another coroutine changes it to unlocked, then the acquire() call resets it to locked and returns. The release() method should only be called in the locked state; it changes the state to unlocked and returns immediately. If an attempt is made to release an unlocked lock, a RuntimeError will be raised. When more than one coroutine is blocked in acquire() waiting for the state to turn to unlocked, only one coroutine proceeds when a release() call resets the state to unlocked; first coroutine which is blocked in acquire() is being processed. acquire() is a coroutine and should be called with 'await'. Locks also support the asynchronous context management protocol. 'async with lock' statement should be used. Usage: lock = Lock() ... await lock.acquire() try: ... finally: lock.release() Context manager usage: lock = Lock() ... async with lock: ... Lock objects can be tested for locking state: if not lock.locked(): await lock.acquire() else: # lock is acquired ... c"d|_d|_dSNF)_waiters_lockedrs r__init__z Lock.__init__Ns  rct}|jrdnd}|jr|dt |j}d|ddd|dS Nlockedunlocked , waiters:)super__repr__r%r$lenrresextra __class__s rr1z Lock.__repr__Rspgg   L8j = =<<DM(:(:<K|]}|VdSr cancelled.0ws r zLock.acquire..ds*99aAKKMM999999rT) r%r$all collectionsdeque _get_loop create_futureappendremover CancelledError_wake_up_firstrfuts rrz Lock.acquire]s-   $-"7994=99999#8DL4 = '-//DMnn,,.. S!!!   *  $$S)))) $$S)))))(   < &##%%%    tsB<!C<CC,Dch|jrd|_|dStd)aGRelease a lock. When the lock is locked, reset it to unlocked, and return. If any other coroutines are blocked waiting for the lock to become unlocked, allow exactly one of them to proceed. When invoked on an unlocked lock, a RuntimeError is raised. There is no return value. FzLock is not acquired.N)r%rH RuntimeErrorrs rrz Lock.release}s< < 8 DL    ! ! ! ! !677 7rc|jsdS tt|j}n#t$rYdSwxYw|s|ddSdS)z*Wake up the first waiter if it isn't done.NT)r$nextiter StopIterationdone set_resultrIs rrHzLock._wake_up_firsts}  F tDM**++CC    FF  xxzz ! NN4  ! !s !- ;;) rrr__doc__r&r1r)rrrH __classcell__r6s@rrrs33j*****@888" ! ! ! ! ! ! !rrc@eZdZdZdZfdZdZdZdZdZ xZ S)ra#Asynchronous equivalent to threading.Event. Class implementing event objects. An event manages a flag that can be set to true with the set() method and reset to false with the clear() method. The wait() method blocks until the flag is true. The flag is initially false. cDtj|_d|_dSr#)rArBr$_valuers rr&zEvent.__init__s#)++  rct}|jrdnd}|jr|dt |j}d|ddd|dS) Nsetunsetr+r,r r-r.r/)r0r1rXr$r2r3s rr1zEvent.__repr__spgg  1' = =<<DM(:(:<>CC&DDE  D%$E %D96E 8D99E cnK|}|s&|d{V|}|&|S)zWait until a predicate becomes true. The predicate should be a callable which result will be interpreted as a boolean value. The final predicate value is the return value. Nrc)r predicateresults rwait_forzCondition.wait_forsW !))++       Y[[F ! rr c|stdd}|jD]9}||krdS|s|dz }|d:dS)aBy default, wake up one coroutine waiting on this condition, if any. If the calling coroutine has not acquired the lock when this method is called, a RuntimeError is raised. This method wakes up at most n of the coroutines waiting for the condition variable; it is a no-op if no coroutines are waiting. Note: an awakened coroutine does not actually return from its wait() call until it can reacquire the lock. Since notify() does not release the lock, its caller should. z!cannot notify on un-acquired lockrr FN)r)rLr$rQrR)rnidxrJs rnotifyzCondition.notify*s{{}} DBCC C= & &Caxx88:: &qu%%%  & &rcT|t|jdS)aWake up all threads waiting on this condition. This method acts like notify(), but wakes up all waiting threads instead of one. If the calling thread has not acquired the lock when this method is called, a RuntimeError is raised. N)rrr2r$rs r notify_allzCondition.notify_allBs& C &&'''''rrr ) rrrrSr&r1rcrnrrrtrTrUs@rrrs , , , ,*****#0#0#0J   &&&&0(((((((rrcBeZdZdZd dZfdZdZdZdZdZ xZ S) raA Semaphore implementation. A semaphore manages an internal counter which is decremented by each acquire() call and incremented by each release() call. The counter can never go below zero; when acquire() finds that it is zero, it blocks, waiting until some other thread calls release(). Semaphores also support the context management protocol. The optional argument gives the initial value for the internal counter; it defaults to 1. If the value given is less than 0, ValueError is raised. r cL|dkrtdd|_||_dS)Nrz$Semaphore initial value must be >= 0) ValueErrorr$rX)rvalues rr&zSemaphore.__init__Zs, 199CDD D  rct}|rdn d|j}|jr|dt |j}d|ddd|dS) Nr)zunlocked, value:r+r,r r-r.r/)r0r1r)rXr$r2r3s rr1zSemaphore.__repr__`sgg   KKMMO/O$+/O/O = =<<DM(:(:<.js-AAaAKKMM!AAAAAArr )rXanyr$rs rr)zSemaphore.lockedgs9{aC AADM,?RAAA A A CrctK|s|xjdzc_dS|jtj|_|}|j| |d{V|j|n#|j|wxYwnL#tj $r:| s$|xjdz c_| wxYw|jdkr| dS)a5Acquire a semaphore. If the internal counter is larger than zero on entry, decrement it by one and return True immediately. If it is zero on entry, block, waiting until some other coroutine has called release() to make it larger than 0, and then return True. r TNr) r)rXr$rArBrCrDrErFr rGr; _wake_up_nextrIs rrzSemaphore.acquirels@{{}}  KK1 KK4 = '-//DMnn,,.. S!!!  *  $$S)))) $$S)))))(   ==?? % q ""$$$    ;??    ts B-C -C  C A DcN|xjdz c_|dS)zRelease a semaphore, incrementing the internal counter by one. When it was zero on entry and another coroutine is waiting for it to become larger than zero again, wake up that coroutine. r N)rXrrs rrzSemaphore.releases, q  rc|jsdS|jD]>}|s(|xjdzc_|ddS?dS)z)Wake up the first waiter that isn't done.Nr T)r$rQrXrRrIs rrzSemaphore._wake_up_nextsj}  F=  C88::  q t$$$   rru) rrrrSr&r1r)rrrrTrUs@rrrKs   *****CCC """H       rrc.eZdZdZdfd ZfdZxZS)rzA bounded semaphore implementation. This raises ValueError in release() if it would increase the value above the initial value. r cX||_t|dSr) _bound_valuer0r&)rryr6s rr&zBoundedSemaphore.__init__s)! rc|j|jkrtdtdS)Nz(BoundedSemaphore released too many times)rXrrxr0r)rr6s rrzBoundedSemaphore.releases< ;$+ + +GHH H rru)rrrrSr&rrTrUs@rrrs`       rrceZdZdZdZdZdZdS) _BarrierStatefillingdraining resettingbrokenN)rrrFILLINGDRAINING RESETTINGBROKENr rrrrs"GHI FFFrrceZdZdZdZfdZdZdZdZdZ dZ d Z d Z d Z d Zed ZedZedZxZS)ra Asyncio equivalent to threading.Barrier Implements a Barrier primitive. Useful for synchronizing a fixed number of tasks at known synchronization points. Tasks block on 'wait()' and are simultaneously awoken once they have all made their call. c|dkrtdt|_||_tj|_d|_dS)z1Create a barrier, initialised to 'parties' tasks.r zparties must be > 0rN)rxr_cond_partiesrr_state_count)rpartiess rr&zBarrier.__init__sA Q;;233 3[[  #+  rct}|jj}|js|d|jd|jz }d|ddd|dS)Nr+/r,r r-r.r/)r0r1rryr n_waitingrr3s rr1zBarrier.__repr__spgg  ;$&{ B A$.AA4<AA AE)3qt9))))))rc:K|d{VSrrkrs rrzBarrier.__aenter__s(YY[[       rc KdSrr )rargss rrzBarrier.__aexit__s  rcK|j4d{V|d{V |j}|xjdz c_|dz|jkr|d{Vn|d{V||xjdzc_|cdddd{VS#|xjdzc_|wxYw#1d{VswxYwYdS)zWait for the barrier. When the specified number of tasks have started waiting, they are all simultaneously awoken. Returns an unique and individual index number from 0 to 'parties-1'. Nr )r_blockrr_release_wait_exit)rindexs rrcz Barrier.waits:        ++--          q 19 ----//))))))))**,,&&&&&&& q                 q                  s)C'AB>$C'>&C$$C'' C14C1cKjfdd{Vjtjurt jddS)NcBjtjtjfvSr)rrrrrsrz Barrier._block..sDK& (?(rzBarrier aborted)rrnrrrr BrokenBarrierErrorrs`rrzBarrier._blocks j!!              ;-. . ./0ABB B / .rc^Ktj|_|jdSr)rrrrrtrs rrzBarrier._releases, $,  rcKjfdd{Vjtjtjfvrt jddS)Nc*jtjuSr)rrrrsrrzBarrier._wait..s$+]=R*RrzAbort or reset of barrier)rrnrrrrr rrs`rrz Barrier._waitsn j!!"R"R"R"RSSSSSSSSS ;=/1HI I I/0KLL L J Irc|jdkrK|jtjtjfvrtj|_|jdSdS)Nr)rrrrrrrrtrs rrz Barrier._exitsU ;!  {}6 8NOOO+3 J ! ! # # # # #  rc"K|j4d{V|jdkr%|jtjurtj|_ntj|_|jdddd{VdS#1d{VswxYwYdS)zReset the barrier to the initial state. Any tasks currently waiting will get the BrokenBarrier exception raised. Nr)rrrrrrrtrs rresetz Barrier.reset#s : $ $ $ $ $ $ $ ${Q;m&==="/"9DK+3 J ! ! # # # $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $sAA>> B BcK|j4d{Vtj|_|jdddd{VdS#1d{VswxYwYdS)zPlace the barrier into a 'broken' state. Useful in case of error. Any currently waiting tasks and tasks attempting to 'wait()' will have BrokenBarrierError raised. N)rrrrrtrs rabortz Barrier.abort2s : $ $ $ $ $ $ $ $'.DK J ! ! # # # $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $s+A AAc|jS)z8Return the number of tasks required to trip the barrier.)rrs rrzBarrier.parties<s }rc:|jtjur|jSdS)zrs!! * C!C!C!C!C! !7C!C!C!L:&:&:&:&:&F ":&:&:&zm(m(m(m(m($f&<m(m(m(`WWWWW$f&<WWWty$DIM3M3M3M3M3f$M3M3M3M3M3r__pycache__/format_helpers.cpython-311.opt-1.pyc000064400000010067152533123130015431 0ustar00 !A?hd \ddlZddlZddlZddlZddlZddlmZdZdZdZ d dZ d d Z dS) N) constantsc8tj|}tj|r|j}|j|jfSt |tjrt|j St |tj rt|j SdSN) inspectunwrap isfunction__code__ co_filenameco_firstlineno isinstance functoolspartial_get_function_sourcefunc partialmethod)rcodes C/opt/alt/python-internal/lib64/python3.11/asyncio/format_helpers.pyrr s >$  D$7} $"566$ )**/#DI...$ /00/#DI... 4cxt||d}t|}|r|d|dd|dz }|S)Nz at r:r)_format_callbackr)rargs func_reprsources r_format_callback_sourcersQ tT22I !$ ' 'F 43F1I33q 333 rcg}|r|d|D|r1|d|Ddd|S)zFormat function arguments and keyword arguments. Special case for a single parameter: ('hello',) is formatted as ('hello'). c3>K|]}tj|VdSrreprlibrepr).0args r z*_format_args_and_kwargs..&s,773W\#&&777777rc3NK|] \}}|dtj|V!dS)=Nr)r"kvs rr$z*_format_args_and_kwargs..(s<II$!Q--GLOO--IIIIIIrz({})z, )extenditemsformatjoin)rkwargsr*s r_format_args_and_kwargsr.s E 8 77$777777 J II&,,..IIIIII ==5)) * **rcpt|tjr4t|||z}t |j|j|j|St|dr|j r|j }n.t|dr|j r|j }nt|}|t||z }|r||z }|S)N __qualname____name__) r rrr.rrrkeywordshasattrr1r2r!)rrr-suffixrs rrr,s$ )**M(v66? 49dmVLLLt^$$):% z " "t}M JJ  (v666I V rc|tjj}| tj}t jt j||d}| |S)zlReplacement for traceback.extract_stack() that only does the necessary work for asyncio debug mode. NF)limit lookup_lines) sys _getframef_backrDEBUG_STACK_DEPTH traceback StackSummaryextract walk_stackreverse)fr7stacks r extract_stackrD>sj y MOO " }+  " * *9+?+B+B168= + ? ?E MMOOO Lr)r/)NN) rrr r9r=r/rrrr.rrDrrrFs     + + +$r__pycache__/threads.cpython-311.opt-1.pyc000064400000002441152533123130014046 0ustar00 !A?h0dZddlZddlZddlmZdZdZdS)z6High-level support for working with threads in asyncioN)events) to_threadcKtj}tj}t j|j|g|Ri|}|d|d{VS)aAsynchronously run function *func* in a separate thread. Any *args and **kwargs supplied for this function are directly passed to *func*. Also, the current :class:`contextvars.Context` is propagated, allowing context variables from the main thread to be accessed in the separate thread. Return a coroutine that can be awaited to get the eventual result of *func*. N)rget_running_loop contextvars copy_context functoolspartialrunrun_in_executor)funcargskwargsloopctx func_calls rsU<<  7 7 7 7 7r__pycache__/trsock.cpython-311.opt-1.pyc000064400000012434152533123130013724 0ustar00 !A?h (ddlZGddZdS)NceZdZdZdZdejfdZedZedZ edZ dZ d Z d Z d Zd Zd ZdZdZdZdZdZdZdZdZdS)TransportSocketzA socket-like wrapper for exposing real transport sockets. These objects can be safely returned by APIs like `transport.get_extra_info('socket')`. All potentially disruptive operations (like "socket.close()") are banned. _socksockc||_dSNr)selfrs ;/opt/alt/python-internal/lib64/python3.11/asyncio/trsock.py__init__zTransportSocket.__init__s  c|jjSr )rfamilyr s r rzTransportSocket.familys z  r c|jjSr )rtypers r rzTransportSocket.types zr c|jjSr )rprotors r rzTransportSocket.protos zr cjd|d|jd|jd|j}|dkrh |}|r|d|}n#t j$rYnwxYw |}|r|d|}n#t j$rYnwxYw|dS) Nz)filenorrr getsocknamesocketerror getpeername)r sladdrraddrs r __repr__zTransportSocket.__repr__s "4;;== " "k " ",0I " "Z " " ;;==B   ((**.--e--A<     ((**.--e--A<    wwws$ A''A98A9=BB-,B-c td)Nz/Cannot serialize asyncio.TransportSocket object) TypeErrorrs r __getstate__zTransportSocket.__getstate__5sIJJJr c4|jSr )rrrs r rzTransportSocket.fileno8sz  """r c4|jSr )rduprs r r&zTransportSocket.dup;sz~~r c4|jSr )rget_inheritablers r r(zTransportSocket.get_inheritable>sz))+++r c:|j|dSr )rshutdown)r hows r r*zTransportSocket.shutdownAs  C     r c&|jj|i|Sr )r getsockoptr argskwargss r r-zTransportSocket.getsockoptFs$tz$d5f555r c*|jj|i|dSr )r setsockoptr.s r r2zTransportSocket.setsockoptIs" t.v.....r c4|jSr )rrrs r rzTransportSocket.getpeernameLz%%'''r c4|jSr )rrrs r rzTransportSocket.getsocknameOr4r c4|jSr )r getsockbynamers r r7zTransportSocket.getsockbynameRsz'')))r c0|dkrdStd)Nrzr r rrspIV]!!X!X  X .KKK###   ,,,!!! 666///((((((***LLL CCCCCr r)rrr>r r rIsT ^C^C^C^C^C^C^C^C^C^Cr __pycache__/runners.cpython-311.opt-2.pyc000064400000020706152533123130014115 0ustar00 !A?hdZddlZddlZddlZddlZddlZddlZddlmZddlm Z ddlm Z ddlm Z Gdd ej Z Gd d Zdd d ZdZdS))RunnerrunN) coroutines)events) exceptions)tasksceZdZdZdZdZdS)_Statecreated initializedclosedN)__name__ __module__ __qualname__CREATED INITIALIZEDCLOSEDn  )  !$rc.||SN) _lazy_initr#s r __enter__zRunner.__enter__:s  rc.|dSr&)close)r#exc_typeexc_valexc_tbs r__exit__zRunner.__exit__>s rc" |jtjurdS |j}t ||||||jrtj d| d|_tj |_dS#|jrtj d| d|_tj |_wxYwr&) rr rr_cancel_all_tasksrun_until_completeshutdown_asyncgensshutdown_default_executorr"rset_event_loopr+r)r#loops rr+z Runner.closeAs, ;f0 0 0 F (:D d # # #  # #D$;$;$=$= > > >  # #D$B$B$D$D E E E# ,%d+++ JJLLLDJ -DKKK # ,%d+++ JJLLLDJ -DK ' ' ' 's A$CA Dc: ||jSr&)r'rr(s rget_loopzRunner.get_loopQs) zrcontextc tj|s"td|t jt d|||j}|j ||}tj tj urxtjtjtjurNt%j|j|} tjtj|n#t$rd}YnwxYwd}d|_ |j ||Jtjtj|ur+tjtjtjSSS#t.j$r<|jdkr/t3|dd}||dkrt5wxYw#|Jtjtj|ur+tjtjtjwwwxYw)Nz"a coroutine was expected, got {!r}z7Runner.run() cannot be called from a running event loopr9) main_taskruncancel)r iscoroutine ValueErrorformatr_get_running_loop RuntimeErrorr'r r create_task threadingcurrent_thread main_threadsignal getsignalSIGINTdefault_int_handler functoolspartial _on_sigintr!r2rCancelledErrorgetattrKeyboardInterrupt)r#coror:tasksigint_handlerr=s rrz Runner.runVs8=%d++ PAHHNNOO O  # % % 1IKK K  ?mGz%%dG%<<  $ & &)*?*A*A A A //63MMM&.t$OOON & fm^<<<< & & &"&  & "N ! I:0066*$V]33~EE fmV-GHHHH+E(   $q(("4T::'HHJJ!OO+---   *$V]33~EE fmV-GHHHH+Es,?D D.-D.;F""A G--G00AH?c|jtjurtd|jtjurdS|j@t j|_|j s t j |jd|_ n||_|j |j |j tj|_tj|_dS)NzRunner is closedT)rr rrBrrrnew_event_looprr"r5r set_debug contextvars copy_contextr r(s rr'zRunner._lazy_inits ;&- ' '122 2 ;&, , , F   %.00DJ' ,%dj111'+$++--DJ ; " J  - - -#022 ( rc|xjdz c_|jdkrE|s1||jddSt )NrcdSr&rrrrz#Runner._on_sigint..sDr)r!donecancelrcall_soon_threadsaferP)r#signumframer<s rrMzRunner._on_sigintsn "  A % %inn.>.> %       J + +LL 9 9 9 F!!!r) rrrr$r)r/r+r8rr'rMrrrrrs6!%4%%%%%(((  $(+I+I+I+I+IZ)))&"""""rrrc tjtdt|5}||cdddS#1swxYwYdS)Nz8asyncio.run() cannot be called from a running event loopra)rrArBrr)mainrrunners rrrs.!!- FHH H e    zz$                  sAAAcbtj|}|sdS|D]}||tj|ddi|D]V}|r|+|d||dWdS)Nreturn_exceptionsTz1unhandled exception during asyncio.run() shutdown)message exceptionrR)r all_tasksr]r2gather cancelledrhcall_exception_handler)r6 to_cancelrRs rr1r1s%%I  EL)LtLLMMM >>     >>   '  ' 'N!^^--))    r)__all__rWenumrKrDrGsysrrrr Enumr rrr1rrrrss&   TY H"H"H"H"H"H"H"H"V     Br__pycache__/windows_events.cpython-311.opt-2.pyc000064400000131527152533123130015503 0ustar00 !A?h ddlZejdkr edddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl m Z ddl mZddl mZddl mZdd l mZdd l mZdd l mZdd l mZdd lmZdZejZejZdZdZdZdZGddejZGddejZ Gdde Z!Gdde Z"Gdde#Z$Gddej%Z&Gdd ej'Z(Gd!d"Z)Gd#d$ej*Z+e&Z,Gd%d&e j-Z.Gd'd(e j-Z/e/Z0dS))Nwin32z win32 only)events)base_subprocess)futures) exceptions)proactor_events)selector_events)tasks) windows_utils)logger)SelectorEventLoopProactorEventLoop IocpProactorDefaultEventLoopPolicyWindowsSelectorEventLoopPolicyWindowsProactorEventLoopPolicyiigMbP?g?cVeZdZ ddfd ZfdZdZd fd ZfdZfdZxZ S) _OverlappedFutureNloopcxt||jr|jd=||_dSNr)super__init___source_traceback_ov)selfovr __class__s C/opt/alt/python-internal/lib64/python3.11/asyncio/windows_events.pyrz_OverlappedFuture.__init__6s? d###  ! +&r*ct}|j8|jjrdnd}|dd|d|jjdd|S)Npending completedrz overlapped=)r _repr_inforr%insertaddressrinfostater!s r"r)z_OverlappedFuture._repr_info<shww!!## 8 !%!1BII{E KKI%II483CIIII J J J r#c|jdS |jnH#t$r;}d||d}|jr |j|d<|j|Yd}~nd}~wwxYwd|_dS)Nz&Cancelling an overlapped future failedmessage exceptionfuturesource_traceback)rcancelOSErrorr_loopcall_exception_handler)rexccontexts r"_cancel_overlappedz$_OverlappedFuture._cancel_overlappedCs 8  F 7 HOO     7 7 7C G % E.2.D*+ J - -g 6 6 6 6 6 6 6 6 7s% A*1A%%A*cp|t|SN)msg)r;rr5rr>r!s r"r5z_OverlappedFuture.cancelSs- !!!ww~~#~&&&r#crt||dSN)r set_exceptionr;rr2r!s r"rBz_OverlappedFuture.set_exceptionWs3 i((( !!!!!r#cXt|d|_dSrA)r set_resultrrresultr!s r"rEz_OverlappedFuture.set_result[s& 6"""r#rA) __name__ __module__ __qualname__rr)r;r5rBrE __classcell__r!s@r"rr0s $(  ''''''"""""r#rcbeZdZ ddfd ZdZfdZdZdZd fd Zfd Z fd Z xZ S) _BaseWaitHandleFutureNrct||jr|jd=||_||_||_d|_dS)NrrT)rrrr_handle _wait_handle _registered)rr handle wait_handlerr!s r"rz_BaseWaitHandleFuture.__init__cs\ d###  ! +&r* ' r#cRtj|jdtjkSNr)_winapiWaitForSingleObjectrP WAIT_OBJECT_0rs r"_pollz_BaseWaitHandleFuture._pollqs$+DL!<<%& 'r#c6t}|d|jd|j-|rdnd}|||j|d|jd|S)Nzhandle=r'signaledwaitingz wait_handle=)rr)appendrPr[rQr,s r"r)z _BaseWaitHandleFuture._repr_infovsww!!## /dl///000 < #"&**,,=JJIE KK      ( KK=t'8=== > > > r#cd|_dSrA)r)rfuts r"_unregister_wait_cbz)_BaseWaitHandleFuture._unregister_wait_cbsr#c^|jsdSd|_|j}d|_ tj|nc#t$rV}|jtjkr7d||d}|jr |j|d<|j |Yd}~dSYd}~nd}~wwxYw| ddSNFz$Failed to unregister the wait handler0r4) rRrQ _overlappedUnregisterWaitr6winerrorERROR_IO_PENDINGrr7r8rbrrTr9r:s r"_unregister_waitz&_BaseWaitHandleFuture._unregister_waits  F '     &{ 3 3 3 3   |{;;;E!$" )I262HG./ 11':::<;;;;    &&&&&s5 BABBcp|t|Sr=)rjrr5r?s r"r5z_BaseWaitHandleFuture.cancels- ww~~#~&&&r#cr|t|dSrA)rjrrBrCs r"rBz#_BaseWaitHandleFuture.set_exceptions3  i(((((r#cr|t|dSrA)rjrrErFs r"rEz _BaseWaitHandleFuture.set_results3  6"""""r#rA) rHrIrJrr[r)rbrjr5rBrErKrLs@r"rNrN`s<8<        '''  '''0'''''')))))#########r#rNc@eZdZ ddfd ZdZfdZfdZxZS)_WaitCancelFutureNrc`t||||d|_dS)Nr)rr_done_callback)rr eventrTrr!s r"rz_WaitCancelFuture.__init__s2 UKd;;;"r#c td)Nz'_WaitCancelFuture must not be cancelled) RuntimeErrorrZs r"r5z_WaitCancelFuture.cancelsDEEEr#ct||j||dSdSrA)rrErqrFs r"rEz_WaitCancelFuture.set_resultsF 6"""   *    % % % % % + *r#ct||j||dSdSrA)rrBrqrCs r"rBz_WaitCancelFuture.set_exceptionsF i(((   *    % % % % % + *r#)rHrIrJrr5rErBrKrLs@r"roros8<####### FFF&&&&& &&&&&&&&&r#roc4eZdZddfd ZfdZdZxZS)_WaitHandleFutureNrct||||||_d|_t jdddd|_d|_dS)NrTF)rr _proactor_unregister_proactorre CreateEvent_event _event_fut)rr rSrTproactorrr!s r"rz_WaitHandleFuture.__init__sV V[t<<<!$(!!-dD%FF r#c|j'tj|jd|_d|_|j|jd|_t|dSrA) r}rW CloseHandler~rz _unregisterrrrb)rrar!s r"rbz%_WaitHandleFuture._unregister_wait_cbsk ; "   , , ,DK"DO ""48,,, ##C(((((r#c|jsdSd|_|j}d|_ tj||jnc#t $rV}|jtjkr7d||d}|jr |j|d<|j |Yd}~dSYd}~nd}~wwxYw|j |j|j |_dSrd)rRrQreUnregisterWaitExr}r6rgrhrr7r8rz _wait_cancelrbr~ris r"rjz"_WaitHandleFuture._unregister_waits  F '     (dk B B B B   |{;;;E!$" )I262HG./ 11':::<;;;; .55dk6:6NPPs; BABB)rHrIrJrrbrjrKrLs@r"rxrxstBF)))))$PPPPPPPr#rxc2eZdZ dZdZdZdZdZeZdS) PipeServerc||_tj|_d|_d|_|d|_dSNT)_addressweakrefWeakSet_free_instances_pipe_accept_pipe_future_server_pipe_handle)rr+s r"rzPipeServer.__init__sC &00 #' --d33 r#cJ|j|dc}|_|SNF)rr)rtmps r"_get_unconnected_pipez PipeServer._get_unconnected_pipes& *d&>&>u&E&ETZ r#c |rdStjtjz}|r|tjz}tj|j|tjtjztj ztj tj tj tj tj}tj|}|j||SrA)closedrWPIPE_ACCESS_DUPLEXFILE_FLAG_OVERLAPPEDFILE_FLAG_FIRST_PIPE_INSTANCECreateNamedPiperPIPE_TYPE_MESSAGEPIPE_READMODE_MESSAGE PIPE_WAITPIPE_UNLIMITED_INSTANCESr BUFSIZENMPWAIT_WAIT_FOREVERNULL PipeHandleradd)rfirstflagshpipes r"rzPipeServer._server_pipe_handle s ;;== 4*W-II  ; W: :E  # M5  %(E E     ,  !=#8  (',  8 8'**   &&& r#c|jduSrA)rrZs r"rzPipeServer.closeds %&r#c|j |jd|_|jG|jD]}|d|_d|_|jdSdSrA)rr5rrcloserclear)rrs r"rzPipeServer.close"s  # /  $ + + - - -'+D $ = $,   DJ DM  & & ( ( ( ( ( % $r#N) rHrIrJrrrrr__del__r#r"rrse444$''' ) ) )GGGr#rceZdZdS)_WindowsSelectorEventLoopN)rHrIrJrr#r"rr1s11r#rcBeZdZ dfd ZfdZdZdZ ddZxZS)rNcj|t}t|dSrA)rrr)rrr!s r"rzProactorEventLoop.__init__8s0  #~~H """""r#c ||jt|jQ|jj}|j|!|js|j |d|_dSdS#|jO|jj}|j|!|js|j |d|_wxYwrA) call_soon_loop_self_readingr run_forever_self_reading_futurerr5r%rzr)rr r!s r"rzProactorEventLoop.run_forever=s 1 NN42 3 3 3 GG   ! ! !(4.2)00222>"*>N..r222,0)))54t(4.2)00222>"*>N..r222,0)0000s :BAC/cK|j|}|d{V}|}|||d|i}||fS)Naddrextra)rz connect_pipe_make_duplex_pipe_transport)rprotocol_factoryr+frprotocoltranss r"create_pipe_connectionz(ProactorEventLoop.create_pipe_connectionPsl N ' ' 0 0wwwwww##%%00x8>7H1JJhr#crKtdfd gS)Ncd} |r||}j|r|dS}||di}|dSj|}|_ | dS#t$rG|r,| dkr| YdSt$r}|rF| dkr.d||d|njrt#jd|d Yd}~dSd}~wt&j$r|r|YdSYdSwxYw) NrrrzPipe accept failed)r1r2rzAccept pipe failed on pipe %rT)exc_info)rGrdiscardrrrrrz accept_piperadd_done_callbackBrokenPipeErrorfilenorr6r8_debugr warningrCancelledError) rrrr9r+loop_accept_piperrservers r"rz>ProactorEventLoop.start_serving_pipe..loop_accept_pipe[sJD) 6 A88::D*224888}} //11H44hvw.?5AAA3355<FN..t44*./*##$455555+# 1 1 1!DKKMMR//JJLLL/000000 1 1 1 8DKKMMR////#7%( $11 JJLLLL[8N#B#'$8888/000000000, ! ! !!JJLLLLLL!!! !s2AC:CCA G# G,A;F--(GGrA)rr)rrr+rrs```@@r"start_serving_pipez$ProactorEventLoop.start_serving_pipeXsgG$$+ 6+ 6+ 6+ 6+ 6+ 6+ 6+ 6+ 6+ 6Z '(((xr#c K|} t||||||||f| |d| } | d{VnN#ttf$rt$r0| | d{VwxYw| S)N)waiterr) create_future_WindowsSubprocessTransport SystemExitKeyboardInterrupt BaseExceptionr_wait) rrargsshellstdinstdoutstderrbufsizerkwargsrtransps r"_make_subprocess_transportz,ProactorEventLoop._make_subprocess_transports##%%,T8T5-2FFG74:%770677 LLLLLLLL-.        LLNNN,,..    s 8A BrA) rHrIrJrrrrrrKrLs@r"rr5s<###### 11111&111j04r#rceZdZ efdZdZdZdZddZdZ d d Z d d Z d d Z d d Z d!d Zd dZdZdZdZdZdZddZdZdZdZdZdZdZddZdZdZdZdS)"rcd|_g|_tjtjt d||_i|_tj |_ g|_ tj |_ dSrV) r7_resultsreCreateIoCompletionPortINVALID_HANDLE_VALUEr_iocp_cacherrrR _unregistered_stopped_serving)r concurrencys r"rzIocpProactor.__init__sg   7  ,dA{DD  "?,, ' 1 1r#c2|jtddS)NzIocpProactor is closed)rrtrZs r" _check_closedzIocpProactor._check_closeds! : 788 8  r#cdt|jzdt|jzg}|j|dd|jjdd|dS)Nzoverlapped#=%sz result#=%sr< r()lenrrrr_r!rHjoin)rr-s r"__repr__zIocpProactor.__repr__sl 3t{#3#33s4=1113 :  KK ! ! ! N333SXXd^^^^DDr#c||_dSrA)r7)rrs r"set_loopzIocpProactor.set_loops  r#Ncn|js|||j}g|_ |d}S#d}wxYwrA)rr[)rtimeoutrs r"selectzIocpProactor.selectsJ} JJw   m  CC$CJJJJs04cb|j}|||SrA)r7rrE)rvalueras r"_resultzIocpProactor._results,j&&(( u r#rc||tjt} t |t jr*||||n(|||n%#t$r| dcYSwxYwd}| |||S)Nr#c |S#t$r3}|jtjtjfvrt |jd}~wwxYwrA getresultr6rgreERROR_NETNAME_DELETEDERROR_OPERATION_ABORTEDConnectionResetErrorrrkeyr r9s r" finish_recvz&IocpProactor.recv..finish_recvf ||~~%   B?c||tjt} t |t jr*||||n(|||n%#t$r| dcYSwxYwd}| |||S)Nrc |S#t$r3}|jtjtjfvrt |jd}~wwxYwrArrs r"rz+IocpProactor.recv_into..finish_recvrr) rrerrr r  WSARecvIntor ReadFileIntorrr rrbufrr rs r" recv_intozIocpProactor.recv_intos   &&&  #D ) ) #$ .. 4t{{}}c59999 s333 # # #<<?? " " " #   ~~b$ 444rc2||tjt} ||||n%#t $r|dcYSwxYwd}||||S)Nr#Nc |S#t$rN}|jtjkrYd}~dS|jtjtjfvrt|jd}~wwxYw)Nr rr6rgreERROR_PORT_UNREACHABLErrrrrs r"rz*IocpProactor.recvfrom..finish_recvs ||~~%   <;#EEE$99999.finish_recvs ||~~%   <;#EEE"77777.finish_send.rr)rrerr WSASendTorr )rrrrrr r*s r"sendtozIocpProactor.sendto(sm   &&&  #D ) ) T[[]]C555   ~~b$ 444r#cj||tjt}t |t jr*||||n(|||d}| |||S)Nc |S#t$r3}|jtjtjfvrt |jd}~wwxYwrArrs r"r*z&IocpProactor.send..finish_sendBrr) rrerrr r WSASendr WriteFiler )rrrrr r*s r"sendzIocpProactor.send:s   &&&  #D ) ) dFM * * - JJt{{}}c5 1 1 1 1 LL , , ,   ~~b$ 444r#c||jtjt }|fd}d}|||}||}tj ||j |S)NcJ|tjd}t jtj|   fS)Nz@P) rstructpackr setsockoptr  SOL_SOCKETreSO_UPDATE_ACCEPT_CONTEXT settimeout gettimeout getpeername)rrr rrlisteners r" finish_acceptz*IocpProactor.accept..finish_acceptTs LLNNN+dHOO$5$566C OOF-'@# G G G OOH//11 2 2 2))+++ +r#clK |d{VdS#tj$r|wxYwrA)rrr)r3rs r" accept_coroz(IocpProactor.accept..accept_coro]sN  ,     s%3r) r_get_accept_socketfamilyrerrAcceptExrr r ensure_futurer7)rr<r r=r?r3corors ` @r"acceptzIocpProactor.acceptNs   ***&&x77  #D ) ) HOO%%t{{}}555 , , , , , ,   Hm<<{64(( Dtz2222 r#cjtjkrWtj||j}|d|S|  tj j nL#t$r?}|j tjkrddkrYd}~nd}~wwxYwtjt$}||fd}|||S)Nrrc|tjtjdSrV)rr6r r7reSO_UPDATE_CONNECT_CONTEXT)rrr rs r"finish_connectz,IocpProactor.connect..finish_connects; LLNNN OOF-'A1 F F FKr#)typer  SOCK_DGRAMre WSAConnectrr7rrEr BindLocalrAr6rgerrno WSAEINVAL getsocknamerr ConnectExr )rrr+raer rIs ` r"connectzIocpProactor.connectjsS 9) ) )  "4;;==' : : :***,,C NN4 J   &&&   !$++-- = = = =   zU_,,!!!$))*))))    #D ) ) T[[]]G,,,     ~~b$777s,B11 C:;5C55C:c N||tjt}|dz}|dz dz}||t j||||ddd}||||S)Nl rc |S#t$r3}|jtjtjfvrt |jd}~wwxYwrArrs r"finish_sendfilez.IocpProactor.sendfile..finish_sendfilerr) rrerr TransmitFilermsvcrt get_osfhandler ) rsockfileoffsetcountr offset_low offset_highrWs r"sendfilezIocpProactor.sendfiles   &&&  #D ) )k) |{2   ,T[[]];;"Kq! % % %    ~~b$888r#c|tjt}|}|r|Sfd}|||S)Nc0|SrA)r)rrr rs r"finish_accept_pipez4IocpProactor.accept_pipe..finish_accept_pipes LLNNNKr#)rrerrConnectNamedPiperrr )rrr connectedrds ` r"rzIocpProactor.accept_pipes   &&&  #D ) )'' 66  &<<%% %     ~~b$(:;;;r#c*Kt} tj|}n`#t$r }|jtjkrYd}~nd}~wwxYwt |dzt}tj |d{Vvtj |S)NT) CONNECT_PIPE_INIT_DELAYre ConnectPiper6rgERROR_PIPE_BUSYminCONNECT_PIPE_MAX_DELAYr sleepr r)rr+delayrSr9s r"rzIocpProactor.connect_pipes' % $099   <;#>>>?>>>>   #9::E+e$$ $ $ $ $ $ $ $ %'///s! A AA c2 |||dSr)_wait_for_handle)rrSrs r"wait_for_handlezIocpProactor.wait_for_handles! $$VWe<<.finish_wait_for_handles7799 r#r)rrWINFINITEmathceilrerrRegisterWaitWithQueuerr+ror7rxrr) rrSr _is_cancelmsr rTrxrs @r"rqzIocpProactor._wait_for_handles  ?!BB7S=))B #D ) )!7 DJ B00  3!"fk KKKAA!"fk4'+z333A  (#B'     $%b!-C"D BJr#c||jvrJ|j|tj||jdddSdSrV)rRrrerrrrobjs r"rz IocpProactor._register_with_iocpsX d& & &    % % %  .szz||TZA N N N N N ' &r#cL|t||j}|jr|jd=|jsP |dd|}||n,#t $r}||Yd}~nd}~wwxYw||||f|j|j <|Sr) rrr7rr%rEr6rBrr+)rr rcallbackrrrRs r"r zIocpProactor._registers  btz 2 2 2  (#B'z $  $ tR00 U#### # # #"""""""" #$%b#x"8 BJs A%% B/B  Bcd ||j|dSrA)rrr_)rr s r"rzIocpProactor._unregisters8  !!"%%%%%r#cXtj|}|d|SrV)r r9)rrAss r"r@zIocpProactor._get_accept_socket's% M& ! ! Qr#c $|t}nF|dkrtdtj|dz}|tkrtd t j|j|}|n]d}|\}}}} |j|\}} } } nq#t$rd|j r$|j dd||||fzd|dtj fvrtj|YwxYw| |jvr|n|s | ||| } || |j|nF#t,$r9} || |j|Yd} ~ nd} ~ wwxYwd}n#d}wxYw{|jD]"} |j| jd#|jdS) Nrznegative timeoutrvztimeout too bigTz8GetQueuedCompletionStatus() returned an unexpected eventz)err=%s transferred=%s key=%#x address=%#x)r1status)ry ValueErrorrzr{reGetQueuedCompletionStatusrrpopKeyErrorr7 get_debugr8rrWrrr5donerErr_r6rBrr+r)rrr~rerr transferredrr+rr rrrrRs r"r[zIocpProactor._poll,sy ?BB q[[/00 07S=))BX~~ !2333&  :4:rJJF~B-3 *Cc7 '+{w'?'?$2sHH   :''))J55%7#N&);W%E$F77q+"BCCC',,, d+++ VVXX  $H[#r::E LL'''M((++++ ,,,OOA&&&M((++++++++,AAAHHHHM& R$ . .B KOOBJ - - - -   """""sC:BA+DD> E; 0G; F>/F94G9F>>GGc:|j|dSrA)rrrs r" _stop_servingzIocpProactor._stop_servinges! !!#&&&&&r#c|jdSt|jD]\}}}}|rt |t r2 |H#t$rB}|j 1d||d}|j r |j |d<|j |Yd}~d}~wwxYwd}tj }||z} |jrs| tj kr@tjd|tj |z tj |z} |||jsg|_t%j|jd|_dS)NzCancelling a future failedr0r4g?z,%r is running after closing for %.1f seconds)rlistrvalues cancelledr ror5r6r7rr8time monotonicr debugr[rrWr) rrar rrr9r: msg_update start_timenext_msgs r"rzIocpProactor.closeks :  F'+4;+=+=+?+?&@&@ C C "CS(}} CC!233 C CJJLLLL C C Cz-'C),&)## 0P:=:OG$67 99'BBB C ^%%  *k #4>++++ K!4>#3#3j#@BBB>++j8 JJz " " "k # DJ''' s#A88 C8B??Cc.|dSrA)rrZs r"rzIocpProactor.__del__s r#rA)rr$) rHrIrJryrrrrrrrrr!r'r,r1rErSrarrrrrrqrr rr@r[rrrrr#r"rrs-#+2222999EEE     5555.5555.55550555505555$5555(8888>999*<<<"000&====   DOOO@&&& 7#7#7#7#r''' ---^r#rceZdZdZdS)rc tj|f|||||d|_fd}jjt jj} | |dS)N)rrrrrcdj}|dSrA)_procpoll_process_exited)r returncoders r"rz4_WindowsSubprocessTransport._start..callbacks.**J   , , , , ,r#) r Popenrr7rzrrintrPr) rrrrrrrrrrs ` r"_startz"_WindowsSubprocessTransport._starts"( 'U6&''%''  - - - - - J 0 0TZ5G1H1H I I H%%%%%r#N)rHrIrJrrr#r"rrs# & & & & &r#rceZdZeZdS)rN)rHrIrJr _loop_factoryrr#r"rr%MMMr#rceZdZeZdS)rN)rHrIrJrrrr#r"rrrr#r)1sysplatform ImportErrorrerWrNrzrYr r4rrrrrrr r r r logr __all__rryERROR_CONNECTION_REFUSEDERROR_CONNECTION_ABORTEDrirmFuturerrNrorxobjectrBaseSelectorEventLooprBaseProactorEventLooprrBaseSubprocessTransportrrBaseDefaultEventLoopPolicyrrrrr#r"rsu4 <7 +l # ##  |   --------`G#G#G#G#G#GNG#G#G#T&&&&&-&&&01P1P1P1P1P-1P1P1Ph88888888v22222 E222ggggg=gggT||||||||~ & & & & &/"I & & &.&&&&&V%F&&&&&&&&V%F&&&8r#__pycache__/base_futures.cpython-311.pyc000064400000006520152533123130014146 0ustar00 !A?hxdZddlZddlmZddlmZdZdZdZd Z d Z d Z ej d Z dS) N) get_ident)format_helpersPENDING CANCELLEDFINISHEDc>t|jdo|jduS)zCheck for a Future. This returns True when obj is a Future instance or is advertising itself as duck-type compatible by setting _asyncio_future_blocking. See comment in Future for more details. _asyncio_future_blockingN)hasattr __class__r )objs A/opt/alt/python-internal/lib64/python3.11/asyncio/base_futures.pyisfuturers) CM#= > > 5  ( 46ct|}|sd}d}|dkr||dd}n|dkrAd||dd||dd}nJ|dkrDd||dd|dz ||dd}d |d S) #helper function for Future.__repr__c,tj|dS)Nr)r_format_callback_source)callbacks r format_cbz$_format_callbacks..format_cbs5hCCCrrrz{}, {}z{}, <{} more>, {}zcb=[])lenformat)cbsizers r_format_callbacksr s r77D  DDD qyy Yr!uQx   __YYr!uQx00))BqE!H2E2E F F  ' ' "Q%((;(;(,q(1 "R&)(<(<>> "<<<rc|jg}|jtkrV|j|d|jn1t j|j}|d||jr'|t|j|j r4|j d}|d|dd|d|S) rNz exception=zresult=rz created at r:r) _statelower _FINISHED _exceptionappendreprlibrepr_result _callbacksr _source_traceback)futureinforesultframes r_future_repr_infor1-s M   ! ! "D } !!   ( KK:V%6:: ; ; ; ;\&.11F KK*&** + + + : %f&788999 9(, 7%(77U1X77888 Krcldt|}d|jjd|dS)N <>)joinr1r __name__)r-r.s r _future_reprr8As; 88%f-- . .D 2v( 2 24 2 2 22r)__all__r(_threadrrr_PENDING _CANCELLEDr%rr r1recursive_reprr8rrrr>s     666((33333r__pycache__/events.cpython-311.pyc000064400000111663152533123130012770 0ustar00 !A?hodZdZddlZddlZddlZddlZddlZddlZddlm Z GddZ Gdd e Z Gd d Z Gd d Z GddZGddeZdaejZGddejZeZdZdZdZdZdZdZdZd"dZdZdZdZ d Z!eZ"eZ#eZ$eZ%eZ& dd!l'mZmZmZmZmZeZ(eZ)eZ*eZ+eZ,dS#e-$rYdSwxYw)#z!Event loop and event loop policy.)AbstractEventLoopPolicyAbstractEventLoopAbstractServerHandle TimerHandleget_event_loop_policyset_event_loop_policyget_event_loopset_event_loopnew_event_loopget_child_watcherset_child_watcher_set_running_loopget_running_loop_get_running_loopN)format_helpersc<eZdZdZdZd dZdZdZdZdZ d Z dS) rz1Object returned by callback registration methods.) _callback_args _cancelled_loop_source_traceback_repr __weakref___contextNc|tj}||_||_||_||_d|_d|_|jr-tj tj d|_ dSd|_ dS)NFr) contextvars copy_contextrrrrrr get_debugr extract_stacksys _getframer)selfcallbackargsloopcontexts ;/opt/alt/python-internal/lib64/python3.11/asyncio/events.py__init__zHandle.__init__#s ?!.00G  !  :   ! ! *%3%A a  &"&"D " " "&*D " " "c@|jjg}|jr|d|j2|t j|j|j|jr4|jd}|d|dd|d|S)N cancelledz created at r:r) __class____name__rappendrr_format_callback_sourcerr)r$infoframes r) _repr_infozHandle._repr_info2s'( ? % KK $ $ $ > % KK> ,, - - -  ! =*2.E KK;eAh;;q;; < < < r+c|j|jS|}dd|S)Nz<{}> )rr6formatjoin)r$r4s r)__repr__zHandle.__repr__>s= : !:   }}SXXd^^,,,r+c|jsDd|_|jrt||_d|_d|_dSdS)NT)rrr reprrrrr$s r)cancelz Handle.cancelDsT "DOz##%% ("$ZZ !DNDJJJ  r+c|jSN)rr>s r)r-zHandle.cancelledOs r+cB |jj|jg|jRn}#tt f$rt $r_}tj|j|j}d|}|||d}|j r |j |d<|j |Yd}~nd}~wwxYwd}dS)NzException in callback )message exceptionhandlesource_traceback) rrunrr SystemExitKeyboardInterrupt BaseExceptionrr3rrcall_exception_handler)r$exccbmsgr(s r)_runz Handle._runRs 7 DM dn :tz : : : : :-.     7 7 77 ,,B/2//C G % E.2.D*+ J - -g 6 6 6 6 6 6 6 6 7s BABBrA) r1 __module__ __qualname____doc__ __slots__r*r6r;r?r-rOr+r)rrs;;I * * * *   ---   r+rcjeZdZdZddgZdfd ZfdZdZdZd Z d Z d Z d Z fd Z dZxZS)rz7Object returned by timed callback registration methods. _scheduled_whenNct|||||jr|jd=||_d|_dS)Nr.F)superr*rrWrV)r$whenr%r&r'r(r0s r)r*zTimerHandle.__init__ksI 4w777  ! +&r* r+ct}|jrdnd}||d|j|S)Nrzwhen=)rYr6rinsertrW)r$r4posr0s r)r6zTimerHandle._repr_inforsLww!!##?)aa C---... r+c*t|jSrA)hashrWr>s r)__hash__zTimerHandle.__hash__xsDJr+cZt|tr|j|jkStSrA isinstancerrWNotImplementedr$others r)__lt__zTimerHandle.__lt__{) e[ ) ) ,: + +r+ct|tr%|j|jkp||StSrArdrrW__eq__rerfs r)__le__zTimerHandle.__le__; e[ ) ) B: +At{{5/A/A Ar+cZt|tr|j|jkStSrArcrfs r)__gt__zTimerHandle.__gt__rir+ct|tr%|j|jkp||StSrArkrfs r)__ge__zTimerHandle.__ge__rnr+ct|tr@|j|jko/|j|jko|j|jko|j|jkSt SrA)rdrrWrrrrerfs r)rlzTimerHandle.__eq__sc e[ ) ) 9J%+-8Neo58J%+-8Ou'77 9r+c|js|j|tdSrA)rr_timer_handle_cancelledrYr?)r$r0s r)r?zTimerHandle.cancels= 5 J . .t 4 4 4 r+c|jS)zReturn a scheduled callback time. The time is an absolute timestamp, using the same time reference as loop.time(). )rWr>s r)rZzTimerHandle.whens zr+rA)r1rPrQrRrSr*r6rarhrmrprrrlr?rZ __classcell__)r0s@r)rrfsAAw'I               r+rcBeZdZdZdZdZdZdZdZdZ dZ d Z d S) rz,Abstract server returned by create_server().ct)z5Stop serving. This leaves existing connections open.NotImplementedErrorr>s r)closezAbstractServer.close!!r+ct)z4Get the event loop the Server object is attached to.rzr>s r)get_loopzAbstractServer.get_loopr}r+ct)z3Return True if the server is accepting connections.rzr>s r) is_servingzAbstractServer.is_servingr}r+cKt)zStart accepting connections. This method is idempotent, so it can be called when the server is already being serving. rzr>s r) start_servingzAbstractServer.start_serving "!r+cKt)zStart accepting connections until the coroutine is cancelled. The server is closed when the coroutine is cancelled. rzr>s r) serve_foreverzAbstractServer.serve_forever "!r+cKt)z*Coroutine to wait until service is closed.rzr>s r) wait_closedzAbstractServer.wait_closed !!r+c K|SrArTr>s r) __aenter__zAbstractServer.__aenter__s  r+cfK||d{VdSrA)r|r)r$rLs r) __aexit__zAbstractServer.__aexit__s=            r+N) r1rPrQrRr|rrrrrrrrTr+r)rrs66""""""""""""""""""!!!!!r+rc eZdZdZdZdZdZdZdZdZ dZ d Z d Z d d d Z d d dZd d dZdZdZd d ddZd d dZdZdZddddddZdJdZ dKd dddd d d d d d d d dZ dKejejd dd d d d d dd d ZdLdd!d"Zd#d d d d$d%Z dMd d d d d d&d'Z dMd dd d d dd(d)Z d d d d*d+Z! dKdddd d d d d,d-Z"d.Z#d/Z$e%j&e%j&e%j&d0d1Z'e%j&e%j&e%j&d0d2Z(d3Z)d4Z*d5Z+d6Z,d7Z-d8Z.d9Z/dJd:Z0d;Z1d<Z2d=Z3d>Z4dLd d!d?Z5d@Z6dAZ7dBZ8dCZ9dDZ:dEZ;dFZdIZ?d S)NrzAbstract event loop.ct)z*Run the event loop until stop() is called.rzr>s r) run_foreverzAbstractEventLoop.run_foreverr}r+ct)zpRun the event loop until a Future is done. Return the Future's result, or raise its exception. rz)r$futures r)run_until_completez$AbstractEventLoop.run_until_completes "!r+ct)zStop the event loop as soon as reasonable. Exactly how soon that is may depend on the implementation, but no more I/O callbacks should be scheduled. rzr>s r)stopzAbstractEventLoop.stops "!r+ct)z3Return whether the event loop is currently running.rzr>s r) is_runningzAbstractEventLoop.is_runningr}r+ct)z*Returns True if the event loop was closed.rzr>s r) is_closedzAbstractEventLoop.is_closedr}r+ct)zClose the loop. The loop should not be running. This is idempotent and irreversible. No other methods should be called after this one. rzr>s r)r|zAbstractEventLoop.closes "!r+cKt)z,Shutdown all active asynchronous generators.rzr>s r)shutdown_asyncgensz$AbstractEventLoop.shutdown_asyncgensrr+cKt)z.Schedule the shutdown of the default executor.rzr>s r)shutdown_default_executorz+AbstractEventLoop.shutdown_default_executorrr+ct)z3Notification that a TimerHandle has been cancelled.rz)r$rEs r)ruz)AbstractEventLoop._timer_handle_cancelledr}r+N)r(c&|jd|g|Rd|iS)Nrr() call_laterr$r%r(r&s r) call_soonzAbstractEventLoop.call_soons&tq(CTCCC7CCCr+ctrArz)r$delayr%r(r&s r)rzAbstractEventLoop.call_later !!r+ctrArz)r$rZr%r(r&s r)call_atzAbstractEventLoop.call_atrr+ctrArzr>s r)timezAbstractEventLoop.timerr+ctrArzr>s r) create_futurezAbstractEventLoop.create_futurerr+)namer(ctrArz)r$cororr(s r) create_taskzAbstractEventLoop.create_taskrr+ctrArzrs r)call_soon_threadsafez&AbstractEventLoop.call_soon_threadsaferr+ctrArz)r$executorfuncr&s r)run_in_executorz!AbstractEventLoop.run_in_executor!rr+ctrArz)r$rs r)set_default_executorz&AbstractEventLoop.set_default_executor$rr+r)familytypeprotoflagscKtrArz)r$hostportrrrrs r) getaddrinfozAbstractEventLoop.getaddrinfo)rr+cKtrArz)r$sockaddrrs r) getnameinfozAbstractEventLoop.getnameinfo- !!r+) sslrrrsock local_addrserver_hostnamessl_handshake_timeoutssl_shutdown_timeouthappy_eyeballs_delay interleavec KtrArz)r$protocol_factoryrrrrrrrrrrrrrs r)create_connectionz#AbstractEventLoop.create_connection0s"!r+dT) rrrbacklogr reuse_address reuse_portrrrc Kt)a#A coroutine which creates a TCP server bound to host and port. The return value is a Server object which can be used to stop the service. If host is an empty string or None all interfaces are assumed and a list of multiple sockets will be returned (most likely one for IPv4 and another one for IPv6). The host parameter can also be a sequence (e.g. list) of hosts to bind to. family can be set to either AF_INET or AF_INET6 to force the socket to use IPv4 or IPv6. If not set it will be determined from host (defaults to AF_UNSPEC). flags is a bitmask for getaddrinfo(). sock can optionally be specified in order to use a preexisting socket object. backlog is the maximum number of queued connections passed to listen() (defaults to 100). ssl can be set to an SSLContext to enable SSL over the accepted connections. reuse_address tells the kernel to reuse a local socket in TIME_WAIT state, without waiting for its natural timeout to expire. If not specified will automatically be set to True on UNIX. reuse_port tells the kernel to allow this endpoint to be bound to the same port as other existing endpoints are bound to, so long as they all set this flag when being created. This option is not supported on Windows. ssl_handshake_timeout is the time in seconds that an SSL server will wait for completion of the SSL handshake before aborting the connection. Default is 60s. ssl_shutdown_timeout is the time in seconds that an SSL server will wait for completion of the SSL shutdown procedure before aborting the connection. Default is 30s. start_serving set to True (default) causes the created server to start accepting connections immediately. When set to False, the user should await Server.start_serving() or Server.serve_forever() to make the server to start accepting connections. rz)r$rrrrrrrrrrrrrs r) create_serverzAbstractEventLoop.create_server:sp"!r+)fallbackcKt)zRSend a file through a transport. Return an amount of sent bytes. rz)r$ transportfileoffsetcountrs r)sendfilezAbstractEventLoop.sendfiletrr+F) server_siderrrcKt)z|Upgrade a transport to TLS. Return a new transport that *protocol* should start using immediately. rz)r$rprotocol sslcontextrrrrs r) start_tlszAbstractEventLoop.start_tls|s"!r+)rrrrrcKtrArz)r$rpathrrrrrs r)create_unix_connectionz(AbstractEventLoop.create_unix_connectionrr+)rrrrrrcKt)aWA coroutine which creates a UNIX Domain Socket server. The return value is a Server object, which can be used to stop the service. path is a str, representing a file system path to bind the server socket to. sock can optionally be specified in order to use a preexisting socket object. backlog is the maximum number of queued connections passed to listen() (defaults to 100). ssl can be set to an SSLContext to enable SSL over the accepted connections. ssl_handshake_timeout is the time in seconds that an SSL server will wait for the SSL handshake to complete (defaults to 60s). ssl_shutdown_timeout is the time in seconds that an SSL server will wait for the SSL shutdown to finish (defaults to 30s). start_serving set to True (default) causes the created server to start accepting connections immediately. When set to False, the user should await Server.start_serving() or Server.serve_forever() to make the server to start accepting connections. rz) r$rrrrrrrrs r)create_unix_serverz$AbstractEventLoop.create_unix_serversD"!r+)rrrcKt)aHandle an accepted connection. This is used by servers that accept connections outside of asyncio, but use asyncio to handle connections. This method is a coroutine. When completed, the coroutine returns a (transport, protocol) pair. rz)r$rrrrrs r)connect_accepted_socketz)AbstractEventLoop.connect_accepted_sockets"!r+)rrrrrallow_broadcastrcKt)aA coroutine which creates a datagram endpoint. This method will try to establish the endpoint in the background. When successful, the coroutine returns a (transport, protocol) pair. protocol_factory must be a callable returning a protocol instance. socket family AF_INET, socket.AF_INET6 or socket.AF_UNIX depending on host (or family if specified), socket type SOCK_DGRAM. reuse_address tells the kernel to reuse a local socket in TIME_WAIT state, without waiting for its natural timeout to expire. If not specified it will automatically be set to True on UNIX. reuse_port tells the kernel to allow this endpoint to be bound to the same port as other existing endpoints are bound to, so long as they all set this flag when being created. This option is not supported on Windows and some UNIX's. If the :py:data:`~socket.SO_REUSEPORT` constant is not defined then this capability is unsupported. allow_broadcast tells the kernel to allow this endpoint to send messages to the broadcast address. sock can optionally be specified in order to use a preexisting socket object. rz) r$rr remote_addrrrrrrrrs r)create_datagram_endpointz*AbstractEventLoop.create_datagram_endpointsB"!r+cKt)aRegister read pipe in event loop. Set the pipe to non-blocking mode. protocol_factory should instantiate object with Protocol interface. pipe is a file-like object. Return pair (transport, protocol), where transport supports the ReadTransport interface.rzr$rpipes r)connect_read_pipez#AbstractEventLoop.connect_read_pipe"!r+cKt)aRegister write pipe in event loop. protocol_factory should instantiate object with BaseProtocol interface. Pipe is file-like object already switched to nonblocking. Return pair (transport, protocol), where transport support WriteTransport interface.rzrs r)connect_write_pipez$AbstractEventLoop.connect_write_piperr+)stdinstdoutstderrcKtrArz)r$rcmdrrrkwargss r)subprocess_shellz"AbstractEventLoop.subprocess_shellrr+cKtrArz)r$rrrrr&rs r)subprocess_execz!AbstractEventLoop.subprocess_exec rr+ctrArzr$fdr%r&s r) add_readerzAbstractEventLoop.add_readerrr+ctrArzr$rs r) remove_readerzAbstractEventLoop.remove_readerrr+ctrArzrs r) add_writerzAbstractEventLoop.add_writerrr+ctrArzrs r) remove_writerzAbstractEventLoop.remove_writerrr+cKtrArz)r$rnbytess r) sock_recvzAbstractEventLoop.sock_recv#rr+cKtrArz)r$rbufs r)sock_recv_intoz AbstractEventLoop.sock_recv_into&rr+cKtrArz)r$rbufsizes r) sock_recvfromzAbstractEventLoop.sock_recvfrom)rr+cKtrArz)r$rr r s r)sock_recvfrom_intoz$AbstractEventLoop.sock_recvfrom_into,rr+cKtrArz)r$rdatas r) sock_sendallzAbstractEventLoop.sock_sendall/rr+cKtrArz)r$rraddresss r) sock_sendtozAbstractEventLoop.sock_sendto2rr+cKtrArz)r$rrs r) sock_connectzAbstractEventLoop.sock_connect5rr+cKtrArz)r$rs r) sock_acceptzAbstractEventLoop.sock_accept8rr+cKtrArz)r$rrrrrs r) sock_sendfilezAbstractEventLoop.sock_sendfile;rr+ctrArz)r$sigr%r&s r)add_signal_handlerz$AbstractEventLoop.add_signal_handlerArr+ctrArz)r$r!s r)remove_signal_handlerz'AbstractEventLoop.remove_signal_handlerDrr+ctrArz)r$factorys r)set_task_factoryz"AbstractEventLoop.set_task_factoryIrr+ctrArzr>s r)get_task_factoryz"AbstractEventLoop.get_task_factoryLrr+ctrArzr>s r)get_exception_handlerz'AbstractEventLoop.get_exception_handlerQrr+ctrArz)r$handlers r)set_exception_handlerz'AbstractEventLoop.set_exception_handlerTrr+ctrArzr$r(s r)default_exception_handlerz+AbstractEventLoop.default_exception_handlerWrr+ctrArzr0s r)rKz(AbstractEventLoop.call_exception_handlerZrr+ctrArzr>s r)r zAbstractEventLoop.get_debug_rr+ctrArz)r$enableds r) set_debugzAbstractEventLoop.set_debugbrr+)rNN)rNrA)@r1rPrQrRrrrrrr|rrrurrrrrrrrrrrrsocket AF_UNSPEC AI_PASSIVErrrrrrrrr subprocessPIPErrrrrrr rrrrrrrrr"r$r'r)r+r.r1rKr r6rTr+r)rrs """"""""""""""" " " """"""" """26DDDDD:>"""""6:""""""""""" )-d""""" =A""""""""""" "#!1"""""""""59"$4 "&!%!%$"""""598"&#$DT"&!%8"8"8"8"8"t"#'"""""%*(,.2-1 " " " " "*."4 "&!% """""*.""s"&!% """"""""""L"&!% " " " " " EI!"./q59d7;$ !"!"!"!"!"J " " " " " "&0_&0o&0o"""""%/O%/_%/_""""""""""""""""" """"""""""""""""""""""""""(,""""" """""" """""" """""""""""" """"""""r+rc0eZdZdZdZdZdZdZdZdS)rz-Abstract policy for accessing the event loop.ct)a>Get the event loop for the current context. Returns an event loop object implementing the AbstractEventLoop interface, or raises an exception in case no event loop has been set for the current context and the current policy does not specify to create one. It should never return None.rzr>s r)r z&AbstractEventLoopPolicy.get_event_loopis "!r+ct)z3Set the event loop for the current context to loop.rzr$r's r)r z&AbstractEventLoopPolicy.set_event_loopsr}r+ct)zCreate and return a new event loop object according to this policy's rules. If there's need to set this loop as the event loop for the current context, set_event_loop must be called explicitly.rzr>s r)r z&AbstractEventLoopPolicy.new_event_loopws "!r+ct)z$Get the watcher for child processes.rzr>s r)r z)AbstractEventLoopPolicy.get_child_watcherr}r+ct)z$Set the watcher for child processes.rz)r$watchers r)r z)AbstractEventLoopPolicy.set_child_watcherr}r+N) r1rPrQrRr r r r r rTr+r)rrfse77"""""""""""""""""r+rcTeZdZdZdZGddejZdZdZ dZ dZ dS) BaseDefaultEventLoopPolicyaDefault policy implementation for accessing the event loop. In this policy, each thread has its own event loop. However, we only automatically create an event loop by default for the main thread; other threads by default have no event loop. Other policies may have different rules (e.g. a single global event loop, or automatically creating an event loop per thread, or using some other notion of context to which an event loop is associated). NceZdZdZdZdS)!BaseDefaultEventLoopPolicy._LocalNF)r1rPrQr _set_calledrTr+r)_LocalrHs r+rJc8||_dSrA)rJ_localr>s r)r*z#BaseDefaultEventLoopPolicy.__init__skkmm r+cL|jjY|jjsMtjtjur'|||jj(tdtjj z|jjS)zvGet the event loop for the current context. Returns an instance of EventLoop or raises an exception. Nz,There is no current event loop in thread %r.) rLrrI threadingcurrent_thread main_threadr r RuntimeErrorrr>s r)r z)BaseDefaultEventLoopPolicy.get_event_loops K  %K+ &(**i.C.E.EEE    3 3 5 5 6 6 6 ;  $M!*!9!;!;!@ ABB B{  r+cd|j_|:t|ts%t dt |jd||j_dS)zSet the event loop.TNzs r)r z)BaseDefaultEventLoopPolicy.new_event_loops !!###r+) r1rPrQrRrVrNlocalrJr*r r r rTr+r)rFrFs  M$$$!!! !!!$$$$$r+rFceZdZdZdS) _RunningLoopr7N)r1rPrQloop_pidrTr+r)rYrYsHHHr+rYcDt}|td|S)zrReturn the running event loop. Raise a RuntimeError if there is none. This function is thread-specific. Nzno running event loop)rrQr's r)rrs(   D |2333 Kr+c^tj\}}||tjkr|SdSdS)zReturn the running event loop or None. This is a low-level function intended to be used by event loops. This function is thread-specific. N) _running_looprZosgetpid) running_looppids r)rrs;&.L#C29;;$6$6 $6$6r+cD|tjft_dS)zSet the running event loop. This is a low-level function intended to be used by event loops. This function is thread-specific. N)r_r`r^rZr\s r)rrs#BIKK0Mr+ctt5tddlm}|addddS#1swxYwYdS)NrDefaultEventLoopPolicy)_lock_event_loop_policyrfres r)_init_event_loop_policyrjs ::  % 0 0 0 0 0 0!7!7!9!9 ::::::::::::::::::s -11c:tttS)z"Get the current event loop policy.)rhrjrTr+r)rrs!!!! r+c|:t|ts%tdt|jd|adS)zZSet the current event loop policy. If policy is None, the default policy is restored.NzDpolicy must be an instance of AbstractEventLoopPolicy or None, not 'rS)rdrrTrr1rh)policys r)rrsM *V5L"M"Mw_cdj_k_k_twwwxxxr+ctS)aGReturn an asyncio event loop. When called from a coroutine or a callback (e.g. scheduled with call_soon or similar API), this function will always return the running event loop. If there is no running event loop set, the function will return the result of `get_event_loop_policy().get_event_loop()` call. )_py__get_event_looprTr+r)r r s   r+cft}||StSrA)rrr ) stacklevel current_loops r)_get_event_looprts3 %&&L " " 1 1 3 33r+cHt|dS)zCEquivalent to calling get_event_loop_policy().set_event_loop(loop).N)rr r\s r)r r #s"**400000r+cBtS)z?Equivalent to calling get_event_loop_policy().new_event_loop().)rr rTr+r)r r (s " " 1 1 3 33r+cBtS)zBEquivalent to calling get_event_loop_policy().get_child_watcher().)rr rTr+r)r r -s " " 4 4 6 66r+cDt|S)zMEquivalent to calling get_event_loop_policy().set_child_watcher(watcher).)rr )rDs r)r r 2s ! " " 4 4W = ==r+)rrrr rt)rp).rR__all__rr_r8r;r"rNrirrrrrrrFrhLockrgrWrYr^rrrrjrrr rtr r r r _py__get_running_loop_py__set_running_loop_py_get_running_loop_py_get_event_loopro_asyncio_c__get_running_loop_c__set_running_loop_c_get_running_loop_c_get_event_loop_c__get_event_loop ImportErrorrTr+r)rs>''   GGGGGGGGT<<<<<&<<<~'!'!'!'!'!'!'!'!TT"T"T"T"T"T"T"T"n """"""""D3$3$3$3$3$!83$3$3$t  9?        111:::    ! ! !4444111 444 777 >>>*)'#%)MMMMMMMMMMMMMM -,*&(   DD sC++C43C4__pycache__/coroutines.cpython-311.opt-2.pyc000064400000007436152533123130014620 0ustar00 !A?hH dZddlZddlZddlZddlZddlZddlZdZe Z dZ ej ej ejjfZeZdZdZdS))iscoroutinefunction iscoroutineNctjjp=tjj o+t t jdS)NPYTHONASYNCIODEBUG)sysflagsdev_modeignore_environmentboolosenvironget?/opt/alt/python-internal/lib64/python3.11/asyncio/coroutines.py_is_debug_moder s@ 9  Nci&B"B#M"&rz~~6J'K'K"L"LNrc\ tj|pt|ddtuS)N _is_coroutine)inspectrgetattrr)funcs rrrs3@  ' - - B D/4 0 0M ACrc t|tvrdSt|trAt tdkr'tt|dSdS)NTdF)type_iscoroutine_typecache isinstance_COROUTINE_TYPESlenadd)objs rrr"si3 Cyy***t#'(( % & & , , " & &tCyy 1 1 1turcd}d}d}t|dr|jr|j}nt|dr|jr|j}||}|s||r|dS|Sd}t|dr|jr|j}nt|dr|jr|j}|jpd}d }||j}|d |d |}n|j}|d |d |}|S) Nct|dr|jr|j}n7t|dr|jr|j}ndt|jd}|dS)N __qualname____name__z())hasattrr#r$r)coro coro_names rget_namez#_format_coroutine..get_name5s} 4 ( ( DT-> D)II T: & & D4= D IIDDJJ/CCCIrcf |jS#t$r |jcYS#t$rYYdSwxYwwxYw)NF) cr_runningAttributeError gi_running)r's r is_runningz%_format_coroutine..is_runningCsa ? "    &&&!   uuu  s  00 ,0,0cr_codegi_codez runninggi_framecr_framezrz running at :z done, defined at )r&r/r0r1r2 co_filenamef_linenoco_firstlineno) r'r)r. coro_coder( coro_framefilenamelineno coro_reprs r_format_coroutiner<2s_    ItY!DL!L y ! !!dl!L I  :d   ))) ) JtZ  #T]#] z " "#t}#] $=(=H F$ AAhAAAA ) GGHGGvGG r)__all__collections.abc collectionsrr r tracebacktypesrobjectrr CoroutineType GeneratorTypeabc Coroutinersetrrr<rrrrHs .  NNN CCC')<O-/    =====r__pycache__/streams.cpython-311.opt-2.pyc000064400000070202152533123130014073 0ustar00 !A?hok~dZddlZddlZddlZddlZddlZeedredz ZddlmZddlm Z ddlm Z dd lm Z dd lm Z dd l mZdd lmZd ZdeddZdeddZeedrdeddZdeddZGdde jZGddee jZGddZGddZdS)) StreamReader StreamWriterStreamReaderProtocolopen_connection start_serverNAF_UNIX)open_unix_connectionstart_unix_server) coroutines)events) exceptions)format_helpers) protocols)logger)sleepi)limitc K tj}t||}t|| |j fd||fi|d{V\}}t | ||}||fS)NrlooprcSNprotocolsz!open_connection..1s)r get_running_looprrcreate_connectionr) hostportrkwdsrreader transport_writerrs @rrrs"  " $ $D D 1 1 1F#F666H//$..(,........LIq )Xvt < rcnK tjfd}j|||fi|d{VS)NcNt}t|}|SNrrrrr%rclient_connected_cbrrs rfactoryzstart_server..factoryNs6E555'0C-1333r)r r create_server)r.r"r#rr$r/rs` ` @rrr6st(  " $ $D $#GT4@@4@@ @ @ @ @ @ @@rcK tj}t||}t|||jfd|fi|d{V\}}t |||}||fS)NrrcSrrrsrrz&open_unix_connection..bsHr)r r rrcreate_unix_connectionr) pathrr$rr%r&r'r(rs @rr r ZsN&((E555'T:::8T8    d,,&*,,,,,,,, 1i64@@v~rclK tjfd}j||fi|d{VS)NcNt}t|}|Sr+r,r-s rr/z"start_unix_server..factoryks6!D999F+F4G15777HOr)r r create_unix_server)r.r4rr$r/rs` ` @rr r fsnK&((        -T,WdCCdCCCCCCCCCrc6eZdZ ddZdZdZdZdZdZdS) FlowControlMixinNc|tjd|_n||_d|_t j|_d|_dS)N) stacklevelF)r _get_event_loop_loop_paused collectionsdeque_drain_waiters_connection_lost)selfrs r__init__zFlowControlMixin.__init__~sK </1===DJJDJ )/11 %rctd|_|jrtjd|dSdS)NTz%r pauses writing)r?r> get_debugrdebugrDs r pause_writingzFlowControlMixin.pause_writingsB :   ! ! 4 L,d 3 3 3 3 3 4 4rcd|_|jrtjd||jD]+}|s|d,dS)NFz%r resumes writing)r?r>rGrrHrBdone set_resultrDwaiters rresume_writingzFlowControlMixin.resume_writingss :   ! ! 5 L-t 4 4 4) ( (F;;== (!!$''' ( (rcd|_|jsdS|jD]C}|s-||d.||DdSNT)rCr?rBrLrM set_exceptionrDexcrOs rconnection_lostz FlowControlMixin.connection_lostsv $|  F) . .F;;== .;%%d++++((---  . .rc2K|jrtd|jsdS|j}|j| |d{V|j|dS#|j|wxYw)NzConnection lost)rCConnectionResetErrorr?r> create_futurerBappendremoverNs r _drain_helperzFlowControlMixin._drain_helpers   :&'899 9|  F))++ ""6*** /LLLLLLL   & &v . . . . .D  & &v . . . .s A::Bctr)NotImplementedErrorrDstreams r_get_close_waiterz"FlowControlMixin._get_close_waiters!!rr) __name__ __module__ __qualname__rErJrPrVr\rarrrr9r9tsx&&&&444 ((( . . . / / /"""""rr9cjeZdZ dZd fd ZedZdZdZfdZ dZ dZ d Z d Z xZS) rNcLt||&tj||_|j|_nd|_|||_d|_d|_d|_ d|_ ||_ d|_ |j |_dS)NrF)superrEweakrefref_stream_reader_wr_source_traceback_strong_reader_reject_connection_stream_writer_task _transport_client_connected_cb _over_sslr>rY_closed)rD stream_readerr.r __class__s rrEzStreamReaderProtocol.__init__s d###  $%,[%?%?D "%2%DD " "%)D "  *#0D "'" $7!z//11 rc<|jdS|Sr)rjrIs r_stream_readerz#StreamReaderProtocol._stream_readers"  ! )4%%'''rcv|j}|j}||_||_|ddu|_dS)N sslcontext)r>r&rnrpget_extra_inforr)rDr(rr&s r_replace_writerz$StreamReaderProtocol._replace_writers>z$ $#"11,??tKrcXjrEddi}jr j|d<j|dS_j}||ddu_ j t|j_ |j }tj|r?fd}j|_j|d_dSdS)NmessagezpAn open stream was garbage collected prior to establishing network connection; call "stream.close()" explicitly.source_tracebackryc|rdS|}|4jd|ddSdS)Nz*Unhandled exception in client_connected_cb)r} exceptionr&) cancelledcloserr>call_exception_handler)taskrUrDr&s rcallbackz6StreamReaderProtocol.connection_made..callbacks~~''!)))..**C 99'S),)2;; "))))) 'r)rmrkr>rabortrprw set_transportrzrrrqrrnr iscoroutine create_taskroadd_done_callbackrl)rDr&contextr%resrs`` rconnection_madez$StreamReaderProtocol.connection_madesg  " @G % E.2.D*+ J - -g 6 6 6 OO    F#$     + + +"11,??tK  $ 0".y$/5/3z#;#;D ++F,0,?AAC%c** 7 * * * * * *"Z33C88  ,,X666"&D   / 1 0rc|j}|,||n|||js7||jdn|j|t |d|_d|_ d|_ d|_ dSr) rwfeed_eofrSrsrLrMrgrVrjrnrorp)rDrUr%rus rrVz$StreamReaderProtocol.connection_lost s$  {!!!!$$S)))|  "" 0{ ''---- **3/// $$$!%" rcF|j}|||dSdSr)rw feed_data)rDdatar%s r data_receivedz"StreamReaderProtocol.data_receiveds2$     T " " " " "  rcR|j}|||jrdSdS)NFT)rwrrr)rDr%s r eof_receivedz!StreamReaderProtocol.eof_received!s6$   OO    > 5trc|jSr)rsr_s rraz&StreamReaderProtocol._get_close_waiter,s |rc |j}|r*|s|dSdSdS#t$rYdSwxYwr)rsrLrrAttributeError)rDcloseds r__del__zStreamReaderProtocol.__del__/s #\F{{}} #V%5%5%7%7 #  """"" # # # #    DD sA AANN)rbrcrdrkrEpropertyrwr{rrVrrrar __classcell__)rus@rrrs222222(((X( LLL('('('T$###    # # # # # # #rrc~eZdZ dZdZedZdZdZdZ dZ dZ d Z d Z dd Zd Zd d ddZdZd S)rc||_||_||_||_|j|_|jddSr)rp _protocol_readerr>rY _complete_futrM)rDr&rr%rs rrEzStreamWriter.__init__EsS#!  !Z5577 %%d+++++rc|jjd|jg}|j|d|jdd|S)N transport=zreader=<{}> )rurbrprrZformatjoinrDinfos r__repr__zStreamWriter.__repr__Os]')Ido)I)IJ < # KK2$,22 3 3 3}}SXXd^^,,,rc|jSrrprIs rr&zStreamWriter.transportUs rc:|j|dSr)rpwriterDrs rrzStreamWriter.writeYs d#####rc:|j|dSr)rp writelinesrs rrzStreamWriter.writelines\s ""4(((((rc4|jSr)rp write_eofrIs rrzStreamWriter.write_eof_s((***rc4|jSr)rp can_write_eofrIs rrzStreamWriter.can_write_eofbs,,...rc4|jSr)rprrIs rrzStreamWriter.closees$$&&&rc4|jSr)rp is_closingrIs rrzStreamWriter.is_closinghs))+++rcJK|j|d{VdSr)rrarIs r wait_closedzStreamWriter.wait_closedks4n..t44444444444rNc8|j||Sr)rprz)rDnamedefaults rrzzStreamWriter.get_extra_infons--dG<< start_tlsrpr{)rDryrrrr new_transports rrzStreamWriter.start_tlss Bn9E >jjll"j22 OXz#_"7399999999 (  &&&&&rc|jsh|jrt jdt dS|t jd|t dSdS)Nzloop is closedz unclosed )rprr> is_closedwarningswarnResourceWarningrrIs rrzStreamWriter.__del__s))++ Ez##%% E .@@@@@  2$22ODDDDD  E Err)rbrcrdrErrr&rrrrrrrrzrrrrrrrr;s,,,--- X$$$)))+++///''',,,555====---4)-.2 ' ' ' ' 'EEEEErrceZdZdZedfdZdZdZdZdZ dZ dZ d Z d Z d Zd Zd ZddZddZdZdZdZdS)rNcz|dkrtd||_|tj|_n||_t |_d|_d|_d|_ d|_ d|_ |j r-tjtjd|_dSdS)NrzLimit cannot be <= 0Fr ) ValueError_limitr r=r> bytearray_buffer_eof_waiter _exceptionrpr?rGr extract_stacksys _getframerk)rDrrs rrEzStreamReader.__init__s A::344 4 </11DJJDJ {{    :   ! ! "%3%A a  &"&"D " " " " "rc\dg}|jr*|t|jd|jr|d|jt kr|d|j|jr|d|j|jr|d|j|jr|d|j|j r|dd d |S) Nrz byteseofzlimit=zwaiter=z exception=rpausedrr) rrZlenrr_DEFAULT_LIMITrrrpr?rrrs rrzStreamReader.__repr__s, < 6 KK3t|,,444 5 5 5 9  KK    ;. ( ( KK... / / / < 4 KK2$,22 3 3 3 ? : KK8T_88 9 9 9 ? : KK8T_88 9 9 9 < " KK ! ! !}}SXXd^^,,,rc|jSr)rrIs rrzStreamReader.exceptions rc||_|j}|2d|_|s||dSdSdSr)rrrrSrTs rrSzStreamReader.set_exceptions]  DL##%% *$$S)))))   * *rc |j}|2d|_|s|ddSdSdSr)rrrMrNs r_wakeup_waiterzStreamReader._wakeup_waitersY?  DL##%% (!!$'''''   ( (rc||_dSrr)rDr&s rrzStreamReader.set_transports #rc|jr?t|j|jkr$d|_|jdSdSdS)NF)r?rrrrpresume_readingrIs r_maybe_resume_transportz$StreamReader._maybe_resume_transportsS < -C --<< DL O * * , , , , , - -<rY)rD func_names r_wait_for_datazStreamReader._wait_for_datas  < #55566 6 < - DL O * * , , ,z//11  ,       DLLL4DL    s # A99 BcK d}t|} ||d{V}n#tj$r}|jcYd}~Sd}~wtj$r}|j||jr|jd|j|z=n|j | t|j dd}~wwxYw|S)N r) r readuntilrIncompleteReadErrorpartialLimitOverrunErrorr startswithconsumedclearrrargs)rDsepseplenlinees rreadlinezStreamReader.readline#s S (,,,,,,,,DD-   9      + ( ( (|&&sAJ77 %L!5!*v"5!566 ""$$$  ( ( * * *QVAY'' '  ( s(2CA C CA:CCrcK t|}|dkrtd|j|jd} t|j}||z |krJ|j||}|dkrn|dz|z }||jkrt jd||jrBt|j}|j t j |d| dd{V||jkrt jd||jd||z}|jd||z=| t|S) Nrz,Separator should be at least one-byte stringTr z2Separator is not found, and chunk exceed the limitrz2Separator is found, but chunk is longer than limit)rrrrfindrrrrbytesrrrr)rD separatorroffsetbuflenisepchunks rrzStreamReader.readuntilBs &Y Q;;KLL L ? &/ !* 3&&F&((|((F;;2:: !f,DK''$6L   y Bdl++ ""$$$ 4UDAAA%%k22 2 2 2 2 2 2 2= 3@ $+  .DdLL L ^dVm^, L$- ( $$&&&U||rrcK |j|j|dkrdS|dkrQg} ||jd{V}|sn||9d|S|js"|js|dd{Vt|jd|}|jd|=| |S)NrrTread) rr rrZrrrrrr)rDnblocksblockrs rr zStreamReader.reads * ? &/ ! 663 q55 F %"ii 44444444 e$$$  % 88F## #| .DI .%%f-- - - - - - - -T\"1"%&& L!  $$&&& rcK |dkrtd|j|j|dkrdSt|j|kr||jrBt |j}|jtj||| dd{Vt|j|k|t|j|kr.t |j}|jn&t |jd|}|jd|=| |S)Nrz*readexactly size can not be less than zeror readexactly) rrrrrrrrrrr)rDr  incompleters rrzStreamReader.readexactlysP  q55IJJ J ? &/ ! 663$,!##y D"4<00  ""$$$ 4ZCCC%%m44 4 4 4 4 4 4 4 $,!## t|   ! !&&D L   bqb)**D RaR  $$&&& rc|SrrrIs r __aiter__zStreamReader.__aiter__s rcXK|d{V}|dkrt|S)Nr)rStopAsyncIteration)rDvals r __anext__zStreamReader.__anext__s9MMOO###### #::$ $ r)r)r)rbrcrdrkrrErrrSrrrrrrrrrr rrrrrrrrs4+$"""",---$***((($$$--- ...$$$,   8>YYYYv1111f'''Rrrrr)__all__r@socketrrrhhasattrr r rrrlogrtasksrrrrr r Protocolr9rrrrrrrsf '  769= <||d |j||d |jd d |S)Nclosedzpid=z returncode=runningz not startedrzstdin=rr zstdout=stderr=zstdout=zstderr=z<{}> ) r4__name__rappendrrrgetpipeformatjoin)r-infor rrs r5__repr__z BaseSubprocessTransport.__repr__7s'( < " KK ! ! ! 9 KK*ty** + + +   ' KK8d&688 9 9 9 9 Y " KK " " " " KK & & & ""   KK--- . . .####  &F"2"2 KK666 7 7 7 7! 3fk33444! 3fk33444}}SXXd^^,,,c tN)NotImplementedError)r-r r r rrrr2s r5r"zBaseSubprocessTransport._startTs!!rBc||_dSrDr)r-r/s r5 set_protocolz$BaseSubprocessTransport.set_protocolWs !rBc|jSrDrGr-s r5 get_protocolz$BaseSubprocessTransport.get_protocolZs ~rBc|jSrD)rrJs r5 is_closingz"BaseSubprocessTransport.is_closing]s |rBc|jrdSd|_|jD]}||j|j{|jv|j_|j rtj d| |j dS#t$rYdSwxYwdSdSdS)NTz$Close running child process: kill %r)rrvaluesr=r#rrpollrr&rwarningkillProcessLookupError)r-protos r5r#zBaseSubprocessTransport.close`s <  F [''))  E} J       J " ( !!)z##%% MEtLLL  !!!!!%     # "((*)sB:: CCcl|js,|d|t||dSdS)Nzunclosed transport )source)rResourceWarningr#)r-_warns r5__del__zBaseSubprocessTransport.__del__{sG|  E000/$ O O O O JJLLLLL  rBc|jSrD)rrJs r5get_pidzBaseSubprocessTransport.get_pids yrBc|jSrD)rrJs r5get_returncodez&BaseSubprocessTransport.get_returncodes rBc<||jvr|j|jSdSrD)rr=)r-fds r5get_pipe_transportz*BaseSubprocessTransport.get_pipe_transports#   ;r?' '4rBc0|jtdSrD)rrSrJs r5 _check_procz#BaseSubprocessTransport._check_procs : $&& &  rBcb||j|dSrD)rbr send_signal)r-signals r5rdz#BaseSubprocessTransport.send_signals0  v&&&&&rBc`||jdSrD)rbr terminaterJs r5rgz!BaseSubprocessTransport.terminates.  rBc`||jdSrD)rbrrRrJs r5rRzBaseSubprocessTransport.kills,  rBcK j}j}|j1|fd|jd{V\}}|jd<|j1|fd|jd{V\}}|jd<|j1|fd|jd{V\}}|jd<|j j j D]\}}|j|g|Rd_ |+| s| ddSdSdS#ttf$rt $rB}|/| s!||Yd}~dSYd}~dSYd}~dSd}~wwxYw)Nc$tdS)Nr)WriteSubprocessPipeProtorJsr5z8BaseSubprocessTransport._connect_pipes..s4T1==rBrc$tdS)NrReadSubprocessPipeProtorJsr5rlz8BaseSubprocessTransport._connect_pipes..3D!<<rBrc$tdS)Nr rnrJsr5rlz8BaseSubprocessTransport._connect_pipes..rprBr )rrr connect_write_piperrconnect_read_piper call_soonrconnection_mader cancelled set_result SystemExitKeyboardInterrupt BaseException set_exception) r-r0procr._r=callbackdataexcs ` r5r,z&BaseSubprocessTransport._connect_pipessg# (:D:Dz% $ 7 7====J! !       4"& A{& $ 6 6<<<<K!!!!!!!!!!4"& A{& $ 6 6<<<<K!!!!!!!!!!4"& A NN4>94 @ @ @"&"5 0 0$x/$/////"&D !&*:*:*<*<!!!$'''''"!!! -.     * * *!&*:*:*<*<!$$S)))))))))"!!!!!!!!!!! *sC8D..F  +FF cv|j|j||fdS|jj|g|RdSrD)rr;rrt)r-cbrs r5_callzBaseSubprocessTransport._callsO   *   & &Dz 2 2 2 2 2 DJ  +d + + + + + +rBcp||jj|||dSrD)rrpipe_connection_lost _try_finish)r-r_rs r5_pipe_connection_lostz-BaseSubprocessTransport._pipe_connection_losts5 4>6C@@@ rBcH||jj||dSrD)rrpipe_data_received)r-r_rs r5_pipe_data_receivedz+BaseSubprocessTransport._pipe_data_receiveds# 4>4b$?????rBc|jrtjd||||_|jj ||j_||jj | dS)Nz%r exited with return code %r) rr&rr@rr returncoderrprocess_exitedr)r-rs r5_process_exitedz'BaseSubprocessTransport._process_exiteds~ :   ! ! K K7z J J J% : (%/DJ ! 4>0111 rBcK |j|jS|j}|j||d{VSrD)rr create_futurerr;)r-r0s r5_waitzBaseSubprocessTransport._waits[ '   '# #))++ !!&)))||||||rBc|jdStd|jDr$d|_||jddSdS)Nc3,K|]}|duo|jVdSrD) disconnected).0ps r5 z6BaseSubprocessTransport._try_finish..sA..}/......rBT)rallrrOr r_call_connection_lostrJs r5rz#BaseSubprocessTransport._try_finishsz   # F .. **,,... . . 9!DN JJt14 8 8 8 8 8 9 9rBc |j||jD]0}|s||j1d|_d|_d|_d|_dS#|jD]0}|s||j1d|_d|_d|_d|_wxYwrD)rconnection_lostrrvrwrrr)r-rr0s r5rz-BaseSubprocessTransport._call_connection_losts " N * *3 / / /, 8 8''))8%%d&6777!%D DJDJ!DNNN , 8 8''))8%%d&6777!%D DJDJ!DN ! ! ! !s A22AC)NN)r: __module__ __qualname__rrAr"rHrKrMr#warningswarnrYr[r]r`rbrdrgrRr,rrrrrrr __classcell__)r4s@r5rr s%))<)<)<)<)<)||_||_d|_d|_dS)NF)r|r_r=r)r-r|r_s r5rz!WriteSubprocessPipeProto.__init__s%  !rBc||_dSrD)r=)r- transports r5ruz(WriteSubprocessPipeProto.connection_mades  rBcBd|jjd|jd|jdS)N)r4r:r_r=rJs r5rAz!WriteSubprocessPipeProto.__repr__ s,M4>*MMMMtyMMMMrBcbd|_|j|j|d|_dS)NT)rr|rr_)r-rs r5rz(WriteSubprocessPipeProto.connection_lost s/  ''555 rBcB|jjdSrD)r|r pause_writingrJs r5rz&WriteSubprocessPipeProto.pause_writings ))+++++rBcB|jjdSrD)r|rresume_writingrJs r5rz'WriteSubprocessPipeProto.resume_writings **,,,,,rBN) r:rrrrurArrrrrBr5rkrksq""" NNN ,,,-----rBrkceZdZdZdS)rocF|j|j|dSrD)r|rr_)r-rs r5 data_receivedz%ReadSubprocessPipeProto.data_receiveds" %%dgt44444rBN)r:rrrrrBr5roros#55555rBro)rrrrrlogrSubprocessTransportr BaseProtocolrkProtocolrorrBr5rsr"r"r"r"r"j<r"r"r"j-----y5---4555556'055555rB__pycache__/coroutines.cpython-311.pyc000064400000007661152533123130013660 0ustar00 !A?hH dZddlZddlZddlZddlZddlZddlZdZe Z dZ ej ej ejjfZeZdZdZdS))iscoroutinefunction iscoroutineNctjjp=tjj o+t t jdS)NPYTHONASYNCIODEBUG)sysflagsdev_modeignore_environmentboolosenvironget?/opt/alt/python-internal/lib64/python3.11/asyncio/coroutines.py_is_debug_moder s@ 9  Nci&B"B#M"&rz~~6J'K'K"L"LNrcZtj|pt|ddtuS)z6Return True if func is a decorated coroutine function. _is_coroutineN)inspectrgetattrr)funcs rrrs0  ' - - B D/4 0 0M ACrct|tvrdSt|trAt tdkr'tt|dSdS)z)Return True if obj is a coroutine object.TdF)type_iscoroutine_typecache isinstance_COROUTINE_TYPESlenadd)objs rrr"sf Cyy***t#'(( % & & , , " & &tCyy 1 1 1turct|sJd}d}d}t|dr|jr|j}nt|dr|jr|j}||}|s||r|dS|Sd}t|dr|jr|j}nt|dr|jr|j}|jpd}d }||j}|d |d |}n|j}|d |d |}|S) Nct|dr|jr|j}n7t|dr|jr|j}ndt|jd}|dS)N __qualname____name__z())hasattrr#r$r)coro coro_names rget_namez#_format_coroutine..get_name5s} 4 ( ( DT-> D)II T: & & D4= D IIDDJJ/CCCIrcf |jS#t$r |jcYS#t$rYYdSwxYwwxYw)NF) cr_runningAttributeError gi_running)r's r is_runningz%_format_coroutine..is_runningCsa ? "    &&&!   uuu  s  00 ,0,0cr_codegi_codez runninggi_framecr_framezrz running at :z done, defined at ) rr&r/r0r1r2 co_filenamef_linenoco_firstlineno) r'r)r. coro_coder( coro_framefilenamelineno coro_reprs r_format_coroutiner<2ss t       ItY!DL!L y ! !!dl!L I  :d   ))) ) JtZ  #T]#] z " "#t}#] $=(=H F$ AAhAAAA ) GGHGGvGG r)__all__collections.abc collectionsrr r tracebacktypesrobjectrr CoroutineType GeneratorTypeabc Coroutinersetrrr<rrrrHs .  NNN CCC')<O-/    =====r__pycache__/base_subprocess.cpython-311.opt-1.pyc000064400000040244152533123130015601 0ustar00 !A?h"ddlZddlZddlZddlmZddlmZddlmZGddejZ Gdd ej Z Gd d e ej Z dS) N) protocols) transports)loggerceZdZ dfd ZdZdZdZdZdZdZ e j fd Z d Z d Zd Zd ZdZdZdZdZdZdZdZdZdZdZdZxZS)BaseSubprocessTransportNc Dt| d|_||_||_d|_d|_d|_g|_tj |_ i|_ d|_ |tjkr d|j d<|tjkr d|j d<|tjkr d|j d< |jd||||||d| n#|xYw|jj|_|j|jd<|jrBt+|t,t.fr|} n|d} t1jd| |j|j|| dS) NFrr)argsshellstdinstdoutstderrbufsize subprocesszprocess %r created: pid %s)super__init___closed _protocol_loop_proc_pid _returncode _exit_waiters collectionsdeque_pending_calls_pipes _finishedrPIPE_startclosepid_extra get_debug isinstancebytesstrrdebug create_task_connect_pipes)selfloopprotocolr r r rrrwaiterextrakwargsprogram __class__s D/opt/alt/python-internal/lib64/python3.11/asyncio/base_subprocess.pyrz BaseSubprocessTransport.__init__ s  !   )/11  JO # #!DKN Z_ $ $!DKN Z_ $ $!DKN  DK BTeF%w B B:@ B B B B  JJLLL JN $(J L! :   ! ! -$ -- "q' L5 $) - - - t226::;;;;;s CC5c8|jjg}|jr|d|j|d|j|j|d|jn2|j|dn|d|jd}||d|j|jd}|jd }|"||ur|d |jn>||d |j||d |jd d |S)Nclosedzpid=z returncode=runningz not startedrzstdin=rr zstdout=stderr=zstdout=zstderr=z<{}> ) r4__name__rappendrrrgetpipeformatjoin)r-infor rrs r5__repr__z BaseSubprocessTransport.__repr__7s'( < " KK ! ! ! 9 KK*ty** + + +   ' KK8d&688 9 9 9 9 Y " KK " " " " KK & & & ""   KK--- . . .####  &F"2"2 KK666 7 7 7 7! 3fk33444! 3fk33444}}SXXd^^,,,c tN)NotImplementedError)r-r r r rrrr2s r5r"zBaseSubprocessTransport._startTs!!rBc||_dSrDr)r-r/s r5 set_protocolz$BaseSubprocessTransport.set_protocolWs !rBc|jSrDrGr-s r5 get_protocolz$BaseSubprocessTransport.get_protocolZs ~rBc|jSrD)rrJs r5 is_closingz"BaseSubprocessTransport.is_closing]s |rBc|jrdSd|_|jD]}||j|j{|jv|j_|j rtj d| |j dS#t$rYdSwxYwdSdSdS)NTz$Close running child process: kill %r)rrvaluesr=r#rrpollrr&rwarningkillProcessLookupError)r-protos r5r#zBaseSubprocessTransport.close`s <  F [''))  E} J       J " ( !!)z##%% MEtLLL  !!!!!%     # "((*)sB:: CCcl|js,|d|t||dSdS)Nzunclosed transport )source)rResourceWarningr#)r-_warns r5__del__zBaseSubprocessTransport.__del__{sG|  E000/$ O O O O JJLLLLL  rBc|jSrD)rrJs r5get_pidzBaseSubprocessTransport.get_pids yrBc|jSrD)rrJs r5get_returncodez&BaseSubprocessTransport.get_returncodes rBc<||jvr|j|jSdSrD)rr=)r-fds r5get_pipe_transportz*BaseSubprocessTransport.get_pipe_transports#   ;r?' '4rBc0|jtdSrD)rrSrJs r5 _check_procz#BaseSubprocessTransport._check_procs : $&& &  rBcb||j|dSrD)rbr send_signal)r-signals r5rdz#BaseSubprocessTransport.send_signals0  v&&&&&rBc`||jdSrD)rbr terminaterJs r5rgz!BaseSubprocessTransport.terminates.  rBc`||jdSrD)rbrrRrJs r5rRzBaseSubprocessTransport.kills,  rBcK j}j}|j1|fd|jd{V\}}|jd<|j1|fd|jd{V\}}|jd<|j1|fd|jd{V\}}|jd<|j j j D]\}}|j|g|Rd_ |+| s| ddSdSdS#ttf$rt $rB}|/| s!||Yd}~dSYd}~dSYd}~dSd}~wwxYw)Nc$tdS)Nr)WriteSubprocessPipeProtorJsr5z8BaseSubprocessTransport._connect_pipes..s4T1==rBrc$tdS)NrReadSubprocessPipeProtorJsr5rlz8BaseSubprocessTransport._connect_pipes..3D!<<rBrc$tdS)Nr rnrJsr5rlz8BaseSubprocessTransport._connect_pipes..rprBr )rrr connect_write_piperrconnect_read_piper call_soonrconnection_mader cancelled set_result SystemExitKeyboardInterrupt BaseException set_exception) r-r0procr._r=callbackdataexcs ` r5r,z&BaseSubprocessTransport._connect_pipessg# (:D:Dz% $ 7 7====J! !       4"& A{& $ 6 6<<<<K!!!!!!!!!!4"& A{& $ 6 6<<<<K!!!!!!!!!!4"& A NN4>94 @ @ @"&"5 0 0$x/$/////"&D !&*:*:*<*<!!!$'''''"!!! -.     * * *!&*:*:*<*<!$$S)))))))))"!!!!!!!!!!! *sC8D..F  +FF cv|j|j||fdS|jj|g|RdSrD)rr;rrt)r-cbrs r5_callzBaseSubprocessTransport._callsO   *   & &Dz 2 2 2 2 2 DJ  +d + + + + + +rBcp||jj|||dSrD)rrpipe_connection_lost _try_finish)r-r_rs r5_pipe_connection_lostz-BaseSubprocessTransport._pipe_connection_losts5 4>6C@@@ rBcH||jj||dSrD)rrpipe_data_received)r-r_rs r5_pipe_data_receivedz+BaseSubprocessTransport._pipe_data_receiveds# 4>4b$?????rBc|jrtjd||||_|jj ||j_||jj | dS)Nz%r exited with return code %r) rr&rr@rr returncoderrprocess_exitedr)r-rs r5_process_exitedz'BaseSubprocessTransport._process_exiteds~ :   ! ! K K7z J J J% : (%/DJ ! 4>0111 rBcK|j|jS|j}|j||d{VS)zdWait until the process exit and return the process return code. This method is a coroutine.N)rr create_futurerr;)r-r0s r5_waitzBaseSubprocessTransport._waitsV   '# #))++ !!&)))||||||rBc|jdStd|jDr$d|_||jddSdS)Nc3,K|]}|duo|jVdSrD) disconnected).0ps r5 z6BaseSubprocessTransport._try_finish..sA..}/......rBT)rallrrOr r_call_connection_lostrJs r5rz#BaseSubprocessTransport._try_finishsz   # F .. **,,... . . 9!DN JJt14 8 8 8 8 8 9 9rBc |j||jD]0}|s||j1d|_d|_d|_d|_dS#|jD]0}|s||j1d|_d|_d|_d|_wxYwrD)rconnection_lostrrvrwrrr)r-rr0s r5rz-BaseSubprocessTransport._call_connection_losts " N * *3 / / /, 8 8''))8%%d&6777!%D DJDJ!DNNN , 8 8''))8%%d&6777!%D DJDJ!DN ! ! ! !s A22AC)NN)r: __module__ __qualname__rrAr"rHrKrMr#warningswarnrYr[r]r`rbrdrgrRr,rrrrrrr __classcell__)r4s@r5rr s%))<)<)<)<)<)||_||_d|_d|_dS)NF)r|r_r=r)r-r|r_s r5rz!WriteSubprocessPipeProto.__init__s%  !rBc||_dSrD)r=)r- transports r5ruz(WriteSubprocessPipeProto.connection_mades  rBcBd|jjd|jd|jdS)N)r4r:r_r=rJs r5rAz!WriteSubprocessPipeProto.__repr__ s,M4>*MMMMtyMMMMrBcbd|_|j|j|d|_dS)NT)rr|rr_)r-rs r5rz(WriteSubprocessPipeProto.connection_lost s/  ''555 rBcB|jjdSrD)r|r pause_writingrJs r5rz&WriteSubprocessPipeProto.pause_writings ))+++++rBcB|jjdSrD)r|rresume_writingrJs r5rz'WriteSubprocessPipeProto.resume_writings **,,,,,rBN) r:rrrrurArrrrrBr5rkrksq""" NNN ,,,-----rBrkceZdZdZdS)rocF|j|j|dSrD)r|rr_)r-rs r5 data_receivedz%ReadSubprocessPipeProto.data_receiveds" %%dgt44444rBN)r:rrrrrBr5roros#55555rBro)rrrrrlogrSubprocessTransportr BaseProtocolrkProtocolrorrBr5rsr"r"r"r"r"j<r"r"r"j-----y5---4555556'055555rB__pycache__/threads.cpython-311.pyc000064400000002441152533123130013107 0ustar00 !A?h0dZddlZddlZddlmZdZdZdS)z6High-level support for working with threads in asyncioN)events) to_threadcKtj}tj}t j|j|g|Ri|}|d|d{VS)aAsynchronously run function *func* in a separate thread. Any *args and **kwargs supplied for this function are directly passed to *func*. Also, the current :class:`contextvars.Context` is propagated, allowing context variables from the main thread to be accessed in the separate thread. Return a coroutine that can be awaited to get the eventual result of *func*. N)rget_running_loop contextvars copy_context functoolspartialrunrun_in_executor)funcargskwargsloopctx func_calls rsU<<  7 7 7 7 7r__pycache__/futures.cpython-311.pyc000064400000044134152533123130013157 0ustar00 !A?h78dZdZddlZddlZddlZddlZddlmZddl m Z ddl m Z ddl m Z dd l m Z e jZe jZe jZe jZejdz ZGd d ZeZd Zd ZdZdZdZdZdddZ ddlZejxZZdS#e$rYdSwxYw)z.A Future class similar to the one in PEP 3148.)Future wrap_futureisfutureN) GenericAlias) base_futures)events) exceptions)format_helpersceZdZdZeZdZdZdZdZ dZ dZ dZ dZ dddZdZdZeeZedZejd Zd Zd Zdd Zd ZdZdZdZdZdddZdZ dZ!dZ"dZ#e#Z$dS)ra,This class is *almost* compatible with concurrent.futures.Future. Differences: - This class is not thread-safe. - result() and exception() do not take a timeout argument and raise an exception when the future isn't done yet. - Callbacks registered with add_done_callback() are always called via the event loop's call_soon(). - This class is not compatible with the wait() and as_completed() methods in the concurrent.futures package. (In Python 3.4 or later we may be able to unify the implementations.) NFloopc|tj|_n||_g|_|jr-t jtjd|_ dSdS)zInitialize the future. The optional event_loop argument allows explicitly setting the event loop object used by the future. If it's not provided, the future uses the default event loop. Nr) r _get_event_loop_loop _callbacks get_debugr extract_stacksys _getframe_source_tracebackselfrs *JJJ     ! A*.*@G& ' ))'22222rc|jSr)r'r s r_log_tracebackzFuture._log_tracebackms ##rc6|rtdd|_dS)Nz'_log_traceback can only be set to FalseF) ValueErrorr')rvals rr0zFuture._log_tracebackqs(  HFGG G$rc6|j}|td|S)z-Return the event loop the Future is bound to.Nz!Future object is not initialized.)r RuntimeErrorrs rget_loopzFuture.get_loopws"z <BCC C rc|j|j}d|_|S|jtj}ntj|j}|j|_d|_|S)zCreate the CancelledError to raise if the Future is cancelled. This should only be called once when handling a cancellation since it erases the saved context exception value. N)_cancelled_exc_cancel_messager CancelledError __context__rr,s r_make_cancelled_errorzFuture._make_cancelled_error~se   *%C"&D J   '+--CC+D,@AAC-" rcd|_|jtkrdSt|_||_|dS)zCancel the future and schedule callbacks. If the future is already done or cancelled, return False. Otherwise, change the future's state to cancelled, schedule the callbacks and return True. FT)r'_state_PENDING _CANCELLEDr9_Future__schedule_callbacks)rmsgs rcancelz Future.cancelsD % ;( " "5  " !!###trc|jdd}|sdSg|jdd<|D]"\}}|j|||#dS)zInternal: Ask the event loop to call all callbacks. The callbacks are scheduled to be called as soon as possible. Also clears the callback list. Nr-)rr call_soon)r callbackscallbackctxs r__schedule_callbackszFuture.__schedule_callbackssn OAAA&   F& > >MHc J 4 = = = = > >rc"|jtkS)z(Return True if the future was cancelled.)r?rAr s r cancelledzFuture.cancelleds{j((rc"|jtkS)zReturn True if the future is done. Done means either that a result / exception are available, or that the future was cancelled. )r?r@r s rdonez Future.dones {h&&rc|jtkr|}||jtkrt jdd|_|j|j|j |j S)aReturn the result this future represents. If the future has been cancelled, raises CancelledError. If the future's result isn't yet available, raises InvalidStateError. If the future is done and has an exception set, this exception is raised. zResult is not ready.F) r?rAr= _FINISHEDr InvalidStateErrorr'r(with_traceback _exception_tb_resultr<s rresultz Future.resultsw ;* $ $,,..CI ;) # #./EFF F$ ? &/001CDD D|rc|jtkr|}||jtkrt jdd|_|jS)a&Return the exception that was set on this future. The exception (or None if no exception was set) is returned only if the future is done. If the future has been cancelled, raises CancelledError. If the future isn't done yet, raises InvalidStateError. zException is not set.F)r?rAr=rQr rRr'r(r<s rr$zFuture.exceptionsV ;* $ $,,..CI ;) # #./FGG G$rrFc|jtkr|j|||dS|t j}|j||fdS)zAdd a callback to be run when the future becomes done. The callback is called with a single argument - the future object. If the future is already done when this is called, the callback is scheduled with call_soon. rFN)r?r@rrG contextvars copy_contextrappend)rfnr-s radd_done_callbackzFuture.add_done_callbacksg ;( " " J T7 ; ; ; ; ;%244 O " "B= 1 1 1 1 1rcfd|jD}t|jt|z }|r ||jdd<|S)z}Remove all instances of a callback from the "call when done" list. Returns the number of callbacks removed. c*g|]\}}|k ||fSr`).0frJr\s r z/Future.remove_done_callback..s2***"*1c!"b !#h!(rN)rlen)rr\filtered_callbacks removed_counts ` rremove_done_callbackzFuture.remove_done_callbacksk ****.2o***DO,,s3E/F/FF  4!3DOAAA rc|jtkrtj|jd|||_t |_|dS)zMark the future done and set its result. If the future is already done when this method is called, raises InvalidStateError. : N)r?r@r rRrUrQrB)rrVs r set_resultzFuture.set_resultsX ;( " ".$+/I/I/I/IJJ J   !!#####rc^|jtkrtj|jd|t |t r |}t |t urtd||_|j |_ t|_| d|_ dS)zMark the future done and set an exception. If the future is already done when this method is called, raises InvalidStateError. rizPStopIteration interacts badly with generators and cannot be raised into a FutureTN)r?r@r rR isinstancetype StopIteration TypeErrorr( __traceback__rTrQrBr')rr$s r set_exceptionzFuture.set_exception s ;( " ".$+/I/I/I/IJJ J i & & $! I  ??m + +ABB B#&4  !!####rc#K|s d|_|V|std|S)NTzawait wasn't used with future)rO_asyncio_future_blockingr5rVr s r __await__zFuture.__await__sUyy{{ ,0D )JJJyy{{ @>?? ?{{}}rr)%r* __module__ __qualname____doc__r@r?rUr(rrr9r8rsr'rr!r. classmethodr__class_getitem__propertyr0setterr6r=rDrBrMrOrVr$r]rgrjrqrt__iter__r`rrrrs&FGJ EON %O#""""" ///333 $ L11 $$X$%%% (     > > >))) '''" 04 2 2 2 2 2    $ $ $$$$&HHHrrcT |j}|S#t$rYnwxYw|jSr)r6AttributeErrorr)futr6s r _get_loopr+sH<xzz       9s   c\|rdS||dS)z?Helper setting the result only if the future was not cancelled.N)rMrj)rrVs r_set_result_unless_cancelledr7s/ }}NN6rct|}|tjjurt j|jS|tjjurt j|jS|tjjurt j|jS|Sr)rm concurrentfuturesr:r args TimeoutErrorrR)r, exc_classs r_convert_future_excr>suS IJ&555(#(33 j(5 5 5&11 j(: : :+SX66 rcL|sJ|r|j|jsdS|}||jt |dS|}|j|dS)z8Copy state from a future to a concurrent.futures.Future.N) rOrMrDset_running_or_notify_cancelr$rqrrVrj)rsourcer$rVs r_set_concurrent_future_staterJs ;;===   2: 2 4 4  ""I  !4Y!?!?@@@@@ f%%%%%rc|sJ|rdS|rJ|r|dS|}|$|t |dS|}||dS)zqInternal helper to copy state from another Future. The other Future may be a concurrent.futures.Future. N)rOrMrDr$rqrrVrj)rdestr$rVs r_copy_future_staterYs ;;=== ~~yy{{? $ $$&&    29== > > > > >]]__F OOF # # # # #rcts.ttjjst dts.ttjjst dtrt ndtrt nddfd}fd}||dS)aChain two futures so that when one completes, so does the other. The result (or exception) of source will be copied to destination. If destination is cancelled, source gets cancelled too. Compatible with both asyncio.Future and concurrent.futures.Future. z(A future is required for source argumentz-A future is required for destination argumentNcht|rt||dSt||dSr)rrr)r%others r _set_statez!_chain_future.._set_state}s> F   8 uf - - - - - ( 7 7 7 7 7rc|r8urdSjdSdSr)rMrDcall_soon_threadsafe) destination dest_loopr source_loops r_call_check_cancelz)_chain_future.._call_check_cancelsa  " " @"kY&>&> 00?????  @ @rcrrdSur|dSrdS|dSr)rM is_closedr)rrrrrs r_call_set_statez&_chain_future.._call_set_states  ! ! # # %)*=*=*?*?% F   [ 8 8 J{F + + + + +""$$   * *:{F K K K K Kr)rrlrrrrorr])rrrrrrrs`` @@@r _chain_futurerms_ F  DJv/9/A/H%J%JDBCCC K IK4>4F4M*O*OIGHHH'/'7'7A)F###TK*2;*?*?I +&&&TI888 @@@@@@@ L L L L L L L L!!"4555 _-----rr ct|r|St|tjjs Jd||t j}|}t|||S)z&Wrap concurrent.futures.Future object.z+concurrent.futures.Future is expected, got ) rrlrrrr r create_futurer)r%r new_futures rrrs fj07 8 8AA@f@@AA 8 |%''##%%J&*%%% r) rw__all__concurrent.futuresrrYloggingrtypesrrr r r rr@rArQDEBUG STACK_DEBUGr _PyFuturerrrrrrr_asyncio_CFuture ImportErrorr`rrrs44        $  " ma FFFFFFFFT         & & &$$$().).).X!%     (OOO !'FXXX    DD sBBB__pycache__/locks.cpython-311.opt-2.pyc000064400000053012152533123130013530 0ustar00 !A?hFJ` dZddlZddlZddlmZddlmZddlmZGddZGd d eejZ Gd d ejZ Gd deejZ GddeejZ Gdde Z GddejZGddejZdS))LockEvent Condition SemaphoreBoundedSemaphoreBarrierN) exceptions)mixins)tasksceZdZdZdZdS)_ContextManagerMixinc>K|d{VdSN)acquireselfs :/opt/alt/python-internal/lib64/python3.11/asyncio/locks.py __aenter__z_ContextManagerMixin.__aenter__s-llnntc2K|dSr)release)rexc_typeexctbs r __aexit__z_ContextManagerMixin.__aexit__s rN)__name__ __module__ __qualname__rrrrrr s2 rrc>eZdZ dZfdZdZdZdZdZxZ S)rc"d|_d|_dSNF)_waiters_lockedrs r__init__z Lock.__init__Ns  rct}|jrdnd}|jr|dt |j}d|ddd|dS Nlockedunlocked , waiters:)super__repr__r%r$lenrresextra __class__s rr1z Lock.__repr__Rspgg   L8j = =<<DM(:(:<K|]}|VdSr cancelled.0ws r zLock.acquire..ds*99aAKKMM999999rT) r%r$all collectionsdeque _get_loop create_futureappendremover CancelledError_wake_up_firstrfuts rrz Lock.acquire]s2   $-"7994=99999#8DL4 = '-//DMnn,,.. S!!!   *  $$S)))) $$S)))))(   < &##%%%    tsB="C=CC,D cj |jrd|_|dStd)NFzLock is not acquired.)r%rH RuntimeErrorrs rrz Lock.release}sA  < 8 DL    ! ! ! ! !677 7rc |jsdS tt|j}n#t$rYdSwxYw|s|ddSdSNT)r$nextiter StopIterationdone set_resultrIs rrHzLock._wake_up_firsts8}  F tDM**++CC    FF  xxzz ! NN4  ! !s !. <<) rrrr&r1r)rrrH __classcell__r6s@rrrs3j*****@888" ! ! ! ! ! ! !rrc>eZdZ dZfdZdZdZdZdZxZ S)rcDtj|_d|_dSr#)rArBr$_valuers rr&zEvent.__init__s#)++  rct}|jrdnd}|jr|dt |j}d|ddd|dS) Nsetunsetr+r,r r-r.r/)r0r1rXr$r2r3s rr1zEvent.__repr__spgg  1' = =<<DM(:(:<= 0) ValueErrorr$rX)rvalues rr&zSemaphore.__init__Zs, 199CDD D  rct}|rdn d|j}|jr|dt |j}d|ddd|dS) Nr)zunlocked, value:r+r,r r-r.r/)r0r1r)rXr$r2r3s rr1zSemaphore.__repr__`sgg   KKMMO/O$+/O/O = =<<DM(:(:<.js-AAaAKKMM!AAAAAArr )rXanyr$rs rr)zSemaphore.lockedgs<G{aC AADM,?RAAA A A CrcvK |s|xjdzc_dS|jtj|_|}|j| |d{V|j|n#|j|wxYwnL#tj $r:| s$|xjdz c_| wxYw|jdkr| dS)Nr Tr) r)rXr$rArBrCrDrErFr rGr; _wake_up_nextrIs rrzSemaphore.acquirelsE {{}}  KK1 KK4 = '-//DMnn,,.. S!!!  *  $$S)))) $$S)))))(   ==?? % q ""$$$    ;??    ts B.C.C  CA DcP |xjdz c_|dSNr )rXrrs rrzSemaphore.releases1 q  rc |jsdS|jD]>}|s(|xjdzc_|ddS?dS)Nr T)r$rRrXrSrIs rrzSemaphore._wake_up_nextsm7}  F=  C88::  q t$$$   rru) rrrr&r1r)rrrrTrUs@rrrKs  *****CCC """H       rrc,eZdZ dfd ZfdZxZS)rr cX||_t|dSr) _bound_valuer0r&)rryr6s rr&zBoundedSemaphore.__init__s)! rc|j|jkrtdtdS)Nz(BoundedSemaphore released too many times)rXrrxr0r)rr6s rrzBoundedSemaphore.releases< ;$+ + +GHH H rru)rrrr&rrTrUs@rrrs[       rrceZdZdZdZdZdZdS) _BarrierStatefillingdraining resettingbrokenN)rrrFILLINGDRAINING RESETTINGBROKENr rrrrs"GHI FFFrrceZdZ dZfdZdZdZdZdZdZ dZ d Z d Z d Z ed Zed ZedZxZS)rc |dkrtdt|_||_tj|_d|_dS)Nr zparties must be > 0r)rxr_cond_partiesrr_state_count)rpartiess rr&zBarrier.__init__sD? Q;;233 3[[  #+  rct}|jj}|js|d|jd|jz }d|ddd|dS)Nr+/r,r r-r.r/)r0r1rryr n_waitingrr3s rr1zBarrier.__repr__spgg  ;$&{ B A$.AA4<AA AE)3qt9))))))rc:K|d{VSrrkrs rrzBarrier.__aenter__s(YY[[       rc KdSrr )rargss rrzBarrier.__aexit__s  rcK |j4d{V|d{V |j}|xjdz c_|dz|jkr|d{Vn|d{V||xjdzc_|cdddd{VS#|xjdzc_|wxYw#1d{VswxYwYdSr)r_blockrr_release_wait_exit)rindexs rrcz Barrier.waits :        ++--          q 19 ----//))))))))**,,&&&&&&& q                 q                  s)C(AB?$C(?&C%%C(( C25C2cKjfdd{Vjtjurt jddS)NcBjtjtjfvSr)rrrrrsrz Barrier._block..sDK& (?(rzBarrier aborted)rrnrrrr BrokenBarrierErrorrs`rrzBarrier._blocks j!!              ;-. . ./0ABB B / .rc^Ktj|_|jdSr)rrrrrtrs rrzBarrier._releases, $,  rcKjfdd{Vjtjtjfvrt jddS)Nc*jtjuSr)rrrrsrrzBarrier._wait..s$+]=R*RrzAbort or reset of barrier)rrnrrrrr rrs`rrz Barrier._waitsn j!!"R"R"R"RSSSSSSSSS ;=/1HI I I/0KLL L J Irc|jdkrK|jtjtjfvrtj|_|jdSdSNr)rrrrrrrrtrs rrz Barrier._exitsU ;!  {}6 8NOOO+3 J ! ! # # # # #  rc$K |j4d{V|jdkr%|jtjurtj|_ntj|_|jdddd{VdS#1d{VswxYwYdSr)rrrrrrrtrs rresetz Barrier.reset#s : $ $ $ $ $ $ $ ${Q;m&==="/"9DK+3 J ! ! # # # $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $sAA?? B  B cK |j4d{Vtj|_|jdddd{VdS#1d{VswxYwYdSr)rrrrrtrs rabortz Barrier.abort2s : $ $ $ $ $ $ $ $'.DK J ! ! # # # $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $s+A AAc |jSr)rrs rrzBarrier.parties<s F}rc< |jtjur|jSdSr)rrrrrs rrzBarrier.n_waitingAs"J ;-/ / /; qrc* |jtjuSr)rrrrs rrzBarrier.brokenHs>{m222r)rrrr&r1rrrcrrrrrrpropertyrrrrTrUs@rrrs*   *****!!!    .CCC     M M M$$$ $ $ $$$$XX 33X33333rr)__all__rAenumr r r r_LoopBoundMixinrrrrrEnumrrr rrrs! * C!C!C!C!C! !7C!C!C!L:&:&:&:&:&F ":&:&:&zm(m(m(m(m($f&<m(m(m(`WWWWW$f&<WWWty$DIM3M3M3M3M3f$M3M3M3M3M3r__pycache__/subprocess.cpython-311.opt-1.pyc000064400000030557152533123130014615 0ustar00 !A?hdZddlZddlmZddlmZddlmZddlmZddlmZej Z ej Z ej Z Gd d ej ej ZGd d Zdddejfd ZdddejddZdS))create_subprocess_execcreate_subprocess_shellN)events) protocols)streams)tasks)loggercLeZdZdZfdZdZdZdZdZdZ dZ d Z xZ S) SubprocessStreamProtocolz0Like StreamReaderProtocol, but for a subprocess.ct|||_dx|_x|_|_d|_d|_g|_|j |_ dS)N)loopF) super__init___limitstdinstdoutstderr _transport_process_exited _pipe_fds_loop create_future _stdin_closed)selflimitr __class__s ?/opt/alt/python-internal/lib64/python3.11/asyncio/subprocess.pyrz!SubprocessStreamProtocol.__init__sl d### 155 5T[4;$!Z5577cD|jjg}|j|d|j|j|d|j|j|d|jdd|S)Nzstdin=zstdout=zstderr=z<{}> )r__name__rappendrrformatjoin)rinfos r__repr__z!SubprocessStreamProtocol.__repr__s'( : ! KK/// 0 0 0 ; " KK1$+11 2 2 2 ; " KK1$+11 2 2 2}}SXXd^^,,,rcJ||_|d}|Ytj|j|j|_|j||j d|d}|Ytj|j|j|_ |j ||j d|d}|$tj ||d|j|_ dSdS)Nrrrr)protocolreaderr) rget_pipe_transportr StreamReaderrrr set_transportrr#r StreamWriterr)r transportstdout_transportstderr_transportstdin_transports rconnection_madez(SubprocessStreamProtocol.connection_made(s,#$77::  '!.T[48J@@@DK K % %&6 7 7 7 N ! !! $ $ $$77::  '!.T[48J@@@DK K % %&6 7 7 7 N ! !! $ $ $#66q99  & -o7;5937:???DJJJ ' &rct|dkr|j}n|dkr|j}nd}|||dSdSNrr*)rr feed_data)rfddatar,s rpipe_data_receivedz+SubprocessStreamProtocol.pipe_data_received@sS 77[FF 1WW[FFF     T " " " " "  rc|dkrw|j}||||||jdn&|j|d|j_dS|dkr|j}n|dkr|j}nd}|,|| n||||j vr|j || dS)NrFrr*) rcloseconnection_lostr set_result set_exception_log_tracebackrrfeed_eofrremove_maybe_close_transport)rr9excpiper,s rpipe_connection_lostz-SubprocessStreamProtocol.pipe_connection_lostJs 77:D   % % %{"--d3333"005555:"1 F 77[FF 1WW[FFF  {!!!!$$S)))    N ! !" % % % ##%%%%%rc<d|_|dS)NT)rrDrs rprocess_exitedz'SubprocessStreamProtocol.process_exitedhs"# ##%%%%%rct|jdkr)|jr$|jd|_dSdSdS)Nr)lenrrrr=rIs rrDz/SubprocessStreamProtocol._maybe_close_transportlsL t~  ! # #(< # O ! ! # # #"DOOO $ # # #rc&||jur|jSdSN)rr)rstreams r_get_close_waiterz*SubprocessStreamProtocol._get_close_waiterqs TZ  % % r) r" __module__ __qualname____doc__rr'r5r;rGrJrDrP __classcell__)rs@rr r s::88888---???0###&&&<&&&### &&&&&&&rr cbeZdZdZdZedZdZdZdZ dZ dZ d Z d Z d d Zd S)Processc||_||_||_|j|_|j|_|j|_||_dSrN)r _protocolrrrrget_pidpid)rr1r+rs rrzProcess.__init__wsI#! ^ o o $$&&rc2d|jjd|jdS)N)rr"rZrIs rr'zProcess.__repr__s"84>*88TX8888rc4|jSrN)rget_returncoderIs r returncodezProcess.returncodes--///rcDK|jd{VS)z?Wait until the process exit and return the process return code.N)r_waitrIs rwaitz Process.waits,_**,,,,,,,,,rc:|j|dSrN)r send_signal)rsignals rrezProcess.send_signals ##F+++++rc8|jdSrN)r terminaterIs rrhzProcess.terminates !!#####rc8|jdSrN)rkillrIs rrjz Process.kills rcK|j} |j||r#t jd|t ||jd{Vn6#ttf$r"}|rt jd||Yd}~nd}~wwxYw|rt jd||j dS)Nz%%r communicate: feed stdin (%s bytes)z%r communicate: stdin got %rz%r communicate: close stdin) r get_debugrwriter debugrLdrainBrokenPipeErrorConnectionResetErrorr=)rinputrnrEs r _feed_stdinzProcess._feed_stdins $$&& H J  U # # # O ;T3u::OOO*""$$ $ $ $ $ $ $ $ $!56 H H H H ;T3GGG  H  > L6 = = = sAA<<B/ B**B/c KdSrNrIs r_noopz Process._noops trcK|j|}|dkr|j}n|j}|jr |dkrdnd}t jd|||d{V}|jr |dkrdnd}t jd||| |S)Nr*rrrz%r communicate: read %sz%r communicate: close %s) rr-rrrrlr rnreadr=)rr9r1rOnameoutputs r _read_streamzProcess._read_streamsO66r:: 77[FF[F :   ! ! @!Qww88HD L2D$ ? ? ?{{}}$$$$$$ :   ! ! A!Qww88HD L3T4 @ @ @ rNcK|||}n|}|j|d}n|}|j|d}n|}t j|||d{V\}}}|d{V||fSr7)rsrvrr{rr gatherrc)rrrrrrs r communicatezProcess.communicates  $$U++EEJJLLE ; "&&q))FFZZ\\F ; "&&q))FFZZ\\F&+l5&&&I&I I I I I I IvviikkrrN)r"rQrRrr'propertyr`rcrerhrjrsrvr{r~rurrrVrVvs'''99900X0---,,,$$$&"      rrVc Ktj  fd} j||f|||d|d{V\}}t|| S)Nc&tSNr)r r)srz)create_subprocess_shell..7e=A C C Crrrr)rget_running_loopsubprocess_shellrV) cmdrrrrkwdsprotocol_factoryr1r+rs ` @rrrs  " $ $DCCCCC 5 5 !!!!!Ix 9h - --r)rrrrc Ktj  fd} j||g|R|||d|d{V\}} t|| S)Nc&tSrrr)srrz(create_subprocess_exec..rrr)rrsubprocess_execrV) programrrrrargsrrr1r+rs ` @rrrs  " $ $DCCCCC 4 4!!!F !! !!Ix 9h - --r)__all__ subprocessrrrr logr PIPESTDOUTDEVNULLFlowControlMixinSubprocessProtocolr rV_DEFAULT_LIMITrrrurrrsK =    b&b&b&b&b&w7(;b&b&b&JT T T T T T T T n.2$t(/(> . . . .8*JJJ     ! A*.*@G& ' ))'22222rc|jSr)r'r s r_log_tracebackzFuture._log_tracebackms ##rc6|rtdd|_dS)Nz'_log_traceback can only be set to FalseF) ValueErrorr')rvals rr0zFuture._log_tracebackqs(  HFGG G$rc8 |j}|td|S)Nz!Future object is not initialized.)r RuntimeErrorrs rget_loopzFuture.get_loopws%;z <BCC C rc |j|j}d|_|S|jtj}ntj|j}|j|_d|_|Sr)_cancelled_exc_cancel_messager CancelledError __context__rr,s r_make_cancelled_errorzFuture._make_cancelled_error~sj   *%C"&D J   '+--CC+D,@AAC-" rc d|_|jtkrdSt|_||_|dS)NFT)r'_state_PENDING _CANCELLEDr9_Future__schedule_callbacks)rmsgs rcancelz Future.cancelsI % ;( " "5  " !!###trc |jdd}|sdSg|jdd<|D]"\}}|j|||#dSNr-)rr call_soon)r callbackscallbackctxs r__schedule_callbackszFuture.__schedule_callbacksss OAAA&   F& > >MHc J 4 = = = = > >rc$ |jtkSr)r?rAr s r cancelledzFuture.cancelleds6{j((rc$ |jtkSr)r?r@r s rdonez Future.dones {h&&rc |jtkr|}||jtkrt jdd|_|j|j|j |j S)NzResult is not ready.F) r?rAr= _FINISHEDr InvalidStateErrorr'r(with_traceback _exception_tb_resultr<s rresultz Future.results| ;* $ $,,..CI ;) # #./EFF F$ ? &/001CDD D|rc |jtkr|}||jtkrt jdd|_|jS)NzException is not set.F)r?rAr=rRr rSr'r(r<s rr$zFuture.exceptions[  ;* $ $,,..CI ;) # #./FGG G$rrGc |jtkr|j|||dS|t j}|j||fdSrF)r?r@rrH contextvars copy_contextrappend)rfnr-s radd_done_callbackzFuture.add_done_callbacksl ;( " " J T7 ; ; ; ; ;%244 O " "B= 1 1 1 1 1rc fd|jD}t|jt|z }|r ||jdd<|S)Nc*g|]\}}|k ||fSra).0frKr]s r z/Future.remove_done_callback..s2***"*1c!"b !#h!(r)rlen)rr]filtered_callbacks removed_counts ` rremove_done_callbackzFuture.remove_done_callbacksp ****.2o***DO,,s3E/F/FF  4!3DOAAA rc |jtkrtj|jd|||_t |_|dS)N: )r?r@r rSrVrRrB)rrWs r set_resultzFuture.set_results] ;( " ".$+/I/I/I/IJJ J   !!#####rc` |jtkrtj|jd|t |t r |}t |t urtd||_|j |_ t|_| d|_ dS)NrjzPStopIteration interacts badly with generators and cannot be raised into a FutureT)r?r@r rS isinstancetype StopIteration TypeErrorr( __traceback__rUrRrBr')rr$s r set_exceptionzFuture.set_exception s ;( " ".$+/I/I/I/IJJ J i & & $! I  ??m + +ABB B#&4  !!####rc#K|s d|_|V|std|S)NTzawait wasn't used with future)rP_asyncio_future_blockingr5rWr s r __await__zFuture.__await__sUyy{{ ,0D )JJJyy{{ @>?? ?{{}}rr)$r* __module__ __qualname__r@r?rVr(rrr9r8rtr'rr!r. classmethodr__class_getitem__propertyr0setterr6r=rDrBrNrPrWr$r^rhrkrrru__iter__rarrrrs&FGJ EON %O#""""" ///333 $ L11 $$X$%%% (     > > >))) '''" 04 2 2 2 2 2    $ $ $$$$&HHHrrcT |j}|S#t$rYnwxYw|jSr)r6AttributeErrorr)futr6s r _get_loopr+sH<xzz       9s   c^ |rdS||dSr)rNrk)rrWs r_set_result_unless_cancelledr7s2I }}NN6rct|}|tjjurt j|jS|tjjurt j|jS|tjjurt j|jS|Sr)rn concurrentfuturesr:r args TimeoutErrorrS)r, exc_classs r_convert_future_excr>suS IJ&555(#(33 j(5 5 5&11 j(: : :+SX66 rc" |r|j|jsdS|}||jt |dS|}|j|dSr)rNrDset_running_or_notify_cancelr$rrrrWrk)rsourcer$rWs r_set_concurrent_future_staterJsB   2: 2 4 4  ""I  !4Y!?!?@@@@@ f%%%%%rcN |rdS|r|dS|}|$|t |dS|}||dSr)rNrDr$rrrrWrk)rdestr$rWs r_copy_future_staterYs  ~~ $ $$&&    29== > > > > >]]__F OOF # # # # #rc ts.ttjjst dts.ttjjst dtrt ndtrt nddfd}fd}||dS)Nz(A future is required for source argumentz-A future is required for destination argumentcht|rt||dSt||dSr)rrr)r%others r _set_statez!_chain_future.._set_state}s> F   8 uf - - - - - ( 7 7 7 7 7rc|r8urdSjdSdSr)rNrDcall_soon_threadsafe) destination dest_loopr source_loops r_call_check_cancelz)_chain_future.._call_check_cancelsa  " " @"kY&>&> 00?????  @ @rcrrdSur|dSrdS|dSr)rN is_closedr)rrrrrs r_call_set_statez&_chain_future.._call_set_states  ! ! # # %)*=*=*?*?% F   [ 8 8 J{F + + + + +""$$   * *:{F K K K K Kr)rrmrrrrprr^)rrrrrrrs`` @@@r _chain_futurermsd F  DJv/9/A/H%J%JDBCCC K IK4>4F4M*O*OIGHHH'/'7'7A)F###TK*2;*?*?I +&&&TI888 @@@@@@@ L L L L L L L L!!"4555 _-----rr c t|r|S|tj}|}t |||Sr)rr r create_futurer)r%r new_futures rrrsV0  |%''##%%J&*%%% r)__all__concurrent.futuresrrZloggingrtypesrrr r r rr@rArRDEBUG STACK_DEBUGr _PyFuturerrrrrrr_asyncio_CFuture ImportErrorrarrrs4        $  " ma FFFFFFFFT         & & &$$$().).).X!%     (OOO !'FXXX    DD sBBB__pycache__/staggered.cpython-311.opt-1.pyc000064400000014121152533123130014357 0ustar00 !A?hh.dZdZddlZddlZddlmZddlmZddlmZddlm Z dd d ej ej gej fd ej ed ejd ejejej eejej effdZdS)zFSupport for running coroutines in parallel with staggered start times.)staggered_raceN)events) exceptions)locks)tasks)loopcoro_fnsdelayr returnc N Kptjt| dd g g dtjt jddf  fd  d} | d}|t kr@tj d{V\}}t|} |t k@ f D]}|S# D]}|wxYw)aRun coroutines with staggered start times and take the first to finish. This method takes an iterable of coroutine functions. The first one is started immediately. From then on, whenever the immediately preceding one fails (raises an exception), or when *delay* seconds has passed, the next coroutine is started. This continues until one of the coroutines complete successfully, in which case all others are cancelled, or until all coroutines fail. The coroutines provided should be well-behaved in the following way: * They should only ``return`` if completed successfully. * They should always raise an exception if they did not complete successfully. In particular, if they handle cancellation, they should probably reraise, like this:: try: # do work except asyncio.CancelledError: # undo partially completed work raise Args: coro_fns: an iterable of coroutine functions, i.e. callables that return a coroutine object when called. Use ``functools.partial`` or lambdas to pass arguments. delay: amount of time, in seconds, between starting coroutines. If ``None``, the coroutines will run sequentially. loop: the event loop to use. Returns: tuple *(winner_result, winner_index, exceptions)* where - *winner_result*: the result of the winning coroutine, or ``None`` if no coroutines won. - *winner_index*: the index of the winning coroutine in ``coro_fns``, or ``None`` if no coroutines won. If the winning coroutine may return None on success, *winner_index* can be used to definitively determine whether any coroutine won. - *exceptions*: list of exceptions returned by the coroutines. ``len(exceptions)`` is equal to the number of coroutines actually started, and the order is the same as in ``coro_fns``. The winning coroutine's entry is ``None``. Nprevious_failedr cK|ctjtj5t j| d{Vdddn #1swxYwY t \}}n#t$rYdSwxYwtj }  |} | d |d{V}||tD]\}}||kr| dS#tt f$rt"$r$}| |<|Yd}~dSd}~wwxYw)N) contextlibsuppressexceptions_mod TimeoutErrorrwait_forwaitnext StopIterationrEvent create_taskappend enumeratecancel SystemExitKeyboardInterrupt BaseExceptionset)r this_indexcoro_fn this_failed next_taskresultiter enum_coro_fnsrr run_one_coro running_tasks winner_index winner_results >/opt/alt/python-internal/lib64/python3.11/asyncio/staggered.pyr*z$staggered_race..run_one_coroRs  &$^%@AA D D n_%9%9%;%;UCCCCCCCCC  D D D D D D D D D D D D D D D "&}"5"5 J    FF kmm $$\\+%>%>?? Y''' $ "799______F&L"M"-00  1 ??HHJJJ  %-.       %&Jz " OO          s;.AA"%A"*A== B  B *D//E. E))E.r)rget_running_looprtypingOptionalrrrrlenrrdone cancelled exceptionr)r r r first_task done_countr3_dr'r)rr*r+r,r-s `` @@@@@@r.rrsz  ,6*,,Dh''MMLJM.#_U[9.>B.............`!!,,t"4"455J$$$ C ....!J}55555555GD!TJ , C ....lJ6  A HHJJJJ   A HHJJJJ s AD D$)__doc____all__rr0rrrrrIterableCallable Awaitabler1floatAbstractEventLoopTupleAnyintList Exceptionrr.rIsLL  *******. GGG/&/"f6F2F"GHGu%G& G  \ J OC K *+, GGGGGGrH__pycache__/base_events.cpython-311.pyc000064400000262131152533123130013757 0ustar00 !A?hx&6dZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl Z ddl Z ddlZddlZddlZddlZddlZ ddlZn #e$rdZYnwxYwddlmZddlmZddlmZddlmZddlmZdd lmZdd lmZdd lmZdd lmZdd lmZddlm Z ddl!m"Z"dZ#dZ$dZ%e&e dZ'dZ(dZ)dZ*dZ+d%dZ,d&dZ-dZ.e&e drdZ/ndZ/dZ0Gdd ej1Z2Gd!d"ej3Z4Gd#d$ej5Z6dS)'aBase implementation of event loop. The event loop can be broken up into a multiplexer (the part responsible for notifying us of I/O events) and the event loop proper, which wraps a multiplexer with functionality for scheduling callbacks, immediately or at a given time in the future. Whenever a public API takes a callback, subsequent positional arguments will be passed to the callback if/when it is called. This avoids the proliferation of trivial lambdas implementing closures. Keyword arguments for the callback are not supported; this is a conscious design decision, leaving the door open for keyword arguments to modify the meaning of the API call itself. N) constants) coroutines)events) exceptions)futures) protocols)sslproto) staggered)tasks) transports)trsock)logger) BaseEventLoopServerdg?AF_INET6iQc|j}tt|ddtjrt |jSt|S)N__self__) _callback isinstancegetattrr Taskreprrstr)handlecbs @/opt/alt/python-internal/lib64/python3.11/asyncio/base_events.py_format_handlerGsF  B'"j$//<<BK   6{{ch|tjkrdS|tjkrdSt|S)Nzz) subprocessPIPESTDOUTr)fds r _format_piper&Ps2 Z_x z zBxxr cttdstd |tjtjddS#t $rtdwxYw)N SO_REUSEPORTz)reuse_port not supported by socket modulerzTreuse_port not supported by socket module, SO_REUSEPORT defined but not implemented.)hasattrsocket ValueError setsockopt SOL_SOCKETr(OSErrorsocks r_set_reuseportr1Ys 6> * *JDEEE J OOF-v/BA F F F F F J J JIJJ J Js +AA-c ^ttdsdS|dtjtjhvs|dS|tjkr tj}n|tjkr tj}ndS|d}net |tr |dkrd}nGt |tr |dkrd}n) t|}n#ttf$rYdSwxYw|tj kr4tj g}tr|tjn|g}t |tr|d}d|vrdS|D]V} tj||tr|tjkr |||d||||ffcS|||d||ffcS#t&$rYSwxYwdS)N inet_ptonrr idna%)r)r* IPPROTO_TCP IPPROTO_UDP SOCK_STREAM SOCK_DGRAMrbytesrint TypeErrorr+ AF_UNSPECAF_INET _HAS_IPv6appendrdecoder3r.) hostportfamilytypeprotoflowinfoscopeidafsafs r _ipaddr_inforLds 6; ' ' Q*F,>??? Lt v!!!" " " ""t | D% TS[[ D#  42:: t99DD:&   44 !!!~  ( JJv ' ' 'h$#{{6"" d{{t     R & & & 9R6?224T47,KKKKK4T4L8888    D  4s*5CCC6FF F*)F*ctj}|D].}|d}||vrg||<|||/t|}g}|dkr4||dd|dz |dd|dz =|dt jt j |D|S)z-Interleave list of addrinfo tuples by family.rrNc3K|]}||V dSN).0as r z(_interleave_addrinfos..s0 ] ]]]r ) collections OrderedDictrAlistvaluesextend itertoolschain from_iterable zip_longest) addrinfosfirst_address_family_countaddrinfos_by_familyaddrrEaddrinfos_lists reordereds r_interleave_addrinfosrcs$&13311a , , ,*,  'F#**40000.557788OI!A%%+,K-G!-K,KLMMM A > :Q >> ? ?00  !? 3   r c|s2|}t|ttfrdSt j|dSrO) cancelled exceptionr SystemExitKeyboardInterruptr _get_loopstop)futexcs r_run_until_complete_cbrmsa ==??mmoo cJ(9: ; ;  F c!!!!!r TCP_NODELAYc|jtjtjhvrW|jtjkrD|jtjkr1|tjtj ddSdSdSdSNr) rEr*r?rrFr9rGr7r,rnr/s r _set_nodelayrqsn KFNFO< < < V/// f000 OOF.0BA F F F F F = <//00r cdSrOrPr/s rrqrqs r cjt)t|tjrtddSdS)Nz"Socket cannot be of type SSLSocket)sslr SSLSocketr=r/s r_check_ssl_socketrvs1 :dCM::<===r cDeZdZdZdZdZdZdZdZdZ dZ d Z d S) _SendfileFallbackProtocolct|tjstd||_||_||_|j |_ | | ||j r%|jj |_dSd|_dS)Nz.transport should be _FlowControlMixin instance)rr _FlowControlMixinr= _transport get_protocol_proto is_reading_should_resume_reading_protocol_paused_should_resume_writing pause_reading set_protocol_loop create_future_write_ready_fut)selftransps r__init__z"_SendfileFallbackProtocol.__init__s&*">?? NLMM M ))++ &,&7&7&9&9#&,&=#D!!!  & )$(O$9$G$G$I$ID ! ! !$(D ! ! !r cK|jrtd|j}|dS|d{VdS)NzConnection closed by peer)r{ is_closingConnectionErrorr)rrks rdrainz_SendfileFallbackProtocol.drainsR ? % % ' ' ?!"=>> ># ; F r c td)Nz?Invalid state: connection should have been established already. RuntimeError)r transports rconnection_madez)_SendfileFallbackProtocol.connection_madesNOO Or c|jD|(|jtdn|j||j|dS)NzConnection is closed by peer)r set_exceptionrr}connection_lost)rrls rrz)_SendfileFallbackProtocol.connection_lostsw  ,{%33#$BCCEEEE%33C888 ##C(((((r c^|jdS|jj|_dSrO)rr{rrrs r pause_writingz'_SendfileFallbackProtocol.pause_writings/  , F $ 5 C C E Er cZ|jdS|jdd|_dS)NF)r set_resultrs rresume_writingz(_SendfileFallbackProtocol.resume_writings5  ( F ((/// $r c tdNz'Invalid state: reading should be pausedr)rdatas r data_receivedz'_SendfileFallbackProtocol.data_receivedDEEEr c tdrrrs r eof_receivedz&_SendfileFallbackProtocol.eof_receivedrr c K|j|j|jr|j|j|j|jr|jdSdSrO) r{rr}rresume_readingrcancelrrrs rrestorez!_SendfileFallbackProtocol.restores $$T[111  & - O * * , , ,  ,  ! ( ( * * *  & ) K & & ( ( ( ( ( ) )r N) __name__ __module__ __qualname__rrrrrrrrrrPr rrxrxs ) ) )OOO ) ) )FFF %%% FFFFFF ) ) ) ) )r rxcpeZdZ ddZdZdZdZdZdZdZ d Z e d Z d Z d Zd ZdZdS)rNc||_||_d|_g|_||_||_||_||_||_d|_ d|_ dS)NrF) r_sockets _active_count_waiters_protocol_factory_backlog _ssl_context_ssl_handshake_timeout_ssl_shutdown_timeout_serving_serving_forever_fut)rloopsocketsprotocol_factory ssl_contextbacklogssl_handshake_timeoutssl_shutdown_timeouts rrzServer.__init__s[   !1 '&;#%9" $(!!!r c2d|jjd|jdS)N) __class__rrrs r__repr__zServer.__repr__#s"F4>*FFT\FFFFr c8|jJ|xjdz c_dSrp)rrrs r_attachzServer._attach&s*}((( ar c|jdksJ|xjdzc_|jdkr|j|dSdSdS)Nrr)rr_wakeuprs r_detachzServer._detach*s^!A%%%% a   " "t}'< LLNNNNN # "'<'K|]}tj|VdSrO)rTransportSocket)rQss rrSz!Server.sockets..Ls-FF1V+A..FFFFFFr )rtuplers rrzServer.socketsHs. = 2FF FFFFFFr c8|j}|dSd|_|D]}|j|d|_|j9|js |jd|_|jdkr|dSdS)NFr) rr _stop_servingrrrrrr)rrr0s rclosez Server.closeNs- ? F  + +D J $ $T * * * *  % 1-2244 2  % , , . . .(,D %   " " LLNNNNN # "r cfK|tjdd{VdS)Nr)rr sleeprs r start_servingzServer.start_servingas@ k!nnr cK|jtd|d|jtd|d||j|_ |jd{VnH#t j$r6 || d{V#xYwwxYw d|_dS#d|_wxYw)Nzserver z, is already being awaited on serve_forever()z is closed) rrrrrrrCancelledErrorr wait_closedrs r serve_foreverzServer.serve_forevergs(  $ 0N$NNNPP P = ;;;;<< < $(J$<$<$>$>! -+ + + + + + + + +(     &&(((((((((   ,)-D % % %D % , , , ,s6* A87C 8B=.B76B=7B99B==C CcK|j|jdS|j}|j||d{VdSrO)rrrrrA)rrs rrzServer.wait_closed|sX = DM$9 F))++ V$$$ r rO)rrrrrrrrrrrpropertyrrrrrrPr rrrs>B ) ) ) )GGG    *** , , ,GGXG & ---*r rc JeZdZdZdZdZddddZdZdZd\ddd d Z d\d dddddd d dZ d]dZ d^dZ d^dZ d\dZdZdZdZdZdZdZdZdZdZdZdZdZdZd Zd!Zejfd"Z d#Z!d$Z"dd%d&Z#dd%d'Z$dd%d(Z%d)Z&d*Z'd+Z(dd%d,Z)d-Z*d.Z+d/Z,d0d0d0d0d1d2Z-d_d3Z.d`d d4d5Z/d6Z0d7Z1d8Z2d\d9Z3 d^dd0d0d0dddddddd: d;Z4 dad<Z5d`d d4d=Z6d>Z7d?Z8d dddd@dAZ9 d^d0d0d0ddddBdCZ:d0e;j<d0d0d1dDZ=dEZ> d^e;j?e;j@ddFdddddd dG dHZAddddIdJZBdKZCdLZDdMZEeFjGeFjGeFjGd d d0ddddN dOZHeFjGeFjGeFjGd d d0ddddN dPZIdQZJdRZKdSZLdTZMdUZNdVZOdWZPdXZQdYZRdZZSd[ZTdS)brcd|_d|_d|_tj|_g|_d|_d|_d|_ tj dj |_ d|_|t!jd|_d|_d|_d|_d|_t/j|_d|_d|_dS)NrF monotonicg?)_timer_cancelled_count_closed _stoppingrTdeque_ready _scheduled_default_executor _internal_fds _thread_idtimeget_clock_info resolution_clock_resolution_exception_handler set_debugr_is_debug_modeslow_callback_duration_current_handle _task_factory"_coroutine_origin_tracking_enabled&_coroutine_origin_tracking_saved_depthweakrefWeakSet _asyncgens_asyncgens_shutdown_called_executor_shutdown_calledrs rrzBaseEventLoop.__init__s&'# !')) !%!%!4[!A!A!L"& z022333'*##!27/6:3"/++*/').&&&r c d|jjd|d|d|d S)Nrz running=z closed=z debug=r)rr is_running is_closed get_debugrs rrzBaseEventLoop.__repr__sp C' C C$//2C2C C Cnn&& C C/3~~/?/? C C C r c,tj|S)z,Create a Future object attached to the loop.r)rFuturers rrzBaseEventLoop.create_futures~4((((r N)namecontextc||j(tj||||}|jr|jd=nF||||}n||||}tj|||S)zDSchedule a coroutine object. Return a task object. N)rrrr) _check_closedrr r_source_traceback_set_task_name)rcororrtasks r create_taskzBaseEventLoop.create_tasks    %:dD'JJJD% /*2.))$55))$g)FF  t , , , r cT|t|std||_dS)awSet a task factory that will be used by loop.create_task(). If factory is None the default task factory will be set. If factory is a callable, it should have a signature matching '(loop, coro)', where 'loop' will be a reference to the active event loop, 'coro' will be a coroutine object. The callable must return a Future. Nz'task factory must be a callable or None)callabler=r)rfactorys rset_task_factoryzBaseEventLoop.set_task_factorys4  x'8'8 EFF F$r c|jS)zz4BaseEventLoop.shutdown_asyncgens..)s 2 2 2bbiikk 2 2 2r return_exceptionsz;an error occurred during closing of asynchronous generator )messagerfasyncgen) rlenrrVclearr gatherzipr Exceptioncall_exception_handler)r closing_agensresultsresultrFs rshutdown_asyncgensz BaseEventLoop.shutdown_asyncgenss *.'4?##  FT_--   2 2M 2 2 2$"$$$$$$$$ 77  LFD&),, ++ B9= B B!' $ --  r cKd|_|jdS|}tj|j|f}| |d{V|dS#|wxYw)z.Schedule the shutdown of the default executor.TN)targetr1)rrr threadingThread _do_shutdownstartjoin)rfuturethreads rshutdown_default_executorz'BaseEventLoop.shutdown_default_executor5s)-&  ! ) F##%%!):&KKK  LLLLLLL KKMMMMMFKKMMMMs A66B c: |jd|s||jddSdS#t $r@}|s!||j|Yd}~dSYd}~dSd}~wwxYw)NTwait)rshutdownrrCrr[r)rrhexs rrezBaseEventLoop._do_shutdownBs D  " + + + 6 6 6>>## C))&*;TBBBBB C C D D D>>## D))&*>CCCCCCCCC D D D D D D DsA A B/BBc|rtdtjtddS)Nz"This event loop is already runningz7Cannot run the event loop while another loop is running)rrr_get_running_looprs r_check_runningzBaseEventLoop._check_runningKsS ??   ECDD D  # % % 1IKK K 2 1r c||||jt j} t j|_t j |j |j tj | ||jrn d|_d|_tj d|dt j |dS#d|_d|_tj d|dt j |wxYw)zRun until stop() is called.) firstiter finalizerTFN)r rr_set_coroutine_origin_tracking_debugsysget_asyncgen_hooksrc get_identrset_asyncgen_hooksrOrGr_set_running_loop _run_oncer)rold_agen_hookss r run_foreverzBaseEventLoop.run_foreverRsX   ++DK888/11 4'133DO  "T-J-1-J L L L L  $T * * *    > "DN"DO  $T * * *  / / 6 6 6  "N 3 3 3 3 #DN"DO  $T * * *  / / 6 6 6  "N 3 3 3sA*D AEc||tj| }t j||}|rd|_|t | nD#|r<| r(| s| xYw | tn#| twxYw| std|S)a\Run until the Future is done. If the argument is a coroutine, it is wrapped in a Task. WARNING: It would be disastrous to call run_until_complete() with the same coroutine twice -- it would wrap it in two different Tasks and that can't be good. Return the Future's result, or raise its exception. rFz+Event loop stopped before Future completed.)r rrrisfuturer ensure_future_log_destroy_pendingadd_done_callbackrmrrrerfremove_done_callbackrr_)rrhnew_tasks rrun_until_completez BaseEventLoop.run_until_completejsD  '///$V$777  0+0F '  !7888 @         #FKKMM #&2B2B2D2D #  """    ' '(> ? ? ? ?F ' '(> ? ? ? ?{{}} NLMM M}}s8B C- ACC--D cd|_dS)zStop running the event loop. Every callback already scheduled will still run. This simply informs run_forever to stop looping after a complete iteration. TN)rrs rrjzBaseEventLoop.stops r cf|rtd|jrdS|jrt jd|d|_|j|jd|_ |j }|d|_ | ddSdS)zClose the event loop. This clears the queues and shuts down the executor, but does not wait for the executor to finish. The event loop must not be running. z!Cannot close a running event loopNzClose %rTFrl) rrrrwrdebugrrXrrrrnrexecutors rrzBaseEventLoop.closes ??   DBCC C <  F ; + LT * * *   )-&)  %)D "   5  ) ) ) ) ) r c|jS)z*Returns True if the event loop was closed.)rrs rrzBaseEventLoop.is_closeds |r c|s@|d|t||s|dSdSdS)Nzunclosed event loop rI)rrMrr)r_warns r__del__zBaseEventLoop.__del__sk~~  E111?4 P P P P??$$      r c|jduS)z*Returns True if the event loop is running.N)rrs rrzBaseEventLoop.is_runningst+,r c(tjS)zReturn the time according to the event loop's clock. This is a float expressed in seconds since an epoch, but the epoch, precision, accuracy and drift are unspecified and may differ per event loop. )rrrs rrzBaseEventLoop.times~r r c|td|j||z|g|Rd|i}|jr|jd=|S)a;Arrange for a callback to be called at a given time. Return a Handle: an opaque object with a cancel() method that can be used to cancel the call. The delay can be an int or float, expressed in seconds. It is always relative to the current time. Each callback will be called exactly once. If two callbacks are scheduled for exactly the same time, it is undefined which will be called first. Any positional arguments after the callback will be passed to the callback when it is called. Nzdelay must not be Nonerr )r=call_atrr )rdelaycallbackrr1timers r call_laterzBaseEventLoop.call_latersp =455 5 TYY[[50(.T...%,..  " ,'+ r cB|td||jr*|||dt j|||||}|jr|jd=tj |j |d|_ |S)z|Like call_later(), but uses an absolute time. Absolute time corresponds to the event loop's time() method. Nzwhen cannot be Nonerr T) r=r rw _check_thread_check_callbackr TimerHandler heapqheappushr)rwhenrrr1rs rrzBaseEventLoop.call_ats <122 2  ; 6     9 5 5 5"44wGG  " ,'+ t... r c||jr*|||d||||}|jr|jd=|S)aTArrange for a callback to be called as soon as possible. This operates as a FIFO queue: callbacks are called in the order in which they are registered. Each callback will be called exactly once. Any positional arguments after the callback will be passed to the callback when it is called. call_soonr )r rwrr _call_soonr rrrr1rs rrzBaseEventLoop.call_soonsx  ; 8     ; 7 7 7499  # -(, r ctj|stj|rtd|dt |std|d|dS)Nzcoroutines cannot be used with z()z"a callable object was expected by z(), got )r iscoroutineiscoroutinefunctionr=r)rrmethods rrzBaseEventLoop._check_callbacks  "8 , , >.x88 ><&<<<>> >!! %$V$$$$%% % % %r ctj||||}|jr|jd=|j||S)Nr )rHandler rrA)rrr1rrs rrzBaseEventLoop._call_soon sHxtW==  # -(, 6""" r cr|jdStj}||jkrtddS)aoCheck that the current thread is the thread running the event loop. Non-thread-safe methods of this class make this assumption and will likely behave incorrectly when the assumption is violated. Should only be called when (self._debug == True). The caller is responsible for checking this condition for performance reasons. NzMNon-thread-safe operation invoked on an event loop other than the current one)rrcrzr)r thread_ids rrzBaseEventLoop._check_threadsK ? " F'))  ' ''(( ( ( 'r c||jr||d||||}|jr|jd=||S)z"Like call_soon(), but thread-safe.rCr )r rwrrr r:rs rrCz"BaseEventLoop.call_soon_threadsafe%sx  ; C  +A B B B499  # -(,  r c4||jr||d|D|j}||'t jd}||_t j|j |g|R|S)Nrun_in_executorasyncio)thread_name_prefixr) r rwrrr@ concurrentrThreadPoolExecutor wrap_futuresubmit)rrfuncr1s rrzBaseEventLoop.run_in_executor0s  ; :  '8 9 9 9  -H  ( ( * * *%-@@'0A*2&" HOD (4 ( ( (t555 5r cpt|tjjst d||_dS)Nz,executor must be ThreadPoolExecutor instance)rrrrr=rrs rset_default_executorz"BaseEventLoop.set_default_executor@s8(J$6$IJJ LJKK K!)r cH|d|g}|r|d||r|d||r|d||r|d|d|}tjd||}t j||||||} ||z } d|d | d zd d | }| |jkrtj|ntj|| S) N:zfamily=ztype=zproto=zflags=, zGet address info %szGetting address info z took g@@z.3fzms: ) rArgrrrr* getaddrinforinfo) rrCrDrErFrGflagsmsgt0addrinfodts r_getaddrinfo_debugz BaseEventLoop._getaddrinfo_debugEsY!!!!"  - JJ+++ , , ,  ) JJ't'' ( ( (  + JJ))) * * *  + JJ))) * * *iinn *C000 YY[[%dD&$uMM YY[[2 OcOOcOOO8OO , , , K     L   r rrErFrGrc K|jr|j}n tj}|d|||||||d{VSrO)rwrr*rr)rrCrDrErFrGr getaddr_funcs rrzBaseEventLoop.getaddrinfo]sr ; .2LL!-L)) ,dFD%HHHHHHHH Hr cVK|dtj||d{VSrO)rr* getnameinfo)rsockaddrrs rrzBaseEventLoop.getnameinfogsH)) &$h77777777 7r )fallbackchK|jr'|dkrtdt|||||| |||||d{VS#t j$r }|sYd}~nd}~wwxYw|||||d{VS)Nrzthe socket must be non-blocking) rw gettimeoutr+rv_check_sendfile_params_sock_sendfile_nativerSendfileNotAvailableError_sock_sendfile_fallback)rr0fileoffsetcountrrls r sock_sendfilezBaseEventLoop.sock_sendfileks9 ; @4??,,11>?? ?$ ##D$>>> 33D$4:ECCCCCCCC C3          11$28%AAAAAAAA AsA77BBBc<Ktjd|d|d)Nz-syscall sendfile is not available for socket z and file z combinationrrrr0rrrs rrz#BaseEventLoop._sock_sendfile_nativezs@2 -D - - - - -.. .r c|K|r|||rt|tjn tj}t |}d} |rt||z |}|dkrnft |d|}|d|j|d{V} | sn*|||d| d{V|| z }||dkr)t|dr|||zSSS#|dkr)t|dr|||zwwwxYw)NrTseek) rminr!SENDFILE_FALLBACK_READBUFFER_SIZE bytearray memoryviewrreadinto sock_sendallr)) rr0rrr blocksizebuf total_sentviewreads rrz%BaseEventLoop._sock_sendfile_fallbacks   IIf    FCyB C C C#E  ""  / # #EJ$6 B BI A~~!#z z2!11$ tLLLLLLLL''d5D5k:::::::::d"  #A~~'$"7"7~ &:-....~zA~~'$"7"7~ &:-....~s BD 2D;cdt|ddvrtd|jtjkstd|_t |t s"td||dkr"td|t |t s"td||dkr"td|dS)Nbmodez$file should be opened in binary modez+only SOCK_STREAM type sockets are supportedz+count must be a positive integer (got {!r})rz0offset must be a non-negative integer (got {!r})) rr+rFr*r9rr<r=formatrs rrz$BaseEventLoop._check_sendfile_paramss) gdFC00 0 0CDD DyF...JKK K  eS)) QAHHOOQQQzz AHHOOQQQ&#&& BII  A::BII  :r cKg}|j||\}}}}} d} tj|||} | d||D]\} }}}} | |kr | | n#t$rS} d| d| j}t | j|} || Yd} ~ d} ~ wwxYw|r|t d|d| | | d{V| dx}}S#t$r1} || | | d} ~ w| | xYw#dx}}wxYw)z$Create, bind and connect one socket.NrErFrGF*error while attempting to bind on address : z&no matching local address with family=z found) rAr* setblockingbindr.strerrorlowererrnopop sock_connectr)rr addr_infolocal_addr_infos my_exceptionsrEtype_rG_r(r0lfamilyladdrrlrs r _connect_sockzBaseEventLoop._connect_socks  -(((+4(ua$ .=U%HHHD   U # # #+/?YY+GQ1e&((  2 %((("2226',66"|113366 &ci55%,,S111111112%Y+//111%&W&W&W&WXXX##D'22 2 2 2 2 2 2 2*. -J      % % %   )- -J - - - -sO?D" A75D"7 CA C D"CA D"" E4,,EE44E77E=) rtrErGrr0 local_addrr!rrhappy_eyeballs_delay interleavec vK| |std| |r|std|} | |std| |std|t|| |d}|||td||f|tj||d{V}|st d | =| |tj||d{Vst d nd|rt ||}g| 5|D]1} |d{V}n#t $rY.wxYwn/tj fd |D| d{V\}}}|d D tdkrd td tfdDrd t d ddD#dwxYwn8|td|jtjkrtd||||| | | d{V\}}jr.|d}t'jd|||||||fS)aConnect to a TCP server. Create a streaming transport connection to a given internet host and port: socket family AF_INET or socket.AF_INET6 depending on host (or family if specified), socket type SOCK_STREAM. protocol_factory must be a callable returning a protocol instance. This method is a coroutine which will try to establish the connection in the background. When successful, the coroutine returns a (transport, protocol) pair. Nz+server_hostname is only meaningful with sslz:You must set server_hostname when using ssl without a host1ssl_handshake_timeout is only meaningful with ssl0ssl_shutdown_timeout is only meaningful with sslr8host/port and sock can not be specified at the same timerErFrGrr!getaddrinfo() returned empty listc3PK|] }tjj|V!dSrO) functoolspartialr)rQrr laddr_infosrs rrSz2BaseEventLoop.create_connection..5sR,,!&t'9'18[JJ,,,,,,r rcg|] }|D]}| SrPrP)rQsubrls rrSz3BaseEventLoop.create_connection..;s%GGGc3GGCcGGGGr rc3>K|]}t|kVdSrOr)rQrlmodels rrSz2BaseEventLoop.create_connection..Bs.GGSs3xx50GGGGGGr zMultiple exceptions: {}rc34K|]}t|VdSrOr )rQrls rrSz2BaseEventLoop.create_connection..Gs(%E%E3c#hh%E%E%E%E%E%Er z5host and port was not specified and no sock specified"A Stream Socket was expected, got )rrr*z%r connected to %s:%r: (%r, %r))r+rv_ensure_resolvedr*r9r.rcrr staggered_racerWrallrrgrF_create_connection_transportrwget_extra_inforr)rrrCrDrtrErGrr0rr!rrrrinfosrrrrrrr s` @@@rcreate_connectionzBaseEventLoop.create_connections&  &s &JKK K  "s " B "ABBB"O ,S ,CEE E +C +BDD D   d # # #  + 0BJ  t/ NPPP//t V'uE0NNNNNNNNE CABBB%$($9$9v+5d%:%,%,,,,,,, #G!"EFFFG#  A-eZ@@J#+ %!!H!%)%7%7&+&?&? ? ? ? ? ? ?"!!! !$-#;,,,,,,%*,,,)t $5$5$5555555 a |GGZGGG  &:!++(m+!$JqM 2 2GGGGJGGGGG0",Q-/&&?&F&F II%E%E*%E%E%EEE'G'GHHH"&J%%%%$| KMMMyF...!AAACCC%)$E$E "C"7!5%F%7%7777777 8 ; @++H55D L:tT9h @ @ @(""sD== E  E  BHH"c \K|d|}|} |r7t|trdn|} |||| | ||||} n|||| } | d{Vn#| xYw| |fS)NFr r!rr)rrrboolr&rr) rr0rrtr!r rrrrr%rs rrz*BaseEventLoop._create_connection_transportes ##%%##%%  L!+C!6!6?CJ00h F'&;%9 1;;II 33D(FKKI LLLLLLLL  OO    (""s BB'cK|rtdt|dtjj}|tjjurtd||tjjur> |||||d{VS#tj $r }|sYd}~nd}~wwxYw|std|| ||||d{VS)aSend a file to transport. Return the total number of bytes which were sent. The method uses high-performance os.sendfile if available. file must be a regular file object opened in binary mode. offset tells from where to start reading the file. If specified, count is the total number of bytes to transmit as opposed to sending the file until EOF is reached. File position is updated on return or also in case of error in which case file.tell() can be used to figure out the number of bytes which were sent. fallback set to True makes asyncio to manually read and send the file when the platform does not support the sendfile syscall (e.g. Windows or SSL socket on Unix). Raise SendfileNotAvailableError if the system does not support sendfile syscall and fallback is False. zTransport is closing_sendfile_compatiblez(sendfile is not supported for transport NzHfallback is disabled and native sendfile is not supported for transport ) rrrr _SendfileMode UNSUPPORTED TRY_NATIVE_sendfile_nativerr_sendfile_fallback)rrrrrrrrls rsendfilezBaseEventLoop.sendfiles0    ! ! 7566 6y"8 .:<< 9*6 6 6H9HHJJ J 9*5 5 5 !229d395BBBBBBBBB7     :9+499:: :,,Y-3U<<<<<<<< E88A Grc Kttdt|tjst d|t |ddst d|d|}tj||||||||d } | | | | | j |} | |j } |d{VnK#t$r>|| | wxYw| jS) zzUpgrade transport to TLS. Return a new transport that *protocol* should start using immediately. Nz"Python ssl module is not availablez@sslcontext is expected to be an instance of ssl.SSLContext, got _start_tls_compatibleFz transport z is not supported by start_tls())rrr")rtrr SSLContextr=rrr SSLProtocolrrrrr BaseExceptionrr_app_transport) rrrr%r r!rrr ssl_protocol conmade_cb resume_cbs r start_tlszBaseEventLoop.start_tlss ;CDD D*cn55 '&!&&'' 'y"95AA LJYJJJLL L##%%+ (J "7!5!& (((  !!!|,,,^^L$@)LL NN9#;<<  LLLLLLLL    OO                   **s 9DAE )rErGr reuse_portallow_broadcastr0c K| | jtjkrtd| s s |s|s|s|s|rZt |||||} dd| D} td| d| dd} ns s|d krtd ||fd ff} nttd r|tj krfD](}|$t|tstd )rd dvry tjtj jrtjn8#t$$rYn,t&$r }t)jd|Yd}~nd}~wwxYw||ffff} ni}d fdffD]\}}|t|t,rt/|dkstd|||tj|||d{V}|st'd|D]"\}}}}}||f}||vrddg||<||||<#fd|D} | stdg}| D]\\}}\}}d} d} tj|tj|} |rt5| |r+| tjtjd| dr| |r |s|| |d{V|} n\#t&$r0}| | |j!|Yd}~d}~w| | xYw|d |}|"}|#| || |}|j$r2rt)j%d||nt)j&d|| |d{Vn#| xYw||fS)zCreate datagram connection.Nz$A datagram socket was expected, got )r remote_addrrErGrr.r/rc3.K|]\}}||d|VdS)=NrP)rQkvs rrSz9BaseEventLoop.create_datagram_endpoint..s5$N$NDAqA$NZZAZZ$N$N$N$N$N$Nr zKsocket modifier keyword arguments can not be used when sock is specified. ()Frzunexpected address familyNNAF_UNIXzstring is expected)rz2Unable to check or remove stale UNIX socket %r: %rrz2-tuple is expectedrrcFg|]\}}r|dr|d||fS)rNrrP)rQkey addr_pairrr1s rrSz:BaseEventLoop.create_datagram_endpoint..BsU#E#E#E)7i'#E,5aL,@(-A-6q\-A)$-A-A-Ar zcan not get address informationrz@Datagram endpoint local_addr=%r remote_addr=%r created: (%r, %r)z2Datagram endpoint remote_addr=%r created: (%r, %r))'rFr*r9r+dictrgitemsrr)r8rrr=statS_ISSOCKosst_moderemoveFileNotFoundErrorr.rerrorrrWrr:r1r,r- SO_BROADCASTrrrrArr)rwrr)rrrr1rErGrr.r/r0optsproblemsr_addraddr_pairs_infor`err addr_infosidxrfamrpror(r<r local_addressremote_addressrlrrrs `` rcreate_datagram_endpointz&BaseEventLoop.create_datagram_endpointsO  yF... C4CCEEE =k = =# =', = ="1 =z{#)e'1,;=== 99$N$NDJJLL$N$N$NNN <08<<<===   U # # #FF2 H+2 HQ;;$%@AAA%+UO\#B"D++. H&.0H0H'5>>D' 40E0E''(<=== 6*Q-{"B"B 6=)<)<)DEE2Ij111,"666 &5%/666666666 &,UO%/$=$?#B #$j/A{3C!D;;IC' *4 7 7CCIINN"+,A"B"BB&*&;&; f6G"'u4'<'A'A!A!A!A!A!A!A %O")*M"N"NN7<;;3CCG#&*C"*4437, 33:JsOC00#E#E#E#E#E;E;K;K;M;M#E#E#E 'H$%FGGGJ6E $ $2&%0-!=%F,=ULLLD!-&t,,,&G"-v/BAGGG$$U+++!1 -000"0.J"&"3"3D."I"IIIIIIII!/E+++' %J%c********' !m###%%##%%11 (FF,, ; ? ? 0& YJJJJ (()X??? LLLLLLLL  OO    (""sC0?E00 F%< F%F  F%#B-M N#&NN#P''P>cK|dd\}}t|||||g|ddR} | | gS|||||||d{VS)Nr:r)rLr) rr(rErFrGrrrCrDrs rrzBaseEventLoop._ensure_resolvedsRaR[ dD$eJgabbkJJJ  6M))$V$05U*DDDDDDDD Dr cK|||f|tj||d{V}|std|d|S)N)rErFrrz getaddrinfo(z) returned empty list)rr*r9r.)rrCrDrErrs r_create_server_getaddrinfoz(BaseEventLoop._create_server_getaddrinfos++T4L171C27d,DDDDDDDD HFFFFGG G r r) rErr0rrt reuse_addressr.rrrc Kt|trtd| |td| |td|t |||td| t jdkotjdk} g}|dkrdg}n:t|tst|tj j s|g}n|}fd |D}tj|d{V}tt j|}d } |D]}|\}}}}} t'j|||}n5#t&j$r#jrt-jd |||d YTwxYw||| r+|t&jt&jd | rt9|t:rP|t&jkr@t?t&dr+|t&j t&j!d  |"|#tF$r}d|d|j$%}|j&tLj'krI|(|)jrt-j|Yd}~tG|j&|dd}~wwxYw|stGdd|Dd }|s|D]}|)n\#|s|D]}|)wwxYw|td|j*t&j+krtd||g}|D]}|,d t[||||| | }| r.|.tj/dd{Vjrt-j0d||S)a1Create a TCP server. The host parameter can be a string, in that case the TCP server is bound to host and port. The host parameter can also be a sequence of strings and in that case the TCP server is bound to all hosts of the sequence. If a host appears multiple times (possibly indirectly e.g. when hostnames resolve to the same IP address), the server is only bound once to that host. Return a Server object which can be used to stop the service. This method is a coroutine. z*ssl argument must be an SSLContext or NoneNrrrposixcygwinr4cBg|]}|S))rEr)rV)rQrCrErrDrs rrSz/BaseEventLoop.create_server..sG%%%11$V8=2??%%%r Fz:create_server() failed to create socket.socket(%r, %r, %r)Texc_info IPPROTO_IPV6rrz%could not bind on any address out of cg|] }|d S)rP)rQrs rrSz/BaseEventLoop.create_server..s%@%@%@$d1g%@%@%@r z)Neither host/port nor sock were specifiedrrz %r is serving)1rrr=r+rvrBrrxplatformrrTabcIterabler rYsetrYrZr[r*rFrwrwarningrAr,r- SO_REUSEADDRr1r@rr)r^ IPV6_V6ONLYrr.rrr EADDRNOTAVAILrrrFr9rrrrr)rrrCrDrErr0rrtrWr.rrrrhostsfsr completedresrKsocktyperG canonnamesarLrrs` ``` r create_serverzBaseEventLoop.create_servers-8 c4  JHII I ,CEE E + BDD D   d # # #  t/ NPPP$ "7 2 Os|x7O GrzzT3''  {'?@@ %%%%%%%#%%%B ,+++++++E 55e<<==EI2 % '@'@C9<6B%B!%}R5AA!<!!!;O"N,G+-xOOOO! !NN4((($J"-v/BDJJJ!-&t,,,".&/11#FN;;2(;(.(:(,... @ " " @ @ @ @#%""cl&8&8&:&:&: <9(;;;#KKMMM JJLLL#{4 &s 3 3 3$HHHH%ci554? @D!'%@%@%%@%@%@%@#CDDD!  % '%% !% '%% %%| !LMMMyF... !Nd!N!NOOOfG $ $D   U # # # #g'7W&;,..  !  ! ! # # #+a.. ; 1 K 0 0 0 sb4 L1EL1/F L1 F  B-L19IL1 K2A7K-L1K--K22#L11M)rtrrc zK|jtjkrtd|||std||std|t |||||dd||d{V\}}|jr,|d}tj d|||||fS) Nrrrr4T)r rrr*z%r handled: (%r, %r)) rFr*r9r+rvrrwrrr)rrr0rtrrrrs rconnect_accepted_socketz%BaseEventLoop.connect_accepted_socket"s! 9* * *J$JJKK K ,S ,CEE E +C +BDD D   d # # #$($E$E "C"7!5%F%7%7777777 8 ; L++H55D L/y( K K K(""r c K|}|}||||} |d{Vn#|xYw|jr)t jd|||||fS)Nz Read pipe %r connected: (%r, %r))rr-rrwrrfilenorrr,rrrs rconnect_read_pipezBaseEventLoop.connect_read_pipe@s##%%##%%2246JJ  LLLLLLLL  OO     ; = L; 8 = = =("" AAc K|}|}||||} |d{Vn#|xYw|jr)t jd|||||fS)Nz!Write pipe %r connected: (%r, %r))rr/rrwrrrtrus rconnect_write_pipez BaseEventLoop.connect_write_pipePs##%%##%%33D(FKK  LLLLLLLL  OO     ; = L< 8 = = =(""rwc|g}|%|dt||6|tjkr&|dt|nN|%|dt||%|dt|t jd|dS)Nzstdin=zstdout=stderr=zstdout=zstderr= )rAr&r"r$rrrg)rrr3r4r5rs r_log_subprocesszBaseEventLoop._log_subprocess`su   KK6e!4!466 7 7 7  &J,="="= KK?f)=)=?? @ @ @ @! rUrfr4z+Object created at (most recent call last): z+Handle created at (most recent call last): r r\)getrF __traceback__rr sortedrg traceback format_listrstriprrArrF) rrrUrfr] log_linesr<valuetbs rdefault_exception_handlerz'BaseEventLoop.default_exception_handlers++i(( :9GKK ,,  YI4KLHHH g - -$0$61$6 & 'I '?? 0 0C...CLE(((WWY2599::F$***WWY2599::F$U    ..u.. / / / / TYYy))H======r c|jP ||dS#ttf$rt$rt jddYdSwxYw |||dS#ttf$rt$rc} |d||dn7#ttf$rt$rt jddYn wxYwYd}~dSYd}~dSd}~wwxYw)aDCall the current event loop's exception handler. The context argument is a dict containing the following keys: - 'message': Error message; - 'exception' (optional): Exception object; - 'future' (optional): Future instance; - 'task' (optional): Task instance; - 'handle' (optional): Handle instance; - 'protocol' (optional): Protocol instance; - 'transport' (optional): Transport instance; - 'socket' (optional): Socket instance; - 'asyncgen' (optional): Asynchronous generator that caused the exception. New keys maybe introduced in the future. Note: do not overload this method in an event loop subclass. For custom exception handling, use the `set_exception_handler()` method. Nz&Exception in default exception handlerTr\z$Unhandled error in exception handler)rUrfrzeException in default exception handler while handling an unexpected error in custom exception handler)rrrgrhr(rrF)rrrls rr\z$BaseEventLoop.call_exception_handlers,  " * ,..w77777 12     , , , E&*,,,,,,,  , 0''g66666 12     0 0 0022#I%(#*44 #$56$000L"?+/0000000000000 0sE 1AAA11C/ B'&C*'1CC*CC**C/cL|js|j|dSdS)zAdd a Handle to _ready.N) _cancelledrrArrs r _add_callbackzBaseEventLoop._add_callback4s3  ' K  v & & & & & ' 'r cX|||dS)z6Like _add_callback() but called from a signal handler.N)rr:rs r_add_callback_signalsafez&BaseEventLoop._add_callback_signalsafe9s. 6""" r c8|jr|xjdz c_dSdS)z3Notification that a TimerHandle has been cancelled.rN)rrrs r_timer_handle_cancelledz%BaseEventLoop._timer_handle_cancelled>s1   -  ' '1 , ' ' ' ' - -r ct|j}|tkrf|j|z tkrSg}|jD]&}|jrd|_||'tj|||_d|_nb|jr[|jdjrI|xjdzc_tj |j}d|_|jr|jdjId}|j s|j rd}nQ|jrJ|jdj }ttd||z t }|j|}||d}||jz}|jrZ|jd}|j |krnAtj |j}d|_|j ||jZt|j }t+|D]} |j }|jr#|jr ||_|} ||| z } | |jkr#t7jdt;|| d|_#d|_wxYw|d}dS)zRun one full iteration of the event loop. This calls all currently ready callbacks, polls for I/O, schedules the resulting callbacks, and finally schedules 'call_later' callbacks. FrrNzExecuting %s took %.3f seconds)rWr_MIN_SCHEDULED_TIMER_HANDLESr%_MIN_CANCELLED_TIMER_HANDLES_FRACTIONrrArheapifyheappoprr_whenrmaxrMAXIMUM_SELECT_TIMEOUT _selectorselectr=rrangepopleftrwr_runrrrer) r sched_count new_scheduledrtimeoutrr<end_timentodoirrs rr}zBaseEventLoop._run_onceCs$/** 6 6 6  '+ 55 6 6M/ 1 1$1(-F%%!((0000 M- ( ( (+DO*+D ' '/ *doa&8&C *++q0++t77$)!/ *doa&8&C *  ; N$. NGG _ N?1%+D#a !3446LMMG^**733  Z((( 99;;!77o '_Q'F|x'']4?33F %F  K  v & & & o 'DK  u  A[((**F  {  0+1D(BKKMMMr)BT888'G'5f'='=rCCC,0D((4D(//// s A4K K ct|t|jkrdS|r7tj|_tjt jntj|j||_dSrO)rrrx#get_coroutine_origin_tracking_depthr#set_coroutine_origin_tracking_depthrDEBUG_STACK_DEPTHrenableds rrvz,BaseEventLoop._set_coroutine_origin_trackings ==D!HII I I F  =799  7  3+ - - - -  3; = = =3:///r c|jSrO)rwrs rrzBaseEventLoop.get_debugs {r cv||_|r||j|dSdSrO)rwrrCrvrs rrzBaseEventLoop.set_debugsG ??   T  % %d&I7 S S S S S T Tr rO)NNNr7)r)rN)FNN)Urrrrrrrrrrr&r)r-r/r8r:r=r r@rGrOr`rjrerrrrrjrrrKrLrrrrrrrrrrCrrrrrrrrrrrrr rrr-rSr*r9rrVr> AI_PASSIVErprrrvryr|r"r#rrrrrr\rrrr}rvrrrPr rrrs///<   ))))-d* % % %""""%)$""""" 9=" $t"&!%!% """""CG"""" @D(,"""" AE)-""""04"""" """"""777DDDGGG """2   DDDKKK4440$$$L***.%M ---   :>06:$26&%%%((("=A     555 *** 2"#!1HHHHH7777 A(, A A A A A...///4**.*.*.*.Z59G#14T"&!%!%$G#G#G#G#G#V*/"&!% ####8-<#'-<-<-<-<-<^111"""4%*(,.2-1 .+.+.+.+.+bEID#./q267;$ D#D#D#D#D#N'(f.@%&a D D D D D59I##"&!%IIIIIZ"&!% #####<### ### % % %&0_&0o&0o27%)1(,T "#"#"#"#"#J%/OJO%/_$)1'+Dt # # # # #D''' ***"0>0>0>d707070r'''  --- NNN` : : :TTTTTr r)rr)r)7__doc__rTcollections.abcconcurrent.futuresrrrrrYrBr*r@r"rcrrrxrKrrt ImportErrorr4rrrrrr r r r r rlogr__all__rrr)r@rrr&r1rLrcrmrqrvProtocolrxAbstractServerrAbstractEventLooprrPr rrsm       JJJJ CCC $ #),% GFJ ' ' #JJJ8888v,""" 76=!! GGGG    >>> A)A)A)A)A) 2A)A)A)HnnnnnV "nnnbeTeTeTeTeTF,eTeTeTeTeTsA AA__pycache__/staggered.cpython-311.pyc000064400000015000152533123130013415 0ustar00 !A?hh.dZdZddlZddlZddlmZddlmZddlmZddlm Z dd d ej ej gej fd ej ed ejd ejejej eejej effdZdS)zFSupport for running coroutines in parallel with staggered start times.)staggered_raceN)events) exceptions)locks)tasks)loopcoro_fnsdelayr returnc  Kptjt| dd g g dtjt jddf  fd  d} | d}|t krtj d{V\}}t|} |D]R}| r<| s(|r|S|t k f D]}|S# D]}|wxYw)aRun coroutines with staggered start times and take the first to finish. This method takes an iterable of coroutine functions. The first one is started immediately. From then on, whenever the immediately preceding one fails (raises an exception), or when *delay* seconds has passed, the next coroutine is started. This continues until one of the coroutines complete successfully, in which case all others are cancelled, or until all coroutines fail. The coroutines provided should be well-behaved in the following way: * They should only ``return`` if completed successfully. * They should always raise an exception if they did not complete successfully. In particular, if they handle cancellation, they should probably reraise, like this:: try: # do work except asyncio.CancelledError: # undo partially completed work raise Args: coro_fns: an iterable of coroutine functions, i.e. callables that return a coroutine object when called. Use ``functools.partial`` or lambdas to pass arguments. delay: amount of time, in seconds, between starting coroutines. If ``None``, the coroutines will run sequentially. loop: the event loop to use. Returns: tuple *(winner_result, winner_index, exceptions)* where - *winner_result*: the result of the winning coroutine, or ``None`` if no coroutines won. - *winner_index*: the index of the winning coroutine in ``coro_fns``, or ``None`` if no coroutines won. If the winning coroutine may return None on success, *winner_index* can be used to definitively determine whether any coroutine won. - *exceptions*: list of exceptions returned by the coroutines. ``len(exceptions)`` is equal to the number of coroutines actually started, and the order is the same as in ``coro_fns``. The winning coroutine's entry is ``None``. Nprevious_failedr cJK|ctjtj5t j| d{Vdddn #1swxYwY t \}}n#t$rYdSwxYwtj }  |} |t|dzksJ dt |dzksJ |d{V}J||tD]\}}||kr| dS#t t"f$rt$$r$}| |<|Yd}~dSd}~wwxYw)Nr) contextlibsuppressexceptions_mod TimeoutErrorrwait_forwaitnext StopIterationrEvent create_taskappendlen enumeratecancel SystemExitKeyboardInterrupt BaseExceptionset)r this_indexcoro_fn this_failed next_taskresultiter enum_coro_fnsrr run_one_coro running_tasks winner_index winner_results >/opt/alt/python-internal/lib64/python3.11/asyncio/staggered.pyr,z$staggered_race..run_one_coroRsZ  &$^%@AA D D n_%9%9%;%;UCCCCCCCCC  D D D D D D D D D D D D D D D "&}"5"5 J    FF kmm $$\\+%>%>?? Y'''=!!Z!^3333$:*q.0000 "799______F '''%L"M"-00  1 ??HHJJJ  %-.       %&Jz " OO          s;.AA"%A"*A== B  B E##F">FF"r)rget_running_looprtypingOptionalrrrrrrrdone cancelled exceptionr)r r r first_task done_countr4_dr)r+rr,r-r.r/s `` @@@@@@r0rrsz  ,6*,,Dh''MMLJM.#_U[9.>B.............`!!,,t"4"455J$$$ C ....!J}55555555GD!TJ ,,,Avvxx, ,!++--,kkmm+C ....lJ6  A HHJJJJ   A HHJJJJ s B.EE9)__doc____all__rr2rrrrrIterableCallable Awaitabler3floatAbstractEventLoopTupleAnyintList Exceptionrr0rJsLL  *******. GGG/&/"f6F2F"GHGu%G& G  \ J OC K *+, GGGGGGrI__pycache__/base_futures.cpython-311.opt-2.pyc000064400000006141152533123130015105 0ustar00 !A?hxdZddlZddlmZddlmZdZdZdZd Z d Z d Z ej d Z dS) N) get_ident)format_helpersPENDING CANCELLEDFINISHEDc@ t|jdo|jduS)N_asyncio_future_blocking)hasattr __class__r )objs A/opt/alt/python-internal/lib64/python3.11/asyncio/base_futures.pyisfuturers. CM#= > > 5  ( 46c t|}|sd}d}|dkr||dd}n|dkrAd||dd||dd}nJ|dkrDd||dd|dz ||dd}d |d S) Nc,tj|dS)Nr)r_format_callback_source)callbacks r format_cbz$_format_callbacks..format_cbs5hCCCrrrz{}, {}z{}, <{} more>, {}zcb=[])lenformat)cbsizers r_format_callbacksrs- r77D  DDD qyy Yr!uQx   __YYr!uQx00))BqE!H2E2E F F  ' ' "Q%((;(;(,q(1 "R&)(<(<>> "<<<rc |jg}|jtkrV|j|d|jn1t j|j}|d||jr'|t|j|j r4|j d}|d|dd|d|S)Nz exception=zresult=rz created at r:r) _statelower _FINISHED _exceptionappendreprlibrepr_result _callbacksr_source_traceback)futureinforesultframes r_future_repr_infor0-s- M   ! ! "D } !!   ( KK:V%6:: ; ; ; ;\&.11F KK*&** + + + : %f&788999 9(, 7%(77U1X77888 Krcldt|}d|jjd|dS)N <>)joinr0r __name__)r,r-s r _future_reprr7As; 88%f-- . .D 2v( 2 24 2 2 22r)__all__r'_threadrrr_PENDING _CANCELLEDr$rrr0recursive_reprr7rrrr=s     666((33333r__pycache__/tasks.cpython-311.opt-1.pyc000064400000117747152533123130013561 0ustar00 !A?hdZdZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddlm Z ddl m Z ddl mZddl mZdd l mZdd l mZdd lmZejdjZd-d Zd-d ZdZGddejZeZ ddlZejxZZn #e$rYnwxYwddddZejj Z ejj!Z!ejj"Z"de"ddZ#dZ$dZ%dZ&dZ'dddZ(ej)dZ*d-dZ+dddZ,dddZ-ej)d Z.ee._Gd!d"ej/Z0d#d$d%Z1d&Z2d'Z3e j4Z5iZ6d(Z7d)Z8d*Z9d+Z:e7Z;e:Z dd,lm7Z7m:Z:m8Z8m9Z9m5Z5m6Z6e7Z?e:Z@e8ZAe9ZBdS#e$rYdSwxYw).z0Support for tasks, coroutines and the scheduler.)Task create_taskFIRST_COMPLETEDFIRST_EXCEPTION ALL_COMPLETEDwaitwait_for as_completedsleepgathershield ensure_futurerun_coroutine_threadsafe current_task all_tasks_register_task_unregister_task _enter_task _leave_taskN) GenericAlias) base_tasks) coroutines)events) exceptions)futures) _is_coroutinecT|tj}tj|S)z!Return a currently executed task.)rget_running_loop_current_tasksgetloops :/opt/alt/python-internal/lib64/python3.11/asyncio/tasks.pyrr#s& |&((  d # ##ctjd} tt}n#t$r|dz }|dkrYnwxYw3fd|DS)z'Return a set of all tasks for the loop.NrTrichh|].}tj|u|,|/S)r _get_loopdone).0tr#s r$ zall_tasks..=sE > > >! ##t++AFFHH+ +++r%)rrlist _all_tasks RuntimeError)r#itaskss` r$rr*s |&(( A $$E      FADyyy  > > > >u > > >>s0A A c|B |j}||dS#t$r tjdtdYdSwxYwdS)Nz~Task.set_name() was added in Python 3.8, the method support will be mandatory for third-party task implementations since 3.13. stacklevel)set_nameAttributeErrorwarningswarnDeprecationWarning)tasknamer7s r$_set_task_namer>As  }H HTNNNNN  8 8 8 M9)Q 8 8 8 8 8 8 8 8s&AAceZdZdZdZddddfd ZfdZeeZ dZ dZ d Z d Z d Zd Zdd dZddddZddZdZdZdfd ZdZxZS)rz A coroutine wrapped in a Future.TN)r#r=contextct||jr|jd=tj|sd|_t d||dt|_nt||_d|_ d|_ d|_ ||_ |tj|_n||_|j|j|jt)|dS)Nr"Fza coroutine was expected, got zTask-rr@)super__init___source_tracebackr iscoroutine_log_destroy_pending TypeError_task_name_counter_namestr_num_cancels_requested _must_cancel _fut_waiter_coro contextvars copy_context_context_loop call_soon _Task__stepr)selfcoror#r=r@ __class__s r$rEz Task.__init__js d###  ! +&r*%d++ G).D %ETEEFF F <7!3!5!577DJJTDJ&'#! ?'466DMM#DM T[$-@@@tr%c|jtjkr7|jr0|dd}|jr |j|d<|j|tdS)Nz%Task was destroyed but it is pending!)r<messagesource_traceback) _stater_PENDINGrHrFrTcall_exception_handlerrD__del__)rWr@rYs r$r`z Task.__del__sy ;'* * *t/H *BG% E.2.D*+ J - -g 6 6 6 r%c*tj|SN)r _task_reprrWs r$__repr__z Task.__repr__s$T***r%c|jSrb)rPrds r$get_coroz Task.get_coro zr%c|jSrb)rKrds r$get_namez Task.get_namerhr%c.t||_dSrb)rLrK)rWvalues r$r7z Task.set_namesZZ r%c td)Nz*Task does not support set_result operationr0)rWresults r$ set_resultzTask.set_resultsGHHHr%c td)Nz-Task does not support set_exception operationrn)rW exceptions r$ set_exceptionzTask.set_exceptionsJKKKr%)limitc,tj||S)aReturn 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_task_get_stack)rWrts r$ get_stackzTask.get_stacks*)$666r%)rtfilec.tj|||S)anPrint 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_task_print_stack)rWrtrxs r$ print_stackzTask.print_stacks+D%>>>r%cd|_|rdS|xjdz c_|j|j|rdSd|_||_dS)aRequest 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). This also increases the task's count of cancellation requests. FrNmsgT)_log_tracebackr*rMrOcancelrN_cancel_message)rWr~s r$rz Task.cancelsx,$ 99;; 5 ##q(##   '&&3&// t "tr%c|jS)zReturn the count of the task's cancellation requests. This count is incremented when .cancel() is called and may be decremented using .uncancel(). rMrds r$ cancellingzTask.cancellings **r%cF|jdkr|xjdzc_|jS)zDecrement the task's count of cancellation requests. This should be called by the party that called `cancel()` on the task beforehand. Returns the remaining number of cancellation requests. rrrrds r$uncancelz Task.uncancels/  & * *  ' '1 , ' '**r%c|rtjd|d||jr5t |tjs|}d|_|j}d|_t|j | || d}n| |}t|dd}|8tj||j ur?t!d|d|d}|j |j||jn|r||ur;t!d |}|j |j||jnnd|_||j|j||_|jr'|j|j rd|_nt!d |d |}|j |j||jn|(|j |j|jnt3j|r>t!d |d |}|j |j||jnUt!d|}|j |j||jn#t6$rf}|jr/d|_t9|j n&t9|jYd}~nd}~wtj$r1}||_t9Yd}~nqd}~wt@tBf$r'}t9"|d}~wtF$r+}t9"|Yd}~nd}~wwxYwtI|j |d}dS#tI|j |d}wxYw)Nz_step(): already done: z, F_asyncio_future_blockingzTask z got Future z attached to a different looprCzTask cannot await on itself: r}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*rInvalidStateErrorrN isinstanceCancelledError_make_cancelled_errorrPrOrrTsendthrowgetattrrr)r0rUrVrSradd_done_callback _Task__wakeuprrinspect isgenerator StopIterationrDrprl_cancelled_excKeyboardInterrupt SystemExitrs BaseExceptionr)rWexcrXroblockingnew_excrYs r$__stepz Task.__steps 99;; =.;$;;C;;== =   &c:#<== 30022 %D zDJ%%%H {4C$v'A4HHH#$V,,DJ>>*CCC!CCCDDGJ(( Wdm)EEEEE~~".DDDD#F#F ,, K$--IIII;@700 M4=1BBB+1(,:#/66(,(< 7 > >:49 1*<#'<<17<<==GJ(( Wdm)EEEE $$T[$-$HHHH$V,, A&B)-BB7=BBCC $$K$-%AAAA''Hf'H'HII $$K$-%AAAA{ . . .  .$)!4#78888""39---(   "%D  GGNN        !:.    GG ! !# & & &  ' ' ' GG ! !# & & & & & & & & 'd  D ) ) )DDD  D ) ) )DKKKKsb-K=HO3 O AL+&O3+O='M)$O3)O="N O,!O O3OO33P c ||n,#t$r}||Yd}~nd}~wwxYwd}dSrb)rorVr)rWfuturers r$__wakeupz Task.__wakeup[sr  MMOOO KKMMMM    KK         s+ AAArb)__name__ __module__ __qualname____doc__rHrEr` classmethodr__class_getitem__rergrjr7rprsrwr{rrrrVr __classcell__rYs@r$rrNs+*. %)d6     $ L11+++   IIILLL"&77777.$(d ? ? ? ? ?((((T+++ + + +UUUUUUnr%r)r=r@ctj}|||}n|||}t|||S)z]Schedule the execution of a coroutine object in a spawn task. Return a Task object. NrC)rrrr>)rXr=r@r#r<s r$rrxsY  " $ $D%%g664 Kr%)timeout return_whencKtj|stj|r$t dt |j|std|tttfvrtd|t|}td|Drt dtj}t||||d{VS)a}Wait for the Futures or Tasks 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 zSet of Tasks/Futures is empty.zInvalid return_when value: c3>K|]}tj|VdSrb)rrG)r+fs r$ zwait..s- 1 1: !! $ $ 1 1 1 1 1 1r%z6Passing coroutines is forbidden, use tasks explicitly.N)risfuturerrGrItyper ValueErrorrrrsetanyrr_wait)fsrrr#s r$rrs Nz5b99NLb9JLLMMM ;9:::?O]KKKD{DDEEE RB 1 1b 1 1 111RPQQQ  " $ $Dr7K66 6 6 6 6 6 66r%c\|s|ddSdSrb)r*rp)waiterargss r$_release_waiterrs6 ;;== $  r%cKtj}||d{VS|dkrt||}|r|St ||d{V |S#t j$r}t j|d}~wwxYw| }| |t|}tj t|}t||}|| |d{Vn~#t j$rl|r*|cY|S||t ||d{VwxYw|r(||S||t ||d{V ||S#t j$r}t j|d}~wwxYw#|wxYw)aWait 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. Nrr")rrr r*ro_cancel_and_waitrr TimeoutError create_future call_laterr functoolspartialrrremove_done_callback)futrr#rrtimeout_handlecbs r$rrs  " $ $Dyyyyyy!||Cd+++ 88:: ::<< s.......... 5::<< ( 5 5 5)++ 4 5   ! !F__WovFFN  ?F 3 3B $ ' ' 'C"  LLLLLLLL(   xxzz zz||##2 /((,,,'s6666666666  88:: 9::<<   $ $R ( ( (#3T222 2 2 2 2 2 2 2 9zz|| , 9 9 9 -//S8 9 sf7B B3B..B3(D10I+17F,(I+>.F,,*I++,I+II(I##I((I++Jc~ K| d |||t  t| fd}|D]}|| d{V  |D]}||n5#  |D]}||wxYwtt}}|D]A}|r| |,| |B||fS)zVInternal helper for wait(). The fs argument must be a collection of Futures. Nc(dzdks>tks3tkri|sW|EsddSdSdSdSdS)Nrr)rr cancelledrrrr*rp)rcounterrrrs r$_on_completionz_wait.._on_completions1  qLL ? * * ? * *AKKMM *01 0I)%%''';;== (!!$''''' + * * *0I0I ( (r%) rrrlenrrrrr*add) rrrr#rrr*pendingrrrs ` @@@r$rrs    ! !FN/6JJ"ggG ( ( ( ( ( ( ( (,, N++++3  %  ! ! # # # 3 3A " "> 2 2 2 2 3  %  ! ! # # # 3 3A " "> 2 2 2 2 3EE355'D  6688  HHQKKKK KKNNNN =s -B&&2Cc(K|}tjt|}|| ||d{V||dS#||wxYw)z.Qs& 9 9 9AM!$ ' ' ' 9 9 9r%NcD],}|d-dSrb)r put_nowaitclear)rrr*todos r$ _on_timeoutz!as_completed.._on_timeoutTsL " "A " "> 2 2 2 OOD ! ! ! ! r%csdS||sdSdSdSrb)removerr)rr*rrs r$rz$as_completed.._on_completionZsf  F A  $2  ! ! # # # # # $ $22r%cKd{V}| tj|Srb)r!rrro)rr*s r$ _wait_for_onez#as_completed.._wait_for_onebsB((**       9) )xxzzr%)rrrrGrIrrqueuesrr_get_event_looprrrranger) rrrrrr_rr*r#rrs @@@@@r$r r 8s$Sz5b99SQd2hh>OQQRRR 577D  ! # #D 9 9 9 9R 9 9 9DN $$$$$$$,, N++++ ?#+>> 3t99  moor%c#KdVdS)zSkip 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$__sleep0rqs EEEEEr%c>K|dkrtd{V|Stj}|}||t j||} |d{V |S#|wxYw)z9Coroutine that completes after a given time (in seconds).rN)rrrrrr_set_result_unless_cancelledr)delayror#rhs r$r r }s zzjj  " $ $D    ! !F < ( (A||||||   s )BBr"c$t||S)zmWrap a coroutine or an awaitable in a future. If the argument is a Future, it is returned directly. r")_ensure_future)coro_or_futurer#s r$r r s .t 4 4 44r%ctj|r)|%|tj|urtd|Sd}t j|s5t j|rt|}d}ntd|tj d} | |S#t$r|s|wxYw)NzRThe future belongs to a different loop than the one specified as the loop argumentFTz:An asyncio.Future, a coroutine or an awaitable is requiredr5)rrr)rrrGr isawaitable_wrap_awaitablerIrrrr0close)rr#called_wrap_awaitables r$rrs''  G,=n,M,M M MEFF F!  !. 1 1+  ~ . . +,^<tj}| g S fd}i}gd dd}d |D]u}||vrRt ||}|t j|}||urd|_ dz |||<||n||} |vt| S)aReturn 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. cdz r*|s|dSsl|r+|}|dS|}||dSkrg}D]x}|r#t j|jdn|j}n*|}||}| |yj r+|}|dS |dSdS)Nr) r*rrrrrsrrrroappendrrp) rrresultsresr nfinishednfutsouterrs r$_done_callbackzgather.._done_callbacksQ =EJJLL===??   F }} //11##C(((mmoo?'',,,F   G $ $==?? +%3!19+--CC--//C{!jjlls####& *//11##C(((((  )))));  r%rNr"Fr) rrrrprrr)rHrrr) rcoros_or_futuresr#r arg_to_futargrrrrrs ` @@@@r$r r sK< %''""$$  5*5*5*5*5*5*5*5*5*nJH EI D E j  4000C|(--#~~ ,1( QJE!JsO  ! !. 1 1 1 1S/C XD 1 1 1E Lr%ct|rStj}|fdfd}|S)aWait for a future, shielding it from cancellation. The statement task = asyncio.create_task(something()) res = await shield(task) 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: task = asyncio.create_task(something()) try: res = await shield(task) except CancelledError: res = None Save a reference to tasks passed to this function, to avoid a task disappearing mid-execution. The event loop only keeps weak references to tasks. A task that isn't referenced elsewhere may get garbage collected at any time, even before it's done. cr*|s|dS|rdS|}||dS|dSrb)rrrrrsrpro)innerrrs r$_inner_done_callbackz$shield.._inner_done_callback{s ??   ??$$ "!!! F ??   1 LLNNNNN//##C##C(((((  00000r%c^sdSdSrb)r*r)rr r s r$_outer_done_callbackz$shield.._outer_done_callbacks8zz|| =  & &'; < < < < < = =r%)rr*rr)rr)rr#r r r rs @@@r$r r SsB 3  E zz||  U # #D    E11111"====== 0111 0111 Lr%ctjstdtjfd}|S)zsSubmit a coroutine object to a given event loop. Return a concurrent.futures.Future to access the result. zA coroutine object is requiredc tjtdS#ttf$rt $r/}r|d}~wwxYw)Nr")r _chain_futurer rrrset_running_or_notify_cancelrs)rrXrr#s r$callbackz*run_coroutine_threadsafe..callbacks   !-4"@"@"@& I I I I I-.       2244 *$$S)))  s$)A3*A..A3)rrGrI concurrentrFuturecall_soon_threadsafe)rXr#rrs`` @r$rrs{  !$ ' ':8999   & & ( (F h''' Mr%c.tj|dS)z3Register a new task in asyncio as executed by loop.N)r/rr<s r$rrsN4r%crtj|}|td|d|d|t|<dS)NzCannot enter into task z while another task z is being executed.r r!r0r#r<rs r$rrsf!%d++LGTGG#/GGGHH HN4r%crtj|}||urtd|d|dt|=dS)Nz Leaving task z! does not match the current task .rrs r$rrsi!%d++L4A4AA/;AAABB Btr%c.tj|dS)zUnregister a task.N)r/discardrs r$rrstr%)rrrrr/r rb)Cr__all__concurrent.futuresrrQrr itertoolstypesr9weakrefrrrrrrrrcount__next__rJrrr> _PyFuturer_PyTask_asyncio_CTask ImportErrorrrrrrrrrrr coroutinerr r rrrrr r rWeakSetr/r rrrr_py_register_task_py_unregister_task_py_enter_task_py_leave_task_c_register_task_c_unregister_task _c_enter_task _c_leave_taskr(r%r$r4sy66  %%%%%% %Y_Q''0$$$$>>>>.   [[[[[7 [[[| "OOO M!D66    D #D     $$4$4"0 # 77777@   D D D N)))X % % %"!%66666r   "+/55555,02...!.w~:16xxxxxv???D0W_        #&  6666666666666666 &)MMMM    DD s$BBBE88FF__pycache__/exceptions.cpython-311.opt-2.pyc000064400000005656152533123130014611 0ustar00 !A?h dZGddeZeZGddeZGddeZGddeZ Gd d eZ Gd d eZ d S))BrokenBarrierErrorCancelledErrorInvalidStateError TimeoutErrorIncompleteReadErrorLimitOverrunErrorSendfileNotAvailableErrorceZdZdS)rN__name__ __module__ __qualname__?/opt/alt/python-internal/lib64/python3.11/asyncio/exceptions.pyrr s++rrceZdZdS)rNr rrrrrs55rrceZdZdS)rNr rrrrrsrrc&eZdZ fdZdZxZS)rc|dnt|}tt|d|d||_||_dS)N undefinedz bytes read on a total of z expected bytes)reprsuper__init__lenpartialexpected)selfrr r_expected __class__s rrzIncompleteReadError.__init__$si$,$4[[$x..  CLL88&888 9 9 9   rc<t||j|jffSN)typerrrs r __reduce__zIncompleteReadError.__reduce__+sDzzDL$-888rr r r rr# __classcell__rs@rrrsL !!!!!9999999rrc&eZdZ fdZdZxZS)rcXt|||_dSr )rrconsumed)rmessager)rs rrzLimitOverrunError.__init__5s& !!!  rcHt||jd|jffS)N)r!argsr)r"s rr#zLimitOverrunError.__reduce__9s DzzDIaL$-888rr$r&s@rrr/sL !!!!!9999999rrceZdZdS)rNr rrrrr=s44rrN) __all__ BaseExceptionrr Exceptionr RuntimeErrorrEOFErrorrrrrrrr4s ( ,,,,,],,, 66666 666 99999(999$ 9 9 9 9 9 9 9 95555555555r__pycache__/__init__.cpython-311.pyc000064400000002524152533123130013216 0ustar00 !A?hdZddlZddlTddlTddlTddlTddlTddlTddlTddl Tddl Tddl Tddl Tddl TddlTddlTddlTddlTejejzejzejzejzejzejze jze jze jze jze jzejzejzejzZejdkrddlTeejz ZdSddlTeejz ZdS)z'The asyncio package, tracking PEP 3156.N)*win32)__doc__sys base_events coroutinesevents exceptionsfutureslocks protocolsrunnersqueuesstreams subprocesstasks taskgroupstimeoutsthreads transports__all__platformwindows_events unix_events=/opt/alt/python-internal/lib64/python3.11/asyncio/__init__.pyrs--       >     ?   =       ?  >  ?     =  ?        <7!!!! ~%%GGG {""GGGr__pycache__/subprocess.cpython-311.pyc000064400000030612152533123130013646 0ustar00 !A?hdZddlZddlmZddlmZddlmZddlmZddlmZej Z ej Z ej Z Gd d ej ej ZGd d Zdddejfd ZdddejddZdS))create_subprocess_execcreate_subprocess_shellN)events) protocols)streams)tasks)loggercLeZdZdZfdZdZdZdZdZdZ dZ d Z xZ S) SubprocessStreamProtocolz0Like StreamReaderProtocol, but for a subprocess.ct|||_dx|_x|_|_d|_d|_g|_|j |_ dS)N)loopF) super__init___limitstdinstdoutstderr _transport_process_exited _pipe_fds_loop create_future _stdin_closed)selflimitr __class__s ?/opt/alt/python-internal/lib64/python3.11/asyncio/subprocess.pyrz!SubprocessStreamProtocol.__init__sl d### 155 5T[4;$!Z5577cD|jjg}|j|d|j|j|d|j|j|d|jdd|S)Nzstdin=zstdout=zstderr=z<{}> )r__name__rappendrrformatjoin)rinfos r__repr__z!SubprocessStreamProtocol.__repr__s'( : ! KK/// 0 0 0 ; " KK1$+11 2 2 2 ; " KK1$+11 2 2 2}}SXXd^^,,,rcJ||_|d}|Ytj|j|j|_|j||j d|d}|Ytj|j|j|_ |j ||j d|d}|$tj ||d|j|_ dSdS)Nrrrr)protocolreaderr) rget_pipe_transportr StreamReaderrrr set_transportrr#r StreamWriterr)r transportstdout_transportstderr_transportstdin_transports rconnection_madez(SubprocessStreamProtocol.connection_made(s,#$77::  '!.T[48J@@@DK K % %&6 7 7 7 N ! !! $ $ $$77::  '!.T[48J@@@DK K % %&6 7 7 7 N ! !! $ $ $#66q99  & -o7;5937:???DJJJ ' &rct|dkr|j}n|dkr|j}nd}|||dSdSNrr*)rr feed_data)rfddatar,s rpipe_data_receivedz+SubprocessStreamProtocol.pipe_data_received@sS 77[FF 1WW[FFF     T " " " " "  rc|dkrw|j}||||||jdn&|j|d|j_dS|dkr|j}n|dkr|j}nd}|,|| n||||j vr|j || dS)NrFrr*) rcloseconnection_lostr set_result set_exception_log_tracebackrrfeed_eofrremove_maybe_close_transport)rr9excpiper,s rpipe_connection_lostz-SubprocessStreamProtocol.pipe_connection_lostJs 77:D   % % %{"--d3333"005555:"1 F 77[FF 1WW[FFF  {!!!!$$S)))    N ! !" % % % ##%%%%%rc<d|_|dS)NT)rrDrs rprocess_exitedz'SubprocessStreamProtocol.process_exitedhs"# ##%%%%%rct|jdkr)|jr$|jd|_dSdSdS)Nr)lenrrrr=rIs rrDz/SubprocessStreamProtocol._maybe_close_transportlsL t~  ! # #(< # O ! ! # # #"DOOO $ # # #rc&||jur|jSdSN)rr)rstreams r_get_close_waiterz*SubprocessStreamProtocol._get_close_waiterqs TZ  % % r) r" __module__ __qualname____doc__rr'r5r;rGrJrDrP __classcell__)rs@rr r s::88888---???0###&&&<&&&### &&&&&&&rr cbeZdZdZdZedZdZdZdZ dZ dZ d Z d Z d d Zd S)Processc||_||_||_|j|_|j|_|j|_||_dSrN)r _protocolrrrrget_pidpid)rr1r+rs rrzProcess.__init__wsI#! ^ o o $$&&rc2d|jjd|jdS)N)rr"rZrIs rr'zProcess.__repr__s"84>*88TX8888rc4|jSrN)rget_returncoderIs r returncodezProcess.returncodes--///rcDK|jd{VS)z?Wait until the process exit and return the process return code.N)r_waitrIs rwaitz Process.waits,_**,,,,,,,,,rc:|j|dSrN)r send_signal)rsignals rrezProcess.send_signals ##F+++++rc8|jdSrN)r terminaterIs rrhzProcess.terminates !!#####rc8|jdSrN)rkillrIs rrjz Process.kills rcK|j} |j||r#t jd|t ||jd{Vn6#ttf$r"}|rt jd||Yd}~nd}~wwxYw|rt jd||j dS)Nz%%r communicate: feed stdin (%s bytes)z%r communicate: stdin got %rz%r communicate: close stdin) r get_debugrwriter debugrLdrainBrokenPipeErrorConnectionResetErrorr=)rinputrnrEs r _feed_stdinzProcess._feed_stdins $$&& H J  U # # # O ;T3u::OOO*""$$ $ $ $ $ $ $ $ $!56 H H H H ;T3GGG  H  > L6 = = = sAA<<B/ B**B/c KdSrNrIs r_noopz Process._noops trcK|j|}|dkr|j}n|dksJ|j}|jr |dkrdnd}t jd|||d{V}|jr |dkrdnd}t jd||| |S)Nr*rrrz%r communicate: read %sz%r communicate: close %s) rr-rrrrlr rnreadr=)rr9r1rOnameoutputs r _read_streamzProcess._read_streamsO66r:: 77[FF7777[F :   ! ! @!Qww88HD L2D$ ? ? ?{{}}$$$$$$ :   ! ! A!Qww88HD L3T4 @ @ @ rNcK|||}n|}|j|d}n|}|j|d}n|}t j|||d{V\}}}|d{V||fSr7)rsrvrr{rr gatherrc)rrrrrrs r communicatezProcess.communicates  $$U++EEJJLLE ; "&&q))FFZZ\\F ; "&&q))FFZZ\\F&+l5&&&I&I I I I I I IvviikkrrN)r"rQrRrr'propertyr`rcrerhrjrsrvr{r~rurrrVrVvs'''99900X0---,,,$$$&"      rrVc Ktj  fd} j||f|||d|d{V\}}t|| S)Nc&tSNr)r r)srz)create_subprocess_shell..7e=A C C Crrrr)rget_running_loopsubprocess_shellrV) cmdrrrrkwdsprotocol_factoryr1r+rs ` @rrrs  " $ $DCCCCC 5 5 !!!!!Ix 9h - --r)rrrrc Ktj  fd} j||g|R|||d|d{V\}} t|| S)Nc&tSrrr)srrz(create_subprocess_exec..rrr)rrsubprocess_execrV) programrrrrargsrrr1r+rs ` @rrrs  " $ $DCCCCC 4 4!!!F !! !!Ix 9h - --r)__all__ subprocessrrrr logr PIPESTDOUTDEVNULLFlowControlMixinSubprocessProtocolr rV_DEFAULT_LIMITrrrurrrsK =    b&b&b&b&b&w7(;b&b&b&JT T T T T T T T n.2$t(/(> . . . .8>    F    > % N " " "!DNNN & %r(c||j|jd|_|jd|_|xjdzc_dS)Nr)_remove_reader_ssockfilenorG_csock _internal_fdsr's rrFz&BaseSelectorEventLoop._close_self_pipeast DK..00111     ar(c2tj\|_|_|jd|jd|xjdz c_||j|jdS)NFr) socket socketpairrJrL setblockingrM _add_readerrK_read_from_selfrNs rr#z%BaseSelectorEventLoop._make_self_pipeis#)#4#6#6  T[ &&& &&& a ++--t/CDDDDDr(cdSr-r'datas r_process_self_dataz(BaseSelectorEventLoop._process_self_dataqs r(c |jd}|sdS||n#t$rYBt$rYdSwxYwR)NTi)rJrecvrYInterruptedErrorBlockingIOErrorrWs rrTz%BaseSelectorEventLoop._read_from_selfts  {''--E''----#   "     s77 A AAc|j}|dS |ddS#t$r$|jrt jddYdSYdSwxYw)Nz3Fail to write a null byte into the self-pipe socketTexc_info)rLsendOSError_debugr r)r'csocks r_write_to_selfz$BaseSelectorEventLoop._write_to_selfs   = F , JJu      , , ,{ , 0&*,,,,,,, , , , ,s$'AAdc n|||j||||||| dSr-)rSrK_accept_connection)r'protocol_factoryr/r;r+backlogr5r6s r_start_servingz$BaseSelectorEventLoop._start_servingsK (?)4VW.0D F F F F Fr(c t|D]h} |\} } |jrtjd|| | | dd| i} ||| | ||||} || #tttf$rYdSt$r} | j tj tjtjtjfvr|d| t%j|d|||t.j|j||||||| nYd} ~ bd} ~ wwxYwdS)Nz#%r got a new connection from %r: %rFpeernamez&socket.accept() out of system resource)message exceptionrP)rangeacceptrdr rrR_accept_connection2 create_taskr]r\ConnectionAbortedErrorrcerrnoEMFILEENFILEENOBUFSENOMEMcall_exception_handlerr TransportSocketrIrK call_laterrACCEPT_RETRY_DELAYrl)r'rjr/r;r+rkr5r6_connaddrr*rrexcs rriz(BaseSelectorEventLoop._accept_connectionsw# )# )A" )![[]] d;5L!F!'t555  '''2$T*11$dE:v)+?AA  ((((9$%57MN   ttt   9u|!& !>>> //#K%("("8">">11 '' 666OOI$@$($7$4dJ$+-B$8 ::::  ::::: # )# )sA BE7. E77B5E22E7c Kd}d} |}|} |r||||| d|||| } n|||| ||} | d{VdS#t$r| d} wxYw#t t f$rt$r@} |jr.d| d} ||| d<| | | d<|| Yd} ~ dSYd} ~ dSd} ~ wwxYw)NT)r1r3r*r+r5r6)r1r*r+z3Error on transport creation for incoming connection)rorpr0 transport) create_futurer=r2 BaseExceptionrG SystemExitKeyboardInterruptrdr{) r'rjrr*r;r+r5r6r0rr1rcontexts rrsz)BaseSelectorEventLoop._accept_connection2s  & 5''))H''))F # 44(Jv $E&*?)= 5?? !77(6!8##       !!!  -.     5 5 5{ 5N!$ '*2GJ'(+4GK(++G444444444 5 5 5 5 5 5 5s*AB"A,,"BBC,,/C''C,cf|}t|tsQ t|}n.#ttt f$rt d|dwxYw |j|}|std|d|dS#t$rYdSwxYw)NzInvalid file object: zFile descriptor z is used by transport ) isinstanceintrKAttributeError TypeError ValueErrorr& is_closingrDr)r'rrKrs r_ensure_fd_no_transportz-BaseSelectorEventLoop._ensure_fd_no_transports&#&& K KV]]__--"Iz: K K K !?!?!?@@dJ K &(0I'')) &"%r%% %%&&& & &    DD s!;+A&* B"" B0/B0c|tj|||d} |j|}|j|jc}\}}|j||tjz||f|| n8#t$r+|j |tj|dfYnwxYw|Sr-) _check_closedrHandler"rrXmodifyr EVENT_READcancelrregister r'rcallbackargshandlermaskreaderwriters rrSz!BaseSelectorEventLoop._add_reader s xtT:: .((,,C &)Z "D"66 N ! !"dY-A&A#)6"2 4 4 4!  4 4 4 N # #B (<%+TN 4 4 4 4 4 4 B2CCct|rdS |j|}|j|jc}\}}|t jz}|s|j|n|j||d|f|| dSdS#t$rYdSwxYw)NFT) rEr"rrrXrr unregisterrrrr'rrrrrs rrIz$BaseSelectorEventLoop._remove_readers >>   5 .((,,C&)Z "D"66 Y)) )D @))"----%%b$v???! tu   55 B)) B76B7c|tj|||d} |j|}|j|jc}\}}|j||tjz||f|| n8#t$r+|j |tjd|fYnwxYw|Sr-) rrrr"rrXrr EVENT_WRITErrrrs r _add_writerz!BaseSelectorEventLoop._add_writer.s xtT:: .((,,C &)Z "D"66 N ! !"dY-B&B#)6"2 4 4 4!  4 4 4 N # #B (=%)6N 4 4 4 4 4 4 rct|rdS |j|}|j|jc}\}}|t jz}|s|j|n|j|||df|| dSdS#t$rYdSwxYw)Remove a writer callback.FNT) rEr"rrrXrrrrrrrs r_remove_writerz$BaseSelectorEventLoop._remove_writer>s >>   5 .((,,C&)Z "D"66 Y** *D @))"----%%b$???! tu   55 rcN|||j||g|RdS)zAdd a reader callback.N)rrSr'rrrs r add_readerz BaseSelectorEventLoop.add_readerU9 $$R(((X-------r(cV||||S)zRemove a reader callback.)rrIr'rs r remove_readerz#BaseSelectorEventLoop.remove_readerZ* $$R(((""2&&&r(cN|||j||g|RdS)zAdd a writer callback..N)rrrs r add_writerz BaseSelectorEventLoop.add_writer_rr(cV||||S)r)rrrs r remove_writerz#BaseSelectorEventLoop.remove_writerdrr(cKtj||jr'|dkrt d ||S#t tf$rYnwxYw|}| }| || ||j |||}| tj|j|||d{VS)zReceive data from the socket. The return value is a bytes object representing the data received. The maximum amount of data to be received at once is specified by nbytes. rthe socket must be non-blockingrN)r_check_ssl_socketrd gettimeoutrr[r]r\rrKrrS _sock_recvadd_done_callback functoolspartial_sock_read_done)r'r/nfutrrs r sock_recvzBaseSelectorEventLoop.sock_recvis %d+++ ; @4??,,11>?? ? 99Q<< !12    D   "" [[]] $$R(((!!"dosD!DD   d2Bv F F F H H HyyyyyyAA/.A/c`||s||dSdSr-) cancelledrr'rrrs rrz%BaseSelectorEventLoop._sock_read_done8 >!1!1!3!3>   r " " " " " >r(c*|rdS ||}||dS#ttf$rYdSt t f$rt$r }||Yd}~dSd}~wwxYwr-) doner[ set_resultr]r\rrr set_exception)r'rr/rrXrs rrz BaseSelectorEventLoop._sock_recvs 88::  F !99Q<?? ? >>#&& &!12    D   "" [[]] $$R(((!!"d&:CsKK   d2Bv F F F H H Hyyyyyyrc*|rdS ||}||dS#ttf$rYdSt t f$rt$r }||Yd}~dSd}~wwxYwr-) rrrr]r\rrrr)r'rr/rnbytesrs rrz%BaseSelectorEventLoop._sock_recv_intos 88::  F #^^C((F NN6 " " " " " !12    FF-.     # # #   c " " " " " " " " " #rcKtj||jr'|dkrt d ||S#t tf$rYnwxYw|}| }| || ||j |||}| tj|j|||d{VS)aReceive a datagram from a datagram socket. The return value is a tuple of (bytes, address) representing the datagram received and the address it came from. The maximum amount of data to be received at once is specified by nbytes. rrrN)rrrdrrrecvfromr]r\rrKrrS_sock_recvfromrrrr)r'r/bufsizerrrs r sock_recvfromz#BaseSelectorEventLoop.sock_recvfroms %d+++ ; @4??,,11>?? ? ==)) )!12    D   "" [[]] $$R(((!!"d&93gNN   d2Bv F F F H H Hyyyyyyrc*|rdS ||}||dS#ttf$rYdSt t f$rt$r }||Yd}~dSd}~wwxYwr-) rrrr]r\rrrr)r'rr/rresultrs rrz$BaseSelectorEventLoop._sock_recvfroms 88::  F #]]7++F NN6 " " " " " !12    FF-.     # # #   c " " " " " " " " " #rrc.Ktj||jr'|dkrt d|st |} |||S#ttf$rYnwxYw| }| }| || ||j ||||}|tj|j|||d{VS)zReceive data from the socket. The received data is written into *buf* (a writable buffer). The return value is a tuple of (number of bytes written, address). rrrN)rrrdrrlen recvfrom_intor]r\rrKrrS_sock_recvfrom_intorrrr)r'r/rrrrrs rsock_recvfrom_intoz(BaseSelectorEventLoop.sock_recvfrom_intos7 %d+++ ; @4??,,11>?? ? XXF %%c622 2!12    D   "" [[]] $$R(((!!"d&>T3"(**   d2Bv F F F H H HyyyyyysA--BBc,|rdS |||}||dS#ttf$rYdSt t f$rt$r }||Yd}~dSd}~wwxYwr-) rrrr]r\rrrr)r'rr/rrrrs rrz)BaseSelectorEventLoop._sock_recvfrom_intos 88::  F #''W55F NN6 " " " " " !12    FF-.     # # #   c " " " " " " " " " #sABB3BBc VKtj||jr'|dkrt d ||}n#t tf$rd}YnwxYw|t|krdS| }| }| || ||j ||t||g}|t!j|j|||d{VS)Send data to the socket. The socket must be connected to a remote socket. This method continues to send data from data until either all data has been sent or an error occurs. None is returned on success. On error, an exception is raised, and there is no way to determine how much data, if any, was successfully processed by the receiving end of the connection. rrNr)rrrdrrrbr]r\rrrKrr _sock_sendall memoryviewrrr_sock_write_done)r'r/rXrrrrs r sock_sendallz"BaseSelectorEventLoop.sock_sendall sC %d+++ ; @4??,,11>?? ?  $AA!12   AAA  D >> F  "" [[]] $$R(((!!"d&8#t",T"2"2QC99   d3R G G G I I IyyyyyysAA21A2c|rdS|d} |||d}nQ#ttf$rYdStt f$rt $r }||Yd}~dSd}~wwxYw||z }|t|kr| ddS||d<dSNr) rrbr]r\rrrrrr)r'rr/viewposstartrrs rrz#BaseSelectorEventLoop._sock_sendall*s 88::  FA  $uvv,''AA!12    FF-.          c " " " FFFFF    CII   NN4 CFFFs>B B ,BB c Ktj||jr'|dkrt d |||S#t tf$rYnwxYw|}| }| || ||j ||||}| tj|j|||d{VS)rrrrN)rrrdrrsendtor]r\rrKrr _sock_sendtorrrr)r'r/rXr@rrrs r sock_sendtoz!BaseSelectorEventLoop.sock_sendto@s$ %d+++ ; @4??,,11>?? ? ;;tW-- -!12    D   "" [[]] $$R(((!!"d&7dD")++   d3R G G G I I IyyyyyysAA0/A0c.|rdS ||d|}||dS#ttf$rYdSt t f$rt$r }||Yd}~dSd}~wwxYwr) rrrr]r\rrrr)r'rr/rXr@rrs rrz"BaseSelectorEventLoop._sock_sendto[s 88::  F  D!W--A NN1      !12    FF-.     # # #   c " " " " " " " " " #sABB4BBcKtj||jr'|dkrt d|jt jks!tjrR|jt j kr=| ||j|j |j |d{V}|d\}}}}}| }|||| |d{V d}S#d}wxYw)zTConnect to a remote socket at address. This method is a coroutine. rr)familytypeprotoloopN)rrrdrrrrPAF_INET _HAS_IPv6AF_INET6_ensure_resolvedrrr _sock_connect)r'r/r@resolvedrrs r sock_connectz"BaseSelectorEventLoop.sock_connectjs& %d+++ ; @4??,,11>?? ? ;&. ( (% )*.+*H*H!22 $)4:3H#+1+ Aq!Q  "" 3g... 999999 CC$CJJJJs $C//C3c|} |||dn#ttf$re|||||j|||}|tj |j ||YnCB>B94C9B>>CC cKtj||jr'|dkrt d|}||||d{VS)aWAccept a connection. The socket must be bound to an address and listening for connections. The return value is a pair (conn, address) where conn is a new socket object usable to send and receive data on the connection, and address is the address bound to the socket on the other end of the connection. rrN)rrrdrrr _sock_accept)r'r/rs r sock_acceptz!BaseSelectorEventLoop.sock_accepts %d+++ ; @4??,,11>?? ?  "" #t$$$yyyyyyr(c|} |\}}|d|||fdS#tt f$re|||||j||}| tj |j ||YdSttf$rt$r }||Yd}~dSd}~wwxYw)NFr)rKrrrRrr]r\rrSrrrrrrrrr)r'rr/rrr@rrs rrz"BaseSelectorEventLoop._sock_acceptsI [[]] , KKMMMD'   U # # # NND'? + + + + + !12 L L L  ( ( , , ,%%b$*;S$GGF  ! !!$"66JJJ L L L L L L-.     # # #   c " " " " " " " " " #s,AA2D D *DD cK|j|j=|}||d{V ||j|||dd{V ||r|||j|j<S#||r|||j|j<wxYw)NF)fallback) r&_sock_fd is_reading pause_reading_make_empty_waiter sock_sendfile_sock_reset_empty_waiterresume_reading)r'transpfileoffsetcountrs r_sendfile_nativez&BaseSelectorEventLoop._sendfile_natives1  V_ -**,,''))))))))) 7++FL$5:,<<<<<<<< <  & & ( ( ( (%%'''06D V_ - -  & & ( ( ( (%%'''06D V_ - 6 6 6 6s $B22;C-cF|D]\}}|j|jc}\}}|tjzr4|2|jr||n|||tjzr4|2|jr||||dSr-) fileobjrXrr _cancelledrI _add_callbackrr)r' event_listrrrrrs r_process_eventsz%BaseSelectorEventLoop._process_eventss# / /IC(+ SX %G%ffi** /v/A$/''0000&&v...i++ /0B$/''0000&&v... / /r(c||||dSr-)rIrKrG)r'r/s r _stop_servingz#BaseSelectorEventLoop._stop_servings/ DKKMM*** r(r-NNN)r)4r! __module__ __qualname____doc__rr2rSSL_HANDSHAKE_TIMEOUTSSL_SHUTDOWN_TIMEOUTr=rArGrFr#rYrTrfrlrirsrrSrIrrrrrrrrrrrrrrrrrrrrrrrr rrrr! __classcell__r s@rrr+s 9999997%)$77777 9=+ $t"+"A!*!? +++++$CGBBBB " " " " "   EEE      ,,,&#'tS-6-L,5,JFFFFD#"+"A!*!? ,),),),)`D"+"A!*!? -5-5-5-5^&&&$ * .... ''' ... ''' ,####!!! *###".###"2###">,6   2.####*   ,,," 7 7 7 / / /r(rceZdZdZeZdZdfd ZdZdZ dZ dZ dZ d Z d Zd Zd Zejfd ZddZdZdZdZdZxZS)_SelectorTransportiNct||tj||jd< ||jd<n#t $r d|jd<YnwxYwd|jvr= ||jd<n#tj $r d|jd<YnwxYw||_ | |_ d|_ ||||_||_d|_d|_d|_|j|j||j|j <dS)NrPsocknamernFr)rrr r|_extra getsocknamerc getpeernamerPerrorrrKr _protocol_connected set_protocol_server_buffer_factory_buffer _conn_lost_closing_paused_attachr&)r'rr/r0r*r+r s rrz_SelectorTransport.__init__so %%% & 6t < < H +&*&6&6&8&8DK # # + + +&*DK # # # + T[ ( ( /*.*:*:*<*< J''< / / /*. J''' /   #(  (### ++--   < # L " " "*.'''s$AA54A5BB;:B;c|jjg}|j|dn|jr|d|d|j|j|jst|jj |jtj }|r|dn|dt|jj |jtj }|rd}nd}| }|d|d |d d d |S) Nclosedclosingzfd=z read=pollingz read=idlepollingidlezwrite=z<{}> )r r!rappendr8r _looprErr"rrrget_write_buffer_sizeformatjoin)r'infor>staters r__repr__z_SelectorTransport.__repr__s]'( :  KK ! ! ! ! ] # KK " " " )$-))*** : !$**>*>*@*@ !*4:+?+/=):NPPG ) N++++ K(((*4:+?+/=+4+@BBG !0022G KK=%==7=== > > >}}SXXd^^,,,r(c0|ddSr-) _force_closerNs rabortz_SelectorTransport.abort8s $r(c"||_d|_dSNT) _protocolr2)r'r0s rr3z_SelectorTransport.set_protocol;s!#'   r(c|jSr-)rOrNs r get_protocolz_SelectorTransport.get_protocol?s ~r(c|jSr-)r8rNs rrz_SelectorTransport.is_closingBs }r(c<| o|j Sr-)rr9rNs rrz_SelectorTransport.is_readingEs??$$$9T\)99r(c|sdSd|_|j|j|jrt jd|dSdS)NTz%r pauses reading)rr9rCrIr  get_debugr rrNs rrz _SelectorTransport.pause_readingHsq    F  !!$-000 :   ! ! 4 L,d 3 3 3 3 3 4 4r(c|js|jsdSd|_||j|j|jrtjd|dSdS)NFz%r resumes reading) r8r9rSr  _read_readyrCrUr rrNs rrz!_SelectorTransport.resume_readingPsu =    F  (8999 :   ! ! 5 L-t 4 4 4 4 4 5 5r(c|jrdSd|_|j|j|jsQ|xjdz c_|j|j|j|jddSdSNTr) r8rCrIr r6r7r call_soon_call_connection_lostrNs rrGz_SelectorTransport.closeXs =  F  !!$-000| C OOq OO J % %dm 4 4 4 J !;T B B B B B C Cr(cv|j1|d|t||jdSdS)Nzunclosed transport )source)rResourceWarningrG)r'_warns r__del__z_SelectorTransport.__del__bsL : ! E000/$ O O O O J        " !r(Fatal error on transportct|tr2|jrt jd||dn$|j||||jd||dS)Nz%r: %sTr`)rorprr0) rrcrCrUr rr{rOrK)r'rros r _fatal_errorz_SelectorTransport._fatal_errorgs c7 # # z##%% E XtWtDDDD J - -" ! N //    #r(cP|jrdS|jr8|j|j|j|js&d|_|j|j|xjdz c_|j|j |dSrY) r7r6clearrCrr r8rIrZr[)r'rs rrKz_SelectorTransport._force_closeus ?  F < 5 L   J % %dm 4 4 4} 5 DM J % %dm 4 4 4 1 T7=====r(c |jr|j||jd|_d|_d|_|j}||d|_dSdS#|jd|_d|_d|_|j}||d|_wxYwr-)r2rOconnection_lostrrGrCr4_detach)r'rr+s rr[z(_SelectorTransport._call_connection_losts $' 4..s333 J     DJ!DNDJ\F!   # "! J     DJ!DNDJ\F!   # ####s !A99AC c*t|jSr-)rr6rNs rrDz(_SelectorTransport.get_write_buffer_sizes4<   r(cZ|sdS|jj||g|RdSr-)rrCrSrs rrSz_SelectorTransport._add_readers>    F r83d333333r()NN)ra)r!r#r$max_size bytearrayr5rrrIrLr3rQrrrrrGwarningswarnr`rcrKr[rDrSr(r)s@rr+r+sEHO E//////8---8   (((:::444555CCC%M     > > > $ $ $!!!4444444r(r+ceZdZdZejjZ dfd ZfdZ dZ dZ dZ dZ d Zd Zd Zd Zfd ZdZdZxZS)r.TNcd|_t|||||d|_d|_t j|j|j |j j ||j |j |j |j|(|j tj|ddSdSr)_read_ready_cbrr_eof _empty_waiterr _set_nodelayrrCrZrOconnection_maderSr rWr_set_result_unless_cancelled)r'rr/r0r1r*r+r s rrz!_SelectorSocketTransport.__init__s# tXuf=== !  ,,, T^;TBBB T-!]D,< > > >   J !E!' / / / / /  r(ct|tjr |j|_n |j|_t |dSr-)rr BufferedProtocol_read_ready__get_bufferrq_read_ready__data_receivedrr3)r'r0r s rr3z%_SelectorSocketTransport.set_protocolsP h : ; ; B"&">D  "&"AD  X&&&&&r(c.|dSr-)rqrNs rrWz$_SelectorSocketTransport._read_readys r(c|jrdS |jd}t|st dn?#t t f$rt$r!}||dYd}~dSd}~wwxYw |j |}nR#ttf$rYdSt t f$rt$r!}||dYd}~dSd}~wwxYw|s| dS |j|dS#t t f$rt$r!}||dYd}~dSd}~wwxYw)Nz%get_buffer() returned an empty bufferz/Fatal error: protocol.get_buffer() call failed.$Fatal read error on socket transportz3Fatal error: protocol.buffer_updated() call failed.)r7rO get_bufferrrDrrrrcrrr]r\_read_ready__on_eofbuffer_updated)r'rrrs rryz0_SelectorSocketTransport._read_ready__get_buffers ?  F .++B//Cs88 L"#JKKK L-.          F H H H FFFFF   Z))#..FF!12    FF-.          c#I J J J FFFFF    $ $ & & & F L N ) )& 1 1 1 1 1-.     L L L   J L L L L L L L L L LsM8ABA;;BBC.3C. C))C. D&&E"EE"c|jrdS |j|j}nR#tt f$rYdSt tf$rt$r!}| |dYd}~dSd}~wwxYw|s| dS |j |dS#t tf$rt$r!}| |dYd}~dSd}~wwxYw)Nr~z2Fatal error: protocol.data_received() call failed.) r7rr[rkr]r\rrrrcrrO data_received)r'rXrs rrzz3_SelectorSocketTransport._read_ready__data_receivedsp ?  F :??4=11DD!12    FF-.          c#I J J J FFFFF    $ $ & & & F K N ( ( . . . . .-.     K K K   I K K K K K K K K K Ks2+A:A:A55A:B22C. C))C.c|jrtjd| |j}n?#t tf$rt$r!}| |dYd}~dSd}~wwxYw|r!|j |j dS| dS)Nz%r received EOFz1Fatal error: protocol.eof_received() call failed.) rCrUr rrO eof_receivedrrrrcrIr rG)r' keep_openrs rrz,_SelectorSocketTransport._read_ready__on_eofs :   ! ! 2 L*D 1 1 1 3355II-.          H J J J FFFFF    J % %dm 4 4 4 4 4 JJLLLLLsA B%BBc t|tttfs$t dt |j|jrtd|j td|sdS|j r;|j tj krtjd|xj dz c_ dS|js |j|}||d}|sdSnQ#t$t&f$rYn>t(t*f$rt,$r!}||dYd}~dSd}~wwxYw|j|j|j|j||dS)N/data argument must be a bytes-like object, not z%Cannot call write() after write_eof()z(unable to write; sendfile is in progresssocket.send() raised exception.r%Fatal write error on socket transport)rbytesrlrrrr!rrrDrsr7r!LOG_THRESHOLD_FOR_CONNLOST_WRITESr warningr6rrbr]r\rrrrcrCrr  _write_readyextend_maybe_pause_protocol)r'rXrrs rwritez_SelectorSocketTransport.writes$ : >?? <;#'::#6;;<< < 9 HFGG G   )IJJ J  F ? )"MMM@AAA OOq OO F| E JOOD))ABBxF$%56    12       !!#'NOOO  J " "4=$2C D D D D!!! ""$$$$$sC**D8=D8D33D8cD|js Jd|jrdS |j|j}|r |jd|=||js|j|j|j|j d|j r| ddS|j r(|j tjdSdSdS#t t"f$rYdSt$t&f$rt($r}|j|j|j||d|j |j|Yd}~dSYd}~dSd}~wwxYw)NzData should not be emptyr)r6r7rrb_maybe_resume_protocolrCrr rsrr8r[rrshutdownrPSHUT_WRr]r\rrrrercr)r'rrs rrz%_SelectorSocketTransport._write_ready8s|77777| ?  F 8  --A %L!$  ' ' ) ) )< 8 ))$-888%1&11$777=8..t44444Y8J''77777 8 8 88) !12    DD-.     6 6 6 J % %dm 4 4 4 L     c#J K K K!-"00555555555.-----  6sC11FFA/FFc|js|jrdSd|_|js&|jt jdSdSrN)r8rrr6rrrPrrNs r write_eofz"_SelectorSocketTransport.write_eofVsS = DI  F | 0 J   / / / / / 0 0r(cdSrNrVrNs r can_write_eofz&_SelectorSocketTransport.can_write_eof]str(ct||j)|jt ddSdS)NzConnection is closed by peer)rr[rsrConnectionError)r'rr s rr[z._SelectorSocketTransport._call_connection_lost`sb %%c***   )   , , >?? A A A A A * )r(c|jtd|j|_|js|jd|jS)NzEmpty waiter is already set)rsrDrCrr6rrNs rrz+_SelectorSocketTransport._make_empty_waiterfsZ   )<== =!Z5577| 0   ) )$ / / /!!r(cd|_dSr-)rsrNs rrz,_SelectorSocketTransport._reset_empty_waiterns!r(r")r!r#r$_start_tls_compatibler _SendfileMode TRY_NATIVE_sendfile_compatiblerr3rWryrzrrrrrr[rrr(r)s@rr.r.s* $2=48$(//////,'''''#L#L#LJKKK2*%%%%%%N888<000AAAAA """"""""""r(r.cLeZdZejZ dfd ZdZdZddZ dZ xZ S) r?Nc`t||||||_d|_|j|jj||j|j|j |j |(|jtj |ddSdSr) rr_address _buffer_sizerCrZrOrurSr rWrrv)r'rr/r0r@r1r*r s rrz#_SelectorDatagramTransport.__init__vs tXu555  T^;TBBB T-!]D,< > > >   J !E!' / / / / /  r(c|jSr-)rrNs rrDz0_SelectorDatagramTransport.get_write_buffer_sizes   r(c|jrdS |j|j\}}|j||dS#t tf$rYdSt$r%}|j |Yd}~dSd}~wttf$rt$r!}| |dYd}~dSd}~wwxYw)Nz&Fatal read error on datagram transport)r7rrrkrOdatagram_receivedr]r\rcerror_receivedrrrrcr'rXrrs rrWz&_SelectorDatagramTransport._read_readys ?  F 9,,T];;JD$ N , ,T4 8 8 8 8 8 !12    DD / / / N ) )# . . . . . . . . .-.     M M M   c#K L L L L L L L L L Ms)"A C C'BC%CCc t|tttfs$t dt |j|sdS|jr)|d|jfvrtd|j|j}|j rB|jr;|j tj krtj d|xj dz c_ dS|js |jdr|j|n|j||dS#t&t(f$r(|j|j|jYnkt2$r%}|j|Yd}~dSd}~wt8t:f$rt<$r!}||dYd}~dSd}~wwxYw|j t||f|xj!tE|z c_!|#dS)Nrz!Invalid address: must be None or rrrn'Fatal write error on datagram transport)$rrrlrrrr!rrr7rrr rr6r.rrbrr]r\rCrr  _sendto_readyrcrOrrrrrcrBrrrrs rrz!_SelectorDatagramTransport.sendtosi$ : >?? <;#'::#6;;<< <  F = !D$-000 G GGIII=D ? t} )"MMM@AAA OOq OO F|  ;z*2JOOD))))J%%dD111#%56 J J J &&t}d6HIIIII   --c222 12       !!BDDD  U4[[$/000 SYY& ""$$$$$s+ AD6F1 F1E22F1F,,F1cD|jr=|j\}}|xjt|zc_ |jdr|j|n|j||n#ttf$r<|j ||f|xjt|z c_Ynst$r%}|j |Yd}~dSd}~wttf$rt $r!}||dYd}~dSd}~wwxYw|j=||js=|j|j|jr|ddSdSdS)Nrnr)r6popleftrrr.rrbrr]r\ appendleftrcrOrrrrrcrrCrr r8r[rs rrz(_SelectorDatagramTransport._sendto_readysl --//JD$   T *   ;z*2JOOD))))J%%dD111#%56    ''t 555!!SYY.!!   --c222 12       !!BDDD #l , ##%%%| 1 J % %dm 4 4 4} 1**400000 1 1 1 1s,ABA D; D;C<<D;D66D;r"r-) r!r#r$ collectionsdequer5rrDrWrrr(r)s@rr?r?rs!'O59$( / / / / / /!!!999 *%*%*%*%X1111111r(r?)r%__all__rrvrrrPrmr$ssl ImportErrorrrrrr r r r logr r BaseEventLoopr_FlowControlMixin Transportr+r.r?rVr(rrs* #  JJJJ CCC(((F F F F F K5F F F Ra4a4a4a4a45#-a4a4a4HW"W"W"W"W"1W"W"W"tl1l1l1l1l1!3l1l1l1l1l1s '11__pycache__/timeouts.cpython-311.opt-1.pyc000064400000017250152533123130014271 0ustar00 !A?hddlZddlmZddlmZmZmZddlmZddlm Z ddlm Z dZ Gd d ej Z eGd d Zd eedefdZdeedefdZdS)N) TracebackType)finalOptionalType)events) exceptions)tasks)Timeouttimeout timeout_atc"eZdZdZdZdZdZdZdS)_StatecreatedactiveexpiringexpiredfinishedN)__name__ __module__ __qualname__CREATEDENTEREDEXPIRINGEXPIREDEXITED=/opt/alt/python-internal/lib64/python3.11/asyncio/timeouts.pyrrs'GGHG FFFrrc eZdZdZdeeddfdZdeefdZdeeddfdZde fdZ de fd Z dd Z d eeed eed eedee fdZddZdS)r zAsynchronous context manager for cancelling overdue coroutines. Use `timeout()` or `timeout_at()` rather than instantiating this class directly. whenreturnNcRtj|_d|_d|_||_dS)zSchedule a timeout that will trigger at a given loop time. - If `when` is `None`, the timeout will never trigger. - If `when < loop.time()`, the timeout will trigger on the next iteration of the event loop. N)rr_state_timeout_handler_task_when)selfr!s r__init__zTimeout.__init__!s'n >B+/  rc|jS)zReturn the current deadline.)r'r(s rr!z Timeout.when.s zrc|jtjur?|jtjurt dt d|jjd||_|j|j| d|_dStj }|| kr!| |j |_dS|||j |_dS)zReschedule the timeout.zTimeout has not been enteredzCannot change state of z TimeoutN)r$rrr RuntimeErrorvaluer'r%cancelrget_running_looptime call_soon _on_timeoutcall_at)r(r!loops r reschedulezTimeout.reschedule2s ;fn , ,{fn,,"#ABBBE$+*;EEE   ,  ! ( ( * * * <$(D ! ! !*,,Dtyy{{""(,t7G(H(H%%%(, T4;K(L(L%%%rc@|jtjtjfvS)z$Is timeout expired during execution?)r$rrrr+s rrzTimeout.expiredIs{v???rcdg}|jtjur6|jt |jdnd}|d|d|}d|jjd|dS)Nzwhen= z )r$rrr'roundappendjoinr.)r(infor!info_strs r__repr__zTimeout.__repr__Mszt ;&. ( (+/:+A5Q'''tD KK ' ' '88D>>;DK-;;;;;;rc6K|jtjurtdt j}|tdtj|_||_|j|_ | |j |S)Nz Timeout has already been enteredz$Timeout should be used inside a task) r$rrr-r current_taskrr& cancelling _cancellingr6r')r(tasks r __aenter__zTimeout.__aenter__Us ;fn , ,ABB B!## <EFF Fn  :0022  ### rexc_typeexc_valexc_tbcZK|j |jd|_|jtjurJtj|_|j|jkr|tj urt|n$|jtj urtj |_dSN)r%r/r$rrrr&uncancelrGr CancelledError TimeoutErrorrr)r(rJrKrLs r __aexit__zTimeout.__aexit__as  ,  ! ( ( * * *$(D ! ;&/ ) ) .DKz""$$(888XIb=b=b#/ [FN * * -DKtrch|jtj|_d|_dSrN)r&r/rrr$r%r+s rr3zTimeout._on_timeoutys- o $r)r"r )r"N)rrr__doc__rfloatr)r!r6boolrstrrCrIr BaseExceptionrrRr3rrrr r sD Xe_     huoMxM4MMMM.@@@@@<#<<<<    4 ./-('  $ 0%%%%%%rr delayr"cxtj}t|||zndS)a Timeout async context manager. Useful in cases when you want to apply timeout logic around block of code or in cases when asyncio.wait_for is not suitable. For example: >>> async with asyncio.timeout(10): # 10 seconds timeout ... await long_running_task() delay - value in seconds or None to disable timeout logic long_running_task() is interrupted by raising asyncio.CancelledError, the top-most affected timeout() context manager converts CancelledError into TimeoutError. N)rr0r r1)rYr5s rr r s7  " $ $D %*;499;;&& F FFrr!c t|S)abSchedule the timeout at absolute time. Like timeout() but argument gives absolute time in the same clock system as loop.time(). Please note: it is not POSIX time but a time with undefined starting base, e.g. the time of the system power on. >>> async with asyncio.timeout_at(loop.time() + 10): ... await long_running_task() when - a deadline when timeout occurs or None to disable timeout logic long_running_task() is interrupted by raising asyncio.CancelledError, the top-most affected timeout() context manager converts CancelledError into TimeoutError. )r )r!s rr r s& 4==r)enumtypesrtypingrrrr9rr r __all__Enumrr rUr r rrrras@ (((((((((( TYc%c%c%c%c%c%c%c%LG8E?GwGGGG(Xe_r__pycache__/timeouts.cpython-311.opt-2.pyc000064400000014147152533123130014274 0ustar00 !A?hddlZddlmZddlmZmZmZddlmZddlm Z ddlm Z dZ Gd d ej Z eGd d Zd eedefdZdeedefdZdS)N) TracebackType)finalOptionalType)events) exceptions)tasks)Timeouttimeout timeout_atc"eZdZdZdZdZdZdZdS)_StatecreatedactiveexpiringexpiredfinishedN)__name__ __module__ __qualname__CREATEDENTEREDEXPIRINGEXPIREDEXITED=/opt/alt/python-internal/lib64/python3.11/asyncio/timeouts.pyrrs'GGHG FFFrrc eZdZ deeddfdZdeefdZdeeddfdZdefdZ de fdZ dd Z d ee ed eed eedeefd ZddZdS)r whenreturnNcT tj|_d|_d|_||_dSN)rr_state_timeout_handler_task_when)selfr!s r__init__zTimeout.__init__!s, n >B+/  rc |jSr$)r(r)s rr!z Timeout.when.s *zrc |jtjur?|jtjurt dt d|jjd||_|j|j| d|_dStj }|| kr!| |j |_dS|||j |_dS)NzTimeout has not been enteredzCannot change state of z Timeout)r%rrr RuntimeErrorvaluer(r&cancelrget_running_looptime call_soon _on_timeoutcall_at)r)r!loops r reschedulezTimeout.reschedule2s% ;fn , ,{fn,,"#ABBBE$+*;EEE   ,  ! ( ( * * * <$(D ! ! !*,,Dtyy{{""(,t7G(H(H%%%(, T4;K(L(L%%%rcB |jtjtjfvSr$)r%rrrr,s rrzTimeout.expiredIs2{v???rcdg}|jtjur6|jt |jdnd}|d|d|}d|jjd|dS)Nzwhen= z )r%rrr(roundappendjoinr/)r)infor!info_strs r__repr__zTimeout.__repr__Mszt ;&. ( (+/:+A5Q'''tD KK ' ' '88D>>;DK-;;;;;;rc6K|jtjurtdt j}|tdtj|_||_|j|_ | |j |S)Nz Timeout has already been enteredz$Timeout should be used inside a task) r%rrr.r current_taskrr' cancelling _cancellingr7r()r)tasks r __aenter__zTimeout.__aenter__Us ;fn , ,ABB B!## <EFF Fn  :0022  ### rexc_typeexc_valexc_tbcZK|j |jd|_|jtjurJtj|_|j|jkr|tj urt|n$|jtj urtj |_dSr$)r&r0r%rrrr'uncancelrHr CancelledError TimeoutErrorrr)r)rKrLrMs r __aexit__zTimeout.__aexit__as  ,  ! ( ( * * *$(D ! ;&/ ) ) .DKz""$$(888XIb=b=b#/ [FN * * -DKtrch|jtj|_d|_dSr$)r'r0rrr%r&r,s rr4zTimeout._on_timeoutys- o $r)r"r )r"N)rrrrfloatr*r!r7boolrstrrDrJr BaseExceptionrrRr4rrrr r s? Xe_     huoMxM4MMMM.@@@@@<#<<<<    4 ./-('  $ 0%%%%%%rr delayr"cz tj}t|||zndSr$)rr1r r2)rXr6s rr r s<  " $ $D %*;499;;&& F FFrr!c" t|Sr$)r )r!s rr r s$ 4==r)enumtypesrtypingrrrr:rr r __all__Enumrr rTr r rrrr`s@ (((((((((( TYc%c%c%c%c%c%c%c%LG8E?GwGGGG(Xe_r__pycache__/protocols.cpython-311.opt-2.pyc000064400000010547152533123130014447 0ustar00 !A?h- dZGddZGddeZGddeZGddeZGd d eZd Zd S) ) BaseProtocolProtocolDatagramProtocolSubprocessProtocolBufferedProtocolc,eZdZ dZdZdZdZdZdS)rcdSNr)self transports >/opt/alt/python-internal/lib64/python3.11/asyncio/protocols.pyconnection_madezBaseProtocol.connection_made   cdSr rr excs r connection_lostzBaseProtocol.connection_lostrrcdSr rr s r pause_writingzBaseProtocol.pause_writing%s   rcdSr rrs r resume_writingzBaseProtocol.resume_writing;   rN)__name__ __module__ __qualname__ __slots__rrrrrrr rr s\I         ,     rrc eZdZ dZdZdZdS)rrcdSr r)r datas r data_receivedzProtocol.data_received^rrcdSr rrs r eof_receivedzProtocol.eof_receiveddrrN)rrrrr"r$rrr rrBs>2I        rrc&eZdZ dZdZdZdZdS)rrcdSr r)r sizehints r get_bufferzBufferedProtocol.get_buffers   rcdSr r)r nbytess r buffer_updatedzBufferedProtocol.buffer_updated   rcdSr rrs r r$zBufferedProtocol.eof_receivedrrN)rrrrr(r+r$rrr rrmsM.I            rrc eZdZ dZdZdZdS)rrcdSr r)r r!addrs r datagram_receivedz"DatagramProtocol.datagram_receiveds44rcdSr rrs r error_receivedzDatagramProtocol.error_receivedrrN)rrrrr1r3rrr rrs:*I555     rrc&eZdZ dZdZdZdZdS)rrcdSr r)r fdr!s r pipe_data_receivedz%SubprocessProtocol.pipe_data_receivedr,rcdSr r)r r6rs r pipe_connection_lostz'SubprocessProtocol.pipe_connection_lostr,rcdSr rrs r process_exitedz!SubprocessProtocol.process_exiteds00rN)rrrrr7r9r;rrr rrsI6I      11111rrc\t|}|r||}t|}|std||kr||d|<||dS|d||d|<||||d}t|}|dSdS)Nz%get_buffer() returned an empty buffer)lenr( RuntimeErrorr+)protor!data_lenbufbuf_lens r _feed_data_to_buffered_protorCs4yyH !x((c(( HFGG G h  !C  N   * * * F 'NCM   ) ) )>D4yyH !!!!!rN)__all__rrrrrrCrrr rEs%  6 6 6 6 6 6 6 6 r( ( ( ( ( |( ( ( V2 2 2 2 2 |2 2 2 j      |    11111111.!!!!!r__pycache__/__main__.cpython-311.pyc000064400000013623152533123130013201 0ustar00 !A?h3 ddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl m Z Gddej Z GddejZedkrejd ejZejed eiZd D]Zeeee<e eeZdad a ddlZn #e$rYnwxYweZd e_e e dS#e!$r>t2r4t2"st2#d aYZwxYwdS)N)futuresc$eZdZfdZdZxZS)AsyncIOInteractiveConsolect||jjxjt jzc_||_dS)N)super__init__compilecompilerflagsastPyCF_ALLOW_TOP_LEVEL_AWAITloop)selflocalsr __class__s =/opt/alt/python-internal/lib64/python3.11/asyncio/__main__.pyr z"AsyncIOInteractiveConsole.__init__sB     ##s'EE## cLtjfd}t| S#t $rt$r7tr dYdS YdSwxYw)Nc8dadatjj} |}na#t $rt $r"}da|Yd}~dSd}~wt$r }|Yd}~dSd}~wwxYwtj |s |dS j |atjtdS#t$r }|Yd}~dSd}~wwxYw)NFT) repl_futurerepl_future_interruptedtypes FunctionTyper SystemExitKeyboardInterrupt set_exception BaseExceptioninspect iscoroutine set_resultr create_taskr _chain_future)funccoroexexccodefuturers rcallbackz3AsyncIOInteractiveConsole.runcode..callbacksnK&+ #%dDK88D tvv   $   *.'$$R(((    $$R((( &t,, !!$''' *"i33D99 %k6:::::  * * *$$S))))))))) *s9 ,B A B *BB 94C// D9DDz KeyboardInterrupt ) concurrentrFuturercall_soon_threadsaferesultrrrwrite showtraceback)rr(r*r)s`` @rruncodez!AsyncIOInteractiveConsole.runcodes#**,, * * * * * * *< !!(+++ %==?? "     % % %& % 2333333""$$$$$$  %sA0B# B#"B#)__name__ __module__ __qualname__r r1 __classcell__)rs@rrrsG +%+%+%+%+%+%+%rrceZdZdZdS) REPLThreadc  dtjdtjdttddd}t|dt jd d t t tj dS#t jd d t t tj wxYw) Nz asyncio REPL z on zy Use "await" directly instead of "asyncio.run()". Type "help", "copyright", "credits" or "license" for more information. ps1z>>> zimport asynciozexiting asyncio REPL...)bannerexitmsgignorez ^coroutine .* was never awaited$)messagecategory) sysversionplatformgetattrconsoleinteractwarningsfilterwarningsRuntimeWarningrr-stop)rr:s rrunzREPLThread.runFs 1? ????3v.. ???    1  3 3 3  #;' ) ) ) )  % %di 0 0 0 0 0  #;' ) ) ) )  % %di 0 0 0 0s ABACN)r2r3r4rIrrr7r7Ds#11111rr7__main__zcpython.run_stdinasyncio>__file__r2__spec__ __loader__ __package__ __builtins__FT)$r rLr(concurrent.futuresr+rr? threadingrrErInteractiveConsolerThreadr7r2auditnew_event_looprset_event_loop repl_localskeyrrCrrreadline ImportError repl_threaddaemonstart run_foreverrdonecancelrJrrrds4    3%3%3%3%3% 73%3%3%l11111!1110 z CI!""" !7 ! # #DG4   g&K,))"688C= C'' T::GK#       *,,KK         E !    /;#3#3#5#5 /""$$$*.' H  ;s%3B88C?C*DAEE__pycache__/mixins.cpython-311.opt-2.pyc000064400000002236152533123130013726 0ustar00 !A?hT ddlZddlmZejZGddZdS)N)eventsceZdZdZdZdS)_LoopBoundMixinNctj}|j-t5|j||_dddn #1swxYwY||jurt |d|S)Nz# is bound to a different event loop)r_get_running_loop_loop _global_lock RuntimeError)selfloops ;/opt/alt/python-internal/lib64/python3.11/asyncio/mixins.py _get_loopz_LoopBoundMixin._get_loop s')) :  & &:%!%DJ & & & & & & & & & & & & & & & tz ! !$MMMNN N s=AA)__name__ __module__ __qualname__r rrrr s( E     rr) threadingrLockr rrrrrsgy~           r__pycache__/__init__.cpython-311.opt-1.pyc000064400000002524152533123130014155 0ustar00 !A?hdZddlZddlTddlTddlTddlTddlTddlTddlTddl Tddl Tddl Tddl Tddl TddlTddlTddlTddlTejejzejzejzejzejzejze jze jze jze jze jzejzejzejzZejdkrddlTeejz ZdSddlTeejz ZdS)z'The asyncio package, tracking PEP 3156.N)*win32)__doc__sys base_events coroutinesevents exceptionsfutureslocks protocolsrunnersqueuesstreams subprocesstasks taskgroupstimeoutsthreads transports__all__platformwindows_events unix_events=/opt/alt/python-internal/lib64/python3.11/asyncio/__init__.pyrs--       >     ?   =       ?  >  ?     =  ?        <7!!!! ~%%GGG {""GGGr__pycache__/base_tasks.cpython-311.opt-1.pyc000064400000010144152533123130014532 0ustar00 !A?hT xddlZddlZddlZddlmZddlmZdZejdZdZ dZ dS) N) base_futures) coroutinesctj|}|r|sd|d<|dd|zt j|j}|dd|d|j |dd |j |S) N cancellingrrzname=%rzcoro=<>z wait_for=) r_future_repr_infordoneinsertget_namer_format_coroutine_coro _fut_waiter)taskinfocoros ?/opt/alt/python-internal/lib64/python3.11/asyncio/base_tasks.py_task_repr_infor s  )$ / /D QKK9t}}.///  ' 3 3DKK#D###$$$ # A74#377888 Kcldt|}d|jjd|dS)N  > X>z 7 " " KK ! ! !   * * * 61;??xt<==== /C I &d&&T22222  @t@@@tLLLLL <4<<<4HHHH d3333 3CM3GG + +D $Tr * * * * * + +r) r;reprlibr@r2rrrrecursive_reprrr/rKrrrOs"111   F+++++r__pycache__/base_events.cpython-311.opt-2.pyc000064400000241404152533123130014717 0ustar00 !A?hx&4 ddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl Z ddl Z ddlZddlZddlZddlZ ddlZn #e$rdZYnwxYwddlmZddlmZddlmZddlmZddlmZddlmZdd lmZdd lmZdd lmZdd lmZdd lmZddl m!Z!dZ"dZ#dZ$e%e dZ&dZ'dZ(dZ)dZ*d$dZ+d%dZ,dZ-e%e drdZ.ndZ.dZ/Gddej0Z1Gd d!ej2Z3Gd"d#ej4Z5dS)&N) constants) coroutines)events) exceptions)futures) protocols)sslproto) staggered)tasks) transports)trsock)logger) BaseEventLoopServerdg?AF_INET6iQc|j}tt|ddtjrt |jSt|S)N__self__) _callback isinstancegetattrr Taskreprrstr)handlecbs @/opt/alt/python-internal/lib64/python3.11/asyncio/base_events.py_format_handlerGsF  B'"j$//<<BK   6{{ch|tjkrdS|tjkrdSt|S)Nzz) subprocessPIPESTDOUTr)fds r _format_piper&Ps2 Z_x z zBxxr cttdstd |tjtjddS#t $rtdwxYw)N SO_REUSEPORTz)reuse_port not supported by socket modulerzTreuse_port not supported by socket module, SO_REUSEPORT defined but not implemented.)hasattrsocket ValueError setsockopt SOL_SOCKETr(OSErrorsocks r_set_reuseportr1Ys 6> * *JDEEE J OOF-v/BA F F F F F J J JIJJ J Js +AA-c ^ttdsdS|dtjtjhvs|dS|tjkr tj}n|tjkr tj}ndS|d}net |tr |dkrd}nGt |tr |dkrd}n) t|}n#ttf$rYdSwxYw|tj kr4tj g}tr|tjn|g}t |tr|d}d|vrdS|D]V} tj||tr|tjkr |||d||||ffcS|||d||ffcS#t&$rYSwxYwdS)N inet_ptonrr idna%)r)r* IPPROTO_TCP IPPROTO_UDP SOCK_STREAM SOCK_DGRAMrbytesrint TypeErrorr+ AF_UNSPECAF_INET _HAS_IPv6appendrdecoder3r.) hostportfamilytypeprotoflowinfoscopeidafsafs r _ipaddr_inforLds 6; ' ' Q*F,>??? Lt v!!!" " " ""t | D% TS[[ D#  42:: t99DD:&   44 !!!~  ( JJv ' ' 'h$#{{6"" d{{t     R & & & 9R6?224T47,KKKKK4T4L8888    D  4s*5CCC6FF F*)F*c tj}|D].}|d}||vrg||<|||/t|}g}|dkr4||dd|dz |dd|dz =|dt jt j |D|S)Nrrc3K|]}||V dSN).0as r z(_interleave_addrinfos..s0 ] ]]]r ) collections OrderedDictrAlistvaluesextend itertoolschain from_iterable zip_longest) addrinfosfirst_address_family_countaddrinfos_by_familyaddrrEaddrinfos_lists reordereds r_interleave_addrinfosrcs%7%13311a , , ,*,  'F#**40000.557788OI!A%%+,K-G!-K,KLMMM A > :Q >> ? ?00  !? 3   r c|s2|}t|ttfrdSt j|dSrO) cancelled exceptionr SystemExitKeyboardInterruptr _get_loopstop)futexcs r_run_until_complete_cbrmsa ==??mmoo cJ(9: ; ;  F c!!!!!r TCP_NODELAYc|jtjtjhvrW|jtjkrD|jtjkr1|tjtj ddSdSdSdSNr) rEr*r?rrFr9rGr7r,rnr/s r _set_nodelayrqsn KFNFO< < < V/// f000 OOF.0BA F F F F F = <//00r cdSrOrPr/s rrqrqs r cjt)t|tjrtddSdS)Nz"Socket cannot be of type SSLSocket)sslr SSLSocketr=r/s r_check_ssl_socketrvs1 :dCM::<===r cDeZdZdZdZdZdZdZdZdZ dZ d Z d S) _SendfileFallbackProtocolct|tjstd||_||_||_|j |_ | | ||j r%|jj |_dSd|_dS)Nz.transport should be _FlowControlMixin instance)rr _FlowControlMixinr= _transport get_protocol_proto is_reading_should_resume_reading_protocol_paused_should_resume_writing pause_reading set_protocol_loop create_future_write_ready_fut)selftransps r__init__z"_SendfileFallbackProtocol.__init__s&*">?? NLMM M ))++ &,&7&7&9&9#&,&=#D!!!  & )$(O$9$G$G$I$ID ! ! !$(D ! ! !r cK|jrtd|j}|dS|d{VdS)NzConnection closed by peer)r{ is_closingConnectionErrorr)rrks rdrainz_SendfileFallbackProtocol.drainsR ? % % ' ' ?!"=>> ># ; F r c td)Nz?Invalid state: connection should have been established already. RuntimeError)r transports rconnection_madez)_SendfileFallbackProtocol.connection_madesNOO Or c|jD|(|jtdn|j||j|dS)NzConnection is closed by peer)r set_exceptionrr}connection_lost)rrls rrz)_SendfileFallbackProtocol.connection_lostsw  ,{%33#$BCCEEEE%33C888 ##C(((((r c^|jdS|jj|_dSrO)rr{rrrs r pause_writingz'_SendfileFallbackProtocol.pause_writings/  , F $ 5 C C E Er cZ|jdS|jdd|_dS)NF)r set_resultrs rresume_writingz(_SendfileFallbackProtocol.resume_writings5  ( F ((/// $r c tdNz'Invalid state: reading should be pausedr)rdatas r data_receivedz'_SendfileFallbackProtocol.data_receivedDEEEr c tdrrrs r eof_receivedz&_SendfileFallbackProtocol.eof_receivedrr c K|j|j|jr|j|j|j|jr|jdSdSrO) r{rr}rresume_readingrcancelrrrs rrestorez!_SendfileFallbackProtocol.restores $$T[111  & - O * * , , ,  ,  ! ( ( * * *  & ) K & & ( ( ( ( ( ) )r N) __name__ __module__ __qualname__rrrrrrrrrrPr rrxrxs ) ) )OOO ) ) )FFF %%% FFFFFF ) ) ) ) )r rxcpeZdZ ddZdZdZdZdZdZdZ d Z e d Z d Z d Zd ZdZdS)rNc||_||_d|_g|_||_||_||_||_||_d|_ d|_ dS)NrF) r_sockets _active_count_waiters_protocol_factory_backlog _ssl_context_ssl_handshake_timeout_ssl_shutdown_timeout_serving_serving_forever_fut)rloopsocketsprotocol_factory ssl_contextbacklogssl_handshake_timeoutssl_shutdown_timeouts rrzServer.__init__s[   !1 '&;#%9" $(!!!r c2d|jjd|jdS)N) __class__rrrs r__repr__zServer.__repr__#s"F4>*FFT\FFFFr c&|xjdz c_dSrp)rrs r_attachzServer._attach&s ar cz|xjdzc_|jdkr|j|dSdSdS)Nrr)rr_wakeuprs r_detachzServer._detach*sJ a   " "t}'< LLNNNNN # "'<'K|]}tj|VdSrO)rTransportSocket)rQss rrSz!Server.sockets..Ls-FF1V+A..FFFFFFr )rtuplers rrzServer.socketsHs. = 2FF FFFFFFr c8|j}|dSd|_|D]}|j|d|_|j9|js |jd|_|jdkr|dSdS)NFr) rr _stop_servingrrrrrr)rrr0s rclosez Server.closeNs- ? F  + +D J $ $T * * * *  % 1-2244 2  % , , . . .(,D %   " " LLNNNNN # "r cfK|tjdd{VdS)Nr)rr sleeprs r start_servingzServer.start_servingas@ k!nnr cK|jtd|d|jtd|d||j|_ |jd{VnH#t j$r6 || d{V#xYwwxYw d|_dS#d|_wxYw)Nzserver z, is already being awaited on serve_forever()z is closed) rrrrrrrCancelledErrorr wait_closedrs r serve_foreverzServer.serve_forevergs(  $ 0N$NNNPP P = ;;;;<< < $(J$<$<$>$>! -+ + + + + + + + +(     &&(((((((((   ,)-D % % %D % , , , ,s6* A87C 8B=.B76B=7B99B==C CcK|j|jdS|j}|j||d{VdSrO)rrrrrA)rrs rrzServer.wait_closed|sX = DM$9 F))++ V$$$ r rO)rrrrrrrrrrrpropertyrrrrrrPr rrrs>B ) ) ) )GGG    *** , , ,GGXG & ---*r rc JeZdZdZdZdZddddZdZdZd\ddd d Z d\d dddddd d dZ d]dZ d^dZ d^dZ d\dZdZdZdZdZdZdZdZdZdZdZdZdZdZd Zd!Zejfd"Z d#Z!d$Z"dd%d&Z#dd%d'Z$dd%d(Z%d)Z&d*Z'd+Z(dd%d,Z)d-Z*d.Z+d/Z,d0d0d0d0d1d2Z-d_d3Z.d`d d4d5Z/d6Z0d7Z1d8Z2d\d9Z3 d^dd0d0d0dddddddd: d;Z4 dad<Z5d`d d4d=Z6d>Z7d?Z8d dddd@dAZ9 d^d0d0d0ddddBdCZ:d0e;j<d0d0d1dDZ=dEZ> d^e;j?e;j@ddFdddddd dG dHZAddddIdJZBdKZCdLZDdMZEeFjGeFjGeFjGd d d0ddddN dOZHeFjGeFjGeFjGd d d0ddddN dPZIdQZJdRZKdSZLdTZMdUZNdVZOdWZPdXZQdYZRdZZSd[ZTdS)brcd|_d|_d|_tj|_g|_d|_d|_d|_ tj dj |_ d|_|t!jd|_d|_d|_d|_d|_t/j|_d|_d|_dS)NrF monotonicg?)_timer_cancelled_count_closed _stoppingrTdeque_ready _scheduled_default_executor _internal_fds _thread_idtimeget_clock_info resolution_clock_resolution_exception_handler set_debugr_is_debug_modeslow_callback_duration_current_handle _task_factory"_coroutine_origin_tracking_enabled&_coroutine_origin_tracking_saved_depthweakrefWeakSet _asyncgens_asyncgens_shutdown_called_executor_shutdown_calledrs rrzBaseEventLoop.__init__s&'# !')) !%!%!4[!A!A!L"& z022333'*##!27/6:3"/++*/').&&&r c d|jjd|d|d|d S)Nrz running=z closed=z debug=r)rr is_running is_closed get_debugrs rrzBaseEventLoop.__repr__sp C' C C$//2C2C C Cnn&& C C/3~~/?/? C C C r c. tj|S)Nr)rFuturers rrzBaseEventLoop.create_futures:~4((((r N)namecontextc ||j(tj||||}|jr|jd=nF||||}n||||}tj|||S)N)rrr r ) _check_closedrr r_source_traceback_set_task_name)rcororr tasks r create_taskzBaseEventLoop.create_tasks     %:dD'JJJD% /*2.))$55))$g)FF  t , , , r cV |t|std||_dS)Nz'task factory must be a callable or None)callabler=r)rfactorys rset_task_factoryzBaseEventLoop.set_task_factorys9   x'8'8 EFF F$r c |jSrO)rrs rget_task_factoryzBaseEventLoop.get_task_factorysJ!!r )extraserverc trONotImplementedError)rr0protocolrrrs r_make_socket_transportz$BaseEventLoop._make_socket_transports &!!r FT) server_sideserver_hostnamerrrrcall_connection_madec trOr) rrawsockr sslcontextrr r!rrrrr"s r_make_ssl_transportz!BaseEventLoop._make_ssl_transports  $!!r c trOr)rr0raddressrrs r_make_datagram_transportz&BaseEventLoop._make_datagram_transports (!!r c trOrrpiperrrs r_make_read_pipe_transportz'BaseEventLoop._make_read_pipe_transports )!!r c trOrr+s r_make_write_pipe_transportz(BaseEventLoop._make_write_pipe_transports *!!r c K trOr) rrargsshellstdinstdoutstderrbufsizerkwargss r_make_subprocess_transportz(BaseEventLoop._make_subprocess_transports +!!r c trOrrs r_write_to_selfzBaseEventLoop._write_to_selfs "!r c trOr)r event_lists r_process_eventszBaseEventLoop._process_eventss &!!r c2|jrtddS)NzEvent loop is closed)rrrs rr zBaseEventLoop._check_closeds% < 7566 6 7 7r c2|jrtddS)Nz!Executor shutdown has been called)rrrs r_check_default_executorz%BaseEventLoop._check_default_executor s)  ) DBCC C D Dr c|j||s/||j|dSdSrO)rdiscardrcall_soon_threadsaferacloseragens r_asyncgen_finalizer_hookz&BaseEventLoop._asyncgen_finalizer_hooks^ %%%~~ G  % %d&6 F F F F F G Gr c|jr tjd|dt||j|dS)Nzasynchronous generator z3 was scheduled after loop.shutdown_asyncgens() callsource)rwarningswarnResourceWarningraddrEs r_asyncgen_firstiter_hookz&BaseEventLoop._asyncgen_firstiter_hooks_  * . M2$222 . . . . D!!!!!r cpK d|_t|jsdSt|j}|jt jd|Dddid{V}t||D]6\}}t|tr| d|||d7dS)NTc6g|]}|SrP)rD)rQags r z4BaseEventLoop.shutdown_asyncgens..)s 2 2 2bbiikk 2 2 2r return_exceptionsz;an error occurred during closing of asynchronous generator )messagerfasyncgen) rlenrrVclearr gatherzipr Exceptioncall_exception_handler)r closing_agensresultsresultrFs rshutdown_asyncgensz BaseEventLoop.shutdown_asyncgenss:*.'4?##  FT_--   2 2M 2 2 2$"$$$$$$$$ 77  LFD&),, ++ B9= B B!' $ --  r c K d|_|jdS|}tj|j|f}| |d{V|dS#|wxYw)NT)targetr1)rrr threadingThread _do_shutdownstartjoin)rfuturethreads rshutdown_default_executorz'BaseEventLoop.shutdown_default_executor5s<)-&  ! ) F##%%!):&KKK  LLLLLLL KKMMMMMFKKMMMMs A77B c: |jd|s||jddSdS#t $r@}|s!||j|Yd}~dSYd}~dSd}~wwxYw)NTwait)rshutdownrrCrr[r)rrhexs rrezBaseEventLoop._do_shutdownBs D  " + + + 6 6 6>>## C))&*;TBBBBB C C D D D>>## D))&*>CCCCCCCCC D D D D D D DsA A B/BBc|rtdtjtddS)Nz"This event loop is already runningz7Cannot run the event loop while another loop is running)rrr_get_running_looprs r_check_runningzBaseEventLoop._check_runningKsS ??   ECDD D  # % % 1IKK K 2 1r c ||||jt j} t j|_t j |j |j tj | ||jrn d|_d|_tj d|dt j |dS#d|_d|_tj d|dt j |wxYw)N) firstiter finalizerTF)r rr_set_coroutine_origin_tracking_debugsysget_asyncgen_hooksrc get_identrset_asyncgen_hooksrOrGr_set_running_loop _run_oncer)rold_agen_hookss r run_foreverzBaseEventLoop.run_foreverRs[)   ++DK888/11 4'133DO  "T-J-1-J L L L L  $T * * *    > "DN"DO  $T * * *  / / 6 6 6  "N 3 3 3 3 #DN"DO  $T * * *  / / 6 6 6  "N 3 3 3sA*D AEc ||tj| }t j||}|rd|_|t | nD#|r<| r(| s| xYw | tn#| twxYw| std|S)NrFz+Event loop stopped before Future completed.)r rrrisfuturer ensure_future_log_destroy_pendingadd_done_callbackrmrrrerfremove_done_callbackrr_)rrhnew_tasks rrun_until_completez BaseEventLoop.run_until_completejsI   '///$V$777  0+0F '  !7888 @         #FKKMM #&2B2B2D2D #  """    ' '(> ? ? ? ?F ' '(> ? ? ? ?{{}} NLMM M}}s9B C.ACC..D c d|_dSr)rrs rrjzBaseEventLoop.stops r ch |rtd|jrdS|jrt jd|d|_|j|jd|_ |j }|d|_ | ddSdS)Nz!Cannot close a running event loopzClose %rTFrl) rrrrwrdebugrrXrrrrnrexecutors rrzBaseEventLoop.closes  ??   DBCC C <  F ; + LT * * *   )-&)  %)D "   5  ) ) ) ) ) r c |jSrO)rrs rrzBaseEventLoop.is_closeds 8|r c|s@|d|t||s|dSdSdS)Nzunclosed event loop rI)rrMrr)r_warns r__del__zBaseEventLoop.__del__sk~~  E111?4 P P P P??$$      r c |jduSrO)rrs rrzBaseEventLoop.is_runnings8t+,r c* tjSrO)rrrs rrzBaseEventLoop.times ~r r c |td|j||z|g|Rd|i}|jr|jd=|S)Nzdelay must not be Noner r )r=call_atrr)rdelaycallbackr r1timers r call_laterzBaseEventLoop.call_latersu  =455 5 TYY[[50(.T...%,..  " ,'+ r cD |td||jr*|||dt j|||||}|jr|jd=tj |j |d|_ |S)Nzwhen cannot be Nonerr T) r=r rw _check_thread_check_callbackr TimerHandlerheapqheappushr)rwhenrr r1rs rrzBaseEventLoop.call_ats  <122 2  ; 6     9 5 5 5"44wGG  " ,'+ t... r c ||jr*|||d||||}|jr|jd=|S)N call_soonr )r rwrr _call_soonrrrr r1rs rrzBaseEventLoop.call_soons}   ; 8     ; 7 7 7499  # -(, r ctj|stj|rtd|dt |std|d|dS)Nzcoroutines cannot be used with z()z"a callable object was expected by z(), got )r iscoroutineiscoroutinefunctionr=r)rrmethods rrzBaseEventLoop._check_callbacks  "8 , , >.x88 ><&<<<>> >!! %$V$$$$%% % % %r ctj||||}|jr|jd=|j||S)Nr )rHandlerrrA)rrr1r rs rrzBaseEventLoop._call_soon sHxtW==  # -(, 6""" r ct |jdStj}||jkrtddS)NzMNon-thread-safe operation invoked on an event loop other than the current one)rrcrzr)r thread_ids rrzBaseEventLoop._check_threadsP  ? " F'))  ' ''(( ( ( 'r c ||jr||d||||}|jr|jd=||S)NrCr )r rwrrrr:rs rrCz"BaseEventLoop.call_soon_threadsafe%s{0  ; C  +A B B B499  # -(,  r c4||jr||d|D|j}||'t jd}||_t j|j |g|R|S)Nrun_in_executorasyncio)thread_name_prefixr) r rwrrr@ concurrentrThreadPoolExecutor wrap_futuresubmit)rrfuncr1s rrzBaseEventLoop.run_in_executor0s  ; :  '8 9 9 9  -H  ( ( * * *%-@@'0A*2&" HOD (4 ( ( (t555 5r cpt|tjjst d||_dS)Nz,executor must be ThreadPoolExecutor instance)rrrrr=rrs rset_default_executorz"BaseEventLoop.set_default_executor@s8(J$6$IJJ LJKK K!)r cH|d|g}|r|d||r|d||r|d||r|d|d|}tjd||}t j||||||} ||z } d|d | d zd d | }| |jkrtj|ntj|| S) N:zfamily=ztype=zproto=zflags=, zGet address info %szGetting address info z took g@@z.3fzms: ) rArgrrrr* getaddrinforinfo) rrCrDrErFrGflagsmsgt0addrinfodts r_getaddrinfo_debugz BaseEventLoop._getaddrinfo_debugEsY!!!!"  - JJ+++ , , ,  ) JJ't'' ( ( (  + JJ))) * * *  + JJ))) * * *iinn *C000 YY[[%dD&$uMM YY[[2 OcOOcOOO8OO , , , K     L   r rrErFrGrc K|jr|j}n tj}|d|||||||d{VSrO)rwrr*rr)rrCrDrErFrGr getaddr_funcs rrzBaseEventLoop.getaddrinfo]sr ; .2LL!-L)) ,dFD%HHHHHHHH Hr cVK|dtj||d{VSrO)rr* getnameinfo)rsockaddrrs rrzBaseEventLoop.getnameinfogsH)) &$h77777777 7r )fallbackchK|jr'|dkrtdt|||||| |||||d{VS#t j$r }|sYd}~nd}~wwxYw|||||d{VS)Nrzthe socket must be non-blocking) rw gettimeoutr+rv_check_sendfile_params_sock_sendfile_nativerSendfileNotAvailableError_sock_sendfile_fallback)rr0fileoffsetcountrrls r sock_sendfilezBaseEventLoop.sock_sendfileks9 ; @4??,,11>?? ?$ ##D$>>> 33D$4:ECCCCCCCC C3          11$28%AAAAAAAA AsA77BBBc<Ktjd|d|d)Nz-syscall sendfile is not available for socket z and file z combinationrrrr0rrrs rrz#BaseEventLoop._sock_sendfile_nativezs@2 -D - - - - -.. .r c|K|r|||rt|tjn tj}t |}d} |rt||z |}|dkrnft |d|}|d|j|d{V} | sn*|||d| d{V|| z }||dkr)t|dr|||zSSS#|dkr)t|dr|||zwwwxYw)NrTseek) rminr!SENDFILE_FALLBACK_READBUFFER_SIZE bytearray memoryviewrreadinto sock_sendallr)) rr0rrr blocksizebuf total_sentviewreads rrz%BaseEventLoop._sock_sendfile_fallbacks   IIf    FCyB C C C#E  ""  / # #EJ$6 B BI A~~!#z z2!11$ tLLLLLLLL''d5D5k:::::::::d"  #A~~'$"7"7~ &:-....~zA~~'$"7"7~ &:-....~s BD 2D;cdt|ddvrtd|jtjkstd|_t |t s"td||dkr"td|t |t s"td||dkr"td|dS)Nbmodez$file should be opened in binary modez+only SOCK_STREAM type sockets are supportedz+count must be a positive integer (got {!r})rz0offset must be a non-negative integer (got {!r})) rr+rFr*r9rr<r=formatrs rrz$BaseEventLoop._check_sendfile_paramss) gdFC00 0 0CDD DyF...JKK K  eS)) QAHHOOQQQzz AHHOOQQQ&#&& BII  A::BII  :r cK g}|j||\}}}}} d} tj|||} | d||D]\} }}}} | |kr | | n#t$rS} d| d| j}t | j|} || Yd} ~ d} ~ wwxYw|r|t d|d| | | d{V| dx}}S#t$r1} || | | d} ~ w| | xYw#dx}}wxYw)NrErFrGF*error while attempting to bind on address : z&no matching local address with family=z found) rAr* setblockingbindr.strerrorlowererrnopop sock_connectr)rr addr_infolocal_addr_infos my_exceptionsrEtype_rG_r(r0lfamilyladdrrlrs r _connect_sockzBaseEventLoop._connect_socks 2  -(((+4(ua$ .=U%HHHD   U # # #+/?YY+GQ1e&((  2 %((("2226',66"|113366 &ci55%,,S111111112%Y+//111%&W&W&W&WXXX##D'22 2 2 2 2 2 2 2*. -J      % % %   )- -J - - - -sO?D#!A86D#8 CA C D#CA D## E5-,EE55E88E>) rtrErGrr0 local_addrr!rrhappy_eyeballs_delay interleavec xK | |std| |r|std|} | |std| |std|t|| |d}|||td||f|tj||d{V}|st d| =| |tj||d{Vst dnd|rt ||}g| 5|D]1} |d{V}n#t $rY.wxYwn/tj fd |D| d{V\}}}|d D tdkrd td tfd Drd t d ddD#dwxYwn8|td|jtjkrtd||||| | | d{V\}}jr.|d}t'jd|||||||fS)Nz+server_hostname is only meaningful with sslz:You must set server_hostname when using ssl without a host1ssl_handshake_timeout is only meaningful with ssl0ssl_shutdown_timeout is only meaningful with sslr8host/port and sock can not be specified at the same timerErFrGrr!getaddrinfo() returned empty listc3PK|] }tjj|V!dSrO) functoolspartialr)rQrr laddr_infosrs rrSz2BaseEventLoop.create_connection..5sR,,!&t'9'18[JJ,,,,,,r rcg|] }|D]}| SrPrP)rQsubrls rrSz3BaseEventLoop.create_connection..;s%GGGc3GGCcGGGGr rc3>K|]}t|kVdSrOr)rQrlmodels rrSz2BaseEventLoop.create_connection..Bs.GGSs3xx50GGGGGGr zMultiple exceptions: {}rc34K|]}t|VdSrOr )rQrls rrSz2BaseEventLoop.create_connection..Gs(%E%E3c#hh%E%E%E%E%E%Er z5host and port was not specified and no sock specified"A Stream Socket was expected, got )rrr*z%r connected to %s:%r: (%r, %r))r+rv_ensure_resolvedr*r9r.rcrr staggered_racerWrallrrgrF_create_connection_transportrwget_extra_inforr)rrrCrDrtrErGrr0rr!rrrrinfosrrrrrrr s` @@@rcreate_connectionzBaseEventLoop.create_connections   &s &JKK K  "s " B "ABBB"O ,S ,CEE E +C +BDD D   d # # #  + 0BJ  t/ NPPP//t V'uE0NNNNNNNNE CABBB%$($9$9v+5d%:%,%,,,,,,, #G!"EFFFG#  A-eZ@@J#+ %!!H!%)%7%7&+&?&? ? ? ? ? ? ?"!!! !$-#;,,,,,,%*,,,)t $5$5$5555555 a |GGZGGG  &:!++(m+!$JqM 2 2GGGGJGGGGG0",Q-/&&?&F&F II%E%E*%E%E%EEE'G'GHHH"&J%%%%$| KMMMyF...!AAACCC%)$E$E "C"7!5%F%7%7777777 8 ; @++H55D L:tT9h @ @ @(""sD>> E  E  BHH#c \K|d|}|} |r7t|trdn|} |||| | ||||} n|||| } | d{Vn#| xYw| |fS)NFr r!rr)rrrboolr&rr) rr0rrtr!r rrrrr%rs rrz*BaseEventLoop._create_connection_transportes ##%%##%%  L!+C!6!6?CJ00h F'&;%9 1;;II 33D(FKKI LLLLLLLL  OO    (""s BB'cK |rtdt|dtjj}|tjjurtd||tjjur> |||||d{VS#tj $r }|sYd}~nd}~wwxYw|std|| ||||d{VS)NzTransport is closing_sendfile_compatiblez(sendfile is not supported for transport zHfallback is disabled and native sendfile is not supported for transport ) rrrr _SendfileMode UNSUPPORTED TRY_NATIVE_sendfile_nativerr_sendfile_fallback)rrrrrrrrls rsendfilezBaseEventLoop.sendfiles ,    ! ! 7566 6y"8 .:<< 9*6 6 6H9HHJJ J 9*5 5 5 !229d395BBBBBBBBB7     :9+499:: :,,Y-3U<<<<<<<< E88A Grc K ttdt|tjst d|t |ddst d|d|}tj||||||||d } | | | | | j |} | |j } |d{VnK#t$r>|| | wxYw| jS)Nz"Python ssl module is not availablez@sslcontext is expected to be an instance of ssl.SSLContext, got _start_tls_compatibleFz transport z is not supported by start_tls())rrr")rtrr SSLContextr=rrr SSLProtocolrrrrr BaseExceptionrr_app_transport) rrrr%r r!rrr ssl_protocol conmade_cb resume_cbs r start_tlszBaseEventLoop.start_tlss  ;CDD D*cn55 '&!&&'' 'y"95AA LJYJJJLL L##%%+ (J "7!5!& (((  !!!|,,,^^L$@)LL NN9#;<<  LLLLLLLL    OO                   **s :DAE )rErGr reuse_portallow_broadcastr0c K | | jtjkrtd| s s |s|s|s|s|rZt |||||} dd| D} td| d| dd} ns s|dkrtd ||fd ff} nttd r|tj krfD](}|$t|tstd )rdd vry tjtj jrtjn8#t$$rYn,t&$r }t)jd|Yd}~nd}~wwxYw||ffff} ni}dfdffD]\}}|t|t,rt/|dkstd|||tj|||d{V}|st'd|D]"\}}}}}||f}||vrddg||<||||<#fd|D} | stdg}| D]\\}}\}}d} d} tj|tj|} |rt5| |r+| tjtjd| dr| |r |s|| |d{V|} n\#t&$r0}| | |j!|Yd}~d}~w| | xYw|d|}|"}|#| || |}|j$r2rt)j%d||nt)j&d|| |d{Vn#| xYw||fS)Nz$A datagram socket was expected, got )r remote_addrrErGrr.r/rc3.K|]\}}||d|VdS)=NrP)rQkvs rrSz9BaseEventLoop.create_datagram_endpoint..s5$N$NDAqA$NZZAZZ$N$N$N$N$N$Nr zKsocket modifier keyword arguments can not be used when sock is specified. ()Frzunexpected address familyNNAF_UNIXzstring is expected)rz2Unable to check or remove stale UNIX socket %r: %rrz2-tuple is expectedrrcFg|]\}}r|dr|d||fS)rNrrP)rQkey addr_pairrr1s rrSz:BaseEventLoop.create_datagram_endpoint..BsU#E#E#E)7i'#E,5aL,@(-A-6q\-A)$-A-A-Ar zcan not get address informationrz@Datagram endpoint local_addr=%r remote_addr=%r created: (%r, %r)z2Datagram endpoint remote_addr=%r created: (%r, %r))'rFr*r9r+dictrgitemsrr)r8rrr=statS_ISSOCKosst_moderemoveFileNotFoundErrorr.rerrorrrWrr:r1r,r- SO_BROADCASTrrrrArr)rwrr)rrrr1rErGrr.r/r0optsproblemsr_addraddr_pairs_infor`err addr_infosidxrfamrpror(r<r local_addressremote_addressrlrrrs `` rcreate_datagram_endpointz&BaseEventLoop.create_datagram_endpointsR *  yF... C4CCEEE =k = =# =', = ="1 =z{#)e'1,;=== 99$N$NDJJLL$N$N$NNN <08<<<===   U # # #FF2 H+2 HQ;;$%@AAA%+UO\#B"D++. H&.0H0H'5>>D' 40E0E''(<=== 6*Q-{"B"B 6=)<)<)DEE2Ij111,"666 &5%/666666666 &,UO%/$=$?#B #$j/A{3C!D;;IC' *4 7 7CCIINN"+,A"B"BB&*&;&; f6G"'u4'<'A'A!A!A!A!A!A!A %O")*M"N"NN7<;;3CCG#&*C"*4437, 33:JsOC00#E#E#E#E#E;E;K;K;M;M#E#E#E 'H$%FGGGJ6E $ $2&%0-!=%F,=ULLLD!-&t,,,&G"-v/BAGGG$$U+++!1 -000"0.J"&"3"3D."I"IIIIIIII!/E+++' %J%c********' !m###%%##%%11 (FF,, ; ? ? 0& YJJJJ (()X??? LLLLLLLL  OO    (""sC1?E11 F&= F&F!!F&$B-M N$&NN$P((P?cK|dd\}}t|||||g|ddR} | | gS|||||||d{VS)Nr:r)rLr) rr(rErFrGrrrCrDrs rrzBaseEventLoop._ensure_resolvedsRaR[ dD$eJgabbkJJJ  6M))$V$05U*DDDDDDDD Dr cK|||f|tj||d{V}|std|d|S)N)rErFrrz getaddrinfo(z) returned empty list)rr*r9r.)rrCrDrErrs r_create_server_getaddrinfoz(BaseEventLoop._create_server_getaddrinfos++T4L171C27d,DDDDDDDD HFFFFGG G r r) rErr0rrt reuse_addressr.rrrc K t|trtd| |td| |td|t |||td| t jdkotjdk} g}|dkrdg}n:t|tst|tj j s|g}n|}fd|D}tj|d{V}tt j|}d } |D]}|\}}}}} t'j|||}n5#t&j$r#jrt-jd |||d YTwxYw||| r+|t&jt&jd | rt9|t:rP|t&jkr@t?t&d r+|t&j t&j!d  |"|#tF$r}d|d|j$%}|j&tLj'krI|(|)jrt-j|Yd}~tG|j&|dd}~wwxYw|stGdd|Dd }|s|D]}|)n\#|s|D]}|)wwxYw|td|j*t&j+krtd||g}|D]}|,d t[||||| | }| r.|.tj/dd{Vjrt-j0d||S)Nz*ssl argument must be an SSLContext or Nonerrrposixcygwinr4cBg|]}|S))rEr)rV)rQrCrErrDrs rrSz/BaseEventLoop.create_server..sG%%%11$V8=2??%%%r Fz:create_server() failed to create socket.socket(%r, %r, %r)Texc_info IPPROTO_IPV6rrz%could not bind on any address out of cg|] }|d S)rP)rQrs rrSz/BaseEventLoop.create_server..s%@%@%@$d1g%@%@%@r z)Neither host/port nor sock were specifiedrrz %r is serving)1rrr=r+rvrBrrxplatformrrTabcIterabler rYsetrYrZr[r*rFrwrwarningrAr,r- SO_REUSEADDRr1r@rr)r^ IPV6_V6ONLYrr.rrr EADDRNOTAVAILrrrFr9rrrrr)rrrCrDrErr0rrtrWr.rrrrhostsfsr completedresrKsocktyperG canonnamesarLrrs` ``` r create_serverzBaseEventLoop.create_servers2  c4  JHII I ,CEE E + BDD D   d # # #  t/ NPPP$ "7 2 Os|x7O GrzzT3''  {'?@@ %%%%%%%#%%%B ,+++++++E 55e<<==EI2 % '@'@C9<6B%B!%}R5AA!<!!!;O"N,G+-xOOOO! !NN4((($J"-v/BDJJJ!-&t,,,".&/11#FN;;2(;(.(:(,... @ " " @ @ @ @#%""cl&8&8&:&:&: <9(;;;#KKMMM JJLLL#{4 &s 3 3 3$HHHH%ci554? @D!'%@%@%%@%@%@%@#CDDD!  % '%% !% '%% %%| !LMMMyF... !Nd!N!NOOOfG $ $D   U # # # #g'7W&;,..  !  ! ! # # #+a.. ; 1 K 0 0 0 sb5 L2EL2/F  L2 F  B-L2:IL2 K3A7K.L2K..K33#L22M)rtrrc zK|jtjkrtd|||std||std|t |||||dd||d{V\}}|jr,|d}tj d|||||fS) Nrrrr4T)r rrr*z%r handled: (%r, %r)) rFr*r9r+rvrrwrrr)rrr0rtrrrrs rconnect_accepted_socketz%BaseEventLoop.connect_accepted_socket"s! 9* * *J$JJKK K ,S ,CEE E +C +BDD D   d # # #$($E$E "C"7!5%F%7%7777777 8 ; L++H55D L/y( K K K(""r c K|}|}||||} |d{Vn#|xYw|jr)t jd|||||fS)Nz Read pipe %r connected: (%r, %r))rr-rrwrrfilenorrr,rrrs rconnect_read_pipezBaseEventLoop.connect_read_pipe@s##%%##%%2246JJ  LLLLLLLL  OO     ; = L; 8 = = =("" AAc K|}|}||||} |d{Vn#|xYw|jr)t jd|||||fS)Nz!Write pipe %r connected: (%r, %r))rr/rrwrrrtrus rconnect_write_pipez BaseEventLoop.connect_write_pipePs##%%##%%33D(FKK  LLLLLLLL  OO     ; = L< 8 = = =(""rwc|g}|%|dt||6|tjkr&|dt|nN|%|dt||%|dt|t jd|dS)Nzstdin=zstdout=stderr=zstdout=zstderr= )rAr&r"r$rrrg)rrr3r4r5rs r_log_subprocesszBaseEventLoop._log_subprocess`su   KK6e!4!466 7 7 7  &J,="="= KK?f)=)=?? @ @ @ @! rUrfr4z+Object created at (most recent call last): z+Handle created at (most recent call last): r r\)getrF __traceback__rrsortedrg traceback format_listrstriprrArrF) rr rUrfr] log_linesr<valuetbs rdefault_exception_handlerz'BaseEventLoop.default_exception_handlers ++i(( :9GKK ,,  YI4KLHHH g - -$0$61$6 & 'I '?? 0 0C...CLE(((WWY2599::F$***WWY2599::F$U    ..u.. / / / / TYYy))H======r c |jP ||dS#ttf$rt$rt jddYdSwxYw |||dS#ttf$rt$rc} |d||dn7#ttf$rt$rt jddYn wxYwYd}~dSYd}~dSd}~wwxYw)Nz&Exception in default exception handlerTr\z$Unhandled error in exception handler)rUrfr zeException in default exception handler while handling an unexpected error in custom exception handler)rrrgrhr(rrF)rr rls rr\z$BaseEventLoop.call_exception_handlers *  " * ,..w77777 12     , , , E&*,,,,,,,  , 0''g66666 12     0 0 0022#I%(#*44 #$56$000L"?+/0000000000000 0sE!1AAA22C0B('C+(1CC+CC++C0cN |js|j|dSdSrO) _cancelledrrArrs r _add_callbackzBaseEventLoop._add_callback4s6%  ' K  v & & & & & ' 'r cZ |||dSrO)rr:rs r_add_callback_signalsafez&BaseEventLoop._add_callback_signalsafe9s1D 6""" r c: |jr|xjdz c_dSdSrp)rrrs r_timer_handle_cancelledz%BaseEventLoop._timer_handle_cancelled>s4A   -  ' '1 , ' ' ' ' - -r c t|j}|tkrf|j|z tkrSg}|jD]&}|jrd|_||'tj|||_d|_nb|jr[|jdjrI|xjdzc_tj |j}d|_|jr|jdjId}|j s|j rd}nQ|jrJ|jdj }ttd||z t }|j|}||d}||jz}|jrZ|jd}|j |krnAtj |j}d|_|j ||jZt|j }t+|D]} |j }|jr#|jr ||_|} ||| z } | |jkr#t7jdt;|| d|_#d|_wxYw|d}dS)NFrrzExecuting %s took %.3f seconds)rWr_MIN_SCHEDULED_TIMER_HANDLESr%_MIN_CANCELLED_TIMER_HANDLES_FRACTIONrrArheapifyheappoprr_whenrmaxrMAXIMUM_SELECT_TIMEOUT _selectorselectr=rrangepopleftrwr_runrrrer) r sched_count new_scheduledrtimeoutrr<end_timentodoirrs rr}zBaseEventLoop._run_onceCs  $/** 6 6 6  '+ 55 6 6M/ 1 1$1(-F%%!((0000 M- ( ( (+DO*+D ' '/ *doa&8&C *++q0++t77$)!/ *doa&8&C *  ; N$. NGG _ N?1%+D#a !3446LMMG^**733  Z((( 99;;!77o '_Q'F|x'']4?33F %F  K  v & & & o 'DK  u  A[((**F  {  0+1D(BKKMMMr)BT888'G'5f'='=rCCC,0D((4D(//// s A4K Kct|t|jkrdS|r7tj|_tjt jntj|j||_dSrO)rrrx#get_coroutine_origin_tracking_depthr#set_coroutine_origin_tracking_depthrDEBUG_STACK_DEPTHrenableds rrvz,BaseEventLoop._set_coroutine_origin_trackings ==D!HII I I F  =799  7  3+ - - - -  3; = = =3:///r c|jSrO)rwrs rrzBaseEventLoop.get_debugs {r cv||_|r||j|dSdSrO)rwrrCrvrs rrzBaseEventLoop.set_debugsG ??   T  % %d&I7 S S S S S T Tr rO)NNNr7)r)rN)FNN)Urrrrrrrrrrr&r)r-r/r8r:r=r r@rGrOr`rjrerrrrrjrrrKrLrrrrrrrrrrCrrrrrrrrrrrrr rrr-rSr*r9rrVr> AI_PASSIVErprrrvryr|r"r#rrrrrr\rrrr}rvrrrPr rrrs///<   ))))-d* % % %""""%)$""""" 9=" $t"&!%!% """""CG"""" @D(,"""" AE)-""""04"""" """"""777DDDGGG """2   DDDKKK4440$$$L***.%M ---   :>06:$26&%%%((("=A     555 *** 2"#!1HHHHH7777 A(, A A A A A...///4**.*.*.*.Z59G#14T"&!%!%$G#G#G#G#G#V*/"&!% ####8-<#'-<-<-<-<-<^111"""4%*(,.2-1 .+.+.+.+.+bEID#./q267;$ D#D#D#D#D#N'(f.@%&a D D D D D59I##"&!%IIIIIZ"&!% #####<### ### % % %&0_&0o&0o27%)1(,T "#"#"#"#"#J%/OJO%/_$)1'+Dt # # # # #D''' ***"0>0>0>d707070r'''  --- NNN` : : :TTTTTr r)rr)r)6rTcollections.abcconcurrent.futuresrrrrrYrBr*r@r"rcrrrxrKrrt ImportErrorr4rrrrrr r r r r rlogr__all__rrr)r@rrr&r1rLrcrmrqrvProtocolrxAbstractServerrAbstractEventLooprrPr rrsh      JJJJ CCC $ #),% GFJ ' ' #JJJ8888v,""" 76=!! GGGG    >>> A)A)A)A)A) 2A)A)A)HnnnnnV "nnnbeTeTeTeTeTF,eTeTeTeTeTsA AA__pycache__/tasks.cpython-311.opt-2.pyc000064400000100372152533123130013544 0ustar00 !A?h dZddlZddlZddlZddlZddlZddlZddlZddl Z ddlm Z ddl m Z ddl m Z ddl mZddl mZdd l mZdd l mZejdjZd,d Zd,d Zd ZGddejZeZ ddlZejxZZn #e$rYnwxYwddddZejjZejj Z ejj!Z!de!ddZ"dZ#dZ$dZ%dZ&dddZ'ej(dZ)d,dZ*dddZ+dddZ,ej(dZ-ee-_Gd d!ej.Z/d"d#d$Z0d%Z1d&Z2e j3Z4iZ5d'Z6d(Z7d)Z8d*Z9e6Z:e9Z;e7Ze9Z?e7Z@e8ZAdS#e$rYdSwxYw)-)Task create_taskFIRST_COMPLETEDFIRST_EXCEPTION ALL_COMPLETEDwaitwait_for as_completedsleepgathershield ensure_futurerun_coroutine_threadsafe current_task all_tasks_register_task_unregister_task _enter_task _leave_taskN) GenericAlias) base_tasks) coroutines)events) exceptions)futures) _is_coroutinecV |tj}tj|SN)rget_running_loop_current_tasksgetloops :/opt/alt/python-internal/lib64/python3.11/asyncio/tasks.pyrr#s)+ |&((  d # ##c tjd} tt}n#t$r|dz }|dkrYnwxYw3fd|DS)NrTrichh|].}tj|u|,|/S)r _get_loopdone).0tr$s r% zall_tasks..=sE > > >! ##t++AFFHH+ +++r&)rr list _all_tasks RuntimeError)r$itaskss` r%rr*s1 |&(( A $$E      FADyyy  > > > >u > > >>s1A  A c|B |j}||dS#t$r tjdtdYdSwxYwdS)Nz~Task.set_name() was added in Python 3.8, the method support will be mandatory for third-party task implementations since 3.13. stacklevel)set_nameAttributeErrorwarningswarnDeprecationWarning)tasknamer8s r%_set_task_namer?As  }H HTNNNNN  8 8 8 M9)Q 8 8 8 8 8 8 8 8s&AAceZdZ dZddddfd ZfdZeeZdZ dZ dZ d Z d Z d Zdd d ZddddZddZdZdZdfd ZdZxZS)rTN)r$r>contextct||jr|jd=tj|sd|_t d||dt|_nt||_d|_ d|_ d|_ ||_ |tj|_n||_|j|j|jt)|dS)Nr#Fza coroutine was expected, got zTask-rrA)super__init___source_tracebackr iscoroutine_log_destroy_pending TypeError_task_name_counter_namestr_num_cancels_requested _must_cancel _fut_waiter_coro contextvars copy_context_context_loop call_soon _Task__stepr)selfcoror$r>rA __class__s r%rFz Task.__init__js d###  ! +&r*%d++ G).D %ETEEFF F <7!3!5!577DJJTDJ&'#! ?'466DMM#DM T[$-@@@tr&c|jtjkr7|jr0|dd}|jr |j|d<|j|tdS)Nz%Task was destroyed but it is pending!)r=messagesource_traceback) _stater_PENDINGrIrGrUcall_exception_handlerrE__del__)rXrArZs r%raz Task.__del__sy ;'* * *t/H *BG% E.2.D*+ J - -g 6 6 6 r&c*tj|Sr)r _task_reprrXs r%__repr__z Task.__repr__s$T***r&c|jSr)rQrds r%get_coroz Task.get_coro zr&c|jSr)rLrds r%get_namez Task.get_namerhr&c.t||_dSr)rMrL)rXvalues r%r8z Task.set_namesZZ r&c td)Nz*Task does not support set_result operationr1)rXresults r% set_resultzTask.set_resultsGHHHr&c td)Nz-Task does not support set_exception operationrn)rX exceptions r% set_exceptionzTask.set_exceptionsJKKKr&)limitc. tj||Sr)r_task_get_stack)rXrts r% get_stackzTask.get_stacks ()$666r&)rtfilec0 tj|||Sr)r_task_print_stack)rXrtrxs r% print_stackzTask.print_stacks +D%>>>r&c d|_|rdS|xjdz c_|j|j|rdSd|_||_dS)NFrmsgT)_log_tracebackr+rNrPcancelrO_cancel_message)rXr~s r%rz Task.cancels} *$ 99;; 5 ##q(##   '&&3&// t "tr&c |jSrrNrds r% cancellingzTask.cancellings **r&cH |jdkr|xjdzc_|jS)Nrrrrds r%uncancelz Task.uncancels4   & * *  ' '1 , ' '**r&c|rtjd|d||jr5t |tjs|}d|_|j}d|_t|j | || d}n| |}t|dd}|8tj||j ur?t!d|d|d}|j |j||jn|r||ur;t!d |}|j |j||jnnd|_||j|j||_|jr'|j|j rd|_nt!d |d |}|j |j||jn|(|j |j|jnt3j|r>t!d |d |}|j |j||jnUt!d|}|j |j||jn#t6$rf}|jr/d|_t9|j n&t9|jYd}~nd}~wtj$r1}||_t9Yd}~nqd}~wt@tBf$r'}t9"|d}~wtF$r+}t9"|Yd}~nd}~wwxYwtI|j |d}dS#tI|j |d}wxYw)Nz_step(): already done: z, F_asyncio_future_blockingzTask z got Future z attached to a different looprDzTask cannot await on itself: r}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+rInvalidStateErrorrO isinstanceCancelledError_make_cancelled_errorrQrPrrUsendthrowgetattrrr*r1rVrWrTradd_done_callback _Task__wakeuprrinspect isgenerator StopIterationrErprl_cancelled_excKeyboardInterrupt SystemExitrs BaseExceptionr)rXexcrYroblockingnew_excrZs r%__stepz Task.__steps 99;; =.;$;;C;;== =   &c:#<== 30022 %D zDJ%%%H {4C$v'A4HHH#$V,,DJ>>*CCC!CCCDDGJ(( Wdm)EEEEE~~".DDDD#F#F ,, K$--IIII;@700 M4=1BBB+1(,:#/66(,(< 7 > >:49 1*<#'<<17<<==GJ(( Wdm)EEEE $$T[$-$HHHH$V,, A&B)-BB7=BBCC $$K$-%AAAA''Hf'H'HII $$K$-%AAAA{ . . .  .$)!4#78888""39---(   "%D  GGNN        !:.    GG ! !# & & &  ' ' ' GG ! !# & & & & & & & & 'd  D ) ) )DDD  D ) ) )DKKKKsb-K=HO3 O AL+&O3+O='M)$O3)O="N O,!O O3OO33P c ||n,#t$r}||Yd}~nd}~wwxYwd}dSr)rorWr)rXfuturers r%__wakeupz Task.__wakeup[sr  MMOOO KKMMMM    KK         s+ AAAr)__name__ __module__ __qualname__rIrFra classmethodr__class_getitem__rergrjr8rprsrwr{rrrrWr __classcell__rZs@r%rrNs+. %)d6     $ L11+++   IIILLL"&77777.$(d ? ? ? ? ?((((T+++ + + +UUUUUUnr&r)r>rAc tj}|||}n|||}t|||S)NrD)rr rr?)rYr>rAr$r=s r%rrxs^  " $ $D%%g664 Kr&)timeout return_whencK tj|stj|r$t dt |j|std|tttfvrtd|t|}td|Drt dtj}t||||d{VS)Nzexpect a list of futures, not zSet of Tasks/Futures is empty.zInvalid return_when value: c3>K|]}tj|VdSr)rrH)r,fs r% zwait..s- 1 1: !! $ $ 1 1 1 1 1 1r&z6Passing coroutines is forbidden, use tasks explicitly.)risfuturerrHrJtyper ValueErrorrrrsetanyrr _wait)fsrrr$s r%rrsNz5b99NLb9JLLMMM ;9:::?O]KKKD{DDEEE RB 1 1b 1 1 111RPQQQ  " $ $Dr7K66 6 6 6 6 6 66r&c\|s|ddSdSr)r+rp)waiterargss r%_release_waiterrs6 ;;== $  r&c K tj}||d{VS|dkrt||}|r|St ||d{V |S#t j$r}t j|d}~wwxYw| }| |t|}tj t|}t||}|| |d{Vn~#t j$rl|r*|cY|S||t ||d{VwxYw|r(||S||t ||d{V ||S#t j$r}t j|d}~wwxYw#|wxYw)Nrr#)rr r r+ro_cancel_and_waitrr TimeoutError create_future call_laterr functoolspartialrrremove_done_callback)futrr$rrtimeout_handlecbs r%rrs   " $ $Dyyyyyy!||Cd+++ 88:: ::<< s.......... 5::<< ( 5 5 5)++ 4 5   ! !F__WovFFN  ?F 3 3B $ ' ' 'C"  LLLLLLLL(   xxzz zz||##2 /((,,,'s6666666666  88:: 9::<<   $ $R ( ( (#3T222 2 2 2 2 2 2 2 9zz|| , 9 9 9 -//S8 9 sf8B B4B//B4)D21I,27F-)I,?.F--*I,,,I,II)I$$I))I,,Jc K | d |||t  t| fd}|D]}|| d{V  |D]}||n5#  |D]}||wxYwtt}}|D]A}|r| |,| |B||fS)Nc(dzdks>tks3tkri|sW|EsddSdSdSdSdS)Nrr)rr cancelledrrrr+rp)rcounterrrrs r%_on_completionz_wait.._on_completions1  qLL ? * * ? * *AKKMM *01 0I)%%''';;== (!!$''''' + * * *0I0I ( (r&) rrrlenrrrrr+add) rrrr$rrr+pendingrrrs ` @@@r%rrs    ! !FN/6JJ"ggG ( ( ( ( ( ( ( (,, N++++3  %  ! ! # # # 3 3A " "> 2 2 2 2 3  %  ! ! # # # 3 3A " "> 2 2 2 2 3EE355'D  6688  HHQKKKK KKNNNN =s .B''2Cc*K |}tjt|}|| ||d{V||dS#||wxYwr)rrrrrrr)rr$rrs r%rr'sF    ! !F  ?F 3 3B"%     $$$$$  $$$$s A;;B)rc# K tj|stj|r$t dt |jddlm}|tj fdt|D d  fd} fdfd} D]}|  r| || tt D]}|VdS)Nz#expect an iterable of futures, not r)Queuec2h|]}t|S)r#)r )r,rr$s r%r.zas_completed..Qs& 9 9 9AM!$ ' ' ' 9 9 9r&cD],}|d-dSr)r put_nowaitclear)rrr+todos r% _on_timeoutz!as_completed.._on_timeoutTsL " "A " "> 2 2 2 OOD ! ! ! ! r&csdS||sdSdSdSr)removerr)rr+rrs r%rz$as_completed.._on_completionZsf  F A  $2  ! ! # # # # # $ $22r&cKd{V}| tj|Sr)r"rrro)rr+s r% _wait_for_onez#as_completed.._wait_for_onebsB((**       9) )xxzzr&)rrrrHrJrrqueuesrr_get_event_looprrrranger) rrrrrr_rr+r$rrs @@@@@r%r r 8s"Sz5b99SQd2hh>OQQRRR 577D  ! # #D 9 9 9 9R 9 9 9DN $$$$$$$,, N++++ ?#+>> 3t99  moor&c#K dVdSrr)r)r&r%__sleep0rqs EEEEEr&c@K |dkrtd{V|Stj}|}||t j||} |d{V |S#|wxYw)Nr)rrr rrr_set_result_unless_cancelledr)delayror$rhs r%r r }sC zzjj  " $ $D    ! !F < ( (A||||||   s *BBr#c& t||SNr#)_ensure_future)coro_or_futurer$s r%r r s .t 4 4 44r&ctj|r)|%|tj|urtd|Sd}t j|s5t j|rt|}d}ntd|tj d} | |S#t$r|s|wxYw)NzRThe future belongs to a different loop than the one specified as the loop argumentFTz:An asyncio.Future, a coroutine or an awaitable is requiredr6)rrr*rrrHr isawaitable_wrap_awaitablerJrrrr1close)rr$called_wrap_awaitables r%rrs''  G,=n,M,M M MEFF F!  !. 1 1+  ~ . . +,^<tj}| g S fd}i}gd dd}d |D]u}||vrRt ||}|t j|}||urd|_ dz |||<||n||} |vt| S)Ncdz r*|s|dSsl|r+|}|dS|}||dSkrg}D]x}|r#t j|jdn|j}n*|}||}| |yj r+|}|dS |dSdS)Nr) r+rrrrrsrrrroappendrrp) rrresultsresr nfinishednfutsouterrs r%_done_callbackzgather.._done_callbacksQ =EJJLL===??   F }} //11##C(((mmoo?'',,,F   G $ $==?? +%3!19+--CC--//C{!jjlls####& *//11##C(((((  )))));  r&rr#Fr) rrrrprrr*rIrrr) rcoros_or_futuresr$r arg_to_futargrrrrrs ` @@@@r%r r sP: %''""$$  5*5*5*5*5*5*5*5*5*nJH EI D E j  4000C|(--#~~ ,1( QJE!JsO  ! !. 1 1 1 1S/C XD 1 1 1E Lr&c t|rStj}|fdfd}|S)Ncr*|s|dS|rdS|}||dS|dSr)rrrrrsrpro)innerrrs r%_inner_done_callbackz$shield.._inner_done_callback{s ??   ??$$ "!!! F ??   1 LLNNNNN//##C##C(((((  00000r&c^sdSdSr)r+r)rr r s r%_outer_done_callbackz$shield.._outer_done_callbacks8zz|| =  & &'; < < < < < = =r&)rr+rr*rr)rr$r r r rs @@@r%r r Ss@ 3  E zz||  U # #D    E11111"====== 0111 0111 Lr&c tjstdtjfd}|S)NzA coroutine object is requiredc tjtdS#ttf$rt $r/}r|d}~wwxYwr)r _chain_futurer rrrset_running_or_notify_cancelrs)rrYrr$s r%callbackz*run_coroutine_threadsafe..callbacks   !-4"@"@"@& I I I I I-.       2244 *$$S)))  s$)A3*A..A3)rrHrJ concurrentrFuturecall_soon_threadsafe)rYr$rrs`` @r%rrs  !$ ' ':8999   & & ( (F h''' Mr&c0 tj|dSr)r0rr=s r%rrs=N4r&crtj|}|td|d|d|t|<dS)NzCannot enter into task z while another task z is being executed.r!r"r1r$r=rs r%rrsf!%d++LGTGG#/GGGHH HN4r&crtj|}||urtd|d|dt|=dS)Nz Leaving task z! does not match the current task .rrs r%rrsi!%d++L4A4AA/;AAABB Btr&c0 tj|dSr)r0discardrs r%rrstr&)rrrrr0r!r)B__all__concurrent.futuresrrRrr itertoolstypesr:weakrefrrrrrrrrcount__next__rKrrr? _PyFuturer_PyTask_asyncio_CTask ImportErrorrrrrrrrrrr coroutinerr r rrrrr r rWeakSetr0r!rrrr_py_register_task_py_unregister_task_py_enter_task_py_leave_task_c_register_task_c_unregister_task _c_enter_task _c_leave_taskr)r&r%r4sv6  %%%%%% %Y_Q''0$$$$>>>>.   [[[[[7 [[[| "OOO M!D66    D #D     $$4$4"0 # 77777@   D D D N)))X % % %"!%66666r   "+/55555,02...!.w~:16xxxxxv???D0W_        #&  6666666666666666 &)MMMM    DD s$BBBE77F?F__pycache__/events.cpython-311.opt-2.pyc000064400000067532152533123130013735 0ustar00 !A?ho dZddlZddlZddlZddlZddlZddlZddlmZGddZ Gdde Z Gd d Z Gd d Z Gd dZ Gdde ZdaejZGddejZeZdZdZdZdZdZdZdZd!dZdZdZdZdZ eZ!eZ"eZ#eZ$eZ% dd l&mZmZmZmZmZeZ'eZ(eZ)eZ*eZ+dS#e,$rYdSwxYw)")AbstractEventLoopPolicyAbstractEventLoopAbstractServerHandle TimerHandleget_event_loop_policyset_event_loop_policyget_event_loopset_event_loopnew_event_loopget_child_watcherset_child_watcher_set_running_loopget_running_loop_get_running_loopN)format_helpersc:eZdZ dZd dZdZdZdZdZdZ dS) r) _callback_args _cancelled_loop_source_traceback_repr __weakref___contextNc|tj}||_||_||_||_d|_d|_|jr-tj tj d|_ dSd|_ dS)NFr) contextvars copy_contextrrrrrr get_debugr extract_stacksys _getframer)selfcallbackargsloopcontexts ;/opt/alt/python-internal/lib64/python3.11/asyncio/events.py__init__zHandle.__init__#s ?!.00G  !  :   ! ! *%3%A a  &"&"D " " "&*D " " "c@|jjg}|jr|d|j2|t j|j|j|jr4|jd}|d|dd|d|S)N cancelledz created at r:r) __class____name__rappendrr_format_callback_sourcerr)r$infoframes r) _repr_infozHandle._repr_info2s'( ? % KK $ $ $ > % KK> ,, - - -  ! =*2.E KK;eAh;;q;; < < < r+c|j|jS|}dd|S)Nz<{}> )rr6formatjoin)r$r4s r)__repr__zHandle.__repr__>s= : !:   }}SXXd^^,,,r+c|jsDd|_|jrt||_d|_d|_dSdS)NT)rrr reprrrrr$s r)cancelz Handle.cancelDsT "DOz##%% ("$ZZ !DNDJJJ  r+c|jSN)rr>s r)r-zHandle.cancelledOs r+cB |jj|jg|jRn}#tt f$rt $r_}tj|j|j}d|}|||d}|j r |j |d<|j |Yd}~nd}~wwxYwd}dS)NzException in callback )message exceptionhandlesource_traceback) rrunrr SystemExitKeyboardInterrupt BaseExceptionrr3rrcall_exception_handler)r$exccbmsgr(s r)_runz Handle._runRs 7 DM dn :tz : : : : :-.     7 7 77 ,,B/2//C G % E.2.D*+ J - -g 6 6 6 6 6 6 6 6 7s BABBrA) r1 __module__ __qualname__ __slots__r*r6r;r?r-rOr+r)rrs};I * * * *   ---   r+rcheZdZ ddgZdfd ZfdZdZdZdZd Z d Z d Z fd Z d Z xZS)r _scheduled_whenNct|||||jr|jd=||_d|_dS)Nr.F)superr*rrVrU)r$whenr%r&r'r(r0s r)r*zTimerHandle.__init__ksI 4w777  ! +&r* r+ct}|jrdnd}||d|j|S)Nrzwhen=)rXr6rinsertrV)r$r4posr0s r)r6zTimerHandle._repr_inforsLww!!##?)aa C---... r+c*t|jSrA)hashrVr>s r)__hash__zTimerHandle.__hash__xsDJr+cZt|tr|j|jkStSrA isinstancerrVNotImplementedr$others r)__lt__zTimerHandle.__lt__{) e[ ) ) ,: + +r+ct|tr%|j|jkp||StSrArcrrV__eq__rdres r)__le__zTimerHandle.__le__; e[ ) ) B: +At{{5/A/A Ar+cZt|tr|j|jkStSrArbres r)__gt__zTimerHandle.__gt__rhr+ct|tr%|j|jkp||StSrArjres r)__ge__zTimerHandle.__ge__rmr+ct|tr@|j|jko/|j|jko|j|jko|j|jkSt SrA)rcrrVrrrrdres r)rkzTimerHandle.__eq__sc e[ ) ) 9J%+-8Neo58J%+-8Ou'77 9r+c|js|j|tdSrA)rr_timer_handle_cancelledrXr?)r$r0s r)r?zTimerHandle.cancels= 5 J . .t 4 4 4 r+c |jSrA)rVr>s r)rYzTimerHandle.whens zr+rA)r1rPrQrRr*r6r`rgrlrorqrkr?rY __classcell__)r0s@r)rrfsAw'I               r+rc@eZdZ dZdZdZdZdZdZdZ dZ d S) rc trANotImplementedErrorr>s r)closezAbstractServer.closes C!!r+c trAryr>s r)get_loopzAbstractServer.get_loops B!!r+c trAryr>s r) is_servingzAbstractServer.is_serving A!!r+cK trAryr>s r) start_servingzAbstractServer.start_servings "!r+cK trAryr>s r) serve_foreverzAbstractServer.serve_forevers "!r+cK trAryr>s r) wait_closedzAbstractServer.wait_closeds8!!r+c K|SrArSr>s r) __aenter__zAbstractServer.__aenter__s  r+cfK||d{VdSrA)r{r)r$rLs r) __aexit__zAbstractServer.__aexit__s=            r+N) r1rPrQr{r}rrrrrrrSr+r)rrs6""""""""""""""""""!!!!!r+rc eZdZ dZdZdZdZdZdZdZ dZ d Z d d d Z d d d Z d d dZdZdZd d ddZd d dZdZdZddddddZdIdZ dJd dddd d d d d d d d dZ dJejejd dd d d d d dd dZdKdd d!Zd"d d d d#d$Z dLd d d d d d%d&Z dLd dd d d dd'd(Zd d d d)d*Z dJdddd d d d d+d,Z!d-Z"d.Z#e$j%e$j%e$j%d/d0Z&e$j%e$j%e$j%d/d1Z'd2Z(d3Z)d4Z*d5Z+d6Z,d7Z-d8Z.dId9Z/d:Z0d;Z1d<Z2d=Z3dKd d d>Z4d?Z5d@Z6dAZ7dBZ8dCZ9dDZ:dEZ;dFZd S)Mrc trAryr>s r) run_foreverzAbstractEventLoop.run_forever 8!!r+c trAry)r$futures r)run_until_completez$AbstractEventLoop.run_until_completes "!r+c trAryr>s r)stopzAbstractEventLoop.stops "!r+c trAryr>s r) is_runningzAbstractEventLoop.is_runningrr+c trAryr>s r) is_closedzAbstractEventLoop.is_closedrr+c trAryr>s r)r{zAbstractEventLoop.closes "!r+cK trAryr>s r)shutdown_asyncgensz$AbstractEventLoop.shutdown_asyncgenss:!!r+cK trAryr>s r)shutdown_default_executorz+AbstractEventLoop.shutdown_default_executors<!!r+c trAry)r$rEs r)rtz)AbstractEventLoop._timer_handle_cancelledrr+N)r(c&|jd|g|Rd|iS)Nrr() call_laterr$r%r(r&s r) call_soonzAbstractEventLoop.call_soons&tq(CTCCC7CCCr+ctrAry)r$delayr%r(r&s r)rzAbstractEventLoop.call_later !!r+ctrAry)r$rYr%r(r&s r)call_atzAbstractEventLoop.call_atrr+ctrAryr>s r)timezAbstractEventLoop.timerr+ctrAryr>s r) create_futurezAbstractEventLoop.create_futurerr+)namer(ctrAry)r$cororr(s r) create_taskzAbstractEventLoop.create_taskrr+ctrAryrs r)call_soon_threadsafez&AbstractEventLoop.call_soon_threadsaferr+ctrAry)r$executorfuncr&s r)run_in_executorz!AbstractEventLoop.run_in_executor!rr+ctrAry)r$rs r)set_default_executorz&AbstractEventLoop.set_default_executor$rr+r)familytypeprotoflagscKtrAry)r$hostportrrrrs r) getaddrinfozAbstractEventLoop.getaddrinfo) !!r+cKtrAry)r$sockaddrrs r) getnameinfozAbstractEventLoop.getnameinfo- !!r+) sslrrrsock local_addrserver_hostnamessl_handshake_timeoutssl_shutdown_timeouthappy_eyeballs_delay interleavec KtrAry)r$protocol_factoryrrrrrrrrrrrrrs r)create_connectionz#AbstractEventLoop.create_connection0s"!r+dT) rrrbacklogr reuse_address reuse_portrrrc K trAry)r$rrrrrrrrrrrrrs r) create_serverzAbstractEventLoop.create_server:s/ `"!r+)fallbackcK trAry)r$ transportfileoffsetcountrs r)sendfilezAbstractEventLoop.sendfilets "!r+F) server_siderrrcK trAry)r$rprotocol sslcontextrrrrs r) start_tlszAbstractEventLoop.start_tls|s  "!r+)rrrrrcKtrAry)r$rpathrrrrrs r)create_unix_connectionz(AbstractEventLoop.create_unix_connections "!r+)rrrrrrcK trAry) r$rrrrrrrrs r)create_unix_serverz$AbstractEventLoop.create_unix_servers  8"!r+)rrrcK trAry)r$rrrrrs r)connect_accepted_socketz)AbstractEventLoop.connect_accepted_sockets  "!r+)rrrrrallow_broadcastrcK trAry) r$rr remote_addrrrrrrrrs r)create_datagram_endpointz*AbstractEventLoop.create_datagram_endpoints  8"!r+cK trAryr$rpipes r)connect_read_pipez#AbstractEventLoop.connect_read_pipes $"!r+cK trAryrs r)connect_write_pipez$AbstractEventLoop.connect_write_pipes %"!r+)stdinstdoutstderrcKtrAry)r$rcmdrrrkwargss r)subprocess_shellz"AbstractEventLoop.subprocess_shell "!r+cKtrAry)r$rrrrr&rs r)subprocess_execz!AbstractEventLoop.subprocess_exec rr+ctrAryr$fdr%r&s r) add_readerzAbstractEventLoop.add_readerrr+ctrAryr$rs r) remove_readerzAbstractEventLoop.remove_readerrr+ctrAryrs r) add_writerzAbstractEventLoop.add_writerrr+ctrAryrs r) remove_writerzAbstractEventLoop.remove_writerrr+cKtrAry)r$rnbytess r) sock_recvzAbstractEventLoop.sock_recv#rr+cKtrAry)r$rbufs r)sock_recv_intoz AbstractEventLoop.sock_recv_into&rr+cKtrAry)r$rbufsizes r) sock_recvfromzAbstractEventLoop.sock_recvfrom)rr+cKtrAry)r$rr rs r)sock_recvfrom_intoz$AbstractEventLoop.sock_recvfrom_into,rr+cKtrAry)r$rdatas r) sock_sendallzAbstractEventLoop.sock_sendall/rr+cKtrAry)r$rraddresss r) sock_sendtozAbstractEventLoop.sock_sendto2rr+cKtrAry)r$rrs r) sock_connectzAbstractEventLoop.sock_connect5rr+cKtrAry)r$rs r) sock_acceptzAbstractEventLoop.sock_accept8rr+cKtrAry)r$rrrrrs r) sock_sendfilezAbstractEventLoop.sock_sendfile;rr+ctrAry)r$sigr%r&s r)add_signal_handlerz$AbstractEventLoop.add_signal_handlerArr+ctrAry)r$rs r)remove_signal_handlerz'AbstractEventLoop.remove_signal_handlerDrr+ctrAry)r$factorys r)set_task_factoryz"AbstractEventLoop.set_task_factoryIrr+ctrAryr>s r)get_task_factoryz"AbstractEventLoop.get_task_factoryLrr+ctrAryr>s r)get_exception_handlerz'AbstractEventLoop.get_exception_handlerQrr+ctrAry)r$handlers r)set_exception_handlerz'AbstractEventLoop.set_exception_handlerTrr+ctrAryr$r(s r)default_exception_handlerz+AbstractEventLoop.default_exception_handlerWrr+ctrAryr.s r)rKz(AbstractEventLoop.call_exception_handlerZrr+ctrAryr>s r)r zAbstractEventLoop.get_debug_rr+ctrAry)r$enableds r) set_debugzAbstractEventLoop.set_debugbrr+)rNN)rNrA)?r1rPrQrrrrrr{rrrtrrrrrrrrrrrrsocket AF_UNSPEC AI_PASSIVErrrrrrrrr subprocessPIPErrrrrrr r rrrrrrrr r"r%r'r)r,r/rKr r4rSr+r)rrs""""""""""""""" " " """"""" """26DDDDD:>"""""6:""""""""""" )-d""""" =A""""""""""" "#!1"""""""""59"$4 "&!%!%$"""""598"&#$DT"&!%8"8"8"8"8"t"#'"""""%*(,.2-1 " " " " "*."4 "&!% """""*.""s"&!% """"""""""L"&!% " " " " " EI!"./q59d7;$ !"!"!"!"!"J " " " " " "&0_&0o&0o"""""%/O%/_%/_""""""""""""""""" """"""""""""""""""""""""""(,""""" """""" """""" """""""""""" """"""""r+rc.eZdZ dZdZdZdZdZdS)rc trAryr>s r)r z&AbstractEventLoopPolicy.get_event_loopis ("!r+c trAryr$r's r)r z&AbstractEventLoopPolicy.set_event_loopsrr+c trAryr>s r)r z&AbstractEventLoopPolicy.new_event_loopws J"!r+c trAryr>s r)r z)AbstractEventLoopPolicy.get_child_watchers .!!r+c trAry)r$watchers r)r z)AbstractEventLoopPolicy.set_child_watchers 2!!r+N)r1rPrQr r r r r rSr+r)rrfsb7"""""""""""""""""r+rcReZdZ dZGddejZdZdZdZ dZ dS)BaseDefaultEventLoopPolicyNceZdZdZdZdS)!BaseDefaultEventLoopPolicy._LocalNF)r1rPrQr _set_calledrSr+r)_LocalrFs r+rHc8||_dSrA)rH_localr>s r)r*z#BaseDefaultEventLoopPolicy.__init__skkmm r+cN |jjY|jjsMtjtjur'|||jj(tdtjj z|jjS)Nz,There is no current event loop in thread %r.) rJrrG threadingcurrent_thread main_threadr r RuntimeErrorrr>s r)r z)BaseDefaultEventLoopPolicy.get_event_loops  K  %K+ &(**i.C.E.EEE    3 3 5 5 6 6 6 ;  $M!*!9!;!;!@ ABB B{  r+c d|j_|:t|ts%t dt |jd||j_dS)NTzs r)r z)BaseDefaultEventLoopPolicy.set_event_loops\!"&   Jt5F$G$G q[_`d[e[e[nqqqrr r  r+c, |SrA) _loop_factoryr>s r)r z)BaseDefaultEventLoopPolicy.new_event_loops !!###r+) r1rPrQrTrLlocalrHr*r r r rSr+r)rDrDs M$$$!!! !!!$$$$$r+rDceZdZdZdS) _RunningLoopr5N)r1rPrQloop_pidrSr+r)rWrWsHHHr+rWcF t}|td|S)Nzno running event loop)rrOr's r)rrs-   D |2333 Kr+c` tj\}}||tjkr|SdSdSrA) _running_looprXosgetpid) running_looppids r)rrs@ &.L#C29;;$6$6 $6$6r+cF |tjft_dSrA)r]r^r\rXrZs r)rrs" #BIKK0Mr+ctt5tddlm}|addddS#1swxYwYdS)NrDefaultEventLoopPolicy)_lock_event_loop_policyrdrcs r)_init_event_loop_policyrhs ::  % 0 0 0 0 0 0!7!7!9!9 ::::::::::::::::::s -11c< tttSrA)rfrhrSr+r)rrs,!!!! r+c |:t|ts%tdt|jd|adS)NzDpolicy must be an instance of AbstractEventLoopPolicy or None, not 'rQ)rcrrRrr1rf)policys r)rrsR:*V5L"M"Mw_cdj_k_k_twwwxxxr+c tSrA)_py__get_event_looprSr+r)r r s   r+cft}||StSrA)rrr ) stacklevel current_loops r)_get_event_looprrs3 %&&L " " 1 1 3 33r+cJ t|dSrA)rr rZs r)r r #s%M**400000r+cD tSrA)rr rSr+r)r r (sI " " 1 1 3 33r+cD tSrA)rr rSr+r)r r -sL " " 4 4 6 66r+cF t|SrA)rr )rBs r)r r 2s!; " " 4 4W = ==r+)rrrr rr)rn)-__all__rr]r6r9r"rLrgrrrrrrrDrfLockrerUrWr\rrrrhrrr rrr r r r _py__get_running_loop_py__set_running_loop_py_get_running_loop_py_get_event_looprm_asyncio_c__get_running_loop_c__set_running_loop_c_get_running_loop_c_get_event_loop_c__get_event_loop ImportErrorrSr+r)rs;'   GGGGGGGGT<<<<<&<<<~'!'!'!'!'!'!'!'!TT"T"T"T"T"T"T"T"n """"""""D3$3$3$3$3$!83$3$3$t  9?        111:::    ! ! !4444111 444 777 >>>*)'#%)MMMMMMMMMMMMMM -,*&(   DD sC**C32C3__pycache__/__main__.cpython-311.opt-2.pyc000064400000013623152533123130014141 0ustar00 !A?h3 ddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl m Z Gddej Z GddejZedkrejd ejZejed eiZd D]Zeeee<e eeZdad a ddlZn #e$rYnwxYweZd e_e e dS#e!$r>t2r4t2"st2#d aYZwxYwdS)N)futuresc$eZdZfdZdZxZS)AsyncIOInteractiveConsolect||jjxjt jzc_||_dS)N)super__init__compilecompilerflagsastPyCF_ALLOW_TOP_LEVEL_AWAITloop)selflocalsr __class__s =/opt/alt/python-internal/lib64/python3.11/asyncio/__main__.pyr z"AsyncIOInteractiveConsole.__init__sB     ##s'EE## cLtjfd}t| S#t $rt$r7tr dYdS YdSwxYw)Nc8dadatjj} |}na#t $rt $r"}da|Yd}~dSd}~wt$r }|Yd}~dSd}~wwxYwtj |s |dS j |atjtdS#t$r }|Yd}~dSd}~wwxYw)NFT) repl_futurerepl_future_interruptedtypes FunctionTyper SystemExitKeyboardInterrupt set_exception BaseExceptioninspect iscoroutine set_resultr create_taskr _chain_future)funccoroexexccodefuturers rcallbackz3AsyncIOInteractiveConsole.runcode..callbacksnK&+ #%dDK88D tvv   $   *.'$$R(((    $$R((( &t,, !!$''' *"i33D99 %k6:::::  * * *$$S))))))))) *s9 ,B A B *BB 94C// D9DDz KeyboardInterrupt ) concurrentrFuturercall_soon_threadsaferesultrrrwrite showtraceback)rr(r*r)s`` @rruncodez!AsyncIOInteractiveConsole.runcodes#**,, * * * * * * *< !!(+++ %==?? "     % % %& % 2333333""$$$$$$  %sA0B# B#"B#)__name__ __module__ __qualname__r r1 __classcell__)rs@rrrsG +%+%+%+%+%+%+%rrceZdZdZdS) REPLThreadc  dtjdtjdttddd}t|dt jd d t t tj dS#t jd d t t tj wxYw) Nz asyncio REPL z on zy Use "await" directly instead of "asyncio.run()". Type "help", "copyright", "credits" or "license" for more information. ps1z>>> zimport asynciozexiting asyncio REPL...)bannerexitmsgignorez ^coroutine .* was never awaited$)messagecategory) sysversionplatformgetattrconsoleinteractwarningsfilterwarningsRuntimeWarningrr-stop)rr:s rrunzREPLThread.runFs 1? ????3v.. ???    1  3 3 3  #;' ) ) ) )  % %di 0 0 0 0 0  #;' ) ) ) )  % %di 0 0 0 0s ABACN)r2r3r4rIrrr7r7Ds#11111rr7__main__zcpython.run_stdinasyncio>__file__r2__spec__ __loader__ __package__ __builtins__FT)$r rLr(concurrent.futuresr+rr? threadingrrErInteractiveConsolerThreadr7r2auditnew_event_looprset_event_loop repl_localskeyrrCrrreadline ImportError repl_threaddaemonstart run_foreverrdonecancelrJrrrds4    3%3%3%3%3% 73%3%3%l11111!1110 z CI!""" !7 ! # #DG4   g&K,))"688C= C'' T::GK#       *,,KK         E !    /;#3#3#5#5 /""$$$*.' H  ;s%3B88C?C*DAEE__pycache__/constants.cpython-311.opt-1.pyc000064400000001727152533123130014436 0ustar00 !A?h.TddlZdZdZdZdZdZdZdZd ZGd d ej Z dS) N gN@g>@iicheZdZejZejZejZdS) _SendfileModeN)__name__ __module__ __qualname__enumauto UNSUPPORTED TRY_NATIVEFALLBACK>/opt/alt/python-internal/lib64/python3.11/asyncio/constants.pyrr#s5$)++KJty{{HHHrr) r !LOG_THRESHOLD_FOR_CONNLOST_WRITESACCEPT_RETRY_DELAYDEBUG_STACK_DEPTHSSL_HANDSHAKE_TIMEOUTSSL_SHUTDOWN_TIMEOUT!SENDFILE_FALLBACK_READBUFFER_SIZE FLOW_CONTROL_HIGH_WATER_SSL_READ!FLOW_CONTROL_HIGH_WATER_SSL_WRITEEnumrrrrrs  %&! %/!#& $'!DIr__pycache__/trsock.cpython-311.opt-2.pyc000064400000012033152533123130013720 0ustar00 !A?h (ddlZGddZdS)NceZdZ dZdejfdZedZedZedZ dZ dZ d Z d Z d Zd Zd ZdZdZdZdZdZdZdZdS)TransportSocket_socksockc||_dSNr)selfrs ;/opt/alt/python-internal/lib64/python3.11/asyncio/trsock.py__init__zTransportSocket.__init__s  c|jjSr )rfamilyr s r rzTransportSocket.familys z  r c|jjSr )rtypers r rzTransportSocket.types zr c|jjSr )rprotors r rzTransportSocket.protos zr cjd|d|jd|jd|j}|dkrh |}|r|d|}n#t j$rYnwxYw |}|r|d|}n#t j$rYnwxYw|dS) Nz)filenorrr getsocknamesocketerror getpeername)r sladdrraddrs r __repr__zTransportSocket.__repr__s "4;;== " "k " ",0I " "Z " " ;;==B   ((**.--e--A<     ((**.--e--A<    wwws$ A''A98A9=BB-,B-c td)Nz/Cannot serialize asyncio.TransportSocket object) TypeErrorrs r __getstate__zTransportSocket.__getstate__5sIJJJr c4|jSr )rrrs r rzTransportSocket.fileno8sz  """r c4|jSr )rduprs r r&zTransportSocket.dup;sz~~r c4|jSr )rget_inheritablers r r(zTransportSocket.get_inheritable>sz))+++r c:|j|dSr )rshutdown)r hows r r*zTransportSocket.shutdownAs  C     r c&|jj|i|Sr )r getsockoptr argskwargss r r-zTransportSocket.getsockoptFs$tz$d5f555r c*|jj|i|dSr )r setsockoptr.s r r2zTransportSocket.setsockoptIs" t.v.....r c4|jSr )rrrs r rzTransportSocket.getpeernameLz%%'''r c4|jSr )rrrs r rzTransportSocket.getsocknameOr4r c4|jSr )r getsockbynamers r r7zTransportSocket.getsockbynameRsz'')))r c0|dkrdStd)Nrzr r rrskIV]!!X!X  X .KKK###   ,,,!!! 666///((((((***LLL CCCCCr r)rrr>r r rHsT ^C^C^C^C^C^C^C^C^C^Cr __pycache__/unix_events.cpython-311.pyc000064400000217200152533123130014025 0ustar00 !A?hdZddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl Z ddl mZddl mZddl mZddl mZddl mZdd l mZdd l mZdd l mZdd l mZdd l mZddlmZdZe jdkr eddZdZGddejZ Gddej!Z"Gddej#ej$Z%Gddej&Z'GddZ(Gdde(Z)Gd d!e(Z*Gd"d#e*Z+Gd$d%e*Z,Gd&d'e(Z-Gd(d)e(Z.Gd*d+ej/Z0e Z1e0Z2dS),z2Selector event loop for Unix with signal handling.N) base_events)base_subprocess) constants) coroutines)events) exceptions)futures)selector_events)tasks) transports)logger)SelectorEventLoopAbstractChildWatcherSafeChildWatcherFastChildWatcherPidfdChildWatcherMultiLoopChildWatcherThreadedChildWatcherDefaultEventLoopPolicywin32z+Signals are not really supported on WindowscdS)zDummy signal handler.N)signumframes @/opt/alt/python-internal/lib64/python3.11/asyncio/unix_events.py_sighandler_noopr*sDcP tj|S#t$r|cYSwxYwN)oswaitstatus_to_exitcode ValueError)statuss rr"r"/s>(000  s  %%ceZdZdZdfd ZfdZdZdZdZdZ d Z dd Z dd Z dd Z d Z ddddddddZ dddddddddZdZdZdZdZxZS)_UnixSelectorEventLoopzdUnix event loop. Adds signal handling and UNIX Domain Socket support to SelectorEventLoop. NcXt|i|_dSr )super__init___signal_handlers)selfselector __class__s rr)z_UnixSelectorEventLoop.__init__?s) """ "rcNttjs.t |jD]}||dS|jr;tjd|dt||j dSdS)NzClosing the loop z@ on interpreter shutdown stage, skipping signal handlers removalsource) r(closesys is_finalizinglistr*remove_signal_handlerwarningswarnResourceWarningclear)r+sigr-s rr1z_UnixSelectorEventLoop.closeCs   "" .D122 0 0**3//// 0 0$ . I$III.%) ++++ %++-----  . .rc@|D]}|s||dSr )_handle_signal)r+datars r_process_self_dataz)_UnixSelectorEventLoop._process_self_dataQs= ( (F     ' ' ' '  ( (rcRtj|stj|rtd||| t j|j n5#ttf$r!}tt|d}~wwxYwtj|||d}||j|< t j|t"t j|ddS#t$r}|j|=|jsI t jdn3#ttf$r}t'jd|Yd}~nd}~wwxYw|jt*jkrtd|dd}~wwxYw)zAdd a handler for a signal. UNIX only. Raise ValueError if the signal number is invalid or uncatchable. Raise RuntimeError if there is a problem setting up the handler. z3coroutines cannot be used with add_signal_handler()NFset_wakeup_fd(-1) failed: %ssig  cannot be caught)r iscoroutineiscoroutinefunction TypeError _check_signal _check_closedsignal set_wakeup_fd_csockfilenor#OSError RuntimeErrorstrrHandler*r siginterruptrinfoerrnoEINVAL)r+r:callbackargsexchandlenexcs radd_signal_handlerz)_UnixSelectorEventLoop.add_signal_handlerXs  "8 , , 9.x88 9899 9 3  )  !3!3!5!5 6 6 6 6G$ ) ) )s3xx(( ( )xtT::%+c"  M#/ 0 0 0  U + + + + +   %c*( FF(,,,,"G,FFFK >EEEEEEEEFyEL(("#@##@#@#@AAA sZ"+BCB;;C%/D F& F!0EF!E5E0+F!0E55,F!!F&c|j|}|dS|jr||dS||dS)z2Internal helper that is the actual signal handler.N)r*get _cancelledr5_add_callback_signalsafe)r+r:rXs rr<z%_UnixSelectorEventLoop._handle_signalsa&**3// > F   2  & &s + + + + +  ) )& 1 1 1 1 1rc|| |j|=n#t$rYdSwxYw|tjkr tj}n tj} tj||n;#t$r.}|jtj krtd|dd}~wwxYw|jsI tj dn3#ttf$r}tjd|Yd}~nd}~wwxYwdS)zwRemove a handler for a signal. UNIX only. Return True if a signal handler was removed, False if not. FrBrCNr@rAT)rGr*KeyErrorrISIGINTdefault_int_handlerSIG_DFLrMrSrTrNrJr#rrR)r+r:handlerrWs rr5z,_UnixSelectorEventLoop.remove_signal_handlersK 3 %c**   55  &-  0GGnG  M#w ' ' ' '   yEL(("#@##@#@#@AAA   $ A A$R((((( A A A :C@@@@@@@@ Ats< ..A11 B);)B$$B)4C C9C44C9ct|tstd||tjvrt d|dS)zInternal helper to validate a signal. Raise ValueError if the signal number is invalid or uncatchable. Raise RuntimeError if there is a problem setting up the handler. zsig must be an int, not zinvalid signal number N) isinstanceintrFrI valid_signalsr#)r+r:s rrGz$_UnixSelectorEventLoop._check_signalsa #s## @>s>>?? ? f*,, , ,;c;;<< < - ,rc(t|||||Sr )_UnixReadPipeTransportr+pipeprotocolwaiterextras r_make_read_pipe_transportz0_UnixSelectorEventLoop._make_read_pipe_transports%dD(FEJJJrc(t|||||Sr )_UnixWritePipeTransportrks r_make_write_pipe_transportz1_UnixSelectorEventLoop._make_write_pipe_transports&tT8VUKKKrc Ktj5} | std|} t ||||||||f| |d| } | | |j|  | d{VnN#ttf$rt$r0| | d{VwxYw dddn #1swxYwY| S)NzRasyncio.get_child_watcher() is not activated, subprocess support is not installed.)rnro)rget_child_watcher is_activerN create_future_UnixSubprocessTransportadd_child_handlerget_pid_child_watcher_callback SystemExitKeyboardInterrupt BaseExceptionr1_wait) r+rmrVshellstdinstdoutstderrbufsizerokwargswatcherrntransps r_make_subprocess_transportz1_UnixSelectorEventLoop._make_subprocess_transports % ' ' 7$$&& K #$JKKK''))F-dHdE.3VVW85;5881788F  % %fnn&6&6&*&BF L L L   12        llnn$$$$$$$ #               2 s+A=C8BC8A C((C88C<?C<cH||j|j|dSr )call_soon_threadsafe call_soon_process_exited)r+pid returncoders rr{z._UnixSelectorEventLoop._child_watcher_callbacks% !!$.&2H*UUUUUr)sslsockserver_hostnamessl_handshake_timeoutssl_shutdown_timeoutcK|t|tsJ|r|tdn3|td|td|td||tdtj|}t jt jt jd} |d| ||d{Vn|#| xYw|td|j t jks|j t jkrtd ||d| |||||| d{V\}} || fS) Nz/you have to pass server_hostname when using sslz+server_hostname is only meaningful with ssl1ssl_handshake_timeout is only meaningful with ssl0ssl_shutdown_timeout is only meaningful with ssl3path and sock can not be specified at the same timerFzno path and sock were specified.A UNIX Domain Stream Socket was expected, got )rr)rfrOr#r!fspathsocketAF_UNIX SOCK_STREAM setblocking sock_connectr1familytype_create_connection_transport) r+protocol_factorypathrrrrr transportrms rcreate_unix_connectionz-_UnixSelectorEventLoop.create_unix_connections &*_c*J*J&&J  H& EGGG'* !NOOO$0 GIII#/ FHHH   IKKK9T??D=1CQGGD   '''''d3333333333  | !BCCC v~--I!333 MTMMOOO   U # # #$($E$E "C"7!5%F%7%7777777 8(""s 51C''C>dT)rbacklogrrr start_servingc Kt|trtd||std||std|Z|tdt j|}t jt jt j}|ddvry tj t j |j rt j |n8#t$rYn,t$r } tjd|| Yd} ~ nd} ~ wwxYw ||n#t$rP} || jt&jkr!d|d } tt&j| dd} ~ w|xYw|td |jt jks|jt jkrtd ||d t1j||g|||||} |r.| t7jdd{V| S) Nz*ssl argument must be an SSLContext or Nonerrrr)rz2Unable to check or remove stale UNIX socket %r: %rzAddress z is already in usez-path was not specified, and no sock specifiedrF)rfboolrFr#r!rrrrstatS_ISSOCKst_moderemoveFileNotFoundErrorrMrerrorbindr1rS EADDRINUSErrrrServer_start_servingr sleep) r+rrrrrrrrerrrWmsgservers rcreate_unix_serverz)_UnixSelectorEventLoop.create_unix_servers c4  JHII I ,S ,CEE E +C +BDD D   IKKK9T??D=1CDDDAwk))6}RWT]]%:;;( $(D666L"*+/666666666  $    9 000@T???C!%"2C88dB  | CEEE v~--I!333 MTMMOOO #D4&2B$'2G$8::  !  ! ! # # #+a..  s7)?C)) D5 D>DD"D88 F'A F  F'c K tjn"#t$rtjdwxYw |}n2#tt jf$r}tjdd}~wwxYw tj|j }n"#t$rtjdwxYw|r|n|}|sdS| } | | d|||||d| d{VS)Nzos.sendfile() is not availableznot a regular filer) r!sendfileAttributeErrorr SendfileNotAvailableErrorrLioUnsupportedOperationfstatst_sizerMrw_sock_sendfile_native_impl) r+rfileoffsetcountrLrfsize blocksizefuts r_sock_sendfile_nativez,_UnixSelectorEventLoop._sock_sendfile_native`sN 2 KKK 2 2 26022 2 2 M[[]]FF 78 M M M67KLL L M MHV$$,EE M M M67KLL L M"-EE  1  "" ''T4(.y! E E Eyyyyyys+ 0A A8A33A8<BB5c L|} ||||r||||dS|r9||z }|dkr.||||||dS t j| |||} | dkr.||||||dS|| z }|| z }|||||| |j || |||||| dS#ttf$r?|||||| |j || |||||| YdSt$r} |N| j tjkr9t| t ur#t!dtj} | | _| } |dkrAt%jd} |||||| n2|||||| Yd} ~ dSYd} ~ dSd} ~ wt*t,f$rt.$r7} |||||| Yd} ~ dSd} ~ wwxYw)Nrzsocket is not connectedzos.sendfile call failed)rL remove_writer cancelled_sock_sendfile_update_filepos set_resultr!r_sock_add_cancellation_callback add_writerrBlockingIOErrorInterruptedErrorrMrSENOTCONNrConnectionError __cause__r r set_exceptionr|r}r~)r+r registered_fdrrLrrr total_sentfdsentrWnew_excrs rrz1_UnixSelectorEventLoop._sock_sendfile_native_implwsb [[]]  $   } - - - ==??   . .vvz J J J F   *IA~~2266:NNNz***1 F;r669==DJqyy2266:NNNz*****$d"  (88dCCCD$CS "D& &y*FFFFF[ !12 B B B$44S$??? OOB ?f"E9j B B B B B B ' ' ')I//II_44 *-u~??$'!Q !:-//2266:NNN!!#&&&&2266:NNN!!#&&&&&&&&&'&&&&&-.     # # #  . .vvz J J J   c " " " " " " " " " #s,D''A J#6 J#?CIJ#,,JJ#cV|dkr"tj||tjdSdSNr)r!lseekSEEK_SET)r+rLrrs rrz4_UnixSelectorEventLoop._sock_sendfile_update_fileposs. >> HVVR[ 1 1 1 1 1 >rc@fd}||dS)Nc|r1}|dkr|dSdSdS)Nr@)rrLr)rrr+rs rcbzB_UnixSelectorEventLoop._sock_add_cancellation_callback..cbsR}} +[[]]88&&r***** + +8r)add_done_callback)r+rrrs` ` rrz6_UnixSelectorEventLoop._sock_add_cancellation_callbacks> + + + + + + b!!!!!rr NN)__name__ __module__ __qualname____doc__r)r1r>rZr<r5rGrprsrr{rrrrrr __classcell__r-s@rr&r&9s ###### . . . . .(((+++Z222@ = = =@D(,KKKKAE)-LLLL 04<VVV *.0#4 "&!% 0#0#0#0#0#f*.Gs"&!% GGGGGR.DFDFDFL222"""""""rr&ceZdZdZdfd ZdZdZdZdZdZ d Z d Z d Z d Z d ZejfdZddZdZdZxZS)rjiNct|||jd<||_||_||_||_d|_d|_ tj |jj }tj|sLtj|s8tj|s$d|_d|_d|_t#dtj|jd|j|jj||j|j|j|j|(|jt.j|ddSdS)NrlFz)Pipe transport is for pipes/sockets only.)r(r)_extra_loop_piperL_fileno _protocol_closing_pausedr!rrrS_ISFIFOrS_ISCHRr# set_blockingrconnection_made _add_reader _read_readyr _set_result_unless_cancelled)r+looprlrmrnromoder-s rr)z_UnixReadPipeTransport.__init__sb " F  {{}} !  x %%- d## J d## J T"" JDJDL!DNHII I  e,,, T^;TBBB T-!\4+; = = =   J !E!' / / / / /  rch|sdS|j||dSr ) is_readingrr)r+rrUs rrz"_UnixReadPipeTransport._add_readers7    F r8,,,,,rc"|j o|j Sr )rrr+s rrz!_UnixReadPipeTransport.is_readings<5 $55rc`|jjg}|j|dn|jr|d|d|jt |jdd}|jU|Stj ||jtj }|r|dnH|dn2|j|dn|dd d |S) Nclosedclosingfd= _selectorpollingidleopen<{}> )r-rrappendrrgetattrrr _test_selector_event selectors EVENT_READformatjoin)r+rRr,rs r__repr__z_UnixReadPipeTransport.__repr__s '( :  KK ! ! ! ! ] # KK " " " ($,(()))4:{D99 : !h&:%:$, (<>>G $ I&&&& F#### Z # KK     KK ! ! !}}SXXd^^,,,rc4 tj|j|j}|r|j|dS|jrtj d|d|_ |j |j|j |jj |j |jddS#tt f$rYdSt"$r!}||dYd}~dSd}~wwxYw)N%r was closed by peerTz"Fatal read error on pipe transport)r!readrmax_sizer data_receivedr get_debugrrRr_remove_readerr eof_received_call_connection_lostrrrM _fatal_error)r+r=rWs rrz"_UnixReadPipeTransport._read_ready s5 G74<77D  G,,T22222:''))?K 7>>> $  ))$,777 $$T^%@AAA $$T%?FFFFF !12    DD I I I   c#G H H H H H H H H H IsCD- D6DDc|sdSd|_|j|j|jrt jd|dSdS)NTz%r pauses reading)rrrrrrrdebugrs r pause_readingz$_UnixReadPipeTransport.pause_readingsq    F  !!$,/// :   ! ! 4 L,d 3 3 3 3 3 4 4rc|js|jsdSd|_|j|j|j|jrtjd|dSdS)NFz%r resumes reading) rrrrrrrrrrs rresume_readingz%_UnixReadPipeTransport.resume_reading#sw =    F  t|T-=>>> :   ! ! 5 L-t 4 4 4 4 4 5 5rc||_dSr rr+rms r set_protocolz#_UnixReadPipeTransport.set_protocol+ !rc|jSr r$rs r get_protocolz#_UnixReadPipeTransport.get_protocol. ~rc|jSr rrs r is_closingz!_UnixReadPipeTransport.is_closing1 }rcB|js|ddSdSr )r_closers rr1z_UnixReadPipeTransport.close4s.}  KK       rcv|j1|d|t||jdSdSNzunclosed transport r/rr8r1r+_warns r__del__z_UnixReadPipeTransport.__del__8L : ! E000/$ O O O O J        " !rFatal error on pipe transportc0t|trG|jtjkr2|jrt jd||dn$|j||||j d| |dSNz%r: %sTexc_info)message exceptionrrm) rfrMrSEIOrrrrcall_exception_handlerrr0r+rWr=s rrz#_UnixReadPipeTransport._fatal_error=s sG $ $ ei)?)?z##%% E XtWtDDDD J - -" ! N //    Crcd|_|j|j|j|j|dSNT)rrrrrrr+rWs rr0z_UnixReadPipeTransport._closeKsB  !!$,/// T7=====rc |j||jd|_d|_d|_dS#|jd|_d|_d|_wxYwr rconnection_lostrr1rrDs rrz,_UnixReadPipeTransport._call_connection_lostP  N * *3 / / / J     DJ!DNDJJJ J     DJ!DNDJ     A 0A<rr8)rrrrr)rrrrr r"r&r)r-r1r6r7r6rr0rrrs@rrjrjs(H//////<--- 666---*GGG$444555"""%M    >>> rrjceZdZdfd ZdZdZdZdZdZdZ d Z d Z d Z d Z d ZejfdZdZddZddZdZxZS)rrNcpt||||jd<||_||_||_t|_d|_ d|_ tj |jj }tj|}tj|}tj|} |s(|s&| s$d|_d|_d|_t%dtj|jd|j|jj|| s!|rOt.jds0|j|jj|j|j|(|jt8j|ddSdS)NrlrFz?Pipe transport is only for pipes, sockets and character devicesaix)r(r)rrrLrr bytearray_buffer _conn_lostrr!rrrrrrr#rrrrr2platform startswithrrr r) r+rrlrmrnroris_charis_fifo is_socketr-s rr)z _UnixWritePipeTransport.__init__]s %%%" F {{}} ! {{  x %%-,t$$-%%M$''  E7 Ei EDJDL!DNDEE E  e,,, T^;TBBB  A A)@)@)G)G A J !7!%t/? A A A   J !E!' / / / / /  rc|jjg}|j|dn|jr|d|d|jt |jdd}|j|tj ||jtj }|r|dn|d| }|d|n2|j|dn|dd d |S) Nrrrrrrzbufsize=r r r )r-rrr rrr rr rr EVENT_WRITEget_write_buffer_sizerr)r+rRr,rrs rrz _UnixWritePipeTransport.__repr__sL'( :  KK ! ! ! ! ] # KK " " " ($,(()))4:{D99 : !h&:%:$, (=??G $ I&&&& F###0022G KK,7,, - - - - Z # KK     KK ! ! !}}SXXd^^,,,rc*t|jSr )lenrOrs rrXz-_UnixWritePipeTransport.get_write_buffer_sizes4<   rc|jrtjd||jr#|t dS|dS)Nr)rrrrRrOr0BrokenPipeErrorrs rrz#_UnixWritePipeTransport._read_readysd :   ! ! 7 K/ 6 6 6 <  KK)) * * * * * KKMMMMMrc\t|tttfsJt |t|trt|}|sdS|js|jr;|jtjkrtj d|xjdz c_dS|j s tj |j|}nc#tt f$rd}YnNt"t$f$rt&$r1}|xjdz c_||dYd}~dSd}~wwxYw|t+|krdS|dkrt||d}|j|j|j|xj |z c_ |dS)Nz=pipe closed by peer or os.write(pipe, data) raised exception.rr#Fatal write error on pipe transport)rfbytesrN memoryviewreprrPrr!LOG_THRESHOLD_FOR_CONNLOST_WRITESrwarningrOr!writerrrr|r}r~rrZr _add_writer _write_ready_maybe_pause_protocol)r+r=nrWs rrdz_UnixWritePipeTransport.writes$ : >??KKdKK? dI & & $d##D  F ? dm )"MMM HIII OOq OO F| D HT\400#%56    12       1$!!#'LMMM CII~~Q!$''+ J " "4<1B C C C   ""$$$$$s3CD.#D.=&D))D.c|js Jd tj|j|j}|t |jkr|j|j|j||j r4|j |j| ddS|dkr |jd|=dSdS#ttf$rYdSttf$rt $ri}|j|xjdz c_|j|j||dYd}~dSd}~wwxYw)NzData should not be emptyrrr^)rOr!rdrrZr9r_remove_writer_maybe_resume_protocolrrrrrr|r}r~rPr)r+rhrWs rrfz$_UnixWritePipeTransport._write_readys|77777| %t|44AC %%%% ""$$$ ))$,777++---=5J--dl;;;..t444QL!$$$) !12    DD-.     J J J L   OOq OO J % %dl 3 3 3   c#H I I I I I I I I I  JsC''E>;E>AE99E>cdSrCrrs r can_write_eofz%_UnixWritePipeTransport.can_write_eoftrc|jrdS|jsJd|_|jsA|j|j|j|jddSdSrC)rrrOrrrrrrs r write_eofz!_UnixWritePipeTransport.write_eofsu =  Fzz | C J % %dl 3 3 3 J !;T B B B B B C Crc||_dSr r$r%s rr&z$_UnixWritePipeTransport.set_protocolr'rc|jSr r$rs rr)z$_UnixWritePipeTransport.get_protocolr*rc|jSr r,rs rr-z"_UnixWritePipeTransport.is_closingr.rcR|j|js|dSdSdSr )rrrprs rr1z_UnixWritePipeTransport.closes5 : !$- ! NN      " ! ! !rcv|j1|d|t||jdSdSr2r3r4s rr6z_UnixWritePipeTransport.__del__r7rc0|ddSr )r0rs rabortz_UnixWritePipeTransport.aborts Drr8ct|tr2|jrt jd||dn$|j||||jd||dSr:) rfrMrrrrr@rr0rAs rrz$_UnixWritePipeTransport._fatal_errors c7 # # z##%% E XtWtDDDD J - -" ! N //    Crcd|_|jr|j|j|j|j|j|j|j|dSrC) rrOrrjrr9rrrrDs rr0z_UnixWritePipeTransport._closesx < 4 J % %dl 3 3 3  !!$,/// T7=====rc |j||jd|_d|_d|_dS#|jd|_d|_d|_wxYwr rFrDs rrz-_UnixWritePipeTransport._call_connection_lostrHrIrrJr )rrrr)rrXrrdrfrmrpr&r)r-r1r6r7r6rwrr0rrrs@rrrrrZsH#/#/#/#/#/#/J---0!!!!%!%!%F%%%8CCC""" %M     >>>>rrrceZdZdZdS)rxc d}|tjkr5tjdrt j\}} tj|f||||d|d||_|D| t| d||j_ d}|*| | dSdS#|)| | wwxYw)NrMF)rrrruniversal_newlinesrwb) buffering) subprocessPIPEr2rQrRr socketpairPopen_procr1r detachr) r+rVrrrrrrstdin_ws r_startz_UnixSubprocessTransport._start)s JO # # (?(?(F(F # $.00NE7 #)E!vf#('EE=CEEDJ" #'(8(8$'#R#R#R  "  #"w"  #s A$C-DN)rrrrrrrrxrx's#     rrxc<eZdZdZdZdZdZdZdZdZ dZ d S) raHAbstract base class for monitoring child processes. Objects derived from this class monitor a collection of subprocesses and report their termination or interruption by a signal. New callbacks are registered with .add_child_handler(). Starting a new process must be done within a 'with' block to allow the watcher to suspend its activity until the new process if fully registered (this is needed to prevent a race condition in some implementations). Example: with watcher: proc = subprocess.Popen("sleep 1") watcher.add_child_handler(proc.pid, callback) Notes: Implementations of this class must be thread-safe. Since child watcher objects may catch the SIGCHLD signal and call waitpid(-1), there should be only one active object per process. ct)aRegister a new child handler. Arrange for callback(pid, returncode, *args) to be called when process 'pid' terminates. Specifying another callback for the same process replaces the previous handler. Note: callback() must be thread-safe. NotImplementedErrorr+rrUrVs rryz&AbstractChildWatcher.add_child_handlerVs"###rct)zRemoves the handler for process 'pid'. The function returns True if the handler was successfully removed, False if there was nothing to remove.rr+rs rremove_child_handlerz)AbstractChildWatcher.remove_child_handleras "###rct)zAttach the watcher to an event loop. If the watcher was previously attached to an event loop, then it is first detached before attaching to the new loop. Note: loop may be None. rr+rs r attach_loopz AbstractChildWatcher.attach_loopis"###rct)zlClose the watcher. This must be called to make sure that any underlying resource is freed. rrs rr1zAbstractChildWatcher.closess "###rct)zReturn ``True`` if the watcher is active and is used by the event loop. Return True if the watcher is installed and ready to handle process exit notifications. rrs rrvzAbstractChildWatcher.is_activezs"###rct)zdEnter the watcher's context and allow starting new processes This function must return selfrrs r __enter__zAbstractChildWatcher.__enter__s"###rct)zExit the watcher's contextrr+abcs r__exit__zAbstractChildWatcher.__exit__s!###rN) rrrrryrrr1rvrrrrrrr?s, $ $ $$$$$$$$$$$$$$$$ $$$$$rrcHeZdZdZdZdZdZdZdZdZ dZ d Z d Z d S) ra6Child watcher implementation using Linux's pid file descriptors. This child watcher polls process file descriptors (pidfds) to await child process termination. In some respects, PidfdChildWatcher is a "Goldilocks" child watcher implementation. It doesn't require signals or threads, doesn't interfere with any processes launched outside the event loop, and scales linearly with the number of subprocesses launched by the event loop. The main disadvantage is that pidfds are specific to Linux, and only work on recent (5.3+) kernels. c"d|_i|_dSr r _callbacksrs rr)zPidfdChildWatcher.__init__ rc|Sr rrs rrzPidfdChildWatcher.__enter__ rcdSr r)r+exc_type exc_value exc_tracebacks rrzPidfdChildWatcher.__exit__ rcF|jduo|jSr r is_runningrs rrvzPidfdChildWatcher.is_active"z%A$**?*?*A*AArc0|ddSr rrs rr1zPidfdChildWatcher.close rc6|j#|!|jrtjdt|jD]4\}}}|j|tj|5|j ||_dSNzCA loop is being detached from a child watcher with pending handlers) rrr6r7RuntimeWarningvaluesrr!r1r9)r+rpidfd_s rrzPidfdChildWatcher.attach_loops : !dltl M=    ?1133  KE1a J % %e , , , HUOOOO  rc|j|}||d||f|j|<dStj|}|j||j||||f|j|<dSr)rr\r! pidfd_openrr_do_wait)r+rrUrVexistingrs rryz#PidfdChildWatcher.add_child_handlers~?&&s++  #+A;$#>DOC M#&&E J " "5$- = = =#((D#8DOC rcR|j|\}}}|j| t j|d\}}t |}n'#t$rd}tj d|YnwxYwt j ||||g|RdS)NrzJchild process pid %d exit status already read: will report returncode 255) rpoprrr!waitpidr"ChildProcessErrorrrcr1)r+rrrUrVrr$rs rrzPidfdChildWatcher._do_waits $ 3 3C 8 8x !!%((( 8 3**IAv077JJ!   J N.        j(4((((((sA""!BBc |j|\}}}n#t$rYdSwxYw|j|t j|dS)NFT)rrr`rrr!r1)r+rrrs rrz&PidfdChildWatcher.remove_child_handlersn /--c22KE1aa   55  !!%((( ts ! //N) rrrrr)rrrvr1rryrrrrrrrs     BBB   999)))&rrc8eZdZdZdZdZdZdZdZdZ dS) BaseChildWatcherc"d|_i|_dSr rrs rr)zBaseChildWatcher.__init__rrc0|ddSr rrs rr1zBaseChildWatcher.closerrcF|jduo|jSr rrs rrvzBaseChildWatcher.is_activerrctr r)r+ expected_pids r _do_waitpidzBaseChildWatcher._do_waitpid!###rctr rrs r_do_waitpid_allz BaseChildWatcher._do_waitpid_allrrct|t|tjsJ|j#|!|jrt jdt|j$|jtj ||_|;| tj |j | dSdSr)rfrAbstractEventLooprrr6r7rr5rISIGCHLDrZ _sig_chldrrs rrzBaseChildWatcher.attach_loops|z$0HII||I : !dltl M=   : ! J , ,V^ < < <    # #FNDN C C C  " " " " "  rc |dS#ttf$rt$r(}|jd|dYd}~dSd}~wwxYw)N$Unknown exception in SIGCHLD handler)r=r>)rr|r}r~rr@rDs rrzBaseChildWatcher._sig_chlds   " " " " "-.        J - -A //           sAAAN) rrrr)r1rvrrrrrrrrrsBBB$$$$$$###(     rrcFeZdZdZfdZdZdZdZdZdZ dZ xZ S) rad'Safe' child watcher implementation. This implementation avoids disrupting other code spawning processes by polling explicitly each process in the SIGCHLD handler instead of calling os.waitpid(-1). This is a safe solution but it has a significant overhead when handling a big number of children (O(n) each time SIGCHLD is raised) cz|jtdSr )rr9r(r1r+r-s rr1zSafeChildWatcher.closes,   rc|Sr rrs rrzSafeChildWatcher.__enter__ rrcdSr rrs rrzSafeChildWatcher.__exit__#rrcH||f|j|<||dSr )rrrs rryz"SafeChildWatcher.add_child_handler&s/ ($/ rc: |j|=dS#t$rYdSwxYwNTFrr`rs rrz%SafeChildWatcher.remove_child_handler,8 $4   55   c^t|jD]}||dSr r4rrrs rrz SafeChildWatcher._do_waitpid_all3s<(( " "C   S ! ! ! ! " "rc|dksJ tj|tj\}}|dkrdSt|}|jrt jd||n)#t$r|}d}t j d|YnwxYw |j |\}}|||g|RdS#t$r7|jrt j d|dYdSYdSwxYw)Nr$process %s exited with returncode %sr8Unknown child process pid %d, will report returncode 255'Child watcher got an unexpected pid: %rTr;) r!rWNOHANGr"rrrrrrcrrr`)r+rrr$rrUrVs rrzSafeChildWatcher._do_waitpid8sa 7*\2:>>KCaxx/77Jz##%% 7 C):777!   CJ NJ       $ -!_0055NHd HS* ,t , , , , , , 3 3 3z##%% 3H"T3333333 3 3 3 3s#"A33#BBC:DD) rrrrr1rrryrrrrrs@rrrs    """ - - - - - - -rrcJeZdZdZfdZfdZdZdZdZdZ dZ xZ S) raW'Fast' child watcher implementation. This implementation reaps every terminated processes by calling os.waitpid(-1) directly, possibly breaking other code spawning processes and waiting for their termination. There is no noticeable overhead when handling a big number of children (O(1) each time a child terminates). cttj|_i|_d|_dSr)r(r) threadingLock_lock_zombies_forksrs rr)zFastChildWatcher.__init__es: ^%%   rc|j|jtdSr )rr9rr(r1rs rr1zFastChildWatcher.closeks@    rch|j5|xjdz c_|cdddS#1swxYwYdS)Nr)rrrs rrzFastChildWatcher.__enter__ps Z   KK1 KK                  s '++c |j5|xjdzc_|js|js ddddSt|j}|jdddn #1swxYwYt jd|dS)Nrz5Caught subprocesses termination from unknown pids: %s)rrrrOr9rrc)r+rrrcollateral_victimss rrzFastChildWatcher.__exit__vs Z " " KK1 KK{ $-   " " " " " " " " "%T]!3!3  M   ! ! ! " " " " " " " " " " " " " " "  C      s A.-A..A25A2c|js Jd|j5 |j|}n(#t$r||f|j|<YddddSwxYw dddn #1swxYwY|||g|RdS)NzMust use the context manager)rrrrr`r)r+rrUrVrs rryz"FastChildWatcher.add_child_handlers{:::::{ Z   !]..s33    '/~$                          j(4((((((s1A+6A+A A+AA++A/2A/c: |j|=dS#t$rYdSwxYwrrrs rrz%FastChildWatcher.remove_child_handlerrrc~ tjdtj\}}|dkrdSt|}n#t$rYdSwxYw|j5 |j|\}}|j rtj d||n_#t$rR|j rF||j|<|j rtj d||Ydddd}YnwxYwdddn #1swxYwY|tjd||n |||g|R=)NTr@rrz,unknown process %s exited with returncode %sz8Caught subprocess termination from unknown pid: %d -> %d)r!rrr"rrrrrrrrr`rrrc)r+rr$rrUrVs rrz FastChildWatcher._do_waitpid_alls% 1 < jRZ88 V !88F3F;; %     6 66%)_%8%8%=%=NHdz++--6 %K%(*666 $ $ ${!-7 c*://11:"L*>),j:::! 6 6 6 6 6 6 6 $HHH $ 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6& #Z1111j040000K% 1sR"= A  A DB$40D$A D.D;D=D?DDDD) rrrrr)r1rrryrrrrs@rrr[s       ) ) )(1(1(1(1(1(1(1rrcTeZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd S)ra~A watcher that doesn't require running loop in the main thread. This implementation registers a SIGCHLD signal handler on instantiation (which may conflict with other code that install own handler for this signal). The solution is safe but it has a significant overhead when handling a big number of processes (*O(n)* each time a SIGCHLD is received). c"i|_d|_dSr )r_saved_sighandlerrs rr)zMultiLoopChildWatcher.__init__s!%rc|jduSr )rrs rrvzMultiLoopChildWatcher.is_actives%T11rc|j|jdStjtj}||jkrtjdn$tjtj|jd|_dS)Nz+SIGCHLD handler was changed by outside code) rr9rrI getsignalrrrrc)r+rds rr1zMultiLoopChildWatcher.closes|   ! ) F"6>22 dn $ $ NH I I I I M&.$*@ A A A!%rc|Sr rrs rrzMultiLoopChildWatcher.__enter__rrcdSr rr+rexc_valexc_tbs rrzMultiLoopChildWatcher.__exit__rrcptj}|||f|j|<||dSr )rget_running_looprr)r+rrUrVrs rryz'MultiLoopChildWatcher.add_child_handlers?&(( $h5 rc: |j|=dS#t$rYdSwxYwrrrs rrz*MultiLoopChildWatcher.remove_child_handlerrrc|jdStjtj|j|_|j%t jdtj|_tjtjddS)NzaPrevious SIGCHLD handler was set by non-Python code, restore to default handler on watcher close.F)rrIrrrrcrcrQrs rrz!MultiLoopChildWatcher.attach_loopsw  ! - F!'v~t~!N!N  ! ) NJ K K K%+^D " FNE22222rc^t|jD]}||dSr rrs rrz%MultiLoopChildWatcher._do_waitpid_alls<(( " "C   S ! ! ! ! " "rcD|dksJ tj|tj\}}|dkrdSt|}d}n+#t$r|}d}t jd|d}YnwxYw |j|\}}}| rt jd||dS|r*| rt j d|||j |||g|RdS#t$rt jd|d YdSwxYw) NrTrrF%Loop %r that handles pid %r is closedrrr;)r!rrr"rrrcrr is_closedrrrr`) r+rrr$r debug_logrrUrVs rrz!MultiLoopChildWatcher._do_waitpidsa *\2:>>KCaxx/77JII!   CJ NJ   III   L#'?#6#6s#;#; D(D~~ LFcRRRRR;!1!1;L!G!-z;;;))(CKdKKKKKK / / / ND / / / / / / / /s#"A%A.-A.2C::!DDc |dS#ttf$rt$rt jddYdSwxYw)NrTr;)rr|r}r~rrc)r+rrs rrzMultiLoopChildWatcher._sig_chld8sy R  " " " " "-.     R R R NAD Q Q Q Q Q Q Q Rs1A  A N)rrrrr)rvr1rrryrrrrrrrrrrs  $&&&222 & & &   333""""#L#L#LJRRRRRrrc\eZdZdZdZdZdZdZdZe j fdZ dZ d Z d Zd Zd S) raAThreaded child watcher implementation. The watcher uses a thread per process for waiting for the process finish. It doesn't require subscription on POSIX signal but a thread creation is not free. The watcher has O(1) complexity, its performance doesn't depend on amount of spawn processes. cFtjd|_i|_dSr) itertoolsr _pid_counter_threadsrs rr)zThreadedChildWatcher.__init__Ns%OA.. rcdSrCrrs rrvzThreadedChildWatcher.is_activeRrnrcdSr rrs rr1zThreadedChildWatcher.closeUrrc|Sr rrs rrzThreadedChildWatcher.__enter__XrrcdSr rrs rrzThreadedChildWatcher.__exit__[rrcdt|jD}|r||jdt|dSdS)Nc:g|]}||Sr)is_alive).0threads r z0ThreadedChildWatcher.__del__.._s6)))foo'')6)))rz0 has registered but not finished child processesr/)r4r rr-r8)r+r5threadss rr6zThreadedChildWatcher.__del__^s}))T]-A-A-C-C(D(D)))   ET^UUU!        rctj}tj|jdt |j||||fd}||j|<|dS)Nzasyncio-waitpid-T)targetnamerVdaemon) rrrThreadrnextr r start)r+rrUrVrrs rryz&ThreadedChildWatcher.add_child_handlerfsp&((!)9'S$t?P:Q:Q'S'S(,c8T'B)-///$ c rcdSrCrrs rrz)ThreadedChildWatcher.remove_child_handleros trcdSr rrs rrz ThreadedChildWatcher.attach_loopurrc|dksJ tj|d\}}t|}|rt jd||n)#t $r|}d}t jd|YnwxYw|rt jd||n|j |||g|R|j |dS)Nrrrrr) r!rr"rrrrrcrrr r)r+rrrUrVrr$rs rrz ThreadedChildWatcher._do_waitpidxs a 7*\155KC077J~~ 7 C):777!   CJ NJ        >>   H NBD# N N N N %D %hZ G$ G G G G ,'''''sA#BBN)rrrrr)rvr1rrr6r7r6ryrrrrrrrrAs        %M    (((((rrcBeZdZdZeZfdZdZfdZdZ dZ xZ S)_UnixDefaultEventLoopPolicyz:UNIX event loop policy with a watcher for child processes.cVtd|_dSr )r(r)_watcherrs rr)z$_UnixDefaultEventLoopPolicy.__init__s$  rctj5|jt|_ddddS#1swxYwYdSr )rrr#rrs r _init_watcherz)_UnixDefaultEventLoopPolicy._init_watchers \ 7 7}$ 4 6 6  7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7s 599ct||jBtjtjur|j|dSdSdS)zSet the event loop. As a side effect, if a child watcher was set before, then calling .set_event_loop() from the main thread will call .attach_loop(loop) on the child watcher. N)r(set_event_loopr#rcurrent_thread main_threadr)r+rr-s rr'z*_UnixDefaultEventLoopPolicy.set_event_loopsl t$$$ M %(**i.C.E.EEE M % %d + + + + + & %EErcF|j||jS)z~Get the watcher for child processes. If not yet set, a ThreadedChildWatcher object is automatically created. )r#r%rs rruz-_UnixDefaultEventLoopPolicy.get_child_watchers& =    }rc|t|tsJ|j|j||_dS)z$Set the watcher for child processes.N)rfrr#r1)r+rs rset_child_watcherz-_UnixDefaultEventLoopPolicy.set_child_watchersD*W6J"K"KK = $ M   ! ! ! r) rrrrr& _loop_factoryr)r%r'rur,rrs@rr!r!sDD*M777 , , , , ,       rr!)3rrSrrr!rrIrrrr2rr6rrrrrr r r r r logr__all__rQ ImportErrorrr"BaseSelectorEventLoopr& ReadTransportrj_FlowControlMixinWriteTransportrrBaseSubprocessTransportrxrrrrrrrBaseDefaultEventLoopPolicyr!rrrrrr8s88     <7 +C D DD   N"N"N"N"N"_BN"N"N"b MMMMMZ5MMM`JJJJJj:(7JJJZ     F   0L$L$L$L$L$L$L$L$^KKKKK,KKK\22222+222jG-G-G-G-G-'G-G-G-Tf1f1f1f1f1'f1f1f1RzRzRzRzRzR0zRzRzRzO(O(O(O(O(/O(O(O(d- - - - - &"C- - - `+4r__pycache__/queues.cpython-311.pyc000064400000031056152533123130012770 0ustar00 !A?h&dZddlZddlZddlmZddlmZddlmZGddeZ Gd d eZ Gd d ej Z Gd de Z Gdde ZdS))Queue PriorityQueue LifoQueue QueueFull QueueEmptyN) GenericAlias)locks)mixinsceZdZdZdS)rz;Raised when Queue.get_nowait() is called on an empty Queue.N__name__ __module__ __qualname____doc__;/opt/alt/python-internal/lib64/python3.11/asyncio/queues.pyrr sEEDrrceZdZdZdS)rzDRaised when the Queue.put_nowait() method is called on a full Queue.Nr rrrrrsNNDrrceZdZdZddZdZdZdZdZdZ d Z e e Z d Zd Zed Zd ZdZdZdZdZdZdZdZdS)raA queue, useful for coordinating producer and consumer coroutines. If maxsize is less than or equal to zero, the queue size is infinite. If it is an integer greater than 0, then "await put()" will block when the queue reaches maxsize, until an item is removed by get(). Unlike the standard library Queue, you can reliably know this Queue's size with qsize(), since your single-threaded asyncio application won't be interrupted between calling qsize() and doing an operation on the Queue. rc||_tj|_tj|_d|_t j|_|j | |dS)Nr) _maxsize collectionsdeque_getters_putters_unfinished_tasksr Event _finishedset_initselfmaxsizes r__init__zQueue.__init__!sl $)++ #)++ !"  7rc6tj|_dSN)rr_queuer"s rr!z Queue._init/s!')) rc4|jSr')r(popleftr#s r_getz Queue._get2s{""$$$rc:|j|dSr'r(appendr#items r_putz Queue._put5 4     rc|rC|}|s|ddS|AdSdSr')r*done set_result)r#waiterswaiters r _wakeup_nextzQueue._wakeup_next:s` __&&F;;== !!$'''      rc~dt|jdt|dd|dS)N)typerid_formatr+s r__repr__zQueue.__repr__Bs=K4::&KKBtHHKKK$,,..KKKKrc\dt|jd|dS)Nr;r<r=)r>rr@r+s r__str__z Queue.__str__Es,:4::&::::::rc d|j}t|ddr|dt|jz }|jr|dt |jdz }|jr|dt |jdz }|jr |d|jz }|S)Nzmaxsize=r(z _queue=z _getters[]z _putters[z tasks=)rgetattrlistr(rlenrr)r#results rr@z Queue._formatJs-DM-- 44 ( ( 7 6dk!2!266 6F = 9 83t}#5#5888 8F = 9 83t}#5#5888 8F  ! 9 8 688 8F rc*t|jS)zNumber of items in the queue.)rHr(r+s rqsizez Queue.qsizeVs4;rc|jS)z%Number of items allowed in the queue.)rr+s rr$z Queue.maxsizeZs }rc|j S)z3Return True if the queue is empty, False otherwise.r(r+s remptyz Queue.empty_s ;rcV|jdkrdS||jkS)zReturn True if there are maxsize items in the queue. Note: if the Queue was initialized with maxsize=0 (the default), then full() is never True. rF)rrKr+s rfullz Queue.fullcs+ =A  5::<<4=0 0rc$K|r|}|j| |d{Vn#| |j|n#t$rYnwxYw|s.|s| |jxYw|| |S)zPut an item into the queue. Put an item into the queue. If the queue is full, wait until a free slot is available before adding item. N) rQ _get_loop create_futurerr/cancelremove ValueError cancelledr9 put_nowait)r#r1putters rputz Queue.putns iikk ^^%%3355F M  ( ( (    M((0000!Dyy{{56+;+;+=+=5%%dm444%iikk &t$$$1A!!C&8BC& B C&B  AC&c|rt|||xjdz c_|j||jdS)zyPut an item into the queue without blocking. If no free slot is immediately available, raise QueueFull. r N)rQrr2rrclearr9rr0s rrYzQueue.put_nowaitsl 99;; O $ !#  $-(((((rc"K|r|}|j| |d{Vn#| |j|n#t$rYnwxYw|s.|s| |jxYw|| S)zoRemove and return an item from the queue. If queue is empty, wait until an item is available. N) rOrSrTrr/rUrVrWrXr9 get_nowait)r#getters rgetz Queue.gets jjll ^^%%3355F M  ( ( (    M((0000!Dzz||5F,<,<,>,>5%%dm444%jjll &   r\c|rt|}||j|S)zRemove and return an item from the queue. Return an item if one is immediately available, else raise QueueEmpty. )rOrr,r9rr0s rr`zQueue.get_nowaitsB ::<<  yy{{ $-((( rc|jdkrtd|xjdzc_|jdkr|jdSdS)a$Indicate that a formerly enqueued task is complete. Used by queue consumers. For each get() used to fetch a task, a subsequent call to task_done() tells the queue that the processing on the task is complete. If a join() is currently blocking, it will resume when all items have been processed (meaning that a task_done() call was received for every item that had been put() into the queue). Raises ValueError if called more times than there were items placed in the queue. rz!task_done() called too many timesr N)rrWrr r+s r task_donezQueue.task_donese  !Q & &@AA A !#  !Q & & N    ' &rcbK|jdkr!|jd{VdSdS)aBlock until all items in the queue have been gotten and processed. The count of unfinished tasks goes up whenever an item is added to the queue. The count goes down whenever a consumer calls task_done() to indicate that the item was retrieved and all work on it is complete. When the count of unfinished tasks drops to zero, join() unblocks. rN)rrwaitr+s rjoinz Queue.joinsJ  !A % %.%%'' ' ' ' ' ' ' ' ' ' & %rN)r)rrrrr%r!r,r2r9rArC classmethodr__class_getitem__r@rKpropertyr$rOrQr[rYrbr`rerhrrrrrsR      ***%%%!!! LLL;;;$ L11      X 1 1 1%%%6 ) ) )!!!4   !!!( ( ( ( ( (rrc@eZdZdZdZejfdZejfdZ dS)rzA subclass of Queue; retrieves entries in priority order (lowest first). Entries are typically tuples of the form: (priority number, data). cg|_dSr'rNr"s rr!zPriorityQueue._init  rc(||j|dSr'rN)r#r1heappushs rr2zPriorityQueue._putsd#####rc"||jSr'rN)r#heappops rr,zPriorityQueue._getswt{###rN) rrrrr!heapqrpr2rrr,rrrrrsc #(.$$$$!=$$$$$$rrc$eZdZdZdZdZdZdS)rzEA subclass of Queue that retrieves most recently added entries first.cg|_dSr'rNr"s rr!zLifoQueue._initrnrc:|j|dSr'r.r0s rr2zLifoQueue._putr3rc4|jSr')r(popr+s rr,zLifoQueue._gets{   rN)rrrrr!r2r,rrrrrsGOO!!!!!!!!rr)__all__rrstypesrr r Exceptionrr_LoopBoundMixinrrrrrrr~s= L                 B(B(B(B(B(F "B(B(B(J $ $ $ $ $E $ $ $ ! ! ! ! ! ! ! ! ! !r__pycache__/format_helpers.cpython-311.pyc000064400000010067152533123130014472 0ustar00 !A?hd \ddlZddlZddlZddlZddlZddlmZdZdZdZ d dZ d d Z dS) N) constantsc8tj|}tj|r|j}|j|jfSt |tjrt|j St |tj rt|j SdSN) inspectunwrap isfunction__code__ co_filenameco_firstlineno isinstance functoolspartial_get_function_sourcefunc partialmethod)rcodes C/opt/alt/python-internal/lib64/python3.11/asyncio/format_helpers.pyrr s >$  D$7} $"566$ )**/#DI...$ /00/#DI... 4cxt||d}t|}|r|d|dd|dz }|S)Nz at r:r)_format_callbackr)rargs func_reprsources r_format_callback_sourcersQ tT22I !$ ' 'F 43F1I33q 333 rcg}|r|d|D|r1|d|Ddd|S)zFormat function arguments and keyword arguments. Special case for a single parameter: ('hello',) is formatted as ('hello'). c3>K|]}tj|VdSrreprlibrepr).0args r z*_format_args_and_kwargs..&s,773W\#&&777777rc3NK|] \}}|dtj|V!dS)=Nr)r"kvs rr$z*_format_args_and_kwargs..(s<II$!Q--GLOO--IIIIIIrz({})z, )extenditemsformatjoin)rkwargsr*s r_format_args_and_kwargsr.s E 8 77$777777 J II&,,..IIIIII ==5)) * **rcpt|tjr4t|||z}t |j|j|j|St|dr|j r|j }n.t|dr|j r|j }nt|}|t||z }|r||z }|S)N __qualname____name__) r rrr.rrrkeywordshasattrr1r2r!)rrr-suffixrs rrr,s$ )**M(v66? 49dmVLLLt^$$):% z " "t}M JJ  (v666I V rc|tjj}| tj}t jt j||d}| |S)zlReplacement for traceback.extract_stack() that only does the necessary work for asyncio debug mode. NF)limit lookup_lines) sys _getframef_backrDEBUG_STACK_DEPTH traceback StackSummaryextract walk_stackreverse)fr7stacks r extract_stackrD>sj y MOO " }+  " * *9+?+B+B168= + ? ?E MMOOO Lr)r/)NN) rrr r9r=r/rrrr.rrDrrrFs     + + +$r__pycache__/log.cpython-311.opt-2.pyc000064400000000424152533123130013175 0ustar00 !A?h|0 ddlZejeZdS)N)logging getLogger __package__logger8/opt/alt/python-internal/lib64/python3.11/asyncio/log.pyr s)  ; ' 'r__pycache__/proactor_events.cpython-311.opt-1.pyc000064400000134102152533123130015631 0ustar00 !A?hdZdZddlZddlZddlZddlZddlZddlZddlZddl m Z ddl m Z ddl m Z ddl m Z dd l mZdd l mZdd l mZdd l mZdd lmZdZGddejejZGddeejZGddeejZGddeZGddeejZGddeeejZ GddeeejZ!Gdde j"Z#dS)zEvent loop using a proactor and related classes. A proactor is a "notify-on-completion" multiplexer. Currently a proactor is only implemented on Windows with IOCP. )BaseProactorEventLoopN) base_events) constants)futures) exceptions) protocols)sslproto) transports)trsock)loggerctj||jd< ||jd<nE#tj$r3|jrtj d|dYnwxYwd|jvr? | |jd<dS#tj$rd|jd<YdSwxYwdS)Nsocketsocknamezgetsockname() failed on %rTexc_infopeername) r TransportSocket_extra getsocknamererror_loop get_debugr warning getpeername) transportsocks D/opt/alt/python-internal/lib64/python3.11/asyncio/proactor_events.py_set_socket_extrars !'!7!=!=IXC'+'7'7'9'9 $$ <CCC ? $ $ & & C N,dT C C C CC ))) 0+/+;+;+=+=I Z ( ( (| 0 0 0+/I Z ( ( ( ( 0*)s!;?A=<A= B((CCczeZdZdZ dfd ZdZdZdZdZdZ d Z e j fd Z dd Zd ZdZdZxZS)_ProactorBasePipeTransportz*Base class for pipe and socket transports.Nc t||||||_||||_d|_d|_d|_d|_ d|_ d|_ d|_ d|_ |j|j|j|jj||(|jt&j|ddSdS)NrF)super__init__ _set_extra_sock set_protocol_server_buffer _read_fut _write_fut_pending_write _conn_lost_closing_called_connection_lost _eof_written_attachr call_soon _protocolconnection_mader_set_result_unless_cancelledselflooprprotocolwaiterextraserver __class__s rr$z#_ProactorBasePipeTransport.__init__2s %%%   (###   ',$! < # L " " " T^;TBBB   J !E!' / / / / /  ct|jjg}|j|dn|jr|d|j/|d|j|j|d|j|j|d|j|jr*|dt|j|j r|dd d |S) Nclosedclosingzfd=zread=zwrite=zwrite_bufsize=z EOF writtenz<{}> ) r=__name__r&appendr.filenor*r+r)lenr0formatjoin)r7infos r__repr__z#_ProactorBasePipeTransport.__repr__Is+'( :  KK ! ! ! ! ] # KK " " " : ! KK3dj//1133 4 4 4 > % KK222 3 3 3 ? & KK444 5 5 5 < > KK<T\):):<< = = =   ' KK & & &}}SXXd^^,,,r>c||jd<dS)Npipe)rr7rs rr%z%_ProactorBasePipeTransport._set_extra[s" Fr>c||_dSNr3)r7r9s rr'z'_ProactorBasePipeTransport.set_protocol^s !r>c|jSrOrPr7s r get_protocolz'_ProactorBasePipeTransport.get_protocolas ~r>c|jSrO)r.rRs r is_closingz%_ProactorBasePipeTransport.is_closingds }r>c|jrdSd|_|xjdz c_|js'|j |j|jd|j"|jd|_dSdS)NTr) r.r-r)r+rr2_call_connection_lostr*cancelrRs rclosez _ProactorBasePipeTransport.closegs =  F  1| C 7 J !;T B B B > % N ! ! # # #!DNNN & %r>cv|j1|d|t||jdSdS)Nzunclosed transport )source)r&ResourceWarningrY)r7_warns r__del__z"_ProactorBasePipeTransport.__del__rsL : ! E000/$ O O O O J        " !r>Fatal error on pipe transportc< t|tr2|jrt jd||dn$|j||||jd||dS#||wxYw)Nz%r: %sTr)message exceptionrr9) isinstanceOSErrorrrr debugcall_exception_handlerr3 _force_close)r7excras r _fatal_errorz'_ProactorBasePipeTransport._fatal_errorws ##w'' :''))IL44HHHH 11&!$!% $ 33   c " " " " "D  c " " " "s A+BBc|jP|js7||jdn|j||jr |jrdSd|_|xjdz c_|jr |jd|_|j r |j d|_ d|_ d|_ |j |j|dS)NTrr) _empty_waiterdone set_result set_exceptionr.r/r-r+rXr*r,r)rr2rW)r7rhs rrgz'_ProactorBasePipeTransport._force_closes   )$2D2I2I2K2K ){"--d3333"00555 = T9  F  1 ? # O " " $ $ $"DO > " N ! ! # # #!DN  T7=====r>c|jrdS |j|t|jdrA|jdkr$|jtj|j d|_|j }|| d|_ d|_dS#t|jdrA|jdkr$|jtj|j d|_|j }|| d|_ d|_wxYw)NshutdownT) r/r3connection_losthasattrr&rErpr SHUT_RDWRrYr(_detach)r7rhr<s rrWz0_ProactorBasePipeTransport._call_connection_losts\  '  F 0 N * *3 / / / tz:.. 64:3D3D3F3F"3L3L ##F$4555 J     DJ\F!   # +/D ( ( (tz:.. 64:3D3D3F3F"3L3L ##F$4555 J     DJ\F!   # +/D ( / / / /s CB#E+cP|j}|j|t|jz }|SrO)r,r)rF)r7sizes rget_write_buffer_sizez0_ProactorBasePipeTransport.get_write_buffer_sizes+" < # C %% %D r>NNN)r_)rC __module__ __qualname____doc__r$rJr%r'rSrUrYwarningswarnr^rirgrWrx __classcell__r=s@rr!r!.s4448$(//////.---$###""" " " "%M # # # #>>>(000(r>r!cNeZdZdZ d fd ZdZdZdZdZd Z d d Z xZ S) _ProactorReadPipeTransportzTransport for read pipes.Ncd|_d|_t||||||t ||_|j|jd|_dS)NrqTF) _pending_data_length_pausedr#r$ bytearray_datarr2 _loop_reading) r7r8rr9r:r;r< buffer_sizer=s rr$z#_ProactorReadPipeTransport.__init__sg$&!  tXvufEEE{++  T/000 r>c"|j o|j SrO)rr.rRs r is_readingz%_ProactorReadPipeTransport.is_readings<5 $55r>c|js|jrdSd|_|jrt jd|dSdS)NTz%r pauses reading)r.rrrr rerRs r pause_readingz(_ProactorReadPipeTransport.pause_readings\ = DL  F  :   ! ! 4 L,d 3 3 3 3 3 4 4r>cf|js|jsdSd|_|j |j|jd|j}d|_|dkr.|j|j|jd|||j rtj d|dSdS)NFrqz%r resumes reading) r.rr*rr2rr_data_receivedrrr re)r7lengths rresume_readingz)_ProactorReadPipeTransport.resume_readings =    F > ! J !3T : : :*$&! B;; J !4dj&6I6 R R R :   ! ! 5 L-t 4 4 4 4 4 5 5r>cF|jrtjd| |j}n?#t tf$rt$r!}| |dYd}~dSd}~wwxYw|s| dSdS)Nz%r received EOFz1Fatal error: protocol.eof_received() call failed.) rrr rer3 eof_received SystemExitKeyboardInterrupt BaseExceptionrirY)r7 keep_openrhs r _eof_receivedz(_ProactorReadPipeTransport._eof_receiveds :   ! ! 2 L*D 1 1 1 3355II-.          H J J J FFFFF    JJLLLLL  sA B%BBc|jr ||_dS|dkr|dSt|jt jr\ t j|j|dS#ttf$rt$r!}| |dYd}~dSd}~wwxYw|j |dS)Nrz3Fatal error: protocol.buffer_updated() call failed.) rrrrcr3r BufferedProtocol_feed_data_to_buffered_protorrrri data_received)r7datarrhs rrz)_ProactorReadPipeTransport._data_receiveds < )/D % F Q;;    F dni&@ A A / 6t~tLLLLL 12       !!##1222   N ( ( . . . . .s A))B%B  B%c(d}d} |zd|_|rK|}|dkr! |dkr|||dSdS|jd|}n||jr! |dkr|||dSdS|js/|jj |j |j|_|js|j |j n#t$rW}|js||dn/|jrt#jddYd}~nod}~wt&$r}||Yd}~nHd}~wt*$r }||dYd}~n d}~wt,j$r |jsYnwxYw|dkr|||dSdS#|dkr|||wwxYw)Nrqrz"Fatal read error on pipe transportz*Read error on pipe transport while closingTr)r*rlresultrrrXr.rr _proactor recv_intor&add_done_callbackrConnectionAbortedErrorrirr reConnectionResetErrorrgrdrCancelledError)r7futrrrhs rrz(_ProactorReadPipeTransport._loop_readings- 2"&88:: ! ZZ\\F{{D{{##D&11111{A :gvg.DDJJLLL} 2{{##D&11111{)< X!%!5!?!? DJ!W!W< E001CDDD& , , ,= ,!!#'KLLLL%%'' , I&*,,,,# # # #   c " " " " " " " " I I I   c#G H H H H H H H H(   =    {{##D&11111{v{{##D&1111sl7D+D*6D 'G2 GA E#G2# G0F G2 GF2-G22G G2GG22H)NNNrrO) rCrzr{r|r$rrrrrrrrs@rrrs##486;666444&555$ ///20202020202020202r>rcReZdZdZdZfdZdZd dZdZdZ d Z d Z d Z xZ S) _ProactorBaseWritePipeTransportzTransport for write pipes.TcHtj|i|d|_dSrO)r#r$rkr7argskwr=s rr$z(_ProactorBaseWritePipeTransport.__init__Ms-$%"%%%!r>ct|tttfs$t dt |j|jrtd|j td|sdS|j r;|j tj krtjd|xj dz c_ dS|j%|t|dS|js*t||_|dS|j||dS)Nz/data argument must be a bytes-like object, not zwrite_eof() already calledz(unable to write; sendfile is in progresszsocket.send() raised exception.r)r)rcbytesr memoryview TypeErrortyperCr0 RuntimeErrorrkr-r!LOG_THRESHOLD_FOR_CONNLOST_WRITESr rr+ _loop_writingr)_maybe_pause_protocolextend)r7rs rwritez%_ProactorBaseWritePipeTransport.writeQsW$ : >?? .-Dzz*--.. .   =;<< <   )IJJ J  F ? )"MMM@AAA OOq OO F ? "   E$KK  0 0 0 0 0 )$T??DL  & & ( ( ( ( ( L   % % %  & & ( ( ( ( (r>Nc ||j |jrdSd|_d|_|r|||j}d|_|sg|jr |j|jd|jr$|j tj | n|jj|j ||_|jsHt#||_|j|j|n|j|j|j#|j|jddSdSdS#t.$r }||Yd}~dSd}~wt2$r!}||dYd}~dSd}~wwxYw)Nrz#Fatal write error on pipe transport)r+r.r,rr)rr2rWr0r&rprSHUT_WR_maybe_resume_protocolrsendrlrFrrrrkrmrrgrdri)r7frrhs rrz-_ProactorBaseWritePipeTransport._loop_writingws& J}!8T]!8"DO"#D   ||#  J=KJ(()CTJJJ$8J''777 ++----"&*"6";";DJ"M"M++--J*-d))D'O55d6HIII..0000O55d6HIII!-$/2I"--d33333.-2I2I# # # #   c " " " " " " " " " J J J   c#H I I I I I I I I I Js)F E/F GF.. G;GGcdSNTrRs r can_write_eofz-_ProactorBaseWritePipeTransport.can_write_eoftr>c.|dSrO)rYrRs r write_eofz)_ProactorBaseWritePipeTransport.write_eofs r>c0|ddSrOrgrRs rabortz%_ProactorBaseWritePipeTransport.abort $r>c|jtd|j|_|j|jd|jS)NzEmpty waiter is already set)rkrr create_futurer+rmrRs r_make_empty_waiterz2_ProactorBaseWritePipeTransport._make_empty_waitersX   )<== =!Z5577 ? "   ) )$ / / /!!r>cd|_dSrO)rkrRs r_reset_empty_waiterz3_ProactorBaseWritePipeTransport._reset_empty_waiters!r>NN)rCrzr{r|_start_tls_compatibler$rrrrrrrrrs@rrrGs$$ """""$)$)$)L'J'J'J'JR   """"""""""r>rc$eZdZfdZdZxZS)_ProactorWritePipeTransportctj|i||jj|jd|_|j|jdS)N) r#r$rrrecvr&r*r _pipe_closedrs rr$z$_ProactorWritePipeTransport.__init__s\$%"%%%-224:rBB (():;;;;;r>c|rdS|jrdSd|_|j#|t dS|dSrO) cancelledr.r*r+rgBrokenPipeErrorrY)r7rs rrz(_ProactorWritePipeTransport._pipe_closedsf ==??  F =  F ? &   o// 0 0 0 0 0 JJLLLLLr>)rCrzr{r$rrrs@rrrsG<<<<<       r>rcReZdZdZ d fd ZdZdZdZd dZd dZ d d Z xZ S) _ProactorDatagramTransportiNc||_d|_d|_t|||||t j|_|j |j dS)Nr)r:r;) _addressrk _buffer_sizer#r$ collectionsdequer)rr2r)r7r8rr9addressr:r;r=s rr$z#_ProactorDatagramTransport.__init__sp ! tXfEJJJ#(**  T/00000r>c&t||dSrOrrMs rr%z%_ProactorDatagramTransport._set_extra$%%%%%r>c|jSrO)rrRs rrxz0_ProactorDatagramTransport.get_write_buffer_sizes   r>c0|ddSrOrrRs rrz _ProactorDatagramTransport.abortrr>cZt|tttfst dt ||sdS|j"|d|jfvrtd|j|jrB|jr;|jtj krtj d|xjdz c_dS|j t||f|xjt!|z c_|j||dS)Nz,data argument must be bytes-like object (%r)z!Invalid address: must be None or z!socket.sendto() raised exception.r)rcrrrrrr ValueErrorr-rrr rr)rDrrFr+rr)r7raddrs rsendtoz!_ProactorDatagramTransport.sendtos?$ : >?? (J JJ(( (  F = $dDM5J)J)JCDMCCEE E ? t} )"MMMBCCC OOq OO F U4[[$/000 SYY& ? "     ""$$$$$r>c |jrdSd|_|r||jr|jr0|jr)|jr |j|jddS|j \}}|xj t|zc_ |j+|jj |j||_n,|jj |j|||_|j|j|dS#t&$r%}|j|Yd}~dSd}~wt,$r!}||dYd}~dSd}~wwxYw)N)rz'Fatal write error on datagram transport)r-r+rr)rr.rr2rWpopleftrrFrrr&rrrrrdr3error_received Exceptionri)r7rrrrhs rrz(_ProactorDatagramTransport._loop_writings * #DO  < DO   =KJ(()CTJJJ--//JD$   T *  }("&*"6";";DJ<@#B#B#'*"6"="=dj>BCG#>#I#I O - -d.@ A A A  ' ' ) ) ) ) )  / / / N ) )# . . . . . . . . . N N N   c#L M M M M M M M M M Ns0D2AD2&BD22 F <E F )FF cd} |jr" |r|j||dSdSd|_|U|}|jr$d} |r|j||dSdS|j ||j}}n|\}}|jr" |r|j||dSdS|j0|jj |j |j |_n/|jj |j |j |_|j|j |jnI#t$r$}|j|Yd}~n d}~wt"j$r |jsYnwxYw|r|j||dSdS#|r|j||wwxYwrO)r-r3datagram_receivedr*rr.rrrrr&max_sizerecvfromrrrdrrr)r7rrrresrhs rrz(_ProactorDatagramTransport._loop_reading#sY' = H =00t<<<<< = =?"DNjjll=D0 =00t<<<<< = =-=,!$dm$DD!$JD$   =00t<<<<< = =}(!%!5!:!:4:;?="J"J"&!5!>!>tz?C}"N"N~)001CDDD / / / N ) )# . . . . . . . .(   =     =00t<<<<< = =t =00t<<<< =sME&E5E4A&E'F+ F E*%F+*FF+FF++ G ryrO) rCrzr{rr$r%rxrrrrrrs@rrrsH59$( 1 1 1 1 1 1&&&!!!   %%%%: * * * *D)=)=)=)=)=)=)=)=r>rceZdZdZdZdZdS)_ProactorDuplexPipeTransportzTransport for duplex pipes.cdS)NFrrRs rrz*_ProactorDuplexPipeTransport.can_write_eofTsur>ctrO)NotImplementedErrorrRs rrz&_ProactorDuplexPipeTransport.write_eofWs!!r>N)rCrzr{r|rrrr>rrrOs:&%"""""r>rcReZdZdZejjZ dfd ZdZ dZ dZ xZ S)_ProactorSocketTransportz Transport for connected sockets.Nc|t||||||tj|dSrO)r#r$r _set_nodelayr6s rr$z!_ProactorSocketTransport.__init__bs< tXvufEEE &&&&&r>c&t||dSrOrrMs rr%z#_ProactorSocketTransport._set_extragrr>cdSrrrRs rrz&_ProactorSocketTransport.can_write_eofjrr>c|js|jrdSd|_|j&|jt jdSdSr)r.r0r+r&rprrrRs rrz"_ProactorSocketTransport.write_eofmsQ = D-  F  ? " J   / / / / / # "r>ry) rCrzr{r|r _SendfileMode TRY_NATIVE_sendfile_compatibler$r%rrrrs@rrr[s+*$2=48$('''''' &&&0000000r>rceZdZfdZ d dZ d!ddddddddZ d dZ d"dZ d"d Z d"d Z fd Z d Z d Z dZ d#dZdZdZdZdZdZdZdZdZd!dZdZ d$dZdZdZdZxZS)%rcttjd|jj||_||_d|_i|_ | || tj tjur-tj|jdSdS)NzUsing proactor: %s)r#r$r rer=rCr _selector_self_reading_future_accept_futuresset_loop_make_self_pipe threadingcurrent_thread main_threadsignal set_wakeup_fd_csockrE)r7proactorr=s rr$zBaseProactorEventLoop.__init__ws  )8+=+FGGG!!$(!!$   # % %)>)@)@ @ @  !3!3!5!5 6 6 6 6 6 A @r>Nc*t||||||SrO)r)r7rr9r:r;r<s r_make_socket_transportz,BaseProactorEventLoop._make_socket_transports!'dHf(-v77 7r>F) server_sideserver_hostnamer;r<ssl_handshake_timeoutssl_shutdown_timeoutc ptj||||||| | } t||| ||| jS)N)rrr;r<)r SSLProtocolr_app_transport) r7rawsockr9 sslcontextr:rrr;r<rr ssl_protocols r_make_ssl_transportz)BaseProactorEventLoop._make_ssl_transports\  +h F_&;%9 ;;; !w ',V = = = =**r>c*t||||||SrO)r)r7rr9rr:r;s r_make_datagram_transportz.BaseProactorEventLoop._make_datagram_transports!)$h*0%99 9r>c(t|||||SrO)rr7rr9r:r;s r_make_duplex_pipe_transportz1BaseProactorEventLoop._make_duplex_pipe_transports"+D,0(FEKK Kr>c(t|||||SrO)rr!s r_make_read_pipe_transportz/BaseProactorEventLoop._make_read_pipe_transports)$hNNNr>c(t|||||SrO)rr!s r_make_write_pipe_transportz0BaseProactorEventLoop._make_write_pipe_transports$+4+/65JJ Jr>c|rtd|rdStjtjurt jd|| |j d|_ d|_ t dS)Nz!Cannot close a running event looprq) is_runningr is_closedr r r r r _stop_accept_futures_close_self_piperrYrr#)r7r=s rrYzBaseProactorEventLoop.closes ??   DBCC C >>    F  # % %)>)@)@ @ @   $ $ $ !!###    r>cHK|j||d{VSrO)rr)r7rns r sock_recvzBaseProactorEventLoop.sock_recvs0^((q111111111r>cHK|j||d{VSrO)rr)r7rbufs rsock_recv_intoz$BaseProactorEventLoop.sock_recv_intos0^--dC888888888r>cHK|j||d{VSrO)rr)r7rbufsizes r sock_recvfromz#BaseProactorEventLoop.sock_recvfroms0^,,T7;;;;;;;;;r>rclK|st|}|j|||d{VSrO)rFr recvfrom_into)r7rr0nbytess rsock_recvfrom_intoz(BaseProactorEventLoop.sock_recvfrom_intosE XXF^11$VDDDDDDDDDr>cHK|j||d{VSrO)rr)r7rrs r sock_sendallz"BaseProactorEventLoop.sock_sendalls0^((t444444444r>cLK|j||d|d{VS)Nr)rr)r7rrrs r sock_sendtoz!BaseProactorEventLoop.sock_sendtos4^**4q'BBBBBBBBBr>cHK|j||d{VSrO)rconnect)r7rrs r sock_connectz"BaseProactorEventLoop.sock_connects0^++D':::::::::r>cFK|j|d{VSrO)racceptrMs r sock_acceptz!BaseProactorEventLoop.sock_accepts.^**4000000000r>cK |}n2#ttjf$r}t jdd}~wwxYw t j|j}n"#t$rt jdwxYw|r|n|}|sdSt|d}|rt||z|n|} t||}d} t| |z |}|dkr| | dkr| |SS|j ||||d{V||z }| |z } e#| dkr| |wwxYw)Nznot a regular filerl)rEAttributeErrorioUnsupportedOperationrSendfileNotAvailableErrorosfstatst_sizerdminseekrsendfile) r7rfileoffsetcountrEerrfsize blocksizeend_pos total_sents r_sock_sendfile_nativez+BaseProactorEventLoop._sock_sendfile_natives M[[]]FF 78 M M M67KLL L M MHV$$,EE M M M67KLL L M"-EE  1 ;// 05@#fune,,,5VU##  " (& 0)<< >>% A~~ &!!!! n--dD&)LLLLLLLLL)#i'  (A~~ &!!!!s2AAA A&&B D2.D22EcK|}||d{V ||j|||dd{V ||r|SS#||r|wwxYw)NF)fallback)rrr sock_sendfiler&rr)r7transprNrOrPrs r_sendfile_nativez&BaseProactorEventLoop._sendfile_natives **,,''))))))))) (++FL$5:,<<<<<<<< <  & & ( ( ( (%%'''' (  & & ( ( ( (%%'''' (s $B-Cc|j |jd|_|jd|_|jd|_|xjdzc_dS)Nr)rrX_ssockrYr _internal_fdsrRs rr+z&BaseProactorEventLoop._close_self_pipesx  $ 0  % , , . . .(,D %     ar>ctj\|_|_|jd|jd|xjdz c_dS)NFr)r socketpairr]r setblockingr^rRs rrz%BaseProactorEventLoop._make_self_pipes_#)#4#6#6  T[ &&& &&& ar>cr |||j|urdS|j|jd}||_||jdS#tj$rYdSttf$rt$r$}| d||dYd}~dSd}~wwxYw)Niz.Error on reading from the event loop self pipe)rarbr8) rrrrr]r_loop_self_readingrrrrrrf)r7rrhs rrcz(BaseProactorEventLoop._loop_self_readings 9} (11##DK66A)*D %   7 8 8 8 8 8(    FF-.         ' 'K ))          s"A& A&&B68B6B11B6c|j}|dS |ddS#t$r$|jrt jddYdSYdSwxYw)Nz3Fail to write a null byte into the self-pipe socketTr)rrrd_debugr re)r7csocks r_write_to_selfz$BaseProactorEventLoop._write_to_self1s   = F , JJu      , , ,{ , 0&*,,,,,,, , , , ,s$'AAdc Zdfd dS)Nc F |||\}}jrtjd||} || dd|i n||d|irdSj }|j <| dS#t$r} dkr@ d|tj d n*jrtjd d Yd}~dSYd}~dSYd}~dSd}~wt"j$r YdSwxYw) Nz#%r got a new connection from %r: %rTr)rr;r<rrrrqzAccept failed on a socket)rarbrzAccept failed on socket %rr)rrfr rerrr)rrArrErrdrfr rrYrr) rconnrr9rhr8protocol_factoryr7r<rrrrs rr8z2BaseProactorEventLoop._start_serving..loopHsD# *=!"JD${9 %J%+T4999//11H!-00 (JD#-t"4V2G1E 1GGGG 33 (#-t"4V4EEE>>##FN))$//78$T[[]]3##D))))) 6 6 6;;==B&&//#>%("("8">">11 JJLLLL[6L!=!%6666666666666666!LLLLL,     s%BC$C$$ F .A6E66&F F rO)r2) r7rmrrr<backlogrrr8s ````` ``@r_start_servingz$BaseProactorEventLoop._start_servingCsf $ *$ *$ *$ *$ *$ *$ *$ *$ *$ *$ *$ *$ *L tr>cdSrOr)r7 event_lists r_process_eventsz%BaseProactorEventLoop._process_eventsps r>c|jD]}||jdSrO)rvaluesrXclear)r7futures rr*z*BaseProactorEventLoop._stop_accept_futurestsJ*1133  F MMOOOO ""$$$$$r>c|j|d}|r||j||dSrO)rpoprErXr _stop_servingrY)r7rrvs rryz#BaseProactorEventLoop._stop_servingys^%))$++-->>   MMOOO $$T*** r>ryrOr)r)NNriNN)rCrzr{r$rrrr"r$r&rYr.r1r4r8r:r<r?rBrVr[r+rrcrhrorrr*ryrrs@rrrusS 7 7 7 7 7=A267777 9= + $t"&!% + + + + + CG9999 BF*.KKKK @D(,OOOOAE)-JJJJ (222999<<<EEEE 555CCC;;;111""": ( ( (      99998,,,&>A-1,0++++Z   %%% r>r)$r|__all__rErHrr}r r rrrrrr r r r logr r_FlowControlMixin BaseTransportr! ReadTransportrWriteTransportrrDatagramTransportr Transportrr BaseEventLooprrr>rrs #  000$DDDDD!=!+!9DDDNO2O2O2O2O2!;!+!9O2O2O2dk"k"k"k"k"&@&0&?k"k"k"\"A,A=A=A=A=A=!;!+!=A=A=A=H " " " " "#=#B#-#7 " " "000009>)30004IIIIIK5IIIIIr>