danki2meme commited on
Commit
c8b361b
·
verified ·
1 Parent(s): ab6f387

Upload folder using huggingface_hub

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +34 -0
  2. .venv/.gitignore +2 -0
  3. .venv/Lib/site-packages/__pycache__/typing_extensions.cpython-313.pyc +3 -0
  4. .venv/Lib/site-packages/_yaml/__init__.py +33 -0
  5. .venv/Lib/site-packages/_yaml/__pycache__/__init__.cpython-313.pyc +0 -0
  6. .venv/Lib/site-packages/annotated_doc-0.0.4.dist-info/INSTALLER +1 -0
  7. .venv/Lib/site-packages/annotated_doc-0.0.4.dist-info/METADATA +145 -0
  8. .venv/Lib/site-packages/annotated_doc-0.0.4.dist-info/RECORD +11 -0
  9. .venv/Lib/site-packages/annotated_doc-0.0.4.dist-info/WHEEL +4 -0
  10. .venv/Lib/site-packages/annotated_doc-0.0.4.dist-info/entry_points.txt +4 -0
  11. .venv/Lib/site-packages/annotated_doc-0.0.4.dist-info/licenses/LICENSE +21 -0
  12. .venv/Lib/site-packages/annotated_doc/__init__.py +3 -0
  13. .venv/Lib/site-packages/annotated_doc/__pycache__/__init__.cpython-313.pyc +0 -0
  14. .venv/Lib/site-packages/annotated_doc/__pycache__/main.cpython-313.pyc +0 -0
  15. .venv/Lib/site-packages/annotated_doc/main.py +36 -0
  16. .venv/Lib/site-packages/annotated_doc/py.typed +0 -0
  17. .venv/Lib/site-packages/anyio-4.12.1.dist-info/INSTALLER +1 -0
  18. .venv/Lib/site-packages/anyio-4.12.1.dist-info/METADATA +96 -0
  19. .venv/Lib/site-packages/anyio-4.12.1.dist-info/RECORD +92 -0
  20. .venv/Lib/site-packages/anyio-4.12.1.dist-info/WHEEL +5 -0
  21. .venv/Lib/site-packages/anyio-4.12.1.dist-info/entry_points.txt +2 -0
  22. .venv/Lib/site-packages/anyio-4.12.1.dist-info/licenses/LICENSE +20 -0
  23. .venv/Lib/site-packages/anyio-4.12.1.dist-info/top_level.txt +1 -0
  24. .venv/Lib/site-packages/anyio/__init__.py +111 -0
  25. .venv/Lib/site-packages/anyio/__pycache__/__init__.cpython-313.pyc +0 -0
  26. .venv/Lib/site-packages/anyio/__pycache__/from_thread.cpython-313.pyc +0 -0
  27. .venv/Lib/site-packages/anyio/__pycache__/functools.cpython-313.pyc +0 -0
  28. .venv/Lib/site-packages/anyio/__pycache__/lowlevel.cpython-313.pyc +0 -0
  29. .venv/Lib/site-packages/anyio/__pycache__/pytest_plugin.cpython-313.pyc +0 -0
  30. .venv/Lib/site-packages/anyio/__pycache__/to_interpreter.cpython-313.pyc +0 -0
  31. .venv/Lib/site-packages/anyio/__pycache__/to_process.cpython-313.pyc +0 -0
  32. .venv/Lib/site-packages/anyio/__pycache__/to_thread.cpython-313.pyc +0 -0
  33. .venv/Lib/site-packages/anyio/_backends/__init__.py +0 -0
  34. .venv/Lib/site-packages/anyio/_backends/__pycache__/__init__.cpython-313.pyc +0 -0
  35. .venv/Lib/site-packages/anyio/_backends/__pycache__/_asyncio.cpython-313.pyc +3 -0
  36. .venv/Lib/site-packages/anyio/_backends/__pycache__/_trio.cpython-313.pyc +0 -0
  37. .venv/Lib/site-packages/anyio/_backends/_asyncio.py +0 -0
  38. .venv/Lib/site-packages/anyio/_backends/_trio.py +1346 -0
  39. .venv/Lib/site-packages/anyio/_core/__init__.py +0 -0
  40. .venv/Lib/site-packages/anyio/_core/__pycache__/__init__.cpython-313.pyc +0 -0
  41. .venv/Lib/site-packages/anyio/_core/__pycache__/_asyncio_selector_thread.cpython-313.pyc +0 -0
  42. .venv/Lib/site-packages/anyio/_core/__pycache__/_contextmanagers.cpython-313.pyc +0 -0
  43. .venv/Lib/site-packages/anyio/_core/__pycache__/_eventloop.cpython-313.pyc +0 -0
  44. .venv/Lib/site-packages/anyio/_core/__pycache__/_exceptions.cpython-313.pyc +0 -0
  45. .venv/Lib/site-packages/anyio/_core/__pycache__/_fileio.cpython-313.pyc +0 -0
  46. .venv/Lib/site-packages/anyio/_core/__pycache__/_resources.cpython-313.pyc +0 -0
  47. .venv/Lib/site-packages/anyio/_core/__pycache__/_signals.cpython-313.pyc +0 -0
  48. .venv/Lib/site-packages/anyio/_core/__pycache__/_sockets.cpython-313.pyc +0 -0
  49. .venv/Lib/site-packages/anyio/_core/__pycache__/_streams.cpython-313.pyc +0 -0
  50. .venv/Lib/site-packages/anyio/_core/__pycache__/_subprocesses.cpython-313.pyc +0 -0
.gitattributes CHANGED
@@ -58,3 +58,37 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
58
  # Video files - compressed
59
  *.mp4 filter=lfs diff=lfs merge=lfs -text
60
  *.webm filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58
  # Video files - compressed
59
  *.mp4 filter=lfs diff=lfs merge=lfs -text
60
  *.webm filter=lfs diff=lfs merge=lfs -text
61
+ .venv/Lib/site-packages/__pycache__/typing_extensions.cpython-313.pyc filter=lfs diff=lfs merge=lfs -text
62
+ .venv/Lib/site-packages/anyio/_backends/__pycache__/_asyncio.cpython-313.pyc filter=lfs diff=lfs merge=lfs -text
63
+ .venv/Lib/site-packages/click/__pycache__/core.cpython-313.pyc filter=lfs diff=lfs merge=lfs -text
64
+ .venv/Lib/site-packages/hf_xet/hf_xet.pyd filter=lfs diff=lfs merge=lfs -text
65
+ .venv/Lib/site-packages/huggingface_hub/__pycache__/hf_api.cpython-313.pyc filter=lfs diff=lfs merge=lfs -text
66
+ .venv/Lib/site-packages/huggingface_hub/inference/__pycache__/_client.cpython-313.pyc filter=lfs diff=lfs merge=lfs -text
67
+ .venv/Lib/site-packages/huggingface_hub/inference/_generated/__pycache__/_async_client.cpython-313.pyc filter=lfs diff=lfs merge=lfs -text
68
+ .venv/Lib/site-packages/idna/__pycache__/idnadata.cpython-313.pyc filter=lfs diff=lfs merge=lfs -text
69
+ .venv/Lib/site-packages/idna/__pycache__/uts46data.cpython-313.pyc filter=lfs diff=lfs merge=lfs -text
70
+ .venv/Lib/site-packages/pip/_vendor/distlib/t64-arm.exe filter=lfs diff=lfs merge=lfs -text
71
+ .venv/Lib/site-packages/pip/_vendor/distlib/t64.exe filter=lfs diff=lfs merge=lfs -text
72
+ .venv/Lib/site-packages/pip/_vendor/distlib/w64-arm.exe filter=lfs diff=lfs merge=lfs -text
73
+ .venv/Lib/site-packages/pip/_vendor/distlib/w64.exe filter=lfs diff=lfs merge=lfs -text
74
+ .venv/Lib/site-packages/pip/_vendor/idna/__pycache__/idnadata.cpython-313.pyc filter=lfs diff=lfs merge=lfs -text
75
+ .venv/Lib/site-packages/pip/_vendor/idna/__pycache__/uts46data.cpython-313.pyc filter=lfs diff=lfs merge=lfs -text
76
+ .venv/Lib/site-packages/pip/_vendor/pkg_resources/__pycache__/__init__.cpython-313.pyc filter=lfs diff=lfs merge=lfs -text
77
+ .venv/Lib/site-packages/pip/_vendor/rich/__pycache__/_emoji_codes.cpython-313.pyc filter=lfs diff=lfs merge=lfs -text
78
+ .venv/Lib/site-packages/pip/_vendor/rich/__pycache__/console.cpython-313.pyc filter=lfs diff=lfs merge=lfs -text
79
+ .venv/Lib/site-packages/pygments/lexers/__pycache__/lisp.cpython-313.pyc filter=lfs diff=lfs merge=lfs -text
80
+ .venv/Lib/site-packages/rich/__pycache__/_emoji_codes.cpython-313.pyc filter=lfs diff=lfs merge=lfs -text
81
+ .venv/Lib/site-packages/rich/__pycache__/console.cpython-313.pyc filter=lfs diff=lfs merge=lfs -text
82
+ .venv/Lib/site-packages/yaml/_yaml.cp313-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
83
+ .venv/Scripts/hf.exe filter=lfs diff=lfs merge=lfs -text
84
+ .venv/Scripts/httpx.exe filter=lfs diff=lfs merge=lfs -text
85
+ .venv/Scripts/markdown-it.exe filter=lfs diff=lfs merge=lfs -text
86
+ .venv/Scripts/pip.exe filter=lfs diff=lfs merge=lfs -text
87
+ .venv/Scripts/pip3.13.exe filter=lfs diff=lfs merge=lfs -text
88
+ .venv/Scripts/pip3.exe filter=lfs diff=lfs merge=lfs -text
89
+ .venv/Scripts/pygmentize.exe filter=lfs diff=lfs merge=lfs -text
90
+ .venv/Scripts/python.exe filter=lfs diff=lfs merge=lfs -text
91
+ .venv/Scripts/pythonw.exe filter=lfs diff=lfs merge=lfs -text
92
+ .venv/Scripts/tiny-agents.exe filter=lfs diff=lfs merge=lfs -text
93
+ .venv/Scripts/tqdm.exe filter=lfs diff=lfs merge=lfs -text
94
+ .venv/Scripts/typer.exe filter=lfs diff=lfs merge=lfs -text
.venv/.gitignore ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ # Created by venv; see https://docs.python.org/3/library/venv.html
2
+ *
.venv/Lib/site-packages/__pycache__/typing_extensions.cpython-313.pyc ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:788911a8d6acf5172cb77418b38009a6e2332d0ce783a73ab3a48ac5f5e612ef
3
+ size 162946
.venv/Lib/site-packages/_yaml/__init__.py ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # This is a stub package designed to roughly emulate the _yaml
2
+ # extension module, which previously existed as a standalone module
3
+ # and has been moved into the `yaml` package namespace.
4
+ # It does not perfectly mimic its old counterpart, but should get
5
+ # close enough for anyone who's relying on it even when they shouldn't.
6
+ import yaml
7
+
8
+ # in some circumstances, the yaml module we imoprted may be from a different version, so we need
9
+ # to tread carefully when poking at it here (it may not have the attributes we expect)
10
+ if not getattr(yaml, '__with_libyaml__', False):
11
+ from sys import version_info
12
+
13
+ exc = ModuleNotFoundError if version_info >= (3, 6) else ImportError
14
+ raise exc("No module named '_yaml'")
15
+ else:
16
+ from yaml._yaml import *
17
+ import warnings
18
+ warnings.warn(
19
+ 'The _yaml extension module is now located at yaml._yaml'
20
+ ' and its location is subject to change. To use the'
21
+ ' LibYAML-based parser and emitter, import from `yaml`:'
22
+ ' `from yaml import CLoader as Loader, CDumper as Dumper`.',
23
+ DeprecationWarning
24
+ )
25
+ del warnings
26
+ # Don't `del yaml` here because yaml is actually an existing
27
+ # namespace member of _yaml.
28
+
29
+ __name__ = '_yaml'
30
+ # If the module is top-level (i.e. not a part of any specific package)
31
+ # then the attribute should be set to ''.
32
+ # https://docs.python.org/3.8/library/types.html
33
+ __package__ = ''
.venv/Lib/site-packages/_yaml/__pycache__/__init__.cpython-313.pyc ADDED
Binary file (1.02 kB). View file
 
