Sdm0 commited on
Commit
430b93c
·
verified ·
1 Parent(s): 2a97c99

Force deploy: fix Gemini model name + TokenCostCallback handlers

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 +223 -0
  2. .venv/Lib/site-packages/_distutils_hack/__init__.py +239 -0
  3. .venv/Lib/site-packages/_distutils_hack/override.py +1 -0
  4. .venv/Lib/site-packages/_yaml/__init__.py +33 -0
  5. .venv/Lib/site-packages/ada92cb5d92a588d1b93__mypyc.cp312-win_amd64.pyd +3 -0
  6. .venv/Lib/site-packages/aiohappyeyeballs-2.7.1.dist-info/INSTALLER +1 -0
  7. .venv/Lib/site-packages/aiohappyeyeballs-2.7.1.dist-info/METADATA +124 -0
  8. .venv/Lib/site-packages/aiohappyeyeballs-2.7.1.dist-info/RECORD +16 -0
  9. .venv/Lib/site-packages/aiohappyeyeballs-2.7.1.dist-info/WHEEL +4 -0
  10. .venv/Lib/site-packages/aiohappyeyeballs-2.7.1.dist-info/licenses/LICENSE +279 -0
  11. .venv/Lib/site-packages/aiohappyeyeballs/__init__.py +14 -0
  12. .venv/Lib/site-packages/aiohappyeyeballs/_staggered.py +197 -0
  13. .venv/Lib/site-packages/aiohappyeyeballs/impl.py +247 -0
  14. .venv/Lib/site-packages/aiohappyeyeballs/py.typed +0 -0
  15. .venv/Lib/site-packages/aiohappyeyeballs/types.py +14 -0
  16. .venv/Lib/site-packages/aiohappyeyeballs/utils.py +82 -0
  17. .venv/Lib/site-packages/aiohttp-3.14.1.dist-info/INSTALLER +1 -0
  18. .venv/Lib/site-packages/aiohttp-3.14.1.dist-info/METADATA +257 -0
  19. .venv/Lib/site-packages/aiohttp-3.14.1.dist-info/RECORD +138 -0
  20. .venv/Lib/site-packages/aiohttp-3.14.1.dist-info/WHEEL +5 -0
  21. .venv/Lib/site-packages/aiohttp-3.14.1.dist-info/licenses/LICENSE.txt +201 -0
  22. .venv/Lib/site-packages/aiohttp-3.14.1.dist-info/licenses/vendor/llhttp/LICENSE +22 -0
  23. .venv/Lib/site-packages/aiohttp-3.14.1.dist-info/top_level.txt +1 -0
  24. .venv/Lib/site-packages/aiohttp/.hash/_cparser.pxd.hash +1 -0
  25. .venv/Lib/site-packages/aiohttp/.hash/_find_header.pxd.hash +1 -0
  26. .venv/Lib/site-packages/aiohttp/.hash/_http_parser.pyx.hash +1 -0
  27. .venv/Lib/site-packages/aiohttp/.hash/_http_writer.pyx.hash +1 -0
  28. .venv/Lib/site-packages/aiohttp/.hash/hdrs.py.hash +1 -0
  29. .venv/Lib/site-packages/aiohttp/__init__.py +279 -0
  30. .venv/Lib/site-packages/aiohttp/_cookie_helpers.py +361 -0
  31. .venv/Lib/site-packages/aiohttp/_cparser.pxd +159 -0
  32. .venv/Lib/site-packages/aiohttp/_find_header.pxd +2 -0
  33. .venv/Lib/site-packages/aiohttp/_headers.pxi +83 -0
  34. .venv/Lib/site-packages/aiohttp/_http_parser.cp312-win_amd64.pyd +3 -0
  35. .venv/Lib/site-packages/aiohttp/_http_parser.pyx +965 -0
  36. .venv/Lib/site-packages/aiohttp/_http_writer.cp312-win_amd64.pyd +0 -0
  37. .venv/Lib/site-packages/aiohttp/_http_writer.pyx +164 -0
  38. .venv/Lib/site-packages/aiohttp/_websocket/.hash/mask.pxd.hash +1 -0
  39. .venv/Lib/site-packages/aiohttp/_websocket/.hash/mask.pyx.hash +1 -0
  40. .venv/Lib/site-packages/aiohttp/_websocket/.hash/reader_c.pxd.hash +1 -0
  41. .venv/Lib/site-packages/aiohttp/_websocket/__init__.py +1 -0
  42. .venv/Lib/site-packages/aiohttp/_websocket/helpers.py +148 -0
  43. .venv/Lib/site-packages/aiohttp/_websocket/mask.cp312-win_amd64.pyd +0 -0
  44. .venv/Lib/site-packages/aiohttp/_websocket/mask.pxd +3 -0
  45. .venv/Lib/site-packages/aiohttp/_websocket/mask.pyx +48 -0
  46. .venv/Lib/site-packages/aiohttp/_websocket/models.py +107 -0
  47. .venv/Lib/site-packages/aiohttp/_websocket/reader.py +31 -0
  48. .venv/Lib/site-packages/aiohttp/_websocket/reader_c.cp312-win_amd64.pyd +3 -0
  49. .venv/Lib/site-packages/aiohttp/_websocket/reader_c.pxd +112 -0
  50. .venv/Lib/site-packages/aiohttp/_websocket/reader_c.py +509 -0
