text
stringlengths
1
843k
from __future__ import annotations import types from abc import ABCMeta, abstractmethod from collections.abc import AsyncGenerator, Callable, Coroutine, Iterable from typing import Any, TypeVar _T = TypeVar("_T") class TestRunner(metaclass=ABCMeta): """ Encapsulates a running event loop. Every call made thr...
from __future__ import annotations from ._eventloop import AsyncBackend as AsyncBackend from ._resources import AsyncResource as AsyncResource from ._sockets import ConnectedUDPSocket as ConnectedUDPSocket from ._sockets import ConnectedUNIXDatagramSocket as ConnectedUNIXDatagramSocket from ._sockets import IPAddressT...
from __future__ import annotations from collections.abc import Callable, Mapping from dataclasses import dataclass, field from typing import Any from .. import ClosedResourceError, DelimiterNotFound, EndOfStream, IncompleteRead from ..abc import AnyByteReceiveStream, ByteReceiveStream @dataclass(eq=False) class Buf...
from __future__ import annotations from collections.abc import Callable, Mapping from io import SEEK_SET, UnsupportedOperation from os import PathLike from pathlib import Path from typing import Any, BinaryIO, cast from .. import ( BrokenResourceError, ClosedResourceError, EndOfStream, TypedAttributeS...
from __future__ import annotations import warnings from collections import OrderedDict, deque from dataclasses import dataclass, field from types import TracebackType from typing import Generic, NamedTuple, TypeVar from .. import ( BrokenResourceError, ClosedResourceError, EndOfStream, WouldBlock, ) f...
from __future__ import annotations from collections.abc import Callable, Mapping, Sequence from dataclasses import dataclass from typing import Any, Generic, TypeVar from ..abc import ( ByteReceiveStream, ByteSendStream, ByteStream, Listener, ObjectReceiveStream, ObjectSendStream, ObjectSt...
from __future__ import annotations import codecs from collections.abc import Callable, Mapping from dataclasses import InitVar, dataclass, field from typing import Any from ..abc import ( AnyByteReceiveStream, AnyByteSendStream, AnyByteStream, ObjectReceiveStream, ObjectSendStream, ObjectStrea...
from __future__ import annotations import logging import re import ssl import sys from collections.abc import Callable, Mapping from dataclasses import dataclass from functools import wraps from typing import Any, TypeVar from .. import ( BrokenResourceError, EndOfStream, aclose_forcefully, get_cancel...
null
from __future__ import annotations import array import asyncio import concurrent.futures import contextvars import math import os import socket import sys import threading import weakref from asyncio import ( AbstractEventLoop, CancelledError, all_tasks, create_task, current_task, get_running_l...
from __future__ import annotations import array import math import os import socket import sys import types import weakref from collections.abc import ( AsyncGenerator, AsyncIterator, Awaitable, Callable, Collection, Coroutine, Iterable, Sequence, ) from concurrent.futures import Future...
null
from __future__ import annotations import asyncio import socket import threading from collections.abc import Callable from selectors import EVENT_READ, EVENT_WRITE, DefaultSelector from typing import TYPE_CHECKING, Any if TYPE_CHECKING: from _typeshed import FileDescriptorLike _selector_lock = threading.Lock() _...
from __future__ import annotations import math import sys import threading from collections.abc import Awaitable, Callable, Generator from contextlib import contextmanager from importlib import import_module from typing import TYPE_CHECKING, Any, TypeVar import sniffio if sys.version_info >= (3, 11): from typing...
from __future__ import annotations import sys from collections.abc import Generator from textwrap import dedent from typing import Any if sys.version_info < (3, 11): from exceptiongroup import BaseExceptionGroup class BrokenResourceError(Exception): """ Raised when trying to use a resource that has been...
from __future__ import annotations import os import pathlib import sys from collections.abc import ( AsyncIterator, Callable, Iterable, Iterator, Sequence, ) from dataclasses import dataclass from functools import partial from os import PathLike from typing import ( IO, TYPE_CHECKING, A...
from __future__ import annotations from ..abc import AsyncResource from ._tasks import CancelScope async def aclose_forcefully(resource: AsyncResource) -> None: """ Close an asynchronous resource in a cancelled scope. Doing this closes the resource without waiting on anything. :param resource: the ...
from __future__ import annotations from collections.abc import AsyncIterator from contextlib import AbstractContextManager from signal import Signals from ._eventloop import get_async_backend def open_signal_receiver( *signals: Signals, ) -> AbstractContextManager[AsyncIterator[Signals]]: """ Start rece...
from __future__ import annotations import errno import os import socket import ssl import stat import sys from collections.abc import Awaitable from ipaddress import IPv6Address, ip_address from os import PathLike, chmod from socket import AddressFamily, SocketKind from typing import TYPE_CHECKING, Any, Literal, cast,...
from __future__ import annotations import math from typing import TypeVar from warnings import warn from ..streams.memory import ( MemoryObjectReceiveStream, MemoryObjectSendStream, MemoryObjectStreamState, ) T_Item = TypeVar("T_Item") class create_memory_object_stream( tuple[MemoryObjectSendStream...
from __future__ import annotations import sys from collections.abc import AsyncIterable, Iterable, Mapping, Sequence from io import BytesIO from os import PathLike from subprocess import PIPE, CalledProcessError, CompletedProcess from typing import IO, Any, Union, cast from ..abc import Process from ._eventloop impor...
from __future__ import annotations import math from collections import deque from dataclasses import dataclass from types import TracebackType from sniffio import AsyncLibraryNotFoundError from ..lowlevel import checkpoint from ._eventloop import get_async_backend from ._exceptions import BusyResourceError from ._ta...
from __future__ import annotations import math from collections.abc import Generator from contextlib import contextmanager from types import TracebackType from ..abc._tasks import TaskGroup, TaskStatus from ._eventloop import get_async_backend class _IgnoredTaskStatus(TaskStatus[object]): def started(self, valu...
from __future__ import annotations import os import sys import tempfile from collections.abc import Iterable from io import BytesIO, TextIOWrapper from types import TracebackType from typing import ( TYPE_CHECKING, Any, AnyStr, Generic, overload, ) from .. import to_thread from .._core._fileio imp...
from __future__ import annotations from collections.abc import Awaitable, Generator from typing import Any, cast from ._eventloop import get_async_backend class TaskInfo: """ Represents an asynchronous task. :ivar int id: the unique identifier of the task :ivar parent_id: the identifier of the pare...
from __future__ import annotations from collections.abc import Callable, Mapping from typing import Any, TypeVar, final, overload from ._exceptions import TypedAttributeLookupError T_Attr = TypeVar("T_Attr") T_Default = TypeVar("T_Default") undefined = object() def typed_attribute() -> Any: """Return a unique ...
null
# Copyright 2009-2024 Joshua Bronson. All rights reserved. # # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. """Define bidict package metadata.""" __version__ = '0.23....
# Copyright 2009-2024 Joshua Bronson. All rights reserved. # # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. # * Code review nav * # ...
# Copyright 2009-2024 Joshua Bronson. All rights reserved. # # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. # * Code review nav * # ...
# Copyright 2009-2024 Joshua Bronson. All rights reserved. # # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. # * Code review nav * # ...
# Copyright 2009-2024 Joshua Bronson. All rights reserved. # # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. """Provide :class:`OnDup` and related functionality.""" f...
# Copyright 2009-2024 Joshua Bronson. All rights reserved. # # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. """Provide all bidict exceptions.""" from __future__ impo...
# Copyright 2009-2024 Joshua Bronson. All rights reserved. # # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. # * Code review nav * # ...
# Copyright 2009-2024 Joshua Bronson. All rights reserved. # # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. """Functions for iterating over items in a mapping.""" fr...
# Copyright 2009-2024 Joshua Bronson. All rights reserved. # # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. # * Code review nav * # ...
# Copyright 2009-2024 Joshua Bronson. All rights reserved. # # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. # * Code review nav * # ...
# Copyright 2009-2024 Joshua Bronson. All rights reserved. # # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. """Provide typing-related objects.""" from __future__ imp...
# Copyright 2009-2024 Joshua Bronson. All rights reserved. # # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. # ========================================================...
""" certifi.py ~~~~~~~~~~ This module returns the installation location of cacert.pem or its contents. """ import sys import atexit def exit_cacert_ctx() -> None: _CACERT_CTX.__exit__(None, None, None) # type: ignore[union-attr] if sys.version_info >= (3, 11): from importlib.resources import as_file, file...
from .core import contents, where __all__ = ["contents", "where"] __version__ = "2025.04.26"
import argparse from certifi import contents, where parser = argparse.ArgumentParser() parser.add_argument("-c", "--contents", action="store_true") args = parser.parse_args() if args.contents: print(contents()) else: print(where())
from __future__ import annotations import collections.abc as cabc import enum import errno import inspect import os import sys import typing as t from collections import abc from collections import Counter from contextlib import AbstractContextManager from contextlib import contextmanager from contextlib import ExitSt...
from __future__ import annotations import inspect import typing as t from functools import update_wrapper from gettext import gettext as _ from .core import Argument from .core import Command from .core import Context from .core import Group from .core import Option from .core import Parameter from .globals import ge...
from __future__ import annotations import collections.abc as cabc import typing as t from gettext import gettext as _ from gettext import ngettext from ._compat import get_text_stderr from .globals import resolve_color_default from .utils import echo from .utils import format_filename if t.TYPE_CHECKING: from .c...
from __future__ import annotations import collections.abc as cabc from contextlib import contextmanager from gettext import gettext as _ from ._compat import term_len from .parser import _split_opt # Can force a width. This is used by the test system FORCED_WIDTH: int | None = None def measure_table(rows: cabc.It...
from __future__ import annotations import typing as t from threading import local if t.TYPE_CHECKING: from .core import Context _local = local() @t.overload def get_current_context(silent: t.Literal[False] = False) -> Context: ... @t.overload def get_current_context(silent: bool = ...) -> Context | None: ......
""" This module started out as largely a copy paste from the stdlib's optparse module with the features removed that we do not need from optparse because we implement them in Click on a higher level (for instance type handling, help formatting and a lot more). The plan is to remove more and more from here over time. ...
from __future__ import annotations import collections.abc as cabc import os import re import typing as t from gettext import gettext as _ from .core import Argument from .core import Command from .core import Context from .core import Group from .core import Option from .core import Parameter from .core import Parame...
from __future__ import annotations import collections.abc as cabc import inspect import io import itertools import sys import typing as t from contextlib import AbstractContextManager from gettext import gettext as _ from ._compat import isatty from ._compat import strip_ansi from .exceptions import Abort from .excep...
from __future__ import annotations import collections.abc as cabc import contextlib import io import os import shlex import shutil import sys import tempfile import typing as t from types import TracebackType from . import _compat from . import formatting from . import termui from . import utils from ._compat import ...
from __future__ import annotations import collections.abc as cabc import enum import os import stat import sys import typing as t from datetime import datetime from gettext import gettext as _ from gettext import ngettext from ._compat import _get_argv_encoding from ._compat import open_stream from .exceptions import...
from __future__ import annotations import collections.abc as cabc import os import re import sys import typing as t from functools import update_wrapper from types import ModuleType from types import TracebackType from ._compat import _default_text_stderr from ._compat import _default_text_stdout from ._compat import...
from __future__ import annotations import codecs import collections.abc as cabc import io import os import re import sys import typing as t from types import TracebackType from weakref import WeakKeyDictionary CYGWIN = sys.platform.startswith("cygwin") WIN = sys.platform.startswith("win") auto_wrap_for_ansi: t.Callab...
""" This module contains implementations for the termui module. To keep the import time of Click down, some infrequently used functionality is placed in this module and only imported as needed. """ from __future__ import annotations import collections.abc as cabc import contextlib import math import os import shlex i...
from __future__ import annotations import collections.abc as cabc import textwrap from contextlib import contextmanager class TextWrapper(textwrap.TextWrapper): def _handle_long_word( self, reversed_chunks: list[str], cur_line: list[str], cur_len: int, width: int, ) ->...
# This module is based on the excellent work by Adam Bartoš who # provided a lot of what went into the implementation here in # the discussion to issue1602 in the Python bug tracker. # # There are some general differences in regards to how this works # compared to the original patches as we do not need to patch # the e...
""" Click is a simple Python module inspired by the stdlib optparse to make writing command line scripts fun. Unlike other modules, it's based around a simple API that does not come with too much magic and is composable. """ from __future__ import annotations from .core import Argument as Argument from .core import C...
# Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file. ''' This module generates ANSI character codes to printing colors to terminals. See: http://en.wikipedia.org/wiki/ANSI_escape_code ''' CSI = '\033[' OSC = '\033]' BEL = '\a' def code_to_chars(code): return CSI + str(code) + 'm' def set_t...
# Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file. import re import sys import os from .ansi import AnsiFore, AnsiBack, AnsiStyle, Style, BEL from .winterm import enable_vt_processing, WinTerm, WinColor, WinStyle from .win32 import windll, winapi_test winterm = None if windll is not None: ...
# Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file. import atexit import contextlib import sys from .ansitowin32 import AnsiToWin32 def _wipe_internal_state_for_tests(): global orig_stdout, orig_stderr orig_stdout = None orig_stderr = None global wrapped_stdout, wrapped_stderr...
# Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file. # from winbase.h STDOUT = -11 STDERR = -12 ENABLE_VIRTUAL_TERMINAL_PROCESSING = 0x0004 try: import ctypes from ctypes import LibraryLoader windll = LibraryLoader(ctypes.WinDLL) from ctypes import wintypes except (AttributeErro...
# Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file. try: from msvcrt import get_osfhandle except ImportError: def get_osfhandle(_): raise OSError("This isn't windows!") from . import win32 # from wincon.h class WinColor(object): BLACK = 0 BLUE = 1 GREEN = 2 ...
# Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file. from .initialise import init, deinit, reinit, colorama_text, just_fix_windows_console from .ansi import Fore, Back, Style, Cursor from .ansitowin32 import AnsiToWin32 __version__ = '0.4.6'
# Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file. from io import StringIO, TextIOWrapper from unittest import TestCase, main try: from contextlib import ExitStack except ImportError: # python 2 from contextlib2 import ExitStack try: from unittest.mock import MagicMock, Mock, pa...
# Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file. import sys from unittest import TestCase, main from ..ansi import Back, Fore, Style from ..ansitowin32 import AnsiToWin32 stdout_orig = sys.stdout stderr_orig = sys.stderr class AnsiTest(TestCase): def setUp(self): # sanity chec...
# Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file. import sys from unittest import TestCase, main, skipUnless try: from unittest.mock import patch, Mock except ImportError: from mock import patch, Mock from ..ansitowin32 import StreamWrapper from ..initialise import init, just_fix_wind...
# Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file. import sys from unittest import TestCase, main from ..ansitowin32 import StreamWrapper, AnsiToWin32 from .utils import pycharm, replace_by, replace_original_by, StreamTTY, StreamNonTTY def is_a_tty(stream): return StreamWrapper(stream, No...
# Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file. from contextlib import contextmanager from io import StringIO import sys import os class StreamTTY(StringIO): def isatty(self): return True class StreamNonTTY(StringIO): def isatty(self): return False @contextmanager ...
# Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file. import sys from unittest import TestCase, main, skipUnless try: from unittest.mock import Mock, patch except ImportError: from mock import Mock, patch from ..winterm import WinColor, WinStyle, WinTerm class WinTermTest(TestCase): ...
# Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file.
import asyncio import signal import ssl import threading try: import aiohttp except ImportError: # pragma: no cover aiohttp = None from . import base_client from . import exceptions from . import packet from . import payload async_signal_handler_set = False # this set is used to keep references to backgrou...
import asyncio import urllib from . import base_server from . import exceptions from . import packet from . import async_socket # this set is used to keep references to background tasks to prevent them from # being garbage collected mid-execution. Solution taken from # https://docs.python.org/3/library/asyncio-task.h...
import asyncio import sys import time from . import base_socket from . import exceptions from . import packet from . import payload class AsyncSocket(base_socket.BaseSocket): async def poll(self): """Wait for packets to send to the client.""" try: packets = [await asyncio.wait_for( ...
import logging import signal import threading import time import urllib from . import packet default_logger = logging.getLogger('engineio.client') connected_clients = [] def signal_handler(sig, frame): """SIGINT handler. Disconnect all active clients and then invoke the original signal handler. """ ...
import base64 import gzip import importlib import io import logging import secrets import zlib from . import packet from . import payload default_logger = logging.getLogger('engineio.server') class BaseServer: compression_methods = ['gzip', 'deflate'] event_names = ['connect', 'disconnect', 'message'] v...
class BaseSocket: upgrade_protocols = ['websocket'] def __init__(self, server, sid): self.server = server self.sid = sid self.queue = self.server.create_queue() self.last_ping = None self.connected = False self.upgrading = False self.upgraded = False ...
from base64 import b64encode from engineio.json import JSONDecodeError import logging import queue import ssl import threading import time import urllib try: import requests except ImportError: # pragma: no cover requests = None try: import websocket except ImportError: # pragma: no cover websocket =...
class EngineIOError(Exception): pass class ContentTooLongError(EngineIOError): pass class UnknownPacketError(EngineIOError): pass class QueueEmpty(EngineIOError): pass class SocketIsClosedError(EngineIOError): pass class ConnectionError(EngineIOError): pass
"""JSON-compatible module with sane defaults.""" from json import * # noqa: F401, F403 from json import loads as original_loads def _safe_int(s): if len(s) > 100: raise ValueError('Integer is too large') return int(s) def loads(*args, **kwargs): if 'parse_int' not in kwargs: # pragma: no cove...
import os from engineio.static_files import get_static_file class WSGIApp: """WSGI application middleware for Engine.IO. This middleware dispatches traffic to an Engine.IO application. It can also serve a list of static files to the client, or forward unrelated HTTP traffic to another WSGI applicatio...
import base64 from engineio import json as _json (OPEN, CLOSE, PING, PONG, MESSAGE, UPGRADE, NOOP) = (0, 1, 2, 3, 4, 5, 6) packet_names = ['OPEN', 'CLOSE', 'PING', 'PONG', 'MESSAGE', 'UPGRADE', 'NOOP'] binary_types = (bytes, bytearray) class Packet: """Engine.IO packet.""" json = _json def __init__(se...
import urllib from . import packet class Payload: """Engine.IO payload.""" max_decode_packets = 16 def __init__(self, packets=None, encoded_payload=None): self.packets = packets or [] if encoded_payload is not None: self.decode(encoded_payload) def encode(self, jsonp_ind...
import logging import urllib from . import base_server from . import exceptions from . import packet from . import socket default_logger = logging.getLogger('engineio.server') class Server(base_server.BaseServer): """An Engine.IO server. This class implements a fully compliant Engine.IO web server with sup...
import sys import time from . import base_socket from . import exceptions from . import packet from . import payload class Socket(base_socket.BaseSocket): """An Engine.IO socket.""" def poll(self): """Wait for packets to send to the client.""" queue_empty = self.server.get_queue_empty_excepti...
content_types = { 'css': 'text/css', 'gif': 'image/gif', 'html': 'text/html', 'jpg': 'image/jpeg', 'js': 'application/javascript', 'json': 'application/json', 'png': 'image/png', 'txt': 'text/plain', } def get_static_file(path, static_files): """Return the local filename and conten...
from .client import Client from .middleware import WSGIApp, Middleware from .server import Server from .async_server import AsyncServer from .async_client import AsyncClient from .async_drivers.asgi import ASGIApp try: from .async_drivers.tornado import get_tornado_handler except ImportError: # pragma: no cover ...
import asyncio import sys from urllib.parse import urlsplit from aiohttp.web import Response, WebSocketResponse def create_route(app, engineio_server, engineio_endpoint): """This function sets up the engine.io endpoint as a route for the application. Note that both GET and POST requests must be hooked u...
import os import sys import asyncio from engineio.static_files import get_static_file class ASGIApp: """ASGI application middleware for Engine.IO. This middleware dispatches traffic to an Engine.IO application. It can also serve a list of static files to the client, or forward unrelated HTTP traffic...
from eventlet.green.threading import Event from eventlet import queue, sleep, spawn from eventlet.websocket import WebSocketWSGI as _WebSocketWSGI class EventletThread: # pragma: no cover """Thread class that uses eventlet green threads. Eventlet's own Thread class has a strange bug that causes _DummyThread...
import gevent from gevent import queue from gevent.event import Event try: # use gevent-websocket if installed import geventwebsocket # noqa SimpleWebSocketWSGI = None except ImportError: # pragma: no cover # fallback to simple_websocket when gevent-websocket is not installed from engineio.async_d...
import gevent from gevent import queue from gevent.event import Event from gevent import selectors import uwsgi _websocket_available = hasattr(uwsgi, 'websocket_handshake') class Thread(gevent.Greenlet): # pragma: no cover """ This wrapper class provides gevent Greenlet interface that is compatible with ...
import sys from urllib.parse import urlsplit try: # pragma: no cover from sanic.response import HTTPResponse try: from sanic.server.protocols.websocket_protocol import WebSocketProtocol except ImportError: from sanic.websocket import WebSocketProtocol except ImportError: HTTPResponse =...
import queue import threading import time from engineio.async_drivers._websocket_wsgi import SimpleWebSocketWSGI class DaemonThread(threading.Thread): # pragma: no cover def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs, daemon=True) _async = { 'thread': DaemonThread, 'queue...
import asyncio import sys from urllib.parse import urlsplit from .. import exceptions import tornado.web import tornado.websocket def get_tornado_handler(engineio_server): class Handler(tornado.websocket.WebSocketHandler): # pragma: no cover def __init__(self, *args, **kwargs): super().__ini...
import simple_websocket class SimpleWebSocketWSGI: # pragma: no cover """ This wrapper class provides a threading WebSocket interface that is compatible with eventlet's implementation. """ def __init__(self, handler, server, **kwargs): self.app = handler self.server_args = kwargs ...
null
from enum import Enum from typing import ( Any, Awaitable, Callable, Coroutine, Dict, List, Optional, Sequence, Type, TypeVar, Union, ) from fastapi import routing from fastapi.datastructures import Default, DefaultPlaceholder from fastapi.exception_handlers import ( htt...
from typing import Any, Callable from starlette.background import BackgroundTasks as StarletteBackgroundTasks from typing_extensions import Annotated, Doc, ParamSpec P = ParamSpec("P") class BackgroundTasks(StarletteBackgroundTasks): """ A collection of background tasks that will be called after a response ...
try: from fastapi_cli.cli import main as cli_main except ImportError: # pragma: no cover cli_main = None # type: ignore def main() -> None: if not cli_main: # type: ignore[truthy-function] message = 'To use the fastapi command, please install "fastapi[standard]":\n\n\tpip install "fastapi[stan...