.venv/Lib/site-packages/annotated_doc-0.0.4.dist-info/INSTALLER ADDED
@@ -0,0 +1 @@
 
 
1
+ pip
.venv/Lib/site-packages/annotated_doc-0.0.4.dist-info/METADATA ADDED
@@ -0,0 +1,145 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Metadata-Version: 2.4
2
+ Name: annotated-doc
3
+ Version: 0.0.4
4
+ Summary: Document parameters, class attributes, return types, and variables inline, with Annotated.
5
+ Author-Email: =?utf-8?q?Sebasti=C3=A1n_Ram=C3=ADrez?= <tiangolo@gmail.com>
6
+ License-Expression: MIT
7
+ License-File: LICENSE
8
+ Classifier: Intended Audience :: Information Technology
9
+ Classifier: Intended Audience :: System Administrators
10
+ Classifier: Operating System :: OS Independent
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Programming Language :: Python
13
+ Classifier: Topic :: Internet
14
+ Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
15
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
16
+ Classifier: Topic :: Software Development :: Libraries
17
+ Classifier: Topic :: Software Development
18
+ Classifier: Typing :: Typed
19
+ Classifier: Development Status :: 4 - Beta
20
+ Classifier: Intended Audience :: Developers
21
+ Classifier: Programming Language :: Python :: 3 :: Only
22
+ Classifier: Programming Language :: Python :: 3.8
23
+ Classifier: Programming Language :: Python :: 3.9
24
+ Classifier: Programming Language :: Python :: 3.10
25
+ Classifier: Programming Language :: Python :: 3.11
26
+ Classifier: Programming Language :: Python :: 3.12
27
+ Classifier: Programming Language :: Python :: 3.13
28
+ Classifier: Programming Language :: Python :: 3.14
29
+ Project-URL: Homepage, https://github.com/fastapi/annotated-doc
30
+ Project-URL: Documentation, https://github.com/fastapi/annotated-doc
31
+ Project-URL: Repository, https://github.com/fastapi/annotated-doc
32
+ Project-URL: Issues, https://github.com/fastapi/annotated-doc/issues
33
+ Project-URL: Changelog, https://github.com/fastapi/annotated-doc/release-notes.md
34
+ Requires-Python: >=3.8
35
+ Description-Content-Type: text/markdown
36
+
37
+ # Annotated Doc
38
+
39
+ Document parameters, class attributes, return types, and variables inline, with `Annotated`.
40
+
41
+ <a href="https://github.com/fastapi/annotated-doc/actions?query=workflow%3ATest+event%3Apush+branch%3Amain" target="_blank">
42
+ <img src="https://github.com/fastapi/annotated-doc/actions/workflows/test.yml/badge.svg?event=push&branch=main" alt="Test">
43
+ </a>
44
+ <a href="https://coverage-badge.samuelcolvin.workers.dev/redirect/fastapi/annotated-doc" target="_blank">
45
+ <img src="https://coverage-badge.samuelcolvin.workers.dev/fastapi/annotated-doc.svg" alt="Coverage">
46
+ </a>
47
+ <a href="https://pypi.org/project/annotated-doc" target="_blank">
48
+ <img src="https://img.shields.io/pypi/v/annotated-doc?color=%2334D058&label=pypi%20package" alt="Package version">
49
+ </a>
50
+ <a href="https://pypi.org/project/annotated-doc" target="_blank">
51
+ <img src="https://img.shields.io/pypi/pyversions/annotated-doc.svg?color=%2334D058" alt="Supported Python versions">
52
+ </a>
53
+
54
+ ## Installation
55
+
56
+ ```bash
57
+ pip install annotated-doc
58
+ ```
59
+
60
+ Or with `uv`:
61
+
62
+ ```Python
63
+ uv add annotated-doc
64
+ ```
65
+
66
+ ## Usage
67
+
68
+ Import `Doc` and pass a single literal string with the documentation for the specific parameter, class attribute, return type, or variable.
69
+
70
+ For example, to document a parameter `name` in a function `hi` you could do:
71
+
72
+ ```Python
73
+ from typing import Annotated
74
+
75
+ from annotated_doc import Doc
76
+
77
+ def hi(name: Annotated[str, Doc("Who to say hi to")]) -> None:
78
+ print(f"Hi, {name}!")
79
+ ```
80
+
81
+ You can also use it to document class attributes:
82
+
83
+ ```Python
84
+ from typing import Annotated
85
+
86
+ from annotated_doc import Doc
87
+
88
+ class User:
89
+ name: Annotated[str, Doc("The user's name")]
90
+ age: Annotated[int, Doc("The user's age")]
91
+ ```
92
+
93
+ The same way, you could document return types and variables, or anything that could have a type annotation with `Annotated`.
94
+
95
+ ## Who Uses This
96
+
97
+ `annotated-doc` was made for:
98
+
99
+ * [FastAPI](https://fastapi.tiangolo.com/)
100
+ * [Typer](https://typer.tiangolo.com/)
101
+ * [SQLModel](https://sqlmodel.tiangolo.com/)
102
+ * [Asyncer](https://asyncer.tiangolo.com/)
103
+
104
+ `annotated-doc` is supported by [griffe-typingdoc](https://github.com/mkdocstrings/griffe-typingdoc), which powers reference documentation like the one in the [FastAPI Reference](https://fastapi.tiangolo.com/reference/).
105
+
106
+ ## Reasons not to use `annotated-doc`
107
+
108
+ You are already comfortable with one of the existing docstring formats, like:
109
+
110
+ * Sphinx
111
+ * numpydoc
112
+ * Google
113
+ * Keras
114
+
115
+ Your team is already comfortable using them.
116
+
117
+ You prefer having the documentation about parameters all together in a docstring, separated from the code defining them.
118
+
119
+ You care about a specific set of users, using one specific editor, and that editor already has support for the specific docstring format you use.
120
+
121
+ ## Reasons to use `annotated-doc`
122
+
123
+ * No micro-syntax to learn for newcomers, it’s **just Python** syntax.
124
+ * **Editing** would be already fully supported by default by any editor (current or future) supporting Python syntax, including syntax errors, syntax highlighting, etc.
125
+ * **Rendering** would be relatively straightforward to implement by static tools (tools that don't need runtime execution), as the information can be extracted from the AST they normally already create.
126
+ * **Deduplication of information**: the name of a parameter would be defined in a single place, not duplicated inside of a docstring.
127
+ * **Elimination** of the possibility of having **inconsistencies** when removing a parameter or class variable and **forgetting to remove** its documentation.
128
+ * **Minimization** of the probability of adding a new parameter or class variable and **forgetting to add its documentation**.
129
+ * **Elimination** of the possibility of having **inconsistencies** between the **name** of a parameter in the **signature** and the name in the docstring when it is renamed.
130
+ * **Access** to the documentation string for each symbol at **runtime**, including existing (older) Python versions.
131
+ * A more formalized way to document other symbols, like type aliases, that could use Annotated.
132
+ * **Support** for apps using FastAPI, Typer and others.
133
+ * **AI Accessibility**: AI tools will have an easier way understanding each parameter as the distance from documentation to parameter is much closer.
134
+
135
+ ## History
136
+
137
+ I ([@tiangolo](https://github.com/tiangolo)) originally wanted for this to be part of the Python standard library (in [PEP 727](https://peps.python.org/pep-0727/)), but the proposal was withdrawn as there was a fair amount of negative feedback and opposition.
138
+
139
+ The conclusion was that this was better done as an external effort, in a third-party library.
140
+
141
+ So, here it is, with a simpler approach, as a third-party library, in a way that can be used by others, starting with FastAPI and friends.
142
+
143
+ ## License
144
+
145
+ This project is licensed under the terms of the MIT license.
.venv/Lib/site-packages/annotated_doc-0.0.4.dist-info/RECORD ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ annotated_doc-0.0.4.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
2
+ annotated_doc-0.0.4.dist-info/METADATA,sha256=Irm5KJua33dY2qKKAjJ-OhKaVBVIfwFGej_dSe3Z1TU,6566
3
+ annotated_doc-0.0.4.dist-info/RECORD,,
4
+ annotated_doc-0.0.4.dist-info/WHEEL,sha256=9P2ygRxDrTJz3gsagc0Z96ukrxjr-LFBGOgv3AuKlCA,90
5
+ annotated_doc-0.0.4.dist-info/entry_points.txt,sha256=6OYgBcLyFCUgeqLgnvMyOJxPCWzgy7se4rLPKtNonMs,34
6
+ annotated_doc-0.0.4.dist-info/licenses/LICENSE,sha256=__Fwd5pqy_ZavbQFwIfxzuF4ZpHkqWpANFF-SlBKDN8,1086
7
+ annotated_doc/__init__.py,sha256=VuyxxUe80kfEyWnOrCx_Bk8hybo3aKo6RYBlkBBYW8k,52
8
+ annotated_doc/__pycache__/__init__.cpython-313.pyc,,
9
+ annotated_doc/__pycache__/main.cpython-313.pyc,,
10
+ annotated_doc/main.py,sha256=5Zfvxv80SwwLqpRW73AZyZyiM4bWma9QWRbp_cgD20s,1075
11
+ annotated_doc/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
.venv/Lib/site-packages/annotated_doc-0.0.4.dist-info/WHEEL ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ Wheel-Version: 1.0
2
+ Generator: pdm-backend (2.4.5)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
.venv/Lib/site-packages/annotated_doc-0.0.4.dist-info/entry_points.txt ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ [console_scripts]
2
+
3
+ [gui_scripts]
4
+
.venv/Lib/site-packages/annotated_doc-0.0.4.dist-info/licenses/LICENSE ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2025 Sebastián Ramírez
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
13
+ all 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
21
+ THE SOFTWARE.
.venv/Lib/site-packages/annotated_doc/__init__.py ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ from .main import Doc as Doc
2
+
3
+ __version__ = "0.0.4"
.venv/Lib/site-packages/annotated_doc/__pycache__/__init__.cpython-313.pyc ADDED
Binary file (399 Bytes). View file
 
.venv/Lib/site-packages/annotated_doc/__pycache__/main.cpython-313.pyc ADDED
Binary file (2.07 kB). View file
 
.venv/Lib/site-packages/annotated_doc/main.py ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ class Doc:
2
+ """Define the documentation of a type annotation using `Annotated`, to be
3
+ used in class attributes, function and method parameters, return values,
4
+ and variables.
5
+
6
+ The value should be a positional-only string literal to allow static tools
7
+ like editors and documentation generators to use it.
8
+
9
+ This complements docstrings.
10
+
11
+ The string value passed is available in the attribute `documentation`.
12
+
13
+ Example:
14
+
15
+ ```Python
16
+ from typing import Annotated
17
+ from annotated_doc import Doc
18
+
19
+ def hi(name: Annotated[str, Doc("Who to say hi to")]) -> None:
20
+ print(f"Hi, {name}!")
21
+ ```
22
+ """
23
+
24
+ def __init__(self, documentation: str, /) -> None:
25
+ self.documentation = documentation
26
+
27
+ def __repr__(self) -> str:
28
+ return f"Doc({self.documentation!r})"
29
+
30
+ def __hash__(self) -> int:
31
+ return hash(self.documentation)
32
+
33
+ def __eq__(self, other: object) -> bool:
34
+ if not isinstance(other, Doc):
35
+ return NotImplemented
36
+ return self.documentation == other.documentation
.venv/Lib/site-packages/annotated_doc/py.typed ADDED
File without changes
.venv/Lib/site-packages/anyio-4.12.1.dist-info/INSTALLER ADDED
@@ -0,0 +1 @@
 
 
1
+ pip
.venv/Lib/site-packages/anyio-4.12.1.dist-info/METADATA ADDED
@@ -0,0 +1,96 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Metadata-Version: 2.4
2
+ Name: anyio
3
+ Version: 4.12.1
4
+ Summary: High-level concurrency and networking framework on top of asyncio or Trio
5
+ Author-email: Alex Grönholm <alex.gronholm@nextday.fi>
6
+ License-Expression: MIT
7
+ Project-URL: Documentation, https://anyio.readthedocs.io/en/latest/
8
+ Project-URL: Changelog, https://anyio.readthedocs.io/en/stable/versionhistory.html
9
+ Project-URL: Source code, https://github.com/agronholm/anyio
10
+ Project-URL: Issue tracker, https://github.com/agronholm/anyio/issues
11
+ Classifier: Development Status :: 5 - Production/Stable
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Framework :: AnyIO
14
+ Classifier: Typing :: Typed
15
+ Classifier: Programming Language :: Python
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.9
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Programming Language :: Python :: 3.13
22
+ Classifier: Programming Language :: Python :: 3.14
23
+ Requires-Python: >=3.9
24
+ Description-Content-Type: text/x-rst
25
+ License-File: LICENSE
26
+ Requires-Dist: exceptiongroup>=1.0.2; python_version < "3.11"
27
+ Requires-Dist: idna>=2.8
28
+ Requires-Dist: typing_extensions>=4.5; python_version < "3.13"
29
+ Provides-Extra: trio
30
+ Requires-Dist: trio>=0.32.0; python_version >= "3.10" and extra == "trio"
31
+ Requires-Dist: trio>=0.31.0; python_version < "3.10" and extra == "trio"
32
+ Dynamic: license-file
33
+
34
+ .. image:: https://github.com/agronholm/anyio/actions/workflows/test.yml/badge.svg
35
+ :target: https://github.com/agronholm/anyio/actions/workflows/test.yml
36
+ :alt: Build Status
37
+ .. image:: https://coveralls.io/repos/github/agronholm/anyio/badge.svg?branch=master
38
+ :target: https://coveralls.io/github/agronholm/anyio?branch=master
39
+ :alt: Code Coverage
40
+ .. image:: https://readthedocs.org/projects/anyio/badge/?version=latest
41
+ :target: https://anyio.readthedocs.io/en/latest/?badge=latest
42
+ :alt: Documentation
43
+ .. image:: https://badges.gitter.im/gitterHQ/gitter.svg
44
+ :target: https://gitter.im/python-trio/AnyIO
45
+ :alt: Gitter chat
46
+
47
+ AnyIO is an asynchronous networking and concurrency library that works on top of either asyncio_ or
48
+ Trio_. It implements Trio-like `structured concurrency`_ (SC) on top of asyncio and works in harmony
49
+ with the native SC of Trio itself.
50
+
51
+ Applications and libraries written against AnyIO's API will run unmodified on either asyncio_ or
52
+ Trio_. AnyIO can also be adopted into a library or application incrementally – bit by bit, no full
53
+ refactoring necessary. It will blend in with the native libraries of your chosen backend.
54
+
55
+ To find out why you might want to use AnyIO's APIs instead of asyncio's, you can read about it
56
+ `here <https://anyio.readthedocs.io/en/stable/why.html>`_.
57
+
58
+ Documentation
59
+ -------------
60
+
61
+ View full documentation at: https://anyio.readthedocs.io/
62
+
63
+ Features
64
+ --------
65
+
66
+ AnyIO offers the following functionality:
67
+
68
+ * Task groups (nurseries_ in trio terminology)
69
+ * High-level networking (TCP, UDP and UNIX sockets)
70
+
71
+ * `Happy eyeballs`_ algorithm for TCP connections (more robust than that of asyncio on Python
72
+ 3.8)
73
+ * async/await style UDP sockets (unlike asyncio where you still have to use Transports and
74
+ Protocols)
75
+
76
+ * A versatile API for byte streams and object streams
77
+ * Inter-task synchronization and communication (locks, conditions, events, semaphores, object
78
+ streams)
79
+ * Worker threads
80
+ * Subprocesses
81
+ * Subinterpreter support for code parallelization (on Python 3.13 and later)
82
+ * Asynchronous file I/O (using worker threads)
83
+ * Signal handling
84
+ * Asynchronous version of the functools_ module
85
+
86
+ AnyIO also comes with its own pytest_ plugin which also supports asynchronous fixtures.
87
+ It even works with the popular Hypothesis_ library.
88
+
89
+ .. _asyncio: https://docs.python.org/3/library/asyncio.html
90
+ .. _Trio: https://github.com/python-trio/trio
91
+ .. _structured concurrency: https://en.wikipedia.org/wiki/Structured_concurrency
92
+ .. _nurseries: https://trio.readthedocs.io/en/stable/reference-core.html#nurseries-and-spawning
93
+ .. _Happy eyeballs: https://en.wikipedia.org/wiki/Happy_Eyeballs
94
+ .. _pytest: https://docs.pytest.org/en/latest/
95
+ .. _functools: https://docs.python.org/3/library/functools.html
96
+ .. _Hypothesis: https://hypothesis.works/
.venv/Lib/site-packages/anyio-4.12.1.dist-info/RECORD ADDED
@@ -0,0 +1,92 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ anyio-4.12.1.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
2
+ anyio-4.12.1.dist-info/METADATA,sha256=DfiDab9Tmmcfy802lOLTMEHJQShkOSbopCwqCYbLuJk,4277
3
+ anyio-4.12.1.dist-info/RECORD,,
4
+ anyio-4.12.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
5
+ anyio-4.12.1.dist-info/entry_points.txt,sha256=_d6Yu6uiaZmNe0CydowirE9Cmg7zUL2g08tQpoS3Qvc,39
6
+ anyio-4.12.1.dist-info/licenses/LICENSE,sha256=U2GsncWPLvX9LpsJxoKXwX8ElQkJu8gCO9uC6s8iwrA,1081
7
+ anyio-4.12.1.dist-info/top_level.txt,sha256=QglSMiWX8_5dpoVAEIHdEYzvqFMdSYWmCj6tYw2ITkQ,6
8
+ anyio/__init__.py,sha256=7iDVqMUprUuKNY91FuoKqayAhR-OY136YDPI6P78HHk,6170
9
+ anyio/__pycache__/__init__.cpython-313.pyc,,
10
+ anyio/__pycache__/from_thread.cpython-313.pyc,,
11
+ anyio/__pycache__/functools.cpython-313.pyc,,
12
+ anyio/__pycache__/lowlevel.cpython-313.pyc,,
13
+ anyio/__pycache__/pytest_plugin.cpython-313.pyc,,
14
+ anyio/__pycache__/to_interpreter.cpython-313.pyc,,
15
+ anyio/__pycache__/to_process.cpython-313.pyc,,
16
+ anyio/__pycache__/to_thread.cpython-313.pyc,,
17
+ anyio/_backends/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
18
+ anyio/_backends/__pycache__/__init__.cpython-313.pyc,,
19
+ anyio/_backends/__pycache__/_asyncio.cpython-313.pyc,,
20
+ anyio/_backends/__pycache__/_trio.cpython-313.pyc,,
21
+ anyio/_backends/_asyncio.py,sha256=xG6qv60mgGnL0mK82dxjH2b8hlkMlJ-x2BqIq3qv70Y,98863
22
+ anyio/_backends/_trio.py,sha256=30Rctb7lm8g63ZHljVPVnj5aH-uK6oQvphjwUBoAzuI,41456
23
+ anyio/_core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
24
+ anyio/_core/__pycache__/__init__.cpython-313.pyc,,
25
+ anyio/_core/__pycache__/_asyncio_selector_thread.cpython-313.pyc,,
26
+ anyio/_core/__pycache__/_contextmanagers.cpython-313.pyc,,
27
+ anyio/_core/__pycache__/_eventloop.cpython-313.pyc,,
28
+ anyio/_core/__pycache__/_exceptions.cpython-313.pyc,,
29
+ anyio/_core/__pycache__/_fileio.cpython-313.pyc,,
30
+ anyio/_core/__pycache__/_resources.cpython-313.pyc,,
31
+ anyio/_core/__pycache__/_signals.cpython-313.pyc,,
32
+ anyio/_core/__pycache__/_sockets.cpython-313.pyc,,
33
+ anyio/_core/__pycache__/_streams.cpython-313.pyc,,
34
+ anyio/_core/__pycache__/_subprocesses.cpython-313.pyc,,
35
+ anyio/_core/__pycache__/_synchronization.cpython-313.pyc,,
36
+ anyio/_core/__pycache__/_tasks.cpython-313.pyc,,
37
+ anyio/_core/__pycache__/_tempfile.cpython-313.pyc,,
38
+ anyio/_core/__pycache__/_testing.cpython-313.pyc,,
39
+ anyio/_core/__pycache__/_typedattr.cpython-313.pyc,,
40
+ anyio/_core/_asyncio_selector_thread.py,sha256=2PdxFM3cs02Kp6BSppbvmRT7q7asreTW5FgBxEsflBo,5626
41
+ anyio/_core/_contextmanagers.py,sha256=YInBCabiEeS-UaP_Jdxa1CaFC71ETPW8HZTHIM8Rsc8,7215
42
+ anyio/_core/_eventloop.py,sha256=c2EdcBX-xnKwxPcC4Pjn3_qG9I-x4IWFO2R9RqCGjM4,6448
43
+ anyio/_core/_exceptions.py,sha256=Y3aq-Wxd7Q2HqwSg7nZPvRsHEuGazv_qeet6gqEBdPk,4407
44
+ anyio/_core/_fileio.py,sha256=uc7t10Vb-If7GbdWM_zFf-ajUe6uek63fSt7IBLlZW0,25731
45
+ anyio/_core/_resources.py,sha256=NbmU5O5UX3xEyACnkmYX28Fmwdl-f-ny0tHym26e0w0,435
46
+ anyio/_core/_signals.py,sha256=mjTBB2hTKNPRlU0IhnijeQedpWOGERDiMjSlJQsFrug,1016
47
+ anyio/_core/_sockets.py,sha256=RBXHcUqZt5gg_-OOfgHVv8uq2FSKk1uVUzTdpjBoI1o,34977
48
+ anyio/_core/_streams.py,sha256=FczFwIgDpnkK0bODWJXMpsUJYdvAD04kaUaGzJU8DK0,1806
49
+ anyio/_core/_subprocesses.py,sha256=EXm5igL7dj55iYkPlbYVAqtbqxJxjU-6OndSTIx9SRg,8047
50
+ anyio/_core/_synchronization.py,sha256=MgVVqFzvt580tHC31LiOcq1G6aryut--xRG4Ff8KwxQ,20869
51
+ anyio/_core/_tasks.py,sha256=pVB7K6AAulzUM8YgXAeqNZG44nSyZ1bYJjH8GznC00I,5435
52
+ anyio/_core/_tempfile.py,sha256=lHb7CW4FyIlpkf5ADAf4VmLHCKwEHF9nxqNyBCFFUiA,19697
53
+ anyio/_core/_testing.py,sha256=u7MPqGXwpTxqI7hclSdNA30z2GH1Nw258uwKvy_RfBg,2340
54
+ anyio/_core/_typedattr.py,sha256=P4ozZikn3-DbpoYcvyghS_FOYAgbmUxeoU8-L_07pZM,2508
55
+ anyio/abc/__init__.py,sha256=6mWhcl_pGXhrgZVHP_TCfMvIXIOp9mroEFM90fYCU_U,2869
56
+ anyio/abc/__pycache__/__init__.cpython-313.pyc,,
57
+ anyio/abc/__pycache__/_eventloop.cpython-313.pyc,,
58
+ anyio/abc/__pycache__/_resources.cpython-313.pyc,,
59
+ anyio/abc/__pycache__/_sockets.cpython-313.pyc,,
60
+ anyio/abc/__pycache__/_streams.cpython-313.pyc,,
61
+ anyio/abc/__pycache__/_subprocesses.cpython-313.pyc,,
62
+ anyio/abc/__pycache__/_tasks.cpython-313.pyc,,
63
+ anyio/abc/__pycache__/_testing.cpython-313.pyc,,
64
+ anyio/abc/_eventloop.py,sha256=GlzgB3UJGgG6Kr7olpjOZ-o00PghecXuofVDQ_5611Q,10749
65
+ anyio/abc/_resources.py,sha256=DrYvkNN1hH6Uvv5_5uKySvDsnknGVDe8FCKfko0VtN8,783
66
+ anyio/abc/_sockets.py,sha256=ECTY0jLEF18gryANHR3vFzXzGdZ-xPwELq1QdgOb0Jo,13258
67
+ anyio/abc/_streams.py,sha256=005GKSCXGprxnhucILboSqc2JFovECZk9m3p-qqxXVc,7640
68
+ anyio/abc/_subprocesses.py,sha256=cumAPJTktOQtw63IqG0lDpyZqu_l1EElvQHMiwJgL08,2067
69
+ anyio/abc/_tasks.py,sha256=KC7wrciE48AINOI-AhPutnFhe1ewfP7QnamFlDzqesQ,3721
70
+ anyio/abc/_testing.py,sha256=tBJUzkSfOXJw23fe8qSJ03kJlShOYjjaEyFB6k6MYT8,1821
71
+ anyio/from_thread.py,sha256=L-0w1HxJ6BSb-KuVi57k5Tkc3yzQrx3QK5tAxMPcY-0,19141
72
+ anyio/functools.py,sha256=HWj7GBEmc0Z-mZg3uok7Z7ZJn0rEC_0Pzbt0nYUDaTQ,10973
73
+ anyio/lowlevel.py,sha256=AyKLVK3LaWSoK39LkCKxE4_GDMLKZBNqTrLUgk63y80,5158
74
+ anyio/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
75
+ anyio/pytest_plugin.py,sha256=3jAFQn0jv_pyoWE2GBBlHaj9sqXj4e8vob0_hgrsXE8,10244
76
+ anyio/streams/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
77
+ anyio/streams/__pycache__/__init__.cpython-313.pyc,,
78
+ anyio/streams/__pycache__/buffered.cpython-313.pyc,,
79
+ anyio/streams/__pycache__/file.cpython-313.pyc,,
80
+ anyio/streams/__pycache__/memory.cpython-313.pyc,,
81
+ anyio/streams/__pycache__/stapled.cpython-313.pyc,,
82
+ anyio/streams/__pycache__/text.cpython-313.pyc,,
83
+ anyio/streams/__pycache__/tls.cpython-313.pyc,,
84
+ anyio/streams/buffered.py,sha256=2R3PeJhe4EXrdYqz44Y6-Eg9R6DrmlsYrP36Ir43-po,6263
85
+ anyio/streams/file.py,sha256=4WZ7XGz5WNu39FQHvqbe__TQ0HDP9OOhgO1mk9iVpVU,4470
86
+ anyio/streams/memory.py,sha256=F0zwzvFJKAhX_LRZGoKzzqDC2oMM-f-yyTBrEYEGOaU,10740
87
+ anyio/streams/stapled.py,sha256=T8Xqwf8K6EgURPxbt1N4i7A8BAk-gScv-GRhjLXIf_o,4390
88
+ anyio/streams/text.py,sha256=BcVAGJw1VRvtIqnv-o0Rb0pwH7p8vwlvl21xHq522ag,5765
89
+ anyio/streams/tls.py,sha256=Jpxy0Mfbcp1BxHCwE-YjSSFaLnIBbnnwur-excYThs4,15368
90
+ anyio/to_interpreter.py,sha256=_mLngrMy97TMR6VbW4Y6YzDUk9ZuPcQMPlkuyRh3C9k,7100
91
+ anyio/to_process.py,sha256=J7gAA_YOuoHqnpDAf5fm1Qu6kOmTzdFbiDNvnV755vk,9798
92
+ anyio/to_thread.py,sha256=menEgXYmUV7Fjg_9WqCV95P9MAtQS8BzPGGcWB_QnfQ,2687
.venv/Lib/site-packages/anyio-4.12.1.dist-info/WHEEL ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (80.9.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
.venv/Lib/site-packages/anyio-4.12.1.dist-info/entry_points.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ [pytest11]
2
+ anyio = anyio.pytest_plugin
.venv/Lib/site-packages/anyio-4.12.1.dist-info/licenses/LICENSE ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2018 Alex Grönholm
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
6
+ this software and associated documentation files (the "Software"), to deal in
7
+ the Software without restriction, including without limitation the rights to
8
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9
+ the Software, and to permit persons to whom the Software is furnished to do so,
10
+ 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, FITNESS
17
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
.venv/Lib/site-packages/anyio-4.12.1.dist-info/top_level.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ anyio
.venv/Lib/site-packages/anyio/__init__.py ADDED
@@ -0,0 +1,111 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from __future__ import annotations
2
+
3
+ from ._core._contextmanagers import AsyncContextManagerMixin as AsyncContextManagerMixin
4
+ from ._core._contextmanagers import ContextManagerMixin as ContextManagerMixin
5
+ from ._core._eventloop import current_time as current_time
6
+ from ._core._eventloop import get_all_backends as get_all_backends
7
+ from ._core._eventloop import get_available_backends as get_available_backends
8
+ from ._core._eventloop import get_cancelled_exc_class as get_cancelled_exc_class
9
+ from ._core._eventloop import run as run
10
+ from ._core._eventloop import sleep as sleep
11
+ from ._core._eventloop import sleep_forever as sleep_forever
12
+ from ._core._eventloop import sleep_until as sleep_until
13
+ from ._core._exceptions import BrokenResourceError as BrokenResourceError
14
+ from ._core._exceptions import BrokenWorkerInterpreter as BrokenWorkerInterpreter
15
+ from ._core._exceptions import BrokenWorkerProcess as BrokenWorkerProcess
16
+ from ._core._exceptions import BusyResourceError as BusyResourceError
17
+ from ._core._exceptions import ClosedResourceError as ClosedResourceError
18
+ from ._core._exceptions import ConnectionFailed as ConnectionFailed
19
+ from ._core._exceptions import DelimiterNotFound as DelimiterNotFound
20
+ from ._core._exceptions import EndOfStream as EndOfStream
21
+ from ._core._exceptions import IncompleteRead as IncompleteRead
22
+ from ._core._exceptions import NoEventLoopError as NoEventLoopError
23
+ from ._core._exceptions import RunFinishedError as RunFinishedError
24
+ from ._core._exceptions import TypedAttributeLookupError as TypedAttributeLookupError
25
+ from ._core._exceptions import WouldBlock as WouldBlock
26
+ from ._core._fileio import AsyncFile as AsyncFile
27
+ from ._core._fileio import Path as Path
28
+ from ._core._fileio import open_file as open_file
29
+ from ._core._fileio import wrap_file as wrap_file
30
+ from ._core._resources import aclose_forcefully as aclose_forcefully
31
+ from ._core._signals import open_signal_receiver as open_signal_receiver
32
+ from ._core._sockets import TCPConnectable as TCPConnectable
33
+ from ._core._sockets import UNIXConnectable as UNIXConnectable
34
+ from ._core._sockets import as_connectable as as_connectable
35
+ from ._core._sockets import connect_tcp as connect_tcp
36
+ from ._core._sockets import connect_unix as connect_unix
37
+ from ._core._sockets import create_connected_udp_socket as create_connected_udp_socket
38
+ from ._core._sockets import (
39
+ create_connected_unix_datagram_socket as create_connected_unix_datagram_socket,
40
+ )
41
+ from ._core._sockets import create_tcp_listener as create_tcp_listener
42
+ from ._core._sockets import create_udp_socket as create_udp_socket
43
+ from ._core._sockets import create_unix_datagram_socket as create_unix_datagram_socket
44
+ from ._core._sockets import create_unix_listener as create_unix_listener
45
+ from ._core._sockets import getaddrinfo as getaddrinfo
46
+ from ._core._sockets import getnameinfo as getnameinfo
47
+ from ._core._sockets import notify_closing as notify_closing
48
+ from ._core._sockets import wait_readable as wait_readable
49
+ from ._core._sockets import wait_socket_readable as wait_socket_readable
50
+ from ._core._sockets import wait_socket_writable as wait_socket_writable
51
+ from ._core._sockets import wait_writable as wait_writable
52
+ from ._core._streams import create_memory_object_stream as create_memory_object_stream
53
+ from ._core._subprocesses import open_process as open_process
54
+ from ._core._subprocesses import run_process as run_process
55
+ from ._core._synchronization import CapacityLimiter as CapacityLimiter
56
+ from ._core._synchronization import (
57
+ CapacityLimiterStatistics as CapacityLimiterStatistics,
58
+ )
59
+ from ._core._synchronization import Condition as Condition
60
+ from ._core._synchronization import ConditionStatistics as ConditionStatistics
61
+ from ._core._synchronization import Event as Event
62
+ from ._core._synchronization import EventStatistics as EventStatistics
63
+ from ._core._synchronization import Lock as Lock
64
+ from ._core._synchronization import LockStatistics as LockStatistics
65
+ from ._core._synchronization import ResourceGuard as ResourceGuard
66
+ from ._core._synchronization import Semaphore as Semaphore
67
+ from ._core._synchronization import SemaphoreStatistics as SemaphoreStatistics
68
+ from ._core._tasks import TASK_STATUS_IGNORED as TASK_STATUS_IGNORED
69
+ from ._core._tasks import CancelScope as CancelScope
70
+ from ._core._tasks import create_task_group as create_task_group
71
+ from ._core._tasks import current_effective_deadline as current_effective_deadline
72
+ from ._core._tasks import fail_after as fail_after
73
+ from ._core._tasks import move_on_after as move_on_after
74
+ from ._core._tempfile import NamedTemporaryFile as NamedTemporaryFile
75
+ from ._core._tempfile import SpooledTemporaryFile as SpooledTemporaryFile
76
+ from ._core._tempfile import TemporaryDirectory as TemporaryDirectory
77
+ from ._core._tempfile import TemporaryFile as TemporaryFile
78
+ from ._core._tempfile import gettempdir as gettempdir
79
+ from ._core._tempfile import gettempdirb as gettempdirb
80
+ from ._core._tempfile import mkdtemp as mkdtemp
81
+ from ._core._tempfile import mkstemp as mkstemp
82
+ from ._core._testing import TaskInfo as TaskInfo
83
+ from ._core._testing import get_current_task as get_current_task
84
+ from ._core._testing import get_running_tasks as get_running_tasks
85
+ from ._core._testing import wait_all_tasks_blocked as wait_all_tasks_blocked
86
+ from ._core._typedattr import TypedAttributeProvider as TypedAttributeProvider
87
+ from ._core._typedattr import TypedAttributeSet as TypedAttributeSet
88
+ from ._core._typedattr import typed_attribute as typed_attribute
89
+
90
+ # Re-export imports so they look like they live directly in this package
91
+ for __value in list(locals().values()):
92
+ if getattr(__value, "__module__", "").startswith("anyio."):
93
+ __value.__module__ = __name__
94
+
95
+
96
+ del __value
97
+
98
+
99
+ def __getattr__(attr: str) -> type[BrokenWorkerInterpreter]:
100
+ """Support deprecated aliases."""
101
+ if attr == "BrokenWorkerIntepreter":
102
+ import warnings
103
+
104
+ warnings.warn(
105
+ "The 'BrokenWorkerIntepreter' alias is deprecated, use 'BrokenWorkerInterpreter' instead.",
106
+ DeprecationWarning,
107
+ stacklevel=2,
108
+ )
109
+ return BrokenWorkerInterpreter
110
+
111
+ raise AttributeError(f"module {__name__!r} has no attribute {attr!r}")
.venv/Lib/site-packages/anyio/__pycache__/__init__.cpython-313.pyc ADDED
Binary file (4.79 kB). View file
 
.venv/Lib/site-packages/anyio/__pycache__/from_thread.cpython-313.pyc ADDED
Binary file (25.6 kB). View file
 
.venv/Lib/site-packages/anyio/__pycache__/functools.cpython-313.pyc ADDED
Binary file (16 kB). View file
 
.venv/Lib/site-packages/anyio/__pycache__/lowlevel.cpython-313.pyc ADDED
Binary file (8.15 kB). View file
 
.venv/Lib/site-packages/anyio/__pycache__/pytest_plugin.cpython-313.pyc ADDED
Binary file (14.8 kB). View file
 
.venv/Lib/site-packages/anyio/__pycache__/to_interpreter.cpython-313.pyc ADDED
Binary file (10.6 kB). View file
 
.venv/Lib/site-packages/anyio/__pycache__/to_process.cpython-313.pyc ADDED
Binary file (12.3 kB). View file
 
.venv/Lib/site-packages/anyio/__pycache__/to_thread.cpython-313.pyc ADDED
Binary file (3.23 kB). View file
 
.venv/Lib/site-packages/anyio/_backends/__init__.py ADDED
File without changes
.venv/Lib/site-packages/anyio/_backends/__pycache__/__init__.cpython-313.pyc ADDED
Binary file (337 Bytes). View file
 
.venv/Lib/site-packages/anyio/_backends/__pycache__/_asyncio.cpython-313.pyc ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:bb2e453d6bbb08e5da940e2b37be4807df41815b463883f70349e4fc14b2c8a5
3
+ size 142720
.venv/Lib/site-packages/anyio/_backends/__pycache__/_trio.cpython-313.pyc ADDED
Binary file (73.3 kB). View file
 
.venv/Lib/site-packages/anyio/_backends/_asyncio.py ADDED
The diff for this file is too large to render. See raw diff
 
.venv/Lib/site-packages/anyio/_backends/_trio.py ADDED
@@ -0,0 +1,1346 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from __future__ import annotations
2
+
3
+ import array
4
+ import math
5
+ import os
6
+ import socket
7
+ import sys
8
+ import types
9
+ import weakref
10
+ from collections.abc import (
11
+ AsyncGenerator,
12
+ AsyncIterator,
13
+ Awaitable,
14
+ Callable,
15
+ Collection,
16
+ Coroutine,
17
+ Iterable,
18
+ Sequence,
19
+ )
20
+ from contextlib import AbstractContextManager
21
+ from dataclasses import dataclass
22
+ from io import IOBase
23
+ from os import PathLike
24
+ from signal import Signals
25
+ from socket import AddressFamily, SocketKind
26
+ from types import TracebackType
27
+ from typing import (
28
+ IO,
29
+ TYPE_CHECKING,
30
+ Any,
31
+ Generic,
32
+ NoReturn,
33
+ TypeVar,
34
+ cast,
35
+ overload,
36
+ )
37
+
38
+ import trio.from_thread
39
+ import trio.lowlevel
40
+ from outcome import Error, Outcome, Value
41
+ from trio.lowlevel import (
42
+ current_root_task,
43
+ current_task,
44
+ notify_closing,
45
+ wait_readable,
46
+ wait_writable,
47
+ )
48
+ from trio.socket import SocketType as TrioSocketType
49
+ from trio.to_thread import run_sync
50
+
51
+ from .. import (
52
+ CapacityLimiterStatistics,
53
+ EventStatistics,
54
+ LockStatistics,
55
+ RunFinishedError,
56
+ TaskInfo,
57
+ WouldBlock,
58
+ abc,
59
+ )
60
+ from .._core._eventloop import claim_worker_thread
61
+ from .._core._exceptions import (
62
+ BrokenResourceError,
63
+ BusyResourceError,
64
+ ClosedResourceError,
65
+ EndOfStream,
66
+ )
67
+ from .._core._sockets import convert_ipv6_sockaddr
68
+ from .._core._streams import create_memory_object_stream
69
+ from .._core._synchronization import (
70
+ CapacityLimiter as BaseCapacityLimiter,
71
+ )
72
+ from .._core._synchronization import Event as BaseEvent
73
+ from .._core._synchronization import Lock as BaseLock
74
+ from .._core._synchronization import (
75
+ ResourceGuard,
76
+ SemaphoreStatistics,
77
+ )
78
+ from .._core._synchronization import Semaphore as BaseSemaphore
79
+ from .._core._tasks import CancelScope as BaseCancelScope
80
+ from ..abc import IPSockAddrType, UDPPacketType, UNIXDatagramPacketType
81
+ from ..abc._eventloop import AsyncBackend, StrOrBytesPath
82
+ from ..streams.memory import MemoryObjectSendStream
83
+
84
+ if TYPE_CHECKING:
85
+ from _typeshed import FileDescriptorLike
86
+
87
+ if sys.version_info >= (3, 10):
88
+ from typing import ParamSpec
89
+ else:
90
+ from typing_extensions import ParamSpec
91
+
92
+ if sys.version_info >= (3, 11):
93
+ from typing import TypeVarTuple, Unpack
94
+ else:
95
+ from exceptiongroup import BaseExceptionGroup
96
+ from typing_extensions import TypeVarTuple, Unpack
97
+
98
+ T = TypeVar("T")
99
+ T_Retval = TypeVar("T_Retval")
100
+ T_SockAddr = TypeVar("T_SockAddr", str, IPSockAddrType)
101
+ PosArgsT = TypeVarTuple("PosArgsT")
102
+ P = ParamSpec("P")
103
+
104
+
105
+ #
106
+ # Event loop
107
+ #
108
+
109
+ RunVar = trio.lowlevel.RunVar
110
+
111
+
112
+ #
113
+ # Timeouts and cancellation
114
+ #
115
+
116
+
117
+ class CancelScope(BaseCancelScope):
118
+ def __new__(
119
+ cls, original: trio.CancelScope | None = None, **kwargs: object
120
+ ) -> CancelScope:
121
+ return object.__new__(cls)
122
+
123
+ def __init__(self, original: trio.CancelScope | None = None, **kwargs: Any) -> None:
124
+ self.__original = original or trio.CancelScope(**kwargs)
125
+
126
+ def __enter__(self) -> CancelScope:
127
+ self.__original.__enter__()
128
+ return self
129
+
130
+ def __exit__(
131
+ self,
132
+ exc_type: type[BaseException] | None,
133
+ exc_val: BaseException | None,
134
+ exc_tb: TracebackType | None,
135
+ ) -> bool:
136
+ return self.__original.__exit__(exc_type, exc_val, exc_tb)
137
+
138
+ def cancel(self, reason: str | None = None) -> None:
139
+ self.__original.cancel(reason)
140
+
141
+ @property
142
+ def deadline(self) -> float:
143
+ return self.__original.deadline
144
+
145
+ @deadline.setter
146
+ def deadline(self, value: float) -> None:
147
+ self.__original.deadline = value
148
+
149
+ @property
150
+ def cancel_called(self) -> bool:
151
+ return self.__original.cancel_called
152
+
153
+ @property
154
+ def cancelled_caught(self) -> bool:
155
+ return self.__original.cancelled_caught
156
+
157
+ @property
158
+ def shield(self) -> bool:
159
+ return self.__original.shield
160
+
161
+ @shield.setter
162
+ def shield(self, value: bool) -> None:
163
+ self.__original.shield = value
164
+
165
+
166
+ #
167
+ # Task groups
168
+ #
169
+
170
+
171
+ class TaskGroup(abc.TaskGroup):
172
+ def __init__(self) -> None:
173
+ self._active = False
174
+ self._nursery_manager = trio.open_nursery(strict_exception_groups=True)
175
+ self.cancel_scope = None # type: ignore[assignment]
176
+
177
+ async def __aenter__(self) -> TaskGroup:
178
+ self._active = True
179
+ self._nursery = await self._nursery_manager.__aenter__()
180
+ self.cancel_scope = CancelScope(self._nursery.cancel_scope)
181
+ return self
182
+
183
+ async def __aexit__(
184
+ self,
185
+ exc_type: type[BaseException] | None,
186
+ exc_val: BaseException | None,
187
+ exc_tb: TracebackType | None,
188
+ ) -> bool:
189
+ try:
190
+ # trio.Nursery.__exit__ returns bool; .open_nursery has wrong type
191
+ return await self._nursery_manager.__aexit__(exc_type, exc_val, exc_tb) # type: ignore[return-value]
192
+ except BaseExceptionGroup as exc:
193
+ if not exc.split(trio.Cancelled)[1]:
194
+ raise trio.Cancelled._create() from exc
195
+
196
+ raise
197
+ finally:
198
+ del exc_val, exc_tb
199
+ self._active = False
200
+
201
+ def start_soon(
202
+ self,
203
+ func: Callable[[Unpack[PosArgsT]], Awaitable[Any]],
204
+ *args: Unpack[PosArgsT],
205
+ name: object = None,
206
+ ) -> None:
207
+ if not self._active:
208
+ raise RuntimeError(
209
+ "This task group is not active; no new tasks can be started."
210
+ )
211
+
212
+ self._nursery.start_soon(func, *args, name=name)
213
+
214
+ async def start(
215
+ self, func: Callable[..., Awaitable[Any]], *args: object, name: object = None
216
+ ) -> Any:
217
+ if not self._active:
218
+ raise RuntimeError(
219
+ "This task group is not active; no new tasks can be started."
220
+ )
221
+
222
+ return await self._nursery.start(func, *args, name=name)
223
+
224
+
225
+ #
226
+ # Subprocesses
227
+ #
228
+
229
+
230
+ @dataclass(eq=False)
231
+ class ReceiveStreamWrapper(abc.ByteReceiveStream):
232
+ _stream: trio.abc.ReceiveStream
233
+
234
+ async def receive(self, max_bytes: int | None = None) -> bytes:
235
+ try:
236
+ data = await self._stream.receive_some(max_bytes)
237
+ except trio.ClosedResourceError as exc:
238
+ raise ClosedResourceError from exc.__cause__
239
+ except trio.BrokenResourceError as exc:
240
+ raise BrokenResourceError from exc.__cause__
241
+
242
+ if data:
243
+ return bytes(data)
244
+ else:
245
+ raise EndOfStream
246
+
247
+ async def aclose(self) -> None:
248
+ await self._stream.aclose()
249
+
250
+
251
+ @dataclass(eq=False)
252
+ class SendStreamWrapper(abc.ByteSendStream):
253
+ _stream: trio.abc.SendStream
254
+
255
+ async def send(self, item: bytes) -> None:
256
+ try:
257
+ await self._stream.send_all(item)
258
+ except trio.ClosedResourceError as exc:
259
+ raise ClosedResourceError from exc.__cause__
260
+ except trio.BrokenResourceError as exc:
261
+ raise BrokenResourceError from exc.__cause__
262
+
263
+ async def aclose(self) -> None:
264
+ await self._stream.aclose()
265
+
266
+
267
+ @dataclass(eq=False)
268
+ class Process(abc.Process):
269
+ _process: trio.Process
270
+ _stdin: abc.ByteSendStream | None
271
+ _stdout: abc.ByteReceiveStream | None
272
+ _stderr: abc.ByteReceiveStream | None
273
+
274
+ async def aclose(self) -> None:
275
+ with CancelScope(shield=True):
276
+ if self._stdin:
277
+ await self._stdin.aclose()
278
+ if self._stdout:
279
+ await self._stdout.aclose()
280
+ if self._stderr:
281
+ await self._stderr.aclose()
282
+
283
+ try:
284
+ await self.wait()
285
+ except BaseException:
286
+ self.kill()
287
+ with CancelScope(shield=True):
288
+ await self.wait()
289
+ raise
290
+
291
+ async def wait(self) -> int:
292
+ return await self._process.wait()
293
+
294
+ def terminate(self) -> None:
295
+ self._process.terminate()
296
+
297
+ def kill(self) -> None:
298
+ self._process.kill()
299
+
300
+ def send_signal(self, signal: Signals) -> None:
301
+ self._process.send_signal(signal)
302
+
303
+ @property
304
+ def pid(self) -> int:
305
+ return self._process.pid
306
+
307
+ @property
308
+ def returncode(self) -> int | None:
309
+ return self._process.returncode
310
+
311
+ @property
312
+ def stdin(self) -> abc.ByteSendStream | None:
313
+ return self._stdin
314
+
315
+ @property
316
+ def stdout(self) -> abc.ByteReceiveStream | None:
317
+ return self._stdout
318
+
319
+ @property
320
+ def stderr(self) -> abc.ByteReceiveStream | None:
321
+ return self._stderr
322
+
323
+
324
+ class _ProcessPoolShutdownInstrument(trio.abc.Instrument):
325
+ def after_run(self) -> None:
326
+ super().after_run()
327
+
328
+
329
+ current_default_worker_process_limiter: trio.lowlevel.RunVar = RunVar(
330
+ "current_default_worker_process_limiter"
331
+ )
332
+
333
+
334
+ async def _shutdown_process_pool(workers: set[abc.Process]) -> None:
335
+ try:
336
+ await trio.sleep(math.inf)
337
+ except trio.Cancelled:
338
+ for process in workers:
339
+ if process.returncode is None:
340
+ process.kill()
341
+
342
+ with CancelScope(shield=True):
343
+ for process in workers:
344
+ await process.aclose()
345
+
346
+
347
+ #
348
+ # Sockets and networking
349
+ #
350
+
351
+
352
+ class _TrioSocketMixin(Generic[T_SockAddr]):
353
+ def __init__(self, trio_socket: TrioSocketType) -> None:
354
+ self._trio_socket = trio_socket
355
+ self._closed = False
356
+
357
+ def _check_closed(self) -> None:
358
+ if self._closed:
359
+ raise ClosedResourceError
360
+ if self._trio_socket.fileno() < 0:
361
+ raise BrokenResourceError
362
+
363
+ @property
364
+ def _raw_socket(self) -> socket.socket:
365
+ return self._trio_socket._sock # type: ignore[attr-defined]
366
+
367
+ async def aclose(self) -> None:
368
+ if self._trio_socket.fileno() >= 0:
369
+ self._closed = True
370
+ self._trio_socket.close()
371
+
372
+ def _convert_socket_error(self, exc: BaseException) -> NoReturn:
373
+ if isinstance(exc, trio.ClosedResourceError):
374
+ raise ClosedResourceError from exc
375
+ elif self._trio_socket.fileno() < 0 and self._closed:
376
+ raise ClosedResourceError from None
377
+ elif isinstance(exc, OSError):
378
+ raise BrokenResourceError from exc
379
+ else:
380
+ raise exc
381
+
382
+
383
+ class SocketStream(_TrioSocketMixin, abc.SocketStream):
384
+ def __init__(self, trio_socket: TrioSocketType) -> None:
385
+ super().__init__(trio_socket)
386
+ self._receive_guard = ResourceGuard("reading from")
387
+ self._send_guard = ResourceGuard("writing to")
388
+
389
+ async def receive(self, max_bytes: int = 65536) -> bytes:
390
+ with self._receive_guard:
391
+ try:
392
+ data = await self._trio_socket.recv(max_bytes)
393
+ except BaseException as exc:
394
+ self._convert_socket_error(exc)
395
+
396
+ if data:
397
+ return data
398
+ else:
399
+ raise EndOfStream
400
+
401
+ async def send(self, item: bytes) -> None:
402
+ with self._send_guard:
403
+ view = memoryview(item)
404
+ while view:
405
+ try:
406
+ bytes_sent = await self._trio_socket.send(view)
407
+ except BaseException as exc:
408
+ self._convert_socket_error(exc)
409
+
410
+ view = view[bytes_sent:]
411
+
412
+ async def send_eof(self) -> None:
413
+ self._trio_socket.shutdown(socket.SHUT_WR)
414
+
415
+
416
+ class UNIXSocketStream(SocketStream, abc.UNIXSocketStream):
417
+ async def receive_fds(self, msglen: int, maxfds: int) -> tuple[bytes, list[int]]:
418
+ if not isinstance(msglen, int) or msglen < 0:
419
+ raise ValueError("msglen must be a non-negative integer")
420
+ if not isinstance(maxfds, int) or maxfds < 1:
421
+ raise ValueError("maxfds must be a positive integer")
422
+
423
+ fds = array.array("i")
424
+ await trio.lowlevel.checkpoint()
425
+ with self._receive_guard:
426
+ while True:
427
+ try:
428
+ message, ancdata, flags, addr = await self._trio_socket.recvmsg(
429
+ msglen, socket.CMSG_LEN(maxfds * fds.itemsize)
430
+ )
431
+ except BaseException as exc:
432
+ self._convert_socket_error(exc)
433
+ else:
434
+ if not message and not ancdata:
435
+ raise EndOfStream
436
+
437
+ break
438
+
439
+ for cmsg_level, cmsg_type, cmsg_data in ancdata:
440
+ if cmsg_level != socket.SOL_SOCKET or cmsg_type != socket.SCM_RIGHTS:
441
+ raise RuntimeError(
442
+ f"Received unexpected ancillary data; message = {message!r}, "
443
+ f"cmsg_level = {cmsg_level}, cmsg_type = {cmsg_type}"
444
+ )
445
+
446
+ fds.frombytes(cmsg_data[: len(cmsg_data) - (len(cmsg_data) % fds.itemsize)])
447
+
448
+ return message, list(fds)
449
+
450
+ async def send_fds(self, message: bytes, fds: Collection[int | IOBase]) -> None:
451
+ if not message:
452
+ raise ValueError("message must not be empty")
453
+ if not fds:
454
+ raise ValueError("fds must not be empty")
455
+
456
+ filenos: list[int] = []
457
+ for fd in fds:
458
+ if isinstance(fd, int):
459
+ filenos.append(fd)
460
+ elif isinstance(fd, IOBase):
461
+ filenos.append(fd.fileno())
462
+
463
+ fdarray = array.array("i", filenos)
464
+ await trio.lowlevel.checkpoint()
465
+ with self._send_guard:
466
+ while True:
467
+ try:
468
+ await self._trio_socket.sendmsg(
469
+ [message],
470
+ [
471
+ (
472
+ socket.SOL_SOCKET,
473
+ socket.SCM_RIGHTS,
474
+ fdarray,
475
+ )
476
+ ],
477
+ )
478
+ break
479
+ except BaseException as exc:
480
+ self._convert_socket_error(exc)
481
+
482
+
483
+ class TCPSocketListener(_TrioSocketMixin, abc.SocketListener):
484
+ def __init__(self, raw_socket: socket.socket):
485
+ super().__init__(trio.socket.from_stdlib_socket(raw_socket))
486
+ self._accept_guard = ResourceGuard("accepting connections from")
487
+
488
+ async def accept(self) -> SocketStream:
489
+ with self._accept_guard:
490
+ try:
491
+ trio_socket, _addr = await self._trio_socket.accept()
492
+ except BaseException as exc:
493
+ self._convert_socket_error(exc)
494
+
495
+ trio_socket.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
496
+ return SocketStream(trio_socket)
497
+
498
+
499
+ class UNIXSocketListener(_TrioSocketMixin, abc.SocketListener):
500
+ def __init__(self, raw_socket: socket.socket):
501
+ super().__init__(trio.socket.from_stdlib_socket(raw_socket))
502
+ self._accept_guard = ResourceGuard("accepting connections from")
503
+
504
+ async def accept(self) -> UNIXSocketStream:
505
+ with self._accept_guard:
506
+ try:
507
+ trio_socket, _addr = await self._trio_socket.accept()
508
+ except BaseException as exc:
509
+ self._convert_socket_error(exc)
510
+
511
+ return UNIXSocketStream(trio_socket)
512
+
513
+
514
+ class UDPSocket(_TrioSocketMixin[IPSockAddrType], abc.UDPSocket):
515
+ def __init__(self, trio_socket: TrioSocketType) -> None:
516
+ super().__init__(trio_socket)
517
+ self._receive_guard = ResourceGuard("reading from")
518
+ self._send_guard = ResourceGuard("writing to")
519
+
520
+ async def receive(self) -> tuple[bytes, IPSockAddrType]:
521
+ with self._receive_guard:
522
+ try:
523
+ data, addr = await self._trio_socket.recvfrom(65536)
524
+ return data, convert_ipv6_sockaddr(addr)
525
+ except BaseException as exc:
526
+ self._convert_socket_error(exc)
527
+
528
+ async def send(self, item: UDPPacketType) -> None:
529
+ with self._send_guard:
530
+ try:
531
+ await self._trio_socket.sendto(*item)
532
+ except BaseException as exc:
533
+ self._convert_socket_error(exc)
534
+
535
+
536
+ class ConnectedUDPSocket(_TrioSocketMixin[IPSockAddrType], abc.ConnectedUDPSocket):
537
+ def __init__(self, trio_socket: TrioSocketType) -> None:
538
+ super().__init__(trio_socket)
539
+ self._receive_guard = ResourceGuard("reading from")
540
+ self._send_guard = ResourceGuard("writing to")
541
+
542
+ async def receive(self) -> bytes:
543
+ with self._receive_guard:
544
+ try:
545
+ return await self._trio_socket.recv(65536)
546
+ except BaseException as exc:
547
+ self._convert_socket_error(exc)
548
+
549
+ async def send(self, item: bytes) -> None:
550
+ with self._send_guard:
551
+ try:
552
+ await self._trio_socket.send(item)
553
+ except BaseException as exc:
554
+ self._convert_socket_error(exc)
555
+
556
+
557
+ class UNIXDatagramSocket(_TrioSocketMixin[str], abc.UNIXDatagramSocket):
558
+ def __init__(self, trio_socket: TrioSocketType) -> None:
559
+ super().__init__(trio_socket)
560
+ self._receive_guard = ResourceGuard("reading from")
561
+ self._send_guard = ResourceGuard("writing to")
562
+
563
+ async def receive(self) -> UNIXDatagramPacketType:
564
+ with self._receive_guard:
565
+ try:
566
+ data, addr = await self._trio_socket.recvfrom(65536)
567
+ return data, addr
568
+ except BaseException as exc:
569
+ self._convert_socket_error(exc)
570
+
571
+ async def send(self, item: UNIXDatagramPacketType) -> None:
572
+ with self._send_guard:
573
+ try:
574
+ await self._trio_socket.sendto(*item)
575
+ except BaseException as exc:
576
+ self._convert_socket_error(exc)
577
+
578
+
579
+ class ConnectedUNIXDatagramSocket(
580
+ _TrioSocketMixin[str], abc.ConnectedUNIXDatagramSocket
581
+ ):
582
+ def __init__(self, trio_socket: TrioSocketType) -> None:
583
+ super().__init__(trio_socket)
584
+ self._receive_guard = ResourceGuard("reading from")
585
+ self._send_guard = ResourceGuard("writing to")
586
+
587
+ async def receive(self) -> bytes:
588
+ with self._receive_guard:
589
+ try:
590
+ return await self._trio_socket.recv(65536)
591
+ except BaseException as exc:
592
+ self._convert_socket_error(exc)
593
+
594
+ async def send(self, item: bytes) -> None:
595
+ with self._send_guard:
596
+ try:
597
+ await self._trio_socket.send(item)
598
+ except BaseException as exc:
599
+ self._convert_socket_error(exc)
600
+
601
+
602
+ #
603
+ # Synchronization
604
+ #
605
+
606
+
607
+ class Event(BaseEvent):
608
+ def __new__(cls) -> Event:
609
+ return object.__new__(cls)
610
+
611
+ def __init__(self) -> None:
612
+ self.__original = trio.Event()
613
+
614
+ def is_set(self) -> bool:
615
+ return self.__original.is_set()
616
+
617
+ async def wait(self) -> None:
618
+ return await self.__original.wait()
619
+
620
+ def statistics(self) -> EventStatistics:
621
+ orig_statistics = self.__original.statistics()
622
+ return EventStatistics(tasks_waiting=orig_statistics.tasks_waiting)
623
+
624
+ def set(self) -> None:
625
+ self.__original.set()
626
+
627
+
628
+ class Lock(BaseLock):
629
+ def __new__(cls, *, fast_acquire: bool = False) -> Lock:
630
+ return object.__new__(cls)
631
+
632
+ def __init__(self, *, fast_acquire: bool = False) -> None:
633
+ self._fast_acquire = fast_acquire
634
+ self.__original = trio.Lock()
635
+
636
+ @staticmethod
637
+ def _convert_runtime_error_msg(exc: RuntimeError) -> None:
638
+ if exc.args == ("attempt to re-acquire an already held Lock",):
639
+ exc.args = ("Attempted to acquire an already held Lock",)
640
+
641
+ async def acquire(self) -> None:
642
+ if not self._fast_acquire:
643
+ try:
644
+ await self.__original.acquire()
645
+ except RuntimeError as exc:
646
+ self._convert_runtime_error_msg(exc)
647
+ raise
648
+
649
+ return
650
+
651
+ # This is the "fast path" where we don't let other tasks run
652
+ await trio.lowlevel.checkpoint_if_cancelled()
653
+ try:
654
+ self.__original.acquire_nowait()
655
+ except trio.WouldBlock:
656
+ await self.__original._lot.park()
657
+ except RuntimeError as exc:
658
+ self._convert_runtime_error_msg(exc)
659
+ raise
660
+
661
+ def acquire_nowait(self) -> None:
662
+ try:
663
+ self.__original.acquire_nowait()
664
+ except trio.WouldBlock:
665
+ raise WouldBlock from None
666
+ except RuntimeError as exc:
667
+ self._convert_runtime_error_msg(exc)
668
+ raise
669
+
670
+ def locked(self) -> bool:
671
+ return self.__original.locked()
672
+
673
+ def release(self) -> None:
674
+ self.__original.release()
675
+
676
+ def statistics(self) -> LockStatistics:
677
+ orig_statistics = self.__original.statistics()
678
+ owner = TrioTaskInfo(orig_statistics.owner) if orig_statistics.owner else None
679
+ return LockStatistics(
680
+ orig_statistics.locked, owner, orig_statistics.tasks_waiting
681
+ )
682
+
683
+
684
+ class Semaphore(BaseSemaphore):
685
+ def __new__(
686
+ cls,
687
+ initial_value: int,
688
+ *,
689
+ max_value: int | None = None,
690
+ fast_acquire: bool = False,
691
+ ) -> Semaphore:
692
+ return object.__new__(cls)
693
+
694
+ def __init__(
695
+ self,
696
+ initial_value: int,
697
+ *,
698
+ max_value: int | None = None,
699
+ fast_acquire: bool = False,
700
+ ) -> None:
701
+ super().__init__(initial_value, max_value=max_value, fast_acquire=fast_acquire)
702
+ self.__original = trio.Semaphore(initial_value, max_value=max_value)
703
+
704
+ async def acquire(self) -> None:
705
+ if not self._fast_acquire:
706
+ await self.__original.acquire()
707
+ return
708
+
709
+ # This is the "fast path" where we don't let other tasks run
710
+ await trio.lowlevel.checkpoint_if_cancelled()
711
+ try:
712
+ self.__original.acquire_nowait()
713
+ except trio.WouldBlock:
714
+ await self.__original._lot.park()
715
+
716
+ def acquire_nowait(self) -> None:
717
+ try:
718
+ self.__original.acquire_nowait()
719
+ except trio.WouldBlock:
720
+ raise WouldBlock from None
721
+
722
+ @property
723
+ def max_value(self) -> int | None:
724
+ return self.__original.max_value
725
+
726
+ @property
727
+ def value(self) -> int:
728
+ return self.__original.value
729
+
730
+ def release(self) -> None:
731
+ self.__original.release()
732
+
733
+ def statistics(self) -> SemaphoreStatistics:
734
+ orig_statistics = self.__original.statistics()
735
+ return SemaphoreStatistics(orig_statistics.tasks_waiting)
736
+
737
+
738
+ class CapacityLimiter(BaseCapacityLimiter):
739
+ def __new__(
740
+ cls,
741
+ total_tokens: float | None = None,
742
+ *,
743
+ original: trio.CapacityLimiter | None = None,
744
+ ) -> CapacityLimiter:
745
+ return object.__new__(cls)
746
+
747
+ def __init__(
748
+ self,
749
+ total_tokens: float | None = None,
750
+ *,
751
+ original: trio.CapacityLimiter | None = None,
752
+ ) -> None:
753
+ if original is not None:
754
+ self.__original = original
755
+ else:
756
+ assert total_tokens is not None
757
+ self.__original = trio.CapacityLimiter(total_tokens)
758
+
759
+ async def __aenter__(self) -> None:
760
+ return await self.__original.__aenter__()
761
+
762
+ async def __aexit__(
763
+ self,
764
+ exc_type: type[BaseException] | None,
765
+ exc_val: BaseException | None,
766
+ exc_tb: TracebackType | None,
767
+ ) -> None:
768
+ await self.__original.__aexit__(exc_type, exc_val, exc_tb)
769
+
770
+ @property
771
+ def total_tokens(self) -> float:
772
+ return self.__original.total_tokens
773
+
774
+ @total_tokens.setter
775
+ def total_tokens(self, value: float) -> None:
776
+ self.__original.total_tokens = value
777
+
778
+ @property
779
+ def borrowed_tokens(self) -> int:
780
+ return self.__original.borrowed_tokens
781
+
782
+ @property
783
+ def available_tokens(self) -> float:
784
+ return self.__original.available_tokens
785
+
786
+ def acquire_nowait(self) -> None:
787
+ self.__original.acquire_nowait()
788
+
789
+ def acquire_on_behalf_of_nowait(self, borrower: object) -> None:
790
+ self.__original.acquire_on_behalf_of_nowait(borrower)
791
+
792
+ async def acquire(self) -> None:
793
+ await self.__original.acquire()
794
+
795
+ async def acquire_on_behalf_of(self, borrower: object) -> None:
796
+ await self.__original.acquire_on_behalf_of(borrower)
797
+
798
+ def release(self) -> None:
799
+ return self.__original.release()
800
+
801
+ def release_on_behalf_of(self, borrower: object) -> None:
802
+ return self.__original.release_on_behalf_of(borrower)
803
+
804
+ def statistics(self) -> CapacityLimiterStatistics:
805
+ orig = self.__original.statistics()
806
+ return CapacityLimiterStatistics(
807
+ borrowed_tokens=orig.borrowed_tokens,
808
+ total_tokens=orig.total_tokens,
809
+ borrowers=tuple(orig.borrowers),
810
+ tasks_waiting=orig.tasks_waiting,
811
+ )
812
+
813
+
814
+ _capacity_limiter_wrapper: trio.lowlevel.RunVar = RunVar("_capacity_limiter_wrapper")
815
+
816
+
817
+ #
818
+ # Signal handling
819
+ #
820
+
821
+
822
+ class _SignalReceiver:
823
+ _iterator: AsyncIterator[int]
824
+
825
+ def __init__(self, signals: tuple[Signals, ...]):
826
+ self._signals = signals
827
+
828
+ def __enter__(self) -> _SignalReceiver:
829
+ self._cm = trio.open_signal_receiver(*self._signals)
830
+ self._iterator = self._cm.__enter__()
831
+ return self
832
+
833
+ def __exit__(
834
+ self,
835
+ exc_type: type[BaseException] | None,
836
+ exc_val: BaseException | None,
837
+ exc_tb: TracebackType | None,
838
+ ) -> bool | None:
839
+ return self._cm.__exit__(exc_type, exc_val, exc_tb)
840
+
841
+ def __aiter__(self) -> _SignalReceiver:
842
+ return self
843
+
844
+ async def __anext__(self) -> Signals:
845
+ signum = await self._iterator.__anext__()
846
+ return Signals(signum)
847
+
848
+
849
+ #
850
+ # Testing and debugging
851
+ #
852
+
853
+
854
+ class TestRunner(abc.TestRunner):
855
+ def __init__(self, **options: Any) -> None:
856
+ from queue import Queue
857
+
858
+ self._call_queue: Queue[Callable[[], object]] = Queue()
859
+ self._send_stream: MemoryObjectSendStream | None = None
860
+ self._options = options
861
+
862
+ def __exit__(
863
+ self,
864
+ exc_type: type[BaseException] | None,
865
+ exc_val: BaseException | None,
866
+ exc_tb: types.TracebackType | None,
867
+ ) -> None:
868
+ if self._send_stream:
869
+ self._send_stream.close()
870
+ while self._send_stream is not None:
871
+ self._call_queue.get()()
872
+
873
+ async def _run_tests_and_fixtures(self) -> None:
874
+ self._send_stream, receive_stream = create_memory_object_stream(1)
875
+ with receive_stream:
876
+ async for coro, outcome_holder in receive_stream:
877
+ try:
878
+ retval = await coro
879
+ except BaseException as exc:
880
+ outcome_holder.append(Error(exc))
881
+ else:
882
+ outcome_holder.append(Value(retval))
883
+
884
+ def _main_task_finished(self, outcome: object) -> None:
885
+ self._send_stream = None
886
+
887
+ def _call_in_runner_task(
888
+ self,
889
+ func: Callable[P, Awaitable[T_Retval]],
890
+ *args: P.args,
891
+ **kwargs: P.kwargs,
892
+ ) -> T_Retval:
893
+ if self._send_stream is None:
894
+ trio.lowlevel.start_guest_run(
895
+ self._run_tests_and_fixtures,
896
+ run_sync_soon_threadsafe=self._call_queue.put,
897
+ done_callback=self._main_task_finished,
898
+ **self._options,
899
+ )
900
+ while self._send_stream is None:
901
+ self._call_queue.get()()
902
+
903
+ outcome_holder: list[Outcome] = []
904
+ self._send_stream.send_nowait((func(*args, **kwargs), outcome_holder))
905
+ while not outcome_holder:
906
+ self._call_queue.get()()
907
+
908
+ return outcome_holder[0].unwrap()
909
+
910
+ def run_asyncgen_fixture(
911
+ self,
912
+ fixture_func: Callable[..., AsyncGenerator[T_Retval, Any]],
913
+ kwargs: dict[str, Any],
914
+ ) -> Iterable[T_Retval]:
915
+ asyncgen = fixture_func(**kwargs)
916
+ fixturevalue: T_Retval = self._call_in_runner_task(asyncgen.asend, None)
917
+
918
+ yield fixturevalue
919
+
920
+ try:
921
+ self._call_in_runner_task(asyncgen.asend, None)
922
+ except StopAsyncIteration:
923
+ pass
924
+ else:
925
+ self._call_in_runner_task(asyncgen.aclose)
926
+ raise RuntimeError("Async generator fixture did not stop")
927
+
928
+ def run_fixture(
929
+ self,
930
+ fixture_func: Callable[..., Coroutine[Any, Any, T_Retval]],
931
+ kwargs: dict[str, Any],
932
+ ) -> T_Retval:
933
+ return self._call_in_runner_task(fixture_func, **kwargs)
934
+
935
+ def run_test(
936
+ self, test_func: Callable[..., Coroutine[Any, Any, Any]], kwargs: dict[str, Any]
937
+ ) -> None:
938
+ self._call_in_runner_task(test_func, **kwargs)
939
+
940
+
941
+ class TrioTaskInfo(TaskInfo):
942
+ def __init__(self, task: trio.lowlevel.Task):
943
+ parent_id = None
944
+ if task.parent_nursery and task.parent_nursery.parent_task:
945
+ parent_id = id(task.parent_nursery.parent_task)
946
+
947
+ super().__init__(id(task), parent_id, task.name, task.coro)
948
+ self._task = weakref.proxy(task)
949
+
950
+ def has_pending_cancellation(self) -> bool:
951
+ try:
952
+ return self._task._cancel_status.effectively_cancelled
953
+ except ReferenceError:
954
+ # If the task is no longer around, it surely doesn't have a cancellation
955
+ # pending
956
+ return False
957
+
958
+
959
+ class TrioBackend(AsyncBackend):
960
+ @classmethod
961
+ def run(
962
+ cls,
963
+ func: Callable[[Unpack[PosArgsT]], Awaitable[T_Retval]],
964
+ args: tuple[Unpack[PosArgsT]],
965
+ kwargs: dict[str, Any],
966
+ options: dict[str, Any],
967
+ ) -> T_Retval:
968
+ return trio.run(func, *args)
969
+
970
+ @classmethod
971
+ def current_token(cls) -> object:
972
+ return trio.lowlevel.current_trio_token()
973
+
974
+ @classmethod
975
+ def current_time(cls) -> float:
976
+ return trio.current_time()
977
+
978
+ @classmethod
979
+ def cancelled_exception_class(cls) -> type[BaseException]:
980
+ return trio.Cancelled
981
+
982
+ @classmethod
983
+ async def checkpoint(cls) -> None:
984
+ await trio.lowlevel.checkpoint()
985
+
986
+ @classmethod
987
+ async def checkpoint_if_cancelled(cls) -> None:
988
+ await trio.lowlevel.checkpoint_if_cancelled()
989
+
990
+ @classmethod
991
+ async def cancel_shielded_checkpoint(cls) -> None:
992
+ await trio.lowlevel.cancel_shielded_checkpoint()
993
+
994
+ @classmethod
995
+ async def sleep(cls, delay: float) -> None:
996
+ await trio.sleep(delay)
997
+
998
+ @classmethod
999
+ def create_cancel_scope(
1000
+ cls, *, deadline: float = math.inf, shield: bool = False
1001
+ ) -> abc.CancelScope:
1002
+ return CancelScope(deadline=deadline, shield=shield)
1003
+
1004
+ @classmethod
1005
+ def current_effective_deadline(cls) -> float:
1006
+ return trio.current_effective_deadline()
1007
+
1008
+ @classmethod
1009
+ def create_task_group(cls) -> abc.TaskGroup:
1010
+ return TaskGroup()
1011
+
1012
+ @classmethod
1013
+ def create_event(cls) -> abc.Event:
1014
+ return Event()
1015
+
1016
+ @classmethod
1017
+ def create_lock(cls, *, fast_acquire: bool) -> Lock:
1018
+ return Lock(fast_acquire=fast_acquire)
1019
+
1020
+ @classmethod
1021
+ def create_semaphore(
1022
+ cls,
1023
+ initial_value: int,
1024
+ *,
1025
+ max_value: int | None = None,
1026
+ fast_acquire: bool = False,
1027
+ ) -> abc.Semaphore:
1028
+ return Semaphore(initial_value, max_value=max_value, fast_acquire=fast_acquire)
1029
+
1030
+ @classmethod
1031
+ def create_capacity_limiter(cls, total_tokens: float) -> CapacityLimiter:
1032
+ return CapacityLimiter(total_tokens)
1033
+
1034
+ @classmethod
1035
+ async def run_sync_in_worker_thread(
1036
+ cls,
1037
+ func: Callable[[Unpack[PosArgsT]], T_Retval],
1038
+ args: tuple[Unpack[PosArgsT]],
1039
+ abandon_on_cancel: bool = False,
1040
+ limiter: abc.CapacityLimiter | None = None,
1041
+ ) -> T_Retval:
1042
+ def wrapper() -> T_Retval:
1043
+ with claim_worker_thread(TrioBackend, token):
1044
+ return func(*args)
1045
+
1046
+ token = TrioBackend.current_token()
1047
+ return await run_sync(
1048
+ wrapper,
1049
+ abandon_on_cancel=abandon_on_cancel,
1050
+ limiter=cast(trio.CapacityLimiter, limiter),
1051
+ )
1052
+
1053
+ @classmethod
1054
+ def check_cancelled(cls) -> None:
1055
+ trio.from_thread.check_cancelled()
1056
+
1057
+ @classmethod
1058
+ def run_async_from_thread(
1059
+ cls,
1060
+ func: Callable[[Unpack[PosArgsT]], Awaitable[T_Retval]],
1061
+ args: tuple[Unpack[PosArgsT]],
1062
+ token: object,
1063
+ ) -> T_Retval:
1064
+ trio_token = cast("trio.lowlevel.TrioToken | None", token)
1065
+ try:
1066
+ return trio.from_thread.run(func, *args, trio_token=trio_token)
1067
+ except trio.RunFinishedError:
1068
+ raise RunFinishedError from None
1069
+
1070
+ @classmethod
1071
+ def run_sync_from_thread(
1072
+ cls,
1073
+ func: Callable[[Unpack[PosArgsT]], T_Retval],
1074
+ args: tuple[Unpack[PosArgsT]],
1075
+ token: object,
1076
+ ) -> T_Retval:
1077
+ trio_token = cast("trio.lowlevel.TrioToken | None", token)
1078
+ try:
1079
+ return trio.from_thread.run_sync(func, *args, trio_token=trio_token)
1080
+ except trio.RunFinishedError:
1081
+ raise RunFinishedError from None
1082
+
1083
+ @classmethod
1084
+ async def open_process(
1085
+ cls,
1086
+ command: StrOrBytesPath | Sequence[StrOrBytesPath],
1087
+ *,
1088
+ stdin: int | IO[Any] | None,
1089
+ stdout: int | IO[Any] | None,
1090
+ stderr: int | IO[Any] | None,
1091
+ **kwargs: Any,
1092
+ ) -> Process:
1093
+ def convert_item(item: StrOrBytesPath) -> str:
1094
+ str_or_bytes = os.fspath(item)
1095
+ if isinstance(str_or_bytes, str):
1096
+ return str_or_bytes
1097
+ else:
1098
+ return os.fsdecode(str_or_bytes)
1099
+
1100
+ if isinstance(command, (str, bytes, PathLike)):
1101
+ process = await trio.lowlevel.open_process(
1102
+ convert_item(command),
1103
+ stdin=stdin,
1104
+ stdout=stdout,
1105
+ stderr=stderr,
1106
+ shell=True,
1107
+ **kwargs,
1108
+ )
1109
+ else:
1110
+ process = await trio.lowlevel.open_process(
1111
+ [convert_item(item) for item in command],
1112
+ stdin=stdin,
1113
+ stdout=stdout,
1114
+ stderr=stderr,
1115
+ shell=False,
1116
+ **kwargs,
1117
+ )
1118
+
1119
+ stdin_stream = SendStreamWrapper(process.stdin) if process.stdin else None
1120
+ stdout_stream = ReceiveStreamWrapper(process.stdout) if process.stdout else None
1121
+ stderr_stream = ReceiveStreamWrapper(process.stderr) if process.stderr else None
1122
+ return Process(process, stdin_stream, stdout_stream, stderr_stream)
1123
+
1124
+ @classmethod
1125
+ def setup_process_pool_exit_at_shutdown(cls, workers: set[abc.Process]) -> None:
1126
+ trio.lowlevel.spawn_system_task(_shutdown_process_pool, workers)
1127
+
1128
+ @classmethod
1129
+ async def connect_tcp(
1130
+ cls, host: str, port: int, local_address: IPSockAddrType | None = None
1131
+ ) -> SocketStream:
1132
+ family = socket.AF_INET6 if ":" in host else socket.AF_INET
1133
+ trio_socket = trio.socket.socket(family)
1134
+ trio_socket.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
1135
+ if local_address:
1136
+ await trio_socket.bind(local_address)
1137
+
1138
+ try:
1139
+ await trio_socket.connect((host, port))
1140
+ except BaseException:
1141
+ trio_socket.close()
1142
+ raise
1143
+
1144
+ return SocketStream(trio_socket)
1145
+
1146
+ @classmethod
1147
+ async def connect_unix(cls, path: str | bytes) -> abc.UNIXSocketStream:
1148
+ trio_socket = trio.socket.socket(socket.AF_UNIX)
1149
+ try:
1150
+ await trio_socket.connect(path)
1151
+ except BaseException:
1152
+ trio_socket.close()
1153
+ raise
1154
+
1155
+ return UNIXSocketStream(trio_socket)
1156
+
1157
+ @classmethod
1158
+ def create_tcp_listener(cls, sock: socket.socket) -> abc.SocketListener:
1159
+ return TCPSocketListener(sock)
1160
+
1161
+ @classmethod
1162
+ def create_unix_listener(cls, sock: socket.socket) -> abc.SocketListener:
1163
+ return UNIXSocketListener(sock)
1164
+
1165
+ @classmethod
1166
+ async def create_udp_socket(
1167
+ cls,
1168
+ family: socket.AddressFamily,
1169
+ local_address: IPSockAddrType | None,
1170
+ remote_address: IPSockAddrType | None,
1171
+ reuse_port: bool,
1172
+ ) -> UDPSocket | ConnectedUDPSocket:
1173
+ trio_socket = trio.socket.socket(family=family, type=socket.SOCK_DGRAM)
1174
+
1175
+ if reuse_port:
1176
+ trio_socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEPORT, 1)
1177
+
1178
+ if local_address:
1179
+ await trio_socket.bind(local_address)
1180
+
1181
+ if remote_address:
1182
+ await trio_socket.connect(remote_address)
1183
+ return ConnectedUDPSocket(trio_socket)
1184
+ else:
1185
+ return UDPSocket(trio_socket)
1186
+
1187
+ @classmethod
1188
+ @overload
1189
+ async def create_unix_datagram_socket(
1190
+ cls, raw_socket: socket.socket, remote_path: None
1191
+ ) -> abc.UNIXDatagramSocket: ...
1192
+
1193
+ @classmethod
1194
+ @overload
1195
+ async def create_unix_datagram_socket(
1196
+ cls, raw_socket: socket.socket, remote_path: str | bytes
1197
+ ) -> abc.ConnectedUNIXDatagramSocket: ...
1198
+
1199
+ @classmethod
1200
+ async def create_unix_datagram_socket(
1201
+ cls, raw_socket: socket.socket, remote_path: str | bytes | None
1202
+ ) -> abc.UNIXDatagramSocket | abc.ConnectedUNIXDatagramSocket:
1203
+ trio_socket = trio.socket.from_stdlib_socket(raw_socket)
1204
+
1205
+ if remote_path:
1206
+ await trio_socket.connect(remote_path)
1207
+ return ConnectedUNIXDatagramSocket(trio_socket)
1208
+ else:
1209
+ return UNIXDatagramSocket(trio_socket)
1210
+
1211
+ @classmethod
1212
+ async def getaddrinfo(
1213
+ cls,
1214
+ host: bytes | str | None,
1215
+ port: str | int | None,
1216
+ *,
1217
+ family: int | AddressFamily = 0,
1218
+ type: int | SocketKind = 0,
1219
+ proto: int = 0,
1220
+ flags: int = 0,
1221
+ ) -> Sequence[
1222
+ tuple[
1223
+ AddressFamily,
1224
+ SocketKind,
1225
+ int,
1226
+ str,
1227
+ tuple[str, int] | tuple[str, int, int, int] | tuple[int, bytes],
1228
+ ]
1229
+ ]:
1230
+ return await trio.socket.getaddrinfo(host, port, family, type, proto, flags)
1231
+
1232
+ @classmethod
1233
+ async def getnameinfo(
1234
+ cls, sockaddr: IPSockAddrType, flags: int = 0
1235
+ ) -> tuple[str, str]:
1236
+ return await trio.socket.getnameinfo(sockaddr, flags)
1237
+
1238
+ @classmethod
1239
+ async def wait_readable(cls, obj: FileDescriptorLike) -> None:
1240
+ try:
1241
+ await wait_readable(obj)
1242
+ except trio.ClosedResourceError as exc:
1243
+ raise ClosedResourceError().with_traceback(exc.__traceback__) from None
1244
+ except trio.BusyResourceError:
1245
+ raise BusyResourceError("reading from") from None
1246
+
1247
+ @classmethod
1248
+ async def wait_writable(cls, obj: FileDescriptorLike) -> None:
1249
+ try:
1250
+ await wait_writable(obj)
1251
+ except trio.ClosedResourceError as exc:
1252
+ raise ClosedResourceError().with_traceback(exc.__traceback__) from None
1253
+ except trio.BusyResourceError:
1254
+ raise BusyResourceError("writing to") from None
1255
+
1256
+ @classmethod
1257
+ def notify_closing(cls, obj: FileDescriptorLike) -> None:
1258
+ notify_closing(obj)
1259
+
1260
+ @classmethod
1261
+ async def wrap_listener_socket(cls, sock: socket.socket) -> abc.SocketListener:
1262
+ return TCPSocketListener(sock)
1263
+
1264
+ @classmethod
1265
+ async def wrap_stream_socket(cls, sock: socket.socket) -> SocketStream:
1266
+ trio_sock = trio.socket.from_stdlib_socket(sock)
1267
+ return SocketStream(trio_sock)
1268
+
1269
+ @classmethod
1270
+ async def wrap_unix_stream_socket(cls, sock: socket.socket) -> UNIXSocketStream:
1271
+ trio_sock = trio.socket.from_stdlib_socket(sock)
1272
+ return UNIXSocketStream(trio_sock)
1273
+
1274
+ @classmethod
1275
+ async def wrap_udp_socket(cls, sock: socket.socket) -> UDPSocket:
1276
+ trio_sock = trio.socket.from_stdlib_socket(sock)
1277
+ return UDPSocket(trio_sock)
1278
+
1279
+ @classmethod
1280
+ async def wrap_connected_udp_socket(cls, sock: socket.socket) -> ConnectedUDPSocket:
1281
+ trio_sock = trio.socket.from_stdlib_socket(sock)
1282
+ return ConnectedUDPSocket(trio_sock)
1283
+
1284
+ @classmethod
1285
+ async def wrap_unix_datagram_socket(cls, sock: socket.socket) -> UNIXDatagramSocket:
1286
+ trio_sock = trio.socket.from_stdlib_socket(sock)
1287
+ return UNIXDatagramSocket(trio_sock)
1288
+
1289
+ @classmethod
1290
+ async def wrap_connected_unix_datagram_socket(
1291
+ cls, sock: socket.socket
1292
+ ) -> ConnectedUNIXDatagramSocket:
1293
+ trio_sock = trio.socket.from_stdlib_socket(sock)
1294
+ return ConnectedUNIXDatagramSocket(trio_sock)
1295
+
1296
+ @classmethod
1297
+ def current_default_thread_limiter(cls) -> CapacityLimiter:
1298
+ try:
1299
+ return _capacity_limiter_wrapper.get()
1300
+ except LookupError:
1301
+ limiter = CapacityLimiter(
1302
+ original=trio.to_thread.current_default_thread_limiter()
1303
+ )
1304
+ _capacity_limiter_wrapper.set(limiter)
1305
+ return limiter
1306
+
1307
+ @classmethod
1308
+ def open_signal_receiver(
1309
+ cls, *signals: Signals
1310
+ ) -> AbstractContextManager[AsyncIterator[Signals]]:
1311
+ return _SignalReceiver(signals)
1312
+
1313
+ @classmethod
1314
+ def get_current_task(cls) -> TaskInfo:
1315
+ task = current_task()
1316
+ return TrioTaskInfo(task)
1317
+
1318
+ @classmethod
1319
+ def get_running_tasks(cls) -> Sequence[TaskInfo]:
1320
+ root_task = current_root_task()
1321
+ assert root_task
1322
+ task_infos = [TrioTaskInfo(root_task)]
1323
+ nurseries = root_task.child_nurseries
1324
+ while nurseries:
1325
+ new_nurseries: list[trio.Nursery] = []
1326
+ for nursery in nurseries:
1327
+ for task in nursery.child_tasks:
1328
+ task_infos.append(TrioTaskInfo(task))
1329
+ new_nurseries.extend(task.child_nurseries)
1330
+
1331
+ nurseries = new_nurseries
1332
+
1333
+ return task_infos
1334
+
1335
+ @classmethod
1336
+ async def wait_all_tasks_blocked(cls) -> None:
1337
+ from trio.testing import wait_all_tasks_blocked
1338
+
1339
+ await wait_all_tasks_blocked()
1340
+
1341
+ @classmethod
1342
+ def create_test_runner(cls, options: dict[str, Any]) -> TestRunner:
1343
+ return TestRunner(**options)
1344
+
1345
+
1346
+ backend_class = TrioBackend
.venv/Lib/site-packages/anyio/_core/__init__.py ADDED
File without changes
.venv/Lib/site-packages/anyio/_core/__pycache__/__init__.cpython-313.pyc ADDED
Binary file (333 Bytes). View file
 
.venv/Lib/site-packages/anyio/_core/__pycache__/_asyncio_selector_thread.cpython-313.pyc ADDED
Binary file (8.78 kB). View file
 
.venv/Lib/site-packages/anyio/_core/__pycache__/_contextmanagers.cpython-313.pyc ADDED
Binary file (9.21 kB). View file
 
.venv/Lib/site-packages/anyio/_core/__pycache__/_eventloop.cpython-313.pyc ADDED
Binary file (8.26 kB). View file
 
.venv/Lib/site-packages/anyio/_core/__pycache__/_exceptions.cpython-313.pyc ADDED
Binary file (7.8 kB). View file
 
.venv/Lib/site-packages/anyio/_core/__pycache__/_fileio.cpython-313.pyc ADDED
Binary file (43.4 kB). View file
 
.venv/Lib/site-packages/anyio/_core/__pycache__/_resources.cpython-313.pyc ADDED
Binary file (1.07 kB). View file
 
.venv/Lib/site-packages/anyio/_core/__pycache__/_signals.cpython-313.pyc ADDED
Binary file (1.48 kB). View file
 
.venv/Lib/site-packages/anyio/_core/__pycache__/_sockets.cpython-313.pyc ADDED
Binary file (40.2 kB). View file
 
.venv/Lib/site-packages/anyio/_core/__pycache__/_streams.cpython-313.pyc ADDED
Binary file (2.52 kB). View file
 
.venv/Lib/site-packages/anyio/_core/__pycache__/_subprocesses.cpython-313.pyc ADDED
Binary file (9.59 kB). View file