.gitattributes ADDED
@@ -0,0 +1,223 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .venv/Lib/site-packages/ada92cb5d92a588d1b93__mypyc.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
2
+ .venv/Lib/site-packages/aiohttp/_http_parser.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
3
+ .venv/Lib/site-packages/aiohttp/_websocket/reader_c.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
4
+ .venv/Lib/site-packages/bcrypt/_bcrypt.pyd filter=lfs diff=lfs merge=lfs -text
5
+ .venv/Lib/site-packages/chromadb_rust_bindings/chromadb_rust_bindings.pyd filter=lfs diff=lfs merge=lfs -text
6
+ .venv/Lib/site-packages/dateutil/zoneinfo/dateutil-zoneinfo.tar.gz filter=lfs diff=lfs merge=lfs -text
7
+ .venv/Lib/site-packages/google/_upb/_message.pyd filter=lfs diff=lfs merge=lfs -text
8
+ .venv/Lib/site-packages/grpc/_cython/cygrpc.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
9
+ .venv/Lib/site-packages/hf_xet/hf_xet.pyd filter=lfs diff=lfs merge=lfs -text
10
+ .venv/Lib/site-packages/httptools/parser/parser.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
11
+ .venv/Lib/site-packages/networkx/drawing/tests/baseline/test_display_complex.png filter=lfs diff=lfs merge=lfs -text
12
+ .venv/Lib/site-packages/numpy/_core/_multiarray_umath.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
13
+ .venv/Lib/site-packages/numpy/_core/_simd.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
14
+ .venv/Lib/site-packages/numpy/_core/lib/npymath.lib filter=lfs diff=lfs merge=lfs -text
15
+ .venv/Lib/site-packages/numpy/fft/_pocketfft_umath.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
16
+ .venv/Lib/site-packages/numpy/linalg/_umath_linalg.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
17
+ .venv/Lib/site-packages/numpy/random/_bounded_integers.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
18
+ .venv/Lib/site-packages/numpy/random/_common.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
19
+ .venv/Lib/site-packages/numpy/random/_generator.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
20
+ .venv/Lib/site-packages/numpy/random/bit_generator.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
21
+ .venv/Lib/site-packages/numpy/random/lib/npyrandom.lib filter=lfs diff=lfs merge=lfs -text
22
+ .venv/Lib/site-packages/numpy/random/mtrand.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
23
+ .venv/Lib/site-packages/numpy.libs/libscipy_openblas64_-b788215d9d47792bcba3a2e2a7114320.dll filter=lfs diff=lfs merge=lfs -text
24
+ .venv/Lib/site-packages/numpy.libs/msvcp140-a4c2229bdc2a2a630acdc095b4d86008.dll filter=lfs diff=lfs merge=lfs -text
25
+ .venv/Lib/site-packages/onnxruntime/capi/onnxruntime.dll filter=lfs diff=lfs merge=lfs -text
26
+ .venv/Lib/site-packages/onnxruntime/capi/onnxruntime_pybind11_state.pyd filter=lfs diff=lfs merge=lfs -text
27
+ .venv/Lib/site-packages/orjson/orjson.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
28
+ .venv/Lib/site-packages/ormsgpack/ormsgpack.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
29
+ .venv/Lib/site-packages/pip/_vendor/distlib/t64-arm.exe filter=lfs diff=lfs merge=lfs -text
30
+ .venv/Lib/site-packages/pip/_vendor/distlib/t64.exe filter=lfs diff=lfs merge=lfs -text
31
+ .venv/Lib/site-packages/pip/_vendor/distlib/w64-arm.exe filter=lfs diff=lfs merge=lfs -text
32
+ .venv/Lib/site-packages/pip/_vendor/distlib/w64.exe filter=lfs diff=lfs merge=lfs -text
33
+ .venv/Lib/site-packages/pydantic_core/_pydantic_core.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
34
+ .venv/Lib/site-packages/regex/_regex.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
35
+ .venv/Lib/site-packages/rpds/rpds.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
36
+ .venv/Lib/site-packages/safetensors/_safetensors_rust.pyd filter=lfs diff=lfs merge=lfs -text
37
+ .venv/Lib/site-packages/scipy/_cyutility.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
38
+ .venv/Lib/site-packages/scipy/_lib/_ccallback_c.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
39
+ .venv/Lib/site-packages/scipy/_lib/_uarray/_uarray.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
40
+ .venv/Lib/site-packages/scipy/cluster/hierarchy/_hierarchy.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
41
+ .venv/Lib/site-packages/scipy/cluster/hierarchy/_optimal_leaf_ordering.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
42
+ .venv/Lib/site-packages/scipy/cluster/vq/_vq.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
43
+ .venv/Lib/site-packages/scipy/fft/_duccfft/pyduccfft.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
44
+ .venv/Lib/site-packages/scipy/fftpack/convolve.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
45
+ .venv/Lib/site-packages/scipy/fftpack/tests/fftw_double_ref.npz filter=lfs diff=lfs merge=lfs -text
46
+ .venv/Lib/site-packages/scipy/fftpack/tests/fftw_longdouble_ref.npz filter=lfs diff=lfs merge=lfs -text
47
+ .venv/Lib/site-packages/scipy/integrate/_quadpack.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
48
+ .venv/Lib/site-packages/scipy/integrate/_vode.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
49
+ .venv/Lib/site-packages/scipy/interpolate/_dierckx.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
50
+ .venv/Lib/site-packages/scipy/interpolate/_fitpack.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
51
+ .venv/Lib/site-packages/scipy/interpolate/_interpnd.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
52
+ .venv/Lib/site-packages/scipy/interpolate/_ppoly.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
53
+ .venv/Lib/site-packages/scipy/interpolate/_rbfinterp_pythran.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
54
+ .venv/Lib/site-packages/scipy/interpolate/_rgi_cython.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
55
+ .venv/Lib/site-packages/scipy/io/_fast_matrix_market/_fmm_core.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
56
+ .venv/Lib/site-packages/scipy/io/matlab/_mio5_utils.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
57
+ .venv/Lib/site-packages/scipy/io/matlab/_streams.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
58
+ .venv/Lib/site-packages/scipy/linalg/_batched_linalg.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
59
+ .venv/Lib/site-packages/scipy/linalg/_cythonized_array_utils.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
60
+ .venv/Lib/site-packages/scipy/linalg/_decomp_interpolative.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
61
+ .venv/Lib/site-packages/scipy/linalg/_decomp_update.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
62
+ .venv/Lib/site-packages/scipy/linalg/_fblas.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
63
+ .venv/Lib/site-packages/scipy/linalg/_flapack.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
64
+ .venv/Lib/site-packages/scipy/linalg/_internal_matfuncs.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
65
+ .venv/Lib/site-packages/scipy/linalg/_linalg_pythran.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
66
+ .venv/Lib/site-packages/scipy/linalg/_matfuncs_sqrtm_triu.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
67
+ .venv/Lib/site-packages/scipy/linalg/_solve_toeplitz.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
68
+ .venv/Lib/site-packages/scipy/linalg/cython_blas.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
69
+ .venv/Lib/site-packages/scipy/linalg/cython_lapack.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
70
+ .venv/Lib/site-packages/scipy/linalg/tests/data/carex_18_data.npz filter=lfs diff=lfs merge=lfs -text
71
+ .venv/Lib/site-packages/scipy/ndimage/_nd_image.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
72
+ .venv/Lib/site-packages/scipy/ndimage/_ni_label.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
73
+ .venv/Lib/site-packages/scipy/ndimage/_rank_filter_1d.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
74
+ .venv/Lib/site-packages/scipy/odr/__odrpack.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
75
+ .venv/Lib/site-packages/scipy/optimize/_bglu_dense.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
76
+ .venv/Lib/site-packages/scipy/optimize/_group_columns.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
77
+ .venv/Lib/site-packages/scipy/optimize/_highspy/_core.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
78
+ .venv/Lib/site-packages/scipy/optimize/_highspy/_highs_options.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
79
+ .venv/Lib/site-packages/scipy/optimize/_lsap.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
80
+ .venv/Lib/site-packages/scipy/optimize/_minpack.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
81
+ .venv/Lib/site-packages/scipy/optimize/_moduleTNC.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
82
+ .venv/Lib/site-packages/scipy/optimize/_pava_pybind.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
83
+ .venv/Lib/site-packages/scipy/optimize/_trlib/_trlib.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
84
+ .venv/Lib/site-packages/scipy/signal/_max_len_seq_inner.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
85
+ .venv/Lib/site-packages/scipy/signal/_peak_finding_utils.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
86
+ .venv/Lib/site-packages/scipy/signal/_sigtools.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
87
+ .venv/Lib/site-packages/scipy/signal/_sosfilt.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
88
+ .venv/Lib/site-packages/scipy/signal/_upfirdn_apply.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
89
+ .venv/Lib/site-packages/scipy/sparse/_csparsetools.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
90
+ .venv/Lib/site-packages/scipy/sparse/_sparsetools.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
91
+ .venv/Lib/site-packages/scipy/sparse/csgraph/_flow.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
92
+ .venv/Lib/site-packages/scipy/sparse/csgraph/_matching.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
93
+ .venv/Lib/site-packages/scipy/sparse/csgraph/_min_spanning_tree.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
94
+ .venv/Lib/site-packages/scipy/sparse/csgraph/_reordering.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
95
+ .venv/Lib/site-packages/scipy/sparse/csgraph/_shortest_path.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
96
+ .venv/Lib/site-packages/scipy/sparse/csgraph/_tools.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
97
+ .venv/Lib/site-packages/scipy/sparse/csgraph/_traversal.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
98
+ .venv/Lib/site-packages/scipy/sparse/linalg/_dsolve/_superlu.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
99
+ .venv/Lib/site-packages/scipy/sparse/linalg/_eigen/arpack/_arpacklib.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
100
+ .venv/Lib/site-packages/scipy/sparse/linalg/_propack.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
101
+ .venv/Lib/site-packages/scipy/sparse/linalg/tests/propack_test_data.npz filter=lfs diff=lfs merge=lfs -text
102
+ .venv/Lib/site-packages/scipy/spatial/_ckdtree.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
103
+ .venv/Lib/site-packages/scipy/spatial/_distance_pybind.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
104
+ .venv/Lib/site-packages/scipy/spatial/_distance_wrap.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
105
+ .venv/Lib/site-packages/scipy/spatial/_qhull.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
106
+ .venv/Lib/site-packages/scipy/spatial/transform/_rigid_transform_cy.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
107
+ .venv/Lib/site-packages/scipy/spatial/transform/_rotation_cy.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
108
+ .venv/Lib/site-packages/scipy/special/_ellip_harm_2.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
109
+ .venv/Lib/site-packages/scipy/special/_gufuncs.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
110
+ .venv/Lib/site-packages/scipy/special/_specfun.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
111
+ .venv/Lib/site-packages/scipy/special/_special_ufuncs.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
112
+ .venv/Lib/site-packages/scipy/special/_ufuncs.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
113
+ .venv/Lib/site-packages/scipy/special/_ufuncs_cxx.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
114
+ .venv/Lib/site-packages/scipy/special/cython_special.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
115
+ .venv/Lib/site-packages/scipy/special/tests/data/boost.npz filter=lfs diff=lfs merge=lfs -text
116
+ .venv/Lib/site-packages/scipy/special/tests/data/local.npz filter=lfs diff=lfs merge=lfs -text
117
+ .venv/Lib/site-packages/scipy/stats/_ansari_swilk_statistics.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
118
+ .venv/Lib/site-packages/scipy/stats/_biasedurn.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
119
+ .venv/Lib/site-packages/scipy/stats/_qmc_cy.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
120
+ .venv/Lib/site-packages/scipy/stats/_qmvnt_cy.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
121
+ .venv/Lib/site-packages/scipy/stats/_rcont/rcont.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
122
+ .venv/Lib/site-packages/scipy/stats/_sobol.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
123
+ .venv/Lib/site-packages/scipy/stats/_sobol_direction_numbers.npz filter=lfs diff=lfs merge=lfs -text
124
+ .venv/Lib/site-packages/scipy/stats/_stats.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
125
+ .venv/Lib/site-packages/scipy/stats/_stats_pythran.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
126
+ .venv/Lib/site-packages/scipy/stats/_unuran/unuran_wrapper.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
127
+ .venv/Lib/site-packages/scipy/stats/tests/data/levy_stable/stable-Z1-cdf-sample-data.npy filter=lfs diff=lfs merge=lfs -text
128
+ .venv/Lib/site-packages/scipy/stats/tests/data/levy_stable/stable-Z1-pdf-sample-data.npy filter=lfs diff=lfs merge=lfs -text
129
+ .venv/Lib/site-packages/scipy.libs/libscipy_openblas-197ee2fc9b4d071f7e048078cac74115.dll filter=lfs diff=lfs merge=lfs -text
130
+ .venv/Lib/site-packages/sklearn/.libs/msvcp140.dll filter=lfs diff=lfs merge=lfs -text
131
+ .venv/Lib/site-packages/sklearn/.libs/vcomp140.dll filter=lfs diff=lfs merge=lfs -text
132
+ .venv/Lib/site-packages/sklearn/_cyutility.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
133
+ .venv/Lib/site-packages/sklearn/_loss/_loss.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
134
+ .venv/Lib/site-packages/sklearn/cluster/_hdbscan/_reachability.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
135
+ .venv/Lib/site-packages/sklearn/cluster/_hdbscan/_tree.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
136
+ .venv/Lib/site-packages/sklearn/cluster/_hierarchical_fast.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
137
+ .venv/Lib/site-packages/sklearn/cluster/_k_means_common.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
138
+ .venv/Lib/site-packages/sklearn/cluster/_k_means_elkan.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
139
+ .venv/Lib/site-packages/sklearn/cluster/_k_means_lloyd.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
140
+ .venv/Lib/site-packages/sklearn/datasets/_svmlight_format_fast.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
141
+ .venv/Lib/site-packages/sklearn/datasets/images/china.jpg filter=lfs diff=lfs merge=lfs -text
142
+ .venv/Lib/site-packages/sklearn/datasets/images/flower.jpg filter=lfs diff=lfs merge=lfs -text
143
+ .venv/Lib/site-packages/sklearn/ensemble/_hist_gradient_boosting/histogram.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
144
+ .venv/Lib/site-packages/sklearn/ensemble/_hist_gradient_boosting/splitting.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
145
+ .venv/Lib/site-packages/sklearn/linear_model/_cd_fast.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
146
+ .venv/Lib/site-packages/sklearn/linear_model/_sgd_fast.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
147
+ .venv/Lib/site-packages/sklearn/metrics/_dist_metrics.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
148
+ .venv/Lib/site-packages/sklearn/metrics/_pairwise_distances_reduction/_argkmin.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
149
+ .venv/Lib/site-packages/sklearn/metrics/_pairwise_distances_reduction/_base.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
150
+ .venv/Lib/site-packages/sklearn/metrics/_pairwise_distances_reduction/_datasets_pair.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
151
+ .venv/Lib/site-packages/sklearn/metrics/_pairwise_distances_reduction/_middle_term_computer.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
152
+ .venv/Lib/site-packages/sklearn/metrics/_pairwise_distances_reduction/_radius_neighbors.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
153
+ .venv/Lib/site-packages/sklearn/neighbors/_ball_tree.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
154
+ .venv/Lib/site-packages/sklearn/neighbors/_kd_tree.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
155
+ .venv/Lib/site-packages/sklearn/neighbors/_quad_tree.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
156
+ .venv/Lib/site-packages/sklearn/preprocessing/_csr_polynomial_expansion.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
157
+ .venv/Lib/site-packages/sklearn/preprocessing/_target_encoder_fast.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
158
+ .venv/Lib/site-packages/sklearn/svm/_liblinear.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
159
+ .venv/Lib/site-packages/sklearn/svm/_libsvm.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
160
+ .venv/Lib/site-packages/sklearn/svm/_libsvm_sparse.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
161
+ .venv/Lib/site-packages/sklearn/tree/_criterion.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
162
+ .venv/Lib/site-packages/sklearn/tree/_partitioner.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
163
+ .venv/Lib/site-packages/sklearn/tree/_tree.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
164
+ .venv/Lib/site-packages/sklearn/utils/_cython_blas.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
165
+ .venv/Lib/site-packages/sklearn/utils/_random.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
166
+ .venv/Lib/site-packages/sklearn/utils/_seq_dataset.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
167
+ .venv/Lib/site-packages/sklearn/utils/sparsefuncs_fast.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
168
+ .venv/Lib/site-packages/sqlite_vec/vec0.dll filter=lfs diff=lfs merge=lfs -text
169
+ .venv/Lib/site-packages/tokenizers/tokenizers.pyd filter=lfs diff=lfs merge=lfs -text
170
+ .venv/Lib/site-packages/torch/bin/protoc.exe filter=lfs diff=lfs merge=lfs -text
171
+ .venv/Lib/site-packages/torch/lib/c10.dll filter=lfs diff=lfs merge=lfs -text
172
+ .venv/Lib/site-packages/torch/lib/c10.lib filter=lfs diff=lfs merge=lfs -text
173
+ .venv/Lib/site-packages/torch/lib/cpuinfo.lib filter=lfs diff=lfs merge=lfs -text
174
+ .venv/Lib/site-packages/torch/lib/fmt.lib filter=lfs diff=lfs merge=lfs -text
175
+ .venv/Lib/site-packages/torch/lib/libiomp5md.dll filter=lfs diff=lfs merge=lfs -text
176
+ .venv/Lib/site-packages/torch/lib/libittnotify.lib filter=lfs diff=lfs merge=lfs -text
177
+ .venv/Lib/site-packages/torch/lib/microkernels-prod.lib filter=lfs diff=lfs merge=lfs -text
178
+ .venv/Lib/site-packages/torch/lib/pthreadpool.lib filter=lfs diff=lfs merge=lfs -text
179
+ .venv/Lib/site-packages/torch/lib/sleef.lib filter=lfs diff=lfs merge=lfs -text
180
+ .venv/Lib/site-packages/torch/lib/torch_cpu.dll filter=lfs diff=lfs merge=lfs -text
181
+ .venv/Lib/site-packages/torch/lib/torch_cpu.lib filter=lfs diff=lfs merge=lfs -text
182
+ .venv/Lib/site-packages/torch/lib/torch_python.dll filter=lfs diff=lfs merge=lfs -text
183
+ .venv/Lib/site-packages/torch/lib/torch_python.lib filter=lfs diff=lfs merge=lfs -text
184
+ .venv/Lib/site-packages/torch/lib/uv.dll filter=lfs diff=lfs merge=lfs -text
185
+ .venv/Lib/site-packages/torch/lib/XNNPACK.lib filter=lfs diff=lfs merge=lfs -text
186
+ .venv/Lib/site-packages/uuid_utils/_uuid_utils.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
187
+ .venv/Lib/site-packages/watchfiles/_rust_notify.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
188
+ .venv/Lib/site-packages/yaml/_yaml.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
189
+ .venv/Lib/site-packages/zstandard/_cffi.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
190
+ .venv/Lib/site-packages/zstandard/backend_c.cp312-win_amd64.pyd filter=lfs diff=lfs merge=lfs -text
191
+ .venv/Scripts/chroma.exe filter=lfs diff=lfs merge=lfs -text
192
+ .venv/Scripts/distro.exe filter=lfs diff=lfs merge=lfs -text
193
+ .venv/Scripts/dotenv.exe filter=lfs diff=lfs merge=lfs -text
194
+ .venv/Scripts/f2py.exe filter=lfs diff=lfs merge=lfs -text
195
+ .venv/Scripts/hf.exe filter=lfs diff=lfs merge=lfs -text
196
+ .venv/Scripts/httpx.exe filter=lfs diff=lfs merge=lfs -text
197
+ .venv/Scripts/huggingface-cli.exe filter=lfs diff=lfs merge=lfs -text
198
+ .venv/Scripts/idna.exe filter=lfs diff=lfs merge=lfs -text
199
+ .venv/Scripts/isympy.exe filter=lfs diff=lfs merge=lfs -text
200
+ .venv/Scripts/jsonschema.exe filter=lfs diff=lfs merge=lfs -text
201
+ .venv/Scripts/keyring.exe filter=lfs diff=lfs merge=lfs -text
202
+ .venv/Scripts/markdown-it.exe filter=lfs diff=lfs merge=lfs -text
203
+ .venv/Scripts/normalizer.exe filter=lfs diff=lfs merge=lfs -text
204
+ .venv/Scripts/numpy-config.exe filter=lfs diff=lfs merge=lfs -text
205
+ .venv/Scripts/onnxruntime_test.exe filter=lfs diff=lfs merge=lfs -text
206
+ .venv/Scripts/pip.exe filter=lfs diff=lfs merge=lfs -text
207
+ .venv/Scripts/pip3.12.exe filter=lfs diff=lfs merge=lfs -text
208
+ .venv/Scripts/pip3.exe filter=lfs diff=lfs merge=lfs -text
209
+ .venv/Scripts/pybase64.exe filter=lfs diff=lfs merge=lfs -text
210
+ .venv/Scripts/pygmentize.exe filter=lfs diff=lfs merge=lfs -text
211
+ .venv/Scripts/pyproject-build.exe filter=lfs diff=lfs merge=lfs -text
212
+ .venv/Scripts/python.exe filter=lfs diff=lfs merge=lfs -text
213
+ .venv/Scripts/pythonw.exe filter=lfs diff=lfs merge=lfs -text
214
+ .venv/Scripts/tiny-agents.exe filter=lfs diff=lfs merge=lfs -text
215
+ .venv/Scripts/torchfrtrace.exe filter=lfs diff=lfs merge=lfs -text
216
+ .venv/Scripts/torchrun.exe filter=lfs diff=lfs merge=lfs -text
217
+ .venv/Scripts/tqdm.exe filter=lfs diff=lfs merge=lfs -text
218
+ .venv/Scripts/transformers.exe filter=lfs diff=lfs merge=lfs -text
219
+ .venv/Scripts/typer.exe filter=lfs diff=lfs merge=lfs -text
220
+ .venv/Scripts/uvicorn.exe filter=lfs diff=lfs merge=lfs -text
221
+ .venv/Scripts/watchfiles.exe filter=lfs diff=lfs merge=lfs -text
222
+ .venv/Scripts/websockets.exe filter=lfs diff=lfs merge=lfs -text
223
+ .venv/Scripts/wsdump.exe filter=lfs diff=lfs merge=lfs -text
.venv/Lib/site-packages/_distutils_hack/__init__.py ADDED
@@ -0,0 +1,239 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # don't import any costly modules
2
+ import os
3
+ import sys
4
+
5
+ report_url = (
6
+ "https://github.com/pypa/setuptools/issues/new?template=distutils-deprecation.yml"
7
+ )
8
+
9
+
10
+ def warn_distutils_present():
11
+ if 'distutils' not in sys.modules:
12
+ return
13
+ import warnings
14
+
15
+ warnings.warn(
16
+ "Distutils was imported before Setuptools, but importing Setuptools "
17
+ "also replaces the `distutils` module in `sys.modules`. This may lead "
18
+ "to undesirable behaviors or errors. To avoid these issues, avoid "
19
+ "using distutils directly, ensure that setuptools is installed in the "
20
+ "traditional way (e.g. not an editable install), and/or make sure "
21
+ "that setuptools is always imported before distutils."
22
+ )
23
+
24
+
25
+ def clear_distutils():
26
+ if 'distutils' not in sys.modules:
27
+ return
28
+ import warnings
29
+
30
+ warnings.warn(
31
+ "Setuptools is replacing distutils. Support for replacing "
32
+ "an already imported distutils is deprecated. In the future, "
33
+ "this condition will fail. "
34
+ f"Register concerns at {report_url}"
35
+ )
36
+ mods = [
37
+ name
38
+ for name in sys.modules
39
+ if name == "distutils" or name.startswith("distutils.")
40
+ ]
41
+ for name in mods:
42
+ del sys.modules[name]
43
+
44
+
45
+ def enabled():
46
+ """
47
+ Allow selection of distutils by environment variable.
48
+ """
49
+ which = os.environ.get('SETUPTOOLS_USE_DISTUTILS', 'local')
50
+ if which == 'stdlib':
51
+ import warnings
52
+
53
+ warnings.warn(
54
+ "Reliance on distutils from stdlib is deprecated. Users "
55
+ "must rely on setuptools to provide the distutils module. "
56
+ "Avoid importing distutils or import setuptools first, "
57
+ "and avoid setting SETUPTOOLS_USE_DISTUTILS=stdlib. "
58
+ f"Register concerns at {report_url}"
59
+ )
60
+ return which == 'local'
61
+
62
+
63
+ def ensure_local_distutils():
64
+ import importlib
65
+
66
+ clear_distutils()
67
+
68
+ # With the DistutilsMetaFinder in place,
69
+ # perform an import to cause distutils to be
70
+ # loaded from setuptools._distutils. Ref #2906.
71
+ with shim():
72
+ importlib.import_module('distutils')
73
+
74
+ # check that submodules load as expected
75
+ core = importlib.import_module('distutils.core')
76
+ assert '_distutils' in core.__file__, core.__file__
77
+ assert 'setuptools._distutils.log' not in sys.modules
78
+
79
+
80
+ def do_override():
81
+ """
82
+ Ensure that the local copy of distutils is preferred over stdlib.
83
+
84
+ See https://github.com/pypa/setuptools/issues/417#issuecomment-392298401
85
+ for more motivation.
86
+ """
87
+ if enabled():
88
+ warn_distutils_present()
89
+ ensure_local_distutils()
90
+
91
+
92
+ class _TrivialRe:
93
+ def __init__(self, *patterns) -> None:
94
+ self._patterns = patterns
95
+
96
+ def match(self, string):
97
+ return all(pat in string for pat in self._patterns)
98
+
99
+
100
+ class DistutilsMetaFinder:
101
+ def find_spec(self, fullname, path, target=None):
102
+ # optimization: only consider top level modules and those
103
+ # found in the CPython test suite.
104
+ if path is not None and not fullname.startswith('test.'):
105
+ return None
106
+
107
+ method_name = 'spec_for_{fullname}'.format(**locals())
108
+ method = getattr(self, method_name, lambda: None)
109
+ return method()
110
+
111
+ def spec_for_distutils(self):
112
+ if self.is_cpython():
113
+ return None
114
+
115
+ import importlib
116
+ import importlib.abc
117
+ import importlib.util
118
+
119
+ try:
120
+ mod = importlib.import_module('setuptools._distutils')
121
+ except Exception:
122
+ # There are a couple of cases where setuptools._distutils
123
+ # may not be present:
124
+ # - An older Setuptools without a local distutils is
125
+ # taking precedence. Ref #2957.
126
+ # - Path manipulation during sitecustomize removes
127
+ # setuptools from the path but only after the hook
128
+ # has been loaded. Ref #2980.
129
+ # In either case, fall back to stdlib behavior.
130
+ return None
131
+
132
+ class DistutilsLoader(importlib.abc.Loader):
133
+ def create_module(self, spec):
134
+ mod.__name__ = 'distutils'
135
+ return mod
136
+
137
+ def exec_module(self, module):
138
+ pass
139
+
140
+ return importlib.util.spec_from_loader(
141
+ 'distutils', DistutilsLoader(), origin=mod.__file__
142
+ )
143
+
144
+ @staticmethod
145
+ def is_cpython():
146
+ """
147
+ Suppress supplying distutils for CPython (build and tests).
148
+ Ref #2965 and #3007.
149
+ """
150
+ return os.path.isfile('pybuilddir.txt')
151
+
152
+ def spec_for_pip(self):
153
+ """
154
+ Ensure stdlib distutils when running under pip.
155
+ See pypa/pip#8761 for rationale.
156
+ """
157
+ if sys.version_info >= (3, 12) or self.pip_imported_during_build():
158
+ return
159
+ clear_distutils()
160
+ self.spec_for_distutils = lambda: None
161
+
162
+ @classmethod
163
+ def pip_imported_during_build(cls):
164
+ """
165
+ Detect if pip is being imported in a build script. Ref #2355.
166
+ """
167
+ import traceback
168
+
169
+ return any(
170
+ cls.frame_file_is_setup(frame) for frame, line in traceback.walk_stack(None)
171
+ )
172
+
173
+ @staticmethod
174
+ def frame_file_is_setup(frame):
175
+ """
176
+ Return True if the indicated frame suggests a setup.py file.
177
+ """
178
+ # some frames may not have __file__ (#2940)
179
+ return frame.f_globals.get('__file__', '').endswith('setup.py')
180
+
181
+ def spec_for_sensitive_tests(self):
182
+ """
183
+ Ensure stdlib distutils when running select tests under CPython.
184
+
185
+ python/cpython#91169
186
+ """
187
+ clear_distutils()
188
+ self.spec_for_distutils = lambda: None
189
+
190
+ sensitive_tests = (
191
+ [
192
+ 'test.test_distutils',
193
+ 'test.test_peg_generator',
194
+ 'test.test_importlib',
195
+ ]
196
+ if sys.version_info < (3, 10)
197
+ else [
198
+ 'test.test_distutils',
199
+ ]
200
+ )
201
+
202
+
203
+ for name in DistutilsMetaFinder.sensitive_tests:
204
+ setattr(
205
+ DistutilsMetaFinder,
206
+ f'spec_for_{name}',
207
+ DistutilsMetaFinder.spec_for_sensitive_tests,
208
+ )
209
+
210
+
211
+ DISTUTILS_FINDER = DistutilsMetaFinder()
212
+
213
+
214
+ def add_shim():
215
+ DISTUTILS_FINDER in sys.meta_path or insert_shim()
216
+
217
+
218
+ class shim:
219
+ def __enter__(self) -> None:
220
+ insert_shim()
221
+
222
+ def __exit__(self, exc: object, value: object, tb: object) -> None:
223
+ _remove_shim()
224
+
225
+
226
+ def insert_shim():
227
+ sys.meta_path.insert(0, DISTUTILS_FINDER)
228
+
229
+
230
+ def _remove_shim():
231
+ try:
232
+ sys.meta_path.remove(DISTUTILS_FINDER)
233
+ except ValueError:
234
+ pass
235
+
236
+
237
+ if sys.version_info < (3, 12):
238
+ # DistutilsMetaFinder can only be disabled in Python < 3.12 (PEP 632)
239
+ remove_shim = _remove_shim
.venv/Lib/site-packages/_distutils_hack/override.py ADDED
@@ -0,0 +1 @@
 
 
1
+ __import__('_distutils_hack').do_override()
.venv/Lib/site-packages/_yaml/__init__.py ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # This is a stub package designed to roughly emulate the _yaml
2
+ # extension module, which previously existed as a standalone module
3
+ # and has been moved into the `yaml` package namespace.
4
+ # It does not perfectly mimic its old counterpart, but should get
5
+ # close enough for anyone who's relying on it even when they shouldn't.
6
+ import yaml
7
+
8
+ # in some circumstances, the yaml module we imoprted may be from a different version, so we need
9
+ # to tread carefully when poking at it here (it may not have the attributes we expect)
10
+ if not getattr(yaml, '__with_libyaml__', False):
11
+ from sys import version_info
12
+
13
+ exc = ModuleNotFoundError if version_info >= (3, 6) else ImportError
14
+ raise exc("No module named '_yaml'")
15
+ else:
16
+ from yaml._yaml import *
17
+ import warnings
18
+ warnings.warn(
19
+ 'The _yaml extension module is now located at yaml._yaml'
20
+ ' and its location is subject to change. To use the'
21
+ ' LibYAML-based parser and emitter, import from `yaml`:'
22
+ ' `from yaml import CLoader as Loader, CDumper as Dumper`.',
23
+ DeprecationWarning
24
+ )
25
+ del warnings
26
+ # Don't `del yaml` here because yaml is actually an existing
27
+ # namespace member of _yaml.
28
+
29
+ __name__ = '_yaml'
30
+ # If the module is top-level (i.e. not a part of any specific package)
31
+ # then the attribute should be set to ''.
32
+ # https://docs.python.org/3.8/library/types.html
33
+ __package__ = ''
.venv/Lib/site-packages/ada92cb5d92a588d1b93__mypyc.cp312-win_amd64.pyd ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2429203b0894bb0b90a4b372fe79bb42aa2b1754151d16e6a81d10dad688dfb0
3
+ size 227328
.venv/Lib/site-packages/aiohappyeyeballs-2.7.1.dist-info/INSTALLER ADDED
@@ -0,0 +1 @@
 
 
1
+ pip
.venv/Lib/site-packages/aiohappyeyeballs-2.7.1.dist-info/METADATA ADDED
@@ -0,0 +1,124 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Metadata-Version: 2.4
2
+ Name: aiohappyeyeballs
3
+ Version: 2.7.1
4
+ Summary: Happy Eyeballs for asyncio
5
+ License: PSF-2.0
6
+ License-File: LICENSE
7
+ Author: J. Nick Koston
8
+ Author-email: nick@koston.org
9
+ Requires-Python: >=3.10
10
+ Classifier: Development Status :: 5 - Production/Stable
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: Natural Language :: English
13
+ Classifier: Operating System :: OS Independent
14
+ Classifier: Topic :: Software Development :: Libraries
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Programming Language :: Python :: 3.13
20
+ Classifier: Programming Language :: Python :: 3.14
21
+ Classifier: License :: OSI Approved :: Python Software Foundation License
22
+ Project-URL: Bug Tracker, https://github.com/aio-libs/aiohappyeyeballs/issues
23
+ Project-URL: Changelog, https://github.com/aio-libs/aiohappyeyeballs/blob/main/CHANGELOG.md
24
+ Project-URL: Documentation, https://aiohappyeyeballs.readthedocs.io
25
+ Project-URL: Repository, https://github.com/aio-libs/aiohappyeyeballs
26
+ Description-Content-Type: text/markdown
27
+
28
+ # aiohappyeyeballs
29
+
30
+ <p align="center">
31
+ <a href="https://github.com/aio-libs/aiohappyeyeballs/actions/workflows/ci.yml?query=branch%3Amain">
32
+ <img src="https://img.shields.io/github/actions/workflow/status/aio-libs/aiohappyeyeballs/ci-cd.yml?branch=main&label=CI&logo=github&style=flat-square" alt="CI Status" >
33
+ </a>
34
+ <a href="https://aiohappyeyeballs.readthedocs.io">
35
+ <img src="https://img.shields.io/readthedocs/aiohappyeyeballs.svg?logo=read-the-docs&logoColor=fff&style=flat-square" alt="Documentation Status">
36
+ </a>
37
+ <a href="https://codecov.io/gh/aio-libs/aiohappyeyeballs">
38
+ <img src="https://img.shields.io/codecov/c/github/aio-libs/aiohappyeyeballs.svg?logo=codecov&logoColor=fff&style=flat-square" alt="Test coverage percentage">
39
+ </a>
40
+ </p>
41
+ <p align="center">
42
+ <a href="https://python-poetry.org/">
43
+ <img src="https://img.shields.io/badge/packaging-poetry-299bd7?style=flat-square&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAASCAYAAABrXO8xAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAJJSURBVHgBfZLPa1NBEMe/s7tNXoxW1KJQKaUHkXhQvHgW6UHQQ09CBS/6V3hKc/AP8CqCrUcpmop3Cx48eDB4yEECjVQrlZb80CRN8t6OM/teagVxYZi38+Yz853dJbzoMV3MM8cJUcLMSUKIE8AzQ2PieZzFxEJOHMOgMQQ+dUgSAckNXhapU/NMhDSWLs1B24A8sO1xrN4NECkcAC9ASkiIJc6k5TRiUDPhnyMMdhKc+Zx19l6SgyeW76BEONY9exVQMzKExGKwwPsCzza7KGSSWRWEQhyEaDXp6ZHEr416ygbiKYOd7TEWvvcQIeusHYMJGhTwF9y7sGnSwaWyFAiyoxzqW0PM/RjghPxF2pWReAowTEXnDh0xgcLs8l2YQmOrj3N7ByiqEoH0cARs4u78WgAVkoEDIDoOi3AkcLOHU60RIg5wC4ZuTC7FaHKQm8Hq1fQuSOBvX/sodmNJSB5geaF5CPIkUeecdMxieoRO5jz9bheL6/tXjrwCyX/UYBUcjCaWHljx1xiX6z9xEjkYAzbGVnB8pvLmyXm9ep+W8CmsSHQQY77Zx1zboxAV0w7ybMhQmfqdmmw3nEp1I0Z+FGO6M8LZdoyZnuzzBdjISicKRnpxzI9fPb+0oYXsNdyi+d3h9bm9MWYHFtPeIZfLwzmFDKy1ai3p+PDls1Llz4yyFpferxjnyjJDSEy9CaCx5m2cJPerq6Xm34eTrZt3PqxYO1XOwDYZrFlH1fWnpU38Y9HRze3lj0vOujZcXKuuXm3jP+s3KbZVra7y2EAAAAAASUVORK5CYII=" alt="Poetry">
44
+ </a>
45
+ <a href="https://github.com/astral-sh/ruff">
46
+ <img src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json" alt="Ruff">
47
+ </a>
48
+ <a href="https://github.com/pre-commit/pre-commit">
49
+ <img src="https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white&style=flat-square" alt="pre-commit">
50
+ </a>
51
+ </p>
52
+ <p align="center">
53
+ <a href="https://pypi.org/project/aiohappyeyeballs/">
54
+ <img src="https://img.shields.io/pypi/v/aiohappyeyeballs.svg?logo=python&logoColor=fff&style=flat-square" alt="PyPI Version">
55
+ </a>
56
+ <img src="https://img.shields.io/pypi/pyversions/aiohappyeyeballs.svg?style=flat-square&logo=python&amp;logoColor=fff" alt="Supported Python versions">
57
+ <img src="https://img.shields.io/pypi/l/aiohappyeyeballs.svg?style=flat-square" alt="License">
58
+ </p>
59
+
60
+ ---
61
+
62
+ **Documentation**: <a href="https://aiohappyeyeballs.readthedocs.io" target="_blank">https://aiohappyeyeballs.readthedocs.io </a>
63
+
64
+ **Source Code**: <a href="https://github.com/aio-libs/aiohappyeyeballs" target="_blank">https://github.com/aio-libs/aiohappyeyeballs </a>
65
+
66
+ ---
67
+
68
+ [Happy Eyeballs](https://en.wikipedia.org/wiki/Happy_Eyeballs)
69
+ ([RFC 8305](https://www.rfc-editor.org/rfc/rfc8305.html))
70
+
71
+ ## Use case
72
+
73
+ This library exists to allow connecting with
74
+ [Happy Eyeballs](https://en.wikipedia.org/wiki/Happy_Eyeballs)
75
+ ([RFC 8305](https://www.rfc-editor.org/rfc/rfc8305.html))
76
+ when you
77
+ already have a list of addrinfo and not a DNS name.
78
+
79
+ The stdlib version of `loop.create_connection()`
80
+ will only work when you pass in an unresolved name which
81
+ is not a good fit when using DNS caching or resolving
82
+ names via another method such as `zeroconf`.
83
+
84
+ ## Installation
85
+
86
+ Install this via pip (or your favourite package manager):
87
+
88
+ `pip install aiohappyeyeballs`
89
+
90
+ ## License
91
+
92
+ [aiohappyeyeballs is licensed under the same terms as cpython itself.](https://github.com/python/cpython/blob/main/LICENSE)
93
+
94
+ ## Example usage
95
+
96
+ ```python
97
+
98
+ addr_infos = await loop.getaddrinfo("example.org", 80)
99
+
100
+ socket = await start_connection(addr_infos)
101
+ socket = await start_connection(addr_infos, local_addr_infos=local_addr_infos, happy_eyeballs_delay=0.2)
102
+
103
+ transport, protocol = await loop.create_connection(
104
+ MyProtocol, sock=socket, ...)
105
+
106
+ # Remove the first address for each family from addr_info
107
+ pop_addr_infos_interleave(addr_info, 1)
108
+
109
+ # Remove all matching address from addr_info
110
+ remove_addr_infos(addr_info, "dead::beef::")
111
+
112
+ # Convert a local_addr to local_addr_infos
113
+ local_addr_infos = addr_to_addr_infos(("127.0.0.1",0))
114
+ ```
115
+
116
+ ## Credits
117
+
118
+ This package contains code from cpython and is licensed under the same terms as cpython itself.
119
+
120
+ This package was created with
121
+ [Copier](https://copier.readthedocs.io/) and the
122
+ [browniebroke/pypackage-template](https://github.com/browniebroke/pypackage-template)
123
+ project template.
124
+
.venv/Lib/site-packages/aiohappyeyeballs-2.7.1.dist-info/RECORD ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ aiohappyeyeballs-2.7.1.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
2
+ aiohappyeyeballs-2.7.1.dist-info/METADATA,sha256=5o0b9IrsncwnZzQ97ewl4ShgCFy6GA4QvD073QMWAro,5939
3
+ aiohappyeyeballs-2.7.1.dist-info/RECORD,,
4
+ aiohappyeyeballs-2.7.1.dist-info/WHEEL,sha256=EGEvSphFYqXKs23-kQBeyNoJP1nrT8ZJKQoi5p5DYL8,88
5
+ aiohappyeyeballs-2.7.1.dist-info/licenses/LICENSE,sha256=Oy-B_iHRgcSZxZolbI4ZaEVdZonSaaqFNzv7avQdo78,13936
6
+ aiohappyeyeballs/__init__.py,sha256=8w-_mfeT7HGtbbPFKDghpr8OGsQ2U3_yfZCXAnZ0RCs,361
7
+ aiohappyeyeballs/__pycache__/__init__.cpython-312.pyc,,
8
+ aiohappyeyeballs/__pycache__/_staggered.cpython-312.pyc,,
9
+ aiohappyeyeballs/__pycache__/impl.cpython-312.pyc,,
10
+ aiohappyeyeballs/__pycache__/types.cpython-312.pyc,,
11
+ aiohappyeyeballs/__pycache__/utils.cpython-312.pyc,,
12
+ aiohappyeyeballs/_staggered.py,sha256=aj3cSwHEDX88UMfO9bUau9tfrRAszhjg99dpEMiAOGM,6698
13
+ aiohappyeyeballs/impl.py,sha256=6zK3ukqieZP-GH3rVs8Wr438tPv-Y7T1hGgCygKmS7I,9301
14
+ aiohappyeyeballs/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
15
+ aiohappyeyeballs/types.py,sha256=_8JmHFix6MeM1e7hRP7BleEaGy93GswGtzQv068zKY8,288
16
+ aiohappyeyeballs/utils.py,sha256=wFHV8epGMqIrC9pqofTO4qloBld14GPvVb5Spb25HJI,2561
.venv/Lib/site-packages/aiohappyeyeballs-2.7.1.dist-info/WHEEL ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ Wheel-Version: 1.0
2
+ Generator: poetry-core 2.4.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
.venv/Lib/site-packages/aiohappyeyeballs-2.7.1.dist-info/licenses/LICENSE ADDED
@@ -0,0 +1,279 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ A. HISTORY OF THE SOFTWARE
2
+ ==========================
3
+
4
+ Python was created in the early 1990s by Guido van Rossum at Stichting
5
+ Mathematisch Centrum (CWI, see https://www.cwi.nl) in the Netherlands
6
+ as a successor of a language called ABC. Guido remains Python's
7
+ principal author, although it includes many contributions from others.
8
+
9
+ In 1995, Guido continued his work on Python at the Corporation for
10
+ National Research Initiatives (CNRI, see https://www.cnri.reston.va.us)
11
+ in Reston, Virginia where he released several versions of the
12
+ software.
13
+
14
+ In May 2000, Guido and the Python core development team moved to
15
+ BeOpen.com to form the BeOpen PythonLabs team. In October of the same
16
+ year, the PythonLabs team moved to Digital Creations, which became
17
+ Zope Corporation. In 2001, the Python Software Foundation (PSF, see
18
+ https://www.python.org/psf/) was formed, a non-profit organization
19
+ created specifically to own Python-related Intellectual Property.
20
+ Zope Corporation was a sponsoring member of the PSF.
21
+
22
+ All Python releases are Open Source (see https://opensource.org for
23
+ the Open Source Definition). Historically, most, but not all, Python
24
+ releases have also been GPL-compatible; the table below summarizes
25
+ the various releases.
26
+
27
+ Release Derived Year Owner GPL-
28
+ from compatible? (1)
29
+
30
+ 0.9.0 thru 1.2 1991-1995 CWI yes
31
+ 1.3 thru 1.5.2 1.2 1995-1999 CNRI yes
32
+ 1.6 1.5.2 2000 CNRI no
33
+ 2.0 1.6 2000 BeOpen.com no
34
+ 1.6.1 1.6 2001 CNRI yes (2)
35
+ 2.1 2.0+1.6.1 2001 PSF no
36
+ 2.0.1 2.0+1.6.1 2001 PSF yes
37
+ 2.1.1 2.1+2.0.1 2001 PSF yes
38
+ 2.1.2 2.1.1 2002 PSF yes
39
+ 2.1.3 2.1.2 2002 PSF yes
40
+ 2.2 and above 2.1.1 2001-now PSF yes
41
+
42
+ Footnotes:
43
+
44
+ (1) GPL-compatible doesn't mean that we're distributing Python under
45
+ the GPL. All Python licenses, unlike the GPL, let you distribute
46
+ a modified version without making your changes open source. The
47
+ GPL-compatible licenses make it possible to combine Python with
48
+ other software that is released under the GPL; the others don't.
49
+
50
+ (2) According to Richard Stallman, 1.6.1 is not GPL-compatible,
51
+ because its license has a choice of law clause. According to
52
+ CNRI, however, Stallman's lawyer has told CNRI's lawyer that 1.6.1
53
+ is "not incompatible" with the GPL.
54
+
55
+ Thanks to the many outside volunteers who have worked under Guido's
56
+ direction to make these releases possible.
57
+
58
+
59
+ B. TERMS AND CONDITIONS FOR ACCESSING OR OTHERWISE USING PYTHON
60
+ ===============================================================
61
+
62
+ Python software and documentation are licensed under the
63
+ Python Software Foundation License Version 2.
64
+
65
+ Starting with Python 3.8.6, examples, recipes, and other code in
66
+ the documentation are dual licensed under the PSF License Version 2
67
+ and the Zero-Clause BSD license.
68
+
69
+ Some software incorporated into Python is under different licenses.
70
+ The licenses are listed with code falling under that license.
71
+
72
+
73
+ PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2
74
+ --------------------------------------------
75
+
76
+ 1. This LICENSE AGREEMENT is between the Python Software Foundation
77
+ ("PSF"), and the Individual or Organization ("Licensee") accessing and
78
+ otherwise using this software ("Python") in source or binary form and
79
+ its associated documentation.
80
+
81
+ 2. Subject to the terms and conditions of this License Agreement, PSF hereby
82
+ grants Licensee a nonexclusive, royalty-free, world-wide license to reproduce,
83
+ analyze, test, perform and/or display publicly, prepare derivative works,
84
+ distribute, and otherwise use Python alone or in any derivative version,
85
+ provided, however, that PSF's License Agreement and PSF's notice of copyright,
86
+ i.e., "Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
87
+ 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023 Python Software Foundation;
88
+ All Rights Reserved" are retained in Python alone or in any derivative version
89
+ prepared by Licensee.
90
+
91
+ 3. In the event Licensee prepares a derivative work that is based on
92
+ or incorporates Python or any part thereof, and wants to make
93
+ the derivative work available to others as provided herein, then
94
+ Licensee hereby agrees to include in any such work a brief summary of
95
+ the changes made to Python.
96
+
97
+ 4. PSF is making Python available to Licensee on an "AS IS"
98
+ basis. PSF MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR
99
+ IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, PSF MAKES NO AND
100
+ DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS
101
+ FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON WILL NOT
102
+ INFRINGE ANY THIRD PARTY RIGHTS.
103
+
104
+ 5. PSF SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON
105
+ FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS
106
+ A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON,
107
+ OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.
108
+
109
+ 6. This License Agreement will automatically terminate upon a material
110
+ breach of its terms and conditions.
111
+
112
+ 7. Nothing in this License Agreement shall be deemed to create any
113
+ relationship of agency, partnership, or joint venture between PSF and
114
+ Licensee. This License Agreement does not grant permission to use PSF
115
+ trademarks or trade name in a trademark sense to endorse or promote
116
+ products or services of Licensee, or any third party.
117
+
118
+ 8. By copying, installing or otherwise using Python, Licensee
119
+ agrees to be bound by the terms and conditions of this License
120
+ Agreement.
121
+
122
+
123
+ BEOPEN.COM LICENSE AGREEMENT FOR PYTHON 2.0
124
+ -------------------------------------------
125
+
126
+ BEOPEN PYTHON OPEN SOURCE LICENSE AGREEMENT VERSION 1
127
+
128
+ 1. This LICENSE AGREEMENT is between BeOpen.com ("BeOpen"), having an
129
+ office at 160 Saratoga Avenue, Santa Clara, CA 95051, and the
130
+ Individual or Organization ("Licensee") accessing and otherwise using
131
+ this software in source or binary form and its associated
132
+ documentation ("the Software").
133
+
134
+ 2. Subject to the terms and conditions of this BeOpen Python License
135
+ Agreement, BeOpen hereby grants Licensee a non-exclusive,
136
+ royalty-free, world-wide license to reproduce, analyze, test, perform
137
+ and/or display publicly, prepare derivative works, distribute, and
138
+ otherwise use the Software alone or in any derivative version,
139
+ provided, however, that the BeOpen Python License is retained in the
140
+ Software, alone or in any derivative version prepared by Licensee.
141
+
142
+ 3. BeOpen is making the Software available to Licensee on an "AS IS"
143
+ basis. BEOPEN MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR
144
+ IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, BEOPEN MAKES NO AND
145
+ DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS
146
+ FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE SOFTWARE WILL NOT
147
+ INFRINGE ANY THIRD PARTY RIGHTS.
148
+
149
+ 4. BEOPEN SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF THE
150
+ SOFTWARE FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS
151
+ AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THE SOFTWARE, OR ANY
152
+ DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.
153
+
154
+ 5. This License Agreement will automatically terminate upon a material
155
+ breach of its terms and conditions.
156
+
157
+ 6. This License Agreement shall be governed by and interpreted in all
158
+ respects by the law of the State of California, excluding conflict of
159
+ law provisions. Nothing in this License Agreement shall be deemed to
160
+ create any relationship of agency, partnership, or joint venture
161
+ between BeOpen and Licensee. This License Agreement does not grant
162
+ permission to use BeOpen trademarks or trade names in a trademark
163
+ sense to endorse or promote products or services of Licensee, or any
164
+ third party. As an exception, the "BeOpen Python" logos available at
165
+ http://www.pythonlabs.com/logos.html may be used according to the
166
+ permissions granted on that web page.
167
+
168
+ 7. By copying, installing or otherwise using the software, Licensee
169
+ agrees to be bound by the terms and conditions of this License
170
+ Agreement.
171
+
172
+
173
+ CNRI LICENSE AGREEMENT FOR PYTHON 1.6.1
174
+ ---------------------------------------
175
+
176
+ 1. This LICENSE AGREEMENT is between the Corporation for National
177
+ Research Initiatives, having an office at 1895 Preston White Drive,
178
+ Reston, VA 20191 ("CNRI"), and the Individual or Organization
179
+ ("Licensee") accessing and otherwise using Python 1.6.1 software in
180
+ source or binary form and its associated documentation.
181
+
182
+ 2. Subject to the terms and conditions of this License Agreement, CNRI
183
+ hereby grants Licensee a nonexclusive, royalty-free, world-wide
184
+ license to reproduce, analyze, test, perform and/or display publicly,
185
+ prepare derivative works, distribute, and otherwise use Python 1.6.1
186
+ alone or in any derivative version, provided, however, that CNRI's
187
+ License Agreement and CNRI's notice of copyright, i.e., "Copyright (c)
188
+ 1995-2001 Corporation for National Research Initiatives; All Rights
189
+ Reserved" are retained in Python 1.6.1 alone or in any derivative
190
+ version prepared by Licensee. Alternately, in lieu of CNRI's License
191
+ Agreement, Licensee may substitute the following text (omitting the
192
+ quotes): "Python 1.6.1 is made available subject to the terms and
193
+ conditions in CNRI's License Agreement. This Agreement together with
194
+ Python 1.6.1 may be located on the internet using the following
195
+ unique, persistent identifier (known as a handle): 1895.22/1013. This
196
+ Agreement may also be obtained from a proxy server on the internet
197
+ using the following URL: http://hdl.handle.net/1895.22/1013".
198
+
199
+ 3. In the event Licensee prepares a derivative work that is based on
200
+ or incorporates Python 1.6.1 or any part thereof, and wants to make
201
+ the derivative work available to others as provided herein, then
202
+ Licensee hereby agrees to include in any such work a brief summary of
203
+ the changes made to Python 1.6.1.
204
+
205
+ 4. CNRI is making Python 1.6.1 available to Licensee on an "AS IS"
206
+ basis. CNRI MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR
207
+ IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, CNRI MAKES NO AND
208
+ DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS
209
+ FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON 1.6.1 WILL NOT
210
+ INFRINGE ANY THIRD PARTY RIGHTS.
211
+
212
+ 5. CNRI SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON
213
+ 1.6.1 FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS
214
+ A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON 1.6.1,
215
+ OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.
216
+
217
+ 6. This License Agreement will automatically terminate upon a material
218
+ breach of its terms and conditions.
219
+
220
+ 7. This License Agreement shall be governed by the federal
221
+ intellectual property law of the United States, including without
222
+ limitation the federal copyright law, and, to the extent such
223
+ U.S. federal law does not apply, by the law of the Commonwealth of
224
+ Virginia, excluding Virginia's conflict of law provisions.
225
+ Notwithstanding the foregoing, with regard to derivative works based
226
+ on Python 1.6.1 that incorporate non-separable material that was
227
+ previously distributed under the GNU General Public License (GPL), the
228
+ law of the Commonwealth of Virginia shall govern this License
229
+ Agreement only as to issues arising under or with respect to
230
+ Paragraphs 4, 5, and 7 of this License Agreement. Nothing in this
231
+ License Agreement shall be deemed to create any relationship of
232
+ agency, partnership, or joint venture between CNRI and Licensee. This
233
+ License Agreement does not grant permission to use CNRI trademarks or
234
+ trade name in a trademark sense to endorse or promote products or
235
+ services of Licensee, or any third party.
236
+
237
+ 8. By clicking on the "ACCEPT" button where indicated, or by copying,
238
+ installing or otherwise using Python 1.6.1, Licensee agrees to be
239
+ bound by the terms and conditions of this License Agreement.
240
+
241
+ ACCEPT
242
+
243
+
244
+ CWI LICENSE AGREEMENT FOR PYTHON 0.9.0 THROUGH 1.2
245
+ --------------------------------------------------
246
+
247
+ Copyright (c) 1991 - 1995, Stichting Mathematisch Centrum Amsterdam,
248
+ The Netherlands. All rights reserved.
249
+
250
+ Permission to use, copy, modify, and distribute this software and its
251
+ documentation for any purpose and without fee is hereby granted,
252
+ provided that the above copyright notice appear in all copies and that
253
+ both that copyright notice and this permission notice appear in
254
+ supporting documentation, and that the name of Stichting Mathematisch
255
+ Centrum or CWI not be used in advertising or publicity pertaining to
256
+ distribution of the software without specific, written prior
257
+ permission.
258
+
259
+ STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO
260
+ THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
261
+ FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE
262
+ FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
263
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
264
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
265
+ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
266
+
267
+ ZERO-CLAUSE BSD LICENSE FOR CODE IN THE PYTHON DOCUMENTATION
268
+ ----------------------------------------------------------------------
269
+
270
+ Permission to use, copy, modify, and/or distribute this software for any
271
+ purpose with or without fee is hereby granted.
272
+
273
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
274
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
275
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
276
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
277
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
278
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
279
+ PERFORMANCE OF THIS SOFTWARE.
.venv/Lib/site-packages/aiohappyeyeballs/__init__.py ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ __version__ = "2.7.1"
2
+
3
+ from .impl import start_connection
4
+ from .types import AddrInfoType, SocketFactoryType
5
+ from .utils import addr_to_addr_infos, pop_addr_infos_interleave, remove_addr_infos
6
+
7
+ __all__ = (
8
+ "AddrInfoType",
9
+ "SocketFactoryType",
10
+ "addr_to_addr_infos",
11
+ "pop_addr_infos_interleave",
12
+ "remove_addr_infos",
13
+ "start_connection",
14
+ )
.venv/Lib/site-packages/aiohappyeyeballs/_staggered.py ADDED
@@ -0,0 +1,197 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import asyncio
2
+ import contextlib
3
+ from collections.abc import Awaitable, Callable, Iterable
4
+ from typing import (
5
+ TYPE_CHECKING,
6
+ Any,
7
+ TypeVar,
8
+ )
9
+
10
+ _T = TypeVar("_T")
11
+
12
+ RE_RAISE_EXCEPTIONS = (SystemExit, KeyboardInterrupt)
13
+
14
+
15
+ def _set_result(wait_next: "asyncio.Future[None]") -> None:
16
+ """Set the result of a future if it is not already done."""
17
+ if not wait_next.done():
18
+ wait_next.set_result(None)
19
+
20
+
21
+ async def _wait_one(
22
+ futures: "Iterable[asyncio.Future[Any]]",
23
+ loop: asyncio.AbstractEventLoop,
24
+ ) -> _T:
25
+ """Wait for the first future to complete."""
26
+ wait_next = loop.create_future()
27
+
28
+ def _on_completion(fut: "asyncio.Future[Any]") -> None:
29
+ if not wait_next.done():
30
+ wait_next.set_result(fut)
31
+
32
+ for f in futures:
33
+ f.add_done_callback(_on_completion)
34
+
35
+ try:
36
+ return await wait_next
37
+ finally:
38
+ for f in futures:
39
+ f.remove_done_callback(_on_completion)
40
+
41
+
42
+ async def staggered_race(
43
+ coro_fns: Iterable[Callable[[], Awaitable[_T]]],
44
+ delay: float | None,
45
+ *,
46
+ loop: asyncio.AbstractEventLoop | None = None,
47
+ ) -> tuple[_T | None, int | None, list[BaseException | None]]:
48
+ """
49
+ Run coroutines with staggered start times and take the first to finish.
50
+
51
+ This method takes an iterable of coroutine functions. The first one is
52
+ started immediately. From then on, whenever the immediately preceding one
53
+ fails (raises an exception), or when *delay* seconds has passed, the next
54
+ coroutine is started. This continues until one of the coroutines complete
55
+ successfully, in which case all others are cancelled, or until all
56
+ coroutines fail.
57
+
58
+ The coroutines provided should be well-behaved in the following way:
59
+
60
+ * They should only ``return`` if completed successfully.
61
+
62
+ * They should always raise an exception if they did not complete
63
+ successfully. In particular, if they handle cancellation, they should
64
+ probably reraise, like this::
65
+
66
+ try:
67
+ # do work
68
+ except asyncio.CancelledError:
69
+ # undo partially completed work
70
+ raise
71
+
72
+ Args:
73
+ ----
74
+ coro_fns: an iterable of coroutine functions, i.e. callables that
75
+ return a coroutine object when called. Use ``functools.partial`` or
76
+ lambdas to pass arguments.
77
+
78
+ delay: amount of time, in seconds, between starting coroutines. If
79
+ ``None``, the coroutines will run sequentially.
80
+
81
+ loop: the event loop to use. If ``None``, the running loop is used.
82
+
83
+ Returns:
84
+ -------
85
+ tuple *(winner_result, winner_index, exceptions)* where
86
+
87
+ - *winner_result*: the result of the winning coroutine, or ``None``
88
+ if no coroutines won.
89
+
90
+ - *winner_index*: the index of the winning coroutine in
91
+ ``coro_fns``, or ``None`` if no coroutines won. If the winning
92
+ coroutine may return None on success, *winner_index* can be used
93
+ to definitively determine whether any coroutine won.
94
+
95
+ - *exceptions*: list of exceptions returned by the coroutines.
96
+ ``len(exceptions)`` is equal to the number of coroutines actually
97
+ started, and the order is the same as in ``coro_fns``. The winning
98
+ coroutine's entry is ``None``.
99
+
100
+ """
101
+ loop = loop or asyncio.get_running_loop()
102
+ exceptions: list[BaseException | None] = []
103
+ tasks: set[asyncio.Task[tuple[_T, int] | None]] = set()
104
+
105
+ async def run_one_coro(
106
+ coro_fn: Callable[[], Awaitable[_T]],
107
+ this_index: int,
108
+ start_next: "asyncio.Future[None]",
109
+ ) -> tuple[_T, int] | None:
110
+ """
111
+ Run a single coroutine.
112
+
113
+ If the coroutine fails, set the exception in the exceptions list and
114
+ start the next coroutine by setting the result of the start_next.
115
+
116
+ If the coroutine succeeds, return the result and the index of the
117
+ coroutine in the coro_fns list.
118
+
119
+ If SystemExit or KeyboardInterrupt is raised, re-raise it.
120
+ """
121
+ try:
122
+ result = await coro_fn()
123
+ except RE_RAISE_EXCEPTIONS:
124
+ raise
125
+ except BaseException as e:
126
+ exceptions[this_index] = e
127
+ _set_result(start_next) # Kickstart the next coroutine
128
+ return None
129
+
130
+ return result, this_index
131
+
132
+ start_next_timer: asyncio.TimerHandle | None = None
133
+ start_next: asyncio.Future[None] | None
134
+ task: asyncio.Task[tuple[_T, int] | None]
135
+ done: asyncio.Future[None] | asyncio.Task[tuple[_T, int] | None]
136
+ coro_iter = iter(coro_fns)
137
+ this_index = -1
138
+ try:
139
+ while True:
140
+ if coro_fn := next(coro_iter, None):
141
+ this_index += 1
142
+ exceptions.append(None)
143
+ start_next = loop.create_future()
144
+ task = loop.create_task(run_one_coro(coro_fn, this_index, start_next))
145
+ tasks.add(task)
146
+ start_next_timer = (
147
+ loop.call_later(delay, _set_result, start_next) if delay else None
148
+ )
149
+ elif not tasks:
150
+ # We exhausted the coro_fns list and no tasks are running
151
+ # so we have no winner and all coroutines failed.
152
+ break
153
+
154
+ while tasks or start_next:
155
+ done = await _wait_one(
156
+ (*tasks, start_next) if start_next else tasks, loop
157
+ )
158
+ if done is start_next:
159
+ # The current task has failed or the timer has expired
160
+ # so we need to start the next task.
161
+ start_next = None
162
+ if start_next_timer:
163
+ start_next_timer.cancel()
164
+ start_next_timer = None
165
+
166
+ # Break out of the task waiting loop to start the next
167
+ # task.
168
+ break
169
+
170
+ if TYPE_CHECKING:
171
+ assert isinstance(done, asyncio.Task)
172
+
173
+ tasks.remove(done)
174
+ if winner := done.result():
175
+ return *winner, exceptions
176
+ finally:
177
+ # We either have:
178
+ # - a winner
179
+ # - all tasks failed
180
+ # - a KeyboardInterrupt or SystemExit.
181
+
182
+ #
183
+ # If the timer is still running, cancel it.
184
+ #
185
+ if start_next_timer:
186
+ start_next_timer.cancel()
187
+
188
+ #
189
+ # If there are any tasks left, cancel them and than
190
+ # wait them so they fill the exceptions list.
191
+ #
192
+ for task in tasks:
193
+ task.cancel()
194
+ with contextlib.suppress(asyncio.CancelledError):
195
+ await task
196
+
197
+ return None, None, exceptions
.venv/Lib/site-packages/aiohappyeyeballs/impl.py ADDED
@@ -0,0 +1,247 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Base implementation."""
2
+
3
+ import asyncio
4
+ import contextlib
5
+ import functools
6
+ import itertools
7
+ import socket
8
+ from collections import defaultdict
9
+ from collections.abc import Sequence
10
+
11
+ from . import _staggered
12
+ from .types import AddrInfoType, SocketFactoryType
13
+
14
+
15
+ async def start_connection(
16
+ addr_infos: Sequence[AddrInfoType],
17
+ *,
18
+ local_addr_infos: Sequence[AddrInfoType] | None = None,
19
+ happy_eyeballs_delay: float | None = None,
20
+ interleave: int | None = None,
21
+ loop: asyncio.AbstractEventLoop | None = None,
22
+ socket_factory: SocketFactoryType | None = None,
23
+ ) -> socket.socket:
24
+ """
25
+ Connect to a TCP server.
26
+
27
+ Create a socket connection to a specified destination. The
28
+ destination is specified as a list of AddrInfoType tuples as
29
+ returned from getaddrinfo().
30
+
31
+ The arguments are, in order:
32
+
33
+ * ``family``: the address family, e.g. ``socket.AF_INET`` or
34
+ ``socket.AF_INET6``.
35
+ * ``type``: the socket type, e.g. ``socket.SOCK_STREAM`` or
36
+ ``socket.SOCK_DGRAM``.
37
+ * ``proto``: the protocol, e.g. ``socket.IPPROTO_TCP`` or
38
+ ``socket.IPPROTO_UDP``.
39
+ * ``canonname``: the canonical name of the address, e.g.
40
+ ``"www.python.org"``.
41
+ * ``sockaddr``: the socket address
42
+
43
+ This method is a coroutine which will try to establish the connection
44
+ in the background. When successful, the coroutine returns a
45
+ socket.
46
+
47
+ The expected use case is to use this method in conjunction with
48
+ loop.create_connection() to establish a connection to a server::
49
+
50
+ socket = await start_connection(addr_infos)
51
+ transport, protocol = await loop.create_connection(
52
+ MyProtocol, sock=socket, ...)
53
+ """
54
+ if not addr_infos:
55
+ raise ValueError("addr_infos must not be empty")
56
+
57
+ current_loop = loop or asyncio.get_running_loop()
58
+
59
+ single_addr_info = len(addr_infos) == 1
60
+
61
+ if happy_eyeballs_delay is not None and interleave is None:
62
+ # If using happy eyeballs, default to interleave addresses by family
63
+ interleave = 1
64
+
65
+ if interleave and not single_addr_info:
66
+ addr_infos = _interleave_addrinfos(addr_infos, interleave)
67
+
68
+ sock: socket.socket | None = None
69
+ # uvloop can raise RuntimeError instead of OSError
70
+ exceptions: list[list[OSError | RuntimeError]] = []
71
+ if happy_eyeballs_delay is None or single_addr_info:
72
+ # not using happy eyeballs
73
+ for addrinfo in addr_infos:
74
+ try:
75
+ sock = await _connect_sock(
76
+ current_loop,
77
+ exceptions,
78
+ addrinfo,
79
+ local_addr_infos,
80
+ None,
81
+ socket_factory,
82
+ )
83
+ break
84
+ except (RuntimeError, OSError):
85
+ continue
86
+ else: # using happy eyeballs
87
+ open_sockets: set[socket.socket] = set()
88
+ try:
89
+ sock, _, _ = await _staggered.staggered_race(
90
+ (
91
+ functools.partial(
92
+ _connect_sock,
93
+ current_loop,
94
+ exceptions,
95
+ addrinfo,
96
+ local_addr_infos,
97
+ open_sockets,
98
+ socket_factory,
99
+ )
100
+ for addrinfo in addr_infos
101
+ ),
102
+ happy_eyeballs_delay,
103
+ )
104
+ finally:
105
+ # If we have a winner, staggered_race will
106
+ # cancel the other tasks, however there is a
107
+ # small race window where any of the other tasks
108
+ # can be done before they are cancelled which
109
+ # will leave the socket open. To avoid this problem
110
+ # we pass a set to _connect_sock to keep track of
111
+ # the open sockets and close them here if there
112
+ # are any "runner up" sockets.
113
+ for s in open_sockets:
114
+ if s is not sock:
115
+ with contextlib.suppress(OSError):
116
+ s.close()
117
+ open_sockets = None # type: ignore[assignment]
118
+
119
+ if sock is None:
120
+ all_exceptions = [exc for sub in exceptions for exc in sub]
121
+ try:
122
+ first_exception = all_exceptions[0]
123
+ if len(all_exceptions) == 1:
124
+ raise first_exception
125
+ else:
126
+ # If they all have the same str(), raise one.
127
+ model = str(first_exception)
128
+ if all(str(exc) == model for exc in all_exceptions):
129
+ raise first_exception
130
+ # Raise a combined exception so the user can see all
131
+ # the various error messages.
132
+ msg = "Multiple exceptions: {}".format(
133
+ ", ".join(str(exc) for exc in all_exceptions)
134
+ )
135
+ # If the errno is the same for all exceptions, raise
136
+ # an OSError with that errno.
137
+ if isinstance(first_exception, OSError):
138
+ first_errno = first_exception.errno
139
+ if all(
140
+ isinstance(exc, OSError) and exc.errno == first_errno
141
+ for exc in all_exceptions
142
+ ):
143
+ raise OSError(first_errno, msg)
144
+ elif isinstance(first_exception, RuntimeError) and all(
145
+ isinstance(exc, RuntimeError) for exc in all_exceptions
146
+ ):
147
+ raise RuntimeError(msg)
148
+ # We have a mix of OSError and RuntimeError
149
+ # so we have to pick which one to raise.
150
+ # and we raise OSError for compatibility
151
+ raise OSError(msg)
152
+ finally:
153
+ all_exceptions = None # type: ignore[assignment]
154
+ exceptions = None # type: ignore[assignment]
155
+
156
+ return sock
157
+
158
+
159
+ async def _connect_sock(
160
+ loop: asyncio.AbstractEventLoop,
161
+ exceptions: list[list[OSError | RuntimeError]],
162
+ addr_info: AddrInfoType,
163
+ local_addr_infos: Sequence[AddrInfoType] | None = None,
164
+ open_sockets: set[socket.socket] | None = None,
165
+ socket_factory: SocketFactoryType | None = None,
166
+ ) -> socket.socket:
167
+ """
168
+ Create, bind and connect one socket.
169
+
170
+ If open_sockets is passed, add the socket to the set of open sockets.
171
+ Any failure caught here will remove the socket from the set and close it.
172
+
173
+ Callers can use this set to close any sockets that are not the winner
174
+ of all staggered tasks in the result there are runner up sockets aka
175
+ multiple winners.
176
+ """
177
+ my_exceptions: list[OSError | RuntimeError] = []
178
+ exceptions.append(my_exceptions)
179
+ family, type_, proto, _, address = addr_info
180
+ sock = None
181
+ try:
182
+ if socket_factory is not None:
183
+ sock = socket_factory(addr_info)
184
+ else:
185
+ sock = socket.socket(family=family, type=type_, proto=proto)
186
+ if open_sockets is not None:
187
+ open_sockets.add(sock)
188
+ sock.setblocking(False)
189
+ if local_addr_infos is not None:
190
+ for lfamily, _, _, _, laddr in local_addr_infos:
191
+ # skip local addresses of different family
192
+ if lfamily != family:
193
+ continue
194
+ try:
195
+ sock.bind(laddr)
196
+ break
197
+ except OSError as exc:
198
+ msg = (
199
+ f"error while attempting to bind on "
200
+ f"address {laddr!r}: "
201
+ f"{(exc.strerror or '').lower()}"
202
+ )
203
+ exc = OSError(exc.errno, msg)
204
+ my_exceptions.append(exc)
205
+ else: # all bind attempts failed
206
+ if my_exceptions:
207
+ raise my_exceptions.pop()
208
+ else:
209
+ raise OSError(f"no matching local address with {family=} found")
210
+ await loop.sock_connect(sock, address)
211
+ return sock
212
+ except BaseException as exc:
213
+ if isinstance(exc, (RuntimeError, OSError)):
214
+ my_exceptions.append(exc)
215
+ if sock is not None:
216
+ if open_sockets is not None:
217
+ open_sockets.remove(sock)
218
+ try:
219
+ sock.close()
220
+ except OSError as e:
221
+ my_exceptions.append(e)
222
+ raise
223
+ raise
224
+ finally:
225
+ exceptions = my_exceptions = None # type: ignore[assignment]
226
+
227
+
228
+ def _interleave_addrinfos(
229
+ addrinfos: Sequence[AddrInfoType], first_address_family_count: int = 1
230
+ ) -> list[AddrInfoType]:
231
+ """Interleave list of addrinfo tuples by family."""
232
+ # Group addresses by family
233
+ addrinfos_by_family: defaultdict[int, list[AddrInfoType]] = defaultdict(list)
234
+ for addr in addrinfos:
235
+ addrinfos_by_family[addr[0]].append(addr)
236
+ addrinfos_lists = list(addrinfos_by_family.values())
237
+
238
+ reordered: list[AddrInfoType] = []
239
+ if first_address_family_count > 1:
240
+ reordered.extend(addrinfos_lists[0][: first_address_family_count - 1])
241
+ del addrinfos_lists[0][: first_address_family_count - 1]
242
+ reordered.extend(
243
+ a
244
+ for a in itertools.chain.from_iterable(itertools.zip_longest(*addrinfos_lists))
245
+ if a is not None
246
+ )
247
+ return reordered
.venv/Lib/site-packages/aiohappyeyeballs/py.typed ADDED
File without changes
.venv/Lib/site-packages/aiohappyeyeballs/types.py ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Types for aiohappyeyeballs."""
2
+
3
+ import socket
4
+ from collections.abc import Callable
5
+
6
+ AddrInfoType = tuple[
7
+ int | socket.AddressFamily,
8
+ int | socket.SocketKind,
9
+ int,
10
+ str,
11
+ tuple, # type: ignore[type-arg]
12
+ ]
13
+
14
+ SocketFactoryType = Callable[[AddrInfoType], socket.socket]
.venv/Lib/site-packages/aiohappyeyeballs/utils.py ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Utility functions for aiohappyeyeballs."""
2
+
3
+ import ipaddress
4
+ import socket
5
+
6
+ from .types import AddrInfoType
7
+
8
+
9
+ def addr_to_addr_infos(
10
+ addr: tuple[str, int, int, int] | tuple[str, int, int] | tuple[str, int] | None,
11
+ ) -> list[AddrInfoType] | None:
12
+ """Convert an address tuple to a list of addr_info tuples."""
13
+ if addr is None:
14
+ return None
15
+ host = addr[0]
16
+ port = addr[1]
17
+ is_ipv6 = ":" in host
18
+ if is_ipv6:
19
+ flowinfo = 0
20
+ scopeid = 0
21
+ addr_len = len(addr)
22
+ if addr_len >= 4:
23
+ scopeid = addr[3] # type: ignore[misc]
24
+ if addr_len >= 3:
25
+ flowinfo = addr[2] # type: ignore[misc]
26
+ addr = (host, port, flowinfo, scopeid)
27
+ family = socket.AF_INET6
28
+ else:
29
+ addr = (host, port)
30
+ family = socket.AF_INET
31
+ return [(family, socket.SOCK_STREAM, socket.IPPROTO_TCP, "", addr)]
32
+
33
+
34
+ def pop_addr_infos_interleave(
35
+ addr_infos: list[AddrInfoType], interleave: int | None = None
36
+ ) -> None:
37
+ """
38
+ Pop addr_info from the list of addr_infos by family up to interleave times.
39
+
40
+ The interleave parameter is used to know how many addr_infos for
41
+ each family should be popped of the top of the list.
42
+ """
43
+ if interleave is None:
44
+ interleave = 1
45
+ seen: dict[int, int] = {}
46
+ kept: list[AddrInfoType] = []
47
+ for addr_info in addr_infos:
48
+ family = addr_info[0]
49
+ count = seen.get(family, 0)
50
+ if count >= interleave:
51
+ kept.append(addr_info)
52
+ seen[family] = count + 1
53
+ addr_infos[:] = kept
54
+
55
+
56
+ def _addr_tuple_to_ip_address(
57
+ addr: tuple[str, int] | tuple[str, int, int, int],
58
+ ) -> tuple[ipaddress.IPv4Address, int] | tuple[ipaddress.IPv6Address, int, int, int]:
59
+ """Convert an address tuple to an IPv4Address."""
60
+ return (ipaddress.ip_address(addr[0]), *addr[1:])
61
+
62
+
63
+ def remove_addr_infos(
64
+ addr_infos: list[AddrInfoType],
65
+ addr: tuple[str, int] | tuple[str, int, int, int],
66
+ ) -> None:
67
+ """
68
+ Remove an address from the list of addr_infos.
69
+
70
+ The addr value is typically the return value of
71
+ sock.getpeername().
72
+ """
73
+ kept = [ai for ai in addr_infos if ai[-1] != addr]
74
+ if len(kept) == len(addr_infos):
75
+ # Slow path in case addr is formatted differently
76
+ match_addr = _addr_tuple_to_ip_address(addr)
77
+ kept = [
78
+ ai for ai in addr_infos if _addr_tuple_to_ip_address(ai[-1]) != match_addr
79
+ ]
80
+ if len(kept) == len(addr_infos):
81
+ raise ValueError(f"Address {addr} not found in addr_infos")
82
+ addr_infos[:] = kept
.venv/Lib/site-packages/aiohttp-3.14.1.dist-info/INSTALLER ADDED
@@ -0,0 +1 @@
 
 
1
+ pip
.venv/Lib/site-packages/aiohttp-3.14.1.dist-info/METADATA ADDED
@@ -0,0 +1,257 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Metadata-Version: 2.4
2
+ Name: aiohttp
3
+ Version: 3.14.1
4
+ Summary: Async http client/server framework (asyncio)
5
+ Maintainer-email: aiohttp team <team@aiohttp.org>
6
+ License: Apache-2.0 AND MIT
7
+ Project-URL: Homepage, https://github.com/aio-libs/aiohttp
8
+ Project-URL: Chat: Matrix, https://matrix.to/#/#aio-libs:matrix.org
9
+ Project-URL: Chat: Matrix Space, https://matrix.to/#/#aio-libs-space:matrix.org
10
+ Project-URL: CI: GitHub Actions, https://github.com/aio-libs/aiohttp/actions?query=workflow%3ACI
11
+ Project-URL: Coverage: codecov, https://codecov.io/github/aio-libs/aiohttp
12
+ Project-URL: Docs: Changelog, https://docs.aiohttp.org/en/stable/changes.html
13
+ Project-URL: Docs: RTD, https://docs.aiohttp.org
14
+ Project-URL: GitHub: issues, https://github.com/aio-libs/aiohttp/issues
15
+ Project-URL: GitHub: repo, https://github.com/aio-libs/aiohttp
16
+ Classifier: Development Status :: 5 - Production/Stable
17
+ Classifier: Framework :: AsyncIO
18
+ Classifier: Intended Audience :: Developers
19
+ Classifier: Operating System :: POSIX
20
+ Classifier: Operating System :: MacOS :: MacOS X
21
+ Classifier: Operating System :: Microsoft :: Windows
22
+ Classifier: Programming Language :: Python
23
+ Classifier: Programming Language :: Python :: 3
24
+ Classifier: Programming Language :: Python :: 3.10
25
+ Classifier: Programming Language :: Python :: 3.11
26
+ Classifier: Programming Language :: Python :: 3.12
27
+ Classifier: Programming Language :: Python :: 3.13
28
+ Classifier: Programming Language :: Python :: 3.14
29
+ Classifier: Topic :: Internet :: WWW/HTTP
30
+ Requires-Python: >=3.10
31
+ Description-Content-Type: text/x-rst
32
+ License-File: LICENSE.txt
33
+ License-File: vendor/llhttp/LICENSE
34
+ Requires-Dist: aiohappyeyeballs>=2.5.0
35
+ Requires-Dist: aiosignal>=1.4.0
36
+ Requires-Dist: async-timeout<6.0,>=4.0; python_version < "3.11"
37
+ Requires-Dist: attrs>=17.3.0
38
+ Requires-Dist: frozenlist>=1.1.1
39
+ Requires-Dist: multidict<7.0,>=4.5
40
+ Requires-Dist: propcache>=0.2.0
41
+ Requires-Dist: typing_extensions>=4.4; python_version < "3.13"
42
+ Requires-Dist: yarl<2.0,>=1.17.0
43
+ Provides-Extra: speedups
44
+ Requires-Dist: aiodns>=3.3.0; (sys_platform != "android" and sys_platform != "ios") and extra == "speedups"
45
+ Requires-Dist: Brotli>=1.2; (platform_python_implementation == "CPython" and sys_platform != "android" and sys_platform != "ios") and extra == "speedups"
46
+ Requires-Dist: brotlicffi>=1.2; platform_python_implementation != "CPython" and extra == "speedups"
47
+ Requires-Dist: backports.zstd; (platform_python_implementation == "CPython" and python_version < "3.14" and sys_platform != "android" and sys_platform != "ios") and extra == "speedups"
48
+ Dynamic: license-file
49
+
50
+ ==================================
51
+ Async http client/server framework
52
+ ==================================
53
+
54
+ .. image:: https://raw.githubusercontent.com/aio-libs/aiohttp/master/docs/aiohttp-plain.svg
55
+ :height: 64px
56
+ :width: 64px
57
+ :alt: aiohttp logo
58
+
59
+ |
60
+
61
+ .. image:: https://github.com/aio-libs/aiohttp/workflows/CI/badge.svg
62
+ :target: https://github.com/aio-libs/aiohttp/actions?query=workflow%3ACI
63
+ :alt: GitHub Actions status for master branch
64
+
65
+ .. image:: https://codecov.io/gh/aio-libs/aiohttp/branch/master/graph/badge.svg
66
+ :target: https://codecov.io/gh/aio-libs/aiohttp
67
+ :alt: codecov.io status for master branch
68
+
69
+ .. image:: https://badge.fury.io/py/aiohttp.svg
70
+ :target: https://pypi.org/project/aiohttp
71
+ :alt: Latest PyPI package version
72
+
73
+ .. image:: https://img.shields.io/pypi/dm/aiohttp
74
+ :target: https://pypistats.org/packages/aiohttp
75
+ :alt: Downloads count
76
+
77
+ .. image:: https://readthedocs.org/projects/aiohttp/badge/?version=latest
78
+ :target: https://docs.aiohttp.org/
79
+ :alt: Latest Read The Docs
80
+
81
+ .. image:: https://img.shields.io/endpoint?url=https://codspeed.io/badge.json
82
+ :target: https://codspeed.io/aio-libs/aiohttp
83
+ :alt: Codspeed.io status for aiohttp
84
+
85
+
86
+ Key Features
87
+ ============
88
+
89
+ - Supports both client and server side of HTTP protocol.
90
+ - Supports both client and server Web-Sockets out-of-the-box and avoids
91
+ Callback Hell.
92
+ - Provides Web-server with middleware and pluggable routing.
93
+
94
+
95
+ Getting started
96
+ ===============
97
+
98
+ Client
99
+ ------
100
+
101
+ To get something from the web:
102
+
103
+ .. code-block:: python
104
+
105
+ import aiohttp
106
+ import asyncio
107
+
108
+ async def main():
109
+
110
+ async with aiohttp.ClientSession() as session:
111
+ async with session.get('http://python.org') as response:
112
+
113
+ print("Status:", response.status)
114
+ print("Content-type:", response.headers['content-type'])
115
+
116
+ html = await response.text()
117
+ print("Body:", html[:15], "...")
118
+
119
+ asyncio.run(main())
120
+
121
+ This prints:
122
+
123
+ .. code-block::
124
+
125
+ Status: 200
126
+ Content-type: text/html; charset=utf-8
127
+ Body: <!doctype html> ...
128
+
129
+ Coming from `requests <https://requests.readthedocs.io/>`_ ? Read `why we need so many lines <https://aiohttp.readthedocs.io/en/latest/http_request_lifecycle.html>`_.
130
+
131
+ Server
132
+ ------
133
+
134
+ An example using a simple server:
135
+
136
+ .. code-block:: python
137
+
138
+ # examples/server_simple.py
139
+ from aiohttp import web
140
+
141
+ async def handle(request):
142
+ name = request.match_info.get('name', "Anonymous")
143
+ text = "Hello, " + name
144
+ return web.Response(text=text)
145
+
146
+ async def wshandle(request):
147
+ ws = web.WebSocketResponse()
148
+ await ws.prepare(request)
149
+
150
+ async for msg in ws:
151
+ if msg.type == web.WSMsgType.text:
152
+ await ws.send_str("Hello, {}".format(msg.data))
153
+ elif msg.type == web.WSMsgType.binary:
154
+ await ws.send_bytes(msg.data)
155
+ elif msg.type == web.WSMsgType.close:
156
+ break
157
+
158
+ return ws
159
+
160
+
161
+ app = web.Application()
162
+ app.add_routes([web.get('/', handle),
163
+ web.get('/echo', wshandle),
164
+ web.get('/{name}', handle)])
165
+
166
+ if __name__ == '__main__':
167
+ web.run_app(app)
168
+
169
+
170
+ Documentation
171
+ =============
172
+
173
+ https://aiohttp.readthedocs.io/
174
+
175
+
176
+ Demos
177
+ =====
178
+
179
+ https://github.com/aio-libs/aiohttp-demos
180
+
181
+
182
+ External links
183
+ ==============
184
+
185
+ * `Third party libraries
186
+ <http://aiohttp.readthedocs.io/en/latest/third_party.html>`_
187
+ * `Built with aiohttp
188
+ <http://aiohttp.readthedocs.io/en/latest/built_with.html>`_
189
+ * `Powered by aiohttp
190
+ <http://aiohttp.readthedocs.io/en/latest/powered_by.html>`_
191
+
192
+ Feel free to make a Pull Request for adding your link to these pages!
193
+
194
+
195
+ Communication channels
196
+ ======================
197
+
198
+ *aio-libs Discussions*: https://github.com/aio-libs/aiohttp/discussions
199
+
200
+ *Matrix*: `#aio-libs:matrix.org <https://matrix.to/#/#aio-libs:matrix.org>`_
201
+
202
+ We support `Stack Overflow
203
+ <https://stackoverflow.com/questions/tagged/aiohttp>`_.
204
+ Please add *aiohttp* tag to your question there.
205
+
206
+ Requirements
207
+ ============
208
+
209
+ - attrs_
210
+ - multidict_
211
+ - yarl_
212
+ - frozenlist_
213
+
214
+ Optionally you may install the aiodns_ library (highly recommended for sake of speed).
215
+
216
+ .. _aiodns: https://pypi.python.org/pypi/aiodns
217
+ .. _attrs: https://github.com/python-attrs/attrs
218
+ .. _multidict: https://pypi.python.org/pypi/multidict
219
+ .. _frozenlist: https://pypi.org/project/frozenlist/
220
+ .. _yarl: https://pypi.python.org/pypi/yarl
221
+ .. _async-timeout: https://pypi.python.org/pypi/async_timeout
222
+
223
+
224
+ Keepsafe
225
+ ========
226
+
227
+ The aiohttp community would like to thank Keepsafe
228
+ (https://www.getkeepsafe.com) for its support in the early days of
229
+ the project.
230
+
231
+
232
+ Source code
233
+ ===========
234
+
235
+ The latest developer version is available in a GitHub repository:
236
+ https://github.com/aio-libs/aiohttp
237
+
238
+ Benchmarks
239
+ ==========
240
+
241
+ If you are interested in efficiency, the AsyncIO community maintains a
242
+ list of benchmarks on the official wiki:
243
+ https://github.com/python/asyncio/wiki/Benchmarks
244
+
245
+ --------
246
+
247
+ .. image:: https://img.shields.io/matrix/aio-libs:matrix.org?label=Discuss%20on%20Matrix%20at%20%23aio-libs%3Amatrix.org&logo=matrix&server_fqdn=matrix.org&style=flat
248
+ :target: https://matrix.to/#/%23aio-libs:matrix.org
249
+ :alt: Matrix Room — #aio-libs:matrix.org
250
+
251
+ .. image:: https://img.shields.io/matrix/aio-libs-space:matrix.org?label=Discuss%20on%20Matrix%20at%20%23aio-libs-space%3Amatrix.org&logo=matrix&server_fqdn=matrix.org&style=flat
252
+ :target: https://matrix.to/#/%23aio-libs-space:matrix.org
253
+ :alt: Matrix Space — #aio-libs-space:matrix.org
254
+
255
+ .. image:: https://insights.linuxfoundation.org/api/badge/health-score?project=aiohttp
256
+ :target: https://insights.linuxfoundation.org/project/aiohttp
257
+ :alt: LFX Health Score
.venv/Lib/site-packages/aiohttp-3.14.1.dist-info/RECORD ADDED
@@ -0,0 +1,138 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ aiohttp-3.14.1.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
2
+ aiohttp-3.14.1.dist-info/METADATA,sha256=yRs-uzH3FV0W3T7xYohY_fggESigHjBwYf4i5D0IP8A,8519
3
+ aiohttp-3.14.1.dist-info/RECORD,,
4
+ aiohttp-3.14.1.dist-info/WHEEL,sha256=rR5QfsWcZl3mra5AmSD7Fd0dzQxZ3lHCpDo70IkfDK4,101
5
+ aiohttp-3.14.1.dist-info/licenses/LICENSE.txt,sha256=6hlTcau_ZqOe71ZgCVXRE3wsGW3BRP_sRrbqUwznAEQ,11514
6
+ aiohttp-3.14.1.dist-info/licenses/vendor/llhttp/LICENSE,sha256=J5AS4CoQrP1Zo_LY8TpJczJTXYccKyfImYiYWwajpDg,1091
7
+ aiohttp-3.14.1.dist-info/top_level.txt,sha256=iv-JIaacmTl-hSho3QmphcKnbRRYx1st47yjz_178Ro,8
8
+ aiohttp/.hash/_cparser.pxd.hash,sha256=_MtHyWZIvAQQDQbH1CKgioo0gjS--ztYtUx09xwNpY0,108
9
+ aiohttp/.hash/_find_header.pxd.hash,sha256=TxG5w4etbVd6sfm5JWbdf5PW6LnuXRQnlMoFBVGKN2E,112
10
+ aiohttp/.hash/_http_parser.pyx.hash,sha256=nLgXu4vJDihEqLtY4w-PnsP5Q7DZLTPx1SfygzlfJFg,112
11
+ aiohttp/.hash/_http_writer.pyx.hash,sha256=UUkXTiHqUefgMS4OVxqOVJU9jFc926h2-FeZxT4vDGc,112
12
+ aiohttp/.hash/hdrs.py.hash,sha256=GYrcM9t_TFhYal1KDsi8bJHNI-56WjYezhPutetoxmI,103
13
+ aiohttp/__init__.py,sha256=sFCnVnIfl8_AThh0yv4_CON4rq0oLT2da4f2UoXjAoM,8618
14
+ aiohttp/__pycache__/__init__.cpython-312.pyc,,
15
+ aiohttp/__pycache__/_cookie_helpers.cpython-312.pyc,,
16
+ aiohttp/__pycache__/abc.cpython-312.pyc,,
17
+ aiohttp/__pycache__/base_protocol.cpython-312.pyc,,
18
+ aiohttp/__pycache__/client.cpython-312.pyc,,
19
+ aiohttp/__pycache__/client_exceptions.cpython-312.pyc,,
20
+ aiohttp/__pycache__/client_middleware_digest_auth.cpython-312.pyc,,
21
+ aiohttp/__pycache__/client_middlewares.cpython-312.pyc,,
22
+ aiohttp/__pycache__/client_proto.cpython-312.pyc,,
23
+ aiohttp/__pycache__/client_reqrep.cpython-312.pyc,,
24
+ aiohttp/__pycache__/client_ws.cpython-312.pyc,,
25
+ aiohttp/__pycache__/compression_utils.cpython-312.pyc,,
26
+ aiohttp/__pycache__/connector.cpython-312.pyc,,
27
+ aiohttp/__pycache__/cookiejar.cpython-312.pyc,,
28
+ aiohttp/__pycache__/formdata.cpython-312.pyc,,
29
+ aiohttp/__pycache__/hdrs.cpython-312.pyc,,
30
+ aiohttp/__pycache__/helpers.cpython-312.pyc,,
31
+ aiohttp/__pycache__/http.cpython-312.pyc,,
32
+ aiohttp/__pycache__/http_exceptions.cpython-312.pyc,,
33
+ aiohttp/__pycache__/http_parser.cpython-312.pyc,,
34
+ aiohttp/__pycache__/http_websocket.cpython-312.pyc,,
35
+ aiohttp/__pycache__/http_writer.cpython-312.pyc,,
36
+ aiohttp/__pycache__/log.cpython-312.pyc,,
37
+ aiohttp/__pycache__/multipart.cpython-312.pyc,,
38
+ aiohttp/__pycache__/payload.cpython-312.pyc,,
39
+ aiohttp/__pycache__/payload_streamer.cpython-312.pyc,,
40
+ aiohttp/__pycache__/pytest_plugin.cpython-312.pyc,,
41
+ aiohttp/__pycache__/resolver.cpython-312.pyc,,
42
+ aiohttp/__pycache__/streams.cpython-312.pyc,,
43
+ aiohttp/__pycache__/tcp_helpers.cpython-312.pyc,,
44
+ aiohttp/__pycache__/test_utils.cpython-312.pyc,,
45
+ aiohttp/__pycache__/tracing.cpython-312.pyc,,
46
+ aiohttp/__pycache__/typedefs.cpython-312.pyc,,
47
+ aiohttp/__pycache__/web.cpython-312.pyc,,
48
+ aiohttp/__pycache__/web_app.cpython-312.pyc,,
49
+ aiohttp/__pycache__/web_exceptions.cpython-312.pyc,,
50
+ aiohttp/__pycache__/web_fileresponse.cpython-312.pyc,,
51
+ aiohttp/__pycache__/web_log.cpython-312.pyc,,
52
+ aiohttp/__pycache__/web_middlewares.cpython-312.pyc,,
53
+ aiohttp/__pycache__/web_protocol.cpython-312.pyc,,
54
+ aiohttp/__pycache__/web_request.cpython-312.pyc,,
55
+ aiohttp/__pycache__/web_response.cpython-312.pyc,,
56
+ aiohttp/__pycache__/web_routedef.cpython-312.pyc,,
57
+ aiohttp/__pycache__/web_runner.cpython-312.pyc,,
58
+ aiohttp/__pycache__/web_server.cpython-312.pyc,,
59
+ aiohttp/__pycache__/web_urldispatcher.cpython-312.pyc,,
60
+ aiohttp/__pycache__/web_ws.cpython-312.pyc,,
61
+ aiohttp/__pycache__/worker.cpython-312.pyc,,
62
+ aiohttp/_cookie_helpers.py,sha256=8I8Vs6jDJOWRGIpN5BMFzEeGh4IkfJuRuXwZV69sT64,14453
63
+ aiohttp/_cparser.pxd,sha256=U14CjuQydabOyggX9s65CrROinPyCjqPWgwDZEdof3k,4495
64
+ aiohttp/_find_header.pxd,sha256=BFUSmxhemBtblqxzjzH3x03FfxaWlTyuAIOz8YZ5_nM,70
65
+ aiohttp/_headers.pxi,sha256=1MhCe6Un_KI1tpO85HnDfzVO94BhcirLanAOys5FIHA,2090
66
+ aiohttp/_http_parser.cp312-win_amd64.pyd,sha256=9-Q18klpydAtoxoS804RPTeMb75IT89dWORjWmL4sPo,253952
67
+ aiohttp/_http_parser.pyx,sha256=APyHZD3Ubeyk6evj99bNQuEYtfBYFVLaXkxBjcCQDLc,34825
68
+ aiohttp/_http_writer.cp312-win_amd64.pyd,sha256=RmxEubgGvuEs453_oDyc8D5OV_wjjIRgddOvSZIeWEE,46592
69
+ aiohttp/_http_writer.pyx,sha256=GtaoTzlPgHYLLzWZsXDFb2UVrkZMwD7iDHnbLuFuyx0,4987
70
+ aiohttp/_websocket/.hash/mask.pxd.hash,sha256=TL0gGYyJWxqG8dWwa08B74WGg6-0M6_Breqrff-AiZg,115
71
+ aiohttp/_websocket/.hash/mask.pyx.hash,sha256=7xo6f01JaOQmaUNij3dQlOgxkEC1edkAIhwpeOvimLI,115
72
+ aiohttp/_websocket/.hash/reader_c.pxd.hash,sha256=k1rDYvO9XZNVM5_ZylVA9ebsx1eUgibBeyqyGpjbzps,119
73
+ aiohttp/_websocket/__init__.py,sha256=R51KWH5kkdtDLb7T-ilztksbfweKCy3t22SgxGtiY-4,45
74
+ aiohttp/_websocket/__pycache__/__init__.cpython-312.pyc,,
75
+ aiohttp/_websocket/__pycache__/helpers.cpython-312.pyc,,
76
+ aiohttp/_websocket/__pycache__/models.cpython-312.pyc,,
77
+ aiohttp/_websocket/__pycache__/reader.cpython-312.pyc,,
78
+ aiohttp/_websocket/__pycache__/reader_c.cpython-312.pyc,,
79
+ aiohttp/_websocket/__pycache__/reader_py.cpython-312.pyc,,
80
+ aiohttp/_websocket/__pycache__/writer.cpython-312.pyc,,
81
+ aiohttp/_websocket/helpers.py,sha256=TLiE1IPkJvC7LJ45slO4Dv3bQZeoytk7o8VbQ50rXq0,5174
82
+ aiohttp/_websocket/mask.cp312-win_amd64.pyd,sha256=y38lkL5aqf4k50KfkY_qmrnq7GNu7m8agTZHM-AXA38,35840
83
+ aiohttp/_websocket/mask.pxd,sha256=41TdSZvhcbYSW_Vrw7bF4r_yoor2njtdaZ3bmvK6-jw,115
84
+ aiohttp/_websocket/mask.pyx,sha256=Ro7dOOv43HAAqNMz3xyCA11ppcn-vARIvjycStTEYww,1445
85
+ aiohttp/_websocket/models.py,sha256=BunZRA5HYC-kyVUoZGWa8GexXCbQtD115YX5Mpcpnyg,3059
86
+ aiohttp/_websocket/reader.py,sha256=1r0cJ-jdFgbSrC6-jI0zjEA1CppzoUn8u_wiebrVVO0,1061
87
+ aiohttp/_websocket/reader_c.cp312-win_amd64.pyd,sha256=4k13AIa6eRjuhMeN7YxHHyRBLSBzqbfRMmCCM8CWguM,141312
88
+ aiohttp/_websocket/reader_c.pxd,sha256=-tmQaRk5sRazAheek47vR-bLq_X-WjC7RlwWJt5ethQ,2795
89
+ aiohttp/_websocket/reader_c.py,sha256=iqMe_OM7dqmP7JFGCcJa2i8Mm8DeMIR6WSEKCyuzRBA,20582
90
+ aiohttp/_websocket/reader_py.py,sha256=iqMe_OM7dqmP7JFGCcJa2i8Mm8DeMIR6WSEKCyuzRBA,20582
91
+ aiohttp/_websocket/writer.py,sha256=ZRViY21_RUMJ_0FkBMkdqxsJtegI3hEmGaPYT8l0iv4,11520
92
+ aiohttp/abc.py,sha256=-I9aWFLKrOvnXWgHOvipOltt6laouPnwuw9Tai9AfiY,7806
93
+ aiohttp/base_protocol.py,sha256=DMc_sU8zbVWVwATQlWOX5aZwEj5bse1KRPqVlcetPIc,4828
94
+ aiohttp/client.py,sha256=Bm1gvFrm7aC1kvu6dZAeI6BOjPWh0QEcQrL41-hyoGk,66120
95
+ aiohttp/client_exceptions.py,sha256=KyIV7-ryEh3MaxIEBQ0HD57B4JVOLbMnaOlpIhHzHB4,12035
96
+ aiohttp/client_middleware_digest_auth.py,sha256=UuL-g3Y24GyE-HgIBRC4kh_oqmkKQA55gWpOW-6MDmI,19536
97
+ aiohttp/client_middlewares.py,sha256=FEVIXFkQ58n5bhK4BGEqqDCWnDh-GNJmWq20I5Yt6SU,1973
98
+ aiohttp/client_proto.py,sha256=dFcDXFYThsGh9j-n6xMHe2xT2ITkLna6DZYTWMZSA_0,13003
99
+ aiohttp/client_reqrep.py,sha256=LGnxZS1STacCcms_6dg3smrHvGdJiKpo5uQyGfsdSyk,56261
100
+ aiohttp/client_ws.py,sha256=sFoIQL-gmpcs3v7Bw_8yUhrKt5lmv1hGUcbOr7zfQyo,20028
101
+ aiohttp/compression_utils.py,sha256=y4SDiHyB8VuZIsQMW3M9c1iWMWjgZCp2BE0GTR0k4Es,16287
102
+ aiohttp/connector.py,sha256=YBA1nFwBm1cnPUgEgvwH2J_Qo3q8W18pYvNsEUdm4V8,71887
103
+ aiohttp/cookiejar.py,sha256=uEc9nrelZB2WqRRMntaTqRXT9LJpyedoeBPCBi7fNC0,26493
104
+ aiohttp/formdata.py,sha256=Jcw6cAGKjpru27SmGBm-UNfOHZAQyO2KTyvYR21xTw0,6698
105
+ aiohttp/hdrs.py,sha256=jq-SdfkXAqKyzrKzFo8pZe3PNHQ1o1IDnCTtm7CD6Ic,5227
106
+ aiohttp/helpers.py,sha256=V_2x_uoHErVPkvTwMat6rUjWWugNEZwTYIns3_EFyBA,34063
107
+ aiohttp/http.py,sha256=Xn2HkR8TbSDzn61cGEV9jE1xLk0ARilSM-EiRVab8r4,2155
108
+ aiohttp/http_exceptions.py,sha256=ygc4acVHHwly81wobO5DIylr3eqnY_lDssVsBxomaOg,3233
109
+ aiohttp/http_parser.py,sha256=Mw4i_146zVxHsNPSB6R7oAJq0lI19xbzJCE4OwUY2Lo,46387
110
+ aiohttp/http_websocket.py,sha256=w0bnSv39CdpIe9MEGCYKDe1bJ3gdd-_bVxDzNHHRulY,1024
111
+ aiohttp/http_writer.py,sha256=be03ggFiHIX3pfAl-HxZKRXwON9Sy1NdBE6pnzmycCI,12983
112
+ aiohttp/log.py,sha256=zYUTvXsMQ9Sz1yNN8kXwd5Qxu49a1FzjZ_wQqriEc8M,333
113
+ aiohttp/multipart.py,sha256=QHLZyPjD8NhRLTFGNQhoBs9pE3YkRN69cGzV-beVN7U,45407
114
+ aiohttp/payload.py,sha256=Z9pA7gzhFAmnzEpMdwFwe0ZZowHRfdRLSkzHSN6Y7Sw,42618
115
+ aiohttp/payload_streamer.py,sha256=c8yoX72AYHs6NxqCqmSfQDRF-z2-v1kKIYn6kj68F78,2304
116
+ aiohttp/py.typed,sha256=3VVwXUAWVEVX7sDwyYDnW5ZdBC9_Z9AJAFfLCleUW0k,8
117
+ aiohttp/pytest_plugin.py,sha256=UBFjeBelwm6ntI142CcMyApghdNWLkrbrVnjr9cfBGE,13415
118
+ aiohttp/resolver.py,sha256=v5XBorVS7muvsrpPL7tp_i56MIFUe9vOtV5sbs9ZF40,10227
119
+ aiohttp/streams.py,sha256=kb-fn5g7OeG00-iXTe3YhwZkeH6uZ1vaKwKV4AW2uQ8,24887
120
+ aiohttp/tcp_helpers.py,sha256=K-hhGh3jd6qCEnHJo8LvFyfJwBjh99UKI7A0aSRVhj4,998
121
+ aiohttp/test_utils.py,sha256=KfckS2iyREqj5zQu-SfbQVII1aJgmTFioGIhOJCzzQY,25444
122
+ aiohttp/tracing.py,sha256=V9235J6nmipQTTnUQ8i0FIRXsPofmBjCDAqUxboHRjI,14953
123
+ aiohttp/typedefs.py,sha256=CylMHRAB8RDel6JaKBUf_vK2IqQDlH2de7p069JmDS4,1733
124
+ aiohttp/web.py,sha256=JMA0M1hSe5Ko9SLAocVxOPUCIJRIdIxAoLl9QyFB2GY,19019
125
+ aiohttp/web_app.py,sha256=7C7I68hH9qiwE3fDey9rFXWvQOWTJRMT537Fl4mWKdk,19989
126
+ aiohttp/web_exceptions.py,sha256=kvUYL7SgFay-gBJize8vQtXq4SpGwRKe8O88rsdO3no,10804
127
+ aiohttp/web_fileresponse.py,sha256=-LmkkQs3PvW_DuLGuJFhifCtufaE0e0MAlivN4n5K9w,16823
128
+ aiohttp/web_log.py,sha256=pK085S6qTyS2JY7xJw5Bv4nzn3lnaTwAGan4sFiweR4,8718
129
+ aiohttp/web_middlewares.py,sha256=5W5T1jtBYr8906JO79K9ytcqa9M4uQgwqTenXHdI-1A,4273
130
+ aiohttp/web_protocol.py,sha256=XnlLONO17BqbySgfYFzQCqJODFJXNgDFoCt5y7H-wjg,31966
131
+ aiohttp/web_request.py,sha256=xOH3WPMoaW6WVUKmgymgL_sWeKZKcilT2gEby8T7YXQ,32815
132
+ aiohttp/web_response.py,sha256=dmX64IDeA-3Fk6ytq3NmFn4b17861ikyuVNbMg7adUM,31692
133
+ aiohttp/web_routedef.py,sha256=9Eg0z0kRpmt3yP-gjZTGon0I7rJpHEd3FbI-tIyKWRE,6260
134
+ aiohttp/web_runner.py,sha256=OWQXf8llfZFtK0jdqAxucDxb5P5U5QNWCkKAYe_mIqA,13133
135
+ aiohttp/web_server.py,sha256=3kMuz9AdQji5QPzD2KBWJlCwy31HPMVfZrQEbi7omC8,3261
136
+ aiohttp/web_urldispatcher.py,sha256=-GplcHQgFl9Jw8zDeubOyyDQzXb5R647jBxNCox9aMw,45174
137
+ aiohttp/web_ws.py,sha256=1dqQ-RDuN6k20ca_ZqTYBABnpRw7uq-raFz1sUS-e_A,28238
138
+ aiohttp/worker.py,sha256=jKrmhrcE2ojY9S97r7uyX2IBMM-Fg6rEwHzLBJhGIh8,8772
.venv/Lib/site-packages/aiohttp-3.14.1.dist-info/WHEEL ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (82.0.1)
3
+ Root-Is-Purelib: false
4
+ Tag: cp312-cp312-win_amd64
5
+
.venv/Lib/site-packages/aiohttp-3.14.1.dist-info/licenses/LICENSE.txt ADDED
@@ -0,0 +1,201 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "{}"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright aio-libs contributors
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
.venv/Lib/site-packages/aiohttp-3.14.1.dist-info/licenses/vendor/llhttp/LICENSE ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ MIT License
2
+
3
+ Copyright © 2018 Fedor Indutny
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a
6
+ copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to permit
10
+ persons to whom the Software is furnished to do so, subject to the
11
+ following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included
14
+ in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17
+ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
19
+ NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
20
+ DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
21
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
22
+ USE OR OTHER DEALINGS IN THE SOFTWARE.
.venv/Lib/site-packages/aiohttp-3.14.1.dist-info/top_level.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ aiohttp
.venv/Lib/site-packages/aiohttp/.hash/_cparser.pxd.hash ADDED
@@ -0,0 +1 @@
 
 
1
+ 535e028ee43275a6ceca0817f6ceb90ab44e8a73f20a3a8f5a0c036447687f79 *D:/a/aiohttp/aiohttp/aiohttp/_cparser.pxd
.venv/Lib/site-packages/aiohttp/.hash/_find_header.pxd.hash ADDED
@@ -0,0 +1 @@
 
 
1
+ 0455129b185e981b5b96ac738f31f7c74dc57f1696953cae0083b3f18679fe73 *D:/a/aiohttp/aiohttp/aiohttp/_find_header.pxd
.venv/Lib/site-packages/aiohttp/.hash/_http_parser.pyx.hash ADDED
@@ -0,0 +1 @@
 
 
1
+ 00fc87643dd46deca4e9ebe3f7d6cd42e118b5f0581552da5e4c418dc0900cb7 *D:/a/aiohttp/aiohttp/aiohttp/_http_parser.pyx
.venv/Lib/site-packages/aiohttp/.hash/_http_writer.pyx.hash ADDED
@@ -0,0 +1 @@
 
 
1
+ 1ad6a84f394f80760b2f3599b170c56f6515ae464cc03ee20c79db2ee16ecb1d *D:/a/aiohttp/aiohttp/aiohttp/_http_writer.pyx
.venv/Lib/site-packages/aiohttp/.hash/hdrs.py.hash ADDED
@@ -0,0 +1 @@
 
 
1
+ 8eaf9275f91702a2b2ceb2b3168f2965edcf347435a352039c24ed9bb083e887 *D:/a/aiohttp/aiohttp/aiohttp/hdrs.py
.venv/Lib/site-packages/aiohttp/__init__.py ADDED
@@ -0,0 +1,279 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ __version__ = "3.14.1"
2
+
3
+ from typing import TYPE_CHECKING
4
+
5
+ from . import hdrs as hdrs
6
+ from .client import (
7
+ BaseConnector,
8
+ ClientConnectionError,
9
+ ClientConnectionResetError,
10
+ ClientConnectorCertificateError,
11
+ ClientConnectorDNSError,
12
+ ClientConnectorError,
13
+ ClientConnectorSSLError,
14
+ ClientError,
15
+ ClientHttpProxyError,
16
+ ClientOSError,
17
+ ClientPayloadError,
18
+ ClientProxyConnectionError,
19
+ ClientRequest,
20
+ ClientResponse,
21
+ ClientResponseError,
22
+ ClientSession,
23
+ ClientSSLError,
24
+ ClientTimeout,
25
+ ClientWebSocketResponse,
26
+ ClientWSTimeout,
27
+ ConnectionTimeoutError,
28
+ ContentTypeError,
29
+ Fingerprint,
30
+ InvalidURL,
31
+ InvalidUrlClientError,
32
+ InvalidUrlRedirectClientError,
33
+ NamedPipeConnector,
34
+ NonHttpUrlClientError,
35
+ NonHttpUrlRedirectClientError,
36
+ RedirectClientError,
37
+ RequestInfo,
38
+ ServerConnectionError,
39
+ ServerDisconnectedError,
40
+ ServerFingerprintMismatch,
41
+ ServerTimeoutError,
42
+ SocketTimeoutError,
43
+ TCPConnector,
44
+ TooManyRedirects,
45
+ UnixConnector,
46
+ WSMessageTypeError,
47
+ WSServerHandshakeError,
48
+ request,
49
+ )
50
+ from .client_middleware_digest_auth import DigestAuthMiddleware
51
+ from .client_middlewares import ClientHandlerType, ClientMiddlewareType
52
+ from .compression_utils import set_zlib_backend
53
+ from .connector import (
54
+ AddrInfoType as AddrInfoType,
55
+ SocketFactoryType as SocketFactoryType,
56
+ )
57
+ from .cookiejar import CookieJar as CookieJar, DummyCookieJar as DummyCookieJar
58
+ from .formdata import FormData as FormData
59
+ from .helpers import BasicAuth, ChainMapProxy, ETag, encode_basic_auth
60
+ from .http import (
61
+ HttpVersion as HttpVersion,
62
+ HttpVersion10 as HttpVersion10,
63
+ HttpVersion11 as HttpVersion11,
64
+ WebSocketError as WebSocketError,
65
+ WSCloseCode as WSCloseCode,
66
+ WSMessage as WSMessage,
67
+ WSMsgType as WSMsgType,
68
+ )
69
+ from .multipart import (
70
+ BadContentDispositionHeader as BadContentDispositionHeader,
71
+ BadContentDispositionParam as BadContentDispositionParam,
72
+ BodyPartReader as BodyPartReader,
73
+ MultipartReader as MultipartReader,
74
+ MultipartWriter as MultipartWriter,
75
+ content_disposition_filename as content_disposition_filename,
76
+ parse_content_disposition as parse_content_disposition,
77
+ )
78
+ from .payload import (
79
+ PAYLOAD_REGISTRY as PAYLOAD_REGISTRY,
80
+ AsyncIterablePayload as AsyncIterablePayload,
81
+ BufferedReaderPayload as BufferedReaderPayload,
82
+ BytesIOPayload as BytesIOPayload,
83
+ BytesPayload as BytesPayload,
84
+ IOBasePayload as IOBasePayload,
85
+ JsonPayload as JsonPayload,
86
+ Payload as Payload,
87
+ StringIOPayload as StringIOPayload,
88
+ StringPayload as StringPayload,
89
+ TextIOPayload as TextIOPayload,
90
+ get_payload as get_payload,
91
+ payload_type as payload_type,
92
+ )
93
+ from .payload_streamer import streamer as streamer
94
+ from .resolver import (
95
+ AsyncResolver as AsyncResolver,
96
+ DefaultResolver as DefaultResolver,
97
+ ThreadedResolver as ThreadedResolver,
98
+ )
99
+ from .streams import (
100
+ EMPTY_PAYLOAD as EMPTY_PAYLOAD,
101
+ DataQueue as DataQueue,
102
+ EofStream as EofStream,
103
+ FlowControlDataQueue as FlowControlDataQueue,
104
+ StreamReader as StreamReader,
105
+ )
106
+ from .tracing import (
107
+ TraceConfig as TraceConfig,
108
+ TraceConnectionCreateEndParams as TraceConnectionCreateEndParams,
109
+ TraceConnectionCreateStartParams as TraceConnectionCreateStartParams,
110
+ TraceConnectionQueuedEndParams as TraceConnectionQueuedEndParams,
111
+ TraceConnectionQueuedStartParams as TraceConnectionQueuedStartParams,
112
+ TraceConnectionReuseconnParams as TraceConnectionReuseconnParams,
113
+ TraceDnsCacheHitParams as TraceDnsCacheHitParams,
114
+ TraceDnsCacheMissParams as TraceDnsCacheMissParams,
115
+ TraceDnsResolveHostEndParams as TraceDnsResolveHostEndParams,
116
+ TraceDnsResolveHostStartParams as TraceDnsResolveHostStartParams,
117
+ TraceRequestChunkSentParams as TraceRequestChunkSentParams,
118
+ TraceRequestEndParams as TraceRequestEndParams,
119
+ TraceRequestExceptionParams as TraceRequestExceptionParams,
120
+ TraceRequestHeadersSentParams as TraceRequestHeadersSentParams,
121
+ TraceRequestRedirectParams as TraceRequestRedirectParams,
122
+ TraceRequestStartParams as TraceRequestStartParams,
123
+ TraceResponseChunkReceivedParams as TraceResponseChunkReceivedParams,
124
+ )
125
+
126
+ if TYPE_CHECKING:
127
+ # At runtime these are lazy-loaded at the bottom of the file.
128
+ from .worker import (
129
+ GunicornUVLoopWebWorker as GunicornUVLoopWebWorker,
130
+ GunicornWebWorker as GunicornWebWorker,
131
+ )
132
+
133
+ __all__: tuple[str, ...] = (
134
+ "hdrs",
135
+ # client
136
+ "AddrInfoType",
137
+ "BaseConnector",
138
+ "ClientConnectionError",
139
+ "ClientConnectionResetError",
140
+ "ClientConnectorCertificateError",
141
+ "ClientConnectorDNSError",
142
+ "ClientConnectorError",
143
+ "ClientConnectorSSLError",
144
+ "ClientError",
145
+ "ClientHttpProxyError",
146
+ "ClientOSError",
147
+ "ClientPayloadError",
148
+ "ClientProxyConnectionError",
149
+ "ClientResponse",
150
+ "ClientRequest",
151
+ "ClientResponseError",
152
+ "ClientSSLError",
153
+ "ClientSession",
154
+ "ClientTimeout",
155
+ "ClientWebSocketResponse",
156
+ "ClientWSTimeout",
157
+ "ConnectionTimeoutError",
158
+ "ContentTypeError",
159
+ "Fingerprint",
160
+ "FlowControlDataQueue",
161
+ "InvalidURL",
162
+ "InvalidUrlClientError",
163
+ "InvalidUrlRedirectClientError",
164
+ "NonHttpUrlClientError",
165
+ "NonHttpUrlRedirectClientError",
166
+ "RedirectClientError",
167
+ "RequestInfo",
168
+ "ServerConnectionError",
169
+ "ServerDisconnectedError",
170
+ "ServerFingerprintMismatch",
171
+ "ServerTimeoutError",
172
+ "SocketFactoryType",
173
+ "SocketTimeoutError",
174
+ "TCPConnector",
175
+ "TooManyRedirects",
176
+ "UnixConnector",
177
+ "NamedPipeConnector",
178
+ "WSServerHandshakeError",
179
+ "request",
180
+ # client_middleware
181
+ "ClientMiddlewareType",
182
+ "ClientHandlerType",
183
+ # cookiejar
184
+ "CookieJar",
185
+ "DummyCookieJar",
186
+ # formdata
187
+ "FormData",
188
+ # helpers
189
+ "BasicAuth",
190
+ "ChainMapProxy",
191
+ "DigestAuthMiddleware",
192
+ "ETag",
193
+ "encode_basic_auth",
194
+ "set_zlib_backend",
195
+ # http
196
+ "HttpVersion",
197
+ "HttpVersion10",
198
+ "HttpVersion11",
199
+ "WSMsgType",
200
+ "WSCloseCode",
201
+ "WSMessage",
202
+ "WebSocketError",
203
+ # multipart
204
+ "BadContentDispositionHeader",
205
+ "BadContentDispositionParam",
206
+ "BodyPartReader",
207
+ "MultipartReader",
208
+ "MultipartWriter",
209
+ "content_disposition_filename",
210
+ "parse_content_disposition",
211
+ # payload
212
+ "AsyncIterablePayload",
213
+ "BufferedReaderPayload",
214
+ "BytesIOPayload",
215
+ "BytesPayload",
216
+ "IOBasePayload",
217
+ "JsonPayload",
218
+ "PAYLOAD_REGISTRY",
219
+ "Payload",
220
+ "StringIOPayload",
221
+ "StringPayload",
222
+ "TextIOPayload",
223
+ "get_payload",
224
+ "payload_type",
225
+ # payload_streamer
226
+ "streamer",
227
+ # resolver
228
+ "AsyncResolver",
229
+ "DefaultResolver",
230
+ "ThreadedResolver",
231
+ # streams
232
+ "DataQueue",
233
+ "EMPTY_PAYLOAD",
234
+ "EofStream",
235
+ "StreamReader",
236
+ # tracing
237
+ "TraceConfig",
238
+ "TraceConnectionCreateEndParams",
239
+ "TraceConnectionCreateStartParams",
240
+ "TraceConnectionQueuedEndParams",
241
+ "TraceConnectionQueuedStartParams",
242
+ "TraceConnectionReuseconnParams",
243
+ "TraceDnsCacheHitParams",
244
+ "TraceDnsCacheMissParams",
245
+ "TraceDnsResolveHostEndParams",
246
+ "TraceDnsResolveHostStartParams",
247
+ "TraceRequestChunkSentParams",
248
+ "TraceRequestEndParams",
249
+ "TraceRequestExceptionParams",
250
+ "TraceRequestHeadersSentParams",
251
+ "TraceRequestRedirectParams",
252
+ "TraceRequestStartParams",
253
+ "TraceResponseChunkReceivedParams",
254
+ # workers (imported lazily with __getattr__)
255
+ "GunicornUVLoopWebWorker",
256
+ "GunicornWebWorker",
257
+ "WSMessageTypeError",
258
+ )
259
+
260
+
261
+ def __dir__() -> tuple[str, ...]:
262
+ return __all__ + ("__doc__",)
263
+
264
+
265
+ def __getattr__(name: str) -> object:
266
+ global GunicornUVLoopWebWorker, GunicornWebWorker
267
+
268
+ # Importing gunicorn takes a long time (>100ms), so only import if actually needed.
269
+ if name in ("GunicornUVLoopWebWorker", "GunicornWebWorker"):
270
+ try:
271
+ from .worker import GunicornUVLoopWebWorker as guv, GunicornWebWorker as gw
272
+ except ImportError:
273
+ return None
274
+
275
+ GunicornUVLoopWebWorker = guv # type: ignore[misc]
276
+ GunicornWebWorker = gw # type: ignore[misc]
277
+ return guv if name == "GunicornUVLoopWebWorker" else gw
278
+
279
+ raise AttributeError(f"module {__name__} has no attribute {name}")
.venv/Lib/site-packages/aiohttp/_cookie_helpers.py ADDED
@@ -0,0 +1,361 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ Internal cookie handling helpers.
3
+
4
+ This module contains internal utilities for cookie parsing and manipulation.
5
+ These are not part of the public API and may change without notice.
6
+ """
7
+
8
+ import re
9
+ from collections.abc import Sequence
10
+ from http.cookies import CookieError, Morsel
11
+ from typing import cast
12
+
13
+ from .log import internal_logger
14
+
15
+ __all__ = (
16
+ "parse_set_cookie_headers",
17
+ "parse_cookie_header",
18
+ "preserve_morsel_with_coded_value",
19
+ )
20
+
21
+ # Cookie parsing constants
22
+ # Allow more characters in cookie names to handle real-world cookies
23
+ # that don't strictly follow RFC standards (fixes #2683)
24
+ # RFC 6265 defines cookie-name token as per RFC 2616 Section 2.2,
25
+ # but many servers send cookies with characters like {} [] () etc.
26
+ # This makes the cookie parser more tolerant of real-world cookies
27
+ # while still providing some validation to catch obviously malformed names.
28
+ _COOKIE_NAME_RE = re.compile(r"^[!#$%&\'()*+\-./0-9:<=>?@A-Z\[\]^_`a-z{|}~]+$")
29
+ _COOKIE_KNOWN_ATTRS = frozenset( # AKA Morsel._reserved
30
+ (
31
+ "path",
32
+ "domain",
33
+ "max-age",
34
+ "expires",
35
+ "secure",
36
+ "httponly",
37
+ "samesite",
38
+ "partitioned",
39
+ "version",
40
+ "comment",
41
+ )
42
+ )
43
+ _COOKIE_BOOL_ATTRS = frozenset( # AKA Morsel._flags
44
+ ("secure", "httponly", "partitioned")
45
+ )
46
+
47
+ # SimpleCookie's pattern for parsing cookies with relaxed validation
48
+ # Based on http.cookies pattern but extended to allow more characters in cookie names
49
+ # to handle real-world cookies (fixes #2683)
50
+ _COOKIE_PATTERN = re.compile(
51
+ r"""
52
+ \s* # Optional whitespace at start of cookie
53
+ (?P<key> # Start of group 'key'
54
+ # aiohttp has extended to include [] for compatibility with real-world cookies
55
+ [\w\d!#%&'~_`><@,:/\$\*\+\-\.\^\|\)\(\?\}\{\[\]]+ # Any word of at least one letter
56
+ ) # End of group 'key'
57
+ ( # Optional group: there may not be a value.
58
+ \s*=\s* # Equal Sign
59
+ (?P<val> # Start of group 'val'
60
+ "(?:[^\\"]|\\.)*" # Any double-quoted string (properly closed)
61
+ | # or
62
+ "[^";]* # Unmatched opening quote (differs from SimpleCookie - issue #7993)
63
+ | # or
64
+ # Special case for "expires" attr - RFC 822, RFC 850, RFC 1036, RFC 1123
65
+ (\w{3,6}day|\w{3}),\s # Day of the week or abbreviated day (with comma)
66
+ [\w\d\s-]{9,11}\s[\d:]{8}\s # Date and time in specific format
67
+ (GMT|[+-]\d{4}) # Timezone: GMT or RFC 2822 offset like -0000, +0100
68
+ # NOTE: RFC 2822 timezone support is an aiohttp extension
69
+ # for issue #4493 - SimpleCookie does NOT support this
70
+ | # or
71
+ # ANSI C asctime() format: "Wed Jun 9 10:18:14 2021"
72
+ # NOTE: This is an aiohttp extension for issue #4327 - SimpleCookie does NOT support this format
73
+ \w{3}\s+\w{3}\s+[\s\d]\d\s+\d{2}:\d{2}:\d{2}\s+\d{4}
74
+ | # or
75
+ [\w\d!#%&'~_`><@,:/\$\*\+\-\.\^\|\)\(\?\}\{\=\[\]]* # Any word or empty string
76
+ ) # End of group 'val'
77
+ )? # End of optional value group
78
+ \s* # Any number of spaces.
79
+ (\s+|;|$) # Ending either at space, semicolon, or EOS.
80
+ """,
81
+ re.VERBOSE | re.ASCII,
82
+ )
83
+
84
+
85
+ def preserve_morsel_with_coded_value(cookie: Morsel[str]) -> Morsel[str]:
86
+ """
87
+ Preserve a Morsel's coded_value exactly as received from the server.
88
+
89
+ This function ensures that cookie encoding is preserved exactly as sent by
90
+ the server, which is critical for compatibility with old servers that have
91
+ strict requirements about cookie formats.
92
+
93
+ This addresses the issue described in https://github.com/aio-libs/aiohttp/pull/1453
94
+ where Python's SimpleCookie would re-encode cookies, breaking authentication
95
+ with certain servers.
96
+
97
+ Args:
98
+ cookie: A Morsel object from SimpleCookie
99
+
100
+ Returns:
101
+ A Morsel object with preserved coded_value
102
+
103
+ """
104
+ mrsl_val = cast("Morsel[str]", cookie.get(cookie.key, Morsel()))
105
+ # We use __setstate__ instead of the public set() API because it allows us to
106
+ # bypass validation and set already validated state. This is more stable than
107
+ # setting protected attributes directly and unlikely to change since it would
108
+ # break pickling.
109
+ try:
110
+ mrsl_val.__setstate__( # type: ignore[attr-defined]
111
+ {
112
+ "key": cookie.key,
113
+ "value": cookie.value,
114
+ "coded_value": cookie.coded_value,
115
+ }
116
+ )
117
+ except CookieError:
118
+ return cookie
119
+ return mrsl_val
120
+
121
+
122
+ _unquote_sub = re.compile(r"\\(?:([0-3][0-7][0-7])|(.))").sub
123
+
124
+
125
+ def _unquote_replace(m: re.Match[str]) -> str:
126
+ """
127
+ Replace function for _unquote_sub regex substitution.
128
+
129
+ Handles escaped characters in cookie values:
130
+ - Octal sequences are converted to their character representation
131
+ - Other escaped characters are unescaped by removing the backslash
132
+ """
133
+ if m[1]:
134
+ return chr(int(m[1], 8))
135
+ return m[2]
136
+
137
+
138
+ def _unquote(value: str) -> str:
139
+ """
140
+ Unquote a cookie value.
141
+
142
+ Vendored from http.cookies._unquote to ensure compatibility.
143
+
144
+ Note: The original implementation checked for None, but we've removed
145
+ that check since all callers already ensure the value is not None.
146
+ """
147
+ # If there aren't any doublequotes,
148
+ # then there can't be any special characters. See RFC 2109.
149
+ if len(value) < 2:
150
+ return value
151
+ if value[0] != '"' or value[-1] != '"':
152
+ return value
153
+
154
+ # We have to assume that we must decode this string.
155
+ # Down to work.
156
+
157
+ # Remove the "s
158
+ value = value[1:-1]
159
+
160
+ # Check for special sequences. Examples:
161
+ # \012 --> \n
162
+ # \" --> "
163
+ #
164
+ return _unquote_sub(_unquote_replace, value)
165
+
166
+
167
+ def parse_cookie_header(header: str) -> list[tuple[str, Morsel[str]]]:
168
+ """
169
+ Parse a Cookie header according to RFC 6265 Section 5.4.
170
+
171
+ Cookie headers contain only name-value pairs separated by semicolons.
172
+ There are no attributes in Cookie headers - even names that match
173
+ attribute names (like 'path' or 'secure') should be treated as cookies.
174
+
175
+ This parser uses the same regex-based approach as parse_set_cookie_headers
176
+ to properly handle quoted values that may contain semicolons. When the
177
+ regex fails to match a malformed cookie, it falls back to simple parsing
178
+ to ensure subsequent cookies are not lost
179
+ https://github.com/aio-libs/aiohttp/issues/11632
180
+
181
+ Args:
182
+ header: The Cookie header value to parse
183
+
184
+ Returns:
185
+ List of (name, Morsel) tuples for compatibility with SimpleCookie.update()
186
+ """
187
+ if not header:
188
+ return []
189
+
190
+ cookies: list[tuple[str, Morsel[str]]] = []
191
+ morsel: Morsel[str]
192
+ i = 0
193
+ n = len(header)
194
+
195
+ invalid_names = []
196
+ while i < n:
197
+ # Use the same pattern as parse_set_cookie_headers to find cookies
198
+ match = _COOKIE_PATTERN.match(header, i)
199
+ if not match:
200
+ # Fallback for malformed cookies https://github.com/aio-libs/aiohttp/issues/11632
201
+ # Find next semicolon to skip or attempt simple key=value parsing
202
+ next_semi = header.find(";", i)
203
+ eq_pos = header.find("=", i)
204
+
205
+ # Try to extract key=value if '=' comes before ';'
206
+ if eq_pos != -1 and (next_semi == -1 or eq_pos < next_semi):
207
+ end_pos = next_semi if next_semi != -1 else n
208
+ key = header[i:eq_pos].strip()
209
+ value = header[eq_pos + 1 : end_pos].strip()
210
+
211
+ # Validate the name (same as regex path)
212
+ if not _COOKIE_NAME_RE.match(key):
213
+ invalid_names.append(key)
214
+ else:
215
+ morsel = Morsel()
216
+ try:
217
+ morsel.__setstate__( # type: ignore[attr-defined]
218
+ {
219
+ "key": key,
220
+ "value": _unquote(value),
221
+ "coded_value": value,
222
+ }
223
+ )
224
+ except CookieError:
225
+ pass
226
+ else:
227
+ cookies.append((key, morsel))
228
+
229
+ # Move to next cookie or end
230
+ i = next_semi + 1 if next_semi != -1 else n
231
+ continue
232
+
233
+ key = match.group("key")
234
+ value = match.group("val") or ""
235
+ i = match.end(0)
236
+
237
+ # Validate the name
238
+ if not key or not _COOKIE_NAME_RE.match(key):
239
+ invalid_names.append(key)
240
+ continue
241
+
242
+ # Create new morsel
243
+ morsel = Morsel()
244
+ # Preserve the original value as coded_value (with quotes if present)
245
+ # We use __setstate__ instead of the public set() API because it allows us to
246
+ # bypass validation and set already validated state. This is more stable than
247
+ # setting protected attributes directly and unlikely to change since it would
248
+ # break pickling.
249
+ try:
250
+ morsel.__setstate__( # type: ignore[attr-defined]
251
+ {"key": key, "value": _unquote(value), "coded_value": value}
252
+ )
253
+ except CookieError:
254
+ continue
255
+
256
+ cookies.append((key, morsel))
257
+
258
+ if invalid_names:
259
+ internal_logger.debug(
260
+ "Cannot load cookie. Illegal cookie names: %r", invalid_names
261
+ )
262
+
263
+ return cookies
264
+
265
+
266
+ def parse_set_cookie_headers(headers: Sequence[str]) -> list[tuple[str, Morsel[str]]]:
267
+ """
268
+ Parse cookie headers using a vendored version of SimpleCookie parsing.
269
+
270
+ This implementation is based on SimpleCookie.__parse_string to ensure
271
+ compatibility with how SimpleCookie parses cookies, including handling
272
+ of malformed cookies with missing semicolons.
273
+
274
+ This function is used for both Cookie and Set-Cookie headers in order to be
275
+ forgiving. Ideally we would have followed RFC 6265 Section 5.2 (for Cookie
276
+ headers) and RFC 6265 Section 4.2.1 (for Set-Cookie headers), but the
277
+ real world data makes it impossible since we need to be a bit more forgiving.
278
+
279
+ NOTE: This implementation differs from SimpleCookie in handling unmatched quotes.
280
+ SimpleCookie will stop parsing when it encounters a cookie value with an unmatched
281
+ quote (e.g., 'cookie="value'), causing subsequent cookies to be silently dropped.
282
+ This implementation handles unmatched quotes more gracefully to prevent cookie loss.
283
+ See https://github.com/aio-libs/aiohttp/issues/7993
284
+ """
285
+ parsed_cookies: list[tuple[str, Morsel[str]]] = []
286
+
287
+ for header in headers:
288
+ if not header:
289
+ continue
290
+
291
+ # Parse cookie string using SimpleCookie's algorithm
292
+ i = 0
293
+ n = len(header)
294
+ current_morsel: Morsel[str] | None = None
295
+ morsel_seen = False
296
+
297
+ while 0 <= i < n:
298
+ # Start looking for a cookie
299
+ match = _COOKIE_PATTERN.match(header, i)
300
+ if not match:
301
+ # No more cookies
302
+ break
303
+
304
+ key, value = match.group("key"), match.group("val")
305
+ i = match.end(0)
306
+ lower_key = key.lower()
307
+
308
+ if key[0] == "$":
309
+ if not morsel_seen:
310
+ # We ignore attributes which pertain to the cookie
311
+ # mechanism as a whole, such as "$Version".
312
+ continue
313
+ # Process as attribute
314
+ if current_morsel is not None:
315
+ attr_lower_key = lower_key[1:]
316
+ if attr_lower_key in _COOKIE_KNOWN_ATTRS:
317
+ current_morsel[attr_lower_key] = value or ""
318
+ elif lower_key in _COOKIE_KNOWN_ATTRS:
319
+ if not morsel_seen:
320
+ # Invalid cookie string - attribute before cookie
321
+ break
322
+ if lower_key in _COOKIE_BOOL_ATTRS:
323
+ # Boolean attribute with any value should be True
324
+ if current_morsel is not None and current_morsel.isReservedKey(key):
325
+ current_morsel[lower_key] = True
326
+ elif value is None:
327
+ # Invalid cookie string - non-boolean attribute without value
328
+ break
329
+ elif current_morsel is not None:
330
+ # Regular attribute with value
331
+ current_morsel[lower_key] = _unquote(value)
332
+ elif value is not None:
333
+ # This is a cookie name=value pair
334
+ # Validate the name
335
+ if key in _COOKIE_KNOWN_ATTRS or not _COOKIE_NAME_RE.match(key):
336
+ internal_logger.warning(
337
+ "Can not load cookies: Illegal cookie name %r", key
338
+ )
339
+ current_morsel = None
340
+ else:
341
+ # Create new morsel
342
+ current_morsel = Morsel()
343
+ # Preserve the original value as coded_value (with quotes if present)
344
+ try:
345
+ current_morsel.__setstate__( # type: ignore[attr-defined]
346
+ {
347
+ "key": key,
348
+ "value": _unquote(value),
349
+ "coded_value": value,
350
+ }
351
+ )
352
+ except CookieError:
353
+ current_morsel = None
354
+ else:
355
+ parsed_cookies.append((key, current_morsel))
356
+ morsel_seen = True
357
+ else:
358
+ # Invalid cookie string - no value for non-attribute
359
+ break
360
+
361
+ return parsed_cookies
.venv/Lib/site-packages/aiohttp/_cparser.pxd ADDED
@@ -0,0 +1,159 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from libc.stdint cimport int32_t, uint8_t, uint16_t, uint64_t
2
+
3
+
4
+ cdef extern from "llhttp.h":
5
+
6
+ struct llhttp__internal_s:
7
+ int32_t _index
8
+ void* _span_pos0
9
+ void* _span_cb0
10
+ int32_t error
11
+ const char* reason
12
+ const char* error_pos
13
+ void* data
14
+ void* _current
15
+ uint64_t content_length
16
+ uint8_t type
17
+ uint8_t method
18
+ uint8_t http_major
19
+ uint8_t http_minor
20
+ uint8_t header_state
21
+ uint8_t lenient_flags
22
+ uint8_t upgrade
23
+ uint8_t finish
24
+ uint16_t flags
25
+ uint16_t status_code
26
+ void* settings
27
+
28
+ ctypedef llhttp__internal_s llhttp__internal_t
29
+ ctypedef llhttp__internal_t llhttp_t
30
+
31
+ ctypedef int (*llhttp_data_cb)(llhttp_t*, const char *at, size_t length) except -1
32
+ ctypedef int (*llhttp_cb)(llhttp_t*) except -1
33
+
34
+ struct llhttp_settings_s:
35
+ llhttp_cb on_message_begin
36
+ llhttp_data_cb on_url
37
+ llhttp_data_cb on_status
38
+ llhttp_data_cb on_header_field
39
+ llhttp_data_cb on_header_value
40
+ llhttp_cb on_headers_complete
41
+ llhttp_data_cb on_body
42
+ llhttp_cb on_message_complete
43
+ llhttp_cb on_chunk_header
44
+ llhttp_cb on_chunk_complete
45
+
46
+ llhttp_cb on_url_complete
47
+ llhttp_cb on_status_complete
48
+ llhttp_cb on_header_field_complete
49
+ llhttp_cb on_header_value_complete
50
+
51
+ ctypedef llhttp_settings_s llhttp_settings_t
52
+
53
+ enum llhttp_errno:
54
+ HPE_OK,
55
+ HPE_INTERNAL,
56
+ HPE_STRICT,
57
+ HPE_LF_EXPECTED,
58
+ HPE_UNEXPECTED_CONTENT_LENGTH,
59
+ HPE_CLOSED_CONNECTION,
60
+ HPE_INVALID_METHOD,
61
+ HPE_INVALID_URL,
62
+ HPE_INVALID_CONSTANT,
63
+ HPE_INVALID_VERSION,
64
+ HPE_INVALID_HEADER_TOKEN,
65
+ HPE_INVALID_CONTENT_LENGTH,
66
+ HPE_INVALID_CHUNK_SIZE,
67
+ HPE_INVALID_STATUS,
68
+ HPE_INVALID_EOF_STATE,
69
+ HPE_INVALID_TRANSFER_ENCODING,
70
+ HPE_CB_MESSAGE_BEGIN,
71
+ HPE_CB_HEADERS_COMPLETE,
72
+ HPE_CB_MESSAGE_COMPLETE,
73
+ HPE_CB_CHUNK_HEADER,
74
+ HPE_CB_CHUNK_COMPLETE,
75
+ HPE_PAUSED,
76
+ HPE_PAUSED_UPGRADE,
77
+ HPE_USER
78
+
79
+ ctypedef llhttp_errno llhttp_errno_t
80
+
81
+ enum llhttp_flags:
82
+ F_CHUNKED,
83
+ F_CONTENT_LENGTH
84
+
85
+ enum llhttp_type:
86
+ HTTP_REQUEST,
87
+ HTTP_RESPONSE,
88
+ HTTP_BOTH
89
+
90
+ enum llhttp_method:
91
+ HTTP_DELETE,
92
+ HTTP_GET,
93
+ HTTP_HEAD,
94
+ HTTP_POST,
95
+ HTTP_PUT,
96
+ HTTP_CONNECT,
97
+ HTTP_OPTIONS,
98
+ HTTP_TRACE,
99
+ HTTP_COPY,
100
+ HTTP_LOCK,
101
+ HTTP_MKCOL,
102
+ HTTP_MOVE,
103
+ HTTP_PROPFIND,
104
+ HTTP_PROPPATCH,
105
+ HTTP_SEARCH,
106
+ HTTP_UNLOCK,
107
+ HTTP_BIND,
108
+ HTTP_REBIND,
109
+ HTTP_UNBIND,
110
+ HTTP_ACL,
111
+ HTTP_REPORT,
112
+ HTTP_MKACTIVITY,
113
+ HTTP_CHECKOUT,
114
+ HTTP_MERGE,
115
+ HTTP_MSEARCH,
116
+ HTTP_NOTIFY,
117
+ HTTP_SUBSCRIBE,
118
+ HTTP_UNSUBSCRIBE,
119
+ HTTP_PATCH,
120
+ HTTP_PURGE,
121
+ HTTP_MKCALENDAR,
122
+ HTTP_LINK,
123
+ HTTP_UNLINK,
124
+ HTTP_SOURCE,
125
+ HTTP_PRI,
126
+ HTTP_DESCRIBE,
127
+ HTTP_ANNOUNCE,
128
+ HTTP_SETUP,
129
+ HTTP_PLAY,
130
+ HTTP_PAUSE,
131
+ HTTP_TEARDOWN,
132
+ HTTP_GET_PARAMETER,
133
+ HTTP_SET_PARAMETER,
134
+ HTTP_REDIRECT,
135
+ HTTP_RECORD,
136
+ HTTP_FLUSH
137
+
138
+ ctypedef llhttp_method llhttp_method_t;
139
+
140
+ void llhttp_settings_init(llhttp_settings_t* settings)
141
+ void llhttp_init(llhttp_t* parser, llhttp_type type,
142
+ const llhttp_settings_t* settings)
143
+
144
+ llhttp_errno_t llhttp_execute(llhttp_t* parser, const char* data, size_t len)
145
+
146
+ int llhttp_should_keep_alive(const llhttp_t* parser)
147
+
148
+ void llhttp_resume(llhttp_t* parser)
149
+ void llhttp_resume_after_upgrade(llhttp_t* parser)
150
+
151
+ llhttp_errno_t llhttp_get_errno(const llhttp_t* parser)
152
+ const char* llhttp_get_error_reason(const llhttp_t* parser)
153
+ const char* llhttp_get_error_pos(const llhttp_t* parser)
154
+
155
+ const char* llhttp_method_name(llhttp_method_t method)
156
+
157
+ void llhttp_set_lenient_headers(llhttp_t* parser, int enabled)
158
+ void llhttp_set_lenient_optional_cr_before_lf(llhttp_t* parser, int enabled)
159
+ void llhttp_set_lenient_spaces_after_chunk_size(llhttp_t* parser, int enabled)
.venv/Lib/site-packages/aiohttp/_find_header.pxd ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ cdef extern from "_find_header.h":
2
+ int find_header(char *, int)
.venv/Lib/site-packages/aiohttp/_headers.pxi ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # The file is autogenerated from aiohttp/hdrs.py
2
+ # Run ./tools/gen.py to update it after the origin changing.
3
+
4
+ from . import hdrs
5
+ cdef tuple headers = (
6
+ hdrs.ACCEPT,
7
+ hdrs.ACCEPT_CHARSET,
8
+ hdrs.ACCEPT_ENCODING,
9
+ hdrs.ACCEPT_LANGUAGE,
10
+ hdrs.ACCEPT_RANGES,
11
+ hdrs.ACCESS_CONTROL_ALLOW_CREDENTIALS,
12
+ hdrs.ACCESS_CONTROL_ALLOW_HEADERS,
13
+ hdrs.ACCESS_CONTROL_ALLOW_METHODS,
14
+ hdrs.ACCESS_CONTROL_ALLOW_ORIGIN,
15
+ hdrs.ACCESS_CONTROL_EXPOSE_HEADERS,
16
+ hdrs.ACCESS_CONTROL_MAX_AGE,
17
+ hdrs.ACCESS_CONTROL_REQUEST_HEADERS,
18
+ hdrs.ACCESS_CONTROL_REQUEST_METHOD,
19
+ hdrs.AGE,
20
+ hdrs.ALLOW,
21
+ hdrs.AUTHORIZATION,
22
+ hdrs.CACHE_CONTROL,
23
+ hdrs.CONNECTION,
24
+ hdrs.CONTENT_DISPOSITION,
25
+ hdrs.CONTENT_ENCODING,
26
+ hdrs.CONTENT_LANGUAGE,
27
+ hdrs.CONTENT_LENGTH,
28
+ hdrs.CONTENT_LOCATION,
29
+ hdrs.CONTENT_MD5,
30
+ hdrs.CONTENT_RANGE,
31
+ hdrs.CONTENT_TRANSFER_ENCODING,
32
+ hdrs.CONTENT_TYPE,
33
+ hdrs.COOKIE,
34
+ hdrs.DATE,
35
+ hdrs.DESTINATION,
36
+ hdrs.DIGEST,
37
+ hdrs.ETAG,
38
+ hdrs.EXPECT,
39
+ hdrs.EXPIRES,
40
+ hdrs.FORWARDED,
41
+ hdrs.FROM,
42
+ hdrs.HOST,
43
+ hdrs.IF_MATCH,
44
+ hdrs.IF_MODIFIED_SINCE,
45
+ hdrs.IF_NONE_MATCH,
46
+ hdrs.IF_RANGE,
47
+ hdrs.IF_UNMODIFIED_SINCE,
48
+ hdrs.KEEP_ALIVE,
49
+ hdrs.LAST_EVENT_ID,
50
+ hdrs.LAST_MODIFIED,
51
+ hdrs.LINK,
52
+ hdrs.LOCATION,
53
+ hdrs.MAX_FORWARDS,
54
+ hdrs.ORIGIN,
55
+ hdrs.PRAGMA,
56
+ hdrs.PROXY_AUTHENTICATE,
57
+ hdrs.PROXY_AUTHORIZATION,
58
+ hdrs.RANGE,
59
+ hdrs.REFERER,
60
+ hdrs.RETRY_AFTER,
61
+ hdrs.SEC_WEBSOCKET_ACCEPT,
62
+ hdrs.SEC_WEBSOCKET_EXTENSIONS,
63
+ hdrs.SEC_WEBSOCKET_KEY,
64
+ hdrs.SEC_WEBSOCKET_KEY1,
65
+ hdrs.SEC_WEBSOCKET_PROTOCOL,
66
+ hdrs.SEC_WEBSOCKET_VERSION,
67
+ hdrs.SERVER,
68
+ hdrs.SET_COOKIE,
69
+ hdrs.TE,
70
+ hdrs.TRAILER,
71
+ hdrs.TRANSFER_ENCODING,
72
+ hdrs.URI,
73
+ hdrs.UPGRADE,
74
+ hdrs.USER_AGENT,
75
+ hdrs.VARY,
76
+ hdrs.VIA,
77
+ hdrs.WWW_AUTHENTICATE,
78
+ hdrs.WANT_DIGEST,
79
+ hdrs.WARNING,
80
+ hdrs.X_FORWARDED_FOR,
81
+ hdrs.X_FORWARDED_HOST,
82
+ hdrs.X_FORWARDED_PROTO,
83
+ )
.venv/Lib/site-packages/aiohttp/_http_parser.cp312-win_amd64.pyd ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f7e435f24969c9d02da31a12f34e113d378c6fbe484fcf5d58e4635a62f8b0fa
3
+ size 253952
.venv/Lib/site-packages/aiohttp/_http_parser.pyx ADDED
@@ -0,0 +1,965 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Based on https://github.com/MagicStack/httptools
2
+ #
3
+
4
+ from cpython cimport (
5
+ Py_buffer,
6
+ PyBUF_SIMPLE,
7
+ PyBuffer_Release,
8
+ PyBytes_AsString,
9
+ PyBytes_AsStringAndSize,
10
+ PyObject_GetBuffer,
11
+ )
12
+ from cpython.mem cimport PyMem_Free, PyMem_Malloc
13
+ from libc.limits cimport ULLONG_MAX
14
+ from libc.string cimport memcpy
15
+
16
+ from multidict import CIMultiDict as _CIMultiDict, CIMultiDictProxy as _CIMultiDictProxy
17
+ from yarl import URL as _URL
18
+
19
+ from aiohttp import hdrs
20
+ from aiohttp.helpers import DEBUG, set_exception
21
+
22
+ from .http_exceptions import (
23
+ BadHttpMessage,
24
+ BadHttpMethod,
25
+ BadStatusLine,
26
+ ContentLengthError,
27
+ InvalidHeader,
28
+ InvalidURLError,
29
+ LineTooLong,
30
+ PayloadEncodingError,
31
+ TransferEncodingError,
32
+ )
33
+ from .http_parser import DeflateBuffer as _DeflateBuffer
34
+ from .http_writer import (
35
+ HttpVersion as _HttpVersion,
36
+ HttpVersion10 as _HttpVersion10,
37
+ HttpVersion11 as _HttpVersion11,
38
+ )
39
+ from .streams import EMPTY_PAYLOAD as _EMPTY_PAYLOAD, StreamReader as _StreamReader
40
+
41
+ cimport cython
42
+
43
+ from aiohttp cimport _cparser as cparser
44
+
45
+ include "_headers.pxi"
46
+
47
+ from aiohttp cimport _find_header
48
+
49
+
50
+ cdef frozenset ALLOWED_UPGRADES = frozenset({"websocket"})
51
+ DEF DEFAULT_FREELIST_SIZE = 250
52
+
53
+ cdef extern from "Python.h":
54
+ int PyByteArray_Resize(object, Py_ssize_t) except -1
55
+ Py_ssize_t PyByteArray_Size(object) except -1
56
+ char* PyByteArray_AsString(object)
57
+
58
+ __all__ = ('HttpRequestParser', 'HttpResponseParser',
59
+ 'RawRequestMessage', 'RawResponseMessage')
60
+
61
+ cdef object URL = _URL
62
+ cdef object URL_build = URL.build
63
+ cdef object CIMultiDict = _CIMultiDict
64
+ cdef object CIMultiDictProxy = _CIMultiDictProxy
65
+ cdef object HttpVersion = _HttpVersion
66
+ cdef object HttpVersion10 = _HttpVersion10
67
+ cdef object HttpVersion11 = _HttpVersion11
68
+ cdef object SEC_WEBSOCKET_KEY1 = hdrs.SEC_WEBSOCKET_KEY1
69
+ cdef object CONTENT_ENCODING = hdrs.CONTENT_ENCODING
70
+ cdef object EMPTY_PAYLOAD = _EMPTY_PAYLOAD
71
+ cdef object StreamReader = _StreamReader
72
+ cdef object DeflateBuffer = _DeflateBuffer
73
+ cdef tuple EMPTY_FEED_DATA_RESULT = ((), False, b"")
74
+
75
+ # RFC 9110 singleton headers — duplicates are rejected in strict mode.
76
+ # In lax mode (response parser default), the check is skipped entirely
77
+ # since real-world servers (e.g. Google APIs, Werkzeug) commonly send
78
+ # duplicate headers like Content-Type or Server.
79
+ cdef frozenset SINGLETON_HEADERS = frozenset({
80
+ hdrs.CONTENT_LENGTH,
81
+ hdrs.CONTENT_LOCATION,
82
+ hdrs.CONTENT_RANGE,
83
+ hdrs.CONTENT_TYPE,
84
+ hdrs.ETAG,
85
+ hdrs.HOST,
86
+ hdrs.MAX_FORWARDS,
87
+ hdrs.SERVER,
88
+ hdrs.TRANSFER_ENCODING,
89
+ hdrs.USER_AGENT,
90
+ })
91
+
92
+ cdef inline object extend(object buf, const char* at, size_t length):
93
+ cdef Py_ssize_t s
94
+ cdef char* ptr
95
+ s = PyByteArray_Size(buf)
96
+ PyByteArray_Resize(buf, s + length)
97
+ ptr = PyByteArray_AsString(buf)
98
+ memcpy(ptr + s, at, length)
99
+
100
+
101
+ DEF METHODS_COUNT = 46;
102
+
103
+ cdef list _http_method = []
104
+
105
+ for i in range(METHODS_COUNT):
106
+ _http_method.append(
107
+ cparser.llhttp_method_name(<cparser.llhttp_method_t> i).decode('ascii'))
108
+
109
+
110
+ cdef inline str http_method_str(int i):
111
+ if i < METHODS_COUNT:
112
+ return <str>_http_method[i]
113
+ else:
114
+ return "<unknown>"
115
+
116
+ cdef inline object find_header(bytes raw_header):
117
+ cdef Py_ssize_t size
118
+ cdef char *buf
119
+ cdef int idx
120
+ PyBytes_AsStringAndSize(raw_header, &buf, &size)
121
+ idx = _find_header.find_header(buf, size)
122
+ if idx == -1:
123
+ return raw_header.decode('utf-8', 'surrogateescape')
124
+ return headers[idx]
125
+
126
+
127
+ @cython.freelist(DEFAULT_FREELIST_SIZE)
128
+ cdef class RawRequestMessage:
129
+ cdef readonly str method
130
+ cdef readonly str path
131
+ cdef readonly object version # HttpVersion
132
+ cdef readonly object headers # CIMultiDict
133
+ cdef readonly object raw_headers # tuple
134
+ cdef readonly object should_close
135
+ cdef readonly object compression
136
+ cdef readonly object upgrade
137
+ cdef readonly object chunked
138
+ cdef readonly object url # yarl.URL
139
+
140
+ def __init__(self, method, path, version, headers, raw_headers,
141
+ should_close, compression, upgrade, chunked, url):
142
+ self.method = method
143
+ self.path = path
144
+ self.version = version
145
+ self.headers = headers
146
+ self.raw_headers = raw_headers
147
+ self.should_close = should_close
148
+ self.compression = compression
149
+ self.upgrade = upgrade
150
+ self.chunked = chunked
151
+ self.url = url
152
+
153
+ def __repr__(self):
154
+ info = []
155
+ info.append(("method", self.method))
156
+ info.append(("path", self.path))
157
+ info.append(("version", self.version))
158
+ info.append(("headers", self.headers))
159
+ info.append(("raw_headers", self.raw_headers))
160
+ info.append(("should_close", self.should_close))
161
+ info.append(("compression", self.compression))
162
+ info.append(("upgrade", self.upgrade))
163
+ info.append(("chunked", self.chunked))
164
+ info.append(("url", self.url))
165
+ sinfo = ', '.join(name + '=' + repr(val) for name, val in info)
166
+ return '<RawRequestMessage(' + sinfo + ')>'
167
+
168
+ def _replace(self, **dct):
169
+ cdef RawRequestMessage ret
170
+ ret = _new_request_message(self.method,
171
+ self.path,
172
+ self.version,
173
+ self.headers,
174
+ self.raw_headers,
175
+ self.should_close,
176
+ self.compression,
177
+ self.upgrade,
178
+ self.chunked,
179
+ self.url)
180
+ if "method" in dct:
181
+ ret.method = dct["method"]
182
+ if "path" in dct:
183
+ ret.path = dct["path"]
184
+ if "version" in dct:
185
+ ret.version = dct["version"]
186
+ if "headers" in dct:
187
+ ret.headers = dct["headers"]
188
+ if "raw_headers" in dct:
189
+ ret.raw_headers = dct["raw_headers"]
190
+ if "should_close" in dct:
191
+ ret.should_close = dct["should_close"]
192
+ if "compression" in dct:
193
+ ret.compression = dct["compression"]
194
+ if "upgrade" in dct:
195
+ ret.upgrade = dct["upgrade"]
196
+ if "chunked" in dct:
197
+ ret.chunked = dct["chunked"]
198
+ if "url" in dct:
199
+ ret.url = dct["url"]
200
+ return ret
201
+
202
+ cdef _new_request_message(str method,
203
+ str path,
204
+ object version,
205
+ object headers,
206
+ object raw_headers,
207
+ bint should_close,
208
+ object compression,
209
+ bint upgrade,
210
+ bint chunked,
211
+ object url):
212
+ cdef RawRequestMessage ret
213
+ ret = RawRequestMessage.__new__(RawRequestMessage)
214
+ ret.method = method
215
+ ret.path = path
216
+ ret.version = version
217
+ ret.headers = headers
218
+ ret.raw_headers = raw_headers
219
+ ret.should_close = should_close
220
+ ret.compression = compression
221
+ ret.upgrade = upgrade
222
+ ret.chunked = chunked
223
+ ret.url = url
224
+ return ret
225
+
226
+
227
+ @cython.freelist(DEFAULT_FREELIST_SIZE)
228
+ cdef class RawResponseMessage:
229
+ cdef readonly object version # HttpVersion
230
+ cdef readonly int code
231
+ cdef readonly str reason
232
+ cdef readonly object headers # CIMultiDict
233
+ cdef readonly object raw_headers # tuple
234
+ cdef readonly object should_close
235
+ cdef readonly object compression
236
+ cdef readonly object upgrade
237
+ cdef readonly object chunked
238
+
239
+ def __init__(self, version, code, reason, headers, raw_headers,
240
+ should_close, compression, upgrade, chunked):
241
+ self.version = version
242
+ self.code = code
243
+ self.reason = reason
244
+ self.headers = headers
245
+ self.raw_headers = raw_headers
246
+ self.should_close = should_close
247
+ self.compression = compression
248
+ self.upgrade = upgrade
249
+ self.chunked = chunked
250
+
251
+ def __repr__(self):
252
+ info = []
253
+ info.append(("version", self.version))
254
+ info.append(("code", self.code))
255
+ info.append(("reason", self.reason))
256
+ info.append(("headers", self.headers))
257
+ info.append(("raw_headers", self.raw_headers))
258
+ info.append(("should_close", self.should_close))
259
+ info.append(("compression", self.compression))
260
+ info.append(("upgrade", self.upgrade))
261
+ info.append(("chunked", self.chunked))
262
+ sinfo = ', '.join(name + '=' + repr(val) for name, val in info)
263
+ return '<RawResponseMessage(' + sinfo + ')>'
264
+
265
+
266
+ cdef _new_response_message(object version,
267
+ int code,
268
+ str reason,
269
+ object headers,
270
+ object raw_headers,
271
+ bint should_close,
272
+ object compression,
273
+ bint upgrade,
274
+ bint chunked):
275
+ cdef RawResponseMessage ret
276
+ ret = RawResponseMessage.__new__(RawResponseMessage)
277
+ ret.version = version
278
+ ret.code = code
279
+ ret.reason = reason
280
+ ret.headers = headers
281
+ ret.raw_headers = raw_headers
282
+ ret.should_close = should_close
283
+ ret.compression = compression
284
+ ret.upgrade = upgrade
285
+ ret.chunked = chunked
286
+ return ret
287
+
288
+
289
+ @cython.internal
290
+ cdef class HttpParser:
291
+
292
+ cdef:
293
+ cparser.llhttp_t* _cparser
294
+ cparser.llhttp_settings_t* _csettings
295
+
296
+ bytes _raw_name
297
+ object _name
298
+ bytes _raw_value
299
+ bint _has_value
300
+ int _header_name_size
301
+
302
+ readonly object protocol
303
+ object _loop
304
+ object _timer
305
+
306
+ size_t _max_line_size
307
+ size_t _max_field_size
308
+ size_t _max_headers
309
+ bint _response_with_body
310
+ bint _read_until_eof
311
+ bint _lax
312
+
313
+ bytes _tail
314
+ bint _started
315
+ object _url
316
+ bytearray _buf
317
+ str _path
318
+ str _reason
319
+ list _headers
320
+ set _seen_singletons
321
+ list _raw_headers
322
+ bint _upgraded
323
+ list _messages
324
+ bint _more_data_available
325
+ bint _paused
326
+ Py_ssize_t _msg_in_flight
327
+ Py_ssize_t _max_msg_queue_size
328
+ bint _eof_pending
329
+ object _payload
330
+ unsigned long long _content_length_expected
331
+ bint _payload_error
332
+ object _payload_exception
333
+ object _last_error
334
+ bint _auto_decompress
335
+ int _limit
336
+
337
+ str _content_encoding
338
+
339
+ Py_buffer py_buf
340
+
341
+ def __cinit__(self):
342
+ self._cparser = <cparser.llhttp_t*> \
343
+ PyMem_Malloc(sizeof(cparser.llhttp_t))
344
+ if self._cparser is NULL:
345
+ raise MemoryError()
346
+
347
+ self._csettings = <cparser.llhttp_settings_t*> \
348
+ PyMem_Malloc(sizeof(cparser.llhttp_settings_t))
349
+ if self._csettings is NULL:
350
+ raise MemoryError()
351
+
352
+ def __dealloc__(self):
353
+ PyMem_Free(self._cparser)
354
+ PyMem_Free(self._csettings)
355
+
356
+ cdef _init(
357
+ self, cparser.llhttp_type mode,
358
+ object protocol, object loop, int limit,
359
+ object timer=None,
360
+ size_t max_line_size=8190, size_t max_headers=128,
361
+ size_t max_field_size=8190, payload_exception=None,
362
+ bint response_with_body=True, bint read_until_eof=False,
363
+ bint auto_decompress=True,
364
+ Py_ssize_t max_msg_queue_size=0,
365
+ ):
366
+ cparser.llhttp_settings_init(self._csettings)
367
+ cparser.llhttp_init(self._cparser, mode, self._csettings)
368
+ self._cparser.data = <void*>self
369
+ self._cparser.content_length = 0
370
+ self._content_length_expected = 0
371
+
372
+ self.protocol = protocol
373
+ self._loop = loop
374
+ self._timer = timer
375
+
376
+ self._buf = bytearray()
377
+ self._more_data_available = False
378
+ self._paused = False
379
+ self._msg_in_flight = 0
380
+ self._max_msg_queue_size = max_msg_queue_size
381
+ self._eof_pending = False
382
+ self._payload = None
383
+ self._payload_error = 0
384
+ self._payload_exception = payload_exception
385
+ self._messages = []
386
+
387
+ self._raw_name = b""
388
+ self._raw_value = b""
389
+ self._tail = b""
390
+ self._has_value = False
391
+ self._header_name_size = 0
392
+
393
+ self._max_line_size = max_line_size
394
+ self._max_headers = max_headers
395
+ self._max_field_size = max_field_size
396
+ self._response_with_body = response_with_body
397
+ self._read_until_eof = read_until_eof
398
+ self._upgraded = False
399
+ self._auto_decompress = auto_decompress
400
+ self._content_encoding = None
401
+ self._lax = False
402
+ self._seen_singletons = set()
403
+
404
+ self._csettings.on_url = cb_on_url
405
+ self._csettings.on_status = cb_on_status
406
+ self._csettings.on_header_field = cb_on_header_field
407
+ self._csettings.on_header_value = cb_on_header_value
408
+ self._csettings.on_headers_complete = cb_on_headers_complete
409
+ self._csettings.on_body = cb_on_body
410
+ self._csettings.on_message_begin = cb_on_message_begin
411
+ self._csettings.on_message_complete = cb_on_message_complete
412
+ self._csettings.on_chunk_header = cb_on_chunk_header
413
+ self._csettings.on_chunk_complete = cb_on_chunk_complete
414
+
415
+ self._last_error = None
416
+ self._limit = limit
417
+
418
+ cdef _process_header(self):
419
+ cdef str value
420
+ if self._raw_name != b"":
421
+ name = find_header(self._raw_name)
422
+ value = self._raw_value.decode('utf-8', 'surrogateescape')
423
+
424
+ # reject null bytes in header values - matches the Python parser
425
+ # check at http_parser.py. llhttp in lenient mode doesn't reject
426
+ # these itself, so we need to catch them here.
427
+ # ref: RFC 9110 section 5.5 (CTL chars forbidden in field values)
428
+ if "\x00" in value:
429
+ raise InvalidHeader(self._raw_value)
430
+
431
+ if not self._lax and name in SINGLETON_HEADERS:
432
+ if name in self._seen_singletons:
433
+ raise BadHttpMessage(f"Duplicate '{name}' header found.")
434
+ self._seen_singletons.add(name)
435
+ self._headers.append((name, value))
436
+ if len(self._headers) > self._max_headers:
437
+ raise BadHttpMessage("Too many headers received")
438
+
439
+ if name is CONTENT_ENCODING:
440
+ self._content_encoding = value
441
+
442
+ self._has_value = False
443
+ self._header_name_size = 0
444
+ self._raw_headers.append((self._raw_name, self._raw_value))
445
+ self._raw_name = b""
446
+ self._raw_value = b""
447
+
448
+ cdef _on_header_field(self, char* at, size_t length):
449
+ if self._has_value:
450
+ self._process_header()
451
+
452
+ if self._raw_name == b"":
453
+ self._raw_name = at[:length]
454
+ else:
455
+ self._raw_name += at[:length]
456
+
457
+ cdef _on_header_value(self, char* at, size_t length):
458
+ if self._raw_value == b"":
459
+ self._raw_value = at[:length]
460
+ else:
461
+ self._raw_value += at[:length]
462
+ self._has_value = True
463
+
464
+ cdef _on_headers_complete(self):
465
+ cdef str h_upg
466
+ cdef str enc
467
+
468
+ self._process_header()
469
+
470
+ http_version = self.http_version()
471
+ should_close = not cparser.llhttp_should_keep_alive(self._cparser)
472
+ upgrade = self._cparser.upgrade
473
+ chunked = self._cparser.flags & cparser.F_CHUNKED
474
+
475
+ raw_headers = tuple(self._raw_headers)
476
+ headers = CIMultiDictProxy(CIMultiDict(self._headers))
477
+
478
+ if self._cparser.type == cparser.HTTP_REQUEST:
479
+ if http_version == HttpVersion11 and hdrs.HOST not in headers:
480
+ raise BadHttpMessage("Missing 'Host' header in request.")
481
+ h_upg = headers.get("upgrade", "")
482
+ if (upgrade and h_upg.isascii() and h_upg.lower() in ALLOWED_UPGRADES) or self._cparser.method == cparser.HTTP_CONNECT:
483
+ self._upgraded = True
484
+ else:
485
+ if upgrade and self._cparser.status_code == 101:
486
+ self._upgraded = True
487
+
488
+ # do not support old websocket spec
489
+ if SEC_WEBSOCKET_KEY1 in headers:
490
+ raise InvalidHeader(SEC_WEBSOCKET_KEY1)
491
+
492
+ encoding = None
493
+ enc = self._content_encoding
494
+ if enc is not None:
495
+ self._content_encoding = None
496
+ if enc.isascii() and enc.lower() in {"gzip", "deflate", "br", "zstd"}:
497
+ encoding = enc
498
+
499
+ if self._cparser.type == cparser.HTTP_REQUEST:
500
+ method = http_method_str(self._cparser.method)
501
+ msg = _new_request_message(
502
+ method, self._path,
503
+ http_version, headers, raw_headers,
504
+ should_close, encoding, upgrade, chunked, self._url)
505
+ else:
506
+ msg = _new_response_message(
507
+ http_version, self._cparser.status_code, self._reason,
508
+ headers, raw_headers, should_close, encoding,
509
+ upgrade, chunked)
510
+
511
+ if (
512
+ self._response_with_body
513
+ and (
514
+ ULLONG_MAX > self._cparser.content_length > 0 or chunked or
515
+ self._cparser.method == cparser.HTTP_CONNECT or
516
+ (self._cparser.status_code >= 199 and
517
+ self._cparser.content_length == 0 and
518
+ self._read_until_eof)
519
+ )
520
+ ):
521
+ payload = StreamReader(
522
+ self.protocol, timer=self._timer, loop=self._loop,
523
+ limit=self._limit)
524
+ else:
525
+ payload = EMPTY_PAYLOAD
526
+
527
+ self._payload = payload
528
+ self._content_length_expected = self._cparser.content_length
529
+ if encoding is not None and self._auto_decompress:
530
+ self._payload = DeflateBuffer(payload, encoding, max_decompress_size=self._limit)
531
+
532
+ self._messages.append((msg, payload))
533
+
534
+ cdef _on_message_complete(self):
535
+ self._payload.feed_eof()
536
+ self._payload = None
537
+
538
+ cdef _on_chunk_header(self):
539
+ self._payload.begin_http_chunk_receiving()
540
+
541
+ cdef _on_chunk_complete(self):
542
+ self._payload.end_http_chunk_receiving()
543
+
544
+ cdef object _on_status_complete(self):
545
+ pass
546
+
547
+ cdef inline http_version(self):
548
+ cdef cparser.llhttp_t* parser = self._cparser
549
+
550
+ if parser.http_major == 1:
551
+ if parser.http_minor == 0:
552
+ return HttpVersion10
553
+ elif parser.http_minor == 1:
554
+ return HttpVersion11
555
+
556
+ return HttpVersion(parser.http_major, parser.http_minor)
557
+
558
+ ### Public API ###
559
+
560
+ def pause_reading(self):
561
+ assert self._payload is not None
562
+ self._paused = True
563
+
564
+ def message_consumed(self):
565
+ # Protocol drained a queued message; free a slot for parsing.
566
+ if self._msg_in_flight > 0:
567
+ self._msg_in_flight -= 1
568
+
569
+ def feed_eof(self):
570
+ cdef bytes desc
571
+
572
+ if self._payload is not None:
573
+ if self._cparser.flags & cparser.F_CHUNKED:
574
+ raise TransferEncodingError(
575
+ "Not enough data to satisfy transfer length header.")
576
+ elif self._cparser.flags & cparser.F_CONTENT_LENGTH:
577
+ received = self._content_length_expected - self._cparser.content_length
578
+ raise ContentLengthError(
579
+ f"Not enough data to satisfy content length header "
580
+ f"(received {received} of {self._content_length_expected} bytes).")
581
+ elif cparser.llhttp_get_errno(self._cparser) != cparser.HPE_OK:
582
+ desc = cparser.llhttp_get_error_reason(self._cparser)
583
+ raise PayloadEncodingError(desc.decode('latin-1'))
584
+ else:
585
+ self._eof_pending = True
586
+ while self._more_data_available:
587
+ if self._paused:
588
+ self._paused = False
589
+ return # Will resume via feed_data(b"") later
590
+ self._more_data_available = self._payload.feed_data(b"", 0)
591
+ self._payload.feed_eof()
592
+ self._payload = None
593
+ self._more_data_available = False
594
+ self._eof_pending = False
595
+ elif self._started:
596
+ self._on_headers_complete()
597
+ if self._messages:
598
+ return self._messages[-1][0]
599
+
600
+ def feed_data(self, incoming_data):
601
+ cdef:
602
+ size_t data_len
603
+ size_t nb
604
+ char* base
605
+ cdef cparser.llhttp_errno_t errno
606
+ cdef bytes data
607
+
608
+ # Proactor loop sends bytearray.
609
+ # Ensure cython sees `data` as bytes
610
+ if type(incoming_data) is not bytes:
611
+ data = bytes(incoming_data)
612
+ else:
613
+ data = incoming_data
614
+
615
+ if self._tail:
616
+ data, self._tail = self._tail + data, b""
617
+
618
+ if self._more_data_available:
619
+ result = cb_on_body(self._cparser, b"", 0)
620
+ if result is cparser.HPE_PAUSED:
621
+ self._tail = data
622
+ return EMPTY_FEED_DATA_RESULT
623
+
624
+ if self._eof_pending:
625
+ self._payload.feed_eof()
626
+ self._payload = None
627
+ self._eof_pending = False
628
+ # We can't have new messages here, otherwise we wouldn't have
629
+ # received EOF.
630
+ return EMPTY_FEED_DATA_RESULT
631
+
632
+ PyObject_GetBuffer(data, &self.py_buf, PyBUF_SIMPLE)
633
+ # Cache buffer pointer before PyBuffer_Release to avoid use-after-release.
634
+ base = <char*>self.py_buf.buf
635
+ data_len = <size_t>self.py_buf.len
636
+
637
+ errno = cparser.llhttp_execute(
638
+ self._cparser,
639
+ base,
640
+ data_len)
641
+
642
+ if errno is cparser.HPE_PAUSED_UPGRADE:
643
+ cparser.llhttp_resume_after_upgrade(self._cparser)
644
+ nb = cparser.llhttp_get_error_pos(self._cparser) - base
645
+ elif errno is cparser.HPE_PAUSED:
646
+ cparser.llhttp_resume(self._cparser)
647
+ pos = cparser.llhttp_get_error_pos(self._cparser) - base
648
+ self._tail = data[pos:]
649
+
650
+ PyBuffer_Release(&self.py_buf)
651
+
652
+ if errno not in (cparser.HPE_OK, cparser.HPE_PAUSED, cparser.HPE_PAUSED_UPGRADE):
653
+ if self._payload_error == 0:
654
+ if self._last_error is not None:
655
+ ex = self._last_error
656
+ self._last_error = None
657
+ else:
658
+ after = cparser.llhttp_get_error_pos(self._cparser)
659
+ before = data[:after - base]
660
+ after_b = after.split(b"\r\n", 1)[0]
661
+ before = before.rsplit(b"\r\n", 1)[-1]
662
+ data = before + after_b
663
+ pointer = " " * (len(repr(before))-1) + "^"
664
+ ex = parser_error_from_errno(self._cparser, data, pointer)
665
+ self._payload = None
666
+ raise ex
667
+
668
+ if self._messages:
669
+ messages = self._messages
670
+ self._messages = []
671
+ else:
672
+ messages = ()
673
+
674
+ if self._upgraded:
675
+ return messages, True, data[nb:]
676
+ if not messages: # Shortcut to reduce Python overhead
677
+ return EMPTY_FEED_DATA_RESULT
678
+ return messages, False, b""
679
+
680
+ def set_upgraded(self, val):
681
+ self._upgraded = val
682
+
683
+
684
+ cdef class HttpRequestParser(HttpParser):
685
+
686
+ def __init__(
687
+ self, protocol, loop, int limit, timer=None,
688
+ size_t max_line_size=8190, size_t max_headers=128,
689
+ size_t max_field_size=8190, payload_exception=None,
690
+ bint response_with_body=True, bint read_until_eof=False,
691
+ bint auto_decompress=True, Py_ssize_t max_msg_queue_size=0,
692
+ ):
693
+ self._init(cparser.HTTP_REQUEST, protocol, loop, limit, timer,
694
+ max_line_size, max_headers, max_field_size,
695
+ payload_exception, response_with_body, read_until_eof,
696
+ auto_decompress, max_msg_queue_size)
697
+
698
+ cdef object _on_status_complete(self):
699
+ cdef int idx1, idx2
700
+ if not self._buf:
701
+ return
702
+ self._path = self._buf.decode('utf-8', 'surrogateescape')
703
+ try:
704
+ idx3 = len(self._path)
705
+ if self._cparser.method == cparser.HTTP_CONNECT:
706
+ # authority-form,
707
+ # https://datatracker.ietf.org/doc/html/rfc7230#section-5.3.3
708
+ self._url = URL.build(authority=self._path, encoded=True)
709
+ elif idx3 > 1 and self._path[0] == '/':
710
+ # origin-form,
711
+ # https://datatracker.ietf.org/doc/html/rfc7230#section-5.3.1
712
+ idx1 = self._path.find("?")
713
+ if idx1 == -1:
714
+ query = ""
715
+ idx2 = self._path.find("#")
716
+ if idx2 == -1:
717
+ path = self._path
718
+ fragment = ""
719
+ else:
720
+ path = self._path[0: idx2]
721
+ fragment = self._path[idx2+1:]
722
+
723
+ else:
724
+ path = self._path[0:idx1]
725
+ idx1 += 1
726
+ idx2 = self._path.find("#", idx1+1)
727
+ if idx2 == -1:
728
+ query = self._path[idx1:]
729
+ fragment = ""
730
+ else:
731
+ query = self._path[idx1: idx2]
732
+ fragment = self._path[idx2+1:]
733
+
734
+ self._url = URL.build(
735
+ path=path,
736
+ query_string=query,
737
+ fragment=fragment,
738
+ encoded=True,
739
+ )
740
+ else:
741
+ # absolute-form for proxy maybe,
742
+ # https://datatracker.ietf.org/doc/html/rfc7230#section-5.3.2
743
+ self._url = URL(self._path, encoded=True)
744
+ finally:
745
+ PyByteArray_Resize(self._buf, 0)
746
+
747
+
748
+ cdef class HttpResponseParser(HttpParser):
749
+
750
+ def __init__(
751
+ self, protocol, loop, int limit, timer=None,
752
+ size_t max_line_size=8190, size_t max_headers=128,
753
+ size_t max_field_size=8190, payload_exception=None,
754
+ bint response_with_body=True, bint read_until_eof=False,
755
+ bint auto_decompress=True
756
+ ):
757
+ self._init(cparser.HTTP_RESPONSE, protocol, loop, limit, timer,
758
+ max_line_size, max_headers, max_field_size,
759
+ payload_exception, response_with_body, read_until_eof,
760
+ auto_decompress)
761
+ # Use strict parsing on dev mode, so users are warned about broken servers.
762
+ if not DEBUG:
763
+ cparser.llhttp_set_lenient_headers(self._cparser, 1)
764
+ cparser.llhttp_set_lenient_optional_cr_before_lf(self._cparser, 1)
765
+ cparser.llhttp_set_lenient_spaces_after_chunk_size(self._cparser, 1)
766
+ self._lax = True
767
+
768
+ cdef object _on_status_complete(self):
769
+ if self._buf:
770
+ self._reason = self._buf.decode('utf-8', 'surrogateescape')
771
+ PyByteArray_Resize(self._buf, 0)
772
+ else:
773
+ self._reason = self._reason or ''
774
+
775
+ cdef int cb_on_message_begin(cparser.llhttp_t* parser) except -1:
776
+ cdef HttpParser pyparser = <HttpParser>parser.data
777
+
778
+ pyparser._started = True
779
+ pyparser._headers = []
780
+ pyparser._seen_singletons = set()
781
+ pyparser._raw_headers = []
782
+ PyByteArray_Resize(pyparser._buf, 0)
783
+ pyparser._path = None
784
+ pyparser._reason = None
785
+ return 0
786
+
787
+
788
+ cdef int cb_on_url(cparser.llhttp_t* parser,
789
+ const char *at, size_t length) except -1:
790
+ cdef HttpParser pyparser = <HttpParser>parser.data
791
+ try:
792
+ if len(pyparser._buf) + length > pyparser._max_line_size:
793
+ status = pyparser._buf + at[:length]
794
+ raise LineTooLong(status[:100] + b"...", pyparser._max_line_size)
795
+ extend(pyparser._buf, at, length)
796
+ except BaseException as ex:
797
+ pyparser._last_error = ex
798
+ return -1
799
+ else:
800
+ return 0
801
+
802
+
803
+ cdef int cb_on_status(cparser.llhttp_t* parser,
804
+ const char *at, size_t length) except -1:
805
+ cdef HttpParser pyparser = <HttpParser>parser.data
806
+ try:
807
+ if len(pyparser._buf) + length > pyparser._max_line_size:
808
+ reason = pyparser._buf + at[:length]
809
+ raise LineTooLong(reason[:100] + b"...", pyparser._max_line_size)
810
+ extend(pyparser._buf, at, length)
811
+ except BaseException as ex:
812
+ pyparser._last_error = ex
813
+ return -1
814
+ else:
815
+ return 0
816
+
817
+
818
+ cdef int cb_on_header_field(cparser.llhttp_t* parser,
819
+ const char *at, size_t length) except -1:
820
+ cdef HttpParser pyparser = <HttpParser>parser.data
821
+ cdef Py_ssize_t size
822
+ try:
823
+ pyparser._on_status_complete()
824
+ size = len(pyparser._raw_name) + length
825
+ if size > pyparser._max_field_size:
826
+ name = pyparser._raw_name + at[:length]
827
+ raise LineTooLong(name[:100] + b"...", pyparser._max_field_size)
828
+ pyparser._header_name_size = size
829
+ pyparser._on_header_field(at, length)
830
+ except BaseException as ex:
831
+ pyparser._last_error = ex
832
+ return -1
833
+ else:
834
+ return 0
835
+
836
+
837
+ cdef int cb_on_header_value(cparser.llhttp_t* parser,
838
+ const char *at, size_t length) except -1:
839
+ cdef HttpParser pyparser = <HttpParser>parser.data
840
+ cdef Py_ssize_t size
841
+ try:
842
+ size = len(pyparser._raw_value) + length
843
+ if pyparser._header_name_size + size > pyparser._max_field_size:
844
+ value = pyparser._raw_value + at[:length]
845
+ raise LineTooLong(value[:100] + b"...", pyparser._max_field_size)
846
+ pyparser._on_header_value(at, length)
847
+ except BaseException as ex:
848
+ pyparser._last_error = ex
849
+ return -1
850
+ else:
851
+ return 0
852
+
853
+
854
+ cdef int cb_on_headers_complete(cparser.llhttp_t* parser) except -1:
855
+ cdef HttpParser pyparser = <HttpParser>parser.data
856
+ try:
857
+ pyparser._on_status_complete()
858
+ pyparser._on_headers_complete()
859
+ except BaseException as exc:
860
+ pyparser._last_error = exc
861
+ return -1
862
+ else:
863
+ if pyparser._upgraded or pyparser._cparser.method == cparser.HTTP_CONNECT:
864
+ return 2
865
+ if not pyparser._response_with_body:
866
+ return 1
867
+ return 0
868
+
869
+
870
+ cdef int cb_on_body(cparser.llhttp_t* parser,
871
+ const char *at, size_t length) except -1:
872
+ cdef HttpParser pyparser = <HttpParser>parser.data
873
+ cdef bytes body = at[:length]
874
+ while body or pyparser._more_data_available:
875
+ try:
876
+ pyparser._more_data_available = pyparser._payload.feed_data(body, length)
877
+ except BaseException as underlying_exc:
878
+ reraised_exc = underlying_exc
879
+ if pyparser._payload_exception is not None:
880
+ reraised_exc = pyparser._payload_exception(str(underlying_exc))
881
+
882
+ set_exception(pyparser._payload, reraised_exc, underlying_exc)
883
+
884
+ pyparser._payload_error = 1
885
+ pyparser._paused = False
886
+ return -1
887
+ body = b""
888
+ length = 0
889
+
890
+ if pyparser._paused:
891
+ pyparser._paused = False
892
+ return cparser.HPE_PAUSED
893
+ pyparser._paused = False
894
+ return 0
895
+
896
+
897
+ cdef int cb_on_message_complete(cparser.llhttp_t* parser) except -1:
898
+ cdef HttpParser pyparser = <HttpParser>parser.data
899
+ try:
900
+ pyparser._started = False
901
+ pyparser._on_message_complete()
902
+ except BaseException as exc:
903
+ pyparser._last_error = exc
904
+ return -1
905
+ else:
906
+ if pyparser._max_msg_queue_size:
907
+ pyparser._msg_in_flight += 1
908
+ if pyparser._msg_in_flight >= pyparser._max_msg_queue_size:
909
+ # Queue full: pause llhttp between messages. feed_data() buffers
910
+ # the remainder as tail; resumes once the queue drains.
911
+ return cparser.HPE_PAUSED
912
+ return 0
913
+
914
+
915
+ cdef int cb_on_chunk_header(cparser.llhttp_t* parser) except -1:
916
+ cdef HttpParser pyparser = <HttpParser>parser.data
917
+ try:
918
+ pyparser._on_chunk_header()
919
+ except BaseException as exc:
920
+ pyparser._last_error = exc
921
+ return -1
922
+ else:
923
+ return 0
924
+
925
+
926
+ cdef int cb_on_chunk_complete(cparser.llhttp_t* parser) except -1:
927
+ cdef HttpParser pyparser = <HttpParser>parser.data
928
+ try:
929
+ pyparser._on_chunk_complete()
930
+ except BaseException as exc:
931
+ pyparser._last_error = exc
932
+ return -1
933
+ else:
934
+ return 0
935
+
936
+
937
+ cdef parser_error_from_errno(cparser.llhttp_t* parser, data, pointer):
938
+ cdef cparser.llhttp_errno_t errno = cparser.llhttp_get_errno(parser)
939
+ cdef bytes desc = cparser.llhttp_get_error_reason(parser)
940
+
941
+ err_msg = "{}:\n\n {!r}\n {}".format(desc.decode("latin-1"), data, pointer)
942
+
943
+ if errno in {cparser.HPE_CB_MESSAGE_BEGIN,
944
+ cparser.HPE_CB_HEADERS_COMPLETE,
945
+ cparser.HPE_CB_MESSAGE_COMPLETE,
946
+ cparser.HPE_CB_CHUNK_HEADER,
947
+ cparser.HPE_CB_CHUNK_COMPLETE,
948
+ cparser.HPE_INVALID_HEADER_TOKEN,
949
+ cparser.HPE_INVALID_CONTENT_LENGTH,
950
+ cparser.HPE_INVALID_CHUNK_SIZE,
951
+ cparser.HPE_INVALID_EOF_STATE,
952
+ cparser.HPE_INVALID_TRANSFER_ENCODING}:
953
+ return BadHttpMessage(err_msg)
954
+ elif errno == cparser.HPE_INVALID_METHOD:
955
+ if data.startswith(b"\x16\x03"):
956
+ return BadHttpMethod(error="Received HTTPS traffic on an HTTP port")
957
+ return BadHttpMethod(error=err_msg)
958
+ elif errno in {cparser.HPE_INVALID_STATUS,
959
+ cparser.HPE_INVALID_VERSION,
960
+ cparser.HPE_INVALID_CONSTANT}:
961
+ return BadStatusLine(error=f"Bad status line:\n {err_msg}")
962
+ elif errno == cparser.HPE_INVALID_URL:
963
+ return InvalidURLError(err_msg)
964
+
965
+ return BadHttpMessage(err_msg)
.venv/Lib/site-packages/aiohttp/_http_writer.cp312-win_amd64.pyd ADDED
Binary file (46.6 kB). View file
 
.venv/Lib/site-packages/aiohttp/_http_writer.pyx ADDED
@@ -0,0 +1,164 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from cpython.bytes cimport PyBytes_FromStringAndSize
2
+ from cpython.exc cimport PyErr_NoMemory
3
+ from cpython.mem cimport PyMem_Free, PyMem_Malloc, PyMem_Realloc
4
+ from cpython.object cimport PyObject_Str
5
+ from libc.stdint cimport uint8_t, uint64_t
6
+ from libc.string cimport memcpy
7
+
8
+ from multidict import istr
9
+
10
+ DEF BUF_SIZE = 16 * 1024 # 16KiB
11
+
12
+ cdef object _istr = istr
13
+
14
+
15
+ # ----------------- writer ---------------------------
16
+
17
+ cdef struct Writer:
18
+ char *buf
19
+ Py_ssize_t size
20
+ Py_ssize_t pos
21
+ bint heap_allocated
22
+
23
+ cdef inline void _init_writer(Writer* writer, char *buf):
24
+ writer.buf = buf
25
+ writer.size = BUF_SIZE
26
+ writer.pos = 0
27
+ writer.heap_allocated = 0
28
+
29
+
30
+ cdef inline void _release_writer(Writer* writer):
31
+ if writer.heap_allocated:
32
+ PyMem_Free(writer.buf)
33
+
34
+
35
+ cdef inline int _write_byte(Writer* writer, uint8_t ch):
36
+ cdef char * buf
37
+ cdef Py_ssize_t size
38
+
39
+ if writer.pos == writer.size:
40
+ # reallocate
41
+ size = writer.size + BUF_SIZE
42
+ if not writer.heap_allocated:
43
+ buf = <char*>PyMem_Malloc(size)
44
+ if buf == NULL:
45
+ PyErr_NoMemory()
46
+ return -1
47
+ memcpy(buf, writer.buf, writer.size)
48
+ else:
49
+ buf = <char*>PyMem_Realloc(writer.buf, size)
50
+ if buf == NULL:
51
+ PyErr_NoMemory()
52
+ return -1
53
+ writer.buf = buf
54
+ writer.size = size
55
+ writer.heap_allocated = 1
56
+ writer.buf[writer.pos] = <char>ch
57
+ writer.pos += 1
58
+ return 0
59
+
60
+
61
+ cdef inline int _write_utf8(Writer* writer, Py_UCS4 symbol):
62
+ cdef uint64_t utf = <uint64_t> symbol
63
+
64
+ if utf < 0x80:
65
+ return _write_byte(writer, <uint8_t>utf)
66
+ elif utf < 0x800:
67
+ if _write_byte(writer, <uint8_t>(0xc0 | (utf >> 6))) < 0:
68
+ return -1
69
+ return _write_byte(writer, <uint8_t>(0x80 | (utf & 0x3f)))
70
+ elif 0xD800 <= utf <= 0xDFFF:
71
+ # surogate pair, ignored
72
+ return 0
73
+ elif utf < 0x10000:
74
+ if _write_byte(writer, <uint8_t>(0xe0 | (utf >> 12))) < 0:
75
+ return -1
76
+ if _write_byte(writer, <uint8_t>(0x80 | ((utf >> 6) & 0x3f))) < 0:
77
+ return -1
78
+ return _write_byte(writer, <uint8_t>(0x80 | (utf & 0x3f)))
79
+ elif utf > 0x10FFFF:
80
+ # symbol is too large
81
+ return 0
82
+ else:
83
+ if _write_byte(writer, <uint8_t>(0xf0 | (utf >> 18))) < 0:
84
+ return -1
85
+ if _write_byte(writer,
86
+ <uint8_t>(0x80 | ((utf >> 12) & 0x3f))) < 0:
87
+ return -1
88
+ if _write_byte(writer,
89
+ <uint8_t>(0x80 | ((utf >> 6) & 0x3f))) < 0:
90
+ return -1
91
+ return _write_byte(writer, <uint8_t>(0x80 | (utf & 0x3f)))
92
+
93
+
94
+ cdef inline int _write_str(Writer* writer, str s):
95
+ cdef Py_UCS4 ch
96
+ for ch in s:
97
+ if _write_utf8(writer, ch) < 0:
98
+ return -1
99
+
100
+
101
+ cdef inline int _write_str_raise_on_nlcr(Writer* writer, object s):
102
+ cdef Py_UCS4 ch
103
+ cdef str out_str
104
+ if type(s) is str:
105
+ out_str = <str>s
106
+ elif type(s) is _istr:
107
+ out_str = PyObject_Str(s)
108
+ elif not isinstance(s, str):
109
+ raise TypeError("Cannot serialize non-str key {!r}".format(s))
110
+ else:
111
+ out_str = str(s)
112
+
113
+ for ch in out_str:
114
+ # https://www.rfc-editor.org/info/rfc9110/#section-5.5-5
115
+ # https://www.rfc-editor.org/info/rfc9112/#section-4-3
116
+ if (ch < 0x20 and ch != 0x09) or ch == 0x7F:
117
+ raise ValueError(
118
+ "Forbidden control character detected in headers. "
119
+ "Potential header injection attack."
120
+ )
121
+ if _write_utf8(writer, ch) < 0:
122
+ return -1
123
+
124
+
125
+ # --------------- _serialize_headers ----------------------
126
+
127
+ def _serialize_headers(str status_line, headers):
128
+ cdef Writer writer
129
+ cdef object key
130
+ cdef object val
131
+ cdef char buf[BUF_SIZE]
132
+
133
+ _init_writer(&writer, buf)
134
+
135
+ try:
136
+ if _write_str_raise_on_nlcr(&writer, status_line) < 0:
137
+ raise
138
+ if _write_byte(&writer, b'\r') < 0:
139
+ raise
140
+ if _write_byte(&writer, b'\n') < 0:
141
+ raise
142
+
143
+ for key, val in headers.items():
144
+ if _write_str_raise_on_nlcr(&writer, key) < 0:
145
+ raise
146
+ if _write_byte(&writer, b':') < 0:
147
+ raise
148
+ if _write_byte(&writer, b' ') < 0:
149
+ raise
150
+ if _write_str_raise_on_nlcr(&writer, val) < 0:
151
+ raise
152
+ if _write_byte(&writer, b'\r') < 0:
153
+ raise
154
+ if _write_byte(&writer, b'\n') < 0:
155
+ raise
156
+
157
+ if _write_byte(&writer, b'\r') < 0:
158
+ raise
159
+ if _write_byte(&writer, b'\n') < 0:
160
+ raise
161
+
162
+ return PyBytes_FromStringAndSize(writer.buf, writer.pos)
163
+ finally:
164
+ _release_writer(&writer)
.venv/Lib/site-packages/aiohttp/_websocket/.hash/mask.pxd.hash ADDED
@@ -0,0 +1 @@
 
 
1
+ e354dd499be171b6125bf56bc3b6c5e2bff2a28af69e3b5d699ddb9af2bafa3c *D:/a/aiohttp/aiohttp/aiohttp/_websocket/mask.pxd
.venv/Lib/site-packages/aiohttp/_websocket/.hash/mask.pyx.hash ADDED
@@ -0,0 +1 @@
 
 
1
+ 468edd38ebf8dc7000a8d333df1c82035d69a5c9febc0448be3c9c4ad4c4630c *D:/a/aiohttp/aiohttp/aiohttp/_websocket/mask.pyx
.venv/Lib/site-packages/aiohttp/_websocket/.hash/reader_c.pxd.hash ADDED
@@ -0,0 +1 @@
 
 
1
+ fad990691939b116b302179e938eef47e6cbabf5fe5a30bb465c1626de5eb614 *D:/a/aiohttp/aiohttp/aiohttp/_websocket/reader_c.pxd
.venv/Lib/site-packages/aiohttp/_websocket/__init__.py ADDED
@@ -0,0 +1 @@
 
 
1
+ """WebSocket protocol versions 13 and 8."""
.venv/Lib/site-packages/aiohttp/_websocket/helpers.py ADDED
@@ -0,0 +1,148 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Helpers for WebSocket protocol versions 13 and 8."""
2
+
3
+ import functools
4
+ import re
5
+ from re import Pattern
6
+ from struct import Struct
7
+ from typing import TYPE_CHECKING, Final
8
+
9
+ from ..helpers import NO_EXTENSIONS
10
+ from .models import WSHandshakeError
11
+
12
+ UNPACK_LEN3 = Struct("!Q").unpack_from
13
+ UNPACK_CLOSE_CODE = Struct("!H").unpack
14
+ PACK_LEN1 = Struct("!BB").pack
15
+ PACK_LEN2 = Struct("!BBH").pack
16
+ PACK_LEN3 = Struct("!BBQ").pack
17
+ PACK_CLOSE_CODE = Struct("!H").pack
18
+ PACK_RANDBITS = Struct("!L").pack
19
+ MSG_SIZE: Final[int] = 2**14
20
+ MASK_LEN: Final[int] = 4
21
+
22
+ WS_KEY: Final[bytes] = b"258EAFA5-E914-47DA-95CA-C5AB0DC85B11"
23
+
24
+
25
+ # Used by _websocket_mask_python
26
+ @functools.lru_cache
27
+ def _xor_table() -> list[bytes]:
28
+ return [bytes(a ^ b for a in range(256)) for b in range(256)]
29
+
30
+
31
+ def _websocket_mask_python(mask: bytes, data: bytearray) -> None:
32
+ """Websocket masking function.
33
+
34
+ `mask` is a `bytes` object of length 4; `data` is a `bytearray`
35
+ object of any length. The contents of `data` are masked with `mask`,
36
+ as specified in section 5.3 of RFC 6455.
37
+
38
+ Note that this function mutates the `data` argument.
39
+
40
+ This pure-python implementation may be replaced by an optimized
41
+ version when available.
42
+
43
+ """
44
+ assert isinstance(data, bytearray), data
45
+ assert len(mask) == 4, mask
46
+
47
+ if data:
48
+ _XOR_TABLE = _xor_table()
49
+ a, b, c, d = (_XOR_TABLE[n] for n in mask)
50
+ data[::4] = data[::4].translate(a)
51
+ data[1::4] = data[1::4].translate(b)
52
+ data[2::4] = data[2::4].translate(c)
53
+ data[3::4] = data[3::4].translate(d)
54
+
55
+
56
+ if TYPE_CHECKING or NO_EXTENSIONS: # pragma: no cover
57
+ websocket_mask = _websocket_mask_python
58
+ else:
59
+ try:
60
+ from .mask import _websocket_mask_cython # type: ignore[import-not-found]
61
+
62
+ websocket_mask = _websocket_mask_cython
63
+ except ImportError: # pragma: no cover
64
+ websocket_mask = _websocket_mask_python
65
+
66
+
67
+ _WS_EXT_RE: Final[Pattern[str]] = re.compile(
68
+ r"^(?:;\s*(?:"
69
+ r"(server_no_context_takeover)|"
70
+ r"(client_no_context_takeover)|"
71
+ r"(server_max_window_bits(?:=(\d+))?)|"
72
+ r"(client_max_window_bits(?:=(\d+))?)))*$"
73
+ )
74
+
75
+ _WS_EXT_RE_SPLIT: Final[Pattern[str]] = re.compile(r"permessage-deflate([^,]+)?")
76
+
77
+
78
+ def ws_ext_parse(extstr: str | None, isserver: bool = False) -> tuple[int, bool]:
79
+ if not extstr:
80
+ return 0, False
81
+
82
+ compress = 0
83
+ notakeover = False
84
+ for ext in _WS_EXT_RE_SPLIT.finditer(extstr):
85
+ defext = ext.group(1)
86
+ # Return compress = 15 when get `permessage-deflate`
87
+ if not defext:
88
+ compress = 15
89
+ break
90
+ match = _WS_EXT_RE.match(defext)
91
+ if match:
92
+ compress = 15
93
+ if isserver:
94
+ # Server never fail to detect compress handshake.
95
+ # Server does not need to send max wbit to client
96
+ if match.group(4):
97
+ compress = int(match.group(4))
98
+ # Group3 must match if group4 matches
99
+ # Compress wbit 8 does not support in zlib
100
+ # If compress level not support,
101
+ # CONTINUE to next extension
102
+ if compress > 15 or compress < 9:
103
+ compress = 0
104
+ continue
105
+ if match.group(1):
106
+ notakeover = True
107
+ # Ignore regex group 5 & 6 for client_max_window_bits
108
+ break
109
+ else:
110
+ if match.group(6):
111
+ compress = int(match.group(6))
112
+ # Group5 must match if group6 matches
113
+ # Compress wbit 8 does not support in zlib
114
+ # If compress level not support,
115
+ # FAIL the parse progress
116
+ if compress > 15 or compress < 9:
117
+ raise WSHandshakeError("Invalid window size")
118
+ if match.group(2):
119
+ notakeover = True
120
+ # Ignore regex group 5 & 6 for client_max_window_bits
121
+ break
122
+ # Return Fail if client side and not match
123
+ elif not isserver:
124
+ raise WSHandshakeError("Extension for deflate not supported" + ext.group(1))
125
+
126
+ return compress, notakeover
127
+
128
+
129
+ def ws_ext_gen(
130
+ compress: int = 15, isserver: bool = False, server_notakeover: bool = False
131
+ ) -> str:
132
+ # client_notakeover=False not used for server
133
+ # compress wbit 8 does not support in zlib
134
+ if compress < 9 or compress > 15:
135
+ raise ValueError(
136
+ "Compress wbits must between 9 and 15, zlib does not support wbits=8"
137
+ )
138
+ enabledext = ["permessage-deflate"]
139
+ if not isserver:
140
+ enabledext.append("client_max_window_bits")
141
+
142
+ if compress < 15:
143
+ enabledext.append("server_max_window_bits=" + str(compress))
144
+ if server_notakeover:
145
+ enabledext.append("server_no_context_takeover")
146
+ # if client_notakeover:
147
+ # enabledext.append('client_no_context_takeover')
148
+ return "; ".join(enabledext)
.venv/Lib/site-packages/aiohttp/_websocket/mask.cp312-win_amd64.pyd ADDED
Binary file (35.8 kB). View file
 
.venv/Lib/site-packages/aiohttp/_websocket/mask.pxd ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ """Cython declarations for websocket masking."""
2
+
3
+ cpdef void _websocket_mask_cython(bytes mask, bytearray data)
.venv/Lib/site-packages/aiohttp/_websocket/mask.pyx ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from cpython cimport PyBytes_AsString
2
+
3
+
4
+ #from cpython cimport PyByteArray_AsString # cython still not exports that
5
+ cdef extern from "Python.h":
6
+ char* PyByteArray_AsString(bytearray ba) except NULL
7
+
8
+ from libc.stdint cimport uint32_t, uint64_t, uintmax_t
9
+
10
+
11
+ cpdef void _websocket_mask_cython(bytes mask, bytearray data):
12
+ """Note, this function mutates its `data` argument
13
+ """
14
+ cdef:
15
+ Py_ssize_t data_len, i
16
+ # bit operations on signed integers are implementation-specific
17
+ unsigned char * in_buf
18
+ const unsigned char * mask_buf
19
+ uint32_t uint32_msk
20
+ uint64_t uint64_msk
21
+
22
+ assert len(mask) == 4
23
+
24
+ data_len = len(data)
25
+ in_buf = <unsigned char*>PyByteArray_AsString(data)
26
+ mask_buf = <const unsigned char*>PyBytes_AsString(mask)
27
+ uint32_msk = (<uint32_t*>mask_buf)[0]
28
+
29
+ # TODO: align in_data ptr to achieve even faster speeds
30
+ # does it need in python ?! malloc() always aligns to sizeof(long) bytes
31
+
32
+ if sizeof(size_t) >= 8:
33
+ uint64_msk = uint32_msk
34
+ uint64_msk = (uint64_msk << 32) | uint32_msk
35
+
36
+ while data_len >= 8:
37
+ (<uint64_t*>in_buf)[0] ^= uint64_msk
38
+ in_buf += 8
39
+ data_len -= 8
40
+
41
+
42
+ while data_len >= 4:
43
+ (<uint32_t*>in_buf)[0] ^= uint32_msk
44
+ in_buf += 4
45
+ data_len -= 4
46
+
47
+ for i in range(0, data_len):
48
+ in_buf[i] ^= mask_buf[i]
.venv/Lib/site-packages/aiohttp/_websocket/models.py ADDED
@@ -0,0 +1,107 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Models for WebSocket protocol versions 13 and 8."""
2
+
3
+ import json
4
+ from collections.abc import Callable
5
+ from enum import IntEnum
6
+ from typing import Any, Final, NamedTuple, cast
7
+
8
+ WS_DEFLATE_TRAILING: Final[bytes] = bytes([0x00, 0x00, 0xFF, 0xFF])
9
+
10
+
11
+ class WSCloseCode(IntEnum):
12
+ OK = 1000
13
+ GOING_AWAY = 1001
14
+ PROTOCOL_ERROR = 1002
15
+ UNSUPPORTED_DATA = 1003
16
+ ABNORMAL_CLOSURE = 1006
17
+ INVALID_TEXT = 1007
18
+ POLICY_VIOLATION = 1008
19
+ MESSAGE_TOO_BIG = 1009
20
+ MANDATORY_EXTENSION = 1010
21
+ INTERNAL_ERROR = 1011
22
+ SERVICE_RESTART = 1012
23
+ TRY_AGAIN_LATER = 1013
24
+ BAD_GATEWAY = 1014
25
+
26
+
27
+ class WSMsgType(IntEnum):
28
+ # websocket spec types
29
+ CONTINUATION = 0x0
30
+ TEXT = 0x1
31
+ BINARY = 0x2
32
+ PING = 0x9
33
+ PONG = 0xA
34
+ CLOSE = 0x8
35
+
36
+ # aiohttp specific types
37
+ CLOSING = 0x100
38
+ CLOSED = 0x101
39
+ ERROR = 0x102
40
+
41
+ text = TEXT
42
+ binary = BINARY
43
+ ping = PING
44
+ pong = PONG
45
+ close = CLOSE
46
+ closing = CLOSING
47
+ closed = CLOSED
48
+ error = ERROR
49
+
50
+
51
+ class WSMessage(NamedTuple):
52
+ type: WSMsgType
53
+ # To type correctly, this would need some kind of tagged union for each type.
54
+ data: Any
55
+ extra: str | None
56
+
57
+ def json(self, *, loads: Callable[[Any], Any] = json.loads) -> Any:
58
+ """Return parsed JSON data.
59
+
60
+ .. versionadded:: 0.22
61
+ """
62
+ return loads(self.data)
63
+
64
+
65
+ class WSMessageTextBytes(NamedTuple):
66
+ """WebSocket TEXT message with raw bytes (no UTF-8 decoding)."""
67
+
68
+ type: WSMsgType
69
+ # To type correctly, this would need some kind of tagged union for each type.
70
+ # In 4.0, we use a union of message types to properly type data, but in 3.x
71
+ # we keep it as Any to avoid a breaking change.
72
+ data: Any
73
+ extra: str | None
74
+
75
+ def json(self, *, loads: Callable[[Any], Any] = json.loads) -> Any:
76
+ """Return parsed JSON data."""
77
+ return loads(self.data)
78
+
79
+
80
+ # Type aliases for message types based on decode_text setting
81
+ # When decode_text=True, TEXT messages have str data (WSMessage)
82
+ # When decode_text=False, TEXT messages have bytes data (WSMessageTextBytes)
83
+ WSMessageDecodeText = WSMessage
84
+ WSMessageNoDecodeText = WSMessage | WSMessageTextBytes
85
+
86
+
87
+ # Constructing the tuple directly to avoid the overhead of
88
+ # the lambda and arg processing since NamedTuples are constructed
89
+ # with a run time built lambda
90
+ # https://github.com/python/cpython/blob/d83fcf8371f2f33c7797bc8f5423a8bca8c46e5c/Lib/collections/__init__.py#L441
91
+ WS_CLOSED_MESSAGE = tuple.__new__(WSMessage, (WSMsgType.CLOSED, None, None))
92
+ WS_CLOSING_MESSAGE = tuple.__new__(WSMessage, (WSMsgType.CLOSING, None, None))
93
+
94
+
95
+ class WebSocketError(Exception):
96
+ """WebSocket protocol parser error."""
97
+
98
+ def __init__(self, code: int, message: str) -> None:
99
+ self.code = code
100
+ super().__init__(code, message)
101
+
102
+ def __str__(self) -> str:
103
+ return cast(str, self.args[1])
104
+
105
+
106
+ class WSHandshakeError(Exception):
107
+ """WebSocket protocol handshake error."""
.venv/Lib/site-packages/aiohttp/_websocket/reader.py ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Reader for WebSocket protocol versions 13 and 8."""
2
+
3
+ from typing import TYPE_CHECKING
4
+
5
+ from ..helpers import NO_EXTENSIONS
6
+
7
+ if TYPE_CHECKING or NO_EXTENSIONS: # pragma: no cover
8
+ from .reader_py import (
9
+ WebSocketDataQueue as WebSocketDataQueuePython,
10
+ WebSocketReader as WebSocketReaderPython,
11
+ )
12
+
13
+ WebSocketReader = WebSocketReaderPython
14
+ WebSocketDataQueue = WebSocketDataQueuePython
15
+ else:
16
+ try:
17
+ from .reader_c import ( # type: ignore[import-not-found]
18
+ WebSocketDataQueue as WebSocketDataQueueCython,
19
+ WebSocketReader as WebSocketReaderCython,
20
+ )
21
+
22
+ WebSocketReader = WebSocketReaderCython
23
+ WebSocketDataQueue = WebSocketDataQueueCython
24
+ except ImportError: # pragma: no cover
25
+ from .reader_py import (
26
+ WebSocketDataQueue as WebSocketDataQueuePython,
27
+ WebSocketReader as WebSocketReaderPython,
28
+ )
29
+
30
+ WebSocketReader = WebSocketReaderPython
31
+ WebSocketDataQueue = WebSocketDataQueuePython
.venv/Lib/site-packages/aiohttp/_websocket/reader_c.cp312-win_amd64.pyd ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e24d770086ba7918ee84c78ded8c471f24412d2073a9b7d132608233c09682e3
3
+ size 141312
.venv/Lib/site-packages/aiohttp/_websocket/reader_c.pxd ADDED
@@ -0,0 +1,112 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import cython
2
+
3
+ from .mask cimport _websocket_mask_cython as websocket_mask
4
+
5
+
6
+ cdef unsigned int READ_HEADER
7
+ cdef unsigned int READ_PAYLOAD_LENGTH
8
+ cdef unsigned int READ_PAYLOAD_MASK
9
+ cdef unsigned int READ_PAYLOAD
10
+
11
+ cdef int OP_CODE_NOT_SET
12
+ cdef int OP_CODE_CONTINUATION
13
+ cdef int OP_CODE_TEXT
14
+ cdef int OP_CODE_BINARY
15
+ cdef int OP_CODE_CLOSE
16
+ cdef int OP_CODE_PING
17
+ cdef int OP_CODE_PONG
18
+
19
+ cdef int COMPRESSED_NOT_SET
20
+ cdef int COMPRESSED_FALSE
21
+ cdef int COMPRESSED_TRUE
22
+
23
+ cdef object UNPACK_LEN3
24
+ cdef object UNPACK_CLOSE_CODE
25
+ cdef object TUPLE_NEW
26
+
27
+ cdef object WSMsgType
28
+ cdef object WSMessage
29
+ cdef object WSMessageTextBytes
30
+
31
+ cdef object WS_MSG_TYPE_TEXT
32
+ cdef object WS_MSG_TYPE_BINARY
33
+
34
+ cdef set ALLOWED_CLOSE_CODES
35
+ cdef set MESSAGE_TYPES_WITH_CONTENT
36
+
37
+ cdef tuple EMPTY_FRAME
38
+ cdef tuple EMPTY_FRAME_ERROR
39
+
40
+ cdef class WebSocketDataQueue:
41
+
42
+ cdef unsigned int _size
43
+ cdef public object _protocol
44
+ cdef unsigned int _limit
45
+ cdef object _loop
46
+ cdef bint _eof
47
+ cdef object _waiter
48
+ cdef object _exception
49
+ cdef public object _buffer
50
+ cdef object _get_buffer
51
+ cdef object _put_buffer
52
+
53
+ cdef void _release_waiter(self)
54
+
55
+ cpdef void feed_data(self, object data, unsigned int size)
56
+
57
+ @cython.locals(size="unsigned int")
58
+ cdef _read_from_buffer(self)
59
+
60
+ cdef class WebSocketReader:
61
+
62
+ cdef WebSocketDataQueue queue
63
+ cdef unsigned int _max_msg_size
64
+ cdef bint _decode_text
65
+
66
+ cdef Exception _exc
67
+ cdef bytearray _partial
68
+ cdef unsigned int _state
69
+
70
+ cdef int _opcode
71
+ cdef bint _frame_fin
72
+ cdef int _frame_opcode
73
+ cdef list _payload_fragments
74
+ cdef Py_ssize_t _frame_payload_len
75
+
76
+ cdef bytes _tail
77
+ cdef bint _has_mask
78
+ cdef bytes _frame_mask
79
+ cdef Py_ssize_t _payload_bytes_to_read
80
+ cdef unsigned int _payload_len_flag
81
+ cdef int _compressed
82
+ cdef object _decompressobj
83
+ cdef bint _compress
84
+
85
+ cpdef tuple feed_data(self, object data)
86
+
87
+ @cython.locals(
88
+ is_continuation=bint,
89
+ fin=bint,
90
+ has_partial=bint,
91
+ payload_merged=bytes,
92
+ )
93
+ cpdef void _handle_frame(self, bint fin, int opcode, object payload, int compressed) except *
94
+
95
+ @cython.locals(
96
+ start_pos=Py_ssize_t,
97
+ data_len=Py_ssize_t,
98
+ length=Py_ssize_t,
99
+ chunk_size=Py_ssize_t,
100
+ chunk_len=Py_ssize_t,
101
+ data_len=Py_ssize_t,
102
+ data_cstr="const unsigned char *",
103
+ first_byte="unsigned char",
104
+ second_byte="unsigned char",
105
+ f_start_pos=Py_ssize_t,
106
+ f_end_pos=Py_ssize_t,
107
+ has_mask=bint,
108
+ fin=bint,
109
+ had_fragments=Py_ssize_t,
110
+ payload_bytearray=bytearray,
111
+ )
112
+ cpdef void _feed_data(self, bytes data) except *
.venv/Lib/site-packages/aiohttp/_websocket/reader_c.py ADDED
@@ -0,0 +1,509 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Reader for WebSocket protocol versions 13 and 8."""
2
+
3
+ import asyncio
4
+ import builtins
5
+ from collections import deque
6
+ from typing import Final
7
+
8
+ from ..base_protocol import BaseProtocol
9
+ from ..compression_utils import ZLibDecompressor
10
+ from ..helpers import _EXC_SENTINEL, set_exception
11
+ from ..streams import EofStream
12
+ from .helpers import UNPACK_CLOSE_CODE, UNPACK_LEN3, websocket_mask
13
+ from .models import (
14
+ WS_DEFLATE_TRAILING,
15
+ WebSocketError,
16
+ WSCloseCode,
17
+ WSMessage,
18
+ WSMessageTextBytes,
19
+ WSMsgType,
20
+ )
21
+
22
+ ALLOWED_CLOSE_CODES: Final[set[int]] = {int(i) for i in WSCloseCode}
23
+
24
+ # States for the reader, used to parse the WebSocket frame
25
+ # integer values are used so they can be cythonized
26
+ READ_HEADER = 1
27
+ READ_PAYLOAD_LENGTH = 2
28
+ READ_PAYLOAD_MASK = 3
29
+ READ_PAYLOAD = 4
30
+
31
+ WS_MSG_TYPE_BINARY = WSMsgType.BINARY
32
+ WS_MSG_TYPE_TEXT = WSMsgType.TEXT
33
+
34
+ # WSMsgType values unpacked so they can by cythonized to ints
35
+ OP_CODE_NOT_SET = -1
36
+ OP_CODE_CONTINUATION = WSMsgType.CONTINUATION.value
37
+ OP_CODE_TEXT = WSMsgType.TEXT.value
38
+ OP_CODE_BINARY = WSMsgType.BINARY.value
39
+ OP_CODE_CLOSE = WSMsgType.CLOSE.value
40
+ OP_CODE_PING = WSMsgType.PING.value
41
+ OP_CODE_PONG = WSMsgType.PONG.value
42
+
43
+ EMPTY_FRAME_ERROR = (True, b"")
44
+ EMPTY_FRAME = (False, b"")
45
+
46
+ COMPRESSED_NOT_SET = -1
47
+ COMPRESSED_FALSE = 0
48
+ COMPRESSED_TRUE = 1
49
+
50
+ TUPLE_NEW = tuple.__new__
51
+
52
+ cython_int = int # Typed to int in Python, but cython with use a signed int in the pxd
53
+
54
+
55
+ class WebSocketDataQueue:
56
+ """WebSocketDataQueue resumes and pauses an underlying stream.
57
+
58
+ It is a destination for WebSocket data.
59
+ """
60
+
61
+ def __init__(
62
+ self, protocol: BaseProtocol, limit: int, *, loop: asyncio.AbstractEventLoop
63
+ ) -> None:
64
+ self._size = 0
65
+ self._protocol = protocol
66
+ self._limit = limit * 2
67
+ self._loop = loop
68
+ self._eof = False
69
+ self._waiter: asyncio.Future[None] | None = None
70
+ self._exception: BaseException | None = None
71
+ self._buffer: deque[tuple[WSMessage | WSMessageTextBytes, int]] = deque()
72
+ self._get_buffer = self._buffer.popleft
73
+ self._put_buffer = self._buffer.append
74
+
75
+ def is_eof(self) -> bool:
76
+ return self._eof
77
+
78
+ def exception(self) -> BaseException | None:
79
+ return self._exception
80
+
81
+ def set_exception(
82
+ self,
83
+ exc: BaseException,
84
+ exc_cause: builtins.BaseException = _EXC_SENTINEL,
85
+ ) -> None:
86
+ self._eof = True
87
+ self._exception = exc
88
+ if (waiter := self._waiter) is not None:
89
+ self._waiter = None
90
+ set_exception(waiter, exc, exc_cause)
91
+
92
+ def _release_waiter(self) -> None:
93
+ if (waiter := self._waiter) is None:
94
+ return
95
+ self._waiter = None
96
+ if not waiter.done():
97
+ waiter.set_result(None)
98
+
99
+ def feed_eof(self) -> None:
100
+ self._eof = True
101
+ self._release_waiter()
102
+ self._exception = None # Break cyclic references
103
+
104
+ def feed_data(
105
+ self, data: "WSMessage | WSMessageTextBytes", size: "cython_int"
106
+ ) -> None:
107
+ self._size += size
108
+ self._put_buffer((data, size))
109
+ self._release_waiter()
110
+ if self._size > self._limit and not self._protocol._reading_paused:
111
+ self._protocol.pause_reading()
112
+
113
+ async def read(self) -> WSMessage | WSMessageTextBytes:
114
+ if not self._buffer and not self._eof:
115
+ assert not self._waiter
116
+ self._waiter = self._loop.create_future()
117
+ try:
118
+ await self._waiter
119
+ except (asyncio.CancelledError, asyncio.TimeoutError):
120
+ self._waiter = None
121
+ raise
122
+ return self._read_from_buffer()
123
+
124
+ def _read_from_buffer(self) -> WSMessage | WSMessageTextBytes:
125
+ if self._buffer:
126
+ data, size = self._get_buffer()
127
+ self._size -= size
128
+ if self._size < self._limit and self._protocol._reading_paused:
129
+ self._protocol.resume_reading()
130
+ return data
131
+ if self._exception is not None:
132
+ raise self._exception
133
+ raise EofStream
134
+
135
+
136
+ class WebSocketReader:
137
+ def __init__(
138
+ self,
139
+ queue: WebSocketDataQueue,
140
+ max_msg_size: int,
141
+ compress: bool = True,
142
+ decode_text: bool = True,
143
+ ) -> None:
144
+ self.queue = queue
145
+ self._max_msg_size = max_msg_size
146
+ self._decode_text = decode_text
147
+
148
+ self._exc: Exception | None = None
149
+ self._partial = bytearray()
150
+ self._state = READ_HEADER
151
+
152
+ self._opcode: int = OP_CODE_NOT_SET
153
+ self._frame_fin = False
154
+ self._frame_opcode: int = OP_CODE_NOT_SET
155
+ self._payload_fragments: list[bytes] = []
156
+ self._frame_payload_len = 0
157
+
158
+ self._tail: bytes = b""
159
+ self._has_mask = False
160
+ self._frame_mask: bytes | None = None
161
+ self._payload_bytes_to_read = 0
162
+ self._payload_len_flag = 0
163
+ self._compressed: int = COMPRESSED_NOT_SET
164
+ self._decompressobj: ZLibDecompressor | None = None
165
+ self._compress = compress
166
+
167
+ def feed_eof(self) -> None:
168
+ self.queue.feed_eof()
169
+
170
+ # data can be bytearray on Windows because proactor event loop uses bytearray
171
+ # and asyncio types this to Union[bytes, bytearray, memoryview] so we need
172
+ # coerce data to bytes if it is not
173
+ def feed_data(self, data: bytes | bytearray | memoryview) -> tuple[bool, bytes]:
174
+ if type(data) is not bytes:
175
+ data = bytes(data)
176
+
177
+ if self._exc is not None:
178
+ return True, data
179
+
180
+ try:
181
+ self._feed_data(data)
182
+ except Exception as exc:
183
+ self._exc = exc
184
+ set_exception(self.queue, exc)
185
+ return EMPTY_FRAME_ERROR
186
+
187
+ return EMPTY_FRAME
188
+
189
+ def _handle_frame(
190
+ self,
191
+ fin: bool,
192
+ opcode: int | cython_int, # Union intended: Cython pxd uses C int
193
+ payload: bytes | bytearray,
194
+ compressed: int | cython_int, # Union intended: Cython pxd uses C int
195
+ ) -> None:
196
+ msg: WSMessage
197
+ if opcode in {OP_CODE_TEXT, OP_CODE_BINARY, OP_CODE_CONTINUATION}:
198
+ # Validate continuation frames before processing
199
+ if opcode == OP_CODE_CONTINUATION and self._opcode == OP_CODE_NOT_SET:
200
+ raise WebSocketError(
201
+ WSCloseCode.PROTOCOL_ERROR,
202
+ "Continuation frame for non started message",
203
+ )
204
+
205
+ # load text/binary
206
+ if not fin:
207
+ # got partial frame payload
208
+ if opcode != OP_CODE_CONTINUATION:
209
+ self._opcode = opcode
210
+ self._partial += payload
211
+ return
212
+
213
+ has_partial = bool(self._partial)
214
+ if opcode == OP_CODE_CONTINUATION:
215
+ opcode = self._opcode
216
+ self._opcode = OP_CODE_NOT_SET
217
+ # previous frame was non finished
218
+ # we should get continuation opcode
219
+ elif has_partial:
220
+ raise WebSocketError(
221
+ WSCloseCode.PROTOCOL_ERROR,
222
+ "The opcode in non-fin frame is expected "
223
+ f"to be zero, got {opcode!r}",
224
+ )
225
+
226
+ assembled_payload: bytes | bytearray
227
+ if has_partial:
228
+ assembled_payload = self._partial + payload
229
+ self._partial.clear()
230
+ else:
231
+ assembled_payload = payload
232
+
233
+ # Decompress process must to be done after all packets
234
+ # received.
235
+ if compressed:
236
+ if not self._decompressobj:
237
+ self._decompressobj = ZLibDecompressor(suppress_deflate_header=True)
238
+ # XXX: It's possible that the zlib backend (isal is known to
239
+ # do this, maybe others too?) will return max_length bytes,
240
+ # but internally buffer more data such that the payload is
241
+ # >max_length, so we return one extra byte and if we're able
242
+ # to do that, then the message is too big.
243
+ payload_merged = self._decompressobj.decompress_sync(
244
+ assembled_payload + WS_DEFLATE_TRAILING,
245
+ (
246
+ self._max_msg_size + 1
247
+ if self._max_msg_size
248
+ else self._max_msg_size
249
+ ),
250
+ )
251
+ if self._max_msg_size and len(payload_merged) > self._max_msg_size:
252
+ raise WebSocketError(
253
+ WSCloseCode.MESSAGE_TOO_BIG,
254
+ f"Decompressed message exceeds size limit {self._max_msg_size}",
255
+ )
256
+ elif type(assembled_payload) is bytes:
257
+ payload_merged = assembled_payload
258
+ else:
259
+ payload_merged = bytes(assembled_payload)
260
+
261
+ if opcode == OP_CODE_TEXT:
262
+ if self._decode_text:
263
+ try:
264
+ text = payload_merged.decode("utf-8")
265
+ except UnicodeDecodeError as exc:
266
+ raise WebSocketError(
267
+ WSCloseCode.INVALID_TEXT, "Invalid UTF-8 text message"
268
+ ) from exc
269
+
270
+ # XXX: The Text and Binary messages here can be a performance
271
+ # bottleneck, so we use tuple.__new__ to improve performance.
272
+ # This is not type safe, but many tests should fail in
273
+ # test_client_ws_functional.py if this is wrong.
274
+ self.queue.feed_data(
275
+ TUPLE_NEW(WSMessage, (WS_MSG_TYPE_TEXT, text, "")),
276
+ len(payload_merged),
277
+ )
278
+ else:
279
+ # Return raw bytes for TEXT messages when decode_text=False
280
+ self.queue.feed_data(
281
+ TUPLE_NEW(
282
+ WSMessageTextBytes, (WS_MSG_TYPE_TEXT, payload_merged, "")
283
+ ),
284
+ len(payload_merged),
285
+ )
286
+ else:
287
+ self.queue.feed_data(
288
+ TUPLE_NEW(WSMessage, (WS_MSG_TYPE_BINARY, payload_merged, "")),
289
+ len(payload_merged),
290
+ )
291
+ elif opcode == OP_CODE_CLOSE:
292
+ if len(payload) >= 2:
293
+ close_code = UNPACK_CLOSE_CODE(payload[:2])[0]
294
+ if close_code < 3000 and close_code not in ALLOWED_CLOSE_CODES:
295
+ raise WebSocketError(
296
+ WSCloseCode.PROTOCOL_ERROR,
297
+ f"Invalid close code: {close_code}",
298
+ )
299
+ try:
300
+ close_message = payload[2:].decode("utf-8")
301
+ except UnicodeDecodeError as exc:
302
+ raise WebSocketError(
303
+ WSCloseCode.INVALID_TEXT, "Invalid UTF-8 text message"
304
+ ) from exc
305
+ msg = TUPLE_NEW(WSMessage, (WSMsgType.CLOSE, close_code, close_message))
306
+ elif payload:
307
+ raise WebSocketError(
308
+ WSCloseCode.PROTOCOL_ERROR,
309
+ f"Invalid close frame: {fin} {opcode} {payload!r}",
310
+ )
311
+ else:
312
+ msg = TUPLE_NEW(WSMessage, (WSMsgType.CLOSE, 0, ""))
313
+
314
+ self.queue.feed_data(msg, 0)
315
+ elif opcode == OP_CODE_PING:
316
+ msg = TUPLE_NEW(WSMessage, (WSMsgType.PING, payload, ""))
317
+ self.queue.feed_data(msg, len(payload))
318
+ elif opcode == OP_CODE_PONG:
319
+ msg = TUPLE_NEW(WSMessage, (WSMsgType.PONG, payload, ""))
320
+ self.queue.feed_data(msg, len(payload))
321
+ else:
322
+ raise WebSocketError(
323
+ WSCloseCode.PROTOCOL_ERROR, f"Unexpected opcode={opcode!r}"
324
+ )
325
+
326
+ def _feed_data(self, data: bytes) -> None:
327
+ """Return the next frame from the socket."""
328
+ if self._tail:
329
+ data, self._tail = self._tail + data, b""
330
+
331
+ start_pos: int = 0
332
+ data_len = len(data)
333
+ data_cstr = data
334
+
335
+ while True:
336
+ # read header
337
+ if self._state == READ_HEADER:
338
+ if data_len - start_pos < 2:
339
+ break
340
+ first_byte = data_cstr[start_pos]
341
+ second_byte = data_cstr[start_pos + 1]
342
+ start_pos += 2
343
+
344
+ fin = (first_byte >> 7) & 1
345
+ rsv1 = (first_byte >> 6) & 1
346
+ rsv2 = (first_byte >> 5) & 1
347
+ rsv3 = (first_byte >> 4) & 1
348
+ opcode = first_byte & 0xF
349
+
350
+ # frame-fin = %x0 ; more frames of this message follow
351
+ # / %x1 ; final frame of this message
352
+ # frame-rsv1 = %x0 ;
353
+ # 1 bit, MUST be 0 unless negotiated otherwise
354
+ # frame-rsv2 = %x0 ;
355
+ # 1 bit, MUST be 0 unless negotiated otherwise
356
+ # frame-rsv3 = %x0 ;
357
+ # 1 bit, MUST be 0 unless negotiated otherwise
358
+ #
359
+ # Remove rsv1 from this test for deflate development
360
+ if rsv2 or rsv3 or (rsv1 and not self._compress):
361
+ raise WebSocketError(
362
+ WSCloseCode.PROTOCOL_ERROR,
363
+ "Received frame with non-zero reserved bits",
364
+ )
365
+
366
+ if opcode not in {
367
+ OP_CODE_CONTINUATION,
368
+ OP_CODE_TEXT,
369
+ OP_CODE_BINARY,
370
+ OP_CODE_CLOSE,
371
+ OP_CODE_PING,
372
+ OP_CODE_PONG,
373
+ }:
374
+ raise WebSocketError(
375
+ WSCloseCode.PROTOCOL_ERROR,
376
+ f"Unexpected opcode={opcode!r}",
377
+ )
378
+
379
+ if opcode > 0x7 and fin == 0:
380
+ raise WebSocketError(
381
+ WSCloseCode.PROTOCOL_ERROR,
382
+ "Received fragmented control frame",
383
+ )
384
+
385
+ has_mask = (second_byte >> 7) & 1
386
+ length = second_byte & 0x7F
387
+
388
+ # Control frames MUST have a payload
389
+ # length of 125 bytes or less
390
+ if opcode > 0x7 and length > 125:
391
+ raise WebSocketError(
392
+ WSCloseCode.PROTOCOL_ERROR,
393
+ "Control frame payload cannot be larger than 125 bytes",
394
+ )
395
+
396
+ # Set compress status if last package is FIN
397
+ # OR set compress status if this is first fragment
398
+ # Raise error if not first fragment with rsv1 = 0x1
399
+ if self._frame_fin or self._compressed == COMPRESSED_NOT_SET:
400
+ self._compressed = COMPRESSED_TRUE if rsv1 else COMPRESSED_FALSE
401
+ elif rsv1:
402
+ raise WebSocketError(
403
+ WSCloseCode.PROTOCOL_ERROR,
404
+ "Received frame with non-zero reserved bits",
405
+ )
406
+
407
+ self._frame_fin = bool(fin)
408
+ self._frame_opcode = opcode
409
+ self._has_mask = bool(has_mask)
410
+ self._payload_len_flag = length
411
+ self._state = READ_PAYLOAD_LENGTH
412
+
413
+ # read payload length
414
+ if self._state == READ_PAYLOAD_LENGTH:
415
+ len_flag = self._payload_len_flag
416
+ if len_flag == 126:
417
+ if data_len - start_pos < 2:
418
+ break
419
+ first_byte = data_cstr[start_pos]
420
+ second_byte = data_cstr[start_pos + 1]
421
+ start_pos += 2
422
+ self._payload_bytes_to_read = first_byte << 8 | second_byte
423
+ elif len_flag > 126:
424
+ if data_len - start_pos < 8:
425
+ break
426
+ self._payload_bytes_to_read = UNPACK_LEN3(data, start_pos)[0]
427
+ start_pos += 8
428
+ else:
429
+ self._payload_bytes_to_read = len_flag
430
+
431
+ # Reject oversized data frames before buffering any payload
432
+ # bytes. Control frames are capped at 125 bytes (checked in
433
+ # READ_HEADER) so only text/binary/continuation need this.
434
+ if self._max_msg_size and self._frame_opcode in {
435
+ OP_CODE_TEXT,
436
+ OP_CODE_BINARY,
437
+ OP_CODE_CONTINUATION,
438
+ }:
439
+ projected_size = self._payload_bytes_to_read + len(self._partial)
440
+ if projected_size >= self._max_msg_size:
441
+ raise WebSocketError(
442
+ WSCloseCode.MESSAGE_TOO_BIG,
443
+ f"Message size {projected_size} "
444
+ f"exceeds limit {self._max_msg_size}",
445
+ )
446
+
447
+ self._state = READ_PAYLOAD_MASK if self._has_mask else READ_PAYLOAD
448
+
449
+ # read payload mask
450
+ if self._state == READ_PAYLOAD_MASK:
451
+ if data_len - start_pos < 4:
452
+ break
453
+ self._frame_mask = data_cstr[start_pos : start_pos + 4]
454
+ start_pos += 4
455
+ self._state = READ_PAYLOAD
456
+
457
+ if self._state == READ_PAYLOAD:
458
+ chunk_len = data_len - start_pos
459
+ if self._payload_bytes_to_read >= chunk_len:
460
+ f_end_pos = data_len
461
+ self._payload_bytes_to_read -= chunk_len
462
+ else:
463
+ f_end_pos = start_pos + self._payload_bytes_to_read
464
+ self._payload_bytes_to_read = 0
465
+
466
+ had_fragments = self._frame_payload_len
467
+ self._frame_payload_len += f_end_pos - start_pos
468
+ f_start_pos = start_pos
469
+ start_pos = f_end_pos
470
+
471
+ if self._payload_bytes_to_read != 0:
472
+ # If we don't have a complete frame, we need to save the
473
+ # data for the next call to feed_data.
474
+ self._payload_fragments.append(data_cstr[f_start_pos:f_end_pos])
475
+ break
476
+
477
+ payload: bytes | bytearray
478
+ if had_fragments:
479
+ # We have to join the payload fragments get the payload
480
+ self._payload_fragments.append(data_cstr[f_start_pos:f_end_pos])
481
+ if self._has_mask:
482
+ assert self._frame_mask is not None
483
+ payload_bytearray = bytearray(b"".join(self._payload_fragments))
484
+ websocket_mask(self._frame_mask, payload_bytearray)
485
+ payload = payload_bytearray
486
+ else:
487
+ payload = b"".join(self._payload_fragments)
488
+ self._payload_fragments.clear()
489
+ elif self._has_mask:
490
+ assert self._frame_mask is not None
491
+ payload_bytearray = data_cstr[f_start_pos:f_end_pos] # type: ignore[assignment]
492
+ if type(payload_bytearray) is not bytearray: # pragma: no branch
493
+ # Cython will do the conversion for us
494
+ # but we need to do it for Python and we
495
+ # will always get here in Python
496
+ payload_bytearray = bytearray(payload_bytearray)
497
+ websocket_mask(self._frame_mask, payload_bytearray)
498
+ payload = payload_bytearray
499
+ else:
500
+ payload = data_cstr[f_start_pos:f_end_pos]
501
+
502
+ self._handle_frame(
503
+ self._frame_fin, self._frame_opcode, payload, self._compressed
504
+ )
505
+ self._frame_payload_len = 0
506
+ self._state = READ_HEADER
507
+
508
+ # XXX: Cython needs slices to be bounded, so we can't omit the slice end here.
509
+ self._tail = data_cstr[start_pos:data_len] if start_pos < data_len else b""