ChopGuard commited on
Commit
9d5efc6
·
verified ·
1 Parent(s): aa9fde2

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 +9 -0
  2. .gitignore +3 -0
  3. .venv/.gitignore +2 -0
  4. .venv/bin/Activate.ps1 +248 -0
  5. .venv/bin/activate +76 -0
  6. .venv/bin/activate.csh +27 -0
  7. .venv/bin/activate.fish +69 -0
  8. .venv/bin/hf +8 -0
  9. .venv/bin/httpx2 +8 -0
  10. .venv/bin/idna +8 -0
  11. .venv/bin/pip +8 -0
  12. .venv/bin/pip3 +8 -0
  13. .venv/bin/pip3.14 +8 -0
  14. .venv/bin/python +3 -0
  15. .venv/bin/python3 +3 -0
  16. .venv/bin/python3.14 +3 -0
  17. .venv/bin/tiny-agents +8 -0
  18. .venv/bin/tqdm +8 -0
  19. .venv/bin/𝜋thon +3 -0
  20. .venv/lib/python3.14/site-packages/__pycache__/typing_extensions.cpython-314.pyc +3 -0
  21. .venv/lib/python3.14/site-packages/_yaml/__init__.py +33 -0
  22. .venv/lib/python3.14/site-packages/_yaml/__pycache__/__init__.cpython-314.pyc +0 -0
  23. .venv/lib/python3.14/site-packages/anyio-4.15.1.dist-info/INSTALLER +1 -0
  24. .venv/lib/python3.14/site-packages/anyio-4.15.1.dist-info/METADATA +108 -0
  25. .venv/lib/python3.14/site-packages/anyio-4.15.1.dist-info/RECORD +100 -0
  26. .venv/lib/python3.14/site-packages/anyio-4.15.1.dist-info/WHEEL +5 -0
  27. .venv/lib/python3.14/site-packages/anyio-4.15.1.dist-info/entry_points.txt +2 -0
  28. .venv/lib/python3.14/site-packages/anyio-4.15.1.dist-info/licenses/LICENSE +20 -0
  29. .venv/lib/python3.14/site-packages/anyio-4.15.1.dist-info/top_level.txt +1 -0
  30. .venv/lib/python3.14/site-packages/anyio/__init__.py +154 -0
  31. .venv/lib/python3.14/site-packages/anyio/__pycache__/__init__.cpython-314.pyc +0 -0
  32. .venv/lib/python3.14/site-packages/anyio/__pycache__/_lazyimport.cpython-314.pyc +0 -0
  33. .venv/lib/python3.14/site-packages/anyio/__pycache__/from_thread.cpython-314.pyc +0 -0
  34. .venv/lib/python3.14/site-packages/anyio/__pycache__/functools.cpython-314.pyc +0 -0
  35. .venv/lib/python3.14/site-packages/anyio/__pycache__/itertools.cpython-314.pyc +0 -0
  36. .venv/lib/python3.14/site-packages/anyio/__pycache__/lowlevel.cpython-314.pyc +0 -0
  37. .venv/lib/python3.14/site-packages/anyio/__pycache__/pytest_plugin.cpython-314.pyc +0 -0
  38. .venv/lib/python3.14/site-packages/anyio/__pycache__/to_interpreter.cpython-314.pyc +0 -0
  39. .venv/lib/python3.14/site-packages/anyio/__pycache__/to_process.cpython-314.pyc +0 -0
  40. .venv/lib/python3.14/site-packages/anyio/__pycache__/to_thread.cpython-314.pyc +0 -0
  41. .venv/lib/python3.14/site-packages/anyio/_backends/__init__.py +0 -0
  42. .venv/lib/python3.14/site-packages/anyio/_backends/__pycache__/__init__.cpython-314.pyc +0 -0
  43. .venv/lib/python3.14/site-packages/anyio/_backends/__pycache__/_asyncio.cpython-314.pyc +3 -0
  44. .venv/lib/python3.14/site-packages/anyio/_backends/__pycache__/_trio.cpython-314.pyc +3 -0
  45. .venv/lib/python3.14/site-packages/anyio/_backends/_asyncio.py +0 -0
  46. .venv/lib/python3.14/site-packages/anyio/_backends/_trio.py +1473 -0
  47. .venv/lib/python3.14/site-packages/anyio/_core/__init__.py +0 -0
  48. .venv/lib/python3.14/site-packages/anyio/_core/__pycache__/__init__.cpython-314.pyc +0 -0
  49. .venv/lib/python3.14/site-packages/anyio/_core/__pycache__/_asyncio_selector_thread.cpython-314.pyc +0 -0
  50. .venv/lib/python3.14/site-packages/anyio/_core/__pycache__/_concurrency_utils.cpython-314.pyc +0 -0
