ZTWHHH commited on
Commit
ac789d9
·
verified ·
1 Parent(s): 4bcbd8a

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. .gitattributes +1 -0
  2. falcon/lib/python3.10/site-packages/setuptools/_vendor/autocommand-2.2.2.dist-info/METADATA +420 -0
  3. falcon/lib/python3.10/site-packages/setuptools/_vendor/backports.tarfile-1.2.0.dist-info/INSTALLER +1 -0
  4. falcon/lib/python3.10/site-packages/setuptools/_vendor/backports.tarfile-1.2.0.dist-info/LICENSE +17 -0
  5. falcon/lib/python3.10/site-packages/setuptools/_vendor/backports.tarfile-1.2.0.dist-info/METADATA +46 -0
  6. falcon/lib/python3.10/site-packages/setuptools/_vendor/backports.tarfile-1.2.0.dist-info/RECORD +17 -0
  7. falcon/lib/python3.10/site-packages/setuptools/_vendor/backports.tarfile-1.2.0.dist-info/REQUESTED +0 -0
  8. falcon/lib/python3.10/site-packages/setuptools/_vendor/backports.tarfile-1.2.0.dist-info/WHEEL +5 -0
  9. falcon/lib/python3.10/site-packages/setuptools/_vendor/backports.tarfile-1.2.0.dist-info/top_level.txt +1 -0
  10. falcon/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata-8.0.0.dist-info/INSTALLER +1 -0
  11. falcon/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata-8.0.0.dist-info/LICENSE +202 -0
  12. falcon/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata-8.0.0.dist-info/METADATA +129 -0
  13. falcon/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata-8.0.0.dist-info/RECORD +32 -0
  14. falcon/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata-8.0.0.dist-info/REQUESTED +0 -0
  15. falcon/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata-8.0.0.dist-info/WHEEL +5 -0
  16. falcon/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata-8.0.0.dist-info/top_level.txt +1 -0
  17. falcon/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata/__init__.py +1083 -0
  18. falcon/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata/__pycache__/__init__.cpython-310.pyc +0 -0
  19. falcon/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata/__pycache__/_adapters.cpython-310.pyc +0 -0
  20. falcon/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata/__pycache__/_collections.cpython-310.pyc +0 -0
  21. falcon/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata/__pycache__/_functools.cpython-310.pyc +0 -0
  22. falcon/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata/__pycache__/_itertools.cpython-310.pyc +0 -0
  23. falcon/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata/__pycache__/_meta.cpython-310.pyc +0 -0
  24. falcon/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata/__pycache__/_text.cpython-310.pyc +0 -0
  25. falcon/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata/__pycache__/diagnose.cpython-310.pyc +0 -0
  26. falcon/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata/_adapters.py +83 -0
  27. falcon/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata/_collections.py +30 -0
  28. falcon/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata/_compat.py +57 -0
  29. falcon/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata/_functools.py +104 -0
  30. falcon/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata/_itertools.py +73 -0
  31. falcon/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata/_meta.py +67 -0
  32. falcon/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata/_text.py +99 -0
  33. falcon/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata/compat/__init__.py +0 -0
  34. falcon/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata/compat/__pycache__/py311.cpython-310.pyc +0 -0
  35. falcon/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata/compat/py311.py +22 -0
  36. falcon/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata/compat/py39.py +36 -0
  37. falcon/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata/diagnose.py +21 -0
  38. falcon/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata/py.typed +0 -0
  39. falcon/lib/python3.10/site-packages/setuptools/_vendor/inflect-7.3.1.dist-info/INSTALLER +1 -0
  40. falcon/lib/python3.10/site-packages/setuptools/_vendor/inflect-7.3.1.dist-info/LICENSE +17 -0
  41. falcon/lib/python3.10/site-packages/setuptools/_vendor/inflect-7.3.1.dist-info/METADATA +591 -0
  42. falcon/lib/python3.10/site-packages/setuptools/_vendor/inflect-7.3.1.dist-info/RECORD +13 -0
  43. falcon/lib/python3.10/site-packages/setuptools/_vendor/inflect-7.3.1.dist-info/WHEEL +5 -0
  44. falcon/lib/python3.10/site-packages/setuptools/_vendor/inflect-7.3.1.dist-info/top_level.txt +1 -0
  45. falcon/lib/python3.10/site-packages/setuptools/_vendor/inflect/compat/__init__.py +0 -0
  46. falcon/lib/python3.10/site-packages/setuptools/_vendor/jaraco.text-3.12.1.dist-info/RECORD +20 -0
  47. falcon/lib/python3.10/site-packages/setuptools/_vendor/jaraco.text-3.12.1.dist-info/REQUESTED +0 -0
  48. falcon/lib/python3.10/site-packages/setuptools/_vendor/jaraco.text-3.12.1.dist-info/WHEEL +5 -0
  49. falcon/lib/python3.10/site-packages/setuptools/_vendor/tomli/__pycache__/_parser.cpython-310.pyc +0 -0
  50. falcon/lib/python3.10/site-packages/setuptools/_vendor/wheel/__init__.py +3 -0
.gitattributes CHANGED
@@ -1278,3 +1278,4 @@ evalkit_tf437/lib/python3.10/site-packages/transformers/__pycache__/training_arg
1278
  evalkit_tf437/lib/python3.10/site-packages/transformers/__pycache__/modeling_outputs.cpython-310.pyc filter=lfs diff=lfs merge=lfs -text
1279
  infer_4_33_0/lib/python3.10/site-packages/nvidia/cuda_nvrtc/lib/libnvrtc.so.11.2 filter=lfs diff=lfs merge=lfs -text
1280
  falcon/lib/python3.10/site-packages/setuptools/_vendor/more_itertools/__pycache__/more.cpython-310.pyc filter=lfs diff=lfs merge=lfs -text
 
 
1278
  evalkit_tf437/lib/python3.10/site-packages/transformers/__pycache__/modeling_outputs.cpython-310.pyc filter=lfs diff=lfs merge=lfs -text
1279
  infer_4_33_0/lib/python3.10/site-packages/nvidia/cuda_nvrtc/lib/libnvrtc.so.11.2 filter=lfs diff=lfs merge=lfs -text
1280
  falcon/lib/python3.10/site-packages/setuptools/_vendor/more_itertools/__pycache__/more.cpython-310.pyc filter=lfs diff=lfs merge=lfs -text
