id
int64
0
190k
prompt
stringlengths
21
13.4M
docstring
stringlengths
1
12k
173,821
from gi.repository import GObject, Gio from .exceptions import TrashPermissionError from .util import preprocess_paths class TrashPermissionError(_permission_error): """A permission error specific to a trash directory. Raising this error indicates that permissions prevent us efficiently trashing a file, a...
null
173,822
from __future__ import unicode_literals import errno import sys import os import os.path as op from datetime import datetime import stat from .compat import text_type, environb from .util import preprocess_paths from .exceptions import TrashPermissionError import sys if sys.platform == "darwin": from .plat_osx ...
null
173,823
from __future__ import unicode_literals import errno import sys import os import os.path as op from datetime import datetime import stat from .compat import text_type, environb from .util import preprocess_paths from .exceptions import TrashPermissionError try: fsencode = os.fsencode # Python 3 fsdecode = os.f...
null
173,824
from collections import deque from dataclasses import dataclass from types import TracebackType from typing import Deque, Optional, Tuple, Type from warnings import warn from ..lowlevel import cancel_shielded_checkpoint, checkpoint, checkpoint_if_cancelled from ._compat import DeprecatedAwaitable from ._eventloop impor...
Create an asynchronous lock. :return: a lock object .. deprecated:: 3.0 Use :class:`~Lock` directly.
173,825
from collections import deque from dataclasses import dataclass from types import TracebackType from typing import Deque, Optional, Tuple, Type from warnings import warn from ..lowlevel import cancel_shielded_checkpoint, checkpoint, checkpoint_if_cancelled from ._compat import DeprecatedAwaitable from ._eventloop impor...
Create an asynchronous condition. :param lock: the lock to base the condition object on :return: a condition object .. deprecated:: 3.0 Use :class:`~Condition` directly.
173,826
from collections import deque from dataclasses import dataclass from types import TracebackType from typing import Deque, Optional, Tuple, Type from warnings import warn from ..lowlevel import cancel_shielded_checkpoint, checkpoint, checkpoint_if_cancelled from ._compat import DeprecatedAwaitable from ._eventloop impor...
Create an asynchronous event object. :return: an event object .. deprecated:: 3.0 Use :class:`~Event` directly.
173,827
from collections import deque from dataclasses import dataclass from types import TracebackType from typing import Deque, Optional, Tuple, Type from warnings import warn from ..lowlevel import cancel_shielded_checkpoint, checkpoint, checkpoint_if_cancelled from ._compat import DeprecatedAwaitable from ._eventloop impor...
Create an asynchronous semaphore. :param value: the semaphore's initial value :param max_value: if set, makes this a "bounded" semaphore that raises :exc:`ValueError` if the semaphore's value would exceed this number :return: a semaphore object .. deprecated:: 3.0 Use :class:`~Semaphore` directly.
173,828
from collections import deque from dataclasses import dataclass from types import TracebackType from typing import Deque, Optional, Tuple, Type from warnings import warn from ..lowlevel import cancel_shielded_checkpoint, checkpoint, checkpoint_if_cancelled from ._compat import DeprecatedAwaitable from ._eventloop impor...
Create a capacity limiter. :param total_tokens: the total number of tokens available for borrowing (can be an integer or :data:`math.inf`) :return: a capacity limiter object .. deprecated:: 3.0 Use :class:`~CapacityLimiter` directly.
173,829
import math from types import TracebackType from typing import Optional, Type from warnings import warn from ..abc._tasks import TaskGroup, TaskStatus from ._compat import ( DeprecatedAsyncContextManager, DeprecatedAwaitable, DeprecatedAwaitableFloat, ) from ._eventloop import get_asynclib class CancelScope...
Open a cancel scope. :param shield: ``True`` to shield the cancel scope from external cancellation :return: a cancel scope .. deprecated:: 3.0 Use :class:`~CancelScope` directly.
173,830
import math from types import TracebackType from typing import Optional, Type from warnings import warn from ..abc._tasks import TaskGroup, TaskStatus from ._compat import ( DeprecatedAsyncContextManager, DeprecatedAwaitable, DeprecatedAwaitableFloat, ) from ._eventloop import get_asynclib class Deprecated...
Return the nearest deadline among all the cancel scopes effective for the current task. :return: a clock value from the event loop's internal clock (``float('inf')`` if there is no deadline in effect) :rtype: float
173,831
import math import sys import threading from contextlib import contextmanager from importlib import import_module from typing import ( Any, Callable, Coroutine, Dict, Generator, Optional, Tuple, Type, TypeVar, ) import sniffio from ._compat import DeprecatedAwaitableFloat async def s...
Pause the current task until it's cancelled. This is a shortcut for ``sleep(math.inf)``. .. versionadded:: 3.1
173,832
import math import sys import threading from contextlib import contextmanager from importlib import import_module from typing import ( Any, Callable, Coroutine, Dict, Generator, Optional, Tuple, Type, TypeVar, ) import sniffio from ._compat import DeprecatedAwaitableFloat async def s...
Pause the current task until the given time. :param deadline: the absolute time to wake up at (according to the internal monotonic clock of the event loop) .. versionadded:: 3.1
173,833
import math import sys import threading from contextlib import contextmanager from importlib import import_module from typing import ( Any, Callable, Coroutine, Dict, Generator, Optional, Tuple, Type, TypeVar, ) import sniffio from ._compat import DeprecatedAwaitableFloat BACKENDS = ...
Return a tuple of the names of all built-in backends.
173,834
import sys from typing import Any, Callable, Dict, Mapping, TypeVar, Union, overload from ._exceptions import TypedAttributeLookupError Any = object() The provided code snippet includes necessary dependencies for implementing the `typed_attribute` function. Write a Python function `def typed_attribute() -> Any` to so...
Return a unique object, used to mark typed attributes.
173,835
import math from typing import Any, Optional, Tuple, Type, TypeVar, overload from ..streams.memory import ( MemoryObjectReceiveStream, MemoryObjectSendStream, MemoryObjectStreamState, ) T_Item = TypeVar("T_Item") class Tuple(BaseTypingInstance): def _is_homogenous(self): def py__simple_getitem__(...
null
173,836
import math from typing import Any, Optional, Tuple, Type, TypeVar, overload from ..streams.memory import ( MemoryObjectReceiveStream, MemoryObjectSendStream, MemoryObjectStreamState, ) Any = object() class Tuple(BaseTypingInstance): def _is_homogenous(self): # To specify a variable-length tup...
null
173,837
import math from typing import Any, Optional, Tuple, Type, TypeVar, overload from ..streams.memory import ( MemoryObjectReceiveStream, MemoryObjectSendStream, MemoryObjectStreamState, ) T_Item = TypeVar("T_Item") Any = object() Optional: _SpecialForm = ... Type: _SpecialForm = ... class Tuple(BaseTypi...
Create a memory object stream. :param max_buffer_size: number of items held in the buffer until ``send()`` starts blocking :param item_type: type of item, for marking the streams with the right generic type for static typing (not used at run time) :return: a tuple of (send stream, receive stream)
173,838
from io import BytesIO from os import PathLike from subprocess import DEVNULL, PIPE, CalledProcessError, CompletedProcess from typing import ( IO, Any, AsyncIterable, List, Mapping, Optional, Sequence, Union, cast, ) from ..abc import Process from ._eventloop import get_asynclib from...
Run an external command in a subprocess and wait until it completes. .. seealso:: :func:`subprocess.run` :param command: either a string to pass to the shell, or an iterable of strings containing the executable name or path and its arguments :param input: bytes passed to the standard input of the subprocess :param stdo...
173,839
from abc import ABCMeta, abstractmethod from contextlib import AbstractContextManager from types import TracebackType from typing import ( TYPE_CHECKING, Any, AsyncContextManager, Callable, ContextManager, Generator, Generic, Iterable, List, Optional, Tuple, Type, Typ...
null
173,840
from abc import ABCMeta, abstractmethod from contextlib import AbstractContextManager from types import TracebackType from typing import ( TYPE_CHECKING, Any, AsyncContextManager, Callable, ContextManager, Generator, Generic, Iterable, List, Optional, Tuple, Type, Typ...
null
173,841
from abc import ABCMeta, abstractmethod from contextlib import AbstractContextManager from types import TracebackType from typing import ( TYPE_CHECKING, Any, AsyncContextManager, Callable, ContextManager, Generator, Generic, Iterable, List, Optional, Tuple, Type, Typ...
null
173,842
from abc import ABCMeta, abstractmethod from contextlib import AbstractContextManager from types import TracebackType from typing import ( TYPE_CHECKING, Any, AsyncContextManager, Callable, ContextManager, Generator, Generic, Iterable, List, Optional, Tuple, Type, Typ...
null
173,843
from abc import ABCMeta, abstractmethod from contextlib import AbstractContextManager from types import TracebackType from typing import ( TYPE_CHECKING, Any, AsyncContextManager, Callable, ContextManager, Generator, Generic, Iterable, List, Optional, Tuple, Type, Typ...
Await on the given object if necessary. This function is intended to bridge the gap between AnyIO 2.x and 3.x where some functions and methods were converted from coroutine functions into regular functions. Do **not** try to use this for any other purpose! :return: the result of awaiting on the object if coroutine, or ...
173,844
from abc import ABCMeta, abstractmethod from contextlib import AbstractContextManager from types import TracebackType from typing import ( TYPE_CHECKING, Any, AsyncContextManager, Callable, ContextManager, Generator, Generic, Iterable, List, Optional, Tuple, Type, Typ...
Wrap a regular context manager as an async one if necessary. This function is intended to bridge the gap between AnyIO 2.x and 3.x where some functions and methods were changed to return regular context managers instead of async ones. :param cm: a regular or async context manager :return: an async context manager .. ve...
173,845
from abc import ABCMeta, abstractmethod from contextlib import AbstractContextManager from types import TracebackType from typing import ( TYPE_CHECKING, Any, AsyncContextManager, Callable, ContextManager, Generator, Generic, Iterable, List, Optional, Tuple, Type, Typ...
null
173,846
from typing import AsyncIterator from ._compat import DeprecatedAsyncContextManager from ._eventloop import get_asynclib class AsyncIterator(AsyncIterable[_T_co], Protocol[_T_co]): def __anext__(self) -> Awaitable[_T_co]: ... def __aiter__(self) -> AsyncIterator[_T_co]: ... class DeprecatedAsyncContextManager...
Start receiving operating system signals. :param signals: signals to receive (e.g. ``signal.SIGINT``) :return: an asynchronous context manager for an asynchronous iterator which yields signal numbers .. warning:: Windows does not support signals natively so it is best to avoid relying on this in cross-platform applicat...
173,847
import os import pathlib import sys from dataclasses import dataclass from functools import partial from os import PathLike from typing import ( IO, TYPE_CHECKING, Any, AnyStr, AsyncIterator, Callable, Generic, Iterable, Iterator, List, Optional, Sequence, Tuple, ...
null
173,848
import os import pathlib import sys from dataclasses import dataclass from functools import partial from os import PathLike from typing import ( IO, TYPE_CHECKING, Any, AnyStr, AsyncIterator, Callable, Generic, Iterable, Iterator, List, Optional, Sequence, Tuple, ...
null
173,849
import os import pathlib import sys from dataclasses import dataclass from functools import partial from os import PathLike from typing import ( IO, TYPE_CHECKING, Any, AnyStr, AsyncIterator, Callable, Generic, Iterable, Iterator, List, Optional, Sequence, Tuple, ...
Open a file asynchronously. The arguments are exactly the same as for the builtin :func:`open`. :return: an asynchronous file object
173,850
import os import pathlib import sys from dataclasses import dataclass from functools import partial from os import PathLike from typing import ( IO, TYPE_CHECKING, Any, AnyStr, AsyncIterator, Callable, Generic, Iterable, Iterator, List, Optional, Sequence, Tuple, ...
Wrap an existing file as an asynchronous file. :param file: an existing file-like object :return: an asynchronous file object
173,851
import socket import ssl import sys from ipaddress import IPv6Address, ip_address from os import PathLike, chmod from pathlib import Path from socket import AddressFamily, SocketKind from typing import Awaitable, List, Optional, Tuple, Union, cast, overload from .. import to_thread from ..abc import ( ConnectedUDPS...
null
173,852
import socket import ssl import sys from ipaddress import IPv6Address, ip_address from os import PathLike, chmod from pathlib import Path from socket import AddressFamily, SocketKind from typing import Awaitable, List, Optional, Tuple, Union, cast, overload from .. import to_thread from ..abc import ( ConnectedUDPS...
null
173,853
import socket import ssl import sys from ipaddress import IPv6Address, ip_address from os import PathLike, chmod from pathlib import Path from socket import AddressFamily, SocketKind from typing import Awaitable, List, Optional, Tuple, Union, cast, overload from .. import to_thread from ..abc import ( ConnectedUDPS...
null
173,854
import socket import ssl import sys from ipaddress import IPv6Address, ip_address from os import PathLike, chmod from pathlib import Path from socket import AddressFamily, SocketKind from typing import Awaitable, List, Optional, Tuple, Union, cast, overload from .. import to_thread from ..abc import ( ConnectedUDPS...
null
173,855
import socket import ssl import sys from ipaddress import IPv6Address, ip_address from os import PathLike, chmod from pathlib import Path from socket import AddressFamily, SocketKind from typing import Awaitable, List, Optional, Tuple, Union, cast, overload from .. import to_thread from ..abc import ( ConnectedUDPS...
null
173,856
import socket import ssl import sys from ipaddress import IPv6Address, ip_address from os import PathLike, chmod from pathlib import Path from socket import AddressFamily, SocketKind from typing import Awaitable, List, Optional, Tuple, Union, cast, overload from .. import to_thread from ..abc import ( ConnectedUDPS...
Connect to a host using the TCP protocol. This function implements the stateless version of the Happy Eyeballs algorithm (RFC 6555). If ``address`` is a host name that resolves to multiple IP addresses, each one is tried until one connection attempt succeeds. If the first attempt does not connected within 250 milliseco...
173,857
import socket import ssl import sys from ipaddress import IPv6Address, ip_address from os import PathLike, chmod from pathlib import Path from socket import AddressFamily, SocketKind from typing import Awaitable, List, Optional, Tuple, Union, cast, overload from .. import to_thread from ..abc import ( ConnectedUDPS...
Connect to the given UNIX socket. Not available on Windows. :param path: path to the socket :return: a socket stream object
173,858
import socket import ssl import sys from ipaddress import IPv6Address, ip_address from os import PathLike, chmod from pathlib import Path from socket import AddressFamily, SocketKind from typing import Awaitable, List, Optional, Tuple, Union, cast, overload from .. import to_thread from ..abc import ( ConnectedUDPS...
Create a TCP socket listener. :param local_port: port number to listen on :param local_host: IP address of the interface to listen on. If omitted, listen on all IPv4 and IPv6 interfaces. To listen on all interfaces on a specific address family, use ``0.0.0.0`` for IPv4 or ``::`` for IPv6. :param family: address family ...
173,859
import socket import ssl import sys from ipaddress import IPv6Address, ip_address from os import PathLike, chmod from pathlib import Path from socket import AddressFamily, SocketKind from typing import Awaitable, List, Optional, Tuple, Union, cast, overload from .. import to_thread from ..abc import ( ConnectedUDPS...
Create a UNIX socket listener. Not available on Windows. :param path: path of the socket :param mode: permissions to set on the socket :param backlog: maximum number of queued incoming connections (up to a maximum of 2**16, or 65536) :return: a listener object .. versionchanged:: 3.0 If a socket already exists on the f...
173,860
import socket import ssl import sys from ipaddress import IPv6Address, ip_address from os import PathLike, chmod from pathlib import Path from socket import AddressFamily, SocketKind from typing import Awaitable, List, Optional, Tuple, Union, cast, overload from .. import to_thread from ..abc import ( ConnectedUDPS...
Create a connected UDP socket. Connected UDP sockets can only communicate with the specified remote host/port, and any packets sent from other sources are dropped. :param remote_host: remote host to set as the default target :param remote_port: port on the remote host to set as the default target :param family: address...
173,861
import socket import ssl import sys from ipaddress import IPv6Address, ip_address from os import PathLike, chmod from pathlib import Path from socket import AddressFamily, SocketKind from typing import Awaitable, List, Optional, Tuple, Union, cast, overload from .. import to_thread from ..abc import ( ConnectedUDPS...
Look up the host name of an IP address. :param sockaddr: socket address (e.g. (ipaddress, port) for IPv4) :param flags: flags to pass to upstream ``getnameinfo()`` :return: a tuple of (host name, service name) .. seealso:: :func:`socket.getnameinfo`
173,862
import socket import ssl import sys from ipaddress import IPv6Address, ip_address from os import PathLike, chmod from pathlib import Path from socket import AddressFamily, SocketKind from typing import Awaitable, List, Optional, Tuple, Union, cast, overload from .. import to_thread from ..abc import ( ConnectedUDPS...
Wait until the given socket has data to be read. This does **NOT** work on Windows when using the asyncio backend with a proactor event loop (default on py3.8+). .. warning:: Only use this on raw sockets that have not been wrapped by any higher level constructs like socket streams! :param sock: a socket object :raises ...
173,863
import socket import ssl import sys from ipaddress import IPv6Address, ip_address from os import PathLike, chmod from pathlib import Path from socket import AddressFamily, SocketKind from typing import Awaitable, List, Optional, Tuple, Union, cast, overload from .. import to_thread from ..abc import ( ConnectedUDPS...
Wait until the given socket can be written to. This does **NOT** work on Windows when using the asyncio backend with a proactor event loop (default on py3.8+). .. warning:: Only use this on raw sockets that have not been wrapped by any higher level constructs like socket streams! :param sock: a socket object :raises ~a...
173,864
import threading from asyncio import iscoroutine from concurrent.futures import FIRST_COMPLETED, Future, ThreadPoolExecutor, wait from contextlib import AbstractContextManager, contextmanager from types import TracebackType from typing import ( Any, AsyncContextManager, Callable, ContextManager, Cor...
Create a portal for running functions in the event loop thread from external threads. Use this function in asynchronous code when you need to allow external threads access to the event loop where your asynchronous code is currently running. .. deprecated:: 3.0 Use :class:`.BlockingPortal` directly.
173,865
import threading from asyncio import iscoroutine from concurrent.futures import FIRST_COMPLETED, Future, ThreadPoolExecutor, wait from contextlib import AbstractContextManager, contextmanager from types import TracebackType from typing import ( Any, AsyncContextManager, Callable, ContextManager, Cor...
Start a new event loop in a new thread and run a blocking portal in its main task. The parameters are the same as for :func:`~anyio.run`. :param backend: name of the backend :param backend_options: backend options :return: a context manager that yields a blocking portal .. versionchanged:: 3.0 Usage as a context manage...
173,866
import os import pickle import subprocess import sys from collections import deque from importlib.util import module_from_spec, spec_from_file_location from typing import Callable, Deque, List, Optional, Set, Tuple, TypeVar, cast from ._core._eventloop import current_time, get_asynclib, get_cancelled_exc_class from ._c...
Call the given function with the given arguments in a worker process. If the ``cancellable`` option is enabled and the task waiting for its completion is cancelled, the worker process running it will be abruptly terminated using SIGKILL (or ``terminateProcess()`` on Windows). :param func: a callable :param args: positi...
173,867
import os import pickle import subprocess import sys from collections import deque from importlib.util import module_from_spec, spec_from_file_location from typing import Callable, Deque, List, Optional, Set, Tuple, TypeVar, cast from ._core._eventloop import current_time, get_asynclib, get_cancelled_exc_class from ._c...
null
173,868
import array import asyncio import concurrent.futures import math import socket import sys from asyncio.base_events import _run_until_complete_cb from collections import OrderedDict, deque from concurrent.futures import Future from contextvars import Context, copy_context from dataclasses import dataclass from functoo...
Return ``True`` if the task has been started and has not finished.
173,869
import array import asyncio import concurrent.futures import math import socket import sys from asyncio.base_events import _run_until_complete_cb from collections import OrderedDict, deque from concurrent.futures import Future from contextvars import Context, copy_context from dataclasses import dataclass from functoo...
null
173,870
import array import asyncio import concurrent.futures import math import socket import sys from asyncio.base_events import _run_until_complete_cb from collections import OrderedDict, deque from concurrent.futures import Future from contextvars import Context, copy_context from dataclasses import dataclass from functoo...
null
173,871
import array import asyncio import concurrent.futures import math import socket import sys from asyncio.base_events import _run_until_complete_cb from collections import OrderedDict, deque from concurrent.futures import Future from contextvars import Context, copy_context from dataclasses import dataclass from functoo...
null
173,872
import array import asyncio import concurrent.futures import math import socket import sys from asyncio.base_events import _run_until_complete_cb from collections import OrderedDict, deque from concurrent.futures import Future from contextvars import Context, copy_context from dataclasses import dataclass from functoo...
null
173,873
import array import asyncio import concurrent.futures import math import socket import sys from asyncio.base_events import _run_until_complete_cb from collections import OrderedDict, deque from concurrent.futures import Future from contextvars import Context, copy_context from dataclasses import dataclass from functoo...
null
173,874
import array import asyncio import concurrent.futures import math import socket import sys from asyncio.base_events import _run_until_complete_cb from collections import OrderedDict, deque from concurrent.futures import Future from contextvars import Context, copy_context from dataclasses import dataclass from functoo...
null
173,875
import array import asyncio import concurrent.futures import math import socket import sys from asyncio.base_events import _run_until_complete_cb from collections import OrderedDict, deque from concurrent.futures import Future from contextvars import Context, copy_context from dataclasses import dataclass from functoo...
null
173,876
import array import asyncio import concurrent.futures import math import socket import sys from asyncio.base_events import _run_until_complete_cb from collections import OrderedDict, deque from concurrent.futures import Future from contextvars import Context, copy_context from dataclasses import dataclass from functoo...
null
173,877
import array import asyncio import concurrent.futures import math import socket import sys from asyncio.base_events import _run_until_complete_cb from collections import OrderedDict, deque from concurrent.futures import Future from contextvars import Context, copy_context from dataclasses import dataclass from functoo...
null
173,878
import array import asyncio import concurrent.futures import math import socket import sys from asyncio.base_events import _run_until_complete_cb from collections import OrderedDict, deque from concurrent.futures import Future from contextvars import Context, copy_context from dataclasses import dataclass from functoo...
null
173,879
import array import asyncio import concurrent.futures import math import socket import sys from asyncio.base_events import _run_until_complete_cb from collections import OrderedDict, deque from concurrent.futures import Future from contextvars import Context, copy_context from dataclasses import dataclass from functoo...
null
173,880
import array import asyncio import concurrent.futures import math import socket import sys from asyncio.base_events import _run_until_complete_cb from collections import OrderedDict, deque from concurrent.futures import Future from contextvars import Context, copy_context from dataclasses import dataclass from functoo...
null
173,881
import array import asyncio import concurrent.futures import math import socket import sys from asyncio.base_events import _run_until_complete_cb from collections import OrderedDict, deque from concurrent.futures import Future from contextvars import Context, copy_context from dataclasses import dataclass from functoo...
null
173,882
import array import asyncio import concurrent.futures import math import socket import sys from asyncio.base_events import _run_until_complete_cb from collections import OrderedDict, deque from concurrent.futures import Future from contextvars import Context, copy_context from dataclasses import dataclass from functoo...
null
173,883
import array import asyncio import concurrent.futures import math import socket import sys from asyncio.base_events import _run_until_complete_cb from collections import OrderedDict, deque from concurrent.futures import Future from contextvars import Context, copy_context from dataclasses import dataclass from functoo...
null
173,884
import array import asyncio import concurrent.futures import math import socket import sys from asyncio.base_events import _run_until_complete_cb from collections import OrderedDict, deque from concurrent.futures import Future from contextvars import Context, copy_context from dataclasses import dataclass from functoo...
null
173,885
import array import asyncio import concurrent.futures import math import socket import sys from asyncio.base_events import _run_until_complete_cb from collections import OrderedDict, deque from concurrent.futures import Future from contextvars import Context, copy_context from dataclasses import dataclass from functoo...
null
173,886
import array import asyncio import concurrent.futures import math import socket import sys from asyncio.base_events import _run_until_complete_cb from collections import OrderedDict, deque from concurrent.futures import Future from contextvars import Context, copy_context from dataclasses import dataclass from functoo...
null
173,887
import array import asyncio import concurrent.futures import math import socket import sys from asyncio.base_events import _run_until_complete_cb from collections import OrderedDict, deque from concurrent.futures import Future from contextvars import Context, copy_context from dataclasses import dataclass from functoo...
null
173,888
import array import math import socket from concurrent.futures import Future from contextvars import copy_context from dataclasses import dataclass from functools import partial from io import IOBase from os import PathLike from signal import Signals from types import TracebackType from typing import ( IO, TYPE...
null
173,889
import array import math import socket from concurrent.futures import Future from contextvars import copy_context from dataclasses import dataclass from functools import partial from io import IOBase from os import PathLike from signal import Signals from types import TracebackType from typing import ( IO, TYPE...
null
173,890
import array import math import socket from concurrent.futures import Future from contextvars import copy_context from dataclasses import dataclass from functools import partial from io import IOBase from os import PathLike from signal import Signals from types import TracebackType from typing import ( IO, TYPE...
null
173,891
import array import math import socket from concurrent.futures import Future from contextvars import copy_context from dataclasses import dataclass from functools import partial from io import IOBase from os import PathLike from signal import Signals from types import TracebackType from typing import ( IO, TYPE...
null
173,892
import array import math import socket from concurrent.futures import Future from contextvars import copy_context from dataclasses import dataclass from functools import partial from io import IOBase from os import PathLike from signal import Signals from types import TracebackType from typing import ( IO, TYPE...
null
173,893
import array import math import socket from concurrent.futures import Future from contextvars import copy_context from dataclasses import dataclass from functools import partial from io import IOBase from os import PathLike from signal import Signals from types import TracebackType from typing import ( IO, TYPE...
null
173,894
import array import math import socket from concurrent.futures import Future from contextvars import copy_context from dataclasses import dataclass from functools import partial from io import IOBase from os import PathLike from signal import Signals from types import TracebackType from typing import ( IO, TYPE...
null
173,895
import array import math import socket from concurrent.futures import Future from contextvars import copy_context from dataclasses import dataclass from functools import partial from io import IOBase from os import PathLike from signal import Signals from types import TracebackType from typing import ( IO, TYPE...
null
173,896
import array import math import socket from concurrent.futures import Future from contextvars import copy_context from dataclasses import dataclass from functools import partial from io import IOBase from os import PathLike from signal import Signals from types import TracebackType from typing import ( IO, TYPE...
null
173,897
import array import math import socket from concurrent.futures import Future from contextvars import copy_context from dataclasses import dataclass from functools import partial from io import IOBase from os import PathLike from signal import Signals from types import TracebackType from typing import ( IO, TYPE...
null
173,898
import array import math import socket from concurrent.futures import Future from contextvars import copy_context from dataclasses import dataclass from functools import partial from io import IOBase from os import PathLike from signal import Signals from types import TracebackType from typing import ( IO, TYPE...
null
173,899
import array import math import socket from concurrent.futures import Future from contextvars import copy_context from dataclasses import dataclass from functools import partial from io import IOBase from os import PathLike from signal import Signals from types import TracebackType from typing import ( IO, TYPE...
null
173,900
import array import math import socket from concurrent.futures import Future from contextvars import copy_context from dataclasses import dataclass from functools import partial from io import IOBase from os import PathLike from signal import Signals from types import TracebackType from typing import ( IO, TYPE...
null
173,901
import array import math import socket from concurrent.futures import Future from contextvars import copy_context from dataclasses import dataclass from functools import partial from io import IOBase from os import PathLike from signal import Signals from types import TracebackType from typing import ( IO, TYPE...
null
173,902
import array import math import socket from concurrent.futures import Future from contextvars import copy_context from dataclasses import dataclass from functools import partial from io import IOBase from os import PathLike from signal import Signals from types import TracebackType from typing import ( IO, TYPE...
null
173,903
from typing import Callable, Optional, TypeVar from warnings import warn from ._core._eventloop import get_asynclib from .abc import CapacityLimiter def current_default_thread_limiter() -> CapacityLimiter: """ Return the capacity limiter that is used by default to limit the number of concurrent threads. :re...
null
173,904
import enum import sys from dataclasses import dataclass from typing import Any, Dict, Generic, Set, TypeVar, Union, overload from weakref import WeakKeyDictionary from ._core._eventloop import get_asynclib def get_asynclib(asynclib_name: Optional[str] = None) -> Any: if asynclib_name is None: asynclib_nam...
Allow the scheduler to switch to another task but without checking for cancellation. Equivalent to (but potentially more efficient than):: with CancelScope(shield=True): await checkpoint() .. versionadded:: 3.0
173,905
import enum import sys from dataclasses import dataclass from typing import Any, Dict, Generic, Set, TypeVar, Union, overload from weakref import WeakKeyDictionary from ._core._eventloop import get_asynclib def get_asynclib(asynclib_name: Optional[str] = None) -> Any: if asynclib_name is None: asynclib_nam...
Return a backend specific token object that can be used to get back to the event loop.
173,906
try: # If wsaccel is available we use compiled routines to validate UTF-8 # strings. from wsaccel.utf8validator import Utf8Validator def _validate_utf8(utfbytes): return Utf8Validator().validate(utfbytes)[0] except ImportError: # UTF-8 validator # python implementation of http://bjoern.h...
validate utf8 byte string. utfbytes: utf byte string to check. return value: if valid utf8 string, return true. Otherwise, return false.
173,907
import logging _logger = logging.getLogger('websocket') try: from logging import NullHandler except ImportError: _logger.addHandler(NullHandler()) _traceEnabled = False The provided code snippet includes necessary dependencies for implementing the `enableTrace` function. Write a Python function `def enableTrace(tr...
Turn on/off the traceability. Parameters ---------- traceable: bool If set to True, traceability is enabled.
173,908
import logging _logger = logging.getLogger('websocket') _logger.addHandler(NullHandler()) def warning(msg): _logger.warning(msg)
null
173,909
import logging _logger = logging.getLogger('websocket') _logger.addHandler(NullHandler()) def info(msg): _logger.info(msg)
null
173,910
import logging _logger = logging.getLogger('websocket') try: from logging import NullHandler except ImportError: _logger.addHandler(NullHandler()) def isEnabledForError(): return _logger.isEnabledFor(logging.ERROR)
null
173,911
import logging _logger = logging.getLogger('websocket') try: from logging import NullHandler except ImportError: _logger.addHandler(NullHandler()) def isEnabledForDebug(): return _logger.isEnabledFor(logging.DEBUG)
null
173,912
import logging _traceEnabled = False def isEnabledForTrace(): return _traceEnabled
null
173,913
import inspect import selectors import sys import threading import time import traceback from . import _logging from ._abnf import ABNF from ._url import parse_url from ._core import WebSocket, getdefaulttimeout from ._exceptions import * RECONNECT = 0 def setReconnect(reconnectInterval): global RECONNECT RECO...
null
173,914
import array import os import struct import sys from ._exceptions import * from ._utils import validate_utf8 from threading import Lock def _mask(_m, _d): return XorMaskerSimple(_m).process(_d)
null
173,915
import array import os import struct import sys from ._exceptions import * from ._utils import validate_utf8 from threading import Lock def _mask(mask_value, data_value): datalen = len(data_value) data_value = int.from_bytes(data_value, native_byteorder) mask_value = int.from_bytes(mask_value *...
null
173,916
import hashlib import hmac import os from base64 import encodebytes as base64encode from http import client as HTTPStatus from ._cookiejar import SimpleCookieJar from ._exceptions import * from ._http import * from ._logging import * from ._socket import * SUPPORTED_REDIRECT_STATUSES = (HTTPStatus.MOVED_PERMANENTLY, HT...
null
173,917
import argparse import code import sys import threading import time import ssl import gzip import zlib from urllib.parse import urlparse import websocket def get_encoding(): encoding = getattr(sys.stdin, "encoding", "") if not encoding: return "utf-8" else: return encoding.lower()
null
173,918
import argparse import code import sys import threading import time import ssl import gzip import zlib from urllib.parse import urlparse import websocket class VAction(argparse.Action): def __call__(self, parser, args, values, option_string=None): if values is None: values = "1" try: ...
null
173,919
import errno import selectors import socket from ._exceptions import * from ._ssl_compat import * from ._utils import * _default_timeout = None The provided code snippet includes necessary dependencies for implementing the `setdefaulttimeout` function. Write a Python function `def setdefaulttimeout(timeout)` to solve ...
Set the global timeout setting to connect. Parameters ---------- timeout: int or float default socket timeout time (in seconds)
173,920
import socket import struct import threading import time from ._abnf import * from ._exceptions import * from ._handshake import * from ._http import * from ._logging import * from ._socket import * from ._ssl_compat import * from ._utils import * class WebSocket: """ Low level WebSocket interface. This cla...
Connect to url and return websocket object. Connect to url and return the WebSocket object. Passing optional timeout parameter will set the timeout on the socket. If no timeout is supplied, the global default timeout setting returned by getdefaulttimeout() is used. You can customize using 'options'. If you set "header"...