Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- .cache/pip/http-v2/1/1/c/a/5/11ca53f6629b39be038f5f3f843243e294312a1cd0bda91c3e78a20b +0 -0
- .cache/pip/http-v2/1/1/c/a/5/11ca53f6629b39be038f5f3f843243e294312a1cd0bda91c3e78a20b.body +1091 -0
- .cache/pip/http-v2/1/7/9/c/1/179c1c4742bcaf5b6d7af8dc2f14a1b329b9b11f7f5b09e3faa897a1 +0 -0
- .cache/pip/http-v2/1/8/e/c/b/18ecb372789efe49bbe46617b1f5d32a2b0eac245d58cbf930116174 +0 -0
- .cache/pip/http-v2/1/e/b/f/d/1ebfddf16e338050f3c69ee3fb0551055792844fc428979435d11f85 +0 -0
- .cache/pip/http-v2/1/e/b/f/d/1ebfddf16e338050f3c69ee3fb0551055792844fc428979435d11f85.body +3 -0
- .cache/pip/http-v2/3/3/2/7/a/3327a46f678846be6cb46f3352e6fba668d9664c70a79484c770e358 +0 -0
- .cache/pip/http-v2/3/5/a/0/6/35a0615e0411edd59492c90e8f5cd0a1a0554d6f7d1dec5be2b30560 +0 -0
- .cache/pip/http-v2/3/5/a/0/6/35a0615e0411edd59492c90e8f5cd0a1a0554d6f7d1dec5be2b30560.body +97 -0
- .cache/pip/http-v2/3/8/6/0/e/3860e4de9ae53c79d2fd61419e9049df314ccc8b640782c02c6e2e2d +0 -0
- .cache/pip/http-v2/3/8/6/0/e/3860e4de9ae53c79d2fd61419e9049df314ccc8b640782c02c6e2e2d.body +0 -0
- .cache/pip/http-v2/3/9/b/0/3/39b032291f3825af700bccccb41d7507c739ba2f89c5bbbc5b7b490d +0 -0
- .cache/pip/http-v2/3/9/b/0/3/39b032291f3825af700bccccb41d7507c739ba2f89c5bbbc5b7b490d.body +0 -0
- .cache/pip/http-v2/6/4/2/d/4/642d4b6a48573d7d40bd54626ef2bb21e5059817d13c7487dcfea9fd +0 -0
- .cache/pip/http-v2/6/4/2/d/4/642d4b6a48573d7d40bd54626ef2bb21e5059817d13c7487dcfea9fd.body +1600 -0
- .cache/pip/http-v2/6/4/6/7/b/6467bdd236eabb4648139f514441e5510842fbc90755e4738c64fcf3 +0 -0
- .cache/pip/http-v2/6/4/6/7/b/6467bdd236eabb4648139f514441e5510842fbc90755e4738c64fcf3.body +341 -0
- .cache/pip/http-v2/6/4/c/f/c/64cfc03e83f9fad4049b1d2a1d785c9273270a4ab9788b538f5054e3 +0 -0
- .cache/pip/http-v2/6/5/1/e/5/651e58859e8db8c99b9e7068d03984cfd4577518ff0e021c717afbf4 +0 -0
- .cache/pip/http-v2/6/5/1/e/5/651e58859e8db8c99b9e7068d03984cfd4577518ff0e021c717afbf4.body +78 -0
- .cache/pip/http-v2/6/6/e/c/7/66ec76a7b6ed4081044f5c7821af293b63c17bc2ac523ff93d5ca7d5 +0 -0
- .cache/pip/http-v2/6/8/0/d/4/680d4dd80dc6a3d2df9b9478dfcc8e81e0e4f130e154a3268b98b877 +0 -0
- .cache/pip/http-v2/6/b/5/3/a/6b53a9dd0e4fce887cc28c1a921aa1befe8c1a82e6c213d2542d2acb +0 -0
- .cache/pip/http-v2/6/b/5/3/a/6b53a9dd0e4fce887cc28c1a921aa1befe8c1a82e6c213d2542d2acb.body +0 -0
- .cache/pip/http-v2/a/b/e/2/c/abe2c30c0d105321771461cb84423576f0ec11c835b815e82e629cf7.body +3 -0
- .cache/pip/http-v2/c/1/6/c/6/c16c6c635e568e65136b95a15ea17f91b43799aeb0a7e80b55d7a898 +0 -0
- .cache/pip/http-v2/c/1/6/c/6/c16c6c635e568e65136b95a15ea17f91b43799aeb0a7e80b55d7a898.body +1366 -0
- .cache/pip/http-v2/c/c/c/b/4/cccb41730ba9dcdb4cb7127715ba43b53bfd809d6ff652fe215567a3 +0 -0
- .cache/pip/http-v2/c/c/c/b/4/cccb41730ba9dcdb4cb7127715ba43b53bfd809d6ff652fe215567a3.body +300 -0
- .cache/pip/http-v2/c/d/5/d/e/cd5de44b899cbe1869765c21b55cffc53c0c0ffa9d3c6f1fd40a42a2 +0 -0
- .cache/pip/http-v2/e/5/0/3/0/e503010ce88b2bb388d7806c951cab4dd3e436342653b4835f430bcc.body +3 -0
- .cache/pip/http-v2/e/a/2/2/a/ea22a79fcbb7a5195dc8846d5b7ddabfe6981d47f448fe52cbe95a8a +0 -0
- .cache/pip/http-v2/e/c/8/b/3/ec8b32f74b33a66cdb59c6ce388ac68e5697696325dcbe84554f832d +0 -0
- .cache/pip/http-v2/e/c/8/b/3/ec8b32f74b33a66cdb59c6ce388ac68e5697696325dcbe84554f832d.body +139 -0
- .cache/uv/.gitignore +1 -0
- .cache/uv/.lock +0 -0
- .cache/uv/CACHEDIR.TAG +1 -0
- .cache/uv/archive-v0/9vHEgYd05Zufvhj6EkjIX/typing_extensions.py +0 -0
- .cache/uv/archive-v0/WbiZCgDidtA5T1uiQ47d5/huggingface_hub-1.24.0.dist-info/METADATA +373 -0
- .cache/uv/archive-v0/WbiZCgDidtA5T1uiQ47d5/huggingface_hub-1.24.0.dist-info/RECORD +190 -0
- .cache/uv/archive-v0/WbiZCgDidtA5T1uiQ47d5/huggingface_hub-1.24.0.dist-info/WHEEL +5 -0
- .cache/uv/archive-v0/WbiZCgDidtA5T1uiQ47d5/huggingface_hub-1.24.0.dist-info/entry_points.txt +7 -0
- .cache/uv/archive-v0/WbiZCgDidtA5T1uiQ47d5/huggingface_hub-1.24.0.dist-info/licenses/LICENSE +201 -0
- .cache/uv/archive-v0/WbiZCgDidtA5T1uiQ47d5/huggingface_hub-1.24.0.dist-info/top_level.txt +1 -0
- .cache/uv/archive-v0/WbiZCgDidtA5T1uiQ47d5/huggingface_hub/__init__.py +1804 -0
- .cache/uv/archive-v0/WbiZCgDidtA5T1uiQ47d5/huggingface_hub/_buckets.py +1244 -0
- .cache/uv/archive-v0/WbiZCgDidtA5T1uiQ47d5/huggingface_hub/_commit_api.py +1075 -0
- .cache/uv/archive-v0/WbiZCgDidtA5T1uiQ47d5/huggingface_hub/_commit_scheduler.py +353 -0
- .cache/uv/archive-v0/WbiZCgDidtA5T1uiQ47d5/huggingface_hub/_dataset_viewer.py +172 -0
- .cache/uv/archive-v0/WbiZCgDidtA5T1uiQ47d5/huggingface_hub/_eval_results.py +211 -0
.cache/pip/http-v2/1/1/c/a/5/11ca53f6629b39be038f5f3f843243e294312a1cd0bda91c3e78a20b
ADDED
|
Binary file (1.26 kB). View file
|
|
|
.cache/pip/http-v2/1/1/c/a/5/11ca53f6629b39be038f5f3f843243e294312a1cd0bda91c3e78a20b.body
ADDED
|
@@ -0,0 +1,1091 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Metadata-Version: 2.1
|
| 2 |
+
Name: scipy
|
| 3 |
+
Version: 1.18.0
|
| 4 |
+
Summary: Fundamental algorithms for scientific computing in Python
|
| 5 |
+
Maintainer-Email: SciPy Developers <scipy-dev@python.org>
|
| 6 |
+
License: Copyright (c) 2001-2002 Enthought, Inc. 2003, SciPy Developers.
|
| 7 |
+
All rights reserved.
|
| 8 |
+
|
| 9 |
+
Redistribution and use in source and binary forms, with or without
|
| 10 |
+
modification, are permitted provided that the following conditions
|
| 11 |
+
are met:
|
| 12 |
+
|
| 13 |
+
1. Redistributions of source code must retain the above copyright
|
| 14 |
+
notice, this list of conditions and the following disclaimer.
|
| 15 |
+
|
| 16 |
+
2. Redistributions in binary form must reproduce the above
|
| 17 |
+
copyright notice, this list of conditions and the following
|
| 18 |
+
disclaimer in the documentation and/or other materials provided
|
| 19 |
+
with the distribution.
|
| 20 |
+
|
| 21 |
+
3. Neither the name of the copyright holder nor the names of its
|
| 22 |
+
contributors may be used to endorse or promote products derived
|
| 23 |
+
from this software without specific prior written permission.
|
| 24 |
+
|
| 25 |
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
| 26 |
+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
| 27 |
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
| 28 |
+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
| 29 |
+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
| 30 |
+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
| 31 |
+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
| 32 |
+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
| 33 |
+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
| 34 |
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| 35 |
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| 36 |
+
|
| 37 |
+
----
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
----
|
| 41 |
+
|
| 42 |
+
This binary distribution of SciPy can also bundle the following software
|
| 43 |
+
(depending on the build):
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
Name: OpenBLAS
|
| 47 |
+
Files: scipy.libs/libscipy_openblas*.so
|
| 48 |
+
Description: bundled as a dynamically linked library
|
| 49 |
+
Availability: https://github.com/OpenMathLib/OpenBLAS/
|
| 50 |
+
License: BSD-3-Clause
|
| 51 |
+
Copyright (c) 2011-2014, The OpenBLAS Project
|
| 52 |
+
All rights reserved.
|
| 53 |
+
|
| 54 |
+
Redistribution and use in source and binary forms, with or without
|
| 55 |
+
modification, are permitted provided that the following conditions are
|
| 56 |
+
met:
|
| 57 |
+
|
| 58 |
+
1. Redistributions of source code must retain the above copyright
|
| 59 |
+
notice, this list of conditions and the following disclaimer.
|
| 60 |
+
|
| 61 |
+
2. Redistributions in binary form must reproduce the above copyright
|
| 62 |
+
notice, this list of conditions and the following disclaimer in
|
| 63 |
+
the documentation and/or other materials provided with the
|
| 64 |
+
distribution.
|
| 65 |
+
3. Neither the name of the OpenBLAS project nor the names of
|
| 66 |
+
its contributors may be used to endorse or promote products
|
| 67 |
+
derived from this software without specific prior written
|
| 68 |
+
permission.
|
| 69 |
+
|
| 70 |
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
| 71 |
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
| 72 |
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
| 73 |
+
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
| 74 |
+
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
| 75 |
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
| 76 |
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
| 77 |
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
| 78 |
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
|
| 79 |
+
USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| 80 |
+
|
| 81 |
+
|
| 82 |
+
Name: LAPACK
|
| 83 |
+
Files: scipy.libs/libscipy_openblas*.so
|
| 84 |
+
Description: bundled in OpenBLAS
|
| 85 |
+
Availability: https://github.com/OpenMathLib/OpenBLAS/
|
| 86 |
+
License: BSD-3-Clause-Open-MPI
|
| 87 |
+
Copyright (c) 1992-2013 The University of Tennessee and The University
|
| 88 |
+
of Tennessee Research Foundation. All rights
|
| 89 |
+
reserved.
|
| 90 |
+
Copyright (c) 2000-2013 The University of California Berkeley. All
|
| 91 |
+
rights reserved.
|
| 92 |
+
Copyright (c) 2006-2013 The University of Colorado Denver. All rights
|
| 93 |
+
reserved.
|
| 94 |
+
|
| 95 |
+
$COPYRIGHT$
|
| 96 |
+
|
| 97 |
+
Additional copyrights may follow
|
| 98 |
+
|
| 99 |
+
$HEADER$
|
| 100 |
+
|
| 101 |
+
Redistribution and use in source and binary forms, with or without
|
| 102 |
+
modification, are permitted provided that the following conditions are
|
| 103 |
+
met:
|
| 104 |
+
|
| 105 |
+
- Redistributions of source code must retain the above copyright
|
| 106 |
+
notice, this list of conditions and the following disclaimer.
|
| 107 |
+
|
| 108 |
+
- Redistributions in binary form must reproduce the above copyright
|
| 109 |
+
notice, this list of conditions and the following disclaimer listed
|
| 110 |
+
in this license in the documentation and/or other materials
|
| 111 |
+
provided with the distribution.
|
| 112 |
+
|
| 113 |
+
- Neither the name of the copyright holders nor the names of its
|
| 114 |
+
contributors may be used to endorse or promote products derived from
|
| 115 |
+
this software without specific prior written permission.
|
| 116 |
+
|
| 117 |
+
The copyright holders provide no reassurances that the source code
|
| 118 |
+
provided does not infringe any patent, copyright, or any other
|
| 119 |
+
intellectual property rights of third parties. The copyright holders
|
| 120 |
+
disclaim any liability to any recipient for claims brought against
|
| 121 |
+
recipient by any third party for infringement of that parties
|
| 122 |
+
intellectual property rights.
|
| 123 |
+
|
| 124 |
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
| 125 |
+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
| 126 |
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
| 127 |
+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
| 128 |
+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
| 129 |
+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
| 130 |
+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
| 131 |
+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
| 132 |
+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
| 133 |
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| 134 |
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| 135 |
+
|
| 136 |
+
|
| 137 |
+
Name: GCC runtime library
|
| 138 |
+
Files: scipy.libs/libgfortran*.so
|
| 139 |
+
Description: dynamically linked to files compiled with gcc
|
| 140 |
+
Availability: https://gcc.gnu.org/git/?p=gcc.git;a=tree;f=libgfortran
|
| 141 |
+
License: GPL-3.0-or-later WITH GCC-exception-3.1
|
| 142 |
+
Copyright (C) 2002-2017 Free Software Foundation, Inc.
|
| 143 |
+
|
| 144 |
+
Libgfortran is free software; you can redistribute it and/or modify
|
| 145 |
+
it under the terms of the GNU General Public License as published by
|
| 146 |
+
the Free Software Foundation; either version 3, or (at your option)
|
| 147 |
+
any later version.
|
| 148 |
+
|
| 149 |
+
Libgfortran is distributed in the hope that it will be useful,
|
| 150 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 151 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 152 |
+
GNU General Public License for more details.
|
| 153 |
+
|
| 154 |
+
Under Section 7 of GPL version 3, you are granted additional
|
| 155 |
+
permissions described in the GCC Runtime Library Exception, version
|
| 156 |
+
3.1, as published by the Free Software Foundation.
|
| 157 |
+
|
| 158 |
+
You should have received a copy of the GNU General Public License and
|
| 159 |
+
a copy of the GCC Runtime Library Exception along with this program;
|
| 160 |
+
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
| 161 |
+
<http://www.gnu.org/licenses/>.
|
| 162 |
+
|
| 163 |
+
----
|
| 164 |
+
|
| 165 |
+
Full text of license texts referred to above follows (that they are
|
| 166 |
+
listed below does not necessarily imply the conditions apply to the
|
| 167 |
+
present binary release):
|
| 168 |
+
|
| 169 |
+
----
|
| 170 |
+
|
| 171 |
+
GCC RUNTIME LIBRARY EXCEPTION
|
| 172 |
+
|
| 173 |
+
Version 3.1, 31 March 2009
|
| 174 |
+
|
| 175 |
+
Copyright (C) 2009 Free Software Foundation, Inc. <http://fsf.org/>
|
| 176 |
+
|
| 177 |
+
Everyone is permitted to copy and distribute verbatim copies of this
|
| 178 |
+
license document, but changing it is not allowed.
|
| 179 |
+
|
| 180 |
+
This GCC Runtime Library Exception ("Exception") is an additional
|
| 181 |
+
permission under section 7 of the GNU General Public License, version
|
| 182 |
+
3 ("GPLv3"). It applies to a given file (the "Runtime Library") that
|
| 183 |
+
bears a notice placed by the copyright holder of the file stating that
|
| 184 |
+
the file is governed by GPLv3 along with this Exception.
|
| 185 |
+
|
| 186 |
+
When you use GCC to compile a program, GCC may combine portions of
|
| 187 |
+
certain GCC header files and runtime libraries with the compiled
|
| 188 |
+
program. The purpose of this Exception is to allow compilation of
|
| 189 |
+
non-GPL (including proprietary) programs to use, in this way, the
|
| 190 |
+
header files and runtime libraries covered by this Exception.
|
| 191 |
+
|
| 192 |
+
0. Definitions.
|
| 193 |
+
|
| 194 |
+
A file is an "Independent Module" if it either requires the Runtime
|
| 195 |
+
Library for execution after a Compilation Process, or makes use of an
|
| 196 |
+
interface provided by the Runtime Library, but is not otherwise based
|
| 197 |
+
on the Runtime Library.
|
| 198 |
+
|
| 199 |
+
"GCC" means a version of the GNU Compiler Collection, with or without
|
| 200 |
+
modifications, governed by version 3 (or a specified later version) of
|
| 201 |
+
the GNU General Public License (GPL) with the option of using any
|
| 202 |
+
subsequent versions published by the FSF.
|
| 203 |
+
|
| 204 |
+
"GPL-compatible Software" is software whose conditions of propagation,
|
| 205 |
+
modification and use would permit combination with GCC in accord with
|
| 206 |
+
the license of GCC.
|
| 207 |
+
|
| 208 |
+
"Target Code" refers to output from any compiler for a real or virtual
|
| 209 |
+
target processor architecture, in executable form or suitable for
|
| 210 |
+
input to an assembler, loader, linker and/or execution
|
| 211 |
+
phase. Notwithstanding that, Target Code does not include data in any
|
| 212 |
+
format that is used as a compiler intermediate representation, or used
|
| 213 |
+
for producing a compiler intermediate representation.
|
| 214 |
+
|
| 215 |
+
The "Compilation Process" transforms code entirely represented in
|
| 216 |
+
non-intermediate languages designed for human-written code, and/or in
|
| 217 |
+
Java Virtual Machine byte code, into Target Code. Thus, for example,
|
| 218 |
+
use of source code generators and preprocessors need not be considered
|
| 219 |
+
part of the Compilation Process, since the Compilation Process can be
|
| 220 |
+
understood as starting with the output of the generators or
|
| 221 |
+
preprocessors.
|
| 222 |
+
|
| 223 |
+
A Compilation Process is "Eligible" if it is done using GCC, alone or
|
| 224 |
+
with other GPL-compatible software, or if it is done without using any
|
| 225 |
+
work based on GCC. For example, using non-GPL-compatible Software to
|
| 226 |
+
optimize any GCC intermediate representations would not qualify as an
|
| 227 |
+
Eligible Compilation Process.
|
| 228 |
+
|
| 229 |
+
1. Grant of Additional Permission.
|
| 230 |
+
|
| 231 |
+
You have permission to propagate a work of Target Code formed by
|
| 232 |
+
combining the Runtime Library with Independent Modules, even if such
|
| 233 |
+
propagation would otherwise violate the terms of GPLv3, provided that
|
| 234 |
+
all Target Code was generated by Eligible Compilation Processes. You
|
| 235 |
+
may then convey such a combination under terms of your choice,
|
| 236 |
+
consistent with the licensing of the Independent Modules.
|
| 237 |
+
|
| 238 |
+
2. No Weakening of GCC Copyleft.
|
| 239 |
+
|
| 240 |
+
The availability of this Exception does not imply any general
|
| 241 |
+
presumption that third-party software is unaffected by the copyleft
|
| 242 |
+
requirements of the license of GCC.
|
| 243 |
+
|
| 244 |
+
----
|
| 245 |
+
|
| 246 |
+
GNU GENERAL PUBLIC LICENSE
|
| 247 |
+
Version 3, 29 June 2007
|
| 248 |
+
|
| 249 |
+
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
| 250 |
+
Everyone is permitted to copy and distribute verbatim copies
|
| 251 |
+
of this license document, but changing it is not allowed.
|
| 252 |
+
|
| 253 |
+
Preamble
|
| 254 |
+
|
| 255 |
+
The GNU General Public License is a free, copyleft license for
|
| 256 |
+
software and other kinds of works.
|
| 257 |
+
|
| 258 |
+
The licenses for most software and other practical works are designed
|
| 259 |
+
to take away your freedom to share and change the works. By contrast,
|
| 260 |
+
the GNU General Public License is intended to guarantee your freedom to
|
| 261 |
+
share and change all versions of a program--to make sure it remains free
|
| 262 |
+
software for all its users. We, the Free Software Foundation, use the
|
| 263 |
+
GNU General Public License for most of our software; it applies also to
|
| 264 |
+
any other work released this way by its authors. You can apply it to
|
| 265 |
+
your programs, too.
|
| 266 |
+
|
| 267 |
+
When we speak of free software, we are referring to freedom, not
|
| 268 |
+
price. Our General Public Licenses are designed to make sure that you
|
| 269 |
+
have the freedom to distribute copies of free software (and charge for
|
| 270 |
+
them if you wish), that you receive source code or can get it if you
|
| 271 |
+
want it, that you can change the software or use pieces of it in new
|
| 272 |
+
free programs, and that you know you can do these things.
|
| 273 |
+
|
| 274 |
+
To protect your rights, we need to prevent others from denying you
|
| 275 |
+
these rights or asking you to surrender the rights. Therefore, you have
|
| 276 |
+
certain responsibilities if you distribute copies of the software, or if
|
| 277 |
+
you modify it: responsibilities to respect the freedom of others.
|
| 278 |
+
|
| 279 |
+
For example, if you distribute copies of such a program, whether
|
| 280 |
+
gratis or for a fee, you must pass on to the recipients the same
|
| 281 |
+
freedoms that you received. You must make sure that they, too, receive
|
| 282 |
+
or can get the source code. And you must show them these terms so they
|
| 283 |
+
know their rights.
|
| 284 |
+
|
| 285 |
+
Developers that use the GNU GPL protect your rights with two steps:
|
| 286 |
+
(1) assert copyright on the software, and (2) offer you this License
|
| 287 |
+
giving you legal permission to copy, distribute and/or modify it.
|
| 288 |
+
|
| 289 |
+
For the developers' and authors' protection, the GPL clearly explains
|
| 290 |
+
that there is no warranty for this free software. For both users' and
|
| 291 |
+
authors' sake, the GPL requires that modified versions be marked as
|
| 292 |
+
changed, so that their problems will not be attributed erroneously to
|
| 293 |
+
authors of previous versions.
|
| 294 |
+
|
| 295 |
+
Some devices are designed to deny users access to install or run
|
| 296 |
+
modified versions of the software inside them, although the manufacturer
|
| 297 |
+
can do so. This is fundamentally incompatible with the aim of
|
| 298 |
+
protecting users' freedom to change the software. The systematic
|
| 299 |
+
pattern of such abuse occurs in the area of products for individuals to
|
| 300 |
+
use, which is precisely where it is most unacceptable. Therefore, we
|
| 301 |
+
have designed this version of the GPL to prohibit the practice for those
|
| 302 |
+
products. If such problems arise substantially in other domains, we
|
| 303 |
+
stand ready to extend this provision to those domains in future versions
|
| 304 |
+
of the GPL, as needed to protect the freedom of users.
|
| 305 |
+
|
| 306 |
+
Finally, every program is threatened constantly by software patents.
|
| 307 |
+
States should not allow patents to restrict development and use of
|
| 308 |
+
software on general-purpose computers, but in those that do, we wish to
|
| 309 |
+
avoid the special danger that patents applied to a free program could
|
| 310 |
+
make it effectively proprietary. To prevent this, the GPL assures that
|
| 311 |
+
patents cannot be used to render the program non-free.
|
| 312 |
+
|
| 313 |
+
The precise terms and conditions for copying, distribution and
|
| 314 |
+
modification follow.
|
| 315 |
+
|
| 316 |
+
TERMS AND CONDITIONS
|
| 317 |
+
|
| 318 |
+
0. Definitions.
|
| 319 |
+
|
| 320 |
+
"This License" refers to version 3 of the GNU General Public License.
|
| 321 |
+
|
| 322 |
+
"Copyright" also means copyright-like laws that apply to other kinds of
|
| 323 |
+
works, such as semiconductor masks.
|
| 324 |
+
|
| 325 |
+
"The Program" refers to any copyrightable work licensed under this
|
| 326 |
+
License. Each licensee is addressed as "you". "Licensees" and
|
| 327 |
+
"recipients" may be individuals or organizations.
|
| 328 |
+
|
| 329 |
+
To "modify" a work means to copy from or adapt all or part of the work
|
| 330 |
+
in a fashion requiring copyright permission, other than the making of an
|
| 331 |
+
exact copy. The resulting work is called a "modified version" of the
|
| 332 |
+
earlier work or a work "based on" the earlier work.
|
| 333 |
+
|
| 334 |
+
A "covered work" means either the unmodified Program or a work based
|
| 335 |
+
on the Program.
|
| 336 |
+
|
| 337 |
+
To "propagate" a work means to do anything with it that, without
|
| 338 |
+
permission, would make you directly or secondarily liable for
|
| 339 |
+
infringement under applicable copyright law, except executing it on a
|
| 340 |
+
computer or modifying a private copy. Propagation includes copying,
|
| 341 |
+
distribution (with or without modification), making available to the
|
| 342 |
+
public, and in some countries other activities as well.
|
| 343 |
+
|
| 344 |
+
To "convey" a work means any kind of propagation that enables other
|
| 345 |
+
parties to make or receive copies. Mere interaction with a user through
|
| 346 |
+
a computer network, with no transfer of a copy, is not conveying.
|
| 347 |
+
|
| 348 |
+
An interactive user interface displays "Appropriate Legal Notices"
|
| 349 |
+
to the extent that it includes a convenient and prominently visible
|
| 350 |
+
feature that (1) displays an appropriate copyright notice, and (2)
|
| 351 |
+
tells the user that there is no warranty for the work (except to the
|
| 352 |
+
extent that warranties are provided), that licensees may convey the
|
| 353 |
+
work under this License, and how to view a copy of this License. If
|
| 354 |
+
the interface presents a list of user commands or options, such as a
|
| 355 |
+
menu, a prominent item in the list meets this criterion.
|
| 356 |
+
|
| 357 |
+
1. Source Code.
|
| 358 |
+
|
| 359 |
+
The "source code" for a work means the preferred form of the work
|
| 360 |
+
for making modifications to it. "Object code" means any non-source
|
| 361 |
+
form of a work.
|
| 362 |
+
|
| 363 |
+
A "Standard Interface" means an interface that either is an official
|
| 364 |
+
standard defined by a recognized standards body, or, in the case of
|
| 365 |
+
interfaces specified for a particular programming language, one that
|
| 366 |
+
is widely used among developers working in that language.
|
| 367 |
+
|
| 368 |
+
The "System Libraries" of an executable work include anything, other
|
| 369 |
+
than the work as a whole, that (a) is included in the normal form of
|
| 370 |
+
packaging a Major Component, but which is not part of that Major
|
| 371 |
+
Component, and (b) serves only to enable use of the work with that
|
| 372 |
+
Major Component, or to implement a Standard Interface for which an
|
| 373 |
+
implementation is available to the public in source code form. A
|
| 374 |
+
"Major Component", in this context, means a major essential component
|
| 375 |
+
(kernel, window system, and so on) of the specific operating system
|
| 376 |
+
(if any) on which the executable work runs, or a compiler used to
|
| 377 |
+
produce the work, or an object code interpreter used to run it.
|
| 378 |
+
|
| 379 |
+
The "Corresponding Source" for a work in object code form means all
|
| 380 |
+
the source code needed to generate, install, and (for an executable
|
| 381 |
+
work) run the object code and to modify the work, including scripts to
|
| 382 |
+
control those activities. However, it does not include the work's
|
| 383 |
+
System Libraries, or general-purpose tools or generally available free
|
| 384 |
+
programs which are used unmodified in performing those activities but
|
| 385 |
+
which are not part of the work. For example, Corresponding Source
|
| 386 |
+
includes interface definition files associated with source files for
|
| 387 |
+
the work, and the source code for shared libraries and dynamically
|
| 388 |
+
linked subprograms that the work is specifically designed to require,
|
| 389 |
+
such as by intimate data communication or control flow between those
|
| 390 |
+
subprograms and other parts of the work.
|
| 391 |
+
|
| 392 |
+
The Corresponding Source need not include anything that users
|
| 393 |
+
can regenerate automatically from other parts of the Corresponding
|
| 394 |
+
Source.
|
| 395 |
+
|
| 396 |
+
The Corresponding Source for a work in source code form is that
|
| 397 |
+
same work.
|
| 398 |
+
|
| 399 |
+
2. Basic Permissions.
|
| 400 |
+
|
| 401 |
+
All rights granted under this License are granted for the term of
|
| 402 |
+
copyright on the Program, and are irrevocable provided the stated
|
| 403 |
+
conditions are met. This License explicitly affirms your unlimited
|
| 404 |
+
permission to run the unmodified Program. The output from running a
|
| 405 |
+
covered work is covered by this License only if the output, given its
|
| 406 |
+
content, constitutes a covered work. This License acknowledges your
|
| 407 |
+
rights of fair use or other equivalent, as provided by copyright law.
|
| 408 |
+
|
| 409 |
+
You may make, run and propagate covered works that you do not
|
| 410 |
+
convey, without conditions so long as your license otherwise remains
|
| 411 |
+
in force. You may convey covered works to others for the sole purpose
|
| 412 |
+
of having them make modifications exclusively for you, or provide you
|
| 413 |
+
with facilities for running those works, provided that you comply with
|
| 414 |
+
the terms of this License in conveying all material for which you do
|
| 415 |
+
not control copyright. Those thus making or running the covered works
|
| 416 |
+
for you must do so exclusively on your behalf, under your direction
|
| 417 |
+
and control, on terms that prohibit them from making any copies of
|
| 418 |
+
your copyrighted material outside their relationship with you.
|
| 419 |
+
|
| 420 |
+
Conveying under any other circumstances is permitted solely under
|
| 421 |
+
the conditions stated below. Sublicensing is not allowed; section 10
|
| 422 |
+
makes it unnecessary.
|
| 423 |
+
|
| 424 |
+
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
| 425 |
+
|
| 426 |
+
No covered work shall be deemed part of an effective technological
|
| 427 |
+
measure under any applicable law fulfilling obligations under article
|
| 428 |
+
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
| 429 |
+
similar laws prohibiting or restricting circumvention of such
|
| 430 |
+
measures.
|
| 431 |
+
|
| 432 |
+
When you convey a covered work, you waive any legal power to forbid
|
| 433 |
+
circumvention of technological measures to the extent such circumvention
|
| 434 |
+
is effected by exercising rights under this License with respect to
|
| 435 |
+
the covered work, and you disclaim any intention to limit operation or
|
| 436 |
+
modification of the work as a means of enforcing, against the work's
|
| 437 |
+
users, your or third parties' legal rights to forbid circumvention of
|
| 438 |
+
technological measures.
|
| 439 |
+
|
| 440 |
+
4. Conveying Verbatim Copies.
|
| 441 |
+
|
| 442 |
+
You may convey verbatim copies of the Program's source code as you
|
| 443 |
+
receive it, in any medium, provided that you conspicuously and
|
| 444 |
+
appropriately publish on each copy an appropriate copyright notice;
|
| 445 |
+
keep intact all notices stating that this License and any
|
| 446 |
+
non-permissive terms added in accord with section 7 apply to the code;
|
| 447 |
+
keep intact all notices of the absence of any warranty; and give all
|
| 448 |
+
recipients a copy of this License along with the Program.
|
| 449 |
+
|
| 450 |
+
You may charge any price or no price for each copy that you convey,
|
| 451 |
+
and you may offer support or warranty protection for a fee.
|
| 452 |
+
|
| 453 |
+
5. Conveying Modified Source Versions.
|
| 454 |
+
|
| 455 |
+
You may convey a work based on the Program, or the modifications to
|
| 456 |
+
produce it from the Program, in the form of source code under the
|
| 457 |
+
terms of section 4, provided that you also meet all of these conditions:
|
| 458 |
+
|
| 459 |
+
a) The work must carry prominent notices stating that you modified
|
| 460 |
+
it, and giving a relevant date.
|
| 461 |
+
|
| 462 |
+
b) The work must carry prominent notices stating that it is
|
| 463 |
+
released under this License and any conditions added under section
|
| 464 |
+
7. This requirement modifies the requirement in section 4 to
|
| 465 |
+
"keep intact all notices".
|
| 466 |
+
|
| 467 |
+
c) You must license the entire work, as a whole, under this
|
| 468 |
+
License to anyone who comes into possession of a copy. This
|
| 469 |
+
License will therefore apply, along with any applicable section 7
|
| 470 |
+
additional terms, to the whole of the work, and all its parts,
|
| 471 |
+
regardless of how they are packaged. This License gives no
|
| 472 |
+
permission to license the work in any other way, but it does not
|
| 473 |
+
invalidate such permission if you have separately received it.
|
| 474 |
+
|
| 475 |
+
d) If the work has interactive user interfaces, each must display
|
| 476 |
+
Appropriate Legal Notices; however, if the Program has interactive
|
| 477 |
+
interfaces that do not display Appropriate Legal Notices, your
|
| 478 |
+
work need not make them do so.
|
| 479 |
+
|
| 480 |
+
A compilation of a covered work with other separate and independent
|
| 481 |
+
works, which are not by their nature extensions of the covered work,
|
| 482 |
+
and which are not combined with it such as to form a larger program,
|
| 483 |
+
in or on a volume of a storage or distribution medium, is called an
|
| 484 |
+
"aggregate" if the compilation and its resulting copyright are not
|
| 485 |
+
used to limit the access or legal rights of the compilation's users
|
| 486 |
+
beyond what the individual works permit. Inclusion of a covered work
|
| 487 |
+
in an aggregate does not cause this License to apply to the other
|
| 488 |
+
parts of the aggregate.
|
| 489 |
+
|
| 490 |
+
6. Conveying Non-Source Forms.
|
| 491 |
+
|
| 492 |
+
You may convey a covered work in object code form under the terms
|
| 493 |
+
of sections 4 and 5, provided that you also convey the
|
| 494 |
+
machine-readable Corresponding Source under the terms of this License,
|
| 495 |
+
in one of these ways:
|
| 496 |
+
|
| 497 |
+
a) Convey the object code in, or embodied in, a physical product
|
| 498 |
+
(including a physical distribution medium), accompanied by the
|
| 499 |
+
Corresponding Source fixed on a durable physical medium
|
| 500 |
+
customarily used for software interchange.
|
| 501 |
+
|
| 502 |
+
b) Convey the object code in, or embodied in, a physical product
|
| 503 |
+
(including a physical distribution medium), accompanied by a
|
| 504 |
+
written offer, valid for at least three years and valid for as
|
| 505 |
+
long as you offer spare parts or customer support for that product
|
| 506 |
+
model, to give anyone who possesses the object code either (1) a
|
| 507 |
+
copy of the Corresponding Source for all the software in the
|
| 508 |
+
product that is covered by this License, on a durable physical
|
| 509 |
+
medium customarily used for software interchange, for a price no
|
| 510 |
+
more than your reasonable cost of physically performing this
|
| 511 |
+
conveying of source, or (2) access to copy the
|
| 512 |
+
Corresponding Source from a network server at no charge.
|
| 513 |
+
|
| 514 |
+
c) Convey individual copies of the object code with a copy of the
|
| 515 |
+
written offer to provide the Corresponding Source. This
|
| 516 |
+
alternative is allowed only occasionally and noncommercially, and
|
| 517 |
+
only if you received the object code with such an offer, in accord
|
| 518 |
+
with subsection 6b.
|
| 519 |
+
|
| 520 |
+
d) Convey the object code by offering access from a designated
|
| 521 |
+
place (gratis or for a charge), and offer equivalent access to the
|
| 522 |
+
Corresponding Source in the same way through the same place at no
|
| 523 |
+
further charge. You need not require recipients to copy the
|
| 524 |
+
Corresponding Source along with the object code. If the place to
|
| 525 |
+
copy the object code is a network server, the Corresponding Source
|
| 526 |
+
may be on a different server (operated by you or a third party)
|
| 527 |
+
that supports equivalent copying facilities, provided you maintain
|
| 528 |
+
clear directions next to the object code saying where to find the
|
| 529 |
+
Corresponding Source. Regardless of what server hosts the
|
| 530 |
+
Corresponding Source, you remain obligated to ensure that it is
|
| 531 |
+
available for as long as needed to satisfy these requirements.
|
| 532 |
+
|
| 533 |
+
e) Convey the object code using peer-to-peer transmission, provided
|
| 534 |
+
you inform other peers where the object code and Corresponding
|
| 535 |
+
Source of the work are being offered to the general public at no
|
| 536 |
+
charge under subsection 6d.
|
| 537 |
+
|
| 538 |
+
A separable portion of the object code, whose source code is excluded
|
| 539 |
+
from the Corresponding Source as a System Library, need not be
|
| 540 |
+
included in conveying the object code work.
|
| 541 |
+
|
| 542 |
+
A "User Product" is either (1) a "consumer product", which means any
|
| 543 |
+
tangible personal property which is normally used for personal, family,
|
| 544 |
+
or household purposes, or (2) anything designed or sold for incorporation
|
| 545 |
+
into a dwelling. In determining whether a product is a consumer product,
|
| 546 |
+
doubtful cases shall be resolved in favor of coverage. For a particular
|
| 547 |
+
product received by a particular user, "normally used" refers to a
|
| 548 |
+
typical or common use of that class of product, regardless of the status
|
| 549 |
+
of the particular user or of the way in which the particular user
|
| 550 |
+
actually uses, or expects or is expected to use, the product. A product
|
| 551 |
+
is a consumer product regardless of whether the product has substantial
|
| 552 |
+
commercial, industrial or non-consumer uses, unless such uses represent
|
| 553 |
+
the only significant mode of use of the product.
|
| 554 |
+
|
| 555 |
+
"Installation Information" for a User Product means any methods,
|
| 556 |
+
procedures, authorization keys, or other information required to install
|
| 557 |
+
and execute modified versions of a covered work in that User Product from
|
| 558 |
+
a modified version of its Corresponding Source. The information must
|
| 559 |
+
suffice to ensure that the continued functioning of the modified object
|
| 560 |
+
code is in no case prevented or interfered with solely because
|
| 561 |
+
modification has been made.
|
| 562 |
+
|
| 563 |
+
If you convey an object code work under this section in, or with, or
|
| 564 |
+
specifically for use in, a User Product, and the conveying occurs as
|
| 565 |
+
part of a transaction in which the right of possession and use of the
|
| 566 |
+
User Product is transferred to the recipient in perpetuity or for a
|
| 567 |
+
fixed term (regardless of how the transaction is characterized), the
|
| 568 |
+
Corresponding Source conveyed under this section must be accompanied
|
| 569 |
+
by the Installation Information. But this requirement does not apply
|
| 570 |
+
if neither you nor any third party retains the ability to install
|
| 571 |
+
modified object code on the User Product (for example, the work has
|
| 572 |
+
been installed in ROM).
|
| 573 |
+
|
| 574 |
+
The requirement to provide Installation Information does not include a
|
| 575 |
+
requirement to continue to provide support service, warranty, or updates
|
| 576 |
+
for a work that has been modified or installed by the recipient, or for
|
| 577 |
+
the User Product in which it has been modified or installed. Access to a
|
| 578 |
+
network may be denied when the modification itself materially and
|
| 579 |
+
adversely affects the operation of the network or violates the rules and
|
| 580 |
+
protocols for communication across the network.
|
| 581 |
+
|
| 582 |
+
Corresponding Source conveyed, and Installation Information provided,
|
| 583 |
+
in accord with this section must be in a format that is publicly
|
| 584 |
+
documented (and with an implementation available to the public in
|
| 585 |
+
source code form), and must require no special password or key for
|
| 586 |
+
unpacking, reading or copying.
|
| 587 |
+
|
| 588 |
+
7. Additional Terms.
|
| 589 |
+
|
| 590 |
+
"Additional permissions" are terms that supplement the terms of this
|
| 591 |
+
License by making exceptions from one or more of its conditions.
|
| 592 |
+
Additional permissions that are applicable to the entire Program shall
|
| 593 |
+
be treated as though they were included in this License, to the extent
|
| 594 |
+
that they are valid under applicable law. If additional permissions
|
| 595 |
+
apply only to part of the Program, that part may be used separately
|
| 596 |
+
under those permissions, but the entire Program remains governed by
|
| 597 |
+
this License without regard to the additional permissions.
|
| 598 |
+
|
| 599 |
+
When you convey a copy of a covered work, you may at your option
|
| 600 |
+
remove any additional permissions from that copy, or from any part of
|
| 601 |
+
it. (Additional permissions may be written to require their own
|
| 602 |
+
removal in certain cases when you modify the work.) You may place
|
| 603 |
+
additional permissions on material, added by you to a covered work,
|
| 604 |
+
for which you have or can give appropriate copyright permission.
|
| 605 |
+
|
| 606 |
+
Notwithstanding any other provision of this License, for material you
|
| 607 |
+
add to a covered work, you may (if authorized by the copyright holders of
|
| 608 |
+
that material) supplement the terms of this License with terms:
|
| 609 |
+
|
| 610 |
+
a) Disclaiming warranty or limiting liability differently from the
|
| 611 |
+
terms of sections 15 and 16 of this License; or
|
| 612 |
+
|
| 613 |
+
b) Requiring preservation of specified reasonable legal notices or
|
| 614 |
+
author attributions in that material or in the Appropriate Legal
|
| 615 |
+
Notices displayed by works containing it; or
|
| 616 |
+
|
| 617 |
+
c) Prohibiting misrepresentation of the origin of that material, or
|
| 618 |
+
requiring that modified versions of such material be marked in
|
| 619 |
+
reasonable ways as different from the original version; or
|
| 620 |
+
|
| 621 |
+
d) Limiting the use for publicity purposes of names of licensors or
|
| 622 |
+
authors of the material; or
|
| 623 |
+
|
| 624 |
+
e) Declining to grant rights under trademark law for use of some
|
| 625 |
+
trade names, trademarks, or service marks; or
|
| 626 |
+
|
| 627 |
+
f) Requiring indemnification of licensors and authors of that
|
| 628 |
+
material by anyone who conveys the material (or modified versions of
|
| 629 |
+
it) with contractual assumptions of liability to the recipient, for
|
| 630 |
+
any liability that these contractual assumptions directly impose on
|
| 631 |
+
those licensors and authors.
|
| 632 |
+
|
| 633 |
+
All other non-permissive additional terms are considered "further
|
| 634 |
+
restrictions" within the meaning of section 10. If the Program as you
|
| 635 |
+
received it, or any part of it, contains a notice stating that it is
|
| 636 |
+
governed by this License along with a term that is a further
|
| 637 |
+
restriction, you may remove that term. If a license document contains
|
| 638 |
+
a further restriction but permits relicensing or conveying under this
|
| 639 |
+
License, you may add to a covered work material governed by the terms
|
| 640 |
+
of that license document, provided that the further restriction does
|
| 641 |
+
not survive such relicensing or conveying.
|
| 642 |
+
|
| 643 |
+
If you add terms to a covered work in accord with this section, you
|
| 644 |
+
must place, in the relevant source files, a statement of the
|
| 645 |
+
additional terms that apply to those files, or a notice indicating
|
| 646 |
+
where to find the applicable terms.
|
| 647 |
+
|
| 648 |
+
Additional terms, permissive or non-permissive, may be stated in the
|
| 649 |
+
form of a separately written license, or stated as exceptions;
|
| 650 |
+
the above requirements apply either way.
|
| 651 |
+
|
| 652 |
+
8. Termination.
|
| 653 |
+
|
| 654 |
+
You may not propagate or modify a covered work except as expressly
|
| 655 |
+
provided under this License. Any attempt otherwise to propagate or
|
| 656 |
+
modify it is void, and will automatically terminate your rights under
|
| 657 |
+
this License (including any patent licenses granted under the third
|
| 658 |
+
paragraph of section 11).
|
| 659 |
+
|
| 660 |
+
However, if you cease all violation of this License, then your
|
| 661 |
+
license from a particular copyright holder is reinstated (a)
|
| 662 |
+
provisionally, unless and until the copyright holder explicitly and
|
| 663 |
+
finally terminates your license, and (b) permanently, if the copyright
|
| 664 |
+
holder fails to notify you of the violation by some reasonable means
|
| 665 |
+
prior to 60 days after the cessation.
|
| 666 |
+
|
| 667 |
+
Moreover, your license from a particular copyright holder is
|
| 668 |
+
reinstated permanently if the copyright holder notifies you of the
|
| 669 |
+
violation by some reasonable means, this is the first time you have
|
| 670 |
+
received notice of violation of this License (for any work) from that
|
| 671 |
+
copyright holder, and you cure the violation prior to 30 days after
|
| 672 |
+
your receipt of the notice.
|
| 673 |
+
|
| 674 |
+
Termination of your rights under this section does not terminate the
|
| 675 |
+
licenses of parties who have received copies or rights from you under
|
| 676 |
+
this License. If your rights have been terminated and not permanently
|
| 677 |
+
reinstated, you do not qualify to receive new licenses for the same
|
| 678 |
+
material under section 10.
|
| 679 |
+
|
| 680 |
+
9. Acceptance Not Required for Having Copies.
|
| 681 |
+
|
| 682 |
+
You are not required to accept this License in order to receive or
|
| 683 |
+
run a copy of the Program. Ancillary propagation of a covered work
|
| 684 |
+
occurring solely as a consequence of using peer-to-peer transmission
|
| 685 |
+
to receive a copy likewise does not require acceptance. However,
|
| 686 |
+
nothing other than this License grants you permission to propagate or
|
| 687 |
+
modify any covered work. These actions infringe copyright if you do
|
| 688 |
+
not accept this License. Therefore, by modifying or propagating a
|
| 689 |
+
covered work, you indicate your acceptance of this License to do so.
|
| 690 |
+
|
| 691 |
+
10. Automatic Licensing of Downstream Recipients.
|
| 692 |
+
|
| 693 |
+
Each time you convey a covered work, the recipient automatically
|
| 694 |
+
receives a license from the original licensors, to run, modify and
|
| 695 |
+
propagate that work, subject to this License. You are not responsible
|
| 696 |
+
for enforcing compliance by third parties with this License.
|
| 697 |
+
|
| 698 |
+
An "entity transaction" is a transaction transferring control of an
|
| 699 |
+
organization, or substantially all assets of one, or subdividing an
|
| 700 |
+
organization, or merging organizations. If propagation of a covered
|
| 701 |
+
work results from an entity transaction, each party to that
|
| 702 |
+
transaction who receives a copy of the work also receives whatever
|
| 703 |
+
licenses to the work the party's predecessor in interest had or could
|
| 704 |
+
give under the previous paragraph, plus a right to possession of the
|
| 705 |
+
Corresponding Source of the work from the predecessor in interest, if
|
| 706 |
+
the predecessor has it or can get it with reasonable efforts.
|
| 707 |
+
|
| 708 |
+
You may not impose any further restrictions on the exercise of the
|
| 709 |
+
rights granted or affirmed under this License. For example, you may
|
| 710 |
+
not impose a license fee, royalty, or other charge for exercise of
|
| 711 |
+
rights granted under this License, and you may not initiate litigation
|
| 712 |
+
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
| 713 |
+
any patent claim is infringed by making, using, selling, offering for
|
| 714 |
+
sale, or importing the Program or any portion of it.
|
| 715 |
+
|
| 716 |
+
11. Patents.
|
| 717 |
+
|
| 718 |
+
A "contributor" is a copyright holder who authorizes use under this
|
| 719 |
+
License of the Program or a work on which the Program is based. The
|
| 720 |
+
work thus licensed is called the contributor's "contributor version".
|
| 721 |
+
|
| 722 |
+
A contributor's "essential patent claims" are all patent claims
|
| 723 |
+
owned or controlled by the contributor, whether already acquired or
|
| 724 |
+
hereafter acquired, that would be infringed by some manner, permitted
|
| 725 |
+
by this License, of making, using, or selling its contributor version,
|
| 726 |
+
but do not include claims that would be infringed only as a
|
| 727 |
+
consequence of further modification of the contributor version. For
|
| 728 |
+
purposes of this definition, "control" includes the right to grant
|
| 729 |
+
patent sublicenses in a manner consistent with the requirements of
|
| 730 |
+
this License.
|
| 731 |
+
|
| 732 |
+
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
| 733 |
+
patent license under the contributor's essential patent claims, to
|
| 734 |
+
make, use, sell, offer for sale, import and otherwise run, modify and
|
| 735 |
+
propagate the contents of its contributor version.
|
| 736 |
+
|
| 737 |
+
In the following three paragraphs, a "patent license" is any express
|
| 738 |
+
agreement or commitment, however denominated, not to enforce a patent
|
| 739 |
+
(such as an express permission to practice a patent or covenant not to
|
| 740 |
+
sue for patent infringement). To "grant" such a patent license to a
|
| 741 |
+
party means to make such an agreement or commitment not to enforce a
|
| 742 |
+
patent against the party.
|
| 743 |
+
|
| 744 |
+
If you convey a covered work, knowingly relying on a patent license,
|
| 745 |
+
and the Corresponding Source of the work is not available for anyone
|
| 746 |
+
to copy, free of charge and under the terms of this License, through a
|
| 747 |
+
publicly available network server or other readily accessible means,
|
| 748 |
+
then you must either (1) cause the Corresponding Source to be so
|
| 749 |
+
available, or (2) arrange to deprive yourself of the benefit of the
|
| 750 |
+
patent license for this particular work, or (3) arrange, in a manner
|
| 751 |
+
consistent with the requirements of this License, to extend the patent
|
| 752 |
+
license to downstream recipients. "Knowingly relying" means you have
|
| 753 |
+
actual knowledge that, but for the patent license, your conveying the
|
| 754 |
+
covered work in a country, or your recipient's use of the covered work
|
| 755 |
+
in a country, would infringe one or more identifiable patents in that
|
| 756 |
+
country that you have reason to believe are valid.
|
| 757 |
+
|
| 758 |
+
If, pursuant to or in connection with a single transaction or
|
| 759 |
+
arrangement, you convey, or propagate by procuring conveyance of, a
|
| 760 |
+
covered work, and grant a patent license to some of the parties
|
| 761 |
+
receiving the covered work authorizing them to use, propagate, modify
|
| 762 |
+
or convey a specific copy of the covered work, then the patent license
|
| 763 |
+
you grant is automatically extended to all recipients of the covered
|
| 764 |
+
work and works based on it.
|
| 765 |
+
|
| 766 |
+
A patent license is "discriminatory" if it does not include within
|
| 767 |
+
the scope of its coverage, prohibits the exercise of, or is
|
| 768 |
+
conditioned on the non-exercise of one or more of the rights that are
|
| 769 |
+
specifically granted under this License. You may not convey a covered
|
| 770 |
+
work if you are a party to an arrangement with a third party that is
|
| 771 |
+
in the business of distributing software, under which you make payment
|
| 772 |
+
to the third party based on the extent of your activity of conveying
|
| 773 |
+
the work, and under which the third party grants, to any of the
|
| 774 |
+
parties who would receive the covered work from you, a discriminatory
|
| 775 |
+
patent license (a) in connection with copies of the covered work
|
| 776 |
+
conveyed by you (or copies made from those copies), or (b) primarily
|
| 777 |
+
for and in connection with specific products or compilations that
|
| 778 |
+
contain the covered work, unless you entered into that arrangement,
|
| 779 |
+
or that patent license was granted, prior to 28 March 2007.
|
| 780 |
+
|
| 781 |
+
Nothing in this License shall be construed as excluding or limiting
|
| 782 |
+
any implied license or other defenses to infringement that may
|
| 783 |
+
otherwise be available to you under applicable patent law.
|
| 784 |
+
|
| 785 |
+
12. No Surrender of Others' Freedom.
|
| 786 |
+
|
| 787 |
+
If conditions are imposed on you (whether by court order, agreement or
|
| 788 |
+
otherwise) that contradict the conditions of this License, they do not
|
| 789 |
+
excuse you from the conditions of this License. If you cannot convey a
|
| 790 |
+
covered work so as to satisfy simultaneously your obligations under this
|
| 791 |
+
License and any other pertinent obligations, then as a consequence you may
|
| 792 |
+
not convey it at all. For example, if you agree to terms that obligate you
|
| 793 |
+
to collect a royalty for further conveying from those to whom you convey
|
| 794 |
+
the Program, the only way you could satisfy both those terms and this
|
| 795 |
+
License would be to refrain entirely from conveying the Program.
|
| 796 |
+
|
| 797 |
+
13. Use with the GNU Affero General Public License.
|
| 798 |
+
|
| 799 |
+
Notwithstanding any other provision of this License, you have
|
| 800 |
+
permission to link or combine any covered work with a work licensed
|
| 801 |
+
under version 3 of the GNU Affero General Public License into a single
|
| 802 |
+
combined work, and to convey the resulting work. The terms of this
|
| 803 |
+
License will continue to apply to the part which is the covered work,
|
| 804 |
+
but the special requirements of the GNU Affero General Public License,
|
| 805 |
+
section 13, concerning interaction through a network will apply to the
|
| 806 |
+
combination as such.
|
| 807 |
+
|
| 808 |
+
14. Revised Versions of this License.
|
| 809 |
+
|
| 810 |
+
The Free Software Foundation may publish revised and/or new versions of
|
| 811 |
+
the GNU General Public License from time to time. Such new versions will
|
| 812 |
+
be similar in spirit to the present version, but may differ in detail to
|
| 813 |
+
address new problems or concerns.
|
| 814 |
+
|
| 815 |
+
Each version is given a distinguishing version number. If the
|
| 816 |
+
Program specifies that a certain numbered version of the GNU General
|
| 817 |
+
Public License "or any later version" applies to it, you have the
|
| 818 |
+
option of following the terms and conditions either of that numbered
|
| 819 |
+
version or of any later version published by the Free Software
|
| 820 |
+
Foundation. If the Program does not specify a version number of the
|
| 821 |
+
GNU General Public License, you may choose any version ever published
|
| 822 |
+
by the Free Software Foundation.
|
| 823 |
+
|
| 824 |
+
If the Program specifies that a proxy can decide which future
|
| 825 |
+
versions of the GNU General Public License can be used, that proxy's
|
| 826 |
+
public statement of acceptance of a version permanently authorizes you
|
| 827 |
+
to choose that version for the Program.
|
| 828 |
+
|
| 829 |
+
Later license versions may give you additional or different
|
| 830 |
+
permissions. However, no additional obligations are imposed on any
|
| 831 |
+
author or copyright holder as a result of your choosing to follow a
|
| 832 |
+
later version.
|
| 833 |
+
|
| 834 |
+
15. Disclaimer of Warranty.
|
| 835 |
+
|
| 836 |
+
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
| 837 |
+
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
| 838 |
+
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
| 839 |
+
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
| 840 |
+
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
| 841 |
+
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
| 842 |
+
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
| 843 |
+
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
| 844 |
+
|
| 845 |
+
16. Limitation of Liability.
|
| 846 |
+
|
| 847 |
+
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
| 848 |
+
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
| 849 |
+
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
| 850 |
+
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
| 851 |
+
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
| 852 |
+
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
| 853 |
+
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
| 854 |
+
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
| 855 |
+
SUCH DAMAGES.
|
| 856 |
+
|
| 857 |
+
17. Interpretation of Sections 15 and 16.
|
| 858 |
+
|
| 859 |
+
If the disclaimer of warranty and limitation of liability provided
|
| 860 |
+
above cannot be given local legal effect according to their terms,
|
| 861 |
+
reviewing courts shall apply local law that most closely approximates
|
| 862 |
+
an absolute waiver of all civil liability in connection with the
|
| 863 |
+
Program, unless a warranty or assumption of liability accompanies a
|
| 864 |
+
copy of the Program in return for a fee.
|
| 865 |
+
|
| 866 |
+
END OF TERMS AND CONDITIONS
|
| 867 |
+
|
| 868 |
+
How to Apply These Terms to Your New Programs
|
| 869 |
+
|
| 870 |
+
If you develop a new program, and you want it to be of the greatest
|
| 871 |
+
possible use to the public, the best way to achieve this is to make it
|
| 872 |
+
free software which everyone can redistribute and change under these terms.
|
| 873 |
+
|
| 874 |
+
To do so, attach the following notices to the program. It is safest
|
| 875 |
+
to attach them to the start of each source file to most effectively
|
| 876 |
+
state the exclusion of warranty; and each file should have at least
|
| 877 |
+
the "copyright" line and a pointer to where the full notice is found.
|
| 878 |
+
|
| 879 |
+
<one line to give the program's name and a brief idea of what it does.>
|
| 880 |
+
Copyright (C) <year> <name of author>
|
| 881 |
+
|
| 882 |
+
This program is free software: you can redistribute it and/or modify
|
| 883 |
+
it under the terms of the GNU General Public License as published by
|
| 884 |
+
the Free Software Foundation, either version 3 of the License, or
|
| 885 |
+
(at your option) any later version.
|
| 886 |
+
|
| 887 |
+
This program is distributed in the hope that it will be useful,
|
| 888 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 889 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 890 |
+
GNU General Public License for more details.
|
| 891 |
+
|
| 892 |
+
You should have received a copy of the GNU General Public License
|
| 893 |
+
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
| 894 |
+
|
| 895 |
+
Also add information on how to contact you by electronic and paper mail.
|
| 896 |
+
|
| 897 |
+
If the program does terminal interaction, make it output a short
|
| 898 |
+
notice like this when it starts in an interactive mode:
|
| 899 |
+
|
| 900 |
+
<program> Copyright (C) <year> <name of author>
|
| 901 |
+
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
| 902 |
+
This is free software, and you are welcome to redistribute it
|
| 903 |
+
under certain conditions; type `show c' for details.
|
| 904 |
+
|
| 905 |
+
The hypothetical commands `show w' and `show c' should show the appropriate
|
| 906 |
+
parts of the General Public License. Of course, your program's commands
|
| 907 |
+
might be different; for a GUI interface, you would use an "about box".
|
| 908 |
+
|
| 909 |
+
You should also get your employer (if you work as a programmer) or school,
|
| 910 |
+
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
| 911 |
+
For more information on this, and how to apply and follow the GNU GPL, see
|
| 912 |
+
<http://www.gnu.org/licenses/>.
|
| 913 |
+
|
| 914 |
+
The GNU General Public License does not permit incorporating your program
|
| 915 |
+
into proprietary programs. If your program is a subroutine library, you
|
| 916 |
+
may consider it more useful to permit linking proprietary applications with
|
| 917 |
+
the library. If this is what you want to do, use the GNU Lesser General
|
| 918 |
+
Public License instead of this License. But first, please read
|
| 919 |
+
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
| 920 |
+
|
| 921 |
+
|
| 922 |
+
Name: libquadmath
|
| 923 |
+
Files: scipy.libs/libquadmath*.so
|
| 924 |
+
Description: dynamically linked to files compiled with gcc
|
| 925 |
+
Availability: https://gcc.gnu.org/git/?p=gcc.git;a=tree;f=libquadmath
|
| 926 |
+
License: LGPL-2.1-or-later
|
| 927 |
+
|
| 928 |
+
GCC Quad-Precision Math Library
|
| 929 |
+
Copyright (C) 2010-2019 Free Software Foundation, Inc.
|
| 930 |
+
Written by Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
|
| 931 |
+
|
| 932 |
+
This file is part of the libquadmath library.
|
| 933 |
+
Libquadmath is free software; you can redistribute it and/or
|
| 934 |
+
modify it under the terms of the GNU Library General Public
|
| 935 |
+
License as published by the Free Software Foundation; either
|
| 936 |
+
version 2.1 of the License, or (at your option) any later version.
|
| 937 |
+
|
| 938 |
+
Libquadmath is distributed in the hope that it will be useful,
|
| 939 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 940 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
| 941 |
+
Lesser General Public License for more details.
|
| 942 |
+
https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html
|
| 943 |
+
|
| 944 |
+
Classifier: Development Status :: 5 - Production/Stable
|
| 945 |
+
Classifier: Intended Audience :: Science/Research
|
| 946 |
+
Classifier: Intended Audience :: Developers
|
| 947 |
+
Classifier: License :: OSI Approved :: BSD License
|
| 948 |
+
Classifier: Programming Language :: C
|
| 949 |
+
Classifier: Programming Language :: Python
|
| 950 |
+
Classifier: Programming Language :: Python :: 3
|
| 951 |
+
Classifier: Programming Language :: Python :: 3.12
|
| 952 |
+
Classifier: Programming Language :: Python :: 3.13
|
| 953 |
+
Classifier: Programming Language :: Python :: 3.14
|
| 954 |
+
Classifier: Topic :: Software Development :: Libraries
|
| 955 |
+
Classifier: Topic :: Scientific/Engineering
|
| 956 |
+
Classifier: Operating System :: Microsoft :: Windows
|
| 957 |
+
Classifier: Operating System :: POSIX :: Linux
|
| 958 |
+
Classifier: Operating System :: POSIX
|
| 959 |
+
Classifier: Operating System :: Unix
|
| 960 |
+
Classifier: Operating System :: MacOS
|
| 961 |
+
Project-URL: homepage, https://scipy.org/
|
| 962 |
+
Project-URL: documentation, https://docs.scipy.org/doc/scipy/
|
| 963 |
+
Project-URL: source, https://github.com/scipy/scipy
|
| 964 |
+
Project-URL: download, https://github.com/scipy/scipy/releases
|
| 965 |
+
Project-URL: tracker, https://github.com/scipy/scipy/issues
|
| 966 |
+
Requires-Python: >=3.12
|
| 967 |
+
Requires-Dist: numpy<2.8,>=2.0.0
|
| 968 |
+
Provides-Extra: test
|
| 969 |
+
Requires-Dist: pytest>=8.0.0; extra == "test"
|
| 970 |
+
Requires-Dist: pytest-cov; extra == "test"
|
| 971 |
+
Requires-Dist: pytest-timeout; extra == "test"
|
| 972 |
+
Requires-Dist: pytest-xdist; extra == "test"
|
| 973 |
+
Requires-Dist: asv; extra == "test"
|
| 974 |
+
Requires-Dist: mpmath; extra == "test"
|
| 975 |
+
Requires-Dist: gmpy2; extra == "test"
|
| 976 |
+
Requires-Dist: threadpoolctl; extra == "test"
|
| 977 |
+
Requires-Dist: scikit-umfpack; extra == "test"
|
| 978 |
+
Requires-Dist: pooch; extra == "test"
|
| 979 |
+
Requires-Dist: hypothesis>=6.30; extra == "test"
|
| 980 |
+
Requires-Dist: array-api-strict>=2.3.1; extra == "test"
|
| 981 |
+
Requires-Dist: Cython; extra == "test"
|
| 982 |
+
Requires-Dist: meson; extra == "test"
|
| 983 |
+
Requires-Dist: ninja; sys_platform != "emscripten" and extra == "test"
|
| 984 |
+
Requires-Dist: scipy-doctest>=2.0.0; extra == "test"
|
| 985 |
+
Provides-Extra: doc
|
| 986 |
+
Requires-Dist: sphinx<8.2.0,>=5.0.0; extra == "doc"
|
| 987 |
+
Requires-Dist: intersphinx_registry; extra == "doc"
|
| 988 |
+
Requires-Dist: pydata-sphinx-theme>=0.15.2; extra == "doc"
|
| 989 |
+
Requires-Dist: sphinx-copybutton; extra == "doc"
|
| 990 |
+
Requires-Dist: sphinx-design>=0.4.0; extra == "doc"
|
| 991 |
+
Requires-Dist: matplotlib>=3.5; extra == "doc"
|
| 992 |
+
Requires-Dist: numpydoc; extra == "doc"
|
| 993 |
+
Requires-Dist: jupytext; extra == "doc"
|
| 994 |
+
Requires-Dist: myst-nb>=1.2.0; extra == "doc"
|
| 995 |
+
Requires-Dist: pooch; extra == "doc"
|
| 996 |
+
Requires-Dist: jupyterlite-sphinx>=0.19.1; extra == "doc"
|
| 997 |
+
Requires-Dist: jupyterlite-pyodide-kernel; extra == "doc"
|
| 998 |
+
Requires-Dist: linkify-it-py; extra == "doc"
|
| 999 |
+
Requires-Dist: tabulate; extra == "doc"
|
| 1000 |
+
Provides-Extra: dev
|
| 1001 |
+
Requires-Dist: click<8.3.0; extra == "dev"
|
| 1002 |
+
Requires-Dist: spin; extra == "dev"
|
| 1003 |
+
Requires-Dist: mypy==1.19.1; extra == "dev"
|
| 1004 |
+
Requires-Dist: pyrefly==0.63.0; extra == "dev"
|
| 1005 |
+
Requires-Dist: typing_extensions; extra == "dev"
|
| 1006 |
+
Requires-Dist: types-psutil; extra == "dev"
|
| 1007 |
+
Requires-Dist: pycodestyle; extra == "dev"
|
| 1008 |
+
Requires-Dist: ruff>=0.12.0; extra == "dev"
|
| 1009 |
+
Requires-Dist: cython-lint>=0.12.2; extra == "dev"
|
| 1010 |
+
Description-Content-Type: text/x-rst
|
| 1011 |
+
|
| 1012 |
+
.. image:: https://raw.githubusercontent.com/scipy/scipy/main/doc/source/_static/logo.svg
|
| 1013 |
+
:target: https://scipy.org
|
| 1014 |
+
:width: 110
|
| 1015 |
+
:height: 110
|
| 1016 |
+
:align: left
|
| 1017 |
+
|
| 1018 |
+
.. image:: https://img.shields.io/badge/powered%20by-NumFOCUS-orange.svg?style=flat&colorA=E1523D&colorB=007D8A
|
| 1019 |
+
:target: https://numfocus.org
|
| 1020 |
+
|
| 1021 |
+
.. image:: https://img.shields.io/pypi/dm/scipy.svg?label=Pypi%20downloads
|
| 1022 |
+
:target: https://pypi.org/project/scipy/
|
| 1023 |
+
|
| 1024 |
+
.. image:: https://img.shields.io/conda/dn/conda-forge/scipy.svg?label=Conda%20downloads
|
| 1025 |
+
:target: https://anaconda.org/conda-forge/scipy
|
| 1026 |
+
|
| 1027 |
+
.. image:: https://img.shields.io/badge/stackoverflow-Ask%20questions-blue.svg
|
| 1028 |
+
:target: https://stackoverflow.com/questions/tagged/scipy
|
| 1029 |
+
|
| 1030 |
+
.. image:: https://img.shields.io/badge/DOI-10.1038%2Fs41592--019--0686--2-blue.svg
|
| 1031 |
+
:target: https://www.nature.com/articles/s41592-019-0686-2
|
| 1032 |
+
|
| 1033 |
+
.. image:: https://insights.linuxfoundation.org/api/badge/health-score?project=scipy
|
| 1034 |
+
:target: https://insights.linuxfoundation.org/project/scipy
|
| 1035 |
+
|
| 1036 |
+
SciPy (pronounced "Sigh Pie") is an open-source software for mathematics,
|
| 1037 |
+
science, and engineering. It includes modules for statistics, optimization,
|
| 1038 |
+
integration, linear algebra, Fourier transforms, signal and image processing,
|
| 1039 |
+
ODE solvers, and more.
|
| 1040 |
+
|
| 1041 |
+
- **Website:** https://scipy.org
|
| 1042 |
+
- **Documentation:** https://docs.scipy.org/doc/scipy/
|
| 1043 |
+
- **Development version of the documentation:** https://scipy.github.io/devdocs
|
| 1044 |
+
- **SciPy development forum:** https://discuss.scientific-python.org/c/contributor/scipy
|
| 1045 |
+
- **Stack Overflow:** https://stackoverflow.com/questions/tagged/scipy
|
| 1046 |
+
- **Source code:** https://github.com/scipy/scipy
|
| 1047 |
+
- **Contributing:** https://scipy.github.io/devdocs/dev/index.html
|
| 1048 |
+
- **Bug reports:** https://github.com/scipy/scipy/issues
|
| 1049 |
+
- **Code of Conduct:** https://docs.scipy.org/doc/scipy/dev/conduct/code_of_conduct.html
|
| 1050 |
+
- **Report a security vulnerability:** via Tidelift, as explained in
|
| 1051 |
+
`our docs on Security <https://scipy.github.io/devdocs/tutorial/security.html>`__
|
| 1052 |
+
- **Citing in your work:** https://www.scipy.org/citing-scipy/
|
| 1053 |
+
|
| 1054 |
+
SciPy is built to work with
|
| 1055 |
+
NumPy arrays, and provides many user-friendly and efficient numerical routines,
|
| 1056 |
+
such as routines for numerical integration and optimization. Together, they
|
| 1057 |
+
run on all popular operating systems, are quick to install, and are free of
|
| 1058 |
+
charge. NumPy and SciPy are easy to use, but powerful enough to be depended
|
| 1059 |
+
upon by some of the world's leading scientists and engineers. If you need to
|
| 1060 |
+
manipulate numbers on a computer and display or publish the results, give
|
| 1061 |
+
SciPy a try!
|
| 1062 |
+
|
| 1063 |
+
For the installation instructions, see `our install
|
| 1064 |
+
guide <https://scipy.org/install/>`__.
|
| 1065 |
+
|
| 1066 |
+
|
| 1067 |
+
Call for Contributions
|
| 1068 |
+
----------------------
|
| 1069 |
+
|
| 1070 |
+
We appreciate and welcome contributions. Small improvements or fixes are always appreciated; issues labeled as "good
|
| 1071 |
+
first issue" may be a good starting point. Have a look at `our contributing
|
| 1072 |
+
guide <https://scipy.github.io/devdocs/dev/index.html>`__.
|
| 1073 |
+
|
| 1074 |
+
Writing code isn’t the only way to contribute to SciPy. You can also:
|
| 1075 |
+
|
| 1076 |
+
- review pull requests
|
| 1077 |
+
- triage issues
|
| 1078 |
+
- develop tutorials, presentations, and other educational materials
|
| 1079 |
+
- maintain and improve `our website <https://github.com/scipy/scipy.org>`__
|
| 1080 |
+
- develop graphic design for our brand assets and promotional materials
|
| 1081 |
+
- help with outreach and onboard new contributors
|
| 1082 |
+
- write grant proposals and help with other fundraising efforts
|
| 1083 |
+
|
| 1084 |
+
If you’re unsure where to start or how your skills fit in, reach out! You can
|
| 1085 |
+
ask on the `forum <https://discuss.scientific-python.org/c/contributor/scipy>`__
|
| 1086 |
+
or here, on GitHub, by leaving a comment on a relevant issue that is already
|
| 1087 |
+
open.
|
| 1088 |
+
|
| 1089 |
+
If you are new to contributing to open source, `this
|
| 1090 |
+
guide <https://opensource.guide/how-to-contribute/>`__ helps explain why, what,
|
| 1091 |
+
and how to get involved.
|
.cache/pip/http-v2/1/7/9/c/1/179c1c4742bcaf5b6d7af8dc2f14a1b329b9b11f7f5b09e3faa897a1
ADDED
|
Binary file (1.17 kB). View file
|
|
|
.cache/pip/http-v2/1/8/e/c/b/18ecb372789efe49bbe46617b1f5d32a2b0eac245d58cbf930116174
ADDED
|
Binary file (1.17 kB). View file
|
|
|
.cache/pip/http-v2/1/e/b/f/d/1ebfddf16e338050f3c69ee3fb0551055792844fc428979435d11f85
ADDED
|
Binary file (1.17 kB). View file
|
|
|
.cache/pip/http-v2/1/e/b/f/d/1ebfddf16e338050f3c69ee3fb0551055792844fc428979435d11f85.body
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:1f55797419e16e7f30cf88ffb3113ce0467f00cfe3f70d5c281730b21769bfc2
|
| 3 |
+
size 35287115
|
.cache/pip/http-v2/3/3/2/7/a/3327a46f678846be6cb46f3352e6fba668d9664c70a79484c770e358
ADDED
|
Binary file (1.2 kB). View file
|
|
|
.cache/pip/http-v2/3/5/a/0/6/35a0615e0411edd59492c90e8f5cd0a1a0554d6f7d1dec5be2b30560
ADDED
|
Binary file (1.22 kB). View file
|
|
|
.cache/pip/http-v2/3/5/a/0/6/35a0615e0411edd59492c90e8f5cd0a1a0554d6f7d1dec5be2b30560.body
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Metadata-Version: 2.4
|
| 2 |
+
Name: kiwisolver
|
| 3 |
+
Version: 1.5.0
|
| 4 |
+
Summary: A fast implementation of the Cassowary constraint solver
|
| 5 |
+
Author-email: The Nucleic Development Team <sccolbert@gmail.com>
|
| 6 |
+
Maintainer-email: "Matthieu C. Dartiailh" <m.dartiailh@gmail.com>
|
| 7 |
+
License: =========================
|
| 8 |
+
The Kiwi licensing terms
|
| 9 |
+
=========================
|
| 10 |
+
Kiwi is licensed under the terms of the Modified BSD License (also known as
|
| 11 |
+
New or Revised BSD), as follows:
|
| 12 |
+
|
| 13 |
+
Copyright (c) 2013-2026, Nucleic Development Team
|
| 14 |
+
|
| 15 |
+
All rights reserved.
|
| 16 |
+
|
| 17 |
+
Redistribution and use in source and binary forms, with or without
|
| 18 |
+
modification, are permitted provided that the following conditions are met:
|
| 19 |
+
|
| 20 |
+
Redistributions of source code must retain the above copyright notice, this
|
| 21 |
+
list of conditions and the following disclaimer.
|
| 22 |
+
|
| 23 |
+
Redistributions in binary form must reproduce the above copyright notice, this
|
| 24 |
+
list of conditions and the following disclaimer in the documentation and/or
|
| 25 |
+
other materials provided with the distribution.
|
| 26 |
+
|
| 27 |
+
Neither the name of the Nucleic Development Team nor the names of its
|
| 28 |
+
contributors may be used to endorse or promote products derived from this
|
| 29 |
+
software without specific prior written permission.
|
| 30 |
+
|
| 31 |
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
| 32 |
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
| 33 |
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
| 34 |
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
|
| 35 |
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
| 36 |
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
| 37 |
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
| 38 |
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
| 39 |
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| 40 |
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| 41 |
+
|
| 42 |
+
About Kiwi
|
| 43 |
+
----------
|
| 44 |
+
Chris Colbert began the Kiwi project in December 2013 in an effort to
|
| 45 |
+
create a blisteringly fast UI constraint solver. Chris is still the
|
| 46 |
+
project lead.
|
| 47 |
+
|
| 48 |
+
The Nucleic Development Team is the set of all contributors to the Nucleic
|
| 49 |
+
project and its subprojects.
|
| 50 |
+
|
| 51 |
+
The core team that coordinates development on GitHub can be found here:
|
| 52 |
+
http://github.com/nucleic. The current team consists of:
|
| 53 |
+
|
| 54 |
+
* Chris Colbert
|
| 55 |
+
|
| 56 |
+
Our Copyright Policy
|
| 57 |
+
--------------------
|
| 58 |
+
Nucleic uses a shared copyright model. Each contributor maintains copyright
|
| 59 |
+
over their contributions to Nucleic. But, it is important to note that these
|
| 60 |
+
contributions are typically only changes to the repositories. Thus, the Nucleic
|
| 61 |
+
source code, in its entirety is not the copyright of any single person or
|
| 62 |
+
institution. Instead, it is the collective copyright of the entire Nucleic
|
| 63 |
+
Development Team. If individual contributors want to maintain a record of what
|
| 64 |
+
changes/contributions they have specific copyright on, they should indicate
|
| 65 |
+
their copyright in the commit message of the change, when they commit the
|
| 66 |
+
change to one of the Nucleic repositories.
|
| 67 |
+
|
| 68 |
+
With this in mind, the following banner should be used in any source code file
|
| 69 |
+
to indicate the copyright and license terms:
|
| 70 |
+
|
| 71 |
+
#------------------------------------------------------------------------------
|
| 72 |
+
# Copyright (c) 2013-2026, Nucleic Development Team.
|
| 73 |
+
#
|
| 74 |
+
# Distributed under the terms of the Modified BSD License.
|
| 75 |
+
#
|
| 76 |
+
# The full license is in the file LICENSE, distributed with this software.
|
| 77 |
+
#------------------------------------------------------------------------------
|
| 78 |
+
|
| 79 |
+
Project-URL: homepage, https://github.com/nucleic/kiwi
|
| 80 |
+
Project-URL: documentation, https://kiwisolver.readthedocs.io/en/latest/
|
| 81 |
+
Project-URL: repository, https://github.com/nucleic/kiwi
|
| 82 |
+
Project-URL: changelog, https://github.com/nucleic/kiwi/blob/main/releasenotes.rst
|
| 83 |
+
Classifier: License :: OSI Approved :: BSD License
|
| 84 |
+
Classifier: Programming Language :: Python
|
| 85 |
+
Classifier: Programming Language :: Python :: 3
|
| 86 |
+
Classifier: Programming Language :: Python :: 3.10
|
| 87 |
+
Classifier: Programming Language :: Python :: 3.11
|
| 88 |
+
Classifier: Programming Language :: Python :: 3.12
|
| 89 |
+
Classifier: Programming Language :: Python :: 3.13
|
| 90 |
+
Classifier: Programming Language :: Python :: 3.14
|
| 91 |
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
| 92 |
+
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
| 93 |
+
Classifier: Programming Language :: Python :: Implementation :: GraalPy
|
| 94 |
+
Requires-Python: >=3.10
|
| 95 |
+
Description-Content-Type: text/x-rst
|
| 96 |
+
License-File: LICENSE
|
| 97 |
+
Dynamic: license-file
|
.cache/pip/http-v2/3/8/6/0/e/3860e4de9ae53c79d2fd61419e9049df314ccc8b640782c02c6e2e2d
ADDED
|
Binary file (1.9 kB). View file
|
|
|
.cache/pip/http-v2/3/8/6/0/e/3860e4de9ae53c79d2fd61419e9049df314ccc8b640782c02c6e2e2d.body
ADDED
|
Binary file (43.8 kB). View file
|
|
|
.cache/pip/http-v2/3/9/b/0/3/39b032291f3825af700bccccb41d7507c739ba2f89c5bbbc5b7b490d
ADDED
|
Binary file (1.17 kB). View file
|
|
|
.cache/pip/http-v2/3/9/b/0/3/39b032291f3825af700bccccb41d7507c739ba2f89c5bbbc5b7b490d.body
ADDED
|
Binary file (12.2 kB). View file
|
|
|
.cache/pip/http-v2/6/4/2/d/4/642d4b6a48573d7d40bd54626ef2bb21e5059817d13c7487dcfea9fd
ADDED
|
Binary file (1.24 kB). View file
|
|
|
.cache/pip/http-v2/6/4/2/d/4/642d4b6a48573d7d40bd54626ef2bb21e5059817d13c7487dcfea9fd.body
ADDED
|
@@ -0,0 +1,1600 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Metadata-Version: 2.4
|
| 2 |
+
Name: tqdm
|
| 3 |
+
Version: 4.69.0
|
| 4 |
+
Summary: Fast, Extensible Progress Meter
|
| 5 |
+
Maintainer-email: tqdm developers <devs@tqdm.ml>
|
| 6 |
+
License: MPL-2.0 AND MIT
|
| 7 |
+
Project-URL: homepage, https://tqdm.github.io
|
| 8 |
+
Project-URL: repository, https://github.com/tqdm/tqdm
|
| 9 |
+
Project-URL: changelog, https://tqdm.github.io/releases
|
| 10 |
+
Project-URL: wiki, https://github.com/tqdm/tqdm/wiki
|
| 11 |
+
Keywords: progressbar,progressmeter,progress,bar,meter,rate,eta,console,terminal,time
|
| 12 |
+
Classifier: Development Status :: 5 - Production/Stable
|
| 13 |
+
Classifier: Environment :: Console
|
| 14 |
+
Classifier: Environment :: MacOS X
|
| 15 |
+
Classifier: Environment :: Other Environment
|
| 16 |
+
Classifier: Environment :: Win32 (MS Windows)
|
| 17 |
+
Classifier: Environment :: X11 Applications
|
| 18 |
+
Classifier: Framework :: IPython
|
| 19 |
+
Classifier: Framework :: Jupyter
|
| 20 |
+
Classifier: Intended Audience :: Developers
|
| 21 |
+
Classifier: Intended Audience :: Education
|
| 22 |
+
Classifier: Intended Audience :: End Users/Desktop
|
| 23 |
+
Classifier: Intended Audience :: Other Audience
|
| 24 |
+
Classifier: Intended Audience :: System Administrators
|
| 25 |
+
Classifier: Operating System :: MacOS
|
| 26 |
+
Classifier: Operating System :: MacOS :: MacOS X
|
| 27 |
+
Classifier: Operating System :: Microsoft
|
| 28 |
+
Classifier: Operating System :: Microsoft :: MS-DOS
|
| 29 |
+
Classifier: Operating System :: Microsoft :: Windows
|
| 30 |
+
Classifier: Operating System :: POSIX
|
| 31 |
+
Classifier: Operating System :: POSIX :: BSD
|
| 32 |
+
Classifier: Operating System :: POSIX :: BSD :: FreeBSD
|
| 33 |
+
Classifier: Operating System :: POSIX :: Linux
|
| 34 |
+
Classifier: Operating System :: POSIX :: SunOS/Solaris
|
| 35 |
+
Classifier: Operating System :: Unix
|
| 36 |
+
Classifier: Programming Language :: Python
|
| 37 |
+
Classifier: Programming Language :: Python :: 3
|
| 38 |
+
Classifier: Programming Language :: Python :: 3.8
|
| 39 |
+
Classifier: Programming Language :: Python :: 3.9
|
| 40 |
+
Classifier: Programming Language :: Python :: 3.10
|
| 41 |
+
Classifier: Programming Language :: Python :: 3.11
|
| 42 |
+
Classifier: Programming Language :: Python :: 3.12
|
| 43 |
+
Classifier: Programming Language :: Python :: 3.13
|
| 44 |
+
Classifier: Programming Language :: Python :: 3.14
|
| 45 |
+
Classifier: Programming Language :: Python :: 3 :: Only
|
| 46 |
+
Classifier: Programming Language :: Python :: Implementation
|
| 47 |
+
Classifier: Programming Language :: Python :: Implementation :: IronPython
|
| 48 |
+
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
| 49 |
+
Classifier: Programming Language :: Unix Shell
|
| 50 |
+
Classifier: Topic :: Desktop Environment
|
| 51 |
+
Classifier: Topic :: Education :: Computer Aided Instruction (CAI)
|
| 52 |
+
Classifier: Topic :: Education :: Testing
|
| 53 |
+
Classifier: Topic :: Office/Business
|
| 54 |
+
Classifier: Topic :: Other/Nonlisted Topic
|
| 55 |
+
Classifier: Topic :: Software Development :: Build Tools
|
| 56 |
+
Classifier: Topic :: Software Development :: Libraries
|
| 57 |
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
| 58 |
+
Classifier: Topic :: Software Development :: Pre-processors
|
| 59 |
+
Classifier: Topic :: Software Development :: User Interfaces
|
| 60 |
+
Classifier: Topic :: System :: Installation/Setup
|
| 61 |
+
Classifier: Topic :: System :: Logging
|
| 62 |
+
Classifier: Topic :: System :: Monitoring
|
| 63 |
+
Classifier: Topic :: System :: Shells
|
| 64 |
+
Classifier: Topic :: Terminals
|
| 65 |
+
Classifier: Topic :: Utilities
|
| 66 |
+
Requires-Python: >=3.8
|
| 67 |
+
Description-Content-Type: text/x-rst
|
| 68 |
+
License-File: LICENCE
|
| 69 |
+
Requires-Dist: colorama; platform_system == "Windows"
|
| 70 |
+
Provides-Extra: discord
|
| 71 |
+
Requires-Dist: requests; extra == "discord"
|
| 72 |
+
Requires-Dist: envwrap; extra == "discord"
|
| 73 |
+
Provides-Extra: slack
|
| 74 |
+
Requires-Dist: slack-sdk; extra == "slack"
|
| 75 |
+
Requires-Dist: envwrap; extra == "slack"
|
| 76 |
+
Provides-Extra: telegram
|
| 77 |
+
Requires-Dist: requests; extra == "telegram"
|
| 78 |
+
Requires-Dist: envwrap; extra == "telegram"
|
| 79 |
+
Provides-Extra: notebook
|
| 80 |
+
Requires-Dist: ipywidgets>=6; extra == "notebook"
|
| 81 |
+
Dynamic: license-file
|
| 82 |
+
|
| 83 |
+
|Logo|
|
| 84 |
+
|
| 85 |
+
tqdm
|
| 86 |
+
====
|
| 87 |
+
|
| 88 |
+
|Py-Versions| |Versions| |Conda-Forge-Status| |Docker| |Snapcraft|
|
| 89 |
+
|
| 90 |
+
|Build-Status| |Coverage-Status| |Branch-Coverage-Status| |Codacy-Grade| |Libraries-Rank| |PyPI-Downloads|
|
| 91 |
+
|
| 92 |
+
|LICENCE| |OpenHub-Status| |colab-demo| |binder-demo| |awesome-python|
|
| 93 |
+
|
| 94 |
+
``tqdm`` derives from the Arabic word *taqaddum* (تقدّم) which can mean "progress,"
|
| 95 |
+
and is an abbreviation for "I love you so much" in Spanish (*te quiero demasiado*).
|
| 96 |
+
|
| 97 |
+
Instantly make your loops show a smart progress meter - just wrap any
|
| 98 |
+
iterable with ``tqdm(iterable)``, and you're done!
|
| 99 |
+
|
| 100 |
+
.. code:: python
|
| 101 |
+
|
| 102 |
+
from tqdm import tqdm
|
| 103 |
+
for i in tqdm(range(10000)):
|
| 104 |
+
...
|
| 105 |
+
|
| 106 |
+
``76%|████████████████████████ | 7568/10000 [00:33<00:10, 229.00it/s]``
|
| 107 |
+
|
| 108 |
+
``trange(N)`` can be also used as a convenient shortcut for
|
| 109 |
+
``tqdm(range(N))``.
|
| 110 |
+
|
| 111 |
+
|Screenshot|
|
| 112 |
+
|Video| |Slides| |Merch|
|
| 113 |
+
|
| 114 |
+
It can also be executed as a module with pipes:
|
| 115 |
+
|
| 116 |
+
.. code:: sh
|
| 117 |
+
|
| 118 |
+
$ seq 9999999 | tqdm --bytes | wc -l
|
| 119 |
+
75.2MB [00:00, 217MB/s]
|
| 120 |
+
9999999
|
| 121 |
+
|
| 122 |
+
$ tar -zcf - docs/ | tqdm --bytes --total `du -sb docs/ | cut -f1` \
|
| 123 |
+
> backup.tgz
|
| 124 |
+
32%|██████████▍ | 8.89G/27.9G [00:42<01:31, 223MB/s]
|
| 125 |
+
|
| 126 |
+
Overhead is low -- about 60ns per iteration (80ns with ``tqdm.gui``), and is
|
| 127 |
+
unit tested against performance regression.
|
| 128 |
+
By comparison, the well-established
|
| 129 |
+
`ProgressBar <https://github.com/niltonvolpato/python-progressbar>`__ has
|
| 130 |
+
an 800ns/iter overhead.
|
| 131 |
+
|
| 132 |
+
In addition to its low overhead, ``tqdm`` uses smart algorithms to predict
|
| 133 |
+
the remaining time and to skip unnecessary iteration displays, which allows
|
| 134 |
+
for a negligible overhead in most cases.
|
| 135 |
+
|
| 136 |
+
``tqdm`` works on any platform
|
| 137 |
+
(Linux, Windows, Mac, FreeBSD, NetBSD, Solaris/SunOS),
|
| 138 |
+
in any console or in a GUI, and is also friendly with IPython/Jupyter notebooks.
|
| 139 |
+
|
| 140 |
+
``tqdm`` does not require any dependencies (not even ``curses``!), just
|
| 141 |
+
Python and an environment supporting ``carriage return \r`` and
|
| 142 |
+
``line feed \n`` control characters.
|
| 143 |
+
|
| 144 |
+
**Featured Sponsors**
|
| 145 |
+
|
| 146 |
+
======== ================================================
|
| 147 |
+
|OpenAI| Your Logo Here
|
| 148 |
+
======== ================================================
|
| 149 |
+
OpenAI `Sponsors <https://github.com/sponsors/tqdm>`__
|
| 150 |
+
======== ================================================
|
| 151 |
+
|
| 152 |
+
.. |OpenAI| image:: https://avatars.githubusercontent.com/u/14957082?s=96
|
| 153 |
+
:target: https://openai.com
|
| 154 |
+
|
| 155 |
+
------------------------------------------
|
| 156 |
+
|
| 157 |
+
.. contents:: Table of contents
|
| 158 |
+
:backlinks: top
|
| 159 |
+
:local:
|
| 160 |
+
|
| 161 |
+
|
| 162 |
+
Installation
|
| 163 |
+
------------
|
| 164 |
+
|
| 165 |
+
Latest PyPI stable release
|
| 166 |
+
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
| 167 |
+
|
| 168 |
+
|Versions| |PyPI-Downloads| |Libraries-Dependents|
|
| 169 |
+
|
| 170 |
+
.. code:: sh
|
| 171 |
+
|
| 172 |
+
pip install tqdm
|
| 173 |
+
|
| 174 |
+
Latest development release on GitHub
|
| 175 |
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
| 176 |
+
|
| 177 |
+
|GitHub-Status| |GitHub-Stars| |GitHub-Commits| |GitHub-Forks| |GitHub-Updated|
|
| 178 |
+
|
| 179 |
+
Pull and install pre-release ``devel`` branch:
|
| 180 |
+
|
| 181 |
+
.. code:: sh
|
| 182 |
+
|
| 183 |
+
pip install "git+https://github.com/tqdm/tqdm.git@devel#egg=tqdm"
|
| 184 |
+
|
| 185 |
+
Latest Conda release
|
| 186 |
+
~~~~~~~~~~~~~~~~~~~~
|
| 187 |
+
|
| 188 |
+
|Conda-Forge-Status|
|
| 189 |
+
|
| 190 |
+
.. code:: sh
|
| 191 |
+
|
| 192 |
+
conda install -c conda-forge tqdm
|
| 193 |
+
|
| 194 |
+
Latest Snapcraft release
|
| 195 |
+
~~~~~~~~~~~~~~~~~~~~~~~~
|
| 196 |
+
|
| 197 |
+
|Snapcraft|
|
| 198 |
+
|
| 199 |
+
There are 3 channels to choose from:
|
| 200 |
+
|
| 201 |
+
.. code:: sh
|
| 202 |
+
|
| 203 |
+
snap install tqdm # implies --stable, i.e. latest tagged release
|
| 204 |
+
snap install tqdm --candidate # master branch
|
| 205 |
+
snap install tqdm --edge # devel branch
|
| 206 |
+
|
| 207 |
+
Note that ``snap`` binaries are purely for CLI use (not ``import``-able), and
|
| 208 |
+
automatically set up ``bash`` tab-completion.
|
| 209 |
+
|
| 210 |
+
Latest Docker release
|
| 211 |
+
~~~~~~~~~~~~~~~~~~~~~
|
| 212 |
+
|
| 213 |
+
|Docker|
|
| 214 |
+
|
| 215 |
+
.. code:: sh
|
| 216 |
+
|
| 217 |
+
docker pull tqdm/tqdm
|
| 218 |
+
docker run -i --rm tqdm/tqdm --help
|
| 219 |
+
|
| 220 |
+
Other
|
| 221 |
+
~~~~~
|
| 222 |
+
|
| 223 |
+
There are other (unofficial) places where ``tqdm`` may be downloaded, particularly for CLI use:
|
| 224 |
+
|
| 225 |
+
|Repology|
|
| 226 |
+
|
| 227 |
+
.. |Repology| image:: https://repology.org/badge/tiny-repos/python:tqdm.svg
|
| 228 |
+
:target: https://repology.org/project/python:tqdm/versions
|
| 229 |
+
|
| 230 |
+
Changelog
|
| 231 |
+
---------
|
| 232 |
+
|
| 233 |
+
The list of all changes is available either on GitHub's Releases:
|
| 234 |
+
|GitHub-Status|, on the
|
| 235 |
+
`wiki <https://github.com/tqdm/tqdm/wiki/Releases>`__, or on the
|
| 236 |
+
`website <https://tqdm.github.io/releases>`__.
|
| 237 |
+
|
| 238 |
+
|
| 239 |
+
Usage
|
| 240 |
+
-----
|
| 241 |
+
|
| 242 |
+
``tqdm`` is very versatile and can be used in a number of ways.
|
| 243 |
+
The three main ones are given below.
|
| 244 |
+
|
| 245 |
+
Iterable-based
|
| 246 |
+
~~~~~~~~~~~~~~
|
| 247 |
+
|
| 248 |
+
Wrap ``tqdm()`` around any iterable:
|
| 249 |
+
|
| 250 |
+
.. code:: python
|
| 251 |
+
|
| 252 |
+
from tqdm import tqdm
|
| 253 |
+
from time import sleep
|
| 254 |
+
|
| 255 |
+
text = ""
|
| 256 |
+
for char in tqdm(["a", "b", "c", "d"]):
|
| 257 |
+
sleep(0.25)
|
| 258 |
+
text = text + char
|
| 259 |
+
|
| 260 |
+
``trange(i)`` is a special optimised instance of ``tqdm(range(i))``:
|
| 261 |
+
|
| 262 |
+
.. code:: python
|
| 263 |
+
|
| 264 |
+
from tqdm import trange
|
| 265 |
+
|
| 266 |
+
for i in trange(100):
|
| 267 |
+
sleep(0.01)
|
| 268 |
+
|
| 269 |
+
Instantiation outside of the loop allows for manual control over ``tqdm()``:
|
| 270 |
+
|
| 271 |
+
.. code:: python
|
| 272 |
+
|
| 273 |
+
pbar = tqdm(["a", "b", "c", "d"])
|
| 274 |
+
for char in pbar:
|
| 275 |
+
sleep(0.25)
|
| 276 |
+
pbar.set_description("Processing %s" % char)
|
| 277 |
+
|
| 278 |
+
Manual
|
| 279 |
+
~~~~~~
|
| 280 |
+
|
| 281 |
+
Manual control of ``tqdm()`` updates using a ``with`` statement:
|
| 282 |
+
|
| 283 |
+
.. code:: python
|
| 284 |
+
|
| 285 |
+
with tqdm(total=100) as pbar:
|
| 286 |
+
for i in range(10):
|
| 287 |
+
sleep(0.1)
|
| 288 |
+
pbar.update(10)
|
| 289 |
+
|
| 290 |
+
If the optional variable ``total`` (or an iterable with ``len()``) is
|
| 291 |
+
provided, predictive stats are displayed.
|
| 292 |
+
|
| 293 |
+
``with`` is also optional (you can just assign ``tqdm()`` to a variable,
|
| 294 |
+
but in this case don't forget to ``del`` or ``close()`` at the end:
|
| 295 |
+
|
| 296 |
+
.. code:: python
|
| 297 |
+
|
| 298 |
+
pbar = tqdm(total=100)
|
| 299 |
+
for i in range(10):
|
| 300 |
+
sleep(0.1)
|
| 301 |
+
pbar.update(10)
|
| 302 |
+
pbar.close()
|
| 303 |
+
|
| 304 |
+
Module
|
| 305 |
+
~~~~~~
|
| 306 |
+
|
| 307 |
+
Perhaps the most wonderful use of ``tqdm`` is in a script or on the command
|
| 308 |
+
line. Simply inserting ``tqdm`` (or ``python -m tqdm``) between pipes will pass
|
| 309 |
+
through all ``stdin`` to ``stdout`` while printing progress to ``stderr``.
|
| 310 |
+
|
| 311 |
+
The example below demonstrate counting the number of lines in all Python files
|
| 312 |
+
in the current directory, with timing information included.
|
| 313 |
+
|
| 314 |
+
.. code:: sh
|
| 315 |
+
|
| 316 |
+
$ time find . -name '*.py' -type f -exec cat \{} \; | wc -l
|
| 317 |
+
857365
|
| 318 |
+
|
| 319 |
+
real 0m3.458s
|
| 320 |
+
user 0m0.274s
|
| 321 |
+
sys 0m3.325s
|
| 322 |
+
|
| 323 |
+
$ time find . -name '*.py' -type f -exec cat \{} \; | tqdm | wc -l
|
| 324 |
+
857366it [00:03, 246471.31it/s]
|
| 325 |
+
857365
|
| 326 |
+
|
| 327 |
+
real 0m3.585s
|
| 328 |
+
user 0m0.862s
|
| 329 |
+
sys 0m3.358s
|
| 330 |
+
|
| 331 |
+
Note that the usual arguments for ``tqdm`` can also be specified.
|
| 332 |
+
|
| 333 |
+
.. code:: sh
|
| 334 |
+
|
| 335 |
+
$ find . -name '*.py' -type f -exec cat \{} \; |
|
| 336 |
+
tqdm --unit loc --unit_scale --total 857366 >> /dev/null
|
| 337 |
+
100%|█████████████████████████████████| 857K/857K [00:04<00:00, 246Kloc/s]
|
| 338 |
+
|
| 339 |
+
Backing up a large directory?
|
| 340 |
+
|
| 341 |
+
.. code:: sh
|
| 342 |
+
|
| 343 |
+
$ tar -zcf - docs/ | tqdm --bytes --total `du -sb docs/ | cut -f1` \
|
| 344 |
+
> backup.tgz
|
| 345 |
+
44%|██████████████▊ | 153M/352M [00:14<00:18, 11.0MB/s]
|
| 346 |
+
|
| 347 |
+
This can be beautified further:
|
| 348 |
+
|
| 349 |
+
.. code:: sh
|
| 350 |
+
|
| 351 |
+
$ BYTES=$(du -sb docs/ | cut -f1)
|
| 352 |
+
$ tar -cf - docs/ \
|
| 353 |
+
| tqdm --bytes --total "$BYTES" --desc Processing | gzip \
|
| 354 |
+
| tqdm --bytes --total "$BYTES" --desc Compressed --position 1 \
|
| 355 |
+
> ~/backup.tgz
|
| 356 |
+
Processing: 100%|██████████████████████| 352M/352M [00:14<00:00, 30.2MB/s]
|
| 357 |
+
Compressed: 42%|█████████▎ | 148M/352M [00:14<00:19, 10.9MB/s]
|
| 358 |
+
|
| 359 |
+
Or done on a file level using 7-zip:
|
| 360 |
+
|
| 361 |
+
.. code:: sh
|
| 362 |
+
|
| 363 |
+
$ 7z a -bd -r backup.7z docs/ | grep Compressing \
|
| 364 |
+
| tqdm --total $(find docs/ -type f | wc -l) --unit files \
|
| 365 |
+
| grep -v Compressing
|
| 366 |
+
100%|██████████████████████████▉| 15327/15327 [01:00<00:00, 712.96files/s]
|
| 367 |
+
|
| 368 |
+
Pre-existing CLI programs already outputting basic progress information will
|
| 369 |
+
benefit from ``tqdm``'s ``--update`` and ``--update_to`` flags:
|
| 370 |
+
|
| 371 |
+
.. code:: sh
|
| 372 |
+
|
| 373 |
+
$ seq 3 0.1 5 | tqdm --total 5 --update_to --null
|
| 374 |
+
100%|████████████████████████████████████| 5.0/5 [00:00<00:00, 9673.21it/s]
|
| 375 |
+
$ seq 10 | tqdm --update --null # 1 + 2 + ... + 10 = 55 iterations
|
| 376 |
+
55it [00:00, 90006.52it/s]
|
| 377 |
+
|
| 378 |
+
FAQ and Known Issues
|
| 379 |
+
--------------------
|
| 380 |
+
|
| 381 |
+
|GitHub-Issues|
|
| 382 |
+
|
| 383 |
+
The most common issues relate to excessive output on multiple lines, instead
|
| 384 |
+
of a neat one-line progress bar.
|
| 385 |
+
|
| 386 |
+
- Consoles in general: require support for carriage return (``CR``, ``\r``).
|
| 387 |
+
|
| 388 |
+
* Some cloud logging consoles which don't support ``\r`` properly
|
| 389 |
+
(`cloudwatch <https://github.com/tqdm/tqdm/issues/966>`__,
|
| 390 |
+
`K8s <https://github.com/tqdm/tqdm/issues/1319>`__) may benefit from
|
| 391 |
+
``export TQDM_POSITION=-1``.
|
| 392 |
+
|
| 393 |
+
- Nested progress bars:
|
| 394 |
+
|
| 395 |
+
* Consoles in general: require support for moving cursors up to the
|
| 396 |
+
previous line. For example,
|
| 397 |
+
`IDLE <https://github.com/tqdm/tqdm/issues/191#issuecomment-230168030>`__,
|
| 398 |
+
`ConEmu <https://github.com/tqdm/tqdm/issues/254>`__ and
|
| 399 |
+
`PyCharm <https://github.com/tqdm/tqdm/issues/203>`__ (also
|
| 400 |
+
`here <https://github.com/tqdm/tqdm/issues/208>`__,
|
| 401 |
+
`here <https://github.com/tqdm/tqdm/issues/307>`__, and
|
| 402 |
+
`here <https://github.com/tqdm/tqdm/issues/454#issuecomment-335416815>`__)
|
| 403 |
+
lack full support.
|
| 404 |
+
* Windows: additionally may require the Python module ``colorama``
|
| 405 |
+
to ensure nested bars stay within their respective lines.
|
| 406 |
+
|
| 407 |
+
- Unicode:
|
| 408 |
+
|
| 409 |
+
* Environments which report that they support unicode will have solid smooth
|
| 410 |
+
progress bars. The fallback is an ``ascii``-only bar.
|
| 411 |
+
* Windows consoles often only partially support unicode and thus
|
| 412 |
+
`often require explicit ascii=True <https://github.com/tqdm/tqdm/issues/454#issuecomment-335416815>`__
|
| 413 |
+
(also `here <https://github.com/tqdm/tqdm/issues/499>`__). This is due to
|
| 414 |
+
either normal-width unicode characters being incorrectly displayed as
|
| 415 |
+
"wide", or some unicode characters not rendering.
|
| 416 |
+
|
| 417 |
+
- Wrapping generators:
|
| 418 |
+
|
| 419 |
+
* Generator wrapper functions tend to hide the length of iterables.
|
| 420 |
+
``tqdm`` does not.
|
| 421 |
+
* Replace ``tqdm(enumerate(...))`` with ``enumerate(tqdm(...))`` or
|
| 422 |
+
``tqdm(enumerate(x), total=len(x), ...)``.
|
| 423 |
+
The same applies to ``numpy.ndenumerate``.
|
| 424 |
+
* Replace ``tqdm(zip(a, b))`` with ``zip(tqdm(a), b)`` or even
|
| 425 |
+
``zip(tqdm(a), tqdm(b))``.
|
| 426 |
+
* The same applies to ``itertools``.
|
| 427 |
+
* Some useful convenience functions can be found under ``tqdm.contrib``.
|
| 428 |
+
|
| 429 |
+
- `No intermediate output in docker-compose <https://github.com/tqdm/tqdm/issues/771>`__:
|
| 430 |
+
use ``docker-compose run`` instead of ``docker-compose up`` and ``tty: true``.
|
| 431 |
+
|
| 432 |
+
- Overriding defaults via environment variables:
|
| 433 |
+
e.g. in CI/cloud jobs, ``export TQDM_MININTERVAL=5`` to avoid log spam.
|
| 434 |
+
This override logic is handled by the ``tqdm.utils.envwrap`` decorator
|
| 435 |
+
(useful independent of ``tqdm``).
|
| 436 |
+
|
| 437 |
+
If you come across any other difficulties, browse and file |GitHub-Issues|.
|
| 438 |
+
|
| 439 |
+
Documentation
|
| 440 |
+
-------------
|
| 441 |
+
|
| 442 |
+
|Py-Versions| |README-Hits| (Since 19 May 2016)
|
| 443 |
+
|
| 444 |
+
.. code:: python
|
| 445 |
+
|
| 446 |
+
class tqdm():
|
| 447 |
+
"""
|
| 448 |
+
Decorate an iterable object, returning an iterator which acts exactly
|
| 449 |
+
like the original iterable, but prints a dynamically updating
|
| 450 |
+
progress bar every time a value is requested.
|
| 451 |
+
"""
|
| 452 |
+
|
| 453 |
+
@envwrap("tqdm") # override defaults via env vars
|
| 454 |
+
def __init__(self, iterable=None, desc=None, total=None, leave=True,
|
| 455 |
+
file=None, ncols=None, mininterval=0.1,
|
| 456 |
+
maxinterval=10.0, miniters=None, ascii=None, disable=False,
|
| 457 |
+
unit='it', unit_scale=False, dynamic_ncols=False,
|
| 458 |
+
smoothing=0.3, bar_format=None, initial=0, position=None,
|
| 459 |
+
postfix=None, unit_divisor=1000, write_bytes=False,
|
| 460 |
+
lock_args=None, nrows=None, colour=None, delay=0):
|
| 461 |
+
|
| 462 |
+
Parameters
|
| 463 |
+
~~~~~~~~~~
|
| 464 |
+
|
| 465 |
+
* iterable : iterable, optional
|
| 466 |
+
Iterable to decorate with a progress bar.
|
| 467 |
+
Leave blank to manually manage the updates.
|
| 468 |
+
* desc : str, optional
|
| 469 |
+
Prefix for the progress bar.
|
| 470 |
+
* total : int or float, optional
|
| 471 |
+
The number of expected iterations. If unspecified,
|
| 472 |
+
len(iterable) is used if possible. If float("inf") or as a last
|
| 473 |
+
resort, only basic progress statistics are displayed
|
| 474 |
+
(no ETA, no progress bar).
|
| 475 |
+
If ``gui`` is True and this parameter needs subsequent updating,
|
| 476 |
+
specify an initial arbitrary large positive number,
|
| 477 |
+
e.g. 9e9.
|
| 478 |
+
* leave : bool, optional
|
| 479 |
+
If [default: True], keeps all traces of the progress bar
|
| 480 |
+
upon termination of iteration.
|
| 481 |
+
If ``None``, will leave only if ``position`` is ``0``.
|
| 482 |
+
* file : ``io.TextIOWrapper`` or ``io.StringIO``, optional
|
| 483 |
+
Specifies where to output the progress messages
|
| 484 |
+
(default: sys.stderr). Uses ``file.write(str)`` and ``file.flush()``
|
| 485 |
+
methods. For encoding, see ``write_bytes``.
|
| 486 |
+
* ncols : int, optional
|
| 487 |
+
The width of the entire output message. If specified,
|
| 488 |
+
dynamically resizes the progress bar to stay within this bound.
|
| 489 |
+
If unspecified, attempts to use environment width. The
|
| 490 |
+
fallback is a meter width of 10 and no limit for the counter and
|
| 491 |
+
statistics. If 0, will not print any meter (only stats).
|
| 492 |
+
* mininterval : float, optional
|
| 493 |
+
Minimum progress display update interval [default: 0.1] seconds.
|
| 494 |
+
* maxinterval : float, optional
|
| 495 |
+
Maximum progress display update interval [default: 10] seconds.
|
| 496 |
+
Automatically adjusts ``miniters`` to correspond to ``mininterval``
|
| 497 |
+
after long display update lag. Only works if ``dynamic_miniters``
|
| 498 |
+
or monitor thread is enabled.
|
| 499 |
+
* miniters : int or float, optional
|
| 500 |
+
Minimum progress display update interval, in iterations.
|
| 501 |
+
If 0 and ``dynamic_miniters``, will automatically adjust to equal
|
| 502 |
+
``mininterval`` (more CPU efficient, good for tight loops).
|
| 503 |
+
If > 0, will skip display of specified number of iterations.
|
| 504 |
+
Tweak this and ``mininterval`` to get very efficient loops.
|
| 505 |
+
If your progress is erratic with both fast and slow iterations
|
| 506 |
+
(network, skipping items, etc) you should set miniters=1.
|
| 507 |
+
* ascii : bool or str, optional
|
| 508 |
+
If unspecified or False, use unicode (smooth blocks) to fill
|
| 509 |
+
the meter. The fallback is to use ASCII characters " 123456789#".
|
| 510 |
+
* disable : bool, optional
|
| 511 |
+
Whether to disable the entire progress bar wrapper
|
| 512 |
+
[default: False]. If set to None, disable on non-TTY.
|
| 513 |
+
* unit : str, optional
|
| 514 |
+
String that will be used to define the unit of each iteration
|
| 515 |
+
[default: it].
|
| 516 |
+
* unit_scale : bool or int or float, optional
|
| 517 |
+
If 1 or True, the number of iterations will be reduced/scaled
|
| 518 |
+
automatically and a metric prefix following the
|
| 519 |
+
International System of Units standard will be added
|
| 520 |
+
(kilo, mega, etc.) [default: False]. If any other non-zero
|
| 521 |
+
number, will scale ``total`` and ``n``.
|
| 522 |
+
* dynamic_ncols : bool, optional
|
| 523 |
+
If set, constantly alters ``ncols`` and ``nrows`` to the
|
| 524 |
+
environment (allowing for window resizes) [default: False].
|
| 525 |
+
* smoothing : float, optional
|
| 526 |
+
Exponential moving average smoothing factor for speed estimates
|
| 527 |
+
(ignored in GUI mode). Ranges from 0 (average speed) to 1
|
| 528 |
+
(current/instantaneous speed) [default: 0.3].
|
| 529 |
+
* bar_format : str, optional
|
| 530 |
+
Specify a custom bar string formatting. May impact performance.
|
| 531 |
+
[default: '{l_bar}{bar}{r_bar}'], where
|
| 532 |
+
l_bar='{desc}: {percentage:3.0f}%|' and
|
| 533 |
+
r_bar='| {n_fmt}/{total_fmt} [{elapsed}<{remaining}, '
|
| 534 |
+
'{rate_fmt}{postfix}]'
|
| 535 |
+
Possible vars: l_bar, bar, r_bar, n, n_fmt, total, total_fmt,
|
| 536 |
+
percentage, elapsed, elapsed_s, ncols, nrows, desc, unit,
|
| 537 |
+
rate, rate_fmt, rate_noinv, rate_noinv_fmt,
|
| 538 |
+
rate_inv, rate_inv_fmt, postfix, unit_divisor,
|
| 539 |
+
remaining, remaining_s, eta.
|
| 540 |
+
Note that a trailing ": " is automatically removed after {desc}
|
| 541 |
+
if the latter is empty.
|
| 542 |
+
* initial : int or float, optional
|
| 543 |
+
The initial counter value. Useful when restarting a progress
|
| 544 |
+
bar [default: 0]. If using float, consider specifying ``{n:.3f}``
|
| 545 |
+
or similar in ``bar_format``, or specifying ``unit_scale``.
|
| 546 |
+
* position : int, optional
|
| 547 |
+
Specify the line offset to print this bar (starting from 0)
|
| 548 |
+
Automatic if unspecified.
|
| 549 |
+
Useful to manage multiple bars at once (eg, from threads).
|
| 550 |
+
* postfix : dict or ``*``, optional
|
| 551 |
+
Specify additional stats to display at the end of the bar.
|
| 552 |
+
Calls ``set_postfix(**postfix)`` if possible (dict).
|
| 553 |
+
* unit_divisor : float, optional
|
| 554 |
+
[default: 1000], ignored unless ``unit_scale`` is True.
|
| 555 |
+
* write_bytes : bool, optional
|
| 556 |
+
Whether to write bytes. If (default: False) will write unicode.
|
| 557 |
+
* lock_args : tuple, optional
|
| 558 |
+
Passed to ``refresh`` for intermediate output
|
| 559 |
+
(initialisation, iterating, and updating).
|
| 560 |
+
* nrows : int, optional
|
| 561 |
+
The screen height. If specified, hides nested bars outside this
|
| 562 |
+
bound. If unspecified, attempts to use environment height.
|
| 563 |
+
The fallback is 20.
|
| 564 |
+
* colour : str, optional
|
| 565 |
+
Bar colour (e.g. 'green', '#00ff00').
|
| 566 |
+
* delay : float, optional
|
| 567 |
+
Don't display until [default: 0] seconds have elapsed.
|
| 568 |
+
|
| 569 |
+
Extra CLI Options
|
| 570 |
+
~~~~~~~~~~~~~~~~~
|
| 571 |
+
|
| 572 |
+
* delim : chr, optional
|
| 573 |
+
Delimiting character [default: '\n']. Use '\0' for null.
|
| 574 |
+
N.B.: on Windows systems, Python converts '\n' to '\r\n'.
|
| 575 |
+
* buf_size : int, optional
|
| 576 |
+
String buffer size in bytes [default: 256]
|
| 577 |
+
used when ``delim`` is specified.
|
| 578 |
+
* bytes : bool, optional
|
| 579 |
+
If true, will count bytes, ignore ``delim``, and default
|
| 580 |
+
``unit_scale`` to True, ``unit_divisor`` to 1024, and ``unit`` to 'B'.
|
| 581 |
+
* tee : bool, optional
|
| 582 |
+
If true, passes ``stdin`` to both ``stderr`` and ``stdout``.
|
| 583 |
+
* update : bool, optional
|
| 584 |
+
If true, will treat input as newly elapsed iterations,
|
| 585 |
+
i.e. numbers to pass to ``update()``. Note that this is slow
|
| 586 |
+
(~2e5 it/s) since every input must be decoded as a number.
|
| 587 |
+
* update_to : bool, optional
|
| 588 |
+
If true, will treat input as total elapsed iterations,
|
| 589 |
+
i.e. numbers to assign to ``self.n``. Note that this is slow
|
| 590 |
+
(~2e5 it/s) since every input must be decoded as a number.
|
| 591 |
+
* null : bool, optional
|
| 592 |
+
If true, will discard input (no stdout).
|
| 593 |
+
* manpath : str, optional
|
| 594 |
+
Directory in which to install tqdm man pages.
|
| 595 |
+
* comppath : str, optional
|
| 596 |
+
Directory in which to place tqdm completion.
|
| 597 |
+
* log : str, optional
|
| 598 |
+
CRITICAL|FATAL|ERROR|WARN(ING)|[default: 'INFO']|DEBUG|NOTSET.
|
| 599 |
+
|
| 600 |
+
Returns
|
| 601 |
+
~~~~~~~
|
| 602 |
+
|
| 603 |
+
* out : decorated iterator.
|
| 604 |
+
|
| 605 |
+
.. code:: python
|
| 606 |
+
|
| 607 |
+
class tqdm():
|
| 608 |
+
def update(self, n=1):
|
| 609 |
+
"""
|
| 610 |
+
Manually update the progress bar, useful for streams
|
| 611 |
+
such as reading files.
|
| 612 |
+
E.g.:
|
| 613 |
+
>>> t = tqdm(total=filesize) # Initialise
|
| 614 |
+
>>> for current_buffer in stream:
|
| 615 |
+
... ...
|
| 616 |
+
... t.update(len(current_buffer))
|
| 617 |
+
>>> t.close()
|
| 618 |
+
The last line is highly recommended, but possibly not necessary if
|
| 619 |
+
`t.update()` will be called in such a way that `filesize` will be
|
| 620 |
+
exactly reached and printed.
|
| 621 |
+
|
| 622 |
+
Parameters
|
| 623 |
+
----------
|
| 624 |
+
n : int or float, optional
|
| 625 |
+
Increment to add to the internal counter of iterations
|
| 626 |
+
[default: 1]. If using float, consider specifying `{n:.3f}`
|
| 627 |
+
or similar in `bar_format`, or specifying `unit_scale`.
|
| 628 |
+
|
| 629 |
+
Returns
|
| 630 |
+
-------
|
| 631 |
+
out : bool or None
|
| 632 |
+
True if a `display()` was triggered.
|
| 633 |
+
"""
|
| 634 |
+
|
| 635 |
+
def close(self):
|
| 636 |
+
"""Cleanup and (if leave=False) close the progress bar."""
|
| 637 |
+
|
| 638 |
+
def clear(self, nomove=False):
|
| 639 |
+
"""Clear current bar display."""
|
| 640 |
+
|
| 641 |
+
def refresh(self):
|
| 642 |
+
"""
|
| 643 |
+
Force refresh the display of this bar.
|
| 644 |
+
|
| 645 |
+
Parameters
|
| 646 |
+
----------
|
| 647 |
+
nolock : bool, optional
|
| 648 |
+
If `True`, does not lock.
|
| 649 |
+
If [default: `False`]: calls `acquire()` on internal lock.
|
| 650 |
+
lock_args : tuple, optional
|
| 651 |
+
Passed to internal lock's `acquire()`.
|
| 652 |
+
If specified, will only `display()` if `acquire()` returns `True`.
|
| 653 |
+
"""
|
| 654 |
+
|
| 655 |
+
def unpause(self):
|
| 656 |
+
"""Restart tqdm timer from last print time."""
|
| 657 |
+
|
| 658 |
+
def reset(self, total=None):
|
| 659 |
+
"""
|
| 660 |
+
Resets to 0 iterations for repeated use.
|
| 661 |
+
|
| 662 |
+
Consider combining with `leave=True`.
|
| 663 |
+
|
| 664 |
+
Parameters
|
| 665 |
+
----------
|
| 666 |
+
total : int or float, optional. Total to use for the new bar.
|
| 667 |
+
"""
|
| 668 |
+
|
| 669 |
+
def set_description(self, desc=None, refresh=True):
|
| 670 |
+
"""
|
| 671 |
+
Set/modify description of the progress bar.
|
| 672 |
+
|
| 673 |
+
Parameters
|
| 674 |
+
----------
|
| 675 |
+
desc : str, optional
|
| 676 |
+
refresh : bool, optional
|
| 677 |
+
Forces refresh [default: True].
|
| 678 |
+
"""
|
| 679 |
+
|
| 680 |
+
def set_postfix(self, ordered_dict=None, refresh=True, **tqdm_kwargs):
|
| 681 |
+
"""
|
| 682 |
+
Set/modify postfix (additional stats)
|
| 683 |
+
with automatic formatting based on datatype.
|
| 684 |
+
|
| 685 |
+
Parameters
|
| 686 |
+
----------
|
| 687 |
+
ordered_dict : dict or OrderedDict, optional
|
| 688 |
+
refresh : bool, optional
|
| 689 |
+
Forces refresh [default: True].
|
| 690 |
+
kwargs : dict, optional
|
| 691 |
+
"""
|
| 692 |
+
|
| 693 |
+
@classmethod
|
| 694 |
+
def write(cls, s, file=sys.stdout, end="\n"):
|
| 695 |
+
"""Print a message via tqdm (without overlap with bars)."""
|
| 696 |
+
|
| 697 |
+
@property
|
| 698 |
+
def format_dict(self):
|
| 699 |
+
"""Public API for read-only member access."""
|
| 700 |
+
|
| 701 |
+
def display(self, msg=None, pos=None):
|
| 702 |
+
"""
|
| 703 |
+
Use `self.sp` to display `msg` in the specified `pos`.
|
| 704 |
+
|
| 705 |
+
Consider overloading this function when inheriting to use e.g.:
|
| 706 |
+
`self.some_frontend(**self.format_dict)` instead of `self.sp`.
|
| 707 |
+
|
| 708 |
+
Parameters
|
| 709 |
+
----------
|
| 710 |
+
msg : str, optional. What to display (default: `repr(self)`).
|
| 711 |
+
pos : int, optional. Position to `moveto`
|
| 712 |
+
(default: `abs(self.pos)`).
|
| 713 |
+
"""
|
| 714 |
+
|
| 715 |
+
@classmethod
|
| 716 |
+
@contextmanager
|
| 717 |
+
def wrapattr(cls, stream, method, total=None, bytes=True, **tqdm_kwargs):
|
| 718 |
+
"""
|
| 719 |
+
stream : file-like object.
|
| 720 |
+
method : str, "read" or "write". The result of `read()` and
|
| 721 |
+
the first argument of `write()` should have a `len()`.
|
| 722 |
+
|
| 723 |
+
>>> with tqdm.wrapattr(file_obj, "read", total=file_obj.size) as fobj:
|
| 724 |
+
... while True:
|
| 725 |
+
... chunk = fobj.read(chunk_size)
|
| 726 |
+
... if not chunk:
|
| 727 |
+
... break
|
| 728 |
+
"""
|
| 729 |
+
|
| 730 |
+
@classmethod
|
| 731 |
+
def pandas(cls, *targs, **tqdm_kwargs):
|
| 732 |
+
"""Registers the current `tqdm` class with `pandas`."""
|
| 733 |
+
|
| 734 |
+
def trange(*args, **tqdm_kwargs):
|
| 735 |
+
"""Shortcut for `tqdm(range(*args), **tqdm_kwargs)`."""
|
| 736 |
+
|
| 737 |
+
Convenience Functions
|
| 738 |
+
~~~~~~~~~~~~~~~~~~~~~
|
| 739 |
+
|
| 740 |
+
.. code:: python
|
| 741 |
+
|
| 742 |
+
def tqdm.contrib.tenumerate(iterable, start=0, total=None,
|
| 743 |
+
tqdm_class=tqdm.auto.tqdm, **tqdm_kwargs):
|
| 744 |
+
"""Equivalent of `numpy.ndenumerate` or builtin `enumerate`."""
|
| 745 |
+
|
| 746 |
+
def tqdm.contrib.tzip(iter1, *iter2plus, **tqdm_kwargs):
|
| 747 |
+
"""Equivalent of builtin `zip`."""
|
| 748 |
+
|
| 749 |
+
def tqdm.contrib.tmap(function, *sequences, **tqdm_kwargs):
|
| 750 |
+
"""Equivalent of builtin `map`."""
|
| 751 |
+
|
| 752 |
+
Submodules
|
| 753 |
+
~~~~~~~~~~
|
| 754 |
+
|
| 755 |
+
.. code:: python
|
| 756 |
+
|
| 757 |
+
class tqdm.notebook.tqdm(tqdm.tqdm):
|
| 758 |
+
"""IPython/Jupyter Notebook widget."""
|
| 759 |
+
|
| 760 |
+
class tqdm.auto.tqdm(tqdm.tqdm):
|
| 761 |
+
"""Automatically chooses between `tqdm.notebook` and `tqdm.tqdm`."""
|
| 762 |
+
|
| 763 |
+
class tqdm.asyncio.tqdm(tqdm.tqdm):
|
| 764 |
+
"""Asynchronous version."""
|
| 765 |
+
@classmethod
|
| 766 |
+
def as_completed(cls, fs, *, loop=None, timeout=None, total=None,
|
| 767 |
+
**tqdm_kwargs):
|
| 768 |
+
"""Wrapper for `asyncio.as_completed`."""
|
| 769 |
+
|
| 770 |
+
class tqdm.gui.tqdm(tqdm.tqdm):
|
| 771 |
+
"""Matplotlib GUI version."""
|
| 772 |
+
|
| 773 |
+
class tqdm.tk.tqdm(tqdm.tqdm):
|
| 774 |
+
"""Tkinter GUI version."""
|
| 775 |
+
|
| 776 |
+
class tqdm.rich.tqdm(tqdm.tqdm):
|
| 777 |
+
"""`rich.progress` version."""
|
| 778 |
+
|
| 779 |
+
class tqdm.keras.TqdmCallback(keras.callbacks.Callback):
|
| 780 |
+
"""Keras callback for epoch and batch progress."""
|
| 781 |
+
|
| 782 |
+
class tqdm.dask.TqdmCallback(dask.callbacks.Callback):
|
| 783 |
+
"""Dask callback for task progress."""
|
| 784 |
+
|
| 785 |
+
|
| 786 |
+
``contrib``
|
| 787 |
+
+++++++++++
|
| 788 |
+
|
| 789 |
+
The ``tqdm.contrib`` package also contains experimental modules:
|
| 790 |
+
|
| 791 |
+
- `tqdm.contrib.itertools <https://tqdm.github.io/docs/contrib.itertools/>`_: Thin wrappers around ``itertools``
|
| 792 |
+
- `tqdm.contrib.concurrent <https://tqdm.github.io/docs/contrib.concurrent/>`_: Thin wrappers around ``concurrent.futures``
|
| 793 |
+
- `tqdm.contrib.slack <https://tqdm.github.io/docs/contrib.slack/>`_: Posts to `Slack <https://slack.com>`__ bots
|
| 794 |
+
- `tqdm.contrib.discord <https://tqdm.github.io/docs/contrib.discord/>`_: Posts to `Discord <https://discord.com>`__ bots
|
| 795 |
+
- `tqdm.contrib.telegram <https://tqdm.github.io/docs/contrib.telegram/>`_: Posts to `Telegram <https://telegram.org>`__ bots
|
| 796 |
+
- `tqdm.contrib.bells <https://tqdm.github.io/docs/shortcuts/>`_: Automagically enables all optional features
|
| 797 |
+
|
| 798 |
+
* ``auto``, ``pandas``, ``slack``, ``discord``, ``telegram``
|
| 799 |
+
|
| 800 |
+
.. image:: https://tqdm.github.io/img/screenshot-discord.png
|
| 801 |
+
:alt: Screenshot of `tqdm.contrib.discord` in action
|
| 802 |
+
|
| 803 |
+
Examples and Advanced Usage
|
| 804 |
+
---------------------------
|
| 805 |
+
|
| 806 |
+
- See the `examples <https://github.com/tqdm/tqdm/tree/master/examples>`__
|
| 807 |
+
folder;
|
| 808 |
+
- import the module and run ``help()``;
|
| 809 |
+
- consult the `wiki <https://github.com/tqdm/tqdm/wiki>`__;
|
| 810 |
+
|
| 811 |
+
* this has an
|
| 812 |
+
`excellent article <https://github.com/tqdm/tqdm/wiki/How-to-make-a-great-Progress-Bar>`__
|
| 813 |
+
on how to make a **great** progress bar;
|
| 814 |
+
|
| 815 |
+
- check out the `slides from PyData London <https://tqdm.github.io/PyData2019/slides.html>`__, or
|
| 816 |
+
- run the |binder-demo|.
|
| 817 |
+
|
| 818 |
+
Description and additional stats
|
| 819 |
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
| 820 |
+
|
| 821 |
+
Custom information can be displayed and updated dynamically on ``tqdm`` bars
|
| 822 |
+
with the ``desc`` and ``postfix`` arguments:
|
| 823 |
+
|
| 824 |
+
.. code:: python
|
| 825 |
+
|
| 826 |
+
from tqdm import tqdm, trange
|
| 827 |
+
from random import random, randint
|
| 828 |
+
from time import sleep
|
| 829 |
+
|
| 830 |
+
with trange(10) as t:
|
| 831 |
+
for i in t:
|
| 832 |
+
# Description will be displayed on the left
|
| 833 |
+
t.set_description('GEN %i' % i)
|
| 834 |
+
# Postfix will be displayed on the right,
|
| 835 |
+
# formatted automatically based on argument's datatype
|
| 836 |
+
t.set_postfix(loss=random(), gen=randint(1,999), str='h',
|
| 837 |
+
lst=[1, 2])
|
| 838 |
+
sleep(0.1)
|
| 839 |
+
|
| 840 |
+
with tqdm(total=10, bar_format="{postfix[0]} {postfix[1][value]:>8.2g}",
|
| 841 |
+
postfix=["Batch", {"value": 0}]) as t:
|
| 842 |
+
for i in range(10):
|
| 843 |
+
sleep(0.1)
|
| 844 |
+
t.postfix[1]["value"] = i / 2
|
| 845 |
+
t.update()
|
| 846 |
+
|
| 847 |
+
Points to remember when using ``{postfix[...]}`` in the ``bar_format`` string:
|
| 848 |
+
|
| 849 |
+
- ``postfix`` also needs to be passed as an initial argument in a compatible
|
| 850 |
+
format, and
|
| 851 |
+
- ``postfix`` will be auto-converted to a string if it is a ``dict``-like
|
| 852 |
+
object. To prevent this behaviour, insert an extra item into the dictionary
|
| 853 |
+
where the key is not a string.
|
| 854 |
+
|
| 855 |
+
Additional ``bar_format`` parameters may also be defined by overriding
|
| 856 |
+
``format_dict``, and the bar itself may be modified using ``ascii``:
|
| 857 |
+
|
| 858 |
+
.. code:: python
|
| 859 |
+
|
| 860 |
+
from tqdm import tqdm
|
| 861 |
+
class TqdmExtraFormat(tqdm):
|
| 862 |
+
"""Provides a `total_time` format parameter"""
|
| 863 |
+
@property
|
| 864 |
+
def format_dict(self):
|
| 865 |
+
d = super().format_dict
|
| 866 |
+
total_time = d["elapsed"] * (d["total"] or 0) / max(d["n"], 1)
|
| 867 |
+
d.update(total_time=self.format_interval(total_time) + " in total")
|
| 868 |
+
return d
|
| 869 |
+
|
| 870 |
+
for i in TqdmExtraFormat(
|
| 871 |
+
range(9), ascii=" .oO0",
|
| 872 |
+
bar_format="{total_time}: {percentage:.0f}%|{bar}{r_bar}"):
|
| 873 |
+
if i == 4:
|
| 874 |
+
break
|
| 875 |
+
|
| 876 |
+
.. code::
|
| 877 |
+
|
| 878 |
+
00:00 in total: 44%|0000. | 4/9 [00:00<00:00, 962.93it/s]
|
| 879 |
+
|
| 880 |
+
Note that ``{bar}`` also supports a format specifier ``[width][type]``.
|
| 881 |
+
|
| 882 |
+
- ``width``
|
| 883 |
+
|
| 884 |
+
* unspecified (default): automatic to fill ``ncols``
|
| 885 |
+
* ``int >= 0``: fixed width overriding ``ncols`` logic
|
| 886 |
+
* ``int < 0``: subtract from the automatic default
|
| 887 |
+
|
| 888 |
+
- ``type``
|
| 889 |
+
|
| 890 |
+
* ``a``: ascii (``ascii=True`` override)
|
| 891 |
+
* ``u``: unicode (``ascii=False`` override)
|
| 892 |
+
* ``b``: blank (``ascii=" "`` override)
|
| 893 |
+
|
| 894 |
+
This means a fixed bar with right-justified text may be created by using:
|
| 895 |
+
``bar_format="{l_bar}{bar:10}|{bar:-10b}right-justified"``
|
| 896 |
+
|
| 897 |
+
Nested progress bars
|
| 898 |
+
~~~~~~~~~~~~~~~~~~~~
|
| 899 |
+
|
| 900 |
+
``tqdm`` supports nested progress bars. Here's an example:
|
| 901 |
+
|
| 902 |
+
.. code:: python
|
| 903 |
+
|
| 904 |
+
from tqdm.auto import trange
|
| 905 |
+
from time import sleep
|
| 906 |
+
|
| 907 |
+
for i in trange(4, desc='1st loop'):
|
| 908 |
+
for j in trange(5, desc='2nd loop'):
|
| 909 |
+
for k in trange(50, desc='3rd loop', leave=False):
|
| 910 |
+
sleep(0.01)
|
| 911 |
+
|
| 912 |
+
For manual control over positioning (e.g. for multi-processing use),
|
| 913 |
+
you may specify ``position=n`` where ``n=0`` for the outermost bar,
|
| 914 |
+
``n=1`` for the next, and so on.
|
| 915 |
+
However, it's best to check if ``tqdm`` can work without manual ``position``
|
| 916 |
+
first.
|
| 917 |
+
|
| 918 |
+
.. code:: python
|
| 919 |
+
|
| 920 |
+
from time import sleep
|
| 921 |
+
from tqdm import trange, tqdm
|
| 922 |
+
from multiprocessing import Pool, RLock, freeze_support
|
| 923 |
+
|
| 924 |
+
L = list(range(9))
|
| 925 |
+
|
| 926 |
+
def progresser(n):
|
| 927 |
+
interval = 0.001 / (n + 2)
|
| 928 |
+
total = 5000
|
| 929 |
+
text = f"#{n}, est. {interval * total:<04.2}s"
|
| 930 |
+
for _ in trange(total, desc=text, position=n):
|
| 931 |
+
sleep(interval)
|
| 932 |
+
|
| 933 |
+
if __name__ == '__main__':
|
| 934 |
+
freeze_support() # for Windows support
|
| 935 |
+
tqdm.set_lock(RLock()) # for managing output contention
|
| 936 |
+
p = Pool(initializer=tqdm.set_lock, initargs=(tqdm.get_lock(),))
|
| 937 |
+
p.map(progresser, L)
|
| 938 |
+
|
| 939 |
+
Note that in Python 3, ``tqdm.write`` is thread-safe:
|
| 940 |
+
|
| 941 |
+
.. code:: python
|
| 942 |
+
|
| 943 |
+
from time import sleep
|
| 944 |
+
from tqdm import tqdm, trange
|
| 945 |
+
from concurrent.futures import ThreadPoolExecutor
|
| 946 |
+
|
| 947 |
+
L = list(range(9))
|
| 948 |
+
|
| 949 |
+
def progresser(n):
|
| 950 |
+
interval = 0.001 / (n + 2)
|
| 951 |
+
total = 5000
|
| 952 |
+
text = f"#{n}, est. {interval * total:<04.2}s"
|
| 953 |
+
for _ in trange(total, desc=text):
|
| 954 |
+
sleep(interval)
|
| 955 |
+
if n == 6:
|
| 956 |
+
tqdm.write("n == 6 completed.")
|
| 957 |
+
tqdm.write("`tqdm.write()` is thread-safe in py3!")
|
| 958 |
+
|
| 959 |
+
if __name__ == '__main__':
|
| 960 |
+
with ThreadPoolExecutor() as p:
|
| 961 |
+
p.map(progresser, L)
|
| 962 |
+
|
| 963 |
+
Hooks and callbacks
|
| 964 |
+
~~~~~~~~~~~~~~~~~~~
|
| 965 |
+
|
| 966 |
+
``tqdm`` can easily support callbacks/hooks and manual updates.
|
| 967 |
+
Here's an example with ``urllib``:
|
| 968 |
+
|
| 969 |
+
**``urllib.urlretrieve`` documentation**
|
| 970 |
+
|
| 971 |
+
| [...]
|
| 972 |
+
| If present, the hook function will be called once
|
| 973 |
+
| on establishment of the network connection and once after each block read
|
| 974 |
+
| thereafter. The hook will be passed three arguments; a count of blocks
|
| 975 |
+
| transferred so far, a block size in bytes, and the total size of the file.
|
| 976 |
+
| [...]
|
| 977 |
+
|
| 978 |
+
.. code:: python
|
| 979 |
+
|
| 980 |
+
import urllib, os
|
| 981 |
+
from tqdm import tqdm
|
| 982 |
+
urllib = getattr(urllib, 'request', urllib)
|
| 983 |
+
|
| 984 |
+
class TqdmUpTo(tqdm):
|
| 985 |
+
"""Provides `update_to(n)` which uses `tqdm.update(delta_n)`."""
|
| 986 |
+
def update_to(self, b=1, bsize=1, tsize=None):
|
| 987 |
+
"""
|
| 988 |
+
b : int, optional
|
| 989 |
+
Number of blocks transferred so far [default: 1].
|
| 990 |
+
bsize : int, optional
|
| 991 |
+
Size of each block (in tqdm units) [default: 1].
|
| 992 |
+
tsize : int, optional
|
| 993 |
+
Total size (in tqdm units). If [default: None] remains unchanged.
|
| 994 |
+
"""
|
| 995 |
+
if tsize is not None:
|
| 996 |
+
self.total = tsize
|
| 997 |
+
return self.update(b * bsize - self.n) # also sets self.n = b * bsize
|
| 998 |
+
|
| 999 |
+
eg_link = "https://cgi.cdcl.ml/matryoshka.zip"
|
| 1000 |
+
with TqdmUpTo(unit='B', unit_scale=True, unit_divisor=1024, miniters=1,
|
| 1001 |
+
desc=eg_link.split('/')[-1]) as t: # all optional kwargs
|
| 1002 |
+
urllib.urlretrieve(eg_link, filename=os.devnull,
|
| 1003 |
+
reporthook=t.update_to, data=None)
|
| 1004 |
+
t.total = t.n
|
| 1005 |
+
|
| 1006 |
+
Inspired by `twine#242 <https://github.com/pypa/twine/pull/242>`__.
|
| 1007 |
+
Functional alternative in
|
| 1008 |
+
`examples/tqdm_wget.py <https://github.com/tqdm/tqdm/blob/master/examples/tqdm_wget.py>`__.
|
| 1009 |
+
|
| 1010 |
+
It is recommend to use ``miniters=1`` whenever there is potentially
|
| 1011 |
+
large differences in iteration speed (e.g. downloading a file over
|
| 1012 |
+
a patchy connection).
|
| 1013 |
+
|
| 1014 |
+
**Wrapping read/write methods**
|
| 1015 |
+
|
| 1016 |
+
To measure throughput through a file-like object's ``read`` or ``write``
|
| 1017 |
+
methods, use ``CallbackIOWrapper``:
|
| 1018 |
+
|
| 1019 |
+
.. code:: python
|
| 1020 |
+
|
| 1021 |
+
from tqdm.auto import tqdm
|
| 1022 |
+
from tqdm.utils import CallbackIOWrapper
|
| 1023 |
+
|
| 1024 |
+
with tqdm(total=file_obj.size,
|
| 1025 |
+
unit='B', unit_scale=True, unit_divisor=1024) as t:
|
| 1026 |
+
fobj = CallbackIOWrapper(t.update, file_obj, "read")
|
| 1027 |
+
while True:
|
| 1028 |
+
chunk = fobj.read(chunk_size)
|
| 1029 |
+
if not chunk:
|
| 1030 |
+
break
|
| 1031 |
+
t.reset()
|
| 1032 |
+
# ... continue to use `t` for something else
|
| 1033 |
+
|
| 1034 |
+
Alternatively, use the even simpler ``wrapattr`` convenience function,
|
| 1035 |
+
which would condense both the ``urllib`` and ``CallbackIOWrapper`` examples
|
| 1036 |
+
down to:
|
| 1037 |
+
|
| 1038 |
+
.. code:: python
|
| 1039 |
+
|
| 1040 |
+
import urllib, os
|
| 1041 |
+
from tqdm import tqdm
|
| 1042 |
+
|
| 1043 |
+
eg_link = "https://cgi.cdcl.ml/matryoshka.zip"
|
| 1044 |
+
response = getattr(urllib, 'request', urllib).urlopen(eg_link)
|
| 1045 |
+
with tqdm.wrapattr(open(os.devnull, "wb"), "write",
|
| 1046 |
+
miniters=1, desc=eg_link.split('/')[-1],
|
| 1047 |
+
total=getattr(response, 'length', None)) as fout:
|
| 1048 |
+
for chunk in response:
|
| 1049 |
+
fout.write(chunk)
|
| 1050 |
+
|
| 1051 |
+
The ``requests`` equivalent is nearly identical:
|
| 1052 |
+
|
| 1053 |
+
.. code:: python
|
| 1054 |
+
|
| 1055 |
+
import requests, os
|
| 1056 |
+
from tqdm import tqdm
|
| 1057 |
+
|
| 1058 |
+
eg_link = "https://cgi.cdcl.ml/matryoshka.zip"
|
| 1059 |
+
response = requests.get(eg_link, stream=True)
|
| 1060 |
+
with tqdm.wrapattr(open(os.devnull, "wb"), "write",
|
| 1061 |
+
miniters=1, desc=eg_link.split('/')[-1],
|
| 1062 |
+
total=int(response.headers.get('content-length', 0))) as fout:
|
| 1063 |
+
for chunk in response.iter_content(chunk_size=4096):
|
| 1064 |
+
fout.write(chunk)
|
| 1065 |
+
|
| 1066 |
+
**Custom callback**
|
| 1067 |
+
|
| 1068 |
+
``tqdm`` is known for intelligently skipping unnecessary displays. To make a
|
| 1069 |
+
custom callback take advantage of this, simply use the return value of
|
| 1070 |
+
``update()``. This is set to ``True`` if a ``display()`` was triggered.
|
| 1071 |
+
|
| 1072 |
+
.. code:: python
|
| 1073 |
+
|
| 1074 |
+
from tqdm.auto import tqdm as std_tqdm
|
| 1075 |
+
|
| 1076 |
+
def external_callback(*args, **kwargs):
|
| 1077 |
+
...
|
| 1078 |
+
|
| 1079 |
+
class TqdmExt(std_tqdm):
|
| 1080 |
+
def update(self, n=1):
|
| 1081 |
+
displayed = super().update(n)
|
| 1082 |
+
if displayed:
|
| 1083 |
+
external_callback(**self.format_dict)
|
| 1084 |
+
return displayed
|
| 1085 |
+
|
| 1086 |
+
``asyncio``
|
| 1087 |
+
~~~~~~~~~~~
|
| 1088 |
+
|
| 1089 |
+
Note that ``break`` isn't currently caught by asynchronous iterators.
|
| 1090 |
+
This means that ``tqdm`` cannot clean up after itself in this case:
|
| 1091 |
+
|
| 1092 |
+
.. code:: python
|
| 1093 |
+
|
| 1094 |
+
from tqdm.asyncio import tqdm
|
| 1095 |
+
|
| 1096 |
+
async for i in tqdm(range(9)):
|
| 1097 |
+
if i == 2:
|
| 1098 |
+
break
|
| 1099 |
+
|
| 1100 |
+
Instead, either call ``pbar.close()`` manually or use the context manager syntax:
|
| 1101 |
+
|
| 1102 |
+
.. code:: python
|
| 1103 |
+
|
| 1104 |
+
from tqdm.asyncio import tqdm
|
| 1105 |
+
|
| 1106 |
+
with tqdm(range(9)) as pbar:
|
| 1107 |
+
async for i in pbar:
|
| 1108 |
+
if i == 2:
|
| 1109 |
+
break
|
| 1110 |
+
|
| 1111 |
+
Pandas Integration
|
| 1112 |
+
~~~~~~~~~~~~~~~~~~
|
| 1113 |
+
|
| 1114 |
+
Due to popular demand we've added support for ``pandas`` -- here's an example
|
| 1115 |
+
for ``DataFrame.progress_apply`` and ``DataFrameGroupBy.progress_apply``:
|
| 1116 |
+
|
| 1117 |
+
.. code:: python
|
| 1118 |
+
|
| 1119 |
+
import pandas as pd
|
| 1120 |
+
import numpy as np
|
| 1121 |
+
from tqdm import tqdm
|
| 1122 |
+
|
| 1123 |
+
df = pd.DataFrame(np.random.randint(0, 100, (100000, 6)))
|
| 1124 |
+
|
| 1125 |
+
# Register `pandas.progress_apply` and `pandas.Series.map_apply` with `tqdm`
|
| 1126 |
+
# (can use `tqdm.gui.tqdm`, `tqdm.notebook.tqdm`, optional kwargs, etc.)
|
| 1127 |
+
tqdm.pandas(desc="my bar!")
|
| 1128 |
+
|
| 1129 |
+
# Now you can use `progress_apply` instead of `apply`
|
| 1130 |
+
# and `progress_map` instead of `map`
|
| 1131 |
+
df.progress_apply(lambda x: x**2)
|
| 1132 |
+
# can also groupby:
|
| 1133 |
+
# df.groupby(0).progress_apply(lambda x: x**2)
|
| 1134 |
+
|
| 1135 |
+
In case you're interested in how this works (and how to modify it for your
|
| 1136 |
+
own callbacks), see the
|
| 1137 |
+
`examples <https://github.com/tqdm/tqdm/tree/master/examples>`__
|
| 1138 |
+
folder or import the module and run ``help()``.
|
| 1139 |
+
|
| 1140 |
+
Keras Integration
|
| 1141 |
+
~~~~~~~~~~~~~~~~~
|
| 1142 |
+
|
| 1143 |
+
A ``keras`` callback is also available:
|
| 1144 |
+
|
| 1145 |
+
.. code:: python
|
| 1146 |
+
|
| 1147 |
+
from tqdm.keras import TqdmCallback
|
| 1148 |
+
|
| 1149 |
+
...
|
| 1150 |
+
|
| 1151 |
+
model.fit(..., verbose=0, callbacks=[TqdmCallback()])
|
| 1152 |
+
|
| 1153 |
+
Dask Integration
|
| 1154 |
+
~~~~~~~~~~~~~~~~
|
| 1155 |
+
|
| 1156 |
+
A ``dask`` callback is also available:
|
| 1157 |
+
|
| 1158 |
+
.. code:: python
|
| 1159 |
+
|
| 1160 |
+
from tqdm.dask import TqdmCallback
|
| 1161 |
+
|
| 1162 |
+
with TqdmCallback(desc="compute"):
|
| 1163 |
+
...
|
| 1164 |
+
arr.compute()
|
| 1165 |
+
|
| 1166 |
+
# or use callback globally
|
| 1167 |
+
cb = TqdmCallback(desc="global")
|
| 1168 |
+
cb.register()
|
| 1169 |
+
arr.compute()
|
| 1170 |
+
|
| 1171 |
+
IPython/Jupyter Integration
|
| 1172 |
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
| 1173 |
+
|
| 1174 |
+
IPython/Jupyter is supported via the ``tqdm.notebook`` submodule:
|
| 1175 |
+
|
| 1176 |
+
.. code:: python
|
| 1177 |
+
|
| 1178 |
+
from tqdm.notebook import trange, tqdm
|
| 1179 |
+
from time import sleep
|
| 1180 |
+
|
| 1181 |
+
for i in trange(3, desc='1st loop'):
|
| 1182 |
+
for j in tqdm(range(100), desc='2nd loop'):
|
| 1183 |
+
sleep(0.01)
|
| 1184 |
+
|
| 1185 |
+
In addition to ``tqdm`` features, the submodule provides a native Jupyter
|
| 1186 |
+
widget (compatible with IPython v1-v4 and Jupyter), fully working nested bars
|
| 1187 |
+
and colour hints (blue: normal, green: completed, red: error/interrupt,
|
| 1188 |
+
light blue: no ETA); as demonstrated below.
|
| 1189 |
+
|
| 1190 |
+
|Screenshot-Jupyter1|
|
| 1191 |
+
|Screenshot-Jupyter2|
|
| 1192 |
+
|Screenshot-Jupyter3|
|
| 1193 |
+
|
| 1194 |
+
The ``notebook`` version supports percentage or pixels for overall width
|
| 1195 |
+
(e.g.: ``ncols='100%'`` or ``ncols='480px'``).
|
| 1196 |
+
|
| 1197 |
+
It is also possible to let ``tqdm`` automatically choose between
|
| 1198 |
+
console or notebook versions by using the ``autonotebook`` submodule:
|
| 1199 |
+
|
| 1200 |
+
.. code:: python
|
| 1201 |
+
|
| 1202 |
+
from tqdm.autonotebook import tqdm
|
| 1203 |
+
tqdm.pandas()
|
| 1204 |
+
|
| 1205 |
+
Note that this will issue a ``TqdmExperimentalWarning`` if run in a notebook
|
| 1206 |
+
since it is not meant to be possible to distinguish between ``jupyter notebook``
|
| 1207 |
+
and ``jupyter console``. Use ``auto`` instead of ``autonotebook`` to suppress
|
| 1208 |
+
this warning.
|
| 1209 |
+
|
| 1210 |
+
Note that notebooks will display the bar in the cell where it was created.
|
| 1211 |
+
This may be a different cell from the one where it is used.
|
| 1212 |
+
If this is not desired, either
|
| 1213 |
+
|
| 1214 |
+
- delay the creation of the bar to the cell where it must be displayed, or
|
| 1215 |
+
- create the bar with ``display=False``, and in a later cell call
|
| 1216 |
+
``display(bar.container)``:
|
| 1217 |
+
|
| 1218 |
+
.. code:: python
|
| 1219 |
+
|
| 1220 |
+
from tqdm.notebook import tqdm
|
| 1221 |
+
pbar = tqdm(..., display=False)
|
| 1222 |
+
|
| 1223 |
+
.. code:: python
|
| 1224 |
+
|
| 1225 |
+
# different cell
|
| 1226 |
+
display(pbar.container)
|
| 1227 |
+
|
| 1228 |
+
The ``keras`` callback has a ``display()`` method which can be used likewise:
|
| 1229 |
+
|
| 1230 |
+
.. code:: python
|
| 1231 |
+
|
| 1232 |
+
from tqdm.keras import TqdmCallback
|
| 1233 |
+
cbk = TqdmCallback(display=False)
|
| 1234 |
+
|
| 1235 |
+
.. code:: python
|
| 1236 |
+
|
| 1237 |
+
# different cell
|
| 1238 |
+
cbk.display()
|
| 1239 |
+
model.fit(..., verbose=0, callbacks=[cbk])
|
| 1240 |
+
|
| 1241 |
+
Another possibility is to have a single bar (near the top of the notebook)
|
| 1242 |
+
which is constantly re-used (using ``reset()`` rather than ``close()``).
|
| 1243 |
+
For this reason, the notebook version (unlike the CLI version) does not
|
| 1244 |
+
automatically call ``close()`` upon ``Exception``.
|
| 1245 |
+
|
| 1246 |
+
.. code:: python
|
| 1247 |
+
|
| 1248 |
+
from tqdm.notebook import tqdm
|
| 1249 |
+
pbar = tqdm()
|
| 1250 |
+
|
| 1251 |
+
.. code:: python
|
| 1252 |
+
|
| 1253 |
+
# different cell
|
| 1254 |
+
iterable = range(100)
|
| 1255 |
+
pbar.reset(total=len(iterable)) # initialise with new `total`
|
| 1256 |
+
for i in iterable:
|
| 1257 |
+
pbar.update()
|
| 1258 |
+
pbar.refresh() # force print final status but don't `close()`
|
| 1259 |
+
|
| 1260 |
+
Custom Integration
|
| 1261 |
+
~~~~~~~~~~~~~~~~~~
|
| 1262 |
+
|
| 1263 |
+
To change the default arguments (such as making ``dynamic_ncols=True``),
|
| 1264 |
+
simply use built-in Python magic:
|
| 1265 |
+
|
| 1266 |
+
.. code:: python
|
| 1267 |
+
|
| 1268 |
+
from functools import partial
|
| 1269 |
+
from tqdm import tqdm as std_tqdm
|
| 1270 |
+
tqdm = partial(std_tqdm, dynamic_ncols=True)
|
| 1271 |
+
|
| 1272 |
+
For further customisation,
|
| 1273 |
+
``tqdm`` may be inherited from to create custom callbacks (as with the
|
| 1274 |
+
``TqdmUpTo`` example `above <#hooks-and-callbacks>`__) or for custom frontends
|
| 1275 |
+
(e.g. GUIs such as notebook or plotting packages). In the latter case:
|
| 1276 |
+
|
| 1277 |
+
1. ``def __init__()`` to call ``super().__init__(..., gui=True)`` to disable
|
| 1278 |
+
terminal ``status_printer`` creation.
|
| 1279 |
+
2. Redefine: ``close()``, ``clear()``, ``display()``.
|
| 1280 |
+
|
| 1281 |
+
Consider overloading ``display()`` to use e.g.
|
| 1282 |
+
``self.frontend(**self.format_dict)`` instead of ``self.sp(repr(self))``.
|
| 1283 |
+
|
| 1284 |
+
Some submodule examples of inheritance:
|
| 1285 |
+
|
| 1286 |
+
- `tqdm/notebook.py <https://github.com/tqdm/tqdm/blob/master/tqdm/notebook.py>`__
|
| 1287 |
+
- `tqdm/gui.py <https://github.com/tqdm/tqdm/blob/master/tqdm/gui.py>`__
|
| 1288 |
+
- `tqdm/tk.py <https://github.com/tqdm/tqdm/blob/master/tqdm/tk.py>`__
|
| 1289 |
+
- `tqdm/contrib/slack.py <https://github.com/tqdm/tqdm/blob/master/tqdm/contrib/slack.py>`__
|
| 1290 |
+
- `tqdm/contrib/discord.py <https://github.com/tqdm/tqdm/blob/master/tqdm/contrib/discord.py>`__
|
| 1291 |
+
- `tqdm/contrib/telegram.py <https://github.com/tqdm/tqdm/blob/master/tqdm/contrib/telegram.py>`__
|
| 1292 |
+
|
| 1293 |
+
Dynamic Monitor/Meter
|
| 1294 |
+
~~~~~~~~~~~~~~~~~~~~~
|
| 1295 |
+
|
| 1296 |
+
You can use a ``tqdm`` as a meter which is not monotonically increasing.
|
| 1297 |
+
This could be because ``n`` decreases (e.g. a CPU usage monitor) or ``total``
|
| 1298 |
+
changes.
|
| 1299 |
+
|
| 1300 |
+
One example would be recursively searching for files. The ``total`` is the
|
| 1301 |
+
number of objects found so far, while ``n`` is the number of those objects which
|
| 1302 |
+
are files (rather than folders):
|
| 1303 |
+
|
| 1304 |
+
.. code:: python
|
| 1305 |
+
|
| 1306 |
+
from tqdm import tqdm
|
| 1307 |
+
import os.path
|
| 1308 |
+
|
| 1309 |
+
def find_files_recursively(path, show_progress=True):
|
| 1310 |
+
files = []
|
| 1311 |
+
# total=1 assumes `path` is a file
|
| 1312 |
+
t = tqdm(total=1, unit="file", disable=not show_progress)
|
| 1313 |
+
if not os.path.exists(path):
|
| 1314 |
+
raise IOError("Cannot find:" + path)
|
| 1315 |
+
|
| 1316 |
+
def append_found_file(f):
|
| 1317 |
+
files.append(f)
|
| 1318 |
+
t.update()
|
| 1319 |
+
|
| 1320 |
+
def list_found_dir(path):
|
| 1321 |
+
"""returns os.listdir(path) assuming os.path.isdir(path)"""
|
| 1322 |
+
listing = os.listdir(path)
|
| 1323 |
+
# subtract 1 since a "file" we found was actually this directory
|
| 1324 |
+
t.total += len(listing) - 1
|
| 1325 |
+
# fancy way to give info without forcing a refresh
|
| 1326 |
+
t.set_postfix(dir=path[-10:], refresh=False)
|
| 1327 |
+
t.update(0) # may trigger a refresh
|
| 1328 |
+
return listing
|
| 1329 |
+
|
| 1330 |
+
def recursively_search(path):
|
| 1331 |
+
if os.path.isdir(path):
|
| 1332 |
+
for f in list_found_dir(path):
|
| 1333 |
+
recursively_search(os.path.join(path, f))
|
| 1334 |
+
else:
|
| 1335 |
+
append_found_file(path)
|
| 1336 |
+
|
| 1337 |
+
recursively_search(path)
|
| 1338 |
+
t.set_postfix(dir=path)
|
| 1339 |
+
t.close()
|
| 1340 |
+
return files
|
| 1341 |
+
|
| 1342 |
+
Using ``update(0)`` is a handy way to let ``tqdm`` decide when to trigger a
|
| 1343 |
+
display refresh to avoid console spamming.
|
| 1344 |
+
|
| 1345 |
+
Writing messages
|
| 1346 |
+
~~~~~~~~~~~~~~~~
|
| 1347 |
+
|
| 1348 |
+
This is a work in progress (see
|
| 1349 |
+
`#737 <https://github.com/tqdm/tqdm/issues/737>`__).
|
| 1350 |
+
|
| 1351 |
+
Since ``tqdm`` uses a simple printing mechanism to display progress bars,
|
| 1352 |
+
you should not write any message in the terminal using ``print()`` while
|
| 1353 |
+
a progress bar is open.
|
| 1354 |
+
|
| 1355 |
+
To write messages in the terminal without any collision with ``tqdm`` bar
|
| 1356 |
+
display, a ``.write()`` method is provided:
|
| 1357 |
+
|
| 1358 |
+
.. code:: python
|
| 1359 |
+
|
| 1360 |
+
from tqdm.auto import tqdm, trange
|
| 1361 |
+
from time import sleep
|
| 1362 |
+
|
| 1363 |
+
bar = trange(10)
|
| 1364 |
+
for i in bar:
|
| 1365 |
+
# Print using tqdm class method .write()
|
| 1366 |
+
sleep(0.1)
|
| 1367 |
+
if not (i % 3):
|
| 1368 |
+
tqdm.write("Done task %i" % i)
|
| 1369 |
+
# Can also use bar.write()
|
| 1370 |
+
|
| 1371 |
+
By default, this will print to standard output ``sys.stdout``. but you can
|
| 1372 |
+
specify any file-like object using the ``file`` argument. For example, this
|
| 1373 |
+
can be used to redirect the messages writing to a log file or class.
|
| 1374 |
+
|
| 1375 |
+
Redirecting writing
|
| 1376 |
+
~~~~~~~~~~~~~~~~~~~
|
| 1377 |
+
|
| 1378 |
+
If using a library that can print messages to the console, editing the library
|
| 1379 |
+
by replacing ``print()`` with ``tqdm.write()`` may not be desirable.
|
| 1380 |
+
In that case, redirecting ``sys.stdout`` to ``tqdm.write()`` is an option.
|
| 1381 |
+
|
| 1382 |
+
To redirect ``sys.stdout``, create a file-like class that will write
|
| 1383 |
+
any input string to ``tqdm.write()``, and supply the arguments
|
| 1384 |
+
``file=sys.stdout, dynamic_ncols=True``.
|
| 1385 |
+
|
| 1386 |
+
A reusable canonical example is given below:
|
| 1387 |
+
|
| 1388 |
+
.. code:: python
|
| 1389 |
+
|
| 1390 |
+
from time import sleep
|
| 1391 |
+
import contextlib
|
| 1392 |
+
import sys
|
| 1393 |
+
from tqdm import tqdm
|
| 1394 |
+
from tqdm.contrib import DummyTqdmFile
|
| 1395 |
+
|
| 1396 |
+
|
| 1397 |
+
@contextlib.contextmanager
|
| 1398 |
+
def std_out_err_redirect_tqdm():
|
| 1399 |
+
orig_out_err = sys.stdout, sys.stderr
|
| 1400 |
+
try:
|
| 1401 |
+
sys.stdout, sys.stderr = map(DummyTqdmFile, orig_out_err)
|
| 1402 |
+
yield orig_out_err[0]
|
| 1403 |
+
# Relay exceptions
|
| 1404 |
+
except Exception as exc:
|
| 1405 |
+
raise exc
|
| 1406 |
+
# Always restore sys.stdout/err if necessary
|
| 1407 |
+
finally:
|
| 1408 |
+
sys.stdout, sys.stderr = orig_out_err
|
| 1409 |
+
|
| 1410 |
+
def some_fun(i):
|
| 1411 |
+
print("Fee, fi, fo,".split()[i])
|
| 1412 |
+
|
| 1413 |
+
# Redirect stdout to tqdm.write() (don't forget the `as save_stdout`)
|
| 1414 |
+
with std_out_err_redirect_tqdm() as orig_stdout:
|
| 1415 |
+
# tqdm needs the original stdout
|
| 1416 |
+
# and dynamic_ncols=True to autodetect console width
|
| 1417 |
+
for i in tqdm(range(3), file=orig_stdout, dynamic_ncols=True):
|
| 1418 |
+
sleep(.5)
|
| 1419 |
+
some_fun(i)
|
| 1420 |
+
|
| 1421 |
+
# After the `with`, printing is restored
|
| 1422 |
+
print("Done!")
|
| 1423 |
+
|
| 1424 |
+
Redirecting ``logging``
|
| 1425 |
+
~~~~~~~~~~~~~~~~~~~~~~~
|
| 1426 |
+
|
| 1427 |
+
Similar to ``sys.stdout``/``sys.stderr`` as detailed above, console ``logging``
|
| 1428 |
+
may also be redirected to ``tqdm.write()``.
|
| 1429 |
+
|
| 1430 |
+
Warning: if also redirecting ``sys.stdout``/``sys.stderr``, make sure to
|
| 1431 |
+
redirect ``logging`` first if needed.
|
| 1432 |
+
|
| 1433 |
+
Helper methods are available in ``tqdm.contrib.logging``. For example:
|
| 1434 |
+
|
| 1435 |
+
.. code:: python
|
| 1436 |
+
|
| 1437 |
+
import logging
|
| 1438 |
+
from tqdm import trange
|
| 1439 |
+
from tqdm.contrib.logging import logging_redirect_tqdm
|
| 1440 |
+
|
| 1441 |
+
LOG = logging.getLogger(__name__)
|
| 1442 |
+
|
| 1443 |
+
if __name__ == '__main__':
|
| 1444 |
+
logging.basicConfig(level=logging.INFO)
|
| 1445 |
+
with logging_redirect_tqdm():
|
| 1446 |
+
for i in trange(9):
|
| 1447 |
+
if i == 4:
|
| 1448 |
+
LOG.info("console logging redirected to `tqdm.write()`")
|
| 1449 |
+
# logging restored
|
| 1450 |
+
|
| 1451 |
+
Monitoring thread, intervals and miniters
|
| 1452 |
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
| 1453 |
+
|
| 1454 |
+
``tqdm`` implements a few tricks to increase efficiency and reduce overhead.
|
| 1455 |
+
|
| 1456 |
+
- Avoid unnecessary frequent bar refreshing: ``mininterval`` defines how long
|
| 1457 |
+
to wait between each refresh. ``tqdm`` always gets updated in the background,
|
| 1458 |
+
but it will display only every ``mininterval``.
|
| 1459 |
+
- Reduce number of calls to check system clock/time.
|
| 1460 |
+
- ``mininterval`` is more intuitive to configure than ``miniters``.
|
| 1461 |
+
A clever adjustment system ``dynamic_miniters`` will automatically adjust
|
| 1462 |
+
``miniters`` to the amount of iterations that fit into time ``mininterval``.
|
| 1463 |
+
Essentially, ``tqdm`` will check if it's time to print without actually
|
| 1464 |
+
checking time. This behaviour can be still be bypassed by manually setting
|
| 1465 |
+
``miniters``.
|
| 1466 |
+
|
| 1467 |
+
However, consider a case with a combination of fast and slow iterations.
|
| 1468 |
+
After a few fast iterations, ``dynamic_miniters`` will set ``miniters`` to a
|
| 1469 |
+
large number. When iteration rate subsequently slows, ``miniters`` will
|
| 1470 |
+
remain large and thus reduce display update frequency. To address this:
|
| 1471 |
+
|
| 1472 |
+
- ``maxinterval`` defines the maximum time between display refreshes.
|
| 1473 |
+
A concurrent monitoring thread checks for overdue updates and forces one
|
| 1474 |
+
where necessary.
|
| 1475 |
+
|
| 1476 |
+
The monitoring thread should not have a noticeable overhead, and guarantees
|
| 1477 |
+
updates at least every 10 seconds by default.
|
| 1478 |
+
This value can be directly changed by setting the ``monitor_interval`` of
|
| 1479 |
+
any ``tqdm`` instance (i.e. ``t = tqdm.tqdm(...); t.monitor_interval = 2``).
|
| 1480 |
+
The monitor thread may be disabled application-wide by setting
|
| 1481 |
+
``tqdm.tqdm.monitor_interval = 0`` before instantiation of any ``tqdm`` bar.
|
| 1482 |
+
|
| 1483 |
+
|
| 1484 |
+
Merch
|
| 1485 |
+
-----
|
| 1486 |
+
|
| 1487 |
+
You can buy `tqdm branded merch <https://tqdm.github.io/merch>`__ now!
|
| 1488 |
+
|
| 1489 |
+
Contributions
|
| 1490 |
+
-------------
|
| 1491 |
+
|
| 1492 |
+
|GitHub-Commits| |GitHub-Issues| |GitHub-PRs| |OpenHub-Status| |GitHub-Contributions| |CII Best Practices|
|
| 1493 |
+
|
| 1494 |
+
All source code is hosted on `GitHub <https://github.com/tqdm/tqdm>`__.
|
| 1495 |
+
Contributions are welcome.
|
| 1496 |
+
|
| 1497 |
+
See the
|
| 1498 |
+
`CONTRIBUTING <https://github.com/tqdm/tqdm/blob/master/CONTRIBUTING.md>`__
|
| 1499 |
+
file for more information.
|
| 1500 |
+
|
| 1501 |
+
Developers who have contributed more that 5 *loc* (surviving lines of code):
|
| 1502 |
+
|
| 1503 |
+
|git-fame|
|
| 1504 |
+
|
| 1505 |
+
Honourable mentions:
|
| 1506 |
+
|
| 1507 |
+
- Casper da Costa-Luis `casperdcl <https://github.com/casperdcl>`__ primary maintainer |Gift-Casper|
|
| 1508 |
+
- Stephen Larroque `lrq3000 <https://github.com/lrq3000>`__ maintainer
|
| 1509 |
+
- Hadrien Mary `hadim <https://github.com/hadim>`__ maintainer
|
| 1510 |
+
- Mikhail Korobov `kmike <https://github.com/kmike>`__ maintainer
|
| 1511 |
+
- Noam Yorav-Raphael `noamraph <https://github.com/noamraph>`__ original author
|
| 1512 |
+
|
| 1513 |
+
Ports to Other Languages
|
| 1514 |
+
~~~~~~~~~~~~~~~~~~~~~~~~
|
| 1515 |
+
|
| 1516 |
+
A list is available on
|
| 1517 |
+
`this wiki page <https://github.com/tqdm/tqdm/wiki/tqdm-ports>`__.
|
| 1518 |
+
|
| 1519 |
+
|
| 1520 |
+
LICENCE
|
| 1521 |
+
-------
|
| 1522 |
+
|
| 1523 |
+
Open Source (OSI approved): |LICENCE|
|
| 1524 |
+
|
| 1525 |
+
Citation information: |DOI|
|
| 1526 |
+
|
| 1527 |
+
|README-Hits| (Since 19 May 2016)
|
| 1528 |
+
|
| 1529 |
+
.. |Logo| image:: https://tqdm.github.io/img/logo.gif
|
| 1530 |
+
.. |Screenshot| image:: https://tqdm.github.io/img/tqdm.gif
|
| 1531 |
+
.. |Video| image:: https://tqdm.github.io/img/video.jpg
|
| 1532 |
+
:target: https://tqdm.github.io/video
|
| 1533 |
+
.. |Slides| image:: https://tqdm.github.io/img/slides.jpg
|
| 1534 |
+
:target: https://tqdm.github.io/PyData2019/slides.html
|
| 1535 |
+
.. |Merch| image:: https://tqdm.github.io/img/merch.jpg
|
| 1536 |
+
:target: https://tqdm.github.io/merch
|
| 1537 |
+
.. |Build-Status| image:: https://img.shields.io/github/actions/workflow/status/tqdm/tqdm/test.yml?branch=master&label=tqdm&logo=GitHub
|
| 1538 |
+
:target: https://github.com/tqdm/tqdm/actions/workflows/test.yml
|
| 1539 |
+
.. |Coverage-Status| image:: https://img.shields.io/coveralls/github/tqdm/tqdm/master?logo=coveralls
|
| 1540 |
+
:target: https://coveralls.io/github/tqdm/tqdm
|
| 1541 |
+
.. |Branch-Coverage-Status| image:: https://codecov.io/gh/tqdm/tqdm/branch/master/graph/badge.svg
|
| 1542 |
+
:target: https://codecov.io/gh/tqdm/tqdm
|
| 1543 |
+
.. |Codacy-Grade| image:: https://app.codacy.com/project/badge/Grade/3f965571598f44549c7818f29cdcf177
|
| 1544 |
+
:target: https://app.codacy.com/gh/tqdm/tqdm/dashboard
|
| 1545 |
+
.. |CII Best Practices| image:: https://bestpractices.coreinfrastructure.org/projects/3264/badge
|
| 1546 |
+
:target: https://bestpractices.coreinfrastructure.org/projects/3264
|
| 1547 |
+
.. |GitHub-Status| image:: https://img.shields.io/github/tag/tqdm/tqdm.svg?maxAge=86400&logo=github&logoColor=white
|
| 1548 |
+
:target: https://github.com/tqdm/tqdm/releases
|
| 1549 |
+
.. |GitHub-Forks| image:: https://img.shields.io/github/forks/tqdm/tqdm.svg?logo=github&logoColor=white
|
| 1550 |
+
:target: https://github.com/tqdm/tqdm/network
|
| 1551 |
+
.. |GitHub-Stars| image:: https://img.shields.io/github/stars/tqdm/tqdm.svg?logo=github&logoColor=white
|
| 1552 |
+
:target: https://github.com/tqdm/tqdm/stargazers
|
| 1553 |
+
.. |GitHub-Commits| image:: https://img.shields.io/github/commit-activity/y/tqdm/tqdm.svg?logo=git&logoColor=white
|
| 1554 |
+
:target: https://github.com/tqdm/tqdm/graphs/commit-activity
|
| 1555 |
+
.. |GitHub-Issues| image:: https://img.shields.io/github/issues-closed/tqdm/tqdm.svg?logo=github&logoColor=white
|
| 1556 |
+
:target: https://github.com/tqdm/tqdm/issues?q=
|
| 1557 |
+
.. |GitHub-PRs| image:: https://img.shields.io/github/issues-pr-closed/tqdm/tqdm.svg?logo=github&logoColor=white
|
| 1558 |
+
:target: https://github.com/tqdm/tqdm/pulls
|
| 1559 |
+
.. |GitHub-Contributions| image:: https://img.shields.io/github/contributors/tqdm/tqdm.svg?logo=github&logoColor=white
|
| 1560 |
+
:target: https://github.com/tqdm/tqdm/graphs/contributors
|
| 1561 |
+
.. |GitHub-Updated| image:: https://img.shields.io/github/last-commit/tqdm/tqdm/master.svg?logo=github&logoColor=white&label=pushed
|
| 1562 |
+
:target: https://github.com/tqdm/tqdm/pulse
|
| 1563 |
+
.. |git-fame| image:: https://git-fame.cdcl.ml/gh/tqdm/tqdm?min=5&w=1&M=1&C=1&excl=(png|gif|jpg)$&enum=1
|
| 1564 |
+
:alt: git-fame.cdcl.ml/gh/tqdm/tqdm
|
| 1565 |
+
:target: https://git-fame.cdcl.ml/gh/tqdm/tqdm?w=1&M=1&C=1&excl=(png|gif|jpg)$&enum=1
|
| 1566 |
+
.. |Gift-Casper| image:: https://img.shields.io/badge/sponsor-casper-ff69b4.svg
|
| 1567 |
+
:target: https://cdcl.ml/sponsor
|
| 1568 |
+
.. |Versions| image:: https://img.shields.io/pypi/v/tqdm.svg
|
| 1569 |
+
:target: https://tqdm.github.io/releases
|
| 1570 |
+
.. |PyPI-Downloads| image:: https://img.shields.io/pypi/dm/tqdm.svg?label=pypi%20downloads&logo=PyPI&logoColor=white
|
| 1571 |
+
:target: https://pepy.tech/project/tqdm
|
| 1572 |
+
.. |Py-Versions| image:: https://img.shields.io/pypi/pyversions/tqdm.svg?logo=python&logoColor=white
|
| 1573 |
+
:target: https://pypi.org/project/tqdm
|
| 1574 |
+
.. |Conda-Forge-Status| image:: https://img.shields.io/conda/v/conda-forge/tqdm.svg?label=conda-forge&logo=conda-forge
|
| 1575 |
+
:target: https://anaconda.org/conda-forge/tqdm
|
| 1576 |
+
.. |Snapcraft| image:: https://img.shields.io/badge/snap-install-82BEA0.svg?logo=snapcraft
|
| 1577 |
+
:target: https://snapcraft.io/tqdm
|
| 1578 |
+
.. |Docker| image:: https://img.shields.io/badge/docker-pull-blue.svg?logo=docker&logoColor=white
|
| 1579 |
+
:target: https://hub.docker.com/r/tqdm/tqdm
|
| 1580 |
+
.. |Libraries-Rank| image:: https://img.shields.io/librariesio/sourcerank/pypi/tqdm.svg?logo=koding&logoColor=white
|
| 1581 |
+
:target: https://libraries.io/pypi/tqdm
|
| 1582 |
+
.. |Libraries-Dependents| image:: https://img.shields.io/librariesio/dependent-repos/pypi/tqdm.svg?logo=koding&logoColor=white
|
| 1583 |
+
:target: https://github.com/tqdm/tqdm/network/dependents
|
| 1584 |
+
.. |OpenHub-Status| image:: https://www.openhub.net/p/tqdm/widgets/project_thin_badge?format=gif
|
| 1585 |
+
:target: https://www.openhub.net/p/tqdm?ref=Thin+badge
|
| 1586 |
+
.. |awesome-python| image:: https://awesome.re/mentioned-badge.svg
|
| 1587 |
+
:target: https://github.com/vinta/awesome-python
|
| 1588 |
+
.. |LICENCE| image:: https://img.shields.io/pypi/l/tqdm.svg
|
| 1589 |
+
:target: https://raw.githubusercontent.com/tqdm/tqdm/master/LICENCE
|
| 1590 |
+
.. |DOI| image:: https://img.shields.io/badge/DOI-10.5281/zenodo.595120-blue.svg
|
| 1591 |
+
:target: https://doi.org/10.5281/zenodo.595120
|
| 1592 |
+
.. |colab-demo| image:: https://colab.research.google.com/assets/colab-badge.svg
|
| 1593 |
+
:target: https://colab.research.google.com/github/tqdm/tqdm/blob/master/DEMO.ipynb
|
| 1594 |
+
.. |binder-demo| image:: https://mybinder.org/badge_logo.svg
|
| 1595 |
+
:target: https://mybinder.org/v2/gh/tqdm/tqdm/master?filepath=DEMO.ipynb
|
| 1596 |
+
.. |Screenshot-Jupyter1| image:: https://tqdm.github.io/img/jupyter-1.gif
|
| 1597 |
+
.. |Screenshot-Jupyter2| image:: https://tqdm.github.io/img/jupyter-2.gif
|
| 1598 |
+
.. |Screenshot-Jupyter3| image:: https://tqdm.github.io/img/jupyter-3.gif
|
| 1599 |
+
.. |README-Hits| image:: https://cgi.cdcl.ml/hits?q=tqdm&style=social&r=https://github.com/tqdm/tqdm&l=https://tqdm.github.io/img/favicon.png&f=https://tqdm.github.io/img/logo.gif
|
| 1600 |
+
:target: https://cgi.cdcl.ml/hits?q=tqdm&a=plot&r=https://github.com/tqdm/tqdm&l=https://tqdm.github.io/img/favicon.png&f=https://tqdm.github.io/img/logo.gif&style=social
|
.cache/pip/http-v2/6/4/6/7/b/6467bdd236eabb4648139f514441e5510842fbc90755e4738c64fcf3
ADDED
|
Binary file (1.24 kB). View file
|
|
|
.cache/pip/http-v2/6/4/6/7/b/6467bdd236eabb4648139f514441e5510842fbc90755e4738c64fcf3.body
ADDED
|
@@ -0,0 +1,341 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Metadata-Version: 2.4
|
| 2 |
+
Name: colorlog
|
| 3 |
+
Version: 6.12.0
|
| 4 |
+
Summary: Add colours to the output of Python's logging module.
|
| 5 |
+
Home-page: https://github.com/borntyping/python-colorlog
|
| 6 |
+
Author: Sam Clements
|
| 7 |
+
Author-email: sam@borntyping.co.uk
|
| 8 |
+
License: MIT License
|
| 9 |
+
Classifier: Development Status :: 5 - Production/Stable
|
| 10 |
+
Classifier: Environment :: Console
|
| 11 |
+
Classifier: Intended Audience :: Developers
|
| 12 |
+
Classifier: License :: OSI Approved :: MIT License
|
| 13 |
+
Classifier: Operating System :: OS Independent
|
| 14 |
+
Classifier: Programming Language :: Python
|
| 15 |
+
Classifier: Programming Language :: Python :: 3
|
| 16 |
+
Classifier: Programming Language :: Python :: 3.6
|
| 17 |
+
Classifier: Programming Language :: Python :: 3.7
|
| 18 |
+
Classifier: Programming Language :: Python :: 3.8
|
| 19 |
+
Classifier: Programming Language :: Python :: 3.9
|
| 20 |
+
Classifier: Programming Language :: Python :: 3.10
|
| 21 |
+
Classifier: Programming Language :: Python :: 3.11
|
| 22 |
+
Classifier: Programming Language :: Python :: 3.12
|
| 23 |
+
Classifier: Programming Language :: Python :: 3.13
|
| 24 |
+
Classifier: Topic :: Terminals
|
| 25 |
+
Classifier: Topic :: Utilities
|
| 26 |
+
Requires-Python: >=3.6
|
| 27 |
+
Description-Content-Type: text/markdown
|
| 28 |
+
License-File: LICENSE
|
| 29 |
+
Requires-Dist: colorama; sys_platform == "win32"
|
| 30 |
+
Provides-Extra: development
|
| 31 |
+
Requires-Dist: black; extra == "development"
|
| 32 |
+
Requires-Dist: flake8; extra == "development"
|
| 33 |
+
Requires-Dist: mypy; extra == "development"
|
| 34 |
+
Requires-Dist: pytest; extra == "development"
|
| 35 |
+
Requires-Dist: types-colorama; extra == "development"
|
| 36 |
+
Dynamic: author
|
| 37 |
+
Dynamic: author-email
|
| 38 |
+
Dynamic: classifier
|
| 39 |
+
Dynamic: description
|
| 40 |
+
Dynamic: description-content-type
|
| 41 |
+
Dynamic: home-page
|
| 42 |
+
Dynamic: license
|
| 43 |
+
Dynamic: license-file
|
| 44 |
+
Dynamic: provides-extra
|
| 45 |
+
Dynamic: requires-python
|
| 46 |
+
Dynamic: summary
|
| 47 |
+
|
| 48 |
+
# Log formatting with colors!
|
| 49 |
+
|
| 50 |
+
[](https://pypi.org/project/colorlog/)
|
| 51 |
+
[](https://pypi.org/project/colorlog/)
|
| 52 |
+
|
| 53 |
+
Add colours to the output of Python's `logging` module.
|
| 54 |
+
|
| 55 |
+
- [Source on GitHub](https://github.com/borntyping/python-colorlog)
|
| 56 |
+
- [Package on PyPI](https://pypi.org/pypi/colorlog/)
|
| 57 |
+
|
| 58 |
+
## Status
|
| 59 |
+
|
| 60 |
+
colorlog currently requires Python 3.6 or higher. Older versions (below 5.x.x)
|
| 61 |
+
support Python 2.6 and above.
|
| 62 |
+
|
| 63 |
+
- colorlog 6.x requires Python 3.6 or higher.
|
| 64 |
+
- colorlog 5.x is an interim version that will warn Python 2 users to downgrade.
|
| 65 |
+
- colorlog 4.x is the final version supporting Python 2.
|
| 66 |
+
|
| 67 |
+
[colorama] is included as a dependency on Windows, where it is automatically
|
| 68 |
+
initialised to support colored output.
|
| 69 |
+
|
| 70 |
+
This library is over a decade old and supported a wide set of Python versions
|
| 71 |
+
for most of its life, which has made it a difficult library to add new features
|
| 72 |
+
to. colorlog 6 may break backwards compatibility so that newer features
|
| 73 |
+
can be added more easily, but may still not accept all changes or feature
|
| 74 |
+
requests. colorlog 4 might accept essential bugfixes but should not be
|
| 75 |
+
considered actively maintained and will not accept any major changes or new
|
| 76 |
+
features.
|
| 77 |
+
|
| 78 |
+
## Installation
|
| 79 |
+
|
| 80 |
+
Install from PyPI with:
|
| 81 |
+
|
| 82 |
+
```bash
|
| 83 |
+
pip install colorlog
|
| 84 |
+
```
|
| 85 |
+
|
| 86 |
+
Several Linux distributions provide official packages ([Debian], [Arch],
|
| 87 |
+
[Fedora], [Gentoo], [OpenSuse] and [Ubuntu]), and others have user provided
|
| 88 |
+
packages ([BSD ports], [Conda]).
|
| 89 |
+
|
| 90 |
+
## Usage
|
| 91 |
+
|
| 92 |
+
```python
|
| 93 |
+
import colorlog
|
| 94 |
+
|
| 95 |
+
handler = colorlog.StreamHandler()
|
| 96 |
+
handler.setFormatter(colorlog.ColoredFormatter())
|
| 97 |
+
|
| 98 |
+
logger = colorlog.getLogger('example')
|
| 99 |
+
logger.addHandler(handler)
|
| 100 |
+
```
|
| 101 |
+
|
| 102 |
+
### Arguments
|
| 103 |
+
|
| 104 |
+
`ColoredFormatter` extends [`logging.Formatter`][formatter] and accepts the
|
| 105 |
+
following arguments:
|
| 106 |
+
|
| 107 |
+
- `fmt` *(default=`None`)*: A format string used to output the message. If
|
| 108 |
+
`None`, a default format string is selected based on `style` (e.g.
|
| 109 |
+
`%(log_color)s%(levelname)s:%(name)s:%(message)s` for `%` style).
|
| 110 |
+
- `datefmt`, `style`, `validate`, `defaults`: see
|
| 111 |
+
[`logging.Formatter`][formatter].
|
| 112 |
+
- `reset` *(default=`True`)*: Implicitly adds a color reset code to the
|
| 113 |
+
message output, unless the output already ends with one.
|
| 114 |
+
- `log_colors` *(default=`None`)*: A mapping of record level names to color
|
| 115 |
+
names. If `None`, `colorlog.default_log_colors` is used.
|
| 116 |
+
- `secondary_log_colors` *(default=`None`)*: A mapping of names to `log_colors`
|
| 117 |
+
style mappings, defining additional colors that can be used in format strings.
|
| 118 |
+
If `None`, an empty mapping is used.
|
| 119 |
+
- `stream` *(default=`None`)*: The stream being written to (e.g. `sys.stderr`).
|
| 120 |
+
Used to detect whether the output is a TTY. Colors are disabled automatically
|
| 121 |
+
on non-TTY streams unless `force_color` is set.
|
| 122 |
+
- `no_color` *(default=`False`)*: Disable color output. Can also be set via the
|
| 123 |
+
`NO_COLOR` environment variable.
|
| 124 |
+
- `force_color` *(default=`False`)*: Force color output even on non-TTY streams.
|
| 125 |
+
Takes precedence over `no_color`. Can also be set via the `FORCE_COLOR`
|
| 126 |
+
environment variable.
|
| 127 |
+
|
| 128 |
+
### Color escape codes
|
| 129 |
+
|
| 130 |
+
Color escape codes can be selected based on the log records level, by adding
|
| 131 |
+
parameters to the format string:
|
| 132 |
+
|
| 133 |
+
- `log_color`: Return the color associated with the records level.
|
| 134 |
+
- `<name>_log_color`: Return another color based on the records level if the
|
| 135 |
+
formatter has secondary colors configured (see `secondary_log_colors` below).
|
| 136 |
+
|
| 137 |
+
Multiple escape codes can be used at once by joining them with commas when
|
| 138 |
+
configuring the color for a log level (but can't be used directly in the format
|
| 139 |
+
string). For example, `black,bg_white` would use the escape codes for black
|
| 140 |
+
text on a white background.
|
| 141 |
+
|
| 142 |
+
The following escape codes are made available for use in the format string:
|
| 143 |
+
|
| 144 |
+
- `{color}`, `fg_{color}`, `bg_{color}`: Foreground and background colors.
|
| 145 |
+
- `bold`, `bold_{color}`, `fg_bold_{color}`, `bg_bold_{color}`: Bold/bright
|
| 146 |
+
colors.
|
| 147 |
+
- `thin`, `thin_{color}`, `fg_thin_{color}`: Thin colors (terminal dependent).
|
| 148 |
+
- `reset`: Clear all formatting (both foreground and background colors).
|
| 149 |
+
|
| 150 |
+
The available color names are:
|
| 151 |
+
|
| 152 |
+
- `black`
|
| 153 |
+
- `red`
|
| 154 |
+
- `green`
|
| 155 |
+
- `yellow`
|
| 156 |
+
- `blue`
|
| 157 |
+
- `purple`
|
| 158 |
+
- `cyan`
|
| 159 |
+
- `white`
|
| 160 |
+
|
| 161 |
+
You can also use "bright" colors. These aren't standard ANSI codes, and
|
| 162 |
+
support for these varies wildly across different terminals.
|
| 163 |
+
|
| 164 |
+
- `light_black`
|
| 165 |
+
- `light_red`
|
| 166 |
+
- `light_green`
|
| 167 |
+
- `light_yellow`
|
| 168 |
+
- `light_blue`
|
| 169 |
+
- `light_purple`
|
| 170 |
+
- `light_cyan`
|
| 171 |
+
- `light_white`
|
| 172 |
+
|
| 173 |
+
In addition to pre-defined color names, you can use integers from 0 to 255 for
|
| 174 |
+
256-color support (e.g. `fg_196`, `bg_42`).
|
| 175 |
+
|
| 176 |
+
## Examples
|
| 177 |
+
|
| 178 |
+

|
| 179 |
+
|
| 180 |
+
The following snippet creates a `ColoredFormatter` for use in a logging setup,
|
| 181 |
+
with a custom format string and log colors:
|
| 182 |
+
|
| 183 |
+
```python
|
| 184 |
+
from colorlog import ColoredFormatter
|
| 185 |
+
|
| 186 |
+
formatter = ColoredFormatter(
|
| 187 |
+
"%(log_color)s%(levelname)-8s%(reset)s %(blue)s%(message)s",
|
| 188 |
+
log_colors={
|
| 189 |
+
"DEBUG": "cyan",
|
| 190 |
+
"INFO": "green",
|
| 191 |
+
"WARNING": "yellow",
|
| 192 |
+
"ERROR": "red",
|
| 193 |
+
"CRITICAL": "red,bg_white",
|
| 194 |
+
}
|
| 195 |
+
)
|
| 196 |
+
```
|
| 197 |
+
|
| 198 |
+
*See `docs/example.py` for full example script.*
|
| 199 |
+
|
| 200 |
+
### Using `secondary_log_colors`
|
| 201 |
+
|
| 202 |
+
Secondary log colors are a way to have more than one color that is selected
|
| 203 |
+
based on the log level. Each key in `secondary_log_colors` adds an attribute
|
| 204 |
+
that can be used in format strings (`message` becomes `message_log_color`), and
|
| 205 |
+
has a corresponding value that is identical in format to the `log_colors`
|
| 206 |
+
argument.
|
| 207 |
+
|
| 208 |
+
The following example highlights the level name using the default log colors,
|
| 209 |
+
and highlights the message in red for `error` and `critical` level log messages.
|
| 210 |
+
|
| 211 |
+
```python
|
| 212 |
+
from colorlog import ColoredFormatter
|
| 213 |
+
|
| 214 |
+
formatter = ColoredFormatter(
|
| 215 |
+
"%(log_color)s%(levelname)-8s%(reset)s %(message_log_color)s%(message)s",
|
| 216 |
+
secondary_log_colors={
|
| 217 |
+
'message': {
|
| 218 |
+
'ERROR': 'red',
|
| 219 |
+
'CRITICAL': 'red'
|
| 220 |
+
}
|
| 221 |
+
}
|
| 222 |
+
)
|
| 223 |
+
```
|
| 224 |
+
|
| 225 |
+
### With [`dictConfig`][dictconfig]
|
| 226 |
+
|
| 227 |
+
```python
|
| 228 |
+
logging.config.dictConfig({
|
| 229 |
+
'formatters': {
|
| 230 |
+
'colored': {
|
| 231 |
+
'()': 'colorlog.ColoredFormatter',
|
| 232 |
+
'format': "%(log_color)s%(levelname)-8s%(reset)s %(blue)s%(message)s"
|
| 233 |
+
}
|
| 234 |
+
}
|
| 235 |
+
})
|
| 236 |
+
```
|
| 237 |
+
|
| 238 |
+
A full example dictionary can be found in `tests/test_colorlog.py`.
|
| 239 |
+
|
| 240 |
+
### With [`fileConfig`][fileconfig]
|
| 241 |
+
|
| 242 |
+
```ini
|
| 243 |
+
...
|
| 244 |
+
|
| 245 |
+
[formatters]
|
| 246 |
+
keys=color
|
| 247 |
+
|
| 248 |
+
[formatter_color]
|
| 249 |
+
class=colorlog.ColoredFormatter
|
| 250 |
+
format=%(log_color)s%(levelname)-8s%(reset)s %(bg_blue)s[%(name)s]%(reset)s %(message)s from fileConfig
|
| 251 |
+
datefmt=%m-%d %H:%M:%S
|
| 252 |
+
```
|
| 253 |
+
|
| 254 |
+
An instance of ColoredFormatter created with those arguments will then be used
|
| 255 |
+
by any handlers that are configured to use the `color` formatter.
|
| 256 |
+
|
| 257 |
+
A full example configuration can be found in `tests/test_config.ini`.
|
| 258 |
+
|
| 259 |
+
### With custom log levels
|
| 260 |
+
|
| 261 |
+
ColoredFormatter will work with custom log levels added with
|
| 262 |
+
[`logging.addLevelName`][addlevelname]:
|
| 263 |
+
|
| 264 |
+
```python
|
| 265 |
+
import logging, colorlog
|
| 266 |
+
TRACE = 5
|
| 267 |
+
logging.addLevelName(TRACE, 'TRACE')
|
| 268 |
+
formatter = colorlog.ColoredFormatter(log_colors={'TRACE': 'yellow'})
|
| 269 |
+
handler = logging.StreamHandler()
|
| 270 |
+
handler.setFormatter(formatter)
|
| 271 |
+
logger = logging.getLogger('example')
|
| 272 |
+
logger.addHandler(handler)
|
| 273 |
+
logger.setLevel('TRACE')
|
| 274 |
+
logger.log(TRACE, 'a message using a custom level')
|
| 275 |
+
```
|
| 276 |
+
|
| 277 |
+
## Tests
|
| 278 |
+
|
| 279 |
+
Tests similar to the above examples are found in `tests/test_colorlog.py`.
|
| 280 |
+
|
| 281 |
+
## Status
|
| 282 |
+
|
| 283 |
+
colorlog is in maintenance mode. I try and ensure bugfixes are published,
|
| 284 |
+
but compatibility a wide set of Python versions makes this a difficult
|
| 285 |
+
codebase to add features to. Any changes that might break backwards
|
| 286 |
+
compatibility for existing users will not be considered.
|
| 287 |
+
|
| 288 |
+
## Alternatives
|
| 289 |
+
|
| 290 |
+
There are some more modern libraries for improving Python logging you may
|
| 291 |
+
find useful.
|
| 292 |
+
|
| 293 |
+
- [structlog]
|
| 294 |
+
- [jsonlog]
|
| 295 |
+
|
| 296 |
+
## Projects using colorlog
|
| 297 |
+
|
| 298 |
+
GitHub provides [a list of projects that depend on colorlog][dependents].
|
| 299 |
+
|
| 300 |
+
Some early adopters included [Errbot], [Pythran], and [zenlog].
|
| 301 |
+
|
| 302 |
+
## Licence
|
| 303 |
+
|
| 304 |
+
Copyright (c) 2012-2025 Sam Clements <sam@borntyping.co.uk>
|
| 305 |
+
|
| 306 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
| 307 |
+
this software and associated documentation files (the "Software"), to deal in
|
| 308 |
+
the Software without restriction, including without limitation the rights to
|
| 309 |
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
| 310 |
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
| 311 |
+
subject to the following conditions:
|
| 312 |
+
|
| 313 |
+
The above copyright notice and this permission notice shall be included in all
|
| 314 |
+
copies or substantial portions of the Software.
|
| 315 |
+
|
| 316 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 317 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
| 318 |
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
| 319 |
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
| 320 |
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
| 321 |
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
| 322 |
+
|
| 323 |
+
[addlevelname]: https://docs.python.org/3/library/logging.html#logging.addLevelName
|
| 324 |
+
[arch]: https://archlinux.org/packages/extra/any/python-colorlog/
|
| 325 |
+
[bsd ports]: https://www.freshports.org/devel/py-colorlog/
|
| 326 |
+
[colorama]: https://pypi.python.org/pypi/colorama
|
| 327 |
+
[conda]: https://anaconda.org/conda-forge/colorlog
|
| 328 |
+
[debian]: https://packages.debian.org/trixie/python3-colorlog
|
| 329 |
+
[dependents]: https://github.com/borntyping/python-colorlog/network/dependents?package_id=UGFja2FnZS01MDk3NDcyMQ%3D%3D
|
| 330 |
+
[dictconfig]: http://docs.python.org/3/library/logging.config.html#logging.config.dictConfig
|
| 331 |
+
[errbot]: http://errbot.io/
|
| 332 |
+
[fedora]: https://src.fedoraproject.org/rpms/python-colorlog
|
| 333 |
+
[fileconfig]: http://docs.python.org/3/library/logging.config.html#logging.config.fileConfig
|
| 334 |
+
[formatter]: http://docs.python.org/3/library/logging.html#logging.Formatter
|
| 335 |
+
[gentoo]: https://packages.gentoo.org/packages/dev-python/colorlog
|
| 336 |
+
[jsonlog]: https://github.com/borntyping/jsonlog
|
| 337 |
+
[opensuse]: http://rpm.pbone.net/index.php3?stat=3&search=python-colorlog&srodzaj=3
|
| 338 |
+
[pythran]: https://github.com/serge-sans-paille/pythran
|
| 339 |
+
[structlog]: https://www.structlog.org/en/stable/
|
| 340 |
+
[ubuntu]: https://launchpad.net/python-colorlog
|
| 341 |
+
[zenlog]: https://github.com/ManufacturaInd/python-zenlog
|
.cache/pip/http-v2/6/4/c/f/c/64cfc03e83f9fad4049b1d2a1d785c9273270a4ab9788b538f5054e3
ADDED
|
Binary file (1.9 kB). View file
|
|
|
.cache/pip/http-v2/6/5/1/e/5/651e58859e8db8c99b9e7068d03984cfd4577518ff0e021c717afbf4
ADDED
|
Binary file (1.24 kB). View file
|
|
|
.cache/pip/http-v2/6/5/1/e/5/651e58859e8db8c99b9e7068d03984cfd4577518ff0e021c717afbf4.body
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Metadata-Version: 2.1
|
| 2 |
+
Name: cycler
|
| 3 |
+
Version: 0.12.1
|
| 4 |
+
Summary: Composable style cycles
|
| 5 |
+
Author-email: Thomas A Caswell <matplotlib-users@python.org>
|
| 6 |
+
License: Copyright (c) 2015, matplotlib project
|
| 7 |
+
All rights reserved.
|
| 8 |
+
|
| 9 |
+
Redistribution and use in source and binary forms, with or without
|
| 10 |
+
modification, are permitted provided that the following conditions are met:
|
| 11 |
+
|
| 12 |
+
* Redistributions of source code must retain the above copyright notice, this
|
| 13 |
+
list of conditions and the following disclaimer.
|
| 14 |
+
|
| 15 |
+
* Redistributions in binary form must reproduce the above copyright notice,
|
| 16 |
+
this list of conditions and the following disclaimer in the documentation
|
| 17 |
+
and/or other materials provided with the distribution.
|
| 18 |
+
|
| 19 |
+
* Neither the name of the matplotlib project nor the names of its
|
| 20 |
+
contributors may be used to endorse or promote products derived from
|
| 21 |
+
this software without specific prior written permission.
|
| 22 |
+
|
| 23 |
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
| 24 |
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
| 25 |
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
| 26 |
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
| 27 |
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
| 28 |
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
| 29 |
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
| 30 |
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
| 31 |
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| 32 |
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| 33 |
+
Project-URL: homepage, https://matplotlib.org/cycler/
|
| 34 |
+
Project-URL: repository, https://github.com/matplotlib/cycler
|
| 35 |
+
Keywords: cycle kwargs
|
| 36 |
+
Classifier: License :: OSI Approved :: BSD License
|
| 37 |
+
Classifier: Development Status :: 4 - Beta
|
| 38 |
+
Classifier: Programming Language :: Python :: 3
|
| 39 |
+
Classifier: Programming Language :: Python :: 3.8
|
| 40 |
+
Classifier: Programming Language :: Python :: 3.9
|
| 41 |
+
Classifier: Programming Language :: Python :: 3.10
|
| 42 |
+
Classifier: Programming Language :: Python :: 3.11
|
| 43 |
+
Classifier: Programming Language :: Python :: 3.12
|
| 44 |
+
Classifier: Programming Language :: Python :: 3 :: Only
|
| 45 |
+
Requires-Python: >=3.8
|
| 46 |
+
Description-Content-Type: text/x-rst
|
| 47 |
+
License-File: LICENSE
|
| 48 |
+
Provides-Extra: docs
|
| 49 |
+
Requires-Dist: ipython ; extra == 'docs'
|
| 50 |
+
Requires-Dist: matplotlib ; extra == 'docs'
|
| 51 |
+
Requires-Dist: numpydoc ; extra == 'docs'
|
| 52 |
+
Requires-Dist: sphinx ; extra == 'docs'
|
| 53 |
+
Provides-Extra: tests
|
| 54 |
+
Requires-Dist: pytest ; extra == 'tests'
|
| 55 |
+
Requires-Dist: pytest-cov ; extra == 'tests'
|
| 56 |
+
Requires-Dist: pytest-xdist ; extra == 'tests'
|
| 57 |
+
|
| 58 |
+
|PyPi|_ |Conda|_ |Supported Python versions|_ |GitHub Actions|_ |Codecov|_
|
| 59 |
+
|
| 60 |
+
.. |PyPi| image:: https://img.shields.io/pypi/v/cycler.svg?style=flat
|
| 61 |
+
.. _PyPi: https://pypi.python.org/pypi/cycler
|
| 62 |
+
|
| 63 |
+
.. |Conda| image:: https://img.shields.io/conda/v/conda-forge/cycler
|
| 64 |
+
.. _Conda: https://anaconda.org/conda-forge/cycler
|
| 65 |
+
|
| 66 |
+
.. |Supported Python versions| image:: https://img.shields.io/pypi/pyversions/cycler.svg
|
| 67 |
+
.. _Supported Python versions: https://pypi.python.org/pypi/cycler
|
| 68 |
+
|
| 69 |
+
.. |GitHub Actions| image:: https://github.com/matplotlib/cycler/actions/workflows/tests.yml/badge.svg
|
| 70 |
+
.. _GitHub Actions: https://github.com/matplotlib/cycler/actions
|
| 71 |
+
|
| 72 |
+
.. |Codecov| image:: https://codecov.io/github/matplotlib/cycler/badge.svg?branch=main&service=github
|
| 73 |
+
.. _Codecov: https://codecov.io/github/matplotlib/cycler?branch=main
|
| 74 |
+
|
| 75 |
+
cycler: composable cycles
|
| 76 |
+
=========================
|
| 77 |
+
|
| 78 |
+
Docs: https://matplotlib.org/cycler/
|
.cache/pip/http-v2/6/6/e/c/7/66ec76a7b6ed4081044f5c7821af293b63c17bc2ac523ff93d5ca7d5
ADDED
|
Binary file (1.9 kB). View file
|
|
|
.cache/pip/http-v2/6/8/0/d/4/680d4dd80dc6a3d2df9b9478dfcc8e81e0e4f130e154a3268b98b877
ADDED
|
Binary file (1.9 kB). View file
|
|
|
.cache/pip/http-v2/6/b/5/3/a/6b53a9dd0e4fce887cc28c1a921aa1befe8c1a82e6c213d2542d2acb
ADDED
|
Binary file (1.9 kB). View file
|
|
|
.cache/pip/http-v2/6/b/5/3/a/6b53a9dd0e4fce887cc28c1a921aa1befe8c1a82e6c213d2542d2acb.body
ADDED
|
Binary file (14.8 kB). View file
|
|
|
.cache/pip/http-v2/a/b/e/2/c/abe2c30c0d105321771461cb84423576f0ec11c835b815e82e629cf7.body
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:ba8f811b8ddfac493734d6af0b2dff96919d0c28ca0d641858dab4262777c6ea
|
| 3 |
+
size 10035615
|
.cache/pip/http-v2/c/1/6/c/6/c16c6c635e568e65136b95a15ea17f91b43799aeb0a7e80b55d7a898
ADDED
|
Binary file (1.22 kB). View file
|
|
|
.cache/pip/http-v2/c/1/6/c/6/c16c6c635e568e65136b95a15ea17f91b43799aeb0a7e80b55d7a898.body
ADDED
|
@@ -0,0 +1,1366 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Metadata-Version: 2.1
|
| 2 |
+
Name: matplotlib
|
| 3 |
+
Version: 3.11.1
|
| 4 |
+
Summary: Python plotting package
|
| 5 |
+
Author: John D. Hunter, Michael Droettboom
|
| 6 |
+
Author-Email: Unknown <matplotlib-users@python.org>
|
| 7 |
+
License: License agreement for matplotlib versions 1.3.0 and later
|
| 8 |
+
=========================================================
|
| 9 |
+
|
| 10 |
+
1. This LICENSE AGREEMENT is between the Matplotlib Development Team
|
| 11 |
+
("MDT"), and the Individual or Organization ("Licensee") accessing and
|
| 12 |
+
otherwise using matplotlib software in source or binary form and its
|
| 13 |
+
associated documentation.
|
| 14 |
+
|
| 15 |
+
2. Subject to the terms and conditions of this License Agreement, MDT
|
| 16 |
+
hereby grants Licensee a nonexclusive, royalty-free, world-wide license
|
| 17 |
+
to reproduce, analyze, test, perform and/or display publicly, prepare
|
| 18 |
+
derivative works, distribute, and otherwise use matplotlib
|
| 19 |
+
alone or in any derivative version, provided, however, that MDT's
|
| 20 |
+
License Agreement and MDT's notice of copyright, i.e., "Copyright (c)
|
| 21 |
+
2012- Matplotlib Development Team; All Rights Reserved" are retained in
|
| 22 |
+
matplotlib alone or in any derivative version prepared by
|
| 23 |
+
Licensee.
|
| 24 |
+
|
| 25 |
+
3. In the event Licensee prepares a derivative work that is based on or
|
| 26 |
+
incorporates matplotlib or any part thereof, and wants to
|
| 27 |
+
make the derivative work available to others as provided herein, then
|
| 28 |
+
Licensee hereby agrees to include in any such work a brief summary of
|
| 29 |
+
the changes made to matplotlib .
|
| 30 |
+
|
| 31 |
+
4. MDT is making matplotlib available to Licensee on an "AS
|
| 32 |
+
IS" basis. MDT MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR
|
| 33 |
+
IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, MDT MAKES NO AND
|
| 34 |
+
DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS
|
| 35 |
+
FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF MATPLOTLIB
|
| 36 |
+
WILL NOT INFRINGE ANY THIRD PARTY RIGHTS.
|
| 37 |
+
|
| 38 |
+
5. MDT SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF MATPLOTLIB
|
| 39 |
+
FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR
|
| 40 |
+
LOSS AS A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING
|
| 41 |
+
MATPLOTLIB , OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF
|
| 42 |
+
THE POSSIBILITY THEREOF.
|
| 43 |
+
|
| 44 |
+
6. This License Agreement will automatically terminate upon a material
|
| 45 |
+
breach of its terms and conditions.
|
| 46 |
+
|
| 47 |
+
7. Nothing in this License Agreement shall be deemed to create any
|
| 48 |
+
relationship of agency, partnership, or joint venture between MDT and
|
| 49 |
+
Licensee. This License Agreement does not grant permission to use MDT
|
| 50 |
+
trademarks or trade name in a trademark sense to endorse or promote
|
| 51 |
+
products or services of Licensee, or any third party.
|
| 52 |
+
|
| 53 |
+
8. By copying, installing or otherwise using matplotlib ,
|
| 54 |
+
Licensee agrees to be bound by the terms and conditions of this License
|
| 55 |
+
Agreement.
|
| 56 |
+
|
| 57 |
+
License agreement for matplotlib versions prior to 1.3.0
|
| 58 |
+
========================================================
|
| 59 |
+
|
| 60 |
+
1. This LICENSE AGREEMENT is between John D. Hunter ("JDH"), and the
|
| 61 |
+
Individual or Organization ("Licensee") accessing and otherwise using
|
| 62 |
+
matplotlib software in source or binary form and its associated
|
| 63 |
+
documentation.
|
| 64 |
+
|
| 65 |
+
2. Subject to the terms and conditions of this License Agreement, JDH
|
| 66 |
+
hereby grants Licensee a nonexclusive, royalty-free, world-wide license
|
| 67 |
+
to reproduce, analyze, test, perform and/or display publicly, prepare
|
| 68 |
+
derivative works, distribute, and otherwise use matplotlib
|
| 69 |
+
alone or in any derivative version, provided, however, that JDH's
|
| 70 |
+
License Agreement and JDH's notice of copyright, i.e., "Copyright (c)
|
| 71 |
+
2002-2011 John D. Hunter; All Rights Reserved" are retained in
|
| 72 |
+
matplotlib alone or in any derivative version prepared by
|
| 73 |
+
Licensee.
|
| 74 |
+
|
| 75 |
+
3. In the event Licensee prepares a derivative work that is based on or
|
| 76 |
+
incorporates matplotlib or any part thereof, and wants to
|
| 77 |
+
make the derivative work available to others as provided herein, then
|
| 78 |
+
Licensee hereby agrees to include in any such work a brief summary of
|
| 79 |
+
the changes made to matplotlib.
|
| 80 |
+
|
| 81 |
+
4. JDH is making matplotlib available to Licensee on an "AS
|
| 82 |
+
IS" basis. JDH MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR
|
| 83 |
+
IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, JDH MAKES NO AND
|
| 84 |
+
DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS
|
| 85 |
+
FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF MATPLOTLIB
|
| 86 |
+
WILL NOT INFRINGE ANY THIRD PARTY RIGHTS.
|
| 87 |
+
|
| 88 |
+
5. JDH SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF MATPLOTLIB
|
| 89 |
+
FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR
|
| 90 |
+
LOSS AS A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING
|
| 91 |
+
MATPLOTLIB , OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF
|
| 92 |
+
THE POSSIBILITY THEREOF.
|
| 93 |
+
|
| 94 |
+
6. This License Agreement will automatically terminate upon a material
|
| 95 |
+
breach of its terms and conditions.
|
| 96 |
+
|
| 97 |
+
7. Nothing in this License Agreement shall be deemed to create any
|
| 98 |
+
relationship of agency, partnership, or joint venture between JDH and
|
| 99 |
+
Licensee. This License Agreement does not grant permission to use JDH
|
| 100 |
+
trademarks or trade name in a trademark sense to endorse or promote
|
| 101 |
+
products or services of Licensee, or any third party.
|
| 102 |
+
|
| 103 |
+
8. By copying, installing or otherwise using matplotlib,
|
| 104 |
+
Licensee agrees to be bound by the terms and conditions of this License
|
| 105 |
+
Agreement.
|
| 106 |
+
----
|
| 107 |
+
|
| 108 |
+
This binary distrubution of Matplotlib can also bundle the following software
|
| 109 |
+
(depending on the build):
|
| 110 |
+
|
| 111 |
+
Name: AMS Fonts
|
| 112 |
+
Files: matplotlib/tests/cmr10.pfb
|
| 113 |
+
Description: Type-1 version of one of Knuth's Computer Modern fonts
|
| 114 |
+
License: OFL-1.1
|
| 115 |
+
The cmr10.pfb file is a Type-1 version of one of Knuth's Computer Modern fonts.
|
| 116 |
+
It is included here as test data only, but the following license applies.
|
| 117 |
+
|
| 118 |
+
Copyright (c) 1997, 2009, American Mathematical Society (http://www.ams.org).
|
| 119 |
+
All Rights Reserved.
|
| 120 |
+
|
| 121 |
+
"cmb10" is a Reserved Font Name for this Font Software.
|
| 122 |
+
"cmbsy10" is a Reserved Font Name for this Font Software.
|
| 123 |
+
"cmbsy5" is a Reserved Font Name for this Font Software.
|
| 124 |
+
"cmbsy6" is a Reserved Font Name for this Font Software.
|
| 125 |
+
"cmbsy7" is a Reserved Font Name for this Font Software.
|
| 126 |
+
"cmbsy8" is a Reserved Font Name for this Font Software.
|
| 127 |
+
"cmbsy9" is a Reserved Font Name for this Font Software.
|
| 128 |
+
"cmbx10" is a Reserved Font Name for this Font Software.
|
| 129 |
+
"cmbx12" is a Reserved Font Name for this Font Software.
|
| 130 |
+
"cmbx5" is a Reserved Font Name for this Font Software.
|
| 131 |
+
"cmbx6" is a Reserved Font Name for this Font Software.
|
| 132 |
+
"cmbx7" is a Reserved Font Name for this Font Software.
|
| 133 |
+
"cmbx8" is a Reserved Font Name for this Font Software.
|
| 134 |
+
"cmbx9" is a Reserved Font Name for this Font Software.
|
| 135 |
+
"cmbxsl10" is a Reserved Font Name for this Font Software.
|
| 136 |
+
"cmbxti10" is a Reserved Font Name for this Font Software.
|
| 137 |
+
"cmcsc10" is a Reserved Font Name for this Font Software.
|
| 138 |
+
"cmcsc8" is a Reserved Font Name for this Font Software.
|
| 139 |
+
"cmcsc9" is a Reserved Font Name for this Font Software.
|
| 140 |
+
"cmdunh10" is a Reserved Font Name for this Font Software.
|
| 141 |
+
"cmex10" is a Reserved Font Name for this Font Software.
|
| 142 |
+
"cmex7" is a Reserved Font Name for this Font Software.
|
| 143 |
+
"cmex8" is a Reserved Font Name for this Font Software.
|
| 144 |
+
"cmex9" is a Reserved Font Name for this Font Software.
|
| 145 |
+
"cmff10" is a Reserved Font Name for this Font Software.
|
| 146 |
+
"cmfi10" is a Reserved Font Name for this Font Software.
|
| 147 |
+
"cmfib8" is a Reserved Font Name for this Font Software.
|
| 148 |
+
"cminch" is a Reserved Font Name for this Font Software.
|
| 149 |
+
"cmitt10" is a Reserved Font Name for this Font Software.
|
| 150 |
+
"cmmi10" is a Reserved Font Name for this Font Software.
|
| 151 |
+
"cmmi12" is a Reserved Font Name for this Font Software.
|
| 152 |
+
"cmmi5" is a Reserved Font Name for this Font Software.
|
| 153 |
+
"cmmi6" is a Reserved Font Name for this Font Software.
|
| 154 |
+
"cmmi7" is a Reserved Font Name for this Font Software.
|
| 155 |
+
"cmmi8" is a Reserved Font Name for this Font Software.
|
| 156 |
+
"cmmi9" is a Reserved Font Name for this Font Software.
|
| 157 |
+
"cmmib10" is a Reserved Font Name for this Font Software.
|
| 158 |
+
"cmmib5" is a Reserved Font Name for this Font Software.
|
| 159 |
+
"cmmib6" is a Reserved Font Name for this Font Software.
|
| 160 |
+
"cmmib7" is a Reserved Font Name for this Font Software.
|
| 161 |
+
"cmmib8" is a Reserved Font Name for this Font Software.
|
| 162 |
+
"cmmib9" is a Reserved Font Name for this Font Software.
|
| 163 |
+
"cmr10" is a Reserved Font Name for this Font Software.
|
| 164 |
+
"cmr12" is a Reserved Font Name for this Font Software.
|
| 165 |
+
"cmr17" is a Reserved Font Name for this Font Software.
|
| 166 |
+
"cmr5" is a Reserved Font Name for this Font Software.
|
| 167 |
+
"cmr6" is a Reserved Font Name for this Font Software.
|
| 168 |
+
"cmr7" is a Reserved Font Name for this Font Software.
|
| 169 |
+
"cmr8" is a Reserved Font Name for this Font Software.
|
| 170 |
+
"cmr9" is a Reserved Font Name for this Font Software.
|
| 171 |
+
"cmsl10" is a Reserved Font Name for this Font Software.
|
| 172 |
+
"cmsl12" is a Reserved Font Name for this Font Software.
|
| 173 |
+
"cmsl8" is a Reserved Font Name for this Font Software.
|
| 174 |
+
"cmsl9" is a Reserved Font Name for this Font Software.
|
| 175 |
+
"cmsltt10" is a Reserved Font Name for this Font Software.
|
| 176 |
+
"cmss10" is a Reserved Font Name for this Font Software.
|
| 177 |
+
"cmss12" is a Reserved Font Name for this Font Software.
|
| 178 |
+
"cmss17" is a Reserved Font Name for this Font Software.
|
| 179 |
+
"cmss8" is a Reserved Font Name for this Font Software.
|
| 180 |
+
"cmss9" is a Reserved Font Name for this Font Software.
|
| 181 |
+
"cmssbx10" is a Reserved Font Name for this Font Software.
|
| 182 |
+
"cmssdc10" is a Reserved Font Name for this Font Software.
|
| 183 |
+
"cmssi10" is a Reserved Font Name for this Font Software.
|
| 184 |
+
"cmssi12" is a Reserved Font Name for this Font Software.
|
| 185 |
+
"cmssi17" is a Reserved Font Name for this Font Software.
|
| 186 |
+
"cmssi8" is a Reserved Font Name for this Font Software.
|
| 187 |
+
"cmssi9" is a Reserved Font Name for this Font Software.
|
| 188 |
+
"cmssq8" is a Reserved Font Name for this Font Software.
|
| 189 |
+
"cmssqi8" is a Reserved Font Name for this Font Software.
|
| 190 |
+
"cmsy10" is a Reserved Font Name for this Font Software.
|
| 191 |
+
"cmsy5" is a Reserved Font Name for this Font Software.
|
| 192 |
+
"cmsy6" is a Reserved Font Name for this Font Software.
|
| 193 |
+
"cmsy7" is a Reserved Font Name for this Font Software.
|
| 194 |
+
"cmsy8" is a Reserved Font Name for this Font Software.
|
| 195 |
+
"cmsy9" is a Reserved Font Name for this Font Software.
|
| 196 |
+
"cmtcsc10" is a Reserved Font Name for this Font Software.
|
| 197 |
+
"cmtex10" is a Reserved Font Name for this Font Software.
|
| 198 |
+
"cmtex8" is a Reserved Font Name for this Font Software.
|
| 199 |
+
"cmtex9" is a Reserved Font Name for this Font Software.
|
| 200 |
+
"cmti10" is a Reserved Font Name for this Font Software.
|
| 201 |
+
"cmti12" is a Reserved Font Name for this Font Software.
|
| 202 |
+
"cmti7" is a Reserved Font Name for this Font Software.
|
| 203 |
+
"cmti8" is a Reserved Font Name for this Font Software.
|
| 204 |
+
"cmti9" is a Reserved Font Name for this Font Software.
|
| 205 |
+
"cmtt10" is a Reserved Font Name for this Font Software.
|
| 206 |
+
"cmtt12" is a Reserved Font Name for this Font Software.
|
| 207 |
+
"cmtt8" is a Reserved Font Name for this Font Software.
|
| 208 |
+
"cmtt9" is a Reserved Font Name for this Font Software.
|
| 209 |
+
"cmu10" is a Reserved Font Name for this Font Software.
|
| 210 |
+
"cmvtt10" is a Reserved Font Name for this Font Software.
|
| 211 |
+
"euex10" is a Reserved Font Name for this Font Software.
|
| 212 |
+
"euex7" is a Reserved Font Name for this Font Software.
|
| 213 |
+
"euex8" is a Reserved Font Name for this Font Software.
|
| 214 |
+
"euex9" is a Reserved Font Name for this Font Software.
|
| 215 |
+
"eufb10" is a Reserved Font Name for this Font Software.
|
| 216 |
+
"eufb5" is a Reserved Font Name for this Font Software.
|
| 217 |
+
"eufb7" is a Reserved Font Name for this Font Software.
|
| 218 |
+
"eufm10" is a Reserved Font Name for this Font Software.
|
| 219 |
+
"eufm5" is a Reserved Font Name for this Font Software.
|
| 220 |
+
"eufm7" is a Reserved Font Name for this Font Software.
|
| 221 |
+
"eurb10" is a Reserved Font Name for this Font Software.
|
| 222 |
+
"eurb5" is a Reserved Font Name for this Font Software.
|
| 223 |
+
"eurb7" is a Reserved Font Name for this Font Software.
|
| 224 |
+
"eurm10" is a Reserved Font Name for this Font Software.
|
| 225 |
+
"eurm5" is a Reserved Font Name for this Font Software.
|
| 226 |
+
"eurm7" is a Reserved Font Name for this Font Software.
|
| 227 |
+
"eusb10" is a Reserved Font Name for this Font Software.
|
| 228 |
+
"eusb5" is a Reserved Font Name for this Font Software.
|
| 229 |
+
"eusb7" is a Reserved Font Name for this Font Software.
|
| 230 |
+
"eusm10" is a Reserved Font Name for this Font Software.
|
| 231 |
+
"eusm5" is a Reserved Font Name for this Font Software.
|
| 232 |
+
"eusm7" is a Reserved Font Name for this Font Software.
|
| 233 |
+
"lasy10" is a Reserved Font Name for this Font Software.
|
| 234 |
+
"lasy5" is a Reserved Font Name for this Font Software.
|
| 235 |
+
"lasy6" is a Reserved Font Name for this Font Software.
|
| 236 |
+
"lasy7" is a Reserved Font Name for this Font Software.
|
| 237 |
+
"lasy8" is a Reserved Font Name for this Font Software.
|
| 238 |
+
"lasy9" is a Reserved Font Name for this Font Software.
|
| 239 |
+
"lasyb10" is a Reserved Font Name for this Font Software.
|
| 240 |
+
"lcircle1" is a Reserved Font Name for this Font Software.
|
| 241 |
+
"lcirclew" is a Reserved Font Name for this Font Software.
|
| 242 |
+
"lcmss8" is a Reserved Font Name for this Font Software.
|
| 243 |
+
"lcmssb8" is a Reserved Font Name for this Font Software.
|
| 244 |
+
"lcmssi8" is a Reserved Font Name for this Font Software.
|
| 245 |
+
"line10" is a Reserved Font Name for this Font Software.
|
| 246 |
+
"linew10" is a Reserved Font Name for this Font Software.
|
| 247 |
+
"msam10" is a Reserved Font Name for this Font Software.
|
| 248 |
+
"msam5" is a Reserved Font Name for this Font Software.
|
| 249 |
+
"msam6" is a Reserved Font Name for this Font Software.
|
| 250 |
+
"msam7" is a Reserved Font Name for this Font Software.
|
| 251 |
+
"msam8" is a Reserved Font Name for this Font Software.
|
| 252 |
+
"msam9" is a Reserved Font Name for this Font Software.
|
| 253 |
+
"msbm10" is a Reserved Font Name for this Font Software.
|
| 254 |
+
"msbm5" is a Reserved Font Name for this Font Software.
|
| 255 |
+
"msbm6" is a Reserved Font Name for this Font Software.
|
| 256 |
+
"msbm7" is a Reserved Font Name for this Font Software.
|
| 257 |
+
"msbm8" is a Reserved Font Name for this Font Software.
|
| 258 |
+
"msbm9" is a Reserved Font Name for this Font Software.
|
| 259 |
+
"wncyb10" is a Reserved Font Name for this Font Software.
|
| 260 |
+
"wncyi10" is a Reserved Font Name for this Font Software.
|
| 261 |
+
"wncyr10" is a Reserved Font Name for this Font Software.
|
| 262 |
+
"wncysc10" is a Reserved Font Name for this Font Software.
|
| 263 |
+
"wncyss10" is a Reserved Font Name for this Font Software.
|
| 264 |
+
|
| 265 |
+
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
| 266 |
+
This license is copied below, and is also available with a FAQ at:
|
| 267 |
+
http://scripts.sil.org/OFL
|
| 268 |
+
|
| 269 |
+
-----------------------------------------------------------
|
| 270 |
+
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
| 271 |
+
-----------------------------------------------------------
|
| 272 |
+
|
| 273 |
+
PREAMBLE
|
| 274 |
+
The goals of the Open Font License (OFL) are to stimulate worldwide
|
| 275 |
+
development of collaborative font projects, to support the font creation
|
| 276 |
+
efforts of academic and linguistic communities, and to provide a free and
|
| 277 |
+
open framework in which fonts may be shared and improved in partnership
|
| 278 |
+
with others.
|
| 279 |
+
|
| 280 |
+
The OFL allows the licensed fonts to be used, studied, modified and
|
| 281 |
+
redistributed freely as long as they are not sold by themselves. The
|
| 282 |
+
fonts, including any derivative works, can be bundled, embedded,
|
| 283 |
+
redistributed and/or sold with any software provided that any reserved
|
| 284 |
+
names are not used by derivative works. The fonts and derivatives,
|
| 285 |
+
however, cannot be released under any other type of license. The
|
| 286 |
+
requirement for fonts to remain under this license does not apply
|
| 287 |
+
to any document created using the fonts or their derivatives.
|
| 288 |
+
|
| 289 |
+
DEFINITIONS
|
| 290 |
+
"Font Software" refers to the set of files released by the Copyright
|
| 291 |
+
Holder(s) under this license and clearly marked as such. This may
|
| 292 |
+
include source files, build scripts and documentation.
|
| 293 |
+
|
| 294 |
+
"Reserved Font Name" refers to any names specified as such after the
|
| 295 |
+
copyright statement(s).
|
| 296 |
+
|
| 297 |
+
"Original Version" refers to the collection of Font Software components as
|
| 298 |
+
distributed by the Copyright Holder(s).
|
| 299 |
+
|
| 300 |
+
"Modified Version" refers to any derivative made by adding to, deleting,
|
| 301 |
+
or substituting -- in part or in whole -- any of the components of the
|
| 302 |
+
Original Version, by changing formats or by porting the Font Software to a
|
| 303 |
+
new environment.
|
| 304 |
+
|
| 305 |
+
"Author" refers to any designer, engineer, programmer, technical
|
| 306 |
+
writer or other person who contributed to the Font Software.
|
| 307 |
+
|
| 308 |
+
PERMISSION & CONDITIONS
|
| 309 |
+
Permission is hereby granted, free of charge, to any person obtaining
|
| 310 |
+
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
| 311 |
+
redistribute, and sell modified and unmodified copies of the Font
|
| 312 |
+
Software, subject to the following conditions:
|
| 313 |
+
|
| 314 |
+
1) Neither the Font Software nor any of its individual components,
|
| 315 |
+
in Original or Modified Versions, may be sold by itself.
|
| 316 |
+
|
| 317 |
+
2) Original or Modified Versions of the Font Software may be bundled,
|
| 318 |
+
redistributed and/or sold with any software, provided that each copy
|
| 319 |
+
contains the above copyright notice and this license. These can be
|
| 320 |
+
included either as stand-alone text files, human-readable headers or
|
| 321 |
+
in the appropriate machine-readable metadata fields within text or
|
| 322 |
+
binary files as long as those fields can be easily viewed by the user.
|
| 323 |
+
|
| 324 |
+
3) No Modified Version of the Font Software may use the Reserved Font
|
| 325 |
+
Name(s) unless explicit written permission is granted by the corresponding
|
| 326 |
+
Copyright Holder. This restriction only applies to the primary font name as
|
| 327 |
+
presented to the users.
|
| 328 |
+
|
| 329 |
+
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
| 330 |
+
Software shall not be used to promote, endorse or advertise any
|
| 331 |
+
Modified Version, except to acknowledge the contribution(s) of the
|
| 332 |
+
Copyright Holder(s) and the Author(s) or with their explicit written
|
| 333 |
+
permission.
|
| 334 |
+
|
| 335 |
+
5) The Font Software, modified or unmodified, in part or in whole,
|
| 336 |
+
must be distributed entirely under this license, and must not be
|
| 337 |
+
distributed under any other license. The requirement for fonts to
|
| 338 |
+
remain under this license does not apply to any document created
|
| 339 |
+
using the Font Software.
|
| 340 |
+
|
| 341 |
+
TERMINATION
|
| 342 |
+
This license becomes null and void if any of the above conditions are
|
| 343 |
+
not met.
|
| 344 |
+
|
| 345 |
+
DISCLAIMER
|
| 346 |
+
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
| 347 |
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
| 348 |
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
| 349 |
+
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
| 350 |
+
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
| 351 |
+
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
| 352 |
+
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
| 353 |
+
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
| 354 |
+
OTHER DEALINGS IN THE FONT SOFTWARE.
|
| 355 |
+
|
| 356 |
+
|
| 357 |
+
|
| 358 |
+
Name: BaKoMa Fonts
|
| 359 |
+
Files: matplotlib/mpl-data/fonts/ttf/cm*.ttf matplotlib/mpl-data/fonts/afm/cm*.afm
|
| 360 |
+
Description: Computer Modern Fonts in PostScript Type 1 and TrueType font formats.
|
| 361 |
+
License: BaKoMa Fonts Licence
|
| 362 |
+
BaKoMa Fonts Licence
|
| 363 |
+
--------------------
|
| 364 |
+
|
| 365 |
+
This licence covers two font packs (known as BaKoMa Fonts Collection,
|
| 366 |
+
which is available at `CTAN:fonts/cm/ps-type1/bakoma/'):
|
| 367 |
+
|
| 368 |
+
1) BaKoMa-CM (1.1/12-Nov-94)
|
| 369 |
+
Computer Modern Fonts in PostScript Type 1 and TrueType font formats.
|
| 370 |
+
|
| 371 |
+
2) BaKoMa-AMS (1.2/19-Jan-95)
|
| 372 |
+
AMS TeX fonts in PostScript Type 1 and TrueType font formats.
|
| 373 |
+
|
| 374 |
+
Copyright (C) 1994, 1995, Basil K. Malyshev. All Rights Reserved.
|
| 375 |
+
|
| 376 |
+
Permission to copy and distribute these fonts for any purpose is
|
| 377 |
+
hereby granted without fee, provided that the above copyright notice,
|
| 378 |
+
author statement and this permission notice appear in all copies of
|
| 379 |
+
these fonts and related documentation.
|
| 380 |
+
|
| 381 |
+
Permission to modify and distribute modified fonts for any purpose is
|
| 382 |
+
hereby granted without fee, provided that the copyright notice,
|
| 383 |
+
author statement, this permission notice and location of original
|
| 384 |
+
fonts (http://www.ctan.org/tex-archive/fonts/cm/ps-type1/bakoma)
|
| 385 |
+
appear in all copies of modified fonts and related documentation.
|
| 386 |
+
|
| 387 |
+
Permission to use these fonts (embedding into PostScript, PDF, SVG
|
| 388 |
+
and printing by using any software) is hereby granted without fee.
|
| 389 |
+
It is not required to provide any notices about using these fonts.
|
| 390 |
+
|
| 391 |
+
Basil K. Malyshev
|
| 392 |
+
INSTITUTE FOR HIGH ENERGY PHYSICS
|
| 393 |
+
IHEP, OMVT
|
| 394 |
+
Moscow Region
|
| 395 |
+
142281 PROTVINO
|
| 396 |
+
RUSSIA
|
| 397 |
+
|
| 398 |
+
E-Mail: bakoma@mail.ru
|
| 399 |
+
or malyshev@mail.ihep.ru
|
| 400 |
+
|
| 401 |
+
|
| 402 |
+
|
| 403 |
+
|
| 404 |
+
Name: ColorBrewer Color Schemes
|
| 405 |
+
Files: lib/matplotlib/_cm.py
|
| 406 |
+
Description: Color schemes from ColorBrewer
|
| 407 |
+
License: Apache-2.0
|
| 408 |
+
Apache-Style Software License for ColorBrewer software and ColorBrewer Color Schemes
|
| 409 |
+
|
| 410 |
+
Copyright (c) 2002 Cynthia Brewer, Mark Harrower, and The Pennsylvania State University.
|
| 411 |
+
|
| 412 |
+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
|
| 413 |
+
You may obtain a copy of the License at
|
| 414 |
+
|
| 415 |
+
http://www.apache.org/licenses/LICENSE-2.0
|
| 416 |
+
|
| 417 |
+
Unless required by applicable law or agreed to in writing, software distributed
|
| 418 |
+
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
| 419 |
+
CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
| 420 |
+
specific language governing permissions and limitations under the License.
|
| 421 |
+
|
| 422 |
+
|
| 423 |
+
Name: Courier 10
|
| 424 |
+
Files: matplotlib/tests/Courier10PitchBT-Bold.pfb
|
| 425 |
+
Description: Courier 10 font, used in tests.
|
| 426 |
+
License: Bitstream-Charter
|
| 427 |
+
The Courier10PitchBT-Bold.pfb file is a Type-1 version of
|
| 428 |
+
Courier 10 Pitch BT Bold by Bitstream, obtained from
|
| 429 |
+
<https://ctan.org/tex-archive/fonts/courierten>. It is included
|
| 430 |
+
here as test data only, but the following license applies.
|
| 431 |
+
|
| 432 |
+
|
| 433 |
+
(c) Copyright 1989-1992, Bitstream Inc., Cambridge, MA.
|
| 434 |
+
|
| 435 |
+
You are hereby granted permission under all Bitstream propriety rights
|
| 436 |
+
to use, copy, modify, sublicense, sell, and redistribute the 4 Bitstream
|
| 437 |
+
Charter (r) Type 1 outline fonts and the 4 Courier Type 1 outline fonts
|
| 438 |
+
for any purpose and without restriction; provided, that this notice is
|
| 439 |
+
left intact on all copies of such fonts and that Bitstream's trademark
|
| 440 |
+
is acknowledged as shown below on all unmodified copies of the 4 Charter
|
| 441 |
+
Type 1 fonts.
|
| 442 |
+
|
| 443 |
+
BITSTREAM CHARTER is a registered trademark of Bitstream Inc.
|
| 444 |
+
|
| 445 |
+
|
| 446 |
+
Name: FreeType
|
| 447 |
+
Files: matplotlib/ft2font.*.so
|
| 448 |
+
Description: Font rendering library
|
| 449 |
+
License: FTL OR GPL-2.0-or-later
|
| 450 |
+
The FreeType 2 font engine is copyrighted work and cannot be used
|
| 451 |
+
legally without a software license. In order to make this project
|
| 452 |
+
usable to a vast majority of developers, we distribute it under two
|
| 453 |
+
mutually exclusive open-source licenses.
|
| 454 |
+
|
| 455 |
+
This means that *you* must choose *one* of the two licenses described
|
| 456 |
+
below, then obey all its terms and conditions when using FreeType 2 in
|
| 457 |
+
any of your projects or products.
|
| 458 |
+
|
| 459 |
+
- The FreeType License, found in the file `docs/FTL.TXT`, which is
|
| 460 |
+
similar to the original BSD license *with* an advertising clause
|
| 461 |
+
that forces you to explicitly cite the FreeType project in your
|
| 462 |
+
product's documentation. All details are in the license file.
|
| 463 |
+
This license is suited to products which don't use the GNU General
|
| 464 |
+
Public License.
|
| 465 |
+
|
| 466 |
+
Note that this license is compatible to the GNU General Public
|
| 467 |
+
License version 3, but not version 2.
|
| 468 |
+
|
| 469 |
+
- The GNU General Public License version 2, found in
|
| 470 |
+
`docs/GPLv2.TXT` (any later version can be used also), for
|
| 471 |
+
programs which already use the GPL. Note that the FTL is
|
| 472 |
+
incompatible with GPLv2 due to its advertisement clause.
|
| 473 |
+
|
| 474 |
+
The contributed BDF and PCF drivers come with a license similar to
|
| 475 |
+
that of the X Window System. It is compatible to the above two
|
| 476 |
+
licenses (see files `src/bdf/README` and `src/pcf/README`). The same
|
| 477 |
+
holds for the source code files `src/base/fthash.c` and
|
| 478 |
+
`include/freetype/internal/fthash.h`; they were part of the BDF driver
|
| 479 |
+
in earlier FreeType versions.
|
| 480 |
+
|
| 481 |
+
The gzip module uses the zlib license (see `src/gzip/zlib.h`) which
|
| 482 |
+
too is compatible to the above two licenses.
|
| 483 |
+
|
| 484 |
+
The files `src/autofit/ft-hb.c` and `src/autofit/ft-hb.h` contain code
|
| 485 |
+
taken almost verbatim from the HarfBuzz file `hb-ft.cc`, which uses
|
| 486 |
+
the 'Old MIT' license, compatible to the above two licenses.
|
| 487 |
+
|
| 488 |
+
The MD5 checksum support (only used for debugging in development
|
| 489 |
+
builds) is in the public domain.
|
| 490 |
+
|
| 491 |
+
|
| 492 |
+
Name: HarfBuzz
|
| 493 |
+
Files: matplotlib/ft2font.*.so
|
| 494 |
+
Description: Text shaping library
|
| 495 |
+
License: MIT-Modern-Variant
|
| 496 |
+
HarfBuzz is licensed under the so-called "Old MIT" license. Details follow.
|
| 497 |
+
For parts of HarfBuzz that are licensed under different licenses see individual
|
| 498 |
+
files names COPYING in subdirectories where applicable.
|
| 499 |
+
|
| 500 |
+
Copyright © 2010-2022 Google, Inc.
|
| 501 |
+
Copyright © 2015-2020 Ebrahim Byagowi
|
| 502 |
+
Copyright © 2019,2020 Facebook, Inc.
|
| 503 |
+
Copyright © 2012,2015 Mozilla Foundation
|
| 504 |
+
Copyright © 2011 Codethink Limited
|
| 505 |
+
Copyright © 2008,2010 Nokia Corporation and/or its subsidiary(-ies)
|
| 506 |
+
Copyright © 2009 Keith Stribley
|
| 507 |
+
Copyright © 2011 Martin Hosken and SIL International
|
| 508 |
+
Copyright © 2007 Chris Wilson
|
| 509 |
+
Copyright © 2005,2006,2020,2021,2022,2023 Behdad Esfahbod
|
| 510 |
+
Copyright © 2004,2007,2008,2009,2010,2013,2021,2022,2023 Red Hat, Inc.
|
| 511 |
+
Copyright © 1998-2005 David Turner and Werner Lemberg
|
| 512 |
+
Copyright © 2016 Igalia S.L.
|
| 513 |
+
Copyright © 2022 Matthias Clasen
|
| 514 |
+
Copyright © 2018,2021 Khaled Hosny
|
| 515 |
+
Copyright © 2018,2019,2020 Adobe, Inc
|
| 516 |
+
Copyright © 2013-2015 Alexei Podtelezhnikov
|
| 517 |
+
|
| 518 |
+
For full copyright notices consult the individual files in the package.
|
| 519 |
+
|
| 520 |
+
|
| 521 |
+
Permission is hereby granted, without written agreement and without
|
| 522 |
+
license or royalty fees, to use, copy, modify, and distribute this
|
| 523 |
+
software and its documentation for any purpose, provided that the
|
| 524 |
+
above copyright notice and the following two paragraphs appear in
|
| 525 |
+
all copies of this software.
|
| 526 |
+
|
| 527 |
+
IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
|
| 528 |
+
DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
|
| 529 |
+
ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
|
| 530 |
+
IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
| 531 |
+
DAMAGE.
|
| 532 |
+
|
| 533 |
+
THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
|
| 534 |
+
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
| 535 |
+
FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
| 536 |
+
ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
|
| 537 |
+
PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
| 538 |
+
|
| 539 |
+
|
| 540 |
+
Name: JSXTools resize observer
|
| 541 |
+
Files: lib/matplotlib/backends/web_backend/js/mpl.js
|
| 542 |
+
Description: Minimal polyfill for the ResizeObserver API
|
| 543 |
+
License: CC0-1.0
|
| 544 |
+
# CC0 1.0 Universal
|
| 545 |
+
|
| 546 |
+
## Statement of Purpose
|
| 547 |
+
|
| 548 |
+
The laws of most jurisdictions throughout the world automatically confer
|
| 549 |
+
exclusive Copyright and Related Rights (defined below) upon the creator and
|
| 550 |
+
subsequent owner(s) (each and all, an “owner”) of an original work of
|
| 551 |
+
authorship and/or a database (each, a “Work”).
|
| 552 |
+
|
| 553 |
+
Certain owners wish to permanently relinquish those rights to a Work for the
|
| 554 |
+
purpose of contributing to a commons of creative, cultural and scientific works
|
| 555 |
+
(“Commons”) that the public can reliably and without fear of later claims of
|
| 556 |
+
infringement build upon, modify, incorporate in other works, reuse and
|
| 557 |
+
redistribute as freely as possible in any form whatsoever and for any purposes,
|
| 558 |
+
including without limitation commercial purposes. These owners may contribute
|
| 559 |
+
to the Commons to promote the ideal of a free culture and the further
|
| 560 |
+
production of creative, cultural and scientific works, or to gain reputation or
|
| 561 |
+
greater distribution for their Work in part through the use and efforts of
|
| 562 |
+
others.
|
| 563 |
+
|
| 564 |
+
For these and/or other purposes and motivations, and without any expectation of
|
| 565 |
+
additional consideration or compensation, the person associating CC0 with a
|
| 566 |
+
Work (the “Affirmer”), to the extent that he or she is an owner of Copyright
|
| 567 |
+
and Related Rights in the Work, voluntarily elects to apply CC0 to the Work and
|
| 568 |
+
publicly distribute the Work under its terms, with knowledge of his or her
|
| 569 |
+
Copyright and Related Rights in the Work and the meaning and intended legal
|
| 570 |
+
effect of CC0 on those rights.
|
| 571 |
+
|
| 572 |
+
1. Copyright and Related Rights. A Work made available under CC0 may be
|
| 573 |
+
protected by copyright and related or neighboring rights (“Copyright and
|
| 574 |
+
Related Rights”). Copyright and Related Rights include, but are not limited
|
| 575 |
+
to, the following:
|
| 576 |
+
1. the right to reproduce, adapt, distribute, perform, display, communicate,
|
| 577 |
+
and translate a Work;
|
| 578 |
+
2. moral rights retained by the original author(s) and/or performer(s);
|
| 579 |
+
3. publicity and privacy rights pertaining to a person’s image or likeness
|
| 580 |
+
depicted in a Work;
|
| 581 |
+
4. rights protecting against unfair competition in regards to a Work,
|
| 582 |
+
subject to the limitations in paragraph 4(i), below;
|
| 583 |
+
5. rights protecting the extraction, dissemination, use and reuse of data in
|
| 584 |
+
a Work;
|
| 585 |
+
6. database rights (such as those arising under Directive 96/9/EC of the
|
| 586 |
+
European Parliament and of the Council of 11 March 1996 on the legal
|
| 587 |
+
protection of databases, and under any national implementation thereof,
|
| 588 |
+
including any amended or successor version of such directive); and
|
| 589 |
+
7. other similar, equivalent or corresponding rights throughout the world
|
| 590 |
+
based on applicable law or treaty, and any national implementations
|
| 591 |
+
thereof.
|
| 592 |
+
|
| 593 |
+
2. Waiver. To the greatest extent permitted by, but not in contravention of,
|
| 594 |
+
applicable law, Affirmer hereby overtly, fully, permanently, irrevocably and
|
| 595 |
+
unconditionally waives, abandons, and surrenders all of Affirmer’s Copyright
|
| 596 |
+
and Related Rights and associated claims and causes of action, whether now
|
| 597 |
+
known or unknown (including existing as well as future claims and causes of
|
| 598 |
+
action), in the Work (i) in all territories worldwide, (ii) for the maximum
|
| 599 |
+
duration provided by applicable law or treaty (including future time
|
| 600 |
+
extensions), (iii) in any current or future medium and for any number of
|
| 601 |
+
copies, and (iv) for any purpose whatsoever, including without limitation
|
| 602 |
+
commercial, advertising or promotional purposes (the “Waiver”). Affirmer
|
| 603 |
+
makes the Waiver for the benefit of each member of the public at large and
|
| 604 |
+
to the detriment of Affirmer’s heirs and successors, fully intending that
|
| 605 |
+
such Waiver shall not be subject to revocation, rescission, cancellation,
|
| 606 |
+
termination, or any other legal or equitable action to disrupt the quiet
|
| 607 |
+
enjoyment of the Work by the public as contemplated by Affirmer’s express
|
| 608 |
+
Statement of Purpose.
|
| 609 |
+
|
| 610 |
+
3. Public License Fallback. Should any part of the Waiver for any reason be
|
| 611 |
+
judged legally invalid or ineffective under applicable law, then the Waiver
|
| 612 |
+
shall be preserved to the maximum extent permitted taking into account
|
| 613 |
+
Affirmer’s express Statement of Purpose. In addition, to the extent the
|
| 614 |
+
Waiver is so judged Affirmer hereby grants to each affected person a
|
| 615 |
+
royalty-free, non transferable, non sublicensable, non exclusive,
|
| 616 |
+
irrevocable and unconditional license to exercise Affirmer’s Copyright and
|
| 617 |
+
Related Rights in the Work (i) in all territories worldwide, (ii) for the
|
| 618 |
+
maximum duration provided by applicable law or treaty (including future time
|
| 619 |
+
extensions), (iii) in any current or future medium and for any number of
|
| 620 |
+
copies, and (iv) for any purpose whatsoever, including without limitation
|
| 621 |
+
commercial, advertising or promotional purposes (the “License”). The License
|
| 622 |
+
shall be deemed effective as of the date CC0 was applied by Affirmer to the
|
| 623 |
+
Work. Should any part of the License for any reason be judged legally
|
| 624 |
+
invalid or ineffective under applicable law, such partial invalidity or
|
| 625 |
+
ineffectiveness shall not invalidate the remainder of the License, and in
|
| 626 |
+
such case Affirmer hereby affirms that he or she will not (i) exercise any
|
| 627 |
+
of his or her remaining Copyright and Related Rights in the Work or (ii)
|
| 628 |
+
assert any associated claims and causes of action with respect to the Work,
|
| 629 |
+
in either case contrary to Affirmer’s express Statement of Purpose.
|
| 630 |
+
|
| 631 |
+
4. Limitations and Disclaimers.
|
| 632 |
+
1. No trademark or patent rights held by Affirmer are waived, abandoned,
|
| 633 |
+
surrendered, licensed or otherwise affected by this document.
|
| 634 |
+
2. Affirmer offers the Work as-is and makes no representations or warranties
|
| 635 |
+
of any kind concerning the Work, express, implied, statutory or
|
| 636 |
+
otherwise, including without limitation warranties of title,
|
| 637 |
+
merchantability, fitness for a particular purpose, non infringement, or
|
| 638 |
+
the absence of latent or other defects, accuracy, or the present or
|
| 639 |
+
absence of errors, whether or not discoverable, all to the greatest
|
| 640 |
+
extent permissible under applicable law.
|
| 641 |
+
3. Affirmer disclaims responsibility for clearing rights of other persons
|
| 642 |
+
that may apply to the Work or any use thereof, including without
|
| 643 |
+
limitation any person’s Copyright and Related Rights in the Work.
|
| 644 |
+
Further, Affirmer disclaims responsibility for obtaining any necessary
|
| 645 |
+
consents, permissions or other rights required for any use of the Work.
|
| 646 |
+
4. Affirmer understands and acknowledges that Creative Commons is not a
|
| 647 |
+
party to this document and has no duty or obligation with respect to this
|
| 648 |
+
CC0 or use of the Work.
|
| 649 |
+
|
| 650 |
+
For more information, please see
|
| 651 |
+
http://creativecommons.org/publicdomain/zero/1.0/.
|
| 652 |
+
|
| 653 |
+
|
| 654 |
+
Name: Last Resort fonts
|
| 655 |
+
Files: matplotlib/mpl-data/fonts/ttf/LastResortHE-Regular.ttf
|
| 656 |
+
Description: Last Resort High-Efficiency Font
|
| 657 |
+
License: OFL-1.1
|
| 658 |
+
This Font Software is licensed under the SIL Open Font License,
|
| 659 |
+
Version 1.1.
|
| 660 |
+
|
| 661 |
+
This license is copied below, and is also available with a FAQ at:
|
| 662 |
+
http://scripts.sil.org/OFL
|
| 663 |
+
|
| 664 |
+
-----------------------------------------------------------
|
| 665 |
+
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
| 666 |
+
-----------------------------------------------------------
|
| 667 |
+
|
| 668 |
+
PREAMBLE
|
| 669 |
+
The goals of the Open Font License (OFL) are to stimulate worldwide
|
| 670 |
+
development of collaborative font projects, to support the font
|
| 671 |
+
creation efforts of academic and linguistic communities, and to
|
| 672 |
+
provide a free and open framework in which fonts may be shared and
|
| 673 |
+
improved in partnership with others.
|
| 674 |
+
|
| 675 |
+
The OFL allows the licensed fonts to be used, studied, modified and
|
| 676 |
+
redistributed freely as long as they are not sold by themselves. The
|
| 677 |
+
fonts, including any derivative works, can be bundled, embedded,
|
| 678 |
+
redistributed and/or sold with any software provided that any reserved
|
| 679 |
+
names are not used by derivative works. The fonts and derivatives,
|
| 680 |
+
however, cannot be released under any other type of license. The
|
| 681 |
+
requirement for fonts to remain under this license does not apply to
|
| 682 |
+
any document created using the fonts or their derivatives.
|
| 683 |
+
|
| 684 |
+
DEFINITIONS
|
| 685 |
+
"Font Software" refers to the set of files released by the Copyright
|
| 686 |
+
Holder(s) under this license and clearly marked as such. This may
|
| 687 |
+
include source files, build scripts and documentation.
|
| 688 |
+
|
| 689 |
+
"Reserved Font Name" refers to any names specified as such after the
|
| 690 |
+
copyright statement(s).
|
| 691 |
+
|
| 692 |
+
"Original Version" refers to the collection of Font Software
|
| 693 |
+
components as distributed by the Copyright Holder(s).
|
| 694 |
+
|
| 695 |
+
"Modified Version" refers to any derivative made by adding to,
|
| 696 |
+
deleting, or substituting -- in part or in whole -- any of the
|
| 697 |
+
components of the Original Version, by changing formats or by porting
|
| 698 |
+
the Font Software to a new environment.
|
| 699 |
+
|
| 700 |
+
"Author" refers to any designer, engineer, programmer, technical
|
| 701 |
+
writer or other person who contributed to the Font Software.
|
| 702 |
+
|
| 703 |
+
PERMISSION & CONDITIONS
|
| 704 |
+
Permission is hereby granted, free of charge, to any person obtaining
|
| 705 |
+
a copy of the Font Software, to use, study, copy, merge, embed,
|
| 706 |
+
modify, redistribute, and sell modified and unmodified copies of the
|
| 707 |
+
Font Software, subject to the following conditions:
|
| 708 |
+
|
| 709 |
+
1) Neither the Font Software nor any of its individual components, in
|
| 710 |
+
Original or Modified Versions, may be sold by itself.
|
| 711 |
+
|
| 712 |
+
2) Original or Modified Versions of the Font Software may be bundled,
|
| 713 |
+
redistributed and/or sold with any software, provided that each copy
|
| 714 |
+
contains the above copyright notice and this license. These can be
|
| 715 |
+
included either as stand-alone text files, human-readable headers or
|
| 716 |
+
in the appropriate machine-readable metadata fields within text or
|
| 717 |
+
binary files as long as those fields can be easily viewed by the user.
|
| 718 |
+
|
| 719 |
+
3) No Modified Version of the Font Software may use the Reserved Font
|
| 720 |
+
Name(s) unless explicit written permission is granted by the
|
| 721 |
+
corresponding Copyright Holder. This restriction only applies to the
|
| 722 |
+
primary font name as presented to the users.
|
| 723 |
+
|
| 724 |
+
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
| 725 |
+
Software shall not be used to promote, endorse or advertise any
|
| 726 |
+
Modified Version, except to acknowledge the contribution(s) of the
|
| 727 |
+
Copyright Holder(s) and the Author(s) or with their explicit written
|
| 728 |
+
permission.
|
| 729 |
+
|
| 730 |
+
5) The Font Software, modified or unmodified, in part or in whole,
|
| 731 |
+
must be distributed entirely under this license, and must not be
|
| 732 |
+
distributed under any other license. The requirement for fonts to
|
| 733 |
+
remain under this license does not apply to any document created using
|
| 734 |
+
the Font Software.
|
| 735 |
+
|
| 736 |
+
TERMINATION
|
| 737 |
+
This license becomes null and void if any of the above conditions are
|
| 738 |
+
not met.
|
| 739 |
+
|
| 740 |
+
DISCLAIMER
|
| 741 |
+
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
| 742 |
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
| 743 |
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
| 744 |
+
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
| 745 |
+
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
| 746 |
+
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
| 747 |
+
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
| 748 |
+
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
| 749 |
+
OTHER DEALINGS IN THE FONT SOFTWARE.
|
| 750 |
+
|
| 751 |
+
SPDX-License-Identifier: OFL-1.1
|
| 752 |
+
|
| 753 |
+
|
| 754 |
+
Name: libraqm
|
| 755 |
+
Files: matplotlib/ft2font.*.so
|
| 756 |
+
Description: Complex text layout library
|
| 757 |
+
License: MIT
|
| 758 |
+
The MIT License (MIT)
|
| 759 |
+
|
| 760 |
+
Copyright © 2015 Information Technology Authority (ITA) <foss@ita.gov.om>
|
| 761 |
+
Copyright © 2016-2023 Khaled Hosny <khaled@aliftype.com>
|
| 762 |
+
|
| 763 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 764 |
+
of this software and associated documentation files (the "Software"), to deal
|
| 765 |
+
in the Software without restriction, including without limitation the rights
|
| 766 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
| 767 |
+
copies of the Software, and to permit persons to whom the Software is
|
| 768 |
+
furnished to do so, subject to the following conditions:
|
| 769 |
+
|
| 770 |
+
The above copyright notice and this permission notice shall be included in all
|
| 771 |
+
copies or substantial portions of the Software.
|
| 772 |
+
|
| 773 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 774 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 775 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 776 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 777 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 778 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
| 779 |
+
SOFTWARE.
|
| 780 |
+
|
| 781 |
+
|
| 782 |
+
Name: QHull
|
| 783 |
+
Files: matplotlib/_qhull.*.so
|
| 784 |
+
Description: Convex hull, Delaunay triangulation, Voronoi diagrams, Halfspace intersection
|
| 785 |
+
License: Qhull
|
| 786 |
+
Qhull, Copyright (c) 1993-2020
|
| 787 |
+
|
| 788 |
+
C.B. Barber
|
| 789 |
+
Arlington, MA
|
| 790 |
+
|
| 791 |
+
and
|
| 792 |
+
|
| 793 |
+
The National Science and Technology Research Center for
|
| 794 |
+
Computation and Visualization of Geometric Structures
|
| 795 |
+
(The Geometry Center)
|
| 796 |
+
University of Minnesota
|
| 797 |
+
|
| 798 |
+
email: qhull@qhull.org
|
| 799 |
+
|
| 800 |
+
This software includes Qhull from C.B. Barber and The Geometry Center.
|
| 801 |
+
Files derived from Qhull 1.0 are copyrighted by the Geometry Center. The
|
| 802 |
+
remaining files are copyrighted by C.B. Barber. Qhull is free software
|
| 803 |
+
and may be obtained via http from www.qhull.org. It may be freely copied,
|
| 804 |
+
modified, and redistributed under the following conditions:
|
| 805 |
+
|
| 806 |
+
1. All copyright notices must remain intact in all files.
|
| 807 |
+
|
| 808 |
+
2. A copy of this text file must be distributed along with any copies
|
| 809 |
+
of Qhull that you redistribute; this includes copies that you have
|
| 810 |
+
modified, or copies of programs or other software products that
|
| 811 |
+
include Qhull.
|
| 812 |
+
|
| 813 |
+
3. If you modify Qhull, you must include a notice giving the
|
| 814 |
+
name of the person performing the modification, the date of
|
| 815 |
+
modification, and the reason for such modification.
|
| 816 |
+
|
| 817 |
+
4. When distributing modified versions of Qhull, or other software
|
| 818 |
+
products that include Qhull, you must provide notice that the original
|
| 819 |
+
source code may be obtained as noted above.
|
| 820 |
+
|
| 821 |
+
5. There is no warranty or other guarantee of fitness for Qhull, it is
|
| 822 |
+
provided solely "as is". Bug reports or fixes may be sent to
|
| 823 |
+
qhull_bug@qhull.org; the authors may or may not act on them as
|
| 824 |
+
they desire.
|
| 825 |
+
|
| 826 |
+
|
| 827 |
+
Name: Qt4 Editor
|
| 828 |
+
Files: matplotlib/backends/qt_editor
|
| 829 |
+
Description: Module creating PyQt4 form dialogs/layouts to edit various type of parameters
|
| 830 |
+
License: MIT
|
| 831 |
+
Module creating PyQt4 form dialogs/layouts to edit various type of parameters
|
| 832 |
+
|
| 833 |
+
|
| 834 |
+
formlayout License Agreement (MIT License)
|
| 835 |
+
------------------------------------------
|
| 836 |
+
|
| 837 |
+
Copyright (c) 2009 Pierre Raybaut
|
| 838 |
+
|
| 839 |
+
Permission is hereby granted, free of charge, to any person
|
| 840 |
+
obtaining a copy of this software and associated documentation
|
| 841 |
+
files (the "Software"), to deal in the Software without
|
| 842 |
+
restriction, including without limitation the rights to use,
|
| 843 |
+
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
| 844 |
+
copies of the Software, and to permit persons to whom the
|
| 845 |
+
Software is furnished to do so, subject to the following
|
| 846 |
+
conditions:
|
| 847 |
+
|
| 848 |
+
The above copyright notice and this permission notice shall be
|
| 849 |
+
included in all copies or substantial portions of the Software.
|
| 850 |
+
|
| 851 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
| 852 |
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
| 853 |
+
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
| 854 |
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
| 855 |
+
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
| 856 |
+
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
| 857 |
+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
| 858 |
+
OTHER DEALINGS IN THE SOFTWARE.
|
| 859 |
+
|
| 860 |
+
|
| 861 |
+
Name: SheenBidi
|
| 862 |
+
Files: matplotlib/ft2font.*.so
|
| 863 |
+
Description: Unicode Bidirectional Algorithm implementation
|
| 864 |
+
License: Apache-2.0
|
| 865 |
+
Apache License
|
| 866 |
+
Version 2.0, January 2004
|
| 867 |
+
http://www.apache.org/licenses/
|
| 868 |
+
|
| 869 |
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
| 870 |
+
|
| 871 |
+
1. Definitions.
|
| 872 |
+
|
| 873 |
+
"License" shall mean the terms and conditions for use, reproduction,
|
| 874 |
+
and distribution as defined by Sections 1 through 9 of this document.
|
| 875 |
+
|
| 876 |
+
"Licensor" shall mean the copyright owner or entity authorized by
|
| 877 |
+
the copyright owner that is granting the License.
|
| 878 |
+
|
| 879 |
+
"Legal Entity" shall mean the union of the acting entity and all
|
| 880 |
+
other entities that control, are controlled by, or are under common
|
| 881 |
+
control with that entity. For the purposes of this definition,
|
| 882 |
+
"control" means (i) the power, direct or indirect, to cause the
|
| 883 |
+
direction or management of such entity, whether by contract or
|
| 884 |
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
| 885 |
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
| 886 |
+
|
| 887 |
+
"You" (or "Your") shall mean an individual or Legal Entity
|
| 888 |
+
exercising permissions granted by this License.
|
| 889 |
+
|
| 890 |
+
"Source" form shall mean the preferred form for making modifications,
|
| 891 |
+
including but not limited to software source code, documentation
|
| 892 |
+
source, and configuration files.
|
| 893 |
+
|
| 894 |
+
"Object" form shall mean any form resulting from mechanical
|
| 895 |
+
transformation or translation of a Source form, including but
|
| 896 |
+
not limited to compiled object code, generated documentation,
|
| 897 |
+
and conversions to other media types.
|
| 898 |
+
|
| 899 |
+
"Work" shall mean the work of authorship, whether in Source or
|
| 900 |
+
Object form, made available under the License, as indicated by a
|
| 901 |
+
copyright notice that is included in or attached to the work
|
| 902 |
+
(an example is provided in the Appendix below).
|
| 903 |
+
|
| 904 |
+
"Derivative Works" shall mean any work, whether in Source or Object
|
| 905 |
+
form, that is based on (or derived from) the Work and for which the
|
| 906 |
+
editorial revisions, annotations, elaborations, or other modifications
|
| 907 |
+
represent, as a whole, an original work of authorship. For the purposes
|
| 908 |
+
of this License, Derivative Works shall not include works that remain
|
| 909 |
+
separable from, or merely link (or bind by name) to the interfaces of,
|
| 910 |
+
the Work and Derivative Works thereof.
|
| 911 |
+
|
| 912 |
+
"Contribution" shall mean any work of authorship, including
|
| 913 |
+
the original version of the Work and any modifications or additions
|
| 914 |
+
to that Work or Derivative Works thereof, that is intentionally
|
| 915 |
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
| 916 |
+
or by an individual or Legal Entity authorized to submit on behalf of
|
| 917 |
+
the copyright owner. For the purposes of this definition, "submitted"
|
| 918 |
+
means any form of electronic, verbal, or written communication sent
|
| 919 |
+
to the Licensor or its representatives, including but not limited to
|
| 920 |
+
communication on electronic mailing lists, source code control systems,
|
| 921 |
+
and issue tracking systems that are managed by, or on behalf of, the
|
| 922 |
+
Licensor for the purpose of discussing and improving the Work, but
|
| 923 |
+
excluding communication that is conspicuously marked or otherwise
|
| 924 |
+
designated in writing by the copyright owner as "Not a Contribution."
|
| 925 |
+
|
| 926 |
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
| 927 |
+
on behalf of whom a Contribution has been received by Licensor and
|
| 928 |
+
subsequently incorporated within the Work.
|
| 929 |
+
|
| 930 |
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
| 931 |
+
this License, each Contributor hereby grants to You a perpetual,
|
| 932 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
| 933 |
+
copyright license to reproduce, prepare Derivative Works of,
|
| 934 |
+
publicly display, publicly perform, sublicense, and distribute the
|
| 935 |
+
Work and such Derivative Works in Source or Object form.
|
| 936 |
+
|
| 937 |
+
3. Grant of Patent License. Subject to the terms and conditions of
|
| 938 |
+
this License, each Contributor hereby grants to You a perpetual,
|
| 939 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
| 940 |
+
(except as stated in this section) patent license to make, have made,
|
| 941 |
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
| 942 |
+
where such license applies only to those patent claims licensable
|
| 943 |
+
by such Contributor that are necessarily infringed by their
|
| 944 |
+
Contribution(s) alone or by combination of their Contribution(s)
|
| 945 |
+
with the Work to which such Contribution(s) was submitted. If You
|
| 946 |
+
institute patent litigation against any entity (including a
|
| 947 |
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
| 948 |
+
or a Contribution incorporated within the Work constitutes direct
|
| 949 |
+
or contributory patent infringement, then any patent licenses
|
| 950 |
+
granted to You under this License for that Work shall terminate
|
| 951 |
+
as of the date such litigation is filed.
|
| 952 |
+
|
| 953 |
+
4. Redistribution. You may reproduce and distribute copies of the
|
| 954 |
+
Work or Derivative Works thereof in any medium, with or without
|
| 955 |
+
modifications, and in Source or Object form, provided that You
|
| 956 |
+
meet the following conditions:
|
| 957 |
+
|
| 958 |
+
(a) You must give any other recipients of the Work or
|
| 959 |
+
Derivative Works a copy of this License; and
|
| 960 |
+
|
| 961 |
+
(b) You must cause any modified files to carry prominent notices
|
| 962 |
+
stating that You changed the files; and
|
| 963 |
+
|
| 964 |
+
(c) You must retain, in the Source form of any Derivative Works
|
| 965 |
+
that You distribute, all copyright, patent, trademark, and
|
| 966 |
+
attribution notices from the Source form of the Work,
|
| 967 |
+
excluding those notices that do not pertain to any part of
|
| 968 |
+
the Derivative Works; and
|
| 969 |
+
|
| 970 |
+
(d) If the Work includes a "NOTICE" text file as part of its
|
| 971 |
+
distribution, then any Derivative Works that You distribute must
|
| 972 |
+
include a readable copy of the attribution notices contained
|
| 973 |
+
within such NOTICE file, excluding those notices that do not
|
| 974 |
+
pertain to any part of the Derivative Works, in at least one
|
| 975 |
+
of the following places: within a NOTICE text file distributed
|
| 976 |
+
as part of the Derivative Works; within the Source form or
|
| 977 |
+
documentation, if provided along with the Derivative Works; or,
|
| 978 |
+
within a display generated by the Derivative Works, if and
|
| 979 |
+
wherever such third-party notices normally appear. The contents
|
| 980 |
+
of the NOTICE file are for informational purposes only and
|
| 981 |
+
do not modify the License. You may add Your own attribution
|
| 982 |
+
notices within Derivative Works that You distribute, alongside
|
| 983 |
+
or as an addendum to the NOTICE text from the Work, provided
|
| 984 |
+
that such additional attribution notices cannot be construed
|
| 985 |
+
as modifying the License.
|
| 986 |
+
|
| 987 |
+
You may add Your own copyright statement to Your modifications and
|
| 988 |
+
may provide additional or different license terms and conditions
|
| 989 |
+
for use, reproduction, or distribution of Your modifications, or
|
| 990 |
+
for any such Derivative Works as a whole, provided Your use,
|
| 991 |
+
reproduction, and distribution of the Work otherwise complies with
|
| 992 |
+
the conditions stated in this License.
|
| 993 |
+
|
| 994 |
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
| 995 |
+
any Contribution intentionally submitted for inclusion in the Work
|
| 996 |
+
by You to the Licensor shall be under the terms and conditions of
|
| 997 |
+
this License, without any additional terms or conditions.
|
| 998 |
+
Notwithstanding the above, nothing herein shall supersede or modify
|
| 999 |
+
the terms of any separate license agreement you may have executed
|
| 1000 |
+
with Licensor regarding such Contributions.
|
| 1001 |
+
|
| 1002 |
+
6. Trademarks. This License does not grant permission to use the trade
|
| 1003 |
+
names, trademarks, service marks, or product names of the Licensor,
|
| 1004 |
+
except as required for reasonable and customary use in describing the
|
| 1005 |
+
origin of the Work and reproducing the content of the NOTICE file.
|
| 1006 |
+
|
| 1007 |
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
| 1008 |
+
agreed to in writing, Licensor provides the Work (and each
|
| 1009 |
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
| 1010 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
| 1011 |
+
implied, including, without limitation, any warranties or conditions
|
| 1012 |
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
| 1013 |
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
| 1014 |
+
appropriateness of using or redistributing the Work and assume any
|
| 1015 |
+
risks associated with Your exercise of permissions under this License.
|
| 1016 |
+
|
| 1017 |
+
8. Limitation of Liability. In no event and under no legal theory,
|
| 1018 |
+
whether in tort (including negligence), contract, or otherwise,
|
| 1019 |
+
unless required by applicable law (such as deliberate and grossly
|
| 1020 |
+
negligent acts) or agreed to in writing, shall any Contributor be
|
| 1021 |
+
liable to You for damages, including any direct, indirect, special,
|
| 1022 |
+
incidental, or consequential damages of any character arising as a
|
| 1023 |
+
result of this License or out of the use or inability to use the
|
| 1024 |
+
Work (including but not limited to damages for loss of goodwill,
|
| 1025 |
+
work stoppage, computer failure or malfunction, or any and all
|
| 1026 |
+
other commercial damages or losses), even if such Contributor
|
| 1027 |
+
has been advised of the possibility of such damages.
|
| 1028 |
+
|
| 1029 |
+
9. Accepting Warranty or Additional Liability. While redistributing
|
| 1030 |
+
the Work or Derivative Works thereof, You may choose to offer,
|
| 1031 |
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
| 1032 |
+
or other liability obligations and/or rights consistent with this
|
| 1033 |
+
License. However, in accepting such obligations, You may act only
|
| 1034 |
+
on Your own behalf and on Your sole responsibility, not on behalf
|
| 1035 |
+
of any other Contributor, and only if You agree to indemnify,
|
| 1036 |
+
defend, and hold each Contributor harmless for any liability
|
| 1037 |
+
incurred by, or claims asserted against, such Contributor by reason
|
| 1038 |
+
of your accepting any such warranty or additional liability.
|
| 1039 |
+
|
| 1040 |
+
END OF TERMS AND CONDITIONS
|
| 1041 |
+
|
| 1042 |
+
APPENDIX: How to apply the Apache License to your work.
|
| 1043 |
+
|
| 1044 |
+
To apply the Apache License to your work, attach the following
|
| 1045 |
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
| 1046 |
+
replaced with your own identifying information. (Don't include
|
| 1047 |
+
the brackets!) The text should be enclosed in the appropriate
|
| 1048 |
+
comment syntax for the file format. We also recommend that a
|
| 1049 |
+
file or class name and description of purpose be included on the
|
| 1050 |
+
same "printed page" as the copyright notice for easier
|
| 1051 |
+
identification within third-party archives.
|
| 1052 |
+
|
| 1053 |
+
Copyright [yyyy] [name of copyright owner]
|
| 1054 |
+
|
| 1055 |
+
Licensed under the Apache License, Version 2.0 (the "License");
|
| 1056 |
+
you may not use this file except in compliance with the License.
|
| 1057 |
+
You may obtain a copy of the License at
|
| 1058 |
+
|
| 1059 |
+
http://www.apache.org/licenses/LICENSE-2.0
|
| 1060 |
+
|
| 1061 |
+
Unless required by applicable law or agreed to in writing, software
|
| 1062 |
+
distributed under the License is distributed on an "AS IS" BASIS,
|
| 1063 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 1064 |
+
See the License for the specific language governing permissions and
|
| 1065 |
+
limitations under the License.
|
| 1066 |
+
|
| 1067 |
+
|
| 1068 |
+
Name: Solarized
|
| 1069 |
+
Files: matplotlib/mpl-data/stylelib/Solarize_Light2.mplstyle
|
| 1070 |
+
Description: Solarized color scheme/style
|
| 1071 |
+
License: MIT
|
| 1072 |
+
https://github.com/altercation/solarized/blob/master/LICENSE
|
| 1073 |
+
Copyright (c) 2011 Ethan Schoonover
|
| 1074 |
+
|
| 1075 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 1076 |
+
of this software and associated documentation files (the "Software"), to deal
|
| 1077 |
+
in the Software without restriction, including without limitation the rights
|
| 1078 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
| 1079 |
+
copies of the Software, and to permit persons to whom the Software is
|
| 1080 |
+
furnished to do so, subject to the following conditions:
|
| 1081 |
+
|
| 1082 |
+
The above copyright notice and this permission notice shall be included in
|
| 1083 |
+
all copies or substantial portions of the Software.
|
| 1084 |
+
|
| 1085 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 1086 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 1087 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 1088 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 1089 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 1090 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
| 1091 |
+
THE SOFTWARE.
|
| 1092 |
+
|
| 1093 |
+
|
| 1094 |
+
Name: Stix fonts
|
| 1095 |
+
Files: matplotlib/mpl-data/fonts/ttf/STIX*.ttf
|
| 1096 |
+
Description: STIX fonts
|
| 1097 |
+
License: OFL-1.1
|
| 1098 |
+
STIX Font License
|
| 1099 |
+
|
| 1100 |
+
24 May 2010
|
| 1101 |
+
|
| 1102 |
+
Copyright (c) 2001-2010 by the STI Pub Companies, consisting of the American
|
| 1103 |
+
Institute of Physics, the American Chemical Society, the American Mathematical
|
| 1104 |
+
Society, the American Physical Society, Elsevier, Inc., and The Institute of
|
| 1105 |
+
Electrical and Electronic Engineers, Inc. (www.stixfonts.org), with Reserved
|
| 1106 |
+
Font Name STIX Fonts, STIX Fonts (TM) is a trademark of The Institute of
|
| 1107 |
+
Electrical and Electronics Engineers, Inc.
|
| 1108 |
+
|
| 1109 |
+
Portions copyright (c) 1998-2003 by MicroPress, Inc. (www.micropress-inc.com),
|
| 1110 |
+
with Reserved Font Name TM Math. To obtain additional mathematical fonts, please
|
| 1111 |
+
contact MicroPress, Inc., 68-30 Harrow Street, Forest Hills, NY 11375, USA,
|
| 1112 |
+
Phone: (718) 575-1816.
|
| 1113 |
+
|
| 1114 |
+
Portions copyright (c) 1990 by Elsevier, Inc.
|
| 1115 |
+
|
| 1116 |
+
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
| 1117 |
+
This license is copied below, and is also available with a FAQ at:
|
| 1118 |
+
https://scripts.sil.org/OFL
|
| 1119 |
+
|
| 1120 |
+
-----------------------------------------------------------
|
| 1121 |
+
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
| 1122 |
+
-----------------------------------------------------------
|
| 1123 |
+
|
| 1124 |
+
PREAMBLE
|
| 1125 |
+
The goals of the Open Font License (OFL) are to stimulate worldwide
|
| 1126 |
+
development of collaborative font projects, to support the font creation
|
| 1127 |
+
efforts of academic and linguistic communities, and to provide a free and
|
| 1128 |
+
open framework in which fonts may be shared and improved in partnership
|
| 1129 |
+
with others.
|
| 1130 |
+
|
| 1131 |
+
The OFL allows the licensed fonts to be used, studied, modified and
|
| 1132 |
+
redistributed freely as long as they are not sold by themselves. The
|
| 1133 |
+
fonts, including any derivative works, can be bundled, embedded,
|
| 1134 |
+
redistributed and/or sold with any software provided that any reserved
|
| 1135 |
+
names are not used by derivative works. The fonts and derivatives,
|
| 1136 |
+
however, cannot be released under any other type of license. The
|
| 1137 |
+
requirement for fonts to remain under this license does not apply
|
| 1138 |
+
to any document created using the fonts or their derivatives.
|
| 1139 |
+
|
| 1140 |
+
DEFINITIONS
|
| 1141 |
+
"Font Software" refers to the set of files released by the Copyright
|
| 1142 |
+
Holder(s) under this license and clearly marked as such. This may
|
| 1143 |
+
include source files, build scripts and documentation.
|
| 1144 |
+
|
| 1145 |
+
"Reserved Font Name" refers to any names specified as such after the
|
| 1146 |
+
copyright statement(s).
|
| 1147 |
+
|
| 1148 |
+
"Original Version" refers to the collection of Font Software components as
|
| 1149 |
+
distributed by the Copyright Holder(s).
|
| 1150 |
+
|
| 1151 |
+
"Modified Version" refers to any derivative made by adding to, deleting,
|
| 1152 |
+
or substituting -- in part or in whole -- any of the components of the
|
| 1153 |
+
Original Version, by changing formats or by porting the Font Software to a
|
| 1154 |
+
new environment.
|
| 1155 |
+
|
| 1156 |
+
"Author" refers to any designer, engineer, programmer, technical
|
| 1157 |
+
writer or other person who contributed to the Font Software.
|
| 1158 |
+
|
| 1159 |
+
PERMISSION & CONDITIONS
|
| 1160 |
+
Permission is hereby granted, free of charge, to any person obtaining
|
| 1161 |
+
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
| 1162 |
+
redistribute, and sell modified and unmodified copies of the Font
|
| 1163 |
+
Software, subject to the following conditions:
|
| 1164 |
+
|
| 1165 |
+
1) Neither the Font Software nor any of its individual components,
|
| 1166 |
+
in Original or Modified Versions, may be sold by itself.
|
| 1167 |
+
|
| 1168 |
+
2) Original or Modified Versions of the Font Software may be bundled,
|
| 1169 |
+
redistributed and/or sold with any software, provided that each copy
|
| 1170 |
+
contains the above copyright notice and this license. These can be
|
| 1171 |
+
included either as stand-alone text files, human-readable headers or
|
| 1172 |
+
in the appropriate machine-readable metadata fields within text or
|
| 1173 |
+
binary files as long as those fields can be easily viewed by the user.
|
| 1174 |
+
|
| 1175 |
+
3) No Modified Version of the Font Software may use the Reserved Font
|
| 1176 |
+
Name(s) unless explicit written permission is granted by the corresponding
|
| 1177 |
+
Copyright Holder. This restriction only applies to the primary font name as
|
| 1178 |
+
presented to the users.
|
| 1179 |
+
|
| 1180 |
+
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
| 1181 |
+
Software shall not be used to promote, endorse or advertise any
|
| 1182 |
+
Modified Version, except to acknowledge the contribution(s) of the
|
| 1183 |
+
Copyright Holder(s) and the Author(s) or with their explicit written
|
| 1184 |
+
permission.
|
| 1185 |
+
|
| 1186 |
+
5) The Font Software, modified or unmodified, in part or in whole,
|
| 1187 |
+
must be distributed entirely under this license, and must not be
|
| 1188 |
+
distributed under any other license. The requirement for fonts to
|
| 1189 |
+
remain under this license does not apply to any document created
|
| 1190 |
+
using the Font Software.
|
| 1191 |
+
|
| 1192 |
+
TERMINATION
|
| 1193 |
+
This license becomes null and void if any of the above conditions are
|
| 1194 |
+
not met.
|
| 1195 |
+
|
| 1196 |
+
DISCLAIMER
|
| 1197 |
+
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
| 1198 |
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
| 1199 |
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
| 1200 |
+
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
| 1201 |
+
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
| 1202 |
+
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
| 1203 |
+
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
| 1204 |
+
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
| 1205 |
+
OTHER DEALINGS IN THE FONT SOFTWARE.
|
| 1206 |
+
|
| 1207 |
+
Name: Yorick Colormaps
|
| 1208 |
+
Files: lib/matplotlib/_cm.py
|
| 1209 |
+
Description: Gist/Yorick colormaps
|
| 1210 |
+
License:
|
| 1211 |
+
BSD-style license for gist/yorick colormaps.
|
| 1212 |
+
|
| 1213 |
+
Copyright:
|
| 1214 |
+
|
| 1215 |
+
Copyright (c) 1996. The Regents of the University of California.
|
| 1216 |
+
All rights reserved.
|
| 1217 |
+
|
| 1218 |
+
Permission to use, copy, modify, and distribute this software for any
|
| 1219 |
+
purpose without fee is hereby granted, provided that this entire
|
| 1220 |
+
notice is included in all copies of any software which is or includes
|
| 1221 |
+
a copy or modification of this software and in all copies of the
|
| 1222 |
+
supporting documentation for such software.
|
| 1223 |
+
|
| 1224 |
+
This work was produced at the University of California, Lawrence
|
| 1225 |
+
Livermore National Laboratory under contract no. W-7405-ENG-48 between
|
| 1226 |
+
the U.S. Department of Energy and The Regents of the University of
|
| 1227 |
+
California for the operation of UC LLNL.
|
| 1228 |
+
|
| 1229 |
+
|
| 1230 |
+
DISCLAIMER
|
| 1231 |
+
|
| 1232 |
+
This software was prepared as an account of work sponsored by an
|
| 1233 |
+
agency of the United States Government. Neither the United States
|
| 1234 |
+
Government nor the University of California nor any of their
|
| 1235 |
+
employees, makes any warranty, express or implied, or assumes any
|
| 1236 |
+
liability or responsibility for the accuracy, completeness, or
|
| 1237 |
+
usefulness of any information, apparatus, product, or process
|
| 1238 |
+
disclosed, or represents that its use would not infringe
|
| 1239 |
+
privately-owned rights. Reference herein to any specific commercial
|
| 1240 |
+
products, process, or service by trade name, trademark, manufacturer,
|
| 1241 |
+
or otherwise, does not necessarily constitute or imply its
|
| 1242 |
+
endorsement, recommendation, or favoring by the United States
|
| 1243 |
+
Government or the University of California. The views and opinions of
|
| 1244 |
+
authors expressed herein do not necessarily state or reflect those of
|
| 1245 |
+
the United States Government or the University of California, and
|
| 1246 |
+
shall not be used for advertising or product endorsement purposes.
|
| 1247 |
+
|
| 1248 |
+
|
| 1249 |
+
AUTHOR
|
| 1250 |
+
|
| 1251 |
+
David H. Munro wrote Yorick and Gist. Berkeley Yacc (byacc) generated
|
| 1252 |
+
the Yorick parser. The routines in Math are from LAPACK and FFTPACK;
|
| 1253 |
+
MathC contains C translations by David H. Munro. The algorithms for
|
| 1254 |
+
Yorick's random number generator and several special functions in
|
| 1255 |
+
Yorick/include were taken from Numerical Recipes by Press, et. al.,
|
| 1256 |
+
although the Yorick implementations are unrelated to those in
|
| 1257 |
+
Numerical Recipes. A small amount of code in Gist was adapted from
|
| 1258 |
+
the X11R4 release, copyright M.I.T. -- the complete copyright notice
|
| 1259 |
+
may be found in the (unused) file Gist/host.c.
|
| 1260 |
+
|
| 1261 |
+
Classifier: Development Status :: 5 - Production/Stable
|
| 1262 |
+
Classifier: Framework :: Matplotlib
|
| 1263 |
+
Classifier: Intended Audience :: Science/Research
|
| 1264 |
+
Classifier: Intended Audience :: Education
|
| 1265 |
+
Classifier: License :: OSI Approved :: Python Software Foundation License
|
| 1266 |
+
Classifier: Programming Language :: Python
|
| 1267 |
+
Classifier: Programming Language :: Python :: 3
|
| 1268 |
+
Classifier: Programming Language :: Python :: 3.11
|
| 1269 |
+
Classifier: Programming Language :: Python :: 3.12
|
| 1270 |
+
Classifier: Programming Language :: Python :: 3.13
|
| 1271 |
+
Classifier: Programming Language :: Python :: 3.14
|
| 1272 |
+
Classifier: Topic :: Scientific/Engineering :: Visualization
|
| 1273 |
+
Project-URL: Homepage, https://matplotlib.org
|
| 1274 |
+
Project-URL: Download, https://matplotlib.org/stable/install/index.html
|
| 1275 |
+
Project-URL: Documentation, https://matplotlib.org
|
| 1276 |
+
Project-URL: Source Code, https://github.com/matplotlib/matplotlib
|
| 1277 |
+
Project-URL: Bug Tracker, https://github.com/matplotlib/matplotlib/issues
|
| 1278 |
+
Project-URL: Forum, https://discourse.matplotlib.org/
|
| 1279 |
+
Project-URL: Donate, https://numfocus.org/donate-to-matplotlib
|
| 1280 |
+
Requires-Python: >=3.11
|
| 1281 |
+
Requires-Dist: contourpy>=1.0.1
|
| 1282 |
+
Requires-Dist: cycler>=0.10
|
| 1283 |
+
Requires-Dist: fonttools>=4.28.2
|
| 1284 |
+
Requires-Dist: kiwisolver>=1.3.1
|
| 1285 |
+
Requires-Dist: numpy>=1.25
|
| 1286 |
+
Requires-Dist: packaging>=20.0
|
| 1287 |
+
Requires-Dist: pillow>=9
|
| 1288 |
+
Requires-Dist: pyparsing>=3
|
| 1289 |
+
Requires-Dist: python-dateutil>=2.7
|
| 1290 |
+
Description-Content-Type: text/markdown
|
| 1291 |
+
|
| 1292 |
+
[](https://pypi.org/project/matplotlib/)
|
| 1293 |
+
[](https://anaconda.org/conda-forge/matplotlib)
|
| 1294 |
+
[](https://pypi.org/project/matplotlib)
|
| 1295 |
+
[](https://numfocus.org)
|
| 1296 |
+
[](https://insights.linuxfoundation.org/project/matplotlib)
|
| 1297 |
+
|
| 1298 |
+
[](https://discourse.matplotlib.org)
|
| 1299 |
+
[](https://discourse.matplotlib.org/chat/c/matplotlib/2)
|
| 1300 |
+
[](https://github.com/matplotlib/matplotlib/issues)
|
| 1301 |
+
[](https://matplotlib.org/stable/devel/index.html)
|
| 1302 |
+
|
| 1303 |
+
[](https://github.com/matplotlib/matplotlib/actions?query=workflow%3ATests)
|
| 1304 |
+
[](https://dev.azure.com/matplotlib/matplotlib/_build/latest?definitionId=1&branchName=main)
|
| 1305 |
+
[](https://ci.appveyor.com/project/matplotlib/matplotlib)
|
| 1306 |
+
[](https://app.codecov.io/gh/matplotlib/matplotlib)
|
| 1307 |
+
[](https://jacobtomlinson.dev/effver)
|
| 1308 |
+
|
| 1309 |
+

|
| 1310 |
+
|
| 1311 |
+
Matplotlib is a comprehensive library for creating static, animated, and
|
| 1312 |
+
interactive visualizations in Python.
|
| 1313 |
+
|
| 1314 |
+
Check out our [home page](https://matplotlib.org/) for more information.
|
| 1315 |
+
|
| 1316 |
+

|
| 1317 |
+
|
| 1318 |
+
Matplotlib produces publication-quality figures in a variety of hardcopy
|
| 1319 |
+
formats and interactive environments across platforms. Matplotlib can be
|
| 1320 |
+
used in Python scripts, Python/IPython shells, web application servers,
|
| 1321 |
+
and various graphical user interface toolkits.
|
| 1322 |
+
|
| 1323 |
+
## Install
|
| 1324 |
+
|
| 1325 |
+
See the [install
|
| 1326 |
+
documentation](https://matplotlib.org/stable/users/installing/index.html),
|
| 1327 |
+
which is generated from `/doc/install/index.rst`
|
| 1328 |
+
|
| 1329 |
+
## Contribute
|
| 1330 |
+
|
| 1331 |
+
You've discovered a bug or something else you want to change — excellent!
|
| 1332 |
+
|
| 1333 |
+
You've worked out a way to fix it — even better!
|
| 1334 |
+
|
| 1335 |
+
You want to tell us about it — best of all!
|
| 1336 |
+
|
| 1337 |
+
Start at the [contributing
|
| 1338 |
+
guide](https://matplotlib.org/devdocs/devel/contribute.html)!
|
| 1339 |
+
|
| 1340 |
+
## Contact
|
| 1341 |
+
|
| 1342 |
+
[Discourse](https://discourse.matplotlib.org/) is the discussion forum
|
| 1343 |
+
for general questions and discussions and our recommended starting
|
| 1344 |
+
point.
|
| 1345 |
+
|
| 1346 |
+
Our active mailing lists (which are mirrored on Discourse) are:
|
| 1347 |
+
|
| 1348 |
+
- [Users](https://mail.python.org/mailman/listinfo/matplotlib-users)
|
| 1349 |
+
mailing list: <matplotlib-users@python.org>
|
| 1350 |
+
- [Announcement](https://mail.python.org/mailman/listinfo/matplotlib-announce)
|
| 1351 |
+
mailing list: <matplotlib-announce@python.org>
|
| 1352 |
+
- [Development](https://mail.python.org/mailman/listinfo/matplotlib-devel)
|
| 1353 |
+
mailing list: <matplotlib-devel@python.org>
|
| 1354 |
+
|
| 1355 |
+
[Discourse Chat](https://discourse.matplotlib.org/chat/c/matplotlib/2) is for
|
| 1356 |
+
coordinating development and asking questions directly related to contributing
|
| 1357 |
+
to matplotlib.
|
| 1358 |
+
|
| 1359 |
+
## Citing Matplotlib
|
| 1360 |
+
|
| 1361 |
+
If Matplotlib contributes to a project that leads to publication, please
|
| 1362 |
+
acknowledge this by citing Matplotlib.
|
| 1363 |
+
|
| 1364 |
+
[A ready-made citation
|
| 1365 |
+
entry](https://matplotlib.org/stable/users/project/citing.html) is
|
| 1366 |
+
available.
|
.cache/pip/http-v2/c/c/c/b/4/cccb41730ba9dcdb4cb7127715ba43b53bfd809d6ff652fe215567a3
ADDED
|
Binary file (1.23 kB). View file
|
|
|
.cache/pip/http-v2/c/c/c/b/4/cccb41730ba9dcdb4cb7127715ba43b53bfd809d6ff652fe215567a3.body
ADDED
|
@@ -0,0 +1,300 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Metadata-Version: 2.4
|
| 2 |
+
Name: segmentation_models_pytorch
|
| 3 |
+
Version: 0.5.0
|
| 4 |
+
Summary: Image segmentation models with pre-trained backbones. PyTorch.
|
| 5 |
+
Author-email: Pavel Iakubovskii <qubvel@gmail.com>
|
| 6 |
+
License: The MIT License
|
| 7 |
+
|
| 8 |
+
Copyright (c) 2019, Pavel Iakubovskii
|
| 9 |
+
|
| 10 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 11 |
+
of this software and associated documentation files (the "Software"), to deal
|
| 12 |
+
in the Software without restriction, including without limitation the rights
|
| 13 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
| 14 |
+
copies of the Software, and to permit persons to whom the Software is
|
| 15 |
+
furnished to do so, subject to the following conditions:
|
| 16 |
+
|
| 17 |
+
The above copyright notice and this permission notice shall be included in
|
| 18 |
+
all copies or substantial portions of the Software.
|
| 19 |
+
|
| 20 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 21 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 22 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 23 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 24 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 25 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
| 26 |
+
THE SOFTWARE.
|
| 27 |
+
|
| 28 |
+
Project-URL: Homepage, https://github.com/qubvel-org/segmentation_models.pytorch
|
| 29 |
+
Classifier: License :: OSI Approved :: MIT License
|
| 30 |
+
Classifier: Programming Language :: Python
|
| 31 |
+
Classifier: Programming Language :: Python :: 3
|
| 32 |
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
| 33 |
+
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
| 34 |
+
Requires-Python: >=3.9
|
| 35 |
+
Description-Content-Type: text/markdown
|
| 36 |
+
License-File: LICENSE
|
| 37 |
+
Requires-Dist: huggingface-hub>=0.24
|
| 38 |
+
Requires-Dist: numpy>=1.19.3
|
| 39 |
+
Requires-Dist: pillow>=8
|
| 40 |
+
Requires-Dist: safetensors>=0.3.1
|
| 41 |
+
Requires-Dist: timm>=0.9
|
| 42 |
+
Requires-Dist: torch>=1.8
|
| 43 |
+
Requires-Dist: torchvision>=0.9
|
| 44 |
+
Requires-Dist: tqdm>=4.42.1
|
| 45 |
+
Provides-Extra: docs
|
| 46 |
+
Requires-Dist: autodocsumm; extra == "docs"
|
| 47 |
+
Requires-Dist: huggingface-hub; extra == "docs"
|
| 48 |
+
Requires-Dist: six; extra == "docs"
|
| 49 |
+
Requires-Dist: sphinx; extra == "docs"
|
| 50 |
+
Requires-Dist: sphinx-book-theme; extra == "docs"
|
| 51 |
+
Provides-Extra: test
|
| 52 |
+
Requires-Dist: gitpython; extra == "test"
|
| 53 |
+
Requires-Dist: packaging; extra == "test"
|
| 54 |
+
Requires-Dist: pytest; extra == "test"
|
| 55 |
+
Requires-Dist: pytest-cov; extra == "test"
|
| 56 |
+
Requires-Dist: pytest-xdist; extra == "test"
|
| 57 |
+
Requires-Dist: ruff>=0.9; extra == "test"
|
| 58 |
+
Requires-Dist: setuptools; extra == "test"
|
| 59 |
+
Dynamic: license-file
|
| 60 |
+
|
| 61 |
+
<div align="center">
|
| 62 |
+
|
| 63 |
+

|
| 64 |
+
**Python library with Neural Networks for Image Semantic
|
| 65 |
+
Segmentation based on [PyTorch](https://pytorch.org/).**
|
| 66 |
+
|
| 67 |
+
|
| 68 |
+
[](https://github.com/qubvel/segmentation_models.pytorch/actions/workflows/tests.yml)
|
| 69 |
+

|
| 70 |
+
[](https://smp.readthedocs.io/en/latest/)
|
| 71 |
+
<br>
|
| 72 |
+
[](https://pypi.org/project/segmentation-models-pytorch/)
|
| 73 |
+
[](https://pepy.tech/project/segmentation-models-pytorch)
|
| 74 |
+
[](https://pepy.tech/project/segmentation-models-pytorch)
|
| 75 |
+
<br>
|
| 76 |
+
[](https://github.com/qubvel/segmentation_models.pytorch/blob/main/LICENSE)
|
| 77 |
+
[](https://pepy.tech/project/segmentation-models-pytorch)
|
| 78 |
+
|
| 79 |
+
</div>
|
| 80 |
+
|
| 81 |
+
The main features of the library are:
|
| 82 |
+
|
| 83 |
+
- Super simple high-level API (just two lines to create a neural network)
|
| 84 |
+
- 12 encoder-decoder model architectures (Unet, Unet++, Segformer, DPT, ...)
|
| 85 |
+
- 800+ **pretrained** convolution- and transform-based encoders, including [timm](https://github.com/huggingface/pytorch-image-models) support
|
| 86 |
+
- Popular metrics and losses for training routines (Dice, Jaccard, Tversky, ...)
|
| 87 |
+
- ONNX export and torch script/trace/compile friendly
|
| 88 |
+
|
| 89 |
+
### Community-Driven Project, Supported By
|
| 90 |
+
<table>
|
| 91 |
+
<tr>
|
| 92 |
+
<td align="center" vertical-align="center">
|
| 93 |
+
<a href="https://withoutbg.com/?utm_source=smp&utm_medium=github_readme&utm_campaign=sponsorship" >
|
| 94 |
+
<img src="https://withoutbg.com/images/logo-social.png" width="70px;" alt="withoutBG API Logo" />
|
| 95 |
+
</a>
|
| 96 |
+
</td>
|
| 97 |
+
<td align="center" vertical-align="center">
|
| 98 |
+
<b>withoutBG API</b>
|
| 99 |
+
<br />
|
| 100 |
+
<a href="https://withoutbg.com/?utm_source=smp&utm_medium=github_readme&utm_campaign=sponsorship">https://withoutbg.com</a>
|
| 101 |
+
<br />
|
| 102 |
+
<p width="200px">
|
| 103 |
+
High-quality background removal API
|
| 104 |
+
<br/>
|
| 105 |
+
</p>
|
| 106 |
+
</td>
|
| 107 |
+
</tr>
|
| 108 |
+
</table>
|
| 109 |
+
|
| 110 |
+
### [📚 Project Documentation 📚](http://smp.readthedocs.io/)
|
| 111 |
+
|
| 112 |
+
Visit [Read The Docs Project Page](https://smp.readthedocs.io/) or read the following README to know more about Segmentation Models Pytorch (SMP for short) library
|
| 113 |
+
|
| 114 |
+
### 📋 Table of content
|
| 115 |
+
1. [Quick start](#start)
|
| 116 |
+
2. [Examples](#examples)
|
| 117 |
+
3. [Models and encoders](#models-and-encoders)
|
| 118 |
+
4. [Models API](#api)
|
| 119 |
+
1. [Input channels](#input-channels)
|
| 120 |
+
2. [Auxiliary classification output](#auxiliary-classification-output)
|
| 121 |
+
3. [Depth](#depth)
|
| 122 |
+
5. [Installation](#installation)
|
| 123 |
+
6. [Competitions won with the library](#competitions)
|
| 124 |
+
7. [Contributing](#contributing)
|
| 125 |
+
8. [Citing](#citing)
|
| 126 |
+
9. [License](#license)
|
| 127 |
+
|
| 128 |
+
## ⏳ Quick start <a name="start"></a>
|
| 129 |
+
|
| 130 |
+
#### 1. Create your first Segmentation model with SMP
|
| 131 |
+
|
| 132 |
+
The segmentation model is just a PyTorch `torch.nn.Module`, which can be created as easy as:
|
| 133 |
+
|
| 134 |
+
```python
|
| 135 |
+
import segmentation_models_pytorch as smp
|
| 136 |
+
|
| 137 |
+
model = smp.Unet(
|
| 138 |
+
encoder_name="resnet34", # choose encoder, e.g. mobilenet_v2 or efficientnet-b7
|
| 139 |
+
encoder_weights="imagenet", # use `imagenet` pre-trained weights for encoder initialization
|
| 140 |
+
in_channels=1, # model input channels (1 for gray-scale images, 3 for RGB, etc.)
|
| 141 |
+
classes=3, # model output channels (number of classes in your dataset)
|
| 142 |
+
)
|
| 143 |
+
```
|
| 144 |
+
- see [table](#architectures) with available model architectures
|
| 145 |
+
- see [table](#encoders) with available encoders and their corresponding weights
|
| 146 |
+
|
| 147 |
+
#### 2. Configure data preprocessing
|
| 148 |
+
|
| 149 |
+
All encoders have pretrained weights. Preparing your data the same way as during weights pre-training may give you better results (higher metric score and faster convergence). It is **not necessary** in case you train the whole model, not only the decoder.
|
| 150 |
+
|
| 151 |
+
```python
|
| 152 |
+
from segmentation_models_pytorch.encoders import get_preprocessing_fn
|
| 153 |
+
|
| 154 |
+
preprocess_input = get_preprocessing_fn('resnet18', pretrained='imagenet')
|
| 155 |
+
```
|
| 156 |
+
|
| 157 |
+
Congratulations! You are done! Now you can train your model with your favorite framework!
|
| 158 |
+
|
| 159 |
+
## 💡 Examples <a name="examples"></a>
|
| 160 |
+
|
| 161 |
+
| Name | Link | Colab |
|
| 162 |
+
|-------------------------------------------|-----------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------|
|
| 163 |
+
| **Train** pets binary segmentation on OxfordPets | [Notebook](https://github.com/qubvel/segmentation_models.pytorch/blob/main/examples/binary_segmentation_intro.ipynb) | [](https://colab.research.google.com/github/qubvel/segmentation_models.pytorch/blob/main/examples/binary_segmentation_intro.ipynb) |
|
| 164 |
+
| **Train** cars binary segmentation on CamVid | [Notebook](https://github.com/qubvel/segmentation_models.pytorch/blob/main/examples/cars%20segmentation%20(camvid).ipynb) | [](https://colab.research.google.com/github/qubvel/segmentation_models.pytorch/blob/main/examples/cars%20segmentation%20(camvid).ipynb) |
|
| 165 |
+
| **Train** multiclass segmentation on CamVid | [Notebook](https://github.com/qubvel-org/segmentation_models.pytorch/blob/main/examples/camvid_segmentation_multiclass.ipynb) | [](https://colab.research.google.com/github/qubvel-org/segmentation_models.pytorch/blob/main/examples/camvid_segmentation_multiclass.ipynb) |
|
| 166 |
+
| **Train** clothes binary segmentation by @ternaus | [Repo](https://github.com/ternaus/cloths_segmentation) | |
|
| 167 |
+
| **Load and inference** pretrained Segformer | [Notebook](https://github.com/qubvel-org/segmentation_models.pytorch/blob/main/examples/segformer_inference_pretrained.ipynb) | [](https://colab.research.google.com/github/qubvel/segmentation_models.pytorch/blob/main/examples/segformer_inference_pretrained.ipynb) |
|
| 168 |
+
| **Load and inference** pretrained DPT | [Notebook](https://github.com/qubvel-org/segmentation_models.pytorch/blob/main/examples/dpt_inference_pretrained.ipynb) | [](https://colab.research.google.com/github/qubvel/segmentation_models.pytorch/blob/main/examples/dpt_inference_pretrained.ipynb) |
|
| 169 |
+
| **Load and inference** pretrained DPT | [Notebook](https://github.com/qubvel-org/segmentation_models.pytorch/blob/main/examples/upernet_inference_pretrained.ipynb) | [](https://colab.research.google.com/github/qubvel/segmentation_models.pytorch/blob/main/examples/upernet_inference_pretrained.ipynb) |
|
| 170 |
+
| **Save and load** models locally / to HuggingFace Hub |[Notebook](https://github.com/qubvel-org/segmentation_models.pytorch/blob/main/examples/save_load_model_and_share_with_hf_hub.ipynb) | [](https://colab.research.google.com/github/qubvel/segmentation_models.pytorch/blob/main/examples/save_load_model_and_share_with_hf_hub.ipynb)
|
| 171 |
+
| **Export** trained model to ONNX | [Notebook](https://github.com/qubvel/segmentation_models.pytorch/blob/main/examples/convert_to_onnx.ipynb) | [](https://colab.research.google.com/github/qubvel/segmentation_models.pytorch/blob/main/examples/convert_to_onnx.ipynb) |
|
| 172 |
+
|
| 173 |
+
|
| 174 |
+
## 📦 Models and encoders <a name="models-and-encoders"></a>
|
| 175 |
+
|
| 176 |
+
### Architectures <a name="architectures"></a>
|
| 177 |
+
| Architecture | Paper | Documentation | Checkpoints |
|
| 178 |
+
|--------------|-------|---------------|------------|
|
| 179 |
+
| Unet | [paper](https://arxiv.org/abs/1505.04597) | [docs](https://smp.readthedocs.io/en/latest/models.html#unet) | |
|
| 180 |
+
| Unet++ | [paper](https://arxiv.org/pdf/1807.10165.pdf) | [docs](https://smp.readthedocs.io/en/latest/models.html#unetplusplus) | |
|
| 181 |
+
| MAnet | [paper](https://ieeexplore.ieee.org/abstract/document/9201310) | [docs](https://smp.readthedocs.io/en/latest/models.html#manet) | |
|
| 182 |
+
| Linknet | [paper](https://arxiv.org/abs/1707.03718) | [docs](https://smp.readthedocs.io/en/latest/models.html#linknet) | |
|
| 183 |
+
| FPN | [paper](http://presentations.cocodataset.org/COCO17-Stuff-FAIR.pdf) | [docs](https://smp.readthedocs.io/en/latest/models.html#fpn) | |
|
| 184 |
+
| PSPNet | [paper](https://arxiv.org/abs/1612.01105) | [docs](https://smp.readthedocs.io/en/latest/models.html#pspnet) | |
|
| 185 |
+
| PAN | [paper](https://arxiv.org/abs/1805.10180) | [docs](https://smp.readthedocs.io/en/latest/models.html#pan) | |
|
| 186 |
+
| DeepLabV3 | [paper](https://arxiv.org/abs/1706.05587) | [docs](https://smp.readthedocs.io/en/latest/models.html#deeplabv3) | |
|
| 187 |
+
| DeepLabV3+ | [paper](https://arxiv.org/abs/1802.02611) | [docs](https://smp.readthedocs.io/en/latest/models.html#deeplabv3plus) | |
|
| 188 |
+
| UPerNet | [paper](https://arxiv.org/abs/1807.10221) | [docs](https://smp.readthedocs.io/en/latest/models.html#upernet) | [checkpoints](https://huggingface.co/collections/smp-hub/upernet-67fadcdbe08418c6ea94f768) |
|
| 189 |
+
| Segformer | [paper](https://arxiv.org/abs/2105.15203) | [docs](https://smp.readthedocs.io/en/latest/models.html#segformer) | [checkpoints](https://huggingface.co/collections/smp-hub/segformer-6749eb4923dea2c355f29a1f) |
|
| 190 |
+
| DPT | [paper](https://arxiv.org/abs/2103.13413) | [docs](https://smp.readthedocs.io/en/latest/models.html#dpt) | [checkpoints](https://huggingface.co/collections/smp-hub/dpt-67f30487327c0599a0c62d68) |
|
| 191 |
+
|
| 192 |
+
### Encoders <a name="encoders"></a>
|
| 193 |
+
|
| 194 |
+
The library provides a wide range of **pretrained** encoders (also known as backbones) for segmentation models. Instead of using features from the final layer of a classification model, we extract **intermediate features** and feed them into the decoder for segmentation tasks.
|
| 195 |
+
|
| 196 |
+
All encoders come with **pretrained weights**, which help achieve **faster and more stable convergence** when training segmentation models.
|
| 197 |
+
|
| 198 |
+
Given the extensive selection of supported encoders, you can choose the best one for your specific use case, for example:
|
| 199 |
+
- **Lightweight encoders** for low-latency applications or real-time inference on edge devices (mobilenet/mobileone).
|
| 200 |
+
- **High-capacity architectures** for complex tasks involving a large number of segmented classes, providing superior accuracy (convnext/swin/mit).
|
| 201 |
+
|
| 202 |
+
By selecting the right encoder, you can balance **efficiency, performance, and model complexity** to suit your project needs.
|
| 203 |
+
|
| 204 |
+
All encoders and corresponding pretrained weight are listed in the documentation:
|
| 205 |
+
- [table](https://smp.readthedocs.io/en/latest/encoders.html) with natively ported encoders
|
| 206 |
+
- [table](https://smp.readthedocs.io/en/latest/encoders_timm.html) with [timm](https://github.com/huggingface/pytorch-image-models) encoders supported
|
| 207 |
+
|
| 208 |
+
## 🔁 Models API <a name="api"></a>
|
| 209 |
+
|
| 210 |
+
### Input channels
|
| 211 |
+
|
| 212 |
+
The input channels parameter allows you to create a model that can process a tensor with an arbitrary number of channels.
|
| 213 |
+
If you use pretrained weights from ImageNet, the weights of the first convolution will be reused:
|
| 214 |
+
- For the 1-channel case, it would be a sum of the weights of the first convolution layer.
|
| 215 |
+
- Otherwise, channels would be populated with weights like `new_weight[:, i] = pretrained_weight[:, i % 3]`, and then scaled with `new_weight * 3 / new_in_channels`.
|
| 216 |
+
|
| 217 |
+
```python
|
| 218 |
+
model = smp.FPN('resnet34', in_channels=1)
|
| 219 |
+
mask = model(torch.ones([1, 1, 64, 64]))
|
| 220 |
+
```
|
| 221 |
+
|
| 222 |
+
### Auxiliary classification output
|
| 223 |
+
|
| 224 |
+
All models support `aux_params` parameters, which is default set to `None`.
|
| 225 |
+
If `aux_params = None` then classification auxiliary output is not created, else
|
| 226 |
+
model produce not only `mask`, but also `label` output with shape `NC`.
|
| 227 |
+
Classification head consists of GlobalPooling->Dropout(optional)->Linear->Activation(optional) layers, which can be
|
| 228 |
+
configured by `aux_params` as follows:
|
| 229 |
+
```python
|
| 230 |
+
aux_params=dict(
|
| 231 |
+
pooling='avg', # one of 'avg', 'max'
|
| 232 |
+
dropout=0.5, # dropout ratio, default is None
|
| 233 |
+
activation='sigmoid', # activation function, default is None
|
| 234 |
+
classes=4, # define number of output labels
|
| 235 |
+
)
|
| 236 |
+
model = smp.Unet('resnet34', classes=4, aux_params=aux_params)
|
| 237 |
+
mask, label = model(x)
|
| 238 |
+
```
|
| 239 |
+
|
| 240 |
+
### Depth
|
| 241 |
+
|
| 242 |
+
Depth parameter specify a number of downsampling operations in encoder, so you can make
|
| 243 |
+
your model lighter if specify smaller `depth`.
|
| 244 |
+
```python
|
| 245 |
+
model = smp.Unet('resnet34', encoder_depth=4)
|
| 246 |
+
```
|
| 247 |
+
|
| 248 |
+
## 🛠 Installation <a name="installation"></a>
|
| 249 |
+
PyPI version:
|
| 250 |
+
|
| 251 |
+
```bash
|
| 252 |
+
$ pip install segmentation-models-pytorch
|
| 253 |
+
````
|
| 254 |
+
|
| 255 |
+
The latest version from GitHub:
|
| 256 |
+
|
| 257 |
+
```bash
|
| 258 |
+
$ pip install git+https://github.com/qubvel/segmentation_models.pytorch
|
| 259 |
+
````
|
| 260 |
+
|
| 261 |
+
## 🏆 Competitions won with the library <a name="competitions"></a>
|
| 262 |
+
|
| 263 |
+
`Segmentation Models` package is widely used in image segmentation competitions.
|
| 264 |
+
[Here](https://github.com/qubvel/segmentation_models.pytorch/blob/main/HALLOFFAME.md) you can find competitions, names of the winners and links to their solutions.
|
| 265 |
+
|
| 266 |
+
## 🤝 Contributing <a name="contributing"></a>
|
| 267 |
+
|
| 268 |
+
1. Install SMP in dev mode
|
| 269 |
+
|
| 270 |
+
```bash
|
| 271 |
+
make install_dev # Create .venv, install SMP in dev mode
|
| 272 |
+
```
|
| 273 |
+
|
| 274 |
+
2. Run tests and code checks
|
| 275 |
+
|
| 276 |
+
```bash
|
| 277 |
+
make test # Run tests suite with pytest
|
| 278 |
+
make fixup # Ruff for formatting and lint checks
|
| 279 |
+
```
|
| 280 |
+
|
| 281 |
+
3. Update a table (in case you added an encoder)
|
| 282 |
+
|
| 283 |
+
```bash
|
| 284 |
+
make table # Generates a table with encoders and print to stdout
|
| 285 |
+
```
|
| 286 |
+
|
| 287 |
+
## 📝 Citing <a name="citing"></a>
|
| 288 |
+
```
|
| 289 |
+
@misc{Iakubovskii:2019,
|
| 290 |
+
Author = {Pavel Iakubovskii},
|
| 291 |
+
Title = {Segmentation Models Pytorch},
|
| 292 |
+
Year = {2019},
|
| 293 |
+
Publisher = {GitHub},
|
| 294 |
+
Journal = {GitHub repository},
|
| 295 |
+
Howpublished = {\url{https://github.com/qubvel/segmentation_models.pytorch}}
|
| 296 |
+
}
|
| 297 |
+
```
|
| 298 |
+
|
| 299 |
+
## 🛡️ License <a name="license"></a>
|
| 300 |
+
The project is primarily distributed under [MIT License](https://github.com/qubvel/segmentation_models.pytorch/blob/main/LICENSE), while some files are subject to other licenses. Please refer to [LICENSES](licenses/LICENSES.md) and license statements in each file for careful check, especially for commercial use.
|
.cache/pip/http-v2/c/d/5/d/e/cd5de44b899cbe1869765c21b55cffc53c0c0ffa9d3c6f1fd40a42a2
ADDED
|
Binary file (1.9 kB). View file
|
|
|
.cache/pip/http-v2/e/5/0/3/0/e503010ce88b2bb388d7806c951cab4dd3e436342653b4835f430bcc.body
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:382ff9f685ee3bc25864f820aa50505825f10f5458ffff07e30a6d96e5715cab
|
| 3 |
+
size 1813144
|
.cache/pip/http-v2/e/a/2/2/a/ea22a79fcbb7a5195dc8846d5b7ddabfe6981d47f448fe52cbe95a8a
ADDED
|
Binary file (1.9 kB). View file
|
|
|
.cache/pip/http-v2/e/c/8/b/3/ec8b32f74b33a66cdb59c6ce388ac68e5697696325dcbe84554f832d
ADDED
|
Binary file (1.24 kB). View file
|
|
|
.cache/pip/http-v2/e/c/8/b/3/ec8b32f74b33a66cdb59c6ce388ac68e5697696325dcbe84554f832d.body
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Metadata-Version: 2.4
|
| 2 |
+
Name: alembic
|
| 3 |
+
Version: 1.18.5
|
| 4 |
+
Summary: A database migration tool for SQLAlchemy.
|
| 5 |
+
Author-email: Mike Bayer <mike_mp@zzzcomputing.com>
|
| 6 |
+
License-Expression: MIT
|
| 7 |
+
Project-URL: Homepage, https://alembic.sqlalchemy.org
|
| 8 |
+
Project-URL: Documentation, https://alembic.sqlalchemy.org/en/latest/
|
| 9 |
+
Project-URL: Changelog, https://alembic.sqlalchemy.org/en/latest/changelog.html
|
| 10 |
+
Project-URL: Source, https://github.com/sqlalchemy/alembic/
|
| 11 |
+
Project-URL: Issue Tracker, https://github.com/sqlalchemy/alembic/issues/
|
| 12 |
+
Classifier: Development Status :: 5 - Production/Stable
|
| 13 |
+
Classifier: Intended Audience :: Developers
|
| 14 |
+
Classifier: Environment :: Console
|
| 15 |
+
Classifier: Operating System :: OS Independent
|
| 16 |
+
Classifier: Programming Language :: Python
|
| 17 |
+
Classifier: Programming Language :: Python :: 3
|
| 18 |
+
Classifier: Programming Language :: Python :: 3.10
|
| 19 |
+
Classifier: Programming Language :: Python :: 3.11
|
| 20 |
+
Classifier: Programming Language :: Python :: 3.12
|
| 21 |
+
Classifier: Programming Language :: Python :: 3.13
|
| 22 |
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
| 23 |
+
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
| 24 |
+
Classifier: Topic :: Database :: Front-Ends
|
| 25 |
+
Requires-Python: >=3.10
|
| 26 |
+
Description-Content-Type: text/x-rst
|
| 27 |
+
License-File: LICENSE
|
| 28 |
+
Requires-Dist: SQLAlchemy>=1.4.23
|
| 29 |
+
Requires-Dist: Mako
|
| 30 |
+
Requires-Dist: typing-extensions>=4.12
|
| 31 |
+
Requires-Dist: tomli; python_version < "3.11"
|
| 32 |
+
Provides-Extra: tz
|
| 33 |
+
Requires-Dist: tzdata; extra == "tz"
|
| 34 |
+
Dynamic: license-file
|
| 35 |
+
|
| 36 |
+
Alembic is a database migrations tool written by the author
|
| 37 |
+
of `SQLAlchemy <http://www.sqlalchemy.org>`_. A migrations tool
|
| 38 |
+
offers the following functionality:
|
| 39 |
+
|
| 40 |
+
* Can emit ALTER statements to a database in order to change
|
| 41 |
+
the structure of tables and other constructs
|
| 42 |
+
* Provides a system whereby "migration scripts" may be constructed;
|
| 43 |
+
each script indicates a particular series of steps that can "upgrade" a
|
| 44 |
+
target database to a new version, and optionally a series of steps that can
|
| 45 |
+
"downgrade" similarly, doing the same steps in reverse.
|
| 46 |
+
* Allows the scripts to execute in some sequential manner.
|
| 47 |
+
|
| 48 |
+
The goals of Alembic are:
|
| 49 |
+
|
| 50 |
+
* Very open ended and transparent configuration and operation. A new
|
| 51 |
+
Alembic environment is generated from a set of templates which is selected
|
| 52 |
+
among a set of options when setup first occurs. The templates then deposit a
|
| 53 |
+
series of scripts that define fully how database connectivity is established
|
| 54 |
+
and how migration scripts are invoked; the migration scripts themselves are
|
| 55 |
+
generated from a template within that series of scripts. The scripts can
|
| 56 |
+
then be further customized to define exactly how databases will be
|
| 57 |
+
interacted with and what structure new migration files should take.
|
| 58 |
+
* Full support for transactional DDL. The default scripts ensure that all
|
| 59 |
+
migrations occur within a transaction - for those databases which support
|
| 60 |
+
this (Postgresql, Microsoft SQL Server), migrations can be tested with no
|
| 61 |
+
need to manually undo changes upon failure.
|
| 62 |
+
* Minimalist script construction. Basic operations like renaming
|
| 63 |
+
tables/columns, adding/removing columns, changing column attributes can be
|
| 64 |
+
performed through one line commands like alter_column(), rename_table(),
|
| 65 |
+
add_constraint(). There is no need to recreate full SQLAlchemy Table
|
| 66 |
+
structures for simple operations like these - the functions themselves
|
| 67 |
+
generate minimalist schema structures behind the scenes to achieve the given
|
| 68 |
+
DDL sequence.
|
| 69 |
+
* "auto generation" of migrations. While real world migrations are far more
|
| 70 |
+
complex than what can be automatically determined, Alembic can still
|
| 71 |
+
eliminate the initial grunt work in generating new migration directives
|
| 72 |
+
from an altered schema. The ``--autogenerate`` feature will inspect the
|
| 73 |
+
current status of a database using SQLAlchemy's schema inspection
|
| 74 |
+
capabilities, compare it to the current state of the database model as
|
| 75 |
+
specified in Python, and generate a series of "candidate" migrations,
|
| 76 |
+
rendering them into a new migration script as Python directives. The
|
| 77 |
+
developer then edits the new file, adding additional directives and data
|
| 78 |
+
migrations as needed, to produce a finished migration. Table and column
|
| 79 |
+
level changes can be detected, with constraints and indexes to follow as
|
| 80 |
+
well.
|
| 81 |
+
* Full support for migrations generated as SQL scripts. Those of us who
|
| 82 |
+
work in corporate environments know that direct access to DDL commands on a
|
| 83 |
+
production database is a rare privilege, and DBAs want textual SQL scripts.
|
| 84 |
+
Alembic's usage model and commands are oriented towards being able to run a
|
| 85 |
+
series of migrations into a textual output file as easily as it runs them
|
| 86 |
+
directly to a database. Care must be taken in this mode to not invoke other
|
| 87 |
+
operations that rely upon in-memory SELECTs of rows - Alembic tries to
|
| 88 |
+
provide helper constructs like bulk_insert() to help with data-oriented
|
| 89 |
+
operations that are compatible with script-based DDL.
|
| 90 |
+
* Non-linear, dependency-graph versioning. Scripts are given UUID
|
| 91 |
+
identifiers similarly to a DVCS, and the linkage of one script to the next
|
| 92 |
+
is achieved via human-editable markers within the scripts themselves.
|
| 93 |
+
The structure of a set of migration files is considered as a
|
| 94 |
+
directed-acyclic graph, meaning any migration file can be dependent
|
| 95 |
+
on any other arbitrary set of migration files, or none at
|
| 96 |
+
all. Through this open-ended system, migration files can be organized
|
| 97 |
+
into branches, multiple roots, and mergepoints, without restriction.
|
| 98 |
+
Commands are provided to produce new branches, roots, and merges of
|
| 99 |
+
branches automatically.
|
| 100 |
+
* Provide a library of ALTER constructs that can be used by any SQLAlchemy
|
| 101 |
+
application. The DDL constructs build upon SQLAlchemy's own DDLElement base
|
| 102 |
+
and can be used standalone by any application or script.
|
| 103 |
+
* At long last, bring SQLite and its inability to ALTER things into the fold,
|
| 104 |
+
but in such a way that SQLite's very special workflow needs are accommodated
|
| 105 |
+
in an explicit way that makes the most of a bad situation, through the
|
| 106 |
+
concept of a "batch" migration, where multiple changes to a table can
|
| 107 |
+
be batched together to form a series of instructions for a single, subsequent
|
| 108 |
+
"move-and-copy" workflow. You can even use "move-and-copy" workflow for
|
| 109 |
+
other databases, if you want to recreate a table in the background
|
| 110 |
+
on a busy system.
|
| 111 |
+
|
| 112 |
+
Documentation and status of Alembic is at https://alembic.sqlalchemy.org/
|
| 113 |
+
|
| 114 |
+
The SQLAlchemy Project
|
| 115 |
+
======================
|
| 116 |
+
|
| 117 |
+
Alembic is part of the `SQLAlchemy Project <https://www.sqlalchemy.org>`_ and
|
| 118 |
+
adheres to the same standards and conventions as the core project.
|
| 119 |
+
|
| 120 |
+
Development / Bug reporting / Pull requests
|
| 121 |
+
___________________________________________
|
| 122 |
+
|
| 123 |
+
Please refer to the
|
| 124 |
+
`SQLAlchemy Community Guide <https://www.sqlalchemy.org/develop.html>`_ for
|
| 125 |
+
guidelines on coding and participating in this project.
|
| 126 |
+
|
| 127 |
+
Code of Conduct
|
| 128 |
+
_______________
|
| 129 |
+
|
| 130 |
+
Above all, SQLAlchemy places great emphasis on polite, thoughtful, and
|
| 131 |
+
constructive communication between users and developers.
|
| 132 |
+
Please see our current Code of Conduct at
|
| 133 |
+
`Code of Conduct <https://www.sqlalchemy.org/codeofconduct.html>`_.
|
| 134 |
+
|
| 135 |
+
License
|
| 136 |
+
=======
|
| 137 |
+
|
| 138 |
+
Alembic is distributed under the `MIT license
|
| 139 |
+
<https://opensource.org/licenses/MIT>`_.
|
.cache/uv/.gitignore
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
*
|
.cache/uv/.lock
ADDED
|
File without changes
|
.cache/uv/CACHEDIR.TAG
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
Signature: 8a477f597d28d172789f06886806bc55
|
.cache/uv/archive-v0/9vHEgYd05Zufvhj6EkjIX/typing_extensions.py
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
.cache/uv/archive-v0/WbiZCgDidtA5T1uiQ47d5/huggingface_hub-1.24.0.dist-info/METADATA
ADDED
|
@@ -0,0 +1,373 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Metadata-Version: 2.4
|
| 2 |
+
Name: huggingface_hub
|
| 3 |
+
Version: 1.24.0
|
| 4 |
+
Summary: Client library to download and publish models, datasets and other repos on the huggingface.co hub
|
| 5 |
+
Home-page: https://github.com/huggingface/huggingface_hub
|
| 6 |
+
Author: Hugging Face, Inc.
|
| 7 |
+
Author-email: julien@huggingface.co
|
| 8 |
+
License: Apache-2.0
|
| 9 |
+
Keywords: model-hub machine-learning models natural-language-processing deep-learning pytorch pretrained-models
|
| 10 |
+
Classifier: Intended Audience :: Developers
|
| 11 |
+
Classifier: Intended Audience :: Education
|
| 12 |
+
Classifier: Intended Audience :: Science/Research
|
| 13 |
+
Classifier: License :: OSI Approved :: Apache Software License
|
| 14 |
+
Classifier: Operating System :: OS Independent
|
| 15 |
+
Classifier: Programming Language :: Python :: 3
|
| 16 |
+
Classifier: Programming Language :: Python :: 3 :: Only
|
| 17 |
+
Classifier: Programming Language :: Python :: 3.10
|
| 18 |
+
Classifier: Programming Language :: Python :: 3.11
|
| 19 |
+
Classifier: Programming Language :: Python :: 3.12
|
| 20 |
+
Classifier: Programming Language :: Python :: 3.13
|
| 21 |
+
Classifier: Programming Language :: Python :: 3.14
|
| 22 |
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
| 23 |
+
Requires-Python: >=3.10.0
|
| 24 |
+
Description-Content-Type: text/markdown
|
| 25 |
+
License-File: LICENSE
|
| 26 |
+
Requires-Dist: click<9.0.0,>=8.4.2
|
| 27 |
+
Requires-Dist: filelock>=3.10.0
|
| 28 |
+
Requires-Dist: fsspec>=2023.5.0
|
| 29 |
+
Requires-Dist: hf-xet<2.0.0,>=1.5.1; platform_machine == "x86_64" or platform_machine == "amd64" or platform_machine == "AMD64" or platform_machine == "arm64" or platform_machine == "aarch64"
|
| 30 |
+
Requires-Dist: httpx<1,>=0.23.0
|
| 31 |
+
Requires-Dist: packaging>=20.9
|
| 32 |
+
Requires-Dist: pyyaml>=5.1
|
| 33 |
+
Requires-Dist: tqdm>=4.42.1
|
| 34 |
+
Requires-Dist: typing-extensions>=4.1.0
|
| 35 |
+
Provides-Extra: oauth
|
| 36 |
+
Requires-Dist: authlib>=1.3.2; extra == "oauth"
|
| 37 |
+
Requires-Dist: fastapi; extra == "oauth"
|
| 38 |
+
Requires-Dist: httpx; extra == "oauth"
|
| 39 |
+
Requires-Dist: itsdangerous; extra == "oauth"
|
| 40 |
+
Provides-Extra: torch
|
| 41 |
+
Requires-Dist: torch; extra == "torch"
|
| 42 |
+
Requires-Dist: safetensors[torch]; extra == "torch"
|
| 43 |
+
Provides-Extra: fastai
|
| 44 |
+
Requires-Dist: toml; extra == "fastai"
|
| 45 |
+
Requires-Dist: fastai>=2.4; extra == "fastai"
|
| 46 |
+
Requires-Dist: fastcore>=1.3.27; extra == "fastai"
|
| 47 |
+
Provides-Extra: hf-xet
|
| 48 |
+
Requires-Dist: hf-xet<2.0.0,>=1.5.1; extra == "hf-xet"
|
| 49 |
+
Provides-Extra: mcp
|
| 50 |
+
Requires-Dist: mcp>=1.8.0; extra == "mcp"
|
| 51 |
+
Provides-Extra: testing
|
| 52 |
+
Requires-Dist: authlib>=1.3.2; extra == "testing"
|
| 53 |
+
Requires-Dist: fastapi; extra == "testing"
|
| 54 |
+
Requires-Dist: httpx; extra == "testing"
|
| 55 |
+
Requires-Dist: itsdangerous; extra == "testing"
|
| 56 |
+
Requires-Dist: jedi; extra == "testing"
|
| 57 |
+
Requires-Dist: Jinja2; extra == "testing"
|
| 58 |
+
Requires-Dist: pytest>=8.4.2; extra == "testing"
|
| 59 |
+
Requires-Dist: pytest-cov; extra == "testing"
|
| 60 |
+
Requires-Dist: pytest-env; extra == "testing"
|
| 61 |
+
Requires-Dist: pytest-xdist; extra == "testing"
|
| 62 |
+
Requires-Dist: pytest-vcr; extra == "testing"
|
| 63 |
+
Requires-Dist: pytest-asyncio; extra == "testing"
|
| 64 |
+
Requires-Dist: pytest-rerunfailures<16.0; extra == "testing"
|
| 65 |
+
Requires-Dist: pytest-mock; extra == "testing"
|
| 66 |
+
Requires-Dist: urllib3<2.0; extra == "testing"
|
| 67 |
+
Requires-Dist: soundfile; extra == "testing"
|
| 68 |
+
Requires-Dist: Pillow; extra == "testing"
|
| 69 |
+
Requires-Dist: numpy; extra == "testing"
|
| 70 |
+
Requires-Dist: duckdb; extra == "testing"
|
| 71 |
+
Requires-Dist: fastapi; extra == "testing"
|
| 72 |
+
Provides-Extra: gradio
|
| 73 |
+
Requires-Dist: gradio>=5.0.0; extra == "gradio"
|
| 74 |
+
Requires-Dist: requests; extra == "gradio"
|
| 75 |
+
Provides-Extra: typing
|
| 76 |
+
Requires-Dist: typing-extensions>=4.8.0; extra == "typing"
|
| 77 |
+
Requires-Dist: types-PyYAML; extra == "typing"
|
| 78 |
+
Requires-Dist: types-simplejson; extra == "typing"
|
| 79 |
+
Requires-Dist: types-toml; extra == "typing"
|
| 80 |
+
Requires-Dist: types-tqdm; extra == "typing"
|
| 81 |
+
Requires-Dist: types-urllib3; extra == "typing"
|
| 82 |
+
Provides-Extra: quality
|
| 83 |
+
Requires-Dist: ruff>=0.9.0; extra == "quality"
|
| 84 |
+
Requires-Dist: mypy==1.15.0; extra == "quality"
|
| 85 |
+
Requires-Dist: libcst>=1.4.0; extra == "quality"
|
| 86 |
+
Requires-Dist: ty; extra == "quality"
|
| 87 |
+
Provides-Extra: all
|
| 88 |
+
Requires-Dist: authlib>=1.3.2; extra == "all"
|
| 89 |
+
Requires-Dist: fastapi; extra == "all"
|
| 90 |
+
Requires-Dist: httpx; extra == "all"
|
| 91 |
+
Requires-Dist: itsdangerous; extra == "all"
|
| 92 |
+
Requires-Dist: jedi; extra == "all"
|
| 93 |
+
Requires-Dist: Jinja2; extra == "all"
|
| 94 |
+
Requires-Dist: pytest>=8.4.2; extra == "all"
|
| 95 |
+
Requires-Dist: pytest-cov; extra == "all"
|
| 96 |
+
Requires-Dist: pytest-env; extra == "all"
|
| 97 |
+
Requires-Dist: pytest-xdist; extra == "all"
|
| 98 |
+
Requires-Dist: pytest-vcr; extra == "all"
|
| 99 |
+
Requires-Dist: pytest-asyncio; extra == "all"
|
| 100 |
+
Requires-Dist: pytest-rerunfailures<16.0; extra == "all"
|
| 101 |
+
Requires-Dist: pytest-mock; extra == "all"
|
| 102 |
+
Requires-Dist: urllib3<2.0; extra == "all"
|
| 103 |
+
Requires-Dist: soundfile; extra == "all"
|
| 104 |
+
Requires-Dist: Pillow; extra == "all"
|
| 105 |
+
Requires-Dist: numpy; extra == "all"
|
| 106 |
+
Requires-Dist: duckdb; extra == "all"
|
| 107 |
+
Requires-Dist: fastapi; extra == "all"
|
| 108 |
+
Requires-Dist: ruff>=0.9.0; extra == "all"
|
| 109 |
+
Requires-Dist: mypy==1.15.0; extra == "all"
|
| 110 |
+
Requires-Dist: libcst>=1.4.0; extra == "all"
|
| 111 |
+
Requires-Dist: ty; extra == "all"
|
| 112 |
+
Requires-Dist: typing-extensions>=4.8.0; extra == "all"
|
| 113 |
+
Requires-Dist: types-PyYAML; extra == "all"
|
| 114 |
+
Requires-Dist: types-simplejson; extra == "all"
|
| 115 |
+
Requires-Dist: types-toml; extra == "all"
|
| 116 |
+
Requires-Dist: types-tqdm; extra == "all"
|
| 117 |
+
Requires-Dist: types-urllib3; extra == "all"
|
| 118 |
+
Provides-Extra: dev
|
| 119 |
+
Requires-Dist: authlib>=1.3.2; extra == "dev"
|
| 120 |
+
Requires-Dist: fastapi; extra == "dev"
|
| 121 |
+
Requires-Dist: httpx; extra == "dev"
|
| 122 |
+
Requires-Dist: itsdangerous; extra == "dev"
|
| 123 |
+
Requires-Dist: jedi; extra == "dev"
|
| 124 |
+
Requires-Dist: Jinja2; extra == "dev"
|
| 125 |
+
Requires-Dist: pytest>=8.4.2; extra == "dev"
|
| 126 |
+
Requires-Dist: pytest-cov; extra == "dev"
|
| 127 |
+
Requires-Dist: pytest-env; extra == "dev"
|
| 128 |
+
Requires-Dist: pytest-xdist; extra == "dev"
|
| 129 |
+
Requires-Dist: pytest-vcr; extra == "dev"
|
| 130 |
+
Requires-Dist: pytest-asyncio; extra == "dev"
|
| 131 |
+
Requires-Dist: pytest-rerunfailures<16.0; extra == "dev"
|
| 132 |
+
Requires-Dist: pytest-mock; extra == "dev"
|
| 133 |
+
Requires-Dist: urllib3<2.0; extra == "dev"
|
| 134 |
+
Requires-Dist: soundfile; extra == "dev"
|
| 135 |
+
Requires-Dist: Pillow; extra == "dev"
|
| 136 |
+
Requires-Dist: numpy; extra == "dev"
|
| 137 |
+
Requires-Dist: duckdb; extra == "dev"
|
| 138 |
+
Requires-Dist: fastapi; extra == "dev"
|
| 139 |
+
Requires-Dist: ruff>=0.9.0; extra == "dev"
|
| 140 |
+
Requires-Dist: mypy==1.15.0; extra == "dev"
|
| 141 |
+
Requires-Dist: libcst>=1.4.0; extra == "dev"
|
| 142 |
+
Requires-Dist: ty; extra == "dev"
|
| 143 |
+
Requires-Dist: typing-extensions>=4.8.0; extra == "dev"
|
| 144 |
+
Requires-Dist: types-PyYAML; extra == "dev"
|
| 145 |
+
Requires-Dist: types-simplejson; extra == "dev"
|
| 146 |
+
Requires-Dist: types-toml; extra == "dev"
|
| 147 |
+
Requires-Dist: types-tqdm; extra == "dev"
|
| 148 |
+
Requires-Dist: types-urllib3; extra == "dev"
|
| 149 |
+
Dynamic: author
|
| 150 |
+
Dynamic: author-email
|
| 151 |
+
Dynamic: classifier
|
| 152 |
+
Dynamic: description
|
| 153 |
+
Dynamic: description-content-type
|
| 154 |
+
Dynamic: home-page
|
| 155 |
+
Dynamic: keywords
|
| 156 |
+
Dynamic: license
|
| 157 |
+
Dynamic: license-file
|
| 158 |
+
Dynamic: provides-extra
|
| 159 |
+
Dynamic: requires-dist
|
| 160 |
+
Dynamic: requires-python
|
| 161 |
+
Dynamic: summary
|
| 162 |
+
|
| 163 |
+
<p align="center">
|
| 164 |
+
<picture>
|
| 165 |
+
<source media="(prefers-color-scheme: dark)" srcset="https://huggingface.co/datasets/huggingface/documentation-images/raw/main/huggingface_hub-dark.svg">
|
| 166 |
+
<source media="(prefers-color-scheme: light)" srcset="https://huggingface.co/datasets/huggingface/documentation-images/raw/main/huggingface_hub.svg">
|
| 167 |
+
<img alt="huggingface_hub library logo" src="https://huggingface.co/datasets/huggingface/documentation-images/raw/main/huggingface_hub.svg" width="352" height="59" style="max-width: 100%">
|
| 168 |
+
</picture>
|
| 169 |
+
<br/>
|
| 170 |
+
<br/>
|
| 171 |
+
</p>
|
| 172 |
+
|
| 173 |
+
<p align="center">
|
| 174 |
+
<i>The official CLI and Python client for the Hugging Face Hub.</i>
|
| 175 |
+
<br/>
|
| 176 |
+
<a href="#what-is-huggingface_hub">About</a>
|
| 177 |
+
·
|
| 178 |
+
<a href="https://huggingface.co/docs/huggingface_hub">Documentation</a>
|
| 179 |
+
·
|
| 180 |
+
<a href="https://huggingface.co/docs/huggingface_hub/en/installation">Install</a>
|
| 181 |
+
·
|
| 182 |
+
<a href="https://huggingface.co/docs/huggingface_hub/en/guides/cli">CLI Guide</a>
|
| 183 |
+
·
|
| 184 |
+
<a href="https://github.com/huggingface/huggingface_hub/blob/main/CONTRIBUTING.md">Contributing</a>
|
| 185 |
+
</p>
|
| 186 |
+
|
| 187 |
+
<p align="center">
|
| 188 |
+
<a href="https://huggingface.co/docs/huggingface_hub/en/index"><img alt="Documentation" src="https://img.shields.io/website/http/huggingface.co/docs/huggingface_hub/index.svg?down_color=red&down_message=offline&up_message=online&label=doc"></a>
|
| 189 |
+
<a href="https://github.com/huggingface/huggingface_hub/releases"><img alt="GitHub release" src="https://img.shields.io/github/release/huggingface/huggingface_hub.svg"></a>
|
| 190 |
+
<a href="https://github.com/huggingface/huggingface_hub"><img alt="PyPi version" src="https://img.shields.io/pypi/pyversions/huggingface_hub.svg"></a>
|
| 191 |
+
<a href="https://pypi.org/project/huggingface-hub"><img alt="PyPI - Downloads" src="https://img.shields.io/pypi/dm/huggingface_hub"></a>
|
| 192 |
+
<a href="https://codecov.io/gh/huggingface/huggingface_hub"><img alt="Code coverage" src="https://codecov.io/gh/huggingface/huggingface_hub/branch/main/graph/badge.svg?token=RXP95LE2XL"></a>
|
| 193 |
+
</p>
|
| 194 |
+
|
| 195 |
+
<h4 align="center">
|
| 196 |
+
<p>
|
| 197 |
+
<b>English</b> |
|
| 198 |
+
<a href="https://github.com/huggingface/huggingface_hub/blob/main/i18n/README_de.md">Deutsch</a> |
|
| 199 |
+
<a href="https://github.com/huggingface/huggingface_hub/blob/main/i18n/README_fr.md">Français</a> |
|
| 200 |
+
<a href="https://github.com/huggingface/huggingface_hub/blob/main/i18n/README_hi.md">हिंदी</a> |
|
| 201 |
+
<a href="https://github.com/huggingface/huggingface_hub/blob/main/i18n/README_ko.md">한국어</a> |
|
| 202 |
+
<a href="https://github.com/huggingface/huggingface_hub/blob/main/i18n/README_cn.md">中文 (简体)</a> |
|
| 203 |
+
<a href="https://github.com/huggingface/huggingface_hub/blob/main/i18n/README_kn.md">ಕನ್ನಡ</a>
|
| 204 |
+
</p>
|
| 205 |
+
</h4>
|
| 206 |
+
|
| 207 |
+
## Quick start
|
| 208 |
+
|
| 209 |
+
Install the [`hf` CLI](https://huggingface.co/docs/huggingface_hub/en/guides/cli) with the standalone installer:
|
| 210 |
+
|
| 211 |
+
```bash
|
| 212 |
+
# On macOS and Linux.
|
| 213 |
+
curl -LsSf https://hf.co/cli/install.sh | bash
|
| 214 |
+
```
|
| 215 |
+
|
| 216 |
+
```powershell
|
| 217 |
+
# On Windows.
|
| 218 |
+
powershell -ExecutionPolicy ByPass -c "irm https://hf.co/cli/install.ps1 | iex"
|
| 219 |
+
```
|
| 220 |
+
|
| 221 |
+
Log in, then start working with the Hub:
|
| 222 |
+
|
| 223 |
+
```bash
|
| 224 |
+
# Log in (use --token $HF_TOKEN in non-interactive environments)
|
| 225 |
+
hf auth login
|
| 226 |
+
|
| 227 |
+
# Find models served by Inference Providers
|
| 228 |
+
hf models ls --warm
|
| 229 |
+
|
| 230 |
+
# Download a model
|
| 231 |
+
hf download Qwen/Qwen3-0.6B
|
| 232 |
+
|
| 233 |
+
# Upload files to your own repo
|
| 234 |
+
hf upload username/my-cool-model ./model.safetensors
|
| 235 |
+
|
| 236 |
+
# Sync a local folder to a storage bucket
|
| 237 |
+
hf buckets sync ./checkpoints hf://buckets/username/my-bucket
|
| 238 |
+
|
| 239 |
+
# Run a job on Hugging Face infrastructure
|
| 240 |
+
hf jobs run python:3.12 python -c "print('Hello from the cloud!')"
|
| 241 |
+
|
| 242 |
+
# Discover everything else
|
| 243 |
+
hf --help
|
| 244 |
+
```
|
| 245 |
+
|
| 246 |
+
The Hub uses tokens to authenticate applications (see [docs](https://huggingface.co/docs/hub/security-tokens)). Check out the [CLI guide](https://huggingface.co/docs/huggingface_hub/en/guides/cli) for a tour of the main features.
|
| 247 |
+
|
| 248 |
+
## What is `huggingface_hub`?
|
| 249 |
+
|
| 250 |
+
The `huggingface_hub` library allows you to interact with the [Hugging Face Hub](https://huggingface.co/), a platform democratizing open-source Machine Learning for creators and collaborators. Discover pre-trained models and datasets for your projects, play with the thousands of machine learning apps hosted on the Hub, or create and share your own models, datasets and demos with the community. Everything ships in one package with two interfaces: the [`hf` CLI](https://huggingface.co/docs/huggingface_hub/en/guides/cli) for your terminal and the `huggingface_hub` library for Python — both designed to work well for humans and AI agents. Use them to:
|
| 251 |
+
|
| 252 |
+
- [Download files](https://huggingface.co/docs/huggingface_hub/en/guides/download) from the Hub.
|
| 253 |
+
- [Upload files](https://huggingface.co/docs/huggingface_hub/en/guides/upload) to the Hub.
|
| 254 |
+
- [Manage your repositories](https://huggingface.co/docs/huggingface_hub/en/guides/repository).
|
| 255 |
+
- [Run Inference](https://huggingface.co/docs/huggingface_hub/en/guides/inference) on deployed models.
|
| 256 |
+
- [Run Jobs](https://huggingface.co/docs/huggingface_hub/en/guides/jobs) on Hugging Face infrastructure.
|
| 257 |
+
- [Search](https://huggingface.co/docs/huggingface_hub/en/guides/search) for models, datasets and Spaces.
|
| 258 |
+
- [Share Model Cards](https://huggingface.co/docs/huggingface_hub/en/guides/model-cards) to document your models.
|
| 259 |
+
- [Engage with the community](https://huggingface.co/docs/huggingface_hub/en/guides/community) through PRs and comments.
|
| 260 |
+
- Do all of the above from the terminal with the [`hf` CLI](https://huggingface.co/docs/huggingface_hub/en/guides/cli).
|
| 261 |
+
|
| 262 |
+
## Built for humans and AI agents
|
| 263 |
+
|
| 264 |
+
The `hf` CLI is designed for people and coding agents alike: the same commands adapt their output when run by an agent. If you use Claude Code, Codex, Cursor, or another coding agent, install the `hf` CLI Skill — a command reference generated from your installed CLI:
|
| 265 |
+
|
| 266 |
+
```bash
|
| 267 |
+
# for Codex, Cursor, OpenCode, Pi and other agents that load skills from `.agents/skills`
|
| 268 |
+
hf skills add
|
| 269 |
+
# includes the above + Claude Code
|
| 270 |
+
hf skills add --claude
|
| 271 |
+
```
|
| 272 |
+
|
| 273 |
+
Learn more in the [Hugging Face CLI for AI agents guide](https://huggingface.co/docs/hub/agents-cli) and the [announcement blog post](https://huggingface.co/blog/hf-cli-for-agents).
|
| 274 |
+
|
| 275 |
+
## Use the Python library
|
| 276 |
+
|
| 277 |
+
Install the `huggingface_hub` package with [pip](https://pypi.org/project/huggingface-hub/) (this also installs the `hf` CLI):
|
| 278 |
+
|
| 279 |
+
```bash
|
| 280 |
+
pip install huggingface_hub
|
| 281 |
+
```
|
| 282 |
+
|
| 283 |
+
We recommend using [`uv`](https://docs.astral.sh/uv/) for a fast and reliable install:
|
| 284 |
+
|
| 285 |
+
```bash
|
| 286 |
+
uv pip install huggingface_hub
|
| 287 |
+
```
|
| 288 |
+
|
| 289 |
+
In order to keep the package minimal by default, `huggingface_hub` comes with optional dependencies useful for some use cases. For example, if you want to use the MCP module, run:
|
| 290 |
+
|
| 291 |
+
```bash
|
| 292 |
+
pip install "huggingface_hub[mcp]"
|
| 293 |
+
```
|
| 294 |
+
|
| 295 |
+
To learn more about installation and optional dependencies, check out the [installation guide](https://huggingface.co/docs/huggingface_hub/en/installation).
|
| 296 |
+
|
| 297 |
+
### Download files
|
| 298 |
+
|
| 299 |
+
Download a single file
|
| 300 |
+
|
| 301 |
+
```py
|
| 302 |
+
from huggingface_hub import hf_hub_download
|
| 303 |
+
|
| 304 |
+
hf_hub_download(repo_id="zai-org/GLM-5.2", filename="config.json")
|
| 305 |
+
```
|
| 306 |
+
|
| 307 |
+
Or an entire repository
|
| 308 |
+
|
| 309 |
+
```py
|
| 310 |
+
from huggingface_hub import snapshot_download
|
| 311 |
+
|
| 312 |
+
snapshot_download("sentence-transformers/all-MiniLM-L6-v2")
|
| 313 |
+
```
|
| 314 |
+
|
| 315 |
+
Files will be downloaded in a local cache folder. More details in [this guide](https://huggingface.co/docs/huggingface_hub/en/guides/manage-cache).
|
| 316 |
+
|
| 317 |
+
### Create a repository
|
| 318 |
+
|
| 319 |
+
```py
|
| 320 |
+
from huggingface_hub import create_repo
|
| 321 |
+
|
| 322 |
+
create_repo(repo_id="super-cool-model")
|
| 323 |
+
```
|
| 324 |
+
|
| 325 |
+
### Upload files
|
| 326 |
+
|
| 327 |
+
Upload a single file
|
| 328 |
+
|
| 329 |
+
```py
|
| 330 |
+
from huggingface_hub import upload_file
|
| 331 |
+
|
| 332 |
+
upload_file(
|
| 333 |
+
path_or_fileobj="/home/lysandre/dummy-test/README.md",
|
| 334 |
+
path_in_repo="README.md",
|
| 335 |
+
repo_id="lysandre/test-model",
|
| 336 |
+
)
|
| 337 |
+
```
|
| 338 |
+
|
| 339 |
+
Or an entire folder
|
| 340 |
+
|
| 341 |
+
```py
|
| 342 |
+
from huggingface_hub import upload_folder
|
| 343 |
+
|
| 344 |
+
upload_folder(
|
| 345 |
+
folder_path="/path/to/local/space",
|
| 346 |
+
repo_id="username/my-cool-space",
|
| 347 |
+
repo_type="space",
|
| 348 |
+
)
|
| 349 |
+
```
|
| 350 |
+
|
| 351 |
+
More details in the [upload guide](https://huggingface.co/docs/huggingface_hub/en/guides/upload).
|
| 352 |
+
|
| 353 |
+
## Integrating with the Hub.
|
| 354 |
+
|
| 355 |
+
We're partnering with cool open source ML libraries to provide free model hosting and versioning. You can find the existing integrations [here](https://huggingface.co/docs/hub/libraries).
|
| 356 |
+
|
| 357 |
+
The advantages are:
|
| 358 |
+
|
| 359 |
+
- Free model or dataset hosting for libraries and their users.
|
| 360 |
+
- Built-in file versioning, even with very large files, made possible by [Xet](https://huggingface.co/docs/hub/xet/index), the Hub's chunk-deduplicated storage backend.
|
| 361 |
+
- In-browser widgets to play with the uploaded models.
|
| 362 |
+
- Anyone can upload a new model for your library, they just need to add the corresponding tag for the model to be discoverable.
|
| 363 |
+
- Fast downloads! We use Cloudfront (a CDN) to geo-replicate downloads so they're blazing fast from anywhere on the globe.
|
| 364 |
+
- Usage stats and more features to come.
|
| 365 |
+
|
| 366 |
+
If you would like to integrate your library, feel free to open an issue to begin the discussion. We wrote a [step-by-step guide](https://huggingface.co/docs/hub/adding-a-library) with ❤️ showing how to do this integration.
|
| 367 |
+
|
| 368 |
+
## Contributions (feature requests, bugs, etc.) are super welcome 💙💚💛💜🧡❤️
|
| 369 |
+
|
| 370 |
+
Everyone is welcome to contribute, and we value everybody's contribution. Code is not the only way to help the community.
|
| 371 |
+
Answering questions, helping others, reaching out and improving the documentations are immensely valuable to the community.
|
| 372 |
+
We wrote a [contribution guide](https://github.com/huggingface/huggingface_hub/blob/main/CONTRIBUTING.md) to summarize
|
| 373 |
+
how to get started to contribute to this repository.
|
.cache/uv/archive-v0/WbiZCgDidtA5T1uiQ47d5/huggingface_hub-1.24.0.dist-info/RECORD
ADDED
|
@@ -0,0 +1,190 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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ggingface_hub/__init__.py,sha256=-S0NPE6Z4nJekQs_IfXDYzv314lNMbbaDDEhCTl8C3c,60255
|
| 2 |
+
huggingface_hub/_buckets.py,sha256=XyLbsLzS2fpQz0aAIjKzV-1YbQ4XYZ4-HXQTVq0TXoU,45311
|
| 3 |
+
huggingface_hub/_commit_api.py,sha256=yW99ZJbIuiRt604bQ2TpDzsfxTO-IxdFW8nf-NY2MyE,45389
|
| 4 |
+
huggingface_hub/_commit_scheduler.py,sha256=VG3zjb7xb66NrFMq_pB9dWIsoqSPoF6CntovV7vUiWg,14684
|
| 5 |
+
huggingface_hub/_dataset_viewer.py,sha256=LE9k4s0WJ0JNdriJ8L6qV_-xfbUVC1VEh7CBd0jOjLI,5675
|
| 6 |
+
huggingface_hub/_eval_results.py,sha256=Og7p7bCl2HQG6ZWlSDyir-CRTXjNWPu3S3q65cTGffs,8126
|
| 7 |
+
huggingface_hub/_inference_endpoints.py,sha256=TNCEvHfu5M790bQPl4BccRzcii8WS5FlDYGrGqQzdW4,17724
|
| 8 |
+
huggingface_hub/_jobs_api.py,sha256=tZMrw8idM6nbIz_EJsOt7Gx7_2v7CzRtaUqrQfXAsi0,21164
|
| 9 |
+
huggingface_hub/_local_folder.py,sha256=Fc_hikyMaZRHtXIDZj38hL7MNkq5nZZVxQF-dd-EkMo,18279
|
| 10 |
+
huggingface_hub/_login.py,sha256=wAMdhqMSSh3GBJDozodmk4IIsAvb9J6LaLY9KnXFoyY,21818
|
| 11 |
+
huggingface_hub/_oauth.py,sha256=S8evEd8JLJHz-JiSjGH4WiIi_A7oDox_xH7E9rN1Jic,18628
|
| 12 |
+
huggingface_hub/_oidc.py,sha256=3kcCLavWQ5FQOwizUPzLaBb1ft2FIJo0bSXL24S3r4U,7098
|
| 13 |
+
huggingface_hub/_sandbox.py,sha256=F6ZMchoqH8cnzdmGECqszL8JR4hcWIgGDq4QgV8W-TQ,80138
|
| 14 |
+
huggingface_hub/_sandbox_cache.py,sha256=UYpvHOWZj7CRhacYs5Ot-5N1wFcAapiAyniYdoX-jX8,5742
|
| 15 |
+
huggingface_hub/_snapshot_download.py,sha256=jdXyEI_e00GLeTIs6r783MbO5-AdS2nCow2aqlgzy1Q,30431
|
| 16 |
+
huggingface_hub/_space_api.py,sha256=MF3ezhgl0Vpt3RP1wuwZ7VI9_rSyIlIJ5SmDzIwQlcQ,13424
|
| 17 |
+
huggingface_hub/_tensorboard_logger.py,sha256=GA-LhoG4Z-0Zq7w5B9vTIDJbWUkAhiG2d8a-ktlwGDY,8377
|
| 18 |
+
huggingface_hub/_tree_cache.py,sha256=9JU2uOX5oQT3wK2BSUj5Yb33UUNpmybGav5d5FduzGk,5336
|
| 19 |
+
huggingface_hub/_upload_large_folder.py,sha256=BWA1zyOK9W_3YUerX9YWQa3wAYtHRe_ypgsO79JEkqo,31235
|
| 20 |
+
huggingface_hub/_upload_pipeline.py,sha256=19UxsZ10NB05kOXEvTN663TDE--9EBJjvxR4uI-Lg9c,28946
|
| 21 |
+
huggingface_hub/_webhooks_payload.py,sha256=B9zqljcm20DGeVxJKba570i6RP-cR9CEupMGBuNDHHA,3544
|
| 22 |
+
huggingface_hub/_webhooks_server.py,sha256=VXOk3FHkbIc28phxknJfaFy5B_EoKOKihoCKyOaWZQk,15767
|
| 23 |
+
huggingface_hub/community.py,sha256=N5OE5Rbc2BMwpNXCFOPQAwn0otqQunsXdEnSE_0J2Xo,12325
|
| 24 |
+
huggingface_hub/constants.py,sha256=eI3-JDy6jkG1EuXAjUdVdG67kbj6gxGNlr9In2-5AMc,13182
|
| 25 |
+
huggingface_hub/dataclasses.py,sha256=47qPdMJMuzFFjPwqa_bRvzh7nxwXx_lXE8h3eblkxp8,25940
|
| 26 |
+
huggingface_hub/errors.py,sha256=eso8GCrCcDv1Yb6NDBqyFt_Vr9PLCOsueNylNlDXMD4,18391
|
| 27 |
+
huggingface_hub/fastai_utils.py,sha256=jwKeVXH_VP0zxnOKVNQCVCkF-stH70l-bExbbrYkBKQ,16583
|
| 28 |
+
huggingface_hub/file_download.py,sha256=jSwr6Ze9CT0hScAgEZhRx3LF3BRgZSZLoptYwotQxis,87253
|
| 29 |
+
huggingface_hub/hf_api.py,sha256=VBGUpyUhZ__USFBMlNv20CZxzTKnkJ_CdRXez-LX7Wk,659053
|
| 30 |
+
huggingface_hub/hf_file_system.py,sha256=1Y6BqYHafnwulGNufJtzWfMU3Q3sbaW7oOqUcrNlvc4,60581
|
| 31 |
+
huggingface_hub/hub_mixin.py,sha256=ljKAtm3qQsY-ARtxY-PCFx0koFXLI37JytMrzpqfnQo,36912
|
| 32 |
+
huggingface_hub/lfs.py,sha256=8ymYNHRXgvgUUM9w0EAnC-vkSOOq_1EFJEJNoevoeE8,16588
|
| 33 |
+
huggingface_hub/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
| 34 |
+
huggingface_hub/repocard.py,sha256=ytBgqomIuM3zOeTPfzQNk_stlswh8DttLDvTbX_woPI,35582
|
| 35 |
+
huggingface_hub/repocard_data.py,sha256=CRW3puz-efDcoGjKIgZv6p3LKKKYVgcy-FGr96zAFOg,34251
|
| 36 |
+
huggingface_hub/_hot_reload/__init__.py,sha256=nQEuyVZLAS_463Dff1JH5MorTpkYsBVFCyPhYWY3UyI,606
|
| 37 |
+
huggingface_hub/_hot_reload/client.py,sha256=Ax7qT4CUi5wrg3mDzqkAG8ZzDsCwdcIIS1FIXK0SqD8,4269
|
| 38 |
+
huggingface_hub/_hot_reload/sse_client.py,sha256=49kmsB2P9sxgbZ16ed6F4aLDs3rsHrNpbp6iKlvF90c,4948
|
| 39 |
+
huggingface_hub/_hot_reload/types.py,sha256=d3AOJCLUxT41Fhz4jUrFevm9bfpooe_3PQhpBdgNYSs,2725
|
| 40 |
+
huggingface_hub/cli/__init__.py,sha256=tWu3Is-m2tlJwXhM_vT2mPRgpnt9KhU9qvw5aRsnjU0,664
|
| 41 |
+
huggingface_hub/cli/_city_game.py,sha256=2qkC9dCtPwf4-aqrnbN-vApf0YqIcGGjn2v-etrTfqg,20585
|
| 42 |
+
huggingface_hub/cli/_cli_utils.py,sha256=Q5795puu89Kf4fEvQYPjyJmDnyqFEyEr5SW1xQXQk8I,41313
|
| 43 |
+
huggingface_hub/cli/_completion.py,sha256=BDP6Vob9TLFp6K3lr0XOY98FyD-rm22KrjwsO_YGNbE,3759
|
| 44 |
+
huggingface_hub/cli/_cp.py,sha256=Z-2Z_tBs1e4XBqRO5R9QnabU4qTi9HDlbA52jTBaCkY,10436
|
| 45 |
+
huggingface_hub/cli/_errors.py,sha256=X0rUTO-3eCK5v_MLGEza1BxcuXGccPY-h7ShzmuQc34,5907
|
| 46 |
+
huggingface_hub/cli/_file_listing.py,sha256=QRGm9oZS_g0Cv_jLQcUR6iNwBzMrsmbhs1kxwuY6rwk,7910
|
| 47 |
+
huggingface_hub/cli/_framework.py,sha256=HqfAEYGWRSjKABAZi2zVNgryyU9QKW8u-tRXfR_4nQ8,27364
|
| 48 |
+
huggingface_hub/cli/_help_formatter.py,sha256=-vsa3HfHQFkKWms77EGyp9i22t44ETmVt2L-e8qP-KM,1288
|
| 49 |
+
huggingface_hub/cli/_output.py,sha256=A_yLkT0lzIovZV-fS7NZx7hCGiwiqJNtvUr-IbYPgpQ,13908
|
| 50 |
+
huggingface_hub/cli/_skills.py,sha256=b1dlasxALM5KsDG5R1azcETksQ6ssYYZN-kaz-RdHwg,12134
|
| 51 |
+
huggingface_hub/cli/auth.py,sha256=Ew79M60pTMCnS1ewKVK3fd8ZyfHrNjREOmNWuFXy37M,6056
|
| 52 |
+
huggingface_hub/cli/buckets.py,sha256=J8xMP88fQ6ri3f65Z8XEImI2GNA4KKWloLJJQCBezZw,21062
|
| 53 |
+
huggingface_hub/cli/cache.py,sha256=Oa3g53dUYlNIKy6crlXXGxG7lOZFa6iob0-8mMalCDc,28059
|
| 54 |
+
huggingface_hub/cli/collections.py,sha256=ECTb__1zduL3F02ezGkQIaaSmUOVaeBbsGMs_8MTPcI,10078
|
| 55 |
+
huggingface_hub/cli/datasets.py,sha256=X1xMJTFhHH5NJtmjTS6NN1g4ffai6Abh_obDEJM5mvo,10497
|
| 56 |
+
huggingface_hub/cli/deprecated_cli.py,sha256=vAK_CR4NE9uzNJ0I59SyBnIln5nlypG4CPoohMoPMVg,1090
|
| 57 |
+
huggingface_hub/cli/discussions.py,sha256=obvvN4mtsFnfMs67YTZaMvHkVaM6A-FYr5n-wGkF_jE,14029
|
| 58 |
+
huggingface_hub/cli/download.py,sha256=o6fMKJoNQMxCm1RQUnX3blihJ17mantxkf0F68rZIxs,9669
|
| 59 |
+
huggingface_hub/cli/extensions.py,sha256=qNM1DmzcQXt8kPWQfISc8Pvyku8BxAs-BOVP6sKRBOM,25572
|
| 60 |
+
huggingface_hub/cli/hf.py,sha256=G2R-Mgo2AX09aRiAb-13eZbO441m9yDTwMCtSUf1iac,5208
|
| 61 |
+
huggingface_hub/cli/inference_endpoints.py,sha256=4pfvPm5PVQizStyXGRBnrev62KvhzSNEL65UEVtRcKw,17418
|
| 62 |
+
huggingface_hub/cli/jobs.py,sha256=-eMUXzpU3Dzxp9RAjff-6eCxYwxH9M3s6KK_MOn6Rgo,49640
|
| 63 |
+
huggingface_hub/cli/lfs.py,sha256=MAccazVPX0n-ySRaPocaQUHP7oBnVrvWZt0RhmNIavs,5936
|
| 64 |
+
huggingface_hub/cli/models.py,sha256=eG7H5yDjCVrdL7W_-wpcl70qXlv8bC-roSEu8AroPws,10148
|
| 65 |
+
huggingface_hub/cli/papers.py,sha256=HvT-8zj2fi14ua6awWpHphlbJ362FEJIwSCBJRQZ_cM,4982
|
| 66 |
+
huggingface_hub/cli/repo_files.py,sha256=sGbD5wND3miF71ThfOBJm4xzPRUpJBeLFdvyj229NAM,2443
|
| 67 |
+
huggingface_hub/cli/repos.py,sha256=QS3xYKvspLhCfO5VvpORrSiF6XhSVFclmBxsacVDP2c,20192
|
| 68 |
+
huggingface_hub/cli/sandbox.py,sha256=rTCZf6WhoDa7UiNhsTU_4Lh5uKqKYOs73xXGAAqJGdA,18379
|
| 69 |
+
huggingface_hub/cli/skills.py,sha256=JQkqD43bfr8IapIVp8rvQpd8NKA0dXSbGJD8g-u51w8,19473
|
| 70 |
+
huggingface_hub/cli/spaces.py,sha256=AU655GGrQmF1s1yO8yO6ml2Z8veE7zsh4UMuR5b13RI,40800
|
| 71 |
+
huggingface_hub/cli/system.py,sha256=NtICLnQ49BHFpm2Cl37IV_h21L6mufxVDfse8Lp38HA,1760
|
| 72 |
+
huggingface_hub/cli/upload.py,sha256=P6sq8Dj81a2wazUgZEqbliRleVAAmJrf8ajFDDzHrBE,11318
|
| 73 |
+
huggingface_hub/cli/upload_large_folder.py,sha256=A-2qxAdLrYd8IogfZS2nDhSR1cpA_aaxhXst638WkAk,4081
|
| 74 |
+
huggingface_hub/cli/webhooks.py,sha256=HdpPp01c6Ece_EuNNJr46rnRki3vF4j4o9-SqYRUHnM,8550
|
| 75 |
+
huggingface_hub/inference/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
| 76 |
+
huggingface_hub/inference/_client.py,sha256=bN5cj4tBHPD6v603uq4CJjMB_mmmpdVcfXtl9XIOVqc,157679
|
| 77 |
+
huggingface_hub/inference/_common.py,sha256=X-fBP8s6xuNTAuQsGVIethE8dNQaa-mK7Ds54qVVDz8,14999
|
| 78 |
+
huggingface_hub/inference/_generated/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
| 79 |
+
huggingface_hub/inference/_generated/_async_client.py,sha256=imtfJD9m3qxeo_59gox3nnV8Tr8dfQF3dQF0Joy5K4g,160890
|
| 80 |
+
huggingface_hub/inference/_generated/types/__init__.py,sha256=e625ENOmTUM4uUL1eAlsZOK7CovNoGBDH-TxSNQhaC4,6869
|
| 81 |
+
huggingface_hub/inference/_generated/types/audio_classification.py,sha256=DGWEvrRPX7xpXlbYY4LMojGcULdEZFTshhNR81rTNcQ,1567
|
| 82 |
+
huggingface_hub/inference/_generated/types/audio_to_audio.py,sha256=2Ep4WkePL7oJwcp5nRJqApwviumGHbft9HhXE9XLHj4,891
|
| 83 |
+
huggingface_hub/inference/_generated/types/automatic_speech_recognition.py,sha256=X0uCj9qwAcOmlKtV3vWH5cAgLGY0PuYIy2eSH7GE1qs,5439
|
| 84 |
+
huggingface_hub/inference/_generated/types/base.py,sha256=EPWp1qudjeEimEAyQ-ptdxpAACoRM8tW342-Ds7pP3I,6938
|
| 85 |
+
huggingface_hub/inference/_generated/types/chat_completion.py,sha256=3yc06ZI0NCZzsaeoxSMWyIHqGc8Vn_6aExncuXa1llE,11100
|
| 86 |
+
huggingface_hub/inference/_generated/types/depth_estimation.py,sha256=5Kn4xNGJg235Cofr1lzO59eRGCuLTZun8z5t6a2do8Q,910
|
| 87 |
+
huggingface_hub/inference/_generated/types/document_question_answering.py,sha256=aUZcrDGexjw8Fnm2rACm_3my77V15NnQHZxj-sa7bjo,3146
|
| 88 |
+
huggingface_hub/inference/_generated/types/feature_extraction.py,sha256=DiO47PqwhdNta_KPDBsXfCPIL6BWNhyCLymxORlqUA0,1509
|
| 89 |
+
huggingface_hub/inference/_generated/types/fill_mask.py,sha256=NhEskgoiMst7U_0cV_S-wryga4_2T5LgpbyQ23vHMp0,1680
|
| 90 |
+
huggingface_hub/inference/_generated/types/image_classification.py,sha256=xWr4OY65EcIIhd7MI610a7xlaAVHQeydi8Gc7tlaPTU,1579
|
| 91 |
+
huggingface_hub/inference/_generated/types/image_segmentation.py,sha256=lZKzbn_gkSi1sYGLb9ryeRr0aDAVrfYh0H5Iiv5JNsY,1935
|
| 92 |
+
huggingface_hub/inference/_generated/types/image_text_to_image.py,sha256=pRQgYKXJbIpEjRBxuIE6NRDtk_km9DSTQ2s2qxkYJRM,2585
|
| 93 |
+
huggingface_hub/inference/_generated/types/image_text_to_video.py,sha256=MVhP8D4eYjpT3hWYkkpuiME-hWY09o7C4rIn_wmnAmY,2450
|
| 94 |
+
huggingface_hub/inference/_generated/types/image_to_image.py,sha256=P9TeMFSnZI_pa6DyinzDPWL0PNm_INJwsqFUEzpwIcU,2262
|
| 95 |
+
huggingface_hub/inference/_generated/types/image_to_text.py,sha256=DCDS0Nqi-4AuATitvZm4EgrzYQuQEQ5lzBcaHuCmHnY,4740
|
| 96 |
+
huggingface_hub/inference/_generated/types/image_to_video.py,sha256=iMCjiFTUza9AW_MyJ1videhYgvMY9QSzQ59kNdTE9QY,2206
|
| 97 |
+
huggingface_hub/inference/_generated/types/object_detection.py,sha256=zNILlyZJh59rNNfqXM5x9uprDCPfEU-bvBtabeKSMzI,1965
|
| 98 |
+
huggingface_hub/inference/_generated/types/question_answering.py,sha256=lIRf8DjRiAsjzWUBEsGt354SB4bvejLokf-8luHw6_o,2845
|
| 99 |
+
huggingface_hub/inference/_generated/types/sentence_similarity.py,sha256=eNGiO4dR-Lft9yOLE0E97jfVyOT_ExDWZW5GeJGdatU,1027
|
| 100 |
+
huggingface_hub/inference/_generated/types/summarization.py,sha256=5Dpt6LRteT-hO9esa3Ty_-xSL5U-zTtVZzy3iKwZRng,1472
|
| 101 |
+
huggingface_hub/inference/_generated/types/table_question_answering.py,sha256=bwn616XJ-eLa5JKzn3m9rZZ3z63INGEUwRSOCWlEh-4,2269
|
| 102 |
+
huggingface_hub/inference/_generated/types/text2text_generation.py,sha256=fotSlPWtIlp_LG26AQvNRXxU-jCUfda5PWsxCkbFeKM,1591
|
| 103 |
+
huggingface_hub/inference/_generated/types/text_classification.py,sha256=uamBzz4YzWQ9mb6yuriykX8r47ZHf0K3eJpOLzB2qJw,1439
|
| 104 |
+
huggingface_hub/inference/_generated/types/text_generation.py,sha256=FRUljypvCSQ2RaiylhlHeLJfHNy8qZvuty6SCB_zcaA,5813
|
| 105 |
+
huggingface_hub/inference/_generated/types/text_to_audio.py,sha256=CiaTUSBdFtOs3gGTosqyQrjCwrN8mVJLRxDDWUtwZpQ,4677
|
| 106 |
+
huggingface_hub/inference/_generated/types/text_to_image.py,sha256=Ju25WIDHE-1n8jlZ_udG4rpAaPYpmghR7-cDgVfuf48,1869
|
| 107 |
+
huggingface_hub/inference/_generated/types/text_to_speech.py,sha256=WqDzWkhZsDcjapkoFrkyjF903SKs7aHhjypsYrn8oBw,4693
|
| 108 |
+
huggingface_hub/inference/_generated/types/text_to_video.py,sha256=KjcDbtChwrIxIdTH6vcesUaMcjL2xjPf2nWEnHazj4Y,1756
|
| 109 |
+
huggingface_hub/inference/_generated/types/token_classification.py,sha256=8KRBlqgFDszaUnPMvdRkZNQaZBtDfBhKZ6SggQldQMM,1894
|
| 110 |
+
huggingface_hub/inference/_generated/types/translation.py,sha256=-j2PC1-qfoxvGMaKesqf5jXelqj0BDlEpfvZ7dsIEJM,1742
|
| 111 |
+
huggingface_hub/inference/_generated/types/video_classification.py,sha256=vfaCqp8MuRMMtGvYCX0x4-AcwEd71kPHgSYJTNIOxLQ,1668
|
| 112 |
+
huggingface_hub/inference/_generated/types/visual_question_answering.py,sha256=sWIB-SuEpW21oU6O5qQF3tt5PavUFsFOa8Xg4upTtek,1654
|
| 113 |
+
huggingface_hub/inference/_generated/types/zero_shot_classification.py,sha256=gx-7WHad7xsNa89iSKSteKHjaHrKbIyzN_nSdJN3HCY,1697
|
| 114 |
+
huggingface_hub/inference/_generated/types/zero_shot_image_classification.py,sha256=JZTQvcbSGrOQlWcPuJvAMT8YziDpBRn1O2RQSw507uY,1449
|
| 115 |
+
huggingface_hub/inference/_generated/types/zero_shot_object_detection.py,sha256=sjdpVUN5zW9aYBymLVUs6i5HVk2qkUBO9ysEjHmsXVM,1605
|
| 116 |
+
huggingface_hub/inference/_mcp/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
| 117 |
+
huggingface_hub/inference/_mcp/_cli_hacks.py,sha256=kIA8FfRfOWS3SrZrMTbuVOjE6yxfKfMK75Co5egTWHA,3284
|
| 118 |
+
huggingface_hub/inference/_mcp/agent.py,sha256=ufIzMGHore5n252hV5GZPM0ouDXIl6tv5Jl_5gHXnbg,4250
|
| 119 |
+
huggingface_hub/inference/_mcp/cli.py,sha256=RKdVQ_VdEgf1AL_QBCvwrsUQ0Ux4R1yerrE46DrV5C0,9642
|
| 120 |
+
huggingface_hub/inference/_mcp/constants.py,sha256=0Ih6ivEvG-pfF8NwErFngzP4Rof4lQoz6ms_eKSAkUI,2463
|
| 121 |
+
huggingface_hub/inference/_mcp/mcp_client.py,sha256=dGp8PhN6aVw4bDnuSySFSiguHUiz-nzhgv89CVdO7pI,17243
|
| 122 |
+
huggingface_hub/inference/_mcp/types.py,sha256=yHNfPsM9MhD06oeKdkbmrBsW-3WhUeqA26fyfRfx_bk,929
|
| 123 |
+
huggingface_hub/inference/_mcp/utils.py,sha256=gxSB_rBjQ6VrkApKFsxk6-UzhijxkDVNuZrsjW5pL8k,4318
|
| 124 |
+
huggingface_hub/inference/_providers/__init__.py,sha256=TNWnSNPk0RmToBysTc5D1COm0vHEJoGom0Yh7oG2wC4,9838
|
| 125 |
+
huggingface_hub/inference/_providers/_common.py,sha256=9CjlMAtb7W0-GdB1Z-VkV0GKZ0Zm68rIuicdGE-765M,13716
|
| 126 |
+
huggingface_hub/inference/_providers/cerebras.py,sha256=QOJ-1U-os7uE7p6eUnn_P_APq-yQhx28be7c3Tq2EuA,210
|
| 127 |
+
huggingface_hub/inference/_providers/cohere.py,sha256=P9kbIuvQ2rXI1yNmgbw5VKFFTE0huLq2k-BCyDkDico,1226
|
| 128 |
+
huggingface_hub/inference/_providers/deepinfra.py,sha256=4Behgf5V7FTv7CbN6vPEIYwv1z4gztdRRU-KVoOgxVE,4703
|
| 129 |
+
huggingface_hub/inference/_providers/fal_ai.py,sha256=Y2vo5Dl3e8EoehplwNshu8LbDT1e7V4ZyhAMqs0wXws,11705
|
| 130 |
+
huggingface_hub/inference/_providers/featherless_ai.py,sha256=C8OHdFpoFyA--pawLTekUmUSRq4sw_r0D-cSPekD4kE,1347
|
| 131 |
+
huggingface_hub/inference/_providers/fireworks_ai.py,sha256=go6XPum8u0-g768HJ_r0S4Gb445gZJxnuY_acktz-9c,1188
|
| 132 |
+
huggingface_hub/inference/_providers/groq.py,sha256=JTk2JV4ZOlaohho7zLAFQtk92kGVsPmLJ1hmzcwsqvQ,315
|
| 133 |
+
huggingface_hub/inference/_providers/hf_inference.py,sha256=d2vdCKSi5CtyQqYndHHvH7SY131-7YHUK3yE7653eIc,9467
|
| 134 |
+
huggingface_hub/inference/_providers/novita.py,sha256=ATEoSdPAPLMfx3JpBc0sOyLh4upJYP6xHBuo4YEDYvg,2470
|
| 135 |
+
huggingface_hub/inference/_providers/nscale.py,sha256=T1L2JLI9LqYT9_YEdW76YEtxfDNtdGkoFhH-p2LmSxg,1767
|
| 136 |
+
huggingface_hub/inference/_providers/openai.py,sha256=wwjaaQ55xLmDsDnHpZk52xbuLoGZfWzJkFsE8AdFVaI,1054
|
| 137 |
+
huggingface_hub/inference/_providers/ovhcloud.py,sha256=tdmymlkbddMJKV7NRZ-tH2wymbLPFDTqUSXpWJUXyDQ,314
|
| 138 |
+
huggingface_hub/inference/_providers/publicai.py,sha256=1I2W6rORloB5QHSvky4njZO2XKLTwA-kPdNoauoT5rg,210
|
| 139 |
+
huggingface_hub/inference/_providers/replicate.py,sha256=hte0ZB2RtGFwpAuLrFp2Gbgsn3EOlccCnJkWTDTW__A,6027
|
| 140 |
+
huggingface_hub/inference/_providers/scaleway.py,sha256=MfIc7ZND1sPr__rOmNHZVg0VpECQo0bVyksgIm_32xQ,1174
|
| 141 |
+
huggingface_hub/inference/_providers/together.py,sha256=lrymDZ86n5yoR_Zz7o3AzzSePyo0s7BOBU5digLxb5o,12220
|
| 142 |
+
huggingface_hub/inference/_providers/wavespeed.py,sha256=MGM7Y7r2nQiH_EH0t5UE1o1fT-o3sS7RaQlicS9WHsg,5028
|
| 143 |
+
huggingface_hub/inference/_providers/zai_org.py,sha256=gLJZOEmCPmUZvdM7VDn2nxm4ac3veHdoMgQNR63UeWE,4739
|
| 144 |
+
huggingface_hub/serialization/__init__.py,sha256=jCiw_vVQYW52gwVfWiqgocf2Q19kGTQlRGVpf-4SLP8,963
|
| 145 |
+
huggingface_hub/serialization/_base.py,sha256=8vYeDIsqgyOO3I_uii44Bkb50LsMz3kkD4gwAPzhfWU,8436
|
| 146 |
+
huggingface_hub/serialization/_dduf.py,sha256=FmGRg5wkXI5sNCgZgCNJFmqb_nVrrQYOHf4Lqq0d64I,15385
|
| 147 |
+
huggingface_hub/serialization/_torch.py,sha256=BtaCP-G3oYRP6Pj9MhI-ygBsk3JbBPnVDW9huSOgtkk,46897
|
| 148 |
+
huggingface_hub/templates/datasetcard_template.md,sha256=W-EMqR6wndbrnZorkVv56URWPG49l7MATGeI015kTvs,5503
|
| 149 |
+
huggingface_hub/templates/modelcard_template.md,sha256=4AqArS3cqdtbit5Bo-DhjcnDFR-pza5hErLLTPM4Yuc,6870
|
| 150 |
+
huggingface_hub/utils/__init__.py,sha256=SHfYVviFx_oyeA0EFOz4kXFeRg-SAbDlgyb8tk4TpeU,4026
|
| 151 |
+
huggingface_hub/utils/_auth.py,sha256=Ykuq3yi67jxHmFdyLSc43xvGuCAIR7-h-dajX8IxpGQ,19958
|
| 152 |
+
huggingface_hub/utils/_cache_assets.py,sha256=nnzHRtQAR50dQeIK6qKddsmjjTW9v9HZ7b9bq7PJqss,5691
|
| 153 |
+
huggingface_hub/utils/_cache_manager.py,sha256=2StxP-nHZ5W9_hi8N9wBFqRNLw5HwO0h9HC7NTAGaFE,34955
|
| 154 |
+
huggingface_hub/utils/_chunk_utils.py,sha256=pTjy8Z-KLU4W_6D3OUh3E8lCodWDCd6aJwjNDU0C5U8,2121
|
| 155 |
+
huggingface_hub/utils/_datetime.py,sha256=tbNyI0Dkh27oScPUtLIT_8apqIIkXZYbigjOn9S3aMw,2755
|
| 156 |
+
huggingface_hub/utils/_deprecation.py,sha256=n4kNHbGipquSObJ-gxodcfd6lqoe_8s-VIsTuo3Oruk,4865
|
| 157 |
+
huggingface_hub/utils/_detect_agent.py,sha256=Iw2KW9BUZWfIypn9CtiTmEibHwKK9xx5Ar48z1cMU-Q,7337
|
| 158 |
+
huggingface_hub/utils/_dotenv.py,sha256=NdlEM8OXtzwlwmJCmdc6oGubFObrpgr408y8gnSs7ls,2604
|
| 159 |
+
huggingface_hub/utils/_experimental.py,sha256=q9vUvc1JybVFRQ0GRREG-BLouZEJC_40MxcwbAlOud0,2464
|
| 160 |
+
huggingface_hub/utils/_fixes.py,sha256=jTK1VLmc0ZC9ROSXjKoL5F6kOZFByzirRWIdXxhBfWU,4124
|
| 161 |
+
huggingface_hub/utils/_git_credential.py,sha256=1BhjvIScCOAToDORLOKrR3Szs-m0E5AYHPmC0SD7Nrs,4548
|
| 162 |
+
huggingface_hub/utils/_headers.py,sha256=Q9bu9mvOpm-9rfv-YRlr_Ywy_aMZkmRcN3MbVEcJAJA,8234
|
| 163 |
+
huggingface_hub/utils/_hf_uris.py,sha256=RTHrVKLT5vVU-ca8roXHrKwbN3njowanvxHjx5B4sUg,27558
|
| 164 |
+
huggingface_hub/utils/_http.py,sha256=C_mC63TsaxpmzyYBPHCneXKFLACEytAkBwxRwMNxcB4,46014
|
| 165 |
+
huggingface_hub/utils/_lfs.py,sha256=xMU-ROgNAUpDkzbH6yRZsE-eVYUYTNMGrgVb_QdTv-k,3942
|
| 166 |
+
huggingface_hub/utils/_oauth_device.py,sha256=o7ICmI01yDt1oAFNMUJvN1ThSfaCDpC8AHYSQgcnFGw,7983
|
| 167 |
+
huggingface_hub/utils/_pagination.py,sha256=h-TJjFbX3FqkA1T0tGZ0EhxMvuRSCg-UfL_a-BMs54I,1943
|
| 168 |
+
huggingface_hub/utils/_parsing.py,sha256=DVWuO6s_XMiGfXyc0jyX5hi_yGgBHpF9KLoeQM-VVK0,3586
|
| 169 |
+
huggingface_hub/utils/_paths.py,sha256=kWpUMIK9rmKb2LHgHCkk2DnroDzucrwbj-urCJCgfGw,5962
|
| 170 |
+
huggingface_hub/utils/_runtime.py,sha256=GVJ_Dt6y_48TZWl0ui9yPdW8M7rqGblRGyUqKaXxkCo,13493
|
| 171 |
+
huggingface_hub/utils/_safetensors.py,sha256=qFE7OA-vjU8X0zBBtOeNRzLu147KF-PdFoaxkYfWB4M,4426
|
| 172 |
+
huggingface_hub/utils/_subprocess.py,sha256=tFVBBNot_HLVqQ79y873TGb12C4PUTMwub-GhzDTemE,4542
|
| 173 |
+
huggingface_hub/utils/_telemetry.py,sha256=Tpa3YmOLhK_MEnL2i2fRLQy8aqAEZWbj6MKC18Hs8BA,4824
|
| 174 |
+
huggingface_hub/utils/_terminal.py,sha256=whHgs0Co-1LatoCmJE_ojqE_cWP6b5dWPWpU-uSFWUU,8969
|
| 175 |
+
huggingface_hub/utils/_typing.py,sha256=1LeE785YedppXSR9a1fQDu5rhTxX5v9kBYBaHrP65rA,3542
|
| 176 |
+
huggingface_hub/utils/_validators.py,sha256=tuC1U4yxB-4XKIajZMnKZUSKvZ6qPpydY8LItfa0g40,8419
|
| 177 |
+
huggingface_hub/utils/_verification.py,sha256=ZSilnolSkYmHB3vmBlWuuVr53xz59P5uGnxC3H-Hjc0,5434
|
| 178 |
+
huggingface_hub/utils/_xet.py,sha256=YtEzhvXi21VB4DtrnqGiSh2_Ox77XhVzLlDIwcnYxj0,6305
|
| 179 |
+
huggingface_hub/utils/_xet_progress_reporting.py,sha256=MnNCxB9ieflArNNyz3R4kpkjOdt6mQxi8qp8xqzXQTM,14162
|
| 180 |
+
huggingface_hub/utils/endpoint_helpers.py,sha256=9VtIAlxQ5H_4y30sjCAgbu7XCqAtNLC7aRYxaNn0hLI,2366
|
| 181 |
+
huggingface_hub/utils/insecure_hashlib.py,sha256=z3dVUFvdBZ8kQI_8Vzvvlr3ims-EBiY-SYPdnzIKOkw,1008
|
| 182 |
+
huggingface_hub/utils/logging.py,sha256=WaXk5gRa8Ml_LUIH34QCr8suYj8i_8Wot4IDnYJyWyM,4870
|
| 183 |
+
huggingface_hub/utils/sha.py,sha256=h8wxheZpcv671RhtiIFcFmQTDSrogN3kwQx3ZaNEUHg,2121
|
| 184 |
+
huggingface_hub/utils/tqdm.py,sha256=KbHhkB5g76JgGOGCcjAQOaR-oc-wzd4Sr3wqd41ny7k,13350
|
| 185 |
+
huggingface_hub-1.24.0.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
| 186 |
+
huggingface_hub-1.24.0.dist-info/METADATA,sha256=v9Nc5D4ZrL3kN81cNvd66iJ1JPd9uOkE7TeLj61cjMQ,16311
|
| 187 |
+
huggingface_hub-1.24.0.dist-info/WHEEL,sha256=K260EYznzXsJYBQGqmI8VTxEdiZYNvDZwW9cBh9-_MA,91
|
| 188 |
+
huggingface_hub-1.24.0.dist-info/entry_points.txt,sha256=zP7F_bBSdircPQFysHQZ9F3Lcn5_dCSOEZxVlGCsG0w,212
|
| 189 |
+
huggingface_hub-1.24.0.dist-info/top_level.txt,sha256=8KzlQJAY4miUvjAssOAJodqKOw3harNzuiwGQ9qLSSk,16
|
| 190 |
+
huggingface_hub-1.24.0.dist-info/RECORD,,
|
.cache/uv/archive-v0/WbiZCgDidtA5T1uiQ47d5/huggingface_hub-1.24.0.dist-info/WHEEL
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Wheel-Version: 1.0
|
| 2 |
+
Generator: setuptools (83.0.0)
|
| 3 |
+
Root-Is-Purelib: true
|
| 4 |
+
Tag: py3-none-any
|
| 5 |
+
|
.cache/uv/archive-v0/WbiZCgDidtA5T1uiQ47d5/huggingface_hub-1.24.0.dist-info/entry_points.txt
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[console_scripts]
|
| 2 |
+
hf = huggingface_hub.cli.hf:main
|
| 3 |
+
huggingface-cli = huggingface_hub.cli.deprecated_cli:main
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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.
|
.cache/uv/archive-v0/WbiZCgDidtA5T1uiQ47d5/huggingface_hub-1.24.0.dist-info/top_level.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
huggingface_hub
|
.cache/uv/archive-v0/WbiZCgDidtA5T1uiQ47d5/huggingface_hub/__init__.py
ADDED
|
@@ -0,0 +1,1804 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright 2020 The HuggingFace Team. All rights reserved.
|
| 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 |
+
# ***********
|
| 16 |
+
# `huggingface_hub` init has 2 modes:
|
| 17 |
+
# - Normal usage:
|
| 18 |
+
# If imported to use it, all modules and functions are lazy-loaded. This means
|
| 19 |
+
# they exist at top level in module but are imported only the first time they are
|
| 20 |
+
# used. This way, `from huggingface_hub import something` will import `something`
|
| 21 |
+
# quickly without the hassle of importing all the features from `huggingface_hub`.
|
| 22 |
+
# - Static check:
|
| 23 |
+
# If statically analyzed, all modules and functions are loaded normally. This way
|
| 24 |
+
# static typing check works properly as well as autocomplete in text editors and
|
| 25 |
+
# IDEs.
|
| 26 |
+
#
|
| 27 |
+
# The static model imports are done inside the `if TYPE_CHECKING:` statement at
|
| 28 |
+
# the bottom of this file. Since module/functions imports are duplicated, it is
|
| 29 |
+
# mandatory to make sure to add them twice when adding one. This is checked in the
|
| 30 |
+
# `make quality` command.
|
| 31 |
+
#
|
| 32 |
+
# To update the static imports, please run the following command and commit the changes.
|
| 33 |
+
# ```
|
| 34 |
+
# # Use script
|
| 35 |
+
# python utils/check_static_imports.py --update-file
|
| 36 |
+
#
|
| 37 |
+
# # Or run style on codebase
|
| 38 |
+
# make style
|
| 39 |
+
# ```
|
| 40 |
+
#
|
| 41 |
+
# ***********
|
| 42 |
+
# Lazy loader vendored from https://github.com/scientific-python/lazy_loader
|
| 43 |
+
import importlib
|
| 44 |
+
import os
|
| 45 |
+
import sys
|
| 46 |
+
from typing import TYPE_CHECKING
|
| 47 |
+
|
| 48 |
+
|
| 49 |
+
__version__ = "1.24.0"
|
| 50 |
+
|
| 51 |
+
# Alphabetical order of definitions is ensured in tests
|
| 52 |
+
# WARNING: any comment added in this dictionary definition will be lost when
|
| 53 |
+
# re-generating the file !
|
| 54 |
+
_SUBMOD_ATTRS = {
|
| 55 |
+
"_buckets": [
|
| 56 |
+
"BucketFile",
|
| 57 |
+
"BucketFileMetadata",
|
| 58 |
+
"BucketFolder",
|
| 59 |
+
"BucketInfo",
|
| 60 |
+
"BucketUrl",
|
| 61 |
+
"SyncOperation",
|
| 62 |
+
"SyncPlan",
|
| 63 |
+
],
|
| 64 |
+
"_commit_scheduler": [
|
| 65 |
+
"CommitScheduler",
|
| 66 |
+
],
|
| 67 |
+
"_eval_results": [
|
| 68 |
+
"EvalResultEntry",
|
| 69 |
+
"eval_result_entries_to_yaml",
|
| 70 |
+
"parse_eval_result_entries",
|
| 71 |
+
],
|
| 72 |
+
"_inference_endpoints": [
|
| 73 |
+
"InferenceEndpoint",
|
| 74 |
+
"InferenceEndpointError",
|
| 75 |
+
"InferenceEndpointStatus",
|
| 76 |
+
"InferenceEndpointTimeoutError",
|
| 77 |
+
"InferenceEndpointType",
|
| 78 |
+
],
|
| 79 |
+
"_jobs_api": [
|
| 80 |
+
"JobAccelerator",
|
| 81 |
+
"JobDurations",
|
| 82 |
+
"JobHardware",
|
| 83 |
+
"JobHardwareInfo",
|
| 84 |
+
"JobInfo",
|
| 85 |
+
"JobInitiator",
|
| 86 |
+
"JobOwner",
|
| 87 |
+
"JobStage",
|
| 88 |
+
"JobStatus",
|
| 89 |
+
],
|
| 90 |
+
"_login": [
|
| 91 |
+
"auth_list",
|
| 92 |
+
"auth_switch",
|
| 93 |
+
"interpreter_login",
|
| 94 |
+
"login",
|
| 95 |
+
"logout",
|
| 96 |
+
"notebook_login",
|
| 97 |
+
],
|
| 98 |
+
"_oauth": [
|
| 99 |
+
"OAuthInfo",
|
| 100 |
+
"OAuthOrgInfo",
|
| 101 |
+
"OAuthUserInfo",
|
| 102 |
+
"attach_huggingface_oauth",
|
| 103 |
+
"parse_huggingface_oauth",
|
| 104 |
+
],
|
| 105 |
+
"_sandbox": [
|
| 106 |
+
"Sandbox",
|
| 107 |
+
"SandboxCommandResult",
|
| 108 |
+
"SandboxPool",
|
| 109 |
+
"SandboxProcess",
|
| 110 |
+
],
|
| 111 |
+
"_snapshot_download": [
|
| 112 |
+
"get_cached_repo_tree",
|
| 113 |
+
"snapshot_download",
|
| 114 |
+
],
|
| 115 |
+
"_space_api": [
|
| 116 |
+
"SpaceHardware",
|
| 117 |
+
"SpaceRuntime",
|
| 118 |
+
"SpaceSecret",
|
| 119 |
+
"SpaceStage",
|
| 120 |
+
"SpaceStorage",
|
| 121 |
+
"SpaceVariable",
|
| 122 |
+
"Volume",
|
| 123 |
+
],
|
| 124 |
+
"_tensorboard_logger": [
|
| 125 |
+
"HFSummaryWriter",
|
| 126 |
+
],
|
| 127 |
+
"_webhooks_payload": [
|
| 128 |
+
"WebhookPayload",
|
| 129 |
+
"WebhookPayloadComment",
|
| 130 |
+
"WebhookPayloadDiscussion",
|
| 131 |
+
"WebhookPayloadDiscussionChanges",
|
| 132 |
+
"WebhookPayloadEvent",
|
| 133 |
+
"WebhookPayloadMovedTo",
|
| 134 |
+
"WebhookPayloadRepo",
|
| 135 |
+
"WebhookPayloadUrl",
|
| 136 |
+
"WebhookPayloadWebhook",
|
| 137 |
+
],
|
| 138 |
+
"_webhooks_server": [
|
| 139 |
+
"WebhooksServer",
|
| 140 |
+
"webhook_endpoint",
|
| 141 |
+
],
|
| 142 |
+
"cli._cli_utils": [
|
| 143 |
+
"check_cli_update",
|
| 144 |
+
"typer_factory",
|
| 145 |
+
],
|
| 146 |
+
"community": [
|
| 147 |
+
"Discussion",
|
| 148 |
+
"DiscussionComment",
|
| 149 |
+
"DiscussionCommit",
|
| 150 |
+
"DiscussionEvent",
|
| 151 |
+
"DiscussionStatusChange",
|
| 152 |
+
"DiscussionTitleChange",
|
| 153 |
+
"DiscussionWithDetails",
|
| 154 |
+
],
|
| 155 |
+
"constants": [
|
| 156 |
+
"CONFIG_NAME",
|
| 157 |
+
"FLAX_WEIGHTS_NAME",
|
| 158 |
+
"HUGGINGFACE_CO_URL_HOME",
|
| 159 |
+
"HUGGINGFACE_CO_URL_TEMPLATE",
|
| 160 |
+
"PYTORCH_WEIGHTS_NAME",
|
| 161 |
+
"REPO_TYPE_DATASET",
|
| 162 |
+
"REPO_TYPE_MODEL",
|
| 163 |
+
"REPO_TYPE_SPACE",
|
| 164 |
+
"TF2_WEIGHTS_NAME",
|
| 165 |
+
"TF_WEIGHTS_NAME",
|
| 166 |
+
"is_offline_mode",
|
| 167 |
+
],
|
| 168 |
+
"fastai_utils": [
|
| 169 |
+
"_save_pretrained_fastai",
|
| 170 |
+
"from_pretrained_fastai",
|
| 171 |
+
"push_to_hub_fastai",
|
| 172 |
+
],
|
| 173 |
+
"file_download": [
|
| 174 |
+
"DryRunFileInfo",
|
| 175 |
+
"HfFileMetadata",
|
| 176 |
+
"_CACHED_NO_EXIST",
|
| 177 |
+
"get_hf_file_metadata",
|
| 178 |
+
"hf_hub_download",
|
| 179 |
+
"hf_hub_url",
|
| 180 |
+
"try_to_load_from_cache",
|
| 181 |
+
],
|
| 182 |
+
"hf_api": [
|
| 183 |
+
"Collection",
|
| 184 |
+
"CollectionItem",
|
| 185 |
+
"CommitInfo",
|
| 186 |
+
"CommitOperation",
|
| 187 |
+
"CommitOperationAdd",
|
| 188 |
+
"CommitOperationCopy",
|
| 189 |
+
"CommitOperationDelete",
|
| 190 |
+
"DatasetInfo",
|
| 191 |
+
"DatasetLeaderboardEntry",
|
| 192 |
+
"GitCommitInfo",
|
| 193 |
+
"GitRefInfo",
|
| 194 |
+
"GitRefs",
|
| 195 |
+
"HfApi",
|
| 196 |
+
"KernelInfo",
|
| 197 |
+
"ModelInfo",
|
| 198 |
+
"Organization",
|
| 199 |
+
"RepoFile",
|
| 200 |
+
"RepoFolder",
|
| 201 |
+
"RepoStorageInfo",
|
| 202 |
+
"RepoUrl",
|
| 203 |
+
"SpaceInfo",
|
| 204 |
+
"SpaceSearchResult",
|
| 205 |
+
"SpaceTemplate",
|
| 206 |
+
"User",
|
| 207 |
+
"UserLikes",
|
| 208 |
+
"WebhookInfo",
|
| 209 |
+
"WebhookWatchedItem",
|
| 210 |
+
"accept_access_request",
|
| 211 |
+
"add_collection_item",
|
| 212 |
+
"add_space_secret",
|
| 213 |
+
"add_space_variable",
|
| 214 |
+
"auth_check",
|
| 215 |
+
"batch_bucket_files",
|
| 216 |
+
"bucket_info",
|
| 217 |
+
"cancel_access_request",
|
| 218 |
+
"cancel_job",
|
| 219 |
+
"change_discussion_status",
|
| 220 |
+
"comment_discussion",
|
| 221 |
+
"copy_files",
|
| 222 |
+
"create_branch",
|
| 223 |
+
"create_bucket",
|
| 224 |
+
"create_collection",
|
| 225 |
+
"create_commit",
|
| 226 |
+
"create_discussion",
|
| 227 |
+
"create_inference_endpoint",
|
| 228 |
+
"create_inference_endpoint_from_catalog",
|
| 229 |
+
"create_pull_request",
|
| 230 |
+
"create_repo",
|
| 231 |
+
"create_scheduled_job",
|
| 232 |
+
"create_scheduled_uv_job",
|
| 233 |
+
"create_tag",
|
| 234 |
+
"create_webhook",
|
| 235 |
+
"dataset_info",
|
| 236 |
+
"delete_branch",
|
| 237 |
+
"delete_bucket",
|
| 238 |
+
"delete_collection",
|
| 239 |
+
"delete_collection_item",
|
| 240 |
+
"delete_file",
|
| 241 |
+
"delete_folder",
|
| 242 |
+
"delete_inference_endpoint",
|
| 243 |
+
"delete_repo",
|
| 244 |
+
"delete_scheduled_job",
|
| 245 |
+
"delete_space_secret",
|
| 246 |
+
"delete_space_storage",
|
| 247 |
+
"delete_space_variable",
|
| 248 |
+
"delete_space_volumes",
|
| 249 |
+
"delete_tag",
|
| 250 |
+
"delete_webhook",
|
| 251 |
+
"disable_space_dev_mode",
|
| 252 |
+
"disable_webhook",
|
| 253 |
+
"download_bucket_files",
|
| 254 |
+
"duplicate_repo",
|
| 255 |
+
"duplicate_space",
|
| 256 |
+
"edit_discussion_comment",
|
| 257 |
+
"enable_space_dev_mode",
|
| 258 |
+
"enable_webhook",
|
| 259 |
+
"fetch_job_logs",
|
| 260 |
+
"fetch_job_metrics",
|
| 261 |
+
"fetch_space_logs",
|
| 262 |
+
"file_exists",
|
| 263 |
+
"get_bucket_file_metadata",
|
| 264 |
+
"get_bucket_paths_info",
|
| 265 |
+
"get_collection",
|
| 266 |
+
"get_dataset_leaderboard",
|
| 267 |
+
"get_dataset_tags",
|
| 268 |
+
"get_discussion_details",
|
| 269 |
+
"get_full_repo_name",
|
| 270 |
+
"get_inference_endpoint",
|
| 271 |
+
"get_local_safetensors_metadata",
|
| 272 |
+
"get_model_tags",
|
| 273 |
+
"get_organization_overview",
|
| 274 |
+
"get_paths_info",
|
| 275 |
+
"get_repo_discussions",
|
| 276 |
+
"get_safetensors_metadata",
|
| 277 |
+
"get_space_runtime",
|
| 278 |
+
"get_space_secrets",
|
| 279 |
+
"get_space_variables",
|
| 280 |
+
"get_user_overview",
|
| 281 |
+
"get_webhook",
|
| 282 |
+
"grant_access",
|
| 283 |
+
"inspect_job",
|
| 284 |
+
"inspect_scheduled_job",
|
| 285 |
+
"kernel_info",
|
| 286 |
+
"list_accepted_access_requests",
|
| 287 |
+
"list_bucket_tree",
|
| 288 |
+
"list_buckets",
|
| 289 |
+
"list_collections",
|
| 290 |
+
"list_daily_papers",
|
| 291 |
+
"list_dataset_parquet_files",
|
| 292 |
+
"list_datasets",
|
| 293 |
+
"list_inference_catalog",
|
| 294 |
+
"list_inference_endpoints",
|
| 295 |
+
"list_jobs",
|
| 296 |
+
"list_jobs_hardware",
|
| 297 |
+
"list_lfs_files",
|
| 298 |
+
"list_liked_repos",
|
| 299 |
+
"list_models",
|
| 300 |
+
"list_organization_followers",
|
| 301 |
+
"list_organization_members",
|
| 302 |
+
"list_papers",
|
| 303 |
+
"list_pending_access_requests",
|
| 304 |
+
"list_rejected_access_requests",
|
| 305 |
+
"list_repo_commits",
|
| 306 |
+
"list_repo_files",
|
| 307 |
+
"list_repo_likers",
|
| 308 |
+
"list_repo_refs",
|
| 309 |
+
"list_repo_tree",
|
| 310 |
+
"list_space_templates",
|
| 311 |
+
"list_spaces",
|
| 312 |
+
"list_spaces_hardware",
|
| 313 |
+
"list_user_followers",
|
| 314 |
+
"list_user_following",
|
| 315 |
+
"list_user_repos",
|
| 316 |
+
"list_webhooks",
|
| 317 |
+
"merge_pull_request",
|
| 318 |
+
"model_info",
|
| 319 |
+
"move_bucket",
|
| 320 |
+
"move_repo",
|
| 321 |
+
"paper_info",
|
| 322 |
+
"parse_local_safetensors_file_metadata",
|
| 323 |
+
"parse_safetensors_file_metadata",
|
| 324 |
+
"pause_inference_endpoint",
|
| 325 |
+
"pause_space",
|
| 326 |
+
"permanently_delete_lfs_files",
|
| 327 |
+
"preupload_lfs_files",
|
| 328 |
+
"read_paper",
|
| 329 |
+
"reject_access_request",
|
| 330 |
+
"rename_discussion",
|
| 331 |
+
"repo_exists",
|
| 332 |
+
"repo_info",
|
| 333 |
+
"repo_type_and_id_from_hf_id",
|
| 334 |
+
"request_space_hardware",
|
| 335 |
+
"request_space_storage",
|
| 336 |
+
"restart_space",
|
| 337 |
+
"resume_inference_endpoint",
|
| 338 |
+
"resume_scheduled_job",
|
| 339 |
+
"revision_exists",
|
| 340 |
+
"run_as_future",
|
| 341 |
+
"run_job",
|
| 342 |
+
"run_uv_job",
|
| 343 |
+
"scale_to_zero_inference_endpoint",
|
| 344 |
+
"search_spaces",
|
| 345 |
+
"set_space_sleep_time",
|
| 346 |
+
"set_space_volumes",
|
| 347 |
+
"space_info",
|
| 348 |
+
"super_squash_history",
|
| 349 |
+
"suspend_scheduled_job",
|
| 350 |
+
"sync_bucket",
|
| 351 |
+
"sync_job_volume",
|
| 352 |
+
"trigger_scheduled_job",
|
| 353 |
+
"unlike",
|
| 354 |
+
"update_collection_item",
|
| 355 |
+
"update_collection_metadata",
|
| 356 |
+
"update_inference_endpoint",
|
| 357 |
+
"update_job_labels",
|
| 358 |
+
"update_repo_settings",
|
| 359 |
+
"update_scheduled_job_labels",
|
| 360 |
+
"update_webhook",
|
| 361 |
+
"upload_file",
|
| 362 |
+
"upload_folder",
|
| 363 |
+
"upload_large_folder",
|
| 364 |
+
"verify_repo_checksums",
|
| 365 |
+
"wait_for_job",
|
| 366 |
+
"wait_for_space",
|
| 367 |
+
"whoami",
|
| 368 |
+
],
|
| 369 |
+
"hf_file_system": [
|
| 370 |
+
"HfFileSystem",
|
| 371 |
+
"HfFileSystemFile",
|
| 372 |
+
"HfFileSystemResolvedPath",
|
| 373 |
+
"HfFileSystemStreamFile",
|
| 374 |
+
"hffs",
|
| 375 |
+
],
|
| 376 |
+
"hub_mixin": [
|
| 377 |
+
"ModelHubMixin",
|
| 378 |
+
"PyTorchModelHubMixin",
|
| 379 |
+
],
|
| 380 |
+
"inference._client": [
|
| 381 |
+
"InferenceClient",
|
| 382 |
+
"InferenceTimeoutError",
|
| 383 |
+
],
|
| 384 |
+
"inference._generated._async_client": [
|
| 385 |
+
"AsyncInferenceClient",
|
| 386 |
+
],
|
| 387 |
+
"inference._generated.types": [
|
| 388 |
+
"AudioClassificationInput",
|
| 389 |
+
"AudioClassificationOutputElement",
|
| 390 |
+
"AudioClassificationOutputTransform",
|
| 391 |
+
"AudioClassificationParameters",
|
| 392 |
+
"AudioToAudioInput",
|
| 393 |
+
"AudioToAudioOutputElement",
|
| 394 |
+
"AutomaticSpeechRecognitionEarlyStoppingEnum",
|
| 395 |
+
"AutomaticSpeechRecognitionGenerationParameters",
|
| 396 |
+
"AutomaticSpeechRecognitionInput",
|
| 397 |
+
"AutomaticSpeechRecognitionOutput",
|
| 398 |
+
"AutomaticSpeechRecognitionOutputChunk",
|
| 399 |
+
"AutomaticSpeechRecognitionParameters",
|
| 400 |
+
"ChatCompletionInput",
|
| 401 |
+
"ChatCompletionInputFunctionDefinition",
|
| 402 |
+
"ChatCompletionInputFunctionName",
|
| 403 |
+
"ChatCompletionInputGrammarType",
|
| 404 |
+
"ChatCompletionInputJSONSchema",
|
| 405 |
+
"ChatCompletionInputMessage",
|
| 406 |
+
"ChatCompletionInputMessageChunk",
|
| 407 |
+
"ChatCompletionInputMessageChunkType",
|
| 408 |
+
"ChatCompletionInputResponseFormatJSONObject",
|
| 409 |
+
"ChatCompletionInputResponseFormatJSONSchema",
|
| 410 |
+
"ChatCompletionInputResponseFormatText",
|
| 411 |
+
"ChatCompletionInputStreamOptions",
|
| 412 |
+
"ChatCompletionInputTool",
|
| 413 |
+
"ChatCompletionInputToolCall",
|
| 414 |
+
"ChatCompletionInputToolChoiceClass",
|
| 415 |
+
"ChatCompletionInputToolChoiceEnum",
|
| 416 |
+
"ChatCompletionInputURL",
|
| 417 |
+
"ChatCompletionOutput",
|
| 418 |
+
"ChatCompletionOutputComplete",
|
| 419 |
+
"ChatCompletionOutputFunctionDefinition",
|
| 420 |
+
"ChatCompletionOutputLogprob",
|
| 421 |
+
"ChatCompletionOutputLogprobs",
|
| 422 |
+
"ChatCompletionOutputMessage",
|
| 423 |
+
"ChatCompletionOutputToolCall",
|
| 424 |
+
"ChatCompletionOutputTopLogprob",
|
| 425 |
+
"ChatCompletionOutputUsage",
|
| 426 |
+
"ChatCompletionStreamOutput",
|
| 427 |
+
"ChatCompletionStreamOutputChoice",
|
| 428 |
+
"ChatCompletionStreamOutputDelta",
|
| 429 |
+
"ChatCompletionStreamOutputDeltaToolCall",
|
| 430 |
+
"ChatCompletionStreamOutputFunction",
|
| 431 |
+
"ChatCompletionStreamOutputLogprob",
|
| 432 |
+
"ChatCompletionStreamOutputLogprobs",
|
| 433 |
+
"ChatCompletionStreamOutputTopLogprob",
|
| 434 |
+
"ChatCompletionStreamOutputUsage",
|
| 435 |
+
"DepthEstimationInput",
|
| 436 |
+
"DepthEstimationOutput",
|
| 437 |
+
"DocumentQuestionAnsweringInput",
|
| 438 |
+
"DocumentQuestionAnsweringInputData",
|
| 439 |
+
"DocumentQuestionAnsweringOutputElement",
|
| 440 |
+
"DocumentQuestionAnsweringParameters",
|
| 441 |
+
"FeatureExtractionInput",
|
| 442 |
+
"FeatureExtractionInputTruncationDirection",
|
| 443 |
+
"FillMaskInput",
|
| 444 |
+
"FillMaskOutputElement",
|
| 445 |
+
"FillMaskParameters",
|
| 446 |
+
"ImageClassificationInput",
|
| 447 |
+
"ImageClassificationOutputElement",
|
| 448 |
+
"ImageClassificationOutputTransform",
|
| 449 |
+
"ImageClassificationParameters",
|
| 450 |
+
"ImageSegmentationInput",
|
| 451 |
+
"ImageSegmentationOutputElement",
|
| 452 |
+
"ImageSegmentationParameters",
|
| 453 |
+
"ImageSegmentationSubtask",
|
| 454 |
+
"ImageTextToImageInput",
|
| 455 |
+
"ImageTextToImageOutput",
|
| 456 |
+
"ImageTextToImageParameters",
|
| 457 |
+
"ImageTextToImageTargetSize",
|
| 458 |
+
"ImageTextToVideoInput",
|
| 459 |
+
"ImageTextToVideoOutput",
|
| 460 |
+
"ImageTextToVideoParameters",
|
| 461 |
+
"ImageTextToVideoTargetSize",
|
| 462 |
+
"ImageToImageInput",
|
| 463 |
+
"ImageToImageOutput",
|
| 464 |
+
"ImageToImageParameters",
|
| 465 |
+
"ImageToImageTargetSize",
|
| 466 |
+
"ImageToTextEarlyStoppingEnum",
|
| 467 |
+
"ImageToTextGenerationParameters",
|
| 468 |
+
"ImageToTextInput",
|
| 469 |
+
"ImageToTextOutput",
|
| 470 |
+
"ImageToTextParameters",
|
| 471 |
+
"ImageToVideoInput",
|
| 472 |
+
"ImageToVideoOutput",
|
| 473 |
+
"ImageToVideoParameters",
|
| 474 |
+
"ImageToVideoTargetSize",
|
| 475 |
+
"ObjectDetectionBoundingBox",
|
| 476 |
+
"ObjectDetectionInput",
|
| 477 |
+
"ObjectDetectionOutputElement",
|
| 478 |
+
"ObjectDetectionParameters",
|
| 479 |
+
"Padding",
|
| 480 |
+
"QuestionAnsweringInput",
|
| 481 |
+
"QuestionAnsweringInputData",
|
| 482 |
+
"QuestionAnsweringOutputElement",
|
| 483 |
+
"QuestionAnsweringParameters",
|
| 484 |
+
"SentenceSimilarityInput",
|
| 485 |
+
"SentenceSimilarityInputData",
|
| 486 |
+
"SummarizationInput",
|
| 487 |
+
"SummarizationOutput",
|
| 488 |
+
"SummarizationParameters",
|
| 489 |
+
"SummarizationTruncationStrategy",
|
| 490 |
+
"TableQuestionAnsweringInput",
|
| 491 |
+
"TableQuestionAnsweringInputData",
|
| 492 |
+
"TableQuestionAnsweringOutputElement",
|
| 493 |
+
"TableQuestionAnsweringParameters",
|
| 494 |
+
"Text2TextGenerationInput",
|
| 495 |
+
"Text2TextGenerationOutput",
|
| 496 |
+
"Text2TextGenerationParameters",
|
| 497 |
+
"Text2TextGenerationTruncationStrategy",
|
| 498 |
+
"TextClassificationInput",
|
| 499 |
+
"TextClassificationOutputElement",
|
| 500 |
+
"TextClassificationOutputTransform",
|
| 501 |
+
"TextClassificationParameters",
|
| 502 |
+
"TextGenerationInput",
|
| 503 |
+
"TextGenerationInputGenerateParameters",
|
| 504 |
+
"TextGenerationInputGrammarType",
|
| 505 |
+
"TextGenerationOutput",
|
| 506 |
+
"TextGenerationOutputBestOfSequence",
|
| 507 |
+
"TextGenerationOutputDetails",
|
| 508 |
+
"TextGenerationOutputFinishReason",
|
| 509 |
+
"TextGenerationOutputPrefillToken",
|
| 510 |
+
"TextGenerationOutputToken",
|
| 511 |
+
"TextGenerationStreamOutput",
|
| 512 |
+
"TextGenerationStreamOutputStreamDetails",
|
| 513 |
+
"TextGenerationStreamOutputToken",
|
| 514 |
+
"TextToAudioEarlyStoppingEnum",
|
| 515 |
+
"TextToAudioGenerationParameters",
|
| 516 |
+
"TextToAudioInput",
|
| 517 |
+
"TextToAudioOutput",
|
| 518 |
+
"TextToAudioParameters",
|
| 519 |
+
"TextToImageInput",
|
| 520 |
+
"TextToImageOutput",
|
| 521 |
+
"TextToImageParameters",
|
| 522 |
+
"TextToSpeechEarlyStoppingEnum",
|
| 523 |
+
"TextToSpeechGenerationParameters",
|
| 524 |
+
"TextToSpeechInput",
|
| 525 |
+
"TextToSpeechOutput",
|
| 526 |
+
"TextToSpeechParameters",
|
| 527 |
+
"TextToVideoInput",
|
| 528 |
+
"TextToVideoOutput",
|
| 529 |
+
"TextToVideoParameters",
|
| 530 |
+
"TokenClassificationAggregationStrategy",
|
| 531 |
+
"TokenClassificationInput",
|
| 532 |
+
"TokenClassificationOutputElement",
|
| 533 |
+
"TokenClassificationParameters",
|
| 534 |
+
"TranslationInput",
|
| 535 |
+
"TranslationOutput",
|
| 536 |
+
"TranslationParameters",
|
| 537 |
+
"TranslationTruncationStrategy",
|
| 538 |
+
"TypeEnum",
|
| 539 |
+
"VideoClassificationInput",
|
| 540 |
+
"VideoClassificationOutputElement",
|
| 541 |
+
"VideoClassificationOutputTransform",
|
| 542 |
+
"VideoClassificationParameters",
|
| 543 |
+
"VisualQuestionAnsweringInput",
|
| 544 |
+
"VisualQuestionAnsweringInputData",
|
| 545 |
+
"VisualQuestionAnsweringOutputElement",
|
| 546 |
+
"VisualQuestionAnsweringParameters",
|
| 547 |
+
"ZeroShotClassificationInput",
|
| 548 |
+
"ZeroShotClassificationOutputElement",
|
| 549 |
+
"ZeroShotClassificationParameters",
|
| 550 |
+
"ZeroShotImageClassificationInput",
|
| 551 |
+
"ZeroShotImageClassificationOutputElement",
|
| 552 |
+
"ZeroShotImageClassificationParameters",
|
| 553 |
+
"ZeroShotObjectDetectionBoundingBox",
|
| 554 |
+
"ZeroShotObjectDetectionInput",
|
| 555 |
+
"ZeroShotObjectDetectionOutputElement",
|
| 556 |
+
"ZeroShotObjectDetectionParameters",
|
| 557 |
+
],
|
| 558 |
+
"inference._mcp.agent": [
|
| 559 |
+
"Agent",
|
| 560 |
+
],
|
| 561 |
+
"inference._mcp.mcp_client": [
|
| 562 |
+
"MCPClient",
|
| 563 |
+
],
|
| 564 |
+
"repocard": [
|
| 565 |
+
"DatasetCard",
|
| 566 |
+
"ModelCard",
|
| 567 |
+
"RepoCard",
|
| 568 |
+
"SpaceCard",
|
| 569 |
+
"metadata_eval_result",
|
| 570 |
+
"metadata_load",
|
| 571 |
+
"metadata_save",
|
| 572 |
+
"metadata_update",
|
| 573 |
+
],
|
| 574 |
+
"repocard_data": [
|
| 575 |
+
"CardData",
|
| 576 |
+
"DatasetCardData",
|
| 577 |
+
"EvalResult",
|
| 578 |
+
"ModelCardData",
|
| 579 |
+
"SpaceCardData",
|
| 580 |
+
],
|
| 581 |
+
"serialization": [
|
| 582 |
+
"StateDictSplit",
|
| 583 |
+
"get_torch_storage_id",
|
| 584 |
+
"get_torch_storage_size",
|
| 585 |
+
"load_state_dict_from_file",
|
| 586 |
+
"load_torch_model",
|
| 587 |
+
"save_torch_model",
|
| 588 |
+
"save_torch_state_dict",
|
| 589 |
+
"split_state_dict_into_shards_factory",
|
| 590 |
+
"split_torch_state_dict_into_shards",
|
| 591 |
+
],
|
| 592 |
+
"serialization._dduf": [
|
| 593 |
+
"DDUFEntry",
|
| 594 |
+
"export_entries_as_dduf",
|
| 595 |
+
"export_folder_as_dduf",
|
| 596 |
+
"read_dduf_file",
|
| 597 |
+
],
|
| 598 |
+
"utils": [
|
| 599 |
+
"ASYNC_CLIENT_FACTORY_T",
|
| 600 |
+
"CLIENT_FACTORY_T",
|
| 601 |
+
"CacheNotFound",
|
| 602 |
+
"CachedFileInfo",
|
| 603 |
+
"CachedIncompleteFileInfo",
|
| 604 |
+
"CachedRepoInfo",
|
| 605 |
+
"CachedRevisionInfo",
|
| 606 |
+
"CorruptedCacheException",
|
| 607 |
+
"DeleteCacheStrategy",
|
| 608 |
+
"HFCacheInfo",
|
| 609 |
+
"HfUri",
|
| 610 |
+
"cached_assets_path",
|
| 611 |
+
"close_session",
|
| 612 |
+
"dump_environment_info",
|
| 613 |
+
"get_async_session",
|
| 614 |
+
"get_session",
|
| 615 |
+
"get_token",
|
| 616 |
+
"hf_raise_for_status",
|
| 617 |
+
"logging",
|
| 618 |
+
"parse_hf_uri",
|
| 619 |
+
"scan_cache_dir",
|
| 620 |
+
"set_async_client_factory",
|
| 621 |
+
"set_client_factory",
|
| 622 |
+
],
|
| 623 |
+
}
|
| 624 |
+
|
| 625 |
+
# WARNING: __all__ is generated automatically, Any manual edit will be lost when re-generating this file !
|
| 626 |
+
#
|
| 627 |
+
# To update the static imports, please run the following command and commit the changes.
|
| 628 |
+
# ```
|
| 629 |
+
# # Use script
|
| 630 |
+
# python utils/check_all_variable.py --update
|
| 631 |
+
#
|
| 632 |
+
# # Or run style on codebase
|
| 633 |
+
# make style
|
| 634 |
+
# ```
|
| 635 |
+
|
| 636 |
+
__all__ = [
|
| 637 |
+
"ASYNC_CLIENT_FACTORY_T",
|
| 638 |
+
"Agent",
|
| 639 |
+
"AsyncInferenceClient",
|
| 640 |
+
"AudioClassificationInput",
|
| 641 |
+
"AudioClassificationOutputElement",
|
| 642 |
+
"AudioClassificationOutputTransform",
|
| 643 |
+
"AudioClassificationParameters",
|
| 644 |
+
"AudioToAudioInput",
|
| 645 |
+
"AudioToAudioOutputElement",
|
| 646 |
+
"AutomaticSpeechRecognitionEarlyStoppingEnum",
|
| 647 |
+
"AutomaticSpeechRecognitionGenerationParameters",
|
| 648 |
+
"AutomaticSpeechRecognitionInput",
|
| 649 |
+
"AutomaticSpeechRecognitionOutput",
|
| 650 |
+
"AutomaticSpeechRecognitionOutputChunk",
|
| 651 |
+
"AutomaticSpeechRecognitionParameters",
|
| 652 |
+
"BucketFile",
|
| 653 |
+
"BucketFileMetadata",
|
| 654 |
+
"BucketFolder",
|
| 655 |
+
"BucketInfo",
|
| 656 |
+
"BucketUrl",
|
| 657 |
+
"CLIENT_FACTORY_T",
|
| 658 |
+
"CONFIG_NAME",
|
| 659 |
+
"CacheNotFound",
|
| 660 |
+
"CachedFileInfo",
|
| 661 |
+
"CachedIncompleteFileInfo",
|
| 662 |
+
"CachedRepoInfo",
|
| 663 |
+
"CachedRevisionInfo",
|
| 664 |
+
"CardData",
|
| 665 |
+
"ChatCompletionInput",
|
| 666 |
+
"ChatCompletionInputFunctionDefinition",
|
| 667 |
+
"ChatCompletionInputFunctionName",
|
| 668 |
+
"ChatCompletionInputGrammarType",
|
| 669 |
+
"ChatCompletionInputJSONSchema",
|
| 670 |
+
"ChatCompletionInputMessage",
|
| 671 |
+
"ChatCompletionInputMessageChunk",
|
| 672 |
+
"ChatCompletionInputMessageChunkType",
|
| 673 |
+
"ChatCompletionInputResponseFormatJSONObject",
|
| 674 |
+
"ChatCompletionInputResponseFormatJSONSchema",
|
| 675 |
+
"ChatCompletionInputResponseFormatText",
|
| 676 |
+
"ChatCompletionInputStreamOptions",
|
| 677 |
+
"ChatCompletionInputTool",
|
| 678 |
+
"ChatCompletionInputToolCall",
|
| 679 |
+
"ChatCompletionInputToolChoiceClass",
|
| 680 |
+
"ChatCompletionInputToolChoiceEnum",
|
| 681 |
+
"ChatCompletionInputURL",
|
| 682 |
+
"ChatCompletionOutput",
|
| 683 |
+
"ChatCompletionOutputComplete",
|
| 684 |
+
"ChatCompletionOutputFunctionDefinition",
|
| 685 |
+
"ChatCompletionOutputLogprob",
|
| 686 |
+
"ChatCompletionOutputLogprobs",
|
| 687 |
+
"ChatCompletionOutputMessage",
|
| 688 |
+
"ChatCompletionOutputToolCall",
|
| 689 |
+
"ChatCompletionOutputTopLogprob",
|
| 690 |
+
"ChatCompletionOutputUsage",
|
| 691 |
+
"ChatCompletionStreamOutput",
|
| 692 |
+
"ChatCompletionStreamOutputChoice",
|
| 693 |
+
"ChatCompletionStreamOutputDelta",
|
| 694 |
+
"ChatCompletionStreamOutputDeltaToolCall",
|
| 695 |
+
"ChatCompletionStreamOutputFunction",
|
| 696 |
+
"ChatCompletionStreamOutputLogprob",
|
| 697 |
+
"ChatCompletionStreamOutputLogprobs",
|
| 698 |
+
"ChatCompletionStreamOutputTopLogprob",
|
| 699 |
+
"ChatCompletionStreamOutputUsage",
|
| 700 |
+
"Collection",
|
| 701 |
+
"CollectionItem",
|
| 702 |
+
"CommitInfo",
|
| 703 |
+
"CommitOperation",
|
| 704 |
+
"CommitOperationAdd",
|
| 705 |
+
"CommitOperationCopy",
|
| 706 |
+
"CommitOperationDelete",
|
| 707 |
+
"CommitScheduler",
|
| 708 |
+
"CorruptedCacheException",
|
| 709 |
+
"DDUFEntry",
|
| 710 |
+
"DatasetCard",
|
| 711 |
+
"DatasetCardData",
|
| 712 |
+
"DatasetInfo",
|
| 713 |
+
"DatasetLeaderboardEntry",
|
| 714 |
+
"DeleteCacheStrategy",
|
| 715 |
+
"DepthEstimationInput",
|
| 716 |
+
"DepthEstimationOutput",
|
| 717 |
+
"Discussion",
|
| 718 |
+
"DiscussionComment",
|
| 719 |
+
"DiscussionCommit",
|
| 720 |
+
"DiscussionEvent",
|
| 721 |
+
"DiscussionStatusChange",
|
| 722 |
+
"DiscussionTitleChange",
|
| 723 |
+
"DiscussionWithDetails",
|
| 724 |
+
"DocumentQuestionAnsweringInput",
|
| 725 |
+
"DocumentQuestionAnsweringInputData",
|
| 726 |
+
"DocumentQuestionAnsweringOutputElement",
|
| 727 |
+
"DocumentQuestionAnsweringParameters",
|
| 728 |
+
"DryRunFileInfo",
|
| 729 |
+
"EvalResult",
|
| 730 |
+
"EvalResultEntry",
|
| 731 |
+
"FLAX_WEIGHTS_NAME",
|
| 732 |
+
"FeatureExtractionInput",
|
| 733 |
+
"FeatureExtractionInputTruncationDirection",
|
| 734 |
+
"FillMaskInput",
|
| 735 |
+
"FillMaskOutputElement",
|
| 736 |
+
"FillMaskParameters",
|
| 737 |
+
"GitCommitInfo",
|
| 738 |
+
"GitRefInfo",
|
| 739 |
+
"GitRefs",
|
| 740 |
+
"HFCacheInfo",
|
| 741 |
+
"HFSummaryWriter",
|
| 742 |
+
"HUGGINGFACE_CO_URL_HOME",
|
| 743 |
+
"HUGGINGFACE_CO_URL_TEMPLATE",
|
| 744 |
+
"HfApi",
|
| 745 |
+
"HfFileMetadata",
|
| 746 |
+
"HfFileSystem",
|
| 747 |
+
"HfFileSystemFile",
|
| 748 |
+
"HfFileSystemResolvedPath",
|
| 749 |
+
"HfFileSystemStreamFile",
|
| 750 |
+
"HfUri",
|
| 751 |
+
"ImageClassificationInput",
|
| 752 |
+
"ImageClassificationOutputElement",
|
| 753 |
+
"ImageClassificationOutputTransform",
|
| 754 |
+
"ImageClassificationParameters",
|
| 755 |
+
"ImageSegmentationInput",
|
| 756 |
+
"ImageSegmentationOutputElement",
|
| 757 |
+
"ImageSegmentationParameters",
|
| 758 |
+
"ImageSegmentationSubtask",
|
| 759 |
+
"ImageTextToImageInput",
|
| 760 |
+
"ImageTextToImageOutput",
|
| 761 |
+
"ImageTextToImageParameters",
|
| 762 |
+
"ImageTextToImageTargetSize",
|
| 763 |
+
"ImageTextToVideoInput",
|
| 764 |
+
"ImageTextToVideoOutput",
|
| 765 |
+
"ImageTextToVideoParameters",
|
| 766 |
+
"ImageTextToVideoTargetSize",
|
| 767 |
+
"ImageToImageInput",
|
| 768 |
+
"ImageToImageOutput",
|
| 769 |
+
"ImageToImageParameters",
|
| 770 |
+
"ImageToImageTargetSize",
|
| 771 |
+
"ImageToTextEarlyStoppingEnum",
|
| 772 |
+
"ImageToTextGenerationParameters",
|
| 773 |
+
"ImageToTextInput",
|
| 774 |
+
"ImageToTextOutput",
|
| 775 |
+
"ImageToTextParameters",
|
| 776 |
+
"ImageToVideoInput",
|
| 777 |
+
"ImageToVideoOutput",
|
| 778 |
+
"ImageToVideoParameters",
|
| 779 |
+
"ImageToVideoTargetSize",
|
| 780 |
+
"InferenceClient",
|
| 781 |
+
"InferenceEndpoint",
|
| 782 |
+
"InferenceEndpointError",
|
| 783 |
+
"InferenceEndpointStatus",
|
| 784 |
+
"InferenceEndpointTimeoutError",
|
| 785 |
+
"InferenceEndpointType",
|
| 786 |
+
"InferenceTimeoutError",
|
| 787 |
+
"JobAccelerator",
|
| 788 |
+
"JobDurations",
|
| 789 |
+
"JobHardware",
|
| 790 |
+
"JobHardwareInfo",
|
| 791 |
+
"JobInfo",
|
| 792 |
+
"JobInitiator",
|
| 793 |
+
"JobOwner",
|
| 794 |
+
"JobStage",
|
| 795 |
+
"JobStatus",
|
| 796 |
+
"KernelInfo",
|
| 797 |
+
"MCPClient",
|
| 798 |
+
"ModelCard",
|
| 799 |
+
"ModelCardData",
|
| 800 |
+
"ModelHubMixin",
|
| 801 |
+
"ModelInfo",
|
| 802 |
+
"OAuthInfo",
|
| 803 |
+
"OAuthOrgInfo",
|
| 804 |
+
"OAuthUserInfo",
|
| 805 |
+
"ObjectDetectionBoundingBox",
|
| 806 |
+
"ObjectDetectionInput",
|
| 807 |
+
"ObjectDetectionOutputElement",
|
| 808 |
+
"ObjectDetectionParameters",
|
| 809 |
+
"Organization",
|
| 810 |
+
"PYTORCH_WEIGHTS_NAME",
|
| 811 |
+
"Padding",
|
| 812 |
+
"PyTorchModelHubMixin",
|
| 813 |
+
"QuestionAnsweringInput",
|
| 814 |
+
"QuestionAnsweringInputData",
|
| 815 |
+
"QuestionAnsweringOutputElement",
|
| 816 |
+
"QuestionAnsweringParameters",
|
| 817 |
+
"REPO_TYPE_DATASET",
|
| 818 |
+
"REPO_TYPE_MODEL",
|
| 819 |
+
"REPO_TYPE_SPACE",
|
| 820 |
+
"RepoCard",
|
| 821 |
+
"RepoFile",
|
| 822 |
+
"RepoFolder",
|
| 823 |
+
"RepoStorageInfo",
|
| 824 |
+
"RepoUrl",
|
| 825 |
+
"Sandbox",
|
| 826 |
+
"SandboxCommandResult",
|
| 827 |
+
"SandboxPool",
|
| 828 |
+
"SandboxProcess",
|
| 829 |
+
"SentenceSimilarityInput",
|
| 830 |
+
"SentenceSimilarityInputData",
|
| 831 |
+
"SpaceCard",
|
| 832 |
+
"SpaceCardData",
|
| 833 |
+
"SpaceHardware",
|
| 834 |
+
"SpaceInfo",
|
| 835 |
+
"SpaceRuntime",
|
| 836 |
+
"SpaceSearchResult",
|
| 837 |
+
"SpaceSecret",
|
| 838 |
+
"SpaceStage",
|
| 839 |
+
"SpaceStorage",
|
| 840 |
+
"SpaceTemplate",
|
| 841 |
+
"SpaceVariable",
|
| 842 |
+
"StateDictSplit",
|
| 843 |
+
"SummarizationInput",
|
| 844 |
+
"SummarizationOutput",
|
| 845 |
+
"SummarizationParameters",
|
| 846 |
+
"SummarizationTruncationStrategy",
|
| 847 |
+
"SyncOperation",
|
| 848 |
+
"SyncPlan",
|
| 849 |
+
"TF2_WEIGHTS_NAME",
|
| 850 |
+
"TF_WEIGHTS_NAME",
|
| 851 |
+
"TableQuestionAnsweringInput",
|
| 852 |
+
"TableQuestionAnsweringInputData",
|
| 853 |
+
"TableQuestionAnsweringOutputElement",
|
| 854 |
+
"TableQuestionAnsweringParameters",
|
| 855 |
+
"Text2TextGenerationInput",
|
| 856 |
+
"Text2TextGenerationOutput",
|
| 857 |
+
"Text2TextGenerationParameters",
|
| 858 |
+
"Text2TextGenerationTruncationStrategy",
|
| 859 |
+
"TextClassificationInput",
|
| 860 |
+
"TextClassificationOutputElement",
|
| 861 |
+
"TextClassificationOutputTransform",
|
| 862 |
+
"TextClassificationParameters",
|
| 863 |
+
"TextGenerationInput",
|
| 864 |
+
"TextGenerationInputGenerateParameters",
|
| 865 |
+
"TextGenerationInputGrammarType",
|
| 866 |
+
"TextGenerationOutput",
|
| 867 |
+
"TextGenerationOutputBestOfSequence",
|
| 868 |
+
"TextGenerationOutputDetails",
|
| 869 |
+
"TextGenerationOutputFinishReason",
|
| 870 |
+
"TextGenerationOutputPrefillToken",
|
| 871 |
+
"TextGenerationOutputToken",
|
| 872 |
+
"TextGenerationStreamOutput",
|
| 873 |
+
"TextGenerationStreamOutputStreamDetails",
|
| 874 |
+
"TextGenerationStreamOutputToken",
|
| 875 |
+
"TextToAudioEarlyStoppingEnum",
|
| 876 |
+
"TextToAudioGenerationParameters",
|
| 877 |
+
"TextToAudioInput",
|
| 878 |
+
"TextToAudioOutput",
|
| 879 |
+
"TextToAudioParameters",
|
| 880 |
+
"TextToImageInput",
|
| 881 |
+
"TextToImageOutput",
|
| 882 |
+
"TextToImageParameters",
|
| 883 |
+
"TextToSpeechEarlyStoppingEnum",
|
| 884 |
+
"TextToSpeechGenerationParameters",
|
| 885 |
+
"TextToSpeechInput",
|
| 886 |
+
"TextToSpeechOutput",
|
| 887 |
+
"TextToSpeechParameters",
|
| 888 |
+
"TextToVideoInput",
|
| 889 |
+
"TextToVideoOutput",
|
| 890 |
+
"TextToVideoParameters",
|
| 891 |
+
"TokenClassificationAggregationStrategy",
|
| 892 |
+
"TokenClassificationInput",
|
| 893 |
+
"TokenClassificationOutputElement",
|
| 894 |
+
"TokenClassificationParameters",
|
| 895 |
+
"TranslationInput",
|
| 896 |
+
"TranslationOutput",
|
| 897 |
+
"TranslationParameters",
|
| 898 |
+
"TranslationTruncationStrategy",
|
| 899 |
+
"TypeEnum",
|
| 900 |
+
"User",
|
| 901 |
+
"UserLikes",
|
| 902 |
+
"VideoClassificationInput",
|
| 903 |
+
"VideoClassificationOutputElement",
|
| 904 |
+
"VideoClassificationOutputTransform",
|
| 905 |
+
"VideoClassificationParameters",
|
| 906 |
+
"VisualQuestionAnsweringInput",
|
| 907 |
+
"VisualQuestionAnsweringInputData",
|
| 908 |
+
"VisualQuestionAnsweringOutputElement",
|
| 909 |
+
"VisualQuestionAnsweringParameters",
|
| 910 |
+
"Volume",
|
| 911 |
+
"WebhookInfo",
|
| 912 |
+
"WebhookPayload",
|
| 913 |
+
"WebhookPayloadComment",
|
| 914 |
+
"WebhookPayloadDiscussion",
|
| 915 |
+
"WebhookPayloadDiscussionChanges",
|
| 916 |
+
"WebhookPayloadEvent",
|
| 917 |
+
"WebhookPayloadMovedTo",
|
| 918 |
+
"WebhookPayloadRepo",
|
| 919 |
+
"WebhookPayloadUrl",
|
| 920 |
+
"WebhookPayloadWebhook",
|
| 921 |
+
"WebhookWatchedItem",
|
| 922 |
+
"WebhooksServer",
|
| 923 |
+
"ZeroShotClassificationInput",
|
| 924 |
+
"ZeroShotClassificationOutputElement",
|
| 925 |
+
"ZeroShotClassificationParameters",
|
| 926 |
+
"ZeroShotImageClassificationInput",
|
| 927 |
+
"ZeroShotImageClassificationOutputElement",
|
| 928 |
+
"ZeroShotImageClassificationParameters",
|
| 929 |
+
"ZeroShotObjectDetectionBoundingBox",
|
| 930 |
+
"ZeroShotObjectDetectionInput",
|
| 931 |
+
"ZeroShotObjectDetectionOutputElement",
|
| 932 |
+
"ZeroShotObjectDetectionParameters",
|
| 933 |
+
"_CACHED_NO_EXIST",
|
| 934 |
+
"_save_pretrained_fastai",
|
| 935 |
+
"accept_access_request",
|
| 936 |
+
"add_collection_item",
|
| 937 |
+
"add_space_secret",
|
| 938 |
+
"add_space_variable",
|
| 939 |
+
"attach_huggingface_oauth",
|
| 940 |
+
"auth_check",
|
| 941 |
+
"auth_list",
|
| 942 |
+
"auth_switch",
|
| 943 |
+
"batch_bucket_files",
|
| 944 |
+
"bucket_info",
|
| 945 |
+
"cached_assets_path",
|
| 946 |
+
"cancel_access_request",
|
| 947 |
+
"cancel_job",
|
| 948 |
+
"change_discussion_status",
|
| 949 |
+
"check_cli_update",
|
| 950 |
+
"close_session",
|
| 951 |
+
"comment_discussion",
|
| 952 |
+
"copy_files",
|
| 953 |
+
"create_branch",
|
| 954 |
+
"create_bucket",
|
| 955 |
+
"create_collection",
|
| 956 |
+
"create_commit",
|
| 957 |
+
"create_discussion",
|
| 958 |
+
"create_inference_endpoint",
|
| 959 |
+
"create_inference_endpoint_from_catalog",
|
| 960 |
+
"create_pull_request",
|
| 961 |
+
"create_repo",
|
| 962 |
+
"create_scheduled_job",
|
| 963 |
+
"create_scheduled_uv_job",
|
| 964 |
+
"create_tag",
|
| 965 |
+
"create_webhook",
|
| 966 |
+
"dataset_info",
|
| 967 |
+
"delete_branch",
|
| 968 |
+
"delete_bucket",
|
| 969 |
+
"delete_collection",
|
| 970 |
+
"delete_collection_item",
|
| 971 |
+
"delete_file",
|
| 972 |
+
"delete_folder",
|
| 973 |
+
"delete_inference_endpoint",
|
| 974 |
+
"delete_repo",
|
| 975 |
+
"delete_scheduled_job",
|
| 976 |
+
"delete_space_secret",
|
| 977 |
+
"delete_space_storage",
|
| 978 |
+
"delete_space_variable",
|
| 979 |
+
"delete_space_volumes",
|
| 980 |
+
"delete_tag",
|
| 981 |
+
"delete_webhook",
|
| 982 |
+
"disable_space_dev_mode",
|
| 983 |
+
"disable_webhook",
|
| 984 |
+
"download_bucket_files",
|
| 985 |
+
"dump_environment_info",
|
| 986 |
+
"duplicate_repo",
|
| 987 |
+
"duplicate_space",
|
| 988 |
+
"edit_discussion_comment",
|
| 989 |
+
"enable_space_dev_mode",
|
| 990 |
+
"enable_webhook",
|
| 991 |
+
"eval_result_entries_to_yaml",
|
| 992 |
+
"export_entries_as_dduf",
|
| 993 |
+
"export_folder_as_dduf",
|
| 994 |
+
"fetch_job_logs",
|
| 995 |
+
"fetch_job_metrics",
|
| 996 |
+
"fetch_space_logs",
|
| 997 |
+
"file_exists",
|
| 998 |
+
"from_pretrained_fastai",
|
| 999 |
+
"get_async_session",
|
| 1000 |
+
"get_bucket_file_metadata",
|
| 1001 |
+
"get_bucket_paths_info",
|
| 1002 |
+
"get_cached_repo_tree",
|
| 1003 |
+
"get_collection",
|
| 1004 |
+
"get_dataset_leaderboard",
|
| 1005 |
+
"get_dataset_tags",
|
| 1006 |
+
"get_discussion_details",
|
| 1007 |
+
"get_full_repo_name",
|
| 1008 |
+
"get_hf_file_metadata",
|
| 1009 |
+
"get_inference_endpoint",
|
| 1010 |
+
"get_local_safetensors_metadata",
|
| 1011 |
+
"get_model_tags",
|
| 1012 |
+
"get_organization_overview",
|
| 1013 |
+
"get_paths_info",
|
| 1014 |
+
"get_repo_discussions",
|
| 1015 |
+
"get_safetensors_metadata",
|
| 1016 |
+
"get_session",
|
| 1017 |
+
"get_space_runtime",
|
| 1018 |
+
"get_space_secrets",
|
| 1019 |
+
"get_space_variables",
|
| 1020 |
+
"get_token",
|
| 1021 |
+
"get_torch_storage_id",
|
| 1022 |
+
"get_torch_storage_size",
|
| 1023 |
+
"get_user_overview",
|
| 1024 |
+
"get_webhook",
|
| 1025 |
+
"grant_access",
|
| 1026 |
+
"hf_hub_download",
|
| 1027 |
+
"hf_hub_url",
|
| 1028 |
+
"hf_raise_for_status",
|
| 1029 |
+
"hffs",
|
| 1030 |
+
"inspect_job",
|
| 1031 |
+
"inspect_scheduled_job",
|
| 1032 |
+
"interpreter_login",
|
| 1033 |
+
"is_offline_mode",
|
| 1034 |
+
"kernel_info",
|
| 1035 |
+
"list_accepted_access_requests",
|
| 1036 |
+
"list_bucket_tree",
|
| 1037 |
+
"list_buckets",
|
| 1038 |
+
"list_collections",
|
| 1039 |
+
"list_daily_papers",
|
| 1040 |
+
"list_dataset_parquet_files",
|
| 1041 |
+
"list_datasets",
|
| 1042 |
+
"list_inference_catalog",
|
| 1043 |
+
"list_inference_endpoints",
|
| 1044 |
+
"list_jobs",
|
| 1045 |
+
"list_jobs_hardware",
|
| 1046 |
+
"list_lfs_files",
|
| 1047 |
+
"list_liked_repos",
|
| 1048 |
+
"list_models",
|
| 1049 |
+
"list_organization_followers",
|
| 1050 |
+
"list_organization_members",
|
| 1051 |
+
"list_papers",
|
| 1052 |
+
"list_pending_access_requests",
|
| 1053 |
+
"list_rejected_access_requests",
|
| 1054 |
+
"list_repo_commits",
|
| 1055 |
+
"list_repo_files",
|
| 1056 |
+
"list_repo_likers",
|
| 1057 |
+
"list_repo_refs",
|
| 1058 |
+
"list_repo_tree",
|
| 1059 |
+
"list_space_templates",
|
| 1060 |
+
"list_spaces",
|
| 1061 |
+
"list_spaces_hardware",
|
| 1062 |
+
"list_user_followers",
|
| 1063 |
+
"list_user_following",
|
| 1064 |
+
"list_user_repos",
|
| 1065 |
+
"list_webhooks",
|
| 1066 |
+
"load_state_dict_from_file",
|
| 1067 |
+
"load_torch_model",
|
| 1068 |
+
"logging",
|
| 1069 |
+
"login",
|
| 1070 |
+
"logout",
|
| 1071 |
+
"merge_pull_request",
|
| 1072 |
+
"metadata_eval_result",
|
| 1073 |
+
"metadata_load",
|
| 1074 |
+
"metadata_save",
|
| 1075 |
+
"metadata_update",
|
| 1076 |
+
"model_info",
|
| 1077 |
+
"move_bucket",
|
| 1078 |
+
"move_repo",
|
| 1079 |
+
"notebook_login",
|
| 1080 |
+
"paper_info",
|
| 1081 |
+
"parse_eval_result_entries",
|
| 1082 |
+
"parse_hf_uri",
|
| 1083 |
+
"parse_huggingface_oauth",
|
| 1084 |
+
"parse_local_safetensors_file_metadata",
|
| 1085 |
+
"parse_safetensors_file_metadata",
|
| 1086 |
+
"pause_inference_endpoint",
|
| 1087 |
+
"pause_space",
|
| 1088 |
+
"permanently_delete_lfs_files",
|
| 1089 |
+
"preupload_lfs_files",
|
| 1090 |
+
"push_to_hub_fastai",
|
| 1091 |
+
"read_dduf_file",
|
| 1092 |
+
"read_paper",
|
| 1093 |
+
"reject_access_request",
|
| 1094 |
+
"rename_discussion",
|
| 1095 |
+
"repo_exists",
|
| 1096 |
+
"repo_info",
|
| 1097 |
+
"repo_type_and_id_from_hf_id",
|
| 1098 |
+
"request_space_hardware",
|
| 1099 |
+
"request_space_storage",
|
| 1100 |
+
"restart_space",
|
| 1101 |
+
"resume_inference_endpoint",
|
| 1102 |
+
"resume_scheduled_job",
|
| 1103 |
+
"revision_exists",
|
| 1104 |
+
"run_as_future",
|
| 1105 |
+
"run_job",
|
| 1106 |
+
"run_uv_job",
|
| 1107 |
+
"save_torch_model",
|
| 1108 |
+
"save_torch_state_dict",
|
| 1109 |
+
"scale_to_zero_inference_endpoint",
|
| 1110 |
+
"scan_cache_dir",
|
| 1111 |
+
"search_spaces",
|
| 1112 |
+
"set_async_client_factory",
|
| 1113 |
+
"set_client_factory",
|
| 1114 |
+
"set_space_sleep_time",
|
| 1115 |
+
"set_space_volumes",
|
| 1116 |
+
"snapshot_download",
|
| 1117 |
+
"space_info",
|
| 1118 |
+
"split_state_dict_into_shards_factory",
|
| 1119 |
+
"split_torch_state_dict_into_shards",
|
| 1120 |
+
"super_squash_history",
|
| 1121 |
+
"suspend_scheduled_job",
|
| 1122 |
+
"sync_bucket",
|
| 1123 |
+
"sync_job_volume",
|
| 1124 |
+
"trigger_scheduled_job",
|
| 1125 |
+
"try_to_load_from_cache",
|
| 1126 |
+
"typer_factory",
|
| 1127 |
+
"unlike",
|
| 1128 |
+
"update_collection_item",
|
| 1129 |
+
"update_collection_metadata",
|
| 1130 |
+
"update_inference_endpoint",
|
| 1131 |
+
"update_job_labels",
|
| 1132 |
+
"update_repo_settings",
|
| 1133 |
+
"update_scheduled_job_labels",
|
| 1134 |
+
"update_webhook",
|
| 1135 |
+
"upload_file",
|
| 1136 |
+
"upload_folder",
|
| 1137 |
+
"upload_large_folder",
|
| 1138 |
+
"verify_repo_checksums",
|
| 1139 |
+
"wait_for_job",
|
| 1140 |
+
"wait_for_space",
|
| 1141 |
+
"webhook_endpoint",
|
| 1142 |
+
"whoami",
|
| 1143 |
+
]
|
| 1144 |
+
|
| 1145 |
+
|
| 1146 |
+
def _attach(package_name, submodules=None, submod_attrs=None):
|
| 1147 |
+
"""Attach lazily loaded submodules, functions, or other attributes.
|
| 1148 |
+
|
| 1149 |
+
Typically, modules import submodules and attributes as follows:
|
| 1150 |
+
|
| 1151 |
+
```py
|
| 1152 |
+
import mysubmodule
|
| 1153 |
+
import anothersubmodule
|
| 1154 |
+
|
| 1155 |
+
from .foo import someattr
|
| 1156 |
+
```
|
| 1157 |
+
|
| 1158 |
+
The idea is to replace a package's `__getattr__`, `__dir__`, such that all imports
|
| 1159 |
+
work exactly the way they would with normal imports, except that the import occurs
|
| 1160 |
+
upon first use.
|
| 1161 |
+
|
| 1162 |
+
The typical way to call this function, replacing the above imports, is:
|
| 1163 |
+
|
| 1164 |
+
```python
|
| 1165 |
+
__getattr__, __dir__ = lazy.attach(
|
| 1166 |
+
__name__,
|
| 1167 |
+
['mysubmodule', 'anothersubmodule'],
|
| 1168 |
+
{'foo': ['someattr']}
|
| 1169 |
+
)
|
| 1170 |
+
```
|
| 1171 |
+
This functionality requires Python 3.7 or higher.
|
| 1172 |
+
|
| 1173 |
+
Args:
|
| 1174 |
+
package_name (`str`):
|
| 1175 |
+
Typically use `__name__`.
|
| 1176 |
+
submodules (`set`):
|
| 1177 |
+
List of submodules to attach.
|
| 1178 |
+
submod_attrs (`dict`):
|
| 1179 |
+
Dictionary of submodule -> list of attributes / functions.
|
| 1180 |
+
These attributes are imported as they are used.
|
| 1181 |
+
|
| 1182 |
+
Returns:
|
| 1183 |
+
__getattr__, __dir__, __all__
|
| 1184 |
+
|
| 1185 |
+
"""
|
| 1186 |
+
if submod_attrs is None:
|
| 1187 |
+
submod_attrs = {}
|
| 1188 |
+
|
| 1189 |
+
if submodules is None:
|
| 1190 |
+
submodules = set()
|
| 1191 |
+
else:
|
| 1192 |
+
submodules = set(submodules)
|
| 1193 |
+
|
| 1194 |
+
attr_to_modules = {attr: mod for mod, attrs in submod_attrs.items() for attr in attrs}
|
| 1195 |
+
|
| 1196 |
+
def __getattr__(name):
|
| 1197 |
+
if name in submodules:
|
| 1198 |
+
try:
|
| 1199 |
+
return importlib.import_module(f"{package_name}.{name}")
|
| 1200 |
+
except Exception as e:
|
| 1201 |
+
print(f"Error importing {package_name}.{name}: {e}")
|
| 1202 |
+
raise
|
| 1203 |
+
elif name in attr_to_modules:
|
| 1204 |
+
submod_path = f"{package_name}.{attr_to_modules[name]}"
|
| 1205 |
+
try:
|
| 1206 |
+
submod = importlib.import_module(submod_path)
|
| 1207 |
+
except Exception as e:
|
| 1208 |
+
print(f"Error importing {submod_path}: {e}")
|
| 1209 |
+
raise
|
| 1210 |
+
attr = getattr(submod, name)
|
| 1211 |
+
|
| 1212 |
+
# If the attribute lives in a file (module) with the same
|
| 1213 |
+
# name as the attribute, ensure that the attribute and *not*
|
| 1214 |
+
# the module is accessible on the package.
|
| 1215 |
+
if name == attr_to_modules[name]:
|
| 1216 |
+
pkg = sys.modules[package_name]
|
| 1217 |
+
pkg.__dict__[name] = attr
|
| 1218 |
+
|
| 1219 |
+
return attr
|
| 1220 |
+
else:
|
| 1221 |
+
raise AttributeError(f"No {package_name} attribute {name}")
|
| 1222 |
+
|
| 1223 |
+
def __dir__():
|
| 1224 |
+
return __all__
|
| 1225 |
+
|
| 1226 |
+
return __getattr__, __dir__
|
| 1227 |
+
|
| 1228 |
+
|
| 1229 |
+
__getattr__, __dir__ = _attach(__name__, submodules=[], submod_attrs=_SUBMOD_ATTRS)
|
| 1230 |
+
|
| 1231 |
+
if os.environ.get("EAGER_IMPORT", ""):
|
| 1232 |
+
for attr in __all__:
|
| 1233 |
+
__getattr__(attr)
|
| 1234 |
+
|
| 1235 |
+
# WARNING: any content below this statement is generated automatically. Any manual edit
|
| 1236 |
+
# will be lost when re-generating this file !
|
| 1237 |
+
#
|
| 1238 |
+
# To update the static imports, please run the following command and commit the changes.
|
| 1239 |
+
# ```
|
| 1240 |
+
# # Use script
|
| 1241 |
+
# python utils/check_static_imports.py --update
|
| 1242 |
+
#
|
| 1243 |
+
# # Or run style on codebase
|
| 1244 |
+
# make style
|
| 1245 |
+
# ```
|
| 1246 |
+
if TYPE_CHECKING: # pragma: no cover
|
| 1247 |
+
from ._buckets import (
|
| 1248 |
+
BucketFile, # noqa: F401
|
| 1249 |
+
BucketFileMetadata, # noqa: F401
|
| 1250 |
+
BucketFolder, # noqa: F401
|
| 1251 |
+
BucketInfo, # noqa: F401
|
| 1252 |
+
BucketUrl, # noqa: F401
|
| 1253 |
+
SyncOperation, # noqa: F401
|
| 1254 |
+
SyncPlan, # noqa: F401
|
| 1255 |
+
)
|
| 1256 |
+
from ._commit_scheduler import CommitScheduler # noqa: F401
|
| 1257 |
+
from ._eval_results import (
|
| 1258 |
+
EvalResultEntry, # noqa: F401
|
| 1259 |
+
eval_result_entries_to_yaml, # noqa: F401
|
| 1260 |
+
parse_eval_result_entries, # noqa: F401
|
| 1261 |
+
)
|
| 1262 |
+
from ._inference_endpoints import (
|
| 1263 |
+
InferenceEndpoint, # noqa: F401
|
| 1264 |
+
InferenceEndpointError, # noqa: F401
|
| 1265 |
+
InferenceEndpointStatus, # noqa: F401
|
| 1266 |
+
InferenceEndpointTimeoutError, # noqa: F401
|
| 1267 |
+
InferenceEndpointType, # noqa: F401
|
| 1268 |
+
)
|
| 1269 |
+
from ._jobs_api import (
|
| 1270 |
+
JobAccelerator, # noqa: F401
|
| 1271 |
+
JobDurations, # noqa: F401
|
| 1272 |
+
JobHardware, # noqa: F401
|
| 1273 |
+
JobHardwareInfo, # noqa: F401
|
| 1274 |
+
JobInfo, # noqa: F401
|
| 1275 |
+
JobInitiator, # noqa: F401
|
| 1276 |
+
JobOwner, # noqa: F401
|
| 1277 |
+
JobStage, # noqa: F401
|
| 1278 |
+
JobStatus, # noqa: F401
|
| 1279 |
+
)
|
| 1280 |
+
from ._login import (
|
| 1281 |
+
auth_list, # noqa: F401
|
| 1282 |
+
auth_switch, # noqa: F401
|
| 1283 |
+
interpreter_login, # noqa: F401
|
| 1284 |
+
login, # noqa: F401
|
| 1285 |
+
logout, # noqa: F401
|
| 1286 |
+
notebook_login, # noqa: F401
|
| 1287 |
+
)
|
| 1288 |
+
from ._oauth import (
|
| 1289 |
+
OAuthInfo, # noqa: F401
|
| 1290 |
+
OAuthOrgInfo, # noqa: F401
|
| 1291 |
+
OAuthUserInfo, # noqa: F401
|
| 1292 |
+
attach_huggingface_oauth, # noqa: F401
|
| 1293 |
+
parse_huggingface_oauth, # noqa: F401
|
| 1294 |
+
)
|
| 1295 |
+
from ._sandbox import (
|
| 1296 |
+
Sandbox, # noqa: F401
|
| 1297 |
+
SandboxCommandResult, # noqa: F401
|
| 1298 |
+
SandboxPool, # noqa: F401
|
| 1299 |
+
SandboxProcess, # noqa: F401
|
| 1300 |
+
)
|
| 1301 |
+
from ._snapshot_download import (
|
| 1302 |
+
get_cached_repo_tree, # noqa: F401
|
| 1303 |
+
snapshot_download, # noqa: F401
|
| 1304 |
+
)
|
| 1305 |
+
from ._space_api import (
|
| 1306 |
+
SpaceHardware, # noqa: F401
|
| 1307 |
+
SpaceRuntime, # noqa: F401
|
| 1308 |
+
SpaceSecret, # noqa: F401
|
| 1309 |
+
SpaceStage, # noqa: F401
|
| 1310 |
+
SpaceStorage, # noqa: F401
|
| 1311 |
+
SpaceVariable, # noqa: F401
|
| 1312 |
+
Volume, # noqa: F401
|
| 1313 |
+
)
|
| 1314 |
+
from ._tensorboard_logger import HFSummaryWriter # noqa: F401
|
| 1315 |
+
from ._webhooks_payload import (
|
| 1316 |
+
WebhookPayload, # noqa: F401
|
| 1317 |
+
WebhookPayloadComment, # noqa: F401
|
| 1318 |
+
WebhookPayloadDiscussion, # noqa: F401
|
| 1319 |
+
WebhookPayloadDiscussionChanges, # noqa: F401
|
| 1320 |
+
WebhookPayloadEvent, # noqa: F401
|
| 1321 |
+
WebhookPayloadMovedTo, # noqa: F401
|
| 1322 |
+
WebhookPayloadRepo, # noqa: F401
|
| 1323 |
+
WebhookPayloadUrl, # noqa: F401
|
| 1324 |
+
WebhookPayloadWebhook, # noqa: F401
|
| 1325 |
+
)
|
| 1326 |
+
from ._webhooks_server import (
|
| 1327 |
+
WebhooksServer, # noqa: F401
|
| 1328 |
+
webhook_endpoint, # noqa: F401
|
| 1329 |
+
)
|
| 1330 |
+
from .cli._cli_utils import (
|
| 1331 |
+
check_cli_update, # noqa: F401
|
| 1332 |
+
typer_factory, # noqa: F401
|
| 1333 |
+
)
|
| 1334 |
+
from .community import (
|
| 1335 |
+
Discussion, # noqa: F401
|
| 1336 |
+
DiscussionComment, # noqa: F401
|
| 1337 |
+
DiscussionCommit, # noqa: F401
|
| 1338 |
+
DiscussionEvent, # noqa: F401
|
| 1339 |
+
DiscussionStatusChange, # noqa: F401
|
| 1340 |
+
DiscussionTitleChange, # noqa: F401
|
| 1341 |
+
DiscussionWithDetails, # noqa: F401
|
| 1342 |
+
)
|
| 1343 |
+
from .constants import (
|
| 1344 |
+
CONFIG_NAME, # noqa: F401
|
| 1345 |
+
FLAX_WEIGHTS_NAME, # noqa: F401
|
| 1346 |
+
HUGGINGFACE_CO_URL_HOME, # noqa: F401
|
| 1347 |
+
HUGGINGFACE_CO_URL_TEMPLATE, # noqa: F401
|
| 1348 |
+
PYTORCH_WEIGHTS_NAME, # noqa: F401
|
| 1349 |
+
REPO_TYPE_DATASET, # noqa: F401
|
| 1350 |
+
REPO_TYPE_MODEL, # noqa: F401
|
| 1351 |
+
REPO_TYPE_SPACE, # noqa: F401
|
| 1352 |
+
TF2_WEIGHTS_NAME, # noqa: F401
|
| 1353 |
+
TF_WEIGHTS_NAME, # noqa: F401
|
| 1354 |
+
is_offline_mode, # noqa: F401
|
| 1355 |
+
)
|
| 1356 |
+
from .fastai_utils import (
|
| 1357 |
+
_save_pretrained_fastai, # noqa: F401
|
| 1358 |
+
from_pretrained_fastai, # noqa: F401
|
| 1359 |
+
push_to_hub_fastai, # noqa: F401
|
| 1360 |
+
)
|
| 1361 |
+
from .file_download import (
|
| 1362 |
+
_CACHED_NO_EXIST, # noqa: F401
|
| 1363 |
+
DryRunFileInfo, # noqa: F401
|
| 1364 |
+
HfFileMetadata, # noqa: F401
|
| 1365 |
+
get_hf_file_metadata, # noqa: F401
|
| 1366 |
+
hf_hub_download, # noqa: F401
|
| 1367 |
+
hf_hub_url, # noqa: F401
|
| 1368 |
+
try_to_load_from_cache, # noqa: F401
|
| 1369 |
+
)
|
| 1370 |
+
from .hf_api import (
|
| 1371 |
+
Collection, # noqa: F401
|
| 1372 |
+
CollectionItem, # noqa: F401
|
| 1373 |
+
CommitInfo, # noqa: F401
|
| 1374 |
+
CommitOperation, # noqa: F401
|
| 1375 |
+
CommitOperationAdd, # noqa: F401
|
| 1376 |
+
CommitOperationCopy, # noqa: F401
|
| 1377 |
+
CommitOperationDelete, # noqa: F401
|
| 1378 |
+
DatasetInfo, # noqa: F401
|
| 1379 |
+
DatasetLeaderboardEntry, # noqa: F401
|
| 1380 |
+
GitCommitInfo, # noqa: F401
|
| 1381 |
+
GitRefInfo, # noqa: F401
|
| 1382 |
+
GitRefs, # noqa: F401
|
| 1383 |
+
HfApi, # noqa: F401
|
| 1384 |
+
KernelInfo, # noqa: F401
|
| 1385 |
+
ModelInfo, # noqa: F401
|
| 1386 |
+
Organization, # noqa: F401
|
| 1387 |
+
RepoFile, # noqa: F401
|
| 1388 |
+
RepoFolder, # noqa: F401
|
| 1389 |
+
RepoStorageInfo, # noqa: F401
|
| 1390 |
+
RepoUrl, # noqa: F401
|
| 1391 |
+
SpaceInfo, # noqa: F401
|
| 1392 |
+
SpaceSearchResult, # noqa: F401
|
| 1393 |
+
SpaceTemplate, # noqa: F401
|
| 1394 |
+
User, # noqa: F401
|
| 1395 |
+
UserLikes, # noqa: F401
|
| 1396 |
+
WebhookInfo, # noqa: F401
|
| 1397 |
+
WebhookWatchedItem, # noqa: F401
|
| 1398 |
+
accept_access_request, # noqa: F401
|
| 1399 |
+
add_collection_item, # noqa: F401
|
| 1400 |
+
add_space_secret, # noqa: F401
|
| 1401 |
+
add_space_variable, # noqa: F401
|
| 1402 |
+
auth_check, # noqa: F401
|
| 1403 |
+
batch_bucket_files, # noqa: F401
|
| 1404 |
+
bucket_info, # noqa: F401
|
| 1405 |
+
cancel_access_request, # noqa: F401
|
| 1406 |
+
cancel_job, # noqa: F401
|
| 1407 |
+
change_discussion_status, # noqa: F401
|
| 1408 |
+
comment_discussion, # noqa: F401
|
| 1409 |
+
copy_files, # noqa: F401
|
| 1410 |
+
create_branch, # noqa: F401
|
| 1411 |
+
create_bucket, # noqa: F401
|
| 1412 |
+
create_collection, # noqa: F401
|
| 1413 |
+
create_commit, # noqa: F401
|
| 1414 |
+
create_discussion, # noqa: F401
|
| 1415 |
+
create_inference_endpoint, # noqa: F401
|
| 1416 |
+
create_inference_endpoint_from_catalog, # noqa: F401
|
| 1417 |
+
create_pull_request, # noqa: F401
|
| 1418 |
+
create_repo, # noqa: F401
|
| 1419 |
+
create_scheduled_job, # noqa: F401
|
| 1420 |
+
create_scheduled_uv_job, # noqa: F401
|
| 1421 |
+
create_tag, # noqa: F401
|
| 1422 |
+
create_webhook, # noqa: F401
|
| 1423 |
+
dataset_info, # noqa: F401
|
| 1424 |
+
delete_branch, # noqa: F401
|
| 1425 |
+
delete_bucket, # noqa: F401
|
| 1426 |
+
delete_collection, # noqa: F401
|
| 1427 |
+
delete_collection_item, # noqa: F401
|
| 1428 |
+
delete_file, # noqa: F401
|
| 1429 |
+
delete_folder, # noqa: F401
|
| 1430 |
+
delete_inference_endpoint, # noqa: F401
|
| 1431 |
+
delete_repo, # noqa: F401
|
| 1432 |
+
delete_scheduled_job, # noqa: F401
|
| 1433 |
+
delete_space_secret, # noqa: F401
|
| 1434 |
+
delete_space_storage, # noqa: F401
|
| 1435 |
+
delete_space_variable, # noqa: F401
|
| 1436 |
+
delete_space_volumes, # noqa: F401
|
| 1437 |
+
delete_tag, # noqa: F401
|
| 1438 |
+
delete_webhook, # noqa: F401
|
| 1439 |
+
disable_space_dev_mode, # noqa: F401
|
| 1440 |
+
disable_webhook, # noqa: F401
|
| 1441 |
+
download_bucket_files, # noqa: F401
|
| 1442 |
+
duplicate_repo, # noqa: F401
|
| 1443 |
+
duplicate_space, # noqa: F401
|
| 1444 |
+
edit_discussion_comment, # noqa: F401
|
| 1445 |
+
enable_space_dev_mode, # noqa: F401
|
| 1446 |
+
enable_webhook, # noqa: F401
|
| 1447 |
+
fetch_job_logs, # noqa: F401
|
| 1448 |
+
fetch_job_metrics, # noqa: F401
|
| 1449 |
+
fetch_space_logs, # noqa: F401
|
| 1450 |
+
file_exists, # noqa: F401
|
| 1451 |
+
get_bucket_file_metadata, # noqa: F401
|
| 1452 |
+
get_bucket_paths_info, # noqa: F401
|
| 1453 |
+
get_collection, # noqa: F401
|
| 1454 |
+
get_dataset_leaderboard, # noqa: F401
|
| 1455 |
+
get_dataset_tags, # noqa: F401
|
| 1456 |
+
get_discussion_details, # noqa: F401
|
| 1457 |
+
get_full_repo_name, # noqa: F401
|
| 1458 |
+
get_inference_endpoint, # noqa: F401
|
| 1459 |
+
get_local_safetensors_metadata, # noqa: F401
|
| 1460 |
+
get_model_tags, # noqa: F401
|
| 1461 |
+
get_organization_overview, # noqa: F401
|
| 1462 |
+
get_paths_info, # noqa: F401
|
| 1463 |
+
get_repo_discussions, # noqa: F401
|
| 1464 |
+
get_safetensors_metadata, # noqa: F401
|
| 1465 |
+
get_space_runtime, # noqa: F401
|
| 1466 |
+
get_space_secrets, # noqa: F401
|
| 1467 |
+
get_space_variables, # noqa: F401
|
| 1468 |
+
get_user_overview, # noqa: F401
|
| 1469 |
+
get_webhook, # noqa: F401
|
| 1470 |
+
grant_access, # noqa: F401
|
| 1471 |
+
inspect_job, # noqa: F401
|
| 1472 |
+
inspect_scheduled_job, # noqa: F401
|
| 1473 |
+
kernel_info, # noqa: F401
|
| 1474 |
+
list_accepted_access_requests, # noqa: F401
|
| 1475 |
+
list_bucket_tree, # noqa: F401
|
| 1476 |
+
list_buckets, # noqa: F401
|
| 1477 |
+
list_collections, # noqa: F401
|
| 1478 |
+
list_daily_papers, # noqa: F401
|
| 1479 |
+
list_dataset_parquet_files, # noqa: F401
|
| 1480 |
+
list_datasets, # noqa: F401
|
| 1481 |
+
list_inference_catalog, # noqa: F401
|
| 1482 |
+
list_inference_endpoints, # noqa: F401
|
| 1483 |
+
list_jobs, # noqa: F401
|
| 1484 |
+
list_jobs_hardware, # noqa: F401
|
| 1485 |
+
list_lfs_files, # noqa: F401
|
| 1486 |
+
list_liked_repos, # noqa: F401
|
| 1487 |
+
list_models, # noqa: F401
|
| 1488 |
+
list_organization_followers, # noqa: F401
|
| 1489 |
+
list_organization_members, # noqa: F401
|
| 1490 |
+
list_papers, # noqa: F401
|
| 1491 |
+
list_pending_access_requests, # noqa: F401
|
| 1492 |
+
list_rejected_access_requests, # noqa: F401
|
| 1493 |
+
list_repo_commits, # noqa: F401
|
| 1494 |
+
list_repo_files, # noqa: F401
|
| 1495 |
+
list_repo_likers, # noqa: F401
|
| 1496 |
+
list_repo_refs, # noqa: F401
|
| 1497 |
+
list_repo_tree, # noqa: F401
|
| 1498 |
+
list_space_templates, # noqa: F401
|
| 1499 |
+
list_spaces, # noqa: F401
|
| 1500 |
+
list_spaces_hardware, # noqa: F401
|
| 1501 |
+
list_user_followers, # noqa: F401
|
| 1502 |
+
list_user_following, # noqa: F401
|
| 1503 |
+
list_user_repos, # noqa: F401
|
| 1504 |
+
list_webhooks, # noqa: F401
|
| 1505 |
+
merge_pull_request, # noqa: F401
|
| 1506 |
+
model_info, # noqa: F401
|
| 1507 |
+
move_bucket, # noqa: F401
|
| 1508 |
+
move_repo, # noqa: F401
|
| 1509 |
+
paper_info, # noqa: F401
|
| 1510 |
+
parse_local_safetensors_file_metadata, # noqa: F401
|
| 1511 |
+
parse_safetensors_file_metadata, # noqa: F401
|
| 1512 |
+
pause_inference_endpoint, # noqa: F401
|
| 1513 |
+
pause_space, # noqa: F401
|
| 1514 |
+
permanently_delete_lfs_files, # noqa: F401
|
| 1515 |
+
preupload_lfs_files, # noqa: F401
|
| 1516 |
+
read_paper, # noqa: F401
|
| 1517 |
+
reject_access_request, # noqa: F401
|
| 1518 |
+
rename_discussion, # noqa: F401
|
| 1519 |
+
repo_exists, # noqa: F401
|
| 1520 |
+
repo_info, # noqa: F401
|
| 1521 |
+
repo_type_and_id_from_hf_id, # noqa: F401
|
| 1522 |
+
request_space_hardware, # noqa: F401
|
| 1523 |
+
request_space_storage, # noqa: F401
|
| 1524 |
+
restart_space, # noqa: F401
|
| 1525 |
+
resume_inference_endpoint, # noqa: F401
|
| 1526 |
+
resume_scheduled_job, # noqa: F401
|
| 1527 |
+
revision_exists, # noqa: F401
|
| 1528 |
+
run_as_future, # noqa: F401
|
| 1529 |
+
run_job, # noqa: F401
|
| 1530 |
+
run_uv_job, # noqa: F401
|
| 1531 |
+
scale_to_zero_inference_endpoint, # noqa: F401
|
| 1532 |
+
search_spaces, # noqa: F401
|
| 1533 |
+
set_space_sleep_time, # noqa: F401
|
| 1534 |
+
set_space_volumes, # noqa: F401
|
| 1535 |
+
space_info, # noqa: F401
|
| 1536 |
+
super_squash_history, # noqa: F401
|
| 1537 |
+
suspend_scheduled_job, # noqa: F401
|
| 1538 |
+
sync_bucket, # noqa: F401
|
| 1539 |
+
sync_job_volume, # noqa: F401
|
| 1540 |
+
trigger_scheduled_job, # noqa: F401
|
| 1541 |
+
unlike, # noqa: F401
|
| 1542 |
+
update_collection_item, # noqa: F401
|
| 1543 |
+
update_collection_metadata, # noqa: F401
|
| 1544 |
+
update_inference_endpoint, # noqa: F401
|
| 1545 |
+
update_job_labels, # noqa: F401
|
| 1546 |
+
update_repo_settings, # noqa: F401
|
| 1547 |
+
update_scheduled_job_labels, # noqa: F401
|
| 1548 |
+
update_webhook, # noqa: F401
|
| 1549 |
+
upload_file, # noqa: F401
|
| 1550 |
+
upload_folder, # noqa: F401
|
| 1551 |
+
upload_large_folder, # noqa: F401
|
| 1552 |
+
verify_repo_checksums, # noqa: F401
|
| 1553 |
+
wait_for_job, # noqa: F401
|
| 1554 |
+
wait_for_space, # noqa: F401
|
| 1555 |
+
whoami, # noqa: F401
|
| 1556 |
+
)
|
| 1557 |
+
from .hf_file_system import (
|
| 1558 |
+
HfFileSystem, # noqa: F401
|
| 1559 |
+
HfFileSystemFile, # noqa: F401
|
| 1560 |
+
HfFileSystemResolvedPath, # noqa: F401
|
| 1561 |
+
HfFileSystemStreamFile, # noqa: F401
|
| 1562 |
+
hffs, # noqa: F401
|
| 1563 |
+
)
|
| 1564 |
+
from .hub_mixin import (
|
| 1565 |
+
ModelHubMixin, # noqa: F401
|
| 1566 |
+
PyTorchModelHubMixin, # noqa: F401
|
| 1567 |
+
)
|
| 1568 |
+
from .inference._client import (
|
| 1569 |
+
InferenceClient, # noqa: F401
|
| 1570 |
+
InferenceTimeoutError, # noqa: F401
|
| 1571 |
+
)
|
| 1572 |
+
from .inference._generated._async_client import AsyncInferenceClient # noqa: F401
|
| 1573 |
+
from .inference._generated.types import (
|
| 1574 |
+
AudioClassificationInput, # noqa: F401
|
| 1575 |
+
AudioClassificationOutputElement, # noqa: F401
|
| 1576 |
+
AudioClassificationOutputTransform, # noqa: F401
|
| 1577 |
+
AudioClassificationParameters, # noqa: F401
|
| 1578 |
+
AudioToAudioInput, # noqa: F401
|
| 1579 |
+
AudioToAudioOutputElement, # noqa: F401
|
| 1580 |
+
AutomaticSpeechRecognitionEarlyStoppingEnum, # noqa: F401
|
| 1581 |
+
AutomaticSpeechRecognitionGenerationParameters, # noqa: F401
|
| 1582 |
+
AutomaticSpeechRecognitionInput, # noqa: F401
|
| 1583 |
+
AutomaticSpeechRecognitionOutput, # noqa: F401
|
| 1584 |
+
AutomaticSpeechRecognitionOutputChunk, # noqa: F401
|
| 1585 |
+
AutomaticSpeechRecognitionParameters, # noqa: F401
|
| 1586 |
+
ChatCompletionInput, # noqa: F401
|
| 1587 |
+
ChatCompletionInputFunctionDefinition, # noqa: F401
|
| 1588 |
+
ChatCompletionInputFunctionName, # noqa: F401
|
| 1589 |
+
ChatCompletionInputGrammarType, # noqa: F401
|
| 1590 |
+
ChatCompletionInputJSONSchema, # noqa: F401
|
| 1591 |
+
ChatCompletionInputMessage, # noqa: F401
|
| 1592 |
+
ChatCompletionInputMessageChunk, # noqa: F401
|
| 1593 |
+
ChatCompletionInputMessageChunkType, # noqa: F401
|
| 1594 |
+
ChatCompletionInputResponseFormatJSONObject, # noqa: F401
|
| 1595 |
+
ChatCompletionInputResponseFormatJSONSchema, # noqa: F401
|
| 1596 |
+
ChatCompletionInputResponseFormatText, # noqa: F401
|
| 1597 |
+
ChatCompletionInputStreamOptions, # noqa: F401
|
| 1598 |
+
ChatCompletionInputTool, # noqa: F401
|
| 1599 |
+
ChatCompletionInputToolCall, # noqa: F401
|
| 1600 |
+
ChatCompletionInputToolChoiceClass, # noqa: F401
|
| 1601 |
+
ChatCompletionInputToolChoiceEnum, # noqa: F401
|
| 1602 |
+
ChatCompletionInputURL, # noqa: F401
|
| 1603 |
+
ChatCompletionOutput, # noqa: F401
|
| 1604 |
+
ChatCompletionOutputComplete, # noqa: F401
|
| 1605 |
+
ChatCompletionOutputFunctionDefinition, # noqa: F401
|
| 1606 |
+
ChatCompletionOutputLogprob, # noqa: F401
|
| 1607 |
+
ChatCompletionOutputLogprobs, # noqa: F401
|
| 1608 |
+
ChatCompletionOutputMessage, # noqa: F401
|
| 1609 |
+
ChatCompletionOutputToolCall, # noqa: F401
|
| 1610 |
+
ChatCompletionOutputTopLogprob, # noqa: F401
|
| 1611 |
+
ChatCompletionOutputUsage, # noqa: F401
|
| 1612 |
+
ChatCompletionStreamOutput, # noqa: F401
|
| 1613 |
+
ChatCompletionStreamOutputChoice, # noqa: F401
|
| 1614 |
+
ChatCompletionStreamOutputDelta, # noqa: F401
|
| 1615 |
+
ChatCompletionStreamOutputDeltaToolCall, # noqa: F401
|
| 1616 |
+
ChatCompletionStreamOutputFunction, # noqa: F401
|
| 1617 |
+
ChatCompletionStreamOutputLogprob, # noqa: F401
|
| 1618 |
+
ChatCompletionStreamOutputLogprobs, # noqa: F401
|
| 1619 |
+
ChatCompletionStreamOutputTopLogprob, # noqa: F401
|
| 1620 |
+
ChatCompletionStreamOutputUsage, # noqa: F401
|
| 1621 |
+
DepthEstimationInput, # noqa: F401
|
| 1622 |
+
DepthEstimationOutput, # noqa: F401
|
| 1623 |
+
DocumentQuestionAnsweringInput, # noqa: F401
|
| 1624 |
+
DocumentQuestionAnsweringInputData, # noqa: F401
|
| 1625 |
+
DocumentQuestionAnsweringOutputElement, # noqa: F401
|
| 1626 |
+
DocumentQuestionAnsweringParameters, # noqa: F401
|
| 1627 |
+
FeatureExtractionInput, # noqa: F401
|
| 1628 |
+
FeatureExtractionInputTruncationDirection, # noqa: F401
|
| 1629 |
+
FillMaskInput, # noqa: F401
|
| 1630 |
+
FillMaskOutputElement, # noqa: F401
|
| 1631 |
+
FillMaskParameters, # noqa: F401
|
| 1632 |
+
ImageClassificationInput, # noqa: F401
|
| 1633 |
+
ImageClassificationOutputElement, # noqa: F401
|
| 1634 |
+
ImageClassificationOutputTransform, # noqa: F401
|
| 1635 |
+
ImageClassificationParameters, # noqa: F401
|
| 1636 |
+
ImageSegmentationInput, # noqa: F401
|
| 1637 |
+
ImageSegmentationOutputElement, # noqa: F401
|
| 1638 |
+
ImageSegmentationParameters, # noqa: F401
|
| 1639 |
+
ImageSegmentationSubtask, # noqa: F401
|
| 1640 |
+
ImageTextToImageInput, # noqa: F401
|
| 1641 |
+
ImageTextToImageOutput, # noqa: F401
|
| 1642 |
+
ImageTextToImageParameters, # noqa: F401
|
| 1643 |
+
ImageTextToImageTargetSize, # noqa: F401
|
| 1644 |
+
ImageTextToVideoInput, # noqa: F401
|
| 1645 |
+
ImageTextToVideoOutput, # noqa: F401
|
| 1646 |
+
ImageTextToVideoParameters, # noqa: F401
|
| 1647 |
+
ImageTextToVideoTargetSize, # noqa: F401
|
| 1648 |
+
ImageToImageInput, # noqa: F401
|
| 1649 |
+
ImageToImageOutput, # noqa: F401
|
| 1650 |
+
ImageToImageParameters, # noqa: F401
|
| 1651 |
+
ImageToImageTargetSize, # noqa: F401
|
| 1652 |
+
ImageToTextEarlyStoppingEnum, # noqa: F401
|
| 1653 |
+
ImageToTextGenerationParameters, # noqa: F401
|
| 1654 |
+
ImageToTextInput, # noqa: F401
|
| 1655 |
+
ImageToTextOutput, # noqa: F401
|
| 1656 |
+
ImageToTextParameters, # noqa: F401
|
| 1657 |
+
ImageToVideoInput, # noqa: F401
|
| 1658 |
+
ImageToVideoOutput, # noqa: F401
|
| 1659 |
+
ImageToVideoParameters, # noqa: F401
|
| 1660 |
+
ImageToVideoTargetSize, # noqa: F401
|
| 1661 |
+
ObjectDetectionBoundingBox, # noqa: F401
|
| 1662 |
+
ObjectDetectionInput, # noqa: F401
|
| 1663 |
+
ObjectDetectionOutputElement, # noqa: F401
|
| 1664 |
+
ObjectDetectionParameters, # noqa: F401
|
| 1665 |
+
Padding, # noqa: F401
|
| 1666 |
+
QuestionAnsweringInput, # noqa: F401
|
| 1667 |
+
QuestionAnsweringInputData, # noqa: F401
|
| 1668 |
+
QuestionAnsweringOutputElement, # noqa: F401
|
| 1669 |
+
QuestionAnsweringParameters, # noqa: F401
|
| 1670 |
+
SentenceSimilarityInput, # noqa: F401
|
| 1671 |
+
SentenceSimilarityInputData, # noqa: F401
|
| 1672 |
+
SummarizationInput, # noqa: F401
|
| 1673 |
+
SummarizationOutput, # noqa: F401
|
| 1674 |
+
SummarizationParameters, # noqa: F401
|
| 1675 |
+
SummarizationTruncationStrategy, # noqa: F401
|
| 1676 |
+
TableQuestionAnsweringInput, # noqa: F401
|
| 1677 |
+
TableQuestionAnsweringInputData, # noqa: F401
|
| 1678 |
+
TableQuestionAnsweringOutputElement, # noqa: F401
|
| 1679 |
+
TableQuestionAnsweringParameters, # noqa: F401
|
| 1680 |
+
Text2TextGenerationInput, # noqa: F401
|
| 1681 |
+
Text2TextGenerationOutput, # noqa: F401
|
| 1682 |
+
Text2TextGenerationParameters, # noqa: F401
|
| 1683 |
+
Text2TextGenerationTruncationStrategy, # noqa: F401
|
| 1684 |
+
TextClassificationInput, # noqa: F401
|
| 1685 |
+
TextClassificationOutputElement, # noqa: F401
|
| 1686 |
+
TextClassificationOutputTransform, # noqa: F401
|
| 1687 |
+
TextClassificationParameters, # noqa: F401
|
| 1688 |
+
TextGenerationInput, # noqa: F401
|
| 1689 |
+
TextGenerationInputGenerateParameters, # noqa: F401
|
| 1690 |
+
TextGenerationInputGrammarType, # noqa: F401
|
| 1691 |
+
TextGenerationOutput, # noqa: F401
|
| 1692 |
+
TextGenerationOutputBestOfSequence, # noqa: F401
|
| 1693 |
+
TextGenerationOutputDetails, # noqa: F401
|
| 1694 |
+
TextGenerationOutputFinishReason, # noqa: F401
|
| 1695 |
+
TextGenerationOutputPrefillToken, # noqa: F401
|
| 1696 |
+
TextGenerationOutputToken, # noqa: F401
|
| 1697 |
+
TextGenerationStreamOutput, # noqa: F401
|
| 1698 |
+
TextGenerationStreamOutputStreamDetails, # noqa: F401
|
| 1699 |
+
TextGenerationStreamOutputToken, # noqa: F401
|
| 1700 |
+
TextToAudioEarlyStoppingEnum, # noqa: F401
|
| 1701 |
+
TextToAudioGenerationParameters, # noqa: F401
|
| 1702 |
+
TextToAudioInput, # noqa: F401
|
| 1703 |
+
TextToAudioOutput, # noqa: F401
|
| 1704 |
+
TextToAudioParameters, # noqa: F401
|
| 1705 |
+
TextToImageInput, # noqa: F401
|
| 1706 |
+
TextToImageOutput, # noqa: F401
|
| 1707 |
+
TextToImageParameters, # noqa: F401
|
| 1708 |
+
TextToSpeechEarlyStoppingEnum, # noqa: F401
|
| 1709 |
+
TextToSpeechGenerationParameters, # noqa: F401
|
| 1710 |
+
TextToSpeechInput, # noqa: F401
|
| 1711 |
+
TextToSpeechOutput, # noqa: F401
|
| 1712 |
+
TextToSpeechParameters, # noqa: F401
|
| 1713 |
+
TextToVideoInput, # noqa: F401
|
| 1714 |
+
TextToVideoOutput, # noqa: F401
|
| 1715 |
+
TextToVideoParameters, # noqa: F401
|
| 1716 |
+
TokenClassificationAggregationStrategy, # noqa: F401
|
| 1717 |
+
TokenClassificationInput, # noqa: F401
|
| 1718 |
+
TokenClassificationOutputElement, # noqa: F401
|
| 1719 |
+
TokenClassificationParameters, # noqa: F401
|
| 1720 |
+
TranslationInput, # noqa: F401
|
| 1721 |
+
TranslationOutput, # noqa: F401
|
| 1722 |
+
TranslationParameters, # noqa: F401
|
| 1723 |
+
TranslationTruncationStrategy, # noqa: F401
|
| 1724 |
+
TypeEnum, # noqa: F401
|
| 1725 |
+
VideoClassificationInput, # noqa: F401
|
| 1726 |
+
VideoClassificationOutputElement, # noqa: F401
|
| 1727 |
+
VideoClassificationOutputTransform, # noqa: F401
|
| 1728 |
+
VideoClassificationParameters, # noqa: F401
|
| 1729 |
+
VisualQuestionAnsweringInput, # noqa: F401
|
| 1730 |
+
VisualQuestionAnsweringInputData, # noqa: F401
|
| 1731 |
+
VisualQuestionAnsweringOutputElement, # noqa: F401
|
| 1732 |
+
VisualQuestionAnsweringParameters, # noqa: F401
|
| 1733 |
+
ZeroShotClassificationInput, # noqa: F401
|
| 1734 |
+
ZeroShotClassificationOutputElement, # noqa: F401
|
| 1735 |
+
ZeroShotClassificationParameters, # noqa: F401
|
| 1736 |
+
ZeroShotImageClassificationInput, # noqa: F401
|
| 1737 |
+
ZeroShotImageClassificationOutputElement, # noqa: F401
|
| 1738 |
+
ZeroShotImageClassificationParameters, # noqa: F401
|
| 1739 |
+
ZeroShotObjectDetectionBoundingBox, # noqa: F401
|
| 1740 |
+
ZeroShotObjectDetectionInput, # noqa: F401
|
| 1741 |
+
ZeroShotObjectDetectionOutputElement, # noqa: F401
|
| 1742 |
+
ZeroShotObjectDetectionParameters, # noqa: F401
|
| 1743 |
+
)
|
| 1744 |
+
from .inference._mcp.agent import Agent # noqa: F401
|
| 1745 |
+
from .inference._mcp.mcp_client import MCPClient # noqa: F401
|
| 1746 |
+
from .repocard import (
|
| 1747 |
+
DatasetCard, # noqa: F401
|
| 1748 |
+
ModelCard, # noqa: F401
|
| 1749 |
+
RepoCard, # noqa: F401
|
| 1750 |
+
SpaceCard, # noqa: F401
|
| 1751 |
+
metadata_eval_result, # noqa: F401
|
| 1752 |
+
metadata_load, # noqa: F401
|
| 1753 |
+
metadata_save, # noqa: F401
|
| 1754 |
+
metadata_update, # noqa: F401
|
| 1755 |
+
)
|
| 1756 |
+
from .repocard_data import (
|
| 1757 |
+
CardData, # noqa: F401
|
| 1758 |
+
DatasetCardData, # noqa: F401
|
| 1759 |
+
EvalResult, # noqa: F401
|
| 1760 |
+
ModelCardData, # noqa: F401
|
| 1761 |
+
SpaceCardData, # noqa: F401
|
| 1762 |
+
)
|
| 1763 |
+
from .serialization import (
|
| 1764 |
+
StateDictSplit, # noqa: F401
|
| 1765 |
+
get_torch_storage_id, # noqa: F401
|
| 1766 |
+
get_torch_storage_size, # noqa: F401
|
| 1767 |
+
load_state_dict_from_file, # noqa: F401
|
| 1768 |
+
load_torch_model, # noqa: F401
|
| 1769 |
+
save_torch_model, # noqa: F401
|
| 1770 |
+
save_torch_state_dict, # noqa: F401
|
| 1771 |
+
split_state_dict_into_shards_factory, # noqa: F401
|
| 1772 |
+
split_torch_state_dict_into_shards, # noqa: F401
|
| 1773 |
+
)
|
| 1774 |
+
from .serialization._dduf import (
|
| 1775 |
+
DDUFEntry, # noqa: F401
|
| 1776 |
+
export_entries_as_dduf, # noqa: F401
|
| 1777 |
+
export_folder_as_dduf, # noqa: F401
|
| 1778 |
+
read_dduf_file, # noqa: F401
|
| 1779 |
+
)
|
| 1780 |
+
from .utils import (
|
| 1781 |
+
ASYNC_CLIENT_FACTORY_T, # noqa: F401
|
| 1782 |
+
CLIENT_FACTORY_T, # noqa: F401
|
| 1783 |
+
CachedFileInfo, # noqa: F401
|
| 1784 |
+
CachedIncompleteFileInfo, # noqa: F401
|
| 1785 |
+
CachedRepoInfo, # noqa: F401
|
| 1786 |
+
CachedRevisionInfo, # noqa: F401
|
| 1787 |
+
CacheNotFound, # noqa: F401
|
| 1788 |
+
CorruptedCacheException, # noqa: F401
|
| 1789 |
+
DeleteCacheStrategy, # noqa: F401
|
| 1790 |
+
HFCacheInfo, # noqa: F401
|
| 1791 |
+
HfUri, # noqa: F401
|
| 1792 |
+
cached_assets_path, # noqa: F401
|
| 1793 |
+
close_session, # noqa: F401
|
| 1794 |
+
dump_environment_info, # noqa: F401
|
| 1795 |
+
get_async_session, # noqa: F401
|
| 1796 |
+
get_session, # noqa: F401
|
| 1797 |
+
get_token, # noqa: F401
|
| 1798 |
+
hf_raise_for_status, # noqa: F401
|
| 1799 |
+
logging, # noqa: F401
|
| 1800 |
+
parse_hf_uri, # noqa: F401
|
| 1801 |
+
scan_cache_dir, # noqa: F401
|
| 1802 |
+
set_async_client_factory, # noqa: F401
|
| 1803 |
+
set_client_factory, # noqa: F401
|
| 1804 |
+
)
|
.cache/uv/archive-v0/WbiZCgDidtA5T1uiQ47d5/huggingface_hub/_buckets.py
ADDED
|
@@ -0,0 +1,1244 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright 2026-present, the HuggingFace Inc. team.
|
| 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 |
+
"""Shared logic for bucket operations.
|
| 15 |
+
|
| 16 |
+
This module contains the core buckets logic used by both the CLI and the Python API.
|
| 17 |
+
"""
|
| 18 |
+
|
| 19 |
+
import fnmatch
|
| 20 |
+
import json
|
| 21 |
+
import mimetypes
|
| 22 |
+
import os
|
| 23 |
+
import stat
|
| 24 |
+
import sys
|
| 25 |
+
import time
|
| 26 |
+
from collections.abc import Iterator
|
| 27 |
+
from dataclasses import dataclass, field
|
| 28 |
+
from datetime import datetime, timezone
|
| 29 |
+
from pathlib import Path
|
| 30 |
+
from typing import TYPE_CHECKING, Any, Literal
|
| 31 |
+
|
| 32 |
+
from . import constants, logging
|
| 33 |
+
from .errors import BucketNotFoundError
|
| 34 |
+
from .utils import (
|
| 35 |
+
HfUri,
|
| 36 |
+
StatusLine,
|
| 37 |
+
XetFileData,
|
| 38 |
+
disable_progress_bars,
|
| 39 |
+
enable_progress_bars,
|
| 40 |
+
parse_datetime,
|
| 41 |
+
parse_hf_uri,
|
| 42 |
+
)
|
| 43 |
+
from .utils._hf_uris import _looks_like_hf_url
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
if TYPE_CHECKING:
|
| 47 |
+
from .hf_api import HfApi
|
| 48 |
+
|
| 49 |
+
|
| 50 |
+
logger = logging.get_logger(__name__)
|
| 51 |
+
|
| 52 |
+
|
| 53 |
+
BUCKET_PREFIX = "hf://buckets/"
|
| 54 |
+
_SYNC_TIME_WINDOW_MS = 1000 # 1s safety-window for file modification time comparisons
|
| 55 |
+
|
| 56 |
+
|
| 57 |
+
# =============================================================================
|
| 58 |
+
# Bucket data structures
|
| 59 |
+
# =============================================================================
|
| 60 |
+
|
| 61 |
+
|
| 62 |
+
@dataclass
|
| 63 |
+
class BucketInfo:
|
| 64 |
+
"""
|
| 65 |
+
Contains information about a bucket on the Hub. This object is returned by [`bucket_info`] and [`list_buckets`].
|
| 66 |
+
|
| 67 |
+
Attributes:
|
| 68 |
+
id (`str`):
|
| 69 |
+
ID of the bucket.
|
| 70 |
+
private (`bool`):
|
| 71 |
+
Is the bucket private.
|
| 72 |
+
created_at (`datetime`):
|
| 73 |
+
Date of creation of the bucket on the Hub.
|
| 74 |
+
size (`int`):
|
| 75 |
+
Size of the bucket in bytes.
|
| 76 |
+
total_files (`int`):
|
| 77 |
+
Total number of files in the bucket.
|
| 78 |
+
"""
|
| 79 |
+
|
| 80 |
+
id: str
|
| 81 |
+
private: bool
|
| 82 |
+
created_at: datetime
|
| 83 |
+
size: int
|
| 84 |
+
total_files: int
|
| 85 |
+
|
| 86 |
+
def __init__(self, **kwargs):
|
| 87 |
+
self.id = kwargs.pop("id")
|
| 88 |
+
self.private = kwargs.pop("private")
|
| 89 |
+
self.created_at = parse_datetime(kwargs.pop("createdAt"))
|
| 90 |
+
self.size = kwargs.pop("size")
|
| 91 |
+
self.total_files = kwargs.pop("totalFiles")
|
| 92 |
+
self.__dict__.update(**kwargs)
|
| 93 |
+
|
| 94 |
+
|
| 95 |
+
@dataclass
|
| 96 |
+
class _BucketAddFile:
|
| 97 |
+
source: str | Path | bytes
|
| 98 |
+
destination: str
|
| 99 |
+
|
| 100 |
+
xet_hash: str | None = field(default=None)
|
| 101 |
+
size: int | None = field(default=None)
|
| 102 |
+
mtime: int = field(init=False)
|
| 103 |
+
content_type: str | None = field(init=False)
|
| 104 |
+
|
| 105 |
+
def __post_init__(self) -> None:
|
| 106 |
+
self.content_type = None
|
| 107 |
+
if isinstance(self.source, (str, Path)): # guess content type from source path
|
| 108 |
+
self.content_type = mimetypes.guess_type(self.source)[0]
|
| 109 |
+
if self.content_type is None: # or default to destination path content type
|
| 110 |
+
self.content_type = mimetypes.guess_type(self.destination)[0]
|
| 111 |
+
|
| 112 |
+
self.mtime = int(
|
| 113 |
+
os.path.getmtime(self.source) * 1000 if not isinstance(self.source, bytes) else time.time() * 1000
|
| 114 |
+
)
|
| 115 |
+
|
| 116 |
+
|
| 117 |
+
@dataclass
|
| 118 |
+
class _BucketCopyFile:
|
| 119 |
+
destination: str
|
| 120 |
+
xet_hash: str
|
| 121 |
+
source_repo_type: str # "model", "dataset", "space", "bucket"
|
| 122 |
+
source_repo_id: str
|
| 123 |
+
size: int | None = field(default=None)
|
| 124 |
+
mtime: int = field(init=False)
|
| 125 |
+
content_type: str | None = field(init=False)
|
| 126 |
+
|
| 127 |
+
def __post_init__(self) -> None:
|
| 128 |
+
self.content_type = mimetypes.guess_type(self.destination)[0]
|
| 129 |
+
self.mtime = int(time.time() * 1000)
|
| 130 |
+
|
| 131 |
+
|
| 132 |
+
@dataclass
|
| 133 |
+
class _BucketDeleteFile:
|
| 134 |
+
path: str
|
| 135 |
+
|
| 136 |
+
|
| 137 |
+
@dataclass(frozen=True)
|
| 138 |
+
class BucketFileMetadata:
|
| 139 |
+
"""Data structure containing information about a file in a bucket.
|
| 140 |
+
|
| 141 |
+
Returned by [`get_bucket_file_metadata`].
|
| 142 |
+
|
| 143 |
+
Args:
|
| 144 |
+
size (`int`):
|
| 145 |
+
Size of the file in bytes.
|
| 146 |
+
xet_file_data (`XetFileData`):
|
| 147 |
+
Xet information for the file (hash and refresh route).
|
| 148 |
+
"""
|
| 149 |
+
|
| 150 |
+
size: int
|
| 151 |
+
xet_file_data: XetFileData
|
| 152 |
+
|
| 153 |
+
|
| 154 |
+
@dataclass
|
| 155 |
+
class BucketUrl:
|
| 156 |
+
"""Describes a bucket URL on the Hub.
|
| 157 |
+
|
| 158 |
+
`BucketUrl` is returned by [`create_bucket`]. At initialization, the URL is parsed to populate properties:
|
| 159 |
+
- endpoint (`str`)
|
| 160 |
+
- namespace (`str`)
|
| 161 |
+
- bucket_id (`str`)
|
| 162 |
+
- url (`str`)
|
| 163 |
+
- uri (`HfUri`)
|
| 164 |
+
|
| 165 |
+
Args:
|
| 166 |
+
url (`str`):
|
| 167 |
+
String value of the bucket url.
|
| 168 |
+
endpoint (`str`, *optional*):
|
| 169 |
+
Endpoint of the Hub. Defaults to <https://huggingface.co>.
|
| 170 |
+
"""
|
| 171 |
+
|
| 172 |
+
url: str
|
| 173 |
+
endpoint: str = ""
|
| 174 |
+
namespace: str = field(init=False)
|
| 175 |
+
bucket_id: str = field(init=False)
|
| 176 |
+
uri: HfUri = field(init=False)
|
| 177 |
+
|
| 178 |
+
def __post_init__(self) -> None:
|
| 179 |
+
self.endpoint = self.endpoint or constants.ENDPOINT
|
| 180 |
+
|
| 181 |
+
# Parse URL: expected format is `{endpoint}/buckets/{namespace}/{bucket_name}`
|
| 182 |
+
url_path = self.url.replace(self.endpoint, "").strip("/")
|
| 183 |
+
# Remove leading "buckets/" prefix
|
| 184 |
+
if url_path.startswith("buckets/"):
|
| 185 |
+
url_path = url_path[len("buckets/") :]
|
| 186 |
+
parsed = _parse_bucket_uri(url_path)
|
| 187 |
+
if parsed.path_in_repo:
|
| 188 |
+
raise ValueError(f"Unable to parse bucket URL: {self.url}")
|
| 189 |
+
self.namespace = parsed.id.split("/")[0]
|
| 190 |
+
self.bucket_id = parsed.id
|
| 191 |
+
self.uri = parsed
|
| 192 |
+
|
| 193 |
+
|
| 194 |
+
@dataclass
|
| 195 |
+
class BucketFile:
|
| 196 |
+
"""
|
| 197 |
+
Contains information about a file in a bucket on the Hub. This object is returned by [`list_bucket_tree`].
|
| 198 |
+
|
| 199 |
+
Similar to [`RepoFile`] but for files in buckets.
|
| 200 |
+
"""
|
| 201 |
+
|
| 202 |
+
type: Literal["file"]
|
| 203 |
+
path: str
|
| 204 |
+
size: int
|
| 205 |
+
xet_hash: str
|
| 206 |
+
mtime: datetime | None
|
| 207 |
+
uploaded_at: datetime | None
|
| 208 |
+
|
| 209 |
+
def __init__(self, **kwargs):
|
| 210 |
+
self.type = kwargs.pop("type")
|
| 211 |
+
self.path = kwargs.pop("path")
|
| 212 |
+
self.size = kwargs.pop("size")
|
| 213 |
+
self.xet_hash = kwargs.pop("xetHash")
|
| 214 |
+
mtime = kwargs.pop("mtime", None)
|
| 215 |
+
self.mtime = parse_datetime(mtime) if mtime else None
|
| 216 |
+
uploaded_at = kwargs.pop("uploadedAt", None)
|
| 217 |
+
self.uploaded_at = parse_datetime(uploaded_at) if uploaded_at else None
|
| 218 |
+
|
| 219 |
+
|
| 220 |
+
@dataclass
|
| 221 |
+
class BucketFolder:
|
| 222 |
+
"""
|
| 223 |
+
Contains information about a directory in a bucket on the Hub. This object is returned by [`list_bucket_tree`].
|
| 224 |
+
|
| 225 |
+
Similar to [`RepoFolder`] but for directories in buckets.
|
| 226 |
+
"""
|
| 227 |
+
|
| 228 |
+
type: Literal["directory"]
|
| 229 |
+
path: str
|
| 230 |
+
uploaded_at: datetime | None
|
| 231 |
+
|
| 232 |
+
def __init__(self, **kwargs):
|
| 233 |
+
self.type = kwargs.pop("type")
|
| 234 |
+
self.path = kwargs.pop("path")
|
| 235 |
+
uploaded_at = kwargs.pop("uploadedAt", None) or kwargs.pop("uploaded_at", None)
|
| 236 |
+
self.uploaded_at = (
|
| 237 |
+
(uploaded_at if isinstance(uploaded_at, datetime) else parse_datetime(uploaded_at))
|
| 238 |
+
if uploaded_at
|
| 239 |
+
else None
|
| 240 |
+
)
|
| 241 |
+
|
| 242 |
+
|
| 243 |
+
# =============================================================================
|
| 244 |
+
# Bucket path parsing
|
| 245 |
+
# =============================================================================
|
| 246 |
+
|
| 247 |
+
|
| 248 |
+
def _parse_bucket_uri(path: str) -> HfUri:
|
| 249 |
+
"""Parse a bucket path into a HfUri.
|
| 250 |
+
|
| 251 |
+
Accepts:
|
| 252 |
+
- `hf://buckets/namespace/name(/path/in/repo)` URIs,
|
| 253 |
+
- Hugging Face web URLs such as `https://huggingface.co/buckets/namespace/name(/tree/path)`,
|
| 254 |
+
- plain `namespace/name(/path/in/repo)` paths.
|
| 255 |
+
"""
|
| 256 |
+
if path.startswith(constants.HF_PROTOCOL) or _looks_like_hf_url(path):
|
| 257 |
+
# Don't use 'if is_hf_uri(...)' here as we prefer 'parse_hf_uri(...)' to raise the exact error message.
|
| 258 |
+
parsed = parse_hf_uri(path)
|
| 259 |
+
if not parsed.is_bucket:
|
| 260 |
+
raise ValueError(f"Invalid bucket path: {path}. Must be a bucket URI (hf://buckets/...).")
|
| 261 |
+
return parsed
|
| 262 |
+
parts = path.split("/", 2)
|
| 263 |
+
if len(parts) < 2 or not parts[0] or not parts[1]:
|
| 264 |
+
raise ValueError(f"Invalid bucket path: '{path}'. Expected format: namespace/bucket_name")
|
| 265 |
+
bucket_id = f"{parts[0]}/{parts[1]}"
|
| 266 |
+
prefix = "/".join(parts[2:])
|
| 267 |
+
return HfUri(type="bucket", id=bucket_id, path_in_repo=prefix)
|
| 268 |
+
|
| 269 |
+
|
| 270 |
+
def _is_bucket_path(path: str) -> bool:
|
| 271 |
+
"""Check if a path is a bucket path.
|
| 272 |
+
|
| 273 |
+
Do not raise if the path is not a hf:// URI.
|
| 274 |
+
Raise if the path is a hf:// URI but with an incorrect format.
|
| 275 |
+
"""
|
| 276 |
+
if not path.startswith(constants.HF_PROTOCOL):
|
| 277 |
+
return False
|
| 278 |
+
return parse_hf_uri(path).is_bucket
|
| 279 |
+
|
| 280 |
+
|
| 281 |
+
# =============================================================================
|
| 282 |
+
# Sync data structures
|
| 283 |
+
# =============================================================================
|
| 284 |
+
|
| 285 |
+
|
| 286 |
+
@dataclass
|
| 287 |
+
class SyncOperation:
|
| 288 |
+
"""Represents a sync operation to be performed."""
|
| 289 |
+
|
| 290 |
+
action: Literal["upload", "download", "delete", "skip"]
|
| 291 |
+
path: str
|
| 292 |
+
size: int | None = None
|
| 293 |
+
reason: str = ""
|
| 294 |
+
local_mtime: str | None = None
|
| 295 |
+
remote_mtime: str | None = None
|
| 296 |
+
bucket_file: BucketFile | None = None # BucketFile when available (not serialized to plan file)
|
| 297 |
+
|
| 298 |
+
|
| 299 |
+
@dataclass
|
| 300 |
+
class SyncPlan:
|
| 301 |
+
"""Represents a complete sync plan."""
|
| 302 |
+
|
| 303 |
+
source: str
|
| 304 |
+
dest: str
|
| 305 |
+
timestamp: str
|
| 306 |
+
operations: list[SyncOperation] = field(default_factory=list)
|
| 307 |
+
|
| 308 |
+
def summary(self) -> dict[str, int | str]:
|
| 309 |
+
uploads = sum(1 for op in self.operations if op.action == "upload")
|
| 310 |
+
downloads = sum(1 for op in self.operations if op.action == "download")
|
| 311 |
+
deletes = sum(1 for op in self.operations if op.action == "delete")
|
| 312 |
+
skips = sum(1 for op in self.operations if op.action == "skip")
|
| 313 |
+
total_size = sum(op.size or 0 for op in self.operations if op.action in ("upload", "download"))
|
| 314 |
+
return {
|
| 315 |
+
"uploads": uploads,
|
| 316 |
+
"downloads": downloads,
|
| 317 |
+
"deletes": deletes,
|
| 318 |
+
"skips": skips,
|
| 319 |
+
"total_size": total_size,
|
| 320 |
+
}
|
| 321 |
+
|
| 322 |
+
|
| 323 |
+
# =============================================================================
|
| 324 |
+
# Filter matching
|
| 325 |
+
# =============================================================================
|
| 326 |
+
|
| 327 |
+
|
| 328 |
+
class FilterMatcher:
|
| 329 |
+
"""Matches file paths against include/exclude patterns."""
|
| 330 |
+
|
| 331 |
+
def __init__(
|
| 332 |
+
self,
|
| 333 |
+
include_patterns: list[str] | None = None,
|
| 334 |
+
exclude_patterns: list[str] | None = None,
|
| 335 |
+
filter_rules: list[tuple[str, str]] | None = None,
|
| 336 |
+
):
|
| 337 |
+
"""Initialize the filter matcher.
|
| 338 |
+
|
| 339 |
+
Args:
|
| 340 |
+
include_patterns: Patterns to include (from --include)
|
| 341 |
+
exclude_patterns: Patterns to exclude (from --exclude)
|
| 342 |
+
filter_rules: Rules from filter file as list of ("+"/"-", pattern) tuples
|
| 343 |
+
"""
|
| 344 |
+
self.include_patterns = include_patterns or []
|
| 345 |
+
self.exclude_patterns = exclude_patterns or []
|
| 346 |
+
self.filter_rules = filter_rules or []
|
| 347 |
+
|
| 348 |
+
def matches(self, path: str) -> bool:
|
| 349 |
+
"""Check if a path should be included based on the filter rules.
|
| 350 |
+
|
| 351 |
+
Filtering rules:
|
| 352 |
+
- Filters are evaluated in order, first matching rule decides
|
| 353 |
+
- If no rules match, include by default (unless include patterns are specified)
|
| 354 |
+
"""
|
| 355 |
+
# First check filter rules from file (in order)
|
| 356 |
+
for sign, pattern in self.filter_rules:
|
| 357 |
+
if fnmatch.fnmatch(path, pattern):
|
| 358 |
+
return sign == "+"
|
| 359 |
+
|
| 360 |
+
# Then check CLI patterns
|
| 361 |
+
for pattern in self.exclude_patterns:
|
| 362 |
+
if fnmatch.fnmatch(path, pattern):
|
| 363 |
+
return False
|
| 364 |
+
|
| 365 |
+
for pattern in self.include_patterns:
|
| 366 |
+
if fnmatch.fnmatch(path, pattern):
|
| 367 |
+
return True
|
| 368 |
+
|
| 369 |
+
# If include patterns were specified but none matched, exclude
|
| 370 |
+
if self.include_patterns:
|
| 371 |
+
return False
|
| 372 |
+
|
| 373 |
+
# Default: include
|
| 374 |
+
return True
|
| 375 |
+
|
| 376 |
+
|
| 377 |
+
def _parse_filter_file(filter_file: str) -> list[tuple[str, str]]:
|
| 378 |
+
"""Parse a filter file and return a list of (sign, pattern) tuples.
|
| 379 |
+
|
| 380 |
+
Filter file format:
|
| 381 |
+
- Lines starting with "+" are include patterns
|
| 382 |
+
- Lines starting with "-" are exclude patterns
|
| 383 |
+
- Empty lines and lines starting with "#" are ignored
|
| 384 |
+
"""
|
| 385 |
+
rules = []
|
| 386 |
+
with open(filter_file) as f:
|
| 387 |
+
for line in f:
|
| 388 |
+
line = line.strip()
|
| 389 |
+
if not line or line.startswith("#"):
|
| 390 |
+
continue
|
| 391 |
+
if line.startswith("+"):
|
| 392 |
+
rules.append(("+", line[1:].strip()))
|
| 393 |
+
elif line.startswith("-"):
|
| 394 |
+
rules.append(("-", line[1:].strip()))
|
| 395 |
+
else:
|
| 396 |
+
# Default to include if no prefix
|
| 397 |
+
rules.append(("+", line))
|
| 398 |
+
return rules
|
| 399 |
+
|
| 400 |
+
|
| 401 |
+
# =============================================================================
|
| 402 |
+
# File listing
|
| 403 |
+
# =============================================================================
|
| 404 |
+
|
| 405 |
+
|
| 406 |
+
def _stat_local(path: str) -> tuple[int, float] | None:
|
| 407 |
+
"""Stat a local file and return (size, mtime_ms).
|
| 408 |
+
|
| 409 |
+
Returns None if the path is missing or is a directory. Uses a single
|
| 410 |
+
``os.stat`` call so callers don't pay for multiple syscalls per file.
|
| 411 |
+
"""
|
| 412 |
+
try:
|
| 413 |
+
st = os.stat(path)
|
| 414 |
+
except OSError:
|
| 415 |
+
return None
|
| 416 |
+
if stat.S_ISDIR(st.st_mode):
|
| 417 |
+
return None
|
| 418 |
+
return st.st_size, st.st_mtime * 1000
|
| 419 |
+
|
| 420 |
+
|
| 421 |
+
def _list_local_files(local_path: str) -> Iterator[tuple[str, int, float]]:
|
| 422 |
+
"""List all files in a local directory.
|
| 423 |
+
|
| 424 |
+
Yields:
|
| 425 |
+
tuple: (relative_path, size, mtime_ms) for each file
|
| 426 |
+
"""
|
| 427 |
+
local_path = os.path.abspath(local_path)
|
| 428 |
+
if not os.path.isdir(local_path):
|
| 429 |
+
raise ValueError(f"Local path must be a directory: {local_path}")
|
| 430 |
+
|
| 431 |
+
for root, _, files in os.walk(local_path):
|
| 432 |
+
for filename in files:
|
| 433 |
+
full_path = os.path.join(root, filename)
|
| 434 |
+
stat_info = _stat_local(full_path)
|
| 435 |
+
if stat_info is None:
|
| 436 |
+
continue
|
| 437 |
+
rel_path = os.path.relpath(full_path, local_path)
|
| 438 |
+
# Normalize to forward slashes for consistency
|
| 439 |
+
rel_path = rel_path.replace(os.sep, "/")
|
| 440 |
+
yield rel_path, stat_info[0], stat_info[1]
|
| 441 |
+
|
| 442 |
+
|
| 443 |
+
def _list_remote_files(api: "HfApi", bucket_id: str, prefix: str) -> Iterator[tuple[str, int, float, Any]]:
|
| 444 |
+
"""List all files in a bucket with a given prefix.
|
| 445 |
+
|
| 446 |
+
Yields:
|
| 447 |
+
tuple: (relative_path, size, mtime_ms, bucket_file) for each file.
|
| 448 |
+
bucket_file is the BucketFile object from list_bucket_tree.
|
| 449 |
+
"""
|
| 450 |
+
for item in api.list_bucket_tree(bucket_id, prefix=prefix or None, recursive=True):
|
| 451 |
+
if isinstance(item, BucketFolder):
|
| 452 |
+
continue
|
| 453 |
+
path = item.path
|
| 454 |
+
# Remove prefix from path to get relative path
|
| 455 |
+
# Only strip prefix if it's followed by "/" (directory boundary) or is exact match
|
| 456 |
+
if prefix:
|
| 457 |
+
if path.startswith(prefix + "/"):
|
| 458 |
+
rel_path = path[len(prefix) + 1 :]
|
| 459 |
+
elif path == prefix:
|
| 460 |
+
# Exact match: the file IS the prefix (e.g., single file download)
|
| 461 |
+
rel_path = path.rsplit("/", 1)[-1] if "/" in path else path
|
| 462 |
+
else:
|
| 463 |
+
# Path doesn't match prefix pattern (e.g., "submarine.txt" for prefix "sub")
|
| 464 |
+
# Skip this file - it was returned by the API but doesn't belong to this prefix
|
| 465 |
+
continue
|
| 466 |
+
else:
|
| 467 |
+
rel_path = path
|
| 468 |
+
mtime_ms = item.mtime.timestamp() * 1000 if item.mtime else 0
|
| 469 |
+
yield rel_path, item.size, mtime_ms, item
|
| 470 |
+
|
| 471 |
+
|
| 472 |
+
# =============================================================================
|
| 473 |
+
# Sync plan computation
|
| 474 |
+
# =============================================================================
|
| 475 |
+
|
| 476 |
+
|
| 477 |
+
def _mtime_to_iso(mtime_ms: float) -> str:
|
| 478 |
+
"""Convert mtime in milliseconds to ISO format string."""
|
| 479 |
+
return datetime.fromtimestamp(mtime_ms / 1000, tz=timezone.utc).isoformat()
|
| 480 |
+
|
| 481 |
+
|
| 482 |
+
def _compare_files_for_sync(
|
| 483 |
+
*,
|
| 484 |
+
path: str,
|
| 485 |
+
action: Literal["upload", "download"],
|
| 486 |
+
source_size: int,
|
| 487 |
+
source_mtime: float,
|
| 488 |
+
dest_size: int,
|
| 489 |
+
dest_mtime: float,
|
| 490 |
+
source_newer_label: str,
|
| 491 |
+
dest_newer_label: str,
|
| 492 |
+
ignore_sizes: bool,
|
| 493 |
+
ignore_times: bool,
|
| 494 |
+
ignore_existing: bool,
|
| 495 |
+
bucket_file: Any | None = None,
|
| 496 |
+
) -> SyncOperation:
|
| 497 |
+
"""Compare source and dest files and return the appropriate sync operation.
|
| 498 |
+
|
| 499 |
+
This is a unified helper for both upload and download directions.
|
| 500 |
+
|
| 501 |
+
Args:
|
| 502 |
+
path: Relative file path
|
| 503 |
+
action: "upload" or "download"
|
| 504 |
+
source_size: Size of the source file (bytes)
|
| 505 |
+
source_mtime: Mtime of the source file (milliseconds)
|
| 506 |
+
dest_size: Size of the destination file (bytes)
|
| 507 |
+
dest_mtime: Mtime of the destination file (milliseconds)
|
| 508 |
+
source_newer_label: Label when source is newer (e.g., "local newer" or "remote newer")
|
| 509 |
+
dest_newer_label: Label when dest is newer (e.g., "remote newer" or "local newer")
|
| 510 |
+
ignore_sizes: Only compare mtime
|
| 511 |
+
ignore_times: Only compare size
|
| 512 |
+
ignore_existing: Skip files that exist on receiver
|
| 513 |
+
bucket_file: BucketFile object (for downloads only)
|
| 514 |
+
|
| 515 |
+
Returns:
|
| 516 |
+
SyncOperation describing the action to take
|
| 517 |
+
"""
|
| 518 |
+
local_mtime_iso = _mtime_to_iso(source_mtime if action == "upload" else dest_mtime)
|
| 519 |
+
remote_mtime_iso = _mtime_to_iso(dest_mtime if action == "upload" else source_mtime)
|
| 520 |
+
|
| 521 |
+
base_kwargs: dict[str, Any] = {
|
| 522 |
+
"path": path,
|
| 523 |
+
"size": source_size,
|
| 524 |
+
"local_mtime": local_mtime_iso,
|
| 525 |
+
"remote_mtime": remote_mtime_iso,
|
| 526 |
+
}
|
| 527 |
+
|
| 528 |
+
if ignore_existing:
|
| 529 |
+
return SyncOperation(action="skip", reason="exists on receiver (--ignore-existing)", **base_kwargs)
|
| 530 |
+
|
| 531 |
+
size_differs = source_size != dest_size
|
| 532 |
+
source_newer = (source_mtime - dest_mtime) > _SYNC_TIME_WINDOW_MS
|
| 533 |
+
|
| 534 |
+
if ignore_sizes:
|
| 535 |
+
if source_newer:
|
| 536 |
+
return SyncOperation(action=action, reason=source_newer_label, bucket_file=bucket_file, **base_kwargs)
|
| 537 |
+
else:
|
| 538 |
+
dest_newer = (dest_mtime - source_mtime) > _SYNC_TIME_WINDOW_MS
|
| 539 |
+
skip_reason = dest_newer_label if dest_newer else "same mtime"
|
| 540 |
+
return SyncOperation(action="skip", reason=skip_reason, **base_kwargs)
|
| 541 |
+
elif ignore_times:
|
| 542 |
+
if size_differs:
|
| 543 |
+
return SyncOperation(action=action, reason="size differs", bucket_file=bucket_file, **base_kwargs)
|
| 544 |
+
else:
|
| 545 |
+
return SyncOperation(action="skip", reason="same size", **base_kwargs)
|
| 546 |
+
else:
|
| 547 |
+
if size_differs or source_newer:
|
| 548 |
+
reason = "size differs" if size_differs else source_newer_label
|
| 549 |
+
return SyncOperation(action=action, reason=reason, bucket_file=bucket_file, **base_kwargs)
|
| 550 |
+
else:
|
| 551 |
+
return SyncOperation(action="skip", reason="identical", **base_kwargs)
|
| 552 |
+
|
| 553 |
+
|
| 554 |
+
def _compute_sync_plan(
|
| 555 |
+
source: str,
|
| 556 |
+
dest: str,
|
| 557 |
+
api: "HfApi",
|
| 558 |
+
delete: bool = False,
|
| 559 |
+
ignore_times: bool = False,
|
| 560 |
+
ignore_sizes: bool = False,
|
| 561 |
+
existing: bool = False,
|
| 562 |
+
ignore_existing: bool = False,
|
| 563 |
+
filter_matcher: FilterMatcher | None = None,
|
| 564 |
+
status: Any | None = None,
|
| 565 |
+
) -> SyncPlan:
|
| 566 |
+
"""Compute the sync plan by comparing source and destination.
|
| 567 |
+
|
| 568 |
+
Returns:
|
| 569 |
+
SyncPlan with all operations to be performed
|
| 570 |
+
"""
|
| 571 |
+
filter_matcher = filter_matcher or FilterMatcher()
|
| 572 |
+
is_upload = not _is_bucket_path(source) and _is_bucket_path(dest)
|
| 573 |
+
is_download = _is_bucket_path(source) and not _is_bucket_path(dest)
|
| 574 |
+
|
| 575 |
+
if not is_upload and not is_download:
|
| 576 |
+
raise ValueError("One of source or dest must be a bucket path (hf://buckets/...) and the other must be local.")
|
| 577 |
+
|
| 578 |
+
plan = SyncPlan(
|
| 579 |
+
source=source,
|
| 580 |
+
dest=dest,
|
| 581 |
+
timestamp=datetime.now(timezone.utc).isoformat(),
|
| 582 |
+
)
|
| 583 |
+
|
| 584 |
+
remote_total: int | None = None
|
| 585 |
+
if is_upload:
|
| 586 |
+
# Local -> Remote
|
| 587 |
+
local_path = os.path.abspath(source)
|
| 588 |
+
parsed = _parse_bucket_uri(dest)
|
| 589 |
+
bucket_id, prefix = parsed.id, parsed.path_in_repo
|
| 590 |
+
|
| 591 |
+
if not os.path.isdir(local_path):
|
| 592 |
+
raise ValueError(f"Source must be a directory: {local_path}")
|
| 593 |
+
|
| 594 |
+
# Get local and remote file lists
|
| 595 |
+
local_files = {}
|
| 596 |
+
for rel_path, size, mtime_ms in _list_local_files(local_path):
|
| 597 |
+
if filter_matcher.matches(rel_path):
|
| 598 |
+
local_files[rel_path] = (size, mtime_ms)
|
| 599 |
+
if status:
|
| 600 |
+
status.update(f"Scanning local directory ({len(local_files)} files)")
|
| 601 |
+
if status:
|
| 602 |
+
status.done(f"Scanning local directory ({len(local_files)} files)")
|
| 603 |
+
|
| 604 |
+
remote_files = {}
|
| 605 |
+
if status:
|
| 606 |
+
try:
|
| 607 |
+
remote_total = api.bucket_info(bucket_id).total_files
|
| 608 |
+
except Exception:
|
| 609 |
+
pass
|
| 610 |
+
try:
|
| 611 |
+
for rel_path, size, mtime_ms, _ in _list_remote_files(api, bucket_id, prefix):
|
| 612 |
+
if filter_matcher.matches(rel_path):
|
| 613 |
+
remote_files[rel_path] = (size, mtime_ms)
|
| 614 |
+
if status:
|
| 615 |
+
total_str = f"/{remote_total}" if remote_total is not None else ""
|
| 616 |
+
status.update(f"Scanning remote bucket ({len(remote_files)}{total_str} files)")
|
| 617 |
+
except BucketNotFoundError:
|
| 618 |
+
# Bucket doesn't exist yet - this is expected for new uploads
|
| 619 |
+
logger.debug(f"Bucket '{bucket_id}' not found, treating as empty.")
|
| 620 |
+
if status:
|
| 621 |
+
status.done(f"Scanning remote bucket ({len(remote_files)} files)")
|
| 622 |
+
|
| 623 |
+
# Compare files
|
| 624 |
+
all_paths = set(local_files.keys()) | set(remote_files.keys())
|
| 625 |
+
if status:
|
| 626 |
+
status.done(f"Comparing files ({len(all_paths)} paths)")
|
| 627 |
+
for path in sorted(all_paths):
|
| 628 |
+
local_info = local_files.get(path)
|
| 629 |
+
remote_info = remote_files.get(path)
|
| 630 |
+
|
| 631 |
+
if local_info and not remote_info:
|
| 632 |
+
# New file
|
| 633 |
+
if existing:
|
| 634 |
+
# --existing: skip new files
|
| 635 |
+
plan.operations.append(
|
| 636 |
+
SyncOperation(
|
| 637 |
+
action="skip",
|
| 638 |
+
path=path,
|
| 639 |
+
size=local_info[0],
|
| 640 |
+
reason="new file (--existing)",
|
| 641 |
+
local_mtime=_mtime_to_iso(local_info[1]),
|
| 642 |
+
)
|
| 643 |
+
)
|
| 644 |
+
else:
|
| 645 |
+
plan.operations.append(
|
| 646 |
+
SyncOperation(
|
| 647 |
+
action="upload",
|
| 648 |
+
path=path,
|
| 649 |
+
size=local_info[0],
|
| 650 |
+
reason="new file",
|
| 651 |
+
local_mtime=_mtime_to_iso(local_info[1]),
|
| 652 |
+
)
|
| 653 |
+
)
|
| 654 |
+
elif local_info and remote_info:
|
| 655 |
+
# File exists in both - use helper to determine action
|
| 656 |
+
local_size, local_mtime = local_info
|
| 657 |
+
remote_size, remote_mtime = remote_info
|
| 658 |
+
plan.operations.append(
|
| 659 |
+
_compare_files_for_sync(
|
| 660 |
+
path=path,
|
| 661 |
+
action="upload",
|
| 662 |
+
source_size=local_size,
|
| 663 |
+
source_mtime=local_mtime,
|
| 664 |
+
dest_size=remote_size,
|
| 665 |
+
dest_mtime=remote_mtime,
|
| 666 |
+
source_newer_label="local newer",
|
| 667 |
+
dest_newer_label="remote newer",
|
| 668 |
+
ignore_sizes=ignore_sizes,
|
| 669 |
+
ignore_times=ignore_times,
|
| 670 |
+
ignore_existing=ignore_existing,
|
| 671 |
+
)
|
| 672 |
+
)
|
| 673 |
+
elif not local_info and remote_info and delete:
|
| 674 |
+
# File only in remote and --delete mode
|
| 675 |
+
plan.operations.append(
|
| 676 |
+
SyncOperation(
|
| 677 |
+
action="delete",
|
| 678 |
+
path=path,
|
| 679 |
+
size=remote_info[0],
|
| 680 |
+
reason="not in source (--delete)",
|
| 681 |
+
remote_mtime=_mtime_to_iso(remote_info[1]),
|
| 682 |
+
)
|
| 683 |
+
)
|
| 684 |
+
|
| 685 |
+
else:
|
| 686 |
+
# Remote -> Local (download)
|
| 687 |
+
parsed = _parse_bucket_uri(source)
|
| 688 |
+
bucket_id, prefix = parsed.id, parsed.path_in_repo
|
| 689 |
+
local_path = os.path.abspath(dest)
|
| 690 |
+
|
| 691 |
+
# Get remote and local file lists
|
| 692 |
+
remote_files = {}
|
| 693 |
+
bucket_file_map: dict[str, Any] = {}
|
| 694 |
+
if status:
|
| 695 |
+
try:
|
| 696 |
+
remote_total = api.bucket_info(bucket_id).total_files
|
| 697 |
+
except Exception:
|
| 698 |
+
pass
|
| 699 |
+
for rel_path, size, mtime_ms, bucket_file in _list_remote_files(api, bucket_id, prefix):
|
| 700 |
+
if filter_matcher.matches(rel_path):
|
| 701 |
+
remote_files[rel_path] = (size, mtime_ms)
|
| 702 |
+
bucket_file_map[rel_path] = bucket_file
|
| 703 |
+
if status:
|
| 704 |
+
total_str = f"/{remote_total}" if remote_total is not None else ""
|
| 705 |
+
status.update(f"Scanning remote bucket ({len(remote_files)}{total_str} files)")
|
| 706 |
+
if status:
|
| 707 |
+
status.done(f"Scanning remote bucket ({len(remote_files)} files)")
|
| 708 |
+
|
| 709 |
+
local_files = {}
|
| 710 |
+
if os.path.isdir(local_path):
|
| 711 |
+
if delete:
|
| 712 |
+
# Full walk needed to discover local-only files for deletion.
|
| 713 |
+
for rel_path, size, mtime_ms in _list_local_files(local_path):
|
| 714 |
+
if filter_matcher.matches(rel_path):
|
| 715 |
+
local_files[rel_path] = (size, mtime_ms)
|
| 716 |
+
if status:
|
| 717 |
+
status.update(f"Scanning local directory ({len(local_files)} files)")
|
| 718 |
+
else:
|
| 719 |
+
# Without --delete, the plan only depends on paths that exist
|
| 720 |
+
# remotely. Stat just those instead of walking the whole tree,
|
| 721 |
+
# which can take minutes when dest sits in a large directory
|
| 722 |
+
# like ~/.cache/huggingface/.
|
| 723 |
+
for rel_path in remote_files:
|
| 724 |
+
local_file = os.path.join(local_path, rel_path)
|
| 725 |
+
stat_info = _stat_local(local_file)
|
| 726 |
+
if stat_info is None:
|
| 727 |
+
continue
|
| 728 |
+
local_files[rel_path] = stat_info
|
| 729 |
+
if status:
|
| 730 |
+
status.update(f"Scanning local directory ({len(local_files)} files)")
|
| 731 |
+
if status:
|
| 732 |
+
status.done(f"Scanning local directory ({len(local_files)} files)")
|
| 733 |
+
|
| 734 |
+
# Compare files
|
| 735 |
+
all_paths = set(remote_files.keys()) | set(local_files.keys())
|
| 736 |
+
if status:
|
| 737 |
+
status.done(f"Comparing files ({len(all_paths)} paths)")
|
| 738 |
+
for path in sorted(all_paths):
|
| 739 |
+
remote_info = remote_files.get(path)
|
| 740 |
+
local_info = local_files.get(path)
|
| 741 |
+
|
| 742 |
+
if remote_info and not local_info:
|
| 743 |
+
# New file
|
| 744 |
+
if existing:
|
| 745 |
+
# --existing: skip new files
|
| 746 |
+
plan.operations.append(
|
| 747 |
+
SyncOperation(
|
| 748 |
+
action="skip",
|
| 749 |
+
path=path,
|
| 750 |
+
size=remote_info[0],
|
| 751 |
+
reason="new file (--existing)",
|
| 752 |
+
remote_mtime=_mtime_to_iso(remote_info[1]),
|
| 753 |
+
)
|
| 754 |
+
)
|
| 755 |
+
else:
|
| 756 |
+
plan.operations.append(
|
| 757 |
+
SyncOperation(
|
| 758 |
+
action="download",
|
| 759 |
+
path=path,
|
| 760 |
+
size=remote_info[0],
|
| 761 |
+
reason="new file",
|
| 762 |
+
remote_mtime=_mtime_to_iso(remote_info[1]),
|
| 763 |
+
bucket_file=bucket_file_map.get(path),
|
| 764 |
+
)
|
| 765 |
+
)
|
| 766 |
+
elif remote_info and local_info:
|
| 767 |
+
# File exists in both - use helper to determine action
|
| 768 |
+
remote_size, remote_mtime = remote_info
|
| 769 |
+
local_size, local_mtime = local_info
|
| 770 |
+
plan.operations.append(
|
| 771 |
+
_compare_files_for_sync(
|
| 772 |
+
path=path,
|
| 773 |
+
action="download",
|
| 774 |
+
source_size=remote_size,
|
| 775 |
+
source_mtime=remote_mtime,
|
| 776 |
+
dest_size=local_size,
|
| 777 |
+
dest_mtime=local_mtime,
|
| 778 |
+
source_newer_label="remote newer",
|
| 779 |
+
dest_newer_label="local newer",
|
| 780 |
+
ignore_sizes=ignore_sizes,
|
| 781 |
+
ignore_times=ignore_times,
|
| 782 |
+
ignore_existing=ignore_existing,
|
| 783 |
+
bucket_file=bucket_file_map.get(path),
|
| 784 |
+
)
|
| 785 |
+
)
|
| 786 |
+
elif not remote_info and local_info and delete:
|
| 787 |
+
# File only in local and --delete mode
|
| 788 |
+
plan.operations.append(
|
| 789 |
+
SyncOperation(
|
| 790 |
+
action="delete",
|
| 791 |
+
path=path,
|
| 792 |
+
size=local_info[0],
|
| 793 |
+
reason="not in source (--delete)",
|
| 794 |
+
local_mtime=_mtime_to_iso(local_info[1]),
|
| 795 |
+
)
|
| 796 |
+
)
|
| 797 |
+
|
| 798 |
+
return plan
|
| 799 |
+
|
| 800 |
+
|
| 801 |
+
# =============================================================================
|
| 802 |
+
# Plan serialization
|
| 803 |
+
# =============================================================================
|
| 804 |
+
|
| 805 |
+
|
| 806 |
+
def _write_plan(plan: SyncPlan, f) -> None:
|
| 807 |
+
"""Write a sync plan as JSONL to a file-like object."""
|
| 808 |
+
# Write header
|
| 809 |
+
header = {
|
| 810 |
+
"type": "header",
|
| 811 |
+
"source": plan.source,
|
| 812 |
+
"dest": plan.dest,
|
| 813 |
+
"timestamp": plan.timestamp,
|
| 814 |
+
"summary": plan.summary(),
|
| 815 |
+
}
|
| 816 |
+
f.write(json.dumps(header) + "\n")
|
| 817 |
+
|
| 818 |
+
# Write operations
|
| 819 |
+
for op in plan.operations:
|
| 820 |
+
op_dict: dict[str, Any] = {
|
| 821 |
+
"type": "operation",
|
| 822 |
+
"action": op.action,
|
| 823 |
+
"path": op.path,
|
| 824 |
+
"reason": op.reason,
|
| 825 |
+
}
|
| 826 |
+
if op.size is not None:
|
| 827 |
+
op_dict["size"] = op.size
|
| 828 |
+
if op.local_mtime is not None:
|
| 829 |
+
op_dict["local_mtime"] = op.local_mtime
|
| 830 |
+
if op.remote_mtime is not None:
|
| 831 |
+
op_dict["remote_mtime"] = op.remote_mtime
|
| 832 |
+
f.write(json.dumps(op_dict) + "\n")
|
| 833 |
+
|
| 834 |
+
|
| 835 |
+
def _save_plan(plan: SyncPlan, plan_file: str) -> None:
|
| 836 |
+
"""Save a sync plan to a JSONL file."""
|
| 837 |
+
with open(plan_file, "w") as f:
|
| 838 |
+
_write_plan(plan, f)
|
| 839 |
+
|
| 840 |
+
|
| 841 |
+
def _load_plan(plan_file: str) -> SyncPlan:
|
| 842 |
+
"""Load a sync plan from a JSONL file."""
|
| 843 |
+
with open(plan_file) as f:
|
| 844 |
+
lines = f.readlines()
|
| 845 |
+
|
| 846 |
+
if not lines:
|
| 847 |
+
raise ValueError(f"Empty plan file: {plan_file}")
|
| 848 |
+
|
| 849 |
+
# Parse header
|
| 850 |
+
header = json.loads(lines[0])
|
| 851 |
+
if header.get("type") != "header":
|
| 852 |
+
raise ValueError("Invalid plan file: expected header as first line")
|
| 853 |
+
|
| 854 |
+
plan = SyncPlan(
|
| 855 |
+
source=header["source"],
|
| 856 |
+
dest=header["dest"],
|
| 857 |
+
timestamp=header["timestamp"],
|
| 858 |
+
)
|
| 859 |
+
|
| 860 |
+
# Parse operations
|
| 861 |
+
for line in lines[1:]:
|
| 862 |
+
op_dict = json.loads(line)
|
| 863 |
+
if op_dict.get("type") != "operation":
|
| 864 |
+
continue
|
| 865 |
+
plan.operations.append(
|
| 866 |
+
SyncOperation(
|
| 867 |
+
action=op_dict["action"],
|
| 868 |
+
path=op_dict["path"],
|
| 869 |
+
size=op_dict.get("size"),
|
| 870 |
+
reason=op_dict.get("reason", ""),
|
| 871 |
+
local_mtime=op_dict.get("local_mtime"),
|
| 872 |
+
remote_mtime=op_dict.get("remote_mtime"),
|
| 873 |
+
)
|
| 874 |
+
)
|
| 875 |
+
|
| 876 |
+
return plan
|
| 877 |
+
|
| 878 |
+
|
| 879 |
+
# =============================================================================
|
| 880 |
+
# Plan execution
|
| 881 |
+
# =============================================================================
|
| 882 |
+
|
| 883 |
+
|
| 884 |
+
def _execute_plan(plan: SyncPlan, api: "HfApi", verbose: bool = False, status: Any | None = None) -> None:
|
| 885 |
+
"""Execute a sync plan."""
|
| 886 |
+
is_upload = not _is_bucket_path(plan.source) and _is_bucket_path(plan.dest)
|
| 887 |
+
is_download = _is_bucket_path(plan.source) and not _is_bucket_path(plan.dest)
|
| 888 |
+
|
| 889 |
+
if is_upload:
|
| 890 |
+
local_path = os.path.abspath(plan.source)
|
| 891 |
+
parsed = _parse_bucket_uri(plan.dest)
|
| 892 |
+
bucket_id, prefix = parsed.id, parsed.path_in_repo
|
| 893 |
+
|
| 894 |
+
# Collect operations
|
| 895 |
+
add_files: list[tuple[str | Path | bytes, str]] = []
|
| 896 |
+
delete_paths: list[str] = []
|
| 897 |
+
|
| 898 |
+
for op in plan.operations:
|
| 899 |
+
match op.action:
|
| 900 |
+
case "upload":
|
| 901 |
+
local_file = os.path.join(local_path, op.path)
|
| 902 |
+
remote_path = f"{prefix}/{op.path}" if prefix else op.path
|
| 903 |
+
if verbose:
|
| 904 |
+
print(f" Uploading: {op.path} ({op.reason})")
|
| 905 |
+
add_files.append((local_file, remote_path))
|
| 906 |
+
case "delete":
|
| 907 |
+
remote_path = f"{prefix}/{op.path}" if prefix else op.path
|
| 908 |
+
if verbose:
|
| 909 |
+
print(f" Deleting: {op.path} ({op.reason})")
|
| 910 |
+
delete_paths.append(remote_path)
|
| 911 |
+
case "skip" if verbose:
|
| 912 |
+
print(f" Skipping: {op.path} ({op.reason})")
|
| 913 |
+
|
| 914 |
+
# Execute batch operations
|
| 915 |
+
if add_files or delete_paths:
|
| 916 |
+
if status:
|
| 917 |
+
parts = []
|
| 918 |
+
if add_files:
|
| 919 |
+
parts.append(f"uploading {len(add_files)} files")
|
| 920 |
+
if delete_paths:
|
| 921 |
+
parts.append(f"deleting {len(delete_paths)} files")
|
| 922 |
+
status.done(", ".join(parts).capitalize())
|
| 923 |
+
api.batch_bucket_files(
|
| 924 |
+
bucket_id,
|
| 925 |
+
add=add_files or None,
|
| 926 |
+
delete=delete_paths or None,
|
| 927 |
+
)
|
| 928 |
+
|
| 929 |
+
elif is_download:
|
| 930 |
+
parsed = _parse_bucket_uri(plan.source)
|
| 931 |
+
bucket_id, prefix = parsed.id, parsed.path_in_repo
|
| 932 |
+
local_path = os.path.abspath(plan.dest)
|
| 933 |
+
|
| 934 |
+
# Ensure local directory exists
|
| 935 |
+
os.makedirs(local_path, exist_ok=True)
|
| 936 |
+
|
| 937 |
+
# Collect download operations
|
| 938 |
+
download_files: list[tuple[str | BucketFile, str | Path]] = []
|
| 939 |
+
delete_files: list[str] = []
|
| 940 |
+
|
| 941 |
+
for op in plan.operations:
|
| 942 |
+
if op.action == "download":
|
| 943 |
+
local_file = os.path.join(local_path, op.path)
|
| 944 |
+
# Ensure parent directory exists
|
| 945 |
+
os.makedirs(os.path.dirname(local_file), exist_ok=True)
|
| 946 |
+
if verbose:
|
| 947 |
+
print(f" Downloading: {op.path} ({op.reason})")
|
| 948 |
+
# Use BucketFile when available (avoids extra metadata fetch per file)
|
| 949 |
+
if op.bucket_file is not None:
|
| 950 |
+
download_files.append((op.bucket_file, local_file))
|
| 951 |
+
else:
|
| 952 |
+
remote_path = f"{prefix}/{op.path}" if prefix else op.path
|
| 953 |
+
download_files.append((remote_path, local_file))
|
| 954 |
+
elif op.action == "delete":
|
| 955 |
+
local_file = os.path.join(local_path, op.path)
|
| 956 |
+
if verbose:
|
| 957 |
+
print(f" Deleting: {op.path} ({op.reason})")
|
| 958 |
+
delete_files.append(local_file)
|
| 959 |
+
elif op.action == "skip" and verbose:
|
| 960 |
+
print(f" Skipping: {op.path} ({op.reason})")
|
| 961 |
+
|
| 962 |
+
# Execute downloads
|
| 963 |
+
if len(download_files) > 0:
|
| 964 |
+
if status:
|
| 965 |
+
status.done(f"Downloading {len(download_files)} files")
|
| 966 |
+
api.download_bucket_files(bucket_id, download_files)
|
| 967 |
+
|
| 968 |
+
# Execute deletes
|
| 969 |
+
if status and delete_files:
|
| 970 |
+
status.done(f"Deleting {len(delete_files)} local files")
|
| 971 |
+
for file_path in delete_files:
|
| 972 |
+
if os.path.exists(file_path):
|
| 973 |
+
os.remove(file_path)
|
| 974 |
+
# Remove empty parent directories
|
| 975 |
+
parent = os.path.dirname(file_path)
|
| 976 |
+
while parent != local_path:
|
| 977 |
+
try:
|
| 978 |
+
os.rmdir(parent)
|
| 979 |
+
parent = os.path.dirname(parent)
|
| 980 |
+
except OSError:
|
| 981 |
+
break
|
| 982 |
+
|
| 983 |
+
|
| 984 |
+
def _print_plan_summary(plan: SyncPlan) -> None:
|
| 985 |
+
"""Print a summary of the sync plan."""
|
| 986 |
+
summary = plan.summary()
|
| 987 |
+
print(f"Sync plan: {plan.source} -> {plan.dest}")
|
| 988 |
+
print(f" Uploads: {summary['uploads']}")
|
| 989 |
+
print(f" Downloads: {summary['downloads']}")
|
| 990 |
+
print(f" Deletes: {summary['deletes']}")
|
| 991 |
+
print(f" Skips: {summary['skips']}")
|
| 992 |
+
|
| 993 |
+
|
| 994 |
+
# =============================================================================
|
| 995 |
+
# Public sync function (Python API)
|
| 996 |
+
# =============================================================================
|
| 997 |
+
|
| 998 |
+
|
| 999 |
+
def sync_bucket_internal(
|
| 1000 |
+
source: str | None = None,
|
| 1001 |
+
dest: str | None = None,
|
| 1002 |
+
*,
|
| 1003 |
+
api: "HfApi",
|
| 1004 |
+
delete: bool = False,
|
| 1005 |
+
ignore_times: bool = False,
|
| 1006 |
+
ignore_sizes: bool = False,
|
| 1007 |
+
existing: bool = False,
|
| 1008 |
+
ignore_existing: bool = False,
|
| 1009 |
+
include: list[str] | None = None,
|
| 1010 |
+
exclude: list[str] | None = None,
|
| 1011 |
+
filter_from: str | None = None,
|
| 1012 |
+
plan: str | None = None,
|
| 1013 |
+
apply: str | None = None,
|
| 1014 |
+
dry_run: bool = False,
|
| 1015 |
+
verbose: bool = False,
|
| 1016 |
+
quiet: bool = False,
|
| 1017 |
+
token: bool | str | None = None,
|
| 1018 |
+
) -> SyncPlan:
|
| 1019 |
+
"""Sync files between a local directory and a bucket.
|
| 1020 |
+
|
| 1021 |
+
This is equivalent to the ``hf buckets sync`` CLI command. One of ``source`` or ``dest`` must be a bucket path
|
| 1022 |
+
(``hf://buckets/...``) and the other must be a local directory path.
|
| 1023 |
+
|
| 1024 |
+
Args:
|
| 1025 |
+
source (`str`, *optional*):
|
| 1026 |
+
Source path: local directory or ``hf://buckets/namespace/bucket_name(/prefix)``.
|
| 1027 |
+
Required unless using ``apply``.
|
| 1028 |
+
dest (`str`, *optional*):
|
| 1029 |
+
Destination path: local directory or ``hf://buckets/namespace/bucket_name(/prefix)``.
|
| 1030 |
+
Required unless using ``apply``.
|
| 1031 |
+
api ([`HfApi`]):
|
| 1032 |
+
The HfApi instance to use for API calls.
|
| 1033 |
+
delete (`bool`, *optional*, defaults to `False`):
|
| 1034 |
+
Delete destination files not present in source.
|
| 1035 |
+
ignore_times (`bool`, *optional*, defaults to `False`):
|
| 1036 |
+
Skip files only based on size, ignoring modification times.
|
| 1037 |
+
ignore_sizes (`bool`, *optional*, defaults to `False`):
|
| 1038 |
+
Skip files only based on modification times, ignoring sizes.
|
| 1039 |
+
existing (`bool`, *optional*, defaults to `False`):
|
| 1040 |
+
Skip creating new files on receiver (only update existing files).
|
| 1041 |
+
ignore_existing (`bool`, *optional*, defaults to `False`):
|
| 1042 |
+
Skip updating files that exist on receiver (only create new files).
|
| 1043 |
+
include (`list[str]`, *optional*):
|
| 1044 |
+
Include files matching patterns (fnmatch-style).
|
| 1045 |
+
exclude (`list[str]`, *optional*):
|
| 1046 |
+
Exclude files matching patterns (fnmatch-style).
|
| 1047 |
+
filter_from (`str`, *optional*):
|
| 1048 |
+
Path to a filter file with include/exclude rules.
|
| 1049 |
+
plan (`str`, *optional*):
|
| 1050 |
+
Save sync plan to this JSONL file instead of executing.
|
| 1051 |
+
apply (`str`, *optional*):
|
| 1052 |
+
Apply a previously saved plan file. When set, ``source`` and ``dest`` are not needed.
|
| 1053 |
+
dry_run (`bool`, *optional*, defaults to `False`):
|
| 1054 |
+
Print sync plan to stdout as JSONL without executing.
|
| 1055 |
+
verbose (`bool`, *optional*, defaults to `False`):
|
| 1056 |
+
Show detailed per-file operations.
|
| 1057 |
+
quiet (`bool`, *optional*, defaults to `False`):
|
| 1058 |
+
Suppress all output and progress bars.
|
| 1059 |
+
token (Union[bool, str, None], optional):
|
| 1060 |
+
A valid user access token. If not provided, the locally saved token will be used.
|
| 1061 |
+
|
| 1062 |
+
Returns:
|
| 1063 |
+
[`SyncPlan`]: The computed (or loaded) sync plan.
|
| 1064 |
+
|
| 1065 |
+
Raises:
|
| 1066 |
+
`ValueError`: If arguments are invalid (e.g., both paths are remote, conflicting options).
|
| 1067 |
+
|
| 1068 |
+
Example:
|
| 1069 |
+
```python
|
| 1070 |
+
>>> from huggingface_hub import HfApi
|
| 1071 |
+
>>> api = HfApi()
|
| 1072 |
+
|
| 1073 |
+
# Upload local directory to bucket
|
| 1074 |
+
>>> api.sync_bucket("./data", "hf://buckets/username/my-bucket")
|
| 1075 |
+
|
| 1076 |
+
# Download bucket to local directory
|
| 1077 |
+
>>> api.sync_bucket("hf://buckets/username/my-bucket", "./data")
|
| 1078 |
+
|
| 1079 |
+
# Sync with delete and filtering
|
| 1080 |
+
>>> api.sync_bucket(
|
| 1081 |
+
... "./data",
|
| 1082 |
+
... "hf://buckets/username/my-bucket",
|
| 1083 |
+
... delete=True,
|
| 1084 |
+
... include=["*.safetensors"],
|
| 1085 |
+
... )
|
| 1086 |
+
|
| 1087 |
+
# Dry run: preview what would be synced
|
| 1088 |
+
>>> plan = api.sync_bucket("./data", "hf://buckets/username/my-bucket", dry_run=True)
|
| 1089 |
+
>>> plan.summary()
|
| 1090 |
+
{'uploads': 3, 'downloads': 0, 'deletes': 0, 'skips': 1, 'total_size': 4096}
|
| 1091 |
+
|
| 1092 |
+
# Save plan for review, then apply
|
| 1093 |
+
>>> api.sync_bucket("./data", "hf://buckets/username/my-bucket", plan="sync-plan.jsonl")
|
| 1094 |
+
>>> api.sync_bucket(apply="sync-plan.jsonl")
|
| 1095 |
+
```
|
| 1096 |
+
"""
|
| 1097 |
+
# Build API with token if needed
|
| 1098 |
+
if token is not None:
|
| 1099 |
+
from .hf_api import HfApi
|
| 1100 |
+
|
| 1101 |
+
api = HfApi(
|
| 1102 |
+
endpoint=api.endpoint,
|
| 1103 |
+
token=token,
|
| 1104 |
+
library_name=api.library_name,
|
| 1105 |
+
library_version=api.library_version,
|
| 1106 |
+
user_agent=api.user_agent,
|
| 1107 |
+
headers=api.headers,
|
| 1108 |
+
)
|
| 1109 |
+
# --- Apply mode ---
|
| 1110 |
+
if apply:
|
| 1111 |
+
if source or dest:
|
| 1112 |
+
raise ValueError("Cannot specify source/dest when using apply.")
|
| 1113 |
+
if plan is not None:
|
| 1114 |
+
raise ValueError("Cannot specify both plan and apply.")
|
| 1115 |
+
if delete:
|
| 1116 |
+
raise ValueError("Cannot specify delete when using apply.")
|
| 1117 |
+
if ignore_times:
|
| 1118 |
+
raise ValueError("Cannot specify ignore_times when using apply.")
|
| 1119 |
+
if ignore_sizes:
|
| 1120 |
+
raise ValueError("Cannot specify ignore_sizes when using apply.")
|
| 1121 |
+
if include:
|
| 1122 |
+
raise ValueError("Cannot specify include when using apply.")
|
| 1123 |
+
if exclude:
|
| 1124 |
+
raise ValueError("Cannot specify exclude when using apply.")
|
| 1125 |
+
if filter_from:
|
| 1126 |
+
raise ValueError("Cannot specify filter_from when using apply.")
|
| 1127 |
+
if existing:
|
| 1128 |
+
raise ValueError("Cannot specify existing when using apply.")
|
| 1129 |
+
if ignore_existing:
|
| 1130 |
+
raise ValueError("Cannot specify ignore_existing when using apply.")
|
| 1131 |
+
if dry_run:
|
| 1132 |
+
raise ValueError("Cannot specify dry_run when using apply.")
|
| 1133 |
+
|
| 1134 |
+
sync_plan = _load_plan(apply)
|
| 1135 |
+
status = StatusLine(enabled=not quiet)
|
| 1136 |
+
if not quiet:
|
| 1137 |
+
_print_plan_summary(sync_plan)
|
| 1138 |
+
print("Executing plan...")
|
| 1139 |
+
|
| 1140 |
+
if quiet:
|
| 1141 |
+
disable_progress_bars()
|
| 1142 |
+
try:
|
| 1143 |
+
_execute_plan(sync_plan, api, verbose=verbose, status=status)
|
| 1144 |
+
finally:
|
| 1145 |
+
if quiet:
|
| 1146 |
+
enable_progress_bars()
|
| 1147 |
+
|
| 1148 |
+
if not quiet:
|
| 1149 |
+
print("Sync completed.")
|
| 1150 |
+
|
| 1151 |
+
return sync_plan
|
| 1152 |
+
|
| 1153 |
+
# --- Normal mode ---
|
| 1154 |
+
if not source or not dest:
|
| 1155 |
+
raise ValueError("Both source and dest are required (unless using apply).")
|
| 1156 |
+
|
| 1157 |
+
source_is_bucket = _is_bucket_path(source)
|
| 1158 |
+
dest_is_bucket = _is_bucket_path(dest)
|
| 1159 |
+
|
| 1160 |
+
if source_is_bucket and dest_is_bucket:
|
| 1161 |
+
raise ValueError("Remote to remote sync is not supported. One path must be local.")
|
| 1162 |
+
|
| 1163 |
+
if not source_is_bucket and not dest_is_bucket:
|
| 1164 |
+
raise ValueError("One of source or dest must be a bucket path (hf://buckets/...).")
|
| 1165 |
+
|
| 1166 |
+
if ignore_times and ignore_sizes:
|
| 1167 |
+
raise ValueError("Cannot specify both ignore_times and ignore_sizes.")
|
| 1168 |
+
|
| 1169 |
+
if existing and ignore_existing:
|
| 1170 |
+
raise ValueError("Cannot specify both existing and ignore_existing.")
|
| 1171 |
+
|
| 1172 |
+
if dry_run and plan:
|
| 1173 |
+
raise ValueError("Cannot specify both dry_run and plan.")
|
| 1174 |
+
|
| 1175 |
+
# Validate local path
|
| 1176 |
+
if source_is_bucket:
|
| 1177 |
+
if os.path.exists(dest) and not os.path.isdir(dest):
|
| 1178 |
+
raise ValueError(f"Destination must be a directory: {dest}")
|
| 1179 |
+
else:
|
| 1180 |
+
if not os.path.isdir(source):
|
| 1181 |
+
raise ValueError(f"Source must be an existing directory: {source}")
|
| 1182 |
+
|
| 1183 |
+
# Build filter matcher
|
| 1184 |
+
filter_rules = None
|
| 1185 |
+
if filter_from:
|
| 1186 |
+
filter_rules = _parse_filter_file(filter_from)
|
| 1187 |
+
|
| 1188 |
+
filter_matcher = FilterMatcher(
|
| 1189 |
+
include_patterns=include,
|
| 1190 |
+
exclude_patterns=exclude,
|
| 1191 |
+
filter_rules=filter_rules,
|
| 1192 |
+
)
|
| 1193 |
+
|
| 1194 |
+
# Compute sync plan
|
| 1195 |
+
status = StatusLine(enabled=not quiet and not dry_run)
|
| 1196 |
+
sync_plan = _compute_sync_plan(
|
| 1197 |
+
source=source,
|
| 1198 |
+
dest=dest,
|
| 1199 |
+
api=api,
|
| 1200 |
+
delete=delete,
|
| 1201 |
+
ignore_times=ignore_times,
|
| 1202 |
+
ignore_sizes=ignore_sizes,
|
| 1203 |
+
existing=existing,
|
| 1204 |
+
ignore_existing=ignore_existing,
|
| 1205 |
+
filter_matcher=filter_matcher,
|
| 1206 |
+
status=status,
|
| 1207 |
+
)
|
| 1208 |
+
|
| 1209 |
+
if dry_run:
|
| 1210 |
+
_write_plan(sync_plan, sys.stdout)
|
| 1211 |
+
return sync_plan
|
| 1212 |
+
|
| 1213 |
+
if plan:
|
| 1214 |
+
_save_plan(sync_plan, plan)
|
| 1215 |
+
if not quiet:
|
| 1216 |
+
_print_plan_summary(sync_plan)
|
| 1217 |
+
print(f"Plan saved to: {plan}")
|
| 1218 |
+
return sync_plan
|
| 1219 |
+
|
| 1220 |
+
# Execute plan
|
| 1221 |
+
if not quiet:
|
| 1222 |
+
_print_plan_summary(sync_plan)
|
| 1223 |
+
|
| 1224 |
+
summary = sync_plan.summary()
|
| 1225 |
+
if summary["uploads"] == 0 and summary["downloads"] == 0 and summary["deletes"] == 0:
|
| 1226 |
+
if not quiet:
|
| 1227 |
+
print("Nothing to sync.")
|
| 1228 |
+
return sync_plan
|
| 1229 |
+
|
| 1230 |
+
if not quiet:
|
| 1231 |
+
print("Syncing...")
|
| 1232 |
+
|
| 1233 |
+
if quiet:
|
| 1234 |
+
disable_progress_bars()
|
| 1235 |
+
try:
|
| 1236 |
+
_execute_plan(sync_plan, api, verbose=verbose, status=status)
|
| 1237 |
+
finally:
|
| 1238 |
+
if quiet:
|
| 1239 |
+
enable_progress_bars()
|
| 1240 |
+
|
| 1241 |
+
if not quiet:
|
| 1242 |
+
print("Sync completed.")
|
| 1243 |
+
|
| 1244 |
+
return sync_plan
|
.cache/uv/archive-v0/WbiZCgDidtA5T1uiQ47d5/huggingface_hub/_commit_api.py
ADDED
|
@@ -0,0 +1,1075 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 5 |
+
import base64
|
| 6 |
+
import io
|
| 7 |
+
import json
|
| 8 |
+
import os
|
| 9 |
+
import warnings
|
| 10 |
+
from collections import defaultdict
|
| 11 |
+
from collections.abc import Iterable, Iterator
|
| 12 |
+
from concurrent.futures import ThreadPoolExecutor
|
| 13 |
+
from contextlib import contextmanager
|
| 14 |
+
from dataclasses import dataclass, field
|
| 15 |
+
from itertools import groupby
|
| 16 |
+
from pathlib import Path, PurePosixPath
|
| 17 |
+
from typing import TYPE_CHECKING, Any, BinaryIO, Literal, NamedTuple, Union
|
| 18 |
+
|
| 19 |
+
from tqdm.contrib.concurrent import thread_map
|
| 20 |
+
|
| 21 |
+
from . import constants
|
| 22 |
+
from .errors import EntryNotFoundError
|
| 23 |
+
from .file_download import hf_hub_url
|
| 24 |
+
from .lfs import UploadInfo, lfs_upload, post_lfs_batch_info
|
| 25 |
+
from .utils import (
|
| 26 |
+
FORBIDDEN_FOLDERS,
|
| 27 |
+
are_progress_bars_disabled,
|
| 28 |
+
chunk_iterable,
|
| 29 |
+
get_session,
|
| 30 |
+
hf_raise_for_status,
|
| 31 |
+
http_backoff,
|
| 32 |
+
logging,
|
| 33 |
+
sha,
|
| 34 |
+
tqdm_stream_file,
|
| 35 |
+
validate_hf_hub_args,
|
| 36 |
+
)
|
| 37 |
+
from .utils import tqdm as hf_tqdm
|
| 38 |
+
from .utils._runtime import is_xet_available
|
| 39 |
+
|
| 40 |
+
|
| 41 |
+
if TYPE_CHECKING:
|
| 42 |
+
from .hf_api import CommitInfo, RepoFile
|
| 43 |
+
|
| 44 |
+
|
| 45 |
+
logger = logging.get_logger(__name__)
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
UploadMode = Literal["lfs", "regular"]
|
| 49 |
+
|
| 50 |
+
# Max is 1,000 per request on the Hub for HfApi.get_paths_info
|
| 51 |
+
# Otherwise we get:
|
| 52 |
+
# HfHubHTTPError: 413 Client Error: Payload Too Large for url: https://huggingface.co/api/datasets/xxx (Request ID: xxx)\n\ntoo many parameters
|
| 53 |
+
# See https://github.com/huggingface/huggingface_hub/issues/1503
|
| 54 |
+
FETCH_LFS_BATCH_SIZE = 500
|
| 55 |
+
DUPLICATE_LFS_BATCH_SIZE = 500
|
| 56 |
+
|
| 57 |
+
UPLOAD_BATCH_MAX_NUM_FILES = 256
|
| 58 |
+
|
| 59 |
+
|
| 60 |
+
@dataclass
|
| 61 |
+
class CommitOperationDelete:
|
| 62 |
+
"""
|
| 63 |
+
Data structure holding necessary info to delete a file or a folder from a repository
|
| 64 |
+
on the Hub.
|
| 65 |
+
|
| 66 |
+
Args:
|
| 67 |
+
path_in_repo (`str`):
|
| 68 |
+
Relative filepath in the repo, for example: `"checkpoints/1fec34a/weights.bin"`
|
| 69 |
+
for a file or `"checkpoints/1fec34a/"` for a folder.
|
| 70 |
+
is_folder (`bool` or `Literal["auto"]`, *optional*)
|
| 71 |
+
Whether the Delete Operation applies to a folder or not. If "auto", the path
|
| 72 |
+
type (file or folder) is guessed automatically by looking if path ends with
|
| 73 |
+
a "/" (folder) or not (file). To explicitly set the path type, you can set
|
| 74 |
+
`is_folder=True` or `is_folder=False`.
|
| 75 |
+
"""
|
| 76 |
+
|
| 77 |
+
path_in_repo: str
|
| 78 |
+
is_folder: bool | Literal["auto"] = "auto"
|
| 79 |
+
|
| 80 |
+
def __post_init__(self):
|
| 81 |
+
self.path_in_repo = _validate_path_in_repo(self.path_in_repo)
|
| 82 |
+
|
| 83 |
+
if self.is_folder == "auto":
|
| 84 |
+
self.is_folder = self.path_in_repo.endswith("/")
|
| 85 |
+
if not isinstance(self.is_folder, bool):
|
| 86 |
+
raise ValueError(
|
| 87 |
+
f"Wrong value for `is_folder`. Must be one of [`True`, `False`, `'auto'`]. Got '{self.is_folder}'."
|
| 88 |
+
)
|
| 89 |
+
|
| 90 |
+
|
| 91 |
+
@dataclass
|
| 92 |
+
class CommitOperationCopy:
|
| 93 |
+
"""
|
| 94 |
+
Data structure holding necessary info to copy a file in a repository on the Hub.
|
| 95 |
+
|
| 96 |
+
Both LFS files and regular files are supported. LFS files are copied server-side while regular files are
|
| 97 |
+
downloaded and re-uploaded as part of the commit.
|
| 98 |
+
|
| 99 |
+
Cross-repository copies are supported by setting `src_repo_id` and `src_repo_type`. For cross-repo LFS copies,
|
| 100 |
+
the LFS objects are duplicated to the destination repository before the commit is created. This is handled
|
| 101 |
+
automatically by [`create_commit`]. Note that cross-repository copies only work within the same
|
| 102 |
+
[storage region](https://huggingface.co/docs/hub/storage-regions); copying across regions is not supported.
|
| 103 |
+
|
| 104 |
+
Note: you can combine a [`CommitOperationCopy`] and a [`CommitOperationDelete`] to rename an LFS file on the Hub.
|
| 105 |
+
|
| 106 |
+
Args:
|
| 107 |
+
src_path_in_repo (`str`):
|
| 108 |
+
Relative filepath in the repo of the file to be copied, e.g. `"checkpoints/1fec34a/weights.bin"`.
|
| 109 |
+
path_in_repo (`str`):
|
| 110 |
+
Relative filepath in the repo where to copy the file, e.g. `"checkpoints/1fec34a/weights_copy.bin"`.
|
| 111 |
+
src_revision (`str`, *optional*):
|
| 112 |
+
The git revision of the file to be copied. Can be any valid git revision.
|
| 113 |
+
Default to the target commit revision.
|
| 114 |
+
src_repo_id (`str`, *optional*):
|
| 115 |
+
The source repository to copy from (e.g. `"username/source-model"`).
|
| 116 |
+
Default to the destination repository (intra-repo copy).
|
| 117 |
+
src_repo_type (`str`, *optional*):
|
| 118 |
+
The type of the source repository (`"model"`, `"dataset"` or `"space"`).
|
| 119 |
+
Required when `src_repo_id` is set.
|
| 120 |
+
"""
|
| 121 |
+
|
| 122 |
+
src_path_in_repo: str
|
| 123 |
+
path_in_repo: str
|
| 124 |
+
src_revision: str | None = None
|
| 125 |
+
src_repo_id: str | None = None
|
| 126 |
+
src_repo_type: str | None = None
|
| 127 |
+
# set to the OID of the file to be copied if it has already been uploaded
|
| 128 |
+
# useful to determine if a commit will be empty or not.
|
| 129 |
+
_src_oid: str | None = None
|
| 130 |
+
# set to the OID of the file to copy to if it has already been uploaded
|
| 131 |
+
# useful to determine if a commit will be empty or not.
|
| 132 |
+
_dest_oid: str | None = None
|
| 133 |
+
# set to True once cross-repo LFS files have been duplicated to the destination repo
|
| 134 |
+
_is_duplicated: bool = False
|
| 135 |
+
|
| 136 |
+
def __post_init__(self):
|
| 137 |
+
self.src_path_in_repo = _validate_path_in_repo(self.src_path_in_repo)
|
| 138 |
+
self.path_in_repo = _validate_path_in_repo(self.path_in_repo)
|
| 139 |
+
if self.src_repo_id is not None and self.src_repo_type is None:
|
| 140 |
+
raise ValueError("`src_repo_type` is required when `src_repo_id` is set.")
|
| 141 |
+
if self.src_repo_type is not None and self.src_repo_id is None:
|
| 142 |
+
raise ValueError("`src_repo_id` is required when `src_repo_type` is set.")
|
| 143 |
+
|
| 144 |
+
|
| 145 |
+
@dataclass
|
| 146 |
+
class CommitOperationAdd:
|
| 147 |
+
"""
|
| 148 |
+
Data structure holding necessary info to upload a file to a repository on the Hub.
|
| 149 |
+
|
| 150 |
+
Args:
|
| 151 |
+
path_in_repo (`str`):
|
| 152 |
+
Relative filepath in the repo, for example: `"checkpoints/1fec34a/weights.bin"`
|
| 153 |
+
path_or_fileobj (`str`, `Path`, `bytes`, or `BinaryIO`):
|
| 154 |
+
Either:
|
| 155 |
+
- a path to a local file (as `str` or `pathlib.Path`) to upload
|
| 156 |
+
- a buffer of bytes (`bytes`) holding the content of the file to upload
|
| 157 |
+
- a "file object" (subclass of `io.BufferedIOBase`), typically obtained
|
| 158 |
+
with `open(path, "rb")`. It must support `seek()` and `tell()` methods.
|
| 159 |
+
|
| 160 |
+
Raises:
|
| 161 |
+
[`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError)
|
| 162 |
+
If `path_or_fileobj` is not one of `str`, `Path`, `bytes` or `io.BufferedIOBase`.
|
| 163 |
+
[`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError)
|
| 164 |
+
If `path_or_fileobj` is a `str` or `Path` but not a path to an existing file.
|
| 165 |
+
[`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError)
|
| 166 |
+
If `path_or_fileobj` is a `io.BufferedIOBase` but it doesn't support both
|
| 167 |
+
`seek()` and `tell()`.
|
| 168 |
+
"""
|
| 169 |
+
|
| 170 |
+
path_in_repo: str
|
| 171 |
+
path_or_fileobj: str | Path | bytes | BinaryIO
|
| 172 |
+
upload_info: UploadInfo = field(init=False, repr=False)
|
| 173 |
+
|
| 174 |
+
# Internal attributes
|
| 175 |
+
|
| 176 |
+
# set to "lfs" or "regular" once known
|
| 177 |
+
_upload_mode: UploadMode | None = field(init=False, repr=False, default=None)
|
| 178 |
+
|
| 179 |
+
# set to True if .gitignore rules prevent the file from being uploaded as LFS
|
| 180 |
+
# (server-side check)
|
| 181 |
+
_should_ignore: bool | None = field(init=False, repr=False, default=None)
|
| 182 |
+
|
| 183 |
+
# set to the remote OID of the file if it has already been uploaded
|
| 184 |
+
# useful to determine if a commit will be empty or not
|
| 185 |
+
_remote_oid: str | None = field(init=False, repr=False, default=None)
|
| 186 |
+
|
| 187 |
+
# set to True once the file has been uploaded as LFS
|
| 188 |
+
_is_uploaded: bool = field(init=False, repr=False, default=False)
|
| 189 |
+
|
| 190 |
+
# set to True once the file has been committed
|
| 191 |
+
_is_committed: bool = field(init=False, repr=False, default=False)
|
| 192 |
+
|
| 193 |
+
def __post_init__(self) -> None:
|
| 194 |
+
"""Validates `path_or_fileobj` and compute `upload_info`."""
|
| 195 |
+
self.path_in_repo = _validate_path_in_repo(self.path_in_repo)
|
| 196 |
+
|
| 197 |
+
# Validate `path_or_fileobj` value
|
| 198 |
+
if isinstance(self.path_or_fileobj, Path):
|
| 199 |
+
self.path_or_fileobj = str(self.path_or_fileobj)
|
| 200 |
+
if isinstance(self.path_or_fileobj, str):
|
| 201 |
+
path_or_fileobj = os.path.normpath(os.path.expanduser(self.path_or_fileobj))
|
| 202 |
+
if not os.path.isfile(path_or_fileobj):
|
| 203 |
+
raise ValueError(f"Provided path: '{path_or_fileobj}' is not a file on the local file system")
|
| 204 |
+
elif not isinstance(self.path_or_fileobj, (io.BufferedIOBase, bytes)):
|
| 205 |
+
# ^^ Inspired from: https://stackoverflow.com/questions/44584829/how-to-determine-if-file-is-opened-in-binary-or-text-mode
|
| 206 |
+
raise ValueError(
|
| 207 |
+
"path_or_fileobj must be either an instance of str, bytes or"
|
| 208 |
+
" io.BufferedIOBase. If you passed a file-like object, make sure it is"
|
| 209 |
+
" in binary mode."
|
| 210 |
+
)
|
| 211 |
+
if isinstance(self.path_or_fileobj, io.BufferedIOBase):
|
| 212 |
+
try:
|
| 213 |
+
self.path_or_fileobj.tell()
|
| 214 |
+
self.path_or_fileobj.seek(0, os.SEEK_CUR)
|
| 215 |
+
except (OSError, AttributeError) as exc:
|
| 216 |
+
raise ValueError(
|
| 217 |
+
"path_or_fileobj is a file-like object but does not implement seek() and tell()"
|
| 218 |
+
) from exc
|
| 219 |
+
|
| 220 |
+
# Compute "upload_info" attribute
|
| 221 |
+
if isinstance(self.path_or_fileobj, str):
|
| 222 |
+
self.upload_info = UploadInfo.from_path(self.path_or_fileobj)
|
| 223 |
+
elif isinstance(self.path_or_fileobj, bytes):
|
| 224 |
+
self.upload_info = UploadInfo.from_bytes(self.path_or_fileobj)
|
| 225 |
+
else:
|
| 226 |
+
self.upload_info = UploadInfo.from_fileobj(self.path_or_fileobj)
|
| 227 |
+
|
| 228 |
+
@contextmanager
|
| 229 |
+
def as_file(self, with_tqdm: bool = False) -> Iterator[BinaryIO]:
|
| 230 |
+
"""
|
| 231 |
+
A context manager that yields a file-like object allowing to read the underlying
|
| 232 |
+
data behind `path_or_fileobj`.
|
| 233 |
+
|
| 234 |
+
Args:
|
| 235 |
+
with_tqdm (`bool`, *optional*, defaults to `False`):
|
| 236 |
+
If True, iterating over the file object will display a progress bar. Only
|
| 237 |
+
works if the file-like object is a path to a file. Pure bytes and buffers
|
| 238 |
+
are not supported.
|
| 239 |
+
|
| 240 |
+
Example:
|
| 241 |
+
|
| 242 |
+
```python
|
| 243 |
+
>>> operation = CommitOperationAdd(
|
| 244 |
+
... path_in_repo="remote/dir/weights.h5",
|
| 245 |
+
... path_or_fileobj="./local/weights.h5",
|
| 246 |
+
... )
|
| 247 |
+
CommitOperationAdd(path_in_repo='remote/dir/weights.h5', path_or_fileobj='./local/weights.h5')
|
| 248 |
+
|
| 249 |
+
>>> with operation.as_file() as file:
|
| 250 |
+
... content = file.read()
|
| 251 |
+
|
| 252 |
+
>>> with operation.as_file(with_tqdm=True) as file:
|
| 253 |
+
... while True:
|
| 254 |
+
... data = file.read(1024)
|
| 255 |
+
... if not data:
|
| 256 |
+
... break
|
| 257 |
+
config.json: 100%|█████████████████████████| 8.19k/8.19k [00:02<00:00, 3.72kB/s]
|
| 258 |
+
|
| 259 |
+
>>> with operation.as_file(with_tqdm=True) as file:
|
| 260 |
+
... httpx.put(..., data=file)
|
| 261 |
+
config.json: 100%|█████████████████████████| 8.19k/8.19k [00:02<00:00, 3.72kB/s]
|
| 262 |
+
```
|
| 263 |
+
"""
|
| 264 |
+
if isinstance(self.path_or_fileobj, str) or isinstance(self.path_or_fileobj, Path):
|
| 265 |
+
if with_tqdm:
|
| 266 |
+
with tqdm_stream_file(self.path_or_fileobj) as file:
|
| 267 |
+
yield file
|
| 268 |
+
else:
|
| 269 |
+
with open(self.path_or_fileobj, "rb") as file:
|
| 270 |
+
yield file
|
| 271 |
+
elif isinstance(self.path_or_fileobj, bytes):
|
| 272 |
+
yield io.BytesIO(self.path_or_fileobj)
|
| 273 |
+
elif isinstance(self.path_or_fileobj, io.BufferedIOBase):
|
| 274 |
+
prev_pos = self.path_or_fileobj.tell()
|
| 275 |
+
yield self.path_or_fileobj
|
| 276 |
+
self.path_or_fileobj.seek(prev_pos, io.SEEK_SET)
|
| 277 |
+
|
| 278 |
+
def b64content(self) -> bytes:
|
| 279 |
+
"""
|
| 280 |
+
The base64-encoded content of `path_or_fileobj`
|
| 281 |
+
|
| 282 |
+
Returns: `bytes`
|
| 283 |
+
"""
|
| 284 |
+
with self.as_file() as file:
|
| 285 |
+
return base64.b64encode(file.read())
|
| 286 |
+
|
| 287 |
+
@property
|
| 288 |
+
def _local_oid(self) -> str | None:
|
| 289 |
+
"""Return the OID of the local file.
|
| 290 |
+
|
| 291 |
+
This OID is then compared to `self._remote_oid` to check if the file has changed compared to the remote one.
|
| 292 |
+
If the file did not change, we won't upload it again to prevent empty commits.
|
| 293 |
+
|
| 294 |
+
For LFS files, the OID corresponds to the SHA256 of the file content (used a LFS ref).
|
| 295 |
+
For regular files, the OID corresponds to the SHA1 of the file content.
|
| 296 |
+
Note: this is slightly different to git OID computation since the oid of an LFS file is usually the git-SHA1 of the
|
| 297 |
+
pointer file content (not the actual file content). However, using the SHA256 is enough to detect changes
|
| 298 |
+
and more convenient client-side.
|
| 299 |
+
"""
|
| 300 |
+
if self._upload_mode is None:
|
| 301 |
+
return None
|
| 302 |
+
elif self._upload_mode == "lfs":
|
| 303 |
+
return self.upload_info.sha256.hex()
|
| 304 |
+
else:
|
| 305 |
+
# Regular file => compute sha1
|
| 306 |
+
# => no need to read by chunk since the file is guaranteed to be <=5MB.
|
| 307 |
+
with self.as_file() as file:
|
| 308 |
+
return sha.git_hash(file.read())
|
| 309 |
+
|
| 310 |
+
|
| 311 |
+
def _validate_path_in_repo(path_in_repo: str) -> str:
|
| 312 |
+
# Validate `path_in_repo` value to prevent a server-side issue
|
| 313 |
+
if path_in_repo.startswith("/"):
|
| 314 |
+
path_in_repo = path_in_repo[1:]
|
| 315 |
+
if path_in_repo == "." or path_in_repo == ".." or path_in_repo.startswith("../"):
|
| 316 |
+
raise ValueError(f"Invalid `path_in_repo` in CommitOperation: '{path_in_repo}'")
|
| 317 |
+
if path_in_repo.startswith("./"):
|
| 318 |
+
path_in_repo = path_in_repo[2:]
|
| 319 |
+
for forbidden in FORBIDDEN_FOLDERS:
|
| 320 |
+
if any(part == forbidden for part in path_in_repo.split("/")):
|
| 321 |
+
raise ValueError(
|
| 322 |
+
f"Invalid `path_in_repo` in CommitOperation: cannot update files under a '{forbidden}/' folder (path:"
|
| 323 |
+
f" '{path_in_repo}')."
|
| 324 |
+
)
|
| 325 |
+
return path_in_repo
|
| 326 |
+
|
| 327 |
+
|
| 328 |
+
CommitOperation = Union[CommitOperationAdd, CommitOperationCopy, CommitOperationDelete]
|
| 329 |
+
|
| 330 |
+
|
| 331 |
+
def _warn_on_overwriting_operations(operations: list[CommitOperation]) -> None:
|
| 332 |
+
"""
|
| 333 |
+
Warn user when a list of operations is expected to overwrite itself in a single
|
| 334 |
+
commit.
|
| 335 |
+
|
| 336 |
+
Rules:
|
| 337 |
+
- If a filepath is updated by multiple `CommitOperationAdd` operations, a warning
|
| 338 |
+
message is triggered.
|
| 339 |
+
- If a filepath is updated at least once by a `CommitOperationAdd` and then deleted
|
| 340 |
+
by a `CommitOperationDelete`, a warning is triggered.
|
| 341 |
+
- If a `CommitOperationDelete` deletes a filepath that is then updated by a
|
| 342 |
+
`CommitOperationAdd`, no warning is triggered. This is usually useless (no need to
|
| 343 |
+
delete before upload) but can happen if a user deletes an entire folder and then
|
| 344 |
+
add new files to it.
|
| 345 |
+
"""
|
| 346 |
+
nb_additions_per_path: dict[str, int] = defaultdict(int)
|
| 347 |
+
for operation in operations:
|
| 348 |
+
path_in_repo = operation.path_in_repo
|
| 349 |
+
if isinstance(operation, CommitOperationAdd):
|
| 350 |
+
if nb_additions_per_path[path_in_repo] > 0:
|
| 351 |
+
warnings.warn(
|
| 352 |
+
"About to update multiple times the same file in the same commit:"
|
| 353 |
+
f" '{path_in_repo}'. This can cause undesired inconsistencies in"
|
| 354 |
+
" your repo."
|
| 355 |
+
)
|
| 356 |
+
nb_additions_per_path[path_in_repo] += 1
|
| 357 |
+
for parent in PurePosixPath(path_in_repo).parents:
|
| 358 |
+
# Also keep track of number of updated files per folder
|
| 359 |
+
# => warns if deleting a folder overwrite some contained files
|
| 360 |
+
nb_additions_per_path[str(parent)] += 1
|
| 361 |
+
if isinstance(operation, CommitOperationDelete):
|
| 362 |
+
if nb_additions_per_path[str(PurePosixPath(path_in_repo))] > 0:
|
| 363 |
+
if operation.is_folder:
|
| 364 |
+
warnings.warn(
|
| 365 |
+
"About to delete a folder containing files that have just been"
|
| 366 |
+
f" updated within the same commit: '{path_in_repo}'. This can"
|
| 367 |
+
" cause undesired inconsistencies in your repo."
|
| 368 |
+
)
|
| 369 |
+
else:
|
| 370 |
+
warnings.warn(
|
| 371 |
+
"About to delete a file that have just been updated within the"
|
| 372 |
+
f" same commit: '{path_in_repo}'. This can cause undesired"
|
| 373 |
+
" inconsistencies in your repo."
|
| 374 |
+
)
|
| 375 |
+
|
| 376 |
+
|
| 377 |
+
@validate_hf_hub_args
|
| 378 |
+
def _upload_files(
|
| 379 |
+
*,
|
| 380 |
+
additions: list[CommitOperationAdd],
|
| 381 |
+
repo_type: str,
|
| 382 |
+
repo_id: str,
|
| 383 |
+
headers: dict[str, str],
|
| 384 |
+
endpoint: str | None = None,
|
| 385 |
+
num_threads: int = 5,
|
| 386 |
+
revision: str | None = None,
|
| 387 |
+
create_pr: bool | None = None,
|
| 388 |
+
):
|
| 389 |
+
"""
|
| 390 |
+
Uploads the files through the Xet protocol if possible, otherwise through the legacy LFS protocol.
|
| 391 |
+
|
| 392 |
+
The Xet path does not require any Python-side sha256 computation: hashing happens inside `hf_xet`
|
| 393 |
+
while chunking the files (single read pass) and is backfilled on the operations afterwards.
|
| 394 |
+
"""
|
| 395 |
+
has_buffered_io_data = any(isinstance(op.path_or_fileobj, io.BufferedIOBase) for op in additions)
|
| 396 |
+
if is_xet_available():
|
| 397 |
+
if not has_buffered_io_data:
|
| 398 |
+
_upload_xet_files(
|
| 399 |
+
additions=additions,
|
| 400 |
+
repo_type=repo_type,
|
| 401 |
+
repo_id=repo_id,
|
| 402 |
+
headers=headers,
|
| 403 |
+
endpoint=endpoint,
|
| 404 |
+
revision=revision,
|
| 405 |
+
create_pr=create_pr,
|
| 406 |
+
)
|
| 407 |
+
return
|
| 408 |
+
logger.warning(
|
| 409 |
+
"Uploading files as a binary IO buffer is not supported by Xet Storage. Falling back to HTTP upload."
|
| 410 |
+
)
|
| 411 |
+
|
| 412 |
+
# Legacy LFS path: sha256 is required by the LFS batch endpoint => compute missing ones (in parallel).
|
| 413 |
+
_compute_missing_sha256s(additions, num_threads=num_threads)
|
| 414 |
+
|
| 415 |
+
lfs_actions: list[dict[str, Any]] = []
|
| 416 |
+
lfs_oid2addop: dict[str, CommitOperationAdd] = {}
|
| 417 |
+
for chunk in chunk_iterable(additions, chunk_size=UPLOAD_BATCH_MAX_NUM_FILES):
|
| 418 |
+
chunk_list = [op for op in chunk]
|
| 419 |
+
actions_chunk, errors_chunk, _ = post_lfs_batch_info(
|
| 420 |
+
upload_infos=[op.upload_info for op in chunk_list],
|
| 421 |
+
repo_id=repo_id,
|
| 422 |
+
repo_type=repo_type,
|
| 423 |
+
revision=revision,
|
| 424 |
+
endpoint=endpoint,
|
| 425 |
+
headers=headers,
|
| 426 |
+
token=None, # already passed in 'headers'
|
| 427 |
+
transfers=["basic", "multipart"],
|
| 428 |
+
)
|
| 429 |
+
if errors_chunk:
|
| 430 |
+
message = "\n".join(
|
| 431 |
+
[
|
| 432 |
+
f"Encountered error for file with OID {err.get('oid')}: `{err.get('error', {}).get('message')}"
|
| 433 |
+
for err in errors_chunk
|
| 434 |
+
]
|
| 435 |
+
)
|
| 436 |
+
raise ValueError(f"LFS batch API returned errors:\n{message}")
|
| 437 |
+
lfs_actions.extend(actions_chunk)
|
| 438 |
+
for op in chunk_list:
|
| 439 |
+
lfs_oid2addop[op.upload_info.sha256.hex()] = op
|
| 440 |
+
|
| 441 |
+
if len(lfs_actions) > 0:
|
| 442 |
+
_upload_lfs_files(
|
| 443 |
+
actions=lfs_actions,
|
| 444 |
+
oid2addop=lfs_oid2addop,
|
| 445 |
+
headers=headers,
|
| 446 |
+
endpoint=endpoint,
|
| 447 |
+
num_threads=num_threads,
|
| 448 |
+
)
|
| 449 |
+
|
| 450 |
+
|
| 451 |
+
def _compute_missing_sha256s(additions: list[CommitOperationAdd], num_threads: int) -> None:
|
| 452 |
+
"""Compute the sha256 of the operations that don't have one yet, in parallel."""
|
| 453 |
+
not_hashed = [op for op in additions if not op.upload_info.is_hashed]
|
| 454 |
+
if len(not_hashed) == 0:
|
| 455 |
+
return
|
| 456 |
+
logger.info(f"Computing sha256 for {len(not_hashed)} files.")
|
| 457 |
+
if len(not_hashed) == 1:
|
| 458 |
+
_ = not_hashed[0].upload_info.sha256
|
| 459 |
+
return
|
| 460 |
+
with ThreadPoolExecutor(max_workers=num_threads) as executor:
|
| 461 |
+
list(executor.map(lambda op: op.upload_info.sha256, not_hashed))
|
| 462 |
+
|
| 463 |
+
|
| 464 |
+
@validate_hf_hub_args
|
| 465 |
+
def _upload_lfs_files(
|
| 466 |
+
*,
|
| 467 |
+
actions: list[dict[str, Any]],
|
| 468 |
+
oid2addop: dict[str, CommitOperationAdd],
|
| 469 |
+
headers: dict[str, str],
|
| 470 |
+
endpoint: str | None = None,
|
| 471 |
+
num_threads: int = 5,
|
| 472 |
+
):
|
| 473 |
+
"""
|
| 474 |
+
Uploads the content of `additions` to the Hub using the large file storage protocol.
|
| 475 |
+
|
| 476 |
+
Relevant external documentation:
|
| 477 |
+
- LFS Batch API: https://github.com/git-lfs/git-lfs/blob/main/docs/api/batch.md
|
| 478 |
+
|
| 479 |
+
Args:
|
| 480 |
+
actions (`list[dict[str, Any]]`):
|
| 481 |
+
LFS batch actions returned by the server.
|
| 482 |
+
oid2addop (`dict[str, CommitOperationAdd]`):
|
| 483 |
+
A dictionary mapping the OID of the file to the corresponding `CommitOperationAdd` object.
|
| 484 |
+
headers (`dict[str, str]`):
|
| 485 |
+
Headers to use for the request, including authorization headers and user agent.
|
| 486 |
+
endpoint (`str`, *optional*):
|
| 487 |
+
The endpoint to use for the request. Defaults to `constants.ENDPOINT`.
|
| 488 |
+
num_threads (`int`, *optional*):
|
| 489 |
+
The number of concurrent threads to use when uploading. Defaults to 5.
|
| 490 |
+
|
| 491 |
+
Raises:
|
| 492 |
+
[`EnvironmentError`](https://docs.python.org/3/library/exceptions.html#EnvironmentError)
|
| 493 |
+
If an upload failed for any reason
|
| 494 |
+
[`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError)
|
| 495 |
+
Type of the repo to upload to: `"model"`, `"dataset"` or `"space"`.
|
| 496 |
+
repo_id (`str`):
|
| 497 |
+
A namespace (user or an organization) and a repo name separated
|
| 498 |
+
by a `/`.
|
| 499 |
+
headers (`dict[str, str]`):
|
| 500 |
+
Headers to use for the request, including authorization headers and user agent.
|
| 501 |
+
num_threads (`int`, *optional*):
|
| 502 |
+
The number of concurrent threads to use when uploading. Defaults to 5.
|
| 503 |
+
revision (`str`, *optional*):
|
| 504 |
+
The git revision to upload to.
|
| 505 |
+
|
| 506 |
+
Raises:
|
| 507 |
+
[`EnvironmentError`](https://docs.python.org/3/library/exceptions.html#EnvironmentError)
|
| 508 |
+
If an upload failed for any reason
|
| 509 |
+
[`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError)
|
| 510 |
+
If the server returns malformed responses
|
| 511 |
+
[`HfHubHTTPError`]
|
| 512 |
+
If the LFS batch endpoint returned an HTTP error.
|
| 513 |
+
"""
|
| 514 |
+
# Filter out files already present upstream
|
| 515 |
+
filtered_actions = []
|
| 516 |
+
for action in actions:
|
| 517 |
+
if action.get("actions") is None:
|
| 518 |
+
logger.debug(
|
| 519 |
+
f"Content of file {oid2addop[action['oid']].path_in_repo} is already present upstream - skipping upload."
|
| 520 |
+
)
|
| 521 |
+
else:
|
| 522 |
+
filtered_actions.append(action)
|
| 523 |
+
|
| 524 |
+
# Upload according to server-provided actions
|
| 525 |
+
def _wrapped_lfs_upload(batch_action) -> None:
|
| 526 |
+
try:
|
| 527 |
+
operation = oid2addop[batch_action["oid"]]
|
| 528 |
+
lfs_upload(operation=operation, lfs_batch_action=batch_action, headers=headers, endpoint=endpoint)
|
| 529 |
+
except Exception as exc:
|
| 530 |
+
raise RuntimeError(f"Error while uploading '{operation.path_in_repo}' to the Hub.") from exc
|
| 531 |
+
|
| 532 |
+
if len(filtered_actions) == 1:
|
| 533 |
+
logger.debug("Uploading 1 LFS file to the Hub")
|
| 534 |
+
_wrapped_lfs_upload(filtered_actions[0])
|
| 535 |
+
else:
|
| 536 |
+
logger.debug(
|
| 537 |
+
f"Uploading {len(filtered_actions)} LFS files to the Hub using up to {num_threads} threads concurrently"
|
| 538 |
+
)
|
| 539 |
+
thread_map(
|
| 540 |
+
_wrapped_lfs_upload,
|
| 541 |
+
filtered_actions,
|
| 542 |
+
desc=f"Upload {len(filtered_actions)} LFS files",
|
| 543 |
+
max_workers=num_threads,
|
| 544 |
+
tqdm_class=hf_tqdm,
|
| 545 |
+
)
|
| 546 |
+
|
| 547 |
+
|
| 548 |
+
@validate_hf_hub_args
|
| 549 |
+
def _upload_xet_files(
|
| 550 |
+
*,
|
| 551 |
+
additions: list[CommitOperationAdd],
|
| 552 |
+
repo_type: str,
|
| 553 |
+
repo_id: str,
|
| 554 |
+
headers: dict[str, str],
|
| 555 |
+
endpoint: str | None = None,
|
| 556 |
+
revision: str | None = None,
|
| 557 |
+
create_pr: bool | None = None,
|
| 558 |
+
):
|
| 559 |
+
"""
|
| 560 |
+
Uploads the content of `additions` to the Hub using the xet storage protocol.
|
| 561 |
+
This chunks the files and deduplicates the chunks before uploading them to xetcas storage.
|
| 562 |
+
|
| 563 |
+
Args:
|
| 564 |
+
additions (`` of `CommitOperationAdd`):
|
| 565 |
+
The files to be uploaded.
|
| 566 |
+
repo_type (`str`):
|
| 567 |
+
Type of the repo (e.g. `"model"`, `"dataset"`, `"space"`).
|
| 568 |
+
repo_id (`str`):
|
| 569 |
+
A namespace (user or an organization) and a repo name separated
|
| 570 |
+
by a `/`.
|
| 571 |
+
headers (`dict[str, str]`):
|
| 572 |
+
Headers to use for the request, including authorization headers and user agent.
|
| 573 |
+
endpoint: (`str`, *optional*):
|
| 574 |
+
The endpoint to use for the xetcas service. Defaults to `constants.ENDPOINT`.
|
| 575 |
+
revision (`str`, *optional*):
|
| 576 |
+
The git revision to upload to.
|
| 577 |
+
create_pr (`bool`, *optional*):
|
| 578 |
+
Whether or not to create a Pull Request with that commit.
|
| 579 |
+
|
| 580 |
+
Raises:
|
| 581 |
+
[`EnvironmentError`](https://docs.python.org/3/library/exceptions.html#EnvironmentError)
|
| 582 |
+
If an upload failed for any reason.
|
| 583 |
+
[`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError)
|
| 584 |
+
If the server returns malformed responses or if the user is unauthorized to upload to xet storage.
|
| 585 |
+
[`HfHubHTTPError`]
|
| 586 |
+
If the LFS batch endpoint returned an HTTP error.
|
| 587 |
+
|
| 588 |
+
**How it works:**
|
| 589 |
+
The file upload system uses Xet storage, which is a content-addressable storage system that breaks files into chunks
|
| 590 |
+
for efficient storage and transfer.
|
| 591 |
+
|
| 592 |
+
``session.new_upload_commit()`` manages uploading files by:
|
| 593 |
+
- Registering upload tasks and starting upload immediately in the background
|
| 594 |
+
- Breaking files into smaller chunks for efficient storage
|
| 595 |
+
- Avoiding duplicate storage by recognizing identical chunks across files
|
| 596 |
+
- Connecting to a storage server (CAS server) that manages these chunks
|
| 597 |
+
|
| 598 |
+
Authentication works transparently: the upload commit accepts a ``token_refresh_url``
|
| 599 |
+
that is used to refresh the short-lived xet write token as needed.
|
| 600 |
+
|
| 601 |
+
The upload process works like this:
|
| 602 |
+
1. Upload tasks run in parallel:
|
| 603 |
+
1.1. Read the file content from a path, bytes array, or a stream.
|
| 604 |
+
1.2. Split the file content into smaller chunks based on content patterns: each chunk gets a unique ID based on what's in it.
|
| 605 |
+
1.3. For each chunk:
|
| 606 |
+
- Check if it already exists in storage.
|
| 607 |
+
- Skip uploading chunks that already exist.
|
| 608 |
+
1.4. Group chunks into larger blocks for efficient transfer.
|
| 609 |
+
1.5. Upload these blocks to the storage server.
|
| 610 |
+
1.6. Assemble the file manifest locally and send it to the server for validation.
|
| 611 |
+
2. Return reference files that contain information about the uploaded files, which can be used later to download them.
|
| 612 |
+
"""
|
| 613 |
+
if len(additions) == 0:
|
| 614 |
+
return
|
| 615 |
+
|
| 616 |
+
# at this point, we know that hf_xet is installed
|
| 617 |
+
from .utils._xet import (
|
| 618 |
+
XetTokenType,
|
| 619 |
+
abort_xet_session,
|
| 620 |
+
get_xet_session,
|
| 621 |
+
xet_connection_info_refresh_url,
|
| 622 |
+
xet_headers_without_auth,
|
| 623 |
+
)
|
| 624 |
+
from .utils._xet_progress_reporting import XetUploadProgressReporter
|
| 625 |
+
|
| 626 |
+
refresh_url = xet_connection_info_refresh_url(
|
| 627 |
+
token_type=XetTokenType.WRITE,
|
| 628 |
+
repo_id=repo_id,
|
| 629 |
+
repo_type=repo_type,
|
| 630 |
+
revision=revision,
|
| 631 |
+
endpoint=endpoint,
|
| 632 |
+
)
|
| 633 |
+
if create_pr:
|
| 634 |
+
refresh_url += "?create_pr=1"
|
| 635 |
+
|
| 636 |
+
xet_headers = xet_headers_without_auth(headers)
|
| 637 |
+
|
| 638 |
+
import hf_xet
|
| 639 |
+
|
| 640 |
+
session = get_xet_session()
|
| 641 |
+
progress = None
|
| 642 |
+
|
| 643 |
+
def _sha256_arg(op: CommitOperationAdd):
|
| 644 |
+
# If the sha256 is already known, pass it to avoid recomputation. Otherwise let hf_xet
|
| 645 |
+
# compute it while chunking the file (single read pass) and backfill it afterwards.
|
| 646 |
+
return op.upload_info.sha256.hex() if op.upload_info.is_hashed else hf_xet.COMPUTE_SHA256
|
| 647 |
+
|
| 648 |
+
try:
|
| 649 |
+
if not are_progress_bars_disabled():
|
| 650 |
+
progress = XetUploadProgressReporter()
|
| 651 |
+
progress_callback = progress.update_progress
|
| 652 |
+
else:
|
| 653 |
+
progress_callback = None
|
| 654 |
+
|
| 655 |
+
all_bytes_ops = [op for op in additions if isinstance(op.path_or_fileobj, bytes)]
|
| 656 |
+
all_paths_ops = [op for op in additions if isinstance(op.path_or_fileobj, (str, Path))]
|
| 657 |
+
|
| 658 |
+
handles: list[tuple[CommitOperationAdd, Any]] = []
|
| 659 |
+
with session.new_upload_commit(
|
| 660 |
+
token_refresh_url=refresh_url,
|
| 661 |
+
token_refresh_headers=headers,
|
| 662 |
+
custom_headers=xet_headers,
|
| 663 |
+
progress_callback=progress_callback,
|
| 664 |
+
) as commit:
|
| 665 |
+
for op in all_paths_ops:
|
| 666 |
+
handles.append((op, commit.start_upload_file(str(op.path_or_fileobj), sha256=_sha256_arg(op))))
|
| 667 |
+
for op in all_bytes_ops:
|
| 668 |
+
handles.append((op, commit.start_upload_bytes(op.path_or_fileobj, sha256=_sha256_arg(op))))
|
| 669 |
+
|
| 670 |
+
# Backfill sha256 computed by hf_xet (needed later for the commit payload).
|
| 671 |
+
for op, handle in handles:
|
| 672 |
+
if not op.upload_info.is_hashed:
|
| 673 |
+
op.upload_info.sha256 = bytes.fromhex(handle.result().xet_info.sha256)
|
| 674 |
+
except KeyboardInterrupt:
|
| 675 |
+
abort_xet_session()
|
| 676 |
+
raise
|
| 677 |
+
finally:
|
| 678 |
+
if progress is not None:
|
| 679 |
+
progress.close()
|
| 680 |
+
|
| 681 |
+
|
| 682 |
+
def _validate_preupload_info(preupload_info: dict):
|
| 683 |
+
files = preupload_info.get("files")
|
| 684 |
+
if not isinstance(files, list):
|
| 685 |
+
raise ValueError("preupload_info is improperly formatted")
|
| 686 |
+
for file_info in files:
|
| 687 |
+
if not (
|
| 688 |
+
isinstance(file_info, dict)
|
| 689 |
+
and isinstance(file_info.get("path"), str)
|
| 690 |
+
and isinstance(file_info.get("uploadMode"), str)
|
| 691 |
+
and (file_info["uploadMode"] in ("lfs", "regular"))
|
| 692 |
+
):
|
| 693 |
+
raise ValueError("preupload_info is improperly formatted:")
|
| 694 |
+
return preupload_info
|
| 695 |
+
|
| 696 |
+
|
| 697 |
+
@validate_hf_hub_args
|
| 698 |
+
def _fetch_upload_modes(
|
| 699 |
+
additions: Iterable[CommitOperationAdd],
|
| 700 |
+
repo_type: str,
|
| 701 |
+
repo_id: str,
|
| 702 |
+
headers: dict[str, str],
|
| 703 |
+
revision: str,
|
| 704 |
+
endpoint: str | None = None,
|
| 705 |
+
create_pr: bool = False,
|
| 706 |
+
gitignore_content: str | None = None,
|
| 707 |
+
) -> None:
|
| 708 |
+
"""
|
| 709 |
+
Requests the Hub "preupload" endpoint to determine whether each input file should be uploaded as a regular git blob,
|
| 710 |
+
as a git LFS blob, or as a XET file. Input `additions` are mutated in-place with the upload mode.
|
| 711 |
+
|
| 712 |
+
Args:
|
| 713 |
+
additions (`Iterable` of :class:`CommitOperationAdd`):
|
| 714 |
+
Iterable of :class:`CommitOperationAdd` describing the files to
|
| 715 |
+
upload to the Hub.
|
| 716 |
+
repo_type (`str`):
|
| 717 |
+
Type of the repo to upload to: `"model"`, `"dataset"` or `"space"`.
|
| 718 |
+
repo_id (`str`):
|
| 719 |
+
A namespace (user or an organization) and a repo name separated
|
| 720 |
+
by a `/`.
|
| 721 |
+
headers (`dict[str, str]`):
|
| 722 |
+
Headers to use for the request, including authorization headers and user agent.
|
| 723 |
+
revision (`str`):
|
| 724 |
+
The git revision to upload the files to. Can be any valid git revision.
|
| 725 |
+
gitignore_content (`str`, *optional*):
|
| 726 |
+
The content of the `.gitignore` file to know which files should be ignored. The order of priority
|
| 727 |
+
is to first check if `gitignore_content` is passed, then check if the `.gitignore` file is present
|
| 728 |
+
in the list of files to commit and finally default to the `.gitignore` file already hosted on the Hub
|
| 729 |
+
(if any).
|
| 730 |
+
Raises:
|
| 731 |
+
[`~utils.HfHubHTTPError`]
|
| 732 |
+
If the Hub API returned an error.
|
| 733 |
+
[`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError)
|
| 734 |
+
If the Hub API response is improperly formatted.
|
| 735 |
+
"""
|
| 736 |
+
endpoint = endpoint if endpoint is not None else constants.ENDPOINT
|
| 737 |
+
|
| 738 |
+
# Fetch upload mode (LFS or regular) chunk by chunk.
|
| 739 |
+
upload_modes: dict[str, UploadMode] = {}
|
| 740 |
+
should_ignore_info: dict[str, bool] = {}
|
| 741 |
+
oid_info: dict[str, str | None] = {}
|
| 742 |
+
|
| 743 |
+
for chunk in chunk_iterable(additions, 256):
|
| 744 |
+
payload: dict = {
|
| 745 |
+
"files": [
|
| 746 |
+
{
|
| 747 |
+
"path": op.path_in_repo,
|
| 748 |
+
"sample": base64.b64encode(op.upload_info.sample).decode("ascii"),
|
| 749 |
+
"size": op.upload_info.size,
|
| 750 |
+
}
|
| 751 |
+
for op in chunk
|
| 752 |
+
]
|
| 753 |
+
}
|
| 754 |
+
if gitignore_content is not None:
|
| 755 |
+
payload["gitIgnore"] = gitignore_content
|
| 756 |
+
|
| 757 |
+
resp = http_backoff(
|
| 758 |
+
"POST",
|
| 759 |
+
f"{endpoint}/api/{repo_type}s/{repo_id}/preupload/{revision}",
|
| 760 |
+
json=payload,
|
| 761 |
+
headers=headers,
|
| 762 |
+
params={"create_pr": "1"} if create_pr else None,
|
| 763 |
+
)
|
| 764 |
+
hf_raise_for_status(resp)
|
| 765 |
+
preupload_info = _validate_preupload_info(resp.json())
|
| 766 |
+
upload_modes.update(**{file["path"]: file["uploadMode"] for file in preupload_info["files"]})
|
| 767 |
+
should_ignore_info.update(**{file["path"]: file["shouldIgnore"] for file in preupload_info["files"]})
|
| 768 |
+
oid_info.update(**{file["path"]: file.get("oid") for file in preupload_info["files"]})
|
| 769 |
+
|
| 770 |
+
# Set upload mode for each addition operation
|
| 771 |
+
for addition in additions:
|
| 772 |
+
addition._upload_mode = upload_modes[addition.path_in_repo]
|
| 773 |
+
addition._should_ignore = should_ignore_info[addition.path_in_repo]
|
| 774 |
+
addition._remote_oid = oid_info[addition.path_in_repo]
|
| 775 |
+
|
| 776 |
+
# Empty files cannot be uploaded as LFS (S3 would fail with a 501 Not Implemented)
|
| 777 |
+
# => empty files are uploaded as "regular" to still allow users to commit them.
|
| 778 |
+
for addition in additions:
|
| 779 |
+
if addition.upload_info.size == 0:
|
| 780 |
+
addition._upload_mode = "regular"
|
| 781 |
+
|
| 782 |
+
|
| 783 |
+
class _CopySource(NamedTuple):
|
| 784 |
+
src_repo_id: str | None
|
| 785 |
+
src_repo_type: str | None
|
| 786 |
+
path: str
|
| 787 |
+
revision: str | None
|
| 788 |
+
|
| 789 |
+
|
| 790 |
+
@validate_hf_hub_args
|
| 791 |
+
def _fetch_files_to_copy(
|
| 792 |
+
copies: Iterable[CommitOperationCopy],
|
| 793 |
+
repo_type: str,
|
| 794 |
+
repo_id: str,
|
| 795 |
+
headers: dict[str, str],
|
| 796 |
+
revision: str,
|
| 797 |
+
endpoint: str | None = None,
|
| 798 |
+
) -> dict[_CopySource, Union["RepoFile", bytes]]:
|
| 799 |
+
"""
|
| 800 |
+
Fetch information about the files to copy.
|
| 801 |
+
|
| 802 |
+
For LFS files, we only need their metadata (file size and sha256) while for regular files
|
| 803 |
+
we need to download the raw content from the Hub.
|
| 804 |
+
|
| 805 |
+
Args:
|
| 806 |
+
copies (`Iterable` of :class:`CommitOperationCopy`):
|
| 807 |
+
Iterable of :class:`CommitOperationCopy` describing the files to
|
| 808 |
+
copy on the Hub.
|
| 809 |
+
repo_type (`str`):
|
| 810 |
+
Type of the repo to upload to: `"model"`, `"dataset"` or `"space"`.
|
| 811 |
+
repo_id (`str`):
|
| 812 |
+
A namespace (user or an organization) and a repo name separated
|
| 813 |
+
by a `/`.
|
| 814 |
+
headers (`dict[str, str]`):
|
| 815 |
+
Headers to use for the request, including authorization headers and user agent.
|
| 816 |
+
revision (`str`):
|
| 817 |
+
The git revision to upload the files to. Can be any valid git revision.
|
| 818 |
+
|
| 819 |
+
Returns: `dict[_CopySource, Union[RepoFile, bytes]]]`
|
| 820 |
+
Key is `(src_repo_id, src_repo_type, path, revision)`. For intra-repo copies,
|
| 821 |
+
`src_repo_id` and `src_repo_type` are `None`.
|
| 822 |
+
Value is the raw content as bytes (for regular files) or the file information as a RepoFile (for LFS files).
|
| 823 |
+
|
| 824 |
+
Raises:
|
| 825 |
+
[`~utils.HfHubHTTPError`]
|
| 826 |
+
If the Hub API returned an error.
|
| 827 |
+
[`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError)
|
| 828 |
+
If the Hub API response is improperly formatted.
|
| 829 |
+
"""
|
| 830 |
+
from .hf_api import HfApi, RepoFolder
|
| 831 |
+
|
| 832 |
+
hf_api = HfApi(endpoint=endpoint, headers=headers)
|
| 833 |
+
copies = list(copies)
|
| 834 |
+
files_to_copy: dict[_CopySource, Union["RepoFile", bytes]] = {}
|
| 835 |
+
oid_info: dict[tuple[str, str | None], str | None] = {}
|
| 836 |
+
|
| 837 |
+
# 1. Fetch OIDs for destination paths in batches.
|
| 838 |
+
dest_paths = [op.path_in_repo for op in copies]
|
| 839 |
+
for batch in chunk_iterable(dest_paths, FETCH_LFS_BATCH_SIZE):
|
| 840 |
+
dest_repo_files = hf_api.get_paths_info(
|
| 841 |
+
repo_id=repo_id,
|
| 842 |
+
paths=list(batch),
|
| 843 |
+
revision=revision,
|
| 844 |
+
repo_type=repo_type,
|
| 845 |
+
)
|
| 846 |
+
for file in dest_repo_files:
|
| 847 |
+
if not isinstance(file, RepoFolder):
|
| 848 |
+
oid_info[(file.path, revision)] = file.blob_id
|
| 849 |
+
|
| 850 |
+
# 2. Fetch source file info, grouped by (src_repo_id, src_repo_type, src_revision).
|
| 851 |
+
copies.sort(key=lambda op: (op.src_repo_id or "", op.src_repo_type or "", op.src_revision or ""))
|
| 852 |
+
for (src_repo_id_key, src_repo_type_key, src_revision_key), group in groupby(
|
| 853 |
+
copies, key=lambda op: (op.src_repo_id, op.src_repo_type, op.src_revision)
|
| 854 |
+
):
|
| 855 |
+
operations = list(group)
|
| 856 |
+
is_cross_repo = src_repo_id_key is not None
|
| 857 |
+
eff_repo_id = src_repo_id_key or repo_id
|
| 858 |
+
eff_repo_type = src_repo_type_key or repo_type
|
| 859 |
+
eff_revision = src_revision_key or ("main" if is_cross_repo else revision)
|
| 860 |
+
|
| 861 |
+
src_paths = [op.src_path_in_repo for op in operations]
|
| 862 |
+
for paths_batch in chunk_iterable(src_paths, FETCH_LFS_BATCH_SIZE):
|
| 863 |
+
src_repo_files = hf_api.get_paths_info(
|
| 864 |
+
repo_id=eff_repo_id,
|
| 865 |
+
paths=list(paths_batch),
|
| 866 |
+
revision=eff_revision,
|
| 867 |
+
repo_type=eff_repo_type,
|
| 868 |
+
)
|
| 869 |
+
for src_repo_file in src_repo_files:
|
| 870 |
+
if isinstance(src_repo_file, RepoFolder):
|
| 871 |
+
raise NotImplementedError("Copying a folder is not implemented.")
|
| 872 |
+
source = _CopySource(src_repo_id_key, src_repo_type_key, src_repo_file.path, src_revision_key)
|
| 873 |
+
if src_repo_file.lfs:
|
| 874 |
+
files_to_copy[source] = src_repo_file
|
| 875 |
+
else:
|
| 876 |
+
url = hf_hub_url(
|
| 877 |
+
endpoint=endpoint,
|
| 878 |
+
repo_type=eff_repo_type,
|
| 879 |
+
repo_id=eff_repo_id,
|
| 880 |
+
revision=eff_revision,
|
| 881 |
+
filename=src_repo_file.path,
|
| 882 |
+
)
|
| 883 |
+
response = get_session().get(url, headers=headers)
|
| 884 |
+
hf_raise_for_status(response)
|
| 885 |
+
files_to_copy[source] = response.content
|
| 886 |
+
if not is_cross_repo:
|
| 887 |
+
oid_info[(src_repo_file.path, src_revision_key)] = src_repo_file.blob_id
|
| 888 |
+
|
| 889 |
+
for operation in operations:
|
| 890 |
+
key = _CopySource(src_repo_id_key, src_repo_type_key, operation.src_path_in_repo, src_revision_key)
|
| 891 |
+
if key not in files_to_copy:
|
| 892 |
+
source_desc = f" from {eff_repo_type}s/{eff_repo_id}" if is_cross_repo else ""
|
| 893 |
+
raise EntryNotFoundError(
|
| 894 |
+
f"Cannot copy {operation.src_path_in_repo} at revision "
|
| 895 |
+
f"{eff_revision}{source_desc}: file is missing on repo."
|
| 896 |
+
)
|
| 897 |
+
operation._dest_oid = oid_info.get((operation.path_in_repo, revision))
|
| 898 |
+
if not is_cross_repo:
|
| 899 |
+
operation._src_oid = oid_info.get((operation.src_path_in_repo, operation.src_revision))
|
| 900 |
+
|
| 901 |
+
return files_to_copy
|
| 902 |
+
|
| 903 |
+
|
| 904 |
+
def _prepare_commit_payload(
|
| 905 |
+
operations: Iterable[CommitOperation],
|
| 906 |
+
files_to_copy: dict[_CopySource, Union["RepoFile", bytes]],
|
| 907 |
+
commit_message: str,
|
| 908 |
+
commit_description: str | None = None,
|
| 909 |
+
parent_commit: str | None = None,
|
| 910 |
+
) -> Iterable[dict[str, Any]]:
|
| 911 |
+
"""
|
| 912 |
+
Builds the payload to POST to the `/commit` API of the Hub.
|
| 913 |
+
|
| 914 |
+
Payload is returned as an iterator so that it can be streamed as a ndjson in the
|
| 915 |
+
POST request.
|
| 916 |
+
|
| 917 |
+
For more information, see:
|
| 918 |
+
- https://github.com/huggingface/huggingface_hub/issues/1085#issuecomment-1265208073
|
| 919 |
+
- http://ndjson.org/
|
| 920 |
+
"""
|
| 921 |
+
commit_description = commit_description if commit_description is not None else ""
|
| 922 |
+
|
| 923 |
+
# 1. Send a header item with the commit metadata
|
| 924 |
+
header_value = {"summary": commit_message, "description": commit_description}
|
| 925 |
+
if parent_commit is not None:
|
| 926 |
+
header_value["parentCommit"] = parent_commit
|
| 927 |
+
yield {"key": "header", "value": header_value}
|
| 928 |
+
|
| 929 |
+
nb_ignored_files = 0
|
| 930 |
+
|
| 931 |
+
# 2. Send operations, one per line
|
| 932 |
+
for operation in operations:
|
| 933 |
+
# Skip ignored files
|
| 934 |
+
if isinstance(operation, CommitOperationAdd) and operation._should_ignore:
|
| 935 |
+
logger.debug(f"Skipping file '{operation.path_in_repo}' in commit (ignored by gitignore file).")
|
| 936 |
+
nb_ignored_files += 1
|
| 937 |
+
continue
|
| 938 |
+
|
| 939 |
+
# 2.a. Case adding a regular file
|
| 940 |
+
if isinstance(operation, CommitOperationAdd) and operation._upload_mode == "regular":
|
| 941 |
+
yield {
|
| 942 |
+
"key": "file",
|
| 943 |
+
"value": {
|
| 944 |
+
"content": operation.b64content().decode(),
|
| 945 |
+
"path": operation.path_in_repo,
|
| 946 |
+
"encoding": "base64",
|
| 947 |
+
},
|
| 948 |
+
}
|
| 949 |
+
# 2.b. Case adding an LFS file
|
| 950 |
+
elif isinstance(operation, CommitOperationAdd) and operation._upload_mode == "lfs":
|
| 951 |
+
yield {
|
| 952 |
+
"key": "lfsFile",
|
| 953 |
+
"value": {
|
| 954 |
+
"path": operation.path_in_repo,
|
| 955 |
+
"algo": "sha256",
|
| 956 |
+
"oid": operation.upload_info.sha256.hex(),
|
| 957 |
+
"size": operation.upload_info.size,
|
| 958 |
+
},
|
| 959 |
+
}
|
| 960 |
+
# 2.c. Case deleting a file or folder
|
| 961 |
+
elif isinstance(operation, CommitOperationDelete):
|
| 962 |
+
yield {
|
| 963 |
+
"key": "deletedFolder" if operation.is_folder else "deletedFile",
|
| 964 |
+
"value": {"path": operation.path_in_repo},
|
| 965 |
+
}
|
| 966 |
+
# 2.d. Case copying a file or folder
|
| 967 |
+
elif isinstance(operation, CommitOperationCopy):
|
| 968 |
+
source = _CopySource(
|
| 969 |
+
operation.src_repo_id,
|
| 970 |
+
operation.src_repo_type,
|
| 971 |
+
operation.src_path_in_repo,
|
| 972 |
+
operation.src_revision,
|
| 973 |
+
)
|
| 974 |
+
file_to_copy = files_to_copy[source]
|
| 975 |
+
if isinstance(file_to_copy, bytes):
|
| 976 |
+
yield {
|
| 977 |
+
"key": "file",
|
| 978 |
+
"value": {
|
| 979 |
+
"content": base64.b64encode(file_to_copy).decode(),
|
| 980 |
+
"path": operation.path_in_repo,
|
| 981 |
+
"encoding": "base64",
|
| 982 |
+
},
|
| 983 |
+
}
|
| 984 |
+
elif file_to_copy.lfs:
|
| 985 |
+
yield {
|
| 986 |
+
"key": "lfsFile",
|
| 987 |
+
"value": {
|
| 988 |
+
"path": operation.path_in_repo,
|
| 989 |
+
"algo": "sha256",
|
| 990 |
+
"oid": file_to_copy.lfs.sha256,
|
| 991 |
+
},
|
| 992 |
+
}
|
| 993 |
+
else:
|
| 994 |
+
raise ValueError(
|
| 995 |
+
"Malformed files_to_copy (should be raw file content as bytes or RepoFile objects with LFS info."
|
| 996 |
+
)
|
| 997 |
+
# 2.e. Never expected to happen
|
| 998 |
+
else:
|
| 999 |
+
raise ValueError(
|
| 1000 |
+
f"Unknown operation to commit. Operation: {operation}. Upload mode:"
|
| 1001 |
+
f" {getattr(operation, '_upload_mode', None)}"
|
| 1002 |
+
)
|
| 1003 |
+
|
| 1004 |
+
if nb_ignored_files > 0:
|
| 1005 |
+
logger.info(f"Skipped {nb_ignored_files} file(s) in commit (ignored by gitignore file).")
|
| 1006 |
+
|
| 1007 |
+
|
| 1008 |
+
def _send_commit(
|
| 1009 |
+
*,
|
| 1010 |
+
operations: Iterable[CommitOperation],
|
| 1011 |
+
files_to_copy: dict[_CopySource, Union["RepoFile", bytes]],
|
| 1012 |
+
commit_message: str,
|
| 1013 |
+
commit_description: str,
|
| 1014 |
+
repo_type: str,
|
| 1015 |
+
repo_id: str,
|
| 1016 |
+
headers: dict[str, str],
|
| 1017 |
+
revision: str,
|
| 1018 |
+
endpoint: str | None = None,
|
| 1019 |
+
parent_commit: str | None = None,
|
| 1020 |
+
create_pr: bool = False,
|
| 1021 |
+
hot_reload: bool = False,
|
| 1022 |
+
retry_on_error: bool = False,
|
| 1023 |
+
) -> "CommitInfo":
|
| 1024 |
+
"""
|
| 1025 |
+
Build the ndjson payload for `operations` and POST it to the `/commit` endpoint of the Hub.
|
| 1026 |
+
|
| 1027 |
+
`revision` must already be URL-quoted. Operations must be ready to commit: upload modes fetched
|
| 1028 |
+
and LFS/Xet content uploaded.
|
| 1029 |
+
|
| 1030 |
+
If `retry_on_error` is `True`, the POST is retried with exponential backoff on transient errors.
|
| 1031 |
+
Caution: if a commit succeeds but its response is lost, the retry will create a duplicate commit
|
| 1032 |
+
(and a duplicate pull request if `create_pr` is set) — only enable it when this is acceptable.
|
| 1033 |
+
|
| 1034 |
+
Returns a [`CommitInfo`] built from the server response.
|
| 1035 |
+
|
| 1036 |
+
Raises:
|
| 1037 |
+
[`~utils.HfHubHTTPError`]
|
| 1038 |
+
If the Hub API returned an error.
|
| 1039 |
+
"""
|
| 1040 |
+
endpoint = endpoint if endpoint is not None else constants.ENDPOINT
|
| 1041 |
+
payload = _prepare_commit_payload(
|
| 1042 |
+
operations=operations,
|
| 1043 |
+
files_to_copy=files_to_copy,
|
| 1044 |
+
commit_message=commit_message,
|
| 1045 |
+
commit_description=commit_description,
|
| 1046 |
+
parent_commit=parent_commit,
|
| 1047 |
+
)
|
| 1048 |
+
data = b"".join(json.dumps(item).encode() + b"\n" for item in payload)
|
| 1049 |
+
# See https://github.com/huggingface/huggingface_hub/issues/1085#issuecomment-1265208073
|
| 1050 |
+
headers = {"Content-Type": "application/x-ndjson", **headers}
|
| 1051 |
+
url = f"{endpoint}/api/{repo_type}s/{repo_id}/commit/{revision}"
|
| 1052 |
+
|
| 1053 |
+
params: dict[str, str] = {}
|
| 1054 |
+
if create_pr:
|
| 1055 |
+
params["create_pr"] = "1"
|
| 1056 |
+
if hot_reload:
|
| 1057 |
+
params["hot_reload"] = "1"
|
| 1058 |
+
|
| 1059 |
+
if retry_on_error:
|
| 1060 |
+
response = http_backoff("POST", url, headers=headers, content=data, params=params)
|
| 1061 |
+
else:
|
| 1062 |
+
response = get_session().post(url, headers=headers, content=data, params=params)
|
| 1063 |
+
hf_raise_for_status(response, endpoint_name="commit")
|
| 1064 |
+
|
| 1065 |
+
commit_data = response.json()
|
| 1066 |
+
from .hf_api import CommitInfo
|
| 1067 |
+
|
| 1068 |
+
return CommitInfo(
|
| 1069 |
+
commit_url=commit_data["commitUrl"],
|
| 1070 |
+
commit_message=commit_message,
|
| 1071 |
+
commit_description=commit_description,
|
| 1072 |
+
oid=commit_data["commitOid"],
|
| 1073 |
+
pr_url=commit_data["pullRequestUrl"] if create_pr else None,
|
| 1074 |
+
_endpoint=endpoint,
|
| 1075 |
+
)
|
.cache/uv/archive-v0/WbiZCgDidtA5T1uiQ47d5/huggingface_hub/_commit_scheduler.py
ADDED
|
@@ -0,0 +1,353 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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import atexit
|
| 2 |
+
import logging
|
| 3 |
+
import os
|
| 4 |
+
import time
|
| 5 |
+
from concurrent.futures import Future
|
| 6 |
+
from dataclasses import dataclass
|
| 7 |
+
from io import SEEK_END, SEEK_SET, BytesIO
|
| 8 |
+
from pathlib import Path
|
| 9 |
+
from threading import Lock, Thread
|
| 10 |
+
from typing import Optional
|
| 11 |
+
|
| 12 |
+
from .hf_api import DEFAULT_IGNORE_PATTERNS, CommitInfo, CommitOperationAdd, HfApi
|
| 13 |
+
from .utils import filter_repo_objects
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
logger = logging.getLogger(__name__)
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
@dataclass(frozen=True)
|
| 20 |
+
class _FileToUpload:
|
| 21 |
+
"""Temporary dataclass to store info about files to upload. Not meant to be used directly."""
|
| 22 |
+
|
| 23 |
+
local_path: Path
|
| 24 |
+
path_in_repo: str
|
| 25 |
+
size_limit: int
|
| 26 |
+
last_modified: float
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
class CommitScheduler:
|
| 30 |
+
"""
|
| 31 |
+
Scheduler to upload a local folder to the Hub at regular intervals (e.g. push to hub every 5 minutes).
|
| 32 |
+
|
| 33 |
+
The recommended way to use the scheduler is to use it as a context manager. This ensures that the scheduler is
|
| 34 |
+
properly stopped and the last commit is triggered when the script ends. The scheduler can also be stopped manually
|
| 35 |
+
with the `stop` method. Checkout the [upload guide](https://huggingface.co/docs/huggingface_hub/guides/upload#scheduled-uploads)
|
| 36 |
+
to learn more about how to use it.
|
| 37 |
+
|
| 38 |
+
Args:
|
| 39 |
+
repo_id (`str`):
|
| 40 |
+
The id of the repo to commit to.
|
| 41 |
+
folder_path (`str` or `Path`):
|
| 42 |
+
Path to the local folder to upload regularly.
|
| 43 |
+
every (`int` or `float`, *optional*):
|
| 44 |
+
The number of minutes between each commit. Defaults to 5 minutes.
|
| 45 |
+
path_in_repo (`str`, *optional*):
|
| 46 |
+
Relative path of the directory in the repo, for example: `"checkpoints/"`. Defaults to the root folder
|
| 47 |
+
of the repository.
|
| 48 |
+
repo_type (`str`, *optional*):
|
| 49 |
+
The type of the repo to commit to. Defaults to `model`.
|
| 50 |
+
revision (`str`, *optional*):
|
| 51 |
+
The revision of the repo to commit to. Defaults to `main`.
|
| 52 |
+
private (`bool`, *optional*):
|
| 53 |
+
Whether to make the repo private. If `None` (default), the repo will be public unless the organization's default is private. This value is ignored if the repo already exists.
|
| 54 |
+
token (`str`, *optional*):
|
| 55 |
+
The token to use to commit to the repo. Defaults to the token saved on the machine.
|
| 56 |
+
allow_patterns (`list[str]` or `str`, *optional*):
|
| 57 |
+
If provided, only files matching at least one pattern are uploaded.
|
| 58 |
+
ignore_patterns (`list[str]` or `str`, *optional*):
|
| 59 |
+
If provided, files matching any of the patterns are not uploaded.
|
| 60 |
+
squash_history (`bool`, *optional*):
|
| 61 |
+
Whether to squash the history of the repo after each commit. Defaults to `False`. Squashing commits is
|
| 62 |
+
useful to avoid degraded performances on the repo when it grows too large.
|
| 63 |
+
hf_api (`HfApi`, *optional*):
|
| 64 |
+
The [`HfApi`] client to use to commit to the Hub. Can be set with custom settings (user agent, token,...).
|
| 65 |
+
|
| 66 |
+
Example:
|
| 67 |
+
```py
|
| 68 |
+
>>> from pathlib import Path
|
| 69 |
+
>>> from huggingface_hub import CommitScheduler
|
| 70 |
+
|
| 71 |
+
# Scheduler uploads every 10 minutes
|
| 72 |
+
>>> csv_path = Path("watched_folder/data.csv")
|
| 73 |
+
>>> CommitScheduler(repo_id="test_scheduler", repo_type="dataset", folder_path=csv_path.parent, every=10)
|
| 74 |
+
|
| 75 |
+
>>> with csv_path.open("a") as f:
|
| 76 |
+
... f.write("first line")
|
| 77 |
+
|
| 78 |
+
# Some time later (...)
|
| 79 |
+
>>> with csv_path.open("a") as f:
|
| 80 |
+
... f.write("second line")
|
| 81 |
+
```
|
| 82 |
+
|
| 83 |
+
Example using a context manager:
|
| 84 |
+
```py
|
| 85 |
+
>>> from pathlib import Path
|
| 86 |
+
>>> from huggingface_hub import CommitScheduler
|
| 87 |
+
|
| 88 |
+
>>> with CommitScheduler(repo_id="test_scheduler", repo_type="dataset", folder_path="watched_folder", every=10) as scheduler:
|
| 89 |
+
... csv_path = Path("watched_folder/data.csv")
|
| 90 |
+
... with csv_path.open("a") as f:
|
| 91 |
+
... f.write("first line")
|
| 92 |
+
... (...)
|
| 93 |
+
... with csv_path.open("a") as f:
|
| 94 |
+
... f.write("second line")
|
| 95 |
+
|
| 96 |
+
# Scheduler is now stopped and last commit have been triggered
|
| 97 |
+
```
|
| 98 |
+
"""
|
| 99 |
+
|
| 100 |
+
def __init__(
|
| 101 |
+
self,
|
| 102 |
+
*,
|
| 103 |
+
repo_id: str,
|
| 104 |
+
folder_path: str | Path,
|
| 105 |
+
every: int | float = 5,
|
| 106 |
+
path_in_repo: str | None = None,
|
| 107 |
+
repo_type: str | None = None,
|
| 108 |
+
revision: str | None = None,
|
| 109 |
+
private: bool | None = None,
|
| 110 |
+
token: str | None = None,
|
| 111 |
+
allow_patterns: list[str] | str | None = None,
|
| 112 |
+
ignore_patterns: list[str] | str | None = None,
|
| 113 |
+
squash_history: bool = False,
|
| 114 |
+
hf_api: Optional["HfApi"] = None,
|
| 115 |
+
) -> None:
|
| 116 |
+
self.api = hf_api or HfApi(token=token)
|
| 117 |
+
|
| 118 |
+
# Folder
|
| 119 |
+
self.folder_path = Path(folder_path).expanduser().resolve()
|
| 120 |
+
self.path_in_repo = path_in_repo or ""
|
| 121 |
+
self.allow_patterns = allow_patterns
|
| 122 |
+
|
| 123 |
+
if ignore_patterns is None:
|
| 124 |
+
ignore_patterns = []
|
| 125 |
+
elif isinstance(ignore_patterns, str):
|
| 126 |
+
ignore_patterns = [ignore_patterns]
|
| 127 |
+
self.ignore_patterns = ignore_patterns + DEFAULT_IGNORE_PATTERNS
|
| 128 |
+
|
| 129 |
+
if self.folder_path.is_file():
|
| 130 |
+
raise ValueError(f"'folder_path' must be a directory, not a file: '{self.folder_path}'.")
|
| 131 |
+
self.folder_path.mkdir(parents=True, exist_ok=True)
|
| 132 |
+
|
| 133 |
+
# Repository
|
| 134 |
+
repo_url = self.api.create_repo(repo_id=repo_id, private=private, repo_type=repo_type, exist_ok=True)
|
| 135 |
+
self.repo_id = repo_url.repo_id
|
| 136 |
+
self.repo_type = repo_type
|
| 137 |
+
self.revision = revision
|
| 138 |
+
self.token = token
|
| 139 |
+
|
| 140 |
+
# Keep track of already uploaded files
|
| 141 |
+
self.last_uploaded: dict[Path, float] = {} # key is local path, value is timestamp
|
| 142 |
+
|
| 143 |
+
# Scheduler
|
| 144 |
+
if not every > 0:
|
| 145 |
+
raise ValueError(f"'every' must be a positive integer, not '{every}'.")
|
| 146 |
+
self.lock = Lock()
|
| 147 |
+
self.every = every
|
| 148 |
+
self.squash_history = squash_history
|
| 149 |
+
|
| 150 |
+
logger.info(f"Scheduled job to push '{self.folder_path}' to '{self.repo_id}' every {self.every} minutes.")
|
| 151 |
+
self._scheduler_thread = Thread(target=self._run_scheduler, daemon=True)
|
| 152 |
+
self._scheduler_thread.start()
|
| 153 |
+
atexit.register(self._push_to_hub)
|
| 154 |
+
|
| 155 |
+
self.__stopped = False
|
| 156 |
+
|
| 157 |
+
def stop(self) -> None:
|
| 158 |
+
"""Stop the scheduler.
|
| 159 |
+
|
| 160 |
+
A stopped scheduler cannot be restarted. Mostly for tests purposes.
|
| 161 |
+
"""
|
| 162 |
+
self.__stopped = True
|
| 163 |
+
|
| 164 |
+
def __enter__(self) -> "CommitScheduler":
|
| 165 |
+
return self
|
| 166 |
+
|
| 167 |
+
def __exit__(self, exc_type, exc_value, traceback) -> None:
|
| 168 |
+
# Upload last changes before exiting
|
| 169 |
+
self.trigger().result()
|
| 170 |
+
self.stop()
|
| 171 |
+
return
|
| 172 |
+
|
| 173 |
+
def _run_scheduler(self) -> None:
|
| 174 |
+
"""Dumb thread waiting between each scheduled push to Hub."""
|
| 175 |
+
while True:
|
| 176 |
+
self.last_future = self.trigger()
|
| 177 |
+
time.sleep(self.every * 60)
|
| 178 |
+
if self.__stopped:
|
| 179 |
+
break
|
| 180 |
+
|
| 181 |
+
def trigger(self) -> Future:
|
| 182 |
+
"""Trigger a `push_to_hub` and return a future.
|
| 183 |
+
|
| 184 |
+
This method is automatically called every `every` minutes. You can also call it manually to trigger a commit
|
| 185 |
+
immediately, without waiting for the next scheduled commit.
|
| 186 |
+
"""
|
| 187 |
+
return self.api.run_as_future(self._push_to_hub)
|
| 188 |
+
|
| 189 |
+
def _push_to_hub(self) -> CommitInfo | None:
|
| 190 |
+
if self.__stopped: # If stopped, already scheduled commits are ignored
|
| 191 |
+
return None
|
| 192 |
+
|
| 193 |
+
logger.info("(Background) scheduled commit triggered.")
|
| 194 |
+
try:
|
| 195 |
+
value = self.push_to_hub()
|
| 196 |
+
if self.squash_history:
|
| 197 |
+
logger.info("(Background) squashing repo history.")
|
| 198 |
+
self.api.super_squash_history(repo_id=self.repo_id, repo_type=self.repo_type, branch=self.revision)
|
| 199 |
+
return value
|
| 200 |
+
except Exception as e:
|
| 201 |
+
logger.error(f"Error while pushing to Hub: {e}") # Depending on the setup, error might be silenced
|
| 202 |
+
raise
|
| 203 |
+
|
| 204 |
+
def push_to_hub(self) -> CommitInfo | None:
|
| 205 |
+
"""
|
| 206 |
+
Push folder to the Hub and return the commit info.
|
| 207 |
+
|
| 208 |
+
> [!WARNING]
|
| 209 |
+
> This method is not meant to be called directly. It is run in the background by the scheduler, respecting a
|
| 210 |
+
> queue mechanism to avoid concurrent commits. Making a direct call to the method might lead to concurrency
|
| 211 |
+
> issues.
|
| 212 |
+
|
| 213 |
+
The default behavior of `push_to_hub` is to assume an append-only folder. It lists all files in the folder and
|
| 214 |
+
uploads only changed files. If no changes are found, the method returns without committing anything. If you want
|
| 215 |
+
to change this behavior, you can inherit from [`CommitScheduler`] and override this method. This can be useful
|
| 216 |
+
for example to compress data together in a single file before committing. For more details and examples, check
|
| 217 |
+
out our [integration guide](https://huggingface.co/docs/huggingface_hub/main/en/guides/upload#scheduled-uploads).
|
| 218 |
+
"""
|
| 219 |
+
# Check files to upload (with lock)
|
| 220 |
+
with self.lock:
|
| 221 |
+
logger.debug("Listing files to upload for scheduled commit.")
|
| 222 |
+
|
| 223 |
+
# List files from folder (taken from `_prepare_upload_folder_additions`)
|
| 224 |
+
relpath_to_abspath = {
|
| 225 |
+
path.relative_to(self.folder_path).as_posix(): path
|
| 226 |
+
for path in sorted(self.folder_path.glob("**/*")) # sorted to be deterministic
|
| 227 |
+
if path.is_file()
|
| 228 |
+
}
|
| 229 |
+
prefix = f"{self.path_in_repo.strip('/')}/" if self.path_in_repo else ""
|
| 230 |
+
|
| 231 |
+
# Filter with pattern + filter out unchanged files + retrieve current file size
|
| 232 |
+
files_to_upload: list[_FileToUpload] = []
|
| 233 |
+
for relpath in filter_repo_objects(
|
| 234 |
+
relpath_to_abspath.keys(), allow_patterns=self.allow_patterns, ignore_patterns=self.ignore_patterns
|
| 235 |
+
):
|
| 236 |
+
local_path = relpath_to_abspath[relpath]
|
| 237 |
+
stat = local_path.stat()
|
| 238 |
+
if self.last_uploaded.get(local_path) is None or self.last_uploaded[local_path] != stat.st_mtime:
|
| 239 |
+
files_to_upload.append(
|
| 240 |
+
_FileToUpload(
|
| 241 |
+
local_path=local_path,
|
| 242 |
+
path_in_repo=prefix + relpath,
|
| 243 |
+
size_limit=stat.st_size,
|
| 244 |
+
last_modified=stat.st_mtime,
|
| 245 |
+
)
|
| 246 |
+
)
|
| 247 |
+
|
| 248 |
+
# Return if nothing to upload
|
| 249 |
+
if len(files_to_upload) == 0:
|
| 250 |
+
logger.debug("Dropping schedule commit: no changed file to upload.")
|
| 251 |
+
return None
|
| 252 |
+
|
| 253 |
+
# Convert `_FileToUpload` as `CommitOperationAdd` (=> compute file shas + limit to file size)
|
| 254 |
+
logger.debug("Removing unchanged files since previous scheduled commit.")
|
| 255 |
+
add_operations = [
|
| 256 |
+
CommitOperationAdd(
|
| 257 |
+
# Cap the file to its current size, even if the user append data to it while a scheduled commit is happening
|
| 258 |
+
path_or_fileobj=PartialFileIO(file_to_upload.local_path, size_limit=file_to_upload.size_limit),
|
| 259 |
+
path_in_repo=file_to_upload.path_in_repo,
|
| 260 |
+
)
|
| 261 |
+
for file_to_upload in files_to_upload
|
| 262 |
+
]
|
| 263 |
+
|
| 264 |
+
# Upload files (append mode expected - no need for lock)
|
| 265 |
+
logger.debug("Uploading files for scheduled commit.")
|
| 266 |
+
commit_info = self.api.create_commit(
|
| 267 |
+
repo_id=self.repo_id,
|
| 268 |
+
repo_type=self.repo_type,
|
| 269 |
+
operations=add_operations,
|
| 270 |
+
commit_message="Scheduled Commit",
|
| 271 |
+
revision=self.revision,
|
| 272 |
+
)
|
| 273 |
+
|
| 274 |
+
# Successful commit: keep track of the latest "last_modified" for each file
|
| 275 |
+
for file in files_to_upload:
|
| 276 |
+
self.last_uploaded[file.local_path] = file.last_modified
|
| 277 |
+
return commit_info
|
| 278 |
+
|
| 279 |
+
|
| 280 |
+
class PartialFileIO(BytesIO):
|
| 281 |
+
"""A file-like object that reads only the first part of a file.
|
| 282 |
+
|
| 283 |
+
Useful to upload a file to the Hub when the user might still be appending data to it. Only the first part of the
|
| 284 |
+
file is uploaded (i.e. the part that was available when the filesystem was first scanned).
|
| 285 |
+
|
| 286 |
+
In practice, only used internally by the CommitScheduler to regularly push a folder to the Hub with minimal
|
| 287 |
+
disturbance for the user. The object is passed to `CommitOperationAdd`.
|
| 288 |
+
|
| 289 |
+
Only supports `read`, `tell` and `seek` methods.
|
| 290 |
+
|
| 291 |
+
Args:
|
| 292 |
+
file_path (`str` or `Path`):
|
| 293 |
+
Path to the file to read.
|
| 294 |
+
size_limit (`int`):
|
| 295 |
+
The maximum number of bytes to read from the file. If the file is larger than this, only the first part
|
| 296 |
+
will be read (and uploaded).
|
| 297 |
+
"""
|
| 298 |
+
|
| 299 |
+
def __init__(self, file_path: str | Path, size_limit: int) -> None:
|
| 300 |
+
self._file_path = Path(file_path)
|
| 301 |
+
self._file = self._file_path.open("rb")
|
| 302 |
+
self._size_limit = min(size_limit, os.fstat(self._file.fileno()).st_size)
|
| 303 |
+
|
| 304 |
+
def __del__(self) -> None:
|
| 305 |
+
self._file.close()
|
| 306 |
+
return super().__del__()
|
| 307 |
+
|
| 308 |
+
def __repr__(self) -> str:
|
| 309 |
+
return f"<PartialFileIO file_path={self._file_path} size_limit={self._size_limit}>"
|
| 310 |
+
|
| 311 |
+
def __len__(self) -> int:
|
| 312 |
+
return self._size_limit
|
| 313 |
+
|
| 314 |
+
def __getattribute__(self, name: str):
|
| 315 |
+
if name.startswith("_") or name in ("read", "tell", "seek", "fileno"): # only 4 public methods supported
|
| 316 |
+
return super().__getattribute__(name)
|
| 317 |
+
raise NotImplementedError(f"PartialFileIO does not support '{name}'.")
|
| 318 |
+
|
| 319 |
+
def fileno(self):
|
| 320 |
+
raise AttributeError("PartialFileIO does not have a fileno.")
|
| 321 |
+
|
| 322 |
+
def tell(self) -> int:
|
| 323 |
+
"""Return the current file position."""
|
| 324 |
+
return self._file.tell()
|
| 325 |
+
|
| 326 |
+
def seek(self, __offset: int, __whence: int = SEEK_SET) -> int:
|
| 327 |
+
"""Change the stream position to the given offset.
|
| 328 |
+
|
| 329 |
+
Behavior is the same as a regular file, except that the position is capped to the size limit.
|
| 330 |
+
"""
|
| 331 |
+
if __whence == SEEK_END:
|
| 332 |
+
# SEEK_END => set from the truncated end
|
| 333 |
+
__offset = len(self) + __offset
|
| 334 |
+
__whence = SEEK_SET
|
| 335 |
+
|
| 336 |
+
pos = self._file.seek(__offset, __whence)
|
| 337 |
+
if pos > self._size_limit:
|
| 338 |
+
return self._file.seek(self._size_limit)
|
| 339 |
+
return pos
|
| 340 |
+
|
| 341 |
+
def read(self, __size: int | None = -1) -> bytes:
|
| 342 |
+
"""Read at most `__size` bytes from the file.
|
| 343 |
+
|
| 344 |
+
Behavior is the same as a regular file, except that it is capped to the size limit.
|
| 345 |
+
"""
|
| 346 |
+
current = self._file.tell()
|
| 347 |
+
if __size is None or __size < 0:
|
| 348 |
+
# Read until file limit
|
| 349 |
+
truncated_size = self._size_limit - current
|
| 350 |
+
else:
|
| 351 |
+
# Read until file limit or __size
|
| 352 |
+
truncated_size = min(__size, self._size_limit - current)
|
| 353 |
+
return self._file.read(truncated_size)
|
.cache/uv/archive-v0/WbiZCgDidtA5T1uiQ47d5/huggingface_hub/_dataset_viewer.py
ADDED
|
@@ -0,0 +1,172 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright 2026 The HuggingFace Team. All rights reserved.
|
| 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 |
+
import json
|
| 15 |
+
import os
|
| 16 |
+
import shutil
|
| 17 |
+
import subprocess
|
| 18 |
+
from dataclasses import dataclass
|
| 19 |
+
from typing import TYPE_CHECKING, Any, Union
|
| 20 |
+
|
| 21 |
+
from . import constants
|
| 22 |
+
from .utils import get_token
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
if TYPE_CHECKING:
|
| 26 |
+
import duckdb
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
@dataclass(frozen=True)
|
| 30 |
+
class DatasetParquetEntry:
|
| 31 |
+
"""Represents a single parquet file available for a dataset on the Hub."""
|
| 32 |
+
|
| 33 |
+
config: str
|
| 34 |
+
split: str
|
| 35 |
+
url: str
|
| 36 |
+
size: int
|
| 37 |
+
|
| 38 |
+
|
| 39 |
+
def execute_raw_sql_query(sql_query: str, *, token: str | bool | None = None) -> list[dict[str, Any]]:
|
| 40 |
+
normalized_query = sql_query.strip().rstrip(";").strip()
|
| 41 |
+
_raise_on_forbidden_query(normalized_query)
|
| 42 |
+
|
| 43 |
+
connection = None
|
| 44 |
+
try:
|
| 45 |
+
connection = _get_duckdb_connection(token=token)
|
| 46 |
+
relation = connection.sql(normalized_query)
|
| 47 |
+
if relation is None:
|
| 48 |
+
raise ValueError("SQL query must return rows.")
|
| 49 |
+
|
| 50 |
+
if isinstance(relation, _DuckDBCliRelation):
|
| 51 |
+
# DuckDB binary => run CLI => parse JSON
|
| 52 |
+
return relation.execute()
|
| 53 |
+
else:
|
| 54 |
+
# DuckDB Python API => fetch columns + rows => convert to dicts
|
| 55 |
+
columns = tuple(column[0] for column in relation.description)
|
| 56 |
+
rows = tuple(tuple(row) for row in relation.fetchall())
|
| 57 |
+
return [dict(zip(columns, row)) for row in rows]
|
| 58 |
+
finally:
|
| 59 |
+
if connection is not None:
|
| 60 |
+
connection.close()
|
| 61 |
+
|
| 62 |
+
|
| 63 |
+
def _raise_on_forbidden_query(query: str) -> None:
|
| 64 |
+
if len(query) == 0:
|
| 65 |
+
raise ValueError("SQL query cannot be empty.")
|
| 66 |
+
|
| 67 |
+
# DuckDB CLI meta-commands are dot-prefixed words (e.g. `.shell`, `.output`).
|
| 68 |
+
# Let's forbid them for now but allow SQL expressions like `.5` that can legitimately start a line.
|
| 69 |
+
for line in query.splitlines():
|
| 70 |
+
stripped = line.lstrip()
|
| 71 |
+
if stripped.startswith(".") and stripped[1:2].isalpha():
|
| 72 |
+
raise ValueError("DuckDB CLI meta-commands are not allowed in SQL queries.")
|
| 73 |
+
|
| 74 |
+
|
| 75 |
+
def _get_duckdb_connection(
|
| 76 |
+
token: str | bool | None,
|
| 77 |
+
) -> Union["duckdb.DuckDBPyConnection", "_DuckDBCliConnection"]:
|
| 78 |
+
try:
|
| 79 |
+
# If DuckDB is installed as a Python package, use it!
|
| 80 |
+
import duckdb
|
| 81 |
+
except ImportError as error:
|
| 82 |
+
# Otherwise, use the DuckDB CLI binary.
|
| 83 |
+
duckdb_binary = shutil.which("duckdb")
|
| 84 |
+
if duckdb_binary is None:
|
| 85 |
+
raise ImportError(
|
| 86 |
+
"DuckDB is required for `hf datasets sql`. Install the Python package with `pip install duckdb` or "
|
| 87 |
+
"install the DuckDB CLI binary (for example `brew install duckdb`)."
|
| 88 |
+
) from error
|
| 89 |
+
return _DuckDBCliConnection(binary_path=duckdb_binary, token=token)
|
| 90 |
+
|
| 91 |
+
# Create a new connection (Python API).
|
| 92 |
+
connection = duckdb.connect()
|
| 93 |
+
try:
|
| 94 |
+
for statement in _build_duckdb_secret_statements(token):
|
| 95 |
+
connection.execute(statement)
|
| 96 |
+
return connection
|
| 97 |
+
except Exception:
|
| 98 |
+
connection.close()
|
| 99 |
+
raise
|
| 100 |
+
|
| 101 |
+
|
| 102 |
+
@dataclass
|
| 103 |
+
class _DuckDBCliConnection:
|
| 104 |
+
"""DuckDB connection.
|
| 105 |
+
|
| 106 |
+
Mimics the DuckDB Python API, but runs the queries via the DuckDB CLI binary.
|
| 107 |
+
"""
|
| 108 |
+
|
| 109 |
+
binary_path: str
|
| 110 |
+
token: str | bool | None
|
| 111 |
+
|
| 112 |
+
def __post_init__(self) -> None:
|
| 113 |
+
self._setup_statements = _build_duckdb_secret_statements(self.token)
|
| 114 |
+
|
| 115 |
+
def sql(self, query: str) -> "_DuckDBCliRelation":
|
| 116 |
+
return _DuckDBCliRelation(binary_path=self.binary_path, setup_statements=self._setup_statements, query=query)
|
| 117 |
+
|
| 118 |
+
def close(self) -> None:
|
| 119 |
+
pass
|
| 120 |
+
|
| 121 |
+
|
| 122 |
+
@dataclass
|
| 123 |
+
class _DuckDBCliRelation:
|
| 124 |
+
"""DuckDB relation.
|
| 125 |
+
|
| 126 |
+
Mimics the DuckDB Python API, but runs the queries via the DuckDB CLI binary.
|
| 127 |
+
"""
|
| 128 |
+
|
| 129 |
+
binary_path: str
|
| 130 |
+
setup_statements: list[str]
|
| 131 |
+
query: str
|
| 132 |
+
|
| 133 |
+
def execute(self) -> list[dict[str, Any]]:
|
| 134 |
+
# Build the DuckDB CLI input.
|
| 135 |
+
setup = []
|
| 136 |
+
if self.setup_statements:
|
| 137 |
+
setup = [
|
| 138 |
+
f".output {os.devnull}",
|
| 139 |
+
*(f"{stmt};" for stmt in self.setup_statements),
|
| 140 |
+
".output",
|
| 141 |
+
]
|
| 142 |
+
full_query = "\n".join(setup + [self.query + ";"])
|
| 143 |
+
|
| 144 |
+
# Run DuckDB binary
|
| 145 |
+
result = subprocess.run(
|
| 146 |
+
[self.binary_path, "-json"],
|
| 147 |
+
input=full_query,
|
| 148 |
+
capture_output=True,
|
| 149 |
+
text=True,
|
| 150 |
+
check=False,
|
| 151 |
+
)
|
| 152 |
+
if result.returncode != 0:
|
| 153 |
+
error_message = result.stderr.strip() or result.stdout.strip() or "DuckDB CLI command failed."
|
| 154 |
+
raise RuntimeError(error_message)
|
| 155 |
+
|
| 156 |
+
# Parse JSON output and return
|
| 157 |
+
return json.loads(result.stdout.strip())
|
| 158 |
+
|
| 159 |
+
|
| 160 |
+
def _build_duckdb_secret_statements(token: str | bool | None) -> list[str]:
|
| 161 |
+
if token is None or token is True:
|
| 162 |
+
token = get_token()
|
| 163 |
+
|
| 164 |
+
if not token:
|
| 165 |
+
return []
|
| 166 |
+
|
| 167 |
+
escaped_token = token.replace("'", "''")
|
| 168 |
+
escaped_endpoint = constants.ENDPOINT.replace("'", "''")
|
| 169 |
+
return [
|
| 170 |
+
f"CREATE OR REPLACE SECRET hf_hub_token (TYPE HTTP, BEARER_TOKEN '{escaped_token}', SCOPE '{escaped_endpoint}')",
|
| 171 |
+
f"CREATE OR REPLACE SECRET hf_token (TYPE HUGGINGFACE, TOKEN '{escaped_token}')",
|
| 172 |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Evaluation results utilities for the `.eval_results/*.yaml` format.
|
| 2 |
+
|
| 3 |
+
See https://huggingface.co/docs/hub/eval-results for more details.
|
| 4 |
+
Specifications are available at https://github.com/huggingface/hub-docs/blob/main/eval_results.yaml.
|
| 5 |
+
"""
|
| 6 |
+
|
| 7 |
+
from dataclasses import dataclass
|
| 8 |
+
from typing import Any
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
@dataclass
|
| 12 |
+
class EvalResultEntry:
|
| 13 |
+
"""
|
| 14 |
+
Evaluation result entry for the `.eval_results/*.yaml` format.
|
| 15 |
+
|
| 16 |
+
Represents evaluation scores stored in model repos that automatically appear on
|
| 17 |
+
the model page and the benchmark dataset's leaderboard.
|
| 18 |
+
|
| 19 |
+
For the legacy `model-index` format in `README.md`, use [`EvalResult`] instead.
|
| 20 |
+
|
| 21 |
+
See https://huggingface.co/docs/hub/eval-results for more details.
|
| 22 |
+
|
| 23 |
+
Args:
|
| 24 |
+
dataset_id (`str`):
|
| 25 |
+
Benchmark dataset ID from the Hub. Example: "cais/hle", "Idavidrein/gpqa".
|
| 26 |
+
task_id (`str`):
|
| 27 |
+
Task identifier within the benchmark. Example: "gpqa_diamond".
|
| 28 |
+
value (`Any`):
|
| 29 |
+
The metric value. Example: 20.90.
|
| 30 |
+
dataset_revision (`str`, *optional*):
|
| 31 |
+
Git SHA of the benchmark dataset.
|
| 32 |
+
verify_token (`str`, *optional*):
|
| 33 |
+
A signature that can be used to prove that evaluation is provably auditable and reproducible.
|
| 34 |
+
date (`str`, *optional*):
|
| 35 |
+
When the evaluation was run (ISO-8601 datetime). Defaults to git commit time.
|
| 36 |
+
source_url (`str`, *optional*):
|
| 37 |
+
Link to the evaluation source (e.g., https://huggingface.co/spaces/SaylorTwift/smollm3-mmlu-pro). Required if `source_name`, `source_user`, or `source_org` is provided.
|
| 38 |
+
source_name (`str`, *optional*):
|
| 39 |
+
Display name for the source. Example: "Eval Logs".
|
| 40 |
+
source_user (`str`, *optional*):
|
| 41 |
+
HF user name for attribution. Example: "celinah".
|
| 42 |
+
source_org (`str`, *optional*):
|
| 43 |
+
HF org name for attribution. Example: "cais".
|
| 44 |
+
notes (`str`, *optional*):
|
| 45 |
+
Details about the evaluation setup. Example: "tools", "no-tools", "chain-of-thought".
|
| 46 |
+
|
| 47 |
+
Example:
|
| 48 |
+
```python
|
| 49 |
+
>>> from huggingface_hub import EvalResultEntry
|
| 50 |
+
>>> # Minimal example with required fields only
|
| 51 |
+
>>> result = EvalResultEntry(
|
| 52 |
+
... dataset_id="Idavidrein/gpqa",
|
| 53 |
+
... task_id="gpqa_diamond",
|
| 54 |
+
... value=0.412,
|
| 55 |
+
... )
|
| 56 |
+
>>> # Full example with all fields
|
| 57 |
+
>>> result = EvalResultEntry(
|
| 58 |
+
... dataset_id="cais/hle",
|
| 59 |
+
... task_id="default",
|
| 60 |
+
... value=20.90,
|
| 61 |
+
... dataset_revision="5503434ddd753f426f4b38109466949a1217c2bb",
|
| 62 |
+
... verify_token="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
|
| 63 |
+
... date="2025-01-15T10:30:00Z",
|
| 64 |
+
... source_url="https://huggingface.co/datasets/cais/hle",
|
| 65 |
+
... source_name="CAIS HLE",
|
| 66 |
+
... source_org="cais",
|
| 67 |
+
... notes="no-tools",
|
| 68 |
+
... )
|
| 69 |
+
|
| 70 |
+
```
|
| 71 |
+
"""
|
| 72 |
+
|
| 73 |
+
dataset_id: str
|
| 74 |
+
task_id: str
|
| 75 |
+
value: Any
|
| 76 |
+
dataset_revision: str | None = None
|
| 77 |
+
verify_token: str | None = None
|
| 78 |
+
date: str | None = None
|
| 79 |
+
source_url: str | None = None
|
| 80 |
+
source_name: str | None = None
|
| 81 |
+
source_user: str | None = None
|
| 82 |
+
source_org: str | None = None
|
| 83 |
+
notes: str | None = None
|
| 84 |
+
|
| 85 |
+
def __post_init__(self) -> None:
|
| 86 |
+
if (
|
| 87 |
+
self.source_name is not None or self.source_user is not None or self.source_org is not None
|
| 88 |
+
) and self.source_url is None:
|
| 89 |
+
raise ValueError(
|
| 90 |
+
"If `source_name`, `source_user`, or `source_org` is provided, `source_url` must also be provided."
|
| 91 |
+
)
|
| 92 |
+
|
| 93 |
+
|
| 94 |
+
def eval_result_entries_to_yaml(entries: list[EvalResultEntry]) -> list[dict[str, Any]]:
|
| 95 |
+
"""Convert a list of [`EvalResultEntry`] objects to a YAML-serializable list of dicts.
|
| 96 |
+
|
| 97 |
+
This produces the format expected in `.eval_results/*.yaml` files.
|
| 98 |
+
|
| 99 |
+
Args:
|
| 100 |
+
entries (`list[EvalResultEntry]`):
|
| 101 |
+
List of evaluation result entries to serialize.
|
| 102 |
+
|
| 103 |
+
Returns:
|
| 104 |
+
`list[dict[str, Any]]`: A list of dictionaries ready to be dumped to YAML.
|
| 105 |
+
|
| 106 |
+
Example:
|
| 107 |
+
```python
|
| 108 |
+
>>> from huggingface_hub import EvalResultEntry, eval_result_entries_to_yaml
|
| 109 |
+
>>> entries = [
|
| 110 |
+
... EvalResultEntry(dataset_id="cais/hle", task_id="default", value=20.90),
|
| 111 |
+
... EvalResultEntry(dataset_id="Idavidrein/gpqa", task_id="gpqa_diamond", value=0.412),
|
| 112 |
+
... ]
|
| 113 |
+
>>> yaml_data = eval_result_entries_to_yaml(entries)
|
| 114 |
+
>>> yaml_data[0]
|
| 115 |
+
{'dataset': {'id': 'cais/hle', 'task_id': 'default'}, 'value': 20.9}
|
| 116 |
+
|
| 117 |
+
```
|
| 118 |
+
|
| 119 |
+
To upload eval results to the Hub:
|
| 120 |
+
```python
|
| 121 |
+
>>> import yaml
|
| 122 |
+
>>> from huggingface_hub import upload_file, EvalResultEntry, eval_result_entries_to_yaml
|
| 123 |
+
>>> entries = [
|
| 124 |
+
... EvalResultEntry(dataset_id="cais/hle", task_id="default", value=20.90),
|
| 125 |
+
... ]
|
| 126 |
+
>>> yaml_content = yaml.dump(eval_result_entries_to_yaml(entries))
|
| 127 |
+
>>> upload_file(
|
| 128 |
+
... path_or_fileobj=yaml_content.encode(),
|
| 129 |
+
... path_in_repo=".eval_results/hle.yaml",
|
| 130 |
+
... repo_id="your-username/your-model",
|
| 131 |
+
... )
|
| 132 |
+
|
| 133 |
+
```
|
| 134 |
+
"""
|
| 135 |
+
result = []
|
| 136 |
+
for entry in entries:
|
| 137 |
+
# build the dataset object
|
| 138 |
+
dataset: dict[str, Any] = {"id": entry.dataset_id, "task_id": entry.task_id}
|
| 139 |
+
if entry.dataset_revision is not None:
|
| 140 |
+
dataset["revision"] = entry.dataset_revision
|
| 141 |
+
|
| 142 |
+
data: dict[str, Any] = {"dataset": dataset, "value": entry.value}
|
| 143 |
+
if entry.verify_token is not None:
|
| 144 |
+
data["verifyToken"] = entry.verify_token
|
| 145 |
+
if entry.date is not None:
|
| 146 |
+
data["date"] = entry.date
|
| 147 |
+
# build the source object
|
| 148 |
+
if entry.source_url is not None:
|
| 149 |
+
source: dict[str, Any] = {"url": entry.source_url}
|
| 150 |
+
if entry.source_name is not None:
|
| 151 |
+
source["name"] = entry.source_name
|
| 152 |
+
if entry.source_user is not None:
|
| 153 |
+
source["user"] = entry.source_user
|
| 154 |
+
if entry.source_org is not None:
|
| 155 |
+
source["org"] = entry.source_org
|
| 156 |
+
data["source"] = source
|
| 157 |
+
if entry.notes is not None:
|
| 158 |
+
data["notes"] = entry.notes
|
| 159 |
+
|
| 160 |
+
result.append(data)
|
| 161 |
+
return result
|
| 162 |
+
|
| 163 |
+
|
| 164 |
+
def parse_eval_result_entries(data: list[dict[str, Any]]) -> list[EvalResultEntry]:
|
| 165 |
+
"""Parse a list of dicts into [`EvalResultEntry`] objects.
|
| 166 |
+
|
| 167 |
+
This parses the `.eval_results/*.yaml` format. For the legacy `model-index` format,
|
| 168 |
+
use [`model_index_to_eval_results`] instead.
|
| 169 |
+
|
| 170 |
+
Args:
|
| 171 |
+
data (`list[dict[str, Any]]`):
|
| 172 |
+
A list of dictionaries (e.g., parsed from YAML or API response).
|
| 173 |
+
|
| 174 |
+
Returns:
|
| 175 |
+
`list[EvalResultEntry]`: A list of evaluation result entry objects.
|
| 176 |
+
|
| 177 |
+
Example:
|
| 178 |
+
```python
|
| 179 |
+
>>> from huggingface_hub import parse_eval_result_entries
|
| 180 |
+
>>> data = [
|
| 181 |
+
... {"dataset": {"id": "cais/hle", "task_id": "default"}, "value": 20.90},
|
| 182 |
+
... {"dataset": {"id": "Idavidrein/gpqa", "task_id": "gpqa_diamond"}, "value": 0.412},
|
| 183 |
+
... ]
|
| 184 |
+
>>> entries = parse_eval_result_entries(data)
|
| 185 |
+
>>> entries[0].dataset_id
|
| 186 |
+
'cais/hle'
|
| 187 |
+
>>> entries[0].value
|
| 188 |
+
20.9
|
| 189 |
+
|
| 190 |
+
```
|
| 191 |
+
"""
|
| 192 |
+
entries = []
|
| 193 |
+
for item in data:
|
| 194 |
+
entry_data = item.get("data", item)
|
| 195 |
+
dataset = entry_data.get("dataset", {})
|
| 196 |
+
source = entry_data.get("source", {})
|
| 197 |
+
entry = EvalResultEntry(
|
| 198 |
+
dataset_id=dataset["id"],
|
| 199 |
+
value=entry_data["value"],
|
| 200 |
+
task_id=dataset["task_id"],
|
| 201 |
+
dataset_revision=dataset.get("revision"),
|
| 202 |
+
verify_token=entry_data.get("verifyToken"),
|
| 203 |
+
date=entry_data.get("date"),
|
| 204 |
+
source_url=source.get("url") if source else None,
|
| 205 |
+
source_name=source.get("name") if source else None,
|
| 206 |
+
source_user=source.get("user") if source else None,
|
| 207 |
+
source_org=source.get("org") if source else None,
|
| 208 |
+
notes=entry_data.get("notes"),
|
| 209 |
+
)
|
| 210 |
+
entries.append(entry)
|
| 211 |
+
return entries
|