1281
+ falcon/lib/python3.10/site-packages/sklearn/preprocessing/__pycache__/_data.cpython-310.pyc filter=lfs diff=lfs merge=lfs -text
falcon/lib/python3.10/site-packages/setuptools/_vendor/autocommand-2.2.2.dist-info/METADATA ADDED
@@ -0,0 +1,420 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Metadata-Version: 2.1
2
+ Name: autocommand
3
+ Version: 2.2.2
4
+ Summary: A library to create a command-line program from a function
5
+ Home-page: https://github.com/Lucretiel/autocommand
6
+ Author: Nathan West
7
+ License: LGPLv3
8
+ Project-URL: Homepage, https://github.com/Lucretiel/autocommand
9
+ Project-URL: Bug Tracker, https://github.com/Lucretiel/autocommand/issues
10
+ Platform: any
11
+ Classifier: Development Status :: 6 - Mature
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)
14
+ Classifier: Programming Language :: Python
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3 :: Only
17
+ Classifier: Topic :: Software Development
18
+ Classifier: Topic :: Software Development :: Libraries
19
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
20
+ Requires-Python: >=3.7
21
+ Description-Content-Type: text/markdown
22
+ License-File: LICENSE
23
+
24
+ [![PyPI version](https://badge.fury.io/py/autocommand.svg)](https://badge.fury.io/py/autocommand)
25
+
26
+ # autocommand
27
+
28
+ A library to automatically generate and run simple argparse parsers from function signatures.
29
+
30
+ ## Installation
31
+
32
+ Autocommand is installed via pip:
33
+
34
+ ```
35
+ $ pip install autocommand
36
+ ```
37
+
38
+ ## Usage
39
+
40
+ Autocommand turns a function into a command-line program. It converts the function's parameter signature into command-line arguments, and automatically runs the function if the module was called as `__main__`. In effect, it lets your create a smart main function.
41
+
42
+ ```python
43
+ from autocommand import autocommand
44
+
45
+ # This program takes exactly one argument and echos it.
46
+ @autocommand(__name__)
47
+ def echo(thing):
48
+ print(thing)
49
+ ```
50
+
51
+ ```
52
+ $ python echo.py hello
53
+ hello
54
+ $ python echo.py -h
55
+ usage: echo [-h] thing
56
+
57
+ positional arguments:
58
+ thing
59
+
60
+ optional arguments:
61
+ -h, --help show this help message and exit
62
+ $ python echo.py hello world # too many arguments
63
+ usage: echo.py [-h] thing
64
+ echo.py: error: unrecognized arguments: world
65
+ ```
66
+
67
+ As you can see, autocommand converts the signature of the function into an argument spec. When you run the file as a program, autocommand collects the command-line arguments and turns them into function arguments. The function is executed with these arguments, and then the program exits with the return value of the function, via `sys.exit`. Autocommand also automatically creates a usage message, which can be invoked with `-h` or `--help`, and automatically prints an error message when provided with invalid arguments.
68
+
69
+ ### Types
70
+
71
+ You can use a type annotation to give an argument a type. Any type (or in fact any callable) that returns an object when given a string argument can be used, though there are a few special cases that are described later.
72
+
73
+ ```python
74
+ @autocommand(__name__)
75
+ def net_client(host, port: int):
76
+ ...
77
+ ```
78
+
79
+ Autocommand will catch `TypeErrors` raised by the type during argument parsing, so you can supply a callable and do some basic argument validation as well.
80
+
81
+ ### Trailing Arguments
82
+
83
+ You can add a `*args` parameter to your function to give it trailing arguments. The command will collect 0 or more trailing arguments and supply them to `args` as a tuple. If a type annotation is supplied, the type is applied to each argument.
84
+
85
+ ```python
86
+ # Write the contents of each file, one by one
87
+ @autocommand(__name__)
88
+ def cat(*files):
89
+ for filename in files:
90
+ with open(filename) as file:
91
+ for line in file:
92
+ print(line.rstrip())
93
+ ```
94
+
95
+ ```
96
+ $ python cat.py -h
97
+ usage: ipython [-h] [file [file ...]]
98
+
99
+ positional arguments:
100
+ file
101
+
102
+ optional arguments:
103
+ -h, --help show this help message and exit
104
+ ```
105
+
106
+ ### Options
107
+
108
+ To create `--option` switches, just assign a default. Autocommand will automatically create `--long` and `-s`hort switches.
109
+
110
+ ```python
111
+ @autocommand(__name__)
112
+ def do_with_config(argument, config='~/foo.conf'):
113
+ pass
114
+ ```
115
+
116
+ ```
117
+ $ python example.py -h
118
+ usage: example.py [-h] [-c CONFIG] argument
119
+
120
+ positional arguments:
121
+ argument
122
+
123
+ optional arguments:
124
+ -h, --help show this help message and exit
125
+ -c CONFIG, --config CONFIG
126
+ ```
127
+
128
+ The option's type is automatically deduced from the default, unless one is explicitly given in an annotation:
129
+
130
+ ```python
131
+ @autocommand(__name__)
132
+ def http_connect(host, port=80):
133
+ print('{}:{}'.format(host, port))
134
+ ```
135
+
136
+ ```
137
+ $ python http.py -h
138
+ usage: http.py [-h] [-p PORT] host
139
+
140
+ positional arguments:
141
+ host
142
+
143
+ optional arguments:
144
+ -h, --help show this help message and exit
145
+ -p PORT, --port PORT
146
+ $ python http.py localhost
147
+ localhost:80
148
+ $ python http.py localhost -p 8080
149
+ localhost:8080
150
+ $ python http.py localhost -p blah
151
+ usage: http.py [-h] [-p PORT] host
152
+ http.py: error: argument -p/--port: invalid int value: 'blah'
153
+ ```
154
+
155
+ #### None
156
+
157
+ If an option is given a default value of `None`, it reads in a value as normal, but supplies `None` if the option isn't provided.
158
+
159
+ #### Switches
160
+
161
+ If an argument is given a default value of `True` or `False`, or
162
+ given an explicit `bool` type, it becomes an option switch.
163
+
164
+ ```python
165
+ @autocommand(__name__)
166
+ def example(verbose=False, quiet=False):
167
+ pass
168
+ ```
169
+
170
+ ```
171
+ $ python example.py -h
172
+ usage: example.py [-h] [-v] [-q]
173
+
174
+ optional arguments:
175
+ -h, --help show this help message and exit
176
+ -v, --verbose
177
+ -q, --quiet
178
+ ```
179
+
180
+ Autocommand attempts to do the "correct thing" in these cases- if the default is `True`, then supplying the switch makes the argument `False`; if the type is `bool` and the default is some other `True` value, then supplying the switch makes the argument `False`, while not supplying the switch makes the argument the default value.
181
+
182
+ Autocommand also supports the creation of switch inverters. Pass `add_nos=True` to `autocommand` to enable this.
183
+
184
+ ```
185
+ @autocommand(__name__, add_nos=True)
186
+ def example(verbose=False):
187
+ pass
188
+ ```
189
+
190
+ ```
191
+ $ python example.py -h
192
+ usage: ipython [-h] [-v] [--no-verbose]
193
+
194
+ optional arguments:
195
+ -h, --help show this help message and exit
196
+ -v, --verbose
197
+ --no-verbose
198
+ ```
199
+
200
+ Using the `--no-` version of a switch will pass the opposite value in as a function argument. If multiple switches are present, the last one takes precedence.
201
+
202
+ #### Files
203
+
204
+ If the default value is a file object, such as `sys.stdout`, then autocommand just looks for a string, for a file path. It doesn't do any special checking on the string, though (such as checking if the file exists); it's better to let the client decide how to handle errors in this case. Instead, it provides a special context manager called `smart_open`, which behaves exactly like `open` if a filename or other openable type is provided, but also lets you use already open files:
205
+
206
+ ```python
207
+ from autocommand import autocommand, smart_open
208
+ import sys
209
+
210
+ # Write the contents of stdin, or a file, to stdout
211
+ @autocommand(__name__)
212
+ def write_out(infile=sys.stdin):
213
+ with smart_open(infile) as f:
214
+ for line in f:
215
+ print(line.rstrip())
216
+ # If a file was opened, it is closed here. If it was just stdin, it is untouched.
217
+ ```
218
+
219
+ ```
220
+ $ echo "Hello World!" | python write_out.py | tee hello.txt
221
+ Hello World!
222
+ $ python write_out.py --infile hello.txt
223
+ Hello World!
224
+ ```
225
+
226
+ ### Descriptions and docstrings
227
+
228
+ The `autocommand` decorator accepts `description` and `epilog` kwargs, corresponding to the `description <https://docs.python.org/3/library/argparse.html#description>`_ and `epilog <https://docs.python.org/3/library/argparse.html#epilog>`_ of the `ArgumentParser`. If no description is given, but the decorated function has a docstring, then it is taken as the `description` for the `ArgumentParser`. You can also provide both the description and epilog in the docstring by splitting it into two sections with 4 or more - characters.
229
+
230
+ ```python
231
+ @autocommand(__name__)
232
+ def copy(infile=sys.stdin, outfile=sys.stdout):
233
+ '''
234
+ Copy an the contents of a file (or stdin) to another file (or stdout)
235
+ ----------
236
+ Some extra documentation in the epilog
237
+ '''
238
+ with smart_open(infile) as istr:
239
+ with smart_open(outfile, 'w') as ostr:
240
+ for line in istr:
241
+ ostr.write(line)
242
+ ```
243
+
244
+ ```
245
+ $ python copy.py -h
246
+ usage: copy.py [-h] [-i INFILE] [-o OUTFILE]
247
+
248
+ Copy an the contents of a file (or stdin) to another file (or stdout)
249
+
250
+ optional arguments:
251
+ -h, --help show this help message and exit
252
+ -i INFILE, --infile INFILE
253
+ -o OUTFILE, --outfile OUTFILE
254
+
255
+ Some extra documentation in the epilog
256
+ $ echo "Hello World" | python copy.py --outfile hello.txt
257
+ $ python copy.py --infile hello.txt --outfile hello2.txt
258
+ $ python copy.py --infile hello2.txt
259
+ Hello World
260
+ ```
261
+
262
+ ### Parameter descriptions
263
+
264
+ You can also attach description text to individual parameters in the annotation. To attach both a type and a description, supply them both in any order in a tuple
265
+
266
+ ```python
267
+ @autocommand(__name__)
268
+ def copy_net(
269
+ infile: 'The name of the file to send',
270
+ host: 'The host to send the file to',
271
+ port: (int, 'The port to connect to')):
272
+
273
+ '''
274
+ Copy a file over raw TCP to a remote destination.
275
+ '''
276
+ # Left as an exercise to the reader
277
+ ```
278
+
279
+ ### Decorators and wrappers
280
+
281
+ Autocommand automatically follows wrapper chains created by `@functools.wraps`. This means that you can apply other wrapping decorators to your main function, and autocommand will still correctly detect the signature.
282
+
283
+ ```python
284
+ from functools import wraps
285
+ from autocommand import autocommand
286
+
287
+ def print_yielded(func):
288
+ '''
289
+ Convert a generator into a function that prints all yielded elements
290
+ '''
291
+ @wraps(func)
292
+ def wrapper(*args, **kwargs):
293
+ for thing in func(*args, **kwargs):
294
+ print(thing)
295
+ return wrapper
296
+
297
+ @autocommand(__name__,
298
+ description= 'Print all the values from START to STOP, inclusive, in steps of STEP',
299
+ epilog= 'STOP and STEP default to 1')
300
+ @print_yielded
301
+ def seq(stop, start=1, step=1):
302
+ for i in range(start, stop + 1, step):
303
+ yield i
304
+ ```
305
+
306
+ ```
307
+ $ seq.py -h
308
+ usage: seq.py [-h] [-s START] [-S STEP] stop
309
+
310
+ Print all the values from START to STOP, inclusive, in steps of STEP
311
+
312
+ positional arguments:
313
+ stop
314
+
315
+ optional arguments:
316
+ -h, --help show this help message and exit
317
+ -s START, --start START
318
+ -S STEP, --step STEP
319
+
320
+ STOP and STEP default to 1
321
+ ```
322
+
323
+ Even though autocommand is being applied to the `wrapper` returned by `print_yielded`, it still retreives the signature of the underlying `seq` function to create the argument parsing.
324
+
325
+ ### Custom Parser
326
+
327
+ While autocommand's automatic parser generator is a powerful convenience, it doesn't cover all of the different features that argparse provides. If you need these features, you can provide your own parser as a kwarg to `autocommand`:
328
+
329
+ ```python
330
+ from argparse import ArgumentParser
331
+ from autocommand import autocommand
332
+
333
+ parser = ArgumentParser()
334
+ # autocommand can't do optional positonal parameters
335
+ parser.add_argument('arg', nargs='?')
336
+ # or mutually exclusive options
337
+ group = parser.add_mutually_exclusive_group()
338
+ group.add_argument('-v', '--verbose', action='store_true')
339
+ group.add_argument('-q', '--quiet', action='store_true')
340
+
341
+ @autocommand(__name__, parser=parser)
342
+ def main(arg, verbose, quiet):
343
+ print(arg, verbose, quiet)
344
+ ```
345
+
346
+ ```
347
+ $ python parser.py -h
348
+ usage: write_file.py [-h] [-v | -q] [arg]
349
+
350
+ positional arguments:
351
+ arg
352
+
353
+ optional arguments:
354
+ -h, --help show this help message and exit
355
+ -v, --verbose
356
+ -q, --quiet
357
+ $ python parser.py
358
+ None False False
359
+ $ python parser.py hello
360
+ hello False False
361
+ $ python parser.py -v
362
+ None True False
363
+ $ python parser.py -q
364
+ None False True
365
+ $ python parser.py -vq
366
+ usage: parser.py [-h] [-v | -q] [arg]
367
+ parser.py: error: argument -q/--quiet: not allowed with argument -v/--verbose
368
+ ```
369
+
370
+ Any parser should work fine, so long as each of the parser's arguments has a corresponding parameter in the decorated main function. The order of parameters doesn't matter, as long as they are all present. Note that when using a custom parser, autocommand doesn't modify the parser or the retrieved arguments. This means that no description/epilog will be added, and the function's type annotations and defaults (if present) will be ignored.
371
+
372
+ ## Testing and Library use
373
+
374
+ The decorated function is only called and exited from if the first argument to `autocommand` is `'__main__'` or `True`. If it is neither of these values, or no argument is given, then a new main function is created by the decorator. This function has the signature `main(argv=None)`, and is intended to be called with arguments as if via `main(sys.argv[1:])`. The function has the attributes `parser` and `main`, which are the generated `ArgumentParser` and the original main function that was decorated. This is to facilitate testing and library use of your main. Calling the function triggers a `parse_args()` with the supplied arguments, and returns the result of the main function. Note that, while it returns instead of calling `sys.exit`, the `parse_args()` function will raise a `SystemExit` in the event of a parsing error or `-h/--help` argument.
375
+
376
+ ```python
377
+ @autocommand()
378
+ def test_prog(arg1, arg2: int, quiet=False, verbose=False):
379
+ if not quiet:
380
+ print(arg1, arg2)
381
+ if verbose:
382
+ print("LOUD NOISES")
383
+
384
+ return 0
385
+
386
+ print(test_prog(['-v', 'hello', '80']))
387
+ ```
388
+
389
+ ```
390
+ $ python test_prog.py
391
+ hello 80
392
+ LOUD NOISES
393
+ 0
394
+ ```
395
+
396
+ If the function is called with no arguments, `sys.argv[1:]` is used. This is to allow the autocommand function to be used as a setuptools entry point.
397
+
398
+ ## Exceptions and limitations
399
+
400
+ - There are a few possible exceptions that `autocommand` can raise. All of them derive from `autocommand.AutocommandError`.
401
+
402
+ - If an invalid annotation is given (that is, it isn't a `type`, `str`, `(type, str)`, or `(str, type)`, an `AnnotationError` is raised. The `type` may be any callable, as described in the `Types`_ section.
403
+ - If the function has a `**kwargs` parameter, a `KWargError` is raised.
404
+ - If, somehow, the function has a positional-only parameter, a `PositionalArgError` is raised. This means that the argument doesn't have a name, which is currently not possible with a plain `def` or `lambda`, though many built-in functions have this kind of parameter.
405
+
406
+ - There are a few argparse features that are not supported by autocommand.
407
+
408
+ - It isn't possible to have an optional positional argument (as opposed to a `--option`). POSIX thinks this is bad form anyway.
409
+ - It isn't possible to have mutually exclusive arguments or options
410
+ - It isn't possible to have subcommands or subparsers, though I'm working on a few solutions involving classes or nested function definitions to allow this.
411
+
412
+ ## Development
413
+
414
+ Autocommand cannot be important from the project root; this is to enforce separation of concerns and prevent accidental importing of `setup.py` or tests. To develop, install the project in editable mode:
415
+
416
+ ```
417
+ $ python setup.py develop
418
+ ```
419
+
420
+ This will create a link to the source files in the deployment directory, so that any source changes are reflected when it is imported.
falcon/lib/python3.10/site-packages/setuptools/_vendor/backports.tarfile-1.2.0.dist-info/INSTALLER ADDED
@@ -0,0 +1 @@
 
 
1
+ conda
falcon/lib/python3.10/site-packages/setuptools/_vendor/backports.tarfile-1.2.0.dist-info/LICENSE ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Permission is hereby granted, free of charge, to any person obtaining a copy
2
+ of this software and associated documentation files (the "Software"), to
3
+ deal in the Software without restriction, including without limitation the
4
+ rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
5
+ sell copies of the Software, and to permit persons to whom the Software is
6
+ furnished to do so, subject to the following conditions:
7
+
8
+ The above copyright notice and this permission notice shall be included in
9
+ all copies or substantial portions of the Software.
10
+
11
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
12
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
14
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
15
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
16
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
17
+ IN THE SOFTWARE.
falcon/lib/python3.10/site-packages/setuptools/_vendor/backports.tarfile-1.2.0.dist-info/METADATA ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Metadata-Version: 2.1
2
+ Name: backports.tarfile
3
+ Version: 1.2.0
4
+ Summary: Backport of CPython tarfile module
5
+ Author-email: "Jason R. Coombs" <jaraco@jaraco.com>
6
+ Project-URL: Homepage, https://github.com/jaraco/backports.tarfile
7
+ Classifier: Development Status :: 5 - Production/Stable
8
+ Classifier: Intended Audience :: Developers
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Programming Language :: Python :: 3 :: Only
12
+ Requires-Python: >=3.8
13
+ Description-Content-Type: text/x-rst
14
+ License-File: LICENSE
15
+ Provides-Extra: docs
16
+ Requires-Dist: sphinx >=3.5 ; extra == 'docs'
17
+ Requires-Dist: jaraco.packaging >=9.3 ; extra == 'docs'
18
+ Requires-Dist: rst.linker >=1.9 ; extra == 'docs'
19
+ Requires-Dist: furo ; extra == 'docs'
20
+ Requires-Dist: sphinx-lint ; extra == 'docs'
21
+ Provides-Extra: testing
22
+ Requires-Dist: pytest !=8.1.*,>=6 ; extra == 'testing'
23
+ Requires-Dist: pytest-checkdocs >=2.4 ; extra == 'testing'
24
+ Requires-Dist: pytest-cov ; extra == 'testing'
25
+ Requires-Dist: pytest-enabler >=2.2 ; extra == 'testing'
26
+ Requires-Dist: jaraco.test ; extra == 'testing'
27
+ Requires-Dist: pytest !=8.0.* ; extra == 'testing'
28
+
29
+ .. image:: https://img.shields.io/pypi/v/backports.tarfile.svg
30
+ :target: https://pypi.org/project/backports.tarfile
31
+
32
+ .. image:: https://img.shields.io/pypi/pyversions/backports.tarfile.svg
33
+
34
+ .. image:: https://github.com/jaraco/backports.tarfile/actions/workflows/main.yml/badge.svg
35
+ :target: https://github.com/jaraco/backports.tarfile/actions?query=workflow%3A%22tests%22
36
+ :alt: tests
37
+
38
+ .. image:: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v2.json
39
+ :target: https://github.com/astral-sh/ruff
40
+ :alt: Ruff
41
+
42
+ .. .. image:: https://readthedocs.org/projects/backportstarfile/badge/?version=latest
43
+ .. :target: https://backportstarfile.readthedocs.io/en/latest/?badge=latest
44
+
45
+ .. image:: https://img.shields.io/badge/skeleton-2024-informational
46
+ :target: https://blog.jaraco.com/skeleton
falcon/lib/python3.10/site-packages/setuptools/_vendor/backports.tarfile-1.2.0.dist-info/RECORD ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ backports.tarfile-1.2.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
2
+ backports.tarfile-1.2.0.dist-info/LICENSE,sha256=htoPAa6uRjSKPD1GUZXcHOzN55956HdppkuNoEsqR0E,1023
3
+ backports.tarfile-1.2.0.dist-info/METADATA,sha256=ghXFTq132dxaEIolxr3HK1mZqm9iyUmaRANZQSr6WlE,2020
4
+ backports.tarfile-1.2.0.dist-info/RECORD,,
5
+ backports.tarfile-1.2.0.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
+ backports.tarfile-1.2.0.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
7
+ backports.tarfile-1.2.0.dist-info/top_level.txt,sha256=cGjaLMOoBR1FK0ApojtzWVmViTtJ7JGIK_HwXiEsvtU,10
8
+ backports/__init__.py,sha256=iOEMwnlORWezdO8-2vxBIPSR37D7JGjluZ8f55vzxls,81
9
+ backports/__pycache__/__init__.cpython-312.pyc,,
10
+ backports/tarfile/__init__.py,sha256=Pwf2qUIfB0SolJPCKcx3vz3UEu_aids4g4sAfxy94qg,108491
11
+ backports/tarfile/__main__.py,sha256=Yw2oGT1afrz2eBskzdPYL8ReB_3liApmhFkN2EbDmc4,59
12
+ backports/tarfile/__pycache__/__init__.cpython-312.pyc,,
13
+ backports/tarfile/__pycache__/__main__.cpython-312.pyc,,
14
+ backports/tarfile/compat/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
15
+ backports/tarfile/compat/__pycache__/__init__.cpython-312.pyc,,
16
+ backports/tarfile/compat/__pycache__/py38.cpython-312.pyc,,
17
+ backports/tarfile/compat/py38.py,sha256=iYkyt_gvWjLzGUTJD9TuTfMMjOk-ersXZmRlvQYN2qE,568
falcon/lib/python3.10/site-packages/setuptools/_vendor/backports.tarfile-1.2.0.dist-info/REQUESTED ADDED
File without changes
falcon/lib/python3.10/site-packages/setuptools/_vendor/backports.tarfile-1.2.0.dist-info/WHEEL ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ Wheel-Version: 1.0
2
+ Generator: bdist_wheel (0.43.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
falcon/lib/python3.10/site-packages/setuptools/_vendor/backports.tarfile-1.2.0.dist-info/top_level.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ backports
falcon/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata-8.0.0.dist-info/INSTALLER ADDED
@@ -0,0 +1 @@
 
 
1
+ conda
falcon/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata-8.0.0.dist-info/LICENSE ADDED
@@ -0,0 +1,202 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ 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
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
falcon/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata-8.0.0.dist-info/METADATA ADDED
@@ -0,0 +1,129 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Metadata-Version: 2.1
2
+ Name: importlib_metadata
3
+ Version: 8.0.0
4
+ Summary: Read metadata from Python packages
5
+ Author-email: "Jason R. Coombs" <jaraco@jaraco.com>
6
+ Project-URL: Source, https://github.com/python/importlib_metadata
7
+ Classifier: Development Status :: 5 - Production/Stable
8
+ Classifier: Intended Audience :: Developers
9
+ Classifier: License :: OSI Approved :: Apache Software License
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Programming Language :: Python :: 3 :: Only
12
+ Requires-Python: >=3.8
13
+ Description-Content-Type: text/x-rst
14
+ License-File: LICENSE
15
+ Requires-Dist: zipp >=0.5
16
+ Requires-Dist: typing-extensions >=3.6.4 ; python_version < "3.8"
17
+ Provides-Extra: doc
18
+ Requires-Dist: sphinx >=3.5 ; extra == 'doc'
19
+ Requires-Dist: jaraco.packaging >=9.3 ; extra == 'doc'
20
+ Requires-Dist: rst.linker >=1.9 ; extra == 'doc'
21
+ Requires-Dist: furo ; extra == 'doc'
22
+ Requires-Dist: sphinx-lint ; extra == 'doc'
23
+ Requires-Dist: jaraco.tidelift >=1.4 ; extra == 'doc'
24
+ Provides-Extra: perf
25
+ Requires-Dist: ipython ; extra == 'perf'
26
+ Provides-Extra: test
27
+ Requires-Dist: pytest !=8.1.*,>=6 ; extra == 'test'
28
+ Requires-Dist: pytest-checkdocs >=2.4 ; extra == 'test'
29
+ Requires-Dist: pytest-cov ; extra == 'test'
30
+ Requires-Dist: pytest-mypy ; extra == 'test'
31
+ Requires-Dist: pytest-enabler >=2.2 ; extra == 'test'
32
+ Requires-Dist: pytest-ruff >=0.2.1 ; extra == 'test'
33
+ Requires-Dist: packaging ; extra == 'test'
34
+ Requires-Dist: pyfakefs ; extra == 'test'
35
+ Requires-Dist: flufl.flake8 ; extra == 'test'
36
+ Requires-Dist: pytest-perf >=0.9.2 ; extra == 'test'
37
+ Requires-Dist: jaraco.test >=5.4 ; extra == 'test'
38
+ Requires-Dist: importlib-resources >=1.3 ; (python_version < "3.9") and extra == 'test'
39
+
40
+ .. image:: https://img.shields.io/pypi/v/importlib_metadata.svg
41
+ :target: https://pypi.org/project/importlib_metadata
42
+
43
+ .. image:: https://img.shields.io/pypi/pyversions/importlib_metadata.svg
44
+
45
+ .. image:: https://github.com/python/importlib_metadata/actions/workflows/main.yml/badge.svg
46
+ :target: https://github.com/python/importlib_metadata/actions?query=workflow%3A%22tests%22
47
+ :alt: tests
48
+
49
+ .. image:: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v2.json
50
+ :target: https://github.com/astral-sh/ruff
51
+ :alt: Ruff
52
+
53
+ .. image:: https://readthedocs.org/projects/importlib-metadata/badge/?version=latest
54
+ :target: https://importlib-metadata.readthedocs.io/en/latest/?badge=latest
55
+
56
+ .. image:: https://img.shields.io/badge/skeleton-2024-informational
57
+ :target: https://blog.jaraco.com/skeleton
58
+
59
+ .. image:: https://tidelift.com/badges/package/pypi/importlib-metadata
60
+ :target: https://tidelift.com/subscription/pkg/pypi-importlib-metadata?utm_source=pypi-importlib-metadata&utm_medium=readme
61
+
62
+ Library to access the metadata for a Python package.
63
+
64
+ This package supplies third-party access to the functionality of
65
+ `importlib.metadata <https://docs.python.org/3/library/importlib.metadata.html>`_
66
+ including improvements added to subsequent Python versions.
67
+
68
+
69
+ Compatibility
70
+ =============
71
+
72
+ New features are introduced in this third-party library and later merged
73
+ into CPython. The following table indicates which versions of this library
74
+ were contributed to different versions in the standard library:
75
+
76
+ .. list-table::
77
+ :header-rows: 1
78
+
79
+ * - importlib_metadata
80
+ - stdlib
81
+ * - 7.0
82
+ - 3.13
83
+ * - 6.5
84
+ - 3.12
85
+ * - 4.13
86
+ - 3.11
87
+ * - 4.6
88
+ - 3.10
89
+ * - 1.4
90
+ - 3.8
91
+
92
+
93
+ Usage
94
+ =====
95
+
96
+ See the `online documentation <https://importlib-metadata.readthedocs.io/>`_
97
+ for usage details.
98
+
99
+ `Finder authors
100
+ <https://docs.python.org/3/reference/import.html#finders-and-loaders>`_ can
101
+ also add support for custom package installers. See the above documentation
102
+ for details.
103
+
104
+
105
+ Caveats
106
+ =======
107
+
108
+ This project primarily supports third-party packages installed by PyPA
109
+ tools (or other conforming packages). It does not support:
110
+
111
+ - Packages in the stdlib.
112
+ - Packages installed without metadata.
113
+
114
+ Project details
115
+ ===============
116
+
117
+ * Project home: https://github.com/python/importlib_metadata
118
+ * Report bugs at: https://github.com/python/importlib_metadata/issues
119
+ * Code hosting: https://github.com/python/importlib_metadata
120
+ * Documentation: https://importlib-metadata.readthedocs.io/
121
+
122
+ For Enterprise
123
+ ==============
124
+
125
+ Available as part of the Tidelift Subscription.
126
+
127
+ This project and the maintainers of thousands of other packages are working with Tidelift to deliver one enterprise subscription that covers all of the open source you use.
128
+
129
+ `Learn more <https://tidelift.com/subscription/pkg/pypi-importlib-metadata?utm_source=pypi-importlib-metadata&utm_medium=referral&utm_campaign=github>`_.
falcon/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata-8.0.0.dist-info/RECORD ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ importlib_metadata-8.0.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
2
+ importlib_metadata-8.0.0.dist-info/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
3
+ importlib_metadata-8.0.0.dist-info/METADATA,sha256=anuQ7_7h4J1bSEzfcjIBakPi2cyVQ7y7jklLHsBeH1k,4648
4
+ importlib_metadata-8.0.0.dist-info/RECORD,,
5
+ importlib_metadata-8.0.0.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
+ importlib_metadata-8.0.0.dist-info/WHEEL,sha256=mguMlWGMX-VHnMpKOjjQidIo1ssRlCFu4a4mBpz1s2M,91
7
+ importlib_metadata-8.0.0.dist-info/top_level.txt,sha256=CO3fD9yylANiXkrMo4qHLV_mqXL2sC5JFKgt1yWAT-A,19
8
+ importlib_metadata/__init__.py,sha256=tZNB-23h8Bixi9uCrQqj9Yf0aeC--Josdy3IZRIQeB0,33798
9
+ importlib_metadata/__pycache__/__init__.cpython-312.pyc,,
10
+ importlib_metadata/__pycache__/_adapters.cpython-312.pyc,,
11
+ importlib_metadata/__pycache__/_collections.cpython-312.pyc,,
12
+ importlib_metadata/__pycache__/_compat.cpython-312.pyc,,
13
+ importlib_metadata/__pycache__/_functools.cpython-312.pyc,,
14
+ importlib_metadata/__pycache__/_itertools.cpython-312.pyc,,
15
+ importlib_metadata/__pycache__/_meta.cpython-312.pyc,,
16
+ importlib_metadata/__pycache__/_text.cpython-312.pyc,,
17
+ importlib_metadata/__pycache__/diagnose.cpython-312.pyc,,
18
+ importlib_metadata/_adapters.py,sha256=rIhWTwBvYA1bV7i-5FfVX38qEXDTXFeS5cb5xJtP3ks,2317
19
+ importlib_metadata/_collections.py,sha256=CJ0OTCHIjWA0ZIVS4voORAsn2R4R2cQBEtPsZEJpASY,743
20
+ importlib_metadata/_compat.py,sha256=73QKrN9KNoaZzhbX5yPCCZa-FaALwXe8TPlDR72JgBU,1314
21
+ importlib_metadata/_functools.py,sha256=PsY2-4rrKX4RVeRC1oGp1lB1pmC9eKN88_f-bD9uOoA,2895
22
+ importlib_metadata/_itertools.py,sha256=cvr_2v8BRbxcIl5x5ldfqdHjhI8Yi8s8yk50G_nm6jQ,2068
23
+ importlib_metadata/_meta.py,sha256=nxZ7C8GVlcBFAKWyVOn_dn7ot_twBcbm1NmvjIetBHI,1801
24
+ importlib_metadata/_text.py,sha256=HCsFksZpJLeTP3NEk_ngrAeXVRRtTrtyh9eOABoRP4A,2166
25
+ importlib_metadata/compat/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
26
+ importlib_metadata/compat/__pycache__/__init__.cpython-312.pyc,,
27
+ importlib_metadata/compat/__pycache__/py311.cpython-312.pyc,,
28
+ importlib_metadata/compat/__pycache__/py39.cpython-312.pyc,,
29
+ importlib_metadata/compat/py311.py,sha256=uqm-K-uohyj1042TH4a9Er_I5o7667DvulcD-gC_fSA,608
30
+ importlib_metadata/compat/py39.py,sha256=cPkMv6-0ilK-0Jw_Tkn0xYbOKJZc4WJKQHow0c2T44w,1102
31
+ importlib_metadata/diagnose.py,sha256=nkSRMiowlmkhLYhKhvCg9glmt_11Cox-EmLzEbqYTa8,379
32
+ importlib_metadata/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
falcon/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata-8.0.0.dist-info/REQUESTED ADDED
File without changes
falcon/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata-8.0.0.dist-info/WHEEL ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (70.1.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
falcon/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata-8.0.0.dist-info/top_level.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ importlib_metadata
falcon/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata/__init__.py ADDED
@@ -0,0 +1,1083 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from __future__ import annotations
2
+
3
+ import os
4
+ import re
5
+ import abc
6
+ import sys
7
+ import json
8
+ import zipp
9
+ import email
10
+ import types
11
+ import inspect
12
+ import pathlib
13
+ import operator
14
+ import textwrap
15
+ import functools
16
+ import itertools
17
+ import posixpath
18
+ import collections
19
+
20
+ from . import _meta
21
+ from .compat import py39, py311
22
+ from ._collections import FreezableDefaultDict, Pair
23
+ from ._compat import (
24
+ NullFinder,
25
+ install,
26
+ )
27
+ from ._functools import method_cache, pass_none
28
+ from ._itertools import always_iterable, unique_everseen
29
+ from ._meta import PackageMetadata, SimplePath
30
+
31
+ from contextlib import suppress
32
+ from importlib import import_module
33
+ from importlib.abc import MetaPathFinder
34
+ from itertools import starmap
35
+ from typing import Any, Iterable, List, Mapping, Match, Optional, Set, cast
36
+
37
+ __all__ = [
38
+ 'Distribution',
39
+ 'DistributionFinder',
40
+ 'PackageMetadata',
41
+ 'PackageNotFoundError',
42
+ 'distribution',
43
+ 'distributions',
44
+ 'entry_points',
45
+ 'files',
46
+ 'metadata',
47
+ 'packages_distributions',
48
+ 'requires',
49
+ 'version',
50
+ ]
51
+
52
+
53
+ class PackageNotFoundError(ModuleNotFoundError):
54
+ """The package was not found."""
55
+
56
+ def __str__(self) -> str:
57
+ return f"No package metadata was found for {self.name}"
58
+
59
+ @property
60
+ def name(self) -> str: # type: ignore[override]
61
+ (name,) = self.args
62
+ return name
63
+
64
+
65
+ class Sectioned:
66
+ """
67
+ A simple entry point config parser for performance
68
+
69
+ >>> for item in Sectioned.read(Sectioned._sample):
70
+ ... print(item)
71
+ Pair(name='sec1', value='# comments ignored')
72
+ Pair(name='sec1', value='a = 1')
73
+ Pair(name='sec1', value='b = 2')
74
+ Pair(name='sec2', value='a = 2')
75
+
76
+ >>> res = Sectioned.section_pairs(Sectioned._sample)
77
+ >>> item = next(res)
78
+ >>> item.name
79
+ 'sec1'
80
+ >>> item.value
81
+ Pair(name='a', value='1')
82
+ >>> item = next(res)
83
+ >>> item.value
84
+ Pair(name='b', value='2')
85
+ >>> item = next(res)
86
+ >>> item.name
87
+ 'sec2'
88
+ >>> item.value
89
+ Pair(name='a', value='2')
90
+ >>> list(res)
91
+ []
92
+ """
93
+
94
+ _sample = textwrap.dedent(
95
+ """
96
+ [sec1]
97
+ # comments ignored
98
+ a = 1
99
+ b = 2
100
+
101
+ [sec2]
102
+ a = 2
103
+ """
104
+ ).lstrip()
105
+
106
+ @classmethod
107
+ def section_pairs(cls, text):
108
+ return (
109
+ section._replace(value=Pair.parse(section.value))
110
+ for section in cls.read(text, filter_=cls.valid)
111
+ if section.name is not None
112
+ )
113
+
114
+ @staticmethod
115
+ def read(text, filter_=None):
116
+ lines = filter(filter_, map(str.strip, text.splitlines()))
117
+ name = None
118
+ for value in lines:
119
+ section_match = value.startswith('[') and value.endswith(']')
120
+ if section_match:
121
+ name = value.strip('[]')
122
+ continue
123
+ yield Pair(name, value)
124
+
125
+ @staticmethod
126
+ def valid(line: str):
127
+ return line and not line.startswith('#')
128
+
129
+
130
+ class EntryPoint:
131
+ """An entry point as defined by Python packaging conventions.
132
+
133
+ See `the packaging docs on entry points
134
+ <https://packaging.python.org/specifications/entry-points/>`_
135
+ for more information.
136
+
137
+ >>> ep = EntryPoint(
138
+ ... name=None, group=None, value='package.module:attr [extra1, extra2]')
139
+ >>> ep.module
140
+ 'package.module'
141
+ >>> ep.attr
142
+ 'attr'
143
+ >>> ep.extras
144
+ ['extra1', 'extra2']
145
+ """
146
+
147
+ pattern = re.compile(
148
+ r'(?P<module>[\w.]+)\s*'
149
+ r'(:\s*(?P<attr>[\w.]+)\s*)?'
150
+ r'((?P<extras>\[.*\])\s*)?$'
151
+ )
152
+ """
153
+ A regular expression describing the syntax for an entry point,
154
+ which might look like:
155
+
156
+ - module
157
+ - package.module
158
+ - package.module:attribute
159
+ - package.module:object.attribute
160
+ - package.module:attr [extra1, extra2]
161
+
162
+ Other combinations are possible as well.
163
+
164
+ The expression is lenient about whitespace around the ':',
165
+ following the attr, and following any extras.
166
+ """
167
+
168
+ name: str
169
+ value: str
170
+ group: str
171
+
172
+ dist: Optional[Distribution] = None
173
+
174
+ def __init__(self, name: str, value: str, group: str) -> None:
175
+ vars(self).update(name=name, value=value, group=group)
176
+
177
+ def load(self) -> Any:
178
+ """Load the entry point from its definition. If only a module
179
+ is indicated by the value, return that module. Otherwise,
180
+ return the named object.
181
+ """
182
+ match = cast(Match, self.pattern.match(self.value))
183
+ module = import_module(match.group('module'))
184
+ attrs = filter(None, (match.group('attr') or '').split('.'))
185
+ return functools.reduce(getattr, attrs, module)
186
+
187
+ @property
188
+ def module(self) -> str:
189
+ match = self.pattern.match(self.value)
190
+ assert match is not None
191
+ return match.group('module')
192
+
193
+ @property
194
+ def attr(self) -> str:
195
+ match = self.pattern.match(self.value)
196
+ assert match is not None
197
+ return match.group('attr')
198
+
199
+ @property
200
+ def extras(self) -> List[str]:
201
+ match = self.pattern.match(self.value)
202
+ assert match is not None
203
+ return re.findall(r'\w+', match.group('extras') or '')
204
+
205
+ def _for(self, dist):
206
+ vars(self).update(dist=dist)
207
+ return self
208
+
209
+ def matches(self, **params):
210
+ """
211
+ EntryPoint matches the given parameters.
212
+
213
+ >>> ep = EntryPoint(group='foo', name='bar', value='bing:bong [extra1, extra2]')
214
+ >>> ep.matches(group='foo')
215
+ True
216
+ >>> ep.matches(name='bar', value='bing:bong [extra1, extra2]')
217
+ True
218
+ >>> ep.matches(group='foo', name='other')
219
+ False
220
+ >>> ep.matches()
221
+ True
222
+ >>> ep.matches(extras=['extra1', 'extra2'])
223
+ True
224
+ >>> ep.matches(module='bing')
225
+ True
226
+ >>> ep.matches(attr='bong')
227
+ True
228
+ """
229
+ attrs = (getattr(self, param) for param in params)
230
+ return all(map(operator.eq, params.values(), attrs))
231
+
232
+ def _key(self):
233
+ return self.name, self.value, self.group
234
+
235
+ def __lt__(self, other):
236
+ return self._key() < other._key()
237
+
238
+ def __eq__(self, other):
239
+ return self._key() == other._key()
240
+
241
+ def __setattr__(self, name, value):
242
+ raise AttributeError("EntryPoint objects are immutable.")
243
+
244
+ def __repr__(self):
245
+ return (
246
+ f'EntryPoint(name={self.name!r}, value={self.value!r}, '
247
+ f'group={self.group!r})'
248
+ )
249
+
250
+ def __hash__(self) -> int:
251
+ return hash(self._key())
252
+
253
+
254
+ class EntryPoints(tuple):
255
+ """
256
+ An immutable collection of selectable EntryPoint objects.
257
+ """
258
+
259
+ __slots__ = ()
260
+
261
+ def __getitem__(self, name: str) -> EntryPoint: # type: ignore[override]
262
+ """
263
+ Get the EntryPoint in self matching name.
264
+ """
265
+ try:
266
+ return next(iter(self.select(name=name)))
267
+ except StopIteration:
268
+ raise KeyError(name)
269
+
270
+ def __repr__(self):
271
+ """
272
+ Repr with classname and tuple constructor to
273
+ signal that we deviate from regular tuple behavior.
274
+ """
275
+ return '%s(%r)' % (self.__class__.__name__, tuple(self))
276
+
277
+ def select(self, **params) -> EntryPoints:
278
+ """
279
+ Select entry points from self that match the
280
+ given parameters (typically group and/or name).
281
+ """
282
+ return EntryPoints(ep for ep in self if py39.ep_matches(ep, **params))
283
+
284
+ @property
285
+ def names(self) -> Set[str]:
286
+ """
287
+ Return the set of all names of all entry points.
288
+ """
289
+ return {ep.name for ep in self}
290
+
291
+ @property
292
+ def groups(self) -> Set[str]:
293
+ """
294
+ Return the set of all groups of all entry points.
295
+ """
296
+ return {ep.group for ep in self}
297
+
298
+ @classmethod
299
+ def _from_text_for(cls, text, dist):
300
+ return cls(ep._for(dist) for ep in cls._from_text(text))
301
+
302
+ @staticmethod
303
+ def _from_text(text):
304
+ return (
305
+ EntryPoint(name=item.value.name, value=item.value.value, group=item.name)
306
+ for item in Sectioned.section_pairs(text or '')
307
+ )
308
+
309
+
310
+ class PackagePath(pathlib.PurePosixPath):
311
+ """A reference to a path in a package"""
312
+
313
+ hash: Optional[FileHash]
314
+ size: int
315
+ dist: Distribution
316
+
317
+ def read_text(self, encoding: str = 'utf-8') -> str: # type: ignore[override]
318
+ return self.locate().read_text(encoding=encoding)
319
+
320
+ def read_binary(self) -> bytes:
321
+ return self.locate().read_bytes()
322
+
323
+ def locate(self) -> SimplePath:
324
+ """Return a path-like object for this path"""
325
+ return self.dist.locate_file(self)
326
+
327
+
328
+ class FileHash:
329
+ def __init__(self, spec: str) -> None:
330
+ self.mode, _, self.value = spec.partition('=')
331
+
332
+ def __repr__(self) -> str:
333
+ return f'<FileHash mode: {self.mode} value: {self.value}>'
334
+
335
+
336
+ class Distribution(metaclass=abc.ABCMeta):
337
+ """
338
+ An abstract Python distribution package.
339
+
340
+ Custom providers may derive from this class and define
341
+ the abstract methods to provide a concrete implementation
342
+ for their environment. Some providers may opt to override
343
+ the default implementation of some properties to bypass
344
+ the file-reading mechanism.
345
+ """
346
+
347
+ @abc.abstractmethod
348
+ def read_text(self, filename) -> Optional[str]:
349
+ """Attempt to load metadata file given by the name.
350
+
351
+ Python distribution metadata is organized by blobs of text
352
+ typically represented as "files" in the metadata directory
353
+ (e.g. package-1.0.dist-info). These files include things
354
+ like:
355
+
356
+ - METADATA: The distribution metadata including fields
357
+ like Name and Version and Description.
358
+ - entry_points.txt: A series of entry points as defined in
359
+ `the entry points spec <https://packaging.python.org/en/latest/specifications/entry-points/#file-format>`_.
360
+ - RECORD: A record of files according to
361
+ `this recording spec <https://packaging.python.org/en/latest/specifications/recording-installed-packages/#the-record-file>`_.
362
+
363
+ A package may provide any set of files, including those
364
+ not listed here or none at all.
365
+
366
+ :param filename: The name of the file in the distribution info.
367
+ :return: The text if found, otherwise None.
368
+ """
369
+
370
+ @abc.abstractmethod
371
+ def locate_file(self, path: str | os.PathLike[str]) -> SimplePath:
372
+ """
373
+ Given a path to a file in this distribution, return a SimplePath
374
+ to it.
375
+ """
376
+
377
+ @classmethod
378
+ def from_name(cls, name: str) -> Distribution:
379
+ """Return the Distribution for the given package name.
380
+
381
+ :param name: The name of the distribution package to search for.
382
+ :return: The Distribution instance (or subclass thereof) for the named
383
+ package, if found.
384
+ :raises PackageNotFoundError: When the named package's distribution
385
+ metadata cannot be found.
386
+ :raises ValueError: When an invalid value is supplied for name.
387
+ """
388
+ if not name:
389
+ raise ValueError("A distribution name is required.")
390
+ try:
391
+ return next(iter(cls.discover(name=name)))
392
+ except StopIteration:
393
+ raise PackageNotFoundError(name)
394
+
395
+ @classmethod
396
+ def discover(
397
+ cls, *, context: Optional[DistributionFinder.Context] = None, **kwargs
398
+ ) -> Iterable[Distribution]:
399
+ """Return an iterable of Distribution objects for all packages.
400
+
401
+ Pass a ``context`` or pass keyword arguments for constructing
402
+ a context.
403
+
404
+ :context: A ``DistributionFinder.Context`` object.
405
+ :return: Iterable of Distribution objects for packages matching
406
+ the context.
407
+ """
408
+ if context and kwargs:
409
+ raise ValueError("cannot accept context and kwargs")
410
+ context = context or DistributionFinder.Context(**kwargs)
411
+ return itertools.chain.from_iterable(
412
+ resolver(context) for resolver in cls._discover_resolvers()
413
+ )
414
+
415
+ @staticmethod
416
+ def at(path: str | os.PathLike[str]) -> Distribution:
417
+ """Return a Distribution for the indicated metadata path.
418
+
419
+ :param path: a string or path-like object
420
+ :return: a concrete Distribution instance for the path
421
+ """
422
+ return PathDistribution(pathlib.Path(path))
423
+
424
+ @staticmethod
425
+ def _discover_resolvers():
426
+ """Search the meta_path for resolvers (MetadataPathFinders)."""
427
+ declared = (
428
+ getattr(finder, 'find_distributions', None) for finder in sys.meta_path
429
+ )
430
+ return filter(None, declared)
431
+
432
+ @property
433
+ def metadata(self) -> _meta.PackageMetadata:
434
+ """Return the parsed metadata for this Distribution.
435
+
436
+ The returned object will have keys that name the various bits of
437
+ metadata per the
438
+ `Core metadata specifications <https://packaging.python.org/en/latest/specifications/core-metadata/#core-metadata>`_.
439
+
440
+ Custom providers may provide the METADATA file or override this
441
+ property.
442
+ """
443
+ # deferred for performance (python/cpython#109829)
444
+ from . import _adapters
445
+
446
+ opt_text = (
447
+ self.read_text('METADATA')
448
+ or self.read_text('PKG-INFO')
449
+ # This last clause is here to support old egg-info files. Its
450
+ # effect is to just end up using the PathDistribution's self._path
451
+ # (which points to the egg-info file) attribute unchanged.
452
+ or self.read_text('')
453
+ )
454
+ text = cast(str, opt_text)
455
+ return _adapters.Message(email.message_from_string(text))
456
+
457
+ @property
458
+ def name(self) -> str:
459
+ """Return the 'Name' metadata for the distribution package."""
460
+ return self.metadata['Name']
461
+
462
+ @property
463
+ def _normalized_name(self):
464
+ """Return a normalized version of the name."""
465
+ return Prepared.normalize(self.name)
466
+
467
+ @property
468
+ def version(self) -> str:
469
+ """Return the 'Version' metadata for the distribution package."""
470
+ return self.metadata['Version']
471
+
472
+ @property
473
+ def entry_points(self) -> EntryPoints:
474
+ """
475
+ Return EntryPoints for this distribution.
476
+
477
+ Custom providers may provide the ``entry_points.txt`` file
478
+ or override this property.
479
+ """
480
+ return EntryPoints._from_text_for(self.read_text('entry_points.txt'), self)
481
+
482
+ @property
483
+ def files(self) -> Optional[List[PackagePath]]:
484
+ """Files in this distribution.
485
+
486
+ :return: List of PackagePath for this distribution or None
487
+
488
+ Result is `None` if the metadata file that enumerates files
489
+ (i.e. RECORD for dist-info, or installed-files.txt or
490
+ SOURCES.txt for egg-info) is missing.
491
+ Result may be empty if the metadata exists but is empty.
492
+
493
+ Custom providers are recommended to provide a "RECORD" file (in
494
+ ``read_text``) or override this property to allow for callers to be
495
+ able to resolve filenames provided by the package.
496
+ """
497
+
498
+ def make_file(name, hash=None, size_str=None):
499
+ result = PackagePath(name)
500
+ result.hash = FileHash(hash) if hash else None
501
+ result.size = int(size_str) if size_str else None
502
+ result.dist = self
503
+ return result
504
+
505
+ @pass_none
506
+ def make_files(lines):
507
+ # Delay csv import, since Distribution.files is not as widely used
508
+ # as other parts of importlib.metadata
509
+ import csv
510
+
511
+ return starmap(make_file, csv.reader(lines))
512
+
513
+ @pass_none
514
+ def skip_missing_files(package_paths):
515
+ return list(filter(lambda path: path.locate().exists(), package_paths))
516
+
517
+ return skip_missing_files(
518
+ make_files(
519
+ self._read_files_distinfo()
520
+ or self._read_files_egginfo_installed()
521
+ or self._read_files_egginfo_sources()
522
+ )
523
+ )
524
+
525
+ def _read_files_distinfo(self):
526
+ """
527
+ Read the lines of RECORD.
528
+ """
529
+ text = self.read_text('RECORD')
530
+ return text and text.splitlines()
531
+
532
+ def _read_files_egginfo_installed(self):
533
+ """
534
+ Read installed-files.txt and return lines in a similar
535
+ CSV-parsable format as RECORD: each file must be placed
536
+ relative to the site-packages directory and must also be
537
+ quoted (since file names can contain literal commas).
538
+
539
+ This file is written when the package is installed by pip,
540
+ but it might not be written for other installation methods.
541
+ Assume the file is accurate if it exists.
542
+ """
543
+ text = self.read_text('installed-files.txt')
544
+ # Prepend the .egg-info/ subdir to the lines in this file.
545
+ # But this subdir is only available from PathDistribution's
546
+ # self._path.
547
+ subdir = getattr(self, '_path', None)
548
+ if not text or not subdir:
549
+ return
550
+
551
+ paths = (
552
+ py311.relative_fix((subdir / name).resolve())
553
+ .relative_to(self.locate_file('').resolve(), walk_up=True)
554
+ .as_posix()
555
+ for name in text.splitlines()
556
+ )
557
+ return map('"{}"'.format, paths)
558
+
559
+ def _read_files_egginfo_sources(self):
560
+ """
561
+ Read SOURCES.txt and return lines in a similar CSV-parsable
562
+ format as RECORD: each file name must be quoted (since it
563
+ might contain literal commas).
564
+
565
+ Note that SOURCES.txt is not a reliable source for what
566
+ files are installed by a package. This file is generated
567
+ for a source archive, and the files that are present
568
+ there (e.g. setup.py) may not correctly reflect the files
569
+ that are present after the package has been installed.
570
+ """
571
+ text = self.read_text('SOURCES.txt')
572
+ return text and map('"{}"'.format, text.splitlines())
573
+
574
+ @property
575
+ def requires(self) -> Optional[List[str]]:
576
+ """Generated requirements specified for this Distribution"""
577
+ reqs = self._read_dist_info_reqs() or self._read_egg_info_reqs()
578
+ return reqs and list(reqs)
579
+
580
+ def _read_dist_info_reqs(self):
581
+ return self.metadata.get_all('Requires-Dist')
582
+
583
+ def _read_egg_info_reqs(self):
584
+ source = self.read_text('requires.txt')
585
+ return pass_none(self._deps_from_requires_text)(source)
586
+
587
+ @classmethod
588
+ def _deps_from_requires_text(cls, source):
589
+ return cls._convert_egg_info_reqs_to_simple_reqs(Sectioned.read(source))
590
+
591
+ @staticmethod
592
+ def _convert_egg_info_reqs_to_simple_reqs(sections):
593
+ """
594
+ Historically, setuptools would solicit and store 'extra'
595
+ requirements, including those with environment markers,
596
+ in separate sections. More modern tools expect each
597
+ dependency to be defined separately, with any relevant
598
+ extras and environment markers attached directly to that
599
+ requirement. This method converts the former to the
600
+ latter. See _test_deps_from_requires_text for an example.
601
+ """
602
+
603
+ def make_condition(name):
604
+ return name and f'extra == "{name}"'
605
+
606
+ def quoted_marker(section):
607
+ section = section or ''
608
+ extra, sep, markers = section.partition(':')
609
+ if extra and markers:
610
+ markers = f'({markers})'
611
+ conditions = list(filter(None, [markers, make_condition(extra)]))
612
+ return '; ' + ' and '.join(conditions) if conditions else ''
613
+
614
+ def url_req_space(req):
615
+ """
616
+ PEP 508 requires a space between the url_spec and the quoted_marker.
617
+ Ref python/importlib_metadata#357.
618
+ """
619
+ # '@' is uniquely indicative of a url_req.
620
+ return ' ' * ('@' in req)
621
+
622
+ for section in sections:
623
+ space = url_req_space(section.value)
624
+ yield section.value + space + quoted_marker(section.name)
625
+
626
+ @property
627
+ def origin(self):
628
+ return self._load_json('direct_url.json')
629
+
630
+ def _load_json(self, filename):
631
+ return pass_none(json.loads)(
632
+ self.read_text(filename),
633
+ object_hook=lambda data: types.SimpleNamespace(**data),
634
+ )
635
+
636
+
637
+ class DistributionFinder(MetaPathFinder):
638
+ """
639
+ A MetaPathFinder capable of discovering installed distributions.
640
+
641
+ Custom providers should implement this interface in order to
642
+ supply metadata.
643
+ """
644
+
645
+ class Context:
646
+ """
647
+ Keyword arguments presented by the caller to
648
+ ``distributions()`` or ``Distribution.discover()``
649
+ to narrow the scope of a search for distributions
650
+ in all DistributionFinders.
651
+
652
+ Each DistributionFinder may expect any parameters
653
+ and should attempt to honor the canonical
654
+ parameters defined below when appropriate.
655
+
656
+ This mechanism gives a custom provider a means to
657
+ solicit additional details from the caller beyond
658
+ "name" and "path" when searching distributions.
659
+ For example, imagine a provider that exposes suites
660
+ of packages in either a "public" or "private" ``realm``.
661
+ A caller may wish to query only for distributions in
662
+ a particular realm and could call
663
+ ``distributions(realm="private")`` to signal to the
664
+ custom provider to only include distributions from that
665
+ realm.
666
+ """
667
+
668
+ name = None
669
+ """
670
+ Specific name for which a distribution finder should match.
671
+ A name of ``None`` matches all distributions.
672
+ """
673
+
674
+ def __init__(self, **kwargs):
675
+ vars(self).update(kwargs)
676
+
677
+ @property
678
+ def path(self) -> List[str]:
679
+ """
680
+ The sequence of directory path that a distribution finder
681
+ should search.
682
+
683
+ Typically refers to Python installed package paths such as
684
+ "site-packages" directories and defaults to ``sys.path``.
685
+ """
686
+ return vars(self).get('path', sys.path)
687
+
688
+ @abc.abstractmethod
689
+ def find_distributions(self, context=Context()) -> Iterable[Distribution]:
690
+ """
691
+ Find distributions.
692
+
693
+ Return an iterable of all Distribution instances capable of
694
+ loading the metadata for packages matching the ``context``,
695
+ a DistributionFinder.Context instance.
696
+ """
697
+
698
+
699
+ class FastPath:
700
+ """
701
+ Micro-optimized class for searching a root for children.
702
+
703
+ Root is a path on the file system that may contain metadata
704
+ directories either as natural directories or within a zip file.
705
+
706
+ >>> FastPath('').children()
707
+ ['...']
708
+
709
+ FastPath objects are cached and recycled for any given root.
710
+
711
+ >>> FastPath('foobar') is FastPath('foobar')
712
+ True
713
+ """
714
+
715
+ @functools.lru_cache() # type: ignore
716
+ def __new__(cls, root):
717
+ return super().__new__(cls)
718
+
719
+ def __init__(self, root):
720
+ self.root = root
721
+
722
+ def joinpath(self, child):
723
+ return pathlib.Path(self.root, child)
724
+
725
+ def children(self):
726
+ with suppress(Exception):
727
+ return os.listdir(self.root or '.')
728
+ with suppress(Exception):
729
+ return self.zip_children()
730
+ return []
731
+
732
+ def zip_children(self):
733
+ zip_path = zipp.Path(self.root)
734
+ names = zip_path.root.namelist()
735
+ self.joinpath = zip_path.joinpath
736
+
737
+ return dict.fromkeys(child.split(posixpath.sep, 1)[0] for child in names)
738
+
739
+ def search(self, name):
740
+ return self.lookup(self.mtime).search(name)
741
+
742
+ @property
743
+ def mtime(self):
744
+ with suppress(OSError):
745
+ return os.stat(self.root).st_mtime
746
+ self.lookup.cache_clear()
747
+
748
+ @method_cache
749
+ def lookup(self, mtime):
750
+ return Lookup(self)
751
+
752
+
753
+ class Lookup:
754
+ """
755
+ A micro-optimized class for searching a (fast) path for metadata.
756
+ """
757
+
758
+ def __init__(self, path: FastPath):
759
+ """
760
+ Calculate all of the children representing metadata.
761
+
762
+ From the children in the path, calculate early all of the
763
+ children that appear to represent metadata (infos) or legacy
764
+ metadata (eggs).
765
+ """
766
+
767
+ base = os.path.basename(path.root).lower()
768
+ base_is_egg = base.endswith(".egg")
769
+ self.infos = FreezableDefaultDict(list)
770
+ self.eggs = FreezableDefaultDict(list)
771
+
772
+ for child in path.children():
773
+ low = child.lower()
774
+ if low.endswith((".dist-info", ".egg-info")):
775
+ # rpartition is faster than splitext and suitable for this purpose.
776
+ name = low.rpartition(".")[0].partition("-")[0]
777
+ normalized = Prepared.normalize(name)
778
+ self.infos[normalized].append(path.joinpath(child))
779
+ elif base_is_egg and low == "egg-info":
780
+ name = base.rpartition(".")[0].partition("-")[0]
781
+ legacy_normalized = Prepared.legacy_normalize(name)
782
+ self.eggs[legacy_normalized].append(path.joinpath(child))
783
+
784
+ self.infos.freeze()
785
+ self.eggs.freeze()
786
+
787
+ def search(self, prepared: Prepared):
788
+ """
789
+ Yield all infos and eggs matching the Prepared query.
790
+ """
791
+ infos = (
792
+ self.infos[prepared.normalized]
793
+ if prepared
794
+ else itertools.chain.from_iterable(self.infos.values())
795
+ )
796
+ eggs = (
797
+ self.eggs[prepared.legacy_normalized]
798
+ if prepared
799
+ else itertools.chain.from_iterable(self.eggs.values())
800
+ )
801
+ return itertools.chain(infos, eggs)
802
+
803
+
804
+ class Prepared:
805
+ """
806
+ A prepared search query for metadata on a possibly-named package.
807
+
808
+ Pre-calculates the normalization to prevent repeated operations.
809
+
810
+ >>> none = Prepared(None)
811
+ >>> none.normalized
812
+ >>> none.legacy_normalized
813
+ >>> bool(none)
814
+ False
815
+ >>> sample = Prepared('Sample__Pkg-name.foo')
816
+ >>> sample.normalized
817
+ 'sample_pkg_name_foo'
818
+ >>> sample.legacy_normalized
819
+ 'sample__pkg_name.foo'
820
+ >>> bool(sample)
821
+ True
822
+ """
823
+
824
+ normalized = None
825
+ legacy_normalized = None
826
+
827
+ def __init__(self, name: Optional[str]):
828
+ self.name = name
829
+ if name is None:
830
+ return
831
+ self.normalized = self.normalize(name)
832
+ self.legacy_normalized = self.legacy_normalize(name)
833
+
834
+ @staticmethod
835
+ def normalize(name):
836
+ """
837
+ PEP 503 normalization plus dashes as underscores.
838
+ """
839
+ return re.sub(r"[-_.]+", "-", name).lower().replace('-', '_')
840
+
841
+ @staticmethod
842
+ def legacy_normalize(name):
843
+ """
844
+ Normalize the package name as found in the convention in
845
+ older packaging tools versions and specs.
846
+ """
847
+ return name.lower().replace('-', '_')
848
+
849
+ def __bool__(self):
850
+ return bool(self.name)
851
+
852
+
853
+ @install
854
+ class MetadataPathFinder(NullFinder, DistributionFinder):
855
+ """A degenerate finder for distribution packages on the file system.
856
+
857
+ This finder supplies only a find_distributions() method for versions
858
+ of Python that do not have a PathFinder find_distributions().
859
+ """
860
+
861
+ @classmethod
862
+ def find_distributions(
863
+ cls, context=DistributionFinder.Context()
864
+ ) -> Iterable[PathDistribution]:
865
+ """
866
+ Find distributions.
867
+
868
+ Return an iterable of all Distribution instances capable of
869
+ loading the metadata for packages matching ``context.name``
870
+ (or all names if ``None`` indicated) along the paths in the list
871
+ of directories ``context.path``.
872
+ """
873
+ found = cls._search_paths(context.name, context.path)
874
+ return map(PathDistribution, found)
875
+
876
+ @classmethod
877
+ def _search_paths(cls, name, paths):
878
+ """Find metadata directories in paths heuristically."""
879
+ prepared = Prepared(name)
880
+ return itertools.chain.from_iterable(
881
+ path.search(prepared) for path in map(FastPath, paths)
882
+ )
883
+
884
+ @classmethod
885
+ def invalidate_caches(cls) -> None:
886
+ FastPath.__new__.cache_clear()
887
+
888
+
889
+ class PathDistribution(Distribution):
890
+ def __init__(self, path: SimplePath) -> None:
891
+ """Construct a distribution.
892
+
893
+ :param path: SimplePath indicating the metadata directory.
894
+ """
895
+ self._path = path
896
+
897
+ def read_text(self, filename: str | os.PathLike[str]) -> Optional[str]:
898
+ with suppress(
899
+ FileNotFoundError,
900
+ IsADirectoryError,
901
+ KeyError,
902
+ NotADirectoryError,
903
+ PermissionError,
904
+ ):
905
+ return self._path.joinpath(filename).read_text(encoding='utf-8')
906
+
907
+ return None
908
+
909
+ read_text.__doc__ = Distribution.read_text.__doc__
910
+
911
+ def locate_file(self, path: str | os.PathLike[str]) -> SimplePath:
912
+ return self._path.parent / path
913
+
914
+ @property
915
+ def _normalized_name(self):
916
+ """
917
+ Performance optimization: where possible, resolve the
918
+ normalized name from the file system path.
919
+ """
920
+ stem = os.path.basename(str(self._path))
921
+ return (
922
+ pass_none(Prepared.normalize)(self._name_from_stem(stem))
923
+ or super()._normalized_name
924
+ )
925
+
926
+ @staticmethod
927
+ def _name_from_stem(stem):
928
+ """
929
+ >>> PathDistribution._name_from_stem('foo-3.0.egg-info')
930
+ 'foo'
931
+ >>> PathDistribution._name_from_stem('CherryPy-3.0.dist-info')
932
+ 'CherryPy'
933
+ >>> PathDistribution._name_from_stem('face.egg-info')
934
+ 'face'
935
+ >>> PathDistribution._name_from_stem('foo.bar')
936
+ """
937
+ filename, ext = os.path.splitext(stem)
938
+ if ext not in ('.dist-info', '.egg-info'):
939
+ return
940
+ name, sep, rest = filename.partition('-')
941
+ return name
942
+
943
+
944
+ def distribution(distribution_name: str) -> Distribution:
945
+ """Get the ``Distribution`` instance for the named package.
946
+
947
+ :param distribution_name: The name of the distribution package as a string.
948
+ :return: A ``Distribution`` instance (or subclass thereof).
949
+ """
950
+ return Distribution.from_name(distribution_name)
951
+
952
+
953
+ def distributions(**kwargs) -> Iterable[Distribution]:
954
+ """Get all ``Distribution`` instances in the current environment.
955
+
956
+ :return: An iterable of ``Distribution`` instances.
957
+ """
958
+ return Distribution.discover(**kwargs)
959
+
960
+
961
+ def metadata(distribution_name: str) -> _meta.PackageMetadata:
962
+ """Get the metadata for the named package.
963
+
964
+ :param distribution_name: The name of the distribution package to query.
965
+ :return: A PackageMetadata containing the parsed metadata.
966
+ """
967
+ return Distribution.from_name(distribution_name).metadata
968
+
969
+
970
+ def version(distribution_name: str) -> str:
971
+ """Get the version string for the named package.
972
+
973
+ :param distribution_name: The name of the distribution package to query.
974
+ :return: The version string for the package as defined in the package's
975
+ "Version" metadata key.
976
+ """
977
+ return distribution(distribution_name).version
978
+
979
+
980
+ _unique = functools.partial(
981
+ unique_everseen,
982
+ key=py39.normalized_name,
983
+ )
984
+ """
985
+ Wrapper for ``distributions`` to return unique distributions by name.
986
+ """
987
+
988
+
989
+ def entry_points(**params) -> EntryPoints:
990
+ """Return EntryPoint objects for all installed packages.
991
+
992
+ Pass selection parameters (group or name) to filter the
993
+ result to entry points matching those properties (see
994
+ EntryPoints.select()).
995
+
996
+ :return: EntryPoints for all installed packages.
997
+ """
998
+ eps = itertools.chain.from_iterable(
999
+ dist.entry_points for dist in _unique(distributions())
1000
+ )
1001
+ return EntryPoints(eps).select(**params)
1002
+
1003
+
1004
+ def files(distribution_name: str) -> Optional[List[PackagePath]]:
1005
+ """Return a list of files for the named package.
1006
+
1007
+ :param distribution_name: The name of the distribution package to query.
1008
+ :return: List of files composing the distribution.
1009
+ """
1010
+ return distribution(distribution_name).files
1011
+
1012
+
1013
+ def requires(distribution_name: str) -> Optional[List[str]]:
1014
+ """
1015
+ Return a list of requirements for the named package.
1016
+
1017
+ :return: An iterable of requirements, suitable for
1018
+ packaging.requirement.Requirement.
1019
+ """
1020
+ return distribution(distribution_name).requires
1021
+
1022
+
1023
+ def packages_distributions() -> Mapping[str, List[str]]:
1024
+ """
1025
+ Return a mapping of top-level packages to their
1026
+ distributions.
1027
+
1028
+ >>> import collections.abc
1029
+ >>> pkgs = packages_distributions()
1030
+ >>> all(isinstance(dist, collections.abc.Sequence) for dist in pkgs.values())
1031
+ True
1032
+ """
1033
+ pkg_to_dist = collections.defaultdict(list)
1034
+ for dist in distributions():
1035
+ for pkg in _top_level_declared(dist) or _top_level_inferred(dist):
1036
+ pkg_to_dist[pkg].append(dist.metadata['Name'])
1037
+ return dict(pkg_to_dist)
1038
+
1039
+
1040
+ def _top_level_declared(dist):
1041
+ return (dist.read_text('top_level.txt') or '').split()
1042
+
1043
+
1044
+ def _topmost(name: PackagePath) -> Optional[str]:
1045
+ """
1046
+ Return the top-most parent as long as there is a parent.
1047
+ """
1048
+ top, *rest = name.parts
1049
+ return top if rest else None
1050
+
1051
+
1052
+ def _get_toplevel_name(name: PackagePath) -> str:
1053
+ """
1054
+ Infer a possibly importable module name from a name presumed on
1055
+ sys.path.
1056
+
1057
+ >>> _get_toplevel_name(PackagePath('foo.py'))
1058
+ 'foo'
1059
+ >>> _get_toplevel_name(PackagePath('foo'))
1060
+ 'foo'
1061
+ >>> _get_toplevel_name(PackagePath('foo.pyc'))
1062
+ 'foo'
1063
+ >>> _get_toplevel_name(PackagePath('foo/__init__.py'))
1064
+ 'foo'
1065
+ >>> _get_toplevel_name(PackagePath('foo.pth'))
1066
+ 'foo.pth'
1067
+ >>> _get_toplevel_name(PackagePath('foo.dist-info'))
1068
+ 'foo.dist-info'
1069
+ """
1070
+ return _topmost(name) or (
1071
+ # python/typeshed#10328
1072
+ inspect.getmodulename(name) # type: ignore
1073
+ or str(name)
1074
+ )
1075
+
1076
+
1077
+ def _top_level_inferred(dist):
1078
+ opt_names = set(map(_get_toplevel_name, always_iterable(dist.files)))
1079
+
1080
+ def importable_name(name):
1081
+ return '.' not in name
1082
+
1083
+ return filter(importable_name, opt_names)
falcon/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata/__pycache__/__init__.cpython-310.pyc ADDED
Binary file (40.2 kB). View file
 
falcon/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata/__pycache__/_adapters.cpython-310.pyc ADDED
Binary file (2.86 kB). View file
 
falcon/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata/__pycache__/_collections.cpython-310.pyc ADDED
Binary file (1.55 kB). View file
 
falcon/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata/__pycache__/_functools.cpython-310.pyc ADDED
Binary file (3.14 kB). View file
 
falcon/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata/__pycache__/_itertools.cpython-310.pyc ADDED
Binary file (2.02 kB). View file
 
falcon/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata/__pycache__/_meta.cpython-310.pyc ADDED
Binary file (3.34 kB). View file
 
falcon/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata/__pycache__/_text.cpython-310.pyc ADDED
Binary file (3.07 kB). View file
 
falcon/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata/__pycache__/diagnose.cpython-310.pyc ADDED
Binary file (839 Bytes). View file
 
falcon/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata/_adapters.py ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import re
2
+ import textwrap
3
+ import email.message
4
+
5
+ from ._text import FoldedCase
6
+
7
+
8
+ class Message(email.message.Message):
9
+ multiple_use_keys = set(
10
+ map(
11
+ FoldedCase,
12
+ [
13
+ 'Classifier',
14
+ 'Obsoletes-Dist',
15
+ 'Platform',
16
+ 'Project-URL',
17
+ 'Provides-Dist',
18
+ 'Provides-Extra',
19
+ 'Requires-Dist',
20
+ 'Requires-External',
21
+ 'Supported-Platform',
22
+ 'Dynamic',
23
+ ],
24
+ )
25
+ )
26
+ """
27
+ Keys that may be indicated multiple times per PEP 566.
28
+ """
29
+
30
+ def __new__(cls, orig: email.message.Message):
31
+ res = super().__new__(cls)
32
+ vars(res).update(vars(orig))
33
+ return res
34
+
35
+ def __init__(self, *args, **kwargs):
36
+ self._headers = self._repair_headers()
37
+
38
+ # suppress spurious error from mypy
39
+ def __iter__(self):
40
+ return super().__iter__()
41
+
42
+ def __getitem__(self, item):
43
+ """
44
+ Override parent behavior to typical dict behavior.
45
+
46
+ ``email.message.Message`` will emit None values for missing
47
+ keys. Typical mappings, including this ``Message``, will raise
48
+ a key error for missing keys.
49
+
50
+ Ref python/importlib_metadata#371.
51
+ """
52
+ res = super().__getitem__(item)
53
+ if res is None:
54
+ raise KeyError(item)
55
+ return res
56
+
57
+ def _repair_headers(self):
58
+ def redent(value):
59
+ "Correct for RFC822 indentation"
60
+ if not value or '\n' not in value:
61
+ return value
62
+ return textwrap.dedent(' ' * 8 + value)
63
+
64
+ headers = [(key, redent(value)) for key, value in vars(self)['_headers']]
65
+ if self._payload:
66
+ headers.append(('Description', self.get_payload()))
67
+ return headers
68
+
69
+ @property
70
+ def json(self):
71
+ """
72
+ Convert PackageMetadata to a JSON-compatible format
73
+ per PEP 0566.
74
+ """
75
+
76
+ def transform(key):
77
+ value = self.get_all(key) if key in self.multiple_use_keys else self[key]
78
+ if key == 'Keywords':
79
+ value = re.split(r'\s+', value)
80
+ tk = key.lower().replace('-', '_')
81
+ return tk, value
82
+
83
+ return dict(map(transform, map(FoldedCase, self)))
falcon/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata/_collections.py ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import collections
2
+
3
+
4
+ # from jaraco.collections 3.3
5
+ class FreezableDefaultDict(collections.defaultdict):
6
+ """
7
+ Often it is desirable to prevent the mutation of
8
+ a default dict after its initial construction, such
9
+ as to prevent mutation during iteration.
10
+
11
+ >>> dd = FreezableDefaultDict(list)
12
+ >>> dd[0].append('1')
13
+ >>> dd.freeze()
14
+ >>> dd[1]
15
+ []
16
+ >>> len(dd)
17
+ 1
18
+ """
19
+
20
+ def __missing__(self, key):
21
+ return getattr(self, '_frozen', super().__missing__)(key)
22
+
23
+ def freeze(self):
24
+ self._frozen = lambda key: self.default_factory()
25
+
26
+
27
+ class Pair(collections.namedtuple('Pair', 'name value')):
28
+ @classmethod
29
+ def parse(cls, text):
30
+ return cls(*map(str.strip, text.split("=", 1)))
falcon/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata/_compat.py ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import sys
2
+ import platform
3
+
4
+
5
+ __all__ = ['install', 'NullFinder']
6
+
7
+
8
+ def install(cls):
9
+ """
10
+ Class decorator for installation on sys.meta_path.
11
+
12
+ Adds the backport DistributionFinder to sys.meta_path and
13
+ attempts to disable the finder functionality of the stdlib
14
+ DistributionFinder.
15
+ """
16
+ sys.meta_path.append(cls())
17
+ disable_stdlib_finder()
18
+ return cls
19
+
20
+
21
+ def disable_stdlib_finder():
22
+ """
23
+ Give the backport primacy for discovering path-based distributions
24
+ by monkey-patching the stdlib O_O.
25
+
26
+ See #91 for more background for rationale on this sketchy
27
+ behavior.
28
+ """
29
+
30
+ def matches(finder):
31
+ return getattr(
32
+ finder, '__module__', None
33
+ ) == '_frozen_importlib_external' and hasattr(finder, 'find_distributions')
34
+
35
+ for finder in filter(matches, sys.meta_path): # pragma: nocover
36
+ del finder.find_distributions
37
+
38
+
39
+ class NullFinder:
40
+ """
41
+ A "Finder" (aka "MetaPathFinder") that never finds any modules,
42
+ but may find distributions.
43
+ """
44
+
45
+ @staticmethod
46
+ def find_spec(*args, **kwargs):
47
+ return None
48
+
49
+
50
+ def pypy_partial(val):
51
+ """
52
+ Adjust for variable stacklevel on partial under PyPy.
53
+
54
+ Workaround for #327.
55
+ """
56
+ is_pypy = platform.python_implementation() == 'PyPy'
57
+ return val + is_pypy
falcon/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata/_functools.py ADDED
@@ -0,0 +1,104 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import types
2
+ import functools
3
+
4
+
5
+ # from jaraco.functools 3.3
6
+ def method_cache(method, cache_wrapper=None):
7
+ """
8
+ Wrap lru_cache to support storing the cache data in the object instances.
9
+
10
+ Abstracts the common paradigm where the method explicitly saves an
11
+ underscore-prefixed protected property on first call and returns that
12
+ subsequently.
13
+
14
+ >>> class MyClass:
15
+ ... calls = 0
16
+ ...
17
+ ... @method_cache
18
+ ... def method(self, value):
19
+ ... self.calls += 1
20
+ ... return value
21
+
22
+ >>> a = MyClass()
23
+ >>> a.method(3)
24
+ 3
25
+ >>> for x in range(75):
26
+ ... res = a.method(x)
27
+ >>> a.calls
28
+ 75
29
+
30
+ Note that the apparent behavior will be exactly like that of lru_cache
31
+ except that the cache is stored on each instance, so values in one
32
+ instance will not flush values from another, and when an instance is
33
+ deleted, so are the cached values for that instance.
34
+
35
+ >>> b = MyClass()
36
+ >>> for x in range(35):
37
+ ... res = b.method(x)
38
+ >>> b.calls
39
+ 35
40
+ >>> a.method(0)
41
+ 0
42
+ >>> a.calls
43
+ 75
44
+
45
+ Note that if method had been decorated with ``functools.lru_cache()``,
46
+ a.calls would have been 76 (due to the cached value of 0 having been
47
+ flushed by the 'b' instance).
48
+
49
+ Clear the cache with ``.cache_clear()``
50
+
51
+ >>> a.method.cache_clear()
52
+
53
+ Same for a method that hasn't yet been called.
54
+
55
+ >>> c = MyClass()
56
+ >>> c.method.cache_clear()
57
+
58
+ Another cache wrapper may be supplied:
59
+
60
+ >>> cache = functools.lru_cache(maxsize=2)
61
+ >>> MyClass.method2 = method_cache(lambda self: 3, cache_wrapper=cache)
62
+ >>> a = MyClass()
63
+ >>> a.method2()
64
+ 3
65
+
66
+ Caution - do not subsequently wrap the method with another decorator, such
67
+ as ``@property``, which changes the semantics of the function.
68
+
69
+ See also
70
+ http://code.activestate.com/recipes/577452-a-memoize-decorator-for-instance-methods/
71
+ for another implementation and additional justification.
72
+ """
73
+ cache_wrapper = cache_wrapper or functools.lru_cache()
74
+
75
+ def wrapper(self, *args, **kwargs):
76
+ # it's the first call, replace the method with a cached, bound method
77
+ bound_method = types.MethodType(method, self)
78
+ cached_method = cache_wrapper(bound_method)
79
+ setattr(self, method.__name__, cached_method)
80
+ return cached_method(*args, **kwargs)
81
+
82
+ # Support cache clear even before cache has been created.
83
+ wrapper.cache_clear = lambda: None
84
+
85
+ return wrapper
86
+
87
+
88
+ # From jaraco.functools 3.3
89
+ def pass_none(func):
90
+ """
91
+ Wrap func so it's not called if its first param is None
92
+
93
+ >>> print_text = pass_none(print)
94
+ >>> print_text('text')
95
+ text
96
+ >>> print_text(None)
97
+ """
98
+
99
+ @functools.wraps(func)
100
+ def wrapper(param, *args, **kwargs):
101
+ if param is not None:
102
+ return func(param, *args, **kwargs)
103
+
104
+ return wrapper
falcon/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata/_itertools.py ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from itertools import filterfalse
2
+
3
+
4
+ def unique_everseen(iterable, key=None):
5
+ "List unique elements, preserving order. Remember all elements ever seen."
6
+ # unique_everseen('AAAABBBCCDAABBB') --> A B C D
7
+ # unique_everseen('ABBCcAD', str.lower) --> A B C D
8
+ seen = set()
9
+ seen_add = seen.add
10
+ if key is None:
11
+ for element in filterfalse(seen.__contains__, iterable):
12
+ seen_add(element)
13
+ yield element
14
+ else:
15
+ for element in iterable:
16
+ k = key(element)
17
+ if k not in seen:
18
+ seen_add(k)
19
+ yield element
20
+
21
+
22
+ # copied from more_itertools 8.8
23
+ def always_iterable(obj, base_type=(str, bytes)):
24
+ """If *obj* is iterable, return an iterator over its items::
25
+
26
+ >>> obj = (1, 2, 3)
27
+ >>> list(always_iterable(obj))
28
+ [1, 2, 3]
29
+
30
+ If *obj* is not iterable, return a one-item iterable containing *obj*::
31
+
32
+ >>> obj = 1
33
+ >>> list(always_iterable(obj))
34
+ [1]
35
+
36
+ If *obj* is ``None``, return an empty iterable:
37
+
38
+ >>> obj = None
39
+ >>> list(always_iterable(None))
40
+ []
41
+
42
+ By default, binary and text strings are not considered iterable::
43
+
44
+ >>> obj = 'foo'
45
+ >>> list(always_iterable(obj))
46
+ ['foo']
47
+
48
+ If *base_type* is set, objects for which ``isinstance(obj, base_type)``
49
+ returns ``True`` won't be considered iterable.
50
+
51
+ >>> obj = {'a': 1}
52
+ >>> list(always_iterable(obj)) # Iterate over the dict's keys
53
+ ['a']
54
+ >>> list(always_iterable(obj, base_type=dict)) # Treat dicts as a unit
55
+ [{'a': 1}]
56
+
57
+ Set *base_type* to ``None`` to avoid any special handling and treat objects
58
+ Python considers iterable as iterable:
59
+
60
+ >>> obj = 'foo'
61
+ >>> list(always_iterable(obj, base_type=None))
62
+ ['f', 'o', 'o']
63
+ """
64
+ if obj is None:
65
+ return iter(())
66
+
67
+ if (base_type is not None) and isinstance(obj, base_type):
68
+ return iter((obj,))
69
+
70
+ try:
71
+ return iter(obj)
72
+ except TypeError:
73
+ return iter((obj,))
falcon/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata/_meta.py ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from __future__ import annotations
2
+
3
+ import os
4
+ from typing import Protocol
5
+ from typing import Any, Dict, Iterator, List, Optional, TypeVar, Union, overload
6
+
7
+
8
+ _T = TypeVar("_T")
9
+
10
+
11
+ class PackageMetadata(Protocol):
12
+ def __len__(self) -> int: ... # pragma: no cover
13
+
14
+ def __contains__(self, item: str) -> bool: ... # pragma: no cover
15
+
16
+ def __getitem__(self, key: str) -> str: ... # pragma: no cover
17
+
18
+ def __iter__(self) -> Iterator[str]: ... # pragma: no cover
19
+
20
+ @overload
21
+ def get(
22
+ self, name: str, failobj: None = None
23
+ ) -> Optional[str]: ... # pragma: no cover
24
+
25
+ @overload
26
+ def get(self, name: str, failobj: _T) -> Union[str, _T]: ... # pragma: no cover
27
+
28
+ # overload per python/importlib_metadata#435
29
+ @overload
30
+ def get_all(
31
+ self, name: str, failobj: None = None
32
+ ) -> Optional[List[Any]]: ... # pragma: no cover
33
+
34
+ @overload
35
+ def get_all(self, name: str, failobj: _T) -> Union[List[Any], _T]:
36
+ """
37
+ Return all values associated with a possibly multi-valued key.
38
+ """
39
+
40
+ @property
41
+ def json(self) -> Dict[str, Union[str, List[str]]]:
42
+ """
43
+ A JSON-compatible form of the metadata.
44
+ """
45
+
46
+
47
+ class SimplePath(Protocol):
48
+ """
49
+ A minimal subset of pathlib.Path required by Distribution.
50
+ """
51
+
52
+ def joinpath(
53
+ self, other: Union[str, os.PathLike[str]]
54
+ ) -> SimplePath: ... # pragma: no cover
55
+
56
+ def __truediv__(
57
+ self, other: Union[str, os.PathLike[str]]
58
+ ) -> SimplePath: ... # pragma: no cover
59
+
60
+ @property
61
+ def parent(self) -> SimplePath: ... # pragma: no cover
62
+
63
+ def read_text(self, encoding=None) -> str: ... # pragma: no cover
64
+
65
+ def read_bytes(self) -> bytes: ... # pragma: no cover
66
+
67
+ def exists(self) -> bool: ... # pragma: no cover
falcon/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata/_text.py ADDED
@@ -0,0 +1,99 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import re
2
+
3
+ from ._functools import method_cache
4
+
5
+
6
+ # from jaraco.text 3.5
7
+ class FoldedCase(str):
8
+ """
9
+ A case insensitive string class; behaves just like str
10
+ except compares equal when the only variation is case.
11
+
12
+ >>> s = FoldedCase('hello world')
13
+
14
+ >>> s == 'Hello World'
15
+ True
16
+
17
+ >>> 'Hello World' == s
18
+ True
19
+
20
+ >>> s != 'Hello World'
21
+ False
22
+
23
+ >>> s.index('O')
24
+ 4
25
+
26
+ >>> s.split('O')
27
+ ['hell', ' w', 'rld']
28
+
29
+ >>> sorted(map(FoldedCase, ['GAMMA', 'alpha', 'Beta']))
30
+ ['alpha', 'Beta', 'GAMMA']
31
+
32
+ Sequence membership is straightforward.
33
+
34
+ >>> "Hello World" in [s]
35
+ True
36
+ >>> s in ["Hello World"]
37
+ True
38
+
39
+ You may test for set inclusion, but candidate and elements
40
+ must both be folded.
41
+
42
+ >>> FoldedCase("Hello World") in {s}
43
+ True
44
+ >>> s in {FoldedCase("Hello World")}
45
+ True
46
+
47
+ String inclusion works as long as the FoldedCase object
48
+ is on the right.
49
+
50
+ >>> "hello" in FoldedCase("Hello World")
51
+ True
52
+
53
+ But not if the FoldedCase object is on the left:
54
+
55
+ >>> FoldedCase('hello') in 'Hello World'
56
+ False
57
+
58
+ In that case, use in_:
59
+
60
+ >>> FoldedCase('hello').in_('Hello World')
61
+ True
62
+
63
+ >>> FoldedCase('hello') > FoldedCase('Hello')
64
+ False
65
+ """
66
+
67
+ def __lt__(self, other):
68
+ return self.lower() < other.lower()
69
+
70
+ def __gt__(self, other):
71
+ return self.lower() > other.lower()
72
+
73
+ def __eq__(self, other):
74
+ return self.lower() == other.lower()
75
+
76
+ def __ne__(self, other):
77
+ return self.lower() != other.lower()
78
+
79
+ def __hash__(self):
80
+ return hash(self.lower())
81
+
82
+ def __contains__(self, other):
83
+ return super().lower().__contains__(other.lower())
84
+
85
+ def in_(self, other):
86
+ "Does self appear in other?"
87
+ return self in FoldedCase(other)
88
+
89
+ # cache lower since it's likely to be called frequently.
90
+ @method_cache
91
+ def lower(self):
92
+ return super().lower()
93
+
94
+ def index(self, sub):
95
+ return self.lower().index(sub.lower())
96
+
97
+ def split(self, splitter=' ', maxsplit=0):
98
+ pattern = re.compile(re.escape(splitter), re.I)
99
+ return pattern.split(self, maxsplit)
falcon/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata/compat/__init__.py ADDED
File without changes
falcon/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata/compat/__pycache__/py311.cpython-310.pyc ADDED
Binary file (1.02 kB). View file
 
falcon/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata/compat/py311.py ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import pathlib
3
+ import sys
4
+ import types
5
+
6
+
7
+ def wrap(path): # pragma: no cover
8
+ """
9
+ Workaround for https://github.com/python/cpython/issues/84538
10
+ to add backward compatibility for walk_up=True.
11
+ An example affected package is dask-labextension, which uses
12
+ jupyter-packaging to install JupyterLab javascript files outside
13
+ of site-packages.
14
+ """
15
+
16
+ def relative_to(root, *, walk_up=False):
17
+ return pathlib.Path(os.path.relpath(path, root))
18
+
19
+ return types.SimpleNamespace(relative_to=relative_to)
20
+
21
+
22
+ relative_fix = wrap if sys.version_info < (3, 12) else lambda x: x
falcon/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata/compat/py39.py ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ Compatibility layer with Python 3.8/3.9
3
+ """
4
+
5
+ from typing import TYPE_CHECKING, Any, Optional
6
+
7
+ if TYPE_CHECKING: # pragma: no cover
8
+ # Prevent circular imports on runtime.
9
+ from .. import Distribution, EntryPoint
10
+ else:
11
+ Distribution = EntryPoint = Any
12
+
13
+
14
+ def normalized_name(dist: Distribution) -> Optional[str]:
15
+ """
16
+ Honor name normalization for distributions that don't provide ``_normalized_name``.
17
+ """
18
+ try:
19
+ return dist._normalized_name
20
+ except AttributeError:
21
+ from .. import Prepared # -> delay to prevent circular imports.
22
+
23
+ return Prepared.normalize(getattr(dist, "name", None) or dist.metadata['Name'])
24
+
25
+
26
+ def ep_matches(ep: EntryPoint, **params) -> bool:
27
+ """
28
+ Workaround for ``EntryPoint`` objects without the ``matches`` method.
29
+ """
30
+ try:
31
+ return ep.matches(**params)
32
+ except AttributeError:
33
+ from .. import EntryPoint # -> delay to prevent circular imports.
34
+
35
+ # Reconstruct the EntryPoint object to make sure it is compatible.
36
+ return EntryPoint(ep.name, ep.value, ep.group).matches(**params)
falcon/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata/diagnose.py ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import sys
2
+
3
+ from . import Distribution
4
+
5
+
6
+ def inspect(path):
7
+ print("Inspecting", path)
8
+ dists = list(Distribution.discover(path=[path]))
9
+ if not dists:
10
+ return
11
+ print("Found", len(dists), "packages:", end=' ')
12
+ print(', '.join(dist.name for dist in dists))
13
+
14
+
15
+ def run():
16
+ for path in sys.path:
17
+ inspect(path)
18
+
19
+
20
+ if __name__ == '__main__':
21
+ run()
falcon/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata/py.typed ADDED
File without changes
falcon/lib/python3.10/site-packages/setuptools/_vendor/inflect-7.3.1.dist-info/INSTALLER ADDED
@@ -0,0 +1 @@
 
 
1
+ conda
falcon/lib/python3.10/site-packages/setuptools/_vendor/inflect-7.3.1.dist-info/LICENSE ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Permission is hereby granted, free of charge, to any person obtaining a copy
2
+ of this software and associated documentation files (the "Software"), to
3
+ deal in the Software without restriction, including without limitation the
4
+ rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
5
+ sell copies of the Software, and to permit persons to whom the Software is
6
+ furnished to do so, subject to the following conditions:
7
+
8
+ The above copyright notice and this permission notice shall be included in
9
+ all copies or substantial portions of the Software.
10
+
11
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
12
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
14
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
15
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
16
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
17
+ IN THE SOFTWARE.
falcon/lib/python3.10/site-packages/setuptools/_vendor/inflect-7.3.1.dist-info/METADATA ADDED
@@ -0,0 +1,591 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Metadata-Version: 2.1
2
+ Name: inflect
3
+ Version: 7.3.1
4
+ Summary: Correctly generate plurals, singular nouns, ordinals, indefinite articles
5
+ Author-email: Paul Dyson <pwdyson@yahoo.com>
6
+ Maintainer-email: "Jason R. Coombs" <jaraco@jaraco.com>
7
+ Project-URL: Source, https://github.com/jaraco/inflect
8
+ Keywords: plural,inflect,participle
9
+ Classifier: Development Status :: 5 - Production/Stable
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: License :: OSI Approved :: MIT License
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3 :: Only
14
+ Classifier: Natural Language :: English
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
17
+ Classifier: Topic :: Text Processing :: Linguistic
18
+ Requires-Python: >=3.8
19
+ Description-Content-Type: text/x-rst
20
+ License-File: LICENSE
21
+ Requires-Dist: more-itertools >=8.5.0
22
+ Requires-Dist: typeguard >=4.0.1
23
+ Requires-Dist: typing-extensions ; python_version < "3.9"
24
+ Provides-Extra: doc
25
+ Requires-Dist: sphinx >=3.5 ; extra == 'doc'
26
+ Requires-Dist: jaraco.packaging >=9.3 ; extra == 'doc'
27
+ Requires-Dist: rst.linker >=1.9 ; extra == 'doc'
28
+ Requires-Dist: furo ; extra == 'doc'
29
+ Requires-Dist: sphinx-lint ; extra == 'doc'
30
+ Requires-Dist: jaraco.tidelift >=1.4 ; extra == 'doc'
31
+ Provides-Extra: test
32
+ Requires-Dist: pytest !=8.1.*,>=6 ; extra == 'test'
33
+ Requires-Dist: pytest-checkdocs >=2.4 ; extra == 'test'
34
+ Requires-Dist: pytest-cov ; extra == 'test'
35
+ Requires-Dist: pytest-mypy ; extra == 'test'
36
+ Requires-Dist: pytest-enabler >=2.2 ; extra == 'test'
37
+ Requires-Dist: pytest-ruff >=0.2.1 ; extra == 'test'
38
+ Requires-Dist: pygments ; extra == 'test'
39
+
40
+ .. image:: https://img.shields.io/pypi/v/inflect.svg
41
+ :target: https://pypi.org/project/inflect
42
+
43
+ .. image:: https://img.shields.io/pypi/pyversions/inflect.svg
44
+
45
+ .. image:: https://github.com/jaraco/inflect/actions/workflows/main.yml/badge.svg
46
+ :target: https://github.com/jaraco/inflect/actions?query=workflow%3A%22tests%22
47
+ :alt: tests
48
+
49
+ .. image:: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v2.json
50
+ :target: https://github.com/astral-sh/ruff
51
+ :alt: Ruff
52
+
53
+ .. image:: https://readthedocs.org/projects/inflect/badge/?version=latest
54
+ :target: https://inflect.readthedocs.io/en/latest/?badge=latest
55
+
56
+ .. image:: https://img.shields.io/badge/skeleton-2024-informational
57
+ :target: https://blog.jaraco.com/skeleton
58
+
59
+ .. image:: https://tidelift.com/badges/package/pypi/inflect
60
+ :target: https://tidelift.com/subscription/pkg/pypi-inflect?utm_source=pypi-inflect&utm_medium=readme
61
+
62
+ NAME
63
+ ====
64
+
65
+ inflect.py - Correctly generate plurals, singular nouns, ordinals, indefinite articles; convert numbers to words.
66
+
67
+ SYNOPSIS
68
+ ========
69
+
70
+ .. code-block:: python
71
+
72
+ import inflect
73
+
74
+ p = inflect.engine()
75
+
76
+ # METHODS:
77
+
78
+ # plural plural_noun plural_verb plural_adj singular_noun no num
79
+ # compare compare_nouns compare_nouns compare_adjs
80
+ # a an
81
+ # present_participle
82
+ # ordinal number_to_words
83
+ # join
84
+ # inflect classical gender
85
+ # defnoun defverb defadj defa defan
86
+
87
+
88
+ # UNCONDITIONALLY FORM THE PLURAL
89
+
90
+ print("The plural of ", word, " is ", p.plural(word))
91
+
92
+
93
+ # CONDITIONALLY FORM THE PLURAL
94
+
95
+ print("I saw", cat_count, p.plural("cat", cat_count))
96
+
97
+
98
+ # FORM PLURALS FOR SPECIFIC PARTS OF SPEECH
99
+
100
+ print(
101
+ p.plural_noun("I", N1),
102
+ p.plural_verb("saw", N1),
103
+ p.plural_adj("my", N2),
104
+ p.plural_noun("saw", N2),
105
+ )
106
+
107
+
108
+ # FORM THE SINGULAR OF PLURAL NOUNS
109
+
110
+ print("The singular of ", word, " is ", p.singular_noun(word))
111
+
112
+ # SELECT THE GENDER OF SINGULAR PRONOUNS
113
+
114
+ print(p.singular_noun("they")) # 'it'
115
+ p.gender("feminine")
116
+ print(p.singular_noun("they")) # 'she'
117
+
118
+
119
+ # DEAL WITH "0/1/N" -> "no/1/N" TRANSLATION:
120
+
121
+ print("There ", p.plural_verb("was", errors), p.no(" error", errors))
122
+
123
+
124
+ # USE DEFAULT COUNTS:
125
+
126
+ print(
127
+ p.num(N1, ""),
128
+ p.plural("I"),
129
+ p.plural_verb(" saw"),
130
+ p.num(N2),
131
+ p.plural_noun(" saw"),
132
+ )
133
+ print("There ", p.num(errors, ""), p.plural_verb("was"), p.no(" error"))
134
+
135
+
136
+ # COMPARE TWO WORDS "NUMBER-INSENSITIVELY":
137
+
138
+ if p.compare(word1, word2):
139
+ print("same")
140
+ if p.compare_nouns(word1, word2):
141
+ print("same noun")
142
+ if p.compare_verbs(word1, word2):
143
+ print("same verb")
144
+ if p.compare_adjs(word1, word2):
145
+ print("same adj.")
146
+
147
+
148
+ # ADD CORRECT "a" OR "an" FOR A GIVEN WORD:
149
+
150
+ print("Did you want ", p.a(thing), " or ", p.an(idea))
151
+
152
+
153
+ # CONVERT NUMERALS INTO ORDINALS (i.e. 1->1st, 2->2nd, 3->3rd, etc.)
154
+
155
+ print("It was", p.ordinal(position), " from the left\n")
156
+
157
+ # CONVERT NUMERALS TO WORDS (i.e. 1->"one", 101->"one hundred and one", etc.)
158
+ # RETURNS A SINGLE STRING...
159
+
160
+ words = p.number_to_words(1234)
161
+ # "one thousand, two hundred and thirty-four"
162
+ words = p.number_to_words(p.ordinal(1234))
163
+ # "one thousand, two hundred and thirty-fourth"
164
+
165
+
166
+ # GET BACK A LIST OF STRINGS, ONE FOR EACH "CHUNK"...
167
+
168
+ words = p.number_to_words(1234, wantlist=True)
169
+ # ("one thousand","two hundred and thirty-four")
170
+
171
+
172
+ # OPTIONAL PARAMETERS CHANGE TRANSLATION:
173
+
174
+ words = p.number_to_words(12345, group=1)
175
+ # "one, two, three, four, five"
176
+
177
+ words = p.number_to_words(12345, group=2)
178
+ # "twelve, thirty-four, five"
179
+
180
+ words = p.number_to_words(12345, group=3)
181
+ # "one twenty-three, forty-five"
182
+
183
+ words = p.number_to_words(1234, andword="")
184
+ # "one thousand, two hundred thirty-four"
185
+
186
+ words = p.number_to_words(1234, andword=", plus")
187
+ # "one thousand, two hundred, plus thirty-four"
188
+ # TODO: I get no comma before plus: check perl
189
+
190
+ words = p.number_to_words(555_1202, group=1, zero="oh")
191
+ # "five, five, five, one, two, oh, two"
192
+
193
+ words = p.number_to_words(555_1202, group=1, one="unity")
194
+ # "five, five, five, unity, two, oh, two"
195
+
196
+ words = p.number_to_words(123.456, group=1, decimal="mark")
197
+ # "one two three mark four five six"
198
+ # TODO: DOCBUG: perl gives commas here as do I
199
+
200
+ # LITERAL STYLE ONLY NAMES NUMBERS LESS THAN A CERTAIN THRESHOLD...
201
+
202
+ words = p.number_to_words(9, threshold=10) # "nine"
203
+ words = p.number_to_words(10, threshold=10) # "ten"
204
+ words = p.number_to_words(11, threshold=10) # "11"
205
+ words = p.number_to_words(1000, threshold=10) # "1,000"
206
+
207
+ # JOIN WORDS INTO A LIST:
208
+
209
+ mylist = p.join(("apple", "banana", "carrot"))
210
+ # "apple, banana, and carrot"
211
+
212
+ mylist = p.join(("apple", "banana"))
213
+ # "apple and banana"
214
+
215
+ mylist = p.join(("apple", "banana", "carrot"), final_sep="")
216
+ # "apple, banana and carrot"
217
+
218
+
219
+ # REQUIRE "CLASSICAL" PLURALS (EG: "focus"->"foci", "cherub"->"cherubim")
220
+
221
+ p.classical() # USE ALL CLASSICAL PLURALS
222
+
223
+ p.classical(all=True) # USE ALL CLASSICAL PLURALS
224
+ p.classical(all=False) # SWITCH OFF CLASSICAL MODE
225
+
226
+ p.classical(zero=True) # "no error" INSTEAD OF "no errors"
227
+ p.classical(zero=False) # "no errors" INSTEAD OF "no error"
228
+
229
+ p.classical(herd=True) # "2 buffalo" INSTEAD OF "2 buffalos"
230
+ p.classical(herd=False) # "2 buffalos" INSTEAD OF "2 buffalo"
231
+
232
+ p.classical(persons=True) # "2 chairpersons" INSTEAD OF "2 chairpeople"
233
+ p.classical(persons=False) # "2 chairpeople" INSTEAD OF "2 chairpersons"
234
+
235
+ p.classical(ancient=True) # "2 formulae" INSTEAD OF "2 formulas"
236
+ p.classical(ancient=False) # "2 formulas" INSTEAD OF "2 formulae"
237
+
238
+
239
+ # INTERPOLATE "plural()", "plural_noun()", "plural_verb()", "plural_adj()", "singular_noun()",
240
+ # a()", "an()", "num()" AND "ordinal()" WITHIN STRINGS:
241
+
242
+ print(p.inflect("The plural of {0} is plural('{0}')".format(word)))
243
+ print(p.inflect("The singular of {0} is singular_noun('{0}')".format(word)))
244
+ print(p.inflect("I saw {0} plural('cat',{0})".format(cat_count)))
245
+ print(
246
+ p.inflect(
247
+ "plural('I',{0}) "
248
+ "plural_verb('saw',{0}) "
249
+ "plural('a',{1}) "
250
+ "plural_noun('saw',{1})".format(N1, N2)
251
+ )
252
+ )
253
+ print(
254
+ p.inflect(
255
+ "num({0}, False)plural('I') "
256
+ "plural_verb('saw') "
257
+ "num({1}, False)plural('a') "
258
+ "plural_noun('saw')".format(N1, N2)
259
+ )
260
+ )
261
+ print(p.inflect("I saw num({0}) plural('cat')\nnum()".format(cat_count)))
262
+ print(p.inflect("There plural_verb('was',{0}) no('error',{0})".format(errors)))
263
+ print(p.inflect("There num({0}, False)plural_verb('was') no('error')".format(errors)))
264
+ print(p.inflect("Did you want a('{0}') or an('{1}')".format(thing, idea)))
265
+ print(p.inflect("It was ordinal('{0}') from the left".format(position)))
266
+
267
+
268
+ # ADD USER-DEFINED INFLECTIONS (OVERRIDING INBUILT RULES):
269
+
270
+ p.defnoun("VAX", "VAXen") # SINGULAR => PLURAL
271
+
272
+ p.defverb(
273
+ "will", # 1ST PERSON SINGULAR
274
+ "shall", # 1ST PERSON PLURAL
275
+ "will", # 2ND PERSON SINGULAR
276
+ "will", # 2ND PERSON PLURAL
277
+ "will", # 3RD PERSON SINGULAR
278
+ "will", # 3RD PERSON PLURAL
279
+ )
280
+
281
+ p.defadj("hir", "their") # SINGULAR => PLURAL
282
+
283
+ p.defa("h") # "AY HALWAYS SEZ 'HAITCH'!"
284
+
285
+ p.defan("horrendous.*") # "AN HORRENDOUS AFFECTATION"
286
+
287
+
288
+ DESCRIPTION
289
+ ===========
290
+
291
+ The methods of the class ``engine`` in module ``inflect.py`` provide plural
292
+ inflections, singular noun inflections, "a"/"an" selection for English words,
293
+ and manipulation of numbers as words.
294
+
295
+ Plural forms of all nouns, most verbs, and some adjectives are
296
+ provided. Where appropriate, "classical" variants (for example: "brother" ->
297
+ "brethren", "dogma" -> "dogmata", etc.) are also provided.
298
+
299
+ Single forms of nouns are also provided. The gender of singular pronouns
300
+ can be chosen (for example "they" -> "it" or "she" or "he" or "they").
301
+
302
+ Pronunciation-based "a"/"an" selection is provided for all English
303
+ words, and most initialisms.
304
+
305
+ It is also possible to inflect numerals (1,2,3) to ordinals (1st, 2nd, 3rd)
306
+ and to English words ("one", "two", "three").
307
+
308
+ In generating these inflections, ``inflect.py`` follows the Oxford
309
+ English Dictionary and the guidelines in Fowler's Modern English
310
+ Usage, preferring the former where the two disagree.
311
+
312
+ The module is built around standard British spelling, but is designed
313
+ to cope with common American variants as well. Slang, jargon, and
314
+ other English dialects are *not* explicitly catered for.
315
+
316
+ Where two or more inflected forms exist for a single word (typically a
317
+ "classical" form and a "modern" form), ``inflect.py`` prefers the
318
+ more common form (typically the "modern" one), unless "classical"
319
+ processing has been specified
320
+ (see `MODERN VS CLASSICAL INFLECTIONS`).
321
+
322
+ FORMING PLURALS AND SINGULARS
323
+ =============================
324
+
325
+ Inflecting Plurals and Singulars
326
+ --------------------------------
327
+
328
+ All of the ``plural...`` plural inflection methods take the word to be
329
+ inflected as their first argument and return the corresponding inflection.
330
+ Note that all such methods expect the *singular* form of the word. The
331
+ results of passing a plural form are undefined (and unlikely to be correct).
332
+ Similarly, the ``si...`` singular inflection method expects the *plural*
333
+ form of the word.
334
+
335
+ The ``plural...`` methods also take an optional second argument,
336
+ which indicates the grammatical "number" of the word (or of another word
337
+ with which the word being inflected must agree). If the "number" argument is
338
+ supplied and is not ``1`` (or ``"one"`` or ``"a"``, or some other adjective that
339
+ implies the singular), the plural form of the word is returned. If the
340
+ "number" argument *does* indicate singularity, the (uninflected) word
341
+ itself is returned. If the number argument is omitted, the plural form
342
+ is returned unconditionally.
343
+
344
+ The ``si...`` method takes a second argument in a similar fashion. If it is
345
+ some form of the number ``1``, or is omitted, the singular form is returned.
346
+ Otherwise the plural is returned unaltered.
347
+
348
+
349
+ The various methods of ``inflect.engine`` are:
350
+
351
+
352
+
353
+ ``plural_noun(word, count=None)``
354
+
355
+ The method ``plural_noun()`` takes a *singular* English noun or
356
+ pronoun and returns its plural. Pronouns in the nominative ("I" ->
357
+ "we") and accusative ("me" -> "us") cases are handled, as are
358
+ possessive pronouns ("mine" -> "ours").
359
+
360
+
361
+ ``plural_verb(word, count=None)``
362
+
363
+ The method ``plural_verb()`` takes the *singular* form of a
364
+ conjugated verb (that is, one which is already in the correct "person"
365
+ and "mood") and returns the corresponding plural conjugation.
366
+
367
+
368
+ ``plural_adj(word, count=None)``
369
+
370
+ The method ``plural_adj()`` takes the *singular* form of
371
+ certain types of adjectives and returns the corresponding plural form.
372
+ Adjectives that are correctly handled include: "numerical" adjectives
373
+ ("a" -> "some"), demonstrative adjectives ("this" -> "these", "that" ->
374
+ "those"), and possessives ("my" -> "our", "cat's" -> "cats'", "child's"
375
+ -> "childrens'", etc.)
376
+
377
+
378
+ ``plural(word, count=None)``
379
+
380
+ The method ``plural()`` takes a *singular* English noun,
381
+ pronoun, verb, or adjective and returns its plural form. Where a word
382
+ has more than one inflection depending on its part of speech (for
383
+ example, the noun "thought" inflects to "thoughts", the verb "thought"
384
+ to "thought"), the (singular) noun sense is preferred to the (singular)
385
+ verb sense.
386
+
387
+ Hence ``plural("knife")`` will return "knives" ("knife" having been treated
388
+ as a singular noun), whereas ``plural("knifes")`` will return "knife"
389
+ ("knifes" having been treated as a 3rd person singular verb).
390
+
391
+ The inherent ambiguity of such cases suggests that,
392
+ where the part of speech is known, ``plural_noun``, ``plural_verb``, and
393
+ ``plural_adj`` should be used in preference to ``plural``.
394
+
395
+
396
+ ``singular_noun(word, count=None)``
397
+
398
+ The method ``singular_noun()`` takes a *plural* English noun or
399
+ pronoun and returns its singular. Pronouns in the nominative ("we" ->
400
+ "I") and accusative ("us" -> "me") cases are handled, as are
401
+ possessive pronouns ("ours" -> "mine"). When third person
402
+ singular pronouns are returned they take the neuter gender by default
403
+ ("they" -> "it"), not ("they"-> "she") nor ("they" -> "he"). This can be
404
+ changed with ``gender()``.
405
+
406
+ Note that all these methods ignore any whitespace surrounding the
407
+ word being inflected, but preserve that whitespace when the result is
408
+ returned. For example, ``plural(" cat ")`` returns " cats ".
409
+
410
+
411
+ ``gender(genderletter)``
412
+
413
+ The third person plural pronoun takes the same form for the female, male and
414
+ neuter (e.g. "they"). The singular however, depends upon gender (e.g. "she",
415
+ "he", "it" and "they" -- "they" being the gender neutral form.) By default
416
+ ``singular_noun`` returns the neuter form, however, the gender can be selected with
417
+ the ``gender`` method. Pass the first letter of the gender to
418
+ ``gender`` to return the f(eminine), m(asculine), n(euter) or t(hey)
419
+ form of the singular. e.g.
420
+ gender('f') followed by singular_noun('themselves') returns 'herself'.
421
+
422
+ Numbered plurals
423
+ ----------------
424
+
425
+ The ``plural...`` methods return only the inflected word, not the count that
426
+ was used to inflect it. Thus, in order to produce "I saw 3 ducks", it
427
+ is necessary to use:
428
+
429
+ .. code-block:: python
430
+
431
+ print("I saw", N, p.plural_noun(animal, N))
432
+
433
+ Since the usual purpose of producing a plural is to make it agree with
434
+ a preceding count, inflect.py provides a method
435
+ (``no(word, count)``) which, given a word and a(n optional) count, returns the
436
+ count followed by the correctly inflected word. Hence the previous
437
+ example can be rewritten:
438
+
439
+ .. code-block:: python
440
+
441
+ print("I saw ", p.no(animal, N))
442
+
443
+ In addition, if the count is zero (or some other term which implies
444
+ zero, such as ``"zero"``, ``"nil"``, etc.) the count is replaced by the
445
+ word "no". Hence, if ``N`` had the value zero, the previous example
446
+ would print (the somewhat more elegant)::
447
+
448
+ I saw no animals
449
+
450
+ rather than::
451
+
452
+ I saw 0 animals
453
+
454
+ Note that the name of the method is a pun: the method
455
+ returns either a number (a *No.*) or a ``"no"``, in front of the
456
+ inflected word.
457
+
458
+
459
+ Reducing the number of counts required
460
+ --------------------------------------
461
+
462
+ In some contexts, the need to supply an explicit count to the various
463
+ ``plural...`` methods makes for tiresome repetition. For example:
464
+
465
+ .. code-block:: python
466
+
467
+ print(
468
+ plural_adj("This", errors),
469
+ plural_noun(" error", errors),
470
+ plural_verb(" was", errors),
471
+ " fatal.",
472
+ )
473
+
474
+ inflect.py therefore provides a method
475
+ (``num(count=None, show=None)``) which may be used to set a persistent "default number"
476
+ value. If such a value is set, it is subsequently used whenever an
477
+ optional second "number" argument is omitted. The default value thus set
478
+ can subsequently be removed by calling ``num()`` with no arguments.
479
+ Hence we could rewrite the previous example:
480
+
481
+ .. code-block:: python
482
+
483
+ p.num(errors)
484
+ print(p.plural_adj("This"), p.plural_noun(" error"), p.plural_verb(" was"), "fatal.")
485
+ p.num()
486
+
487
+ Normally, ``num()`` returns its first argument, so that it may also
488
+ be "inlined" in contexts like:
489
+
490
+ .. code-block:: python
491
+
492
+ print(p.num(errors), p.plural_noun(" error"), p.plural_verb(" was"), " detected.")
493
+ if severity > 1:
494
+ print(
495
+ p.plural_adj("This"), p.plural_noun(" error"), p.plural_verb(" was"), "fatal."
496
+ )
497
+
498
+ However, in certain contexts (see `INTERPOLATING INFLECTIONS IN STRINGS`)
499
+ it is preferable that ``num()`` return an empty string. Hence ``num()``
500
+ provides an optional second argument. If that argument is supplied (that is, if
501
+ it is defined) and evaluates to false, ``num`` returns an empty string
502
+ instead of its first argument. For example:
503
+
504
+ .. code-block:: python
505
+
506
+ print(p.num(errors, 0), p.no("error"), p.plural_verb(" was"), " detected.")
507
+ if severity > 1:
508
+ print(
509
+ p.plural_adj("This"), p.plural_noun(" error"), p.plural_verb(" was"), "fatal."
510
+ )
511
+
512
+
513
+
514
+ Number-insensitive equality
515
+ ---------------------------
516
+
517
+ inflect.py also provides a solution to the problem
518
+ of comparing words of differing plurality through the methods
519
+ ``compare(word1, word2)``, ``compare_nouns(word1, word2)``,
520
+ ``compare_verbs(word1, word2)``, and ``compare_adjs(word1, word2)``.
521
+ Each of these methods takes two strings, and compares them
522
+ using the corresponding plural-inflection method (``plural()``, ``plural_noun()``,
523
+ ``plural_verb()``, and ``plural_adj()`` respectively).
524
+
525
+ The comparison returns true if:
526
+
527
+ - the strings are equal, or
528
+ - one string is equal to a plural form of the other, or
529
+ - the strings are two different plural forms of the one word.
530
+
531
+
532
+ Hence all of the following return true:
533
+
534
+ .. code-block:: python
535
+
536
+ p.compare("index", "index") # RETURNS "eq"
537
+ p.compare("index", "indexes") # RETURNS "s:p"
538
+ p.compare("index", "indices") # RETURNS "s:p"
539
+ p.compare("indexes", "index") # RETURNS "p:s"
540
+ p.compare("indices", "index") # RETURNS "p:s"
541
+ p.compare("indices", "indexes") # RETURNS "p:p"
542
+ p.compare("indexes", "indices") # RETURNS "p:p"
543
+ p.compare("indices", "indices") # RETURNS "eq"
544
+
545
+ As indicated by the comments in the previous example, the actual value
546
+ returned by the various ``compare`` methods encodes which of the
547
+ three equality rules succeeded: "eq" is returned if the strings were
548
+ identical, "s:p" if the strings were singular and plural respectively,
549
+ "p:s" for plural and singular, and "p:p" for two distinct plurals.
550
+ Inequality is indicated by returning an empty string.
551
+
552
+ It should be noted that two distinct singular words which happen to take
553
+ the same plural form are *not* considered equal, nor are cases where
554
+ one (singular) word's plural is the other (plural) word's singular.
555
+ Hence all of the following return false:
556
+
557
+ .. code-block:: python
558
+
559
+ p.compare("base", "basis") # ALTHOUGH BOTH -> "bases"
560
+ p.compare("syrinx", "syringe") # ALTHOUGH BOTH -> "syringes"
561
+ p.compare("she", "he") # ALTHOUGH BOTH -> "they"
562
+
563
+ p.compare("opus", "operas") # ALTHOUGH "opus" -> "opera" -> "operas"
564
+ p.compare("taxi", "taxes") # ALTHOUGH "taxi" -> "taxis" -> "taxes"
565
+
566
+ Note too that, although the comparison is "number-insensitive" it is *not*
567
+ case-insensitive (that is, ``plural("time","Times")`` returns false. To obtain
568
+ both number and case insensitivity, use the ``lower()`` method on both strings
569
+ (that is, ``plural("time".lower(), "Times".lower())`` returns true).
570
+
571
+ Related Functionality
572
+ =====================
573
+
574
+ Shout out to these libraries that provide related functionality:
575
+
576
+ * `WordSet <https://jaracotext.readthedocs.io/en/latest/#jaraco.text.WordSet>`_
577
+ parses identifiers like variable names into sets of words suitable for re-assembling
578
+ in another form.
579
+
580
+ * `word2number <https://pypi.org/project/word2number/>`_ converts words to
581
+ a number.
582
+
583
+
584
+ For Enterprise
585
+ ==============
586
+
587
+ Available as part of the Tidelift Subscription.
588
+
589
+ This project and the maintainers of thousands of other packages are working with Tidelift to deliver one enterprise subscription that covers all of the open source you use.
590
+
591
+ `Learn more <https://tidelift.com/subscription/pkg/pypi-PROJECT?utm_source=pypi-PROJECT&utm_medium=referral&utm_campaign=github>`_.
falcon/lib/python3.10/site-packages/setuptools/_vendor/inflect-7.3.1.dist-info/RECORD ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ inflect-7.3.1.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
2
+ inflect-7.3.1.dist-info/LICENSE,sha256=htoPAa6uRjSKPD1GUZXcHOzN55956HdppkuNoEsqR0E,1023
3
+ inflect-7.3.1.dist-info/METADATA,sha256=ZgMNY0WAZRs-U8wZiV2SMfjSKqBrMngXyDMs_CAwMwg,21079
4
+ inflect-7.3.1.dist-info/RECORD,,
5
+ inflect-7.3.1.dist-info/WHEEL,sha256=y4mX-SOX4fYIkonsAGA5N0Oy-8_gI4FXw5HNI1xqvWg,91
6
+ inflect-7.3.1.dist-info/top_level.txt,sha256=m52ujdp10CqT6jh1XQxZT6kEntcnv-7Tl7UiGNTzWZA,8
7
+ inflect/__init__.py,sha256=Jxy1HJXZiZ85kHeLAhkmvz6EMTdFqBe-duvt34R6IOc,103796
8
+ inflect/__pycache__/__init__.cpython-312.pyc,,
9
+ inflect/compat/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
+ inflect/compat/__pycache__/__init__.cpython-312.pyc,,
11
+ inflect/compat/__pycache__/py38.cpython-312.pyc,,
12
+ inflect/compat/py38.py,sha256=oObVfVnWX9_OpnOuEJn1mFbJxVhwyR5epbiTNXDDaso,160
13
+ inflect/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
falcon/lib/python3.10/site-packages/setuptools/_vendor/inflect-7.3.1.dist-info/WHEEL ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (70.2.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
falcon/lib/python3.10/site-packages/setuptools/_vendor/inflect-7.3.1.dist-info/top_level.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ inflect
falcon/lib/python3.10/site-packages/setuptools/_vendor/inflect/compat/__init__.py ADDED
File without changes
falcon/lib/python3.10/site-packages/setuptools/_vendor/jaraco.text-3.12.1.dist-info/RECORD ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jaraco.text-3.12.1.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
2
+ jaraco.text-3.12.1.dist-info/LICENSE,sha256=htoPAa6uRjSKPD1GUZXcHOzN55956HdppkuNoEsqR0E,1023
3
+ jaraco.text-3.12.1.dist-info/METADATA,sha256=AzWdm6ViMfDOPoQMfLWn2zgBQSGJScyqeN29TcuWXVI,3658
4
+ jaraco.text-3.12.1.dist-info/RECORD,,
5
+ jaraco.text-3.12.1.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
+ jaraco.text-3.12.1.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
7
+ jaraco.text-3.12.1.dist-info/top_level.txt,sha256=0JnN3LfXH4LIRfXL-QFOGCJzQWZO3ELx4R1d_louoQM,7
8
+ jaraco/text/Lorem ipsum.txt,sha256=N_7c_79zxOufBY9HZ3yzMgOkNv-TkOTTio4BydrSjgs,1335
9
+ jaraco/text/__init__.py,sha256=Y2YUqXR_orUoDaY4SkPRe6ZZhb5HUHB_Ah9RCNsVyho,16250
10
+ jaraco/text/__pycache__/__init__.cpython-312.pyc,,
11
+ jaraco/text/__pycache__/layouts.cpython-312.pyc,,
12
+ jaraco/text/__pycache__/show-newlines.cpython-312.pyc,,
13
+ jaraco/text/__pycache__/strip-prefix.cpython-312.pyc,,
14
+ jaraco/text/__pycache__/to-dvorak.cpython-312.pyc,,
15
+ jaraco/text/__pycache__/to-qwerty.cpython-312.pyc,,
16
+ jaraco/text/layouts.py,sha256=HTC8aSTLZ7uXipyOXapRMC158juecjK6RVwitfmZ9_w,643
17
+ jaraco/text/show-newlines.py,sha256=WGQa65e8lyhb92LUOLqVn6KaCtoeVgVws6WtSRmLk6w,904
18
+ jaraco/text/strip-prefix.py,sha256=NfVXV8JVNo6nqcuYASfMV7_y4Eo8zMQqlCOGvAnRIVw,412
19
+ jaraco/text/to-dvorak.py,sha256=1SNcbSsvISpXXg-LnybIHHY-RUFOQr36zcHkY1pWFqw,119
20
+ jaraco/text/to-qwerty.py,sha256=s4UMQUnPwFn_dB5uZC27BurHOQcYondBfzIpVL5pEzw,119
falcon/lib/python3.10/site-packages/setuptools/_vendor/jaraco.text-3.12.1.dist-info/REQUESTED ADDED
File without changes
falcon/lib/python3.10/site-packages/setuptools/_vendor/jaraco.text-3.12.1.dist-info/WHEEL ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ Wheel-Version: 1.0
2
+ Generator: bdist_wheel (0.43.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
falcon/lib/python3.10/site-packages/setuptools/_vendor/tomli/__pycache__/_parser.cpython-310.pyc ADDED
Binary file (17 kB). View file
 
falcon/lib/python3.10/site-packages/setuptools/_vendor/wheel/__init__.py ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ from __future__ import annotations
2
+
3
+ __version__ = "0.43.0"