HighTechHighLevel commited on
Commit
187f7c6
·
verified ·
1 Parent(s): 0a03be6

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 +50 -0
  2. .venv/.gitignore +2 -0
  3. .venv/Lib/site-packages/__pycache__/typing_extensions.cpython-314.pyc +3 -0
  4. .venv/Lib/site-packages/_yaml/__init__.py +33 -0
  5. .venv/Lib/site-packages/_yaml/__pycache__/__init__.cpython-314.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-314.pyc +0 -0
  14. .venv/Lib/site-packages/annotated_doc/__pycache__/main.cpython-314.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.13.0.dist-info/INSTALLER +1 -0
  18. .venv/Lib/site-packages/anyio-4.13.0.dist-info/METADATA +105 -0
  19. .venv/Lib/site-packages/anyio-4.13.0.dist-info/RECORD +92 -0
  20. .venv/Lib/site-packages/anyio-4.13.0.dist-info/WHEEL +5 -0
  21. .venv/Lib/site-packages/anyio-4.13.0.dist-info/entry_points.txt +2 -0
  22. .venv/Lib/site-packages/anyio-4.13.0.dist-info/licenses/LICENSE +20 -0
  23. .venv/Lib/site-packages/anyio-4.13.0.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-314.pyc +0 -0
  26. .venv/Lib/site-packages/anyio/__pycache__/from_thread.cpython-314.pyc +0 -0
  27. .venv/Lib/site-packages/anyio/__pycache__/functools.cpython-314.pyc +0 -0
  28. .venv/Lib/site-packages/anyio/__pycache__/lowlevel.cpython-314.pyc +0 -0
  29. .venv/Lib/site-packages/anyio/__pycache__/pytest_plugin.cpython-314.pyc +0 -0
  30. .venv/Lib/site-packages/anyio/__pycache__/to_interpreter.cpython-314.pyc +0 -0
  31. .venv/Lib/site-packages/anyio/__pycache__/to_process.cpython-314.pyc +0 -0
  32. .venv/Lib/site-packages/anyio/__pycache__/to_thread.cpython-314.pyc +0 -0
  33. .venv/Lib/site-packages/anyio/_backends/__init__.py +0 -0
  34. .venv/Lib/site-packages/anyio/_backends/__pycache__/__init__.cpython-314.pyc +0 -0
  35. .venv/Lib/site-packages/anyio/_backends/__pycache__/_asyncio.cpython-314.pyc +3 -0
  36. .venv/Lib/site-packages/anyio/_backends/__pycache__/_trio.cpython-314.pyc +0 -0
  37. .venv/Lib/site-packages/anyio/_backends/_asyncio.py +0 -0
  38. .venv/Lib/site-packages/anyio/_backends/_trio.py +1343 -0
  39. .venv/Lib/site-packages/anyio/_core/__init__.py +0 -0
  40. .venv/Lib/site-packages/anyio/_core/__pycache__/__init__.cpython-314.pyc +0 -0
  41. .venv/Lib/site-packages/anyio/_core/__pycache__/_asyncio_selector_thread.cpython-314.pyc +0 -0
  42. .venv/Lib/site-packages/anyio/_core/__pycache__/_contextmanagers.cpython-314.pyc +0 -0
  43. .venv/Lib/site-packages/anyio/_core/__pycache__/_eventloop.cpython-314.pyc +0 -0
  44. .venv/Lib/site-packages/anyio/_core/__pycache__/_exceptions.cpython-314.pyc +0 -0
  45. .venv/Lib/site-packages/anyio/_core/__pycache__/_fileio.cpython-314.pyc +0 -0
  46. .venv/Lib/site-packages/anyio/_core/__pycache__/_resources.cpython-314.pyc +0 -0
  47. .venv/Lib/site-packages/anyio/_core/__pycache__/_signals.cpython-314.pyc +0 -0
  48. .venv/Lib/site-packages/anyio/_core/__pycache__/_sockets.cpython-314.pyc +0 -0
  49. .venv/Lib/site-packages/anyio/_core/__pycache__/_streams.cpython-314.pyc +0 -0
  50. .venv/Lib/site-packages/anyio/_core/__pycache__/_subprocesses.cpython-314.pyc +0 -0
.gitattributes CHANGED
@@ -58,3 +58,53 @@ 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-314.pyc filter=lfs diff=lfs merge=lfs -text
62
+ .venv/Lib/site-packages/anyio/_backends/__pycache__/_asyncio.cpython-314.pyc filter=lfs diff=lfs merge=lfs -text
63
+ .venv/Lib/site-packages/click/__pycache__/core.cpython-314.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-314.pyc filter=lfs diff=lfs merge=lfs -text
66
+ .venv/Lib/site-packages/huggingface_hub/inference/__pycache__/_client.cpython-314.pyc filter=lfs diff=lfs merge=lfs -text
67
+ .venv/Lib/site-packages/huggingface_hub/inference/_generated/__pycache__/_async_client.cpython-314.pyc filter=lfs diff=lfs merge=lfs -text
68
+ .venv/Lib/site-packages/pip/_vendor/distlib/t64-arm.exe filter=lfs diff=lfs merge=lfs -text
69
+ .venv/Lib/site-packages/pip/_vendor/distlib/t64.exe filter=lfs diff=lfs merge=lfs -text
70
+ .venv/Lib/site-packages/pip/_vendor/distlib/w64-arm.exe filter=lfs diff=lfs merge=lfs -text
71
+ .venv/Lib/site-packages/pip/_vendor/distlib/w64.exe filter=lfs diff=lfs merge=lfs -text
72
+ .venv/Lib/site-packages/pip/_vendor/idna/__pycache__/idnadata.cpython-314.pyc filter=lfs diff=lfs merge=lfs -text
73
+ .venv/Lib/site-packages/pip/_vendor/idna/__pycache__/uts46data.cpython-314.pyc filter=lfs diff=lfs merge=lfs -text
74
+ .venv/Lib/site-packages/pip/_vendor/pkg_resources/__pycache__/__init__.cpython-314.pyc filter=lfs diff=lfs merge=lfs -text
75
+ .venv/Lib/site-packages/pip/_vendor/rich/__pycache__/_emoji_codes.cpython-314.pyc filter=lfs diff=lfs merge=lfs -text
76
+ .venv/Lib/site-packages/pip/_vendor/rich/__pycache__/console.cpython-314.pyc filter=lfs diff=lfs merge=lfs -text
77
+ .venv/Lib/site-packages/pygments/lexers/__pycache__/_cocoa_builtins.cpython-314.pyc filter=lfs diff=lfs merge=lfs -text
78
+ .venv/Lib/site-packages/pygments/lexers/__pycache__/_lilypond_builtins.cpython-314.pyc filter=lfs diff=lfs merge=lfs -text
79
+ .venv/Lib/site-packages/pygments/lexers/__pycache__/lisp.cpython-314.pyc filter=lfs diff=lfs merge=lfs -text
80
+ .venv/Lib/site-packages/pygments/lexers/__pycache__/matlab.cpython-314.pyc filter=lfs diff=lfs merge=lfs -text
81
+ .venv/Lib/site-packages/rich/__pycache__/_emoji_codes.cpython-314.pyc filter=lfs diff=lfs merge=lfs -text
82
+ .venv/Lib/site-packages/rich/__pycache__/console.cpython-314.pyc filter=lfs diff=lfs merge=lfs -text
83
+ .venv/Lib/site-packages/yaml/_yaml.cp314-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
84
+ .venv/Scripts/hf.exe filter=lfs diff=lfs merge=lfs -text
85
+ .venv/Scripts/httpx.exe filter=lfs diff=lfs merge=lfs -text
86
+ .venv/Scripts/huggingface-cli.exe filter=lfs diff=lfs merge=lfs -text
87
+ .venv/Scripts/idna.exe filter=lfs diff=lfs merge=lfs -text
88
+ .venv/Scripts/markdown-it.exe filter=lfs diff=lfs merge=lfs -text
89
+ .venv/Scripts/pip.exe filter=lfs diff=lfs merge=lfs -text
90
+ .venv/Scripts/pip3.14.exe filter=lfs diff=lfs merge=lfs -text
91
+ .venv/Scripts/pip3.exe filter=lfs diff=lfs merge=lfs -text
92
+ .venv/Scripts/pygmentize.exe filter=lfs diff=lfs merge=lfs -text
93
+ .venv/Scripts/python.exe filter=lfs diff=lfs merge=lfs -text
94
+ .venv/Scripts/pythonw.exe filter=lfs diff=lfs merge=lfs -text
95
+ .venv/Scripts/tiny-agents.exe filter=lfs diff=lfs merge=lfs -text
96
+ .venv/Scripts/tqdm.exe filter=lfs diff=lfs merge=lfs -text
97
+ .venv/Scripts/typer.exe filter=lfs diff=lfs merge=lfs -text
98
+ 01_Research_Papers/(PID[[:space:]]tuning[[:space:]]OR[[:space:]]PID[[:space:]]control)[[:space:]]AND[[:space:]](auto-tuning[[:space:]]OR[[:space:]]fractional[[:space:]]order[[:space:]]PID[[:space:]]OR[[:space:]]machine[[:space:]]learning[[:space:]]PID)/A_Novel_State_Machine-Fractional_Order_PID_Control_Strategy_for_Energy_Management_Fra.pdf filter=lfs diff=lfs merge=lfs -text
99
+ 01_Research_Papers/(PID[[:space:]]tuning[[:space:]]OR[[:space:]]PID[[:space:]]control)[[:space:]]AND[[:space:]](auto-tuning[[:space:]]OR[[:space:]]fractional[[:space:]]order[[:space:]]PID[[:space:]]OR[[:space:]]machine[[:space:]]learning[[:space:]]PID)/Comparative_Analysis_of_Evolutionary_Algorithms_for_PID_Controller_Optimization_in_Pn.pdf filter=lfs diff=lfs merge=lfs -text
100
+ 01_Research_Papers/(PID[[:space:]]tuning[[:space:]]OR[[:space:]]PID[[:space:]]control)[[:space:]]AND[[:space:]](auto-tuning[[:space:]]OR[[:space:]]fractional[[:space:]]order[[:space:]]PID[[:space:]]OR[[:space:]]machine[[:space:]]learning[[:space:]]PID)/Enhancing_Dual-Loop_Pressure_Control_in_Pneumatic_Soft_Robotics_With_a_Comparison_of_.pdf filter=lfs diff=lfs merge=lfs -text
101
+ 01_Research_Papers/(PID[[:space:]]tuning[[:space:]]OR[[:space:]]PID[[:space:]]control)[[:space:]]AND[[:space:]](auto-tuning[[:space:]]OR[[:space:]]fractional[[:space:]]order[[:space:]]PID[[:space:]]OR[[:space:]]machine[[:space:]]learning[[:space:]]PID)/Exploring_PID_and_FOPID_Control_Methods_for_Thrust_Vectoring_in_Aerospace_Systems-A_B.pdf filter=lfs diff=lfs merge=lfs -text
102
+ 01_Research_Papers/(PID[[:space:]]tuning[[:space:]]OR[[:space:]]PID[[:space:]]control)[[:space:]]AND[[:space:]](auto-tuning[[:space:]]OR[[:space:]]fractional[[:space:]]order[[:space:]]PID[[:space:]]OR[[:space:]]machine[[:space:]]learning[[:space:]]PID)/Improving_Trajectory_Tracking_of_Differential_Wheeled_Mobile_Robots_With_Enhanced_GWO.pdf filter=lfs diff=lfs merge=lfs -text
103
+ 01_Research_Papers/(PID[[:space:]]tuning[[:space:]]OR[[:space:]]PID[[:space:]]control)[[:space:]]AND[[:space:]](auto-tuning[[:space:]]OR[[:space:]]fractional[[:space:]]order[[:space:]]PID[[:space:]]OR[[:space:]]machine[[:space:]]learning[[:space:]]PID)/New_Generation_of_Higher-Order_Controllers_Leveraging_PID_Control_for_Improved_System_Response.pdf filter=lfs diff=lfs merge=lfs -text
104
+ 01_Research_Papers/(PID[[:space:]]tuning[[:space:]]OR[[:space:]]PID[[:space:]]controller)[[:space:]]AND[[:space:]](industrial[[:space:]]automation[[:space:]]OR[[:space:]]process[[:space:]]control)/Bandwidth_Allocation_Design_for_Self-Tuning_Disturbance_Rejection_PID_Control_Multivariable_Extremum_Seeking_Approach.pdf filter=lfs diff=lfs merge=lfs -text
105
+ 01_Research_Papers/(PID[[:space:]]tuning[[:space:]]OR[[:space:]]PID[[:space:]]controller)[[:space:]]AND[[:space:]](industrial[[:space:]]automation[[:space:]]OR[[:space:]]process[[:space:]]control)/WearaCob_A_Unified_Bidirectional_Framework_for_Adaptive_Synergy_Between_Wearable_and_Collaborative_Robotics.pdf filter=lfs diff=lfs merge=lfs -text
106
+ 02_Software_Tools/awtSCADA_Demo_EN/SCADA_Gateway.exe filter=lfs diff=lfs merge=lfs -text
107
+ 02_Software_Tools/awtSCADA_Demo_EN/SCADA_Gateway_macOS filter=lfs diff=lfs merge=lfs -text
108
+ 02_Software_Tools/xArrow[[:space:]]Tutorial[[:space:]]Video/GetStart.avi filter=lfs diff=lfs merge=lfs -text
109
+ 02_Software_Tools/xArrow[[:space:]]Tutorial[[:space:]]Video/TestWebServer.avi filter=lfs diff=lfs merge=lfs -text
110
+ 02_Software_Tools/xArrow_x86/xArrow_x86.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-314.pyc ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2d570da322c39c16e9d53843117911b2549e91223552543ed8c42785eebd988a
3
+ size 175524
.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-314.pyc ADDED
Binary file (880 Bytes). 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-314.pyc,,
9
+ annotated_doc/__pycache__/main.cpython-314.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-314.pyc ADDED
Binary file (253 Bytes). View file
 
