Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- env-llmeval/lib/python3.10/site-packages/Jinja2-3.1.3.dist-info/INSTALLER +1 -0
- env-llmeval/lib/python3.10/site-packages/Jinja2-3.1.3.dist-info/LICENSE.rst +28 -0
- env-llmeval/lib/python3.10/site-packages/Jinja2-3.1.3.dist-info/METADATA +105 -0
- env-llmeval/lib/python3.10/site-packages/Jinja2-3.1.3.dist-info/RECORD +58 -0
- env-llmeval/lib/python3.10/site-packages/Jinja2-3.1.3.dist-info/WHEEL +5 -0
- env-llmeval/lib/python3.10/site-packages/Jinja2-3.1.3.dist-info/entry_points.txt +2 -0
- env-llmeval/lib/python3.10/site-packages/Jinja2-3.1.3.dist-info/top_level.txt +1 -0
- env-llmeval/lib/python3.10/site-packages/absl/testing/__init__.py +13 -0
- env-llmeval/lib/python3.10/site-packages/absl/testing/__pycache__/__init__.cpython-310.pyc +0 -0
- env-llmeval/lib/python3.10/site-packages/absl/testing/__pycache__/_pretty_print_reporter.cpython-310.pyc +0 -0
- env-llmeval/lib/python3.10/site-packages/absl/testing/__pycache__/parameterized.cpython-310.pyc +0 -0
- env-llmeval/lib/python3.10/site-packages/absl/testing/__pycache__/xml_reporter.cpython-310.pyc +0 -0
- env-llmeval/lib/python3.10/site-packages/absl/testing/_bazelize_command.py +68 -0
- env-llmeval/lib/python3.10/site-packages/absl/testing/absltest.py +0 -0
- env-llmeval/lib/python3.10/site-packages/absl/testing/flagsaver.py +386 -0
- env-llmeval/lib/python3.10/site-packages/absl/testing/parameterized.py +724 -0
- env-llmeval/lib/python3.10/site-packages/absl/testing/xml_reporter.py +563 -0
- env-llmeval/lib/python3.10/site-packages/accelerate-0.29.2.dist-info/INSTALLER +1 -0
- env-llmeval/lib/python3.10/site-packages/accelerate-0.29.2.dist-info/LICENSE +201 -0
- env-llmeval/lib/python3.10/site-packages/accelerate-0.29.2.dist-info/METADATA +378 -0
- env-llmeval/lib/python3.10/site-packages/accelerate-0.29.2.dist-info/RECORD +163 -0
- env-llmeval/lib/python3.10/site-packages/accelerate-0.29.2.dist-info/WHEEL +5 -0
- env-llmeval/lib/python3.10/site-packages/accelerate-0.29.2.dist-info/entry_points.txt +5 -0
- env-llmeval/lib/python3.10/site-packages/accelerate-0.29.2.dist-info/top_level.txt +1 -0
- env-llmeval/lib/python3.10/site-packages/certifi-2024.2.2.dist-info/INSTALLER +1 -0
- env-llmeval/lib/python3.10/site-packages/certifi-2024.2.2.dist-info/LICENSE +20 -0
- env-llmeval/lib/python3.10/site-packages/certifi-2024.2.2.dist-info/METADATA +66 -0
- env-llmeval/lib/python3.10/site-packages/certifi-2024.2.2.dist-info/RECORD +14 -0
- env-llmeval/lib/python3.10/site-packages/certifi-2024.2.2.dist-info/WHEEL +5 -0
- env-llmeval/lib/python3.10/site-packages/certifi-2024.2.2.dist-info/top_level.txt +1 -0
- env-llmeval/lib/python3.10/site-packages/chardet-5.2.0.dist-info/INSTALLER +1 -0
- env-llmeval/lib/python3.10/site-packages/chardet-5.2.0.dist-info/WHEEL +5 -0
- env-llmeval/lib/python3.10/site-packages/chardet-5.2.0.dist-info/entry_points.txt +2 -0
- env-llmeval/lib/python3.10/site-packages/click/__pycache__/_termui_impl.cpython-310.pyc +0 -0
- env-llmeval/lib/python3.10/site-packages/click/__pycache__/_winconsole.cpython-310.pyc +0 -0
- env-llmeval/lib/python3.10/site-packages/click/__pycache__/core.cpython-310.pyc +0 -0
- env-llmeval/lib/python3.10/site-packages/click/__pycache__/decorators.cpython-310.pyc +0 -0
- env-llmeval/lib/python3.10/site-packages/click/__pycache__/exceptions.cpython-310.pyc +0 -0
- env-llmeval/lib/python3.10/site-packages/click/__pycache__/formatting.cpython-310.pyc +0 -0
- env-llmeval/lib/python3.10/site-packages/click/__pycache__/termui.cpython-310.pyc +0 -0
- env-llmeval/lib/python3.10/site-packages/filelock-3.13.4.dist-info/RECORD +22 -0
- env-llmeval/lib/python3.10/site-packages/filelock-3.13.4.dist-info/WHEEL +4 -0
- env-llmeval/lib/python3.10/site-packages/fsspec-2024.2.0.dist-info/INSTALLER +1 -0
- env-llmeval/lib/python3.10/site-packages/fsspec-2024.2.0.dist-info/LICENSE +29 -0
- env-llmeval/lib/python3.10/site-packages/fsspec-2024.2.0.dist-info/METADATA +167 -0
- env-llmeval/lib/python3.10/site-packages/fsspec-2024.2.0.dist-info/RECORD +104 -0
- env-llmeval/lib/python3.10/site-packages/fsspec-2024.2.0.dist-info/WHEEL +5 -0
- env-llmeval/lib/python3.10/site-packages/fsspec-2024.2.0.dist-info/top_level.txt +1 -0
- env-llmeval/lib/python3.10/site-packages/huggingface_hub-0.22.2.dist-info/INSTALLER +1 -0
- env-llmeval/lib/python3.10/site-packages/huggingface_hub-0.22.2.dist-info/LICENSE +201 -0
env-llmeval/lib/python3.10/site-packages/Jinja2-3.1.3.dist-info/INSTALLER
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
pip
|
env-llmeval/lib/python3.10/site-packages/Jinja2-3.1.3.dist-info/LICENSE.rst
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Copyright 2007 Pallets
|
2 |
+
|
3 |
+
Redistribution and use in source and binary forms, with or without
|
4 |
+
modification, are permitted provided that the following conditions are
|
5 |
+
met:
|
6 |
+
|
7 |
+
1. Redistributions of source code must retain the above copyright
|
8 |
+
notice, this list of conditions and the following disclaimer.
|
9 |
+
|
10 |
+
2. Redistributions in binary form must reproduce the above copyright
|
11 |
+
notice, this list of conditions and the following disclaimer in the
|
12 |
+
documentation and/or other materials provided with the distribution.
|
13 |
+
|
14 |
+
3. Neither the name of the copyright holder nor the names of its
|
15 |
+
contributors may be used to endorse or promote products derived from
|
16 |
+
this software without specific prior written permission.
|
17 |
+
|
18 |
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
19 |
+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
20 |
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
21 |
+
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
22 |
+
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
23 |
+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
|
24 |
+
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
25 |
+
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
26 |
+
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
27 |
+
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
28 |
+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
env-llmeval/lib/python3.10/site-packages/Jinja2-3.1.3.dist-info/METADATA
ADDED
@@ -0,0 +1,105 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Metadata-Version: 2.1
|
2 |
+
Name: Jinja2
|
3 |
+
Version: 3.1.3
|
4 |
+
Summary: A very fast and expressive template engine.
|
5 |
+
Home-page: https://palletsprojects.com/p/jinja/
|
6 |
+
Maintainer: Pallets
|
7 |
+
Maintainer-email: [email protected]
|
8 |
+
License: BSD-3-Clause
|
9 |
+
Project-URL: Donate, https://palletsprojects.com/donate
|
10 |
+
Project-URL: Documentation, https://jinja.palletsprojects.com/
|
11 |
+
Project-URL: Changes, https://jinja.palletsprojects.com/changes/
|
12 |
+
Project-URL: Source Code, https://github.com/pallets/jinja/
|
13 |
+
Project-URL: Issue Tracker, https://github.com/pallets/jinja/issues/
|
14 |
+
Project-URL: Chat, https://discord.gg/pallets
|
15 |
+
Classifier: Development Status :: 5 - Production/Stable
|
16 |
+
Classifier: Environment :: Web Environment
|
17 |
+
Classifier: Intended Audience :: Developers
|
18 |
+
Classifier: License :: OSI Approved :: BSD License
|
19 |
+
Classifier: Operating System :: OS Independent
|
20 |
+
Classifier: Programming Language :: Python
|
21 |
+
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
|
22 |
+
Classifier: Topic :: Text Processing :: Markup :: HTML
|
23 |
+
Requires-Python: >=3.7
|
24 |
+
Description-Content-Type: text/x-rst
|
25 |
+
License-File: LICENSE.rst
|
26 |
+
Requires-Dist: MarkupSafe >=2.0
|
27 |
+
Provides-Extra: i18n
|
28 |
+
Requires-Dist: Babel >=2.7 ; extra == 'i18n'
|
29 |
+
|
30 |
+
Jinja
|
31 |
+
=====
|
32 |
+
|
33 |
+
Jinja is a fast, expressive, extensible templating engine. Special
|
34 |
+
placeholders in the template allow writing code similar to Python
|
35 |
+
syntax. Then the template is passed data to render the final document.
|
36 |
+
|
37 |
+
It includes:
|
38 |
+
|
39 |
+
- Template inheritance and inclusion.
|
40 |
+
- Define and import macros within templates.
|
41 |
+
- HTML templates can use autoescaping to prevent XSS from untrusted
|
42 |
+
user input.
|
43 |
+
- A sandboxed environment can safely render untrusted templates.
|
44 |
+
- AsyncIO support for generating templates and calling async
|
45 |
+
functions.
|
46 |
+
- I18N support with Babel.
|
47 |
+
- Templates are compiled to optimized Python code just-in-time and
|
48 |
+
cached, or can be compiled ahead-of-time.
|
49 |
+
- Exceptions point to the correct line in templates to make debugging
|
50 |
+
easier.
|
51 |
+
- Extensible filters, tests, functions, and even syntax.
|
52 |
+
|
53 |
+
Jinja's philosophy is that while application logic belongs in Python if
|
54 |
+
possible, it shouldn't make the template designer's job difficult by
|
55 |
+
restricting functionality too much.
|
56 |
+
|
57 |
+
|
58 |
+
Installing
|
59 |
+
----------
|
60 |
+
|
61 |
+
Install and update using `pip`_:
|
62 |
+
|
63 |
+
.. code-block:: text
|
64 |
+
|
65 |
+
$ pip install -U Jinja2
|
66 |
+
|
67 |
+
.. _pip: https://pip.pypa.io/en/stable/getting-started/
|
68 |
+
|
69 |
+
|
70 |
+
In A Nutshell
|
71 |
+
-------------
|
72 |
+
|
73 |
+
.. code-block:: jinja
|
74 |
+
|
75 |
+
{% extends "base.html" %}
|
76 |
+
{% block title %}Members{% endblock %}
|
77 |
+
{% block content %}
|
78 |
+
<ul>
|
79 |
+
{% for user in users %}
|
80 |
+
<li><a href="{{ user.url }}">{{ user.username }}</a></li>
|
81 |
+
{% endfor %}
|
82 |
+
</ul>
|
83 |
+
{% endblock %}
|
84 |
+
|
85 |
+
|
86 |
+
Donate
|
87 |
+
------
|
88 |
+
|
89 |
+
The Pallets organization develops and supports Jinja and other popular
|
90 |
+
packages. In order to grow the community of contributors and users, and
|
91 |
+
allow the maintainers to devote more time to the projects, `please
|
92 |
+
donate today`_.
|
93 |
+
|
94 |
+
.. _please donate today: https://palletsprojects.com/donate
|
95 |
+
|
96 |
+
|
97 |
+
Links
|
98 |
+
-----
|
99 |
+
|
100 |
+
- Documentation: https://jinja.palletsprojects.com/
|
101 |
+
- Changes: https://jinja.palletsprojects.com/changes/
|
102 |
+
- PyPI Releases: https://pypi.org/project/Jinja2/
|
103 |
+
- Source Code: https://github.com/pallets/jinja/
|
104 |
+
- Issue Tracker: https://github.com/pallets/jinja/issues/
|
105 |
+
- Chat: https://discord.gg/pallets
|
env-llmeval/lib/python3.10/site-packages/Jinja2-3.1.3.dist-info/RECORD
ADDED
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Jinja2-3.1.3.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
|
2 |
+
Jinja2-3.1.3.dist-info/LICENSE.rst,sha256=O0nc7kEF6ze6wQ-vG-JgQI_oXSUrjp3y4JefweCUQ3s,1475
|
3 |
+
Jinja2-3.1.3.dist-info/METADATA,sha256=0cLNbRCI91jytc7Bzv3XAQfZzFDF2gxkJuH46eF5vew,3301
|
4 |
+
Jinja2-3.1.3.dist-info/RECORD,,
|
5 |
+
Jinja2-3.1.3.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
|
6 |
+
Jinja2-3.1.3.dist-info/entry_points.txt,sha256=zRd62fbqIyfUpsRtU7EVIFyiu1tPwfgO7EvPErnxgTE,59
|
7 |
+
Jinja2-3.1.3.dist-info/top_level.txt,sha256=PkeVWtLb3-CqjWi1fO29OCbj55EhX_chhKrCdrVe_zs,7
|
8 |
+
jinja2/__init__.py,sha256=NTBwMwsECrdHmxeXF7seusHLzrh6Ldn1A9qhS5cDuf0,1927
|
9 |
+
jinja2/__pycache__/__init__.cpython-310.pyc,,
|
10 |
+
jinja2/__pycache__/_identifier.cpython-310.pyc,,
|
11 |
+
jinja2/__pycache__/async_utils.cpython-310.pyc,,
|
12 |
+
jinja2/__pycache__/bccache.cpython-310.pyc,,
|
13 |
+
jinja2/__pycache__/compiler.cpython-310.pyc,,
|
14 |
+
jinja2/__pycache__/constants.cpython-310.pyc,,
|
15 |
+
jinja2/__pycache__/debug.cpython-310.pyc,,
|
16 |
+
jinja2/__pycache__/defaults.cpython-310.pyc,,
|
17 |
+
jinja2/__pycache__/environment.cpython-310.pyc,,
|
18 |
+
jinja2/__pycache__/exceptions.cpython-310.pyc,,
|
19 |
+
jinja2/__pycache__/ext.cpython-310.pyc,,
|
20 |
+
jinja2/__pycache__/filters.cpython-310.pyc,,
|
21 |
+
jinja2/__pycache__/idtracking.cpython-310.pyc,,
|
22 |
+
jinja2/__pycache__/lexer.cpython-310.pyc,,
|
23 |
+
jinja2/__pycache__/loaders.cpython-310.pyc,,
|
24 |
+
jinja2/__pycache__/meta.cpython-310.pyc,,
|
25 |
+
jinja2/__pycache__/nativetypes.cpython-310.pyc,,
|
26 |
+
jinja2/__pycache__/nodes.cpython-310.pyc,,
|
27 |
+
jinja2/__pycache__/optimizer.cpython-310.pyc,,
|
28 |
+
jinja2/__pycache__/parser.cpython-310.pyc,,
|
29 |
+
jinja2/__pycache__/runtime.cpython-310.pyc,,
|
30 |
+
jinja2/__pycache__/sandbox.cpython-310.pyc,,
|
31 |
+
jinja2/__pycache__/tests.cpython-310.pyc,,
|
32 |
+
jinja2/__pycache__/utils.cpython-310.pyc,,
|
33 |
+
jinja2/__pycache__/visitor.cpython-310.pyc,,
|
34 |
+
jinja2/_identifier.py,sha256=_zYctNKzRqlk_murTNlzrju1FFJL7Va_Ijqqd7ii2lU,1958
|
35 |
+
jinja2/async_utils.py,sha256=dFcmh6lMNfbh7eLKrBio8JqAKLHdZbpCuurFN4OERtY,2447
|
36 |
+
jinja2/bccache.py,sha256=mhz5xtLxCcHRAa56azOhphIAe19u1we0ojifNMClDio,14061
|
37 |
+
jinja2/compiler.py,sha256=PJzYdRLStlEOqmnQs1YxlizPrJoj3jTZuUleREn6AIQ,72199
|
38 |
+
jinja2/constants.py,sha256=GMoFydBF_kdpaRKPoM5cl5MviquVRLVyZtfp5-16jg0,1433
|
39 |
+
jinja2/debug.py,sha256=iWJ432RadxJNnaMOPrjIDInz50UEgni3_HKuFXi2vuQ,6299
|
40 |
+
jinja2/defaults.py,sha256=boBcSw78h-lp20YbaXSJsqkAI2uN_mD_TtCydpeq5wU,1267
|
41 |
+
jinja2/environment.py,sha256=0qldX3VQKZcm6lgn7zHz94oRFow7YPYERiqkquomNjU,61253
|
42 |
+
jinja2/exceptions.py,sha256=ioHeHrWwCWNaXX1inHmHVblvc4haO7AXsjCp3GfWvx0,5071
|
43 |
+
jinja2/ext.py,sha256=5fnMpllaXkfm2P_93RIvi-OnK7Tk8mCW8Du-GcD12Hc,31844
|
44 |
+
jinja2/filters.py,sha256=vYjKb2zaPShvYtn_LpSmqfS8SScbrA_KOanNibsMDIE,53862
|
45 |
+
jinja2/idtracking.py,sha256=GfNmadir4oDALVxzn3DL9YInhJDr69ebXeA2ygfuCGA,10704
|
46 |
+
jinja2/lexer.py,sha256=DW2nX9zk-6MWp65YR2bqqj0xqCvLtD-u9NWT8AnFRxQ,29726
|
47 |
+
jinja2/loaders.py,sha256=ayAwxfrA1SAffQta0nwSDm3TDT4KYiIGN_D9Z45B310,23085
|
48 |
+
jinja2/meta.py,sha256=GNPEvifmSaU3CMxlbheBOZjeZ277HThOPUTf1RkppKQ,4396
|
49 |
+
jinja2/nativetypes.py,sha256=7GIGALVJgdyL80oZJdQUaUfwSt5q2lSSZbXt0dNf_M4,4210
|
50 |
+
jinja2/nodes.py,sha256=i34GPRAZexXMT6bwuf5SEyvdmS-bRCy9KMjwN5O6pjk,34550
|
51 |
+
jinja2/optimizer.py,sha256=tHkMwXxfZkbfA1KmLcqmBMSaz7RLIvvItrJcPoXTyD8,1650
|
52 |
+
jinja2/parser.py,sha256=Y199wPL-G67gJoi5G_5sHuu9uEP1PJkjjLEW_xTH8-k,39736
|
53 |
+
jinja2/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
54 |
+
jinja2/runtime.py,sha256=_6LkKIWFJjQdqlrgA3K39zBFQ-7Orm3wGDm96RwxQoE,33406
|
55 |
+
jinja2/sandbox.py,sha256=Y0xZeXQnH6EX5VjaV2YixESxoepnRbW_3UeQosaBU3M,14584
|
56 |
+
jinja2/tests.py,sha256=Am5Z6Lmfr2XaH_npIfJJ8MdXtWsbLjMULZJulTAj30E,5905
|
57 |
+
jinja2/utils.py,sha256=IMwRIcN1SsTw2-jdQtlH2KzNABsXZBW_-tnFXafQBvY,23933
|
58 |
+
jinja2/visitor.py,sha256=MH14C6yq24G_KVtWzjwaI7Wg14PCJIYlWW1kpkxYak0,3568
|
env-llmeval/lib/python3.10/site-packages/Jinja2-3.1.3.dist-info/WHEEL
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Wheel-Version: 1.0
|
2 |
+
Generator: bdist_wheel (0.42.0)
|
3 |
+
Root-Is-Purelib: true
|
4 |
+
Tag: py3-none-any
|
5 |
+
|
env-llmeval/lib/python3.10/site-packages/Jinja2-3.1.3.dist-info/entry_points.txt
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
[babel.extractors]
|
2 |
+
jinja2 = jinja2.ext:babel_extract[i18n]
|
env-llmeval/lib/python3.10/site-packages/Jinja2-3.1.3.dist-info/top_level.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
jinja2
|
env-llmeval/lib/python3.10/site-packages/absl/testing/__init__.py
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Copyright 2017 The Abseil Authors.
|
2 |
+
#
|
3 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4 |
+
# you may not use this file except in compliance with the License.
|
5 |
+
# You may obtain a copy of the License at
|
6 |
+
#
|
7 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8 |
+
#
|
9 |
+
# Unless required by applicable law or agreed to in writing, software
|
10 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12 |
+
# See the License for the specific language governing permissions and
|
13 |
+
# limitations under the License.
|
env-llmeval/lib/python3.10/site-packages/absl/testing/__pycache__/__init__.cpython-310.pyc
ADDED
Binary file (177 Bytes). View file
|
|
env-llmeval/lib/python3.10/site-packages/absl/testing/__pycache__/_pretty_print_reporter.cpython-310.pyc
ADDED
Binary file (3.05 kB). View file
|
|
env-llmeval/lib/python3.10/site-packages/absl/testing/__pycache__/parameterized.cpython-310.pyc
ADDED
Binary file (23.6 kB). View file
|
|
env-llmeval/lib/python3.10/site-packages/absl/testing/__pycache__/xml_reporter.cpython-310.pyc
ADDED
Binary file (18.4 kB). View file
|
|
env-llmeval/lib/python3.10/site-packages/absl/testing/_bazelize_command.py
ADDED
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Copyright 2017 The Abseil Authors.
|
2 |
+
#
|
3 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4 |
+
# you may not use this file except in compliance with the License.
|
5 |
+
# You may obtain a copy of the License at
|
6 |
+
#
|
7 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8 |
+
#
|
9 |
+
# Unless required by applicable law or agreed to in writing, software
|
10 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12 |
+
# See the License for the specific language governing permissions and
|
13 |
+
# limitations under the License.
|
14 |
+
|
15 |
+
"""Internal helper for running tests on Windows Bazel."""
|
16 |
+
|
17 |
+
import os
|
18 |
+
|
19 |
+
from absl import flags
|
20 |
+
|
21 |
+
FLAGS = flags.FLAGS
|
22 |
+
|
23 |
+
|
24 |
+
def get_executable_path(py_binary_name):
|
25 |
+
"""Returns the executable path of a py_binary.
|
26 |
+
|
27 |
+
This returns the executable path of a py_binary that is in another Bazel
|
28 |
+
target's data dependencies.
|
29 |
+
|
30 |
+
On Linux/macOS, the path and __file__ has the same root directory.
|
31 |
+
On Windows, bazel builds an .exe file and we need to use the MANIFEST file
|
32 |
+
the location the actual binary.
|
33 |
+
|
34 |
+
Args:
|
35 |
+
py_binary_name: string, the name of a py_binary that is in another Bazel
|
36 |
+
target's data dependencies.
|
37 |
+
|
38 |
+
Raises:
|
39 |
+
RuntimeError: Raised when it cannot locate the executable path.
|
40 |
+
"""
|
41 |
+
|
42 |
+
if os.name == 'nt':
|
43 |
+
py_binary_name += '.exe'
|
44 |
+
manifest_file = os.path.join(FLAGS.test_srcdir, 'MANIFEST')
|
45 |
+
workspace_name = os.environ['TEST_WORKSPACE']
|
46 |
+
manifest_entry = '{}/{}'.format(workspace_name, py_binary_name)
|
47 |
+
with open(manifest_file, 'r') as manifest_fd:
|
48 |
+
for line in manifest_fd:
|
49 |
+
tokens = line.strip().split(' ')
|
50 |
+
if len(tokens) != 2:
|
51 |
+
continue
|
52 |
+
if manifest_entry == tokens[0]:
|
53 |
+
return tokens[1]
|
54 |
+
raise RuntimeError(
|
55 |
+
'Cannot locate executable path for {}, MANIFEST file: {}.'.format(
|
56 |
+
py_binary_name, manifest_file))
|
57 |
+
else:
|
58 |
+
# NOTE: __file__ may be .py or .pyc, depending on how the module was
|
59 |
+
# loaded and executed.
|
60 |
+
path = __file__
|
61 |
+
|
62 |
+
# Use the package name to find the root directory: every dot is
|
63 |
+
# a directory, plus one for ourselves.
|
64 |
+
for _ in range(__name__.count('.') + 1):
|
65 |
+
path = os.path.dirname(path)
|
66 |
+
|
67 |
+
root_directory = path
|
68 |
+
return os.path.join(root_directory, py_binary_name)
|
env-llmeval/lib/python3.10/site-packages/absl/testing/absltest.py
ADDED
The diff for this file is too large to render.
See raw diff
|
|
env-llmeval/lib/python3.10/site-packages/absl/testing/flagsaver.py
ADDED
@@ -0,0 +1,386 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Copyright 2017 The Abseil Authors.
|
2 |
+
#
|
3 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4 |
+
# you may not use this file except in compliance with the License.
|
5 |
+
# You may obtain a copy of the License at
|
6 |
+
#
|
7 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8 |
+
#
|
9 |
+
# Unless required by applicable law or agreed to in writing, software
|
10 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12 |
+
# See the License for the specific language governing permissions and
|
13 |
+
# limitations under the License.
|
14 |
+
|
15 |
+
"""Decorator and context manager for saving and restoring flag values.
|
16 |
+
|
17 |
+
There are many ways to save and restore. Always use the most convenient method
|
18 |
+
for a given use case.
|
19 |
+
|
20 |
+
Here are examples of each method. They all call ``do_stuff()`` while
|
21 |
+
``FLAGS.someflag`` is temporarily set to ``'foo'``::
|
22 |
+
|
23 |
+
from absl.testing import flagsaver
|
24 |
+
|
25 |
+
# Use a decorator which can optionally override flags via arguments.
|
26 |
+
@flagsaver.flagsaver(someflag='foo')
|
27 |
+
def some_func():
|
28 |
+
do_stuff()
|
29 |
+
|
30 |
+
# Use a decorator which can optionally override flags with flagholders.
|
31 |
+
@flagsaver.flagsaver((module.FOO_FLAG, 'foo'), (other_mod.BAR_FLAG, 23))
|
32 |
+
def some_func():
|
33 |
+
do_stuff()
|
34 |
+
|
35 |
+
# Use a decorator which does not override flags itself.
|
36 |
+
@flagsaver.flagsaver
|
37 |
+
def some_func():
|
38 |
+
FLAGS.someflag = 'foo'
|
39 |
+
do_stuff()
|
40 |
+
|
41 |
+
# Use a context manager which can optionally override flags via arguments.
|
42 |
+
with flagsaver.flagsaver(someflag='foo'):
|
43 |
+
do_stuff()
|
44 |
+
|
45 |
+
# Save and restore the flag values yourself.
|
46 |
+
saved_flag_values = flagsaver.save_flag_values()
|
47 |
+
try:
|
48 |
+
FLAGS.someflag = 'foo'
|
49 |
+
do_stuff()
|
50 |
+
finally:
|
51 |
+
flagsaver.restore_flag_values(saved_flag_values)
|
52 |
+
|
53 |
+
# Use the parsing version to emulate users providing the flags.
|
54 |
+
# Note that all flags must be provided as strings (unparsed).
|
55 |
+
@flagsaver.as_parsed(some_int_flag='123')
|
56 |
+
def some_func():
|
57 |
+
# Because the flag was parsed it is considered "present".
|
58 |
+
assert FLAGS.some_int_flag.present
|
59 |
+
do_stuff()
|
60 |
+
|
61 |
+
# flagsaver.as_parsed() can also be used as a context manager just like
|
62 |
+
# flagsaver.flagsaver()
|
63 |
+
with flagsaver.as_parsed(some_int_flag='123'):
|
64 |
+
do_stuff()
|
65 |
+
|
66 |
+
# The flagsaver.as_parsed() interface also supports FlagHolder objects.
|
67 |
+
@flagsaver.as_parsed((module.FOO_FLAG, 'foo'), (other_mod.BAR_FLAG, '23'))
|
68 |
+
def some_func():
|
69 |
+
do_stuff()
|
70 |
+
|
71 |
+
# Using as_parsed with a multi_X flag requires a sequence of strings.
|
72 |
+
@flagsaver.as_parsed(some_multi_int_flag=['123', '456'])
|
73 |
+
def some_func():
|
74 |
+
assert FLAGS.some_multi_int_flag.present
|
75 |
+
do_stuff()
|
76 |
+
|
77 |
+
# If a flag name includes non-identifier characters it can be specified like
|
78 |
+
# so:
|
79 |
+
@flagsaver.as_parsed(**{'i-like-dashes': 'true'})
|
80 |
+
def some_func():
|
81 |
+
do_stuff()
|
82 |
+
|
83 |
+
We save and restore a shallow copy of each Flag object's ``__dict__`` attribute.
|
84 |
+
This preserves all attributes of the flag, such as whether or not it was
|
85 |
+
overridden from its default value.
|
86 |
+
|
87 |
+
WARNING: Currently a flag that is saved and then deleted cannot be restored. An
|
88 |
+
exception will be raised. However if you *add* a flag after saving flag values,
|
89 |
+
and then restore flag values, the added flag will be deleted with no errors.
|
90 |
+
"""
|
91 |
+
|
92 |
+
import collections
|
93 |
+
import functools
|
94 |
+
import inspect
|
95 |
+
from typing import overload, Any, Callable, Mapping, Tuple, TypeVar, Type, Sequence, Union
|
96 |
+
|
97 |
+
from absl import flags
|
98 |
+
|
99 |
+
FLAGS = flags.FLAGS
|
100 |
+
|
101 |
+
|
102 |
+
# The type of pre/post wrapped functions.
|
103 |
+
_CallableT = TypeVar('_CallableT', bound=Callable)
|
104 |
+
|
105 |
+
|
106 |
+
@overload
|
107 |
+
def flagsaver(*args: Tuple[flags.FlagHolder, Any],
|
108 |
+
**kwargs: Any) -> '_FlagOverrider':
|
109 |
+
...
|
110 |
+
|
111 |
+
|
112 |
+
@overload
|
113 |
+
def flagsaver(func: _CallableT) -> _CallableT:
|
114 |
+
...
|
115 |
+
|
116 |
+
|
117 |
+
def flagsaver(*args, **kwargs):
|
118 |
+
"""The main flagsaver interface. See module doc for usage."""
|
119 |
+
return _construct_overrider(_FlagOverrider, *args, **kwargs)
|
120 |
+
|
121 |
+
|
122 |
+
@overload
|
123 |
+
def as_parsed(*args: Tuple[flags.FlagHolder, Union[str, Sequence[str]]],
|
124 |
+
**kwargs: Union[str, Sequence[str]]) -> '_ParsingFlagOverrider':
|
125 |
+
...
|
126 |
+
|
127 |
+
|
128 |
+
@overload
|
129 |
+
def as_parsed(func: _CallableT) -> _CallableT:
|
130 |
+
...
|
131 |
+
|
132 |
+
|
133 |
+
def as_parsed(*args, **kwargs):
|
134 |
+
"""Overrides flags by parsing strings, saves flag state similar to flagsaver.
|
135 |
+
|
136 |
+
This function can be used as either a decorator or context manager similar to
|
137 |
+
flagsaver.flagsaver(). However, where flagsaver.flagsaver() directly sets the
|
138 |
+
flags to new values, this function will parse the provided arguments as if
|
139 |
+
they were provided on the command line. Among other things, this will cause
|
140 |
+
`FLAGS['flag_name'].present == True`.
|
141 |
+
|
142 |
+
A note on unparsed input: For many flag types, the unparsed version will be
|
143 |
+
a single string. However for multi_x (multi_string, multi_integer, multi_enum)
|
144 |
+
the unparsed version will be a Sequence of strings.
|
145 |
+
|
146 |
+
Args:
|
147 |
+
*args: Tuples of FlagHolders and their unparsed value.
|
148 |
+
**kwargs: The keyword args are flag names, and the values are unparsed
|
149 |
+
values.
|
150 |
+
|
151 |
+
Returns:
|
152 |
+
_ParsingFlagOverrider that serves as a context manager or decorator. Will
|
153 |
+
save previous flag state and parse new flags, then on cleanup it will
|
154 |
+
restore the previous flag state.
|
155 |
+
"""
|
156 |
+
return _construct_overrider(_ParsingFlagOverrider, *args, **kwargs)
|
157 |
+
|
158 |
+
|
159 |
+
# NOTE: the order of these overload declarations matters. The type checker will
|
160 |
+
# pick the first match which could be incorrect.
|
161 |
+
@overload
|
162 |
+
def _construct_overrider(
|
163 |
+
flag_overrider_cls: Type['_ParsingFlagOverrider'],
|
164 |
+
*args: Tuple[flags.FlagHolder, Union[str, Sequence[str]]],
|
165 |
+
**kwargs: Union[str, Sequence[str]]) -> '_ParsingFlagOverrider':
|
166 |
+
...
|
167 |
+
|
168 |
+
|
169 |
+
@overload
|
170 |
+
def _construct_overrider(flag_overrider_cls: Type['_FlagOverrider'],
|
171 |
+
*args: Tuple[flags.FlagHolder, Any],
|
172 |
+
**kwargs: Any) -> '_FlagOverrider':
|
173 |
+
...
|
174 |
+
|
175 |
+
|
176 |
+
@overload
|
177 |
+
def _construct_overrider(flag_overrider_cls: Type['_FlagOverrider'],
|
178 |
+
func: _CallableT) -> _CallableT:
|
179 |
+
...
|
180 |
+
|
181 |
+
|
182 |
+
def _construct_overrider(flag_overrider_cls, *args, **kwargs):
|
183 |
+
"""Handles the args/kwargs returning an instance of flag_overrider_cls.
|
184 |
+
|
185 |
+
If flag_overrider_cls is _FlagOverrider then values should be native python
|
186 |
+
types matching the python types. Otherwise if flag_overrider_cls is
|
187 |
+
_ParsingFlagOverrider the values should be strings or sequences of strings.
|
188 |
+
|
189 |
+
Args:
|
190 |
+
flag_overrider_cls: The class that will do the overriding.
|
191 |
+
*args: Tuples of FlagHolder and the new flag value.
|
192 |
+
**kwargs: Keword args mapping flag name to new flag value.
|
193 |
+
|
194 |
+
Returns:
|
195 |
+
A _FlagOverrider to be used as a decorator or context manager.
|
196 |
+
"""
|
197 |
+
if not args:
|
198 |
+
return flag_overrider_cls(**kwargs)
|
199 |
+
# args can be [func] if used as `@flagsaver` instead of `@flagsaver(...)`
|
200 |
+
if len(args) == 1 and callable(args[0]):
|
201 |
+
if kwargs:
|
202 |
+
raise ValueError(
|
203 |
+
"It's invalid to specify both positional and keyword parameters.")
|
204 |
+
func = args[0]
|
205 |
+
if inspect.isclass(func):
|
206 |
+
raise TypeError('@flagsaver.flagsaver cannot be applied to a class.')
|
207 |
+
return _wrap(flag_overrider_cls, func, {})
|
208 |
+
# args can be a list of (FlagHolder, value) pairs.
|
209 |
+
# In which case they augment any specified kwargs.
|
210 |
+
for arg in args:
|
211 |
+
if not isinstance(arg, tuple) or len(arg) != 2:
|
212 |
+
raise ValueError('Expected (FlagHolder, value) pair, found %r' % (arg,))
|
213 |
+
holder, value = arg
|
214 |
+
if not isinstance(holder, flags.FlagHolder):
|
215 |
+
raise ValueError('Expected (FlagHolder, value) pair, found %r' % (arg,))
|
216 |
+
if holder.name in kwargs:
|
217 |
+
raise ValueError('Cannot set --%s multiple times' % holder.name)
|
218 |
+
kwargs[holder.name] = value
|
219 |
+
return flag_overrider_cls(**kwargs)
|
220 |
+
|
221 |
+
|
222 |
+
def save_flag_values(
|
223 |
+
flag_values: flags.FlagValues = FLAGS) -> Mapping[str, Mapping[str, Any]]:
|
224 |
+
"""Returns copy of flag values as a dict.
|
225 |
+
|
226 |
+
Args:
|
227 |
+
flag_values: FlagValues, the FlagValues instance with which the flag will be
|
228 |
+
saved. This should almost never need to be overridden.
|
229 |
+
|
230 |
+
Returns:
|
231 |
+
Dictionary mapping keys to values. Keys are flag names, values are
|
232 |
+
corresponding ``__dict__`` members. E.g. ``{'key': value_dict, ...}``.
|
233 |
+
"""
|
234 |
+
return {name: _copy_flag_dict(flag_values[name]) for name in flag_values}
|
235 |
+
|
236 |
+
|
237 |
+
def restore_flag_values(saved_flag_values: Mapping[str, Mapping[str, Any]],
|
238 |
+
flag_values: flags.FlagValues = FLAGS):
|
239 |
+
"""Restores flag values based on the dictionary of flag values.
|
240 |
+
|
241 |
+
Args:
|
242 |
+
saved_flag_values: {'flag_name': value_dict, ...}
|
243 |
+
flag_values: FlagValues, the FlagValues instance from which the flag will be
|
244 |
+
restored. This should almost never need to be overridden.
|
245 |
+
"""
|
246 |
+
new_flag_names = list(flag_values)
|
247 |
+
for name in new_flag_names:
|
248 |
+
saved = saved_flag_values.get(name)
|
249 |
+
if saved is None:
|
250 |
+
# If __dict__ was not saved delete "new" flag.
|
251 |
+
delattr(flag_values, name)
|
252 |
+
else:
|
253 |
+
if flag_values[name].value != saved['_value']:
|
254 |
+
flag_values[name].value = saved['_value'] # Ensure C++ value is set.
|
255 |
+
flag_values[name].__dict__ = saved
|
256 |
+
|
257 |
+
|
258 |
+
@overload
|
259 |
+
def _wrap(flag_overrider_cls: Type['_FlagOverrider'], func: _CallableT,
|
260 |
+
overrides: Mapping[str, Any]) -> _CallableT:
|
261 |
+
...
|
262 |
+
|
263 |
+
|
264 |
+
@overload
|
265 |
+
def _wrap(flag_overrider_cls: Type['_ParsingFlagOverrider'], func: _CallableT,
|
266 |
+
overrides: Mapping[str, Union[str, Sequence[str]]]) -> _CallableT:
|
267 |
+
...
|
268 |
+
|
269 |
+
|
270 |
+
def _wrap(flag_overrider_cls, func, overrides):
|
271 |
+
"""Creates a wrapper function that saves/restores flag values.
|
272 |
+
|
273 |
+
Args:
|
274 |
+
flag_overrider_cls: The class that will be used as a context manager.
|
275 |
+
func: This will be called between saving flags and restoring flags.
|
276 |
+
overrides: Flag names mapped to their values. These flags will be set after
|
277 |
+
saving the original flag state. The type of the values depends on if
|
278 |
+
_FlagOverrider or _ParsingFlagOverrider was specified.
|
279 |
+
|
280 |
+
Returns:
|
281 |
+
A wrapped version of func.
|
282 |
+
"""
|
283 |
+
|
284 |
+
@functools.wraps(func)
|
285 |
+
def _flagsaver_wrapper(*args, **kwargs):
|
286 |
+
"""Wrapper function that saves and restores flags."""
|
287 |
+
with flag_overrider_cls(**overrides):
|
288 |
+
return func(*args, **kwargs)
|
289 |
+
|
290 |
+
return _flagsaver_wrapper
|
291 |
+
|
292 |
+
|
293 |
+
class _FlagOverrider(object):
|
294 |
+
"""Overrides flags for the duration of the decorated function call.
|
295 |
+
|
296 |
+
It also restores all original values of flags after decorated method
|
297 |
+
completes.
|
298 |
+
"""
|
299 |
+
|
300 |
+
def __init__(self, **overrides: Any):
|
301 |
+
self._overrides = overrides
|
302 |
+
self._saved_flag_values = None
|
303 |
+
|
304 |
+
def __call__(self, func: _CallableT) -> _CallableT:
|
305 |
+
if inspect.isclass(func):
|
306 |
+
raise TypeError('flagsaver cannot be applied to a class.')
|
307 |
+
return _wrap(self.__class__, func, self._overrides)
|
308 |
+
|
309 |
+
def __enter__(self):
|
310 |
+
self._saved_flag_values = save_flag_values(FLAGS)
|
311 |
+
try:
|
312 |
+
FLAGS._set_attributes(**self._overrides)
|
313 |
+
except:
|
314 |
+
# It may fail because of flag validators.
|
315 |
+
restore_flag_values(self._saved_flag_values, FLAGS)
|
316 |
+
raise
|
317 |
+
|
318 |
+
def __exit__(self, exc_type, exc_value, traceback):
|
319 |
+
restore_flag_values(self._saved_flag_values, FLAGS)
|
320 |
+
|
321 |
+
|
322 |
+
class _ParsingFlagOverrider(_FlagOverrider):
|
323 |
+
"""Context manager for overriding flags.
|
324 |
+
|
325 |
+
Simulates command line parsing.
|
326 |
+
|
327 |
+
This is simlar to _FlagOverrider except that all **overrides should be
|
328 |
+
strings or sequences of strings, and when context is entered this class calls
|
329 |
+
.parse(value)
|
330 |
+
|
331 |
+
This results in the flags having .present set properly.
|
332 |
+
"""
|
333 |
+
|
334 |
+
def __init__(self, **overrides: Union[str, Sequence[str]]):
|
335 |
+
for flag_name, new_value in overrides.items():
|
336 |
+
if isinstance(new_value, str):
|
337 |
+
continue
|
338 |
+
if (isinstance(new_value, collections.abc.Sequence) and
|
339 |
+
all(isinstance(single_value, str) for single_value in new_value)):
|
340 |
+
continue
|
341 |
+
raise TypeError(
|
342 |
+
f'flagsaver.as_parsed() cannot parse {flag_name}. Expected a single '
|
343 |
+
f'string or sequence of strings but {type(new_value)} was provided.')
|
344 |
+
super().__init__(**overrides)
|
345 |
+
|
346 |
+
def __enter__(self):
|
347 |
+
self._saved_flag_values = save_flag_values(FLAGS)
|
348 |
+
try:
|
349 |
+
for flag_name, unparsed_value in self._overrides.items():
|
350 |
+
# LINT.IfChange(flag_override_parsing)
|
351 |
+
FLAGS[flag_name].parse(unparsed_value)
|
352 |
+
FLAGS[flag_name].using_default_value = False
|
353 |
+
# LINT.ThenChange()
|
354 |
+
|
355 |
+
# Perform the validation on all modified flags. This is something that
|
356 |
+
# FLAGS._set_attributes() does for you in _FlagOverrider.
|
357 |
+
for flag_name in self._overrides:
|
358 |
+
FLAGS._assert_validators(FLAGS[flag_name].validators)
|
359 |
+
|
360 |
+
except KeyError as e:
|
361 |
+
# If a flag doesn't exist, an UnrecognizedFlagError is more specific.
|
362 |
+
restore_flag_values(self._saved_flag_values, FLAGS)
|
363 |
+
raise flags.UnrecognizedFlagError('Unknown command line flag.') from e
|
364 |
+
|
365 |
+
except:
|
366 |
+
# It may fail because of flag validators or general parsing issues.
|
367 |
+
restore_flag_values(self._saved_flag_values, FLAGS)
|
368 |
+
raise
|
369 |
+
|
370 |
+
|
371 |
+
def _copy_flag_dict(flag: flags.Flag) -> Mapping[str, Any]:
|
372 |
+
"""Returns a copy of the flag object's ``__dict__``.
|
373 |
+
|
374 |
+
It's mostly a shallow copy of the ``__dict__``, except it also does a shallow
|
375 |
+
copy of the validator list.
|
376 |
+
|
377 |
+
Args:
|
378 |
+
flag: flags.Flag, the flag to copy.
|
379 |
+
|
380 |
+
Returns:
|
381 |
+
A copy of the flag object's ``__dict__``.
|
382 |
+
"""
|
383 |
+
copy = flag.__dict__.copy()
|
384 |
+
copy['_value'] = flag.value # Ensure correct restore for C++ flags.
|
385 |
+
copy['validators'] = list(flag.validators)
|
386 |
+
return copy
|
env-llmeval/lib/python3.10/site-packages/absl/testing/parameterized.py
ADDED
@@ -0,0 +1,724 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Copyright 2017 The Abseil Authors.
|
2 |
+
#
|
3 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4 |
+
# you may not use this file except in compliance with the License.
|
5 |
+
# You may obtain a copy of the License at
|
6 |
+
#
|
7 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8 |
+
#
|
9 |
+
# Unless required by applicable law or agreed to in writing, software
|
10 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12 |
+
# See the License for the specific language governing permissions and
|
13 |
+
# limitations under the License.
|
14 |
+
|
15 |
+
"""Adds support for parameterized tests to Python's unittest TestCase class.
|
16 |
+
|
17 |
+
A parameterized test is a method in a test case that is invoked with different
|
18 |
+
argument tuples.
|
19 |
+
|
20 |
+
A simple example::
|
21 |
+
|
22 |
+
class AdditionExample(parameterized.TestCase):
|
23 |
+
@parameterized.parameters(
|
24 |
+
(1, 2, 3),
|
25 |
+
(4, 5, 9),
|
26 |
+
(1, 1, 3))
|
27 |
+
def testAddition(self, op1, op2, result):
|
28 |
+
self.assertEqual(result, op1 + op2)
|
29 |
+
|
30 |
+
Each invocation is a separate test case and properly isolated just
|
31 |
+
like a normal test method, with its own setUp/tearDown cycle. In the
|
32 |
+
example above, there are three separate testcases, one of which will
|
33 |
+
fail due to an assertion error (1 + 1 != 3).
|
34 |
+
|
35 |
+
Parameters for individual test cases can be tuples (with positional parameters)
|
36 |
+
or dictionaries (with named parameters)::
|
37 |
+
|
38 |
+
class AdditionExample(parameterized.TestCase):
|
39 |
+
@parameterized.parameters(
|
40 |
+
{'op1': 1, 'op2': 2, 'result': 3},
|
41 |
+
{'op1': 4, 'op2': 5, 'result': 9},
|
42 |
+
)
|
43 |
+
def testAddition(self, op1, op2, result):
|
44 |
+
self.assertEqual(result, op1 + op2)
|
45 |
+
|
46 |
+
If a parameterized test fails, the error message will show the
|
47 |
+
original test name and the parameters for that test.
|
48 |
+
|
49 |
+
The id method of the test, used internally by the unittest framework, is also
|
50 |
+
modified to show the arguments (but note that the name reported by `id()`
|
51 |
+
doesn't match the actual test name, see below). To make sure that test names
|
52 |
+
stay the same across several invocations, object representations like::
|
53 |
+
|
54 |
+
>>> class Foo(object):
|
55 |
+
... pass
|
56 |
+
>>> repr(Foo())
|
57 |
+
'<__main__.Foo object at 0x23d8610>'
|
58 |
+
|
59 |
+
are turned into ``__main__.Foo``. When selecting a subset of test cases to run
|
60 |
+
on the command-line, the test cases contain an index suffix for each argument
|
61 |
+
in the order they were passed to :func:`parameters` (eg. testAddition0,
|
62 |
+
testAddition1, etc.) This naming scheme is subject to change; for more reliable
|
63 |
+
and stable names, especially in test logs, use :func:`named_parameters` instead.
|
64 |
+
|
65 |
+
Tests using :func:`named_parameters` are similar to :func:`parameters`, except
|
66 |
+
only tuples or dicts of args are supported. For tuples, the first parameter arg
|
67 |
+
has to be a string (or an object that returns an apt name when converted via
|
68 |
+
``str()``). For dicts, a value for the key ``testcase_name`` must be present and
|
69 |
+
must be a string (or an object that returns an apt name when converted via
|
70 |
+
``str()``)::
|
71 |
+
|
72 |
+
class NamedExample(parameterized.TestCase):
|
73 |
+
@parameterized.named_parameters(
|
74 |
+
('Normal', 'aa', 'aaa', True),
|
75 |
+
('EmptyPrefix', '', 'abc', True),
|
76 |
+
('BothEmpty', '', '', True))
|
77 |
+
def testStartsWith(self, prefix, string, result):
|
78 |
+
self.assertEqual(result, string.startswith(prefix))
|
79 |
+
|
80 |
+
class NamedExample(parameterized.TestCase):
|
81 |
+
@parameterized.named_parameters(
|
82 |
+
{'testcase_name': 'Normal',
|
83 |
+
'result': True, 'string': 'aaa', 'prefix': 'aa'},
|
84 |
+
{'testcase_name': 'EmptyPrefix',
|
85 |
+
'result': True, 'string': 'abc', 'prefix': ''},
|
86 |
+
{'testcase_name': 'BothEmpty',
|
87 |
+
'result': True, 'string': '', 'prefix': ''})
|
88 |
+
def testStartsWith(self, prefix, string, result):
|
89 |
+
self.assertEqual(result, string.startswith(prefix))
|
90 |
+
|
91 |
+
Named tests also have the benefit that they can be run individually
|
92 |
+
from the command line::
|
93 |
+
|
94 |
+
$ testmodule.py NamedExample.testStartsWithNormal
|
95 |
+
.
|
96 |
+
--------------------------------------------------------------------
|
97 |
+
Ran 1 test in 0.000s
|
98 |
+
|
99 |
+
OK
|
100 |
+
|
101 |
+
Parameterized Classes
|
102 |
+
=====================
|
103 |
+
|
104 |
+
If invocation arguments are shared across test methods in a single
|
105 |
+
TestCase class, instead of decorating all test methods
|
106 |
+
individually, the class itself can be decorated::
|
107 |
+
|
108 |
+
@parameterized.parameters(
|
109 |
+
(1, 2, 3),
|
110 |
+
(4, 5, 9))
|
111 |
+
class ArithmeticTest(parameterized.TestCase):
|
112 |
+
def testAdd(self, arg1, arg2, result):
|
113 |
+
self.assertEqual(arg1 + arg2, result)
|
114 |
+
|
115 |
+
def testSubtract(self, arg1, arg2, result):
|
116 |
+
self.assertEqual(result - arg1, arg2)
|
117 |
+
|
118 |
+
Inputs from Iterables
|
119 |
+
=====================
|
120 |
+
|
121 |
+
If parameters should be shared across several test cases, or are dynamically
|
122 |
+
created from other sources, a single non-tuple iterable can be passed into
|
123 |
+
the decorator. This iterable will be used to obtain the test cases::
|
124 |
+
|
125 |
+
class AdditionExample(parameterized.TestCase):
|
126 |
+
@parameterized.parameters(
|
127 |
+
c.op1, c.op2, c.result for c in testcases
|
128 |
+
)
|
129 |
+
def testAddition(self, op1, op2, result):
|
130 |
+
self.assertEqual(result, op1 + op2)
|
131 |
+
|
132 |
+
|
133 |
+
Single-Argument Test Methods
|
134 |
+
============================
|
135 |
+
|
136 |
+
If a test method takes only one argument, the single arguments must not be
|
137 |
+
wrapped into a tuple::
|
138 |
+
|
139 |
+
class NegativeNumberExample(parameterized.TestCase):
|
140 |
+
@parameterized.parameters(
|
141 |
+
-1, -3, -4, -5
|
142 |
+
)
|
143 |
+
def testIsNegative(self, arg):
|
144 |
+
self.assertTrue(IsNegative(arg))
|
145 |
+
|
146 |
+
|
147 |
+
List/tuple as a Single Argument
|
148 |
+
===============================
|
149 |
+
|
150 |
+
If a test method takes a single argument of a list/tuple, it must be wrapped
|
151 |
+
inside a tuple::
|
152 |
+
|
153 |
+
class ZeroSumExample(parameterized.TestCase):
|
154 |
+
@parameterized.parameters(
|
155 |
+
([-1, 0, 1], ),
|
156 |
+
([-2, 0, 2], ),
|
157 |
+
)
|
158 |
+
def testSumIsZero(self, arg):
|
159 |
+
self.assertEqual(0, sum(arg))
|
160 |
+
|
161 |
+
|
162 |
+
Cartesian product of Parameter Values as Parameterized Test Cases
|
163 |
+
=================================================================
|
164 |
+
|
165 |
+
If required to test method over a cartesian product of parameters,
|
166 |
+
`parameterized.product` may be used to facilitate generation of parameters
|
167 |
+
test combinations::
|
168 |
+
|
169 |
+
class TestModuloExample(parameterized.TestCase):
|
170 |
+
@parameterized.product(
|
171 |
+
num=[0, 20, 80],
|
172 |
+
modulo=[2, 4],
|
173 |
+
expected=[0]
|
174 |
+
)
|
175 |
+
def testModuloResult(self, num, modulo, expected):
|
176 |
+
self.assertEqual(expected, num % modulo)
|
177 |
+
|
178 |
+
This results in 6 test cases being created - one for each combination of the
|
179 |
+
parameters. It is also possible to supply sequences of keyword argument dicts
|
180 |
+
as elements of the cartesian product::
|
181 |
+
|
182 |
+
@parameterized.product(
|
183 |
+
(dict(num=5, modulo=3, expected=2),
|
184 |
+
dict(num=7, modulo=4, expected=3)),
|
185 |
+
dtype=(int, float)
|
186 |
+
)
|
187 |
+
def testModuloResult(self, num, modulo, expected, dtype):
|
188 |
+
self.assertEqual(expected, dtype(num) % modulo)
|
189 |
+
|
190 |
+
This results in 4 test cases being created - for each of the two sets of test
|
191 |
+
data (supplied as kwarg dicts) and for each of the two data types (supplied as
|
192 |
+
a named parameter). Multiple keyword argument dicts may be supplied if required.
|
193 |
+
|
194 |
+
Async Support
|
195 |
+
=============
|
196 |
+
|
197 |
+
If a test needs to call async functions, it can inherit from both
|
198 |
+
parameterized.TestCase and another TestCase that supports async calls, such
|
199 |
+
as [asynctest](https://github.com/Martiusweb/asynctest)::
|
200 |
+
|
201 |
+
import asynctest
|
202 |
+
|
203 |
+
class AsyncExample(parameterized.TestCase, asynctest.TestCase):
|
204 |
+
@parameterized.parameters(
|
205 |
+
('a', 1),
|
206 |
+
('b', 2),
|
207 |
+
)
|
208 |
+
async def testSomeAsyncFunction(self, arg, expected):
|
209 |
+
actual = await someAsyncFunction(arg)
|
210 |
+
self.assertEqual(actual, expected)
|
211 |
+
"""
|
212 |
+
|
213 |
+
from collections import abc
|
214 |
+
import functools
|
215 |
+
import inspect
|
216 |
+
import itertools
|
217 |
+
import re
|
218 |
+
import types
|
219 |
+
import unittest
|
220 |
+
import warnings
|
221 |
+
|
222 |
+
from absl.testing import absltest
|
223 |
+
|
224 |
+
|
225 |
+
_ADDR_RE = re.compile(r'\<([a-zA-Z0-9_\-\.]+) object at 0x[a-fA-F0-9]+\>')
|
226 |
+
_NAMED = object()
|
227 |
+
_ARGUMENT_REPR = object()
|
228 |
+
_NAMED_DICT_KEY = 'testcase_name'
|
229 |
+
|
230 |
+
|
231 |
+
class NoTestsError(Exception):
|
232 |
+
"""Raised when parameterized decorators do not generate any tests."""
|
233 |
+
|
234 |
+
|
235 |
+
class DuplicateTestNameError(Exception):
|
236 |
+
"""Raised when a parameterized test has the same test name multiple times."""
|
237 |
+
|
238 |
+
def __init__(self, test_class_name, new_test_name, original_test_name):
|
239 |
+
super(DuplicateTestNameError, self).__init__(
|
240 |
+
'Duplicate parameterized test name in {}: generated test name {!r} '
|
241 |
+
'(generated from {!r}) already exists. Consider using '
|
242 |
+
'named_parameters() to give your tests unique names and/or renaming '
|
243 |
+
'the conflicting test method.'.format(
|
244 |
+
test_class_name, new_test_name, original_test_name))
|
245 |
+
|
246 |
+
|
247 |
+
def _clean_repr(obj):
|
248 |
+
return _ADDR_RE.sub(r'<\1>', repr(obj))
|
249 |
+
|
250 |
+
|
251 |
+
def _non_string_or_bytes_iterable(obj):
|
252 |
+
return (isinstance(obj, abc.Iterable) and not isinstance(obj, str) and
|
253 |
+
not isinstance(obj, bytes))
|
254 |
+
|
255 |
+
|
256 |
+
def _format_parameter_list(testcase_params):
|
257 |
+
if isinstance(testcase_params, abc.Mapping):
|
258 |
+
return ', '.join('%s=%s' % (argname, _clean_repr(value))
|
259 |
+
for argname, value in testcase_params.items())
|
260 |
+
elif _non_string_or_bytes_iterable(testcase_params):
|
261 |
+
return ', '.join(map(_clean_repr, testcase_params))
|
262 |
+
else:
|
263 |
+
return _format_parameter_list((testcase_params,))
|
264 |
+
|
265 |
+
|
266 |
+
def _async_wrapped(func):
|
267 |
+
@functools.wraps(func)
|
268 |
+
async def wrapper(*args, **kwargs):
|
269 |
+
return await func(*args, **kwargs)
|
270 |
+
return wrapper
|
271 |
+
|
272 |
+
|
273 |
+
class _ParameterizedTestIter(object):
|
274 |
+
"""Callable and iterable class for producing new test cases."""
|
275 |
+
|
276 |
+
def __init__(self, test_method, testcases, naming_type, original_name=None):
|
277 |
+
"""Returns concrete test functions for a test and a list of parameters.
|
278 |
+
|
279 |
+
The naming_type is used to determine the name of the concrete
|
280 |
+
functions as reported by the unittest framework. If naming_type is
|
281 |
+
_FIRST_ARG, the testcases must be tuples, and the first element must
|
282 |
+
have a string representation that is a valid Python identifier.
|
283 |
+
|
284 |
+
Args:
|
285 |
+
test_method: The decorated test method.
|
286 |
+
testcases: (list of tuple/dict) A list of parameter tuples/dicts for
|
287 |
+
individual test invocations.
|
288 |
+
naming_type: The test naming type, either _NAMED or _ARGUMENT_REPR.
|
289 |
+
original_name: The original test method name. When decorated on a test
|
290 |
+
method, None is passed to __init__ and test_method.__name__ is used.
|
291 |
+
Note test_method.__name__ might be different than the original defined
|
292 |
+
test method because of the use of other decorators. A more accurate
|
293 |
+
value is set by TestGeneratorMetaclass.__new__ later.
|
294 |
+
"""
|
295 |
+
self._test_method = test_method
|
296 |
+
self.testcases = testcases
|
297 |
+
self._naming_type = naming_type
|
298 |
+
if original_name is None:
|
299 |
+
original_name = test_method.__name__
|
300 |
+
self._original_name = original_name
|
301 |
+
self.__name__ = _ParameterizedTestIter.__name__
|
302 |
+
|
303 |
+
def __call__(self, *args, **kwargs):
|
304 |
+
raise RuntimeError('You appear to be running a parameterized test case '
|
305 |
+
'without having inherited from parameterized.'
|
306 |
+
'TestCase. This is bad because none of '
|
307 |
+
'your test cases are actually being run. You may also '
|
308 |
+
'be using another decorator before the parameterized '
|
309 |
+
'one, in which case you should reverse the order.')
|
310 |
+
|
311 |
+
def __iter__(self):
|
312 |
+
test_method = self._test_method
|
313 |
+
naming_type = self._naming_type
|
314 |
+
|
315 |
+
def make_bound_param_test(testcase_params):
|
316 |
+
@functools.wraps(test_method)
|
317 |
+
def bound_param_test(self):
|
318 |
+
if isinstance(testcase_params, abc.Mapping):
|
319 |
+
return test_method(self, **testcase_params)
|
320 |
+
elif _non_string_or_bytes_iterable(testcase_params):
|
321 |
+
return test_method(self, *testcase_params)
|
322 |
+
else:
|
323 |
+
return test_method(self, testcase_params)
|
324 |
+
|
325 |
+
if naming_type is _NAMED:
|
326 |
+
# Signal the metaclass that the name of the test function is unique
|
327 |
+
# and descriptive.
|
328 |
+
bound_param_test.__x_use_name__ = True
|
329 |
+
|
330 |
+
testcase_name = None
|
331 |
+
if isinstance(testcase_params, abc.Mapping):
|
332 |
+
if _NAMED_DICT_KEY not in testcase_params:
|
333 |
+
raise RuntimeError(
|
334 |
+
'Dict for named tests must contain key "%s"' % _NAMED_DICT_KEY)
|
335 |
+
# Create a new dict to avoid modifying the supplied testcase_params.
|
336 |
+
testcase_name = testcase_params[_NAMED_DICT_KEY]
|
337 |
+
testcase_params = {
|
338 |
+
k: v for k, v in testcase_params.items() if k != _NAMED_DICT_KEY
|
339 |
+
}
|
340 |
+
elif _non_string_or_bytes_iterable(testcase_params):
|
341 |
+
if not isinstance(testcase_params[0], str):
|
342 |
+
raise RuntimeError(
|
343 |
+
'The first element of named test parameters is the test name '
|
344 |
+
'suffix and must be a string')
|
345 |
+
testcase_name = testcase_params[0]
|
346 |
+
testcase_params = testcase_params[1:]
|
347 |
+
else:
|
348 |
+
raise RuntimeError(
|
349 |
+
'Named tests must be passed a dict or non-string iterable.')
|
350 |
+
|
351 |
+
test_method_name = self._original_name
|
352 |
+
# Support PEP-8 underscore style for test naming if used.
|
353 |
+
if (test_method_name.startswith('test_')
|
354 |
+
and testcase_name
|
355 |
+
and not testcase_name.startswith('_')):
|
356 |
+
test_method_name += '_'
|
357 |
+
|
358 |
+
bound_param_test.__name__ = test_method_name + str(testcase_name)
|
359 |
+
elif naming_type is _ARGUMENT_REPR:
|
360 |
+
# If it's a generator, convert it to a tuple and treat them as
|
361 |
+
# parameters.
|
362 |
+
if isinstance(testcase_params, types.GeneratorType):
|
363 |
+
testcase_params = tuple(testcase_params)
|
364 |
+
# The metaclass creates a unique, but non-descriptive method name for
|
365 |
+
# _ARGUMENT_REPR tests using an indexed suffix.
|
366 |
+
# To keep test names descriptive, only the original method name is used.
|
367 |
+
# To make sure test names are unique, we add a unique descriptive suffix
|
368 |
+
# __x_params_repr__ for every test.
|
369 |
+
params_repr = '(%s)' % (_format_parameter_list(testcase_params),)
|
370 |
+
bound_param_test.__x_params_repr__ = params_repr
|
371 |
+
else:
|
372 |
+
raise RuntimeError('%s is not a valid naming type.' % (naming_type,))
|
373 |
+
|
374 |
+
bound_param_test.__doc__ = '%s(%s)' % (
|
375 |
+
bound_param_test.__name__, _format_parameter_list(testcase_params))
|
376 |
+
if test_method.__doc__:
|
377 |
+
bound_param_test.__doc__ += '\n%s' % (test_method.__doc__,)
|
378 |
+
if inspect.iscoroutinefunction(test_method):
|
379 |
+
return _async_wrapped(bound_param_test)
|
380 |
+
return bound_param_test
|
381 |
+
|
382 |
+
return (make_bound_param_test(c) for c in self.testcases)
|
383 |
+
|
384 |
+
|
385 |
+
def _modify_class(class_object, testcases, naming_type):
|
386 |
+
assert not getattr(class_object, '_test_params_reprs', None), (
|
387 |
+
'Cannot add parameters to %s. Either it already has parameterized '
|
388 |
+
'methods, or its super class is also a parameterized class.' % (
|
389 |
+
class_object,))
|
390 |
+
# NOTE: _test_params_repr is private to parameterized.TestCase and it's
|
391 |
+
# metaclass; do not use it outside of those classes.
|
392 |
+
class_object._test_params_reprs = test_params_reprs = {}
|
393 |
+
for name, obj in class_object.__dict__.copy().items():
|
394 |
+
if (name.startswith(unittest.TestLoader.testMethodPrefix)
|
395 |
+
and isinstance(obj, types.FunctionType)):
|
396 |
+
delattr(class_object, name)
|
397 |
+
methods = {}
|
398 |
+
_update_class_dict_for_param_test_case(
|
399 |
+
class_object.__name__, methods, test_params_reprs, name,
|
400 |
+
_ParameterizedTestIter(obj, testcases, naming_type, name))
|
401 |
+
for meth_name, meth in methods.items():
|
402 |
+
setattr(class_object, meth_name, meth)
|
403 |
+
|
404 |
+
|
405 |
+
def _parameter_decorator(naming_type, testcases):
|
406 |
+
"""Implementation of the parameterization decorators.
|
407 |
+
|
408 |
+
Args:
|
409 |
+
naming_type: The naming type.
|
410 |
+
testcases: Testcase parameters.
|
411 |
+
|
412 |
+
Raises:
|
413 |
+
NoTestsError: Raised when the decorator generates no tests.
|
414 |
+
|
415 |
+
Returns:
|
416 |
+
A function for modifying the decorated object.
|
417 |
+
"""
|
418 |
+
def _apply(obj):
|
419 |
+
if isinstance(obj, type):
|
420 |
+
_modify_class(obj, testcases, naming_type)
|
421 |
+
return obj
|
422 |
+
else:
|
423 |
+
return _ParameterizedTestIter(obj, testcases, naming_type)
|
424 |
+
|
425 |
+
if (len(testcases) == 1 and
|
426 |
+
not isinstance(testcases[0], tuple) and
|
427 |
+
not isinstance(testcases[0], abc.Mapping)):
|
428 |
+
# Support using a single non-tuple parameter as a list of test cases.
|
429 |
+
# Note that the single non-tuple parameter can't be Mapping either, which
|
430 |
+
# means a single dict parameter case.
|
431 |
+
assert _non_string_or_bytes_iterable(testcases[0]), (
|
432 |
+
'Single parameter argument must be a non-string non-Mapping iterable')
|
433 |
+
testcases = testcases[0]
|
434 |
+
|
435 |
+
if not isinstance(testcases, abc.Sequence):
|
436 |
+
testcases = list(testcases)
|
437 |
+
if not testcases:
|
438 |
+
raise NoTestsError(
|
439 |
+
'parameterized test decorators did not generate any tests. '
|
440 |
+
'Make sure you specify non-empty parameters, '
|
441 |
+
'and do not reuse generators more than once.')
|
442 |
+
|
443 |
+
return _apply
|
444 |
+
|
445 |
+
|
446 |
+
def parameters(*testcases):
|
447 |
+
"""A decorator for creating parameterized tests.
|
448 |
+
|
449 |
+
See the module docstring for a usage example.
|
450 |
+
|
451 |
+
Args:
|
452 |
+
*testcases: Parameters for the decorated method, either a single
|
453 |
+
iterable, or a list of tuples/dicts/objects (for tests with only one
|
454 |
+
argument).
|
455 |
+
|
456 |
+
Raises:
|
457 |
+
NoTestsError: Raised when the decorator generates no tests.
|
458 |
+
|
459 |
+
Returns:
|
460 |
+
A test generator to be handled by TestGeneratorMetaclass.
|
461 |
+
"""
|
462 |
+
return _parameter_decorator(_ARGUMENT_REPR, testcases)
|
463 |
+
|
464 |
+
|
465 |
+
def named_parameters(*testcases):
|
466 |
+
"""A decorator for creating parameterized tests.
|
467 |
+
|
468 |
+
See the module docstring for a usage example. For every parameter tuple
|
469 |
+
passed, the first element of the tuple should be a string and will be appended
|
470 |
+
to the name of the test method. Each parameter dict passed must have a value
|
471 |
+
for the key "testcase_name", the string representation of that value will be
|
472 |
+
appended to the name of the test method.
|
473 |
+
|
474 |
+
Args:
|
475 |
+
*testcases: Parameters for the decorated method, either a single iterable,
|
476 |
+
or a list of tuples or dicts.
|
477 |
+
|
478 |
+
Raises:
|
479 |
+
NoTestsError: Raised when the decorator generates no tests.
|
480 |
+
|
481 |
+
Returns:
|
482 |
+
A test generator to be handled by TestGeneratorMetaclass.
|
483 |
+
"""
|
484 |
+
return _parameter_decorator(_NAMED, testcases)
|
485 |
+
|
486 |
+
|
487 |
+
def product(*kwargs_seqs, **testgrid):
|
488 |
+
"""A decorator for running tests over cartesian product of parameters values.
|
489 |
+
|
490 |
+
See the module docstring for a usage example. The test will be run for every
|
491 |
+
possible combination of the parameters.
|
492 |
+
|
493 |
+
Args:
|
494 |
+
*kwargs_seqs: Each positional parameter is a sequence of keyword arg dicts;
|
495 |
+
every test case generated will include exactly one kwargs dict from each
|
496 |
+
positional parameter; these will then be merged to form an overall list
|
497 |
+
of arguments for the test case.
|
498 |
+
**testgrid: A mapping of parameter names and their possible values. Possible
|
499 |
+
values should given as either a list or a tuple.
|
500 |
+
|
501 |
+
Raises:
|
502 |
+
NoTestsError: Raised when the decorator generates no tests.
|
503 |
+
|
504 |
+
Returns:
|
505 |
+
A test generator to be handled by TestGeneratorMetaclass.
|
506 |
+
"""
|
507 |
+
|
508 |
+
for name, values in testgrid.items():
|
509 |
+
assert isinstance(values, (list, tuple)), (
|
510 |
+
'Values of {} must be given as list or tuple, found {}'.format(
|
511 |
+
name, type(values)))
|
512 |
+
|
513 |
+
prior_arg_names = set()
|
514 |
+
for kwargs_seq in kwargs_seqs:
|
515 |
+
assert ((isinstance(kwargs_seq, (list, tuple))) and
|
516 |
+
all(isinstance(kwargs, dict) for kwargs in kwargs_seq)), (
|
517 |
+
'Positional parameters must be a sequence of keyword arg'
|
518 |
+
'dicts, found {}'
|
519 |
+
.format(kwargs_seq))
|
520 |
+
if kwargs_seq:
|
521 |
+
arg_names = set(kwargs_seq[0])
|
522 |
+
assert all(set(kwargs) == arg_names for kwargs in kwargs_seq), (
|
523 |
+
'Keyword argument dicts within a single parameter must all have the '
|
524 |
+
'same keys, found {}'.format(kwargs_seq))
|
525 |
+
assert not (arg_names & prior_arg_names), (
|
526 |
+
'Keyword argument dict sequences must all have distinct argument '
|
527 |
+
'names, found duplicate(s) {}'
|
528 |
+
.format(sorted(arg_names & prior_arg_names)))
|
529 |
+
prior_arg_names |= arg_names
|
530 |
+
|
531 |
+
assert not (prior_arg_names & set(testgrid)), (
|
532 |
+
'Arguments supplied in kwargs dicts in positional parameters must not '
|
533 |
+
'overlap with arguments supplied as named parameters; found duplicate '
|
534 |
+
'argument(s) {}'.format(sorted(prior_arg_names & set(testgrid))))
|
535 |
+
|
536 |
+
# Convert testgrid into a sequence of sequences of kwargs dicts and combine
|
537 |
+
# with the positional parameters.
|
538 |
+
# So foo=[1,2], bar=[3,4] --> [[{foo: 1}, {foo: 2}], [{bar: 3, bar: 4}]]
|
539 |
+
testgrid = (tuple({k: v} for v in vs) for k, vs in testgrid.items())
|
540 |
+
testgrid = tuple(kwargs_seqs) + tuple(testgrid)
|
541 |
+
|
542 |
+
# Create all possible combinations of parameters as a cartesian product
|
543 |
+
# of parameter values.
|
544 |
+
testcases = [
|
545 |
+
dict(itertools.chain.from_iterable(case.items()
|
546 |
+
for case in cases))
|
547 |
+
for cases in itertools.product(*testgrid)
|
548 |
+
]
|
549 |
+
return _parameter_decorator(_ARGUMENT_REPR, testcases)
|
550 |
+
|
551 |
+
|
552 |
+
class TestGeneratorMetaclass(type):
|
553 |
+
"""Metaclass for adding tests generated by parameterized decorators."""
|
554 |
+
|
555 |
+
def __new__(cls, class_name, bases, dct):
|
556 |
+
# NOTE: _test_params_repr is private to parameterized.TestCase and it's
|
557 |
+
# metaclass; do not use it outside of those classes.
|
558 |
+
test_params_reprs = dct.setdefault('_test_params_reprs', {})
|
559 |
+
for name, obj in dct.copy().items():
|
560 |
+
if (name.startswith(unittest.TestLoader.testMethodPrefix) and
|
561 |
+
_non_string_or_bytes_iterable(obj)):
|
562 |
+
# NOTE: `obj` might not be a _ParameterizedTestIter in two cases:
|
563 |
+
# 1. a class-level iterable named test* that isn't a test, such as
|
564 |
+
# a list of something. Such attributes get deleted from the class.
|
565 |
+
#
|
566 |
+
# 2. If a decorator is applied to the parameterized test, e.g.
|
567 |
+
# @morestuff
|
568 |
+
# @parameterized.parameters(...)
|
569 |
+
# def test_foo(...): ...
|
570 |
+
#
|
571 |
+
# This is OK so long as the underlying parameterized function state
|
572 |
+
# is forwarded (e.g. using functool.wraps() and **without**
|
573 |
+
# accessing explicitly accessing the internal attributes.
|
574 |
+
if isinstance(obj, _ParameterizedTestIter):
|
575 |
+
# Update the original test method name so it's more accurate.
|
576 |
+
# The mismatch might happen when another decorator is used inside
|
577 |
+
# the parameterized decrators, and the inner decorator doesn't
|
578 |
+
# preserve its __name__.
|
579 |
+
obj._original_name = name
|
580 |
+
iterator = iter(obj)
|
581 |
+
dct.pop(name)
|
582 |
+
_update_class_dict_for_param_test_case(
|
583 |
+
class_name, dct, test_params_reprs, name, iterator)
|
584 |
+
# If the base class is a subclass of parameterized.TestCase, inherit its
|
585 |
+
# _test_params_reprs too.
|
586 |
+
for base in bases:
|
587 |
+
# Check if the base has _test_params_reprs first, then check if it's a
|
588 |
+
# subclass of parameterized.TestCase. Otherwise when this is called for
|
589 |
+
# the parameterized.TestCase definition itself, this raises because
|
590 |
+
# itself is not defined yet. This works as long as absltest.TestCase does
|
591 |
+
# not define _test_params_reprs.
|
592 |
+
base_test_params_reprs = getattr(base, '_test_params_reprs', None)
|
593 |
+
if base_test_params_reprs and issubclass(base, TestCase):
|
594 |
+
for test_method, test_method_id in base_test_params_reprs.items():
|
595 |
+
# test_method may both exists in base and this class.
|
596 |
+
# This class's method overrides base class's.
|
597 |
+
# That's why it should only inherit it if it does not exist.
|
598 |
+
test_params_reprs.setdefault(test_method, test_method_id)
|
599 |
+
|
600 |
+
return type.__new__(cls, class_name, bases, dct)
|
601 |
+
|
602 |
+
|
603 |
+
def _update_class_dict_for_param_test_case(
|
604 |
+
test_class_name, dct, test_params_reprs, name, iterator):
|
605 |
+
"""Adds individual test cases to a dictionary.
|
606 |
+
|
607 |
+
Args:
|
608 |
+
test_class_name: The name of the class tests are added to.
|
609 |
+
dct: The target dictionary.
|
610 |
+
test_params_reprs: The dictionary for mapping names to test IDs.
|
611 |
+
name: The original name of the test case.
|
612 |
+
iterator: The iterator generating the individual test cases.
|
613 |
+
|
614 |
+
Raises:
|
615 |
+
DuplicateTestNameError: Raised when a test name occurs multiple times.
|
616 |
+
RuntimeError: If non-parameterized functions are generated.
|
617 |
+
"""
|
618 |
+
for idx, func in enumerate(iterator):
|
619 |
+
assert callable(func), 'Test generators must yield callables, got %r' % (
|
620 |
+
func,)
|
621 |
+
if not (getattr(func, '__x_use_name__', None) or
|
622 |
+
getattr(func, '__x_params_repr__', None)):
|
623 |
+
raise RuntimeError(
|
624 |
+
'{}.{} generated a test function without using the parameterized '
|
625 |
+
'decorators. Only tests generated using the decorators are '
|
626 |
+
'supported.'.format(test_class_name, name))
|
627 |
+
|
628 |
+
if getattr(func, '__x_use_name__', False):
|
629 |
+
original_name = func.__name__
|
630 |
+
new_name = original_name
|
631 |
+
else:
|
632 |
+
original_name = name
|
633 |
+
new_name = '%s%d' % (original_name, idx)
|
634 |
+
|
635 |
+
if new_name in dct:
|
636 |
+
raise DuplicateTestNameError(test_class_name, new_name, original_name)
|
637 |
+
|
638 |
+
dct[new_name] = func
|
639 |
+
test_params_reprs[new_name] = getattr(func, '__x_params_repr__', '')
|
640 |
+
|
641 |
+
|
642 |
+
class TestCase(absltest.TestCase, metaclass=TestGeneratorMetaclass):
|
643 |
+
"""Base class for test cases using the parameters decorator."""
|
644 |
+
|
645 |
+
# visibility: private; do not call outside this class.
|
646 |
+
def _get_params_repr(self):
|
647 |
+
return self._test_params_reprs.get(self._testMethodName, '')
|
648 |
+
|
649 |
+
def __str__(self):
|
650 |
+
params_repr = self._get_params_repr()
|
651 |
+
if params_repr:
|
652 |
+
params_repr = ' ' + params_repr
|
653 |
+
return '{}{} ({})'.format(
|
654 |
+
self._testMethodName, params_repr,
|
655 |
+
unittest.util.strclass(self.__class__))
|
656 |
+
|
657 |
+
def id(self):
|
658 |
+
"""Returns the descriptive ID of the test.
|
659 |
+
|
660 |
+
This is used internally by the unittesting framework to get a name
|
661 |
+
for the test to be used in reports.
|
662 |
+
|
663 |
+
Returns:
|
664 |
+
The test id.
|
665 |
+
"""
|
666 |
+
base = super(TestCase, self).id()
|
667 |
+
params_repr = self._get_params_repr()
|
668 |
+
if params_repr:
|
669 |
+
# We include the params in the id so that, when reported in the
|
670 |
+
# test.xml file, the value is more informative than just "test_foo0".
|
671 |
+
# Use a space to separate them so that it's copy/paste friendly and
|
672 |
+
# easy to identify the actual test id.
|
673 |
+
return '{} {}'.format(base, params_repr)
|
674 |
+
else:
|
675 |
+
return base
|
676 |
+
|
677 |
+
|
678 |
+
# This function is kept CamelCase because it's used as a class's base class.
|
679 |
+
def CoopTestCase(other_base_class): # pylint: disable=invalid-name
|
680 |
+
"""Returns a new base class with a cooperative metaclass base.
|
681 |
+
|
682 |
+
This enables the TestCase to be used in combination
|
683 |
+
with other base classes that have custom metaclasses, such as
|
684 |
+
``mox.MoxTestBase``.
|
685 |
+
|
686 |
+
Only works with metaclasses that do not override ``type.__new__``.
|
687 |
+
|
688 |
+
Example::
|
689 |
+
|
690 |
+
from absl.testing import parameterized
|
691 |
+
|
692 |
+
class ExampleTest(parameterized.CoopTestCase(OtherTestCase)):
|
693 |
+
...
|
694 |
+
|
695 |
+
Args:
|
696 |
+
other_base_class: (class) A test case base class.
|
697 |
+
|
698 |
+
Returns:
|
699 |
+
A new class object.
|
700 |
+
"""
|
701 |
+
# If the other base class has a metaclass of 'type' then trying to combine
|
702 |
+
# the metaclasses will result in an MRO error. So simply combine them and
|
703 |
+
# return.
|
704 |
+
if type(other_base_class) == type: # pylint: disable=unidiomatic-typecheck
|
705 |
+
warnings.warn(
|
706 |
+
'CoopTestCase is only necessary when combining with a class that uses'
|
707 |
+
' a metaclass. Use multiple inheritance like this instead: class'
|
708 |
+
f' ExampleTest(paramaterized.TestCase, {other_base_class.__name__}):',
|
709 |
+
stacklevel=2,
|
710 |
+
)
|
711 |
+
|
712 |
+
class CoopTestCaseBase(other_base_class, TestCase):
|
713 |
+
pass
|
714 |
+
|
715 |
+
return CoopTestCaseBase
|
716 |
+
else:
|
717 |
+
|
718 |
+
class CoopMetaclass(type(other_base_class), TestGeneratorMetaclass): # pylint: disable=unused-variable
|
719 |
+
pass
|
720 |
+
|
721 |
+
class CoopTestCaseBase(other_base_class, TestCase, metaclass=CoopMetaclass):
|
722 |
+
pass
|
723 |
+
|
724 |
+
return CoopTestCaseBase
|
env-llmeval/lib/python3.10/site-packages/absl/testing/xml_reporter.py
ADDED
@@ -0,0 +1,563 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Copyright 2017 The Abseil Authors.
|
2 |
+
#
|
3 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4 |
+
# you may not use this file except in compliance with the License.
|
5 |
+
# You may obtain a copy of the License at
|
6 |
+
#
|
7 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8 |
+
#
|
9 |
+
# Unless required by applicable law or agreed to in writing, software
|
10 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12 |
+
# See the License for the specific language governing permissions and
|
13 |
+
# limitations under the License.
|
14 |
+
|
15 |
+
"""A Python test reporter that generates test reports in JUnit XML format."""
|
16 |
+
|
17 |
+
import datetime
|
18 |
+
import re
|
19 |
+
import sys
|
20 |
+
import threading
|
21 |
+
import time
|
22 |
+
import traceback
|
23 |
+
import unittest
|
24 |
+
from xml.sax import saxutils
|
25 |
+
from absl.testing import _pretty_print_reporter
|
26 |
+
|
27 |
+
|
28 |
+
# See http://www.w3.org/TR/REC-xml/#NT-Char
|
29 |
+
_bad_control_character_codes = set(range(0, 0x20)) - {0x9, 0xA, 0xD}
|
30 |
+
|
31 |
+
|
32 |
+
_control_character_conversions = {
|
33 |
+
chr(i): '\\x{:02x}'.format(i) for i in _bad_control_character_codes}
|
34 |
+
|
35 |
+
|
36 |
+
_escape_xml_attr_conversions = {
|
37 |
+
'"': '"',
|
38 |
+
"'": ''',
|
39 |
+
'\n': '
',
|
40 |
+
'\t': '	',
|
41 |
+
'\r': '
',
|
42 |
+
' ': ' '}
|
43 |
+
_escape_xml_attr_conversions.update(_control_character_conversions)
|
44 |
+
|
45 |
+
|
46 |
+
# When class or module level function fails, unittest/suite.py adds a
|
47 |
+
# _ErrorHolder instance instead of a real TestCase, and it has a description
|
48 |
+
# like "setUpClass (__main__.MyTestCase)".
|
49 |
+
_CLASS_OR_MODULE_LEVEL_TEST_DESC_REGEX = re.compile(r'^(\w+) \((\S+)\)$')
|
50 |
+
|
51 |
+
|
52 |
+
# NOTE: while saxutils.quoteattr() theoretically does the same thing; it
|
53 |
+
# seems to often end up being too smart for it's own good not escaping properly.
|
54 |
+
# This function is much more reliable.
|
55 |
+
def _escape_xml_attr(content):
|
56 |
+
"""Escapes xml attributes."""
|
57 |
+
# Note: saxutils doesn't escape the quotes.
|
58 |
+
return saxutils.escape(content, _escape_xml_attr_conversions)
|
59 |
+
|
60 |
+
|
61 |
+
def _escape_cdata(s):
|
62 |
+
"""Escapes a string to be used as XML CDATA.
|
63 |
+
|
64 |
+
CDATA characters are treated strictly as character data, not as XML markup,
|
65 |
+
but there are still certain restrictions on them.
|
66 |
+
|
67 |
+
Args:
|
68 |
+
s: the string to be escaped.
|
69 |
+
Returns:
|
70 |
+
An escaped version of the input string.
|
71 |
+
"""
|
72 |
+
for char, escaped in _control_character_conversions.items():
|
73 |
+
s = s.replace(char, escaped)
|
74 |
+
return s.replace(']]>', ']] >')
|
75 |
+
|
76 |
+
|
77 |
+
def _iso8601_timestamp(timestamp):
|
78 |
+
"""Produces an ISO8601 datetime.
|
79 |
+
|
80 |
+
Args:
|
81 |
+
timestamp: an Epoch based timestamp in seconds.
|
82 |
+
|
83 |
+
Returns:
|
84 |
+
A iso8601 format timestamp if the input is a valid timestamp, None otherwise
|
85 |
+
"""
|
86 |
+
if timestamp is None or timestamp < 0:
|
87 |
+
return None
|
88 |
+
return datetime.datetime.fromtimestamp(
|
89 |
+
timestamp, tz=datetime.timezone.utc).isoformat()
|
90 |
+
|
91 |
+
|
92 |
+
def _print_xml_element_header(element, attributes, stream, indentation=''):
|
93 |
+
"""Prints an XML header of an arbitrary element.
|
94 |
+
|
95 |
+
Args:
|
96 |
+
element: element name (testsuites, testsuite, testcase)
|
97 |
+
attributes: 2-tuple list with (attributes, values) already escaped
|
98 |
+
stream: output stream to write test report XML to
|
99 |
+
indentation: indentation added to the element header
|
100 |
+
"""
|
101 |
+
stream.write('%s<%s' % (indentation, element))
|
102 |
+
for attribute in attributes:
|
103 |
+
if (len(attribute) == 2 and attribute[0] is not None and
|
104 |
+
attribute[1] is not None):
|
105 |
+
stream.write(' %s="%s"' % (attribute[0], attribute[1]))
|
106 |
+
stream.write('>\n')
|
107 |
+
|
108 |
+
# Copy time.time which ensures the real time is used internally.
|
109 |
+
# This prevents bad interactions with tests that stub out time.
|
110 |
+
_time_copy = time.time
|
111 |
+
|
112 |
+
if hasattr(traceback, '_some_str'):
|
113 |
+
# Use the traceback module str function to format safely.
|
114 |
+
_safe_str = traceback._some_str
|
115 |
+
else:
|
116 |
+
_safe_str = str # pylint: disable=invalid-name
|
117 |
+
|
118 |
+
|
119 |
+
class _TestCaseResult(object):
|
120 |
+
"""Private helper for _TextAndXMLTestResult that represents a test result.
|
121 |
+
|
122 |
+
Attributes:
|
123 |
+
test: A TestCase instance of an individual test method.
|
124 |
+
name: The name of the individual test method.
|
125 |
+
full_class_name: The full name of the test class.
|
126 |
+
run_time: The duration (in seconds) it took to run the test.
|
127 |
+
start_time: Epoch relative timestamp of when test started (in seconds)
|
128 |
+
errors: A list of error 4-tuples. Error tuple entries are
|
129 |
+
1) a string identifier of either "failure" or "error"
|
130 |
+
2) an exception_type
|
131 |
+
3) an exception_message
|
132 |
+
4) a string version of a sys.exc_info()-style tuple of values
|
133 |
+
('error', err[0], err[1], self._exc_info_to_string(err))
|
134 |
+
If the length of errors is 0, then the test is either passed or
|
135 |
+
skipped.
|
136 |
+
skip_reason: A string explaining why the test was skipped.
|
137 |
+
"""
|
138 |
+
|
139 |
+
def __init__(self, test):
|
140 |
+
self.run_time = -1
|
141 |
+
self.start_time = -1
|
142 |
+
self.skip_reason = None
|
143 |
+
self.errors = []
|
144 |
+
self.test = test
|
145 |
+
|
146 |
+
# Parse the test id to get its test name and full class path.
|
147 |
+
# Unfortunately there is no better way of knowning the test and class.
|
148 |
+
# Worse, unittest uses _ErrorHandler instances to represent class / module
|
149 |
+
# level failures.
|
150 |
+
test_desc = test.id() or str(test)
|
151 |
+
# Check if it's something like "setUpClass (__main__.TestCase)".
|
152 |
+
match = _CLASS_OR_MODULE_LEVEL_TEST_DESC_REGEX.match(test_desc)
|
153 |
+
if match:
|
154 |
+
name = match.group(1)
|
155 |
+
full_class_name = match.group(2)
|
156 |
+
else:
|
157 |
+
class_name = unittest.util.strclass(test.__class__)
|
158 |
+
if isinstance(test, unittest.case._SubTest):
|
159 |
+
# If the test case is a _SubTest, the real TestCase instance is
|
160 |
+
# available as _SubTest.test_case.
|
161 |
+
class_name = unittest.util.strclass(test.test_case.__class__)
|
162 |
+
if test_desc.startswith(class_name + '.'):
|
163 |
+
# In a typical unittest.TestCase scenario, test.id() returns with
|
164 |
+
# a class name formatted using unittest.util.strclass.
|
165 |
+
name = test_desc[len(class_name)+1:]
|
166 |
+
full_class_name = class_name
|
167 |
+
else:
|
168 |
+
# Otherwise make a best effort to guess the test name and full class
|
169 |
+
# path.
|
170 |
+
parts = test_desc.rsplit('.', 1)
|
171 |
+
name = parts[-1]
|
172 |
+
full_class_name = parts[0] if len(parts) == 2 else ''
|
173 |
+
self.name = _escape_xml_attr(name)
|
174 |
+
self.full_class_name = _escape_xml_attr(full_class_name)
|
175 |
+
|
176 |
+
def set_run_time(self, time_in_secs):
|
177 |
+
self.run_time = time_in_secs
|
178 |
+
|
179 |
+
def set_start_time(self, time_in_secs):
|
180 |
+
self.start_time = time_in_secs
|
181 |
+
|
182 |
+
def print_xml_summary(self, stream):
|
183 |
+
"""Prints an XML Summary of a TestCase.
|
184 |
+
|
185 |
+
Status and result are populated as per JUnit XML test result reporter.
|
186 |
+
A test that has been skipped will always have a skip reason,
|
187 |
+
as every skip method in Python's unittest requires the reason arg to be
|
188 |
+
passed.
|
189 |
+
|
190 |
+
Args:
|
191 |
+
stream: output stream to write test report XML to
|
192 |
+
"""
|
193 |
+
|
194 |
+
if self.skip_reason is None:
|
195 |
+
status = 'run'
|
196 |
+
result = 'completed'
|
197 |
+
else:
|
198 |
+
status = 'notrun'
|
199 |
+
result = 'suppressed'
|
200 |
+
|
201 |
+
test_case_attributes = [
|
202 |
+
('name', '%s' % self.name),
|
203 |
+
('status', '%s' % status),
|
204 |
+
('result', '%s' % result),
|
205 |
+
('time', '%.3f' % self.run_time),
|
206 |
+
('classname', self.full_class_name),
|
207 |
+
('timestamp', _iso8601_timestamp(self.start_time)),
|
208 |
+
]
|
209 |
+
_print_xml_element_header('testcase', test_case_attributes, stream, ' ')
|
210 |
+
self._print_testcase_details(stream)
|
211 |
+
stream.write(' </testcase>\n')
|
212 |
+
|
213 |
+
def _print_testcase_details(self, stream):
|
214 |
+
for error in self.errors:
|
215 |
+
outcome, exception_type, message, error_msg = error # pylint: disable=unpacking-non-sequence
|
216 |
+
message = _escape_xml_attr(_safe_str(message))
|
217 |
+
exception_type = _escape_xml_attr(str(exception_type))
|
218 |
+
error_msg = _escape_cdata(error_msg)
|
219 |
+
stream.write(' <%s message="%s" type="%s"><![CDATA[%s]]></%s>\n'
|
220 |
+
% (outcome, message, exception_type, error_msg, outcome))
|
221 |
+
|
222 |
+
|
223 |
+
class _TestSuiteResult(object):
|
224 |
+
"""Private helper for _TextAndXMLTestResult."""
|
225 |
+
|
226 |
+
def __init__(self):
|
227 |
+
self.suites = {}
|
228 |
+
self.failure_counts = {}
|
229 |
+
self.error_counts = {}
|
230 |
+
self.overall_start_time = -1
|
231 |
+
self.overall_end_time = -1
|
232 |
+
self._testsuites_properties = {}
|
233 |
+
|
234 |
+
def add_test_case_result(self, test_case_result):
|
235 |
+
suite_name = type(test_case_result.test).__name__
|
236 |
+
if suite_name == '_ErrorHolder':
|
237 |
+
# _ErrorHolder is a special case created by unittest for class / module
|
238 |
+
# level functions.
|
239 |
+
suite_name = test_case_result.full_class_name.rsplit('.')[-1]
|
240 |
+
if isinstance(test_case_result.test, unittest.case._SubTest):
|
241 |
+
# If the test case is a _SubTest, the real TestCase instance is
|
242 |
+
# available as _SubTest.test_case.
|
243 |
+
suite_name = type(test_case_result.test.test_case).__name__
|
244 |
+
|
245 |
+
self._setup_test_suite(suite_name)
|
246 |
+
self.suites[suite_name].append(test_case_result)
|
247 |
+
for error in test_case_result.errors:
|
248 |
+
# Only count the first failure or error so that the sum is equal to the
|
249 |
+
# total number of *testcases* that have failures or errors.
|
250 |
+
if error[0] == 'failure':
|
251 |
+
self.failure_counts[suite_name] += 1
|
252 |
+
break
|
253 |
+
elif error[0] == 'error':
|
254 |
+
self.error_counts[suite_name] += 1
|
255 |
+
break
|
256 |
+
|
257 |
+
def print_xml_summary(self, stream):
|
258 |
+
overall_test_count = sum(len(x) for x in self.suites.values())
|
259 |
+
overall_failures = sum(self.failure_counts.values())
|
260 |
+
overall_errors = sum(self.error_counts.values())
|
261 |
+
overall_attributes = [
|
262 |
+
('name', ''),
|
263 |
+
('tests', '%d' % overall_test_count),
|
264 |
+
('failures', '%d' % overall_failures),
|
265 |
+
('errors', '%d' % overall_errors),
|
266 |
+
('time', '%.3f' % (self.overall_end_time - self.overall_start_time)),
|
267 |
+
('timestamp', _iso8601_timestamp(self.overall_start_time)),
|
268 |
+
]
|
269 |
+
_print_xml_element_header('testsuites', overall_attributes, stream)
|
270 |
+
if self._testsuites_properties:
|
271 |
+
stream.write(' <properties>\n')
|
272 |
+
for name, value in sorted(self._testsuites_properties.items()):
|
273 |
+
stream.write(' <property name="%s" value="%s"></property>\n' %
|
274 |
+
(_escape_xml_attr(name), _escape_xml_attr(str(value))))
|
275 |
+
stream.write(' </properties>\n')
|
276 |
+
|
277 |
+
for suite_name in self.suites:
|
278 |
+
suite = self.suites[suite_name]
|
279 |
+
suite_end_time = max(x.start_time + x.run_time for x in suite)
|
280 |
+
suite_start_time = min(x.start_time for x in suite)
|
281 |
+
failures = self.failure_counts[suite_name]
|
282 |
+
errors = self.error_counts[suite_name]
|
283 |
+
suite_attributes = [
|
284 |
+
('name', '%s' % suite_name),
|
285 |
+
('tests', '%d' % len(suite)),
|
286 |
+
('failures', '%d' % failures),
|
287 |
+
('errors', '%d' % errors),
|
288 |
+
('time', '%.3f' % (suite_end_time - suite_start_time)),
|
289 |
+
('timestamp', _iso8601_timestamp(suite_start_time)),
|
290 |
+
]
|
291 |
+
_print_xml_element_header('testsuite', suite_attributes, stream)
|
292 |
+
|
293 |
+
# test_case_result entries are not guaranteed to be in any user-friendly
|
294 |
+
# order, especially when using subtests. So sort them.
|
295 |
+
for test_case_result in sorted(suite, key=lambda t: t.name):
|
296 |
+
test_case_result.print_xml_summary(stream)
|
297 |
+
stream.write('</testsuite>\n')
|
298 |
+
stream.write('</testsuites>\n')
|
299 |
+
|
300 |
+
def _setup_test_suite(self, suite_name):
|
301 |
+
"""Adds a test suite to the set of suites tracked by this test run.
|
302 |
+
|
303 |
+
Args:
|
304 |
+
suite_name: string, The name of the test suite being initialized.
|
305 |
+
"""
|
306 |
+
if suite_name in self.suites:
|
307 |
+
return
|
308 |
+
self.suites[suite_name] = []
|
309 |
+
self.failure_counts[suite_name] = 0
|
310 |
+
self.error_counts[suite_name] = 0
|
311 |
+
|
312 |
+
def set_end_time(self, timestamp_in_secs):
|
313 |
+
"""Sets the start timestamp of this test suite.
|
314 |
+
|
315 |
+
Args:
|
316 |
+
timestamp_in_secs: timestamp in seconds since epoch
|
317 |
+
"""
|
318 |
+
self.overall_end_time = timestamp_in_secs
|
319 |
+
|
320 |
+
def set_start_time(self, timestamp_in_secs):
|
321 |
+
"""Sets the end timestamp of this test suite.
|
322 |
+
|
323 |
+
Args:
|
324 |
+
timestamp_in_secs: timestamp in seconds since epoch
|
325 |
+
"""
|
326 |
+
self.overall_start_time = timestamp_in_secs
|
327 |
+
|
328 |
+
|
329 |
+
class _TextAndXMLTestResult(_pretty_print_reporter.TextTestResult):
|
330 |
+
"""Private TestResult class that produces both formatted text results and XML.
|
331 |
+
|
332 |
+
Used by TextAndXMLTestRunner.
|
333 |
+
"""
|
334 |
+
|
335 |
+
_TEST_SUITE_RESULT_CLASS = _TestSuiteResult
|
336 |
+
_TEST_CASE_RESULT_CLASS = _TestCaseResult
|
337 |
+
|
338 |
+
def __init__(self, xml_stream, stream, descriptions, verbosity,
|
339 |
+
time_getter=_time_copy, testsuites_properties=None):
|
340 |
+
super(_TextAndXMLTestResult, self).__init__(stream, descriptions, verbosity)
|
341 |
+
self.xml_stream = xml_stream
|
342 |
+
self.pending_test_case_results = {}
|
343 |
+
self.suite = self._TEST_SUITE_RESULT_CLASS()
|
344 |
+
if testsuites_properties:
|
345 |
+
self.suite._testsuites_properties = testsuites_properties
|
346 |
+
self.time_getter = time_getter
|
347 |
+
|
348 |
+
# This lock guards any mutations on pending_test_case_results.
|
349 |
+
self._pending_test_case_results_lock = threading.RLock()
|
350 |
+
|
351 |
+
def startTest(self, test):
|
352 |
+
self.start_time = self.time_getter()
|
353 |
+
super(_TextAndXMLTestResult, self).startTest(test)
|
354 |
+
|
355 |
+
def stopTest(self, test):
|
356 |
+
# Grabbing the write lock to avoid conflicting with stopTestRun.
|
357 |
+
with self._pending_test_case_results_lock:
|
358 |
+
super(_TextAndXMLTestResult, self).stopTest(test)
|
359 |
+
result = self.get_pending_test_case_result(test)
|
360 |
+
if not result:
|
361 |
+
test_name = test.id() or str(test)
|
362 |
+
sys.stderr.write('No pending test case: %s\n' % test_name)
|
363 |
+
return
|
364 |
+
if getattr(self, 'start_time', None) is None:
|
365 |
+
# startTest may not be called for skipped tests since Python 3.12.1.
|
366 |
+
self.start_time = self.time_getter()
|
367 |
+
test_id = id(test)
|
368 |
+
run_time = self.time_getter() - self.start_time
|
369 |
+
result.set_run_time(run_time)
|
370 |
+
result.set_start_time(self.start_time)
|
371 |
+
self.suite.add_test_case_result(result)
|
372 |
+
del self.pending_test_case_results[test_id]
|
373 |
+
|
374 |
+
def startTestRun(self):
|
375 |
+
self.suite.set_start_time(self.time_getter())
|
376 |
+
super(_TextAndXMLTestResult, self).startTestRun()
|
377 |
+
|
378 |
+
def stopTestRun(self):
|
379 |
+
self.suite.set_end_time(self.time_getter())
|
380 |
+
# All pending_test_case_results will be added to the suite and removed from
|
381 |
+
# the pending_test_case_results dictionary. Grabbing the write lock to avoid
|
382 |
+
# results from being added during this process to avoid duplicating adds or
|
383 |
+
# accidentally erasing newly appended pending results.
|
384 |
+
with self._pending_test_case_results_lock:
|
385 |
+
# Errors in the test fixture (setUpModule, tearDownModule,
|
386 |
+
# setUpClass, tearDownClass) can leave a pending result which
|
387 |
+
# never gets added to the suite. The runner calls stopTestRun
|
388 |
+
# which gives us an opportunity to add these errors for
|
389 |
+
# reporting here.
|
390 |
+
for test_id in self.pending_test_case_results:
|
391 |
+
result = self.pending_test_case_results[test_id]
|
392 |
+
if getattr(self, 'start_time', None) is not None:
|
393 |
+
run_time = self.suite.overall_end_time - self.start_time
|
394 |
+
result.set_run_time(run_time)
|
395 |
+
result.set_start_time(self.start_time)
|
396 |
+
self.suite.add_test_case_result(result)
|
397 |
+
self.pending_test_case_results.clear()
|
398 |
+
|
399 |
+
def _exc_info_to_string(self, err, test=None):
|
400 |
+
"""Converts a sys.exc_info()-style tuple of values into a string.
|
401 |
+
|
402 |
+
This method must be overridden because the method signature in
|
403 |
+
unittest.TestResult changed between Python 2.2 and 2.4.
|
404 |
+
|
405 |
+
Args:
|
406 |
+
err: A sys.exc_info() tuple of values for an error.
|
407 |
+
test: The test method.
|
408 |
+
|
409 |
+
Returns:
|
410 |
+
A formatted exception string.
|
411 |
+
"""
|
412 |
+
if test:
|
413 |
+
return super(_TextAndXMLTestResult, self)._exc_info_to_string(err, test)
|
414 |
+
return ''.join(traceback.format_exception(*err))
|
415 |
+
|
416 |
+
def add_pending_test_case_result(self, test, error_summary=None,
|
417 |
+
skip_reason=None):
|
418 |
+
"""Adds result information to a test case result which may still be running.
|
419 |
+
|
420 |
+
If a result entry for the test already exists, add_pending_test_case_result
|
421 |
+
will add error summary tuples and/or overwrite skip_reason for the result.
|
422 |
+
If it does not yet exist, a result entry will be created.
|
423 |
+
Note that a test result is considered to have been run and passed
|
424 |
+
only if there are no errors or skip_reason.
|
425 |
+
|
426 |
+
Args:
|
427 |
+
test: A test method as defined by unittest
|
428 |
+
error_summary: A 4-tuple with the following entries:
|
429 |
+
1) a string identifier of either "failure" or "error"
|
430 |
+
2) an exception_type
|
431 |
+
3) an exception_message
|
432 |
+
4) a string version of a sys.exc_info()-style tuple of values
|
433 |
+
('error', err[0], err[1], self._exc_info_to_string(err))
|
434 |
+
If the length of errors is 0, then the test is either passed or
|
435 |
+
skipped.
|
436 |
+
skip_reason: a string explaining why the test was skipped
|
437 |
+
"""
|
438 |
+
with self._pending_test_case_results_lock:
|
439 |
+
test_id = id(test)
|
440 |
+
if test_id not in self.pending_test_case_results:
|
441 |
+
self.pending_test_case_results[test_id] = self._TEST_CASE_RESULT_CLASS(
|
442 |
+
test)
|
443 |
+
if error_summary:
|
444 |
+
self.pending_test_case_results[test_id].errors.append(error_summary)
|
445 |
+
if skip_reason:
|
446 |
+
self.pending_test_case_results[test_id].skip_reason = skip_reason
|
447 |
+
|
448 |
+
def delete_pending_test_case_result(self, test):
|
449 |
+
with self._pending_test_case_results_lock:
|
450 |
+
test_id = id(test)
|
451 |
+
del self.pending_test_case_results[test_id]
|
452 |
+
|
453 |
+
def get_pending_test_case_result(self, test):
|
454 |
+
test_id = id(test)
|
455 |
+
return self.pending_test_case_results.get(test_id, None)
|
456 |
+
|
457 |
+
def addSuccess(self, test):
|
458 |
+
super(_TextAndXMLTestResult, self).addSuccess(test)
|
459 |
+
self.add_pending_test_case_result(test)
|
460 |
+
|
461 |
+
def addError(self, test, err):
|
462 |
+
super(_TextAndXMLTestResult, self).addError(test, err)
|
463 |
+
error_summary = ('error', err[0], err[1],
|
464 |
+
self._exc_info_to_string(err, test=test))
|
465 |
+
self.add_pending_test_case_result(test, error_summary=error_summary)
|
466 |
+
|
467 |
+
def addFailure(self, test, err):
|
468 |
+
super(_TextAndXMLTestResult, self).addFailure(test, err)
|
469 |
+
error_summary = ('failure', err[0], err[1],
|
470 |
+
self._exc_info_to_string(err, test=test))
|
471 |
+
self.add_pending_test_case_result(test, error_summary=error_summary)
|
472 |
+
|
473 |
+
def addSkip(self, test, reason):
|
474 |
+
super(_TextAndXMLTestResult, self).addSkip(test, reason)
|
475 |
+
self.add_pending_test_case_result(test, skip_reason=reason)
|
476 |
+
|
477 |
+
def addExpectedFailure(self, test, err):
|
478 |
+
super(_TextAndXMLTestResult, self).addExpectedFailure(test, err)
|
479 |
+
if callable(getattr(test, 'recordProperty', None)):
|
480 |
+
test.recordProperty('EXPECTED_FAILURE',
|
481 |
+
self._exc_info_to_string(err, test=test))
|
482 |
+
self.add_pending_test_case_result(test)
|
483 |
+
|
484 |
+
def addUnexpectedSuccess(self, test):
|
485 |
+
super(_TextAndXMLTestResult, self).addUnexpectedSuccess(test)
|
486 |
+
test_name = test.id() or str(test)
|
487 |
+
error_summary = ('error', '', '',
|
488 |
+
'Test case %s should have failed, but passed.'
|
489 |
+
% (test_name))
|
490 |
+
self.add_pending_test_case_result(test, error_summary=error_summary)
|
491 |
+
|
492 |
+
def addSubTest(self, test, subtest, err): # pylint: disable=invalid-name
|
493 |
+
super(_TextAndXMLTestResult, self).addSubTest(test, subtest, err)
|
494 |
+
if err is not None:
|
495 |
+
if issubclass(err[0], test.failureException):
|
496 |
+
error_summary = ('failure', err[0], err[1],
|
497 |
+
self._exc_info_to_string(err, test=test))
|
498 |
+
else:
|
499 |
+
error_summary = ('error', err[0], err[1],
|
500 |
+
self._exc_info_to_string(err, test=test))
|
501 |
+
else:
|
502 |
+
error_summary = None
|
503 |
+
self.add_pending_test_case_result(subtest, error_summary=error_summary)
|
504 |
+
|
505 |
+
def printErrors(self):
|
506 |
+
super(_TextAndXMLTestResult, self).printErrors()
|
507 |
+
self.xml_stream.write('<?xml version="1.0"?>\n')
|
508 |
+
self.suite.print_xml_summary(self.xml_stream)
|
509 |
+
|
510 |
+
|
511 |
+
class TextAndXMLTestRunner(unittest.TextTestRunner):
|
512 |
+
"""A test runner that produces both formatted text results and XML.
|
513 |
+
|
514 |
+
It prints out the names of tests as they are run, errors as they
|
515 |
+
occur, and a summary of the results at the end of the test run.
|
516 |
+
"""
|
517 |
+
|
518 |
+
_TEST_RESULT_CLASS = _TextAndXMLTestResult
|
519 |
+
|
520 |
+
_xml_stream = None
|
521 |
+
_testsuites_properties = {}
|
522 |
+
|
523 |
+
def __init__(self, xml_stream=None, *args, **kwargs):
|
524 |
+
"""Initialize a TextAndXMLTestRunner.
|
525 |
+
|
526 |
+
Args:
|
527 |
+
xml_stream: file-like or None; XML-formatted test results are output
|
528 |
+
via this object's write() method. If None (the default), the
|
529 |
+
new instance behaves as described in the set_default_xml_stream method
|
530 |
+
documentation below.
|
531 |
+
*args: passed unmodified to unittest.TextTestRunner.__init__.
|
532 |
+
**kwargs: passed unmodified to unittest.TextTestRunner.__init__.
|
533 |
+
"""
|
534 |
+
super(TextAndXMLTestRunner, self).__init__(*args, **kwargs)
|
535 |
+
if xml_stream is not None:
|
536 |
+
self._xml_stream = xml_stream
|
537 |
+
# else, do not set self._xml_stream to None -- this allows implicit fallback
|
538 |
+
# to the class attribute's value.
|
539 |
+
|
540 |
+
@classmethod
|
541 |
+
def set_default_xml_stream(cls, xml_stream):
|
542 |
+
"""Sets the default XML stream for the class.
|
543 |
+
|
544 |
+
Args:
|
545 |
+
xml_stream: file-like or None; used for instances when xml_stream is None
|
546 |
+
or not passed to their constructors. If None is passed, instances
|
547 |
+
created with xml_stream=None will act as ordinary TextTestRunner
|
548 |
+
instances; this is the default state before any calls to this method
|
549 |
+
have been made.
|
550 |
+
"""
|
551 |
+
cls._xml_stream = xml_stream
|
552 |
+
|
553 |
+
def _makeResult(self):
|
554 |
+
if self._xml_stream is None:
|
555 |
+
return super(TextAndXMLTestRunner, self)._makeResult()
|
556 |
+
else:
|
557 |
+
return self._TEST_RESULT_CLASS(
|
558 |
+
self._xml_stream, self.stream, self.descriptions, self.verbosity,
|
559 |
+
testsuites_properties=self._testsuites_properties)
|
560 |
+
|
561 |
+
@classmethod
|
562 |
+
def set_testsuites_property(cls, key, value):
|
563 |
+
cls._testsuites_properties[key] = value
|
env-llmeval/lib/python3.10/site-packages/accelerate-0.29.2.dist-info/INSTALLER
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
pip
|
env-llmeval/lib/python3.10/site-packages/accelerate-0.29.2.dist-info/LICENSE
ADDED
@@ -0,0 +1,201 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Apache License
|
2 |
+
Version 2.0, January 2004
|
3 |
+
http://www.apache.org/licenses/
|
4 |
+
|
5 |
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
6 |
+
|
7 |
+
1. Definitions.
|
8 |
+
|
9 |
+
"License" shall mean the terms and conditions for use, reproduction,
|
10 |
+
and distribution as defined by Sections 1 through 9 of this document.
|
11 |
+
|
12 |
+
"Licensor" shall mean the copyright owner or entity authorized by
|
13 |
+
the copyright owner that is granting the License.
|
14 |
+
|
15 |
+
"Legal Entity" shall mean the union of the acting entity and all
|
16 |
+
other entities that control, are controlled by, or are under common
|
17 |
+
control with that entity. For the purposes of this definition,
|
18 |
+
"control" means (i) the power, direct or indirect, to cause the
|
19 |
+
direction or management of such entity, whether by contract or
|
20 |
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
21 |
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
22 |
+
|
23 |
+
"You" (or "Your") shall mean an individual or Legal Entity
|
24 |
+
exercising permissions granted by this License.
|
25 |
+
|
26 |
+
"Source" form shall mean the preferred form for making modifications,
|
27 |
+
including but not limited to software source code, documentation
|
28 |
+
source, and configuration files.
|
29 |
+
|
30 |
+
"Object" form shall mean any form resulting from mechanical
|
31 |
+
transformation or translation of a Source form, including but
|
32 |
+
not limited to compiled object code, generated documentation,
|
33 |
+
and conversions to other media types.
|
34 |
+
|
35 |
+
"Work" shall mean the work of authorship, whether in Source or
|
36 |
+
Object form, made available under the License, as indicated by a
|
37 |
+
copyright notice that is included in or attached to the work
|
38 |
+
(an example is provided in the Appendix below).
|
39 |
+
|
40 |
+
"Derivative Works" shall mean any work, whether in Source or Object
|
41 |
+
form, that is based on (or derived from) the Work and for which the
|
42 |
+
editorial revisions, annotations, elaborations, or other modifications
|
43 |
+
represent, as a whole, an original work of authorship. For the purposes
|
44 |
+
of this License, Derivative Works shall not include works that remain
|
45 |
+
separable from, or merely link (or bind by name) to the interfaces of,
|
46 |
+
the Work and Derivative Works thereof.
|
47 |
+
|
48 |
+
"Contribution" shall mean any work of authorship, including
|
49 |
+
the original version of the Work and any modifications or additions
|
50 |
+
to that Work or Derivative Works thereof, that is intentionally
|
51 |
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
52 |
+
or by an individual or Legal Entity authorized to submit on behalf of
|
53 |
+
the copyright owner. For the purposes of this definition, "submitted"
|
54 |
+
means any form of electronic, verbal, or written communication sent
|
55 |
+
to the Licensor or its representatives, including but not limited to
|
56 |
+
communication on electronic mailing lists, source code control systems,
|
57 |
+
and issue tracking systems that are managed by, or on behalf of, the
|
58 |
+
Licensor for the purpose of discussing and improving the Work, but
|
59 |
+
excluding communication that is conspicuously marked or otherwise
|
60 |
+
designated in writing by the copyright owner as "Not a Contribution."
|
61 |
+
|
62 |
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
63 |
+
on behalf of whom a Contribution has been received by Licensor and
|
64 |
+
subsequently incorporated within the Work.
|
65 |
+
|
66 |
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
67 |
+
this License, each Contributor hereby grants to You a perpetual,
|
68 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
69 |
+
copyright license to reproduce, prepare Derivative Works of,
|
70 |
+
publicly display, publicly perform, sublicense, and distribute the
|
71 |
+
Work and such Derivative Works in Source or Object form.
|
72 |
+
|
73 |
+
3. Grant of Patent License. Subject to the terms and conditions of
|
74 |
+
this License, each Contributor hereby grants to You a perpetual,
|
75 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
76 |
+
(except as stated in this section) patent license to make, have made,
|
77 |
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
78 |
+
where such license applies only to those patent claims licensable
|
79 |
+
by such Contributor that are necessarily infringed by their
|
80 |
+
Contribution(s) alone or by combination of their Contribution(s)
|
81 |
+
with the Work to which such Contribution(s) was submitted. If You
|
82 |
+
institute patent litigation against any entity (including a
|
83 |
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
84 |
+
or a Contribution incorporated within the Work constitutes direct
|
85 |
+
or contributory patent infringement, then any patent licenses
|
86 |
+
granted to You under this License for that Work shall terminate
|
87 |
+
as of the date such litigation is filed.
|
88 |
+
|
89 |
+
4. Redistribution. You may reproduce and distribute copies of the
|
90 |
+
Work or Derivative Works thereof in any medium, with or without
|
91 |
+
modifications, and in Source or Object form, provided that You
|
92 |
+
meet the following conditions:
|
93 |
+
|
94 |
+
(a) You must give any other recipients of the Work or
|
95 |
+
Derivative Works a copy of this License; and
|
96 |
+
|
97 |
+
(b) You must cause any modified files to carry prominent notices
|
98 |
+
stating that You changed the files; and
|
99 |
+
|
100 |
+
(c) You must retain, in the Source form of any Derivative Works
|
101 |
+
that You distribute, all copyright, patent, trademark, and
|
102 |
+
attribution notices from the Source form of the Work,
|
103 |
+
excluding those notices that do not pertain to any part of
|
104 |
+
the Derivative Works; and
|
105 |
+
|
106 |
+
(d) If the Work includes a "NOTICE" text file as part of its
|
107 |
+
distribution, then any Derivative Works that You distribute must
|
108 |
+
include a readable copy of the attribution notices contained
|
109 |
+
within such NOTICE file, excluding those notices that do not
|
110 |
+
pertain to any part of the Derivative Works, in at least one
|
111 |
+
of the following places: within a NOTICE text file distributed
|
112 |
+
as part of the Derivative Works; within the Source form or
|
113 |
+
documentation, if provided along with the Derivative Works; or,
|
114 |
+
within a display generated by the Derivative Works, if and
|
115 |
+
wherever such third-party notices normally appear. The contents
|
116 |
+
of the NOTICE file are for informational purposes only and
|
117 |
+
do not modify the License. You may add Your own attribution
|
118 |
+
notices within Derivative Works that You distribute, alongside
|
119 |
+
or as an addendum to the NOTICE text from the Work, provided
|
120 |
+
that such additional attribution notices cannot be construed
|
121 |
+
as modifying the License.
|
122 |
+
|
123 |
+
You may add Your own copyright statement to Your modifications and
|
124 |
+
may provide additional or different license terms and conditions
|
125 |
+
for use, reproduction, or distribution of Your modifications, or
|
126 |
+
for any such Derivative Works as a whole, provided Your use,
|
127 |
+
reproduction, and distribution of the Work otherwise complies with
|
128 |
+
the conditions stated in this License.
|
129 |
+
|
130 |
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
131 |
+
any Contribution intentionally submitted for inclusion in the Work
|
132 |
+
by You to the Licensor shall be under the terms and conditions of
|
133 |
+
this License, without any additional terms or conditions.
|
134 |
+
Notwithstanding the above, nothing herein shall supersede or modify
|
135 |
+
the terms of any separate license agreement you may have executed
|
136 |
+
with Licensor regarding such Contributions.
|
137 |
+
|
138 |
+
6. Trademarks. This License does not grant permission to use the trade
|
139 |
+
names, trademarks, service marks, or product names of the Licensor,
|
140 |
+
except as required for reasonable and customary use in describing the
|
141 |
+
origin of the Work and reproducing the content of the NOTICE file.
|
142 |
+
|
143 |
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
144 |
+
agreed to in writing, Licensor provides the Work (and each
|
145 |
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
146 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
147 |
+
implied, including, without limitation, any warranties or conditions
|
148 |
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
149 |
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
150 |
+
appropriateness of using or redistributing the Work and assume any
|
151 |
+
risks associated with Your exercise of permissions under this License.
|
152 |
+
|
153 |
+
8. Limitation of Liability. In no event and under no legal theory,
|
154 |
+
whether in tort (including negligence), contract, or otherwise,
|
155 |
+
unless required by applicable law (such as deliberate and grossly
|
156 |
+
negligent acts) or agreed to in writing, shall any Contributor be
|
157 |
+
liable to You for damages, including any direct, indirect, special,
|
158 |
+
incidental, or consequential damages of any character arising as a
|
159 |
+
result of this License or out of the use or inability to use the
|
160 |
+
Work (including but not limited to damages for loss of goodwill,
|
161 |
+
work stoppage, computer failure or malfunction, or any and all
|
162 |
+
other commercial damages or losses), even if such Contributor
|
163 |
+
has been advised of the possibility of such damages.
|
164 |
+
|
165 |
+
9. Accepting Warranty or Additional Liability. While redistributing
|
166 |
+
the Work or Derivative Works thereof, You may choose to offer,
|
167 |
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
168 |
+
or other liability obligations and/or rights consistent with this
|
169 |
+
License. However, in accepting such obligations, You may act only
|
170 |
+
on Your own behalf and on Your sole responsibility, not on behalf
|
171 |
+
of any other Contributor, and only if You agree to indemnify,
|
172 |
+
defend, and hold each Contributor harmless for any liability
|
173 |
+
incurred by, or claims asserted against, such Contributor by reason
|
174 |
+
of your accepting any such warranty or additional liability.
|
175 |
+
|
176 |
+
END OF TERMS AND CONDITIONS
|
177 |
+
|
178 |
+
APPENDIX: How to apply the Apache License to your work.
|
179 |
+
|
180 |
+
To apply the Apache License to your work, attach the following
|
181 |
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
182 |
+
replaced with your own identifying information. (Don't include
|
183 |
+
the brackets!) The text should be enclosed in the appropriate
|
184 |
+
comment syntax for the file format. We also recommend that a
|
185 |
+
file or class name and description of purpose be included on the
|
186 |
+
same "printed page" as the copyright notice for easier
|
187 |
+
identification within third-party archives.
|
188 |
+
|
189 |
+
Copyright [yyyy] [name of copyright owner]
|
190 |
+
|
191 |
+
Licensed under the Apache License, Version 2.0 (the "License");
|
192 |
+
you may not use this file except in compliance with the License.
|
193 |
+
You may obtain a copy of the License at
|
194 |
+
|
195 |
+
http://www.apache.org/licenses/LICENSE-2.0
|
196 |
+
|
197 |
+
Unless required by applicable law or agreed to in writing, software
|
198 |
+
distributed under the License is distributed on an "AS IS" BASIS,
|
199 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
200 |
+
See the License for the specific language governing permissions and
|
201 |
+
limitations under the License.
|
env-llmeval/lib/python3.10/site-packages/accelerate-0.29.2.dist-info/METADATA
ADDED
@@ -0,0 +1,378 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Metadata-Version: 2.1
|
2 |
+
Name: accelerate
|
3 |
+
Version: 0.29.2
|
4 |
+
Summary: Accelerate
|
5 |
+
Home-page: https://github.com/huggingface/accelerate
|
6 |
+
Author: The HuggingFace team
|
7 |
+
Author-email: [email protected]
|
8 |
+
License: Apache
|
9 |
+
Keywords: deep learning
|
10 |
+
Classifier: Development Status :: 5 - Production/Stable
|
11 |
+
Classifier: Intended Audience :: Developers
|
12 |
+
Classifier: Intended Audience :: Education
|
13 |
+
Classifier: Intended Audience :: Science/Research
|
14 |
+
Classifier: License :: OSI Approved :: Apache Software License
|
15 |
+
Classifier: Operating System :: OS Independent
|
16 |
+
Classifier: Programming Language :: Python :: 3
|
17 |
+
Classifier: Programming Language :: Python :: 3.8
|
18 |
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
19 |
+
Requires-Python: >=3.8.0
|
20 |
+
Description-Content-Type: text/markdown
|
21 |
+
License-File: LICENSE
|
22 |
+
Requires-Dist: numpy (>=1.17)
|
23 |
+
Requires-Dist: packaging (>=20.0)
|
24 |
+
Requires-Dist: psutil
|
25 |
+
Requires-Dist: pyyaml
|
26 |
+
Requires-Dist: torch (>=1.10.0)
|
27 |
+
Requires-Dist: huggingface-hub
|
28 |
+
Requires-Dist: safetensors (>=0.3.1)
|
29 |
+
Provides-Extra: dev
|
30 |
+
Requires-Dist: black (~=23.1) ; extra == 'dev'
|
31 |
+
Requires-Dist: hf-doc-builder (>=0.3.0) ; extra == 'dev'
|
32 |
+
Requires-Dist: ruff (~=0.2.1) ; extra == 'dev'
|
33 |
+
Requires-Dist: pytest (<=8.0.0,>=7.2.0) ; extra == 'dev'
|
34 |
+
Requires-Dist: pytest-xdist ; extra == 'dev'
|
35 |
+
Requires-Dist: pytest-subtests ; extra == 'dev'
|
36 |
+
Requires-Dist: parameterized ; extra == 'dev'
|
37 |
+
Requires-Dist: datasets ; extra == 'dev'
|
38 |
+
Requires-Dist: evaluate ; extra == 'dev'
|
39 |
+
Requires-Dist: torchpippy (>=0.2.0) ; extra == 'dev'
|
40 |
+
Requires-Dist: transformers ; extra == 'dev'
|
41 |
+
Requires-Dist: scipy ; extra == 'dev'
|
42 |
+
Requires-Dist: scikit-learn ; extra == 'dev'
|
43 |
+
Requires-Dist: deepspeed ; extra == 'dev'
|
44 |
+
Requires-Dist: tqdm ; extra == 'dev'
|
45 |
+
Requires-Dist: bitsandbytes ; extra == 'dev'
|
46 |
+
Requires-Dist: timm ; extra == 'dev'
|
47 |
+
Requires-Dist: rich ; extra == 'dev'
|
48 |
+
Provides-Extra: docs
|
49 |
+
Provides-Extra: quality
|
50 |
+
Requires-Dist: black (~=23.1) ; extra == 'quality'
|
51 |
+
Requires-Dist: hf-doc-builder (>=0.3.0) ; extra == 'quality'
|
52 |
+
Requires-Dist: ruff (~=0.2.1) ; extra == 'quality'
|
53 |
+
Provides-Extra: rich
|
54 |
+
Requires-Dist: rich ; extra == 'rich'
|
55 |
+
Provides-Extra: sagemaker
|
56 |
+
Requires-Dist: sagemaker ; extra == 'sagemaker'
|
57 |
+
Provides-Extra: test_dev
|
58 |
+
Requires-Dist: datasets ; extra == 'test_dev'
|
59 |
+
Requires-Dist: evaluate ; extra == 'test_dev'
|
60 |
+
Requires-Dist: torchpippy (>=0.2.0) ; extra == 'test_dev'
|
61 |
+
Requires-Dist: transformers ; extra == 'test_dev'
|
62 |
+
Requires-Dist: scipy ; extra == 'test_dev'
|
63 |
+
Requires-Dist: scikit-learn ; extra == 'test_dev'
|
64 |
+
Requires-Dist: deepspeed ; extra == 'test_dev'
|
65 |
+
Requires-Dist: tqdm ; extra == 'test_dev'
|
66 |
+
Requires-Dist: bitsandbytes ; extra == 'test_dev'
|
67 |
+
Requires-Dist: timm ; extra == 'test_dev'
|
68 |
+
Provides-Extra: test_prod
|
69 |
+
Requires-Dist: pytest (<=8.0.0,>=7.2.0) ; extra == 'test_prod'
|
70 |
+
Requires-Dist: pytest-xdist ; extra == 'test_prod'
|
71 |
+
Requires-Dist: pytest-subtests ; extra == 'test_prod'
|
72 |
+
Requires-Dist: parameterized ; extra == 'test_prod'
|
73 |
+
Provides-Extra: test_trackers
|
74 |
+
Requires-Dist: wandb ; extra == 'test_trackers'
|
75 |
+
Requires-Dist: comet-ml ; extra == 'test_trackers'
|
76 |
+
Requires-Dist: tensorboard ; extra == 'test_trackers'
|
77 |
+
Requires-Dist: dvclive ; extra == 'test_trackers'
|
78 |
+
Provides-Extra: testing
|
79 |
+
Requires-Dist: pytest (<=8.0.0,>=7.2.0) ; extra == 'testing'
|
80 |
+
Requires-Dist: pytest-xdist ; extra == 'testing'
|
81 |
+
Requires-Dist: pytest-subtests ; extra == 'testing'
|
82 |
+
Requires-Dist: parameterized ; extra == 'testing'
|
83 |
+
Requires-Dist: datasets ; extra == 'testing'
|
84 |
+
Requires-Dist: evaluate ; extra == 'testing'
|
85 |
+
Requires-Dist: torchpippy (>=0.2.0) ; extra == 'testing'
|
86 |
+
Requires-Dist: transformers ; extra == 'testing'
|
87 |
+
Requires-Dist: scipy ; extra == 'testing'
|
88 |
+
Requires-Dist: scikit-learn ; extra == 'testing'
|
89 |
+
Requires-Dist: deepspeed ; extra == 'testing'
|
90 |
+
Requires-Dist: tqdm ; extra == 'testing'
|
91 |
+
Requires-Dist: bitsandbytes ; extra == 'testing'
|
92 |
+
Requires-Dist: timm ; extra == 'testing'
|
93 |
+
|
94 |
+
<!---
|
95 |
+
Copyright 2021 The HuggingFace Team. All rights reserved.
|
96 |
+
|
97 |
+
Licensed under the Apache License, Version 2.0 (the "License");
|
98 |
+
you may not use this file except in compliance with the License.
|
99 |
+
You may obtain a copy of the License at
|
100 |
+
|
101 |
+
http://www.apache.org/licenses/LICENSE-2.0
|
102 |
+
|
103 |
+
Unless required by applicable law or agreed to in writing, software
|
104 |
+
distributed under the License is distributed on an "AS IS" BASIS,
|
105 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
106 |
+
See the License for the specific language governing permissions and
|
107 |
+
limitations under the License.
|
108 |
+
-->
|
109 |
+
|
110 |
+
<p align="center">
|
111 |
+
<br>
|
112 |
+
<img src="https://raw.githubusercontent.com/huggingface/accelerate/main/docs/source/imgs/accelerate_logo.png" width="400"/>
|
113 |
+
<br>
|
114 |
+
<p>
|
115 |
+
|
116 |
+
<p align="center">
|
117 |
+
<!-- Uncomment when CircleCI is set up
|
118 |
+
<a href="https://circleci.com/gh/huggingface/accelerate">
|
119 |
+
<img alt="Build" src="https://img.shields.io/circleci/build/github/huggingface/transformers/master">
|
120 |
+
</a>
|
121 |
+
-->
|
122 |
+
<a href="https://github.com/huggingface/accelerate/blob/main/LICENSE">
|
123 |
+
<img alt="License" src="https://img.shields.io/github/license/huggingface/accelerate.svg?color=blue">
|
124 |
+
</a>
|
125 |
+
<a href="https://huggingface.co/docs/accelerate/index.html">
|
126 |
+
<img alt="Documentation" src="https://img.shields.io/website/http/huggingface.co/docs/accelerate/index.html.svg?down_color=red&down_message=offline&up_message=online">
|
127 |
+
</a>
|
128 |
+
<a href="https://github.com/huggingface/accelerate/releases">
|
129 |
+
<img alt="GitHub release" src="https://img.shields.io/github/release/huggingface/accelerate.svg">
|
130 |
+
</a>
|
131 |
+
<a href="https://github.com/huggingface/accelerate/blob/main/CODE_OF_CONDUCT.md">
|
132 |
+
<img alt="Contributor Covenant" src="https://img.shields.io/badge/Contributor%20Covenant-v2.0%20adopted-ff69b4.svg">
|
133 |
+
</a>
|
134 |
+
</p>
|
135 |
+
|
136 |
+
<h3 align="center">
|
137 |
+
<p>Run your *raw* PyTorch training script on any kind of device
|
138 |
+
</h3>
|
139 |
+
|
140 |
+
<h3 align="center">
|
141 |
+
<a href="https://hf.co/course"><img src="https://raw.githubusercontent.com/huggingface/accelerate/main/docs/source/imgs/course_banner.png"></a>
|
142 |
+
</h3>
|
143 |
+
|
144 |
+
## Easy to integrate
|
145 |
+
|
146 |
+
🤗 Accelerate was created for PyTorch users who like to write the training loop of PyTorch models but are reluctant to write and maintain the boilerplate code needed to use multi-GPUs/TPU/fp16.
|
147 |
+
|
148 |
+
🤗 Accelerate abstracts exactly and only the boilerplate code related to multi-GPUs/TPU/fp16 and leaves the rest of your code unchanged.
|
149 |
+
|
150 |
+
Here is an example:
|
151 |
+
|
152 |
+
```diff
|
153 |
+
import torch
|
154 |
+
import torch.nn.functional as F
|
155 |
+
from datasets import load_dataset
|
156 |
+
+ from accelerate import Accelerator
|
157 |
+
|
158 |
+
+ accelerator = Accelerator()
|
159 |
+
- device = 'cpu'
|
160 |
+
+ device = accelerator.device
|
161 |
+
|
162 |
+
model = torch.nn.Transformer().to(device)
|
163 |
+
optimizer = torch.optim.Adam(model.parameters())
|
164 |
+
|
165 |
+
dataset = load_dataset('my_dataset')
|
166 |
+
data = torch.utils.data.DataLoader(dataset, shuffle=True)
|
167 |
+
|
168 |
+
+ model, optimizer, data = accelerator.prepare(model, optimizer, data)
|
169 |
+
|
170 |
+
model.train()
|
171 |
+
for epoch in range(10):
|
172 |
+
for source, targets in data:
|
173 |
+
source = source.to(device)
|
174 |
+
targets = targets.to(device)
|
175 |
+
|
176 |
+
optimizer.zero_grad()
|
177 |
+
|
178 |
+
output = model(source)
|
179 |
+
loss = F.cross_entropy(output, targets)
|
180 |
+
|
181 |
+
- loss.backward()
|
182 |
+
+ accelerator.backward(loss)
|
183 |
+
|
184 |
+
optimizer.step()
|
185 |
+
```
|
186 |
+
|
187 |
+
As you can see in this example, by adding 5-lines to any standard PyTorch training script you can now run on any kind of single or distributed node setting (single CPU, single GPU, multi-GPUs and TPUs) as well as with or without mixed precision (fp8, fp16, bf16).
|
188 |
+
|
189 |
+
In particular, the same code can then be run without modification on your local machine for debugging or your training environment.
|
190 |
+
|
191 |
+
🤗 Accelerate even handles the device placement for you (which requires a few more changes to your code, but is safer in general), so you can even simplify your training loop further:
|
192 |
+
|
193 |
+
```diff
|
194 |
+
import torch
|
195 |
+
import torch.nn.functional as F
|
196 |
+
from datasets import load_dataset
|
197 |
+
+ from accelerate import Accelerator
|
198 |
+
|
199 |
+
- device = 'cpu'
|
200 |
+
+ accelerator = Accelerator()
|
201 |
+
|
202 |
+
- model = torch.nn.Transformer().to(device)
|
203 |
+
+ model = torch.nn.Transformer()
|
204 |
+
optimizer = torch.optim.Adam(model.parameters())
|
205 |
+
|
206 |
+
dataset = load_dataset('my_dataset')
|
207 |
+
data = torch.utils.data.DataLoader(dataset, shuffle=True)
|
208 |
+
|
209 |
+
+ model, optimizer, data = accelerator.prepare(model, optimizer, data)
|
210 |
+
|
211 |
+
model.train()
|
212 |
+
for epoch in range(10):
|
213 |
+
for source, targets in data:
|
214 |
+
- source = source.to(device)
|
215 |
+
- targets = targets.to(device)
|
216 |
+
|
217 |
+
optimizer.zero_grad()
|
218 |
+
|
219 |
+
output = model(source)
|
220 |
+
loss = F.cross_entropy(output, targets)
|
221 |
+
|
222 |
+
- loss.backward()
|
223 |
+
+ accelerator.backward(loss)
|
224 |
+
|
225 |
+
optimizer.step()
|
226 |
+
```
|
227 |
+
|
228 |
+
Want to learn more? Check out the [documentation](https://huggingface.co/docs/accelerate) or have a look at our [examples](https://github.com/huggingface/accelerate/tree/main/examples).
|
229 |
+
|
230 |
+
## Launching script
|
231 |
+
|
232 |
+
🤗 Accelerate also provides an optional CLI tool that allows you to quickly configure and test your training environment before launching the scripts. No need to remember how to use `torch.distributed.run` or to write a specific launcher for TPU training!
|
233 |
+
On your machine(s) just run:
|
234 |
+
|
235 |
+
```bash
|
236 |
+
accelerate config
|
237 |
+
```
|
238 |
+
|
239 |
+
and answer the questions asked. This will generate a config file that will be used automatically to properly set the default options when doing
|
240 |
+
|
241 |
+
```bash
|
242 |
+
accelerate launch my_script.py --args_to_my_script
|
243 |
+
```
|
244 |
+
|
245 |
+
For instance, here is how you would run the GLUE example on the MRPC task (from the root of the repo):
|
246 |
+
|
247 |
+
```bash
|
248 |
+
accelerate launch examples/nlp_example.py
|
249 |
+
```
|
250 |
+
|
251 |
+
This CLI tool is **optional**, and you can still use `python my_script.py` or `python -m torchrun my_script.py` at your convenience.
|
252 |
+
|
253 |
+
You can also directly pass in the arguments you would to `torchrun` as arguments to `accelerate launch` if you wish to not run` accelerate config`.
|
254 |
+
|
255 |
+
For example, here is how to launch on two GPUs:
|
256 |
+
|
257 |
+
```bash
|
258 |
+
accelerate launch --multi_gpu --num_processes 2 examples/nlp_example.py
|
259 |
+
```
|
260 |
+
|
261 |
+
To learn more, check the CLI documentation available [here](https://huggingface.co/docs/accelerate/package_reference/cli).
|
262 |
+
|
263 |
+
## Launching multi-CPU run using MPI
|
264 |
+
|
265 |
+
🤗 Here is another way to launch multi-CPU run using MPI. You can learn how to install Open MPI on [this page](https://www.open-mpi.org/faq/?category=building#easy-build). You can use Intel MPI or MVAPICH as well.
|
266 |
+
Once you have MPI setup on your cluster, just run:
|
267 |
+
```bash
|
268 |
+
accelerate config
|
269 |
+
```
|
270 |
+
Answer the questions that are asked, selecting to run using multi-CPU, and answer "yes" when asked if you want accelerate to launch mpirun.
|
271 |
+
Then, use `accelerate launch` with your script like:
|
272 |
+
```bash
|
273 |
+
accelerate launch examples/nlp_example.py
|
274 |
+
```
|
275 |
+
Alternatively, you can use mpirun directly, without using the CLI like:
|
276 |
+
```bash
|
277 |
+
mpirun -np 2 python examples/nlp_example.py
|
278 |
+
```
|
279 |
+
|
280 |
+
## Launching training using DeepSpeed
|
281 |
+
|
282 |
+
🤗 Accelerate supports training on single/multiple GPUs using DeepSpeed. To use it, you don't need to change anything in your training code; you can set everything using just `accelerate config`. However, if you desire to tweak your DeepSpeed related args from your Python script, we provide you the `DeepSpeedPlugin`.
|
283 |
+
|
284 |
+
```python
|
285 |
+
from accelerate import Accelerator, DeepSpeedPlugin
|
286 |
+
|
287 |
+
# deepspeed needs to know your gradient accumulation steps beforehand, so don't forget to pass it
|
288 |
+
# Remember you still need to do gradient accumulation by yourself, just like you would have done without deepspeed
|
289 |
+
deepspeed_plugin = DeepSpeedPlugin(zero_stage=2, gradient_accumulation_steps=2)
|
290 |
+
accelerator = Accelerator(mixed_precision='fp16', deepspeed_plugin=deepspeed_plugin)
|
291 |
+
|
292 |
+
# How to save your 🤗 Transformer?
|
293 |
+
accelerator.wait_for_everyone()
|
294 |
+
unwrapped_model = accelerator.unwrap_model(model)
|
295 |
+
unwrapped_model.save_pretrained(save_dir, save_function=accelerator.save, state_dict=accelerator.get_state_dict(model))
|
296 |
+
```
|
297 |
+
|
298 |
+
Note: DeepSpeed support is experimental for now. In case you get into some problem, please open an issue.
|
299 |
+
|
300 |
+
## Launching your training from a notebook
|
301 |
+
|
302 |
+
🤗 Accelerate also provides a `notebook_launcher` function you can use in a notebook to launch a distributed training. This is especially useful for Colab or Kaggle notebooks with a TPU backend. Just define your training loop in a `training_function` then in your last cell, add:
|
303 |
+
|
304 |
+
```python
|
305 |
+
from accelerate import notebook_launcher
|
306 |
+
|
307 |
+
notebook_launcher(training_function)
|
308 |
+
```
|
309 |
+
|
310 |
+
An example can be found in [this notebook](https://github.com/huggingface/notebooks/blob/main/examples/accelerate_examples/simple_nlp_example.ipynb). [](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/accelerate_examples/simple_nlp_example.ipynb)
|
311 |
+
|
312 |
+
## Why should I use 🤗 Accelerate?
|
313 |
+
|
314 |
+
You should use 🤗 Accelerate when you want to easily run your training scripts in a distributed environment without having to renounce full control over your training loop. This is not a high-level framework above PyTorch, just a thin wrapper so you don't have to learn a new library. In fact, the whole API of 🤗 Accelerate is in one class, the `Accelerator` object.
|
315 |
+
|
316 |
+
## Why shouldn't I use 🤗 Accelerate?
|
317 |
+
|
318 |
+
You shouldn't use 🤗 Accelerate if you don't want to write a training loop yourself. There are plenty of high-level libraries above PyTorch that will offer you that, 🤗 Accelerate is not one of them.
|
319 |
+
|
320 |
+
## Frameworks using 🤗 Accelerate
|
321 |
+
|
322 |
+
If you like the simplicity of 🤗 Accelerate but would prefer a higher-level abstraction around its capabilities, some frameworks and libraries that are built on top of 🤗 Accelerate are listed below:
|
323 |
+
|
324 |
+
* [Amphion](https://github.com/open-mmlab/Amphion) is a toolkit for Audio, Music, and Speech Generation. Its purpose is to support reproducible research and help junior researchers and engineers get started in the field of audio, music, and speech generation research and development.
|
325 |
+
* [Animus](https://github.com/Scitator/animus) is a minimalistic framework to run machine learning experiments. Animus highlights common "breakpoints" in ML experiments and provides a unified interface for them within [IExperiment](https://github.com/Scitator/animus/blob/main/animus/core.py#L76).
|
326 |
+
* [Catalyst](https://github.com/catalyst-team/catalyst#getting-started) is a PyTorch framework for Deep Learning Research and Development. It focuses on reproducibility, rapid experimentation, and codebase reuse so you can create something new rather than write yet another train loop. Catalyst provides a [Runner](https://catalyst-team.github.io/catalyst/api/core.html#runner) to connect all parts of the experiment: hardware backend, data transformations, model training, and inference logic.
|
327 |
+
* [fastai](https://github.com/fastai/fastai#installing) is a PyTorch framework for Deep Learning that simplifies training fast and accurate neural nets using modern best practices. fastai provides a [Learner](https://docs.fast.ai/learner.html#Learner) to handle the training, fine-tuning, and inference of deep learning algorithms.
|
328 |
+
* [Finetuner](https://github.com/jina-ai/finetuner) is a service that enables models to create higher-quality embeddings for semantic search, visual similarity search, cross-modal text<->image search, recommendation systems, clustering, duplication detection, anomaly detection, or other uses.
|
329 |
+
* [InvokeAI](https://github.com/invoke-ai/InvokeAI) is a creative engine for Stable Diffusion models, offering industry-leading WebUI, terminal usage support, and serves as the foundation for many commercial products.
|
330 |
+
* [Kornia](https://kornia.readthedocs.io/en/latest/get-started/introduction.html) is a differentiable library that allows classical computer vision to be integrated into deep learning models. Kornia provides a [Trainer](https://kornia.readthedocs.io/en/latest/x.html#kornia.x.Trainer) with the specific purpose to train and fine-tune the supported deep learning algorithms within the library.
|
331 |
+
* [Open Assistant](https://projects.laion.ai/Open-Assistant/) is a chat-based assistant that understands tasks, can interact with their party systems, and retrieve information dynamically to do so.
|
332 |
+
* [pytorch-accelerated](https://github.com/Chris-hughes10/pytorch-accelerated) is a lightweight training library, with a streamlined feature set centered around a general-purpose [Trainer](https://pytorch-accelerated.readthedocs.io/en/latest/trainer.html), that places a huge emphasis on simplicity and transparency; enabling users to understand exactly what is going on under the hood, but without having to write and maintain the boilerplate themselves!
|
333 |
+
* [Stable Diffusion web UI](https://github.com/AUTOMATIC1111/stable-diffusion-webui) is an open-source browser-based easy-to-use interface based on the Gradio library for Stable Diffusion.
|
334 |
+
* [torchkeras](https://github.com/lyhue1991/torchkeras) is a simple tool for training pytorch model just in a keras style, a dynamic and beautiful plot is provided in notebook to monitor your loss or metric.
|
335 |
+
* [transformers](https://github.com/huggingface/transformers) as a tool for helping train state-of-the-art machine learning models in PyTorch, Tensorflow, and JAX. (Accelerate is the backend for the PyTorch side).
|
336 |
+
|
337 |
+
|
338 |
+
## Installation
|
339 |
+
|
340 |
+
This repository is tested on Python 3.8+ and PyTorch 1.10.0+
|
341 |
+
|
342 |
+
You should install 🤗 Accelerate in a [virtual environment](https://docs.python.org/3/library/venv.html). If you're unfamiliar with Python virtual environments, check out the [user guide](https://packaging.python.org/guides/installing-using-pip-and-virtual-environments/).
|
343 |
+
|
344 |
+
First, create a virtual environment with the version of Python you're going to use and activate it.
|
345 |
+
|
346 |
+
Then, you will need to install PyTorch: refer to the [official installation page](https://pytorch.org/get-started/locally/#start-locally) regarding the specific install command for your platform. Then 🤗 Accelerate can be installed using pip as follows:
|
347 |
+
|
348 |
+
```bash
|
349 |
+
pip install accelerate
|
350 |
+
```
|
351 |
+
|
352 |
+
## Supported integrations
|
353 |
+
|
354 |
+
- CPU only
|
355 |
+
- multi-CPU on one node (machine)
|
356 |
+
- multi-CPU on several nodes (machines)
|
357 |
+
- single GPU
|
358 |
+
- multi-GPU on one node (machine)
|
359 |
+
- multi-GPU on several nodes (machines)
|
360 |
+
- TPU
|
361 |
+
- FP16/BFloat16 mixed precision
|
362 |
+
- FP8 mixed precision with [Transformer Engine](https://github.com/NVIDIA/TransformerEngine)
|
363 |
+
- DeepSpeed support (Experimental)
|
364 |
+
- PyTorch Fully Sharded Data Parallel (FSDP) support (Experimental)
|
365 |
+
- Megatron-LM support (Experimental)
|
366 |
+
|
367 |
+
## Citing 🤗 Accelerate
|
368 |
+
|
369 |
+
If you use 🤗 Accelerate in your publication, please cite it by using the following BibTeX entry.
|
370 |
+
|
371 |
+
```bibtex
|
372 |
+
@Misc{accelerate,
|
373 |
+
title = {Accelerate: Training and inference at scale made simple, efficient and adaptable.},
|
374 |
+
author = {Sylvain Gugger and Lysandre Debut and Thomas Wolf and Philipp Schmid and Zachary Mueller and Sourab Mangrulkar and Marc Sun and Benjamin Bossan},
|
375 |
+
howpublished = {\url{https://github.com/huggingface/accelerate}},
|
376 |
+
year = {2022}
|
377 |
+
}
|
378 |
+
```
|
env-llmeval/lib/python3.10/site-packages/accelerate-0.29.2.dist-info/RECORD
ADDED
@@ -0,0 +1,163 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
../../../bin/accelerate,sha256=BMhR7IPBrkcxmZ7nWXIeRgnrnhJmrdjee8KIXhgtYdk,259
|
2 |
+
../../../bin/accelerate-config,sha256=_nmL3uln1BEsmG5LBCWZc-Jrz6bVgsNc-KdbFNHdRs8,251
|
3 |
+
../../../bin/accelerate-estimate-memory,sha256=gmoXcy4yYs5YHPtp71NGOdpsG5WD0oZaZdNTFK-I77E,253
|
4 |
+
../../../bin/accelerate-launch,sha256=KIOgqpBnhsRCaEi_V3uM_yO_nOLRuKSASHtce3c8OHU,251
|
5 |
+
accelerate-0.29.2.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
|
6 |
+
accelerate-0.29.2.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
7 |
+
accelerate-0.29.2.dist-info/METADATA,sha256=FjUkmeCY24ElAVCof9Q9TqEllme-f6G0FbuJR9PfjWY,18942
|
8 |
+
accelerate-0.29.2.dist-info/RECORD,,
|
9 |
+
accelerate-0.29.2.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92
|
10 |
+
accelerate-0.29.2.dist-info/entry_points.txt,sha256=Z_KV59tIt4oZtUDEQ0w8JThJ6_1dd8vR8heH24DeAXI,238
|
11 |
+
accelerate-0.29.2.dist-info/top_level.txt,sha256=esVfdxTidsjQ90zsN_rPpjLFJ4ijRlx4mnLrG09hlt4,11
|
12 |
+
accelerate/__init__.py,sha256=7PnXknD50D0dgEHWiHkz-2s1bLDKCwrYetYFxSzqd6A,1456
|
13 |
+
accelerate/__pycache__/__init__.cpython-310.pyc,,
|
14 |
+
accelerate/__pycache__/accelerator.cpython-310.pyc,,
|
15 |
+
accelerate/__pycache__/big_modeling.cpython-310.pyc,,
|
16 |
+
accelerate/__pycache__/checkpointing.cpython-310.pyc,,
|
17 |
+
accelerate/__pycache__/data_loader.cpython-310.pyc,,
|
18 |
+
accelerate/__pycache__/hooks.cpython-310.pyc,,
|
19 |
+
accelerate/__pycache__/inference.cpython-310.pyc,,
|
20 |
+
accelerate/__pycache__/launchers.cpython-310.pyc,,
|
21 |
+
accelerate/__pycache__/local_sgd.cpython-310.pyc,,
|
22 |
+
accelerate/__pycache__/logging.cpython-310.pyc,,
|
23 |
+
accelerate/__pycache__/memory_utils.cpython-310.pyc,,
|
24 |
+
accelerate/__pycache__/optimizer.cpython-310.pyc,,
|
25 |
+
accelerate/__pycache__/scheduler.cpython-310.pyc,,
|
26 |
+
accelerate/__pycache__/state.cpython-310.pyc,,
|
27 |
+
accelerate/__pycache__/tracking.cpython-310.pyc,,
|
28 |
+
accelerate/accelerator.py,sha256=rh4-KBMCkCGLldjKo1CRtBIbsXG76fJqYWdgOugaw7w,143024
|
29 |
+
accelerate/big_modeling.py,sha256=eytO1vW8nxNNkyb8o9uh4L8iavzwJxbxc9selyG_8MU,29034
|
30 |
+
accelerate/checkpointing.py,sha256=vFyLNg9-8qsPBYhAkcm-WwKEeK5Lrq9qLrQWNGFKoPk,11378
|
31 |
+
accelerate/commands/__init__.py,sha256=m1PPTDT4ziIAvM0-FDSgIMIZ69Konn126s6LwuzH6v8,606
|
32 |
+
accelerate/commands/__pycache__/__init__.cpython-310.pyc,,
|
33 |
+
accelerate/commands/__pycache__/accelerate_cli.cpython-310.pyc,,
|
34 |
+
accelerate/commands/__pycache__/env.cpython-310.pyc,,
|
35 |
+
accelerate/commands/__pycache__/estimate.cpython-310.pyc,,
|
36 |
+
accelerate/commands/__pycache__/launch.cpython-310.pyc,,
|
37 |
+
accelerate/commands/__pycache__/test.cpython-310.pyc,,
|
38 |
+
accelerate/commands/__pycache__/tpu.cpython-310.pyc,,
|
39 |
+
accelerate/commands/__pycache__/utils.cpython-310.pyc,,
|
40 |
+
accelerate/commands/accelerate_cli.py,sha256=i3nge5Wj8i4zkV0CVIk9P8veleRZbTZY0AU4fJOrKF8,1749
|
41 |
+
accelerate/commands/config/__init__.py,sha256=iJK8dgj3pc5Vdr1E7UuGoFu-BlybyXLxYDoTg9gXngE,1645
|
42 |
+
accelerate/commands/config/__pycache__/__init__.cpython-310.pyc,,
|
43 |
+
accelerate/commands/config/__pycache__/cluster.cpython-310.pyc,,
|
44 |
+
accelerate/commands/config/__pycache__/config.cpython-310.pyc,,
|
45 |
+
accelerate/commands/config/__pycache__/config_args.cpython-310.pyc,,
|
46 |
+
accelerate/commands/config/__pycache__/config_utils.cpython-310.pyc,,
|
47 |
+
accelerate/commands/config/__pycache__/default.cpython-310.pyc,,
|
48 |
+
accelerate/commands/config/__pycache__/sagemaker.cpython-310.pyc,,
|
49 |
+
accelerate/commands/config/__pycache__/update.cpython-310.pyc,,
|
50 |
+
accelerate/commands/config/cluster.py,sha256=lA55beGeo0fAowfffKhf8nGcy6lBjaOxTtV-Yg_Rz6s,29926
|
51 |
+
accelerate/commands/config/config.py,sha256=FuRlQvOjgATEtyqOSsGD-KEtOCvACOHjs2C-krrtldk,3035
|
52 |
+
accelerate/commands/config/config_args.py,sha256=hE42coVnn0UU-ysqp2ZH-jlqaXoPaHt5E_3qxT42GIM,10024
|
53 |
+
accelerate/commands/config/config_utils.py,sha256=DcjIV1mDInFmct2_XQ-9KYAkREINs6YuHRbZe5HFjT8,2926
|
54 |
+
accelerate/commands/config/default.py,sha256=3-SdEhl_zXM9S3f-FxkSVtiBQ5VY-QNsC4O26u60bss,5350
|
55 |
+
accelerate/commands/config/sagemaker.py,sha256=GjHE2-h4tRr1P_PFtMF3miiAtJlzkbHbMb6kFXqn8eo,10341
|
56 |
+
accelerate/commands/config/update.py,sha256=NXW1J7GkUHpg71QlIXsmMB_0z8S8IZo2FWax5POwrhc,2395
|
57 |
+
accelerate/commands/env.py,sha256=HXXUozMFlxs0b-bU2a3nEcXwYz-5EBkfCvE9svqeN2U,3595
|
58 |
+
accelerate/commands/estimate.py,sha256=shEn2nXyHmz94zpAzV2R8__lcNYW9f9djl7bOHoo04k,12398
|
59 |
+
accelerate/commands/launch.py,sha256=rYmkdc0Kbcux4TOqBG_sJN-NNc4nmV90vuwHqhGNfWw,41439
|
60 |
+
accelerate/commands/menu/__init__.py,sha256=uqSlBM0TFHBwzdv3p3SXfpAk1lZFp4h1a7mbBdscPHs,645
|
61 |
+
accelerate/commands/menu/__pycache__/__init__.cpython-310.pyc,,
|
62 |
+
accelerate/commands/menu/__pycache__/cursor.cpython-310.pyc,,
|
63 |
+
accelerate/commands/menu/__pycache__/helpers.cpython-310.pyc,,
|
64 |
+
accelerate/commands/menu/__pycache__/input.cpython-310.pyc,,
|
65 |
+
accelerate/commands/menu/__pycache__/keymap.cpython-310.pyc,,
|
66 |
+
accelerate/commands/menu/__pycache__/selection_menu.cpython-310.pyc,,
|
67 |
+
accelerate/commands/menu/cursor.py,sha256=-lmpJVAzvNc0c3EOtSuLoKB59zqylVCbYyWLPnrOmvQ,2028
|
68 |
+
accelerate/commands/menu/helpers.py,sha256=KrSB5fJjH4MUEUAQJ6bYaN16AYcnl9UalDrPD3DYeeg,1483
|
69 |
+
accelerate/commands/menu/input.py,sha256=Uj9eDp8-Mb0Fe49nuogqo9W_RCfYd6udfjiPKx7Wjmg,2537
|
70 |
+
accelerate/commands/menu/keymap.py,sha256=eXj-suyYs1m5dEHoUKN4mKAMLc8DWHnwhP6G6JSU0jQ,4086
|
71 |
+
accelerate/commands/menu/selection_menu.py,sha256=bxy-DHaKKC6SCToOlMBv5_z0MdUzylEg6Sio9OuV3GM,4921
|
72 |
+
accelerate/commands/test.py,sha256=YrPYEaAACOGZ6btn2MV6NbMSEdBUcMWADLbQWaZSHtk,2149
|
73 |
+
accelerate/commands/tpu.py,sha256=KyxDP7IuveidZrbW4rx2s8Ku3o_ptI6tzwr_R7ck0os,5548
|
74 |
+
accelerate/commands/utils.py,sha256=ilcfE32oHh28EToM00nc_SR6upfZiuxUI0AjjZu8KYY,3995
|
75 |
+
accelerate/data_loader.py,sha256=qQojnHAW0cjTL7jLQN_g-oHlRZBkKzti3ifk84Izuw4,48307
|
76 |
+
accelerate/hooks.py,sha256=x0FBwwoy6PKSwulavYTpc4gERIoB7RHGPF0Qe6qjXNA,31244
|
77 |
+
accelerate/inference.py,sha256=Ci7kkw2cocNpuvmbo1ytW2QgcI_HKWoXkIdonFOr0tg,7977
|
78 |
+
accelerate/launchers.py,sha256=iFDZ7seDdRwHAHy1BbVPmPccAONiPdV2aBOHNuT2ZD8,11375
|
79 |
+
accelerate/local_sgd.py,sha256=v0-AxldUSCYCI-rqjLiEHsVtSqyEIWTC5ppn7CW7qfY,4002
|
80 |
+
accelerate/logging.py,sha256=kvUvk33r_7T2BNzIwqRZBOhuC-50Ju4rm4HbsM6h2G8,4897
|
81 |
+
accelerate/memory_utils.py,sha256=3R5LoeHl6GgTZ-IMPrDZMdaEehWarGdPqODushb-6pg,862
|
82 |
+
accelerate/optimizer.py,sha256=H7e1XwEysZ_GFR8V_3bHjFAY7zzrzO8samCyW_r7dZo,7453
|
83 |
+
accelerate/scheduler.py,sha256=des_4M_Tt1W8gCYZZbLla0GHBEgJY3Wx2EGBQPTzeiY,4238
|
84 |
+
accelerate/state.py,sha256=9EDuO_uxO2-SxFnVSjUQuR9lDPMYXjwd1yfAgM-Oiws,50116
|
85 |
+
accelerate/test_utils/__init__.py,sha256=amEDYw-ztgIvHkYT3mv3ixk1QJirUnf6jfPJzqUUYkQ,1459
|
86 |
+
accelerate/test_utils/__pycache__/__init__.cpython-310.pyc,,
|
87 |
+
accelerate/test_utils/__pycache__/examples.cpython-310.pyc,,
|
88 |
+
accelerate/test_utils/__pycache__/testing.cpython-310.pyc,,
|
89 |
+
accelerate/test_utils/__pycache__/training.cpython-310.pyc,,
|
90 |
+
accelerate/test_utils/examples.py,sha256=jRm1S9TkmeoLaqprBvtVFN4LesiaDZtKMNIoLNY2euw,7281
|
91 |
+
accelerate/test_utils/scripts/__init__.py,sha256=m1PPTDT4ziIAvM0-FDSgIMIZ69Konn126s6LwuzH6v8,606
|
92 |
+
accelerate/test_utils/scripts/__pycache__/__init__.cpython-310.pyc,,
|
93 |
+
accelerate/test_utils/scripts/__pycache__/test_cli.cpython-310.pyc,,
|
94 |
+
accelerate/test_utils/scripts/__pycache__/test_distributed_data_loop.cpython-310.pyc,,
|
95 |
+
accelerate/test_utils/scripts/__pycache__/test_notebook.cpython-310.pyc,,
|
96 |
+
accelerate/test_utils/scripts/__pycache__/test_ops.cpython-310.pyc,,
|
97 |
+
accelerate/test_utils/scripts/__pycache__/test_script.cpython-310.pyc,,
|
98 |
+
accelerate/test_utils/scripts/__pycache__/test_sync.cpython-310.pyc,,
|
99 |
+
accelerate/test_utils/scripts/external_deps/__init__.py,sha256=m1PPTDT4ziIAvM0-FDSgIMIZ69Konn126s6LwuzH6v8,606
|
100 |
+
accelerate/test_utils/scripts/external_deps/__pycache__/__init__.cpython-310.pyc,,
|
101 |
+
accelerate/test_utils/scripts/external_deps/__pycache__/test_checkpointing.cpython-310.pyc,,
|
102 |
+
accelerate/test_utils/scripts/external_deps/__pycache__/test_metrics.cpython-310.pyc,,
|
103 |
+
accelerate/test_utils/scripts/external_deps/__pycache__/test_peak_memory_usage.cpython-310.pyc,,
|
104 |
+
accelerate/test_utils/scripts/external_deps/__pycache__/test_performance.cpython-310.pyc,,
|
105 |
+
accelerate/test_utils/scripts/external_deps/__pycache__/test_pippy.cpython-310.pyc,,
|
106 |
+
accelerate/test_utils/scripts/external_deps/__pycache__/test_zero3_integration.cpython-310.pyc,,
|
107 |
+
accelerate/test_utils/scripts/external_deps/test_checkpointing.py,sha256=zILzHevzqxB1NPPDrJ1furaitI8MTvhBeG9QzzL0bmE,10668
|
108 |
+
accelerate/test_utils/scripts/external_deps/test_metrics.py,sha256=67-S1qeCpCL9ceaH22RsIsBJscMS7VQWaO4Krcszzbw,12133
|
109 |
+
accelerate/test_utils/scripts/external_deps/test_peak_memory_usage.py,sha256=D0YnKCxkI4ZwDOmZ5Ev6hL9jPyP7SU4WffpVFiK14bs,11072
|
110 |
+
accelerate/test_utils/scripts/external_deps/test_performance.py,sha256=8fV3wCM1H9HVRRyC5C4EGWt-9aHILX_y3-E7LfSiv7M,9803
|
111 |
+
accelerate/test_utils/scripts/external_deps/test_pippy.py,sha256=RdMoD1rlLKMyjyl0soSqR3iDbGidS6-z5GHo3bJUOw8,4647
|
112 |
+
accelerate/test_utils/scripts/external_deps/test_zero3_integration.py,sha256=bJ0Jio-6OCyS2FIgFmZi3duqG1gbkOoTEcHsrORYIL4,1503
|
113 |
+
accelerate/test_utils/scripts/test_cli.py,sha256=qfk1aYFtdvYFCYPkl05602SNGvk08QTv0xZVVcFVtzM,833
|
114 |
+
accelerate/test_utils/scripts/test_distributed_data_loop.py,sha256=VqFPKNRu8yx2MoZ4nHy5wRocEthSymcIA2mg1knqDq8,8315
|
115 |
+
accelerate/test_utils/scripts/test_notebook.py,sha256=Q4OOWHa_GMmzwfiq71BTpKYmhCHLC02J42OO94ut9xk,1629
|
116 |
+
accelerate/test_utils/scripts/test_ops.py,sha256=BcGn3xJT2wUJ0Yk_6VLNkneSv9z24JeAoQjsgdIIRr4,6170
|
117 |
+
accelerate/test_utils/scripts/test_script.py,sha256=QyHRWvHQm1XWkAH7YilQ0gZe3zwvEkyqD6JXmneWqak,32059
|
118 |
+
accelerate/test_utils/scripts/test_sync.py,sha256=3kltq-GuUjOVuo6_FOuWiPyc5f3pGiqiwEAbex5x_-o,18263
|
119 |
+
accelerate/test_utils/testing.py,sha256=HIp7n6qPMh8KPbwEzNWu5mzfxnQRcU15EQ1AQKehpo0,20571
|
120 |
+
accelerate/test_utils/training.py,sha256=8k_YAQ21MzUdb2aFWq1t2fihW1b-iBGh1OJSL3whY68,4019
|
121 |
+
accelerate/tracking.py,sha256=WLY-H1DTsxrz4BVzle7QZMp0Irg84yFMbA1e6JaY3pM,39789
|
122 |
+
accelerate/utils/__init__.py,sha256=SEP34Od2TbTZt7AbhPJoWWDxFoNMeNEyAuVfaPgVu7k,6065
|
123 |
+
accelerate/utils/__pycache__/__init__.cpython-310.pyc,,
|
124 |
+
accelerate/utils/__pycache__/bnb.cpython-310.pyc,,
|
125 |
+
accelerate/utils/__pycache__/constants.cpython-310.pyc,,
|
126 |
+
accelerate/utils/__pycache__/dataclasses.cpython-310.pyc,,
|
127 |
+
accelerate/utils/__pycache__/deepspeed.cpython-310.pyc,,
|
128 |
+
accelerate/utils/__pycache__/environment.cpython-310.pyc,,
|
129 |
+
accelerate/utils/__pycache__/fsdp_utils.cpython-310.pyc,,
|
130 |
+
accelerate/utils/__pycache__/imports.cpython-310.pyc,,
|
131 |
+
accelerate/utils/__pycache__/launch.cpython-310.pyc,,
|
132 |
+
accelerate/utils/__pycache__/megatron_lm.cpython-310.pyc,,
|
133 |
+
accelerate/utils/__pycache__/memory.cpython-310.pyc,,
|
134 |
+
accelerate/utils/__pycache__/modeling.cpython-310.pyc,,
|
135 |
+
accelerate/utils/__pycache__/offload.cpython-310.pyc,,
|
136 |
+
accelerate/utils/__pycache__/operations.cpython-310.pyc,,
|
137 |
+
accelerate/utils/__pycache__/other.cpython-310.pyc,,
|
138 |
+
accelerate/utils/__pycache__/random.cpython-310.pyc,,
|
139 |
+
accelerate/utils/__pycache__/rich.cpython-310.pyc,,
|
140 |
+
accelerate/utils/__pycache__/torch_xla.cpython-310.pyc,,
|
141 |
+
accelerate/utils/__pycache__/tqdm.cpython-310.pyc,,
|
142 |
+
accelerate/utils/__pycache__/transformer_engine.cpython-310.pyc,,
|
143 |
+
accelerate/utils/__pycache__/versions.cpython-310.pyc,,
|
144 |
+
accelerate/utils/bnb.py,sha256=3i59dy8EcBYJEnT2alJ5_M-zeIpFsrceQ4bImiJJKOk,20570
|
145 |
+
accelerate/utils/constants.py,sha256=e6Bpf7gSZLFkvfr-1B1841b6lVoKJ5uyyf5kefe0aT4,2566
|
146 |
+
accelerate/utils/dataclasses.py,sha256=QSP-gYjXz68s0PAseKwLHRBQUnzcBQwPk80otV4X20k,74253
|
147 |
+
accelerate/utils/deepspeed.py,sha256=1JFnz-dY6xP9yHywnX8bzZNq-d-8Cpg5CvVNLZ74b_0,10276
|
148 |
+
accelerate/utils/environment.py,sha256=8eVGMCu7xT1y0Hxochnxz_RghDePtWo2TghDlOm5Gf0,10409
|
149 |
+
accelerate/utils/fsdp_utils.py,sha256=QURWBtK8D00zppqJko0yeznEovXvnkRLI0NpPPkog1Q,10667
|
150 |
+
accelerate/utils/imports.py,sha256=gYj_W3E5V83dYlSqqYE89OAK6JonzwhlcEjsJcOpB3E,12232
|
151 |
+
accelerate/utils/launch.py,sha256=hHpcnR0NrSmqaT7AIaeIeXOAJVIhWnWdq3kA1XSnOYs,27459
|
152 |
+
accelerate/utils/megatron_lm.py,sha256=IfHrtMiPSwuzh5ri96rTTIcEluuMNuIj3O8Y4jW6Fzk,57124
|
153 |
+
accelerate/utils/memory.py,sha256=VxJCU-tMX8uE34GbJnxtDXYPHh4D9p2Y-d6rkGxqSa0,5200
|
154 |
+
accelerate/utils/modeling.py,sha256=OfTHPg7oM9-jzYotLZjJKj6TrhCTFV3qOtQAOhKXmzQ,80246
|
155 |
+
accelerate/utils/offload.py,sha256=qjaVai81wbkA0YH2WkmOXvZT0BRphygfRV_4Ua4j4U4,7837
|
156 |
+
accelerate/utils/operations.py,sha256=zsmRx8mP2eoImPc42pOmBIqaHX7RDugw8AZ_HF3onpg,30610
|
157 |
+
accelerate/utils/other.py,sha256=kgON65EhzQN3oQZqzgAOmmNC2vsQkeO77qEuzN7Zv7c,12283
|
158 |
+
accelerate/utils/random.py,sha256=t-HsLQRm8etSiLSyONCU9wNhj-0VjDUyDme9p6RxDNU,4881
|
159 |
+
accelerate/utils/rich.py,sha256=8JZX_uGMQX-BufdXxJpdne7BWd1KyLHSgbiGxrDMYr8,847
|
160 |
+
accelerate/utils/torch_xla.py,sha256=Pq1tuqN0X_pWDVza6YgjfO45uoJdoRVRForLeLQzFus,1908
|
161 |
+
accelerate/utils/tqdm.py,sha256=9Ovx4GL8AvjSaBd_OysoUGPW9ZJ3ZBOde6776HMEMOA,1344
|
162 |
+
accelerate/utils/transformer_engine.py,sha256=gNPkOv_D1SDLm6nVZtxWIjyA6snxWtAQeBWUZLIErJE,3582
|
163 |
+
accelerate/utils/versions.py,sha256=UgmcbjBm--6CIx1ZamSAMjAK_B_2l48LbeaNygqej8M,2149
|
env-llmeval/lib/python3.10/site-packages/accelerate-0.29.2.dist-info/WHEEL
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Wheel-Version: 1.0
|
2 |
+
Generator: bdist_wheel (0.37.1)
|
3 |
+
Root-Is-Purelib: true
|
4 |
+
Tag: py3-none-any
|
5 |
+
|
env-llmeval/lib/python3.10/site-packages/accelerate-0.29.2.dist-info/entry_points.txt
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
[console_scripts]
|
2 |
+
accelerate = accelerate.commands.accelerate_cli:main
|
3 |
+
accelerate-config = accelerate.commands.config:main
|
4 |
+
accelerate-estimate-memory = accelerate.commands.estimate:main
|
5 |
+
accelerate-launch = accelerate.commands.launch:main
|
env-llmeval/lib/python3.10/site-packages/accelerate-0.29.2.dist-info/top_level.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
accelerate
|
env-llmeval/lib/python3.10/site-packages/certifi-2024.2.2.dist-info/INSTALLER
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
pip
|
env-llmeval/lib/python3.10/site-packages/certifi-2024.2.2.dist-info/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
This package contains a modified version of ca-bundle.crt:
|
2 |
+
|
3 |
+
ca-bundle.crt -- Bundle of CA Root Certificates
|
4 |
+
|
5 |
+
This is a bundle of X.509 certificates of public Certificate Authorities
|
6 |
+
(CA). These were automatically extracted from Mozilla's root certificates
|
7 |
+
file (certdata.txt). This file can be found in the mozilla source tree:
|
8 |
+
https://hg.mozilla.org/mozilla-central/file/tip/security/nss/lib/ckfw/builtins/certdata.txt
|
9 |
+
It contains the certificates in PEM format and therefore
|
10 |
+
can be directly used with curl / libcurl / php_curl, or with
|
11 |
+
an Apache+mod_ssl webserver for SSL client authentication.
|
12 |
+
Just configure this file as the SSLCACertificateFile.#
|
13 |
+
|
14 |
+
***** BEGIN LICENSE BLOCK *****
|
15 |
+
This Source Code Form is subject to the terms of the Mozilla Public License,
|
16 |
+
v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain
|
17 |
+
one at http://mozilla.org/MPL/2.0/.
|
18 |
+
|
19 |
+
***** END LICENSE BLOCK *****
|
20 |
+
@(#) $RCSfile: certdata.txt,v $ $Revision: 1.80 $ $Date: 2011/11/03 15:11:58 $
|
env-llmeval/lib/python3.10/site-packages/certifi-2024.2.2.dist-info/METADATA
ADDED
@@ -0,0 +1,66 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Metadata-Version: 2.1
|
2 |
+
Name: certifi
|
3 |
+
Version: 2024.2.2
|
4 |
+
Summary: Python package for providing Mozilla's CA Bundle.
|
5 |
+
Home-page: https://github.com/certifi/python-certifi
|
6 |
+
Author: Kenneth Reitz
|
7 |
+
Author-email: [email protected]
|
8 |
+
License: MPL-2.0
|
9 |
+
Project-URL: Source, https://github.com/certifi/python-certifi
|
10 |
+
Classifier: Development Status :: 5 - Production/Stable
|
11 |
+
Classifier: Intended Audience :: Developers
|
12 |
+
Classifier: License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)
|
13 |
+
Classifier: Natural Language :: English
|
14 |
+
Classifier: Programming Language :: Python
|
15 |
+
Classifier: Programming Language :: Python :: 3
|
16 |
+
Classifier: Programming Language :: Python :: 3 :: Only
|
17 |
+
Classifier: Programming Language :: Python :: 3.6
|
18 |
+
Classifier: Programming Language :: Python :: 3.7
|
19 |
+
Classifier: Programming Language :: Python :: 3.8
|
20 |
+
Classifier: Programming Language :: Python :: 3.9
|
21 |
+
Classifier: Programming Language :: Python :: 3.10
|
22 |
+
Classifier: Programming Language :: Python :: 3.11
|
23 |
+
Requires-Python: >=3.6
|
24 |
+
License-File: LICENSE
|
25 |
+
|
26 |
+
Certifi: Python SSL Certificates
|
27 |
+
================================
|
28 |
+
|
29 |
+
Certifi provides Mozilla's carefully curated collection of Root Certificates for
|
30 |
+
validating the trustworthiness of SSL certificates while verifying the identity
|
31 |
+
of TLS hosts. It has been extracted from the `Requests`_ project.
|
32 |
+
|
33 |
+
Installation
|
34 |
+
------------
|
35 |
+
|
36 |
+
``certifi`` is available on PyPI. Simply install it with ``pip``::
|
37 |
+
|
38 |
+
$ pip install certifi
|
39 |
+
|
40 |
+
Usage
|
41 |
+
-----
|
42 |
+
|
43 |
+
To reference the installed certificate authority (CA) bundle, you can use the
|
44 |
+
built-in function::
|
45 |
+
|
46 |
+
>>> import certifi
|
47 |
+
|
48 |
+
>>> certifi.where()
|
49 |
+
'/usr/local/lib/python3.7/site-packages/certifi/cacert.pem'
|
50 |
+
|
51 |
+
Or from the command line::
|
52 |
+
|
53 |
+
$ python -m certifi
|
54 |
+
/usr/local/lib/python3.7/site-packages/certifi/cacert.pem
|
55 |
+
|
56 |
+
Enjoy!
|
57 |
+
|
58 |
+
.. _`Requests`: https://requests.readthedocs.io/en/master/
|
59 |
+
|
60 |
+
Addition/Removal of Certificates
|
61 |
+
--------------------------------
|
62 |
+
|
63 |
+
Certifi does not support any addition/removal or other modification of the
|
64 |
+
CA trust store content. This project is intended to provide a reliable and
|
65 |
+
highly portable root of trust to python deployments. Look to upstream projects
|
66 |
+
for methods to use alternate trust.
|
env-llmeval/lib/python3.10/site-packages/certifi-2024.2.2.dist-info/RECORD
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
certifi-2024.2.2.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
|
2 |
+
certifi-2024.2.2.dist-info/LICENSE,sha256=6TcW2mucDVpKHfYP5pWzcPBpVgPSH2-D8FPkLPwQyvc,989
|
3 |
+
certifi-2024.2.2.dist-info/METADATA,sha256=1noreLRChpOgeSj0uJT1mehiBl8ngh33Guc7KdvzYYM,2170
|
4 |
+
certifi-2024.2.2.dist-info/RECORD,,
|
5 |
+
certifi-2024.2.2.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
|
6 |
+
certifi-2024.2.2.dist-info/top_level.txt,sha256=KMu4vUCfsjLrkPbSNdgdekS-pVJzBAJFO__nI8NF6-U,8
|
7 |
+
certifi/__init__.py,sha256=ljtEx-EmmPpTe2SOd5Kzsujm_lUD0fKJVnE9gzce320,94
|
8 |
+
certifi/__main__.py,sha256=xBBoj905TUWBLRGANOcf7oi6e-3dMP4cEoG9OyMs11g,243
|
9 |
+
certifi/__pycache__/__init__.cpython-310.pyc,,
|
10 |
+
certifi/__pycache__/__main__.cpython-310.pyc,,
|
11 |
+
certifi/__pycache__/core.cpython-310.pyc,,
|
12 |
+
certifi/cacert.pem,sha256=ejR8qP724p-CtuR4U1WmY1wX-nVeCUD2XxWqj8e9f5I,292541
|
13 |
+
certifi/core.py,sha256=qRDDFyXVJwTB_EmoGppaXU_R9qCZvhl-EzxPMuV3nTA,4426
|
14 |
+
certifi/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
env-llmeval/lib/python3.10/site-packages/certifi-2024.2.2.dist-info/WHEEL
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Wheel-Version: 1.0
|
2 |
+
Generator: bdist_wheel (0.42.0)
|
3 |
+
Root-Is-Purelib: true
|
4 |
+
Tag: py3-none-any
|
5 |
+
|
env-llmeval/lib/python3.10/site-packages/certifi-2024.2.2.dist-info/top_level.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
certifi
|
env-llmeval/lib/python3.10/site-packages/chardet-5.2.0.dist-info/INSTALLER
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
pip
|
env-llmeval/lib/python3.10/site-packages/chardet-5.2.0.dist-info/WHEEL
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Wheel-Version: 1.0
|
2 |
+
Generator: bdist_wheel (0.41.0)
|
3 |
+
Root-Is-Purelib: true
|
4 |
+
Tag: py3-none-any
|
5 |
+
|
env-llmeval/lib/python3.10/site-packages/chardet-5.2.0.dist-info/entry_points.txt
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
[console_scripts]
|
2 |
+
chardetect = chardet.cli.chardetect:main
|
env-llmeval/lib/python3.10/site-packages/click/__pycache__/_termui_impl.cpython-310.pyc
ADDED
Binary file (16.3 kB). View file
|
|
env-llmeval/lib/python3.10/site-packages/click/__pycache__/_winconsole.cpython-310.pyc
ADDED
Binary file (7.66 kB). View file
|
|
env-llmeval/lib/python3.10/site-packages/click/__pycache__/core.cpython-310.pyc
ADDED
Binary file (91.1 kB). View file
|
|
env-llmeval/lib/python3.10/site-packages/click/__pycache__/decorators.cpython-310.pyc
ADDED
Binary file (17.2 kB). View file
|
|
env-llmeval/lib/python3.10/site-packages/click/__pycache__/exceptions.cpython-310.pyc
ADDED
Binary file (10.3 kB). View file
|
|
env-llmeval/lib/python3.10/site-packages/click/__pycache__/formatting.cpython-310.pyc
ADDED
Binary file (9.46 kB). View file
|
|
env-llmeval/lib/python3.10/site-packages/click/__pycache__/termui.cpython-310.pyc
ADDED
Binary file (26.1 kB). View file
|
|
env-llmeval/lib/python3.10/site-packages/filelock-3.13.4.dist-info/RECORD
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
filelock-3.13.4.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
|
2 |
+
filelock-3.13.4.dist-info/METADATA,sha256=id-2QR57cZ5P7lgQZdhd_xGLBlUrD1p_mFir6ITfRx4,2792
|
3 |
+
filelock-3.13.4.dist-info/RECORD,,
|
4 |
+
filelock-3.13.4.dist-info/WHEEL,sha256=as-1oFTWSeWBgyzh0O_qF439xqBe6AbBgt4MfYe5zwY,87
|
5 |
+
filelock-3.13.4.dist-info/licenses/LICENSE,sha256=iNm062BXnBkew5HKBMFhMFctfu3EqG2qWL8oxuFMm80,1210
|
6 |
+
filelock/__init__.py,sha256=c_wPy9Fo0fmqE4V448Q2A2dDYnMTZeAVHX-kUoN3KCY,1214
|
7 |
+
filelock/__pycache__/__init__.cpython-310.pyc,,
|
8 |
+
filelock/__pycache__/_api.cpython-310.pyc,,
|
9 |
+
filelock/__pycache__/_error.cpython-310.pyc,,
|
10 |
+
filelock/__pycache__/_soft.cpython-310.pyc,,
|
11 |
+
filelock/__pycache__/_unix.cpython-310.pyc,,
|
12 |
+
filelock/__pycache__/_util.cpython-310.pyc,,
|
13 |
+
filelock/__pycache__/_windows.cpython-310.pyc,,
|
14 |
+
filelock/__pycache__/version.cpython-310.pyc,,
|
15 |
+
filelock/_api.py,sha256=rdQfF14SEH01ZoSQXdRm7CW7xGFUTBZyQytd8TySiio,12330
|
16 |
+
filelock/_error.py,sha256=-5jMcjTu60YAvAO1UbqDD1GIEjVkwr8xCFwDBtMeYDg,787
|
17 |
+
filelock/_soft.py,sha256=haqtc_TB_KJbYv2a8iuEAclKuM4fMG1vTcp28sK919c,1711
|
18 |
+
filelock/_unix.py,sha256=-FXP0tjInBHUYygOlMpp4taUmD87QOkrD_4ybg_iT7Q,2259
|
19 |
+
filelock/_util.py,sha256=QHBoNFIYfbAThhotH3Q8E2acFc84wpG49-T-uu017ZE,1715
|
20 |
+
filelock/_windows.py,sha256=eMKL8dZKrgekf5VYVGR14an29JGEInRtUO8ui9ABywg,2177
|
21 |
+
filelock/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
22 |
+
filelock/version.py,sha256=7_6ZiCN2IEbqvGolC1tvkUZXIMID8-9wKt9GAmhPeyU,413
|
env-llmeval/lib/python3.10/site-packages/filelock-3.13.4.dist-info/WHEEL
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Wheel-Version: 1.0
|
2 |
+
Generator: hatchling 1.22.5
|
3 |
+
Root-Is-Purelib: true
|
4 |
+
Tag: py3-none-any
|
env-llmeval/lib/python3.10/site-packages/fsspec-2024.2.0.dist-info/INSTALLER
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
pip
|
env-llmeval/lib/python3.10/site-packages/fsspec-2024.2.0.dist-info/LICENSE
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
BSD 3-Clause License
|
2 |
+
|
3 |
+
Copyright (c) 2018, Martin Durant
|
4 |
+
All rights reserved.
|
5 |
+
|
6 |
+
Redistribution and use in source and binary forms, with or without
|
7 |
+
modification, are permitted provided that the following conditions are met:
|
8 |
+
|
9 |
+
* Redistributions of source code must retain the above copyright notice, this
|
10 |
+
list of conditions and the following disclaimer.
|
11 |
+
|
12 |
+
* Redistributions in binary form must reproduce the above copyright notice,
|
13 |
+
this list of conditions and the following disclaimer in the documentation
|
14 |
+
and/or other materials provided with the distribution.
|
15 |
+
|
16 |
+
* Neither the name of the copyright holder nor the names of its
|
17 |
+
contributors may be used to endorse or promote products derived from
|
18 |
+
this software without specific prior written permission.
|
19 |
+
|
20 |
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
21 |
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
22 |
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
23 |
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
24 |
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
25 |
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
26 |
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
27 |
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
28 |
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
29 |
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
env-llmeval/lib/python3.10/site-packages/fsspec-2024.2.0.dist-info/METADATA
ADDED
@@ -0,0 +1,167 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Metadata-Version: 2.1
|
2 |
+
Name: fsspec
|
3 |
+
Version: 2024.2.0
|
4 |
+
Summary: File-system specification
|
5 |
+
Home-page: https://github.com/fsspec/filesystem_spec
|
6 |
+
Maintainer: Martin Durant
|
7 |
+
Maintainer-email: [email protected]
|
8 |
+
License: BSD
|
9 |
+
Project-URL: Changelog, https://filesystem-spec.readthedocs.io/en/latest/changelog.html
|
10 |
+
Project-URL: Documentation, https://filesystem-spec.readthedocs.io/en/latest/
|
11 |
+
Keywords: file
|
12 |
+
Classifier: Development Status :: 4 - Beta
|
13 |
+
Classifier: Intended Audience :: Developers
|
14 |
+
Classifier: License :: OSI Approved :: BSD License
|
15 |
+
Classifier: Operating System :: OS Independent
|
16 |
+
Classifier: Programming Language :: Python :: 3.8
|
17 |
+
Classifier: Programming Language :: Python :: 3.9
|
18 |
+
Classifier: Programming Language :: Python :: 3.10
|
19 |
+
Classifier: Programming Language :: Python :: 3.11
|
20 |
+
Requires-Python: >=3.8
|
21 |
+
Description-Content-Type: text/markdown
|
22 |
+
License-File: LICENSE
|
23 |
+
Provides-Extra: abfs
|
24 |
+
Requires-Dist: adlfs ; extra == 'abfs'
|
25 |
+
Provides-Extra: adl
|
26 |
+
Requires-Dist: adlfs ; extra == 'adl'
|
27 |
+
Provides-Extra: arrow
|
28 |
+
Requires-Dist: pyarrow >=1 ; extra == 'arrow'
|
29 |
+
Provides-Extra: dask
|
30 |
+
Requires-Dist: dask ; extra == 'dask'
|
31 |
+
Requires-Dist: distributed ; extra == 'dask'
|
32 |
+
Provides-Extra: devel
|
33 |
+
Requires-Dist: pytest ; extra == 'devel'
|
34 |
+
Requires-Dist: pytest-cov ; extra == 'devel'
|
35 |
+
Provides-Extra: dropbox
|
36 |
+
Requires-Dist: dropboxdrivefs ; extra == 'dropbox'
|
37 |
+
Requires-Dist: requests ; extra == 'dropbox'
|
38 |
+
Requires-Dist: dropbox ; extra == 'dropbox'
|
39 |
+
Provides-Extra: entrypoints
|
40 |
+
Provides-Extra: full
|
41 |
+
Requires-Dist: adlfs ; extra == 'full'
|
42 |
+
Requires-Dist: aiohttp !=4.0.0a0,!=4.0.0a1 ; extra == 'full'
|
43 |
+
Requires-Dist: dask ; extra == 'full'
|
44 |
+
Requires-Dist: distributed ; extra == 'full'
|
45 |
+
Requires-Dist: dropbox ; extra == 'full'
|
46 |
+
Requires-Dist: dropboxdrivefs ; extra == 'full'
|
47 |
+
Requires-Dist: fusepy ; extra == 'full'
|
48 |
+
Requires-Dist: gcsfs ; extra == 'full'
|
49 |
+
Requires-Dist: libarchive-c ; extra == 'full'
|
50 |
+
Requires-Dist: ocifs ; extra == 'full'
|
51 |
+
Requires-Dist: panel ; extra == 'full'
|
52 |
+
Requires-Dist: paramiko ; extra == 'full'
|
53 |
+
Requires-Dist: pyarrow >=1 ; extra == 'full'
|
54 |
+
Requires-Dist: pygit2 ; extra == 'full'
|
55 |
+
Requires-Dist: requests ; extra == 'full'
|
56 |
+
Requires-Dist: s3fs ; extra == 'full'
|
57 |
+
Requires-Dist: smbprotocol ; extra == 'full'
|
58 |
+
Requires-Dist: tqdm ; extra == 'full'
|
59 |
+
Provides-Extra: fuse
|
60 |
+
Requires-Dist: fusepy ; extra == 'fuse'
|
61 |
+
Provides-Extra: gcs
|
62 |
+
Requires-Dist: gcsfs ; extra == 'gcs'
|
63 |
+
Provides-Extra: git
|
64 |
+
Requires-Dist: pygit2 ; extra == 'git'
|
65 |
+
Provides-Extra: github
|
66 |
+
Requires-Dist: requests ; extra == 'github'
|
67 |
+
Provides-Extra: gs
|
68 |
+
Requires-Dist: gcsfs ; extra == 'gs'
|
69 |
+
Provides-Extra: gui
|
70 |
+
Requires-Dist: panel ; extra == 'gui'
|
71 |
+
Provides-Extra: hdfs
|
72 |
+
Requires-Dist: pyarrow >=1 ; extra == 'hdfs'
|
73 |
+
Provides-Extra: http
|
74 |
+
Requires-Dist: aiohttp !=4.0.0a0,!=4.0.0a1 ; extra == 'http'
|
75 |
+
Provides-Extra: libarchive
|
76 |
+
Requires-Dist: libarchive-c ; extra == 'libarchive'
|
77 |
+
Provides-Extra: oci
|
78 |
+
Requires-Dist: ocifs ; extra == 'oci'
|
79 |
+
Provides-Extra: s3
|
80 |
+
Requires-Dist: s3fs ; extra == 's3'
|
81 |
+
Provides-Extra: sftp
|
82 |
+
Requires-Dist: paramiko ; extra == 'sftp'
|
83 |
+
Provides-Extra: smb
|
84 |
+
Requires-Dist: smbprotocol ; extra == 'smb'
|
85 |
+
Provides-Extra: ssh
|
86 |
+
Requires-Dist: paramiko ; extra == 'ssh'
|
87 |
+
Provides-Extra: tqdm
|
88 |
+
Requires-Dist: tqdm ; extra == 'tqdm'
|
89 |
+
|
90 |
+
# filesystem_spec
|
91 |
+
|
92 |
+
[](https://pypi.python.org/pypi/fsspec/)
|
93 |
+
[](https://anaconda.org/conda-forge/fsspec)
|
94 |
+

|
95 |
+
[](https://filesystem-spec.readthedocs.io/en/latest/?badge=latest)
|
96 |
+
[](https://pepy.tech/project/fsspec)
|
97 |
+
|
98 |
+
A specification for pythonic filesystems.
|
99 |
+
|
100 |
+
## Install
|
101 |
+
|
102 |
+
```bash
|
103 |
+
pip install fsspec
|
104 |
+
```
|
105 |
+
|
106 |
+
would install the base fsspec. Various optionally supported features might require specification of custom
|
107 |
+
extra require, e.g. `pip install fsspec[ssh]` will install dependencies for `ssh` backends support.
|
108 |
+
Use `pip install fsspec[full]` for installation of all known extra dependencies.
|
109 |
+
|
110 |
+
Up-to-date package also provided through conda-forge distribution:
|
111 |
+
|
112 |
+
```bash
|
113 |
+
conda install -c conda-forge fsspec
|
114 |
+
```
|
115 |
+
|
116 |
+
|
117 |
+
## Purpose
|
118 |
+
|
119 |
+
To produce a template or specification for a file-system interface, that specific implementations should follow,
|
120 |
+
so that applications making use of them can rely on a common behaviour and not have to worry about the specific
|
121 |
+
internal implementation decisions with any given backend. Many such implementations are included in this package,
|
122 |
+
or in sister projects such as `s3fs` and `gcsfs`.
|
123 |
+
|
124 |
+
In addition, if this is well-designed, then additional functionality, such as a key-value store or FUSE
|
125 |
+
mounting of the file-system implementation may be available for all implementations "for free".
|
126 |
+
|
127 |
+
## Documentation
|
128 |
+
|
129 |
+
Please refer to [RTD](https://filesystem-spec.readthedocs.io/en/latest/?badge=latest)
|
130 |
+
|
131 |
+
## Develop
|
132 |
+
|
133 |
+
fsspec uses GitHub Actions for CI. Environment files can be found
|
134 |
+
in the "ci/" directory. Note that the main environment is called "py38",
|
135 |
+
but it is expected that the version of python installed be adjustable at
|
136 |
+
CI runtime. For local use, pick a version suitable for you.
|
137 |
+
|
138 |
+
### Testing
|
139 |
+
|
140 |
+
Tests can be run in the dev environment, if activated, via ``pytest fsspec``.
|
141 |
+
|
142 |
+
The full fsspec suite requires a system-level docker, docker-compose, and fuse
|
143 |
+
installation. If only making changes to one backend implementation, it is
|
144 |
+
not generally necessary to run all tests locally.
|
145 |
+
|
146 |
+
It is expected that contributors ensure that any change to fsspec does not
|
147 |
+
cause issues or regressions for either other fsspec-related packages such
|
148 |
+
as gcsfs and s3fs, nor for downstream users of fsspec. The "downstream" CI
|
149 |
+
run and corresponding environment file run a set of tests from the dask
|
150 |
+
test suite, and very minimal tests against pandas and zarr from the
|
151 |
+
test_downstream.py module in this repo.
|
152 |
+
|
153 |
+
### Code Formatting
|
154 |
+
|
155 |
+
fsspec uses [Black](https://black.readthedocs.io/en/stable) to ensure
|
156 |
+
a consistent code format throughout the project.
|
157 |
+
Run ``black fsspec`` from the root of the filesystem_spec repository to
|
158 |
+
auto-format your code. Additionally, many editors have plugins that will apply
|
159 |
+
``black`` as you edit files. ``black`` is included in the ``tox`` environments.
|
160 |
+
|
161 |
+
Optionally, you may wish to setup [pre-commit hooks](https://pre-commit.com) to
|
162 |
+
automatically run ``black`` when you make a git commit.
|
163 |
+
Run ``pre-commit install --install-hooks`` from the root of the
|
164 |
+
filesystem_spec repository to setup pre-commit hooks. ``black`` will now be run
|
165 |
+
before you commit, reformatting any changed files. You can format without
|
166 |
+
committing via ``pre-commit run`` or skip these checks with ``git commit
|
167 |
+
--no-verify``.
|
env-llmeval/lib/python3.10/site-packages/fsspec-2024.2.0.dist-info/RECORD
ADDED
@@ -0,0 +1,104 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
fsspec-2024.2.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
|
2 |
+
fsspec-2024.2.0.dist-info/LICENSE,sha256=LcNUls5TpzB5FcAIqESq1T53K0mzTN0ARFBnaRQH7JQ,1513
|
3 |
+
fsspec-2024.2.0.dist-info/METADATA,sha256=uwzW1Braxnd_QGVI8W6J0KHi5KTiTJEm8YzSUdG-_Dc,6786
|
4 |
+
fsspec-2024.2.0.dist-info/RECORD,,
|
5 |
+
fsspec-2024.2.0.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
|
6 |
+
fsspec-2024.2.0.dist-info/top_level.txt,sha256=blt2pDrQDwN3Gklcw13CSPLQRd6aaOgJ8AxqrW395MI,7
|
7 |
+
fsspec/__init__.py,sha256=2kT62GfFK-AjgS-LgwSsCo_VA2IePvsyv8Ash5oiaFA,1982
|
8 |
+
fsspec/__pycache__/__init__.cpython-310.pyc,,
|
9 |
+
fsspec/__pycache__/_version.cpython-310.pyc,,
|
10 |
+
fsspec/__pycache__/archive.cpython-310.pyc,,
|
11 |
+
fsspec/__pycache__/asyn.cpython-310.pyc,,
|
12 |
+
fsspec/__pycache__/caching.cpython-310.pyc,,
|
13 |
+
fsspec/__pycache__/callbacks.cpython-310.pyc,,
|
14 |
+
fsspec/__pycache__/compression.cpython-310.pyc,,
|
15 |
+
fsspec/__pycache__/config.cpython-310.pyc,,
|
16 |
+
fsspec/__pycache__/conftest.cpython-310.pyc,,
|
17 |
+
fsspec/__pycache__/core.cpython-310.pyc,,
|
18 |
+
fsspec/__pycache__/dircache.cpython-310.pyc,,
|
19 |
+
fsspec/__pycache__/exceptions.cpython-310.pyc,,
|
20 |
+
fsspec/__pycache__/fuse.cpython-310.pyc,,
|
21 |
+
fsspec/__pycache__/generic.cpython-310.pyc,,
|
22 |
+
fsspec/__pycache__/gui.cpython-310.pyc,,
|
23 |
+
fsspec/__pycache__/mapping.cpython-310.pyc,,
|
24 |
+
fsspec/__pycache__/parquet.cpython-310.pyc,,
|
25 |
+
fsspec/__pycache__/registry.cpython-310.pyc,,
|
26 |
+
fsspec/__pycache__/spec.cpython-310.pyc,,
|
27 |
+
fsspec/__pycache__/transaction.cpython-310.pyc,,
|
28 |
+
fsspec/__pycache__/utils.cpython-310.pyc,,
|
29 |
+
fsspec/_version.py,sha256=onTKKWe4fXkBjQxbTwM82SUT0H3x4U17IYrciFAryaU,500
|
30 |
+
fsspec/archive.py,sha256=S__DzfZj-urAN3tp2W6jJ6YDiXG1fAl7FjvWUN73qIE,2386
|
31 |
+
fsspec/asyn.py,sha256=kJ45sFFya2lZsmu2v8CVc8ZPRs8AccEzAy6Jot2ylkU,36157
|
32 |
+
fsspec/caching.py,sha256=N45pzJdD4w5FOX_sxGvHWirggPNB66JTGP1HH6fpSck,28781
|
33 |
+
fsspec/callbacks.py,sha256=BDIwLzK6rr_0V5ch557fSzsivCElpdqhXr5dZ9Te-EE,9210
|
34 |
+
fsspec/compression.py,sha256=Yyd8FXw2rwWRtVoRVah_yguv-J7BUcBo4yDu6Qt52a0,4859
|
35 |
+
fsspec/config.py,sha256=LF4Zmu1vhJW7Je9Q-cwkRc3xP7Rhyy7Xnwj26Z6sv2g,4279
|
36 |
+
fsspec/conftest.py,sha256=fVfx-NLrH_OZS1TIpYNoPzM7efEcMoL62reHOdYeFCA,1245
|
37 |
+
fsspec/core.py,sha256=0yCj1Z5MhbSDIQiqFs49VORl9QaGwV6hp9bXdkIoPIo,22363
|
38 |
+
fsspec/dircache.py,sha256=YzogWJrhEastHU7vWz-cJiJ7sdtLXFXhEpInGKd4EcM,2717
|
39 |
+
fsspec/exceptions.py,sha256=xcS7LiRrQ748kvOB9mrUR14kpjNztrHgEkZWi9M-VaI,330
|
40 |
+
fsspec/fuse.py,sha256=66amOa6wdIbS0DMhhfAPUoOB37HPorfXD1izV0prmTY,10145
|
41 |
+
fsspec/generic.py,sha256=NuNaP66OaphwMbuLHRFBLda78TD81isa9O4ozJqbUv0,13455
|
42 |
+
fsspec/gui.py,sha256=XKoXZpUhRE7jOhRCJH4-jRbKhVu56aS8h9tecvPD3nc,13932
|
43 |
+
fsspec/implementations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
44 |
+
fsspec/implementations/__pycache__/__init__.cpython-310.pyc,,
|
45 |
+
fsspec/implementations/__pycache__/arrow.cpython-310.pyc,,
|
46 |
+
fsspec/implementations/__pycache__/cache_mapper.cpython-310.pyc,,
|
47 |
+
fsspec/implementations/__pycache__/cache_metadata.cpython-310.pyc,,
|
48 |
+
fsspec/implementations/__pycache__/cached.cpython-310.pyc,,
|
49 |
+
fsspec/implementations/__pycache__/dask.cpython-310.pyc,,
|
50 |
+
fsspec/implementations/__pycache__/data.cpython-310.pyc,,
|
51 |
+
fsspec/implementations/__pycache__/dbfs.cpython-310.pyc,,
|
52 |
+
fsspec/implementations/__pycache__/dirfs.cpython-310.pyc,,
|
53 |
+
fsspec/implementations/__pycache__/ftp.cpython-310.pyc,,
|
54 |
+
fsspec/implementations/__pycache__/git.cpython-310.pyc,,
|
55 |
+
fsspec/implementations/__pycache__/github.cpython-310.pyc,,
|
56 |
+
fsspec/implementations/__pycache__/http.cpython-310.pyc,,
|
57 |
+
fsspec/implementations/__pycache__/jupyter.cpython-310.pyc,,
|
58 |
+
fsspec/implementations/__pycache__/libarchive.cpython-310.pyc,,
|
59 |
+
fsspec/implementations/__pycache__/local.cpython-310.pyc,,
|
60 |
+
fsspec/implementations/__pycache__/memory.cpython-310.pyc,,
|
61 |
+
fsspec/implementations/__pycache__/reference.cpython-310.pyc,,
|
62 |
+
fsspec/implementations/__pycache__/sftp.cpython-310.pyc,,
|
63 |
+
fsspec/implementations/__pycache__/smb.cpython-310.pyc,,
|
64 |
+
fsspec/implementations/__pycache__/tar.cpython-310.pyc,,
|
65 |
+
fsspec/implementations/__pycache__/webhdfs.cpython-310.pyc,,
|
66 |
+
fsspec/implementations/__pycache__/zip.cpython-310.pyc,,
|
67 |
+
fsspec/implementations/arrow.py,sha256=_7TLuV6ZzNlpmUU_v6ud56u2wadzsKmY5qugPBxgMEs,8649
|
68 |
+
fsspec/implementations/cache_mapper.py,sha256=iHgBA6gjzDJ7_mBboHFzpLTf55HP3UEwUOZ43xyUK4M,2429
|
69 |
+
fsspec/implementations/cache_metadata.py,sha256=ZvyA7Y3KK-5Ct4E5pELzD6mH_5T03XqaKVT96qYDADU,8576
|
70 |
+
fsspec/implementations/cached.py,sha256=LbbPbeUup07O0y7gXD_atFgajWM9p1vlDKu_BOyLfbo,30943
|
71 |
+
fsspec/implementations/dask.py,sha256=CXZbJzIVOhKV8ILcxuy3bTvcacCueAbyQxmvAkbPkrk,4466
|
72 |
+
fsspec/implementations/data.py,sha256=Oti0dKzyeadnVIedo3s8CADoh9bNM-96_6viTEYr4lo,1245
|
73 |
+
fsspec/implementations/dbfs.py,sha256=cix9OYUveuSOx5UO5uRUwNUkYqjzyY0fkKnca1kTgZ0,15014
|
74 |
+
fsspec/implementations/dirfs.py,sha256=inDIRSDPhI1_ud1MMBFrpZQ11VIAMJ_dZQtbE4V08Ng,11384
|
75 |
+
fsspec/implementations/ftp.py,sha256=rp6cTog8xqjDPlKdSLKcsyP7K593_ByMabxGbNSEpTo,11655
|
76 |
+
fsspec/implementations/git.py,sha256=vKGI-Vd5q4H2RrvhebkPc9NwlfkZ980OUGhebeCw-M0,4034
|
77 |
+
fsspec/implementations/github.py,sha256=0kIiKkeAaROuHgdWBHVQFrzJ2ZfoDgymCehL_kJXHYA,7565
|
78 |
+
fsspec/implementations/http.py,sha256=PkhfgUV3-T7fG2Jf-NLX9doH52snV5Wmw91uVA9k74M,29454
|
79 |
+
fsspec/implementations/jupyter.py,sha256=B2uj7OEm7yIk-vRSsO37_ND0t0EBvn4B-Su43ibN4Pg,3811
|
80 |
+
fsspec/implementations/libarchive.py,sha256=5_I2DiLXwQ1JC8x-K7jXu-tBwhO9dj7tFLnb0bTnVMQ,7102
|
81 |
+
fsspec/implementations/local.py,sha256=nxiRKg9FAQHTQss9-ET8ZzDXPGhSOktgkxrg0ffMs2I,13454
|
82 |
+
fsspec/implementations/memory.py,sha256=2iU--pOV2KCTrS-d5K8VKSygh9MPk2D7NZ_C8lMMEIw,9701
|
83 |
+
fsspec/implementations/reference.py,sha256=0iGu8mscaQ3a5iTlRNByytQ3_-1Bj8__ARqVwyy4q2M,43871
|
84 |
+
fsspec/implementations/sftp.py,sha256=fMY9XZcmpjszQ2tCqO_TPaJesaeD_Dv7ptYzgUPGoO0,5631
|
85 |
+
fsspec/implementations/smb.py,sha256=k3RtzW97lJtYuw_QpP1rJRFnUBmSsw9twFjUCex0a5U,10591
|
86 |
+
fsspec/implementations/tar.py,sha256=dam78Tp_CozybNqCY2JYgGBS3Uc9FuJUAT9oB0lolOs,4111
|
87 |
+
fsspec/implementations/webhdfs.py,sha256=wqVfno7z0TY1HepaIvKTUUcl_bi5NkV6qWsST8t_s7Y,16745
|
88 |
+
fsspec/implementations/zip.py,sha256=JDX-3HOI15qUl6VTBsNPuDp5RVN6s2n3Bywd4mMu0T0,4347
|
89 |
+
fsspec/mapping.py,sha256=WFEXRWxujQwfzzkRP5tpdIE0265okAtlP97qFZGvV1k,8165
|
90 |
+
fsspec/parquet.py,sha256=qVxDhwc960SGOt5etcYAJxCr-7HQKP01687KpDR02Gw,19463
|
91 |
+
fsspec/registry.py,sha256=-dl7sh2tsfhMA2uxz5KQDsPFehQTgMJIbVjNq6QLoKU,11145
|
92 |
+
fsspec/spec.py,sha256=3t96RgizRN_slIuHXnuR0bXjVUfBS1TfuDrEua4oQvE,66277
|
93 |
+
fsspec/tests/abstract/__init__.py,sha256=i1wcFixV6QhOwdoB24c8oXjzobISNqiKVz9kl2DvAY8,10028
|
94 |
+
fsspec/tests/abstract/__pycache__/__init__.cpython-310.pyc,,
|
95 |
+
fsspec/tests/abstract/__pycache__/common.cpython-310.pyc,,
|
96 |
+
fsspec/tests/abstract/__pycache__/copy.cpython-310.pyc,,
|
97 |
+
fsspec/tests/abstract/__pycache__/get.cpython-310.pyc,,
|
98 |
+
fsspec/tests/abstract/__pycache__/put.cpython-310.pyc,,
|
99 |
+
fsspec/tests/abstract/common.py,sha256=1GQwNo5AONzAnzZj0fWgn8NJPLXALehbsuGxS3FzWVU,4973
|
100 |
+
fsspec/tests/abstract/copy.py,sha256=gU5-d97U3RSde35Vp4RxPY4rWwL744HiSrJ8IBOp9-8,19967
|
101 |
+
fsspec/tests/abstract/get.py,sha256=vNR4HztvTR7Cj56AMo7_tx7TeYz1Jgr_2Wb8Lv-UiBY,20755
|
102 |
+
fsspec/tests/abstract/put.py,sha256=7aih17OKB_IZZh1Mkq1eBDIjobhtMQmI8x-Pw-S_aZk,21201
|
103 |
+
fsspec/transaction.py,sha256=jeexB-H6Aw_gN6Z7hoKKe6v8zizITq39-gyTgpipIKE,2251
|
104 |
+
fsspec/utils.py,sha256=_VX_0VwDtoAFSjMYrxvJvnPNX9FMoHO5BlFHXJ0bHFI,23053
|
env-llmeval/lib/python3.10/site-packages/fsspec-2024.2.0.dist-info/WHEEL
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Wheel-Version: 1.0
|
2 |
+
Generator: bdist_wheel (0.42.0)
|
3 |
+
Root-Is-Purelib: true
|
4 |
+
Tag: py3-none-any
|
5 |
+
|
env-llmeval/lib/python3.10/site-packages/fsspec-2024.2.0.dist-info/top_level.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
fsspec
|
env-llmeval/lib/python3.10/site-packages/huggingface_hub-0.22.2.dist-info/INSTALLER
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
pip
|
env-llmeval/lib/python3.10/site-packages/huggingface_hub-0.22.2.dist-info/LICENSE
ADDED
@@ -0,0 +1,201 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Apache License
|
2 |
+
Version 2.0, January 2004
|
3 |
+
http://www.apache.org/licenses/
|
4 |
+
|
5 |
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
6 |
+
|
7 |
+
1. Definitions.
|
8 |
+
|
9 |
+
"License" shall mean the terms and conditions for use, reproduction,
|
10 |
+
and distribution as defined by Sections 1 through 9 of this document.
|
11 |
+
|
12 |
+
"Licensor" shall mean the copyright owner or entity authorized by
|
13 |
+
the copyright owner that is granting the License.
|
14 |
+
|
15 |
+
"Legal Entity" shall mean the union of the acting entity and all
|
16 |
+
other entities that control, are controlled by, or are under common
|
17 |
+
control with that entity. For the purposes of this definition,
|
18 |
+
"control" means (i) the power, direct or indirect, to cause the
|
19 |
+
direction or management of such entity, whether by contract or
|
20 |
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
21 |
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
22 |
+
|
23 |
+
"You" (or "Your") shall mean an individual or Legal Entity
|
24 |
+
exercising permissions granted by this License.
|
25 |
+
|
26 |
+
"Source" form shall mean the preferred form for making modifications,
|
27 |
+
including but not limited to software source code, documentation
|
28 |
+
source, and configuration files.
|
29 |
+
|
30 |
+
"Object" form shall mean any form resulting from mechanical
|
31 |
+
transformation or translation of a Source form, including but
|
32 |
+
not limited to compiled object code, generated documentation,
|
33 |
+
and conversions to other media types.
|
34 |
+
|
35 |
+
"Work" shall mean the work of authorship, whether in Source or
|
36 |
+
Object form, made available under the License, as indicated by a
|
37 |
+
copyright notice that is included in or attached to the work
|
38 |
+
(an example is provided in the Appendix below).
|
39 |
+
|
40 |
+
"Derivative Works" shall mean any work, whether in Source or Object
|
41 |
+
form, that is based on (or derived from) the Work and for which the
|
42 |
+
editorial revisions, annotations, elaborations, or other modifications
|
43 |
+
represent, as a whole, an original work of authorship. For the purposes
|
44 |
+
of this License, Derivative Works shall not include works that remain
|
45 |
+
separable from, or merely link (or bind by name) to the interfaces of,
|
46 |
+
the Work and Derivative Works thereof.
|
47 |
+
|
48 |
+
"Contribution" shall mean any work of authorship, including
|
49 |
+
the original version of the Work and any modifications or additions
|
50 |
+
to that Work or Derivative Works thereof, that is intentionally
|
51 |
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
52 |
+
or by an individual or Legal Entity authorized to submit on behalf of
|
53 |
+
the copyright owner. For the purposes of this definition, "submitted"
|
54 |
+
means any form of electronic, verbal, or written communication sent
|
55 |
+
to the Licensor or its representatives, including but not limited to
|
56 |
+
communication on electronic mailing lists, source code control systems,
|
57 |
+
and issue tracking systems that are managed by, or on behalf of, the
|
58 |
+
Licensor for the purpose of discussing and improving the Work, but
|
59 |
+
excluding communication that is conspicuously marked or otherwise
|
60 |
+
designated in writing by the copyright owner as "Not a Contribution."
|
61 |
+
|
62 |
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
63 |
+
on behalf of whom a Contribution has been received by Licensor and
|
64 |
+
subsequently incorporated within the Work.
|
65 |
+
|
66 |
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
67 |
+
this License, each Contributor hereby grants to You a perpetual,
|
68 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
69 |
+
copyright license to reproduce, prepare Derivative Works of,
|
70 |
+
publicly display, publicly perform, sublicense, and distribute the
|
71 |
+
Work and such Derivative Works in Source or Object form.
|
72 |
+
|
73 |
+
3. Grant of Patent License. Subject to the terms and conditions of
|
74 |
+
this License, each Contributor hereby grants to You a perpetual,
|
75 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
76 |
+
(except as stated in this section) patent license to make, have made,
|
77 |
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
78 |
+
where such license applies only to those patent claims licensable
|
79 |
+
by such Contributor that are necessarily infringed by their
|
80 |
+
Contribution(s) alone or by combination of their Contribution(s)
|
81 |
+
with the Work to which such Contribution(s) was submitted. If You
|
82 |
+
institute patent litigation against any entity (including a
|
83 |
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
84 |
+
or a Contribution incorporated within the Work constitutes direct
|
85 |
+
or contributory patent infringement, then any patent licenses
|
86 |
+
granted to You under this License for that Work shall terminate
|
87 |
+
as of the date such litigation is filed.
|
88 |
+
|
89 |
+
4. Redistribution. You may reproduce and distribute copies of the
|
90 |
+
Work or Derivative Works thereof in any medium, with or without
|
91 |
+
modifications, and in Source or Object form, provided that You
|
92 |
+
meet the following conditions:
|
93 |
+
|
94 |
+
(a) You must give any other recipients of the Work or
|
95 |
+
Derivative Works a copy of this License; and
|
96 |
+
|
97 |
+
(b) You must cause any modified files to carry prominent notices
|
98 |
+
stating that You changed the files; and
|
99 |
+
|
100 |
+
(c) You must retain, in the Source form of any Derivative Works
|
101 |
+
that You distribute, all copyright, patent, trademark, and
|
102 |
+
attribution notices from the Source form of the Work,
|
103 |
+
excluding those notices that do not pertain to any part of
|
104 |
+
the Derivative Works; and
|
105 |
+
|
106 |
+
(d) If the Work includes a "NOTICE" text file as part of its
|
107 |
+
distribution, then any Derivative Works that You distribute must
|
108 |
+
include a readable copy of the attribution notices contained
|
109 |
+
within such NOTICE file, excluding those notices that do not
|
110 |
+
pertain to any part of the Derivative Works, in at least one
|
111 |
+
of the following places: within a NOTICE text file distributed
|
112 |
+
as part of the Derivative Works; within the Source form or
|
113 |
+
documentation, if provided along with the Derivative Works; or,
|
114 |
+
within a display generated by the Derivative Works, if and
|
115 |
+
wherever such third-party notices normally appear. The contents
|
116 |
+
of the NOTICE file are for informational purposes only and
|
117 |
+
do not modify the License. You may add Your own attribution
|
118 |
+
notices within Derivative Works that You distribute, alongside
|
119 |
+
or as an addendum to the NOTICE text from the Work, provided
|
120 |
+
that such additional attribution notices cannot be construed
|
121 |
+
as modifying the License.
|
122 |
+
|
123 |
+
You may add Your own copyright statement to Your modifications and
|
124 |
+
may provide additional or different license terms and conditions
|
125 |
+
for use, reproduction, or distribution of Your modifications, or
|
126 |
+
for any such Derivative Works as a whole, provided Your use,
|
127 |
+
reproduction, and distribution of the Work otherwise complies with
|
128 |
+
the conditions stated in this License.
|
129 |
+
|
130 |
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
131 |
+
any Contribution intentionally submitted for inclusion in the Work
|
132 |
+
by You to the Licensor shall be under the terms and conditions of
|
133 |
+
this License, without any additional terms or conditions.
|
134 |
+
Notwithstanding the above, nothing herein shall supersede or modify
|
135 |
+
the terms of any separate license agreement you may have executed
|
136 |
+
with Licensor regarding such Contributions.
|
137 |
+
|
138 |
+
6. Trademarks. This License does not grant permission to use the trade
|
139 |
+
names, trademarks, service marks, or product names of the Licensor,
|
140 |
+
except as required for reasonable and customary use in describing the
|
141 |
+
origin of the Work and reproducing the content of the NOTICE file.
|
142 |
+
|
143 |
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
144 |
+
agreed to in writing, Licensor provides the Work (and each
|
145 |
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
146 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
147 |
+
implied, including, without limitation, any warranties or conditions
|
148 |
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
149 |
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
150 |
+
appropriateness of using or redistributing the Work and assume any
|
151 |
+
risks associated with Your exercise of permissions under this License.
|
152 |
+
|
153 |
+
8. Limitation of Liability. In no event and under no legal theory,
|
154 |
+
whether in tort (including negligence), contract, or otherwise,
|
155 |
+
unless required by applicable law (such as deliberate and grossly
|
156 |
+
negligent acts) or agreed to in writing, shall any Contributor be
|
157 |
+
liable to You for damages, including any direct, indirect, special,
|
158 |
+
incidental, or consequential damages of any character arising as a
|
159 |
+
result of this License or out of the use or inability to use the
|
160 |
+
Work (including but not limited to damages for loss of goodwill,
|
161 |
+
work stoppage, computer failure or malfunction, or any and all
|
162 |
+
other commercial damages or losses), even if such Contributor
|
163 |
+
has been advised of the possibility of such damages.
|
164 |
+
|
165 |
+
9. Accepting Warranty or Additional Liability. While redistributing
|
166 |
+
the Work or Derivative Works thereof, You may choose to offer,
|
167 |
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
168 |
+
or other liability obligations and/or rights consistent with this
|
169 |
+
License. However, in accepting such obligations, You may act only
|
170 |
+
on Your own behalf and on Your sole responsibility, not on behalf
|
171 |
+
of any other Contributor, and only if You agree to indemnify,
|
172 |
+
defend, and hold each Contributor harmless for any liability
|
173 |
+
incurred by, or claims asserted against, such Contributor by reason
|
174 |
+
of your accepting any such warranty or additional liability.
|
175 |
+
|
176 |
+
END OF TERMS AND CONDITIONS
|
177 |
+
|
178 |
+
APPENDIX: How to apply the Apache License to your work.
|
179 |
+
|
180 |
+
To apply the Apache License to your work, attach the following
|
181 |
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
182 |
+
replaced with your own identifying information. (Don't include
|
183 |
+
the brackets!) The text should be enclosed in the appropriate
|
184 |
+
comment syntax for the file format. We also recommend that a
|
185 |
+
file or class name and description of purpose be included on the
|
186 |
+
same "printed page" as the copyright notice for easier
|
187 |
+
identification within third-party archives.
|
188 |
+
|
189 |
+
Copyright [yyyy] [name of copyright owner]
|
190 |
+
|
191 |
+
Licensed under the Apache License, Version 2.0 (the "License");
|
192 |
+
you may not use this file except in compliance with the License.
|
193 |
+
You may obtain a copy of the License at
|
194 |
+
|
195 |
+
http://www.apache.org/licenses/LICENSE-2.0
|
196 |
+
|
197 |
+
Unless required by applicable law or agreed to in writing, software
|
198 |
+
distributed under the License is distributed on an "AS IS" BASIS,
|
199 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
200 |
+
See the License for the specific language governing permissions and
|
201 |
+
limitations under the License.
|