Sumitwarrior7 commited on
Commit
e081f68
·
verified ·
1 Parent(s): afccb27

Add files using upload-large-folder tool

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .venv/lib/python3.10/site-packages/_yaml/__init__.py +33 -0
  2. .venv/lib/python3.10/site-packages/aiofile-3.9.0.dist-info/INSTALLER +1 -0
  3. .venv/lib/python3.10/site-packages/aiofile-3.9.0.dist-info/LICENCE +195 -0
  4. .venv/lib/python3.10/site-packages/aiofile-3.9.0.dist-info/LICENCE.md +195 -0
  5. .venv/lib/python3.10/site-packages/aiofile-3.9.0.dist-info/METADATA +492 -0
  6. .venv/lib/python3.10/site-packages/aiofile-3.9.0.dist-info/RECORD +12 -0
  7. .venv/lib/python3.10/site-packages/aiofile-3.9.0.dist-info/REQUESTED +0 -0
  8. .venv/lib/python3.10/site-packages/aiofile-3.9.0.dist-info/WHEEL +4 -0
  9. .venv/lib/python3.10/site-packages/attr/__init__.py +104 -0
  10. .venv/lib/python3.10/site-packages/attr/__init__.pyi +389 -0
  11. .venv/lib/python3.10/site-packages/attr/__pycache__/__init__.cpython-310.pyc +0 -0
  12. .venv/lib/python3.10/site-packages/attr/__pycache__/_cmp.cpython-310.pyc +0 -0
  13. .venv/lib/python3.10/site-packages/attr/__pycache__/_compat.cpython-310.pyc +0 -0
  14. .venv/lib/python3.10/site-packages/attr/__pycache__/_config.cpython-310.pyc +0 -0
  15. .venv/lib/python3.10/site-packages/attr/__pycache__/_funcs.cpython-310.pyc +0 -0
  16. .venv/lib/python3.10/site-packages/attr/__pycache__/_make.cpython-310.pyc +0 -0
  17. .venv/lib/python3.10/site-packages/attr/__pycache__/_next_gen.cpython-310.pyc +0 -0
  18. .venv/lib/python3.10/site-packages/attr/__pycache__/_version_info.cpython-310.pyc +0 -0
  19. .venv/lib/python3.10/site-packages/attr/__pycache__/converters.cpython-310.pyc +0 -0
  20. .venv/lib/python3.10/site-packages/attr/__pycache__/exceptions.cpython-310.pyc +0 -0
  21. .venv/lib/python3.10/site-packages/attr/__pycache__/filters.cpython-310.pyc +0 -0
  22. .venv/lib/python3.10/site-packages/attr/__pycache__/setters.cpython-310.pyc +0 -0
  23. .venv/lib/python3.10/site-packages/attr/__pycache__/validators.cpython-310.pyc +0 -0
  24. .venv/lib/python3.10/site-packages/attr/_cmp.py +160 -0
  25. .venv/lib/python3.10/site-packages/attr/_cmp.pyi +13 -0
  26. .venv/lib/python3.10/site-packages/attr/_compat.py +99 -0
  27. .venv/lib/python3.10/site-packages/attr/_config.py +31 -0
  28. .venv/lib/python3.10/site-packages/attr/_funcs.py +497 -0
  29. .venv/lib/python3.10/site-packages/attr/_make.py +0 -0
  30. .venv/lib/python3.10/site-packages/attr/_next_gen.py +674 -0
  31. .venv/lib/python3.10/site-packages/attr/_typing_compat.pyi +15 -0
  32. .venv/lib/python3.10/site-packages/attr/_version_info.py +89 -0
  33. .venv/lib/python3.10/site-packages/attr/_version_info.pyi +9 -0
  34. .venv/lib/python3.10/site-packages/attr/converters.py +162 -0
  35. .venv/lib/python3.10/site-packages/attr/converters.pyi +19 -0
  36. .venv/lib/python3.10/site-packages/attr/exceptions.py +95 -0
  37. .venv/lib/python3.10/site-packages/attr/exceptions.pyi +17 -0
  38. .venv/lib/python3.10/site-packages/attr/filters.py +72 -0
  39. .venv/lib/python3.10/site-packages/attr/filters.pyi +6 -0
  40. .venv/lib/python3.10/site-packages/attr/py.typed +0 -0
  41. .venv/lib/python3.10/site-packages/attr/setters.py +79 -0
  42. .venv/lib/python3.10/site-packages/attr/setters.pyi +20 -0
  43. .venv/lib/python3.10/site-packages/attr/validators.py +750 -0
  44. .venv/lib/python3.10/site-packages/attr/validators.pyi +140 -0
  45. .venv/lib/python3.10/site-packages/backports/__init__.py +1 -0
  46. .venv/lib/python3.10/site-packages/backports/__pycache__/__init__.cpython-310.pyc +0 -0
  47. .venv/lib/python3.10/site-packages/backports/tarfile/__init__.py +0 -0
  48. .venv/lib/python3.10/site-packages/backports/tarfile/__main__.py +5 -0
  49. .venv/lib/python3.10/site-packages/backports/tarfile/compat/__init__.py +0 -0
  50. .venv/lib/python3.10/site-packages/backports/tarfile/compat/py38.py +24 -0