.venv/Lib/site-packages/annotated_doc/__pycache__/main.cpython-314.pyc ADDED
Binary file (2.55 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.13.0.dist-info/INSTALLER ADDED
@@ -0,0 +1 @@
 
 
1
+ pip
.venv/Lib/site-packages/anyio-4.13.0.dist-info/METADATA ADDED
@@ -0,0 +1,105 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Metadata-Version: 2.4
2
+ Name: anyio
3
+ Version: 4.13.0
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.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Programming Language :: Python :: 3.14
22
+ Requires-Python: >=3.10
23
+ Description-Content-Type: text/x-rst
24
+ License-File: LICENSE
25
+ Requires-Dist: exceptiongroup>=1.0.2; python_version < "3.11"
26
+ Requires-Dist: idna>=2.8
27
+ Requires-Dist: typing_extensions>=4.5; python_version < "3.13"
28
+ Provides-Extra: trio
29
+ Requires-Dist: trio>=0.32.0; extra == "trio"
30
+ Dynamic: license-file
31
+
32
+ .. image:: https://github.com/agronholm/anyio/actions/workflows/test.yml/badge.svg
33
+ :target: https://github.com/agronholm/anyio/actions/workflows/test.yml
34
+ :alt: Build Status
35
+ .. image:: https://coveralls.io/repos/github/agronholm/anyio/badge.svg?branch=master
36
+ :target: https://coveralls.io/github/agronholm/anyio?branch=master
37
+ :alt: Code Coverage
38
+ .. image:: https://readthedocs.org/projects/anyio/badge/?version=latest
39
+ :target: https://anyio.readthedocs.io/en/latest/?badge=latest
40
+ :alt: Documentation
41
+ .. image:: https://badges.gitter.im/gitterHQ/gitter.svg
42
+ :target: https://gitter.im/python-trio/AnyIO
43
+ :alt: Gitter chat
44
+ .. image:: https://tidelift.com/badges/package/pypi/anyio
45
+ :target: https://tidelift.com/subscription/pkg/pypi-anyio
46
+ :alt: Tidelift
47
+
48
+ AnyIO is an asynchronous networking and concurrency library that works on top of either asyncio_ or
49
+ Trio_. It implements Trio-like `structured concurrency`_ (SC) on top of asyncio and works in harmony
50
+ with the native SC of Trio itself.
51
+
52
+ Applications and libraries written against AnyIO's API will run unmodified on either asyncio_ or
53
+ Trio_. AnyIO can also be adopted into a library or application incrementally – bit by bit, no full
54
+ refactoring necessary. It will blend in with the native libraries of your chosen backend.
55
+
56
+ To find out why you might want to use AnyIO's APIs instead of asyncio's, you can read about it
57
+ `here <https://anyio.readthedocs.io/en/stable/why.html>`_.
58
+
59
+ Documentation
60
+ -------------
61
+
62
+ View full documentation at: https://anyio.readthedocs.io/
63
+
64
+ Features
65
+ --------
66
+
67
+ AnyIO offers the following functionality:
68
+
69
+ * Task groups (nurseries_ in trio terminology)
70
+ * High-level networking (TCP, UDP and UNIX sockets)
71
+
72
+ * `Happy eyeballs`_ algorithm for TCP connections (more robust than that of asyncio on Python
73
+ 3.8)
74
+ * async/await style UDP sockets (unlike asyncio where you still have to use Transports and
75
+ Protocols)
76
+
77
+ * A versatile API for byte streams and object streams
78
+ * Inter-task synchronization and communication (locks, conditions, events, semaphores, object
79
+ streams)
80
+ * Worker threads
81
+ * Subprocesses
82
+ * Subinterpreter support for code parallelization (on Python 3.13 and later)
83
+ * Asynchronous file I/O (using worker threads)
84
+ * Signal handling
85
+ * Asynchronous version of the functools_ module
86
+
87
+ AnyIO also comes with its own pytest_ plugin which also supports asynchronous fixtures.
88
+ It even works with the popular Hypothesis_ library.
89
+
90
+ .. _asyncio: https://docs.python.org/3/library/asyncio.html
91
+ .. _Trio: https://github.com/python-trio/trio
92
+ .. _structured concurrency: https://en.wikipedia.org/wiki/Structured_concurrency
93
+ .. _nurseries: https://trio.readthedocs.io/en/stable/reference-core.html#nurseries-and-spawning
94
+ .. _Happy eyeballs: https://en.wikipedia.org/wiki/Happy_Eyeballs
95
+ .. _pytest: https://docs.pytest.org/en/latest/
96
+ .. _functools: https://docs.python.org/3/library/functools.html
97
+ .. _Hypothesis: https://hypothesis.works/
98
+
99
+ Security contact information
100
+ ----------------------------
101
+
102
+ To report a security vulnerability, please use the `Tidelift security contact`_.
103
+ Tidelift will coordinate the fix and disclosure.
104
+
105
+ .. _Tidelift security contact: https://tidelift.com/security
.venv/Lib/site-packages/anyio-4.13.0.dist-info/RECORD ADDED
@@ -0,0 +1,92 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ anyio-4.13.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
2
+ anyio-4.13.0.dist-info/METADATA,sha256=F0EYfiPlmTRwmJN2JktNxJg1GNnl0wHhzOWmz7pFvjM,4513
3
+ anyio-4.13.0.dist-info/RECORD,,
4
+ anyio-4.13.0.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
5
+ anyio-4.13.0.dist-info/entry_points.txt,sha256=_d6Yu6uiaZmNe0CydowirE9Cmg7zUL2g08tQpoS3Qvc,39
6
+ anyio-4.13.0.dist-info/licenses/LICENSE,sha256=U2GsncWPLvX9LpsJxoKXwX8ElQkJu8gCO9uC6s8iwrA,1081
7
+ anyio-4.13.0.dist-info/top_level.txt,sha256=QglSMiWX8_5dpoVAEIHdEYzvqFMdSYWmCj6tYw2ITkQ,6
8
+ anyio/__init__.py,sha256=7iDVqMUprUuKNY91FuoKqayAhR-OY136YDPI6P78HHk,6170
9
+ anyio/__pycache__/__init__.cpython-314.pyc,,
10
+ anyio/__pycache__/from_thread.cpython-314.pyc,,
11
+ anyio/__pycache__/functools.cpython-314.pyc,,
12
+ anyio/__pycache__/lowlevel.cpython-314.pyc,,
13
+ anyio/__pycache__/pytest_plugin.cpython-314.pyc,,
14
+ anyio/__pycache__/to_interpreter.cpython-314.pyc,,
15
+ anyio/__pycache__/to_process.cpython-314.pyc,,
16
+ anyio/__pycache__/to_thread.cpython-314.pyc,,
17
+ anyio/_backends/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
18
+ anyio/_backends/__pycache__/__init__.cpython-314.pyc,,
19
+ anyio/_backends/__pycache__/_asyncio.cpython-314.pyc,,
20
+ anyio/_backends/__pycache__/_trio.cpython-314.pyc,,
21
+ anyio/_backends/_asyncio.py,sha256=kuqlg2sBUsFdgY80xSDAw60Gx_4WNCl9iSL5XlY6lCU,99476
22
+ anyio/_backends/_trio.py,sha256=l9U-TsKRxzmTQxSMvOhn0bNeFn_iRx3Ho30jvR5Bdu0,41366
23
+ anyio/_core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
24
+ anyio/_core/__pycache__/__init__.cpython-314.pyc,,
25
+ anyio/_core/__pycache__/_asyncio_selector_thread.cpython-314.pyc,,
26
+ anyio/_core/__pycache__/_contextmanagers.cpython-314.pyc,,
27
+ anyio/_core/__pycache__/_eventloop.cpython-314.pyc,,
28
+ anyio/_core/__pycache__/_exceptions.cpython-314.pyc,,
29
+ anyio/_core/__pycache__/_fileio.cpython-314.pyc,,
30
+ anyio/_core/__pycache__/_resources.cpython-314.pyc,,
31
+ anyio/_core/__pycache__/_signals.cpython-314.pyc,,
32
+ anyio/_core/__pycache__/_sockets.cpython-314.pyc,,
33
+ anyio/_core/__pycache__/_streams.cpython-314.pyc,,
34
+ anyio/_core/__pycache__/_subprocesses.cpython-314.pyc,,
35
+ anyio/_core/__pycache__/_synchronization.cpython-314.pyc,,
36
+ anyio/_core/__pycache__/_tasks.cpython-314.pyc,,
37
+ anyio/_core/__pycache__/_tempfile.cpython-314.pyc,,
38
+ anyio/_core/__pycache__/_testing.cpython-314.pyc,,
39
+ anyio/_core/__pycache__/_typedattr.cpython-314.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=CKi1gFNiW2G4knWeBE7He7-rptQwgYjDUWfG8DSlvLs,25665
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=tkmkPKEkEaiMD8C9WRZBlmgjOYRDRbZdte6e-unay2E,7916
50
+ anyio/_core/_synchronization.py,sha256=9G3fvRsPNrrWJ_Z6gD_80wXq8I8qgAyhwM8PvHQnT2c,21061
51
+ anyio/_core/_tasks.py,sha256=pVB7K6AAulzUM8YgXAeqNZG44nSyZ1bYJjH8GznC00I,5435
52
+ anyio/_core/_tempfile.py,sha256=jE2w59FRF3yRo4vjkjfZF2YcqsBZvc66VWRwrJGDYGk,19624
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-314.pyc,,
57
+ anyio/abc/__pycache__/_eventloop.cpython-314.pyc,,
58
+ anyio/abc/__pycache__/_resources.cpython-314.pyc,,
59
+ anyio/abc/__pycache__/_sockets.cpython-314.pyc,,
60
+ anyio/abc/__pycache__/_streams.cpython-314.pyc,,
61
+ anyio/abc/__pycache__/_subprocesses.cpython-314.pyc,,
62
+ anyio/abc/__pycache__/_tasks.cpython-314.pyc,,
63
+ anyio/abc/__pycache__/_testing.cpython-314.pyc,,
64
+ anyio/abc/_eventloop.py,sha256=39lYnmtvoHaZw22sWBKOTA_zv7bamOnr8O49PqgDXdw,10629
65
+ anyio/abc/_resources.py,sha256=DrYvkNN1hH6Uvv5_5uKySvDsnknGVDe8FCKfko0VtN8,783
66
+ anyio/abc/_sockets.py,sha256=OmVDrfemVvF9c5K1tpBgQyV6fn5v0XyCExLAqBOGz9o,13124
67
+ anyio/abc/_streams.py,sha256=HYvna1iZbWcwLROTO6IhLX79RTRLPShZMWe0sG1q54I,7481
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=5AWM1iYTKkTzptvUhQDdLSh5GvbBW-vcs-SAUfIfA9A,12076
73
+ anyio/lowlevel.py,sha256=AyKLVK3LaWSoK39LkCKxE4_GDMLKZBNqTrLUgk63y80,5158
74
+ anyio/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
75
+ anyio/pytest_plugin.py,sha256=t6h4KJstqIxfxwTZ1YO8vpUVuB99nfCLltn0NHfatHo,12775
76
+ anyio/streams/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
77
+ anyio/streams/__pycache__/__init__.cpython-314.pyc,,
78
+ anyio/streams/__pycache__/buffered.cpython-314.pyc,,
79
+ anyio/streams/__pycache__/file.cpython-314.pyc,,
80
+ anyio/streams/__pycache__/memory.cpython-314.pyc,,
81
+ anyio/streams/__pycache__/stapled.cpython-314.pyc,,
82
+ anyio/streams/__pycache__/text.cpython-314.pyc,,
83
+ anyio/streams/__pycache__/tls.cpython-314.pyc,,
84
+ anyio/streams/buffered.py,sha256=2R3PeJhe4EXrdYqz44Y6-Eg9R6DrmlsYrP36Ir43-po,6263
85
+ anyio/streams/file.py,sha256=msnrotVKGMQomUu_Rj2qz9MvIdUp6d3JGr7MOEO8kV4,4428
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=DQVkXUvsTEYKkBO8dlVU7j_5H8QOtLy4sGi1Wrjqevo,15303
90
+ anyio/to_interpreter.py,sha256=_mLngrMy97TMR6VbW4Y6YzDUk9ZuPcQMPlkuyRh3C9k,7100
91
+ anyio/to_process.py,sha256=J7gAA_YOuoHqnpDAf5fm1Qu6kOmTzdFbiDNvnV755vk,9798
92
+ anyio/to_thread.py,sha256=f6h_k2d743GBv9FhAnhM_YpTvWgIrzBy9cOE0eJ1UJw,2693
.venv/Lib/site-packages/anyio-4.13.0.dist-info/WHEEL ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (82.0.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
.venv/Lib/site-packages/anyio-4.13.0.dist-info/entry_points.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ [pytest11]
2
+ anyio = anyio.pytest_plugin
.venv/Lib/site-packages/anyio-4.13.0.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.13.0.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-314.pyc ADDED
Binary file (4.8 kB). View file
 
.venv/Lib/site-packages/anyio/__pycache__/from_thread.cpython-314.pyc ADDED
Binary file (30.2 kB). View file
 
.venv/Lib/site-packages/anyio/__pycache__/functools.cpython-314.pyc ADDED
Binary file (20.5 kB). View file
 
.venv/Lib/site-packages/anyio/__pycache__/lowlevel.cpython-314.pyc ADDED
Binary file (10.1 kB). View file
 
.venv/Lib/site-packages/anyio/__pycache__/pytest_plugin.cpython-314.pyc ADDED
Binary file (20.5 kB). View file
 
.venv/Lib/site-packages/anyio/__pycache__/to_interpreter.cpython-314.pyc ADDED
Binary file (12.2 kB). View file
 
.venv/Lib/site-packages/anyio/__pycache__/to_process.cpython-314.pyc ADDED
Binary file (13 kB). View file
 
.venv/Lib/site-packages/anyio/__pycache__/to_thread.cpython-314.pyc ADDED
Binary file (3.38 kB). View file
 
.venv/Lib/site-packages/anyio/_backends/__init__.py ADDED
File without changes
.venv/Lib/site-packages/anyio/_backends/__pycache__/__init__.cpython-314.pyc ADDED
Binary file (191 Bytes). View file
 
.venv/Lib/site-packages/anyio/_backends/__pycache__/_asyncio.cpython-314.pyc ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2a4d1b191b0fde59fa3b93bfe142b9b3aabc670ac6f328f390a3caa986a6c35a
3
+ size 174544
.venv/Lib/site-packages/anyio/_backends/__pycache__/_trio.cpython-314.pyc ADDED
Binary file (95.2 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,1343 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ ParamSpec,
34
+ TypeVar,
35
+ cast,
36
+ overload,
37
+ )
38
+
39
+ import trio.from_thread
40
+ import trio.lowlevel
41
+ from outcome import Error, Outcome, Value
42
+ from trio.lowlevel import (
43
+ current_root_task,
44
+ current_task,
45
+ notify_closing,
46
+ wait_readable,
47
+ wait_writable,
48
+ )
49
+ from trio.socket import SocketType as TrioSocketType
50
+ from trio.to_thread import run_sync
51
+
52
+ from .. import (
53
+ CapacityLimiterStatistics,
54
+ EventStatistics,
55
+ LockStatistics,
56
+ RunFinishedError,
57
+ TaskInfo,
58
+ WouldBlock,
59
+ abc,
60
+ )
61
+ from .._core._eventloop import claim_worker_thread
62
+ from .._core._exceptions import (
63
+ BrokenResourceError,
64
+ BusyResourceError,
65
+ ClosedResourceError,
66
+ EndOfStream,
67
+ )
68
+ from .._core._sockets import convert_ipv6_sockaddr
69
+ from .._core._streams import create_memory_object_stream
70
+ from .._core._synchronization import (
71
+ CapacityLimiter as BaseCapacityLimiter,
72
+ )
73
+ from .._core._synchronization import Event as BaseEvent
74
+ from .._core._synchronization import Lock as BaseLock
75
+ from .._core._synchronization import (
76
+ ResourceGuard,
77
+ SemaphoreStatistics,
78
+ )
79
+ from .._core._synchronization import Semaphore as BaseSemaphore
80
+ from .._core._tasks import CancelScope as BaseCancelScope
81
+ from ..abc import IPSockAddrType, UDPPacketType, UNIXDatagramPacketType
82
+ from ..abc._eventloop import AsyncBackend, StrOrBytesPath
83
+ from ..streams.memory import MemoryObjectSendStream
84
+
85
+ if TYPE_CHECKING:
86
+ from _typeshed import FileDescriptorLike
87
+
88
+ if sys.version_info >= (3, 11):
89
+ from typing import TypeVarTuple, Unpack
90
+ else:
91
+ from exceptiongroup import BaseExceptionGroup
92
+ from typing_extensions import TypeVarTuple, Unpack
93
+
94
+ T = TypeVar("T")
95
+ T_Retval = TypeVar("T_Retval")
96
+ T_SockAddr = TypeVar("T_SockAddr", str, IPSockAddrType)
97
+ PosArgsT = TypeVarTuple("PosArgsT")
98
+ P = ParamSpec("P")
99
+
100
+
101
+ #
102
+ # Event loop
103
+ #
104
+
105
+ RunVar = trio.lowlevel.RunVar
106
+
107
+
108
+ #
109
+ # Timeouts and cancellation
110
+ #
111
+
112
+
113
+ class CancelScope(BaseCancelScope):
114
+ def __new__(
115
+ cls, original: trio.CancelScope | None = None, **kwargs: object
116
+ ) -> CancelScope:
117
+ return object.__new__(cls)
118
+
119
+ def __init__(self, original: trio.CancelScope | None = None, **kwargs: Any) -> None:
120
+ self.__original = original or trio.CancelScope(**kwargs)
121
+
122
+ def __enter__(self) -> CancelScope:
123
+ self.__original.__enter__()
124
+ return self
125
+
126
+ def __exit__(
127
+ self,
128
+ exc_type: type[BaseException] | None,
129
+ exc_val: BaseException | None,
130
+ exc_tb: TracebackType | None,
131
+ ) -> bool:
132
+ return self.__original.__exit__(exc_type, exc_val, exc_tb)
133
+
134
+ def cancel(self, reason: str | None = None) -> None:
135
+ self.__original.cancel(reason)
136
+
137
+ @property
138
+ def deadline(self) -> float:
139
+ return self.__original.deadline
140
+
141
+ @deadline.setter
142
+ def deadline(self, value: float) -> None:
143
+ self.__original.deadline = value
144
+
145
+ @property
146
+ def cancel_called(self) -> bool:
147
+ return self.__original.cancel_called
148
+
149
+ @property
150
+ def cancelled_caught(self) -> bool:
151
+ return self.__original.cancelled_caught
152
+
153
+ @property
154
+ def shield(self) -> bool:
155
+ return self.__original.shield
156
+
157
+ @shield.setter
158
+ def shield(self, value: bool) -> None:
159
+ self.__original.shield = value
160
+
161
+
162
+ #
163
+ # Task groups
164
+ #
165
+
166
+
167
+ class TaskGroup(abc.TaskGroup):
168
+ def __init__(self) -> None:
169
+ self._active = False
170
+ self._nursery_manager = trio.open_nursery(strict_exception_groups=True)
171
+ self.cancel_scope = None # type: ignore[assignment]
172
+
173
+ async def __aenter__(self) -> TaskGroup:
174
+ self._active = True
175
+ self._nursery = await self._nursery_manager.__aenter__()
176
+ self.cancel_scope = CancelScope(self._nursery.cancel_scope)
177
+ return self
178
+
179
+ async def __aexit__(
180
+ self,
181
+ exc_type: type[BaseException] | None,
182
+ exc_val: BaseException | None,
183
+ exc_tb: TracebackType | None,
184
+ ) -> bool:
185
+ try:
186
+ # trio.Nursery.__exit__ returns bool; .open_nursery has wrong type
187
+ return await self._nursery_manager.__aexit__(exc_type, exc_val, exc_tb) # type: ignore[return-value]
188
+ except BaseExceptionGroup as exc:
189
+ if not exc.split(trio.Cancelled)[1]:
190
+ raise trio.Cancelled._create() from exc
191
+
192
+ raise
193
+ finally:
194
+ del exc_val, exc_tb
195
+ self._active = False
196
+
197
+ def start_soon(
198
+ self,
199
+ func: Callable[[Unpack[PosArgsT]], Awaitable[Any]],
200
+ *args: Unpack[PosArgsT],
201
+ name: object = None,
202
+ ) -> None:
203
+ if not self._active:
204
+ raise RuntimeError(
205
+ "This task group is not active; no new tasks can be started."
206
+ )
207
+
208
+ self._nursery.start_soon(func, *args, name=name)
209
+
210
+ async def start(
211
+ self, func: Callable[..., Awaitable[Any]], *args: object, name: object = None
212
+ ) -> Any:
213
+ if not self._active:
214
+ raise RuntimeError(
215
+ "This task group is not active; no new tasks can be started."
216
+ )
217
+
218
+ return await self._nursery.start(func, *args, name=name)
219
+
220
+
221
+ #
222
+ # Subprocesses
223
+ #
224
+
225
+
226
+ @dataclass(eq=False)
227
+ class ReceiveStreamWrapper(abc.ByteReceiveStream):
228
+ _stream: trio.abc.ReceiveStream
229
+
230
+ async def receive(self, max_bytes: int | None = None) -> bytes:
231
+ try:
232
+ data = await self._stream.receive_some(max_bytes)
233
+ except trio.ClosedResourceError as exc:
234
+ raise ClosedResourceError from exc.__cause__
235
+ except trio.BrokenResourceError as exc:
236
+ raise BrokenResourceError from exc.__cause__
237
+
238
+ if data:
239
+ return bytes(data)
240
+ else:
241
+ raise EndOfStream
242
+
243
+ async def aclose(self) -> None:
244
+ await self._stream.aclose()
245
+
246
+
247
+ @dataclass(eq=False)
248
+ class SendStreamWrapper(abc.ByteSendStream):
249
+ _stream: trio.abc.SendStream
250
+
251
+ async def send(self, item: bytes) -> None:
252
+ try:
253
+ await self._stream.send_all(item)
254
+ except trio.ClosedResourceError as exc:
255
+ raise ClosedResourceError from exc.__cause__
256
+ except trio.BrokenResourceError as exc:
257
+ raise BrokenResourceError from exc.__cause__
258
+
259
+ async def aclose(self) -> None:
260
+ await self._stream.aclose()
261
+
262
+
263
+ @dataclass(eq=False)
264
+ class Process(abc.Process):
265
+ _process: trio.Process
266
+ _stdin: abc.ByteSendStream | None
267
+ _stdout: abc.ByteReceiveStream | None
268
+ _stderr: abc.ByteReceiveStream | None
269
+
270
+ async def aclose(self) -> None:
271
+ with CancelScope(shield=True):
272
+ if self._stdin:
273
+ await self._stdin.aclose()
274
+ if self._stdout:
275
+ await self._stdout.aclose()
276
+ if self._stderr:
277
+ await self._stderr.aclose()
278
+
279
+ try:
280
+ await self.wait()
281
+ except BaseException:
282
+ self.kill()
283
+ with CancelScope(shield=True):
284
+ await self.wait()
285
+ raise
286
+
287
+ async def wait(self) -> int:
288
+ return await self._process.wait()
289
+
290
+ def terminate(self) -> None:
291
+ self._process.terminate()
292
+
293
+ def kill(self) -> None:
294
+ self._process.kill()
295
+
296
+ def send_signal(self, signal: Signals) -> None:
297
+ self._process.send_signal(signal)
298
+
299
+ @property
300
+ def pid(self) -> int:
301
+ return self._process.pid
302
+
303
+ @property
304
+ def returncode(self) -> int | None:
305
+ return self._process.returncode
306
+
307
+ @property
308
+ def stdin(self) -> abc.ByteSendStream | None:
309
+ return self._stdin
310
+
311
+ @property
312
+ def stdout(self) -> abc.ByteReceiveStream | None:
313
+ return self._stdout
314
+
315
+ @property
316
+ def stderr(self) -> abc.ByteReceiveStream | None:
317
+ return self._stderr
318
+
319
+
320
+ class _ProcessPoolShutdownInstrument(trio.abc.Instrument):
321
+ def after_run(self) -> None:
322
+ super().after_run()
323
+
324
+
325
+ current_default_worker_process_limiter: trio.lowlevel.RunVar = RunVar(
326
+ "current_default_worker_process_limiter"
327
+ )
328
+
329
+
330
+ async def _shutdown_process_pool(workers: set[abc.Process]) -> None:
331
+ try:
332
+ await trio.sleep(math.inf)
333
+ except trio.Cancelled:
334
+ for process in workers:
335
+ if process.returncode is None:
336
+ process.kill()
337
+
338
+ with CancelScope(shield=True):
339
+ for process in workers:
340
+ await process.aclose()
341
+
342
+
343
+ #
344
+ # Sockets and networking
345
+ #
346
+
347
+
348
+ class _TrioSocketMixin(Generic[T_SockAddr]):
349
+ def __init__(self, trio_socket: TrioSocketType) -> None:
350
+ self._trio_socket = trio_socket
351
+ self._closed = False
352
+
353
+ def _check_closed(self) -> None:
354
+ if self._closed:
355
+ raise ClosedResourceError
356
+ if self._trio_socket.fileno() < 0:
357
+ raise BrokenResourceError
358
+
359
+ @property
360
+ def _raw_socket(self) -> socket.socket:
361
+ return self._trio_socket._sock # type: ignore[attr-defined]
362
+
363
+ async def aclose(self) -> None:
364
+ if self._trio_socket.fileno() >= 0:
365
+ self._closed = True
366
+ self._trio_socket.close()
367
+
368
+ def _convert_socket_error(self, exc: BaseException) -> NoReturn:
369
+ if isinstance(exc, trio.ClosedResourceError):
370
+ raise ClosedResourceError from exc
371
+ elif self._trio_socket.fileno() < 0 and self._closed:
372
+ raise ClosedResourceError from None
373
+ elif isinstance(exc, OSError):
374
+ raise BrokenResourceError from exc
375
+ else:
376
+ raise exc
377
+
378
+
379
+ class SocketStream(_TrioSocketMixin, abc.SocketStream):
380
+ def __init__(self, trio_socket: TrioSocketType) -> None:
381
+ super().__init__(trio_socket)
382
+ self._receive_guard = ResourceGuard("reading from")
383
+ self._send_guard = ResourceGuard("writing to")
384
+
385
+ async def receive(self, max_bytes: int = 65536) -> bytes:
386
+ with self._receive_guard:
387
+ try:
388
+ data = await self._trio_socket.recv(max_bytes)
389
+ except BaseException as exc:
390
+ self._convert_socket_error(exc)
391
+
392
+ if data:
393
+ return data
394
+ else:
395
+ raise EndOfStream
396
+
397
+ async def send(self, item: bytes) -> None:
398
+ with self._send_guard:
399
+ view = memoryview(item)
400
+ while view:
401
+ try:
402
+ bytes_sent = await self._trio_socket.send(view)
403
+ except BaseException as exc:
404
+ self._convert_socket_error(exc)
405
+
406
+ view = view[bytes_sent:]
407
+
408
+ async def send_eof(self) -> None:
409
+ self._trio_socket.shutdown(socket.SHUT_WR)
410
+
411
+
412
+ class UNIXSocketStream(SocketStream, abc.UNIXSocketStream):
413
+ async def receive_fds(self, msglen: int, maxfds: int) -> tuple[bytes, list[int]]:
414
+ if not isinstance(msglen, int) or msglen < 0:
415
+ raise ValueError("msglen must be a non-negative integer")
416
+ if not isinstance(maxfds, int) or maxfds < 1:
417
+ raise ValueError("maxfds must be a positive integer")
418
+
419
+ fds = array.array("i")
420
+ await trio.lowlevel.checkpoint()
421
+ with self._receive_guard:
422
+ while True:
423
+ try:
424
+ message, ancdata, flags, addr = await self._trio_socket.recvmsg(
425
+ msglen, socket.CMSG_LEN(maxfds * fds.itemsize)
426
+ )
427
+ except BaseException as exc:
428
+ self._convert_socket_error(exc)
429
+ else:
430
+ if not message and not ancdata:
431
+ raise EndOfStream
432
+
433
+ break
434
+
435
+ for cmsg_level, cmsg_type, cmsg_data in ancdata:
436
+ if cmsg_level != socket.SOL_SOCKET or cmsg_type != socket.SCM_RIGHTS:
437
+ raise RuntimeError(
438
+ f"Received unexpected ancillary data; message = {message!r}, "
439
+ f"cmsg_level = {cmsg_level}, cmsg_type = {cmsg_type}"
440
+ )
441
+
442
+ fds.frombytes(cmsg_data[: len(cmsg_data) - (len(cmsg_data) % fds.itemsize)])
443
+
444
+ return message, list(fds)
445
+
446
+ async def send_fds(self, message: bytes, fds: Collection[int | IOBase]) -> None:
447
+ if not message:
448
+ raise ValueError("message must not be empty")
449
+ if not fds:
450
+ raise ValueError("fds must not be empty")
451
+
452
+ filenos: list[int] = []
453
+ for fd in fds:
454
+ if isinstance(fd, int):
455
+ filenos.append(fd)
456
+ elif isinstance(fd, IOBase):
457
+ filenos.append(fd.fileno())
458
+
459
+ fdarray = array.array("i", filenos)
460
+ await trio.lowlevel.checkpoint()
461
+ with self._send_guard:
462
+ while True:
463
+ try:
464
+ await self._trio_socket.sendmsg(
465
+ [message],
466
+ [
467
+ (
468
+ socket.SOL_SOCKET,
469
+ socket.SCM_RIGHTS,
470
+ fdarray,
471
+ )
472
+ ],
473
+ )
474
+ break
475
+ except BaseException as exc:
476
+ self._convert_socket_error(exc)
477
+
478
+
479
+ class TCPSocketListener(_TrioSocketMixin, abc.SocketListener):
480
+ def __init__(self, raw_socket: socket.socket):
481
+ super().__init__(trio.socket.from_stdlib_socket(raw_socket))
482
+ self._accept_guard = ResourceGuard("accepting connections from")
483
+
484
+ async def accept(self) -> SocketStream:
485
+ with self._accept_guard:
486
+ try:
487
+ trio_socket, _addr = await self._trio_socket.accept()
488
+ except BaseException as exc:
489
+ self._convert_socket_error(exc)
490
+
491
+ trio_socket.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
492
+ return SocketStream(trio_socket)
493
+
494
+
495
+ class UNIXSocketListener(_TrioSocketMixin, abc.SocketListener):
496
+ def __init__(self, raw_socket: socket.socket):
497
+ super().__init__(trio.socket.from_stdlib_socket(raw_socket))
498
+ self._accept_guard = ResourceGuard("accepting connections from")
499
+
500
+ async def accept(self) -> UNIXSocketStream:
501
+ with self._accept_guard:
502
+ try:
503
+ trio_socket, _addr = await self._trio_socket.accept()
504
+ except BaseException as exc:
505
+ self._convert_socket_error(exc)
506
+
507
+ return UNIXSocketStream(trio_socket)
508
+
509
+
510
+ class UDPSocket(_TrioSocketMixin[IPSockAddrType], abc.UDPSocket):
511
+ def __init__(self, trio_socket: TrioSocketType) -> None:
512
+ super().__init__(trio_socket)
513
+ self._receive_guard = ResourceGuard("reading from")
514
+ self._send_guard = ResourceGuard("writing to")
515
+
516
+ async def receive(self) -> tuple[bytes, IPSockAddrType]:
517
+ with self._receive_guard:
518
+ try:
519
+ data, addr = await self._trio_socket.recvfrom(65536)
520
+ return data, convert_ipv6_sockaddr(addr)
521
+ except BaseException as exc:
522
+ self._convert_socket_error(exc)
523
+
524
+ async def send(self, item: UDPPacketType) -> None:
525
+ with self._send_guard:
526
+ try:
527
+ await self._trio_socket.sendto(*item)
528
+ except BaseException as exc:
529
+ self._convert_socket_error(exc)
530
+
531
+
532
+ class ConnectedUDPSocket(_TrioSocketMixin[IPSockAddrType], abc.ConnectedUDPSocket):
533
+ def __init__(self, trio_socket: TrioSocketType) -> None:
534
+ super().__init__(trio_socket)
535
+ self._receive_guard = ResourceGuard("reading from")
536
+ self._send_guard = ResourceGuard("writing to")
537
+
538
+ async def receive(self) -> bytes:
539
+ with self._receive_guard:
540
+ try:
541
+ return await self._trio_socket.recv(65536)
542
+ except BaseException as exc:
543
+ self._convert_socket_error(exc)
544
+
545
+ async def send(self, item: bytes) -> None:
546
+ with self._send_guard:
547
+ try:
548
+ await self._trio_socket.send(item)
549
+ except BaseException as exc:
550
+ self._convert_socket_error(exc)
551
+
552
+
553
+ class UNIXDatagramSocket(_TrioSocketMixin[str], abc.UNIXDatagramSocket):
554
+ def __init__(self, trio_socket: TrioSocketType) -> None:
555
+ super().__init__(trio_socket)
556
+ self._receive_guard = ResourceGuard("reading from")
557
+ self._send_guard = ResourceGuard("writing to")
558
+
559
+ async def receive(self) -> UNIXDatagramPacketType:
560
+ with self._receive_guard:
561
+ try:
562
+ data, addr = await self._trio_socket.recvfrom(65536)
563
+ return data, addr
564
+ except BaseException as exc:
565
+ self._convert_socket_error(exc)
566
+
567
+ async def send(self, item: UNIXDatagramPacketType) -> None:
568
+ with self._send_guard:
569
+ try:
570
+ await self._trio_socket.sendto(*item)
571
+ except BaseException as exc:
572
+ self._convert_socket_error(exc)
573
+
574
+
575
+ class ConnectedUNIXDatagramSocket(
576
+ _TrioSocketMixin[str], abc.ConnectedUNIXDatagramSocket
577
+ ):
578
+ def __init__(self, trio_socket: TrioSocketType) -> None:
579
+ super().__init__(trio_socket)
580
+ self._receive_guard = ResourceGuard("reading from")
581
+ self._send_guard = ResourceGuard("writing to")
582
+
583
+ async def receive(self) -> bytes:
584
+ with self._receive_guard:
585
+ try:
586
+ return await self._trio_socket.recv(65536)
587
+ except BaseException as exc:
588
+ self._convert_socket_error(exc)
589
+
590
+ async def send(self, item: bytes) -> None:
591
+ with self._send_guard:
592
+ try:
593
+ await self._trio_socket.send(item)
594
+ except BaseException as exc:
595
+ self._convert_socket_error(exc)
596
+
597
+
598
+ #
599
+ # Synchronization
600
+ #
601
+
602
+
603
+ class Event(BaseEvent):
604
+ def __new__(cls) -> Event:
605
+ return object.__new__(cls)
606
+
607
+ def __init__(self) -> None:
608
+ self.__original = trio.Event()
609
+
610
+ def is_set(self) -> bool:
611
+ return self.__original.is_set()
612
+
613
+ async def wait(self) -> None:
614
+ return await self.__original.wait()
615
+
616
+ def statistics(self) -> EventStatistics:
617
+ orig_statistics = self.__original.statistics()
618
+ return EventStatistics(tasks_waiting=orig_statistics.tasks_waiting)
619
+
620
+ def set(self) -> None:
621
+ self.__original.set()
622
+
623
+
624
+ class Lock(BaseLock):
625
+ def __new__(cls, *, fast_acquire: bool = False) -> Lock:
626
+ return object.__new__(cls)
627
+
628
+ def __init__(self, *, fast_acquire: bool = False) -> None:
629
+ self._fast_acquire = fast_acquire
630
+ self.__original = trio.Lock()
631
+
632
+ @staticmethod
633
+ def _convert_runtime_error_msg(exc: RuntimeError) -> None:
634
+ if exc.args == ("attempt to re-acquire an already held Lock",):
635
+ exc.args = ("Attempted to acquire an already held Lock",)
636
+
637
+ async def acquire(self) -> None:
638
+ if not self._fast_acquire:
639
+ try:
640
+ await self.__original.acquire()
641
+ except RuntimeError as exc:
642
+ self._convert_runtime_error_msg(exc)
643
+ raise
644
+
645
+ return
646
+
647
+ # This is the "fast path" where we don't let other tasks run
648
+ await trio.lowlevel.checkpoint_if_cancelled()
649
+ try:
650
+ self.__original.acquire_nowait()
651
+ except trio.WouldBlock:
652
+ await self.__original._lot.park()
653
+ except RuntimeError as exc:
654
+ self._convert_runtime_error_msg(exc)
655
+ raise
656
+
657
+ def acquire_nowait(self) -> None:
658
+ try:
659
+ self.__original.acquire_nowait()
660
+ except trio.WouldBlock:
661
+ raise WouldBlock from None
662
+ except RuntimeError as exc:
663
+ self._convert_runtime_error_msg(exc)
664
+ raise
665
+
666
+ def locked(self) -> bool:
667
+ return self.__original.locked()
668
+
669
+ def release(self) -> None:
670
+ self.__original.release()
671
+
672
+ def statistics(self) -> LockStatistics:
673
+ orig_statistics = self.__original.statistics()
674
+ owner = TrioTaskInfo(orig_statistics.owner) if orig_statistics.owner else None
675
+ return LockStatistics(
676
+ orig_statistics.locked, owner, orig_statistics.tasks_waiting
677
+ )
678
+
679
+
680
+ class Semaphore(BaseSemaphore):
681
+ def __new__(
682
+ cls,
683
+ initial_value: int,
684
+ *,
685
+ max_value: int | None = None,
686
+ fast_acquire: bool = False,
687
+ ) -> Semaphore:
688
+ return object.__new__(cls)
689
+
690
+ def __init__(
691
+ self,
692
+ initial_value: int,
693
+ *,
694
+ max_value: int | None = None,
695
+ fast_acquire: bool = False,
696
+ ) -> None:
697
+ super().__init__(initial_value, max_value=max_value, fast_acquire=fast_acquire)
698
+ self.__original = trio.Semaphore(initial_value, max_value=max_value)
699
+
700
+ async def acquire(self) -> None:
701
+ if not self._fast_acquire:
702
+ await self.__original.acquire()
703
+ return
704
+
705
+ # This is the "fast path" where we don't let other tasks run
706
+ await trio.lowlevel.checkpoint_if_cancelled()
707
+ try:
708
+ self.__original.acquire_nowait()
709
+ except trio.WouldBlock:
710
+ await self.__original._lot.park()
711
+
712
+ def acquire_nowait(self) -> None:
713
+ try:
714
+ self.__original.acquire_nowait()
715
+ except trio.WouldBlock:
716
+ raise WouldBlock from None
717
+
718
+ @property
719
+ def max_value(self) -> int | None:
720
+ return self.__original.max_value
721
+
722
+ @property
723
+ def value(self) -> int:
724
+ return self.__original.value
725
+
726
+ def release(self) -> None:
727
+ self.__original.release()
728
+
729
+ def statistics(self) -> SemaphoreStatistics:
730
+ orig_statistics = self.__original.statistics()
731
+ return SemaphoreStatistics(orig_statistics.tasks_waiting)
732
+
733
+
734
+ class CapacityLimiter(BaseCapacityLimiter):
735
+ def __new__(
736
+ cls,
737
+ total_tokens: float | None = None,
738
+ *,
739
+ original: trio.CapacityLimiter | None = None,
740
+ ) -> CapacityLimiter:
741
+ return object.__new__(cls)
742
+
743
+ def __init__(
744
+ self,
745
+ total_tokens: float | None = None,
746
+ *,
747
+ original: trio.CapacityLimiter | None = None,
748
+ ) -> None:
749
+ if original is not None:
750
+ self.__original = original
751
+ else:
752
+ assert total_tokens is not None
753
+ self.__original = trio.CapacityLimiter(total_tokens)
754
+
755
+ async def __aenter__(self) -> None:
756
+ return await self.__original.__aenter__()
757
+
758
+ async def __aexit__(
759
+ self,
760
+ exc_type: type[BaseException] | None,
761
+ exc_val: BaseException | None,
762
+ exc_tb: TracebackType | None,
763
+ ) -> None:
764
+ await self.__original.__aexit__(exc_type, exc_val, exc_tb)
765
+
766
+ @property
767
+ def total_tokens(self) -> float:
768
+ return self.__original.total_tokens
769
+
770
+ @total_tokens.setter
771
+ def total_tokens(self, value: float) -> None:
772
+ self.__original.total_tokens = value
773
+
774
+ @property
775
+ def borrowed_tokens(self) -> int:
776
+ return self.__original.borrowed_tokens
777
+
778
+ @property
779
+ def available_tokens(self) -> float:
780
+ return self.__original.available_tokens
781
+
782
+ def acquire_nowait(self) -> None:
783
+ self.__original.acquire_nowait()
784
+
785
+ def acquire_on_behalf_of_nowait(self, borrower: object) -> None:
786
+ self.__original.acquire_on_behalf_of_nowait(borrower)
787
+
788
+ async def acquire(self) -> None:
789
+ await self.__original.acquire()
790
+
791
+ async def acquire_on_behalf_of(self, borrower: object) -> None:
792
+ await self.__original.acquire_on_behalf_of(borrower)
793
+
794
+ def release(self) -> None:
795
+ return self.__original.release()
796
+
797
+ def release_on_behalf_of(self, borrower: object) -> None:
798
+ return self.__original.release_on_behalf_of(borrower)
799
+
800
+ def statistics(self) -> CapacityLimiterStatistics:
801
+ orig = self.__original.statistics()
802
+ return CapacityLimiterStatistics(
803
+ borrowed_tokens=orig.borrowed_tokens,
804
+ total_tokens=orig.total_tokens,
805
+ borrowers=tuple(orig.borrowers),
806
+ tasks_waiting=orig.tasks_waiting,
807
+ )
808
+
809
+
810
+ _capacity_limiter_wrapper: trio.lowlevel.RunVar = RunVar("_capacity_limiter_wrapper")
811
+
812
+
813
+ #
814
+ # Signal handling
815
+ #
816
+
817
+
818
+ class _SignalReceiver:
819
+ _iterator: AsyncIterator[int]
820
+
821
+ def __init__(self, signals: tuple[Signals, ...]):
822
+ self._signals = signals
823
+
824
+ def __enter__(self) -> _SignalReceiver:
825
+ self._cm = trio.open_signal_receiver(*self._signals)
826
+ self._iterator = self._cm.__enter__()
827
+ return self
828
+
829
+ def __exit__(
830
+ self,
831
+ exc_type: type[BaseException] | None,
832
+ exc_val: BaseException | None,
833
+ exc_tb: TracebackType | None,
834
+ ) -> bool | None:
835
+ return self._cm.__exit__(exc_type, exc_val, exc_tb)
836
+
837
+ def __aiter__(self) -> _SignalReceiver:
838
+ return self
839
+
840
+ async def __anext__(self) -> Signals:
841
+ signum = await self._iterator.__anext__()
842
+ return Signals(signum)
843
+
844
+
845
+ #
846
+ # Testing and debugging
847
+ #
848
+
849
+
850
+ class TestRunner(abc.TestRunner):
851
+ def __init__(self, **options: Any) -> None:
852
+ from queue import Queue
853
+
854
+ self._call_queue: Queue[Callable[[], object]] = Queue()
855
+ self._send_stream: MemoryObjectSendStream | None = None
856
+ self._options = options
857
+
858
+ def __exit__(
859
+ self,
860
+ exc_type: type[BaseException] | None,
861
+ exc_val: BaseException | None,
862
+ exc_tb: types.TracebackType | None,
863
+ ) -> None:
864
+ if self._send_stream:
865
+ self._send_stream.close()
866
+ while self._send_stream is not None:
867
+ self._call_queue.get()()
868
+
869
+ async def _run_tests_and_fixtures(self) -> None:
870
+ self._send_stream, receive_stream = create_memory_object_stream(1)
871
+ with receive_stream:
872
+ async for coro, outcome_holder in receive_stream:
873
+ try:
874
+ retval = await coro
875
+ except BaseException as exc:
876
+ outcome_holder.append(Error(exc))
877
+ else:
878
+ outcome_holder.append(Value(retval))
879
+
880
+ def _main_task_finished(self, outcome: object) -> None:
881
+ self._send_stream = None
882
+
883
+ def _call_in_runner_task(
884
+ self,
885
+ func: Callable[P, Awaitable[T_Retval]],
886
+ /,
887
+ *args: P.args,
888
+ **kwargs: P.kwargs,
889
+ ) -> T_Retval:
890
+ if self._send_stream is None:
891
+ trio.lowlevel.start_guest_run(
892
+ self._run_tests_and_fixtures,
893
+ run_sync_soon_threadsafe=self._call_queue.put,
894
+ done_callback=self._main_task_finished,
895
+ **self._options,
896
+ )
897
+ while self._send_stream is None:
898
+ self._call_queue.get()()
899
+
900
+ outcome_holder: list[Outcome] = []
901
+ self._send_stream.send_nowait((func(*args, **kwargs), outcome_holder))
902
+ while not outcome_holder:
903
+ self._call_queue.get()()
904
+
905
+ return outcome_holder[0].unwrap()
906
+
907
+ def run_asyncgen_fixture(
908
+ self,
909
+ fixture_func: Callable[..., AsyncGenerator[T_Retval, Any]],
910
+ kwargs: dict[str, Any],
911
+ ) -> Iterable[T_Retval]:
912
+ asyncgen = fixture_func(**kwargs)
913
+ fixturevalue: T_Retval = self._call_in_runner_task(asyncgen.asend, None)
914
+
915
+ yield fixturevalue
916
+
917
+ try:
918
+ self._call_in_runner_task(asyncgen.asend, None)
919
+ except StopAsyncIteration:
920
+ pass
921
+ else:
922
+ self._call_in_runner_task(asyncgen.aclose)
923
+ raise RuntimeError("Async generator fixture did not stop")
924
+
925
+ def run_fixture(
926
+ self,
927
+ fixture_func: Callable[..., Coroutine[Any, Any, T_Retval]],
928
+ kwargs: dict[str, Any],
929
+ ) -> T_Retval:
930
+ return self._call_in_runner_task(fixture_func, **kwargs)
931
+
932
+ def run_test(
933
+ self, test_func: Callable[..., Coroutine[Any, Any, Any]], kwargs: dict[str, Any]
934
+ ) -> None:
935
+ self._call_in_runner_task(test_func, **kwargs)
936
+
937
+
938
+ class TrioTaskInfo(TaskInfo):
939
+ def __init__(self, task: trio.lowlevel.Task):
940
+ parent_id = None
941
+ if task.parent_nursery and task.parent_nursery.parent_task:
942
+ parent_id = id(task.parent_nursery.parent_task)
943
+
944
+ super().__init__(id(task), parent_id, task.name, task.coro)
945
+ self._task = weakref.proxy(task)
946
+
947
+ def has_pending_cancellation(self) -> bool:
948
+ try:
949
+ return self._task._cancel_status.effectively_cancelled
950
+ except ReferenceError:
951
+ # If the task is no longer around, it surely doesn't have a cancellation
952
+ # pending
953
+ return False
954
+
955
+
956
+ class TrioBackend(AsyncBackend):
957
+ @classmethod
958
+ def run(
959
+ cls,
960
+ func: Callable[[Unpack[PosArgsT]], Awaitable[T_Retval]],
961
+ args: tuple[Unpack[PosArgsT]],
962
+ kwargs: dict[str, Any],
963
+ options: dict[str, Any],
964
+ ) -> T_Retval:
965
+ return trio.run(func, *args)
966
+
967
+ @classmethod
968
+ def current_token(cls) -> object:
969
+ return trio.lowlevel.current_trio_token()
970
+
971
+ @classmethod
972
+ def current_time(cls) -> float:
973
+ return trio.current_time()
974
+
975
+ @classmethod
976
+ def cancelled_exception_class(cls) -> type[BaseException]:
977
+ return trio.Cancelled
978
+
979
+ @classmethod
980
+ async def checkpoint(cls) -> None:
981
+ await trio.lowlevel.checkpoint()
982
+
983
+ @classmethod
984
+ async def checkpoint_if_cancelled(cls) -> None:
985
+ await trio.lowlevel.checkpoint_if_cancelled()
986
+
987
+ @classmethod
988
+ async def cancel_shielded_checkpoint(cls) -> None:
989
+ await trio.lowlevel.cancel_shielded_checkpoint()
990
+
991
+ @classmethod
992
+ async def sleep(cls, delay: float) -> None:
993
+ await trio.sleep(delay)
994
+
995
+ @classmethod
996
+ def create_cancel_scope(
997
+ cls, *, deadline: float = math.inf, shield: bool = False
998
+ ) -> abc.CancelScope:
999
+ return CancelScope(deadline=deadline, shield=shield)
1000
+
1001
+ @classmethod
1002
+ def current_effective_deadline(cls) -> float:
1003
+ return trio.current_effective_deadline()
1004
+
1005
+ @classmethod
1006
+ def create_task_group(cls) -> abc.TaskGroup:
1007
+ return TaskGroup()
1008
+
1009
+ @classmethod
1010
+ def create_event(cls) -> abc.Event:
1011
+ return Event()
1012
+
1013
+ @classmethod
1014
+ def create_lock(cls, *, fast_acquire: bool) -> Lock:
1015
+ return Lock(fast_acquire=fast_acquire)
1016
+
1017
+ @classmethod
1018
+ def create_semaphore(
1019
+ cls,
1020
+ initial_value: int,
1021
+ *,
1022
+ max_value: int | None = None,
1023
+ fast_acquire: bool = False,
1024
+ ) -> abc.Semaphore:
1025
+ return Semaphore(initial_value, max_value=max_value, fast_acquire=fast_acquire)
1026
+
1027
+ @classmethod
1028
+ def create_capacity_limiter(cls, total_tokens: float) -> CapacityLimiter:
1029
+ return CapacityLimiter(total_tokens)
1030
+
1031
+ @classmethod
1032
+ async def run_sync_in_worker_thread(
1033
+ cls,
1034
+ func: Callable[[Unpack[PosArgsT]], T_Retval],
1035
+ args: tuple[Unpack[PosArgsT]],
1036
+ abandon_on_cancel: bool = False,
1037
+ limiter: abc.CapacityLimiter | None = None,
1038
+ ) -> T_Retval:
1039
+ def wrapper() -> T_Retval:
1040
+ with claim_worker_thread(TrioBackend, token):
1041
+ return func(*args)
1042
+
1043
+ token = TrioBackend.current_token()
1044
+ return await run_sync(
1045
+ wrapper,
1046
+ abandon_on_cancel=abandon_on_cancel,
1047
+ limiter=cast(trio.CapacityLimiter, limiter),
1048
+ )
1049
+
1050
+ @classmethod
1051
+ def check_cancelled(cls) -> None:
1052
+ trio.from_thread.check_cancelled()
1053
+
1054
+ @classmethod
1055
+ def run_async_from_thread(
1056
+ cls,
1057
+ func: Callable[[Unpack[PosArgsT]], Awaitable[T_Retval]],
1058
+ args: tuple[Unpack[PosArgsT]],
1059
+ token: object,
1060
+ ) -> T_Retval:
1061
+ trio_token = cast("trio.lowlevel.TrioToken | None", token)
1062
+ try:
1063
+ return trio.from_thread.run(func, *args, trio_token=trio_token)
1064
+ except trio.RunFinishedError:
1065
+ raise RunFinishedError from None
1066
+
1067
+ @classmethod
1068
+ def run_sync_from_thread(
1069
+ cls,
1070
+ func: Callable[[Unpack[PosArgsT]], T_Retval],
1071
+ args: tuple[Unpack[PosArgsT]],
1072
+ token: object,
1073
+ ) -> T_Retval:
1074
+ trio_token = cast("trio.lowlevel.TrioToken | None", token)
1075
+ try:
1076
+ return trio.from_thread.run_sync(func, *args, trio_token=trio_token)
1077
+ except trio.RunFinishedError:
1078
+ raise RunFinishedError from None
1079
+
1080
+ @classmethod
1081
+ async def open_process(
1082
+ cls,
1083
+ command: StrOrBytesPath | Sequence[StrOrBytesPath],
1084
+ *,
1085
+ stdin: int | IO[Any] | None,
1086
+ stdout: int | IO[Any] | None,
1087
+ stderr: int | IO[Any] | None,
1088
+ **kwargs: Any,
1089
+ ) -> Process:
1090
+ def convert_item(item: StrOrBytesPath) -> str:
1091
+ str_or_bytes = os.fspath(item)
1092
+ if isinstance(str_or_bytes, str):
1093
+ return str_or_bytes
1094
+ else:
1095
+ return os.fsdecode(str_or_bytes)
1096
+
1097
+ if isinstance(command, (str, bytes, PathLike)):
1098
+ process = await trio.lowlevel.open_process(
1099
+ convert_item(command),
1100
+ stdin=stdin,
1101
+ stdout=stdout,
1102
+ stderr=stderr,
1103
+ shell=True,
1104
+ **kwargs,
1105
+ )
1106
+ else:
1107
+ process = await trio.lowlevel.open_process(
1108
+ [convert_item(item) for item in command],
1109
+ stdin=stdin,
1110
+ stdout=stdout,
1111
+ stderr=stderr,
1112
+ shell=False,
1113
+ **kwargs,
1114
+ )
1115
+
1116
+ stdin_stream = SendStreamWrapper(process.stdin) if process.stdin else None
1117
+ stdout_stream = ReceiveStreamWrapper(process.stdout) if process.stdout else None
1118
+ stderr_stream = ReceiveStreamWrapper(process.stderr) if process.stderr else None
1119
+ return Process(process, stdin_stream, stdout_stream, stderr_stream)
1120
+
1121
+ @classmethod
1122
+ def setup_process_pool_exit_at_shutdown(cls, workers: set[abc.Process]) -> None:
1123
+ trio.lowlevel.spawn_system_task(_shutdown_process_pool, workers)
1124
+
1125
+ @classmethod
1126
+ async def connect_tcp(
1127
+ cls, host: str, port: int, local_address: IPSockAddrType | None = None
1128
+ ) -> SocketStream:
1129
+ family = socket.AF_INET6 if ":" in host else socket.AF_INET
1130
+ trio_socket = trio.socket.socket(family)
1131
+ trio_socket.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
1132
+ if local_address:
1133
+ await trio_socket.bind(local_address)
1134
+
1135
+ try:
1136
+ await trio_socket.connect((host, port))
1137
+ except BaseException:
1138
+ trio_socket.close()
1139
+ raise
1140
+
1141
+ return SocketStream(trio_socket)
1142
+
1143
+ @classmethod
1144
+ async def connect_unix(cls, path: str | bytes) -> abc.UNIXSocketStream:
1145
+ trio_socket = trio.socket.socket(socket.AF_UNIX)
1146
+ try:
1147
+ await trio_socket.connect(path)
1148
+ except BaseException:
1149
+ trio_socket.close()
1150
+ raise
1151
+
1152
+ return UNIXSocketStream(trio_socket)
1153
+
1154
+ @classmethod
1155
+ def create_tcp_listener(cls, sock: socket.socket) -> abc.SocketListener:
1156
+ return TCPSocketListener(sock)
1157
+
1158
+ @classmethod
1159
+ def create_unix_listener(cls, sock: socket.socket) -> abc.SocketListener:
1160
+ return UNIXSocketListener(sock)
1161
+
1162
+ @classmethod
1163
+ async def create_udp_socket(
1164
+ cls,
1165
+ family: socket.AddressFamily,
1166
+ local_address: IPSockAddrType | None,
1167
+ remote_address: IPSockAddrType | None,
1168
+ reuse_port: bool,
1169
+ ) -> UDPSocket | ConnectedUDPSocket:
1170
+ trio_socket = trio.socket.socket(family=family, type=socket.SOCK_DGRAM)
1171
+
1172
+ if reuse_port:
1173
+ trio_socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEPORT, 1)
1174
+
1175
+ if local_address:
1176
+ await trio_socket.bind(local_address)
1177
+
1178
+ if remote_address:
1179
+ await trio_socket.connect(remote_address)
1180
+ return ConnectedUDPSocket(trio_socket)
1181
+ else:
1182
+ return UDPSocket(trio_socket)
1183
+
1184
+ @classmethod
1185
+ @overload
1186
+ async def create_unix_datagram_socket(
1187
+ cls, raw_socket: socket.socket, remote_path: None
1188
+ ) -> abc.UNIXDatagramSocket: ...
1189
+
1190
+ @classmethod
1191
+ @overload
1192
+ async def create_unix_datagram_socket(
1193
+ cls, raw_socket: socket.socket, remote_path: str | bytes
1194
+ ) -> abc.ConnectedUNIXDatagramSocket: ...
1195
+
1196
+ @classmethod
1197
+ async def create_unix_datagram_socket(
1198
+ cls, raw_socket: socket.socket, remote_path: str | bytes | None
1199
+ ) -> abc.UNIXDatagramSocket | abc.ConnectedUNIXDatagramSocket:
1200
+ trio_socket = trio.socket.from_stdlib_socket(raw_socket)
1201
+
1202
+ if remote_path:
1203
+ await trio_socket.connect(remote_path)
1204
+ return ConnectedUNIXDatagramSocket(trio_socket)
1205
+ else:
1206
+ return UNIXDatagramSocket(trio_socket)
1207
+
1208
+ @classmethod
1209
+ async def getaddrinfo(
1210
+ cls,
1211
+ host: bytes | str | None,
1212
+ port: str | int | None,
1213
+ *,
1214
+ family: int | AddressFamily = 0,
1215
+ type: int | SocketKind = 0,
1216
+ proto: int = 0,
1217
+ flags: int = 0,
1218
+ ) -> Sequence[
1219
+ tuple[
1220
+ AddressFamily,
1221
+ SocketKind,
1222
+ int,
1223
+ str,
1224
+ tuple[str, int] | tuple[str, int, int, int] | tuple[int, bytes],
1225
+ ]
1226
+ ]:
1227
+ return await trio.socket.getaddrinfo(host, port, family, type, proto, flags)
1228
+
1229
+ @classmethod
1230
+ async def getnameinfo(
1231
+ cls, sockaddr: IPSockAddrType, flags: int = 0
1232
+ ) -> tuple[str, str]:
1233
+ return await trio.socket.getnameinfo(sockaddr, flags)
1234
+
1235
+ @classmethod
1236
+ async def wait_readable(cls, obj: FileDescriptorLike) -> None:
1237
+ try:
1238
+ await wait_readable(obj)
1239
+ except trio.ClosedResourceError as exc:
1240
+ raise ClosedResourceError().with_traceback(exc.__traceback__) from None
1241
+ except trio.BusyResourceError:
1242
+ raise BusyResourceError("reading from") from None
1243
+
1244
+ @classmethod
1245
+ async def wait_writable(cls, obj: FileDescriptorLike) -> None:
1246
+ try:
1247
+ await wait_writable(obj)
1248
+ except trio.ClosedResourceError as exc:
1249
+ raise ClosedResourceError().with_traceback(exc.__traceback__) from None
1250
+ except trio.BusyResourceError:
1251
+ raise BusyResourceError("writing to") from None
1252
+
1253
+ @classmethod
1254
+ def notify_closing(cls, obj: FileDescriptorLike) -> None:
1255
+ notify_closing(obj)
1256
+
1257
+ @classmethod
1258
+ async def wrap_listener_socket(cls, sock: socket.socket) -> abc.SocketListener:
1259
+ return TCPSocketListener(sock)
1260
+
1261
+ @classmethod
1262
+ async def wrap_stream_socket(cls, sock: socket.socket) -> SocketStream:
1263
+ trio_sock = trio.socket.from_stdlib_socket(sock)
1264
+ return SocketStream(trio_sock)
1265
+
1266
+ @classmethod
1267
+ async def wrap_unix_stream_socket(cls, sock: socket.socket) -> UNIXSocketStream:
1268
+ trio_sock = trio.socket.from_stdlib_socket(sock)
1269
+ return UNIXSocketStream(trio_sock)
1270
+
1271
+ @classmethod
1272
+ async def wrap_udp_socket(cls, sock: socket.socket) -> UDPSocket:
1273
+ trio_sock = trio.socket.from_stdlib_socket(sock)
1274
+ return UDPSocket(trio_sock)
1275
+
1276
+ @classmethod
1277
+ async def wrap_connected_udp_socket(cls, sock: socket.socket) -> ConnectedUDPSocket:
1278
+ trio_sock = trio.socket.from_stdlib_socket(sock)
1279
+ return ConnectedUDPSocket(trio_sock)
1280
+
1281
+ @classmethod
1282
+ async def wrap_unix_datagram_socket(cls, sock: socket.socket) -> UNIXDatagramSocket:
1283
+ trio_sock = trio.socket.from_stdlib_socket(sock)
1284
+ return UNIXDatagramSocket(trio_sock)
1285
+
1286
+ @classmethod
1287
+ async def wrap_connected_unix_datagram_socket(
1288
+ cls, sock: socket.socket
1289
+ ) -> ConnectedUNIXDatagramSocket:
1290
+ trio_sock = trio.socket.from_stdlib_socket(sock)
1291
+ return ConnectedUNIXDatagramSocket(trio_sock)
1292
+
1293
+ @classmethod
1294
+ def current_default_thread_limiter(cls) -> CapacityLimiter:
1295
+ try:
1296
+ return _capacity_limiter_wrapper.get()
1297
+ except LookupError:
1298
+ limiter = CapacityLimiter(
1299
+ original=trio.to_thread.current_default_thread_limiter()
1300
+ )
1301
+ _capacity_limiter_wrapper.set(limiter)
1302
+ return limiter
1303
+
1304
+ @classmethod
1305
+ def open_signal_receiver(
1306
+ cls, *signals: Signals
1307
+ ) -> AbstractContextManager[AsyncIterator[Signals]]:
1308
+ return _SignalReceiver(signals)
1309
+
1310
+ @classmethod
1311
+ def get_current_task(cls) -> TaskInfo:
1312
+ task = current_task()
1313
+ return TrioTaskInfo(task)
1314
+
1315
+ @classmethod
1316
+ def get_running_tasks(cls) -> Sequence[TaskInfo]:
1317
+ root_task = current_root_task()
1318
+ assert root_task
1319
+ task_infos = [TrioTaskInfo(root_task)]
1320
+ nurseries = root_task.child_nurseries
1321
+ while nurseries:
1322
+ new_nurseries: list[trio.Nursery] = []
1323
+ for nursery in nurseries:
1324
+ for task in nursery.child_tasks:
1325
+ task_infos.append(TrioTaskInfo(task))
1326
+ new_nurseries.extend(task.child_nurseries)
1327
+
1328
+ nurseries = new_nurseries
1329
+
1330
+ return task_infos
1331
+
1332
+ @classmethod
1333
+ async def wait_all_tasks_blocked(cls) -> None:
1334
+ from trio.testing import wait_all_tasks_blocked
1335
+
1336
+ await wait_all_tasks_blocked()
1337
+
1338
+ @classmethod
1339
+ def create_test_runner(cls, options: dict[str, Any]) -> TestRunner:
1340
+ return TestRunner(**options)
1341
+
1342
+
1343
+ backend_class = TrioBackend
.venv/Lib/site-packages/anyio/_core/__init__.py ADDED
File without changes
.venv/Lib/site-packages/anyio/_core/__pycache__/__init__.cpython-314.pyc ADDED
Binary file (187 Bytes). View file
 
.venv/Lib/site-packages/anyio/_core/__pycache__/_asyncio_selector_thread.cpython-314.pyc ADDED
Binary file (10 kB). View file
 
.venv/Lib/site-packages/anyio/_core/__pycache__/_contextmanagers.cpython-314.pyc ADDED
Binary file (10.3 kB). View file
 
.venv/Lib/site-packages/anyio/_core/__pycache__/_eventloop.cpython-314.pyc ADDED
Binary file (9.93 kB). View file
 
.venv/Lib/site-packages/anyio/_core/__pycache__/_exceptions.cpython-314.pyc ADDED
Binary file (8.66 kB). View file
 
.venv/Lib/site-packages/anyio/_core/__pycache__/_fileio.cpython-314.pyc ADDED
Binary file (58.7 kB). View file
 
.venv/Lib/site-packages/anyio/_core/__pycache__/_resources.cpython-314.pyc ADDED
Binary file (1.09 kB). View file
 
.venv/Lib/site-packages/anyio/_core/__pycache__/_signals.cpython-314.pyc ADDED
Binary file (1.46 kB). View file
 
.venv/Lib/site-packages/anyio/_core/__pycache__/_sockets.cpython-314.pyc ADDED
Binary file (44.7 kB). View file
 
.venv/Lib/site-packages/anyio/_core/__pycache__/_streams.cpython-314.pyc ADDED
Binary file (2.56 kB). View file
 
.venv/Lib/site-packages/anyio/_core/__pycache__/_subprocesses.cpython-314.pyc ADDED
Binary file (10.2 kB). View file