.gitattributes CHANGED
@@ -33,3 +33,12 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ .venv/bin/python filter=lfs diff=lfs merge=lfs -text
37
+ .venv/bin/python3 filter=lfs diff=lfs merge=lfs -text
38
+ .venv/bin/python3.14 filter=lfs diff=lfs merge=lfs -text
39
+ .venv/bin/𝜋thon filter=lfs diff=lfs merge=lfs -text
40
+ .venv/lib/python3.14/site-packages/__pycache__/typing_extensions.cpython-314.pyc filter=lfs diff=lfs merge=lfs -text
41
+ .venv/lib/python3.14/site-packages/anyio/_backends/__pycache__/_asyncio.cpython-314.pyc filter=lfs diff=lfs merge=lfs -text
42
+ .venv/lib/python3.14/site-packages/anyio/_backends/__pycache__/_trio.cpython-314.pyc filter=lfs diff=lfs merge=lfs -text
43
+ .venv/lib/python3.14/site-packages/click/__pycache__/core.cpython-314.pyc filter=lfs diff=lfs merge=lfs -text
44
+ .venv/lib/python3.14/site-packages/filelock/__pycache__/_api.cpython-314.pyc filter=lfs diff=lfs merge=lfs -text
.gitignore ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ conversations/
2
+
3
+ .venv
.venv/.gitignore ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ # Created by venv; see https://docs.python.org/3/library/venv.html
2
+ *
.venv/bin/Activate.ps1 ADDED
@@ -0,0 +1,248 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <#
2
+ .Synopsis
3
+ Activate a Python virtual environment for the current PowerShell session.
4
+
5
+ .Description
6
+ Pushes the python executable for a virtual environment to the front of the
7
+ $Env:PATH environment variable and sets the prompt to signify that you are
8
+ in a Python virtual environment. Makes use of the command line switches as
9
+ well as the `pyvenv.cfg` file values present in the virtual environment.
10
+
11
+ .Parameter VenvDir
12
+ Path to the directory that contains the virtual environment to activate. The
13
+ default value for this is the parent of the directory that the Activate.ps1
14
+ script is located within.
15
+
16
+ .Parameter Prompt
17
+ The prompt prefix to display when this virtual environment is activated. By
18
+ default, this prompt is the name of the virtual environment folder (VenvDir)
19
+ surrounded by parentheses and followed by a single space (ie. '(.venv) ').
20
+
21
+ .Example
22
+ Activate.ps1
23
+ Activates the Python virtual environment that contains the Activate.ps1 script.
24
+
25
+ .Example
26
+ Activate.ps1 -Verbose
27
+ Activates the Python virtual environment that contains the Activate.ps1 script,
28
+ and shows extra information about the activation as it executes.
29
+
30
+ .Example
31
+ Activate.ps1 -VenvDir C:\Users\MyUser\Common\.venv
32
+ Activates the Python virtual environment located in the specified location.
33
+
34
+ .Example
35
+ Activate.ps1 -Prompt "MyPython"
36
+ Activates the Python virtual environment that contains the Activate.ps1 script,
37
+ and prefixes the current prompt with the specified string (surrounded in
38
+ parentheses) while the virtual environment is active.
39
+
40
+ .Notes
41
+ On Windows, it may be required to enable this Activate.ps1 script by setting the
42
+ execution policy for the user. You can do this by issuing the following PowerShell
43
+ command:
44
+
45
+ PS C:\> Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
46
+
47
+ For more information on Execution Policies:
48
+ https://go.microsoft.com/fwlink/?LinkID=135170
49
+
50
+ #>
51
+ Param(
52
+ [Parameter(Mandatory = $false)]
53
+ [String]
54
+ $VenvDir,
55
+ [Parameter(Mandatory = $false)]
56
+ [String]
57
+ $Prompt
58
+ )
59
+
60
+ <# Function declarations --------------------------------------------------- #>
61
+
62
+ <#
63
+ .Synopsis
64
+ Remove all shell session elements added by the Activate script, including the
65
+ addition of the virtual environment's Python executable from the beginning of
66
+ the PATH variable.
67
+
68
+ .Parameter NonDestructive
69
+ If present, do not remove this function from the global namespace for the
70
+ session.
71
+
72
+ #>
73
+ function global:deactivate ([switch]$NonDestructive) {
74
+ # Revert to original values
75
+
76
+ # The prior prompt:
77
+ if (Test-Path -Path Function:_OLD_VIRTUAL_PROMPT) {
78
+ Copy-Item -Path Function:_OLD_VIRTUAL_PROMPT -Destination Function:prompt
79
+ Remove-Item -Path Function:_OLD_VIRTUAL_PROMPT
80
+ }
81
+
82
+ # The prior PYTHONHOME:
83
+ if (Test-Path -Path Env:_OLD_VIRTUAL_PYTHONHOME) {
84
+ Copy-Item -Path Env:_OLD_VIRTUAL_PYTHONHOME -Destination Env:PYTHONHOME
85
+ Remove-Item -Path Env:_OLD_VIRTUAL_PYTHONHOME
86
+ }
87
+
88
+ # The prior PATH:
89
+ if (Test-Path -Path Env:_OLD_VIRTUAL_PATH) {
90
+ Copy-Item -Path Env:_OLD_VIRTUAL_PATH -Destination Env:PATH
91
+ Remove-Item -Path Env:_OLD_VIRTUAL_PATH
92
+ }
93
+
94
+ # Just remove the VIRTUAL_ENV altogether:
95
+ if (Test-Path -Path Env:VIRTUAL_ENV) {
96
+ Remove-Item -Path env:VIRTUAL_ENV
97
+ }
98
+
99
+ # Just remove VIRTUAL_ENV_PROMPT altogether.
100
+ if (Test-Path -Path Env:VIRTUAL_ENV_PROMPT) {
101
+ Remove-Item -Path env:VIRTUAL_ENV_PROMPT
102
+ }
103
+
104
+ # Just remove the _PYTHON_VENV_PROMPT_PREFIX altogether:
105
+ if (Get-Variable -Name "_PYTHON_VENV_PROMPT_PREFIX" -ErrorAction SilentlyContinue) {
106
+ Remove-Variable -Name _PYTHON_VENV_PROMPT_PREFIX -Scope Global -Force
107
+ }
108
+
109
+ # Leave deactivate function in the global namespace if requested:
110
+ if (-not $NonDestructive) {
111
+ Remove-Item -Path function:deactivate
112
+ }
113
+ }
114
+
115
+ <#
116
+ .Description
117
+ Get-PyVenvConfig parses the values from the pyvenv.cfg file located in the
118
+ given folder, and returns them in a map.
119
+
120
+ For each line in the pyvenv.cfg file, if that line can be parsed into exactly
121
+ two strings separated by `=` (with any amount of whitespace surrounding the =)
122
+ then it is considered a `key = value` line. The left hand string is the key,
123
+ the right hand is the value.
124
+
125
+ If the value starts with a `'` or a `"` then the first and last character is
126
+ stripped from the value before being captured.
127
+
128
+ .Parameter ConfigDir
129
+ Path to the directory that contains the `pyvenv.cfg` file.
130
+ #>
131
+ function Get-PyVenvConfig(
132
+ [String]
133
+ $ConfigDir
134
+ ) {
135
+ Write-Verbose "Given ConfigDir=$ConfigDir, obtain values in pyvenv.cfg"
136
+
137
+ # Ensure the file exists, and issue a warning if it doesn't (but still allow the function to continue).
138
+ $pyvenvConfigPath = Join-Path -Resolve -Path $ConfigDir -ChildPath 'pyvenv.cfg' -ErrorAction Continue
139
+
140
+ # An empty map will be returned if no config file is found.
141
+ $pyvenvConfig = @{ }
142
+
143
+ if ($pyvenvConfigPath) {
144
+
145
+ Write-Verbose "File exists, parse `key = value` lines"
146
+ $pyvenvConfigContent = Get-Content -Path $pyvenvConfigPath
147
+
148
+ $pyvenvConfigContent | ForEach-Object {
149
+ $keyval = $PSItem -split "\s*=\s*", 2
150
+ if ($keyval[0] -and $keyval[1]) {
151
+ $val = $keyval[1]
152
+
153
+ # Remove extraneous quotations around a string value.
154
+ if ("'""".Contains($val.Substring(0, 1))) {
155
+ $val = $val.Substring(1, $val.Length - 2)
156
+ }
157
+
158
+ $pyvenvConfig[$keyval[0]] = $val
159
+ Write-Verbose "Adding Key: '$($keyval[0])'='$val'"
160
+ }
161
+ }
162
+ }
163
+ return $pyvenvConfig
164
+ }
165
+
166
+
167
+ <# Begin Activate script --------------------------------------------------- #>
168
+
169
+ # Determine the containing directory of this script
170
+ $VenvExecPath = Split-Path -Parent $MyInvocation.MyCommand.Definition
171
+ $VenvExecDir = Get-Item -Path $VenvExecPath
172
+
173
+ Write-Verbose "Activation script is located in path: '$VenvExecPath'"
174
+ Write-Verbose "VenvExecDir Fullname: '$($VenvExecDir.FullName)"
175
+ Write-Verbose "VenvExecDir Name: '$($VenvExecDir.Name)"
176
+
177
+ # Set values required in priority: CmdLine, ConfigFile, Default
178
+ # First, get the location of the virtual environment, it might not be
179
+ # VenvExecDir if specified on the command line.
180
+ if ($VenvDir) {
181
+ Write-Verbose "VenvDir given as parameter, using '$VenvDir' to determine values"
182
+ }
183
+ else {
184
+ Write-Verbose "VenvDir not given as a parameter, using parent directory name as VenvDir."
185
+ $VenvDir = $VenvExecDir.Parent.FullName.TrimEnd("\\/")
186
+ Write-Verbose "VenvDir=$VenvDir"
187
+ }
188
+
189
+ # Next, read the `pyvenv.cfg` file to determine any required value such
190
+ # as `prompt`.
191
+ $pyvenvCfg = Get-PyVenvConfig -ConfigDir $VenvDir
192
+
193
+ # Next, set the prompt from the command line, or the config file, or
194
+ # just use the name of the virtual environment folder.
195
+ if ($Prompt) {
196
+ Write-Verbose "Prompt specified as argument, using '$Prompt'"
197
+ }
198
+ else {
199
+ Write-Verbose "Prompt not specified as argument to script, checking pyvenv.cfg value"
200
+ if ($pyvenvCfg -and $pyvenvCfg['prompt']) {
201
+ Write-Verbose " Setting based on value in pyvenv.cfg='$($pyvenvCfg['prompt'])'"
202
+ $Prompt = $pyvenvCfg['prompt'];
203
+ }
204
+ else {
205
+ Write-Verbose " Setting prompt based on parent's directory's name. (Is the directory name passed to venv module when creating the virtual environment)"
206
+ Write-Verbose " Got leaf-name of $VenvDir='$(Split-Path -Path $venvDir -Leaf)'"
207
+ $Prompt = Split-Path -Path $venvDir -Leaf
208
+ }
209
+ }
210
+
211
+ Write-Verbose "Prompt = '$Prompt'"
212
+ Write-Verbose "VenvDir='$VenvDir'"
213
+
214
+ # Deactivate any currently active virtual environment, but leave the
215
+ # deactivate function in place.
216
+ deactivate -nondestructive
217
+
218
+ # Now set the environment variable VIRTUAL_ENV, used by many tools to determine
219
+ # that there is an activated venv.
220
+ $env:VIRTUAL_ENV = $VenvDir
221
+
222
+ $env:VIRTUAL_ENV_PROMPT = $Prompt
223
+
224
+ if (-not $Env:VIRTUAL_ENV_DISABLE_PROMPT) {
225
+
226
+ Write-Verbose "Setting prompt to '$Prompt'"
227
+
228
+ # Set the prompt to include the env name
229
+ # Make sure _OLD_VIRTUAL_PROMPT is global
230
+ function global:_OLD_VIRTUAL_PROMPT { "" }
231
+ Copy-Item -Path function:prompt -Destination function:_OLD_VIRTUAL_PROMPT
232
+ New-Variable -Name _PYTHON_VENV_PROMPT_PREFIX -Description "Python virtual environment prompt prefix" -Scope Global -Option ReadOnly -Visibility Public -Value $Prompt
233
+
234
+ function global:prompt {
235
+ Write-Host -NoNewline -ForegroundColor Green "($_PYTHON_VENV_PROMPT_PREFIX) "
236
+ _OLD_VIRTUAL_PROMPT
237
+ }
238
+ }
239
+
240
+ # Clear PYTHONHOME
241
+ if (Test-Path -Path Env:PYTHONHOME) {
242
+ Copy-Item -Path Env:PYTHONHOME -Destination Env:_OLD_VIRTUAL_PYTHONHOME
243
+ Remove-Item -Path Env:PYTHONHOME
244
+ }
245
+
246
+ # Add the venv to the PATH
247
+ Copy-Item -Path Env:PATH -Destination Env:_OLD_VIRTUAL_PATH
248
+ $Env:PATH = "$VenvExecDir$([System.IO.Path]::PathSeparator)$Env:PATH"
.venv/bin/activate ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # This file must be used with "source bin/activate" *from bash*
2
+ # You cannot run it directly
3
+
4
+ deactivate () {
5
+ # reset old environment variables
6
+ if [ -n "${_OLD_VIRTUAL_PATH:-}" ] ; then
7
+ PATH="${_OLD_VIRTUAL_PATH:-}"
8
+ export PATH
9
+ unset _OLD_VIRTUAL_PATH
10
+ fi
11
+ if [ -n "${_OLD_VIRTUAL_PYTHONHOME:-}" ] ; then
12
+ PYTHONHOME="${_OLD_VIRTUAL_PYTHONHOME:-}"
13
+ export PYTHONHOME
14
+ unset _OLD_VIRTUAL_PYTHONHOME
15
+ fi
16
+
17
+ # Call hash to forget past locations. Without forgetting
18
+ # past locations the $PATH changes we made may not be respected.
19
+ # See "man bash" for more details. hash is usually a builtin of your shell
20
+ hash -r 2> /dev/null
21
+
22
+ if [ -n "${_OLD_VIRTUAL_PS1:-}" ] ; then
23
+ PS1="${_OLD_VIRTUAL_PS1:-}"
24
+ export PS1
25
+ unset _OLD_VIRTUAL_PS1
26
+ fi
27
+
28
+ unset VIRTUAL_ENV
29
+ unset VIRTUAL_ENV_PROMPT
30
+ if [ ! "${1:-}" = "nondestructive" ] ; then
31
+ # Self destruct!
32
+ unset -f deactivate
33
+ fi
34
+ }
35
+
36
+ # unset irrelevant variables
37
+ deactivate nondestructive
38
+
39
+ # on Windows, a path can contain colons and backslashes and has to be converted:
40
+ case "$(uname)" in
41
+ CYGWIN*|MSYS*|MINGW*)
42
+ # transform D:\path\to\venv to /d/path/to/venv on MSYS and MINGW
43
+ # and to /cygdrive/d/path/to/venv on Cygwin
44
+ VIRTUAL_ENV=$(cygpath /run/media/chop/NEWBULK/Workspace/ChopGuard/run_20261018_010954_625209/.venv)
45
+ export VIRTUAL_ENV
46
+ ;;
47
+ *)
48
+ # use the path as-is
49
+ export VIRTUAL_ENV=/run/media/chop/NEWBULK/Workspace/ChopGuard/run_20261018_010954_625209/.venv
50
+ ;;
51
+ esac
52
+
53
+ _OLD_VIRTUAL_PATH="$PATH"
54
+ PATH="$VIRTUAL_ENV/"bin":$PATH"
55
+ export PATH
56
+
57
+ VIRTUAL_ENV_PROMPT=.venv
58
+ export VIRTUAL_ENV_PROMPT
59
+
60
+ # unset PYTHONHOME if set
61
+ # this will fail if PYTHONHOME is set to the empty string (which is bad anyway)
62
+ # could use `if (set -u; : $PYTHONHOME) ;` in bash
63
+ if [ -n "${PYTHONHOME:-}" ] ; then
64
+ _OLD_VIRTUAL_PYTHONHOME="${PYTHONHOME:-}"
65
+ unset PYTHONHOME
66
+ fi
67
+
68
+ if [ -z "${VIRTUAL_ENV_DISABLE_PROMPT:-}" ] ; then
69
+ _OLD_VIRTUAL_PS1="${PS1:-}"
70
+ PS1="(".venv") ${PS1:-}"
71
+ export PS1
72
+ fi
73
+
74
+ # Call hash to forget past commands. Without forgetting
75
+ # past commands the $PATH changes we made may not be respected
76
+ hash -r 2> /dev/null
.venv/bin/activate.csh ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # This file must be used with "source bin/activate.csh" *from csh*.
2
+ # You cannot run it directly.
3
+
4
+ # Created by Davide Di Blasi <davidedb@gmail.com>.
5
+ # Ported to Python 3.3 venv by Andrew Svetlov <andrew.svetlov@gmail.com>
6
+
7
+ alias deactivate 'test $?_OLD_VIRTUAL_PATH != 0 && setenv PATH "$_OLD_VIRTUAL_PATH" && unset _OLD_VIRTUAL_PATH; rehash; test $?_OLD_VIRTUAL_PROMPT != 0 && set prompt="$_OLD_VIRTUAL_PROMPT" && unset _OLD_VIRTUAL_PROMPT; unsetenv VIRTUAL_ENV; unsetenv VIRTUAL_ENV_PROMPT; test "\!:*" != "nondestructive" && unalias deactivate'
8
+
9
+ # Unset irrelevant variables.
10
+ deactivate nondestructive
11
+
12
+ setenv VIRTUAL_ENV /run/media/chop/NEWBULK/Workspace/ChopGuard/run_20261018_010954_625209/.venv
13
+
14
+ set _OLD_VIRTUAL_PATH="$PATH"
15
+ setenv PATH "$VIRTUAL_ENV/"bin":$PATH"
16
+ setenv VIRTUAL_ENV_PROMPT .venv
17
+
18
+
19
+ set _OLD_VIRTUAL_PROMPT="$prompt"
20
+
21
+ if (! "$?VIRTUAL_ENV_DISABLE_PROMPT") then
22
+ set prompt = "(".venv") $prompt:q"
23
+ endif
24
+
25
+ alias pydoc python -m pydoc
26
+
27
+ rehash
.venv/bin/activate.fish ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # This file must be used with "source <venv>/bin/activate.fish" *from fish*
2
+ # (https://fishshell.com/). You cannot run it directly.
3
+
4
+ function deactivate -d "Exit virtual environment and return to normal shell environment"
5
+ # reset old environment variables
6
+ if test -n "$_OLD_VIRTUAL_PATH"
7
+ set -gx PATH $_OLD_VIRTUAL_PATH
8
+ set -e _OLD_VIRTUAL_PATH
9
+ end
10
+ if test -n "$_OLD_VIRTUAL_PYTHONHOME"
11
+ set -gx PYTHONHOME $_OLD_VIRTUAL_PYTHONHOME
12
+ set -e _OLD_VIRTUAL_PYTHONHOME
13
+ end
14
+
15
+ if test -n "$_OLD_FISH_PROMPT_OVERRIDE"
16
+ set -e _OLD_FISH_PROMPT_OVERRIDE
17
+ # prevents error when using nested fish instances (Issue #93858)
18
+ if functions -q _old_fish_prompt
19
+ functions -e fish_prompt
20
+ functions -c _old_fish_prompt fish_prompt
21
+ functions -e _old_fish_prompt
22
+ end
23
+ end
24
+
25
+ set -e VIRTUAL_ENV
26
+ set -e VIRTUAL_ENV_PROMPT
27
+ if test "$argv[1]" != "nondestructive"
28
+ # Self-destruct!
29
+ functions -e deactivate
30
+ end
31
+ end
32
+
33
+ # Unset irrelevant variables.
34
+ deactivate nondestructive
35
+
36
+ set -gx VIRTUAL_ENV /run/media/chop/NEWBULK/Workspace/ChopGuard/run_20261018_010954_625209/.venv
37
+
38
+ set -gx _OLD_VIRTUAL_PATH $PATH
39
+ set -gx PATH "$VIRTUAL_ENV/"bin $PATH
40
+ set -gx VIRTUAL_ENV_PROMPT .venv
41
+
42
+ # Unset PYTHONHOME if set.
43
+ if set -q PYTHONHOME
44
+ set -gx _OLD_VIRTUAL_PYTHONHOME $PYTHONHOME
45
+ set -e PYTHONHOME
46
+ end
47
+
48
+ if test -z "$VIRTUAL_ENV_DISABLE_PROMPT"
49
+ # fish uses a function instead of an env var to generate the prompt.
50
+
51
+ # Save the current fish_prompt function as the function _old_fish_prompt.
52
+ functions -c fish_prompt _old_fish_prompt
53
+
54
+ # With the original prompt function renamed, we can override with our own.
55
+ function fish_prompt
56
+ # Save the return status of the last command.
57
+ set -l old_status $status
58
+
59
+ # Output the venv prompt; color taken from the blue of the Python logo.
60
+ printf "%s(%s)%s " (set_color 4B8BBE) .venv (set_color normal)
61
+
62
+ # Restore the return status of the previous command.
63
+ echo "exit $old_status" | .
64
+ # Output the original/"old" prompt.
65
+ _old_fish_prompt
66
+ end
67
+
68
+ set -gx _OLD_FISH_PROMPT_OVERRIDE "$VIRTUAL_ENV"
69
+ end
.venv/bin/hf ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ #!/run/media/chop/NEWBULK/Workspace/ChopGuard/run_20261018_010954_625209/.venv/bin/python3
2
+ # -*- coding: utf-8 -*-
3
+ import re
4
+ import sys
5
+ from huggingface_hub.cli.hf import main
6
+ if __name__ == '__main__':
7
+ sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
8
+ sys.exit(main())
.venv/bin/httpx2 ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ #!/run/media/chop/NEWBULK/Workspace/ChopGuard/run_20261018_010954_625209/.venv/bin/python3
2
+ # -*- coding: utf-8 -*-
3
+ import re
4
+ import sys
5
+ from httpx2._main import main
6
+ if __name__ == '__main__':
7
+ sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
8
+ sys.exit(main())
.venv/bin/idna ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ #!/run/media/chop/NEWBULK/Workspace/ChopGuard/run_20261018_010954_625209/.venv/bin/python3
2
+ # -*- coding: utf-8 -*-
3
+ import re
4
+ import sys
5
+ from idna.cli import main
6
+ if __name__ == '__main__':
7
+ sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
8
+ sys.exit(main())
.venv/bin/pip ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ #!/run/media/chop/NEWBULK/Workspace/ChopGuard/run_20261018_010954_625209/.venv/bin/python3
2
+ # -*- coding: utf-8 -*-
3
+ import re
4
+ import sys
5
+ from pip._internal.cli.main import main
6
+ if __name__ == '__main__':
7
+ sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
8
+ sys.exit(main())
.venv/bin/pip3 ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ #!/run/media/chop/NEWBULK/Workspace/ChopGuard/run_20261018_010954_625209/.venv/bin/python3
2
+ # -*- coding: utf-8 -*-
3
+ import re
4
+ import sys
5
+ from pip._internal.cli.main import main
6
+ if __name__ == '__main__':
7
+ sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
8
+ sys.exit(main())
.venv/bin/pip3.14 ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ #!/run/media/chop/NEWBULK/Workspace/ChopGuard/run_20261018_010954_625209/.venv/bin/python3
2
+ # -*- coding: utf-8 -*-
3
+ import re
4
+ import sys
5
+ from pip._internal.cli.main import main
6
+ if __name__ == '__main__':
7
+ sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
8
+ sys.exit(main())
.venv/bin/python ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b8d8288faefdd300201f43fcf00f6f539a27218eeed3a3dff5ab10b9c4c99700
3
+ size 7481192
.venv/bin/python3 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b8d8288faefdd300201f43fcf00f6f539a27218eeed3a3dff5ab10b9c4c99700
3
+ size 7481192
.venv/bin/python3.14 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b8d8288faefdd300201f43fcf00f6f539a27218eeed3a3dff5ab10b9c4c99700
3
+ size 7481192
.venv/bin/tiny-agents ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ #!/run/media/chop/NEWBULK/Workspace/ChopGuard/run_20261018_010954_625209/.venv/bin/python3
2
+ # -*- coding: utf-8 -*-
3
+ import re
4
+ import sys
5
+ from huggingface_hub.inference._mcp.cli import app
6
+ if __name__ == '__main__':
7
+ sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
8
+ sys.exit(app())
.venv/bin/tqdm ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ #!/run/media/chop/NEWBULK/Workspace/ChopGuard/run_20261018_010954_625209/.venv/bin/python3
2
+ # -*- coding: utf-8 -*-
3
+ import re
4
+ import sys
5
+ from tqdm.cli import main
6
+ if __name__ == '__main__':
7
+ sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
8
+ sys.exit(main())
.venv/bin/𝜋thon ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b8d8288faefdd300201f43fcf00f6f539a27218eeed3a3dff5ab10b9c4c99700
3
+ size 7481192
.venv/lib/python3.14/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:6e337f18c92750414c4fb602467988640887646dca3ac07e1f707169eb340718
3
+ size 179457
.venv/lib/python3.14/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/python3.14/site-packages/_yaml/__pycache__/__init__.cpython-314.pyc ADDED
Binary file (921 Bytes). View file
 