.venv/lib/python3.10/site-packages/_yaml/__init__.py ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # This is a stub package designed to roughly emulate the _yaml
2
+ # extension module, which previously existed as a standalone module
3
+ # and has been moved into the `yaml` package namespace.
4
+ # It does not perfectly mimic its old counterpart, but should get
5
+ # close enough for anyone who's relying on it even when they shouldn't.
6
+ import yaml
7
+
8
+ # in some circumstances, the yaml module we imoprted may be from a different version, so we need
9
+ # to tread carefully when poking at it here (it may not have the attributes we expect)
10
+ if not getattr(yaml, '__with_libyaml__', False):
11
+ from sys import version_info
12
+
13
+ exc = ModuleNotFoundError if version_info >= (3, 6) else ImportError
14
+ raise exc("No module named '_yaml'")
15
+ else:
16
+ from yaml._yaml import *
17
+ import warnings
18
+ warnings.warn(
19
+ 'The _yaml extension module is now located at yaml._yaml'
20
+ ' and its location is subject to change. To use the'
21
+ ' LibYAML-based parser and emitter, import from `yaml`:'
22
+ ' `from yaml import CLoader as Loader, CDumper as Dumper`.',
23
+ DeprecationWarning
24
+ )
25
+ del warnings
26
+ # Don't `del yaml` here because yaml is actually an existing
27
+ # namespace member of _yaml.
28
+
29
+ __name__ = '_yaml'
30
+ # If the module is top-level (i.e. not a part of any specific package)
31
+ # then the attribute should be set to ''.
32
+ # https://docs.python.org/3.8/library/types.html
33
+ __package__ = ''
.venv/lib/python3.10/site-packages/aiofile-3.9.0.dist-info/INSTALLER ADDED
@@ -0,0 +1 @@
 
 
1
+ uv
.venv/lib/python3.10/site-packages/aiofile-3.9.0.dist-info/LICENCE ADDED
@@ -0,0 +1,195 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Apache License
2
+ ==============
3
+
4
+ _Version 2.0, January 2004_
5
+ _&lt;<http://www.apache.org/licenses/>&gt;_
6
+
7
+ ### Terms and Conditions for use, reproduction, and distribution
8
+
9
+ #### 1. Definitions
10
+
11
+ “License” shall mean the terms and conditions for use, reproduction, and
12
+ distribution as defined by Sections 1 through 9 of this document.
13
+
14
+ “Licensor” shall mean the copyright owner or entity authorized by the copyright
15
+ owner that is granting the License.
16
+
17
+ “Legal Entity” shall mean the union of the acting entity and all other entities
18
+ that control, are controlled by, or are under common control with that entity.
19
+ For the purposes of this definition, “control” means **(i)** the power, direct or
20
+ indirect, to cause the direction or management of such entity, whether by
21
+ contract or otherwise, or **(ii)** ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or **(iii)** beneficial ownership of such entity.
23
+
24
+ “You” (or “Your”) shall mean an individual or Legal Entity exercising
25
+ permissions granted by this License.
26
+
27
+ “Source” form shall mean the preferred form for making modifications, including
28
+ but not limited to software source code, documentation source, and configuration
29
+ files.
30
+
31
+ “Object” form shall mean any form resulting from mechanical transformation or
32
+ translation of a Source form, including but not limited to compiled object code,
33
+ generated documentation, and conversions to other media types.
34
+
35
+ “Work” shall mean the work of authorship, whether in Source or Object form, made
36
+ available under the License, as indicated by a copyright notice that is included
37
+ in or attached to the work (an example is provided in the Appendix below).
38
+
39
+ “Derivative Works” shall mean any work, whether in Source or Object form, that
40
+ is based on (or derived from) the Work and for which the editorial revisions,
41
+ annotations, elaborations, or other modifications represent, as a whole, an
42
+ original work of authorship. For the purposes of this License, Derivative Works
43
+ shall not include works that remain separable from, or merely link (or bind by
44
+ name) to the interfaces of, the Work and Derivative Works thereof.
45
+
46
+ “Contribution” shall mean any work of authorship, including the original version
47
+ of the Work and any modifications or additions to that Work or Derivative Works
48
+ thereof, that is intentionally submitted to Licensor for inclusion in the Work
49
+ by the copyright owner or by an individual or Legal Entity authorized to submit
50
+ on behalf of the copyright owner. For the purposes of this definition,
51
+ “submitted” means any form of electronic, verbal, or written communication sent
52
+ to the Licensor or its representatives, including but not limited to
53
+ communication on electronic mailing lists, source code control systems, and
54
+ issue tracking systems that are managed by, or on behalf of, the Licensor for
55
+ the purpose of discussing and improving the Work, but excluding communication
56
+ that is conspicuously marked or otherwise designated in writing by the copyright
57
+ owner as “Not a Contribution.”
58
+
59
+ “Contributor” shall mean Licensor and any individual or Legal Entity on behalf
60
+ of whom a Contribution has been received by Licensor and subsequently
61
+ incorporated within the Work.
62
+
63
+ #### 2. Grant of Copyright License
64
+
65
+ Subject to the terms and conditions of this License, each Contributor hereby
66
+ grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
67
+ irrevocable copyright license to reproduce, prepare Derivative Works of,
68
+ publicly display, publicly perform, sublicense, and distribute the Work and such
69
+ Derivative Works in Source or Object form.
70
+
71
+ #### 3. Grant of Patent License
72
+
73
+ Subject to the terms and conditions of this License, each Contributor hereby
74
+ grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
75
+ irrevocable (except as stated in this section) patent license to make, have
76
+ made, use, offer to sell, sell, import, and otherwise transfer the Work, where
77
+ such license applies only to those patent claims licensable by such Contributor
78
+ that are necessarily infringed by their Contribution(s) alone or by combination
79
+ of their Contribution(s) with the Work to which such Contribution(s) was
80
+ submitted. If You institute patent litigation against any entity (including a
81
+ cross-claim or counterclaim in a lawsuit) alleging that the Work or a
82
+ Contribution incorporated within the Work constitutes direct or contributory
83
+ patent infringement, then any patent licenses granted to You under this License
84
+ for that Work shall terminate as of the date such litigation is filed.
85
+
86
+ #### 4. Redistribution
87
+
88
+ You may reproduce and distribute copies of the Work or Derivative Works thereof
89
+ in any medium, with or without modifications, and in Source or Object form,
90
+ provided that You meet the following conditions:
91
+
92
+ * **(a)** You must give any other recipients of the Work or Derivative Works a copy of
93
+ this License; and
94
+ * **(b)** You must cause any modified files to carry prominent notices stating that You
95
+ changed the files; and
96
+ * **(c)** You must retain, in the Source form of any Derivative Works that You distribute,
97
+ all copyright, patent, trademark, and attribution notices from the Source form
98
+ of the Work, excluding those notices that do not pertain to any part of the
99
+ Derivative Works; and
100
+ * **(d)** If the Work includes a “NOTICE” text file as part of its distribution, then any
101
+ Derivative Works that You distribute must include a readable copy of the
102
+ attribution notices contained within such NOTICE file, excluding those notices
103
+ that do not pertain to any part of the Derivative Works, in at least one of the
104
+ following places: within a NOTICE text file distributed as part of the
105
+ Derivative Works; within the Source form or documentation, if provided along
106
+ with the Derivative Works; or, within a display generated by the Derivative
107
+ Works, if and wherever such third-party notices normally appear. The contents of
108
+ the NOTICE file are for informational purposes only and do not modify the
109
+ License. You may add Your own attribution notices within Derivative Works that
110
+ You distribute, alongside or as an addendum to the NOTICE text from the Work,
111
+ provided that such additional attribution notices cannot be construed as
112
+ modifying the License.
113
+
114
+ You may add Your own copyright statement to Your modifications and may provide
115
+ additional or different license terms and conditions for use, reproduction, or
116
+ distribution of Your modifications, or for any such Derivative Works as a whole,
117
+ provided Your use, reproduction, and distribution of the Work otherwise complies
118
+ with the conditions stated in this License.
119
+
120
+ #### 5. Submission of Contributions
121
+
122
+ Unless You explicitly state otherwise, any Contribution intentionally submitted
123
+ for inclusion in the Work by You to the Licensor shall be under the terms and
124
+ conditions of this License, without any additional terms or conditions.
125
+ Notwithstanding the above, nothing herein shall supersede or modify the terms of
126
+ any separate license agreement you may have executed with Licensor regarding
127
+ such Contributions.
128
+
129
+ #### 6. Trademarks
130
+
131
+ This License does not grant permission to use the trade names, trademarks,
132
+ service marks, or product names of the Licensor, except as required for
133
+ reasonable and customary use in describing the origin of the Work and
134
+ reproducing the content of the NOTICE file.
135
+
136
+ #### 7. Disclaimer of Warranty
137
+
138
+ Unless required by applicable law or agreed to in writing, Licensor provides the
139
+ Work (and each Contributor provides its Contributions) on an “AS IS” BASIS,
140
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied,
141
+ including, without limitation, any warranties or conditions of TITLE,
142
+ NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are
143
+ solely responsible for determining the appropriateness of using or
144
+ redistributing the Work and assume any risks associated with Your exercise of
145
+ permissions under this License.
146
+
147
+ #### 8. Limitation of Liability
148
+
149
+ In no event and under no legal theory, whether in tort (including negligence),
150
+ contract, or otherwise, unless required by applicable law (such as deliberate
151
+ and grossly negligent acts) or agreed to in writing, shall any Contributor be
152
+ liable to You for damages, including any direct, indirect, special, incidental,
153
+ or consequential damages of any character arising as a result of this License or
154
+ out of the use or inability to use the Work (including but not limited to
155
+ damages for loss of goodwill, work stoppage, computer failure or malfunction, or
156
+ any and all other commercial damages or losses), even if such Contributor has
157
+ been advised of the possibility of such damages.
158
+
159
+ #### 9. Accepting Warranty or Additional Liability
160
+
161
+ While redistributing the Work or Derivative Works thereof, You may choose to
162
+ offer, and charge a fee for, acceptance of support, warranty, indemnity, or
163
+ other liability obligations and/or rights consistent with this License. However,
164
+ in accepting such obligations, You may act only on Your own behalf and on Your
165
+ sole responsibility, not on behalf of any other Contributor, and only if You
166
+ agree to indemnify, defend, and hold each Contributor harmless for any liability
167
+ incurred by, or claims asserted against, such Contributor by reason of your
168
+ accepting any such warranty or additional liability.
169
+
170
+ _END OF TERMS AND CONDITIONS_
171
+
172
+ ### APPENDIX: How to apply the Apache License to your work
173
+
174
+ To apply the Apache License to your work, attach the following boilerplate
175
+ notice, with the fields enclosed by brackets `[]` replaced with your own
176
+ identifying information. (Don't include the brackets!) The text should be
177
+ enclosed in the appropriate comment syntax for the file format. We also
178
+ recommend that a file or class name and description of purpose be included on
179
+ the same “printed page” as the copyright notice for easier identification within
180
+ third-party archives.
181
+
182
+ Copyright [yyyy] [name of copyright owner]
183
+
184
+ Licensed under the Apache License, Version 2.0 (the "License");
185
+ you may not use this file except in compliance with the License.
186
+ You may obtain a copy of the License at
187
+
188
+ http://www.apache.org/licenses/LICENSE-2.0
189
+
190
+ Unless required by applicable law or agreed to in writing, software
191
+ distributed under the License is distributed on an "AS IS" BASIS,
192
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
193
+ See the License for the specific language governing permissions and
194
+ limitations under the License.
195
+
.venv/lib/python3.10/site-packages/aiofile-3.9.0.dist-info/LICENCE.md ADDED
@@ -0,0 +1,195 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Apache License
2
+ ==============
3
+
4
+ _Version 2.0, January 2004_
5
+ _&lt;<http://www.apache.org/licenses/>&gt;_
6
+
7
+ ### Terms and Conditions for use, reproduction, and distribution
8
+
9
+ #### 1. Definitions
10
+
11
+ “License” shall mean the terms and conditions for use, reproduction, and
12
+ distribution as defined by Sections 1 through 9 of this document.
13
+
14
+ “Licensor” shall mean the copyright owner or entity authorized by the copyright
15
+ owner that is granting the License.
16
+
17
+ “Legal Entity” shall mean the union of the acting entity and all other entities
18
+ that control, are controlled by, or are under common control with that entity.
19
+ For the purposes of this definition, “control” means **(i)** the power, direct or
20
+ indirect, to cause the direction or management of such entity, whether by
21
+ contract or otherwise, or **(ii)** ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or **(iii)** beneficial ownership of such entity.
23
+
24
+ “You” (or “Your”) shall mean an individual or Legal Entity exercising
25
+ permissions granted by this License.
26
+
27
+ “Source” form shall mean the preferred form for making modifications, including
28
+ but not limited to software source code, documentation source, and configuration
29
+ files.
30
+
31
+ “Object” form shall mean any form resulting from mechanical transformation or
32
+ translation of a Source form, including but not limited to compiled object code,
33
+ generated documentation, and conversions to other media types.
34
+
35
+ “Work” shall mean the work of authorship, whether in Source or Object form, made
36
+ available under the License, as indicated by a copyright notice that is included
37
+ in or attached to the work (an example is provided in the Appendix below).
38
+
39
+ “Derivative Works” shall mean any work, whether in Source or Object form, that
40
+ is based on (or derived from) the Work and for which the editorial revisions,
41
+ annotations, elaborations, or other modifications represent, as a whole, an
42
+ original work of authorship. For the purposes of this License, Derivative Works
43
+ shall not include works that remain separable from, or merely link (or bind by
44
+ name) to the interfaces of, the Work and Derivative Works thereof.
45
+
46
+ “Contribution” shall mean any work of authorship, including the original version
47
+ of the Work and any modifications or additions to that Work or Derivative Works
48
+ thereof, that is intentionally submitted to Licensor for inclusion in the Work
49
+ by the copyright owner or by an individual or Legal Entity authorized to submit
50
+ on behalf of the copyright owner. For the purposes of this definition,
51
+ “submitted” means any form of electronic, verbal, or written communication sent
52
+ to the Licensor or its representatives, including but not limited to
53
+ communication on electronic mailing lists, source code control systems, and
54
+ issue tracking systems that are managed by, or on behalf of, the Licensor for
55
+ the purpose of discussing and improving the Work, but excluding communication
56
+ that is conspicuously marked or otherwise designated in writing by the copyright
57
+ owner as “Not a Contribution.”
58
+
59
+ “Contributor” shall mean Licensor and any individual or Legal Entity on behalf
60
+ of whom a Contribution has been received by Licensor and subsequently
61
+ incorporated within the Work.
62
+
63
+ #### 2. Grant of Copyright License
64
+
65
+ Subject to the terms and conditions of this License, each Contributor hereby
66
+ grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
67
+ irrevocable copyright license to reproduce, prepare Derivative Works of,
68
+ publicly display, publicly perform, sublicense, and distribute the Work and such
69
+ Derivative Works in Source or Object form.
70
+
71
+ #### 3. Grant of Patent License
72
+
73
+ Subject to the terms and conditions of this License, each Contributor hereby
74
+ grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
75
+ irrevocable (except as stated in this section) patent license to make, have
76
+ made, use, offer to sell, sell, import, and otherwise transfer the Work, where
77
+ such license applies only to those patent claims licensable by such Contributor
78
+ that are necessarily infringed by their Contribution(s) alone or by combination
79
+ of their Contribution(s) with the Work to which such Contribution(s) was
80
+ submitted. If You institute patent litigation against any entity (including a
81
+ cross-claim or counterclaim in a lawsuit) alleging that the Work or a
82
+ Contribution incorporated within the Work constitutes direct or contributory
83
+ patent infringement, then any patent licenses granted to You under this License
84
+ for that Work shall terminate as of the date such litigation is filed.
85
+
86
+ #### 4. Redistribution
87
+
88
+ You may reproduce and distribute copies of the Work or Derivative Works thereof
89
+ in any medium, with or without modifications, and in Source or Object form,
90
+ provided that You meet the following conditions:
91
+
92
+ * **(a)** You must give any other recipients of the Work or Derivative Works a copy of
93
+ this License; and
94
+ * **(b)** You must cause any modified files to carry prominent notices stating that You
95
+ changed the files; and
96
+ * **(c)** You must retain, in the Source form of any Derivative Works that You distribute,
97
+ all copyright, patent, trademark, and attribution notices from the Source form
98
+ of the Work, excluding those notices that do not pertain to any part of the
99
+ Derivative Works; and
100
+ * **(d)** If the Work includes a “NOTICE” text file as part of its distribution, then any
101
+ Derivative Works that You distribute must include a readable copy of the
102
+ attribution notices contained within such NOTICE file, excluding those notices
103
+ that do not pertain to any part of the Derivative Works, in at least one of the
104
+ following places: within a NOTICE text file distributed as part of the
105
+ Derivative Works; within the Source form or documentation, if provided along
106
+ with the Derivative Works; or, within a display generated by the Derivative
107
+ Works, if and wherever such third-party notices normally appear. The contents of
108
+ the NOTICE file are for informational purposes only and do not modify the
109
+ License. You may add Your own attribution notices within Derivative Works that
110
+ You distribute, alongside or as an addendum to the NOTICE text from the Work,
111
+ provided that such additional attribution notices cannot be construed as
112
+ modifying the License.
113
+
114
+ You may add Your own copyright statement to Your modifications and may provide
115
+ additional or different license terms and conditions for use, reproduction, or
116
+ distribution of Your modifications, or for any such Derivative Works as a whole,
117
+ provided Your use, reproduction, and distribution of the Work otherwise complies
118
+ with the conditions stated in this License.
119
+
120
+ #### 5. Submission of Contributions
121
+
122
+ Unless You explicitly state otherwise, any Contribution intentionally submitted
123
+ for inclusion in the Work by You to the Licensor shall be under the terms and
124
+ conditions of this License, without any additional terms or conditions.
125
+ Notwithstanding the above, nothing herein shall supersede or modify the terms of
126
+ any separate license agreement you may have executed with Licensor regarding
127
+ such Contributions.
128
+
129
+ #### 6. Trademarks
130
+
131
+ This License does not grant permission to use the trade names, trademarks,
132
+ service marks, or product names of the Licensor, except as required for
133
+ reasonable and customary use in describing the origin of the Work and
134
+ reproducing the content of the NOTICE file.
135
+
136
+ #### 7. Disclaimer of Warranty
137
+
138
+ Unless required by applicable law or agreed to in writing, Licensor provides the
139
+ Work (and each Contributor provides its Contributions) on an “AS IS” BASIS,
140
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied,
141
+ including, without limitation, any warranties or conditions of TITLE,
142
+ NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are
143
+ solely responsible for determining the appropriateness of using or
144
+ redistributing the Work and assume any risks associated with Your exercise of
145
+ permissions under this License.
146
+
147
+ #### 8. Limitation of Liability
148
+
149
+ In no event and under no legal theory, whether in tort (including negligence),
150
+ contract, or otherwise, unless required by applicable law (such as deliberate
151
+ and grossly negligent acts) or agreed to in writing, shall any Contributor be
152
+ liable to You for damages, including any direct, indirect, special, incidental,
153
+ or consequential damages of any character arising as a result of this License or
154
+ out of the use or inability to use the Work (including but not limited to
155
+ damages for loss of goodwill, work stoppage, computer failure or malfunction, or
156
+ any and all other commercial damages or losses), even if such Contributor has
157
+ been advised of the possibility of such damages.
158
+
159
+ #### 9. Accepting Warranty or Additional Liability
160
+
161
+ While redistributing the Work or Derivative Works thereof, You may choose to
162
+ offer, and charge a fee for, acceptance of support, warranty, indemnity, or
163
+ other liability obligations and/or rights consistent with this License. However,
164
+ in accepting such obligations, You may act only on Your own behalf and on Your
165
+ sole responsibility, not on behalf of any other Contributor, and only if You
166
+ agree to indemnify, defend, and hold each Contributor harmless for any liability
167
+ incurred by, or claims asserted against, such Contributor by reason of your
168
+ accepting any such warranty or additional liability.
169
+
170
+ _END OF TERMS AND CONDITIONS_
171
+
172
+ ### APPENDIX: How to apply the Apache License to your work
173
+
174
+ To apply the Apache License to your work, attach the following boilerplate
175
+ notice, with the fields enclosed by brackets `[]` replaced with your own
176
+ identifying information. (Don't include the brackets!) The text should be
177
+ enclosed in the appropriate comment syntax for the file format. We also
178
+ recommend that a file or class name and description of purpose be included on
179
+ the same “printed page” as the copyright notice for easier identification within
180
+ third-party archives.
181
+
182
+ Copyright [yyyy] [name of copyright owner]
183
+
184
+ Licensed under the Apache License, Version 2.0 (the "License");
185
+ you may not use this file except in compliance with the License.
186
+ You may obtain a copy of the License at
187
+
188
+ http://www.apache.org/licenses/LICENSE-2.0
189
+
190
+ Unless required by applicable law or agreed to in writing, software
191
+ distributed under the License is distributed on an "AS IS" BASIS,
192
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
193
+ See the License for the specific language governing permissions and
194
+ limitations under the License.
195
+
.venv/lib/python3.10/site-packages/aiofile-3.9.0.dist-info/METADATA ADDED
@@ -0,0 +1,492 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Metadata-Version: 2.1
2
+ Name: aiofile
3
+ Version: 3.9.0
4
+ Summary: Asynchronous file operations.
5
+ Home-page: http://github.com/mosquito/aiofile
6
+ License: Apache-2.0
7
+ Keywords: aio,python,asyncio,fileio,io
8
+ Author: Dmitry Orlov
9
+ Author-email: me@mosquito.su
10
+ Requires-Python: >=3.8,<4
11
+ Classifier: Development Status :: 5 - Production/Stable
12
+ Classifier: Environment :: Console
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Intended Audience :: Education
15
+ Classifier: Intended Audience :: End Users/Desktop
16
+ Classifier: License :: OSI Approved :: Apache Software License
17
+ Classifier: Natural Language :: English
18
+ Classifier: Natural Language :: Russian
19
+ Classifier: Operating System :: MacOS :: MacOS X
20
+ Classifier: Operating System :: POSIX :: Linux
21
+ Classifier: Programming Language :: Python
22
+ Classifier: Programming Language :: Python :: 3
23
+ Classifier: Programming Language :: Python :: 3.8
24
+ Classifier: Programming Language :: Python :: 3.9
25
+ Classifier: Programming Language :: Python :: 3.10
26
+ Classifier: Programming Language :: Python :: 3.11
27
+ Classifier: Programming Language :: Python :: 3.12
28
+ Classifier: Programming Language :: Python :: 3 :: Only
29
+ Classifier: Programming Language :: Python :: 3.13
30
+ Classifier: Programming Language :: Python :: Implementation :: CPython
31
+ Classifier: Topic :: Software Development :: Libraries
32
+ Classifier: Topic :: System
33
+ Classifier: Topic :: System :: Operating System
34
+ Requires-Dist: caio (>=0.9.0,<0.10.0)
35
+ Description-Content-Type: text/markdown
36
+
37
+ # AIOFile
38
+
39
+ [![Github Actions](https://github.com/mosquito/aiofile/workflows/tox/badge.svg)](https://github.com/mosquito/aiofile/actions?query=branch%3Amaster) [![Latest Version](https://img.shields.io/pypi/v/aiofile.svg)](https://pypi.python.org/pypi/aiofile/) [![Wheel](https://img.shields.io/pypi/wheel/aiofile.svg)](https://pypi.python.org/pypi/aiofile/) [![Python Versions](https://img.shields.io/pypi/pyversions/aiofile.svg)](https://pypi.python.org/pypi/aiofile/) [![License](https://img.shields.io/pypi/l/aiofile.svg)](https://pypi.python.org/pypi/aiofile/) [![Coverage Status](https://coveralls.io/repos/github/mosquito/aiofile/badge.svg?branch=master)](https://coveralls.io/github/mosquito/aiofile?branch=master)
40
+
41
+ Real asynchronous file operations with asyncio support.
42
+
43
+ ## Status
44
+
45
+ Development - Stable
46
+
47
+ ## Features
48
+
49
+ * Since version 2.0.0 using [caio](https://pypi.org/project/caio), which contains linux `libaio` and two
50
+ thread-based implementations (c-based and pure-python).
51
+ * AIOFile has no internal pointer. You should pass `offset` and
52
+ `chunk_size` for each operation or use helpers (Reader or Writer).
53
+ The simplest way is to use `async_open` for creating object with
54
+ file-like interface.
55
+ * For Linux using implementation based on [libaio](https://pagure.io/libaio).
56
+ * For POSIX (MacOS X and optional Linux) using implementation
57
+ based on [threadpool](https://github.com/mbrossard/threadpool/).
58
+ * Otherwise using pure-python thread-based implementation.
59
+ * Implementation chooses automatically depending on system compatibility.
60
+
61
+ ## Limitations
62
+
63
+ * Linux native AIO implementation is not able to open special files.
64
+ Asynchronous operations against special fs like `/proc/` `/sys/` are not
65
+ supported by the kernel. It's not a aiofile's or caio issue.
66
+ In these cases, you might switch to thread-based implementations
67
+ (see [Troubleshooting](#troubleshooting) section).
68
+ However, when used on supported file systems, the linux implementation has a
69
+ smaller overhead and is preferred but it's not a silver bullet.
70
+
71
+ ## Code examples
72
+
73
+ All code examples require Python 3.6+.
74
+
75
+ ### High-level API
76
+
77
+ #### `async_open` helper
78
+
79
+ Helper mimics python file-like objects, it returns file-like
80
+ objects with similar but async methods.
81
+
82
+ Supported methods:
83
+
84
+ * `async def read(length = -1)` - reading chunk from file, when length is
85
+ `-1`, will be reading file to the end.
86
+ * `async def write(data)` - writing chunk to file
87
+ * `def seek(offset)` - setting file pointer position
88
+ * `def tell()` - returns current file pointer position
89
+ * `async def readline(size=-1, newline="\n")` - read chunks until
90
+ newline or EOF. Since version 3.7.0 `__aiter__` returns `LineReader`.
91
+
92
+ This method is suboptimal for small lines because it doesn't reuse read buffer.
93
+ When you want to read file by lines please avoid using `async_open`
94
+ use `LineReader` instead.
95
+ * `def __aiter__() -> LineReader` - iterator over lines.
96
+ * `def iter_chunked(chunk_size: int = 32768) -> Reader` - iterator over
97
+ chunks.
98
+ * `.file` property contains AIOFile object
99
+
100
+ Basic example:
101
+
102
+ <!-- name: test_basic -->
103
+ ```python
104
+ import asyncio
105
+ from pathlib import Path
106
+ from tempfile import gettempdir
107
+
108
+ from aiofile import async_open
109
+
110
+ tmp_filename = Path(gettempdir()) / "hello.txt"
111
+
112
+ async def main():
113
+ async with async_open(tmp_filename, 'w+') as afp:
114
+ await afp.write("Hello ")
115
+ await afp.write("world")
116
+ afp.seek(0)
117
+
118
+ print(await afp.read())
119
+
120
+ await afp.write("Hello from\nasync world")
121
+ print(await afp.readline())
122
+ print(await afp.readline())
123
+
124
+ asyncio.run(main())
125
+ ```
126
+
127
+ Example without context manager:
128
+
129
+ <!-- name: test_basic_without_context_manager -->
130
+ ```python
131
+ import asyncio
132
+ import atexit
133
+ import os
134
+ from tempfile import mktemp
135
+
136
+ from aiofile import async_open
137
+
138
+
139
+ TMP_NAME = mktemp()
140
+ atexit.register(os.unlink, TMP_NAME)
141
+
142
+
143
+ async def main():
144
+ afp = await async_open(TMP_NAME, "w")
145
+ await afp.write("Hello")
146
+ await afp.close()
147
+
148
+
149
+ asyncio.run(main())
150
+ assert open(TMP_NAME, "r").read() == "Hello"
151
+ ```
152
+
153
+ Concatenate example program (`cat`):
154
+
155
+ ```python
156
+ import asyncio
157
+ import sys
158
+ from argparse import ArgumentParser
159
+ from pathlib import Path
160
+
161
+ from aiofile import async_open
162
+
163
+ parser = ArgumentParser(
164
+ description="Read files line by line using asynchronous io API"
165
+ )
166
+ parser.add_argument("file_name", nargs="+", type=Path)
167
+
168
+ async def main(arguments):
169
+ for src in arguments.file_name:
170
+ async with async_open(src, "r") as afp:
171
+ async for line in afp:
172
+ sys.stdout.write(line)
173
+
174
+
175
+ asyncio.run(main(parser.parse_args()))
176
+ ```
177
+
178
+ Copy file example program (`cp`):
179
+
180
+ ```python
181
+ import asyncio
182
+ from argparse import ArgumentParser
183
+ from pathlib import Path
184
+
185
+ from aiofile import async_open
186
+
187
+ parser = ArgumentParser(
188
+ description="Copying files using asynchronous io API"
189
+ )
190
+ parser.add_argument("source", type=Path)
191
+ parser.add_argument("dest", type=Path)
192
+ parser.add_argument("--chunk-size", type=int, default=65535)
193
+
194
+
195
+ async def main(arguments):
196
+ async with async_open(arguments.source, "rb") as src, \
197
+ async_open(arguments.dest, "wb") as dest:
198
+ async for chunk in src.iter_chunked(arguments.chunk_size):
199
+ await dest.write(chunk)
200
+
201
+
202
+ asyncio.run(main(parser.parse_args()))
203
+ ```
204
+
205
+ Example with opening already open file pointer:
206
+
207
+ ```python
208
+ import asyncio
209
+ from typing import IO, Any
210
+ from aiofile import async_open
211
+
212
+
213
+ async def main(fp: IO[Any]):
214
+ async with async_open(fp) as afp:
215
+ await afp.write("Hello from\nasync world")
216
+ print(await afp.readline())
217
+
218
+
219
+ with open("test.txt", "w+") as fp:
220
+ asyncio.run(main(fp))
221
+ ```
222
+
223
+ Linux native aio doesn't support reading and writing special files
224
+ (e.g. procfs/sysfs/unix pipes/etc.), so you can perform operations with
225
+ these files using compatible context objects.
226
+
227
+ ```python
228
+ import asyncio
229
+ from aiofile import async_open
230
+ from caio import thread_aio_asyncio
231
+ from contextlib import AsyncExitStack
232
+
233
+
234
+ async def main():
235
+ async with AsyncExitStack() as stack:
236
+
237
+ # Custom context should be reused
238
+ ctx = await stack.enter_async_context(
239
+ thread_aio_asyncio.AsyncioContext()
240
+ )
241
+
242
+ # Open special file with custom context
243
+ src = await stack.enter_async_context(
244
+ async_open("/proc/cpuinfo", "r", context=ctx)
245
+ )
246
+
247
+ # Open regular file with default context
248
+ dest = await stack.enter_async_context(
249
+ async_open("/tmp/cpuinfo", "w")
250
+ )
251
+
252
+ # Copying file content line by line
253
+ async for line in src:
254
+ await dest.write(line)
255
+
256
+
257
+ asyncio.run(main())
258
+ ```
259
+
260
+ ### Low-level API
261
+
262
+ The `AIOFile` class is a low-level interface for asynchronous file operations, and the read and write methods accept
263
+ an `offset=0` in bytes at which the operation will be performed.
264
+
265
+ This allows you to do many independent IO operations on a once open file without moving the virtual carriage.
266
+
267
+ For example, you may make 10 concurrent HTTP requests by specifying the `Range` header, and asynchronously write
268
+ one opened file, while the offsets must either be calculated manually, or use 10 instances of `Writer` with
269
+ specified initial offsets.
270
+
271
+ In order to provide sequential reading and writing, there is `Writer`, `Reader` and `LineReader`. Keep in mind
272
+ `async_open` is not the same as AIOFile, it provides a similar interface for file operations, it simulates methods
273
+ like read or write as it is implemented in the built-in open.
274
+
275
+ ```python
276
+ import asyncio
277
+ from aiofile import AIOFile
278
+
279
+
280
+ async def main():
281
+ async with AIOFile("hello.txt", 'w+') as afp:
282
+ payload = "Hello world\n"
283
+
284
+ await asyncio.gather(
285
+ *[afp.write(payload, offset=i * len(payload)) for i in range(10)]
286
+ )
287
+
288
+ await afp.fsync()
289
+
290
+ assert await afp.read(len(payload) * 10) == payload * 10
291
+
292
+ asyncio.run(main())
293
+ ```
294
+
295
+ The Low-level API in fact is just little bit sugared `caio` API.
296
+
297
+ ```python
298
+ import asyncio
299
+ from aiofile import AIOFile
300
+
301
+
302
+ async def main():
303
+ async with AIOFile("/tmp/hello.txt", 'w+') as afp:
304
+ await afp.write("Hello ")
305
+ await afp.write("world", offset=7)
306
+ await afp.fsync()
307
+
308
+ print(await afp.read())
309
+
310
+
311
+ asyncio.run(main())
312
+ ```
313
+
314
+ #### `Reader` and `Writer`
315
+
316
+ When you want to read or write file linearly following example
317
+ might be helpful.
318
+
319
+ ```python
320
+ import asyncio
321
+ from aiofile import AIOFile, Reader, Writer
322
+
323
+
324
+ async def main():
325
+ async with AIOFile("/tmp/hello.txt", 'w+') as afp:
326
+ writer = Writer(afp)
327
+ reader = Reader(afp, chunk_size=8)
328
+
329
+ await writer("Hello")
330
+ await writer(" ")
331
+ await writer("World")
332
+ await afp.fsync()
333
+
334
+ async for chunk in reader:
335
+ print(chunk)
336
+
337
+
338
+ asyncio.run(main())
339
+ ```
340
+
341
+ #### `LineReader` - read file line by line
342
+
343
+ LineReader is a helper that is very effective when you want to read a file
344
+ linearly and line by line.
345
+
346
+ It contains a buffer and will read the fragments of the file chunk by
347
+ chunk into the buffer, where it will try to find lines.
348
+
349
+ The default chunk size is 4KB.
350
+
351
+ ```python
352
+ import asyncio
353
+ from aiofile import AIOFile, LineReader, Writer
354
+
355
+
356
+ async def main():
357
+ async with AIOFile("/tmp/hello.txt", 'w+') as afp:
358
+ writer = Writer(afp)
359
+
360
+ await writer("Hello")
361
+ await writer(" ")
362
+ await writer("World")
363
+ await writer("\n")
364
+ await writer("\n")
365
+ await writer("From async world")
366
+ await afp.fsync()
367
+
368
+ async for line in LineReader(afp):
369
+ print(line)
370
+
371
+
372
+ asyncio.run(main())
373
+ ```
374
+
375
+ When you want to read file by lines please avoid to use `async_open`
376
+ use `LineReader` instead.
377
+
378
+ ## More examples
379
+
380
+ Useful examples with `aiofile`
381
+
382
+ ### Async CSV Dict Reader
383
+
384
+ ```python
385
+ import asyncio
386
+ import io
387
+ from csv import DictReader
388
+
389
+ from aiofile import AIOFile, LineReader
390
+
391
+
392
+ class AsyncDictReader:
393
+ def __init__(self, afp, **kwargs):
394
+ self.buffer = io.BytesIO()
395
+ self.file_reader = LineReader(
396
+ afp, line_sep=kwargs.pop('line_sep', '\n'),
397
+ chunk_size=kwargs.pop('chunk_size', 4096),
398
+ offset=kwargs.pop('offset', 0),
399
+ )
400
+ self.reader = DictReader(
401
+ io.TextIOWrapper(
402
+ self.buffer,
403
+ encoding=kwargs.pop('encoding', 'utf-8'),
404
+ errors=kwargs.pop('errors', 'replace'),
405
+ ), **kwargs,
406
+ )
407
+ self.line_num = 0
408
+
409
+ def __aiter__(self):
410
+ return self
411
+
412
+ async def __anext__(self):
413
+ if self.line_num == 0:
414
+ header = await self.file_reader.readline()
415
+ self.buffer.write(header)
416
+
417
+ line = await self.file_reader.readline()
418
+
419
+ if not line:
420
+ raise StopAsyncIteration
421
+
422
+ self.buffer.write(line)
423
+ self.buffer.seek(0)
424
+
425
+ try:
426
+ result = next(self.reader)
427
+ except StopIteration as e:
428
+ raise StopAsyncIteration from e
429
+
430
+ self.buffer.seek(0)
431
+ self.buffer.truncate(0)
432
+ self.line_num = self.reader.line_num
433
+
434
+ return result
435
+
436
+
437
+ async def main():
438
+ async with AIOFile('sample.csv', 'rb') as afp:
439
+ async for item in AsyncDictReader(afp):
440
+ print(item)
441
+
442
+
443
+ asyncio.run(main())
444
+ ```
445
+
446
+ ## Troubleshooting
447
+
448
+ The caio `linux` implementation works normal for modern linux kernel versions
449
+ and file systems. So you may have problems specific for your environment.
450
+ It's not a bug and might be resolved some ways:
451
+
452
+ 1. Upgrade the kernel
453
+ 2. Use compatible file systems
454
+ 3. Use threads based or pure python implementation.
455
+
456
+ The caio since version 0.7.0 contains some ways to do this.
457
+
458
+ 1. In runtime use the environment variable `CAIO_IMPL` with
459
+ possible values:
460
+
461
+ * `linux` - use native linux kernels aio mechanism
462
+ * `thread` - use thread based implementation written in C
463
+ * `python` - use pure python implementation
464
+
465
+ 2. File `default_implementation` located near `__init__.py` in caio
466
+ installation path. It's useful for distros package maintainers. This file
467
+ might contains comments (lines starts with `#` symbol) and the first line
468
+ should be one of `linux` `thread` or `python`.
469
+
470
+ 3. You might manually manage contexts:
471
+
472
+ ```python
473
+ import asyncio
474
+
475
+ from aiofile import async_open
476
+ from caio import linux_aio_asyncio, thread_aio_asyncio
477
+
478
+
479
+ async def main():
480
+ linux_ctx = linux_aio_asyncio.AsyncioContext()
481
+ threads_ctx = thread_aio_asyncio.AsyncioContext()
482
+
483
+ async with async_open("/tmp/test.txt", "w", context=linux_ctx) as afp:
484
+ await afp.write("Hello")
485
+
486
+ async with async_open("/tmp/test.txt", "r", context=threads_ctx) as afp:
487
+ print(await afp.read())
488
+
489
+
490
+ asyncio.run(main())
491
+ ```
492
+
.venv/lib/python3.10/site-packages/aiofile-3.9.0.dist-info/RECORD ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ aiofile-3.9.0.dist-info/INSTALLER,sha256=5hhM4Q4mYTT9z6QB6PGpUAW81PGNFrYrdXMj4oM_6ak,2
2
+ aiofile-3.9.0.dist-info/LICENCE,sha256=7GQBUOA3dNG1Jk-yaPOCncNnRVURCRMev23QpZ1ew-s,10495
3
+ aiofile-3.9.0.dist-info/LICENCE.md,sha256=7GQBUOA3dNG1Jk-yaPOCncNnRVURCRMev23QpZ1ew-s,10495
4
+ aiofile-3.9.0.dist-info/METADATA,sha256=zlrmdokR-TvPMaMTeGvp9rtpqqoSkMIG76QPqfB50lI,14046
5
+ aiofile-3.9.0.dist-info/RECORD,,
6
+ aiofile-3.9.0.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
+ aiofile-3.9.0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
8
+ aiofile/__init__.py,sha256=7yc9jKAQNFC1bYghRlMM_tvMlqNXBoWFC0DHrVtZimg,618
9
+ aiofile/aio.py,sha256=YvUNB51-p7MjwcTwQsZUKnahrNnfloJohyQRhhGONOU,9147
10
+ aiofile/py.typed,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
11
+ aiofile/utils.py,sha256=fSmImBPaZrFmiHXn0x0UrUa3T9NPa13YK6kcqO1Viow,10607
12
+ aiofile/version.py,sha256=4JIbHoxFpAICH6rY5oqXJ8_iP-wLwyx3U2YNgk2nUZI,483
.venv/lib/python3.10/site-packages/aiofile-3.9.0.dist-info/REQUESTED ADDED
File without changes
.venv/lib/python3.10/site-packages/aiofile-3.9.0.dist-info/WHEEL ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ Wheel-Version: 1.0
2
+ Generator: poetry-core 1.9.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
.venv/lib/python3.10/site-packages/attr/__init__.py ADDED
@@ -0,0 +1,104 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # SPDX-License-Identifier: MIT
2
+
3
+ """
4
+ Classes Without Boilerplate
5
+ """
6
+
7
+ from functools import partial
8
+ from typing import Callable, Literal, Protocol
9
+
10
+ from . import converters, exceptions, filters, setters, validators
11
+ from ._cmp import cmp_using
12
+ from ._config import get_run_validators, set_run_validators
13
+ from ._funcs import asdict, assoc, astuple, has, resolve_types
14
+ from ._make import (
15
+ NOTHING,
16
+ Attribute,
17
+ Converter,
18
+ Factory,
19
+ _Nothing,
20
+ attrib,
21
+ attrs,
22
+ evolve,
23
+ fields,
24
+ fields_dict,
25
+ make_class,
26
+ validate,
27
+ )
28
+ from ._next_gen import define, field, frozen, mutable
29
+ from ._version_info import VersionInfo
30
+
31
+
32
+ s = attributes = attrs
33
+ ib = attr = attrib
34
+ dataclass = partial(attrs, auto_attribs=True) # happy Easter ;)
35
+
36
+
37
+ class AttrsInstance(Protocol):
38
+ pass
39
+
40
+
41
+ NothingType = Literal[_Nothing.NOTHING]
42
+
43
+ __all__ = [
44
+ "NOTHING",
45
+ "Attribute",
46
+ "AttrsInstance",
47
+ "Converter",
48
+ "Factory",
49
+ "NothingType",
50
+ "asdict",
51
+ "assoc",
52
+ "astuple",
53
+ "attr",
54
+ "attrib",
55
+ "attributes",
56
+ "attrs",
57
+ "cmp_using",
58
+ "converters",
59
+ "define",
60
+ "evolve",
61
+ "exceptions",
62
+ "field",
63
+ "fields",
64
+ "fields_dict",
65
+ "filters",
66
+ "frozen",
67
+ "get_run_validators",
68
+ "has",
69
+ "ib",
70
+ "make_class",
71
+ "mutable",
72
+ "resolve_types",
73
+ "s",
74
+ "set_run_validators",
75
+ "setters",
76
+ "validate",
77
+ "validators",
78
+ ]
79
+
80
+
81
+ def _make_getattr(mod_name: str) -> Callable:
82
+ """
83
+ Create a metadata proxy for packaging information that uses *mod_name* in
84
+ its warnings and errors.
85
+ """
86
+
87
+ def __getattr__(name: str) -> str:
88
+ if name not in ("__version__", "__version_info__"):
89
+ msg = f"module {mod_name} has no attribute {name}"
90
+ raise AttributeError(msg)
91
+
92
+ from importlib.metadata import metadata
93
+
94
+ meta = metadata("attrs")
95
+
96
+ if name == "__version_info__":
97
+ return VersionInfo._from_version_string(meta["version"])
98
+
99
+ return meta["version"]
100
+
101
+ return __getattr__
102
+
103
+
104
+ __getattr__ = _make_getattr(__name__)
.venv/lib/python3.10/site-packages/attr/__init__.pyi ADDED
@@ -0,0 +1,389 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import enum
2
+ import sys
3
+
4
+ from typing import (
5
+ Any,
6
+ Callable,
7
+ Generic,
8
+ Literal,
9
+ Mapping,
10
+ Protocol,
11
+ Sequence,
12
+ TypeVar,
13
+ overload,
14
+ )
15
+
16
+ # `import X as X` is required to make these public
17
+ from . import converters as converters
18
+ from . import exceptions as exceptions
19
+ from . import filters as filters
20
+ from . import setters as setters
21
+ from . import validators as validators
22
+ from ._cmp import cmp_using as cmp_using
23
+ from ._typing_compat import AttrsInstance_
24
+ from ._version_info import VersionInfo
25
+ from attrs import (
26
+ define as define,
27
+ field as field,
28
+ mutable as mutable,
29
+ frozen as frozen,
30
+ _EqOrderType,
31
+ _ValidatorType,
32
+ _ConverterType,
33
+ _ReprArgType,
34
+ _OnSetAttrType,
35
+ _OnSetAttrArgType,
36
+ _FieldTransformer,
37
+ _ValidatorArgType,
38
+ )
39
+
40
+ if sys.version_info >= (3, 10):
41
+ from typing import TypeGuard, TypeAlias
42
+ else:
43
+ from typing_extensions import TypeGuard, TypeAlias
44
+
45
+ if sys.version_info >= (3, 11):
46
+ from typing import dataclass_transform
47
+ else:
48
+ from typing_extensions import dataclass_transform
49
+
50
+ __version__: str
51
+ __version_info__: VersionInfo
52
+ __title__: str
53
+ __description__: str
54
+ __url__: str
55
+ __uri__: str
56
+ __author__: str
57
+ __email__: str
58
+ __license__: str
59
+ __copyright__: str
60
+
61
+ _T = TypeVar("_T")
62
+ _C = TypeVar("_C", bound=type)
63
+
64
+ _FilterType = Callable[["Attribute[_T]", _T], bool]
65
+
66
+ # We subclass this here to keep the protocol's qualified name clean.
67
+ class AttrsInstance(AttrsInstance_, Protocol):
68
+ pass
69
+
70
+ _A = TypeVar("_A", bound=type[AttrsInstance])
71
+
72
+ class _Nothing(enum.Enum):
73
+ NOTHING = enum.auto()
74
+
75
+ NOTHING = _Nothing.NOTHING
76
+ NothingType: TypeAlias = Literal[_Nothing.NOTHING]
77
+
78
+ # NOTE: Factory lies about its return type to make this possible:
79
+ # `x: List[int] # = Factory(list)`
80
+ # Work around mypy issue #4554 in the common case by using an overload.
81
+
82
+ @overload
83
+ def Factory(factory: Callable[[], _T]) -> _T: ...
84
+ @overload
85
+ def Factory(
86
+ factory: Callable[[Any], _T],
87
+ takes_self: Literal[True],
88
+ ) -> _T: ...
89
+ @overload
90
+ def Factory(
91
+ factory: Callable[[], _T],
92
+ takes_self: Literal[False],
93
+ ) -> _T: ...
94
+
95
+ In = TypeVar("In")
96
+ Out = TypeVar("Out")
97
+
98
+ class Converter(Generic[In, Out]):
99
+ @overload
100
+ def __init__(self, converter: Callable[[In], Out]) -> None: ...
101
+ @overload
102
+ def __init__(
103
+ self,
104
+ converter: Callable[[In, AttrsInstance, Attribute], Out],
105
+ *,
106
+ takes_self: Literal[True],
107
+ takes_field: Literal[True],
108
+ ) -> None: ...
109
+ @overload
110
+ def __init__(
111
+ self,
112
+ converter: Callable[[In, Attribute], Out],
113
+ *,
114
+ takes_field: Literal[True],
115
+ ) -> None: ...
116
+ @overload
117
+ def __init__(
118
+ self,
119
+ converter: Callable[[In, AttrsInstance], Out],
120
+ *,
121
+ takes_self: Literal[True],
122
+ ) -> None: ...
123
+
124
+ class Attribute(Generic[_T]):
125
+ name: str
126
+ default: _T | None
127
+ validator: _ValidatorType[_T] | None
128
+ repr: _ReprArgType
129
+ cmp: _EqOrderType
130
+ eq: _EqOrderType
131
+ order: _EqOrderType
132
+ hash: bool | None
133
+ init: bool
134
+ converter: Converter | None
135
+ metadata: dict[Any, Any]
136
+ type: type[_T] | None
137
+ kw_only: bool
138
+ on_setattr: _OnSetAttrType
139
+ alias: str | None
140
+
141
+ def evolve(self, **changes: Any) -> "Attribute[Any]": ...
142
+
143
+ # NOTE: We had several choices for the annotation to use for type arg:
144
+ # 1) Type[_T]
145
+ # - Pros: Handles simple cases correctly
146
+ # - Cons: Might produce less informative errors in the case of conflicting
147
+ # TypeVars e.g. `attr.ib(default='bad', type=int)`
148
+ # 2) Callable[..., _T]
149
+ # - Pros: Better error messages than #1 for conflicting TypeVars
150
+ # - Cons: Terrible error messages for validator checks.
151
+ # e.g. attr.ib(type=int, validator=validate_str)
152
+ # -> error: Cannot infer function type argument
153
+ # 3) type (and do all of the work in the mypy plugin)
154
+ # - Pros: Simple here, and we could customize the plugin with our own errors.
155
+ # - Cons: Would need to write mypy plugin code to handle all the cases.
156
+ # We chose option #1.
157
+
158
+ # `attr` lies about its return type to make the following possible:
159
+ # attr() -> Any
160
+ # attr(8) -> int
161
+ # attr(validator=<some callable>) -> Whatever the callable expects.
162
+ # This makes this type of assignments possible:
163
+ # x: int = attr(8)
164
+ #
165
+ # This form catches explicit None or no default but with no other arguments
166
+ # returns Any.
167
+ @overload
168
+ def attrib(
169
+ default: None = ...,
170
+ validator: None = ...,
171
+ repr: _ReprArgType = ...,
172
+ cmp: _EqOrderType | None = ...,
173
+ hash: bool | None = ...,
174
+ init: bool = ...,
175
+ metadata: Mapping[Any, Any] | None = ...,
176
+ type: None = ...,
177
+ converter: None = ...,
178
+ factory: None = ...,
179
+ kw_only: bool | None = ...,
180
+ eq: _EqOrderType | None = ...,
181
+ order: _EqOrderType | None = ...,
182
+ on_setattr: _OnSetAttrArgType | None = ...,
183
+ alias: str | None = ...,
184
+ ) -> Any: ...
185
+
186
+ # This form catches an explicit None or no default and infers the type from the
187
+ # other arguments.
188
+ @overload
189
+ def attrib(
190
+ default: None = ...,
191
+ validator: _ValidatorArgType[_T] | None = ...,
192
+ repr: _ReprArgType = ...,
193
+ cmp: _EqOrderType | None = ...,
194
+ hash: bool | None = ...,
195
+ init: bool = ...,
196
+ metadata: Mapping[Any, Any] | None = ...,
197
+ type: type[_T] | None = ...,
198
+ converter: _ConverterType
199
+ | list[_ConverterType]
200
+ | tuple[_ConverterType]
201
+ | None = ...,
202
+ factory: Callable[[], _T] | None = ...,
203
+ kw_only: bool | None = ...,
204
+ eq: _EqOrderType | None = ...,
205
+ order: _EqOrderType | None = ...,
206
+ on_setattr: _OnSetAttrArgType | None = ...,
207
+ alias: str | None = ...,
208
+ ) -> _T: ...
209
+
210
+ # This form catches an explicit default argument.
211
+ @overload
212
+ def attrib(
213
+ default: _T,
214
+ validator: _ValidatorArgType[_T] | None = ...,
215
+ repr: _ReprArgType = ...,
216
+ cmp: _EqOrderType | None = ...,
217
+ hash: bool | None = ...,
218
+ init: bool = ...,
219
+ metadata: Mapping[Any, Any] | None = ...,
220
+ type: type[_T] | None = ...,
221
+ converter: _ConverterType
222
+ | list[_ConverterType]
223
+ | tuple[_ConverterType]
224
+ | None = ...,
225
+ factory: Callable[[], _T] | None = ...,
226
+ kw_only: bool | None = ...,
227
+ eq: _EqOrderType | None = ...,
228
+ order: _EqOrderType | None = ...,
229
+ on_setattr: _OnSetAttrArgType | None = ...,
230
+ alias: str | None = ...,
231
+ ) -> _T: ...
232
+
233
+ # This form covers type=non-Type: e.g. forward references (str), Any
234
+ @overload
235
+ def attrib(
236
+ default: _T | None = ...,
237
+ validator: _ValidatorArgType[_T] | None = ...,
238
+ repr: _ReprArgType = ...,
239
+ cmp: _EqOrderType | None = ...,
240
+ hash: bool | None = ...,
241
+ init: bool = ...,
242
+ metadata: Mapping[Any, Any] | None = ...,
243
+ type: object = ...,
244
+ converter: _ConverterType
245
+ | list[_ConverterType]
246
+ | tuple[_ConverterType]
247
+ | None = ...,
248
+ factory: Callable[[], _T] | None = ...,
249
+ kw_only: bool | None = ...,
250
+ eq: _EqOrderType | None = ...,
251
+ order: _EqOrderType | None = ...,
252
+ on_setattr: _OnSetAttrArgType | None = ...,
253
+ alias: str | None = ...,
254
+ ) -> Any: ...
255
+ @overload
256
+ @dataclass_transform(order_default=True, field_specifiers=(attrib, field))
257
+ def attrs(
258
+ maybe_cls: _C,
259
+ these: dict[str, Any] | None = ...,
260
+ repr_ns: str | None = ...,
261
+ repr: bool = ...,
262
+ cmp: _EqOrderType | None = ...,
263
+ hash: bool | None = ...,
264
+ init: bool = ...,
265
+ slots: bool = ...,
266
+ frozen: bool = ...,
267
+ weakref_slot: bool = ...,
268
+ str: bool = ...,
269
+ auto_attribs: bool = ...,
270
+ kw_only: bool = ...,
271
+ cache_hash: bool = ...,
272
+ auto_exc: bool = ...,
273
+ eq: _EqOrderType | None = ...,
274
+ order: _EqOrderType | None = ...,
275
+ auto_detect: bool = ...,
276
+ collect_by_mro: bool = ...,
277
+ getstate_setstate: bool | None = ...,
278
+ on_setattr: _OnSetAttrArgType | None = ...,
279
+ field_transformer: _FieldTransformer | None = ...,
280
+ match_args: bool = ...,
281
+ unsafe_hash: bool | None = ...,
282
+ ) -> _C: ...
283
+ @overload
284
+ @dataclass_transform(order_default=True, field_specifiers=(attrib, field))
285
+ def attrs(
286
+ maybe_cls: None = ...,
287
+ these: dict[str, Any] | None = ...,
288
+ repr_ns: str | None = ...,
289
+ repr: bool = ...,
290
+ cmp: _EqOrderType | None = ...,
291
+ hash: bool | None = ...,
292
+ init: bool = ...,
293
+ slots: bool = ...,
294
+ frozen: bool = ...,
295
+ weakref_slot: bool = ...,
296
+ str: bool = ...,
297
+ auto_attribs: bool = ...,
298
+ kw_only: bool = ...,
299
+ cache_hash: bool = ...,
300
+ auto_exc: bool = ...,
301
+ eq: _EqOrderType | None = ...,
302
+ order: _EqOrderType | None = ...,
303
+ auto_detect: bool = ...,
304
+ collect_by_mro: bool = ...,
305
+ getstate_setstate: bool | None = ...,
306
+ on_setattr: _OnSetAttrArgType | None = ...,
307
+ field_transformer: _FieldTransformer | None = ...,
308
+ match_args: bool = ...,
309
+ unsafe_hash: bool | None = ...,
310
+ ) -> Callable[[_C], _C]: ...
311
+ def fields(cls: type[AttrsInstance] | AttrsInstance) -> Any: ...
312
+ def fields_dict(cls: type[AttrsInstance]) -> dict[str, Attribute[Any]]: ...
313
+ def validate(inst: AttrsInstance) -> None: ...
314
+ def resolve_types(
315
+ cls: _A,
316
+ globalns: dict[str, Any] | None = ...,
317
+ localns: dict[str, Any] | None = ...,
318
+ attribs: list[Attribute[Any]] | None = ...,
319
+ include_extras: bool = ...,
320
+ ) -> _A: ...
321
+
322
+ # TODO: add support for returning a proper attrs class from the mypy plugin
323
+ # we use Any instead of _CountingAttr so that e.g. `make_class('Foo',
324
+ # [attr.ib()])` is valid
325
+ def make_class(
326
+ name: str,
327
+ attrs: list[str] | tuple[str, ...] | dict[str, Any],
328
+ bases: tuple[type, ...] = ...,
329
+ class_body: dict[str, Any] | None = ...,
330
+ repr_ns: str | None = ...,
331
+ repr: bool = ...,
332
+ cmp: _EqOrderType | None = ...,
333
+ hash: bool | None = ...,
334
+ init: bool = ...,
335
+ slots: bool = ...,
336
+ frozen: bool = ...,
337
+ weakref_slot: bool = ...,
338
+ str: bool = ...,
339
+ auto_attribs: bool = ...,
340
+ kw_only: bool = ...,
341
+ cache_hash: bool = ...,
342
+ auto_exc: bool = ...,
343
+ eq: _EqOrderType | None = ...,
344
+ order: _EqOrderType | None = ...,
345
+ collect_by_mro: bool = ...,
346
+ on_setattr: _OnSetAttrArgType | None = ...,
347
+ field_transformer: _FieldTransformer | None = ...,
348
+ ) -> type: ...
349
+
350
+ # _funcs --
351
+
352
+ # TODO: add support for returning TypedDict from the mypy plugin
353
+ # FIXME: asdict/astuple do not honor their factory args. Waiting on one of
354
+ # these:
355
+ # https://github.com/python/mypy/issues/4236
356
+ # https://github.com/python/typing/issues/253
357
+ # XXX: remember to fix attrs.asdict/astuple too!
358
+ def asdict(
359
+ inst: AttrsInstance,
360
+ recurse: bool = ...,
361
+ filter: _FilterType[Any] | None = ...,
362
+ dict_factory: type[Mapping[Any, Any]] = ...,
363
+ retain_collection_types: bool = ...,
364
+ value_serializer: Callable[[type, Attribute[Any], Any], Any] | None = ...,
365
+ tuple_keys: bool | None = ...,
366
+ ) -> dict[str, Any]: ...
367
+
368
+ # TODO: add support for returning NamedTuple from the mypy plugin
369
+ def astuple(
370
+ inst: AttrsInstance,
371
+ recurse: bool = ...,
372
+ filter: _FilterType[Any] | None = ...,
373
+ tuple_factory: type[Sequence[Any]] = ...,
374
+ retain_collection_types: bool = ...,
375
+ ) -> tuple[Any, ...]: ...
376
+ def has(cls: type) -> TypeGuard[type[AttrsInstance]]: ...
377
+ def assoc(inst: _T, **changes: Any) -> _T: ...
378
+ def evolve(inst: _T, **changes: Any) -> _T: ...
379
+
380
+ # _config --
381
+
382
+ def set_run_validators(run: bool) -> None: ...
383
+ def get_run_validators() -> bool: ...
384
+
385
+ # aliases --
386
+
387
+ s = attributes = attrs
388
+ ib = attr = attrib
389
+ dataclass = attrs # Technically, partial(attrs, auto_attribs=True) ;)
.venv/lib/python3.10/site-packages/attr/__pycache__/__init__.cpython-310.pyc ADDED
Binary file (2.29 kB). View file
 
.venv/lib/python3.10/site-packages/attr/__pycache__/_cmp.cpython-310.pyc ADDED
Binary file (4.07 kB). View file
 
.venv/lib/python3.10/site-packages/attr/__pycache__/_compat.cpython-310.pyc ADDED
Binary file (2.56 kB). View file
 
.venv/lib/python3.10/site-packages/attr/__pycache__/_config.cpython-310.pyc ADDED
Binary file (1.05 kB). View file
 
.venv/lib/python3.10/site-packages/attr/__pycache__/_funcs.cpython-310.pyc ADDED
Binary file (10.9 kB). View file
 
.venv/lib/python3.10/site-packages/attr/__pycache__/_make.cpython-310.pyc ADDED
Binary file (75.6 kB). View file
 
.venv/lib/python3.10/site-packages/attr/__pycache__/_next_gen.cpython-310.pyc ADDED
Binary file (25.6 kB). View file
 
.venv/lib/python3.10/site-packages/attr/__pycache__/_version_info.cpython-310.pyc ADDED
Binary file (2.53 kB). View file
 
.venv/lib/python3.10/site-packages/attr/__pycache__/converters.cpython-310.pyc ADDED
Binary file (3.78 kB). View file
 
.venv/lib/python3.10/site-packages/attr/__pycache__/exceptions.cpython-310.pyc ADDED
Binary file (3.26 kB). View file
 
.venv/lib/python3.10/site-packages/attr/__pycache__/filters.cpython-310.pyc ADDED
Binary file (2.3 kB). View file
 
.venv/lib/python3.10/site-packages/attr/__pycache__/setters.cpython-310.pyc ADDED
Binary file (1.64 kB). View file
 
.venv/lib/python3.10/site-packages/attr/__pycache__/validators.cpython-310.pyc ADDED
Binary file (21.4 kB). View file
 
.venv/lib/python3.10/site-packages/attr/_cmp.py ADDED
@@ -0,0 +1,160 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # SPDX-License-Identifier: MIT
2
+
3
+
4
+ import functools
5
+ import types
6
+
7
+ from ._make import __ne__
8
+
9
+
10
+ _operation_names = {"eq": "==", "lt": "<", "le": "<=", "gt": ">", "ge": ">="}
11
+
12
+
13
+ def cmp_using(
14
+ eq=None,
15
+ lt=None,
16
+ le=None,
17
+ gt=None,
18
+ ge=None,
19
+ require_same_type=True,
20
+ class_name="Comparable",
21
+ ):
22
+ """
23
+ Create a class that can be passed into `attrs.field`'s ``eq``, ``order``,
24
+ and ``cmp`` arguments to customize field comparison.
25
+
26
+ The resulting class will have a full set of ordering methods if at least
27
+ one of ``{lt, le, gt, ge}`` and ``eq`` are provided.
28
+
29
+ Args:
30
+ eq (typing.Callable | None):
31
+ Callable used to evaluate equality of two objects.
32
+
33
+ lt (typing.Callable | None):
34
+ Callable used to evaluate whether one object is less than another
35
+ object.
36
+
37
+ le (typing.Callable | None):
38
+ Callable used to evaluate whether one object is less than or equal
39
+ to another object.
40
+
41
+ gt (typing.Callable | None):
42
+ Callable used to evaluate whether one object is greater than
43
+ another object.
44
+
45
+ ge (typing.Callable | None):
46
+ Callable used to evaluate whether one object is greater than or
47
+ equal to another object.
48
+
49
+ require_same_type (bool):
50
+ When `True`, equality and ordering methods will return
51
+ `NotImplemented` if objects are not of the same type.
52
+
53
+ class_name (str | None): Name of class. Defaults to "Comparable".
54
+
55
+ See `comparison` for more details.
56
+
57
+ .. versionadded:: 21.1.0
58
+ """
59
+
60
+ body = {
61
+ "__slots__": ["value"],
62
+ "__init__": _make_init(),
63
+ "_requirements": [],
64
+ "_is_comparable_to": _is_comparable_to,
65
+ }
66
+
67
+ # Add operations.
68
+ num_order_functions = 0
69
+ has_eq_function = False
70
+
71
+ if eq is not None:
72
+ has_eq_function = True
73
+ body["__eq__"] = _make_operator("eq", eq)
74
+ body["__ne__"] = __ne__
75
+
76
+ if lt is not None:
77
+ num_order_functions += 1
78
+ body["__lt__"] = _make_operator("lt", lt)
79
+
80
+ if le is not None:
81
+ num_order_functions += 1
82
+ body["__le__"] = _make_operator("le", le)
83
+
84
+ if gt is not None:
85
+ num_order_functions += 1
86
+ body["__gt__"] = _make_operator("gt", gt)
87
+
88
+ if ge is not None:
89
+ num_order_functions += 1
90
+ body["__ge__"] = _make_operator("ge", ge)
91
+
92
+ type_ = types.new_class(
93
+ class_name, (object,), {}, lambda ns: ns.update(body)
94
+ )
95
+
96
+ # Add same type requirement.
97
+ if require_same_type:
98
+ type_._requirements.append(_check_same_type)
99
+
100
+ # Add total ordering if at least one operation was defined.
101
+ if 0 < num_order_functions < 4:
102
+ if not has_eq_function:
103
+ # functools.total_ordering requires __eq__ to be defined,
104
+ # so raise early error here to keep a nice stack.
105
+ msg = "eq must be define is order to complete ordering from lt, le, gt, ge."
106
+ raise ValueError(msg)
107
+ type_ = functools.total_ordering(type_)
108
+
109
+ return type_
110
+
111
+
112
+ def _make_init():
113
+ """
114
+ Create __init__ method.
115
+ """
116
+
117
+ def __init__(self, value):
118
+ """
119
+ Initialize object with *value*.
120
+ """
121
+ self.value = value
122
+
123
+ return __init__
124
+
125
+
126
+ def _make_operator(name, func):
127
+ """
128
+ Create operator method.
129
+ """
130
+
131
+ def method(self, other):
132
+ if not self._is_comparable_to(other):
133
+ return NotImplemented
134
+
135
+ result = func(self.value, other.value)
136
+ if result is NotImplemented:
137
+ return NotImplemented
138
+
139
+ return result
140
+
141
+ method.__name__ = f"__{name}__"
142
+ method.__doc__ = (
143
+ f"Return a {_operation_names[name]} b. Computed by attrs."
144
+ )
145
+
146
+ return method
147
+
148
+
149
+ def _is_comparable_to(self, other):
150
+ """
151
+ Check whether `other` is comparable to `self`.
152
+ """
153
+ return all(func(self, other) for func in self._requirements)
154
+
155
+
156
+ def _check_same_type(self, other):
157
+ """
158
+ Return True if *self* and *other* are of the same type, False otherwise.
159
+ """
160
+ return other.value.__class__ is self.value.__class__
.venv/lib/python3.10/site-packages/attr/_cmp.pyi ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import Any, Callable
2
+
3
+ _CompareWithType = Callable[[Any, Any], bool]
4
+
5
+ def cmp_using(
6
+ eq: _CompareWithType | None = ...,
7
+ lt: _CompareWithType | None = ...,
8
+ le: _CompareWithType | None = ...,
9
+ gt: _CompareWithType | None = ...,
10
+ ge: _CompareWithType | None = ...,
11
+ require_same_type: bool = ...,
12
+ class_name: str = ...,
13
+ ) -> type: ...
.venv/lib/python3.10/site-packages/attr/_compat.py ADDED
@@ -0,0 +1,99 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # SPDX-License-Identifier: MIT
2
+
3
+ import inspect
4
+ import platform
5
+ import sys
6
+ import threading
7
+
8
+ from collections.abc import Mapping, Sequence # noqa: F401
9
+ from typing import _GenericAlias
10
+
11
+
12
+ PYPY = platform.python_implementation() == "PyPy"
13
+ PY_3_10_PLUS = sys.version_info[:2] >= (3, 10)
14
+ PY_3_11_PLUS = sys.version_info[:2] >= (3, 11)
15
+ PY_3_12_PLUS = sys.version_info[:2] >= (3, 12)
16
+ PY_3_13_PLUS = sys.version_info[:2] >= (3, 13)
17
+ PY_3_14_PLUS = sys.version_info[:2] >= (3, 14)
18
+
19
+
20
+ if PY_3_14_PLUS:
21
+ import annotationlib
22
+
23
+ # We request forward-ref annotations to not break in the presence of
24
+ # forward references.
25
+
26
+ def _get_annotations(cls):
27
+ return annotationlib.get_annotations(
28
+ cls, format=annotationlib.Format.FORWARDREF
29
+ )
30
+
31
+ else:
32
+
33
+ def _get_annotations(cls):
34
+ """
35
+ Get annotations for *cls*.
36
+ """
37
+ return cls.__dict__.get("__annotations__", {})
38
+
39
+
40
+ class _AnnotationExtractor:
41
+ """
42
+ Extract type annotations from a callable, returning None whenever there
43
+ is none.
44
+ """
45
+
46
+ __slots__ = ["sig"]
47
+
48
+ def __init__(self, callable):
49
+ try:
50
+ self.sig = inspect.signature(callable)
51
+ except (ValueError, TypeError): # inspect failed
52
+ self.sig = None
53
+
54
+ def get_first_param_type(self):
55
+ """
56
+ Return the type annotation of the first argument if it's not empty.
57
+ """
58
+ if not self.sig:
59
+ return None
60
+
61
+ params = list(self.sig.parameters.values())
62
+ if params and params[0].annotation is not inspect.Parameter.empty:
63
+ return params[0].annotation
64
+
65
+ return None
66
+
67
+ def get_return_type(self):
68
+ """
69
+ Return the return type if it's not empty.
70
+ """
71
+ if (
72
+ self.sig
73
+ and self.sig.return_annotation is not inspect.Signature.empty
74
+ ):
75
+ return self.sig.return_annotation
76
+
77
+ return None
78
+
79
+
80
+ # Thread-local global to track attrs instances which are already being repr'd.
81
+ # This is needed because there is no other (thread-safe) way to pass info
82
+ # about the instances that are already being repr'd through the call stack
83
+ # in order to ensure we don't perform infinite recursion.
84
+ #
85
+ # For instance, if an instance contains a dict which contains that instance,
86
+ # we need to know that we're already repr'ing the outside instance from within
87
+ # the dict's repr() call.
88
+ #
89
+ # This lives here rather than in _make.py so that the functions in _make.py
90
+ # don't have a direct reference to the thread-local in their globals dict.
91
+ # If they have such a reference, it breaks cloudpickle.
92
+ repr_context = threading.local()
93
+
94
+
95
+ def get_generic_base(cl):
96
+ """If this is a generic class (A[str]), return the generic base for it."""
97
+ if cl.__class__ is _GenericAlias:
98
+ return cl.__origin__
99
+ return None
.venv/lib/python3.10/site-packages/attr/_config.py ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # SPDX-License-Identifier: MIT
2
+
3
+ __all__ = ["get_run_validators", "set_run_validators"]
4
+
5
+ _run_validators = True
6
+
7
+
8
+ def set_run_validators(run):
9
+ """
10
+ Set whether or not validators are run. By default, they are run.
11
+
12
+ .. deprecated:: 21.3.0 It will not be removed, but it also will not be
13
+ moved to new ``attrs`` namespace. Use `attrs.validators.set_disabled()`
14
+ instead.
15
+ """
16
+ if not isinstance(run, bool):
17
+ msg = "'run' must be bool."
18
+ raise TypeError(msg)
19
+ global _run_validators
20
+ _run_validators = run
21
+
22
+
23
+ def get_run_validators():
24
+ """
25
+ Return whether or not validators are run.
26
+
27
+ .. deprecated:: 21.3.0 It will not be removed, but it also will not be
28
+ moved to new ``attrs`` namespace. Use `attrs.validators.get_disabled()`
29
+ instead.
30
+ """
31
+ return _run_validators
.venv/lib/python3.10/site-packages/attr/_funcs.py ADDED
@@ -0,0 +1,497 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # SPDX-License-Identifier: MIT
2
+
3
+
4
+ import copy
5
+
6
+ from ._compat import get_generic_base
7
+ from ._make import _OBJ_SETATTR, NOTHING, fields
8
+ from .exceptions import AttrsAttributeNotFoundError
9
+
10
+
11
+ _ATOMIC_TYPES = frozenset(
12
+ {
13
+ type(None),
14
+ bool,
15
+ int,
16
+ float,
17
+ str,
18
+ complex,
19
+ bytes,
20
+ type(...),
21
+ type,
22
+ range,
23
+ property,
24
+ }
25
+ )
26
+
27
+
28
+ def asdict(
29
+ inst,
30
+ recurse=True,
31
+ filter=None,
32
+ dict_factory=dict,
33
+ retain_collection_types=False,
34
+ value_serializer=None,
35
+ ):
36
+ """
37
+ Return the *attrs* attribute values of *inst* as a dict.
38
+
39
+ Optionally recurse into other *attrs*-decorated classes.
40
+
41
+ Args:
42
+ inst: Instance of an *attrs*-decorated class.
43
+
44
+ recurse (bool): Recurse into classes that are also *attrs*-decorated.
45
+
46
+ filter (~typing.Callable):
47
+ A callable whose return code determines whether an attribute or
48
+ element is included (`True`) or dropped (`False`). Is called with
49
+ the `attrs.Attribute` as the first argument and the value as the
50
+ second argument.
51
+
52
+ dict_factory (~typing.Callable):
53
+ A callable to produce dictionaries from. For example, to produce
54
+ ordered dictionaries instead of normal Python dictionaries, pass in
55
+ ``collections.OrderedDict``.
56
+
57
+ retain_collection_types (bool):
58
+ Do not convert to `list` when encountering an attribute whose type
59
+ is `tuple` or `set`. Only meaningful if *recurse* is `True`.
60
+
61
+ value_serializer (typing.Callable | None):
62
+ A hook that is called for every attribute or dict key/value. It
63
+ receives the current instance, field and value and must return the
64
+ (updated) value. The hook is run *after* the optional *filter* has
65
+ been applied.
66
+
67
+ Returns:
68
+ Return type of *dict_factory*.
69
+
70
+ Raises:
71
+ attrs.exceptions.NotAnAttrsClassError:
72
+ If *cls* is not an *attrs* class.
73
+
74
+ .. versionadded:: 16.0.0 *dict_factory*
75
+ .. versionadded:: 16.1.0 *retain_collection_types*
76
+ .. versionadded:: 20.3.0 *value_serializer*
77
+ .. versionadded:: 21.3.0
78
+ If a dict has a collection for a key, it is serialized as a tuple.
79
+ """
80
+ attrs = fields(inst.__class__)
81
+ rv = dict_factory()
82
+ for a in attrs:
83
+ v = getattr(inst, a.name)
84
+ if filter is not None and not filter(a, v):
85
+ continue
86
+
87
+ if value_serializer is not None:
88
+ v = value_serializer(inst, a, v)
89
+
90
+ if recurse is True:
91
+ value_type = type(v)
92
+ if value_type in _ATOMIC_TYPES:
93
+ rv[a.name] = v
94
+ elif has(value_type):
95
+ rv[a.name] = asdict(
96
+ v,
97
+ recurse=True,
98
+ filter=filter,
99
+ dict_factory=dict_factory,
100
+ retain_collection_types=retain_collection_types,
101
+ value_serializer=value_serializer,
102
+ )
103
+ elif issubclass(value_type, (tuple, list, set, frozenset)):
104
+ cf = value_type if retain_collection_types is True else list
105
+ items = [
106
+ _asdict_anything(
107
+ i,
108
+ is_key=False,
109
+ filter=filter,
110
+ dict_factory=dict_factory,
111
+ retain_collection_types=retain_collection_types,
112
+ value_serializer=value_serializer,
113
+ )
114
+ for i in v
115
+ ]
116
+ try:
117
+ rv[a.name] = cf(items)
118
+ except TypeError:
119
+ if not issubclass(cf, tuple):
120
+ raise
121
+ # Workaround for TypeError: cf.__new__() missing 1 required
122
+ # positional argument (which appears, for a namedturle)
123
+ rv[a.name] = cf(*items)
124
+ elif issubclass(value_type, dict):
125
+ df = dict_factory
126
+ rv[a.name] = df(
127
+ (
128
+ _asdict_anything(
129
+ kk,
130
+ is_key=True,
131
+ filter=filter,
132
+ dict_factory=df,
133
+ retain_collection_types=retain_collection_types,
134
+ value_serializer=value_serializer,
135
+ ),
136
+ _asdict_anything(
137
+ vv,
138
+ is_key=False,
139
+ filter=filter,
140
+ dict_factory=df,
141
+ retain_collection_types=retain_collection_types,
142
+ value_serializer=value_serializer,
143
+ ),
144
+ )
145
+ for kk, vv in v.items()
146
+ )
147
+ else:
148
+ rv[a.name] = v
149
+ else:
150
+ rv[a.name] = v
151
+ return rv
152
+
153
+
154
+ def _asdict_anything(
155
+ val,
156
+ is_key,
157
+ filter,
158
+ dict_factory,
159
+ retain_collection_types,
160
+ value_serializer,
161
+ ):
162
+ """
163
+ ``asdict`` only works on attrs instances, this works on anything.
164
+ """
165
+ val_type = type(val)
166
+ if val_type in _ATOMIC_TYPES:
167
+ rv = val
168
+ if value_serializer is not None:
169
+ rv = value_serializer(None, None, rv)
170
+ elif getattr(val_type, "__attrs_attrs__", None) is not None:
171
+ # Attrs class.
172
+ rv = asdict(
173
+ val,
174
+ recurse=True,
175
+ filter=filter,
176
+ dict_factory=dict_factory,
177
+ retain_collection_types=retain_collection_types,
178
+ value_serializer=value_serializer,
179
+ )
180
+ elif issubclass(val_type, (tuple, list, set, frozenset)):
181
+ if retain_collection_types is True:
182
+ cf = val.__class__
183
+ elif is_key:
184
+ cf = tuple
185
+ else:
186
+ cf = list
187
+
188
+ rv = cf(
189
+ [
190
+ _asdict_anything(
191
+ i,
192
+ is_key=False,
193
+ filter=filter,
194
+ dict_factory=dict_factory,
195
+ retain_collection_types=retain_collection_types,
196
+ value_serializer=value_serializer,
197
+ )
198
+ for i in val
199
+ ]
200
+ )
201
+ elif issubclass(val_type, dict):
202
+ df = dict_factory
203
+ rv = df(
204
+ (
205
+ _asdict_anything(
206
+ kk,
207
+ is_key=True,
208
+ filter=filter,
209
+ dict_factory=df,
210
+ retain_collection_types=retain_collection_types,
211
+ value_serializer=value_serializer,
212
+ ),
213
+ _asdict_anything(
214
+ vv,
215
+ is_key=False,
216
+ filter=filter,
217
+ dict_factory=df,
218
+ retain_collection_types=retain_collection_types,
219
+ value_serializer=value_serializer,
220
+ ),
221
+ )
222
+ for kk, vv in val.items()
223
+ )
224
+ else:
225
+ rv = val
226
+ if value_serializer is not None:
227
+ rv = value_serializer(None, None, rv)
228
+
229
+ return rv
230
+
231
+
232
+ def astuple(
233
+ inst,
234
+ recurse=True,
235
+ filter=None,
236
+ tuple_factory=tuple,
237
+ retain_collection_types=False,
238
+ ):
239
+ """
240
+ Return the *attrs* attribute values of *inst* as a tuple.
241
+
242
+ Optionally recurse into other *attrs*-decorated classes.
243
+
244
+ Args:
245
+ inst: Instance of an *attrs*-decorated class.
246
+
247
+ recurse (bool):
248
+ Recurse into classes that are also *attrs*-decorated.
249
+
250
+ filter (~typing.Callable):
251
+ A callable whose return code determines whether an attribute or
252
+ element is included (`True`) or dropped (`False`). Is called with
253
+ the `attrs.Attribute` as the first argument and the value as the
254
+ second argument.
255
+
256
+ tuple_factory (~typing.Callable):
257
+ A callable to produce tuples from. For example, to produce lists
258
+ instead of tuples.
259
+
260
+ retain_collection_types (bool):
261
+ Do not convert to `list` or `dict` when encountering an attribute
262
+ which type is `tuple`, `dict` or `set`. Only meaningful if
263
+ *recurse* is `True`.
264
+
265
+ Returns:
266
+ Return type of *tuple_factory*
267
+
268
+ Raises:
269
+ attrs.exceptions.NotAnAttrsClassError:
270
+ If *cls* is not an *attrs* class.
271
+
272
+ .. versionadded:: 16.2.0
273
+ """
274
+ attrs = fields(inst.__class__)
275
+ rv = []
276
+ retain = retain_collection_types # Very long. :/
277
+ for a in attrs:
278
+ v = getattr(inst, a.name)
279
+ if filter is not None and not filter(a, v):
280
+ continue
281
+ value_type = type(v)
282
+ if recurse is True:
283
+ if value_type in _ATOMIC_TYPES:
284
+ rv.append(v)
285
+ elif has(value_type):
286
+ rv.append(
287
+ astuple(
288
+ v,
289
+ recurse=True,
290
+ filter=filter,
291
+ tuple_factory=tuple_factory,
292
+ retain_collection_types=retain,
293
+ )
294
+ )
295
+ elif issubclass(value_type, (tuple, list, set, frozenset)):
296
+ cf = v.__class__ if retain is True else list
297
+ items = [
298
+ (
299
+ astuple(
300
+ j,
301
+ recurse=True,
302
+ filter=filter,
303
+ tuple_factory=tuple_factory,
304
+ retain_collection_types=retain,
305
+ )
306
+ if has(j.__class__)
307
+ else j
308
+ )
309
+ for j in v
310
+ ]
311
+ try:
312
+ rv.append(cf(items))
313
+ except TypeError:
314
+ if not issubclass(cf, tuple):
315
+ raise
316
+ # Workaround for TypeError: cf.__new__() missing 1 required
317
+ # positional argument (which appears, for a namedturle)
318
+ rv.append(cf(*items))
319
+ elif issubclass(value_type, dict):
320
+ df = value_type if retain is True else dict
321
+ rv.append(
322
+ df(
323
+ (
324
+ (
325
+ astuple(
326
+ kk,
327
+ tuple_factory=tuple_factory,
328
+ retain_collection_types=retain,
329
+ )
330
+ if has(kk.__class__)
331
+ else kk
332
+ ),
333
+ (
334
+ astuple(
335
+ vv,
336
+ tuple_factory=tuple_factory,
337
+ retain_collection_types=retain,
338
+ )
339
+ if has(vv.__class__)
340
+ else vv
341
+ ),
342
+ )
343
+ for kk, vv in v.items()
344
+ )
345
+ )
346
+ else:
347
+ rv.append(v)
348
+ else:
349
+ rv.append(v)
350
+
351
+ return rv if tuple_factory is list else tuple_factory(rv)
352
+
353
+
354
+ def has(cls):
355
+ """
356
+ Check whether *cls* is a class with *attrs* attributes.
357
+
358
+ Args:
359
+ cls (type): Class to introspect.
360
+
361
+ Raises:
362
+ TypeError: If *cls* is not a class.
363
+
364
+ Returns:
365
+ bool:
366
+ """
367
+ attrs = getattr(cls, "__attrs_attrs__", None)
368
+ if attrs is not None:
369
+ return True
370
+
371
+ # No attrs, maybe it's a specialized generic (A[str])?
372
+ generic_base = get_generic_base(cls)
373
+ if generic_base is not None:
374
+ generic_attrs = getattr(generic_base, "__attrs_attrs__", None)
375
+ if generic_attrs is not None:
376
+ # Stick it on here for speed next time.
377
+ cls.__attrs_attrs__ = generic_attrs
378
+ return generic_attrs is not None
379
+ return False
380
+
381
+
382
+ def assoc(inst, **changes):
383
+ """
384
+ Copy *inst* and apply *changes*.
385
+
386
+ This is different from `evolve` that applies the changes to the arguments
387
+ that create the new instance.
388
+
389
+ `evolve`'s behavior is preferable, but there are `edge cases`_ where it
390
+ doesn't work. Therefore `assoc` is deprecated, but will not be removed.
391
+
392
+ .. _`edge cases`: https://github.com/python-attrs/attrs/issues/251
393
+
394
+ Args:
395
+ inst: Instance of a class with *attrs* attributes.
396
+
397
+ changes: Keyword changes in the new copy.
398
+
399
+ Returns:
400
+ A copy of inst with *changes* incorporated.
401
+
402
+ Raises:
403
+ attrs.exceptions.AttrsAttributeNotFoundError:
404
+ If *attr_name* couldn't be found on *cls*.
405
+
406
+ attrs.exceptions.NotAnAttrsClassError:
407
+ If *cls* is not an *attrs* class.
408
+
409
+ .. deprecated:: 17.1.0
410
+ Use `attrs.evolve` instead if you can. This function will not be
411
+ removed du to the slightly different approach compared to
412
+ `attrs.evolve`, though.
413
+ """
414
+ new = copy.copy(inst)
415
+ attrs = fields(inst.__class__)
416
+ for k, v in changes.items():
417
+ a = getattr(attrs, k, NOTHING)
418
+ if a is NOTHING:
419
+ msg = f"{k} is not an attrs attribute on {new.__class__}."
420
+ raise AttrsAttributeNotFoundError(msg)
421
+ _OBJ_SETATTR(new, k, v)
422
+ return new
423
+
424
+
425
+ def resolve_types(
426
+ cls, globalns=None, localns=None, attribs=None, include_extras=True
427
+ ):
428
+ """
429
+ Resolve any strings and forward annotations in type annotations.
430
+
431
+ This is only required if you need concrete types in :class:`Attribute`'s
432
+ *type* field. In other words, you don't need to resolve your types if you
433
+ only use them for static type checking.
434
+
435
+ With no arguments, names will be looked up in the module in which the class
436
+ was created. If this is not what you want, for example, if the name only
437
+ exists inside a method, you may pass *globalns* or *localns* to specify
438
+ other dictionaries in which to look up these names. See the docs of
439
+ `typing.get_type_hints` for more details.
440
+
441
+ Args:
442
+ cls (type): Class to resolve.
443
+
444
+ globalns (dict | None): Dictionary containing global variables.
445
+
446
+ localns (dict | None): Dictionary containing local variables.
447
+
448
+ attribs (list | None):
449
+ List of attribs for the given class. This is necessary when calling
450
+ from inside a ``field_transformer`` since *cls* is not an *attrs*
451
+ class yet.
452
+
453
+ include_extras (bool):
454
+ Resolve more accurately, if possible. Pass ``include_extras`` to
455
+ ``typing.get_hints``, if supported by the typing module. On
456
+ supported Python versions (3.9+), this resolves the types more
457
+ accurately.
458
+
459
+ Raises:
460
+ TypeError: If *cls* is not a class.
461
+
462
+ attrs.exceptions.NotAnAttrsClassError:
463
+ If *cls* is not an *attrs* class and you didn't pass any attribs.
464
+
465
+ NameError: If types cannot be resolved because of missing variables.
466
+
467
+ Returns:
468
+ *cls* so you can use this function also as a class decorator. Please
469
+ note that you have to apply it **after** `attrs.define`. That means the
470
+ decorator has to come in the line **before** `attrs.define`.
471
+
472
+ .. versionadded:: 20.1.0
473
+ .. versionadded:: 21.1.0 *attribs*
474
+ .. versionadded:: 23.1.0 *include_extras*
475
+ """
476
+ # Since calling get_type_hints is expensive we cache whether we've
477
+ # done it already.
478
+ if getattr(cls, "__attrs_types_resolved__", None) != cls:
479
+ import typing
480
+
481
+ kwargs = {
482
+ "globalns": globalns,
483
+ "localns": localns,
484
+ "include_extras": include_extras,
485
+ }
486
+
487
+ hints = typing.get_type_hints(cls, **kwargs)
488
+ for field in fields(cls) if attribs is None else attribs:
489
+ if field.name in hints:
490
+ # Since fields have been frozen we must work around it.
491
+ _OBJ_SETATTR(field, "type", hints[field.name])
492
+ # We store the class we resolved so that subclasses know they haven't
493
+ # been resolved.
494
+ cls.__attrs_types_resolved__ = cls
495
+
496
+ # Return the class so you can use it as a decorator too.
497
+ return cls
.venv/lib/python3.10/site-packages/attr/_make.py ADDED
The diff for this file is too large to render. See raw diff
 
.venv/lib/python3.10/site-packages/attr/_next_gen.py ADDED
@@ -0,0 +1,674 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # SPDX-License-Identifier: MIT
2
+
3
+ """
4
+ These are keyword-only APIs that call `attr.s` and `attr.ib` with different
5
+ default values.
6
+ """
7
+
8
+ from functools import partial
9
+
10
+ from . import setters
11
+ from ._funcs import asdict as _asdict
12
+ from ._funcs import astuple as _astuple
13
+ from ._make import (
14
+ _DEFAULT_ON_SETATTR,
15
+ NOTHING,
16
+ _frozen_setattrs,
17
+ attrib,
18
+ attrs,
19
+ )
20
+ from .exceptions import NotAnAttrsClassError, UnannotatedAttributeError
21
+
22
+
23
+ def define(
24
+ maybe_cls=None,
25
+ *,
26
+ these=None,
27
+ repr=None,
28
+ unsafe_hash=None,
29
+ hash=None,
30
+ init=None,
31
+ slots=True,
32
+ frozen=False,
33
+ weakref_slot=True,
34
+ str=False,
35
+ auto_attribs=None,
36
+ kw_only=False,
37
+ cache_hash=False,
38
+ auto_exc=True,
39
+ eq=None,
40
+ order=False,
41
+ auto_detect=True,
42
+ getstate_setstate=None,
43
+ on_setattr=None,
44
+ field_transformer=None,
45
+ match_args=True,
46
+ force_kw_only=False,
47
+ ):
48
+ r"""
49
+ A class decorator that adds :term:`dunder methods` according to
50
+ :term:`fields <field>` specified using :doc:`type annotations <types>`,
51
+ `field()` calls, or the *these* argument.
52
+
53
+ Since *attrs* patches or replaces an existing class, you cannot use
54
+ `object.__init_subclass__` with *attrs* classes, because it runs too early.
55
+ As a replacement, you can define ``__attrs_init_subclass__`` on your class.
56
+ It will be called by *attrs* classes that subclass it after they're
57
+ created. See also :ref:`init-subclass`.
58
+
59
+ Args:
60
+ slots (bool):
61
+ Create a :term:`slotted class <slotted classes>` that's more
62
+ memory-efficient. Slotted classes are generally superior to the
63
+ default dict classes, but have some gotchas you should know about,
64
+ so we encourage you to read the :term:`glossary entry <slotted
65
+ classes>`.
66
+
67
+ auto_detect (bool):
68
+ Instead of setting the *init*, *repr*, *eq*, and *hash* arguments
69
+ explicitly, assume they are set to True **unless any** of the
70
+ involved methods for one of the arguments is implemented in the
71
+ *current* class (meaning, it is *not* inherited from some base
72
+ class).
73
+
74
+ So, for example by implementing ``__eq__`` on a class yourself,
75
+ *attrs* will deduce ``eq=False`` and will create *neither*
76
+ ``__eq__`` *nor* ``__ne__`` (but Python classes come with a
77
+ sensible ``__ne__`` by default, so it *should* be enough to only
78
+ implement ``__eq__`` in most cases).
79
+
80
+ Passing :data:`True` or :data:`False` to *init*, *repr*, *eq*, or *hash*
81
+ overrides whatever *auto_detect* would determine.
82
+
83
+ auto_exc (bool):
84
+ If the class subclasses `BaseException` (which implicitly includes
85
+ any subclass of any exception), the following happens to behave
86
+ like a well-behaved Python exception class:
87
+
88
+ - the values for *eq*, *order*, and *hash* are ignored and the
89
+ instances compare and hash by the instance's ids [#]_ ,
90
+ - all attributes that are either passed into ``__init__`` or have a
91
+ default value are additionally available as a tuple in the
92
+ ``args`` attribute,
93
+ - the value of *str* is ignored leaving ``__str__`` to base
94
+ classes.
95
+
96
+ .. [#]
97
+ Note that *attrs* will *not* remove existing implementations of
98
+ ``__hash__`` or the equality methods. It just won't add own
99
+ ones.
100
+
101
+ on_setattr (~typing.Callable | list[~typing.Callable] | None | ~typing.Literal[attrs.setters.NO_OP]):
102
+ A callable that is run whenever the user attempts to set an
103
+ attribute (either by assignment like ``i.x = 42`` or by using
104
+ `setattr` like ``setattr(i, "x", 42)``). It receives the same
105
+ arguments as validators: the instance, the attribute that is being
106
+ modified, and the new value.
107
+
108
+ If no exception is raised, the attribute is set to the return value
109
+ of the callable.
110
+
111
+ If a list of callables is passed, they're automatically wrapped in
112
+ an `attrs.setters.pipe`.
113
+
114
+ If left None, the default behavior is to run converters and
115
+ validators whenever an attribute is set.
116
+
117
+ init (bool):
118
+ Create a ``__init__`` method that initializes the *attrs*
119
+ attributes. Leading underscores are stripped for the argument name,
120
+ unless an alias is set on the attribute.
121
+
122
+ .. seealso::
123
+ `init` shows advanced ways to customize the generated
124
+ ``__init__`` method, including executing code before and after.
125
+
126
+ repr(bool):
127
+ Create a ``__repr__`` method with a human readable representation
128
+ of *attrs* attributes.
129
+
130
+ str (bool):
131
+ Create a ``__str__`` method that is identical to ``__repr__``. This
132
+ is usually not necessary except for `Exception`\ s.
133
+
134
+ eq (bool | None):
135
+ If True or None (default), add ``__eq__`` and ``__ne__`` methods
136
+ that check two instances for equality.
137
+
138
+ .. seealso::
139
+ `comparison` describes how to customize the comparison behavior
140
+ going as far comparing NumPy arrays.
141
+
142
+ order (bool | None):
143
+ If True, add ``__lt__``, ``__le__``, ``__gt__``, and ``__ge__``
144
+ methods that behave like *eq* above and allow instances to be
145
+ ordered.
146
+
147
+ They compare the instances as if they were tuples of their *attrs*
148
+ attributes if and only if the types of both classes are
149
+ *identical*.
150
+
151
+ If `None` mirror value of *eq*.
152
+
153
+ .. seealso:: `comparison`
154
+
155
+ unsafe_hash (bool | None):
156
+ If None (default), the ``__hash__`` method is generated according
157
+ how *eq* and *frozen* are set.
158
+
159
+ 1. If *both* are True, *attrs* will generate a ``__hash__`` for
160
+ you.
161
+ 2. If *eq* is True and *frozen* is False, ``__hash__`` will be set
162
+ to None, marking it unhashable (which it is).
163
+ 3. If *eq* is False, ``__hash__`` will be left untouched meaning
164
+ the ``__hash__`` method of the base class will be used. If the
165
+ base class is `object`, this means it will fall back to id-based
166
+ hashing.
167
+
168
+ Although not recommended, you can decide for yourself and force
169
+ *attrs* to create one (for example, if the class is immutable even
170
+ though you didn't freeze it programmatically) by passing True or
171
+ not. Both of these cases are rather special and should be used
172
+ carefully.
173
+
174
+ .. seealso::
175
+
176
+ - Our documentation on `hashing`,
177
+ - Python's documentation on `object.__hash__`,
178
+ - and the `GitHub issue that led to the default \ behavior
179
+ <https://github.com/python-attrs/attrs/issues/136>`_ for more
180
+ details.
181
+
182
+ hash (bool | None):
183
+ Deprecated alias for *unsafe_hash*. *unsafe_hash* takes precedence.
184
+
185
+ cache_hash (bool):
186
+ Ensure that the object's hash code is computed only once and stored
187
+ on the object. If this is set to True, hashing must be either
188
+ explicitly or implicitly enabled for this class. If the hash code
189
+ is cached, avoid any reassignments of fields involved in hash code
190
+ computation or mutations of the objects those fields point to after
191
+ object creation. If such changes occur, the behavior of the
192
+ object's hash code is undefined.
193
+
194
+ frozen (bool):
195
+ Make instances immutable after initialization. If someone attempts
196
+ to modify a frozen instance, `attrs.exceptions.FrozenInstanceError`
197
+ is raised.
198
+
199
+ .. note::
200
+
201
+ 1. This is achieved by installing a custom ``__setattr__``
202
+ method on your class, so you can't implement your own.
203
+
204
+ 2. True immutability is impossible in Python.
205
+
206
+ 3. This *does* have a minor a runtime performance `impact
207
+ <how-frozen>` when initializing new instances. In other
208
+ words: ``__init__`` is slightly slower with ``frozen=True``.
209
+
210
+ 4. If a class is frozen, you cannot modify ``self`` in
211
+ ``__attrs_post_init__`` or a self-written ``__init__``. You
212
+ can circumvent that limitation by using
213
+ ``object.__setattr__(self, "attribute_name", value)``.
214
+
215
+ 5. Subclasses of a frozen class are frozen too.
216
+
217
+ kw_only (bool):
218
+ Make attributes keyword-only in the generated ``__init__`` (if
219
+ *init* is False, this parameter is ignored). Attributes that
220
+ explicitly set ``kw_only=False`` are not affected; base class
221
+ attributes are also not affected.
222
+
223
+ Also see *force_kw_only*.
224
+
225
+ weakref_slot (bool):
226
+ Make instances weak-referenceable. This has no effect unless
227
+ *slots* is True.
228
+
229
+ field_transformer (~typing.Callable | None):
230
+ A function that is called with the original class object and all
231
+ fields right before *attrs* finalizes the class. You can use this,
232
+ for example, to automatically add converters or validators to
233
+ fields based on their types.
234
+
235
+ .. seealso:: `transform-fields`
236
+
237
+ match_args (bool):
238
+ If True (default), set ``__match_args__`` on the class to support
239
+ :pep:`634` (*Structural Pattern Matching*). It is a tuple of all
240
+ non-keyword-only ``__init__`` parameter names on Python 3.10 and
241
+ later. Ignored on older Python versions.
242
+
243
+ collect_by_mro (bool):
244
+ If True, *attrs* collects attributes from base classes correctly
245
+ according to the `method resolution order
246
+ <https://docs.python.org/3/howto/mro.html>`_. If False, *attrs*
247
+ will mimic the (wrong) behavior of `dataclasses` and :pep:`681`.
248
+
249
+ See also `issue #428
250
+ <https://github.com/python-attrs/attrs/issues/428>`_.
251
+
252
+ force_kw_only (bool):
253
+ A back-compat flag for restoring pre-25.4.0 behavior. If True and
254
+ ``kw_only=True``, all attributes are made keyword-only, including
255
+ base class attributes, and those set to ``kw_only=False`` at the
256
+ attribute level. Defaults to False.
257
+
258
+ See also `issue #980
259
+ <https://github.com/python-attrs/attrs/issues/980>`_.
260
+
261
+ getstate_setstate (bool | None):
262
+ .. note::
263
+
264
+ This is usually only interesting for slotted classes and you
265
+ should probably just set *auto_detect* to True.
266
+
267
+ If True, ``__getstate__`` and ``__setstate__`` are generated and
268
+ attached to the class. This is necessary for slotted classes to be
269
+ pickleable. If left None, it's True by default for slotted classes
270
+ and False for dict classes.
271
+
272
+ If *auto_detect* is True, and *getstate_setstate* is left None, and
273
+ **either** ``__getstate__`` or ``__setstate__`` is detected
274
+ directly on the class (meaning: not inherited), it is set to False
275
+ (this is usually what you want).
276
+
277
+ auto_attribs (bool | None):
278
+ If True, look at type annotations to determine which attributes to
279
+ use, like `dataclasses`. If False, it will only look for explicit
280
+ :func:`field` class attributes, like classic *attrs*.
281
+
282
+ If left None, it will guess:
283
+
284
+ 1. If any attributes are annotated and no unannotated
285
+ `attrs.field`\ s are found, it assumes *auto_attribs=True*.
286
+ 2. Otherwise it assumes *auto_attribs=False* and tries to collect
287
+ `attrs.field`\ s.
288
+
289
+ If *attrs* decides to look at type annotations, **all** fields
290
+ **must** be annotated. If *attrs* encounters a field that is set to
291
+ a :func:`field` / `attr.ib` but lacks a type annotation, an
292
+ `attrs.exceptions.UnannotatedAttributeError` is raised. Use
293
+ ``field_name: typing.Any = field(...)`` if you don't want to set a
294
+ type.
295
+
296
+ .. warning::
297
+
298
+ For features that use the attribute name to create decorators
299
+ (for example, :ref:`validators <validators>`), you still *must*
300
+ assign :func:`field` / `attr.ib` to them. Otherwise Python will
301
+ either not find the name or try to use the default value to
302
+ call, for example, ``validator`` on it.
303
+
304
+ Attributes annotated as `typing.ClassVar`, and attributes that are
305
+ neither annotated nor set to an `field()` are **ignored**.
306
+
307
+ these (dict[str, object]):
308
+ A dictionary of name to the (private) return value of `field()`
309
+ mappings. This is useful to avoid the definition of your attributes
310
+ within the class body because you can't (for example, if you want
311
+ to add ``__repr__`` methods to Django models) or don't want to.
312
+
313
+ If *these* is not `None`, *attrs* will *not* search the class body
314
+ for attributes and will *not* remove any attributes from it.
315
+
316
+ The order is deduced from the order of the attributes inside
317
+ *these*.
318
+
319
+ Arguably, this is a rather obscure feature.
320
+
321
+ .. versionadded:: 20.1.0
322
+ .. versionchanged:: 21.3.0 Converters are also run ``on_setattr``.
323
+ .. versionadded:: 22.2.0
324
+ *unsafe_hash* as an alias for *hash* (for :pep:`681` compliance).
325
+ .. versionchanged:: 24.1.0
326
+ Instances are not compared as tuples of attributes anymore, but using a
327
+ big ``and`` condition. This is faster and has more correct behavior for
328
+ uncomparable values like `math.nan`.
329
+ .. versionadded:: 24.1.0
330
+ If a class has an *inherited* classmethod called
331
+ ``__attrs_init_subclass__``, it is executed after the class is created.
332
+ .. deprecated:: 24.1.0 *hash* is deprecated in favor of *unsafe_hash*.
333
+ .. versionadded:: 24.3.0
334
+ Unless already present, a ``__replace__`` method is automatically
335
+ created for `copy.replace` (Python 3.13+ only).
336
+ .. versionchanged:: 25.4.0
337
+ *kw_only* now only applies to attributes defined in the current class,
338
+ and respects attribute-level ``kw_only=False`` settings.
339
+ .. versionadded:: 25.4.0
340
+ Added *force_kw_only* to go back to the previous *kw_only* behavior.
341
+
342
+ .. note::
343
+
344
+ The main differences to the classic `attr.s` are:
345
+
346
+ - Automatically detect whether or not *auto_attribs* should be `True`
347
+ (c.f. *auto_attribs* parameter).
348
+ - Converters and validators run when attributes are set by default --
349
+ if *frozen* is `False`.
350
+ - *slots=True*
351
+
352
+ Usually, this has only upsides and few visible effects in everyday
353
+ programming. But it *can* lead to some surprising behaviors, so
354
+ please make sure to read :term:`slotted classes`.
355
+
356
+ - *auto_exc=True*
357
+ - *auto_detect=True*
358
+ - *order=False*
359
+ - *force_kw_only=False*
360
+ - Some options that were only relevant on Python 2 or were kept around
361
+ for backwards-compatibility have been removed.
362
+
363
+ """
364
+
365
+ def do_it(cls, auto_attribs):
366
+ return attrs(
367
+ maybe_cls=cls,
368
+ these=these,
369
+ repr=repr,
370
+ hash=hash,
371
+ unsafe_hash=unsafe_hash,
372
+ init=init,
373
+ slots=slots,
374
+ frozen=frozen,
375
+ weakref_slot=weakref_slot,
376
+ str=str,
377
+ auto_attribs=auto_attribs,
378
+ kw_only=kw_only,
379
+ cache_hash=cache_hash,
380
+ auto_exc=auto_exc,
381
+ eq=eq,
382
+ order=order,
383
+ auto_detect=auto_detect,
384
+ collect_by_mro=True,
385
+ getstate_setstate=getstate_setstate,
386
+ on_setattr=on_setattr,
387
+ field_transformer=field_transformer,
388
+ match_args=match_args,
389
+ force_kw_only=force_kw_only,
390
+ )
391
+
392
+ def wrap(cls):
393
+ """
394
+ Making this a wrapper ensures this code runs during class creation.
395
+
396
+ We also ensure that frozen-ness of classes is inherited.
397
+ """
398
+ nonlocal frozen, on_setattr
399
+
400
+ had_on_setattr = on_setattr not in (None, setters.NO_OP)
401
+
402
+ # By default, mutable classes convert & validate on setattr.
403
+ if frozen is False and on_setattr is None:
404
+ on_setattr = _DEFAULT_ON_SETATTR
405
+
406
+ # However, if we subclass a frozen class, we inherit the immutability
407
+ # and disable on_setattr.
408
+ for base_cls in cls.__bases__:
409
+ if base_cls.__setattr__ is _frozen_setattrs:
410
+ if had_on_setattr:
411
+ msg = "Frozen classes can't use on_setattr (frozen-ness was inherited)."
412
+ raise ValueError(msg)
413
+
414
+ on_setattr = setters.NO_OP
415
+ break
416
+
417
+ if auto_attribs is not None:
418
+ return do_it(cls, auto_attribs)
419
+
420
+ try:
421
+ return do_it(cls, True)
422
+ except UnannotatedAttributeError:
423
+ return do_it(cls, False)
424
+
425
+ # maybe_cls's type depends on the usage of the decorator. It's a class
426
+ # if it's used as `@attrs` but `None` if used as `@attrs()`.
427
+ if maybe_cls is None:
428
+ return wrap
429
+
430
+ return wrap(maybe_cls)
431
+
432
+
433
+ mutable = define
434
+ frozen = partial(define, frozen=True, on_setattr=None)
435
+
436
+
437
+ def field(
438
+ *,
439
+ default=NOTHING,
440
+ validator=None,
441
+ repr=True,
442
+ hash=None,
443
+ init=True,
444
+ metadata=None,
445
+ type=None,
446
+ converter=None,
447
+ factory=None,
448
+ kw_only=None,
449
+ eq=None,
450
+ order=None,
451
+ on_setattr=None,
452
+ alias=None,
453
+ ):
454
+ """
455
+ Create a new :term:`field` / :term:`attribute` on a class.
456
+
457
+ .. warning::
458
+
459
+ Does **nothing** unless the class is also decorated with
460
+ `attrs.define` (or similar)!
461
+
462
+ Args:
463
+ default:
464
+ A value that is used if an *attrs*-generated ``__init__`` is used
465
+ and no value is passed while instantiating or the attribute is
466
+ excluded using ``init=False``.
467
+
468
+ If the value is an instance of `attrs.Factory`, its callable will
469
+ be used to construct a new value (useful for mutable data types
470
+ like lists or dicts).
471
+
472
+ If a default is not set (or set manually to `attrs.NOTHING`), a
473
+ value *must* be supplied when instantiating; otherwise a
474
+ `TypeError` will be raised.
475
+
476
+ .. seealso:: `defaults`
477
+
478
+ factory (~typing.Callable):
479
+ Syntactic sugar for ``default=attr.Factory(factory)``.
480
+
481
+ validator (~typing.Callable | list[~typing.Callable]):
482
+ Callable that is called by *attrs*-generated ``__init__`` methods
483
+ after the instance has been initialized. They receive the
484
+ initialized instance, the :func:`~attrs.Attribute`, and the passed
485
+ value.
486
+
487
+ The return value is *not* inspected so the validator has to throw
488
+ an exception itself.
489
+
490
+ If a `list` is passed, its items are treated as validators and must
491
+ all pass.
492
+
493
+ Validators can be globally disabled and re-enabled using
494
+ `attrs.validators.get_disabled` / `attrs.validators.set_disabled`.
495
+
496
+ The validator can also be set using decorator notation as shown
497
+ below.
498
+
499
+ .. seealso:: :ref:`validators`
500
+
501
+ repr (bool | ~typing.Callable):
502
+ Include this attribute in the generated ``__repr__`` method. If
503
+ True, include the attribute; if False, omit it. By default, the
504
+ built-in ``repr()`` function is used. To override how the attribute
505
+ value is formatted, pass a ``callable`` that takes a single value
506
+ and returns a string. Note that the resulting string is used as-is,
507
+ which means it will be used directly *instead* of calling
508
+ ``repr()`` (the default).
509
+
510
+ eq (bool | ~typing.Callable):
511
+ If True (default), include this attribute in the generated
512
+ ``__eq__`` and ``__ne__`` methods that check two instances for
513
+ equality. To override how the attribute value is compared, pass a
514
+ callable that takes a single value and returns the value to be
515
+ compared.
516
+
517
+ .. seealso:: `comparison`
518
+
519
+ order (bool | ~typing.Callable):
520
+ If True (default), include this attributes in the generated
521
+ ``__lt__``, ``__le__``, ``__gt__`` and ``__ge__`` methods. To
522
+ override how the attribute value is ordered, pass a callable that
523
+ takes a single value and returns the value to be ordered.
524
+
525
+ .. seealso:: `comparison`
526
+
527
+ hash (bool | None):
528
+ Include this attribute in the generated ``__hash__`` method. If
529
+ None (default), mirror *eq*'s value. This is the correct behavior
530
+ according the Python spec. Setting this value to anything else
531
+ than None is *discouraged*.
532
+
533
+ .. seealso:: `hashing`
534
+
535
+ init (bool):
536
+ Include this attribute in the generated ``__init__`` method.
537
+
538
+ It is possible to set this to False and set a default value. In
539
+ that case this attributed is unconditionally initialized with the
540
+ specified default value or factory.
541
+
542
+ .. seealso:: `init`
543
+
544
+ converter (typing.Callable | Converter):
545
+ A callable that is called by *attrs*-generated ``__init__`` methods
546
+ to convert attribute's value to the desired format.
547
+
548
+ If a vanilla callable is passed, it is given the passed-in value as
549
+ the only positional argument. It is possible to receive additional
550
+ arguments by wrapping the callable in a `Converter`.
551
+
552
+ Either way, the returned value will be used as the new value of the
553
+ attribute. The value is converted before being passed to the
554
+ validator, if any.
555
+
556
+ .. seealso:: :ref:`converters`
557
+
558
+ metadata (dict | None):
559
+ An arbitrary mapping, to be used by third-party code.
560
+
561
+ .. seealso:: `extending-metadata`.
562
+
563
+ type (type):
564
+ The type of the attribute. Nowadays, the preferred method to
565
+ specify the type is using a variable annotation (see :pep:`526`).
566
+ This argument is provided for backwards-compatibility and for usage
567
+ with `make_class`. Regardless of the approach used, the type will
568
+ be stored on ``Attribute.type``.
569
+
570
+ Please note that *attrs* doesn't do anything with this metadata by
571
+ itself. You can use it as part of your own code or for `static type
572
+ checking <types>`.
573
+
574
+ kw_only (bool | None):
575
+ Make this attribute keyword-only in the generated ``__init__`` (if
576
+ *init* is False, this parameter is ignored). If None (default),
577
+ mirror the setting from `attrs.define`.
578
+
579
+ on_setattr (~typing.Callable | list[~typing.Callable] | None | ~typing.Literal[attrs.setters.NO_OP]):
580
+ Allows to overwrite the *on_setattr* setting from `attr.s`. If left
581
+ None, the *on_setattr* value from `attr.s` is used. Set to
582
+ `attrs.setters.NO_OP` to run **no** `setattr` hooks for this
583
+ attribute -- regardless of the setting in `define()`.
584
+
585
+ alias (str | None):
586
+ Override this attribute's parameter name in the generated
587
+ ``__init__`` method. If left None, default to ``name`` stripped
588
+ of leading underscores. See `private-attributes`.
589
+
590
+ .. versionadded:: 20.1.0
591
+ .. versionchanged:: 21.1.0
592
+ *eq*, *order*, and *cmp* also accept a custom callable
593
+ .. versionadded:: 22.2.0 *alias*
594
+ .. versionadded:: 23.1.0
595
+ The *type* parameter has been re-added; mostly for `attrs.make_class`.
596
+ Please note that type checkers ignore this metadata.
597
+ .. versionchanged:: 25.4.0
598
+ *kw_only* can now be None, and its default is also changed from False to
599
+ None.
600
+
601
+ .. seealso::
602
+
603
+ `attr.ib`
604
+ """
605
+ return attrib(
606
+ default=default,
607
+ validator=validator,
608
+ repr=repr,
609
+ hash=hash,
610
+ init=init,
611
+ metadata=metadata,
612
+ type=type,
613
+ converter=converter,
614
+ factory=factory,
615
+ kw_only=kw_only,
616
+ eq=eq,
617
+ order=order,
618
+ on_setattr=on_setattr,
619
+ alias=alias,
620
+ )
621
+
622
+
623
+ def asdict(inst, *, recurse=True, filter=None, value_serializer=None):
624
+ """
625
+ Same as `attr.asdict`, except that collections types are always retained
626
+ and dict is always used as *dict_factory*.
627
+
628
+ .. versionadded:: 21.3.0
629
+ """
630
+ return _asdict(
631
+ inst=inst,
632
+ recurse=recurse,
633
+ filter=filter,
634
+ value_serializer=value_serializer,
635
+ retain_collection_types=True,
636
+ )
637
+
638
+
639
+ def astuple(inst, *, recurse=True, filter=None):
640
+ """
641
+ Same as `attr.astuple`, except that collections types are always retained
642
+ and `tuple` is always used as the *tuple_factory*.
643
+
644
+ .. versionadded:: 21.3.0
645
+ """
646
+ return _astuple(
647
+ inst=inst, recurse=recurse, filter=filter, retain_collection_types=True
648
+ )
649
+
650
+
651
+ def inspect(cls):
652
+ """
653
+ Inspect the class and return its effective build parameters.
654
+
655
+ Warning:
656
+ This feature is currently **experimental** and is not covered by our
657
+ strict backwards-compatibility guarantees.
658
+
659
+ Args:
660
+ cls: The *attrs*-decorated class to inspect.
661
+
662
+ Returns:
663
+ The effective build parameters of the class.
664
+
665
+ Raises:
666
+ NotAnAttrsClassError: If the class is not an *attrs*-decorated class.
667
+
668
+ .. versionadded:: 25.4.0
669
+ """
670
+ try:
671
+ return cls.__dict__["__attrs_props__"]
672
+ except KeyError:
673
+ msg = f"{cls!r} is not an attrs-decorated class."
674
+ raise NotAnAttrsClassError(msg) from None
.venv/lib/python3.10/site-packages/attr/_typing_compat.pyi ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import Any, ClassVar, Protocol
2
+
3
+ # MYPY is a special constant in mypy which works the same way as `TYPE_CHECKING`.
4
+ MYPY = False
5
+
6
+ if MYPY:
7
+ # A protocol to be able to statically accept an attrs class.
8
+ class AttrsInstance_(Protocol):
9
+ __attrs_attrs__: ClassVar[Any]
10
+
11
+ else:
12
+ # For type checkers without plug-in support use an empty protocol that
13
+ # will (hopefully) be combined into a union.
14
+ class AttrsInstance_(Protocol):
15
+ pass
.venv/lib/python3.10/site-packages/attr/_version_info.py ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # SPDX-License-Identifier: MIT
2
+
3
+
4
+ from functools import total_ordering
5
+
6
+ from ._funcs import astuple
7
+ from ._make import attrib, attrs
8
+
9
+
10
+ @total_ordering
11
+ @attrs(eq=False, order=False, slots=True, frozen=True)
12
+ class VersionInfo:
13
+ """
14
+ A version object that can be compared to tuple of length 1--4:
15
+
16
+ >>> attr.VersionInfo(19, 1, 0, "final") <= (19, 2)
17
+ True
18
+ >>> attr.VersionInfo(19, 1, 0, "final") < (19, 1, 1)
19
+ True
20
+ >>> vi = attr.VersionInfo(19, 2, 0, "final")
21
+ >>> vi < (19, 1, 1)
22
+ False
23
+ >>> vi < (19,)
24
+ False
25
+ >>> vi == (19, 2,)
26
+ True
27
+ >>> vi == (19, 2, 1)
28
+ False
29
+
30
+ .. versionadded:: 19.2
31
+ """
32
+
33
+ year = attrib(type=int)
34
+ minor = attrib(type=int)
35
+ micro = attrib(type=int)
36
+ releaselevel = attrib(type=str)
37
+
38
+ @classmethod
39
+ def _from_version_string(cls, s):
40
+ """
41
+ Parse *s* and return a _VersionInfo.
42
+ """
43
+ v = s.split(".")
44
+ if len(v) == 3:
45
+ v.append("final")
46
+
47
+ return cls(
48
+ year=int(v[0]), minor=int(v[1]), micro=int(v[2]), releaselevel=v[3]
49
+ )
50
+
51
+ def _ensure_tuple(self, other):
52
+ """
53
+ Ensure *other* is a tuple of a valid length.
54
+
55
+ Returns a possibly transformed *other* and ourselves as a tuple of
56
+ the same length as *other*.
57
+ """
58
+
59
+ if self.__class__ is other.__class__:
60
+ other = astuple(other)
61
+
62
+ if not isinstance(other, tuple):
63
+ raise NotImplementedError
64
+
65
+ if not (1 <= len(other) <= 4):
66
+ raise NotImplementedError
67
+
68
+ return astuple(self)[: len(other)], other
69
+
70
+ def __eq__(self, other):
71
+ try:
72
+ us, them = self._ensure_tuple(other)
73
+ except NotImplementedError:
74
+ return NotImplemented
75
+
76
+ return us == them
77
+
78
+ def __lt__(self, other):
79
+ try:
80
+ us, them = self._ensure_tuple(other)
81
+ except NotImplementedError:
82
+ return NotImplemented
83
+
84
+ # Since alphabetically "dev0" < "final" < "post1" < "post2", we don't
85
+ # have to do anything special with releaselevel for now.
86
+ return us < them
87
+
88
+ def __hash__(self):
89
+ return hash((self.year, self.minor, self.micro, self.releaselevel))
.venv/lib/python3.10/site-packages/attr/_version_info.pyi ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ class VersionInfo:
2
+ @property
3
+ def year(self) -> int: ...
4
+ @property
5
+ def minor(self) -> int: ...
6
+ @property
7
+ def micro(self) -> int: ...
8
+ @property
9
+ def releaselevel(self) -> str: ...
.venv/lib/python3.10/site-packages/attr/converters.py ADDED
@@ -0,0 +1,162 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # SPDX-License-Identifier: MIT
2
+
3
+ """
4
+ Commonly useful converters.
5
+ """
6
+
7
+ import typing
8
+
9
+ from ._compat import _AnnotationExtractor
10
+ from ._make import NOTHING, Converter, Factory, pipe
11
+
12
+
13
+ __all__ = [
14
+ "default_if_none",
15
+ "optional",
16
+ "pipe",
17
+ "to_bool",
18
+ ]
19
+
20
+
21
+ def optional(converter):
22
+ """
23
+ A converter that allows an attribute to be optional. An optional attribute
24
+ is one which can be set to `None`.
25
+
26
+ Type annotations will be inferred from the wrapped converter's, if it has
27
+ any.
28
+
29
+ Args:
30
+ converter (typing.Callable):
31
+ the converter that is used for non-`None` values.
32
+
33
+ .. versionadded:: 17.1.0
34
+ """
35
+
36
+ if isinstance(converter, Converter):
37
+
38
+ def optional_converter(val, inst, field):
39
+ if val is None:
40
+ return None
41
+ return converter(val, inst, field)
42
+
43
+ else:
44
+
45
+ def optional_converter(val):
46
+ if val is None:
47
+ return None
48
+ return converter(val)
49
+
50
+ xtr = _AnnotationExtractor(converter)
51
+
52
+ t = xtr.get_first_param_type()
53
+ if t:
54
+ optional_converter.__annotations__["val"] = typing.Optional[t]
55
+
56
+ rt = xtr.get_return_type()
57
+ if rt:
58
+ optional_converter.__annotations__["return"] = typing.Optional[rt]
59
+
60
+ if isinstance(converter, Converter):
61
+ return Converter(optional_converter, takes_self=True, takes_field=True)
62
+
63
+ return optional_converter
64
+
65
+
66
+ def default_if_none(default=NOTHING, factory=None):
67
+ """
68
+ A converter that allows to replace `None` values by *default* or the result
69
+ of *factory*.
70
+
71
+ Args:
72
+ default:
73
+ Value to be used if `None` is passed. Passing an instance of
74
+ `attrs.Factory` is supported, however the ``takes_self`` option is
75
+ *not*.
76
+
77
+ factory (typing.Callable):
78
+ A callable that takes no parameters whose result is used if `None`
79
+ is passed.
80
+
81
+ Raises:
82
+ TypeError: If **neither** *default* or *factory* is passed.
83
+
84
+ TypeError: If **both** *default* and *factory* are passed.
85
+
86
+ ValueError:
87
+ If an instance of `attrs.Factory` is passed with
88
+ ``takes_self=True``.
89
+
90
+ .. versionadded:: 18.2.0
91
+ """
92
+ if default is NOTHING and factory is None:
93
+ msg = "Must pass either `default` or `factory`."
94
+ raise TypeError(msg)
95
+
96
+ if default is not NOTHING and factory is not None:
97
+ msg = "Must pass either `default` or `factory` but not both."
98
+ raise TypeError(msg)
99
+
100
+ if factory is not None:
101
+ default = Factory(factory)
102
+
103
+ if isinstance(default, Factory):
104
+ if default.takes_self:
105
+ msg = "`takes_self` is not supported by default_if_none."
106
+ raise ValueError(msg)
107
+
108
+ def default_if_none_converter(val):
109
+ if val is not None:
110
+ return val
111
+
112
+ return default.factory()
113
+
114
+ else:
115
+
116
+ def default_if_none_converter(val):
117
+ if val is not None:
118
+ return val
119
+
120
+ return default
121
+
122
+ return default_if_none_converter
123
+
124
+
125
+ def to_bool(val):
126
+ """
127
+ Convert "boolean" strings (for example, from environment variables) to real
128
+ booleans.
129
+
130
+ Values mapping to `True`:
131
+
132
+ - ``True``
133
+ - ``"true"`` / ``"t"``
134
+ - ``"yes"`` / ``"y"``
135
+ - ``"on"``
136
+ - ``"1"``
137
+ - ``1``
138
+
139
+ Values mapping to `False`:
140
+
141
+ - ``False``
142
+ - ``"false"`` / ``"f"``
143
+ - ``"no"`` / ``"n"``
144
+ - ``"off"``
145
+ - ``"0"``
146
+ - ``0``
147
+
148
+ Raises:
149
+ ValueError: For any other value.
150
+
151
+ .. versionadded:: 21.3.0
152
+ """
153
+ if isinstance(val, str):
154
+ val = val.lower()
155
+
156
+ if val in (True, "true", "t", "yes", "y", "on", "1", 1):
157
+ return True
158
+ if val in (False, "false", "f", "no", "n", "off", "0", 0):
159
+ return False
160
+
161
+ msg = f"Cannot convert value to bool: {val!r}"
162
+ raise ValueError(msg)
.venv/lib/python3.10/site-packages/attr/converters.pyi ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import Callable, Any, overload
2
+
3
+ from attrs import _ConverterType, _CallableConverterType
4
+
5
+ @overload
6
+ def pipe(*validators: _CallableConverterType) -> _CallableConverterType: ...
7
+ @overload
8
+ def pipe(*validators: _ConverterType) -> _ConverterType: ...
9
+ @overload
10
+ def optional(converter: _CallableConverterType) -> _CallableConverterType: ...
11
+ @overload
12
+ def optional(converter: _ConverterType) -> _ConverterType: ...
13
+ @overload
14
+ def default_if_none(default: Any) -> _CallableConverterType: ...
15
+ @overload
16
+ def default_if_none(
17
+ *, factory: Callable[[], Any]
18
+ ) -> _CallableConverterType: ...
19
+ def to_bool(val: str | int | bool) -> bool: ...
.venv/lib/python3.10/site-packages/attr/exceptions.py ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # SPDX-License-Identifier: MIT
2
+
3
+ from __future__ import annotations
4
+
5
+
6
+ class FrozenError(AttributeError):
7
+ """
8
+ A frozen/immutable instance or attribute have been attempted to be
9
+ modified.
10
+
11
+ It mirrors the behavior of ``namedtuples`` by using the same error message
12
+ and subclassing `AttributeError`.
13
+
14
+ .. versionadded:: 20.1.0
15
+ """
16
+
17
+ def __init__(self):
18
+ msg = "can't set attribute"
19
+ super().__init__(msg)
20
+ self.msg = msg
21
+
22
+
23
+ class FrozenInstanceError(FrozenError):
24
+ """
25
+ A frozen instance has been attempted to be modified.
26
+
27
+ .. versionadded:: 16.1.0
28
+ """
29
+
30
+
31
+ class FrozenAttributeError(FrozenError):
32
+ """
33
+ A frozen attribute has been attempted to be modified.
34
+
35
+ .. versionadded:: 20.1.0
36
+ """
37
+
38
+
39
+ class AttrsAttributeNotFoundError(ValueError):
40
+ """
41
+ An *attrs* function couldn't find an attribute that the user asked for.
42
+
43
+ .. versionadded:: 16.2.0
44
+ """
45
+
46
+
47
+ class NotAnAttrsClassError(ValueError):
48
+ """
49
+ A non-*attrs* class has been passed into an *attrs* function.
50
+
51
+ .. versionadded:: 16.2.0
52
+ """
53
+
54
+
55
+ class DefaultAlreadySetError(RuntimeError):
56
+ """
57
+ A default has been set when defining the field and is attempted to be reset
58
+ using the decorator.
59
+
60
+ .. versionadded:: 17.1.0
61
+ """
62
+
63
+
64
+ class UnannotatedAttributeError(RuntimeError):
65
+ """
66
+ A class with ``auto_attribs=True`` has a field without a type annotation.
67
+
68
+ .. versionadded:: 17.3.0
69
+ """
70
+
71
+
72
+ class PythonTooOldError(RuntimeError):
73
+ """
74
+ It was attempted to use an *attrs* feature that requires a newer Python
75
+ version.
76
+
77
+ .. versionadded:: 18.2.0
78
+ """
79
+
80
+
81
+ class NotCallableError(TypeError):
82
+ """
83
+ A field requiring a callable has been set with a value that is not
84
+ callable.
85
+
86
+ .. versionadded:: 19.2.0
87
+ """
88
+
89
+ def __init__(self, msg, value):
90
+ super(TypeError, self).__init__(msg, value)
91
+ self.msg = msg
92
+ self.value = value
93
+
94
+ def __str__(self):
95
+ return str(self.msg)
.venv/lib/python3.10/site-packages/attr/exceptions.pyi ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import Any
2
+
3
+ class FrozenError(AttributeError):
4
+ msg: str = ...
5
+
6
+ class FrozenInstanceError(FrozenError): ...
7
+ class FrozenAttributeError(FrozenError): ...
8
+ class AttrsAttributeNotFoundError(ValueError): ...
9
+ class NotAnAttrsClassError(ValueError): ...
10
+ class DefaultAlreadySetError(RuntimeError): ...
11
+ class UnannotatedAttributeError(RuntimeError): ...
12
+ class PythonTooOldError(RuntimeError): ...
13
+
14
+ class NotCallableError(TypeError):
15
+ msg: str = ...
16
+ value: Any = ...
17
+ def __init__(self, msg: str, value: Any) -> None: ...
.venv/lib/python3.10/site-packages/attr/filters.py ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # SPDX-License-Identifier: MIT
2
+
3
+ """
4
+ Commonly useful filters for `attrs.asdict` and `attrs.astuple`.
5
+ """
6
+
7
+ from ._make import Attribute
8
+
9
+
10
+ def _split_what(what):
11
+ """
12
+ Returns a tuple of `frozenset`s of classes and attributes.
13
+ """
14
+ return (
15
+ frozenset(cls for cls in what if isinstance(cls, type)),
16
+ frozenset(cls for cls in what if isinstance(cls, str)),
17
+ frozenset(cls for cls in what if isinstance(cls, Attribute)),
18
+ )
19
+
20
+
21
+ def include(*what):
22
+ """
23
+ Create a filter that only allows *what*.
24
+
25
+ Args:
26
+ what (list[type, str, attrs.Attribute]):
27
+ What to include. Can be a type, a name, or an attribute.
28
+
29
+ Returns:
30
+ Callable:
31
+ A callable that can be passed to `attrs.asdict`'s and
32
+ `attrs.astuple`'s *filter* argument.
33
+
34
+ .. versionchanged:: 23.1.0 Accept strings with field names.
35
+ """
36
+ cls, names, attrs = _split_what(what)
37
+
38
+ def include_(attribute, value):
39
+ return (
40
+ value.__class__ in cls
41
+ or attribute.name in names
42
+ or attribute in attrs
43
+ )
44
+
45
+ return include_
46
+
47
+
48
+ def exclude(*what):
49
+ """
50
+ Create a filter that does **not** allow *what*.
51
+
52
+ Args:
53
+ what (list[type, str, attrs.Attribute]):
54
+ What to exclude. Can be a type, a name, or an attribute.
55
+
56
+ Returns:
57
+ Callable:
58
+ A callable that can be passed to `attrs.asdict`'s and
59
+ `attrs.astuple`'s *filter* argument.
60
+
61
+ .. versionchanged:: 23.3.0 Accept field name string as input argument
62
+ """
63
+ cls, names, attrs = _split_what(what)
64
+
65
+ def exclude_(attribute, value):
66
+ return not (
67
+ value.__class__ in cls
68
+ or attribute.name in names
69
+ or attribute in attrs
70
+ )
71
+
72
+ return exclude_
.venv/lib/python3.10/site-packages/attr/filters.pyi ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ from typing import Any
2
+
3
+ from . import Attribute, _FilterType
4
+
5
+ def include(*what: type | str | Attribute[Any]) -> _FilterType[Any]: ...
6
+ def exclude(*what: type | str | Attribute[Any]) -> _FilterType[Any]: ...
.venv/lib/python3.10/site-packages/attr/py.typed ADDED
File without changes
.venv/lib/python3.10/site-packages/attr/setters.py ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # SPDX-License-Identifier: MIT
2
+
3
+ """
4
+ Commonly used hooks for on_setattr.
5
+ """
6
+
7
+ from . import _config
8
+ from .exceptions import FrozenAttributeError
9
+
10
+
11
+ def pipe(*setters):
12
+ """
13
+ Run all *setters* and return the return value of the last one.
14
+
15
+ .. versionadded:: 20.1.0
16
+ """
17
+
18
+ def wrapped_pipe(instance, attrib, new_value):
19
+ rv = new_value
20
+
21
+ for setter in setters:
22
+ rv = setter(instance, attrib, rv)
23
+
24
+ return rv
25
+
26
+ return wrapped_pipe
27
+
28
+
29
+ def frozen(_, __, ___):
30
+ """
31
+ Prevent an attribute to be modified.
32
+
33
+ .. versionadded:: 20.1.0
34
+ """
35
+ raise FrozenAttributeError
36
+
37
+
38
+ def validate(instance, attrib, new_value):
39
+ """
40
+ Run *attrib*'s validator on *new_value* if it has one.
41
+
42
+ .. versionadded:: 20.1.0
43
+ """
44
+ if _config._run_validators is False:
45
+ return new_value
46
+
47
+ v = attrib.validator
48
+ if not v:
49
+ return new_value
50
+
51
+ v(instance, attrib, new_value)
52
+
53
+ return new_value
54
+
55
+
56
+ def convert(instance, attrib, new_value):
57
+ """
58
+ Run *attrib*'s converter -- if it has one -- on *new_value* and return the
59
+ result.
60
+
61
+ .. versionadded:: 20.1.0
62
+ """
63
+ c = attrib.converter
64
+ if c:
65
+ # This can be removed once we drop 3.8 and use attrs.Converter instead.
66
+ from ._make import Converter
67
+
68
+ if not isinstance(c, Converter):
69
+ return c(new_value)
70
+
71
+ return c(new_value, instance, attrib)
72
+
73
+ return new_value
74
+
75
+
76
+ # Sentinel for disabling class-wide *on_setattr* hooks for certain attributes.
77
+ # Sphinx's autodata stopped working, so the docstring is inlined in the API
78
+ # docs.
79
+ NO_OP = object()
.venv/lib/python3.10/site-packages/attr/setters.pyi ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import Any, NewType, NoReturn, TypeVar
2
+
3
+ from . import Attribute
4
+ from attrs import _OnSetAttrType
5
+
6
+ _T = TypeVar("_T")
7
+
8
+ def frozen(
9
+ instance: Any, attribute: Attribute[Any], new_value: Any
10
+ ) -> NoReturn: ...
11
+ def pipe(*setters: _OnSetAttrType) -> _OnSetAttrType: ...
12
+ def validate(instance: Any, attribute: Attribute[_T], new_value: _T) -> _T: ...
13
+
14
+ # convert is allowed to return Any, because they can be chained using pipe.
15
+ def convert(
16
+ instance: Any, attribute: Attribute[Any], new_value: Any
17
+ ) -> Any: ...
18
+
19
+ _NoOpType = NewType("_NoOpType", object)
20
+ NO_OP: _NoOpType
.venv/lib/python3.10/site-packages/attr/validators.py ADDED
@@ -0,0 +1,750 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # SPDX-License-Identifier: MIT
2
+
3
+ """
4
+ Commonly useful validators.
5
+ """
6
+
7
+ import operator
8
+ import re
9
+
10
+ from contextlib import contextmanager
11
+ from re import Pattern
12
+
13
+ from ._config import get_run_validators, set_run_validators
14
+ from ._make import _AndValidator, and_, attrib, attrs
15
+ from .converters import default_if_none
16
+ from .exceptions import NotCallableError
17
+
18
+
19
+ __all__ = [
20
+ "and_",
21
+ "deep_iterable",
22
+ "deep_mapping",
23
+ "disabled",
24
+ "ge",
25
+ "get_disabled",
26
+ "gt",
27
+ "in_",
28
+ "instance_of",
29
+ "is_callable",
30
+ "le",
31
+ "lt",
32
+ "matches_re",
33
+ "max_len",
34
+ "min_len",
35
+ "not_",
36
+ "optional",
37
+ "or_",
38
+ "set_disabled",
39
+ ]
40
+
41
+
42
+ def set_disabled(disabled):
43
+ """
44
+ Globally disable or enable running validators.
45
+
46
+ By default, they are run.
47
+
48
+ Args:
49
+ disabled (bool): If `True`, disable running all validators.
50
+
51
+ .. warning::
52
+
53
+ This function is not thread-safe!
54
+
55
+ .. versionadded:: 21.3.0
56
+ """
57
+ set_run_validators(not disabled)
58
+
59
+
60
+ def get_disabled():
61
+ """
62
+ Return a bool indicating whether validators are currently disabled or not.
63
+
64
+ Returns:
65
+ bool:`True` if validators are currently disabled.
66
+
67
+ .. versionadded:: 21.3.0
68
+ """
69
+ return not get_run_validators()
70
+
71
+
72
+ @contextmanager
73
+ def disabled():
74
+ """
75
+ Context manager that disables running validators within its context.
76
+
77
+ .. warning::
78
+
79
+ This context manager is not thread-safe!
80
+
81
+ .. versionadded:: 21.3.0
82
+ .. versionchanged:: 26.1.0 The contextmanager is nestable.
83
+ """
84
+ prev = get_run_validators()
85
+ set_run_validators(False)
86
+ try:
87
+ yield
88
+ finally:
89
+ set_run_validators(prev)
90
+
91
+
92
+ @attrs(repr=False, slots=True, unsafe_hash=True)
93
+ class _InstanceOfValidator:
94
+ type = attrib()
95
+
96
+ def __call__(self, inst, attr, value):
97
+ """
98
+ We use a callable class to be able to change the ``__repr__``.
99
+ """
100
+ if not isinstance(value, self.type):
101
+ msg = f"'{attr.name}' must be {self.type!r} (got {value!r} that is a {value.__class__!r})."
102
+ raise TypeError(
103
+ msg,
104
+ attr,
105
+ self.type,
106
+ value,
107
+ )
108
+
109
+ def __repr__(self):
110
+ return f"<instance_of validator for type {self.type!r}>"
111
+
112
+
113
+ def instance_of(type):
114
+ """
115
+ A validator that raises a `TypeError` if the initializer is called with a
116
+ wrong type for this particular attribute (checks are performed using
117
+ `isinstance` therefore it's also valid to pass a tuple of types).
118
+
119
+ Args:
120
+ type (type | tuple[type]): The type to check for.
121
+
122
+ Raises:
123
+ TypeError:
124
+ With a human readable error message, the attribute (of type
125
+ `attrs.Attribute`), the expected type, and the value it got.
126
+ """
127
+ return _InstanceOfValidator(type)
128
+
129
+
130
+ @attrs(repr=False, frozen=True, slots=True)
131
+ class _MatchesReValidator:
132
+ pattern = attrib()
133
+ match_func = attrib()
134
+
135
+ def __call__(self, inst, attr, value):
136
+ """
137
+ We use a callable class to be able to change the ``__repr__``.
138
+ """
139
+ if not self.match_func(value):
140
+ msg = f"'{attr.name}' must match regex {self.pattern.pattern!r} ({value!r} doesn't)"
141
+ raise ValueError(
142
+ msg,
143
+ attr,
144
+ self.pattern,
145
+ value,
146
+ )
147
+
148
+ def __repr__(self):
149
+ return f"<matches_re validator for pattern {self.pattern!r}>"
150
+
151
+
152
+ def matches_re(regex, flags=0, func=None):
153
+ r"""
154
+ A validator that raises `ValueError` if the initializer is called with a
155
+ string that doesn't match *regex*.
156
+
157
+ Args:
158
+ regex (str, re.Pattern):
159
+ A regex string or precompiled pattern to match against
160
+
161
+ flags (int):
162
+ Flags that will be passed to the underlying re function (default 0)
163
+
164
+ func (typing.Callable):
165
+ Which underlying `re` function to call. Valid options are
166
+ `re.fullmatch`, `re.search`, and `re.match`; the default `None`
167
+ means `re.fullmatch`. For performance reasons, the pattern is
168
+ always precompiled using `re.compile`.
169
+
170
+ .. versionadded:: 19.2.0
171
+ .. versionchanged:: 21.3.0 *regex* can be a pre-compiled pattern.
172
+ """
173
+ valid_funcs = (re.fullmatch, None, re.search, re.match)
174
+ if func not in valid_funcs:
175
+ msg = "'func' must be one of {}.".format(
176
+ ", ".join(
177
+ sorted((e and e.__name__) or "None" for e in set(valid_funcs))
178
+ )
179
+ )
180
+ raise ValueError(msg)
181
+
182
+ if isinstance(regex, Pattern):
183
+ if flags:
184
+ msg = "'flags' can only be used with a string pattern; pass flags to re.compile() instead"
185
+ raise TypeError(msg)
186
+ pattern = regex
187
+ else:
188
+ pattern = re.compile(regex, flags)
189
+
190
+ if func is re.match:
191
+ match_func = pattern.match
192
+ elif func is re.search:
193
+ match_func = pattern.search
194
+ else:
195
+ match_func = pattern.fullmatch
196
+
197
+ return _MatchesReValidator(pattern, match_func)
198
+
199
+
200
+ @attrs(repr=False, slots=True, unsafe_hash=True)
201
+ class _OptionalValidator:
202
+ validator = attrib()
203
+
204
+ def __call__(self, inst, attr, value):
205
+ if value is None:
206
+ return
207
+
208
+ self.validator(inst, attr, value)
209
+
210
+ def __repr__(self):
211
+ return f"<optional validator for {self.validator!r} or None>"
212
+
213
+
214
+ def optional(validator):
215
+ """
216
+ A validator that makes an attribute optional. An optional attribute is one
217
+ which can be set to `None` in addition to satisfying the requirements of
218
+ the sub-validator.
219
+
220
+ Args:
221
+ validator
222
+ (typing.Callable | tuple[typing.Callable] | list[typing.Callable]):
223
+ A validator (or validators) that is used for non-`None` values.
224
+
225
+ .. versionadded:: 15.1.0
226
+ .. versionchanged:: 17.1.0 *validator* can be a list of validators.
227
+ .. versionchanged:: 23.1.0 *validator* can also be a tuple of validators.
228
+ """
229
+ if isinstance(validator, (list, tuple)):
230
+ return _OptionalValidator(_AndValidator(validator))
231
+
232
+ return _OptionalValidator(validator)
233
+
234
+
235
+ @attrs(repr=False, slots=True, unsafe_hash=True)
236
+ class _InValidator:
237
+ options = attrib()
238
+ _original_options = attrib(hash=False)
239
+
240
+ def __call__(self, inst, attr, value):
241
+ try:
242
+ in_options = value in self.options
243
+ except TypeError: # e.g. `1 in "abc"`
244
+ in_options = False
245
+
246
+ if not in_options:
247
+ msg = f"'{attr.name}' must be in {self._original_options!r} (got {value!r})"
248
+ raise ValueError(
249
+ msg,
250
+ attr,
251
+ self._original_options,
252
+ value,
253
+ )
254
+
255
+ def __repr__(self):
256
+ return f"<in_ validator with options {self._original_options!r}>"
257
+
258
+
259
+ def in_(options):
260
+ """
261
+ A validator that raises a `ValueError` if the initializer is called with a
262
+ value that does not belong in the *options* provided.
263
+
264
+ The check is performed using ``value in options``, so *options* has to
265
+ support that operation.
266
+
267
+ To keep the validator hashable, dicts, lists, and sets are transparently
268
+ transformed into a `tuple`.
269
+
270
+ Args:
271
+ options: Allowed options.
272
+
273
+ Raises:
274
+ ValueError:
275
+ With a human readable error message, the attribute (of type
276
+ `attrs.Attribute`), the expected options, and the value it got.
277
+
278
+ .. versionadded:: 17.1.0
279
+ .. versionchanged:: 22.1.0
280
+ The ValueError was incomplete until now and only contained the human
281
+ readable error message. Now it contains all the information that has
282
+ been promised since 17.1.0.
283
+ .. versionchanged:: 24.1.0
284
+ *options* that are a list, dict, or a set are now transformed into a
285
+ tuple to keep the validator hashable.
286
+ """
287
+ repr_options = options
288
+ if isinstance(options, (list, dict, set)):
289
+ options = tuple(options)
290
+
291
+ return _InValidator(options, repr_options)
292
+
293
+
294
+ @attrs(repr=False, slots=False, unsafe_hash=True)
295
+ class _IsCallableValidator:
296
+ def __call__(self, inst, attr, value):
297
+ """
298
+ We use a callable class to be able to change the ``__repr__``.
299
+ """
300
+ if not callable(value):
301
+ message = (
302
+ "'{name}' must be callable "
303
+ "(got {value!r} that is a {actual!r})."
304
+ )
305
+ raise NotCallableError(
306
+ msg=message.format(
307
+ name=attr.name, value=value, actual=value.__class__
308
+ ),
309
+ value=value,
310
+ )
311
+
312
+ def __repr__(self):
313
+ return "<is_callable validator>"
314
+
315
+
316
+ def is_callable():
317
+ """
318
+ A validator that raises a `attrs.exceptions.NotCallableError` if the
319
+ initializer is called with a value for this particular attribute that is
320
+ not callable.
321
+
322
+ .. versionadded:: 19.1.0
323
+
324
+ Raises:
325
+ attrs.exceptions.NotCallableError:
326
+ With a human readable error message containing the attribute
327
+ (`attrs.Attribute`) name, and the value it got.
328
+ """
329
+ return _IsCallableValidator()
330
+
331
+
332
+ @attrs(repr=False, slots=True, unsafe_hash=True)
333
+ class _DeepIterable:
334
+ member_validator = attrib(validator=is_callable())
335
+ iterable_validator = attrib(
336
+ default=None, validator=optional(is_callable())
337
+ )
338
+
339
+ def __call__(self, inst, attr, value):
340
+ """
341
+ We use a callable class to be able to change the ``__repr__``.
342
+ """
343
+ if self.iterable_validator is not None:
344
+ self.iterable_validator(inst, attr, value)
345
+
346
+ for member in value:
347
+ self.member_validator(inst, attr, member)
348
+
349
+ def __repr__(self):
350
+ iterable_identifier = (
351
+ ""
352
+ if self.iterable_validator is None
353
+ else f" {self.iterable_validator!r}"
354
+ )
355
+ return (
356
+ f"<deep_iterable validator for{iterable_identifier}"
357
+ f" iterables of {self.member_validator!r}>"
358
+ )
359
+
360
+
361
+ def deep_iterable(member_validator, iterable_validator=None):
362
+ """
363
+ A validator that performs deep validation of an iterable.
364
+
365
+ Args:
366
+ member_validator: Validator(s) to apply to iterable members.
367
+
368
+ iterable_validator:
369
+ Validator(s) to apply to iterable itself (optional).
370
+
371
+ Raises
372
+ TypeError: if any sub-validators fail
373
+
374
+ .. versionadded:: 19.1.0
375
+
376
+ .. versionchanged:: 25.4.0
377
+ *member_validator* and *iterable_validator* can now be a list or tuple
378
+ of validators.
379
+ """
380
+ if isinstance(member_validator, (list, tuple)):
381
+ member_validator = and_(*member_validator)
382
+ if isinstance(iterable_validator, (list, tuple)):
383
+ iterable_validator = and_(*iterable_validator)
384
+ return _DeepIterable(member_validator, iterable_validator)
385
+
386
+
387
+ @attrs(repr=False, slots=True, unsafe_hash=True)
388
+ class _DeepMapping:
389
+ key_validator = attrib(validator=optional(is_callable()))
390
+ value_validator = attrib(validator=optional(is_callable()))
391
+ mapping_validator = attrib(validator=optional(is_callable()))
392
+
393
+ def __call__(self, inst, attr, value):
394
+ """
395
+ We use a callable class to be able to change the ``__repr__``.
396
+ """
397
+ if self.mapping_validator is not None:
398
+ self.mapping_validator(inst, attr, value)
399
+
400
+ for key in value:
401
+ if self.key_validator is not None:
402
+ self.key_validator(inst, attr, key)
403
+ if self.value_validator is not None:
404
+ self.value_validator(inst, attr, value[key])
405
+
406
+ def __repr__(self):
407
+ return f"<deep_mapping validator for objects mapping {self.key_validator!r} to {self.value_validator!r}>"
408
+
409
+
410
+ def deep_mapping(
411
+ key_validator=None, value_validator=None, mapping_validator=None
412
+ ):
413
+ """
414
+ A validator that performs deep validation of a dictionary.
415
+
416
+ All validators are optional, but at least one of *key_validator* or
417
+ *value_validator* must be provided.
418
+
419
+ Args:
420
+ key_validator: Validator(s) to apply to dictionary keys.
421
+
422
+ value_validator: Validator(s) to apply to dictionary values.
423
+
424
+ mapping_validator:
425
+ Validator(s) to apply to top-level mapping attribute.
426
+
427
+ .. versionadded:: 19.1.0
428
+
429
+ .. versionchanged:: 25.4.0
430
+ *key_validator* and *value_validator* are now optional, but at least one
431
+ of them must be provided.
432
+
433
+ .. versionchanged:: 25.4.0
434
+ *key_validator*, *value_validator*, and *mapping_validator* can now be a
435
+ list or tuple of validators.
436
+
437
+ Raises:
438
+ TypeError: If any sub-validator fails on validation.
439
+
440
+ ValueError:
441
+ If neither *key_validator* nor *value_validator* is provided on
442
+ instantiation.
443
+ """
444
+ if key_validator is None and value_validator is None:
445
+ msg = (
446
+ "At least one of key_validator or value_validator must be provided"
447
+ )
448
+ raise ValueError(msg)
449
+
450
+ if isinstance(key_validator, (list, tuple)):
451
+ key_validator = and_(*key_validator)
452
+ if isinstance(value_validator, (list, tuple)):
453
+ value_validator = and_(*value_validator)
454
+ if isinstance(mapping_validator, (list, tuple)):
455
+ mapping_validator = and_(*mapping_validator)
456
+
457
+ return _DeepMapping(key_validator, value_validator, mapping_validator)
458
+
459
+
460
+ @attrs(repr=False, frozen=True, slots=True)
461
+ class _NumberValidator:
462
+ bound = attrib()
463
+ compare_op = attrib()
464
+ compare_func = attrib()
465
+
466
+ def __call__(self, inst, attr, value):
467
+ """
468
+ We use a callable class to be able to change the ``__repr__``.
469
+ """
470
+ if not self.compare_func(value, self.bound):
471
+ msg = f"'{attr.name}' must be {self.compare_op} {self.bound}: {value}"
472
+ raise ValueError(msg)
473
+
474
+ def __repr__(self):
475
+ return f"<Validator for x {self.compare_op} {self.bound}>"
476
+
477
+
478
+ def lt(val):
479
+ """
480
+ A validator that raises `ValueError` if the initializer is called with a
481
+ number larger or equal to *val*.
482
+
483
+ The validator uses `operator.lt` to compare the values.
484
+
485
+ Args:
486
+ val: Exclusive upper bound for values.
487
+
488
+ .. versionadded:: 21.3.0
489
+ """
490
+ return _NumberValidator(val, "<", operator.lt)
491
+
492
+
493
+ def le(val):
494
+ """
495
+ A validator that raises `ValueError` if the initializer is called with a
496
+ number greater than *val*.
497
+
498
+ The validator uses `operator.le` to compare the values.
499
+
500
+ Args:
501
+ val: Inclusive upper bound for values.
502
+
503
+ .. versionadded:: 21.3.0
504
+ """
505
+ return _NumberValidator(val, "<=", operator.le)
506
+
507
+
508
+ def ge(val):
509
+ """
510
+ A validator that raises `ValueError` if the initializer is called with a
511
+ number smaller than *val*.
512
+
513
+ The validator uses `operator.ge` to compare the values.
514
+
515
+ Args:
516
+ val: Inclusive lower bound for values
517
+
518
+ .. versionadded:: 21.3.0
519
+ """
520
+ return _NumberValidator(val, ">=", operator.ge)
521
+
522
+
523
+ def gt(val):
524
+ """
525
+ A validator that raises `ValueError` if the initializer is called with a
526
+ number smaller or equal to *val*.
527
+
528
+ The validator uses `operator.gt` to compare the values.
529
+
530
+ Args:
531
+ val: Exclusive lower bound for values
532
+
533
+ .. versionadded:: 21.3.0
534
+ """
535
+ return _NumberValidator(val, ">", operator.gt)
536
+
537
+
538
+ @attrs(repr=False, frozen=True, slots=True)
539
+ class _MaxLengthValidator:
540
+ max_length = attrib()
541
+
542
+ def __call__(self, inst, attr, value):
543
+ """
544
+ We use a callable class to be able to change the ``__repr__``.
545
+ """
546
+ if len(value) > self.max_length:
547
+ msg = f"Length of '{attr.name}' must be <= {self.max_length}: {len(value)}"
548
+ raise ValueError(msg)
549
+
550
+ def __repr__(self):
551
+ return f"<max_len validator for {self.max_length}>"
552
+
553
+
554
+ def max_len(length):
555
+ """
556
+ A validator that raises `ValueError` if the initializer is called
557
+ with a string or iterable that is longer than *length*.
558
+
559
+ Args:
560
+ length (int): Maximum length of the string or iterable
561
+
562
+ .. versionadded:: 21.3.0
563
+ """
564
+ return _MaxLengthValidator(length)
565
+
566
+
567
+ @attrs(repr=False, frozen=True, slots=True)
568
+ class _MinLengthValidator:
569
+ min_length = attrib()
570
+
571
+ def __call__(self, inst, attr, value):
572
+ """
573
+ We use a callable class to be able to change the ``__repr__``.
574
+ """
575
+ if len(value) < self.min_length:
576
+ msg = f"Length of '{attr.name}' must be >= {self.min_length}: {len(value)}"
577
+ raise ValueError(msg)
578
+
579
+ def __repr__(self):
580
+ return f"<min_len validator for {self.min_length}>"
581
+
582
+
583
+ def min_len(length):
584
+ """
585
+ A validator that raises `ValueError` if the initializer is called
586
+ with a string or iterable that is shorter than *length*.
587
+
588
+ Args:
589
+ length (int): Minimum length of the string or iterable
590
+
591
+ .. versionadded:: 22.1.0
592
+ """
593
+ return _MinLengthValidator(length)
594
+
595
+
596
+ @attrs(repr=False, slots=True, unsafe_hash=True)
597
+ class _SubclassOfValidator:
598
+ type = attrib()
599
+
600
+ def __call__(self, inst, attr, value):
601
+ """
602
+ We use a callable class to be able to change the ``__repr__``.
603
+ """
604
+ if not issubclass(value, self.type):
605
+ msg = f"'{attr.name}' must be a subclass of {self.type!r} (got {value!r})."
606
+ raise TypeError(
607
+ msg,
608
+ attr,
609
+ self.type,
610
+ value,
611
+ )
612
+
613
+ def __repr__(self):
614
+ return f"<subclass_of validator for type {self.type!r}>"
615
+
616
+
617
+ def _subclass_of(type):
618
+ """
619
+ A validator that raises a `TypeError` if the initializer is called with a
620
+ wrong type for this particular attribute (checks are performed using
621
+ `issubclass` therefore it's also valid to pass a tuple of types).
622
+
623
+ Args:
624
+ type (type | tuple[type, ...]): The type(s) to check for.
625
+
626
+ Raises:
627
+ TypeError:
628
+ With a human readable error message, the attribute (of type
629
+ `attrs.Attribute`), the expected type, and the value it got.
630
+ """
631
+ return _SubclassOfValidator(type)
632
+
633
+
634
+ @attrs(repr=False, slots=True, unsafe_hash=True)
635
+ class _NotValidator:
636
+ validator = attrib()
637
+ msg = attrib(
638
+ converter=default_if_none(
639
+ "not_ validator child '{validator!r}' "
640
+ "did not raise a captured error"
641
+ )
642
+ )
643
+ exc_types = attrib(
644
+ validator=deep_iterable(
645
+ member_validator=_subclass_of(Exception),
646
+ iterable_validator=instance_of(tuple),
647
+ ),
648
+ )
649
+
650
+ def __call__(self, inst, attr, value):
651
+ try:
652
+ self.validator(inst, attr, value)
653
+ except self.exc_types:
654
+ pass # suppress error to invert validity
655
+ else:
656
+ raise ValueError(
657
+ self.msg.format(
658
+ validator=self.validator,
659
+ exc_types=self.exc_types,
660
+ ),
661
+ attr,
662
+ self.validator,
663
+ value,
664
+ self.exc_types,
665
+ )
666
+
667
+ def __repr__(self):
668
+ return f"<not_ validator wrapping {self.validator!r}, capturing {self.exc_types!r}>"
669
+
670
+
671
+ def not_(validator, *, msg=None, exc_types=(ValueError, TypeError)):
672
+ """
673
+ A validator that wraps and logically 'inverts' the validator passed to it.
674
+ It will raise a `ValueError` if the provided validator *doesn't* raise a
675
+ `ValueError` or `TypeError` (by default), and will suppress the exception
676
+ if the provided validator *does*.
677
+
678
+ Intended to be used with existing validators to compose logic without
679
+ needing to create inverted variants, for example, ``not_(in_(...))``.
680
+
681
+ Args:
682
+ validator: A validator to be logically inverted.
683
+
684
+ msg (str):
685
+ Message to raise if validator fails. Formatted with keys
686
+ ``exc_types`` and ``validator``.
687
+
688
+ exc_types (tuple[type, ...]):
689
+ Exception type(s) to capture. Other types raised by child
690
+ validators will not be intercepted and pass through.
691
+
692
+ Raises:
693
+ ValueError:
694
+ With a human readable error message, the attribute (of type
695
+ `attrs.Attribute`), the validator that failed to raise an
696
+ exception, the value it got, and the expected exception types.
697
+
698
+ .. versionadded:: 22.2.0
699
+ """
700
+ try:
701
+ exc_types = tuple(exc_types)
702
+ except TypeError:
703
+ exc_types = (exc_types,)
704
+ return _NotValidator(validator, msg, exc_types)
705
+
706
+
707
+ @attrs(repr=False, slots=True, unsafe_hash=True)
708
+ class _OrValidator:
709
+ validators = attrib()
710
+
711
+ def __call__(self, inst, attr, value):
712
+ for v in self.validators:
713
+ try:
714
+ v(inst, attr, value)
715
+ except Exception: # noqa: BLE001, PERF203, S112
716
+ continue
717
+ else:
718
+ return
719
+
720
+ msg = f"None of {self.validators!r} satisfied for value {value!r}"
721
+ raise ValueError(msg)
722
+
723
+ def __repr__(self):
724
+ return f"<or validator wrapping {self.validators!r}>"
725
+
726
+
727
+ def or_(*validators):
728
+ """
729
+ A validator that composes multiple validators into one.
730
+
731
+ When called on a value, it runs all wrapped validators until one of them is
732
+ satisfied.
733
+
734
+ Args:
735
+ validators (~collections.abc.Iterable[typing.Callable]):
736
+ Arbitrary number of validators.
737
+
738
+ Raises:
739
+ ValueError:
740
+ If no validator is satisfied. Raised with a human-readable error
741
+ message listing all the wrapped validators and the value that
742
+ failed all of them.
743
+
744
+ .. versionadded:: 24.1.0
745
+ """
746
+ vals = []
747
+ for v in validators:
748
+ vals.extend(v.validators if isinstance(v, _OrValidator) else [v])
749
+
750
+ return _OrValidator(tuple(vals))
.venv/lib/python3.10/site-packages/attr/validators.pyi ADDED
@@ -0,0 +1,140 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from types import UnionType
2
+ from typing import (
3
+ Any,
4
+ AnyStr,
5
+ Callable,
6
+ Container,
7
+ ContextManager,
8
+ Iterable,
9
+ Mapping,
10
+ Match,
11
+ Pattern,
12
+ TypeVar,
13
+ overload,
14
+ )
15
+
16
+ from attrs import _ValidatorType
17
+ from attrs import _ValidatorArgType
18
+
19
+ _T = TypeVar("_T")
20
+ _T1 = TypeVar("_T1")
21
+ _T2 = TypeVar("_T2")
22
+ _T3 = TypeVar("_T3")
23
+ _T4 = TypeVar("_T4")
24
+ _T5 = TypeVar("_T5")
25
+ _T6 = TypeVar("_T6")
26
+ _I = TypeVar("_I", bound=Iterable)
27
+ _K = TypeVar("_K")
28
+ _V = TypeVar("_V")
29
+ _M = TypeVar("_M", bound=Mapping)
30
+
31
+ def set_disabled(run: bool) -> None: ...
32
+ def get_disabled() -> bool: ...
33
+ def disabled() -> ContextManager[None]: ...
34
+
35
+ # To be more precise on instance_of use some overloads.
36
+ # If there are more than 3 items in the tuple then we fall back to Any
37
+ @overload
38
+ def instance_of(type: type[_T]) -> _ValidatorType[_T]: ...
39
+ @overload
40
+ def instance_of(type: tuple[type[_T]]) -> _ValidatorType[_T]: ...
41
+ @overload
42
+ def instance_of(
43
+ type: tuple[type[_T1], type[_T2]],
44
+ ) -> _ValidatorType[_T1 | _T2]: ...
45
+ @overload
46
+ def instance_of(
47
+ type: tuple[type[_T1], type[_T2], type[_T3]],
48
+ ) -> _ValidatorType[_T1 | _T2 | _T3]: ...
49
+ @overload
50
+ def instance_of(type: tuple[type, ...]) -> _ValidatorType[Any]: ...
51
+ @overload
52
+ def instance_of(type: UnionType) -> _ValidatorType[Any]: ...
53
+ def optional(
54
+ validator: (
55
+ _ValidatorType[_T]
56
+ | list[_ValidatorType[_T]]
57
+ | tuple[_ValidatorType[_T], ...]
58
+ ),
59
+ ) -> _ValidatorType[_T | None]: ...
60
+ def in_(options: Container[_T]) -> _ValidatorType[_T]: ...
61
+ def and_(*validators: _ValidatorType[_T]) -> _ValidatorType[_T]: ...
62
+ def matches_re(
63
+ regex: Pattern[AnyStr] | AnyStr,
64
+ flags: int = ...,
65
+ func: Callable[[AnyStr, AnyStr, int], Match[AnyStr] | None] | None = ...,
66
+ ) -> _ValidatorType[AnyStr]: ...
67
+ def deep_iterable(
68
+ member_validator: _ValidatorArgType[_T],
69
+ iterable_validator: _ValidatorArgType[_I] | None = ...,
70
+ ) -> _ValidatorType[_I]: ...
71
+ @overload
72
+ def deep_mapping(
73
+ key_validator: _ValidatorArgType[_K],
74
+ value_validator: _ValidatorArgType[_V] | None = ...,
75
+ mapping_validator: _ValidatorArgType[_M] | None = ...,
76
+ ) -> _ValidatorType[_M]: ...
77
+ @overload
78
+ def deep_mapping(
79
+ key_validator: _ValidatorArgType[_K] | None = ...,
80
+ value_validator: _ValidatorArgType[_V] = ...,
81
+ mapping_validator: _ValidatorArgType[_M] | None = ...,
82
+ ) -> _ValidatorType[_M]: ...
83
+ def is_callable() -> _ValidatorType[_T]: ...
84
+ def lt(val: _T) -> _ValidatorType[_T]: ...
85
+ def le(val: _T) -> _ValidatorType[_T]: ...
86
+ def ge(val: _T) -> _ValidatorType[_T]: ...
87
+ def gt(val: _T) -> _ValidatorType[_T]: ...
88
+ def max_len(length: int) -> _ValidatorType[_T]: ...
89
+ def min_len(length: int) -> _ValidatorType[_T]: ...
90
+ def not_(
91
+ validator: _ValidatorType[_T],
92
+ *,
93
+ msg: str | None = None,
94
+ exc_types: type[Exception] | Iterable[type[Exception]] = ...,
95
+ ) -> _ValidatorType[_T]: ...
96
+ @overload
97
+ def or_(
98
+ __v1: _ValidatorType[_T1],
99
+ __v2: _ValidatorType[_T2],
100
+ ) -> _ValidatorType[_T1 | _T2]: ...
101
+ @overload
102
+ def or_(
103
+ __v1: _ValidatorType[_T1],
104
+ __v2: _ValidatorType[_T2],
105
+ __v3: _ValidatorType[_T3],
106
+ ) -> _ValidatorType[_T1 | _T2 | _T3]: ...
107
+ @overload
108
+ def or_(
109
+ __v1: _ValidatorType[_T1],
110
+ __v2: _ValidatorType[_T2],
111
+ __v3: _ValidatorType[_T3],
112
+ __v4: _ValidatorType[_T4],
113
+ ) -> _ValidatorType[_T1 | _T2 | _T3 | _T4]: ...
114
+ @overload
115
+ def or_(
116
+ __v1: _ValidatorType[_T1],
117
+ __v2: _ValidatorType[_T2],
118
+ __v3: _ValidatorType[_T3],
119
+ __v4: _ValidatorType[_T4],
120
+ __v5: _ValidatorType[_T5],
121
+ ) -> _ValidatorType[_T1 | _T2 | _T3 | _T4 | _T5]: ...
122
+ @overload
123
+ def or_(
124
+ __v1: _ValidatorType[_T1],
125
+ __v2: _ValidatorType[_T2],
126
+ __v3: _ValidatorType[_T3],
127
+ __v4: _ValidatorType[_T4],
128
+ __v5: _ValidatorType[_T5],
129
+ __v6: _ValidatorType[_T6],
130
+ ) -> _ValidatorType[_T1 | _T2 | _T3 | _T4 | _T5 | _T6]: ...
131
+ @overload
132
+ def or_(
133
+ __v1: _ValidatorType[Any],
134
+ __v2: _ValidatorType[Any],
135
+ __v3: _ValidatorType[Any],
136
+ __v4: _ValidatorType[Any],
137
+ __v5: _ValidatorType[Any],
138
+ __v6: _ValidatorType[Any],
139
+ *validators: _ValidatorType[Any],
140
+ ) -> _ValidatorType[Any]: ...
.venv/lib/python3.10/site-packages/backports/__init__.py ADDED
@@ -0,0 +1 @@
 
 
1
+ __path__ = __import__('pkgutil').extend_path(__path__, __name__) # type: ignore
.venv/lib/python3.10/site-packages/backports/__pycache__/__init__.cpython-310.pyc ADDED
Binary file (291 Bytes). View file
 
.venv/lib/python3.10/site-packages/backports/tarfile/__init__.py ADDED
The diff for this file is too large to render. See raw diff
 
.venv/lib/python3.10/site-packages/backports/tarfile/__main__.py ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ from . import main
2
+
3
+
4
+ if __name__ == '__main__':
5
+ main()
.venv/lib/python3.10/site-packages/backports/tarfile/compat/__init__.py ADDED
File without changes
.venv/lib/python3.10/site-packages/backports/tarfile/compat/py38.py ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import sys
2
+
3
+
4
+ if sys.version_info < (3, 9):
5
+
6
+ def removesuffix(self, suffix):
7
+ # suffix='' should not call self[:-0].
8
+ if suffix and self.endswith(suffix):
9
+ return self[: -len(suffix)]
10
+ else:
11
+ return self[:]
12
+
13
+ def removeprefix(self, prefix):
14
+ if self.startswith(prefix):
15
+ return self[len(prefix) :]
16
+ else:
17
+ return self[:]
18
+ else:
19
+
20
+ def removesuffix(self, suffix):
21
+ return self.removesuffix(suffix)
22
+
23
+ def removeprefix(self, prefix):
24
+ return self.removeprefix(prefix)