Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- venv/lib/python3.10/site-packages/aiohappyeyeballs/__init__.py +14 -0
- venv/lib/python3.10/site-packages/aiohappyeyeballs/__pycache__/__init__.cpython-310.pyc +0 -0
- venv/lib/python3.10/site-packages/aiohappyeyeballs/__pycache__/_staggered.cpython-310.pyc +0 -0
- venv/lib/python3.10/site-packages/aiohappyeyeballs/__pycache__/impl.cpython-310.pyc +0 -0
- venv/lib/python3.10/site-packages/aiohappyeyeballs/__pycache__/types.cpython-310.pyc +0 -0
- venv/lib/python3.10/site-packages/aiohappyeyeballs/__pycache__/utils.cpython-310.pyc +0 -0
- venv/lib/python3.10/site-packages/aiohappyeyeballs/_staggered.py +207 -0
- venv/lib/python3.10/site-packages/aiohappyeyeballs/impl.py +259 -0
- venv/lib/python3.10/site-packages/aiohappyeyeballs/py.typed +0 -0
- venv/lib/python3.10/site-packages/aiohappyeyeballs/types.py +17 -0
- venv/lib/python3.10/site-packages/aiohappyeyeballs/utils.py +97 -0
- venv/lib/python3.10/site-packages/async_timeout-5.0.1.dist-info/INSTALLER +1 -0
- venv/lib/python3.10/site-packages/async_timeout-5.0.1.dist-info/LICENSE +13 -0
- venv/lib/python3.10/site-packages/async_timeout-5.0.1.dist-info/METADATA +163 -0
- venv/lib/python3.10/site-packages/async_timeout-5.0.1.dist-info/RECORD +10 -0
- venv/lib/python3.10/site-packages/async_timeout-5.0.1.dist-info/WHEEL +5 -0
- venv/lib/python3.10/site-packages/async_timeout-5.0.1.dist-info/top_level.txt +1 -0
- venv/lib/python3.10/site-packages/async_timeout-5.0.1.dist-info/zip-safe +1 -0
- venv/lib/python3.10/site-packages/attrs-25.3.0.dist-info/INSTALLER +1 -0
- venv/lib/python3.10/site-packages/attrs-25.3.0.dist-info/RECORD +55 -0
- venv/lib/python3.10/site-packages/attrs-25.3.0.dist-info/licenses/LICENSE +21 -0
- venv/lib/python3.10/site-packages/chardet/__pycache__/gb2312prober.cpython-310.pyc +0 -0
- venv/lib/python3.10/site-packages/chardet/__pycache__/hebrewprober.cpython-310.pyc +0 -0
- venv/lib/python3.10/site-packages/chardet/__pycache__/jisfreq.cpython-310.pyc +0 -0
- venv/lib/python3.10/site-packages/chardet/__pycache__/johabprober.cpython-310.pyc +0 -0
- venv/lib/python3.10/site-packages/chardet/__pycache__/jpcntx.cpython-310.pyc +0 -0
- venv/lib/python3.10/site-packages/chardet/__pycache__/langbulgarianmodel.cpython-310.pyc +0 -0
- venv/lib/python3.10/site-packages/chardet/__pycache__/langgreekmodel.cpython-310.pyc +0 -0
- venv/lib/python3.10/site-packages/chardet/__pycache__/langhebrewmodel.cpython-310.pyc +0 -0
- venv/lib/python3.10/site-packages/chardet/__pycache__/langhungarianmodel.cpython-310.pyc +0 -0
- venv/lib/python3.10/site-packages/chardet/__pycache__/langrussianmodel.cpython-310.pyc +0 -0
- venv/lib/python3.10/site-packages/chardet/__pycache__/langthaimodel.cpython-310.pyc +0 -0
- venv/lib/python3.10/site-packages/chardet/__pycache__/langturkishmodel.cpython-310.pyc +0 -0
- venv/lib/python3.10/site-packages/chardet/__pycache__/latin1prober.cpython-310.pyc +0 -0
- venv/lib/python3.10/site-packages/chardet/__pycache__/macromanprober.cpython-310.pyc +0 -0
- venv/lib/python3.10/site-packages/chardet/__pycache__/mbcharsetprober.cpython-310.pyc +0 -0
- venv/lib/python3.10/site-packages/chardet/__pycache__/mbcsgroupprober.cpython-310.pyc +0 -0
- venv/lib/python3.10/site-packages/chardet/__pycache__/mbcssm.cpython-310.pyc +0 -0
- venv/lib/python3.10/site-packages/chardet/__pycache__/resultdict.cpython-310.pyc +0 -0
- venv/lib/python3.10/site-packages/chardet/__pycache__/sbcharsetprober.cpython-310.pyc +0 -0
- venv/lib/python3.10/site-packages/chardet/__pycache__/sbcsgroupprober.cpython-310.pyc +0 -0
- venv/lib/python3.10/site-packages/chardet/__pycache__/sjisprober.cpython-310.pyc +0 -0
- venv/lib/python3.10/site-packages/chardet/__pycache__/universaldetector.cpython-310.pyc +0 -0
- venv/lib/python3.10/site-packages/chardet/__pycache__/utf1632prober.cpython-310.pyc +0 -0
- venv/lib/python3.10/site-packages/chardet/__pycache__/utf8prober.cpython-310.pyc +0 -0
- venv/lib/python3.10/site-packages/chardet/__pycache__/version.cpython-310.pyc +0 -0
- venv/lib/python3.10/site-packages/nltk/VERSION +1 -0
- venv/lib/python3.10/site-packages/nltk/__init__.py +209 -0
- venv/lib/python3.10/site-packages/nltk/app/__pycache__/__init__.cpython-310.pyc +0 -0
- venv/lib/python3.10/site-packages/nltk/app/__pycache__/chartparser_app.cpython-310.pyc +0 -0
venv/lib/python3.10/site-packages/aiohappyeyeballs/__init__.py
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
__version__ = "2.6.1"
|
| 2 |
+
|
| 3 |
+
from .impl import start_connection
|
| 4 |
+
from .types import AddrInfoType, SocketFactoryType
|
| 5 |
+
from .utils import addr_to_addr_infos, pop_addr_infos_interleave, remove_addr_infos
|
| 6 |
+
|
| 7 |
+
__all__ = (
|
| 8 |
+
"AddrInfoType",
|
| 9 |
+
"SocketFactoryType",
|
| 10 |
+
"addr_to_addr_infos",
|
| 11 |
+
"pop_addr_infos_interleave",
|
| 12 |
+
"remove_addr_infos",
|
| 13 |
+
"start_connection",
|
| 14 |
+
)
|
venv/lib/python3.10/site-packages/aiohappyeyeballs/__pycache__/__init__.cpython-310.pyc
ADDED
|
Binary file (552 Bytes). View file
|
|
|
venv/lib/python3.10/site-packages/aiohappyeyeballs/__pycache__/_staggered.cpython-310.pyc
ADDED
|
Binary file (5.59 kB). View file
|
|
|
venv/lib/python3.10/site-packages/aiohappyeyeballs/__pycache__/impl.cpython-310.pyc
ADDED
|
Binary file (6.4 kB). View file
|
|
|
venv/lib/python3.10/site-packages/aiohappyeyeballs/__pycache__/types.cpython-310.pyc
ADDED
|
Binary file (524 Bytes). View file
|
|
|
venv/lib/python3.10/site-packages/aiohappyeyeballs/__pycache__/utils.cpython-310.pyc
ADDED
|
Binary file (2.61 kB). View file
|
|
|
venv/lib/python3.10/site-packages/aiohappyeyeballs/_staggered.py
ADDED
|
@@ -0,0 +1,207 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import asyncio
|
| 2 |
+
import contextlib
|
| 3 |
+
|
| 4 |
+
# PY3.9: Import Callable from typing until we drop Python 3.9 support
|
| 5 |
+
# https://github.com/python/cpython/issues/87131
|
| 6 |
+
from typing import (
|
| 7 |
+
TYPE_CHECKING,
|
| 8 |
+
Any,
|
| 9 |
+
Awaitable,
|
| 10 |
+
Callable,
|
| 11 |
+
Iterable,
|
| 12 |
+
List,
|
| 13 |
+
Optional,
|
| 14 |
+
Set,
|
| 15 |
+
Tuple,
|
| 16 |
+
TypeVar,
|
| 17 |
+
Union,
|
| 18 |
+
)
|
| 19 |
+
|
| 20 |
+
_T = TypeVar("_T")
|
| 21 |
+
|
| 22 |
+
RE_RAISE_EXCEPTIONS = (SystemExit, KeyboardInterrupt)
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
def _set_result(wait_next: "asyncio.Future[None]") -> None:
|
| 26 |
+
"""Set the result of a future if it is not already done."""
|
| 27 |
+
if not wait_next.done():
|
| 28 |
+
wait_next.set_result(None)
|
| 29 |
+
|
| 30 |
+
|
| 31 |
+
async def _wait_one(
|
| 32 |
+
futures: "Iterable[asyncio.Future[Any]]",
|
| 33 |
+
loop: asyncio.AbstractEventLoop,
|
| 34 |
+
) -> _T:
|
| 35 |
+
"""Wait for the first future to complete."""
|
| 36 |
+
wait_next = loop.create_future()
|
| 37 |
+
|
| 38 |
+
def _on_completion(fut: "asyncio.Future[Any]") -> None:
|
| 39 |
+
if not wait_next.done():
|
| 40 |
+
wait_next.set_result(fut)
|
| 41 |
+
|
| 42 |
+
for f in futures:
|
| 43 |
+
f.add_done_callback(_on_completion)
|
| 44 |
+
|
| 45 |
+
try:
|
| 46 |
+
return await wait_next
|
| 47 |
+
finally:
|
| 48 |
+
for f in futures:
|
| 49 |
+
f.remove_done_callback(_on_completion)
|
| 50 |
+
|
| 51 |
+
|
| 52 |
+
async def staggered_race(
|
| 53 |
+
coro_fns: Iterable[Callable[[], Awaitable[_T]]],
|
| 54 |
+
delay: Optional[float],
|
| 55 |
+
*,
|
| 56 |
+
loop: Optional[asyncio.AbstractEventLoop] = None,
|
| 57 |
+
) -> Tuple[Optional[_T], Optional[int], List[Optional[BaseException]]]:
|
| 58 |
+
"""
|
| 59 |
+
Run coroutines with staggered start times and take the first to finish.
|
| 60 |
+
|
| 61 |
+
This method takes an iterable of coroutine functions. The first one is
|
| 62 |
+
started immediately. From then on, whenever the immediately preceding one
|
| 63 |
+
fails (raises an exception), or when *delay* seconds has passed, the next
|
| 64 |
+
coroutine is started. This continues until one of the coroutines complete
|
| 65 |
+
successfully, in which case all others are cancelled, or until all
|
| 66 |
+
coroutines fail.
|
| 67 |
+
|
| 68 |
+
The coroutines provided should be well-behaved in the following way:
|
| 69 |
+
|
| 70 |
+
* They should only ``return`` if completed successfully.
|
| 71 |
+
|
| 72 |
+
* They should always raise an exception if they did not complete
|
| 73 |
+
successfully. In particular, if they handle cancellation, they should
|
| 74 |
+
probably reraise, like this::
|
| 75 |
+
|
| 76 |
+
try:
|
| 77 |
+
# do work
|
| 78 |
+
except asyncio.CancelledError:
|
| 79 |
+
# undo partially completed work
|
| 80 |
+
raise
|
| 81 |
+
|
| 82 |
+
Args:
|
| 83 |
+
----
|
| 84 |
+
coro_fns: an iterable of coroutine functions, i.e. callables that
|
| 85 |
+
return a coroutine object when called. Use ``functools.partial`` or
|
| 86 |
+
lambdas to pass arguments.
|
| 87 |
+
|
| 88 |
+
delay: amount of time, in seconds, between starting coroutines. If
|
| 89 |
+
``None``, the coroutines will run sequentially.
|
| 90 |
+
|
| 91 |
+
loop: the event loop to use. If ``None``, the running loop is used.
|
| 92 |
+
|
| 93 |
+
Returns:
|
| 94 |
+
-------
|
| 95 |
+
tuple *(winner_result, winner_index, exceptions)* where
|
| 96 |
+
|
| 97 |
+
- *winner_result*: the result of the winning coroutine, or ``None``
|
| 98 |
+
if no coroutines won.
|
| 99 |
+
|
| 100 |
+
- *winner_index*: the index of the winning coroutine in
|
| 101 |
+
``coro_fns``, or ``None`` if no coroutines won. If the winning
|
| 102 |
+
coroutine may return None on success, *winner_index* can be used
|
| 103 |
+
to definitively determine whether any coroutine won.
|
| 104 |
+
|
| 105 |
+
- *exceptions*: list of exceptions returned by the coroutines.
|
| 106 |
+
``len(exceptions)`` is equal to the number of coroutines actually
|
| 107 |
+
started, and the order is the same as in ``coro_fns``. The winning
|
| 108 |
+
coroutine's entry is ``None``.
|
| 109 |
+
|
| 110 |
+
"""
|
| 111 |
+
loop = loop or asyncio.get_running_loop()
|
| 112 |
+
exceptions: List[Optional[BaseException]] = []
|
| 113 |
+
tasks: Set[asyncio.Task[Optional[Tuple[_T, int]]]] = set()
|
| 114 |
+
|
| 115 |
+
async def run_one_coro(
|
| 116 |
+
coro_fn: Callable[[], Awaitable[_T]],
|
| 117 |
+
this_index: int,
|
| 118 |
+
start_next: "asyncio.Future[None]",
|
| 119 |
+
) -> Optional[Tuple[_T, int]]:
|
| 120 |
+
"""
|
| 121 |
+
Run a single coroutine.
|
| 122 |
+
|
| 123 |
+
If the coroutine fails, set the exception in the exceptions list and
|
| 124 |
+
start the next coroutine by setting the result of the start_next.
|
| 125 |
+
|
| 126 |
+
If the coroutine succeeds, return the result and the index of the
|
| 127 |
+
coroutine in the coro_fns list.
|
| 128 |
+
|
| 129 |
+
If SystemExit or KeyboardInterrupt is raised, re-raise it.
|
| 130 |
+
"""
|
| 131 |
+
try:
|
| 132 |
+
result = await coro_fn()
|
| 133 |
+
except RE_RAISE_EXCEPTIONS:
|
| 134 |
+
raise
|
| 135 |
+
except BaseException as e:
|
| 136 |
+
exceptions[this_index] = e
|
| 137 |
+
_set_result(start_next) # Kickstart the next coroutine
|
| 138 |
+
return None
|
| 139 |
+
|
| 140 |
+
return result, this_index
|
| 141 |
+
|
| 142 |
+
start_next_timer: Optional[asyncio.TimerHandle] = None
|
| 143 |
+
start_next: Optional[asyncio.Future[None]]
|
| 144 |
+
task: asyncio.Task[Optional[Tuple[_T, int]]]
|
| 145 |
+
done: Union[asyncio.Future[None], asyncio.Task[Optional[Tuple[_T, int]]]]
|
| 146 |
+
coro_iter = iter(coro_fns)
|
| 147 |
+
this_index = -1
|
| 148 |
+
try:
|
| 149 |
+
while True:
|
| 150 |
+
if coro_fn := next(coro_iter, None):
|
| 151 |
+
this_index += 1
|
| 152 |
+
exceptions.append(None)
|
| 153 |
+
start_next = loop.create_future()
|
| 154 |
+
task = loop.create_task(run_one_coro(coro_fn, this_index, start_next))
|
| 155 |
+
tasks.add(task)
|
| 156 |
+
start_next_timer = (
|
| 157 |
+
loop.call_later(delay, _set_result, start_next) if delay else None
|
| 158 |
+
)
|
| 159 |
+
elif not tasks:
|
| 160 |
+
# We exhausted the coro_fns list and no tasks are running
|
| 161 |
+
# so we have no winner and all coroutines failed.
|
| 162 |
+
break
|
| 163 |
+
|
| 164 |
+
while tasks or start_next:
|
| 165 |
+
done = await _wait_one(
|
| 166 |
+
(*tasks, start_next) if start_next else tasks, loop
|
| 167 |
+
)
|
| 168 |
+
if done is start_next:
|
| 169 |
+
# The current task has failed or the timer has expired
|
| 170 |
+
# so we need to start the next task.
|
| 171 |
+
start_next = None
|
| 172 |
+
if start_next_timer:
|
| 173 |
+
start_next_timer.cancel()
|
| 174 |
+
start_next_timer = None
|
| 175 |
+
|
| 176 |
+
# Break out of the task waiting loop to start the next
|
| 177 |
+
# task.
|
| 178 |
+
break
|
| 179 |
+
|
| 180 |
+
if TYPE_CHECKING:
|
| 181 |
+
assert isinstance(done, asyncio.Task)
|
| 182 |
+
|
| 183 |
+
tasks.remove(done)
|
| 184 |
+
if winner := done.result():
|
| 185 |
+
return *winner, exceptions
|
| 186 |
+
finally:
|
| 187 |
+
# We either have:
|
| 188 |
+
# - a winner
|
| 189 |
+
# - all tasks failed
|
| 190 |
+
# - a KeyboardInterrupt or SystemExit.
|
| 191 |
+
|
| 192 |
+
#
|
| 193 |
+
# If the timer is still running, cancel it.
|
| 194 |
+
#
|
| 195 |
+
if start_next_timer:
|
| 196 |
+
start_next_timer.cancel()
|
| 197 |
+
|
| 198 |
+
#
|
| 199 |
+
# If there are any tasks left, cancel them and than
|
| 200 |
+
# wait them so they fill the exceptions list.
|
| 201 |
+
#
|
| 202 |
+
for task in tasks:
|
| 203 |
+
task.cancel()
|
| 204 |
+
with contextlib.suppress(asyncio.CancelledError):
|
| 205 |
+
await task
|
| 206 |
+
|
| 207 |
+
return None, None, exceptions
|
venv/lib/python3.10/site-packages/aiohappyeyeballs/impl.py
ADDED
|
@@ -0,0 +1,259 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Base implementation."""
|
| 2 |
+
|
| 3 |
+
import asyncio
|
| 4 |
+
import collections
|
| 5 |
+
import contextlib
|
| 6 |
+
import functools
|
| 7 |
+
import itertools
|
| 8 |
+
import socket
|
| 9 |
+
from typing import List, Optional, Sequence, Set, Union
|
| 10 |
+
|
| 11 |
+
from . import _staggered
|
| 12 |
+
from .types import AddrInfoType, SocketFactoryType
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
async def start_connection(
|
| 16 |
+
addr_infos: Sequence[AddrInfoType],
|
| 17 |
+
*,
|
| 18 |
+
local_addr_infos: Optional[Sequence[AddrInfoType]] = None,
|
| 19 |
+
happy_eyeballs_delay: Optional[float] = None,
|
| 20 |
+
interleave: Optional[int] = None,
|
| 21 |
+
loop: Optional[asyncio.AbstractEventLoop] = None,
|
| 22 |
+
socket_factory: Optional[SocketFactoryType] = None,
|
| 23 |
+
) -> socket.socket:
|
| 24 |
+
"""
|
| 25 |
+
Connect to a TCP server.
|
| 26 |
+
|
| 27 |
+
Create a socket connection to a specified destination. The
|
| 28 |
+
destination is specified as a list of AddrInfoType tuples as
|
| 29 |
+
returned from getaddrinfo().
|
| 30 |
+
|
| 31 |
+
The arguments are, in order:
|
| 32 |
+
|
| 33 |
+
* ``family``: the address family, e.g. ``socket.AF_INET`` or
|
| 34 |
+
``socket.AF_INET6``.
|
| 35 |
+
* ``type``: the socket type, e.g. ``socket.SOCK_STREAM`` or
|
| 36 |
+
``socket.SOCK_DGRAM``.
|
| 37 |
+
* ``proto``: the protocol, e.g. ``socket.IPPROTO_TCP`` or
|
| 38 |
+
``socket.IPPROTO_UDP``.
|
| 39 |
+
* ``canonname``: the canonical name of the address, e.g.
|
| 40 |
+
``"www.python.org"``.
|
| 41 |
+
* ``sockaddr``: the socket address
|
| 42 |
+
|
| 43 |
+
This method is a coroutine which will try to establish the connection
|
| 44 |
+
in the background. When successful, the coroutine returns a
|
| 45 |
+
socket.
|
| 46 |
+
|
| 47 |
+
The expected use case is to use this method in conjunction with
|
| 48 |
+
loop.create_connection() to establish a connection to a server::
|
| 49 |
+
|
| 50 |
+
socket = await start_connection(addr_infos)
|
| 51 |
+
transport, protocol = await loop.create_connection(
|
| 52 |
+
MyProtocol, sock=socket, ...)
|
| 53 |
+
"""
|
| 54 |
+
if not (current_loop := loop):
|
| 55 |
+
current_loop = asyncio.get_running_loop()
|
| 56 |
+
|
| 57 |
+
single_addr_info = len(addr_infos) == 1
|
| 58 |
+
|
| 59 |
+
if happy_eyeballs_delay is not None and interleave is None:
|
| 60 |
+
# If using happy eyeballs, default to interleave addresses by family
|
| 61 |
+
interleave = 1
|
| 62 |
+
|
| 63 |
+
if interleave and not single_addr_info:
|
| 64 |
+
addr_infos = _interleave_addrinfos(addr_infos, interleave)
|
| 65 |
+
|
| 66 |
+
sock: Optional[socket.socket] = None
|
| 67 |
+
# uvloop can raise RuntimeError instead of OSError
|
| 68 |
+
exceptions: List[List[Union[OSError, RuntimeError]]] = []
|
| 69 |
+
if happy_eyeballs_delay is None or single_addr_info:
|
| 70 |
+
# not using happy eyeballs
|
| 71 |
+
for addrinfo in addr_infos:
|
| 72 |
+
try:
|
| 73 |
+
sock = await _connect_sock(
|
| 74 |
+
current_loop,
|
| 75 |
+
exceptions,
|
| 76 |
+
addrinfo,
|
| 77 |
+
local_addr_infos,
|
| 78 |
+
None,
|
| 79 |
+
socket_factory,
|
| 80 |
+
)
|
| 81 |
+
break
|
| 82 |
+
except (RuntimeError, OSError):
|
| 83 |
+
continue
|
| 84 |
+
else: # using happy eyeballs
|
| 85 |
+
open_sockets: Set[socket.socket] = set()
|
| 86 |
+
try:
|
| 87 |
+
sock, _, _ = await _staggered.staggered_race(
|
| 88 |
+
(
|
| 89 |
+
functools.partial(
|
| 90 |
+
_connect_sock,
|
| 91 |
+
current_loop,
|
| 92 |
+
exceptions,
|
| 93 |
+
addrinfo,
|
| 94 |
+
local_addr_infos,
|
| 95 |
+
open_sockets,
|
| 96 |
+
socket_factory,
|
| 97 |
+
)
|
| 98 |
+
for addrinfo in addr_infos
|
| 99 |
+
),
|
| 100 |
+
happy_eyeballs_delay,
|
| 101 |
+
)
|
| 102 |
+
finally:
|
| 103 |
+
# If we have a winner, staggered_race will
|
| 104 |
+
# cancel the other tasks, however there is a
|
| 105 |
+
# small race window where any of the other tasks
|
| 106 |
+
# can be done before they are cancelled which
|
| 107 |
+
# will leave the socket open. To avoid this problem
|
| 108 |
+
# we pass a set to _connect_sock to keep track of
|
| 109 |
+
# the open sockets and close them here if there
|
| 110 |
+
# are any "runner up" sockets.
|
| 111 |
+
for s in open_sockets:
|
| 112 |
+
if s is not sock:
|
| 113 |
+
with contextlib.suppress(OSError):
|
| 114 |
+
s.close()
|
| 115 |
+
open_sockets = None # type: ignore[assignment]
|
| 116 |
+
|
| 117 |
+
if sock is None:
|
| 118 |
+
all_exceptions = [exc for sub in exceptions for exc in sub]
|
| 119 |
+
try:
|
| 120 |
+
first_exception = all_exceptions[0]
|
| 121 |
+
if len(all_exceptions) == 1:
|
| 122 |
+
raise first_exception
|
| 123 |
+
else:
|
| 124 |
+
# If they all have the same str(), raise one.
|
| 125 |
+
model = str(first_exception)
|
| 126 |
+
if all(str(exc) == model for exc in all_exceptions):
|
| 127 |
+
raise first_exception
|
| 128 |
+
# Raise a combined exception so the user can see all
|
| 129 |
+
# the various error messages.
|
| 130 |
+
msg = "Multiple exceptions: {}".format(
|
| 131 |
+
", ".join(str(exc) for exc in all_exceptions)
|
| 132 |
+
)
|
| 133 |
+
# If the errno is the same for all exceptions, raise
|
| 134 |
+
# an OSError with that errno.
|
| 135 |
+
if isinstance(first_exception, OSError):
|
| 136 |
+
first_errno = first_exception.errno
|
| 137 |
+
if all(
|
| 138 |
+
isinstance(exc, OSError) and exc.errno == first_errno
|
| 139 |
+
for exc in all_exceptions
|
| 140 |
+
):
|
| 141 |
+
raise OSError(first_errno, msg)
|
| 142 |
+
elif isinstance(first_exception, RuntimeError) and all(
|
| 143 |
+
isinstance(exc, RuntimeError) for exc in all_exceptions
|
| 144 |
+
):
|
| 145 |
+
raise RuntimeError(msg)
|
| 146 |
+
# We have a mix of OSError and RuntimeError
|
| 147 |
+
# so we have to pick which one to raise.
|
| 148 |
+
# and we raise OSError for compatibility
|
| 149 |
+
raise OSError(msg)
|
| 150 |
+
finally:
|
| 151 |
+
all_exceptions = None # type: ignore[assignment]
|
| 152 |
+
exceptions = None # type: ignore[assignment]
|
| 153 |
+
|
| 154 |
+
return sock
|
| 155 |
+
|
| 156 |
+
|
| 157 |
+
async def _connect_sock(
|
| 158 |
+
loop: asyncio.AbstractEventLoop,
|
| 159 |
+
exceptions: List[List[Union[OSError, RuntimeError]]],
|
| 160 |
+
addr_info: AddrInfoType,
|
| 161 |
+
local_addr_infos: Optional[Sequence[AddrInfoType]] = None,
|
| 162 |
+
open_sockets: Optional[Set[socket.socket]] = None,
|
| 163 |
+
socket_factory: Optional[SocketFactoryType] = None,
|
| 164 |
+
) -> socket.socket:
|
| 165 |
+
"""
|
| 166 |
+
Create, bind and connect one socket.
|
| 167 |
+
|
| 168 |
+
If open_sockets is passed, add the socket to the set of open sockets.
|
| 169 |
+
Any failure caught here will remove the socket from the set and close it.
|
| 170 |
+
|
| 171 |
+
Callers can use this set to close any sockets that are not the winner
|
| 172 |
+
of all staggered tasks in the result there are runner up sockets aka
|
| 173 |
+
multiple winners.
|
| 174 |
+
"""
|
| 175 |
+
my_exceptions: List[Union[OSError, RuntimeError]] = []
|
| 176 |
+
exceptions.append(my_exceptions)
|
| 177 |
+
family, type_, proto, _, address = addr_info
|
| 178 |
+
sock = None
|
| 179 |
+
try:
|
| 180 |
+
if socket_factory is not None:
|
| 181 |
+
sock = socket_factory(addr_info)
|
| 182 |
+
else:
|
| 183 |
+
sock = socket.socket(family=family, type=type_, proto=proto)
|
| 184 |
+
if open_sockets is not None:
|
| 185 |
+
open_sockets.add(sock)
|
| 186 |
+
sock.setblocking(False)
|
| 187 |
+
if local_addr_infos is not None:
|
| 188 |
+
for lfamily, _, _, _, laddr in local_addr_infos:
|
| 189 |
+
# skip local addresses of different family
|
| 190 |
+
if lfamily != family:
|
| 191 |
+
continue
|
| 192 |
+
try:
|
| 193 |
+
sock.bind(laddr)
|
| 194 |
+
break
|
| 195 |
+
except OSError as exc:
|
| 196 |
+
msg = (
|
| 197 |
+
f"error while attempting to bind on "
|
| 198 |
+
f"address {laddr!r}: "
|
| 199 |
+
f"{(exc.strerror or '').lower()}"
|
| 200 |
+
)
|
| 201 |
+
exc = OSError(exc.errno, msg)
|
| 202 |
+
my_exceptions.append(exc)
|
| 203 |
+
else: # all bind attempts failed
|
| 204 |
+
if my_exceptions:
|
| 205 |
+
raise my_exceptions.pop()
|
| 206 |
+
else:
|
| 207 |
+
raise OSError(f"no matching local address with {family=} found")
|
| 208 |
+
await loop.sock_connect(sock, address)
|
| 209 |
+
return sock
|
| 210 |
+
except (RuntimeError, OSError) as exc:
|
| 211 |
+
my_exceptions.append(exc)
|
| 212 |
+
if sock is not None:
|
| 213 |
+
if open_sockets is not None:
|
| 214 |
+
open_sockets.remove(sock)
|
| 215 |
+
try:
|
| 216 |
+
sock.close()
|
| 217 |
+
except OSError as e:
|
| 218 |
+
my_exceptions.append(e)
|
| 219 |
+
raise
|
| 220 |
+
raise
|
| 221 |
+
except:
|
| 222 |
+
if sock is not None:
|
| 223 |
+
if open_sockets is not None:
|
| 224 |
+
open_sockets.remove(sock)
|
| 225 |
+
try:
|
| 226 |
+
sock.close()
|
| 227 |
+
except OSError as e:
|
| 228 |
+
my_exceptions.append(e)
|
| 229 |
+
raise
|
| 230 |
+
raise
|
| 231 |
+
finally:
|
| 232 |
+
exceptions = my_exceptions = None # type: ignore[assignment]
|
| 233 |
+
|
| 234 |
+
|
| 235 |
+
def _interleave_addrinfos(
|
| 236 |
+
addrinfos: Sequence[AddrInfoType], first_address_family_count: int = 1
|
| 237 |
+
) -> List[AddrInfoType]:
|
| 238 |
+
"""Interleave list of addrinfo tuples by family."""
|
| 239 |
+
# Group addresses by family
|
| 240 |
+
addrinfos_by_family: collections.OrderedDict[int, List[AddrInfoType]] = (
|
| 241 |
+
collections.OrderedDict()
|
| 242 |
+
)
|
| 243 |
+
for addr in addrinfos:
|
| 244 |
+
family = addr[0]
|
| 245 |
+
if family not in addrinfos_by_family:
|
| 246 |
+
addrinfos_by_family[family] = []
|
| 247 |
+
addrinfos_by_family[family].append(addr)
|
| 248 |
+
addrinfos_lists = list(addrinfos_by_family.values())
|
| 249 |
+
|
| 250 |
+
reordered: List[AddrInfoType] = []
|
| 251 |
+
if first_address_family_count > 1:
|
| 252 |
+
reordered.extend(addrinfos_lists[0][: first_address_family_count - 1])
|
| 253 |
+
del addrinfos_lists[0][: first_address_family_count - 1]
|
| 254 |
+
reordered.extend(
|
| 255 |
+
a
|
| 256 |
+
for a in itertools.chain.from_iterable(itertools.zip_longest(*addrinfos_lists))
|
| 257 |
+
if a is not None
|
| 258 |
+
)
|
| 259 |
+
return reordered
|
venv/lib/python3.10/site-packages/aiohappyeyeballs/py.typed
ADDED
|
File without changes
|
venv/lib/python3.10/site-packages/aiohappyeyeballs/types.py
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Types for aiohappyeyeballs."""
|
| 2 |
+
|
| 3 |
+
import socket
|
| 4 |
+
|
| 5 |
+
# PY3.9: Import Callable from typing until we drop Python 3.9 support
|
| 6 |
+
# https://github.com/python/cpython/issues/87131
|
| 7 |
+
from typing import Callable, Tuple, Union
|
| 8 |
+
|
| 9 |
+
AddrInfoType = Tuple[
|
| 10 |
+
Union[int, socket.AddressFamily],
|
| 11 |
+
Union[int, socket.SocketKind],
|
| 12 |
+
int,
|
| 13 |
+
str,
|
| 14 |
+
Tuple, # type: ignore[type-arg]
|
| 15 |
+
]
|
| 16 |
+
|
| 17 |
+
SocketFactoryType = Callable[[AddrInfoType], socket.socket]
|
venv/lib/python3.10/site-packages/aiohappyeyeballs/utils.py
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Utility functions for aiohappyeyeballs."""
|
| 2 |
+
|
| 3 |
+
import ipaddress
|
| 4 |
+
import socket
|
| 5 |
+
from typing import Dict, List, Optional, Tuple, Union
|
| 6 |
+
|
| 7 |
+
from .types import AddrInfoType
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
def addr_to_addr_infos(
|
| 11 |
+
addr: Optional[
|
| 12 |
+
Union[Tuple[str, int, int, int], Tuple[str, int, int], Tuple[str, int]]
|
| 13 |
+
],
|
| 14 |
+
) -> Optional[List[AddrInfoType]]:
|
| 15 |
+
"""Convert an address tuple to a list of addr_info tuples."""
|
| 16 |
+
if addr is None:
|
| 17 |
+
return None
|
| 18 |
+
host = addr[0]
|
| 19 |
+
port = addr[1]
|
| 20 |
+
is_ipv6 = ":" in host
|
| 21 |
+
if is_ipv6:
|
| 22 |
+
flowinfo = 0
|
| 23 |
+
scopeid = 0
|
| 24 |
+
addr_len = len(addr)
|
| 25 |
+
if addr_len >= 4:
|
| 26 |
+
scopeid = addr[3] # type: ignore[misc]
|
| 27 |
+
if addr_len >= 3:
|
| 28 |
+
flowinfo = addr[2] # type: ignore[misc]
|
| 29 |
+
addr = (host, port, flowinfo, scopeid)
|
| 30 |
+
family = socket.AF_INET6
|
| 31 |
+
else:
|
| 32 |
+
addr = (host, port)
|
| 33 |
+
family = socket.AF_INET
|
| 34 |
+
return [(family, socket.SOCK_STREAM, socket.IPPROTO_TCP, "", addr)]
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
def pop_addr_infos_interleave(
|
| 38 |
+
addr_infos: List[AddrInfoType], interleave: Optional[int] = None
|
| 39 |
+
) -> None:
|
| 40 |
+
"""
|
| 41 |
+
Pop addr_info from the list of addr_infos by family up to interleave times.
|
| 42 |
+
|
| 43 |
+
The interleave parameter is used to know how many addr_infos for
|
| 44 |
+
each family should be popped of the top of the list.
|
| 45 |
+
"""
|
| 46 |
+
seen: Dict[int, int] = {}
|
| 47 |
+
if interleave is None:
|
| 48 |
+
interleave = 1
|
| 49 |
+
to_remove: List[AddrInfoType] = []
|
| 50 |
+
for addr_info in addr_infos:
|
| 51 |
+
family = addr_info[0]
|
| 52 |
+
if family not in seen:
|
| 53 |
+
seen[family] = 0
|
| 54 |
+
if seen[family] < interleave:
|
| 55 |
+
to_remove.append(addr_info)
|
| 56 |
+
seen[family] += 1
|
| 57 |
+
for addr_info in to_remove:
|
| 58 |
+
addr_infos.remove(addr_info)
|
| 59 |
+
|
| 60 |
+
|
| 61 |
+
def _addr_tuple_to_ip_address(
|
| 62 |
+
addr: Union[Tuple[str, int], Tuple[str, int, int, int]],
|
| 63 |
+
) -> Union[
|
| 64 |
+
Tuple[ipaddress.IPv4Address, int], Tuple[ipaddress.IPv6Address, int, int, int]
|
| 65 |
+
]:
|
| 66 |
+
"""Convert an address tuple to an IPv4Address."""
|
| 67 |
+
return (ipaddress.ip_address(addr[0]), *addr[1:])
|
| 68 |
+
|
| 69 |
+
|
| 70 |
+
def remove_addr_infos(
|
| 71 |
+
addr_infos: List[AddrInfoType],
|
| 72 |
+
addr: Union[Tuple[str, int], Tuple[str, int, int, int]],
|
| 73 |
+
) -> None:
|
| 74 |
+
"""
|
| 75 |
+
Remove an address from the list of addr_infos.
|
| 76 |
+
|
| 77 |
+
The addr value is typically the return value of
|
| 78 |
+
sock.getpeername().
|
| 79 |
+
"""
|
| 80 |
+
bad_addrs_infos: List[AddrInfoType] = []
|
| 81 |
+
for addr_info in addr_infos:
|
| 82 |
+
if addr_info[-1] == addr:
|
| 83 |
+
bad_addrs_infos.append(addr_info)
|
| 84 |
+
if bad_addrs_infos:
|
| 85 |
+
for bad_addr_info in bad_addrs_infos:
|
| 86 |
+
addr_infos.remove(bad_addr_info)
|
| 87 |
+
return
|
| 88 |
+
# Slow path in case addr is formatted differently
|
| 89 |
+
match_addr = _addr_tuple_to_ip_address(addr)
|
| 90 |
+
for addr_info in addr_infos:
|
| 91 |
+
if match_addr == _addr_tuple_to_ip_address(addr_info[-1]):
|
| 92 |
+
bad_addrs_infos.append(addr_info)
|
| 93 |
+
if bad_addrs_infos:
|
| 94 |
+
for bad_addr_info in bad_addrs_infos:
|
| 95 |
+
addr_infos.remove(bad_addr_info)
|
| 96 |
+
return
|
| 97 |
+
raise ValueError(f"Address {addr} not found in addr_infos")
|
venv/lib/python3.10/site-packages/async_timeout-5.0.1.dist-info/INSTALLER
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
pip
|
venv/lib/python3.10/site-packages/async_timeout-5.0.1.dist-info/LICENSE
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Copyright 2016-2020 aio-libs collaboration.
|
| 2 |
+
|
| 3 |
+
Licensed under the Apache License, Version 2.0 (the "License");
|
| 4 |
+
you may not use this file except in compliance with the License.
|
| 5 |
+
You may obtain a copy of the License at
|
| 6 |
+
|
| 7 |
+
http://www.apache.org/licenses/LICENSE-2.0
|
| 8 |
+
|
| 9 |
+
Unless required by applicable law or agreed to in writing, software
|
| 10 |
+
distributed under the License is distributed on an "AS IS" BASIS,
|
| 11 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 12 |
+
See the License for the specific language governing permissions and
|
| 13 |
+
limitations under the License.
|
venv/lib/python3.10/site-packages/async_timeout-5.0.1.dist-info/METADATA
ADDED
|
@@ -0,0 +1,163 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Metadata-Version: 2.1
|
| 2 |
+
Name: async-timeout
|
| 3 |
+
Version: 5.0.1
|
| 4 |
+
Summary: Timeout context manager for asyncio programs
|
| 5 |
+
Home-page: https://github.com/aio-libs/async-timeout
|
| 6 |
+
Author: Andrew Svetlov <andrew.svetlov@gmail.com>
|
| 7 |
+
Author-email: andrew.svetlov@gmail.com
|
| 8 |
+
License: Apache 2
|
| 9 |
+
Project-URL: Chat: Gitter, https://gitter.im/aio-libs/Lobby
|
| 10 |
+
Project-URL: CI: GitHub Actions, https://github.com/aio-libs/async-timeout/actions
|
| 11 |
+
Project-URL: Coverage: codecov, https://codecov.io/github/aio-libs/async-timeout
|
| 12 |
+
Project-URL: GitHub: issues, https://github.com/aio-libs/async-timeout/issues
|
| 13 |
+
Project-URL: GitHub: repo, https://github.com/aio-libs/async-timeout
|
| 14 |
+
Classifier: Development Status :: 5 - Production/Stable
|
| 15 |
+
Classifier: Topic :: Software Development :: Libraries
|
| 16 |
+
Classifier: Framework :: AsyncIO
|
| 17 |
+
Classifier: Intended Audience :: Developers
|
| 18 |
+
Classifier: License :: OSI Approved :: Apache Software License
|
| 19 |
+
Classifier: Programming Language :: Python
|
| 20 |
+
Classifier: Programming Language :: Python :: 3
|
| 21 |
+
Classifier: Programming Language :: Python :: 3 :: Only
|
| 22 |
+
Requires-Python: >=3.8
|
| 23 |
+
Description-Content-Type: text/x-rst
|
| 24 |
+
License-File: LICENSE
|
| 25 |
+
|
| 26 |
+
async-timeout
|
| 27 |
+
=============
|
| 28 |
+
.. image:: https://travis-ci.com/aio-libs/async-timeout.svg?branch=master
|
| 29 |
+
:target: https://travis-ci.com/aio-libs/async-timeout
|
| 30 |
+
.. image:: https://codecov.io/gh/aio-libs/async-timeout/branch/master/graph/badge.svg
|
| 31 |
+
:target: https://codecov.io/gh/aio-libs/async-timeout
|
| 32 |
+
.. image:: https://img.shields.io/pypi/v/async-timeout.svg
|
| 33 |
+
:target: https://pypi.python.org/pypi/async-timeout
|
| 34 |
+
.. image:: https://badges.gitter.im/Join%20Chat.svg
|
| 35 |
+
:target: https://gitter.im/aio-libs/Lobby
|
| 36 |
+
:alt: Chat on Gitter
|
| 37 |
+
|
| 38 |
+
asyncio-compatible timeout context manager.
|
| 39 |
+
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
DEPRECATED
|
| 43 |
+
----------
|
| 44 |
+
|
| 45 |
+
This library has effectively been upstreamed into Python 3.11+.
|
| 46 |
+
|
| 47 |
+
Therefore this library is considered deprecated and no longer actively supported.
|
| 48 |
+
|
| 49 |
+
Version 5.0+ provides dual-mode when executed on Python 3.11+:
|
| 50 |
+
``asyncio_timeout.Timeout`` is fully compatible with ``asyncio.Timeout`` *and* old
|
| 51 |
+
versions of the library.
|
| 52 |
+
|
| 53 |
+
Anyway, using upstream is highly recommended. ``asyncio_timeout`` exists only for the
|
| 54 |
+
sake of backward compatibility, easy supporting both old and new Python by the same
|
| 55 |
+
code, and easy misgration.
|
| 56 |
+
|
| 57 |
+
If rescheduling API is not important and only ``async with timeout(...): ...`` functionality is required,
|
| 58 |
+
a user could apply conditional import::
|
| 59 |
+
|
| 60 |
+
if sys.version_info >= (3, 11):
|
| 61 |
+
from asyncio import timeout, timeout_at
|
| 62 |
+
else:
|
| 63 |
+
from async_timeout import timeout, timeout_at
|
| 64 |
+
|
| 65 |
+
|
| 66 |
+
Usage example
|
| 67 |
+
-------------
|
| 68 |
+
|
| 69 |
+
|
| 70 |
+
The context manager is useful in cases when you want to apply timeout
|
| 71 |
+
logic around block of code or in cases when ``asyncio.wait_for()`` is
|
| 72 |
+
not suitable. Also it's much faster than ``asyncio.wait_for()``
|
| 73 |
+
because ``timeout`` doesn't create a new task.
|
| 74 |
+
|
| 75 |
+
The ``timeout(delay, *, loop=None)`` call returns a context manager
|
| 76 |
+
that cancels a block on *timeout* expiring::
|
| 77 |
+
|
| 78 |
+
from async_timeout import timeout
|
| 79 |
+
async with timeout(1.5):
|
| 80 |
+
await inner()
|
| 81 |
+
|
| 82 |
+
1. If ``inner()`` is executed faster than in ``1.5`` seconds nothing
|
| 83 |
+
happens.
|
| 84 |
+
2. Otherwise ``inner()`` is cancelled internally by sending
|
| 85 |
+
``asyncio.CancelledError`` into but ``asyncio.TimeoutError`` is
|
| 86 |
+
raised outside of context manager scope.
|
| 87 |
+
|
| 88 |
+
*timeout* parameter could be ``None`` for skipping timeout functionality.
|
| 89 |
+
|
| 90 |
+
|
| 91 |
+
Alternatively, ``timeout_at(when)`` can be used for scheduling
|
| 92 |
+
at the absolute time::
|
| 93 |
+
|
| 94 |
+
loop = asyncio.get_event_loop()
|
| 95 |
+
now = loop.time()
|
| 96 |
+
|
| 97 |
+
async with timeout_at(now + 1.5):
|
| 98 |
+
await inner()
|
| 99 |
+
|
| 100 |
+
|
| 101 |
+
Please note: it is not POSIX time but a time with
|
| 102 |
+
undefined starting base, e.g. the time of the system power on.
|
| 103 |
+
|
| 104 |
+
|
| 105 |
+
Context manager has ``.expired()`` / ``.expired`` for check if timeout happens
|
| 106 |
+
exactly in context manager::
|
| 107 |
+
|
| 108 |
+
async with timeout(1.5) as cm:
|
| 109 |
+
await inner()
|
| 110 |
+
print(cm.expired()) # recommended api
|
| 111 |
+
print(cm.expired) # compatible api
|
| 112 |
+
|
| 113 |
+
The property is ``True`` if ``inner()`` execution is cancelled by
|
| 114 |
+
timeout context manager.
|
| 115 |
+
|
| 116 |
+
If ``inner()`` call explicitly raises ``TimeoutError`` ``cm.expired``
|
| 117 |
+
is ``False``.
|
| 118 |
+
|
| 119 |
+
The scheduled deadline time is available as ``.when()`` / ``.deadline``::
|
| 120 |
+
|
| 121 |
+
async with timeout(1.5) as cm:
|
| 122 |
+
cm.when() # recommended api
|
| 123 |
+
cm.deadline # compatible api
|
| 124 |
+
|
| 125 |
+
Not finished yet timeout can be rescheduled by ``shift()``
|
| 126 |
+
or ``update()`` methods::
|
| 127 |
+
|
| 128 |
+
async with timeout(1.5) as cm:
|
| 129 |
+
# recommended api
|
| 130 |
+
cm.reschedule(cm.when() + 1) # add another second on waiting
|
| 131 |
+
# compatible api
|
| 132 |
+
cm.shift(1) # add another second on waiting
|
| 133 |
+
cm.update(loop.time() + 5) # reschedule to now+5 seconds
|
| 134 |
+
|
| 135 |
+
Rescheduling is forbidden if the timeout is expired or after exit from ``async with``
|
| 136 |
+
code block.
|
| 137 |
+
|
| 138 |
+
|
| 139 |
+
Disable scheduled timeout::
|
| 140 |
+
|
| 141 |
+
async with timeout(1.5) as cm:
|
| 142 |
+
cm.reschedule(None) # recommended api
|
| 143 |
+
cm.reject() # compatible api
|
| 144 |
+
|
| 145 |
+
|
| 146 |
+
|
| 147 |
+
Installation
|
| 148 |
+
------------
|
| 149 |
+
|
| 150 |
+
::
|
| 151 |
+
|
| 152 |
+
$ pip install async-timeout
|
| 153 |
+
|
| 154 |
+
The library is Python 3 only!
|
| 155 |
+
|
| 156 |
+
|
| 157 |
+
|
| 158 |
+
Authors and License
|
| 159 |
+
-------------------
|
| 160 |
+
|
| 161 |
+
The module is written by Andrew Svetlov.
|
| 162 |
+
|
| 163 |
+
It's *Apache 2* licensed and freely available.
|
venv/lib/python3.10/site-packages/async_timeout-5.0.1.dist-info/RECORD
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
async_timeout-5.0.1.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
|
| 2 |
+
async_timeout-5.0.1.dist-info/LICENSE,sha256=4Y17uPUT4sRrtYXJS1hb0wcg3TzLId2weG9y0WZY-Sw,568
|
| 3 |
+
async_timeout-5.0.1.dist-info/METADATA,sha256=RVDNEIPYIBJKPsjThJDaKRX1h79-4QYQNuBLSXPItU8,5131
|
| 4 |
+
async_timeout-5.0.1.dist-info/RECORD,,
|
| 5 |
+
async_timeout-5.0.1.dist-info/WHEEL,sha256=P9jw-gEje8ByB7_hXoICnHtVCrEwMQh-630tKvQWehc,91
|
| 6 |
+
async_timeout-5.0.1.dist-info/top_level.txt,sha256=9oM4e7Twq8iD_7_Q3Mz0E6GPIB6vJvRFo-UBwUQtBDU,14
|
| 7 |
+
async_timeout-5.0.1.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
| 8 |
+
async_timeout/__init__.py,sha256=QF0zpfX1vGmxib7kAqNPm9YehPV0oBVozxJ--Mxq9dI,9186
|
| 9 |
+
async_timeout/__pycache__/__init__.cpython-310.pyc,,
|
| 10 |
+
async_timeout/py.typed,sha256=tyozzRT1fziXETDxokmuyt6jhOmtjUbnVNJdZcG7ik0,12
|
venv/lib/python3.10/site-packages/async_timeout-5.0.1.dist-info/WHEEL
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Wheel-Version: 1.0
|
| 2 |
+
Generator: setuptools (75.3.0)
|
| 3 |
+
Root-Is-Purelib: true
|
| 4 |
+
Tag: py3-none-any
|
| 5 |
+
|
venv/lib/python3.10/site-packages/async_timeout-5.0.1.dist-info/top_level.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
async_timeout
|
venv/lib/python3.10/site-packages/async_timeout-5.0.1.dist-info/zip-safe
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
|
venv/lib/python3.10/site-packages/attrs-25.3.0.dist-info/INSTALLER
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
pip
|
venv/lib/python3.10/site-packages/attrs-25.3.0.dist-info/RECORD
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
attr/__init__.py,sha256=fOYIvt1eGSqQre4uCS3sJWKZ0mwAuC8UD6qba5OS9_U,2057
|
| 2 |
+
attr/__init__.pyi,sha256=QIXnnHPoucmDWkbpNsWTP-cgJ1bn8le7DjyRa_wYdew,11281
|
| 3 |
+
attr/__pycache__/__init__.cpython-310.pyc,,
|
| 4 |
+
attr/__pycache__/_cmp.cpython-310.pyc,,
|
| 5 |
+
attr/__pycache__/_compat.cpython-310.pyc,,
|
| 6 |
+
attr/__pycache__/_config.cpython-310.pyc,,
|
| 7 |
+
attr/__pycache__/_funcs.cpython-310.pyc,,
|
| 8 |
+
attr/__pycache__/_make.cpython-310.pyc,,
|
| 9 |
+
attr/__pycache__/_next_gen.cpython-310.pyc,,
|
| 10 |
+
attr/__pycache__/_version_info.cpython-310.pyc,,
|
| 11 |
+
attr/__pycache__/converters.cpython-310.pyc,,
|
| 12 |
+
attr/__pycache__/exceptions.cpython-310.pyc,,
|
| 13 |
+
attr/__pycache__/filters.cpython-310.pyc,,
|
| 14 |
+
attr/__pycache__/setters.cpython-310.pyc,,
|
| 15 |
+
attr/__pycache__/validators.cpython-310.pyc,,
|
| 16 |
+
attr/_cmp.py,sha256=3Nn1TjxllUYiX_nJoVnEkXoDk0hM1DYKj5DE7GZe4i0,4117
|
| 17 |
+
attr/_cmp.pyi,sha256=U-_RU_UZOyPUEQzXE6RMYQQcjkZRY25wTH99sN0s7MM,368
|
| 18 |
+
attr/_compat.py,sha256=4hlXbWhdDjQCDK6FKF1EgnZ3POiHgtpp54qE0nxaGHg,2704
|
| 19 |
+
attr/_config.py,sha256=dGq3xR6fgZEF6UBt_L0T-eUHIB4i43kRmH0P28sJVw8,843
|
| 20 |
+
attr/_funcs.py,sha256=5-tUKJtp3h5El55EcDl6GWXFp68fT8D8U7uCRN6497I,15854
|
| 21 |
+
attr/_make.py,sha256=lBUPPmxiA1BeHzB6OlHoCEh--tVvM1ozXO8eXOa6g4c,96664
|
| 22 |
+
attr/_next_gen.py,sha256=7FRkbtl_N017SuBhf_Vw3mw2c2pGZhtCGOzadgz7tp4,24395
|
| 23 |
+
attr/_typing_compat.pyi,sha256=XDP54TUn-ZKhD62TOQebmzrwFyomhUCoGRpclb6alRA,469
|
| 24 |
+
attr/_version_info.py,sha256=exSqb3b5E-fMSsgZAlEw9XcLpEgobPORCZpcaEglAM4,2121
|
| 25 |
+
attr/_version_info.pyi,sha256=x_M3L3WuB7r_ULXAWjx959udKQ4HLB8l-hsc1FDGNvk,209
|
| 26 |
+
attr/converters.py,sha256=GlDeOzPeTFgeBBLbj9G57Ez5lAk68uhSALRYJ_exe84,3861
|
| 27 |
+
attr/converters.pyi,sha256=orU2bff-VjQa2kMDyvnMQV73oJT2WRyQuw4ZR1ym1bE,643
|
| 28 |
+
attr/exceptions.py,sha256=HRFq4iybmv7-DcZwyjl6M1euM2YeJVK_hFxuaBGAngI,1977
|
| 29 |
+
attr/exceptions.pyi,sha256=zZq8bCUnKAy9mDtBEw42ZhPhAUIHoTKedDQInJD883M,539
|
| 30 |
+
attr/filters.py,sha256=ZBiKWLp3R0LfCZsq7X11pn9WX8NslS2wXM4jsnLOGc8,1795
|
| 31 |
+
attr/filters.pyi,sha256=3J5BG-dTxltBk1_-RuNRUHrv2qu1v8v4aDNAQ7_mifA,208
|
| 32 |
+
attr/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
| 33 |
+
attr/setters.py,sha256=5-dcT63GQK35ONEzSgfXCkbB7pPkaR-qv15mm4PVSzQ,1617
|
| 34 |
+
attr/setters.pyi,sha256=NnVkaFU1BB4JB8E4JuXyrzTUgvtMpj8p3wBdJY7uix4,584
|
| 35 |
+
attr/validators.py,sha256=WaB1HLAHHqRHWsrv_K9H-sJ7ESil3H3Cmv2d8TtVZx4,20046
|
| 36 |
+
attr/validators.pyi,sha256=s2WhKPqskxbsckJfKk8zOuuB088GfgpyxcCYSNFLqNU,2603
|
| 37 |
+
attrs-25.3.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
|
| 38 |
+
attrs-25.3.0.dist-info/METADATA,sha256=W38cREj7s1wqNf1fg4hVwZmL1xh0AdSp4IhtTMROinw,10993
|
| 39 |
+
attrs-25.3.0.dist-info/RECORD,,
|
| 40 |
+
attrs-25.3.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
| 41 |
+
attrs-25.3.0.dist-info/licenses/LICENSE,sha256=iCEVyV38KvHutnFPjsbVy8q_Znyv-HKfQkINpj9xTp8,1109
|
| 42 |
+
attrs/__init__.py,sha256=qeQJZ4O08yczSn840v9bYOaZyRE81WsVi-QCrY3krCU,1107
|
| 43 |
+
attrs/__init__.pyi,sha256=nZmInocjM7tHV4AQw0vxO_fo6oJjL_PonlV9zKKW8DY,7931
|
| 44 |
+
attrs/__pycache__/__init__.cpython-310.pyc,,
|
| 45 |
+
attrs/__pycache__/converters.cpython-310.pyc,,
|
| 46 |
+
attrs/__pycache__/exceptions.cpython-310.pyc,,
|
| 47 |
+
attrs/__pycache__/filters.cpython-310.pyc,,
|
| 48 |
+
attrs/__pycache__/setters.cpython-310.pyc,,
|
| 49 |
+
attrs/__pycache__/validators.cpython-310.pyc,,
|
| 50 |
+
attrs/converters.py,sha256=8kQljrVwfSTRu8INwEk8SI0eGrzmWftsT7rM0EqyohM,76
|
| 51 |
+
attrs/exceptions.py,sha256=ACCCmg19-vDFaDPY9vFl199SPXCQMN_bENs4DALjzms,76
|
| 52 |
+
attrs/filters.py,sha256=VOUMZug9uEU6dUuA0dF1jInUK0PL3fLgP0VBS5d-CDE,73
|
| 53 |
+
attrs/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
| 54 |
+
attrs/setters.py,sha256=eL1YidYQV3T2h9_SYIZSZR1FAcHGb1TuCTy0E0Lv2SU,73
|
| 55 |
+
attrs/validators.py,sha256=xcy6wD5TtTkdCG1f4XWbocPSO0faBjk5IfVJfP6SUj0,76
|
venv/lib/python3.10/site-packages/attrs-25.3.0.dist-info/licenses/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
The MIT License (MIT)
|
| 2 |
+
|
| 3 |
+
Copyright (c) 2015 Hynek Schlawack and the attrs contributors
|
| 4 |
+
|
| 5 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 6 |
+
of this software and associated documentation files (the "Software"), to deal
|
| 7 |
+
in the Software without restriction, including without limitation the rights
|
| 8 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
| 9 |
+
copies of the Software, and to permit persons to whom the Software is
|
| 10 |
+
furnished to do so, subject to the following conditions:
|
| 11 |
+
|
| 12 |
+
The above copyright notice and this permission notice shall be included in all
|
| 13 |
+
copies or substantial portions of the Software.
|
| 14 |
+
|
| 15 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 16 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 17 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 18 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 19 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 20 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
| 21 |
+
SOFTWARE.
|
venv/lib/python3.10/site-packages/chardet/__pycache__/gb2312prober.cpython-310.pyc
ADDED
|
Binary file (1.22 kB). View file
|
|
|
venv/lib/python3.10/site-packages/chardet/__pycache__/hebrewprober.cpython-310.pyc
ADDED
|
Binary file (3.47 kB). View file
|
|
|
venv/lib/python3.10/site-packages/chardet/__pycache__/jisfreq.cpython-310.pyc
ADDED
|
Binary file (22.2 kB). View file
|
|
|
venv/lib/python3.10/site-packages/chardet/__pycache__/johabprober.cpython-310.pyc
ADDED
|
Binary file (1.22 kB). View file
|
|
|
venv/lib/python3.10/site-packages/chardet/__pycache__/jpcntx.cpython-310.pyc
ADDED
|
Binary file (38 kB). View file
|
|
|
venv/lib/python3.10/site-packages/chardet/__pycache__/langbulgarianmodel.cpython-310.pyc
ADDED
|
Binary file (48 kB). View file
|
|
|
venv/lib/python3.10/site-packages/chardet/__pycache__/langgreekmodel.cpython-310.pyc
ADDED
|
Binary file (46.2 kB). View file
|
|
|
venv/lib/python3.10/site-packages/chardet/__pycache__/langhebrewmodel.cpython-310.pyc
ADDED
|
Binary file (44.6 kB). View file
|
|
|
venv/lib/python3.10/site-packages/chardet/__pycache__/langhungarianmodel.cpython-310.pyc
ADDED
|
Binary file (47.9 kB). View file
|
|
|
venv/lib/python3.10/site-packages/chardet/__pycache__/langrussianmodel.cpython-310.pyc
ADDED
|
Binary file (61.1 kB). View file
|
|
|
venv/lib/python3.10/site-packages/chardet/__pycache__/langthaimodel.cpython-310.pyc
ADDED
|
Binary file (44.8 kB). View file
|
|
|
venv/lib/python3.10/site-packages/chardet/__pycache__/langturkishmodel.cpython-310.pyc
ADDED
|
Binary file (44.6 kB). View file
|
|
|
venv/lib/python3.10/site-packages/chardet/__pycache__/latin1prober.cpython-310.pyc
ADDED
|
Binary file (4.61 kB). View file
|
|
|
venv/lib/python3.10/site-packages/chardet/__pycache__/macromanprober.cpython-310.pyc
ADDED
|
Binary file (4.76 kB). View file
|
|
|
venv/lib/python3.10/site-packages/chardet/__pycache__/mbcharsetprober.cpython-310.pyc
ADDED
|
Binary file (2.36 kB). View file
|
|
|
venv/lib/python3.10/site-packages/chardet/__pycache__/mbcsgroupprober.cpython-310.pyc
ADDED
|
Binary file (1.31 kB). View file
|
|
|
venv/lib/python3.10/site-packages/chardet/__pycache__/mbcssm.cpython-310.pyc
ADDED
|
Binary file (21 kB). View file
|
|
|
venv/lib/python3.10/site-packages/chardet/__pycache__/resultdict.cpython-310.pyc
ADDED
|
Binary file (627 Bytes). View file
|
|
|
venv/lib/python3.10/site-packages/chardet/__pycache__/sbcharsetprober.cpython-310.pyc
ADDED
|
Binary file (3.73 kB). View file
|
|
|
venv/lib/python3.10/site-packages/chardet/__pycache__/sbcsgroupprober.cpython-310.pyc
ADDED
|
Binary file (1.79 kB). View file
|
|
|
venv/lib/python3.10/site-packages/chardet/__pycache__/sjisprober.cpython-310.pyc
ADDED
|
Binary file (2.69 kB). View file
|
|
|
venv/lib/python3.10/site-packages/chardet/__pycache__/universaldetector.cpython-310.pyc
ADDED
|
Binary file (7.18 kB). View file
|
|
|
venv/lib/python3.10/site-packages/chardet/__pycache__/utf1632prober.cpython-310.pyc
ADDED
|
Binary file (6.15 kB). View file
|
|
|
venv/lib/python3.10/site-packages/chardet/__pycache__/utf8prober.cpython-310.pyc
ADDED
|
Binary file (2.16 kB). View file
|
|
|
venv/lib/python3.10/site-packages/chardet/__pycache__/version.cpython-310.pyc
ADDED
|
Binary file (492 Bytes). View file
|
|
|
venv/lib/python3.10/site-packages/nltk/VERSION
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
3.9.1
|
venv/lib/python3.10/site-packages/nltk/__init__.py
ADDED
|
@@ -0,0 +1,209 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Natural Language Toolkit (NLTK)
|
| 2 |
+
#
|
| 3 |
+
# Copyright (C) 2001-2024 NLTK Project
|
| 4 |
+
# Authors: Steven Bird <stevenbird1@gmail.com>
|
| 5 |
+
# Edward Loper <edloper@gmail.com>
|
| 6 |
+
# URL: <https://www.nltk.org/>
|
| 7 |
+
# For license information, see LICENSE.TXT
|
| 8 |
+
|
| 9 |
+
"""
|
| 10 |
+
The Natural Language Toolkit (NLTK) is an open source Python library
|
| 11 |
+
for Natural Language Processing. A free online book is available.
|
| 12 |
+
(If you use the library for academic research, please cite the book.)
|
| 13 |
+
|
| 14 |
+
Steven Bird, Ewan Klein, and Edward Loper (2009).
|
| 15 |
+
Natural Language Processing with Python. O'Reilly Media Inc.
|
| 16 |
+
https://www.nltk.org/book/
|
| 17 |
+
|
| 18 |
+
isort:skip_file
|
| 19 |
+
"""
|
| 20 |
+
|
| 21 |
+
import os
|
| 22 |
+
|
| 23 |
+
# //////////////////////////////////////////////////////
|
| 24 |
+
# Metadata
|
| 25 |
+
# //////////////////////////////////////////////////////
|
| 26 |
+
|
| 27 |
+
# Version. For each new release, the version number should be updated
|
| 28 |
+
# in the file VERSION.
|
| 29 |
+
try:
|
| 30 |
+
# If a VERSION file exists, use it!
|
| 31 |
+
version_file = os.path.join(os.path.dirname(__file__), "VERSION")
|
| 32 |
+
with open(version_file) as infile:
|
| 33 |
+
__version__ = infile.read().strip()
|
| 34 |
+
except NameError:
|
| 35 |
+
__version__ = "unknown (running code interactively?)"
|
| 36 |
+
except OSError as ex:
|
| 37 |
+
__version__ = "unknown (%s)" % ex
|
| 38 |
+
|
| 39 |
+
if __doc__ is not None: # fix for the ``python -OO``
|
| 40 |
+
__doc__ += "\n@version: " + __version__
|
| 41 |
+
|
| 42 |
+
|
| 43 |
+
# Copyright notice
|
| 44 |
+
__copyright__ = """\
|
| 45 |
+
Copyright (C) 2001-2024 NLTK Project.
|
| 46 |
+
|
| 47 |
+
Distributed and Licensed under the Apache License, Version 2.0,
|
| 48 |
+
which is included by reference.
|
| 49 |
+
"""
|
| 50 |
+
|
| 51 |
+
__license__ = "Apache License, Version 2.0"
|
| 52 |
+
# Description of the toolkit, keywords, and the project's primary URL.
|
| 53 |
+
__longdescr__ = """\
|
| 54 |
+
The Natural Language Toolkit (NLTK) is a Python package for
|
| 55 |
+
natural language processing. NLTK requires Python 3.8, 3.9, 3.10, 3.11 or 3.12."""
|
| 56 |
+
__keywords__ = [
|
| 57 |
+
"NLP",
|
| 58 |
+
"CL",
|
| 59 |
+
"natural language processing",
|
| 60 |
+
"computational linguistics",
|
| 61 |
+
"parsing",
|
| 62 |
+
"tagging",
|
| 63 |
+
"tokenizing",
|
| 64 |
+
"syntax",
|
| 65 |
+
"linguistics",
|
| 66 |
+
"language",
|
| 67 |
+
"natural language",
|
| 68 |
+
"text analytics",
|
| 69 |
+
]
|
| 70 |
+
__url__ = "https://www.nltk.org/"
|
| 71 |
+
|
| 72 |
+
# Maintainer, contributors, etc.
|
| 73 |
+
__maintainer__ = "NLTK Team"
|
| 74 |
+
__maintainer_email__ = "nltk.team@gmail.com"
|
| 75 |
+
__author__ = __maintainer__
|
| 76 |
+
__author_email__ = __maintainer_email__
|
| 77 |
+
|
| 78 |
+
# "Trove" classifiers for Python Package Index.
|
| 79 |
+
__classifiers__ = [
|
| 80 |
+
"Development Status :: 5 - Production/Stable",
|
| 81 |
+
"Intended Audience :: Developers",
|
| 82 |
+
"Intended Audience :: Education",
|
| 83 |
+
"Intended Audience :: Information Technology",
|
| 84 |
+
"Intended Audience :: Science/Research",
|
| 85 |
+
"License :: OSI Approved :: Apache Software License",
|
| 86 |
+
"Operating System :: OS Independent",
|
| 87 |
+
"Programming Language :: Python :: 3.8",
|
| 88 |
+
"Programming Language :: Python :: 3.9",
|
| 89 |
+
"Programming Language :: Python :: 3.10",
|
| 90 |
+
"Programming Language :: Python :: 3.11",
|
| 91 |
+
"Programming Language :: Python :: 3.12",
|
| 92 |
+
"Topic :: Scientific/Engineering",
|
| 93 |
+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
| 94 |
+
"Topic :: Scientific/Engineering :: Human Machine Interfaces",
|
| 95 |
+
"Topic :: Scientific/Engineering :: Information Analysis",
|
| 96 |
+
"Topic :: Text Processing",
|
| 97 |
+
"Topic :: Text Processing :: Filters",
|
| 98 |
+
"Topic :: Text Processing :: General",
|
| 99 |
+
"Topic :: Text Processing :: Indexing",
|
| 100 |
+
"Topic :: Text Processing :: Linguistic",
|
| 101 |
+
]
|
| 102 |
+
|
| 103 |
+
from nltk.internals import config_java
|
| 104 |
+
|
| 105 |
+
# support numpy from pypy
|
| 106 |
+
try:
|
| 107 |
+
import numpypy
|
| 108 |
+
except ImportError:
|
| 109 |
+
pass
|
| 110 |
+
|
| 111 |
+
# Override missing methods on environments where it cannot be used like GAE.
|
| 112 |
+
import subprocess
|
| 113 |
+
|
| 114 |
+
if not hasattr(subprocess, "PIPE"):
|
| 115 |
+
|
| 116 |
+
def _fake_PIPE(*args, **kwargs):
|
| 117 |
+
raise NotImplementedError("subprocess.PIPE is not supported.")
|
| 118 |
+
|
| 119 |
+
subprocess.PIPE = _fake_PIPE
|
| 120 |
+
if not hasattr(subprocess, "Popen"):
|
| 121 |
+
|
| 122 |
+
def _fake_Popen(*args, **kwargs):
|
| 123 |
+
raise NotImplementedError("subprocess.Popen is not supported.")
|
| 124 |
+
|
| 125 |
+
subprocess.Popen = _fake_Popen
|
| 126 |
+
|
| 127 |
+
###########################################################
|
| 128 |
+
# TOP-LEVEL MODULES
|
| 129 |
+
###########################################################
|
| 130 |
+
|
| 131 |
+
# Import top-level functionality into top-level namespace
|
| 132 |
+
|
| 133 |
+
from nltk.collocations import *
|
| 134 |
+
from nltk.decorators import decorator, memoize
|
| 135 |
+
from nltk.featstruct import *
|
| 136 |
+
from nltk.grammar import *
|
| 137 |
+
from nltk.probability import *
|
| 138 |
+
from nltk.text import *
|
| 139 |
+
from nltk.util import *
|
| 140 |
+
from nltk.jsontags import *
|
| 141 |
+
|
| 142 |
+
###########################################################
|
| 143 |
+
# PACKAGES
|
| 144 |
+
###########################################################
|
| 145 |
+
|
| 146 |
+
from nltk.chunk import *
|
| 147 |
+
from nltk.classify import *
|
| 148 |
+
from nltk.inference import *
|
| 149 |
+
from nltk.metrics import *
|
| 150 |
+
from nltk.parse import *
|
| 151 |
+
from nltk.tag import *
|
| 152 |
+
from nltk.tokenize import *
|
| 153 |
+
from nltk.translate import *
|
| 154 |
+
from nltk.tree import *
|
| 155 |
+
from nltk.sem import *
|
| 156 |
+
from nltk.stem import *
|
| 157 |
+
|
| 158 |
+
# Packages which can be lazily imported
|
| 159 |
+
# (a) we don't import *
|
| 160 |
+
# (b) they're slow to import or have run-time dependencies
|
| 161 |
+
# that can safely fail at run time
|
| 162 |
+
|
| 163 |
+
from nltk import lazyimport
|
| 164 |
+
|
| 165 |
+
app = lazyimport.LazyModule("app", locals(), globals())
|
| 166 |
+
chat = lazyimport.LazyModule("chat", locals(), globals())
|
| 167 |
+
corpus = lazyimport.LazyModule("corpus", locals(), globals())
|
| 168 |
+
draw = lazyimport.LazyModule("draw", locals(), globals())
|
| 169 |
+
toolbox = lazyimport.LazyModule("toolbox", locals(), globals())
|
| 170 |
+
|
| 171 |
+
# Optional loading
|
| 172 |
+
|
| 173 |
+
try:
|
| 174 |
+
import numpy
|
| 175 |
+
except ImportError:
|
| 176 |
+
pass
|
| 177 |
+
else:
|
| 178 |
+
from nltk import cluster
|
| 179 |
+
|
| 180 |
+
from nltk.downloader import download, download_shell
|
| 181 |
+
|
| 182 |
+
try:
|
| 183 |
+
import tkinter
|
| 184 |
+
except ImportError:
|
| 185 |
+
pass
|
| 186 |
+
else:
|
| 187 |
+
try:
|
| 188 |
+
from nltk.downloader import download_gui
|
| 189 |
+
except RuntimeError as e:
|
| 190 |
+
import warnings
|
| 191 |
+
|
| 192 |
+
warnings.warn(
|
| 193 |
+
"Corpus downloader GUI not loaded "
|
| 194 |
+
"(RuntimeError during import: %s)" % str(e)
|
| 195 |
+
)
|
| 196 |
+
|
| 197 |
+
# explicitly import all top-level modules (ensuring
|
| 198 |
+
# they override the same names inadvertently imported
|
| 199 |
+
# from a subpackage)
|
| 200 |
+
|
| 201 |
+
from nltk import ccg, chunk, classify, collocations
|
| 202 |
+
from nltk import data, featstruct, grammar, help, inference, metrics
|
| 203 |
+
from nltk import misc, parse, probability, sem, stem, wsd
|
| 204 |
+
from nltk import tag, tbl, text, tokenize, translate, tree, util
|
| 205 |
+
|
| 206 |
+
|
| 207 |
+
# FIXME: override any accidentally imported demo, see https://github.com/nltk/nltk/issues/2116
|
| 208 |
+
def demo():
|
| 209 |
+
print("To run the demo code for a module, type nltk.module.demo()")
|
venv/lib/python3.10/site-packages/nltk/app/__pycache__/__init__.cpython-310.pyc
ADDED
|
Binary file (1.4 kB). View file
|
|
|
venv/lib/python3.10/site-packages/nltk/app/__pycache__/chartparser_app.cpython-310.pyc
ADDED
|
Binary file (62.6 kB). View file
|
|
|