.venv/lib/python3.14/site-packages/anyio-4.15.1.dist-info/INSTALLER ADDED
@@ -0,0 +1 @@
 
 
1
+ pip
.venv/lib/python3.14/site-packages/anyio-4.15.1.dist-info/METADATA ADDED
@@ -0,0 +1,108 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Metadata-Version: 2.4
2
+ Name: anyio
3
+ Version: 4.15.1
4
+ Summary: High-level concurrency and networking framework on top of asyncio or Trio
5
+ Author-email: Alex Grönholm <alex.gronholm@nextday.fi>
6
+ License-Expression: MIT
7
+ Project-URL: Documentation, https://anyio.readthedocs.io/en/latest/
8
+ Project-URL: Changelog, https://anyio.readthedocs.io/en/stable/versionhistory.html
9
+ Project-URL: Source code, https://github.com/agronholm/anyio
10
+ Project-URL: Issue tracker, https://github.com/agronholm/anyio/issues
11
+ Classifier: Development Status :: 5 - Production/Stable
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Framework :: AnyIO
14
+ Classifier: Typing :: Typed
15
+ Classifier: Programming Language :: Python
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.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
+ Classifier: Programming Language :: Python :: 3.15
23
+ Classifier: Programming Language :: Python :: Free Threading :: 2 - Beta
24
+ Requires-Python: >=3.10
25
+ Description-Content-Type: text/x-rst
26
+ License-File: LICENSE
27
+ Requires-Dist: exceptiongroup>=1.0.2; python_version < "3.11"
28
+ Requires-Dist: idna>=2.8
29
+ Requires-Dist: typing_extensions>=4.16.0; python_version < "3.15"
30
+ Provides-Extra: trio
31
+ Requires-Dist: trio>=0.32.0; extra == "trio"
32
+ Dynamic: license-file
33
+
34
+ .. image:: https://github.com/agronholm/anyio/actions/workflows/test.yml/badge.svg
35
+ :target: https://github.com/agronholm/anyio/actions/workflows/test.yml
36
+ :alt: Build Status
37
+ .. image:: https://coveralls.io/repos/github/agronholm/anyio/badge.svg?branch=master
38
+ :target: https://coveralls.io/github/agronholm/anyio?branch=master
39
+ :alt: Code Coverage
40
+ .. image:: https://readthedocs.org/projects/anyio/badge/?version=latest
41
+ :target: https://anyio.readthedocs.io/en/latest/?badge=latest
42
+ :alt: Documentation
43
+ .. image:: https://badges.gitter.im/gitterHQ/gitter.svg
44
+ :target: https://gitter.im/python-trio/AnyIO
45
+ :alt: Gitter chat
46
+ .. image:: https://tidelift.com/badges/package/pypi/anyio
47
+ :target: https://tidelift.com/subscription/pkg/pypi-anyio
48
+ :alt: Tidelift
49
+
50
+ AnyIO is an asynchronous networking and concurrency library that works on top of either asyncio_ or
51
+ Trio_. It implements Trio-like `structured concurrency`_ (SC) on top of asyncio and works in harmony
52
+ with the native SC of Trio itself.
53
+
54
+ Applications and libraries written against AnyIO's API will run unmodified on either asyncio_ or
55
+ Trio_. AnyIO can also be adopted into a library or application incrementally – bit by bit, no full
56
+ refactoring necessary. It will blend in with the native libraries of your chosen backend.
57
+
58
+ To find out why you might want to use AnyIO's APIs instead of asyncio's, you can read about it
59
+ `here <https://anyio.readthedocs.io/en/stable/why.html>`_.
60
+
61
+ Documentation
62
+ -------------
63
+
64
+ View full documentation at: https://anyio.readthedocs.io/
65
+
66
+ Features
67
+ --------
68
+
69
+ AnyIO offers the following functionality:
70
+
71
+ * Task groups (nurseries_ in trio terminology)
72
+ * High-level networking (TCP, UDP and UNIX sockets)
73
+
74
+ * `Happy eyeballs`_ algorithm for TCP connections (more robust than that of asyncio on Python
75
+ 3.8)
76
+ * async/await style UDP sockets (unlike asyncio where you still have to use Transports and
77
+ Protocols)
78
+
79
+ * A versatile API for byte streams and object streams
80
+ * Inter-task synchronization and communication (locks, conditions, events, semaphores, object
81
+ streams and futures)
82
+ * Worker threads
83
+ * Subprocesses
84
+ * Subinterpreter support for code parallelization (on Python 3.13 and later)
85
+ * Asynchronous file I/O (using worker threads)
86
+ * Signal handling
87
+ * Asynchronous versions of the functools_ and itertools_ modules
88
+
89
+ AnyIO also comes with its own pytest_ plugin which also supports asynchronous fixtures.
90
+ It even works with the popular Hypothesis_ library.
91
+
92
+ .. _asyncio: https://docs.python.org/3/library/asyncio.html
93
+ .. _Trio: https://github.com/python-trio/trio
94
+ .. _structured concurrency: https://en.wikipedia.org/wiki/Structured_concurrency
95
+ .. _nurseries: https://trio.readthedocs.io/en/stable/reference-core.html#nurseries-and-spawning
96
+ .. _Happy eyeballs: https://en.wikipedia.org/wiki/Happy_Eyeballs
97
+ .. _pytest: https://docs.pytest.org/en/latest/
98
+ .. _functools: https://docs.python.org/3/library/functools.html
99
+ .. _itertools: https://docs.python.org/3/library/itertools.html
100
+ .. _Hypothesis: https://hypothesis.works/
101
+
102
+ Security contact information
103
+ ----------------------------
104
+
105
+ To report a security vulnerability, please use the `Tidelift security contact`_.
106
+ Tidelift will coordinate the fix and disclosure.
107
+
108
+ .. _Tidelift security contact: https://tidelift.com/security
.venv/lib/python3.14/site-packages/anyio-4.15.1.dist-info/RECORD ADDED
@@ -0,0 +1,100 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ anyio-4.15.1.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
2
+ anyio-4.15.1.dist-info/METADATA,sha256=BDrstXGvcYnopsUo9djjJUXxss36r3YdUebVtn6jyoE,4733
3
+ anyio-4.15.1.dist-info/RECORD,,
4
+ anyio-4.15.1.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
5
+ anyio-4.15.1.dist-info/entry_points.txt,sha256=_d6Yu6uiaZmNe0CydowirE9Cmg7zUL2g08tQpoS3Qvc,39
6
+ anyio-4.15.1.dist-info/licenses/LICENSE,sha256=U2GsncWPLvX9LpsJxoKXwX8ElQkJu8gCO9uC6s8iwrA,1081
7
+ anyio-4.15.1.dist-info/top_level.txt,sha256=QglSMiWX8_5dpoVAEIHdEYzvqFMdSYWmCj6tYw2ITkQ,6
8
+ anyio/__init__.py,sha256=OfroYRjIUw_JFj0Zwh1JAaajMQg4VqtoAt0XoOHDRwE,7602
9
+ anyio/__pycache__/__init__.cpython-314.pyc,,
10
+ anyio/__pycache__/_lazyimport.cpython-314.pyc,,
11
+ anyio/__pycache__/from_thread.cpython-314.pyc,,
12
+ anyio/__pycache__/functools.cpython-314.pyc,,
13
+ anyio/__pycache__/itertools.cpython-314.pyc,,
14
+ anyio/__pycache__/lowlevel.cpython-314.pyc,,
15
+ anyio/__pycache__/pytest_plugin.cpython-314.pyc,,
16
+ anyio/__pycache__/to_interpreter.cpython-314.pyc,,
17
+ anyio/__pycache__/to_process.cpython-314.pyc,,
18
+ anyio/__pycache__/to_thread.cpython-314.pyc,,
19
+ anyio/_backends/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
20
+ anyio/_backends/__pycache__/__init__.cpython-314.pyc,,
21
+ anyio/_backends/__pycache__/_asyncio.cpython-314.pyc,,
22
+ anyio/_backends/__pycache__/_trio.cpython-314.pyc,,
23
+ anyio/_backends/_asyncio.py,sha256=Vqy7O1ymmEpxTiPzehSuBCVTziGALNV-BbsIRaKXsg4,107767
24
+ anyio/_backends/_trio.py,sha256=Gs8XzX0IeBvje8IEZtJmpNylKCUAChKv7I_YZi3wlmg,45715
25
+ anyio/_core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
26
+ anyio/_core/__pycache__/__init__.cpython-314.pyc,,
27
+ anyio/_core/__pycache__/_asyncio_selector_thread.cpython-314.pyc,,
28
+ anyio/_core/__pycache__/_concurrency_utils.cpython-314.pyc,,
29
+ anyio/_core/__pycache__/_contextmanagers.cpython-314.pyc,,
30
+ anyio/_core/__pycache__/_eventloop.cpython-314.pyc,,
31
+ anyio/_core/__pycache__/_exceptions.cpython-314.pyc,,
32
+ anyio/_core/__pycache__/_fileio.cpython-314.pyc,,
33
+ anyio/_core/__pycache__/_futures.cpython-314.pyc,,
34
+ anyio/_core/__pycache__/_resources.cpython-314.pyc,,
35
+ anyio/_core/__pycache__/_signals.cpython-314.pyc,,
36
+ anyio/_core/__pycache__/_sockets.cpython-314.pyc,,
37
+ anyio/_core/__pycache__/_streams.cpython-314.pyc,,
38
+ anyio/_core/__pycache__/_subprocesses.cpython-314.pyc,,
39
+ anyio/_core/__pycache__/_synchronization.cpython-314.pyc,,
40
+ anyio/_core/__pycache__/_tasks.cpython-314.pyc,,
41
+ anyio/_core/__pycache__/_tempfile.cpython-314.pyc,,
42
+ anyio/_core/__pycache__/_testing.cpython-314.pyc,,
43
+ anyio/_core/__pycache__/_typedattr.cpython-314.pyc,,
44
+ anyio/_core/_asyncio_selector_thread.py,sha256=2PdxFM3cs02Kp6BSppbvmRT7q7asreTW5FgBxEsflBo,5626
45
+ anyio/_core/_concurrency_utils.py,sha256=kvRXMrnDqgQTBkZc-f279-lBnZM4YbSToXqhnAUCfSc,4522
46
+ anyio/_core/_contextmanagers.py,sha256=YInBCabiEeS-UaP_Jdxa1CaFC71ETPW8HZTHIM8Rsc8,7215
47
+ anyio/_core/_eventloop.py,sha256=ByZUeJD9alMfcyTseRo5IzTO0IltEul_Gyq9iqSjqDk,6658
48
+ anyio/_core/_exceptions.py,sha256=B4ZhLkBQT4tI6vShv4-GJui492IJsoIDTw1FQJEkmAI,5618
49
+ anyio/_core/_fileio.py,sha256=q--ft9h5Y_FRLzhAnoYrXf3tOuZ8ZyIN2A9mCfMbZRc,34163
50
+ anyio/_core/_futures.py,sha256=YQq5uhnCnKQMQD62tOLfzEm7dUXY3GQorJdH6ghfgIQ,6177
51
+ anyio/_core/_resources.py,sha256=Ld5duCe9NwgPfI7EIOh3CMIBYQ7rq6ZQEa7CFS0u9Ec,450
52
+ anyio/_core/_signals.py,sha256=mjTBB2hTKNPRlU0IhnijeQedpWOGERDiMjSlJQsFrug,1016
53
+ anyio/_core/_sockets.py,sha256=C8b-3w5H9n0Fo4g7X8WJvk0m6CGh6NVAAFtieBGHK3g,35289
54
+ anyio/_core/_streams.py,sha256=FczFwIgDpnkK0bODWJXMpsUJYdvAD04kaUaGzJU8DK0,1806
55
+ anyio/_core/_subprocesses.py,sha256=TMBuGNILz-47w5t9vayJ1GpCpDT6LxsMohJDFCewIRc,7938
56
+ anyio/_core/_synchronization.py,sha256=ggsd74QPd846faA2HQeT07ONQ5HQ1S78gy8mvB3qCrw,21658
57
+ anyio/_core/_tasks.py,sha256=J2dhM_Jq3Grsfg_enNWpRz2SxfM15uLt-pEfvoQq3uA,15391
58
+ anyio/_core/_tempfile.py,sha256=IgoBCFaPhrFvsF9KHcCcrnCRn-UqMfw0WRdSDWgxAiI,19726
59
+ anyio/_core/_testing.py,sha256=ZRucLh5kqhiFWAJMMbd8yZ6uIvz0rq3WwL72ldosxAU,2340
60
+ anyio/_core/_typedattr.py,sha256=gt9Dzn-IL0QW14aHPDD8PAtq95FYKNNupHyf37xZGPQ,2607
61
+ anyio/_lazyimport.py,sha256=LCjnYanIfYE9G-Dv_EsqNLDuVRppNicWZjCTfS9-sJU,6082
62
+ anyio/abc/__init__.py,sha256=XIVvCI2c6oyaOcqXe94k2rzU5_s7-ZNnlxGTk34H4T0,3050
63
+ anyio/abc/__pycache__/__init__.cpython-314.pyc,,
64
+ anyio/abc/__pycache__/_eventloop.cpython-314.pyc,,
65
+ anyio/abc/__pycache__/_resources.cpython-314.pyc,,
66
+ anyio/abc/__pycache__/_sockets.cpython-314.pyc,,
67
+ anyio/abc/__pycache__/_streams.cpython-314.pyc,,
68
+ anyio/abc/__pycache__/_subprocesses.cpython-314.pyc,,
69
+ anyio/abc/__pycache__/_tasks.cpython-314.pyc,,
70
+ anyio/abc/__pycache__/_testing.cpython-314.pyc,,
71
+ anyio/abc/_eventloop.py,sha256=0-UwgB351rkocCt8m3fjTmcNx2Fxn52nUoujG5DzMvU,11127
72
+ anyio/abc/_resources.py,sha256=hrb0LXUgHSp3i8G6W8JJchdzKXgg1m0T-L7udXmv2y0,900
73
+ anyio/abc/_sockets.py,sha256=jQWnPX7iDIDyvyvVkbuFhjezw4oI2WggzbW6Vl2-eqs,13162
74
+ anyio/abc/_streams.py,sha256=IMeOPPutFXRbyeAutxV1HJe7FUQZYp2qKrJJpP1DCv0,7620
75
+ anyio/abc/_subprocesses.py,sha256=CDqU1p0HuBS0pXUzBW_hbfhihTJRM67n__7qZmoPU84,2123
76
+ anyio/abc/_tasks.py,sha256=HBPpT72aOy0bwMAxBCKmnXsR328wCYRjYm3iaVw2fQo,7070
77
+ anyio/abc/_testing.py,sha256=A9Y8RAClIPn1A0aNHBN8YoaRy_MKOpbFGEbTHAXgB6U,2145
78
+ anyio/from_thread.py,sha256=iZZbfcNySi4wAcx1_cxAQE4J0YZC88qRMIYqQ6SF9sc,19415
79
+ anyio/functools.py,sha256=T4JS8IXq-x1S0Lbo2owF8l9fza2KypO147QLeyz4cjs,11797
80
+ anyio/itertools.py,sha256=TS7_UCa2Y3cggtaLlWHbjOyf6QhPfQUdPduNW-ddXTE,16255
81
+ anyio/lowlevel.py,sha256=QyWkvfetbCH0mHkqv1yxGwOaiZ7fyxhpZkHWOXPV5JU,6280
82
+ anyio/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
83
+ anyio/pytest_plugin.py,sha256=oLXyOstvRZW3VVbqIODhZsPt4jSz2UGh44YeG2nJXx0,14516
84
+ anyio/streams/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
85
+ anyio/streams/__pycache__/__init__.cpython-314.pyc,,
86
+ anyio/streams/__pycache__/buffered.cpython-314.pyc,,
87
+ anyio/streams/__pycache__/file.cpython-314.pyc,,
88
+ anyio/streams/__pycache__/memory.cpython-314.pyc,,
89
+ anyio/streams/__pycache__/stapled.cpython-314.pyc,,
90
+ anyio/streams/__pycache__/text.cpython-314.pyc,,
91
+ anyio/streams/__pycache__/tls.cpython-314.pyc,,
92
+ anyio/streams/buffered.py,sha256=u7hCD8SNrYHcutG6K5wEiy1F88-pizgjvEFM22Kq2Cw,6746
93
+ anyio/streams/file.py,sha256=6jujI2m-QJITqqKFamrupX_DNsU7y2Fz3omLZxOLuY0,4524
94
+ anyio/streams/memory.py,sha256=rpxNzDMag9PCOynBqN64KyuAfAPB41vFyRP-Npo-lE0,10793
95
+ anyio/streams/stapled.py,sha256=UJ2Rgt0NUmM1VovRNOoZoic960lcbDjb3vhfZg3b_Z0,4845
96
+ anyio/streams/text.py,sha256=BcVAGJw1VRvtIqnv-o0Rb0pwH7p8vwlvl21xHq522ag,5765
97
+ anyio/streams/tls.py,sha256=fqLmxvULFO9rvxGyJ33VPrOIN7E3eiU1q90BkmKigQ8,15818
98
+ anyio/to_interpreter.py,sha256=ATnoT6kei9wDmQZtXTA3SsY4CK7XKr8Ta4_x5i6pbTw,7100
99
+ anyio/to_process.py,sha256=p6n8j0nreJUl1DEkR_9PL6KRoKtNqFxORTn8qZBvn94,9850
100
+ anyio/to_thread.py,sha256=8MPVrrQq8ttGvV21cSd68rMto5bhxJ0-i9CupXag5Gs,2750
.venv/lib/python3.14/site-packages/anyio-4.15.1.dist-info/WHEEL ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (84.0.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
.venv/lib/python3.14/site-packages/anyio-4.15.1.dist-info/entry_points.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ [pytest11]
2
+ anyio = anyio.pytest_plugin
.venv/lib/python3.14/site-packages/anyio-4.15.1.dist-info/licenses/LICENSE ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2018 Alex Grönholm
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
6
+ this software and associated documentation files (the "Software"), to deal in
7
+ the Software without restriction, including without limitation the rights to
8
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9
+ the Software, and to permit persons to whom the Software is furnished to do so,
10
+ subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
.venv/lib/python3.14/site-packages/anyio-4.15.1.dist-info/top_level.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ anyio
.venv/lib/python3.14/site-packages/anyio/__init__.py ADDED
@@ -0,0 +1,154 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from __future__ import annotations
2
+
3
+ from typing import TYPE_CHECKING
4
+
5
+ from ._lazyimport import (
6
+ fix_package_names,
7
+ install_lazy_importer,
8
+ set_deprecated_aliases,
9
+ )
10
+
11
+ if TYPE_CHECKING or not install_lazy_importer():
12
+ from ._core._concurrency_utils import amap as amap
13
+ from ._core._concurrency_utils import as_completed as as_completed
14
+ from ._core._concurrency_utils import gather as gather
15
+ from ._core._contextmanagers import (
16
+ AsyncContextManagerMixin as AsyncContextManagerMixin,
17
+ )
18
+ from ._core._contextmanagers import ContextManagerMixin as ContextManagerMixin
19
+ from ._core._eventloop import current_time as current_time
20
+ from ._core._eventloop import get_all_backends as get_all_backends
21
+ from ._core._eventloop import get_available_backends as get_available_backends
22
+ from ._core._eventloop import get_cancelled_exc_class as get_cancelled_exc_class
23
+ from ._core._eventloop import run as run
24
+ from ._core._eventloop import sleep as sleep
25
+ from ._core._eventloop import sleep_forever as sleep_forever
26
+ from ._core._eventloop import sleep_until as sleep_until
27
+ from ._core._exceptions import BrokenResourceError as BrokenResourceError
28
+ from ._core._exceptions import BrokenWorkerInterpreter as BrokenWorkerInterpreter
29
+ from ._core._exceptions import BrokenWorkerProcess as BrokenWorkerProcess
30
+ from ._core._exceptions import BusyResourceError as BusyResourceError
31
+ from ._core._exceptions import ClosedResourceError as ClosedResourceError
32
+ from ._core._exceptions import ConnectionFailed as ConnectionFailed
33
+ from ._core._exceptions import DelimiterNotFound as DelimiterNotFound
34
+ from ._core._exceptions import EndOfStream as EndOfStream
35
+ from ._core._exceptions import FutureAlreadyFinished as FutureAlreadyFinished
36
+ from ._core._exceptions import FutureCancelled as FutureCancelled
37
+ from ._core._exceptions import FutureFailed as FutureFailed
38
+ from ._core._exceptions import FutureNotFinished as FutureNotFinished
39
+ from ._core._exceptions import IncompleteRead as IncompleteRead
40
+ from ._core._exceptions import NoEventLoopError as NoEventLoopError
41
+ from ._core._exceptions import RunFinishedError as RunFinishedError
42
+ from ._core._exceptions import TaskCancelled as TaskCancelled
43
+ from ._core._exceptions import TaskFailed as TaskFailed
44
+ from ._core._exceptions import TaskNotFinished as TaskNotFinished
45
+ from ._core._exceptions import (
46
+ TypedAttributeLookupError as TypedAttributeLookupError,
47
+ )
48
+ from ._core._exceptions import WouldBlock as WouldBlock
49
+ from ._core._fileio import AsyncFile as AsyncFile
50
+ from ._core._fileio import Path as Path
51
+ from ._core._fileio import open_file as open_file
52
+ from ._core._fileio import wrap_file as wrap_file
53
+ from ._core._futures import Future as Future
54
+ from ._core._resources import aclose_forcefully as aclose_forcefully
55
+ from ._core._signals import open_signal_receiver as open_signal_receiver
56
+ from ._core._sockets import TCPConnectable as TCPConnectable
57
+ from ._core._sockets import UNIXConnectable as UNIXConnectable
58
+ from ._core._sockets import as_connectable as as_connectable
59
+ from ._core._sockets import connect_tcp as connect_tcp
60
+ from ._core._sockets import connect_unix as connect_unix
61
+ from ._core._sockets import (
62
+ create_connected_udp_socket as create_connected_udp_socket,
63
+ )
64
+ from ._core._sockets import (
65
+ create_connected_unix_datagram_socket as create_connected_unix_datagram_socket,
66
+ )
67
+ from ._core._sockets import create_tcp_listener as create_tcp_listener
68
+ from ._core._sockets import create_udp_socket as create_udp_socket
69
+ from ._core._sockets import (
70
+ create_unix_datagram_socket as create_unix_datagram_socket,
71
+ )
72
+ from ._core._sockets import create_unix_listener as create_unix_listener
73
+ from ._core._sockets import getaddrinfo as getaddrinfo
74
+ from ._core._sockets import getnameinfo as getnameinfo
75
+ from ._core._sockets import notify_closing as notify_closing
76
+ from ._core._sockets import wait_readable as wait_readable
77
+ from ._core._sockets import wait_socket_readable as wait_socket_readable
78
+ from ._core._sockets import wait_socket_writable as wait_socket_writable
79
+ from ._core._sockets import wait_writable as wait_writable
80
+ from ._core._streams import (
81
+ create_memory_object_stream as create_memory_object_stream,
82
+ )
83
+ from ._core._subprocesses import open_process as open_process
84
+ from ._core._subprocesses import run_process as run_process
85
+ from ._core._synchronization import CapacityLimiter as CapacityLimiter
86
+ from ._core._synchronization import (
87
+ CapacityLimiterStatistics as CapacityLimiterStatistics,
88
+ )
89
+ from ._core._synchronization import Condition as Condition
90
+ from ._core._synchronization import ConditionStatistics as ConditionStatistics
91
+ from ._core._synchronization import Event as Event
92
+ from ._core._synchronization import EventStatistics as EventStatistics
93
+ from ._core._synchronization import Lock as Lock
94
+ from ._core._synchronization import LockStatistics as LockStatistics
95
+ from ._core._synchronization import ResourceGuard as ResourceGuard
96
+ from ._core._synchronization import Semaphore as Semaphore
97
+ from ._core._synchronization import SemaphoreStatistics as SemaphoreStatistics
98
+ from ._core._tasks import TASK_STATUS_IGNORED as TASK_STATUS_IGNORED
99
+ from ._core._tasks import CancelScope as CancelScope
100
+ from ._core._tasks import TaskHandle as TaskHandle
101
+ from ._core._tasks import create_task_group as create_task_group
102
+ from ._core._tasks import current_effective_deadline as current_effective_deadline
103
+ from ._core._tasks import fail_after as fail_after
104
+ from ._core._tasks import fail_at as fail_at
105
+ from ._core._tasks import move_on_after as move_on_after
106
+ from ._core._tasks import move_on_at as move_on_at
107
+ from ._core._tempfile import NamedTemporaryFile as NamedTemporaryFile
108
+ from ._core._tempfile import SpooledTemporaryFile as SpooledTemporaryFile
109
+ from ._core._tempfile import TemporaryDirectory as TemporaryDirectory
110
+ from ._core._tempfile import TemporaryFile as TemporaryFile
111
+ from ._core._tempfile import gettempdir as gettempdir
112
+ from ._core._tempfile import gettempdirb as gettempdirb
113
+ from ._core._tempfile import mkdtemp as mkdtemp
114
+ from ._core._tempfile import mkstemp as mkstemp
115
+ from ._core._testing import TaskInfo as TaskInfo
116
+ from ._core._testing import get_current_task as get_current_task
117
+ from ._core._testing import get_running_tasks as get_running_tasks
118
+ from ._core._testing import wait_all_tasks_blocked as wait_all_tasks_blocked
119
+ from ._core._typedattr import TypedAttributeProvider as TypedAttributeProvider
120
+ from ._core._typedattr import TypedAttributeSet as TypedAttributeSet
121
+ from ._core._typedattr import typed_attribute as typed_attribute
122
+
123
+ # ruff: isort: off
124
+ from . import (
125
+ abc as abc,
126
+ )
127
+ from . import (
128
+ from_thread as from_thread,
129
+ )
130
+ from . import (
131
+ functools as functools,
132
+ )
133
+ from . import (
134
+ itertools as itertools,
135
+ )
136
+ from . import (
137
+ lowlevel as lowlevel,
138
+ )
139
+ from . import (
140
+ to_interpreter as to_interpreter,
141
+ )
142
+ from . import (
143
+ to_process as to_process,
144
+ )
145
+ from . import (
146
+ to_thread as to_thread,
147
+ )
148
+
149
+ fix_package_names()
150
+ set_deprecated_aliases(
151
+ {
152
+ "BrokenWorkerIntepreter": "anyio.BrokenWorkerInterpreter",
153
+ }
154
+ )
.venv/lib/python3.14/site-packages/anyio/__pycache__/__init__.cpython-314.pyc ADDED
Binary file (4.96 kB). View file
 
.venv/lib/python3.14/site-packages/anyio/__pycache__/_lazyimport.cpython-314.pyc ADDED
Binary file (10.4 kB). View file
 
.venv/lib/python3.14/site-packages/anyio/__pycache__/from_thread.cpython-314.pyc ADDED
Binary file (30.5 kB). View file
 
.venv/lib/python3.14/site-packages/anyio/__pycache__/functools.cpython-314.pyc ADDED
Binary file (20.2 kB). View file
 
.venv/lib/python3.14/site-packages/anyio/__pycache__/itertools.cpython-314.pyc ADDED
Binary file (29.6 kB). View file
 
.venv/lib/python3.14/site-packages/anyio/__pycache__/lowlevel.cpython-314.pyc ADDED
Binary file (11.1 kB). View file
 
.venv/lib/python3.14/site-packages/anyio/__pycache__/pytest_plugin.cpython-314.pyc ADDED
Binary file (21.9 kB). View file
 
.venv/lib/python3.14/site-packages/anyio/__pycache__/to_interpreter.cpython-314.pyc ADDED
Binary file (12.2 kB). View file
 
.venv/lib/python3.14/site-packages/anyio/__pycache__/to_process.cpython-314.pyc ADDED
Binary file (13.1 kB). View file
 
.venv/lib/python3.14/site-packages/anyio/__pycache__/to_thread.cpython-314.pyc ADDED
Binary file (3.49 kB). View file
 
.venv/lib/python3.14/site-packages/anyio/_backends/__init__.py ADDED
File without changes
.venv/lib/python3.14/site-packages/anyio/_backends/__pycache__/__init__.cpython-314.pyc ADDED
Binary file (232 Bytes). View file
 
.venv/lib/python3.14/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:3e188e14da7a55a3731f1c9ed351e35fd48616734cb483582843f14b2b19159f
3
+ size 182577
.venv/lib/python3.14/site-packages/anyio/_backends/__pycache__/_trio.cpython-314.pyc ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6789b427c9f38804c593ea6a8947aedc00166998aa7904b8dfca3d629485e06d
3
+ size 101861
.venv/lib/python3.14/site-packages/anyio/_backends/_asyncio.py ADDED
The diff for this file is too large to render. See raw diff
 
.venv/lib/python3.14/site-packages/anyio/_backends/_trio.py ADDED
@@ -0,0 +1,1473 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 contextvars import Context
22
+ from dataclasses import dataclass
23
+ from functools import partial, wraps
24
+ from io import IOBase
25
+ from os import PathLike
26
+ from signal import Signals
27
+ from socket import AddressFamily, SocketKind
28
+ from types import TracebackType
29
+ from typing import (
30
+ IO,
31
+ TYPE_CHECKING,
32
+ Any,
33
+ Generic,
34
+ Literal,
35
+ NoReturn,
36
+ ParamSpec,
37
+ TypeVar,
38
+ cast,
39
+ overload,
40
+ )
41
+
42
+ import trio.from_thread
43
+ import trio.lowlevel
44
+ from outcome import Error, Outcome, Value
45
+ from trio.lowlevel import (
46
+ current_root_task,
47
+ current_task,
48
+ notify_closing,
49
+ wait_readable,
50
+ wait_writable,
51
+ )
52
+ from trio.socket import SocketType as TrioSocketType
53
+ from trio.to_thread import run_sync
54
+
55
+ from .. import (
56
+ CapacityLimiterStatistics,
57
+ EventStatistics,
58
+ LockStatistics,
59
+ RunFinishedError,
60
+ TaskInfo,
61
+ WouldBlock,
62
+ abc,
63
+ )
64
+ from .._core._eventloop import claim_worker_thread
65
+ from .._core._exceptions import (
66
+ BrokenResourceError,
67
+ BusyResourceError,
68
+ ClosedResourceError,
69
+ EndOfStream,
70
+ )
71
+ from .._core._sockets import convert_ipv6_sockaddr
72
+ from .._core._streams import create_memory_object_stream
73
+ from .._core._synchronization import (
74
+ CapacityLimiter as BaseCapacityLimiter,
75
+ )
76
+ from .._core._synchronization import Event as BaseEvent
77
+ from .._core._synchronization import Lock as BaseLock
78
+ from .._core._synchronization import (
79
+ ResourceGuard,
80
+ SemaphoreStatistics,
81
+ )
82
+ from .._core._synchronization import Semaphore as BaseSemaphore
83
+ from .._core._tasks import CancelScope as BaseCancelScope
84
+ from .._core._tasks import TaskHandle
85
+ from ..abc import IPSockAddrType, UDPPacketType, UNIXDatagramPacketType
86
+ from ..abc._eventloop import AsyncBackend, StrOrBytesPath
87
+ from ..abc._tasks import T_contra, call_for_coroutine, get_callable_name, get_coro_name
88
+
89
+ if TYPE_CHECKING:
90
+ from _typeshed import FileDescriptorLike
91
+
92
+ from ..streams.memory import MemoryObjectSendStream
93
+
94
+ if sys.version_info < (3, 15):
95
+ from typing_extensions import sentinel
96
+
97
+ if sys.version_info >= (3, 11):
98
+ from typing import Self, TypeVarTuple, Unpack
99
+ else:
100
+ from exceptiongroup import BaseExceptionGroup
101
+ from typing_extensions import Self, TypeVarTuple, Unpack
102
+
103
+ T = TypeVar("T")
104
+ T_Retval = TypeVar("T_Retval")
105
+ T_co = TypeVar("T_co", covariant=True)
106
+ T_SockAddr = TypeVar("T_SockAddr", str, IPSockAddrType)
107
+ PosArgsT = TypeVarTuple("PosArgsT")
108
+ P = ParamSpec("P")
109
+
110
+
111
+ def ensure_returns_coro(
112
+ func: Callable[P, Awaitable[T_Retval]],
113
+ ) -> Callable[P, Coroutine[Any, Any, T_Retval]]:
114
+ @wraps(func)
115
+ def wrapper(*args: P.args, **kwargs: P.kwargs) -> Coroutine[Any, Any, T_Retval]:
116
+ awaitable = func(*args, **kwargs)
117
+ # Check the common case first.
118
+ if isinstance(awaitable, Coroutine):
119
+ return awaitable
120
+ elif not isinstance(awaitable, Awaitable):
121
+ # The user violated the type annotations. Still, we should pass this on to
122
+ # Trio so it can raise with an appropriate message.
123
+ return awaitable
124
+ else:
125
+
126
+ @wraps(func)
127
+ async def inner_wrapper() -> T_Retval:
128
+ return await awaitable
129
+
130
+ return inner_wrapper()
131
+
132
+ return wrapper
133
+
134
+
135
+ #
136
+ # Event loop
137
+ #
138
+
139
+ RunVar = trio.lowlevel.RunVar
140
+
141
+
142
+ #
143
+ # Timeouts and cancellation
144
+ #
145
+
146
+
147
+ class CancelScope(BaseCancelScope):
148
+ __slots__ = ("__original",)
149
+
150
+ def __new__(
151
+ cls, original: trio.CancelScope | None = None, **kwargs: object
152
+ ) -> Self:
153
+ return object.__new__(cls)
154
+
155
+ def __init__(self, original: trio.CancelScope | None = None, **kwargs: Any) -> None:
156
+ self.__original = original or trio.CancelScope(**kwargs)
157
+
158
+ def __enter__(self) -> Self:
159
+ self.__original.__enter__()
160
+ return self
161
+
162
+ def __exit__(
163
+ self,
164
+ exc_type: type[BaseException] | None,
165
+ exc_val: BaseException | None,
166
+ exc_tb: TracebackType | None,
167
+ ) -> bool:
168
+ return self.__original.__exit__(exc_type, exc_val, exc_tb)
169
+
170
+ def cancel(self, reason: str | None = None) -> None:
171
+ self.__original.cancel(reason)
172
+
173
+ @property
174
+ def deadline(self) -> float:
175
+ return self.__original.deadline
176
+
177
+ @deadline.setter
178
+ def deadline(self, value: float) -> None:
179
+ self.__original.deadline = value
180
+
181
+ @property
182
+ def cancel_called(self) -> bool:
183
+ return self.__original.cancel_called
184
+
185
+ @property
186
+ def cancelled_caught(self) -> bool:
187
+ return self.__original.cancelled_caught
188
+
189
+ @property
190
+ def shield(self) -> bool:
191
+ return self.__original.shield
192
+
193
+ @shield.setter
194
+ def shield(self, value: bool) -> None:
195
+ self.__original.shield = value
196
+
197
+
198
+ #
199
+ # Task groups
200
+ #
201
+
202
+ empty_start_value = sentinel("empty_start_value")
203
+
204
+
205
+ class _TrioTaskStatus(abc.TaskStatus[T_contra], Generic[T_contra]):
206
+ early_start_value: T_contra | object = empty_start_value
207
+ real_task_status: trio.TaskStatus[T_contra | None] | None = None
208
+
209
+ def started(self, value: T_contra | None = None) -> None:
210
+ if self.real_task_status is None:
211
+ if self.early_start_value is not empty_start_value:
212
+ raise RuntimeError("called 'started' twice on the same task status")
213
+
214
+ self.early_start_value = value
215
+ else:
216
+ self.real_task_status.started(value)
217
+
218
+
219
+ class TaskGroup(abc.TaskGroup):
220
+ def __init__(self) -> None:
221
+ self._entered = False
222
+ self._active = False
223
+ self._nursery_manager = trio.open_nursery(strict_exception_groups=True)
224
+ self.cancel_scope = None # type: ignore[assignment]
225
+
226
+ async def __aenter__(self) -> Self:
227
+ if self._entered:
228
+ raise RuntimeError("TaskGroup cannot be entered more than once")
229
+
230
+ self._entered = True
231
+ self._active = True
232
+ self._nursery = await self._nursery_manager.__aenter__()
233
+ self.cancel_scope = CancelScope(self._nursery.cancel_scope)
234
+ return self
235
+
236
+ async def __aexit__(
237
+ self,
238
+ exc_type: type[BaseException] | None,
239
+ exc_val: BaseException | None,
240
+ exc_tb: TracebackType | None,
241
+ ) -> bool:
242
+ try:
243
+ # trio.Nursery.__exit__ returns bool; .open_nursery has wrong type
244
+ return await self._nursery_manager.__aexit__(exc_type, exc_val, exc_tb) # type: ignore[return-value]
245
+ except BaseExceptionGroup as exc:
246
+ if not exc.split(trio.Cancelled)[1]:
247
+ raise trio.Cancelled._create() from exc
248
+
249
+ raise
250
+ finally:
251
+ del exc_val, exc_tb
252
+ self._active = False
253
+
254
+ def _check_active(self, coro: Coroutine | None = None) -> None:
255
+ if not self._active:
256
+ if coro is not None:
257
+ coro.close()
258
+
259
+ raise RuntimeError(
260
+ "This task group is not active; no new tasks can be started."
261
+ )
262
+
263
+ def create_task(
264
+ self,
265
+ coro: Coroutine[Any, Any, T_co],
266
+ *,
267
+ name: object = None,
268
+ context: Context | None = None,
269
+ ) -> TaskHandle[T_co]:
270
+ if not isinstance(coro, Coroutine):
271
+ raise TypeError(f"expected a coroutine, got {coro.__class__.__qualname__}")
272
+
273
+ self._check_active(coro)
274
+ final_name = get_coro_name(coro, name)
275
+ handle = TaskHandle(coro, final_name)
276
+ if context is not None:
277
+ context.run(
278
+ partial(self._nursery.start_soon, handle._run_coro, name=handle.name)
279
+ )
280
+ else:
281
+ self._nursery.start_soon(handle._run_coro, name=handle.name)
282
+
283
+ return handle
284
+
285
+ async def start(
286
+ self,
287
+ func: Callable[[Unpack[PosArgsT]], Coroutine[Any, Any, T_co]],
288
+ *args: Unpack[PosArgsT],
289
+ name: object = None,
290
+ return_handle: Literal[False, True] = False,
291
+ ) -> Any:
292
+ handle: TaskHandle[T_co]
293
+
294
+ async def run_coro_with_task_status(
295
+ *, task_status: trio.TaskStatus[Any]
296
+ ) -> None:
297
+ nonlocal handle
298
+ wrapper_task_status = _TrioTaskStatus()
299
+ coro = call_for_coroutine(func, args, task_status=wrapper_task_status)
300
+ if wrapper_task_status.early_start_value is not empty_start_value:
301
+ task_status.started(wrapper_task_status.early_start_value)
302
+ else:
303
+ wrapper_task_status.real_task_status = task_status
304
+
305
+ handle = TaskHandle(coro, final_name)
306
+ await handle._run_coro()
307
+
308
+ self._check_active()
309
+ final_name = get_callable_name(func, name)
310
+ start_value = await self._nursery.start(
311
+ run_coro_with_task_status, name=final_name
312
+ )
313
+ if return_handle:
314
+ handle._start_value = start_value
315
+ return handle
316
+ else:
317
+ return start_value
318
+
319
+
320
+ #
321
+ # Subprocesses
322
+ #
323
+
324
+
325
+ @dataclass(eq=False)
326
+ class ReceiveStreamWrapper(abc.ByteReceiveStream):
327
+ _stream: trio.abc.ReceiveStream
328
+
329
+ async def receive(self, max_bytes: int | None = None) -> bytes:
330
+ if max_bytes is not None and max_bytes < 1:
331
+ raise ValueError("max_bytes must be a positive integer")
332
+
333
+ try:
334
+ data = await self._stream.receive_some(max_bytes)
335
+ except trio.ClosedResourceError as exc:
336
+ raise ClosedResourceError from exc.__cause__
337
+ except trio.BrokenResourceError as exc:
338
+ raise BrokenResourceError from exc.__cause__
339
+
340
+ if data:
341
+ return bytes(data)
342
+ else:
343
+ raise EndOfStream
344
+
345
+ async def aclose(self) -> None:
346
+ await self._stream.aclose()
347
+
348
+
349
+ @dataclass(eq=False)
350
+ class SendStreamWrapper(abc.ByteSendStream):
351
+ _stream: trio.abc.SendStream
352
+
353
+ async def send(self, item: bytes) -> None:
354
+ try:
355
+ await self._stream.send_all(item)
356
+ except trio.ClosedResourceError as exc:
357
+ raise ClosedResourceError from exc.__cause__
358
+ except trio.BrokenResourceError as exc:
359
+ raise BrokenResourceError from exc.__cause__
360
+
361
+ async def aclose(self) -> None:
362
+ await self._stream.aclose()
363
+
364
+
365
+ @dataclass(eq=False)
366
+ class Process(abc.Process):
367
+ _process: trio.Process
368
+ _stdin: abc.ByteSendStream | None
369
+ _stdout: abc.ByteReceiveStream | None
370
+ _stderr: abc.ByteReceiveStream | None
371
+
372
+ async def aclose(self) -> None:
373
+ with CancelScope(shield=True):
374
+ if self._stdin:
375
+ await self._stdin.aclose()
376
+ if self._stdout:
377
+ await self._stdout.aclose()
378
+ if self._stderr:
379
+ await self._stderr.aclose()
380
+
381
+ try:
382
+ await self.wait()
383
+ except BaseException:
384
+ self.kill()
385
+ with CancelScope(shield=True):
386
+ await self.wait()
387
+ raise
388
+
389
+ async def wait(self) -> int:
390
+ return await self._process.wait()
391
+
392
+ def terminate(self) -> None:
393
+ self._process.terminate()
394
+
395
+ def kill(self) -> None:
396
+ self._process.kill()
397
+
398
+ def send_signal(self, signal: Signals) -> None:
399
+ self._process.send_signal(signal)
400
+
401
+ @property
402
+ def pid(self) -> int:
403
+ return self._process.pid
404
+
405
+ @property
406
+ def returncode(self) -> int | None:
407
+ return self._process.returncode
408
+
409
+ @property
410
+ def stdin(self) -> abc.ByteSendStream | None:
411
+ return self._stdin
412
+
413
+ @property
414
+ def stdout(self) -> abc.ByteReceiveStream | None:
415
+ return self._stdout
416
+
417
+ @property
418
+ def stderr(self) -> abc.ByteReceiveStream | None:
419
+ return self._stderr
420
+
421
+
422
+ class _ProcessPoolShutdownInstrument(trio.abc.Instrument):
423
+ def after_run(self) -> None:
424
+ super().after_run()
425
+
426
+
427
+ current_default_worker_process_limiter: trio.lowlevel.RunVar = RunVar(
428
+ "current_default_worker_process_limiter"
429
+ )
430
+
431
+
432
+ async def _shutdown_process_pool(workers: set[abc.Process]) -> None:
433
+ try:
434
+ await trio.sleep(math.inf)
435
+ except trio.Cancelled:
436
+ for process in workers:
437
+ if process.returncode is None:
438
+ process.kill()
439
+
440
+ with CancelScope(shield=True):
441
+ for process in workers:
442
+ await process.aclose()
443
+
444
+
445
+ #
446
+ # Sockets and networking
447
+ #
448
+
449
+
450
+ class _TrioSocketMixin(Generic[T_SockAddr]):
451
+ def __init__(self, trio_socket: TrioSocketType) -> None:
452
+ self._trio_socket = trio_socket
453
+ self._closed = False
454
+
455
+ def _check_closed(self) -> None:
456
+ if self._closed:
457
+ raise ClosedResourceError
458
+ if self._trio_socket.fileno() < 0:
459
+ raise BrokenResourceError
460
+
461
+ @property
462
+ def _raw_socket(self) -> socket.socket:
463
+ return self._trio_socket._sock # type: ignore[attr-defined]
464
+
465
+ async def aclose(self) -> None:
466
+ if self._trio_socket.fileno() >= 0:
467
+ self._closed = True
468
+ self._trio_socket.close()
469
+
470
+ def _convert_socket_error(self, exc: BaseException) -> NoReturn:
471
+ if isinstance(exc, trio.ClosedResourceError):
472
+ raise ClosedResourceError from exc
473
+ elif self._trio_socket.fileno() < 0 and self._closed:
474
+ raise ClosedResourceError from None
475
+ elif isinstance(exc, OSError):
476
+ raise BrokenResourceError from exc
477
+ else:
478
+ raise exc
479
+
480
+
481
+ class SocketStream(_TrioSocketMixin, abc.SocketStream):
482
+ def __init__(self, trio_socket: TrioSocketType) -> None:
483
+ super().__init__(trio_socket)
484
+ self._receive_guard = ResourceGuard("reading from")
485
+ self._send_guard = ResourceGuard("writing to")
486
+
487
+ async def receive(self, max_bytes: int = 65536) -> bytes:
488
+ if max_bytes < 1:
489
+ raise ValueError("max_bytes must be a positive integer")
490
+
491
+ with self._receive_guard:
492
+ try:
493
+ data = await self._trio_socket.recv(max_bytes)
494
+ except BaseException as exc:
495
+ self._convert_socket_error(exc)
496
+
497
+ if data:
498
+ return data
499
+ else:
500
+ raise EndOfStream
501
+
502
+ async def send(self, item: bytes) -> None:
503
+ with self._send_guard:
504
+ view = memoryview(item)
505
+ while view:
506
+ try:
507
+ bytes_sent = await self._trio_socket.send(view)
508
+ except BaseException as exc:
509
+ self._convert_socket_error(exc)
510
+
511
+ view = view[bytes_sent:]
512
+
513
+ async def send_eof(self) -> None:
514
+ self._trio_socket.shutdown(socket.SHUT_WR)
515
+
516
+
517
+ class UNIXSocketStream(SocketStream, abc.UNIXSocketStream):
518
+ async def receive_fds(self, msglen: int, maxfds: int) -> tuple[bytes, list[int]]:
519
+ if not isinstance(msglen, int) or msglen < 0:
520
+ raise ValueError("msglen must be a non-negative integer")
521
+ if not isinstance(maxfds, int) or maxfds < 1:
522
+ raise ValueError("maxfds must be a positive integer")
523
+
524
+ fds = array.array("i")
525
+ await trio.lowlevel.checkpoint()
526
+ with self._receive_guard:
527
+ while True:
528
+ try:
529
+ message, ancdata, _flags, _addr = await self._trio_socket.recvmsg(
530
+ msglen, socket.CMSG_LEN(maxfds * fds.itemsize)
531
+ )
532
+ except BaseException as exc:
533
+ self._convert_socket_error(exc)
534
+ else:
535
+ if not message and not ancdata:
536
+ raise EndOfStream
537
+
538
+ break
539
+
540
+ for cmsg_level, cmsg_type, cmsg_data in ancdata:
541
+ if cmsg_level != socket.SOL_SOCKET or cmsg_type != socket.SCM_RIGHTS:
542
+ raise RuntimeError(
543
+ f"Received unexpected ancillary data; message = {message!r}, "
544
+ f"cmsg_level = {cmsg_level}, cmsg_type = {cmsg_type}"
545
+ )
546
+
547
+ fds.frombytes(cmsg_data[: len(cmsg_data) - (len(cmsg_data) % fds.itemsize)])
548
+
549
+ return message, list(fds)
550
+
551
+ async def send_fds(self, message: bytes, fds: Collection[int | IOBase]) -> None:
552
+ if not message:
553
+ raise ValueError("message must not be empty")
554
+ if not fds:
555
+ raise ValueError("fds must not be empty")
556
+
557
+ filenos: list[int] = []
558
+ for fd in fds:
559
+ if isinstance(fd, int):
560
+ filenos.append(fd)
561
+ elif isinstance(fd, IOBase):
562
+ filenos.append(fd.fileno())
563
+
564
+ fdarray = array.array("i", filenos)
565
+ await trio.lowlevel.checkpoint()
566
+ with self._send_guard:
567
+ while True:
568
+ try:
569
+ await self._trio_socket.sendmsg(
570
+ [message],
571
+ [
572
+ (
573
+ socket.SOL_SOCKET,
574
+ socket.SCM_RIGHTS,
575
+ fdarray,
576
+ )
577
+ ],
578
+ )
579
+ break
580
+ except BaseException as exc:
581
+ self._convert_socket_error(exc)
582
+
583
+
584
+ class TCPSocketListener(_TrioSocketMixin, abc.SocketListener):
585
+ def __init__(self, raw_socket: socket.socket):
586
+ super().__init__(trio.socket.from_stdlib_socket(raw_socket))
587
+ self._accept_guard = ResourceGuard("accepting connections from")
588
+
589
+ async def accept(self) -> SocketStream:
590
+ with self._accept_guard:
591
+ try:
592
+ trio_socket, _addr = await self._trio_socket.accept()
593
+ except BaseException as exc:
594
+ self._convert_socket_error(exc)
595
+
596
+ trio_socket.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
597
+ return SocketStream(trio_socket)
598
+
599
+
600
+ class UNIXSocketListener(_TrioSocketMixin, abc.SocketListener):
601
+ def __init__(self, raw_socket: socket.socket):
602
+ super().__init__(trio.socket.from_stdlib_socket(raw_socket))
603
+ self._accept_guard = ResourceGuard("accepting connections from")
604
+
605
+ async def accept(self) -> UNIXSocketStream:
606
+ with self._accept_guard:
607
+ try:
608
+ trio_socket, _addr = await self._trio_socket.accept()
609
+ except BaseException as exc:
610
+ self._convert_socket_error(exc)
611
+
612
+ return UNIXSocketStream(trio_socket)
613
+
614
+
615
+ class UDPSocket(_TrioSocketMixin[IPSockAddrType], abc.UDPSocket):
616
+ def __init__(self, trio_socket: TrioSocketType) -> None:
617
+ super().__init__(trio_socket)
618
+ self._receive_guard = ResourceGuard("reading from")
619
+ self._send_guard = ResourceGuard("writing to")
620
+
621
+ async def receive(self) -> tuple[bytes, IPSockAddrType]:
622
+ with self._receive_guard:
623
+ try:
624
+ data, addr = await self._trio_socket.recvfrom(65536)
625
+ return data, convert_ipv6_sockaddr(addr)
626
+ except BaseException as exc:
627
+ self._convert_socket_error(exc)
628
+
629
+ async def send(self, item: UDPPacketType) -> None:
630
+ with self._send_guard:
631
+ try:
632
+ await self._trio_socket.sendto(*item)
633
+ except BaseException as exc:
634
+ self._convert_socket_error(exc)
635
+
636
+
637
+ class ConnectedUDPSocket(_TrioSocketMixin[IPSockAddrType], abc.ConnectedUDPSocket):
638
+ def __init__(self, trio_socket: TrioSocketType) -> None:
639
+ super().__init__(trio_socket)
640
+ self._receive_guard = ResourceGuard("reading from")
641
+ self._send_guard = ResourceGuard("writing to")
642
+
643
+ async def receive(self) -> bytes:
644
+ with self._receive_guard:
645
+ try:
646
+ return await self._trio_socket.recv(65536)
647
+ except BaseException as exc:
648
+ self._convert_socket_error(exc)
649
+
650
+ async def send(self, item: bytes) -> None:
651
+ with self._send_guard:
652
+ try:
653
+ await self._trio_socket.send(item)
654
+ except BaseException as exc:
655
+ self._convert_socket_error(exc)
656
+
657
+
658
+ class UNIXDatagramSocket(_TrioSocketMixin[str], abc.UNIXDatagramSocket):
659
+ def __init__(self, trio_socket: TrioSocketType) -> None:
660
+ super().__init__(trio_socket)
661
+ self._receive_guard = ResourceGuard("reading from")
662
+ self._send_guard = ResourceGuard("writing to")
663
+
664
+ async def receive(self) -> UNIXDatagramPacketType:
665
+ with self._receive_guard:
666
+ try:
667
+ data, addr = await self._trio_socket.recvfrom(65536)
668
+ return data, addr
669
+ except BaseException as exc:
670
+ self._convert_socket_error(exc)
671
+
672
+ async def send(self, item: UNIXDatagramPacketType) -> None:
673
+ with self._send_guard:
674
+ try:
675
+ await self._trio_socket.sendto(*item)
676
+ except BaseException as exc:
677
+ self._convert_socket_error(exc)
678
+
679
+
680
+ class ConnectedUNIXDatagramSocket(
681
+ _TrioSocketMixin[str], abc.ConnectedUNIXDatagramSocket
682
+ ):
683
+ def __init__(self, trio_socket: TrioSocketType) -> None:
684
+ super().__init__(trio_socket)
685
+ self._receive_guard = ResourceGuard("reading from")
686
+ self._send_guard = ResourceGuard("writing to")
687
+
688
+ async def receive(self) -> bytes:
689
+ with self._receive_guard:
690
+ try:
691
+ return await self._trio_socket.recv(65536)
692
+ except BaseException as exc:
693
+ self._convert_socket_error(exc)
694
+
695
+ async def send(self, item: bytes) -> None:
696
+ with self._send_guard:
697
+ try:
698
+ await self._trio_socket.send(item)
699
+ except BaseException as exc:
700
+ self._convert_socket_error(exc)
701
+
702
+
703
+ #
704
+ # Synchronization
705
+ #
706
+
707
+
708
+ class Event(BaseEvent):
709
+ __slots__ = ("__original",)
710
+
711
+ def __new__(cls) -> Self:
712
+ return object.__new__(cls)
713
+
714
+ def __init__(self) -> None:
715
+ self.__original = trio.Event()
716
+
717
+ def is_set(self) -> bool:
718
+ return self.__original.is_set()
719
+
720
+ async def wait(self) -> None:
721
+ return await self.__original.wait()
722
+
723
+ def statistics(self) -> EventStatistics:
724
+ orig_statistics = self.__original.statistics()
725
+ return EventStatistics(tasks_waiting=orig_statistics.tasks_waiting)
726
+
727
+ def set(self) -> None:
728
+ self.__original.set()
729
+
730
+
731
+ class Lock(BaseLock):
732
+ __slots__ = "__original", "_fast_acquire"
733
+
734
+ def __new__(cls, *, fast_acquire: bool = False) -> Self:
735
+ return object.__new__(cls)
736
+
737
+ def __init__(self, *, fast_acquire: bool = False) -> None:
738
+ self._fast_acquire = fast_acquire
739
+ self.__original = trio.Lock()
740
+
741
+ @staticmethod
742
+ def _convert_runtime_error_msg(exc: RuntimeError) -> None:
743
+ if exc.args == ("attempt to re-acquire an already held Lock",):
744
+ exc.args = ("Attempted to acquire an already held Lock",)
745
+
746
+ async def acquire(self) -> None:
747
+ if not self._fast_acquire:
748
+ try:
749
+ await self.__original.acquire()
750
+ except RuntimeError as exc:
751
+ self._convert_runtime_error_msg(exc)
752
+ raise
753
+
754
+ return
755
+
756
+ # This is the "fast path" where we don't let other tasks run
757
+ await trio.lowlevel.checkpoint_if_cancelled()
758
+ try:
759
+ self.__original.acquire_nowait()
760
+ except trio.WouldBlock:
761
+ await self.__original._lot.park()
762
+ except RuntimeError as exc:
763
+ self._convert_runtime_error_msg(exc)
764
+ raise
765
+
766
+ def acquire_nowait(self) -> None:
767
+ try:
768
+ self.__original.acquire_nowait()
769
+ except trio.WouldBlock:
770
+ raise WouldBlock from None
771
+ except RuntimeError as exc:
772
+ self._convert_runtime_error_msg(exc)
773
+ raise
774
+
775
+ def locked(self) -> bool:
776
+ return self.__original.locked()
777
+
778
+ def release(self) -> None:
779
+ self.__original.release()
780
+
781
+ def statistics(self) -> LockStatistics:
782
+ orig_statistics = self.__original.statistics()
783
+ owner = TrioTaskInfo(orig_statistics.owner) if orig_statistics.owner else None
784
+ return LockStatistics(
785
+ orig_statistics.locked, owner, orig_statistics.tasks_waiting
786
+ )
787
+
788
+
789
+ class Semaphore(BaseSemaphore):
790
+ __slots__ = ("__original",)
791
+
792
+ def __new__(
793
+ cls,
794
+ initial_value: int,
795
+ *,
796
+ max_value: int | None = None,
797
+ fast_acquire: bool = False,
798
+ ) -> Self:
799
+ return object.__new__(cls)
800
+
801
+ def __init__(
802
+ self,
803
+ initial_value: int,
804
+ *,
805
+ max_value: int | None = None,
806
+ fast_acquire: bool = False,
807
+ ) -> None:
808
+ super().__init__(initial_value, max_value=max_value, fast_acquire=fast_acquire)
809
+ self.__original = trio.Semaphore(initial_value, max_value=max_value)
810
+
811
+ async def acquire(self) -> None:
812
+ if not self._fast_acquire:
813
+ await self.__original.acquire()
814
+ return
815
+
816
+ # This is the "fast path" where we don't let other tasks run
817
+ await trio.lowlevel.checkpoint_if_cancelled()
818
+ try:
819
+ self.__original.acquire_nowait()
820
+ except trio.WouldBlock:
821
+ await self.__original._lot.park()
822
+
823
+ def acquire_nowait(self) -> None:
824
+ try:
825
+ self.__original.acquire_nowait()
826
+ except trio.WouldBlock:
827
+ raise WouldBlock from None
828
+
829
+ @property
830
+ def max_value(self) -> int | None:
831
+ return self.__original.max_value
832
+
833
+ @property
834
+ def value(self) -> int:
835
+ return self.__original.value
836
+
837
+ def release(self) -> None:
838
+ self.__original.release()
839
+
840
+ def statistics(self) -> SemaphoreStatistics:
841
+ orig_statistics = self.__original.statistics()
842
+ return SemaphoreStatistics(orig_statistics.tasks_waiting)
843
+
844
+
845
+ class CapacityLimiter(BaseCapacityLimiter):
846
+ __slots__ = ("__original",)
847
+
848
+ def __new__(
849
+ cls,
850
+ total_tokens: float | None = None,
851
+ *,
852
+ original: trio.CapacityLimiter | None = None,
853
+ ) -> Self:
854
+ return object.__new__(cls)
855
+
856
+ def __init__(
857
+ self,
858
+ total_tokens: float | None = None,
859
+ *,
860
+ original: trio.CapacityLimiter | None = None,
861
+ ) -> None:
862
+ if original is not None:
863
+ self.__original = original
864
+ else:
865
+ assert total_tokens is not None
866
+ self.__original = trio.CapacityLimiter(total_tokens)
867
+
868
+ async def __aenter__(self) -> None:
869
+ return await self.__original.__aenter__()
870
+
871
+ async def __aexit__(
872
+ self,
873
+ exc_type: type[BaseException] | None,
874
+ exc_val: BaseException | None,
875
+ exc_tb: TracebackType | None,
876
+ ) -> None:
877
+ await self.__original.__aexit__(exc_type, exc_val, exc_tb)
878
+
879
+ @property
880
+ def total_tokens(self) -> float:
881
+ return self.__original.total_tokens
882
+
883
+ @total_tokens.setter
884
+ def total_tokens(self, value: float) -> None:
885
+ self.__original.total_tokens = value
886
+
887
+ @property
888
+ def borrowed_tokens(self) -> int:
889
+ return self.__original.borrowed_tokens
890
+
891
+ @property
892
+ def available_tokens(self) -> float:
893
+ return self.__original.available_tokens
894
+
895
+ def acquire_nowait(self) -> None:
896
+ try:
897
+ self.__original.acquire_nowait()
898
+ except trio.WouldBlock:
899
+ raise WouldBlock from None
900
+
901
+ def acquire_on_behalf_of_nowait(self, borrower: object) -> None:
902
+ try:
903
+ self.__original.acquire_on_behalf_of_nowait(borrower)
904
+ except trio.WouldBlock:
905
+ raise WouldBlock from None
906
+
907
+ async def acquire(self) -> None:
908
+ await self.__original.acquire()
909
+
910
+ async def acquire_on_behalf_of(self, borrower: object) -> None:
911
+ await self.__original.acquire_on_behalf_of(borrower)
912
+
913
+ def release(self) -> None:
914
+ return self.__original.release()
915
+
916
+ def release_on_behalf_of(self, borrower: object) -> None:
917
+ return self.__original.release_on_behalf_of(borrower)
918
+
919
+ def statistics(self) -> CapacityLimiterStatistics:
920
+ orig = self.__original.statistics()
921
+ return CapacityLimiterStatistics(
922
+ borrowed_tokens=orig.borrowed_tokens,
923
+ total_tokens=orig.total_tokens,
924
+ borrowers=tuple(orig.borrowers),
925
+ tasks_waiting=orig.tasks_waiting,
926
+ )
927
+
928
+
929
+ _capacity_limiter_wrapper: trio.lowlevel.RunVar = RunVar("_capacity_limiter_wrapper")
930
+
931
+
932
+ #
933
+ # Signal handling
934
+ #
935
+
936
+
937
+ class _SignalReceiver:
938
+ _iterator: AsyncIterator[int]
939
+
940
+ def __init__(self, signals: tuple[Signals, ...]):
941
+ self._signals = signals
942
+
943
+ def __enter__(self) -> Self:
944
+ self._cm = trio.open_signal_receiver(*self._signals)
945
+ self._iterator = self._cm.__enter__()
946
+ return self
947
+
948
+ def __exit__(
949
+ self,
950
+ exc_type: type[BaseException] | None,
951
+ exc_val: BaseException | None,
952
+ exc_tb: TracebackType | None,
953
+ ) -> bool | None:
954
+ return self._cm.__exit__(exc_type, exc_val, exc_tb)
955
+
956
+ def __aiter__(self) -> _SignalReceiver:
957
+ return self
958
+
959
+ async def __anext__(self) -> Signals:
960
+ signum = await self._iterator.__anext__()
961
+ return Signals(signum)
962
+
963
+
964
+ #
965
+ # Testing and debugging
966
+ #
967
+
968
+
969
+ class TestRunner(abc.TestRunner):
970
+ def __init__(self, **options: Any) -> None:
971
+ from queue import Queue
972
+
973
+ self._call_queue: Queue[Callable[[], object]] = Queue()
974
+ self._send_stream: (
975
+ MemoryObjectSendStream[tuple[Awaitable[Any], list[Outcome]]] | None
976
+ ) = None
977
+ self._options = options
978
+
979
+ def __exit__(
980
+ self,
981
+ exc_type: type[BaseException] | None,
982
+ exc_val: BaseException | None,
983
+ exc_tb: types.TracebackType | None,
984
+ ) -> None:
985
+ if self._send_stream:
986
+ self._send_stream.close()
987
+ while self._send_stream is not None:
988
+ self._call_queue.get()()
989
+
990
+ def is_running(self) -> bool:
991
+ return trio.lowlevel.in_trio_task()
992
+
993
+ async def _run_tests_and_fixtures(self) -> None:
994
+ self._send_stream, receive_stream = create_memory_object_stream[
995
+ tuple[Awaitable[Any], list[Outcome]]
996
+ ](1)
997
+ with receive_stream:
998
+ async for awaitable, outcome_holder in receive_stream:
999
+ try:
1000
+ retval = await awaitable
1001
+ except BaseException as exc:
1002
+ outcome_holder.append(Error(exc))
1003
+ else:
1004
+ outcome_holder.append(Value(retval))
1005
+
1006
+ def _main_task_finished(self, outcome: object) -> None:
1007
+ self._send_stream = None
1008
+
1009
+ def _call_in_runner_task(
1010
+ self,
1011
+ func: Callable[P, Awaitable[T_Retval]],
1012
+ /,
1013
+ *args: P.args,
1014
+ **kwargs: P.kwargs,
1015
+ ) -> T_Retval:
1016
+ if self._send_stream is None:
1017
+ trio.lowlevel.start_guest_run(
1018
+ self._run_tests_and_fixtures,
1019
+ run_sync_soon_threadsafe=self._call_queue.put,
1020
+ done_callback=self._main_task_finished,
1021
+ **self._options,
1022
+ )
1023
+ while self._send_stream is None:
1024
+ self._call_queue.get()()
1025
+
1026
+ outcome_holder: list[Outcome] = []
1027
+ self._send_stream.send_nowait((func(*args, **kwargs), outcome_holder))
1028
+ while not outcome_holder:
1029
+ self._call_queue.get()()
1030
+
1031
+ return outcome_holder[0].unwrap()
1032
+
1033
+ def run_asyncgen_fixture(
1034
+ self,
1035
+ fixture_func: Callable[..., AsyncGenerator[T_Retval, Any]],
1036
+ kwargs: dict[str, Any],
1037
+ ) -> Iterable[T_Retval]:
1038
+ asyncgen = fixture_func(**kwargs)
1039
+ fixturevalue: T_Retval = self._call_in_runner_task(asyncgen.asend, None)
1040
+
1041
+ yield fixturevalue
1042
+
1043
+ try:
1044
+ self._call_in_runner_task(asyncgen.asend, None)
1045
+ except StopAsyncIteration:
1046
+ pass
1047
+ else:
1048
+ self._call_in_runner_task(asyncgen.aclose)
1049
+ raise RuntimeError("Async generator fixture did not stop")
1050
+
1051
+ def run_fixture(
1052
+ self,
1053
+ fixture_func: Callable[..., Coroutine[Any, Any, T_Retval]],
1054
+ kwargs: dict[str, Any],
1055
+ ) -> T_Retval:
1056
+ return self._call_in_runner_task(fixture_func, **kwargs)
1057
+
1058
+ def run_test(
1059
+ self, test_func: Callable[..., Coroutine[Any, Any, Any]], kwargs: dict[str, Any]
1060
+ ) -> None:
1061
+ self._call_in_runner_task(test_func, **kwargs)
1062
+
1063
+
1064
+ class TrioTaskInfo(TaskInfo):
1065
+ def __init__(self, task: trio.lowlevel.Task):
1066
+ parent_id = None
1067
+ if task.parent_nursery and task.parent_nursery.parent_task:
1068
+ parent_id = id(task.parent_nursery.parent_task)
1069
+
1070
+ super().__init__(id(task), parent_id, task.name, task.coro)
1071
+ self._task = weakref.proxy(task)
1072
+
1073
+ def has_pending_cancellation(self) -> bool:
1074
+ try:
1075
+ return self._task._cancel_status.effectively_cancelled
1076
+ except ReferenceError:
1077
+ # If the task is no longer around, it surely doesn't have a cancellation
1078
+ # pending
1079
+ return False
1080
+
1081
+
1082
+ class TrioBackend(AsyncBackend):
1083
+ @classmethod
1084
+ def run(
1085
+ cls,
1086
+ func: Callable[[Unpack[PosArgsT]], Awaitable[T_Retval]],
1087
+ args: tuple[Unpack[PosArgsT]],
1088
+ kwargs: dict[str, Any],
1089
+ options: dict[str, Any],
1090
+ ) -> T_Retval:
1091
+ assert not kwargs, "unreachable, and not supported by Trio"
1092
+ return trio.run(ensure_returns_coro(func), *args, **options)
1093
+
1094
+ @classmethod
1095
+ def current_token(cls) -> object:
1096
+ return trio.lowlevel.current_trio_token()
1097
+
1098
+ @classmethod
1099
+ def current_time(cls) -> float:
1100
+ return trio.current_time()
1101
+
1102
+ @classmethod
1103
+ def cancelled_exception_class(cls) -> type[BaseException]:
1104
+ return trio.Cancelled
1105
+
1106
+ @classmethod
1107
+ async def checkpoint(cls) -> None:
1108
+ await trio.lowlevel.checkpoint()
1109
+
1110
+ @classmethod
1111
+ async def checkpoint_if_cancelled(cls) -> None:
1112
+ await trio.lowlevel.checkpoint_if_cancelled()
1113
+
1114
+ @classmethod
1115
+ async def cancel_shielded_checkpoint(cls) -> None:
1116
+ await trio.lowlevel.cancel_shielded_checkpoint()
1117
+
1118
+ @classmethod
1119
+ async def sleep(cls, delay: float) -> None:
1120
+ await trio.sleep(delay)
1121
+
1122
+ @classmethod
1123
+ def create_cancel_scope(
1124
+ cls, *, deadline: float = math.inf, shield: bool = False
1125
+ ) -> BaseCancelScope:
1126
+ return CancelScope(deadline=deadline, shield=shield)
1127
+
1128
+ @classmethod
1129
+ def current_effective_deadline(cls) -> float:
1130
+ return trio.current_effective_deadline()
1131
+
1132
+ @classmethod
1133
+ def create_task_group(cls) -> abc.TaskGroup:
1134
+ return TaskGroup()
1135
+
1136
+ @classmethod
1137
+ def create_event(cls) -> BaseEvent:
1138
+ return Event()
1139
+
1140
+ @classmethod
1141
+ def create_lock(cls, *, fast_acquire: bool) -> Lock:
1142
+ return Lock(fast_acquire=fast_acquire)
1143
+
1144
+ @classmethod
1145
+ def create_semaphore(
1146
+ cls,
1147
+ initial_value: int,
1148
+ *,
1149
+ max_value: int | None = None,
1150
+ fast_acquire: bool = False,
1151
+ ) -> BaseSemaphore:
1152
+ return Semaphore(initial_value, max_value=max_value, fast_acquire=fast_acquire)
1153
+
1154
+ @classmethod
1155
+ def create_capacity_limiter(cls, total_tokens: float) -> CapacityLimiter:
1156
+ return CapacityLimiter(total_tokens)
1157
+
1158
+ @classmethod
1159
+ async def run_sync_in_worker_thread(
1160
+ cls,
1161
+ func: Callable[[Unpack[PosArgsT]], T_Retval],
1162
+ args: tuple[Unpack[PosArgsT]],
1163
+ abandon_on_cancel: bool = False,
1164
+ limiter: BaseCapacityLimiter | None = None,
1165
+ ) -> T_Retval:
1166
+ def wrapper() -> T_Retval:
1167
+ with claim_worker_thread(TrioBackend, token):
1168
+ return func(*args)
1169
+
1170
+ token = TrioBackend.current_token()
1171
+ return await run_sync(
1172
+ wrapper,
1173
+ abandon_on_cancel=abandon_on_cancel,
1174
+ limiter=cast(trio.CapacityLimiter, limiter),
1175
+ )
1176
+
1177
+ @classmethod
1178
+ def check_cancelled(cls) -> None:
1179
+ trio.from_thread.check_cancelled()
1180
+
1181
+ @classmethod
1182
+ def run_async_from_thread(
1183
+ cls,
1184
+ func: Callable[[Unpack[PosArgsT]], Coroutine[Any, Any, T_co]],
1185
+ args: tuple[Unpack[PosArgsT]],
1186
+ token: object,
1187
+ ) -> T_co:
1188
+ trio_token = cast("trio.lowlevel.TrioToken | None", token)
1189
+ try:
1190
+ return trio.from_thread.run(func, *args, trio_token=trio_token)
1191
+ except trio.RunFinishedError:
1192
+ raise RunFinishedError from None
1193
+
1194
+ @classmethod
1195
+ def run_sync_from_thread(
1196
+ cls,
1197
+ func: Callable[[Unpack[PosArgsT]], T_Retval],
1198
+ args: tuple[Unpack[PosArgsT]],
1199
+ token: object,
1200
+ ) -> T_Retval:
1201
+ trio_token = cast("trio.lowlevel.TrioToken | None", token)
1202
+ try:
1203
+ return trio.from_thread.run_sync(func, *args, trio_token=trio_token)
1204
+ except trio.RunFinishedError:
1205
+ raise RunFinishedError from None
1206
+
1207
+ @classmethod
1208
+ async def open_process(
1209
+ cls,
1210
+ command: StrOrBytesPath | Sequence[StrOrBytesPath],
1211
+ *,
1212
+ stdin: int | IO[Any] | None,
1213
+ stdout: int | IO[Any] | None,
1214
+ stderr: int | IO[Any] | None,
1215
+ **kwargs: Any,
1216
+ ) -> Process:
1217
+ def convert_item(item: StrOrBytesPath) -> str:
1218
+ str_or_bytes = os.fspath(item)
1219
+ if isinstance(str_or_bytes, str):
1220
+ return str_or_bytes
1221
+ else:
1222
+ return os.fsdecode(str_or_bytes)
1223
+
1224
+ if isinstance(command, (str, bytes, PathLike)):
1225
+ process = await trio.lowlevel.open_process(
1226
+ convert_item(command),
1227
+ stdin=stdin,
1228
+ stdout=stdout,
1229
+ stderr=stderr,
1230
+ shell=True,
1231
+ **kwargs,
1232
+ )
1233
+ else:
1234
+ process = await trio.lowlevel.open_process(
1235
+ [convert_item(item) for item in command],
1236
+ stdin=stdin,
1237
+ stdout=stdout,
1238
+ stderr=stderr,
1239
+ shell=False,
1240
+ **kwargs,
1241
+ )
1242
+
1243
+ stdin_stream = SendStreamWrapper(process.stdin) if process.stdin else None
1244
+ stdout_stream = ReceiveStreamWrapper(process.stdout) if process.stdout else None
1245
+ stderr_stream = ReceiveStreamWrapper(process.stderr) if process.stderr else None
1246
+ return Process(process, stdin_stream, stdout_stream, stderr_stream)
1247
+
1248
+ @classmethod
1249
+ def setup_process_pool_exit_at_shutdown(cls, workers: set[abc.Process]) -> None:
1250
+ trio.lowlevel.spawn_system_task(_shutdown_process_pool, workers)
1251
+
1252
+ @classmethod
1253
+ async def connect_tcp(
1254
+ cls, host: str, port: int, local_address: IPSockAddrType | None = None
1255
+ ) -> SocketStream:
1256
+ family = socket.AF_INET6 if ":" in host else socket.AF_INET
1257
+ trio_socket = trio.socket.socket(family)
1258
+ trio_socket.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
1259
+ if local_address:
1260
+ await trio_socket.bind(local_address)
1261
+
1262
+ try:
1263
+ await trio_socket.connect((host, port))
1264
+ except BaseException:
1265
+ trio_socket.close()
1266
+ raise
1267
+
1268
+ return SocketStream(trio_socket)
1269
+
1270
+ @classmethod
1271
+ async def connect_unix(cls, path: str | bytes) -> abc.UNIXSocketStream:
1272
+ trio_socket = trio.socket.socket(socket.AF_UNIX)
1273
+ try:
1274
+ await trio_socket.connect(path)
1275
+ except BaseException:
1276
+ trio_socket.close()
1277
+ raise
1278
+
1279
+ return UNIXSocketStream(trio_socket)
1280
+
1281
+ @classmethod
1282
+ def create_tcp_listener(cls, sock: socket.socket) -> abc.SocketListener:
1283
+ return TCPSocketListener(sock)
1284
+
1285
+ @classmethod
1286
+ def create_unix_listener(cls, sock: socket.socket) -> abc.SocketListener:
1287
+ return UNIXSocketListener(sock)
1288
+
1289
+ @classmethod
1290
+ async def create_udp_socket(
1291
+ cls,
1292
+ family: socket.AddressFamily,
1293
+ local_address: IPSockAddrType | None,
1294
+ remote_address: IPSockAddrType | None,
1295
+ reuse_port: bool,
1296
+ ) -> UDPSocket | ConnectedUDPSocket:
1297
+ trio_socket = trio.socket.socket(family=family, type=socket.SOCK_DGRAM)
1298
+
1299
+ if reuse_port:
1300
+ trio_socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEPORT, 1)
1301
+
1302
+ if local_address:
1303
+ await trio_socket.bind(local_address)
1304
+
1305
+ if remote_address:
1306
+ await trio_socket.connect(remote_address)
1307
+ return ConnectedUDPSocket(trio_socket)
1308
+ else:
1309
+ return UDPSocket(trio_socket)
1310
+
1311
+ @classmethod
1312
+ @overload
1313
+ async def create_unix_datagram_socket(
1314
+ cls, raw_socket: socket.socket, remote_path: None
1315
+ ) -> abc.UNIXDatagramSocket: ...
1316
+
1317
+ @classmethod
1318
+ @overload
1319
+ async def create_unix_datagram_socket(
1320
+ cls, raw_socket: socket.socket, remote_path: str | bytes
1321
+ ) -> abc.ConnectedUNIXDatagramSocket: ...
1322
+
1323
+ @classmethod
1324
+ async def create_unix_datagram_socket(
1325
+ cls, raw_socket: socket.socket, remote_path: str | bytes | None
1326
+ ) -> abc.UNIXDatagramSocket | abc.ConnectedUNIXDatagramSocket:
1327
+ trio_socket = trio.socket.from_stdlib_socket(raw_socket)
1328
+
1329
+ if remote_path:
1330
+ await trio_socket.connect(remote_path)
1331
+ return ConnectedUNIXDatagramSocket(trio_socket)
1332
+ else:
1333
+ return UNIXDatagramSocket(trio_socket)
1334
+
1335
+ @classmethod
1336
+ async def getaddrinfo(
1337
+ cls,
1338
+ host: bytes | str | None,
1339
+ port: str | int | None,
1340
+ *,
1341
+ family: int | AddressFamily = 0,
1342
+ type: int | SocketKind = 0,
1343
+ proto: int = 0,
1344
+ flags: int = 0,
1345
+ ) -> Sequence[
1346
+ tuple[
1347
+ AddressFamily,
1348
+ SocketKind,
1349
+ int,
1350
+ str,
1351
+ tuple[str, int] | tuple[str, int, int, int] | tuple[int, bytes],
1352
+ ]
1353
+ ]:
1354
+ return await trio.socket.getaddrinfo(host, port, family, type, proto, flags)
1355
+
1356
+ @classmethod
1357
+ async def getnameinfo(
1358
+ cls, sockaddr: IPSockAddrType, flags: int = 0
1359
+ ) -> tuple[str, str]:
1360
+ return await trio.socket.getnameinfo(sockaddr, flags)
1361
+
1362
+ @classmethod
1363
+ async def wait_readable(cls, obj: FileDescriptorLike) -> None:
1364
+ try:
1365
+ await wait_readable(obj)
1366
+ except trio.ClosedResourceError as exc:
1367
+ raise ClosedResourceError().with_traceback(exc.__traceback__) from None
1368
+ except trio.BusyResourceError:
1369
+ raise BusyResourceError("reading from") from None
1370
+
1371
+ @classmethod
1372
+ async def wait_writable(cls, obj: FileDescriptorLike) -> None:
1373
+ try:
1374
+ await wait_writable(obj)
1375
+ except trio.ClosedResourceError as exc:
1376
+ raise ClosedResourceError().with_traceback(exc.__traceback__) from None
1377
+ except trio.BusyResourceError:
1378
+ raise BusyResourceError("writing to") from None
1379
+
1380
+ @classmethod
1381
+ def notify_closing(cls, obj: FileDescriptorLike) -> None:
1382
+ notify_closing(obj)
1383
+
1384
+ @classmethod
1385
+ async def wrap_listener_socket(cls, sock: socket.socket) -> abc.SocketListener:
1386
+ if hasattr(socket, "AF_UNIX") and sock.family == socket.AF_UNIX:
1387
+ return UNIXSocketListener(sock)
1388
+
1389
+ return TCPSocketListener(sock)
1390
+
1391
+ @classmethod
1392
+ async def wrap_stream_socket(cls, sock: socket.socket) -> SocketStream:
1393
+ trio_sock = trio.socket.from_stdlib_socket(sock)
1394
+ return SocketStream(trio_sock)
1395
+
1396
+ @classmethod
1397
+ async def wrap_unix_stream_socket(cls, sock: socket.socket) -> UNIXSocketStream:
1398
+ trio_sock = trio.socket.from_stdlib_socket(sock)
1399
+ return UNIXSocketStream(trio_sock)
1400
+
1401
+ @classmethod
1402
+ async def wrap_udp_socket(cls, sock: socket.socket) -> UDPSocket:
1403
+ trio_sock = trio.socket.from_stdlib_socket(sock)
1404
+ return UDPSocket(trio_sock)
1405
+
1406
+ @classmethod
1407
+ async def wrap_connected_udp_socket(cls, sock: socket.socket) -> ConnectedUDPSocket:
1408
+ trio_sock = trio.socket.from_stdlib_socket(sock)
1409
+ return ConnectedUDPSocket(trio_sock)
1410
+
1411
+ @classmethod
1412
+ async def wrap_unix_datagram_socket(cls, sock: socket.socket) -> UNIXDatagramSocket:
1413
+ trio_sock = trio.socket.from_stdlib_socket(sock)
1414
+ return UNIXDatagramSocket(trio_sock)
1415
+
1416
+ @classmethod
1417
+ async def wrap_connected_unix_datagram_socket(
1418
+ cls, sock: socket.socket
1419
+ ) -> ConnectedUNIXDatagramSocket:
1420
+ trio_sock = trio.socket.from_stdlib_socket(sock)
1421
+ return ConnectedUNIXDatagramSocket(trio_sock)
1422
+
1423
+ @classmethod
1424
+ def current_default_thread_limiter(cls) -> CapacityLimiter:
1425
+ try:
1426
+ return _capacity_limiter_wrapper.get()
1427
+ except LookupError:
1428
+ limiter = CapacityLimiter(
1429
+ original=trio.to_thread.current_default_thread_limiter()
1430
+ )
1431
+ _capacity_limiter_wrapper.set(limiter)
1432
+ return limiter
1433
+
1434
+ @classmethod
1435
+ def open_signal_receiver(
1436
+ cls, *signals: Signals
1437
+ ) -> AbstractContextManager[AsyncIterator[Signals]]:
1438
+ return _SignalReceiver(signals)
1439
+
1440
+ @classmethod
1441
+ def get_current_task(cls) -> TaskInfo:
1442
+ task = current_task()
1443
+ return TrioTaskInfo(task)
1444
+
1445
+ @classmethod
1446
+ def get_running_tasks(cls) -> Sequence[TaskInfo]:
1447
+ root_task = current_root_task()
1448
+ assert root_task
1449
+ task_infos = [TrioTaskInfo(root_task)]
1450
+ nurseries = root_task.child_nurseries
1451
+ while nurseries:
1452
+ new_nurseries: list[trio.Nursery] = []
1453
+ for nursery in nurseries:
1454
+ for task in nursery.child_tasks:
1455
+ task_infos.append(TrioTaskInfo(task))
1456
+ new_nurseries.extend(task.child_nurseries)
1457
+
1458
+ nurseries = new_nurseries
1459
+
1460
+ return task_infos
1461
+
1462
+ @classmethod
1463
+ async def wait_all_tasks_blocked(cls) -> None:
1464
+ from trio.testing import wait_all_tasks_blocked
1465
+
1466
+ await wait_all_tasks_blocked()
1467
+
1468
+ @classmethod
1469
+ def create_test_runner(cls, options: dict[str, Any]) -> TestRunner:
1470
+ return TestRunner(**options)
1471
+
1472
+
1473
+ backend_class = TrioBackend
.venv/lib/python3.14/site-packages/anyio/_core/__init__.py ADDED
File without changes
.venv/lib/python3.14/site-packages/anyio/_core/__pycache__/__init__.cpython-314.pyc ADDED
Binary file (228 Bytes). View file
 
.venv/lib/python3.14/site-packages/anyio/_core/__pycache__/_asyncio_selector_thread.cpython-314.pyc ADDED
Binary file (10.1 kB). View file
 
.venv/lib/python3.14/site-packages/anyio/_core/__pycache__/_concurrency_utils.cpython-314.pyc ADDED
Binary file (9.91 kB). View file