giancap61 commited on
Commit
c2536ae
·
verified ·
1 Parent(s): 187968b

Add files using upload-large-folder tool

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. TTS/Kokoro/.venv/Lib/site-packages/__pycache__/docopt.cpython-312.pyc +0 -0
  2. TTS/Kokoro/.venv/Lib/site-packages/__pycache__/isympy.cpython-312.pyc +0 -0
  3. TTS/Kokoro/.venv/Lib/site-packages/__pycache__/six.cpython-312.pyc +0 -0
  4. TTS/Kokoro/.venv/Lib/site-packages/__pycache__/soundfile.cpython-312.pyc +0 -0
  5. TTS/Kokoro/.venv/Lib/site-packages/_distutils_hack/__init__.py +239 -0
  6. TTS/Kokoro/.venv/Lib/site-packages/_distutils_hack/override.py +1 -0
  7. TTS/Kokoro/.venv/Lib/site-packages/_soundfile_data/COPYING +503 -0
  8. TTS/Kokoro/.venv/Lib/site-packages/_soundfile_data/__init__.py +3 -0
  9. TTS/Kokoro/.venv/Lib/site-packages/_yaml/__init__.py +33 -0
  10. TTS/Kokoro/.venv/Lib/site-packages/addict/__pycache__/__init__.cpython-312.pyc +0 -0
  11. TTS/Kokoro/.venv/Lib/site-packages/rich-14.3.3.dist-info/INSTALLER +1 -0
  12. TTS/Kokoro/.venv/Lib/site-packages/rich-14.3.3.dist-info/METADATA +480 -0
  13. TTS/Kokoro/.venv/Lib/site-packages/rich-14.3.3.dist-info/RECORD +206 -0
  14. TTS/Kokoro/.venv/Lib/site-packages/rich-14.3.3.dist-info/WHEEL +4 -0
  15. TTS/Kokoro/.venv/Lib/site-packages/rich/__init__.py +177 -0
  16. TTS/Kokoro/.venv/Lib/site-packages/rich/__main__.py +245 -0
  17. TTS/Kokoro/.venv/Lib/site-packages/rich/_inspect.py +272 -0
  18. TTS/Kokoro/.venv/Lib/site-packages/rich/_loop.py +43 -0
  19. TTS/Kokoro/.venv/Lib/site-packages/rich/_palettes.py +309 -0
  20. TTS/Kokoro/.venv/Lib/site-packages/rich/_pick.py +17 -0
  21. TTS/Kokoro/.venv/Lib/site-packages/rich/_ratio.py +153 -0
  22. TTS/Kokoro/.venv/Lib/site-packages/rich/_spinners.py +482 -0
  23. TTS/Kokoro/.venv/Lib/site-packages/rich/_stack.py +16 -0
  24. TTS/Kokoro/.venv/Lib/site-packages/rich/_timer.py +19 -0
  25. TTS/Kokoro/.venv/Lib/site-packages/rich/_win32_console.py +661 -0
  26. TTS/Kokoro/.venv/Lib/site-packages/rich/_windows.py +71 -0
  27. TTS/Kokoro/.venv/Lib/site-packages/rich/_windows_renderer.py +56 -0
  28. TTS/Kokoro/.venv/Lib/site-packages/rich/_wrap.py +93 -0
  29. TTS/Kokoro/.venv/Lib/site-packages/rpds/__init__.py +5 -0
  30. TTS/Kokoro/.venv/Lib/site-packages/rpds/__init__.pyi +79 -0
  31. TTS/Kokoro/.venv/Lib/site-packages/rpds/py.typed +0 -0
  32. TTS/Kokoro/.venv/Lib/site-packages/rpds_py-0.30.0.dist-info/INSTALLER +1 -0
  33. TTS/Kokoro/.venv/Lib/site-packages/rpds_py-0.30.0.dist-info/METADATA +99 -0
  34. TTS/Kokoro/.venv/Lib/site-packages/rpds_py-0.30.0.dist-info/RECORD +10 -0
  35. TTS/Kokoro/.venv/Lib/site-packages/rpds_py-0.30.0.dist-info/WHEEL +4 -0
  36. TTS/Kokoro/.venv/Lib/site-packages/safetensors-0.7.0.dist-info/INSTALLER +1 -0
  37. TTS/Kokoro/.venv/Lib/site-packages/safetensors-0.7.0.dist-info/METADATA +133 -0
  38. TTS/Kokoro/.venv/Lib/site-packages/safetensors-0.7.0.dist-info/RECORD +22 -0
  39. TTS/Kokoro/.venv/Lib/site-packages/safetensors-0.7.0.dist-info/WHEEL +4 -0
  40. TTS/Kokoro/.venv/Lib/site-packages/safetensors/__init__.py +10 -0
  41. TTS/Kokoro/.venv/Lib/site-packages/safetensors/__init__.pyi +164 -0
  42. TTS/Kokoro/.venv/Lib/site-packages/safetensors/flax.py +138 -0
  43. TTS/Kokoro/.venv/Lib/site-packages/safetensors/mlx.py +140 -0
  44. TTS/Kokoro/.venv/Lib/site-packages/safetensors/numpy.py +187 -0
  45. TTS/Kokoro/.venv/Lib/site-packages/safetensors/paddle.py +290 -0
  46. TTS/Kokoro/.venv/Lib/site-packages/safetensors/py.typed +0 -0
  47. TTS/Kokoro/.venv/Lib/site-packages/safetensors/tensorflow.py +139 -0
  48. TTS/Kokoro/.venv/Lib/site-packages/safetensors/torch.py +550 -0
  49. TTS/Kokoro/.venv/Lib/site-packages/segments-2.3.0.dist-info/INSTALLER +1 -0
  50. TTS/Kokoro/.venv/Lib/site-packages/segments-2.3.0.dist-info/LICENSE +202 -0
TTS/Kokoro/.venv/Lib/site-packages/__pycache__/docopt.cpython-312.pyc ADDED
Binary file (31.7 kB). View file
 
TTS/Kokoro/.venv/Lib/site-packages/__pycache__/isympy.cpython-312.pyc ADDED
Binary file (11 kB). View file
 
TTS/Kokoro/.venv/Lib/site-packages/__pycache__/six.cpython-312.pyc ADDED
Binary file (41.4 kB). View file
 
TTS/Kokoro/.venv/Lib/site-packages/__pycache__/soundfile.cpython-312.pyc ADDED
Binary file (75.1 kB). View file
 
TTS/Kokoro/.venv/Lib/site-packages/_distutils_hack/__init__.py ADDED
@@ -0,0 +1,239 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # don't import any costly modules
2
+ import os
3
+ import sys
4
+
5
+ report_url = (
6
+ "https://github.com/pypa/setuptools/issues/new?template=distutils-deprecation.yml"
7
+ )
8
+
9
+
10
+ def warn_distutils_present():
11
+ if 'distutils' not in sys.modules:
12
+ return
13
+ import warnings
14
+
15
+ warnings.warn(
16
+ "Distutils was imported before Setuptools, but importing Setuptools "
17
+ "also replaces the `distutils` module in `sys.modules`. This may lead "
18
+ "to undesirable behaviors or errors. To avoid these issues, avoid "
19
+ "using distutils directly, ensure that setuptools is installed in the "
20
+ "traditional way (e.g. not an editable install), and/or make sure "
21
+ "that setuptools is always imported before distutils."
22
+ )
23
+
24
+
25
+ def clear_distutils():
26
+ if 'distutils' not in sys.modules:
27
+ return
28
+ import warnings
29
+
30
+ warnings.warn(
31
+ "Setuptools is replacing distutils. Support for replacing "
32
+ "an already imported distutils is deprecated. In the future, "
33
+ "this condition will fail. "
34
+ f"Register concerns at {report_url}"
35
+ )
36
+ mods = [
37
+ name
38
+ for name in sys.modules
39
+ if name == "distutils" or name.startswith("distutils.")
40
+ ]
41
+ for name in mods:
42
+ del sys.modules[name]
43
+
44
+
45
+ def enabled():
46
+ """
47
+ Allow selection of distutils by environment variable.
48
+ """
49
+ which = os.environ.get('SETUPTOOLS_USE_DISTUTILS', 'local')
50
+ if which == 'stdlib':
51
+ import warnings
52
+
53
+ warnings.warn(
54
+ "Reliance on distutils from stdlib is deprecated. Users "
55
+ "must rely on setuptools to provide the distutils module. "
56
+ "Avoid importing distutils or import setuptools first, "
57
+ "and avoid setting SETUPTOOLS_USE_DISTUTILS=stdlib. "
58
+ f"Register concerns at {report_url}"
59
+ )
60
+ return which == 'local'
61
+
62
+
63
+ def ensure_local_distutils():
64
+ import importlib
65
+
66
+ clear_distutils()
67
+
68
+ # With the DistutilsMetaFinder in place,
69
+ # perform an import to cause distutils to be
70
+ # loaded from setuptools._distutils. Ref #2906.
71
+ with shim():
72
+ importlib.import_module('distutils')
73
+
74
+ # check that submodules load as expected
75
+ core = importlib.import_module('distutils.core')
76
+ assert '_distutils' in core.__file__, core.__file__
77
+ assert 'setuptools._distutils.log' not in sys.modules
78
+
79
+
80
+ def do_override():
81
+ """
82
+ Ensure that the local copy of distutils is preferred over stdlib.
83
+
84
+ See https://github.com/pypa/setuptools/issues/417#issuecomment-392298401
85
+ for more motivation.
86
+ """
87
+ if enabled():
88
+ warn_distutils_present()
89
+ ensure_local_distutils()
90
+
91
+
92
+ class _TrivialRe:
93
+ def __init__(self, *patterns) -> None:
94
+ self._patterns = patterns
95
+
96
+ def match(self, string):
97
+ return all(pat in string for pat in self._patterns)
98
+
99
+
100
+ class DistutilsMetaFinder:
101
+ def find_spec(self, fullname, path, target=None):
102
+ # optimization: only consider top level modules and those
103
+ # found in the CPython test suite.
104
+ if path is not None and not fullname.startswith('test.'):
105
+ return None
106
+
107
+ method_name = 'spec_for_{fullname}'.format(**locals())
108
+ method = getattr(self, method_name, lambda: None)
109
+ return method()
110
+
111
+ def spec_for_distutils(self):
112
+ if self.is_cpython():
113
+ return None
114
+
115
+ import importlib
116
+ import importlib.abc
117
+ import importlib.util
118
+
119
+ try:
120
+ mod = importlib.import_module('setuptools._distutils')
121
+ except Exception:
122
+ # There are a couple of cases where setuptools._distutils
123
+ # may not be present:
124
+ # - An older Setuptools without a local distutils is
125
+ # taking precedence. Ref #2957.
126
+ # - Path manipulation during sitecustomize removes
127
+ # setuptools from the path but only after the hook
128
+ # has been loaded. Ref #2980.
129
+ # In either case, fall back to stdlib behavior.
130
+ return None
131
+
132
+ class DistutilsLoader(importlib.abc.Loader):
133
+ def create_module(self, spec):
134
+ mod.__name__ = 'distutils'
135
+ return mod
136
+
137
+ def exec_module(self, module):
138
+ pass
139
+
140
+ return importlib.util.spec_from_loader(
141
+ 'distutils', DistutilsLoader(), origin=mod.__file__
142
+ )
143
+
144
+ @staticmethod
145
+ def is_cpython():
146
+ """
147
+ Suppress supplying distutils for CPython (build and tests).
148
+ Ref #2965 and #3007.
149
+ """
150
+ return os.path.isfile('pybuilddir.txt')
151
+
152
+ def spec_for_pip(self):
153
+ """
154
+ Ensure stdlib distutils when running under pip.
155
+ See pypa/pip#8761 for rationale.
156
+ """
157
+ if sys.version_info >= (3, 12) or self.pip_imported_during_build():
158
+ return
159
+ clear_distutils()
160
+ self.spec_for_distutils = lambda: None
161
+
162
+ @classmethod
163
+ def pip_imported_during_build(cls):
164
+ """
165
+ Detect if pip is being imported in a build script. Ref #2355.
166
+ """
167
+ import traceback
168
+
169
+ return any(
170
+ cls.frame_file_is_setup(frame) for frame, line in traceback.walk_stack(None)
171
+ )
172
+
173
+ @staticmethod
174
+ def frame_file_is_setup(frame):
175
+ """
176
+ Return True if the indicated frame suggests a setup.py file.
177
+ """
178
+ # some frames may not have __file__ (#2940)
179
+ return frame.f_globals.get('__file__', '').endswith('setup.py')
180
+
181
+ def spec_for_sensitive_tests(self):
182
+ """
183
+ Ensure stdlib distutils when running select tests under CPython.
184
+
185
+ python/cpython#91169
186
+ """
187
+ clear_distutils()
188
+ self.spec_for_distutils = lambda: None
189
+
190
+ sensitive_tests = (
191
+ [
192
+ 'test.test_distutils',
193
+ 'test.test_peg_generator',
194
+ 'test.test_importlib',
195
+ ]
196
+ if sys.version_info < (3, 10)
197
+ else [
198
+ 'test.test_distutils',
199
+ ]
200
+ )
201
+
202
+
203
+ for name in DistutilsMetaFinder.sensitive_tests:
204
+ setattr(
205
+ DistutilsMetaFinder,
206
+ f'spec_for_{name}',
207
+ DistutilsMetaFinder.spec_for_sensitive_tests,
208
+ )
209
+
210
+
211
+ DISTUTILS_FINDER = DistutilsMetaFinder()
212
+
213
+
214
+ def add_shim():
215
+ DISTUTILS_FINDER in sys.meta_path or insert_shim()
216
+
217
+
218
+ class shim:
219
+ def __enter__(self) -> None:
220
+ insert_shim()
221
+
222
+ def __exit__(self, exc: object, value: object, tb: object) -> None:
223
+ _remove_shim()
224
+
225
+
226
+ def insert_shim():
227
+ sys.meta_path.insert(0, DISTUTILS_FINDER)
228
+
229
+
230
+ def _remove_shim():
231
+ try:
232
+ sys.meta_path.remove(DISTUTILS_FINDER)
233
+ except ValueError:
234
+ pass
235
+
236
+
237
+ if sys.version_info < (3, 12):
238
+ # DistutilsMetaFinder can only be disabled in Python < 3.12 (PEP 632)
239
+ remove_shim = _remove_shim
TTS/Kokoro/.venv/Lib/site-packages/_distutils_hack/override.py ADDED
@@ -0,0 +1 @@
 
 
1
+ __import__('_distutils_hack').do_override()
TTS/Kokoro/.venv/Lib/site-packages/_soundfile_data/COPYING ADDED
@@ -0,0 +1,503 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ GNU LESSER GENERAL PUBLIC LICENSE
2
+ Version 2.1, February 1999
3
+
4
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
5
+ 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
6
+ Everyone is permitted to copy and distribute verbatim copies
7
+ of this license document, but changing it is not allowed.
8
+
9
+ [This is the first released version of the Lesser GPL. It also counts
10
+ as the successor of the GNU Library Public License, version 2, hence
11
+ the version number 2.1.]
12
+
13
+ Preamble
14
+
15
+ The licenses for most software are designed to take away your
16
+ freedom to share and change it. By contrast, the GNU General Public
17
+ Licenses are intended to guarantee your freedom to share and change
18
+ free software--to make sure the software is free for all its users.
19
+
20
+ This license, the Lesser General Public License, applies to some
21
+ specially designated software packages--typically libraries--of the
22
+ Free Software Foundation and other authors who decide to use it. You
23
+ can use it too, but we suggest you first think carefully about whether
24
+ this license or the ordinary General Public License is the better
25
+ strategy to use in any particular case, based on the explanations below.
26
+
27
+ When we speak of free software, we are referring to freedom of use,
28
+ not price. Our General Public Licenses are designed to make sure that
29
+ you have the freedom to distribute copies of free software (and charge
30
+ for this service if you wish); that you receive source code or can get
31
+ it if you want it; that you can change the software and use pieces of
32
+ it in new free programs; and that you are informed that you can do
33
+ these things.
34
+
35
+ To protect your rights, we need to make restrictions that forbid
36
+ distributors to deny you these rights or to ask you to surrender these
37
+ rights. These restrictions translate to certain responsibilities for
38
+ you if you distribute copies of the library or if you modify it.
39
+
40
+ For example, if you distribute copies of the library, whether gratis
41
+ or for a fee, you must give the recipients all the rights that we gave
42
+ you. You must make sure that they, too, receive or can get the source
43
+ code. If you link other code with the library, you must provide
44
+ complete object files to the recipients, so that they can relink them
45
+ with the library after making changes to the library and recompiling
46
+ it. And you must show them these terms so they know their rights.
47
+
48
+ We protect your rights with a two-step method: (1) we copyright the
49
+ library, and (2) we offer you this license, which gives you legal
50
+ permission to copy, distribute and/or modify the library.
51
+
52
+ To protect each distributor, we want to make it very clear that
53
+ there is no warranty for the free library. Also, if the library is
54
+ modified by someone else and passed on, the recipients should know
55
+ that what they have is not the original version, so that the original
56
+ author's reputation will not be affected by problems that might be
57
+ introduced by others.
58
+
59
+ Finally, software patents pose a constant threat to the existence of
60
+ any free program. We wish to make sure that a company cannot
61
+ effectively restrict the users of a free program by obtaining a
62
+ restrictive license from a patent holder. Therefore, we insist that
63
+ any patent license obtained for a version of the library must be
64
+ consistent with the full freedom of use specified in this license.
65
+
66
+ Most GNU software, including some libraries, is covered by the
67
+ ordinary GNU General Public License. This license, the GNU Lesser
68
+ General Public License, applies to certain designated libraries, and
69
+ is quite different from the ordinary General Public License. We use
70
+ this license for certain libraries in order to permit linking those
71
+ libraries into non-free programs.
72
+
73
+ When a program is linked with a library, whether statically or using
74
+ a shared library, the combination of the two is legally speaking a
75
+ combined work, a derivative of the original library. The ordinary
76
+ General Public License therefore permits such linking only if the
77
+ entire combination fits its criteria of freedom. The Lesser General
78
+ Public License permits more lax criteria for linking other code with
79
+ the library.
80
+
81
+ We call this license the "Lesser" General Public License because it
82
+ does Less to protect the user's freedom than the ordinary General
83
+ Public License. It also provides other free software developers Less
84
+ of an advantage over competing non-free programs. These disadvantages
85
+ are the reason we use the ordinary General Public License for many
86
+ libraries. However, the Lesser license provides advantages in certain
87
+ special circumstances.
88
+
89
+ For example, on rare occasions, there may be a special need to
90
+ encourage the widest possible use of a certain library, so that it becomes
91
+ a de-facto standard. To achieve this, non-free programs must be
92
+ allowed to use the library. A more frequent case is that a free
93
+ library does the same job as widely used non-free libraries. In this
94
+ case, there is little to gain by limiting the free library to free
95
+ software only, so we use the Lesser General Public License.
96
+
97
+ In other cases, permission to use a particular library in non-free
98
+ programs enables a greater number of people to use a large body of
99
+ free software. For example, permission to use the GNU C Library in
100
+ non-free programs enables many more people to use the whole GNU
101
+ operating system, as well as its variant, the GNU/Linux operating
102
+ system.
103
+
104
+ Although the Lesser General Public License is Less protective of the
105
+ users' freedom, it does ensure that the user of a program that is
106
+ linked with the Library has the freedom and the wherewithal to run
107
+ that program using a modified version of the Library.
108
+
109
+ The precise terms and conditions for copying, distribution and
110
+ modification follow. Pay close attention to the difference between a
111
+ "work based on the library" and a "work that uses the library". The
112
+ former contains code derived from the library, whereas the latter must
113
+ be combined with the library in order to run.
114
+
115
+ GNU LESSER GENERAL PUBLIC LICENSE
116
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
117
+
118
+ 0. This License Agreement applies to any software library or other
119
+ program which contains a notice placed by the copyright holder or
120
+ other authorized party saying it may be distributed under the terms of
121
+ this Lesser General Public License (also called "this License").
122
+ Each licensee is addressed as "you".
123
+
124
+ A "library" means a collection of software functions and/or data
125
+ prepared so as to be conveniently linked with application programs
126
+ (which use some of those functions and data) to form executables.
127
+
128
+ The "Library", below, refers to any such software library or work
129
+ which has been distributed under these terms. A "work based on the
130
+ Library" means either the Library or any derivative work under
131
+ copyright law: that is to say, a work containing the Library or a
132
+ portion of it, either verbatim or with modifications and/or translated
133
+ straightforwardly into another language. (Hereinafter, translation is
134
+ included without limitation in the term "modification".)
135
+
136
+ "Source code" for a work means the preferred form of the work for
137
+ making modifications to it. For a library, complete source code means
138
+ all the source code for all modules it contains, plus any associated
139
+ interface definition files, plus the scripts used to control compilation
140
+ and installation of the library.
141
+
142
+ Activities other than copying, distribution and modification are not
143
+ covered by this License; they are outside its scope. The act of
144
+ running a program using the Library is not restricted, and output from
145
+ such a program is covered only if its contents constitute a work based
146
+ on the Library (independent of the use of the Library in a tool for
147
+ writing it). Whether that is true depends on what the Library does
148
+ and what the program that uses the Library does.
149
+
150
+ 1. You may copy and distribute verbatim copies of the Library's
151
+ complete source code as you receive it, in any medium, provided that
152
+ you conspicuously and appropriately publish on each copy an
153
+ appropriate copyright notice and disclaimer of warranty; keep intact
154
+ all the notices that refer to this License and to the absence of any
155
+ warranty; and distribute a copy of this License along with the
156
+ Library.
157
+
158
+ You may charge a fee for the physical act of transferring a copy,
159
+ and you may at your option offer warranty protection in exchange for a
160
+ fee.
161
+
162
+ 2. You may modify your copy or copies of the Library or any portion
163
+ of it, thus forming a work based on the Library, and copy and
164
+ distribute such modifications or work under the terms of Section 1
165
+ above, provided that you also meet all of these conditions:
166
+
167
+ a) The modified work must itself be a software library.
168
+
169
+ b) You must cause the files modified to carry prominent notices
170
+ stating that you changed the files and the date of any change.
171
+
172
+ c) You must cause the whole of the work to be licensed at no
173
+ charge to all third parties under the terms of this License.
174
+
175
+ d) If a facility in the modified Library refers to a function or a
176
+ table of data to be supplied by an application program that uses
177
+ the facility, other than as an argument passed when the facility
178
+ is invoked, then you must make a good faith effort to ensure that,
179
+ in the event an application does not supply such function or
180
+ table, the facility still operates, and performs whatever part of
181
+ its purpose remains meaningful.
182
+
183
+ (For example, a function in a library to compute square roots has
184
+ a purpose that is entirely well-defined independent of the
185
+ application. Therefore, Subsection 2d requires that any
186
+ application-supplied function or table used by this function must
187
+ be optional: if the application does not supply it, the square
188
+ root function must still compute square roots.)
189
+
190
+ These requirements apply to the modified work as a whole. If
191
+ identifiable sections of that work are not derived from the Library,
192
+ and can be reasonably considered independent and separate works in
193
+ themselves, then this License, and its terms, do not apply to those
194
+ sections when you distribute them as separate works. But when you
195
+ distribute the same sections as part of a whole which is a work based
196
+ on the Library, the distribution of the whole must be on the terms of
197
+ this License, whose permissions for other licensees extend to the
198
+ entire whole, and thus to each and every part regardless of who wrote
199
+ it.
200
+
201
+ Thus, it is not the intent of this section to claim rights or contest
202
+ your rights to work written entirely by you; rather, the intent is to
203
+ exercise the right to control the distribution of derivative or
204
+ collective works based on the Library.
205
+
206
+ In addition, mere aggregation of another work not based on the Library
207
+ with the Library (or with a work based on the Library) on a volume of
208
+ a storage or distribution medium does not bring the other work under
209
+ the scope of this License.
210
+
211
+ 3. You may opt to apply the terms of the ordinary GNU General Public
212
+ License instead of this License to a given copy of the Library. To do
213
+ this, you must alter all the notices that refer to this License, so
214
+ that they refer to the ordinary GNU General Public License, version 2,
215
+ instead of to this License. (If a newer version than version 2 of the
216
+ ordinary GNU General Public License has appeared, then you can specify
217
+ that version instead if you wish.) Do not make any other change in
218
+ these notices.
219
+
220
+ Once this change is made in a given copy, it is irreversible for
221
+ that copy, so the ordinary GNU General Public License applies to all
222
+ subsequent copies and derivative works made from that copy.
223
+
224
+ This option is useful when you wish to copy part of the code of
225
+ the Library into a program that is not a library.
226
+
227
+ 4. You may copy and distribute the Library (or a portion or
228
+ derivative of it, under Section 2) in object code or executable form
229
+ under the terms of Sections 1 and 2 above provided that you accompany
230
+ it with the complete corresponding machine-readable source code, which
231
+ must be distributed under the terms of Sections 1 and 2 above on a
232
+ medium customarily used for software interchange.
233
+
234
+ If distribution of object code is made by offering access to copy
235
+ from a designated place, then offering equivalent access to copy the
236
+ source code from the same place satisfies the requirement to
237
+ distribute the source code, even though third parties are not
238
+ compelled to copy the source along with the object code.
239
+
240
+ 5. A program that contains no derivative of any portion of the
241
+ Library, but is designed to work with the Library by being compiled or
242
+ linked with it, is called a "work that uses the Library". Such a
243
+ work, in isolation, is not a derivative work of the Library, and
244
+ therefore falls outside the scope of this License.
245
+
246
+ However, linking a "work that uses the Library" with the Library
247
+ creates an executable that is a derivative of the Library (because it
248
+ contains portions of the Library), rather than a "work that uses the
249
+ library". The executable is therefore covered by this License.
250
+ Section 6 states terms for distribution of such executables.
251
+
252
+ When a "work that uses the Library" uses material from a header file
253
+ that is part of the Library, the object code for the work may be a
254
+ derivative work of the Library even though the source code is not.
255
+ Whether this is true is especially significant if the work can be
256
+ linked without the Library, or if the work is itself a library. The
257
+ threshold for this to be true is not precisely defined by law.
258
+
259
+ If such an object file uses only numerical parameters, data
260
+ structure layouts and accessors, and small macros and small inline
261
+ functions (ten lines or less in length), then the use of the object
262
+ file is unrestricted, regardless of whether it is legally a derivative
263
+ work. (Executables containing this object code plus portions of the
264
+ Library will still fall under Section 6.)
265
+
266
+ Otherwise, if the work is a derivative of the Library, you may
267
+ distribute the object code for the work under the terms of Section 6.
268
+ Any executables containing that work also fall under Section 6,
269
+ whether or not they are linked directly with the Library itself.
270
+
271
+ 6. As an exception to the Sections above, you may also combine or
272
+ link a "work that uses the Library" with the Library to produce a
273
+ work containing portions of the Library, and distribute that work
274
+ under terms of your choice, provided that the terms permit
275
+ modification of the work for the customer's own use and reverse
276
+ engineering for debugging such modifications.
277
+
278
+ You must give prominent notice with each copy of the work that the
279
+ Library is used in it and that the Library and its use are covered by
280
+ this License. You must supply a copy of this License. If the work
281
+ during execution displays copyright notices, you must include the
282
+ copyright notice for the Library among them, as well as a reference
283
+ directing the user to the copy of this License. Also, you must do one
284
+ of these things:
285
+
286
+ a) Accompany the work with the complete corresponding
287
+ machine-readable source code for the Library including whatever
288
+ changes were used in the work (which must be distributed under
289
+ Sections 1 and 2 above); and, if the work is an executable linked
290
+ with the Library, with the complete machine-readable "work that
291
+ uses the Library", as object code and/or source code, so that the
292
+ user can modify the Library and then relink to produce a modified
293
+ executable containing the modified Library. (It is understood
294
+ that the user who changes the contents of definitions files in the
295
+ Library will not necessarily be able to recompile the application
296
+ to use the modified definitions.)
297
+
298
+ b) Use a suitable shared library mechanism for linking with the
299
+ Library. A suitable mechanism is one that (1) uses at run time a
300
+ copy of the library already present on the user's computer system,
301
+ rather than copying library functions into the executable, and (2)
302
+ will operate properly with a modified version of the library, if
303
+ the user installs one, as long as the modified version is
304
+ interface-compatible with the version that the work was made with.
305
+
306
+ c) Accompany the work with a written offer, valid for at
307
+ least three years, to give the same user the materials
308
+ specified in Subsection 6a, above, for a charge no more
309
+ than the cost of performing this distribution.
310
+
311
+ d) If distribution of the work is made by offering access to copy
312
+ from a designated place, offer equivalent access to copy the above
313
+ specified materials from the same place.
314
+
315
+ e) Verify that the user has already received a copy of these
316
+ materials or that you have already sent this user a copy.
317
+
318
+ For an executable, the required form of the "work that uses the
319
+ Library" must include any data and utility programs needed for
320
+ reproducing the executable from it. However, as a special exception,
321
+ the materials to be distributed need not include anything that is
322
+ normally distributed (in either source or binary form) with the major
323
+ components (compiler, kernel, and so on) of the operating system on
324
+ which the executable runs, unless that component itself accompanies
325
+ the executable.
326
+
327
+ It may happen that this requirement contradicts the license
328
+ restrictions of other proprietary libraries that do not normally
329
+ accompany the operating system. Such a contradiction means you cannot
330
+ use both them and the Library together in an executable that you
331
+ distribute.
332
+
333
+ 7. You may place library facilities that are a work based on the
334
+ Library side-by-side in a single library together with other library
335
+ facilities not covered by this License, and distribute such a combined
336
+ library, provided that the separate distribution of the work based on
337
+ the Library and of the other library facilities is otherwise
338
+ permitted, and provided that you do these two things:
339
+
340
+ a) Accompany the combined library with a copy of the same work
341
+ based on the Library, uncombined with any other library
342
+ facilities. This must be distributed under the terms of the
343
+ Sections above.
344
+
345
+ b) Give prominent notice with the combined library of the fact
346
+ that part of it is a work based on the Library, and explaining
347
+ where to find the accompanying uncombined form of the same work.
348
+
349
+ 8. You may not copy, modify, sublicense, link with, or distribute
350
+ the Library except as expressly provided under this License. Any
351
+ attempt otherwise to copy, modify, sublicense, link with, or
352
+ distribute the Library is void, and will automatically terminate your
353
+ rights under this License. However, parties who have received copies,
354
+ or rights, from you under this License will not have their licenses
355
+ terminated so long as such parties remain in full compliance.
356
+
357
+ 9. You are not required to accept this License, since you have not
358
+ signed it. However, nothing else grants you permission to modify or
359
+ distribute the Library or its derivative works. These actions are
360
+ prohibited by law if you do not accept this License. Therefore, by
361
+ modifying or distributing the Library (or any work based on the
362
+ Library), you indicate your acceptance of this License to do so, and
363
+ all its terms and conditions for copying, distributing or modifying
364
+ the Library or works based on it.
365
+
366
+ 10. Each time you redistribute the Library (or any work based on the
367
+ Library), the recipient automatically receives a license from the
368
+ original licensor to copy, distribute, link with or modify the Library
369
+ subject to these terms and conditions. You may not impose any further
370
+ restrictions on the recipients' exercise of the rights granted herein.
371
+ You are not responsible for enforcing compliance by third parties with
372
+ this License.
373
+
374
+ 11. If, as a consequence of a court judgment or allegation of patent
375
+ infringement or for any other reason (not limited to patent issues),
376
+ conditions are imposed on you (whether by court order, agreement or
377
+ otherwise) that contradict the conditions of this License, they do not
378
+ excuse you from the conditions of this License. If you cannot
379
+ distribute so as to satisfy simultaneously your obligations under this
380
+ License and any other pertinent obligations, then as a consequence you
381
+ may not distribute the Library at all. For example, if a patent
382
+ license would not permit royalty-free redistribution of the Library by
383
+ all those who receive copies directly or indirectly through you, then
384
+ the only way you could satisfy both it and this License would be to
385
+ refrain entirely from distribution of the Library.
386
+
387
+ If any portion of this section is held invalid or unenforceable under any
388
+ particular circumstance, the balance of the section is intended to apply,
389
+ and the section as a whole is intended to apply in other circumstances.
390
+
391
+ It is not the purpose of this section to induce you to infringe any
392
+ patents or other property right claims or to contest validity of any
393
+ such claims; this section has the sole purpose of protecting the
394
+ integrity of the free software distribution system which is
395
+ implemented by public license practices. Many people have made
396
+ generous contributions to the wide range of software distributed
397
+ through that system in reliance on consistent application of that
398
+ system; it is up to the author/donor to decide if he or she is willing
399
+ to distribute software through any other system and a licensee cannot
400
+ impose that choice.
401
+
402
+ This section is intended to make thoroughly clear what is believed to
403
+ be a consequence of the rest of this License.
404
+
405
+ 12. If the distribution and/or use of the Library is restricted in
406
+ certain countries either by patents or by copyrighted interfaces, the
407
+ original copyright holder who places the Library under this License may add
408
+ an explicit geographical distribution limitation excluding those countries,
409
+ so that distribution is permitted only in or among countries not thus
410
+ excluded. In such case, this License incorporates the limitation as if
411
+ written in the body of this License.
412
+
413
+ 13. The Free Software Foundation may publish revised and/or new
414
+ versions of the Lesser General Public License from time to time.
415
+ Such new versions will be similar in spirit to the present version,
416
+ but may differ in detail to address new problems or concerns.
417
+
418
+ Each version is given a distinguishing version number. If the Library
419
+ specifies a version number of this License which applies to it and
420
+ "any later version", you have the option of following the terms and
421
+ conditions either of that version or of any later version published by
422
+ the Free Software Foundation. If the Library does not specify a
423
+ license version number, you may choose any version ever published by
424
+ the Free Software Foundation.
425
+
426
+ 14. If you wish to incorporate parts of the Library into other free
427
+ programs whose distribution conditions are incompatible with these,
428
+ write to the author to ask for permission. For software which is
429
+ copyrighted by the Free Software Foundation, write to the Free
430
+ Software Foundation; we sometimes make exceptions for this. Our
431
+ decision will be guided by the two goals of preserving the free status
432
+ of all derivatives of our free software and of promoting the sharing
433
+ and reuse of software generally.
434
+
435
+ NO WARRANTY
436
+
437
+ 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
438
+ WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
439
+ EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
440
+ OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
441
+ KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
442
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
443
+ PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
444
+ LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
445
+ THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
446
+
447
+ 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
448
+ WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
449
+ AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
450
+ FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
451
+ CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
452
+ LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
453
+ RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
454
+ FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
455
+ SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
456
+ DAMAGES.
457
+
458
+ END OF TERMS AND CONDITIONS
459
+
460
+ How to Apply These Terms to Your New Libraries
461
+
462
+ If you develop a new library, and you want it to be of the greatest
463
+ possible use to the public, we recommend making it free software that
464
+ everyone can redistribute and change. You can do so by permitting
465
+ redistribution under these terms (or, alternatively, under the terms of the
466
+ ordinary General Public License).
467
+
468
+ To apply these terms, attach the following notices to the library. It is
469
+ safest to attach them to the start of each source file to most effectively
470
+ convey the exclusion of warranty; and each file should have at least the
471
+ "copyright" line and a pointer to where the full notice is found.
472
+
473
+ <one line to give the library's name and a brief idea of what it does.>
474
+ Copyright (C) <year> <name of author>
475
+
476
+ This library is free software; you can redistribute it and/or
477
+ modify it under the terms of the GNU Lesser General Public
478
+ License as published by the Free Software Foundation; either
479
+ version 2.1 of the License, or (at your option) any later version.
480
+
481
+ This library is distributed in the hope that it will be useful,
482
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
483
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
484
+ Lesser General Public License for more details.
485
+
486
+ You should have received a copy of the GNU Lesser General Public
487
+ License along with this library; if not, write to the Free Software
488
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
489
+
490
+ Also add information on how to contact you by electronic and paper mail.
491
+
492
+ You should also get your employer (if you work as a programmer) or your
493
+ school, if any, to sign a "copyright disclaimer" for the library, if
494
+ necessary. Here is a sample; alter the names:
495
+
496
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the
497
+ library `Frob' (a library for tweaking knobs) written by James Random Hacker.
498
+
499
+ <signature of Ty Coon>, 1 April 1990
500
+ Ty Coon, President of Vice
501
+
502
+ That's all there is to it!
503
+
TTS/Kokoro/.venv/Lib/site-packages/_soundfile_data/__init__.py ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ # this file makes _soundfile_data importable, so we can query its path
2
+ # when searching for the libsndfile binaries.
3
+ pass
TTS/Kokoro/.venv/Lib/site-packages/_yaml/__init__.py ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # This is a stub package designed to roughly emulate the _yaml
2
+ # extension module, which previously existed as a standalone module
3
+ # and has been moved into the `yaml` package namespace.
4
+ # It does not perfectly mimic its old counterpart, but should get
5
+ # close enough for anyone who's relying on it even when they shouldn't.
6
+ import yaml
7
+
8
+ # in some circumstances, the yaml module we imoprted may be from a different version, so we need
9
+ # to tread carefully when poking at it here (it may not have the attributes we expect)
10
+ if not getattr(yaml, '__with_libyaml__', False):
11
+ from sys import version_info
12
+
13
+ exc = ModuleNotFoundError if version_info >= (3, 6) else ImportError
14
+ raise exc("No module named '_yaml'")
15
+ else:
16
+ from yaml._yaml import *
17
+ import warnings
18
+ warnings.warn(
19
+ 'The _yaml extension module is now located at yaml._yaml'
20
+ ' and its location is subject to change. To use the'
21
+ ' LibYAML-based parser and emitter, import from `yaml`:'
22
+ ' `from yaml import CLoader as Loader, CDumper as Dumper`.',
23
+ DeprecationWarning
24
+ )
25
+ del warnings
26
+ # Don't `del yaml` here because yaml is actually an existing
27
+ # namespace member of _yaml.
28
+
29
+ __name__ = '_yaml'
30
+ # If the module is top-level (i.e. not a part of any specific package)
31
+ # then the attribute should be set to ''.
32
+ # https://docs.python.org/3.8/library/types.html
33
+ __package__ = ''
TTS/Kokoro/.venv/Lib/site-packages/addict/__pycache__/__init__.cpython-312.pyc ADDED
Binary file (469 Bytes). View file
 
TTS/Kokoro/.venv/Lib/site-packages/rich-14.3.3.dist-info/INSTALLER ADDED
@@ -0,0 +1 @@
 
 
1
+ pip
TTS/Kokoro/.venv/Lib/site-packages/rich-14.3.3.dist-info/METADATA ADDED
@@ -0,0 +1,480 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Metadata-Version: 2.4
2
+ Name: rich
3
+ Version: 14.3.3
4
+ Summary: Render rich text, tables, progress bars, syntax highlighting, markdown and more to the terminal
5
+ License: MIT
6
+ License-File: LICENSE
7
+ Author: Will McGugan
8
+ Author-email: willmcgugan@gmail.com
9
+ Requires-Python: >=3.8.0
10
+ Classifier: Development Status :: 5 - Production/Stable
11
+ Classifier: Environment :: Console
12
+ Classifier: Framework :: IPython
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Operating System :: MacOS
16
+ Classifier: Operating System :: Microsoft :: Windows
17
+ Classifier: Operating System :: POSIX :: Linux
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3.8
20
+ Classifier: Programming Language :: Python :: 3.9
21
+ Classifier: Programming Language :: Python :: 3.10
22
+ Classifier: Programming Language :: Python :: 3.11
23
+ Classifier: Programming Language :: Python :: 3.12
24
+ Classifier: Programming Language :: Python :: 3.13
25
+ Classifier: Programming Language :: Python :: 3.14
26
+ Classifier: Typing :: Typed
27
+ Provides-Extra: jupyter
28
+ Requires-Dist: ipywidgets (>=7.5.1,<9) ; extra == "jupyter"
29
+ Requires-Dist: markdown-it-py (>=2.2.0)
30
+ Requires-Dist: pygments (>=2.13.0,<3.0.0)
31
+ Project-URL: Documentation, https://rich.readthedocs.io/en/latest/
32
+ Project-URL: Homepage, https://github.com/Textualize/rich
33
+ Description-Content-Type: text/markdown
34
+
35
+ [![Supported Python Versions](https://img.shields.io/pypi/pyversions/rich)](https://pypi.org/project/rich/) [![PyPI version](https://badge.fury.io/py/rich.svg)](https://badge.fury.io/py/rich)
36
+
37
+ [![Downloads](https://pepy.tech/badge/rich/month)](https://pepy.tech/project/rich)
38
+ [![codecov](https://img.shields.io/codecov/c/github/Textualize/rich?label=codecov&logo=codecov)](https://codecov.io/gh/Textualize/rich)
39
+ [![Rich blog](https://img.shields.io/badge/blog-rich%20news-yellowgreen)](https://www.willmcgugan.com/tag/rich/)
40
+ [![Twitter Follow](https://img.shields.io/twitter/follow/willmcgugan.svg?style=social)](https://twitter.com/willmcgugan)
41
+
42
+ ![Logo](https://github.com/textualize/rich/raw/master/imgs/logo.svg)
43
+
44
+ [English readme](https://github.com/textualize/rich/blob/master/README.md)
45
+ • [简体中文 readme](https://github.com/textualize/rich/blob/master/README.cn.md)
46
+ • [正體中文 readme](https://github.com/textualize/rich/blob/master/README.zh-tw.md)
47
+ • [Lengua española readme](https://github.com/textualize/rich/blob/master/README.es.md)
48
+ • [Deutsche readme](https://github.com/textualize/rich/blob/master/README.de.md)
49
+ • [Läs på svenska](https://github.com/textualize/rich/blob/master/README.sv.md)
50
+ • [日本語 readme](https://github.com/textualize/rich/blob/master/README.ja.md)
51
+ • [한국어 readme](https://github.com/textualize/rich/blob/master/README.kr.md)
52
+ • [Français readme](https://github.com/textualize/rich/blob/master/README.fr.md)
53
+ • [Schwizerdütsch readme](https://github.com/textualize/rich/blob/master/README.de-ch.md)
54
+ • [हिन्दी readme](https://github.com/textualize/rich/blob/master/README.hi.md)
55
+ • [Português brasileiro readme](https://github.com/textualize/rich/blob/master/README.pt-br.md)
56
+ • [Italian readme](https://github.com/textualize/rich/blob/master/README.it.md)
57
+ • [Русский readme](https://github.com/textualize/rich/blob/master/README.ru.md)
58
+ • [Indonesian readme](https://github.com/textualize/rich/blob/master/README.id.md)
59
+ • [فارسی readme](https://github.com/textualize/rich/blob/master/README.fa.md)
60
+ • [Türkçe readme](https://github.com/textualize/rich/blob/master/README.tr.md)
61
+ • [Polskie readme](https://github.com/textualize/rich/blob/master/README.pl.md)
62
+
63
+
64
+ Rich is a Python library for _rich_ text and beautiful formatting in the terminal.
65
+
66
+ The [Rich API](https://rich.readthedocs.io/en/latest/) makes it easy to add color and style to terminal output. Rich can also render pretty tables, progress bars, markdown, syntax highlighted source code, tracebacks, and more — out of the box.
67
+
68
+ ![Features](https://github.com/textualize/rich/raw/master/imgs/features.png)
69
+
70
+ For a video introduction to Rich see [calmcode.io](https://calmcode.io/rich/introduction.html) by [@fishnets88](https://twitter.com/fishnets88).
71
+
72
+ See what [people are saying about Rich](https://www.willmcgugan.com/blog/pages/post/rich-tweets/).
73
+
74
+ ## Compatibility
75
+
76
+ Rich works with Linux, macOS and Windows. True color / emoji works with new Windows Terminal, classic terminal is limited to 16 colors. Rich requires Python 3.8 or later.
77
+
78
+ Rich works with [Jupyter notebooks](https://jupyter.org/) with no additional configuration required.
79
+
80
+ ## Installing
81
+
82
+ Install with `pip` or your favorite PyPI package manager.
83
+
84
+ ```sh
85
+ python -m pip install rich
86
+ ```
87
+
88
+ Run the following to test Rich output on your terminal:
89
+
90
+ ```sh
91
+ python -m rich
92
+ ```
93
+
94
+ ## Rich Print
95
+
96
+ To effortlessly add rich output to your application, you can import the [rich print](https://rich.readthedocs.io/en/latest/introduction.html#quick-start) method, which has the same signature as the builtin Python function. Try this:
97
+
98
+ ```python
99
+ from rich import print
100
+
101
+ print("Hello, [bold magenta]World[/bold magenta]!", ":vampire:", locals())
102
+ ```
103
+
104
+ ![Hello World](https://github.com/textualize/rich/raw/master/imgs/print.png)
105
+
106
+ ## Rich REPL
107
+
108
+ Rich can be installed in the Python REPL, so that any data structures will be pretty printed and highlighted.
109
+
110
+ ```python
111
+ >>> from rich import pretty
112
+ >>> pretty.install()
113
+ ```
114
+
115
+ ![REPL](https://github.com/textualize/rich/raw/master/imgs/repl.png)
116
+
117
+ ## Using the Console
118
+
119
+ For more control over rich terminal content, import and construct a [Console](https://rich.readthedocs.io/en/latest/reference/console.html#rich.console.Console) object.
120
+
121
+ ```python
122
+ from rich.console import Console
123
+
124
+ console = Console()
125
+ ```
126
+
127
+ The Console object has a `print` method which has an intentionally similar interface to the builtin `print` function. Here's an example of use:
128
+
129
+ ```python
130
+ console.print("Hello", "World!")
131
+ ```
132
+
133
+ As you might expect, this will print `"Hello World!"` to the terminal. Note that unlike the builtin `print` function, Rich will word-wrap your text to fit within the terminal width.
134
+
135
+ There are a few ways of adding color and style to your output. You can set a style for the entire output by adding a `style` keyword argument. Here's an example:
136
+
137
+ ```python
138
+ console.print("Hello", "World!", style="bold red")
139
+ ```
140
+
141
+ The output will be something like the following:
142
+
143
+ ![Hello World](https://github.com/textualize/rich/raw/master/imgs/hello_world.png)
144
+
145
+ That's fine for styling a line of text at a time. For more finely grained styling, Rich renders a special markup which is similar in syntax to [bbcode](https://en.wikipedia.org/wiki/BBCode). Here's an example:
146
+
147
+ ```python
148
+ console.print("Where there is a [bold cyan]Will[/bold cyan] there [u]is[/u] a [i]way[/i].")
149
+ ```
150
+
151
+ ![Console Markup](https://github.com/textualize/rich/raw/master/imgs/where_there_is_a_will.png)
152
+
153
+ You can use a Console object to generate sophisticated output with minimal effort. See the [Console API](https://rich.readthedocs.io/en/latest/console.html) docs for details.
154
+
155
+ ## Rich Inspect
156
+
157
+ Rich has an [inspect](https://rich.readthedocs.io/en/latest/reference/init.html?highlight=inspect#rich.inspect) function which can produce a report on any Python object, such as class, instance, or builtin.
158
+
159
+ ```python
160
+ >>> my_list = ["foo", "bar"]
161
+ >>> from rich import inspect
162
+ >>> inspect(my_list, methods=True)
163
+ ```
164
+
165
+ ![Log](https://github.com/textualize/rich/raw/master/imgs/inspect.png)
166
+
167
+ See the [inspect docs](https://rich.readthedocs.io/en/latest/reference/init.html#rich.inspect) for details.
168
+
169
+ # Rich Library
170
+
171
+ Rich contains a number of builtin _renderables_ you can use to create elegant output in your CLI and help you debug your code.
172
+
173
+ Click the following headings for details:
174
+
175
+ <details>
176
+ <summary>Log</summary>
177
+
178
+ The Console object has a `log()` method which has a similar interface to `print()`, but also renders a column for the current time and the file and line which made the call. By default Rich will do syntax highlighting for Python structures and for repr strings. If you log a collection (i.e. a dict or a list) Rich will pretty print it so that it fits in the available space. Here's an example of some of these features.
179
+
180
+ ```python
181
+ from rich.console import Console
182
+ console = Console()
183
+
184
+ test_data = [
185
+ {"jsonrpc": "2.0", "method": "sum", "params": [None, 1, 2, 4, False, True], "id": "1",},
186
+ {"jsonrpc": "2.0", "method": "notify_hello", "params": [7]},
187
+ {"jsonrpc": "2.0", "method": "subtract", "params": [42, 23], "id": "2"},
188
+ ]
189
+
190
+ def test_log():
191
+ enabled = False
192
+ context = {
193
+ "foo": "bar",
194
+ }
195
+ movies = ["Deadpool", "Rise of the Skywalker"]
196
+ console.log("Hello from", console, "!")
197
+ console.log(test_data, log_locals=True)
198
+
199
+
200
+ test_log()
201
+ ```
202
+
203
+ The above produces the following output:
204
+
205
+ ![Log](https://github.com/textualize/rich/raw/master/imgs/log.png)
206
+
207
+ Note the `log_locals` argument, which outputs a table containing the local variables where the log method was called.
208
+
209
+ The log method could be used for logging to the terminal for long running applications such as servers, but is also a very nice debugging aid.
210
+
211
+ </details>
212
+ <details>
213
+ <summary>Logging Handler</summary>
214
+
215
+ You can also use the builtin [Handler class](https://rich.readthedocs.io/en/latest/logging.html) to format and colorize output from Python's logging module. Here's an example of the output:
216
+
217
+ ![Logging](https://github.com/textualize/rich/raw/master/imgs/logging.png)
218
+
219
+ </details>
220
+
221
+ <details>
222
+ <summary>Emoji</summary>
223
+
224
+ To insert an emoji in to console output place the name between two colons. Here's an example:
225
+
226
+ ```python
227
+ >>> console.print(":smiley: :vampire: :pile_of_poo: :thumbs_up: :raccoon:")
228
+ 😃 🧛 💩 👍 🦝
229
+ ```
230
+
231
+ Please use this feature wisely.
232
+
233
+ </details>
234
+
235
+ <details>
236
+ <summary>Tables</summary>
237
+
238
+ Rich can render flexible [tables](https://rich.readthedocs.io/en/latest/tables.html) with unicode box characters. There is a large variety of formatting options for borders, styles, cell alignment etc.
239
+
240
+ ![table movie](https://github.com/textualize/rich/raw/master/imgs/table_movie.gif)
241
+
242
+ The animation above was generated with [table_movie.py](https://github.com/textualize/rich/blob/master/examples/table_movie.py) in the examples directory.
243
+
244
+ Here's a simpler table example:
245
+
246
+ ```python
247
+ from rich.console import Console
248
+ from rich.table import Table
249
+
250
+ console = Console()
251
+
252
+ table = Table(show_header=True, header_style="bold magenta")
253
+ table.add_column("Date", style="dim", width=12)
254
+ table.add_column("Title")
255
+ table.add_column("Production Budget", justify="right")
256
+ table.add_column("Box Office", justify="right")
257
+ table.add_row(
258
+ "Dec 20, 2019", "Star Wars: The Rise of Skywalker", "$275,000,000", "$375,126,118"
259
+ )
260
+ table.add_row(
261
+ "May 25, 2018",
262
+ "[red]Solo[/red]: A Star Wars Story",
263
+ "$275,000,000",
264
+ "$393,151,347",
265
+ )
266
+ table.add_row(
267
+ "Dec 15, 2017",
268
+ "Star Wars Ep. VIII: The Last Jedi",
269
+ "$262,000,000",
270
+ "[bold]$1,332,539,889[/bold]",
271
+ )
272
+
273
+ console.print(table)
274
+ ```
275
+
276
+ This produces the following output:
277
+
278
+ ![table](https://github.com/textualize/rich/raw/master/imgs/table.png)
279
+
280
+ Note that console markup is rendered in the same way as `print()` and `log()`. In fact, anything that is renderable by Rich may be included in the headers / rows (even other tables).
281
+
282
+ The `Table` class is smart enough to resize columns to fit the available width of the terminal, wrapping text as required. Here's the same example, with the terminal made smaller than the table above:
283
+
284
+ ![table2](https://github.com/textualize/rich/raw/master/imgs/table2.png)
285
+
286
+ </details>
287
+
288
+ <details>
289
+ <summary>Progress Bars</summary>
290
+
291
+ Rich can render multiple flicker-free [progress](https://rich.readthedocs.io/en/latest/progress.html) bars to track long-running tasks.
292
+
293
+ For basic usage, wrap any sequence in the `track` function and iterate over the result. Here's an example:
294
+
295
+ ```python
296
+ from rich.progress import track
297
+
298
+ for step in track(range(100)):
299
+ do_step(step)
300
+ ```
301
+
302
+ It's not much harder to add multiple progress bars. Here's an example taken from the docs:
303
+
304
+ ![progress](https://github.com/textualize/rich/raw/master/imgs/progress.gif)
305
+
306
+ The columns may be configured to show any details you want. Built-in columns include percentage complete, file size, file speed, and time remaining. Here's another example showing a download in progress:
307
+
308
+ ![progress](https://github.com/textualize/rich/raw/master/imgs/downloader.gif)
309
+
310
+ To try this out yourself, see [examples/downloader.py](https://github.com/textualize/rich/blob/master/examples/downloader.py) which can download multiple URLs simultaneously while displaying progress.
311
+
312
+ </details>
313
+
314
+ <details>
315
+ <summary>Status</summary>
316
+
317
+ For situations where it is hard to calculate progress, you can use the [status](https://rich.readthedocs.io/en/latest/reference/console.html#rich.console.Console.status) method which will display a 'spinner' animation and message. The animation won't prevent you from using the console as normal. Here's an example:
318
+
319
+ ```python
320
+ from time import sleep
321
+ from rich.console import Console
322
+
323
+ console = Console()
324
+ tasks = [f"task {n}" for n in range(1, 11)]
325
+
326
+ with console.status("[bold green]Working on tasks...") as status:
327
+ while tasks:
328
+ task = tasks.pop(0)
329
+ sleep(1)
330
+ console.log(f"{task} complete")
331
+ ```
332
+
333
+ This generates the following output in the terminal.
334
+
335
+ ![status](https://github.com/textualize/rich/raw/master/imgs/status.gif)
336
+
337
+ The spinner animations were borrowed from [cli-spinners](https://www.npmjs.com/package/cli-spinners). You can select a spinner by specifying the `spinner` parameter. Run the following command to see the available values:
338
+
339
+ ```
340
+ python -m rich.spinner
341
+ ```
342
+
343
+ The above command generates the following output in the terminal:
344
+
345
+ ![spinners](https://github.com/textualize/rich/raw/master/imgs/spinners.gif)
346
+
347
+ </details>
348
+
349
+ <details>
350
+ <summary>Tree</summary>
351
+
352
+ Rich can render a [tree](https://rich.readthedocs.io/en/latest/tree.html) with guide lines. A tree is ideal for displaying a file structure, or any other hierarchical data.
353
+
354
+ The labels of the tree can be simple text or anything else Rich can render. Run the following for a demonstration:
355
+
356
+ ```
357
+ python -m rich.tree
358
+ ```
359
+
360
+ This generates the following output:
361
+
362
+ ![markdown](https://github.com/textualize/rich/raw/master/imgs/tree.png)
363
+
364
+ See the [tree.py](https://github.com/textualize/rich/blob/master/examples/tree.py) example for a script that displays a tree view of any directory, similar to the linux `tree` command.
365
+
366
+ </details>
367
+
368
+ <details>
369
+ <summary>Columns</summary>
370
+
371
+ Rich can render content in neat [columns](https://rich.readthedocs.io/en/latest/columns.html) with equal or optimal width. Here's a very basic clone of the (MacOS / Linux) `ls` command which displays a directory listing in columns:
372
+
373
+ ```python
374
+ import os
375
+ import sys
376
+
377
+ from rich import print
378
+ from rich.columns import Columns
379
+
380
+ directory = os.listdir(sys.argv[1])
381
+ print(Columns(directory))
382
+ ```
383
+
384
+ The following screenshot is the output from the [columns example](https://github.com/textualize/rich/blob/master/examples/columns.py) which displays data pulled from an API in columns:
385
+
386
+ ![columns](https://github.com/textualize/rich/raw/master/imgs/columns.png)
387
+
388
+ </details>
389
+
390
+ <details>
391
+ <summary>Markdown</summary>
392
+
393
+ Rich can render [markdown](https://rich.readthedocs.io/en/latest/markdown.html) and does a reasonable job of translating the formatting to the terminal.
394
+
395
+ To render markdown import the `Markdown` class and construct it with a string containing markdown code. Then print it to the console. Here's an example:
396
+
397
+ ```python
398
+ from rich.console import Console
399
+ from rich.markdown import Markdown
400
+
401
+ console = Console()
402
+ with open("README.md") as readme:
403
+ markdown = Markdown(readme.read())
404
+ console.print(markdown)
405
+ ```
406
+
407
+ This will produce output something like the following:
408
+
409
+ ![markdown](https://github.com/textualize/rich/raw/master/imgs/markdown.png)
410
+
411
+ </details>
412
+
413
+ <details>
414
+ <summary>Syntax Highlighting</summary>
415
+
416
+ Rich uses the [pygments](https://pygments.org/) library to implement [syntax highlighting](https://rich.readthedocs.io/en/latest/syntax.html). Usage is similar to rendering markdown; construct a `Syntax` object and print it to the console. Here's an example:
417
+
418
+ ```python
419
+ from rich.console import Console
420
+ from rich.syntax import Syntax
421
+
422
+ my_code = '''
423
+ def iter_first_last(values: Iterable[T]) -> Iterable[Tuple[bool, bool, T]]:
424
+ """Iterate and generate a tuple with a flag for first and last value."""
425
+ iter_values = iter(values)
426
+ try:
427
+ previous_value = next(iter_values)
428
+ except StopIteration:
429
+ return
430
+ first = True
431
+ for value in iter_values:
432
+ yield first, False, previous_value
433
+ first = False
434
+ previous_value = value
435
+ yield first, True, previous_value
436
+ '''
437
+ syntax = Syntax(my_code, "python", theme="monokai", line_numbers=True)
438
+ console = Console()
439
+ console.print(syntax)
440
+ ```
441
+
442
+ This will produce the following output:
443
+
444
+ ![syntax](https://github.com/textualize/rich/raw/master/imgs/syntax.png)
445
+
446
+ </details>
447
+
448
+ <details>
449
+ <summary>Tracebacks</summary>
450
+
451
+ Rich can render [beautiful tracebacks](https://rich.readthedocs.io/en/latest/traceback.html) which are easier to read and show more code than standard Python tracebacks. You can set Rich as the default traceback handler so all uncaught exceptions will be rendered by Rich.
452
+
453
+ Here's what it looks like on OSX (similar on Linux):
454
+
455
+ ![traceback](https://github.com/textualize/rich/raw/master/imgs/traceback.png)
456
+
457
+ </details>
458
+
459
+ All Rich renderables make use of the [Console Protocol](https://rich.readthedocs.io/en/latest/protocol.html), which you can also use to implement your own Rich content.
460
+
461
+ # Rich CLI
462
+
463
+
464
+ See also [Rich CLI](https://github.com/textualize/rich-cli) for a command line application powered by Rich. Syntax highlight code, render markdown, display CSVs in tables, and more, directly from the command prompt.
465
+
466
+
467
+ ![Rich CLI](https://raw.githubusercontent.com/Textualize/rich-cli/main/imgs/rich-cli-splash.jpg)
468
+
469
+ # Textual
470
+
471
+ See also Rich's sister project, [Textual](https://github.com/Textualize/textual), which you can use to build sophisticated User Interfaces in the terminal.
472
+
473
+ ![textual-splash](https://github.com/user-attachments/assets/4caeb77e-48c0-4cf7-b14d-c53ded855ffd)
474
+
475
+ # Toad
476
+
477
+ [Toad](https://github.com/batrachianai/toad) is a unified interface for agentic coding. Built with Rich and Textual.
478
+
479
+ ![toad](https://github.com/user-attachments/assets/6678b707-1aeb-420f-99ad-abfcd4356771)
480
+
TTS/Kokoro/.venv/Lib/site-packages/rich-14.3.3.dist-info/RECORD ADDED
@@ -0,0 +1,206 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ rich-14.3.3.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
2
+ rich-14.3.3.dist-info/METADATA,sha256=9kOnJPejl6vTwavl35qTJmtKu218p9Ob-z-jDoz1ATo,18495
3
+ rich-14.3.3.dist-info/RECORD,,
4
+ rich-14.3.3.dist-info/WHEEL,sha256=kJCRJT_g0adfAJzTx2GUMmS80rTJIVHRCfG0DQgLq3o,88
5
+ rich-14.3.3.dist-info/licenses/LICENSE,sha256=3u18F6QxgVgZCj6iOcyHmlpQJxzruYrnAl9I--WNyhU,1056
6
+ rich/__init__.py,sha256=j7AA9_z_PANQbmRTwTkWZc_DVdqtBBHxBqGrMsz21CI,6131
7
+ rich/__main__.py,sha256=kcy8BtBEUkYLCogRkwhCdJs0VNx6KF1n8kFU2g-7plg,7725
8
+ rich/__pycache__/__init__.cpython-312.pyc,,
9
+ rich/__pycache__/__main__.cpython-312.pyc,,
10
+ rich/__pycache__/_emoji_codes.cpython-312.pyc,,
11
+ rich/__pycache__/_emoji_replace.cpython-312.pyc,,
12
+ rich/__pycache__/_export_format.cpython-312.pyc,,
13
+ rich/__pycache__/_extension.cpython-312.pyc,,
14
+ rich/__pycache__/_fileno.cpython-312.pyc,,
15
+ rich/__pycache__/_inspect.cpython-312.pyc,,
16
+ rich/__pycache__/_log_render.cpython-312.pyc,,
17
+ rich/__pycache__/_loop.cpython-312.pyc,,
18
+ rich/__pycache__/_null_file.cpython-312.pyc,,
19
+ rich/__pycache__/_palettes.cpython-312.pyc,,
20
+ rich/__pycache__/_pick.cpython-312.pyc,,
21
+ rich/__pycache__/_ratio.cpython-312.pyc,,
22
+ rich/__pycache__/_spinners.cpython-312.pyc,,
23
+ rich/__pycache__/_stack.cpython-312.pyc,,
24
+ rich/__pycache__/_timer.cpython-312.pyc,,
25
+ rich/__pycache__/_win32_console.cpython-312.pyc,,
26
+ rich/__pycache__/_windows.cpython-312.pyc,,
27
+ rich/__pycache__/_windows_renderer.cpython-312.pyc,,
28
+ rich/__pycache__/_wrap.cpython-312.pyc,,
29
+ rich/__pycache__/abc.cpython-312.pyc,,
30
+ rich/__pycache__/align.cpython-312.pyc,,
31
+ rich/__pycache__/ansi.cpython-312.pyc,,
32
+ rich/__pycache__/bar.cpython-312.pyc,,
33
+ rich/__pycache__/box.cpython-312.pyc,,
34
+ rich/__pycache__/cells.cpython-312.pyc,,
35
+ rich/__pycache__/color.cpython-312.pyc,,
36
+ rich/__pycache__/color_triplet.cpython-312.pyc,,
37
+ rich/__pycache__/columns.cpython-312.pyc,,
38
+ rich/__pycache__/console.cpython-312.pyc,,
39
+ rich/__pycache__/constrain.cpython-312.pyc,,
40
+ rich/__pycache__/containers.cpython-312.pyc,,
41
+ rich/__pycache__/control.cpython-312.pyc,,
42
+ rich/__pycache__/default_styles.cpython-312.pyc,,
43
+ rich/__pycache__/diagnose.cpython-312.pyc,,
44
+ rich/__pycache__/emoji.cpython-312.pyc,,
45
+ rich/__pycache__/errors.cpython-312.pyc,,
46
+ rich/__pycache__/file_proxy.cpython-312.pyc,,
47
+ rich/__pycache__/filesize.cpython-312.pyc,,
48
+ rich/__pycache__/highlighter.cpython-312.pyc,,
49
+ rich/__pycache__/json.cpython-312.pyc,,
50
+ rich/__pycache__/jupyter.cpython-312.pyc,,
51
+ rich/__pycache__/layout.cpython-312.pyc,,
52
+ rich/__pycache__/live.cpython-312.pyc,,
53
+ rich/__pycache__/live_render.cpython-312.pyc,,
54
+ rich/__pycache__/logging.cpython-312.pyc,,
55
+ rich/__pycache__/markdown.cpython-312.pyc,,
56
+ rich/__pycache__/markup.cpython-312.pyc,,
57
+ rich/__pycache__/measure.cpython-312.pyc,,
58
+ rich/__pycache__/padding.cpython-312.pyc,,
59
+ rich/__pycache__/pager.cpython-312.pyc,,
60
+ rich/__pycache__/palette.cpython-312.pyc,,
61
+ rich/__pycache__/panel.cpython-312.pyc,,
62
+ rich/__pycache__/pretty.cpython-312.pyc,,
63
+ rich/__pycache__/progress.cpython-312.pyc,,
64
+ rich/__pycache__/progress_bar.cpython-312.pyc,,
65
+ rich/__pycache__/prompt.cpython-312.pyc,,
66
+ rich/__pycache__/protocol.cpython-312.pyc,,
67
+ rich/__pycache__/region.cpython-312.pyc,,
68
+ rich/__pycache__/repr.cpython-312.pyc,,
69
+ rich/__pycache__/rule.cpython-312.pyc,,
70
+ rich/__pycache__/scope.cpython-312.pyc,,
71
+ rich/__pycache__/screen.cpython-312.pyc,,
72
+ rich/__pycache__/segment.cpython-312.pyc,,
73
+ rich/__pycache__/spinner.cpython-312.pyc,,
74
+ rich/__pycache__/status.cpython-312.pyc,,
75
+ rich/__pycache__/style.cpython-312.pyc,,
76
+ rich/__pycache__/styled.cpython-312.pyc,,
77
+ rich/__pycache__/syntax.cpython-312.pyc,,
78
+ rich/__pycache__/table.cpython-312.pyc,,
79
+ rich/__pycache__/terminal_theme.cpython-312.pyc,,
80
+ rich/__pycache__/text.cpython-312.pyc,,
81
+ rich/__pycache__/theme.cpython-312.pyc,,
82
+ rich/__pycache__/themes.cpython-312.pyc,,
83
+ rich/__pycache__/traceback.cpython-312.pyc,,
84
+ rich/__pycache__/tree.cpython-312.pyc,,
85
+ rich/_emoji_codes.py,sha256=hu1VL9nbVdppJrVoijVshRlcRRe_v3dju3Mmd2sKZdY,140235
86
+ rich/_emoji_replace.py,sha256=n-kcetsEUx2ZUmhQrfeMNc-teeGhpuSQ5F8VPBsyvDo,1064
87
+ rich/_export_format.py,sha256=RI08pSrm5tBSzPMvnbTqbD9WIalaOoN5d4M1RTmLq1Y,2128
88
+ rich/_extension.py,sha256=G66PkbH_QdTJh6jD-J228O76CmAnr2hLQv72CgPPuzE,241
89
+ rich/_fileno.py,sha256=HWZxP5C2ajMbHryvAQZseflVfQoGzsKOHzKGsLD8ynQ,799
90
+ rich/_inspect.py,sha256=5pUYCqveN4ekb_mgHOYCipyZCrMGEJZYZs3y5QqmCf0,9894
91
+ rich/_log_render.py,sha256=xBKCxqiO4FZk8eG56f8crFdrmJxFrJsQE3V3F-fFekc,3213
92
+ rich/_loop.py,sha256=hV_6CLdoPm0va22Wpw4zKqM0RYsz3TZxXj0PoS-9eDQ,1236
93
+ rich/_null_file.py,sha256=ADGKp1yt-k70FMKV6tnqCqecB-rSJzp-WQsD7LPL-kg,1394
94
+ rich/_palettes.py,sha256=cdev1JQKZ0JvlguV9ipHgznTdnvlIzUFDBb0It2PzjI,7063
95
+ rich/_pick.py,sha256=evDt8QN4lF5CiwrUIXlOJCntitBCOsI3ZLPEIAVRLJU,423
96
+ rich/_ratio.py,sha256=IOtl78sQCYZsmHyxhe45krkb68u9xVz7zFsXVJD-b2Y,5325
97
+ rich/_spinners.py,sha256=U2r1_g_1zSjsjiUdAESc2iAMc3i4ri_S8PYP6kQ5z1I,19919
98
+ rich/_stack.py,sha256=-C8OK7rxn3sIUdVwxZBBpeHhIzX0eI-VM3MemYfaXm0,351
99
+ rich/_timer.py,sha256=zelxbT6oPFZnNrwWPpc1ktUeAT-Vc4fuFcRZLQGLtMI,417
100
+ rich/_unicode_data/__init__.py,sha256=40PhAFp3b88yPnRtTG6i9g5xj-5w98CET3C4Ip1LJAI,2631
101
+ rich/_unicode_data/__pycache__/__init__.cpython-312.pyc,,
102
+ rich/_unicode_data/__pycache__/_versions.cpython-312.pyc,,
103
+ rich/_unicode_data/__pycache__/unicode10-0-0.cpython-312.pyc,,
104
+ rich/_unicode_data/__pycache__/unicode11-0-0.cpython-312.pyc,,
105
+ rich/_unicode_data/__pycache__/unicode12-0-0.cpython-312.pyc,,
106
+ rich/_unicode_data/__pycache__/unicode12-1-0.cpython-312.pyc,,
107
+ rich/_unicode_data/__pycache__/unicode13-0-0.cpython-312.pyc,,
108
+ rich/_unicode_data/__pycache__/unicode14-0-0.cpython-312.pyc,,
109
+ rich/_unicode_data/__pycache__/unicode15-0-0.cpython-312.pyc,,
110
+ rich/_unicode_data/__pycache__/unicode15-1-0.cpython-312.pyc,,
111
+ rich/_unicode_data/__pycache__/unicode16-0-0.cpython-312.pyc,,
112
+ rich/_unicode_data/__pycache__/unicode17-0-0.cpython-312.pyc,,
113
+ rich/_unicode_data/__pycache__/unicode4-1-0.cpython-312.pyc,,
114
+ rich/_unicode_data/__pycache__/unicode5-0-0.cpython-312.pyc,,
115
+ rich/_unicode_data/__pycache__/unicode5-1-0.cpython-312.pyc,,
116
+ rich/_unicode_data/__pycache__/unicode5-2-0.cpython-312.pyc,,
117
+ rich/_unicode_data/__pycache__/unicode6-0-0.cpython-312.pyc,,
118
+ rich/_unicode_data/__pycache__/unicode6-1-0.cpython-312.pyc,,
119
+ rich/_unicode_data/__pycache__/unicode6-2-0.cpython-312.pyc,,
120
+ rich/_unicode_data/__pycache__/unicode6-3-0.cpython-312.pyc,,
121
+ rich/_unicode_data/__pycache__/unicode7-0-0.cpython-312.pyc,,
122
+ rich/_unicode_data/__pycache__/unicode8-0-0.cpython-312.pyc,,
123
+ rich/_unicode_data/__pycache__/unicode9-0-0.cpython-312.pyc,,
124
+ rich/_unicode_data/_versions.py,sha256=ftILR3G5dqmlQmCJYNovuyXfFneJY2eH2RvpV19tyYE,298
125
+ rich/_unicode_data/unicode10-0-0.py,sha256=FUstYPZwDF15BEuAERqXHqIPvC1KY1SL20qLj999Fzo,14496
126
+ rich/_unicode_data/unicode11-0-0.py,sha256=jp8SRKFBlIaHMafxAfhLiU7FizwdcgPVvytR3kSFtZo,14874
127
+ rich/_unicode_data/unicode12-0-0.py,sha256=0XHXSjW5EXue6Qfgl_u0bK7NstiSdmqrR_F_Wqhs5bE,15216
128
+ rich/_unicode_data/unicode12-1-0.py,sha256=kWcRGh1UVwsmK9qflfGsO_aM8AuNhLthJcsyXAOQryI,15189
129
+ rich/_unicode_data/unicode13-0-0.py,sha256=DokduALtgaB-WvapW7X7PmM3kZFbgnCo9ifINWZtuDs,15519
130
+ rich/_unicode_data/unicode14-0-0.py,sha256=Ni-3JnGf5sB4kGl8ip-Iyqoum-awJjZV0RoSNuo0yu8,15884
131
+ rich/_unicode_data/unicode15-0-0.py,sha256=DBHkV5Si9vmtv_MiW6NmPQb8yUeP4N-9hNt2juZr4ZE,16156
132
+ rich/_unicode_data/unicode15-1-0.py,sha256=uyCZLYrg0q7wGt3-uBdsF0Ay_x8MTMvFqK6aMOkl9rA,16129
133
+ rich/_unicode_data/unicode16-0-0.py,sha256=5iGpbczVQ7BD2QGYb6k1h_OdILQXXuhcvI6dQFLKbMc,16480
134
+ rich/_unicode_data/unicode17-0-0.py,sha256=NXbjFsAaTYdj6TYgk5Q9disv40LZHbedFGRl_48_9Y0,16704
135
+ rich/_unicode_data/unicode4-1-0.py,sha256=yIApQGEG7VOFYY2FFfvOdPprE6VpDusjLlTlCy4G_Rw,9488
136
+ rich/_unicode_data/unicode5-0-0.py,sha256=PkEI1x4RGwXSmgqHiu88jyz14VQT8bWiOtBDrECaVZg,9613
137
+ rich/_unicode_data/unicode5-1-0.py,sha256=C0-PWziqpkVkf3PkPz2GWNwidCrjef5AHQGBpqTPkuY,9650
138
+ rich/_unicode_data/unicode5-2-0.py,sha256=gM88qri3_9b0I37DGK1-ah-0SUed2VmvxUddB5UZLto,10390
139
+ rich/_unicode_data/unicode6-0-0.py,sha256=hhcAipqKU81dZ4YbDXIlT7KEK9yNG_Lx-5GLgNTF75g,10604
140
+ rich/_unicode_data/unicode6-1-0.py,sha256=PtUJYxwtU5S2A44YY_69Ka_wTkq-c7QCa-yibmkHvJs,10899
141
+ rich/_unicode_data/unicode6-2-0.py,sha256=TdTOctGwO-OYVGif1DoRJvsaQISHw5EXHPt58fjB55g,10899
142
+ rich/_unicode_data/unicode6-3-0.py,sha256=G9l8chu2MJTwZ_d_0tmH7PBg8KYYHaeuJCJNCHGHkDc,10924
143
+ rich/_unicode_data/unicode7-0-0.py,sha256=po9GGYW7ilGU9MwGE6fny-OofqbDwelQrnOIm-IusjI,11630
144
+ rich/_unicode_data/unicode8-0-0.py,sha256=4PjyI-w2Uj9xtanNlZm1d_2khcetMQlIefaoU2joGkY,11864
145
+ rich/_unicode_data/unicode9-0-0.py,sha256=A-pQjvkTICUGXEDOiWNMqa6z6vv1E__HJffzu7zLi9c,14148
146
+ rich/_win32_console.py,sha256=o2QN_IRx10biGP3Ap1neaqX8FBGlUKSmWM6Kw4OSg-U,22719
147
+ rich/_windows.py,sha256=is3WpbHMj8WaTHYB11hc6lP2t4hlvt4TViTlHSmjsi0,1901
148
+ rich/_windows_renderer.py,sha256=d799xOnxLbCCCzGu9-U7YLmIQkxtxQIBFQQ6iu4veSc,2759
149
+ rich/_wrap.py,sha256=FlSsom5EX0LVkA3KWy34yHnCfLtqX-ZIepXKh-70rpc,3404
150
+ rich/abc.py,sha256=dALMOGfKVNeAbvqq66IpTQxQUerxD7AE4FKwqd0eQKk,878
151
+ rich/align.py,sha256=a8MbP-iJjoOFonxqgoP3YketKMWU3WFZaxjqAv2Qc5E,10726
152
+ rich/ansi.py,sha256=Avs1LHbSdcyOvDOdpELZUoULcBiYewY76eNBp6uFBhs,6921
153
+ rich/bar.py,sha256=ldbVHOzKJOnflVNuv1xS7g6dLX2E3wMnXkdPbpzJTcs,3263
154
+ rich/box.py,sha256=SSolg8_pzHzY9QvJQo-qp0tbPsnj8O_2W4hmi1l-Zo0,10650
155
+ rich/cells.py,sha256=fPRSnquYlCO4THgmUokOJOhNlcx8C4NZ2Xv9JM_7GbE,12335
156
+ rich/color.py,sha256=3HSULVDj7qQkXUdFWv78JOiSZzfy5y1nkcYhna296V0,18211
157
+ rich/color_triplet.py,sha256=3lhQkdJbvWPoLDO-AnYImAWmJvV5dlgYNCVZ97ORaN4,1054
158
+ rich/columns.py,sha256=HUX0KcMm9dsKNi11fTbiM_h2iDtl8ySCaVcxlalEzq8,7131
159
+ rich/console.py,sha256=doKNi4BLSKZCt6Ra-6AXiQK-FaWAL-7fClG2ZO5w7uQ,101009
160
+ rich/constrain.py,sha256=1VIPuC8AgtKWrcncQrjBdYqA3JVWysu6jZo1rrh7c7Q,1288
161
+ rich/containers.py,sha256=c_56TxcedGYqDepHBMTuZdUIijitAQgnox-Qde0Z1qo,5502
162
+ rich/control.py,sha256=HnsraFTzBaUQDzKJWXsfPv-PPmgGypSgSv7oANackqs,6475
163
+ rich/default_styles.py,sha256=Tk1pZ9bOZ40EVX7cfBbYDEo7hrpwBvZGsiUCXdh0P0M,8340
164
+ rich/diagnose.py,sha256=1RWnQoppPXjC_49AB4vtV048DK3ksQSq671C83Y6f-g,977
165
+ rich/emoji.py,sha256=_bTf1Y3JqiMk6Nfn4V_YOhq1wAPAHNODhGLJj95R3uI,2343
166
+ rich/errors.py,sha256=5pP3Kc5d4QJ_c0KFsxrfyhjiPVe7J1zOqSFbFAzcV-Y,642
167
+ rich/file_proxy.py,sha256=Tl9THMDZ-Pk5Wm8sI1gGg_U5DhusmxD-FZ0fUbcU0W0,1683
168
+ rich/filesize.py,sha256=_iz9lIpRgvW7MNSeCZnLg-HwzbP4GETg543WqD8SFs0,2484
169
+ rich/highlighter.py,sha256=MIapWwjR8ahUcsDicgN4xLRbanbh5x_Qzh5kfdDrKKk,9729
170
+ rich/json.py,sha256=omC2WHTgURxEosna1ftoSJCne2EX7MDuQtCdswS3qsk,5019
171
+ rich/jupyter.py,sha256=G9pOJmR4ESIFYSd4MKGqmHqCtstx0oRWpyeTgv54-Xc,3228
172
+ rich/layout.py,sha256=WR8PCSroYnteIT3zawxQ3k3ad1sQO5wGG1SZOoeBuBM,13944
173
+ rich/live.py,sha256=UKvqLSuSzNHIBz5pxRrU7SPsnG48vJJx2TMHiaHlmnI,15317
174
+ rich/live_render.py,sha256=jQO3X_p2wemGI2bdCAY_e5j9xXNTwDxuujbpoSRsH6c,3803
175
+ rich/logging.py,sha256=UL6TZNlaptYKHNhQ45LREy-29Pl-tQsBh7q3HSnWIAA,12456
176
+ rich/markdown.py,sha256=mDDJmUbWRYm7_vKenVq76K6aG43KTJJ4tiYMzxXO7ns,26177
177
+ rich/markup.py,sha256=btpr271BLhiCR1jNglRnv2BpIzVcNefYwSMeW9teDbc,8427
178
+ rich/measure.py,sha256=HmrIJX8sWRTHbgh8MxEay_83VkqNW_70s8aKP5ZcYI8,5305
179
+ rich/padding.py,sha256=h8XnIivLrNtlxI3vQPKHXh4hAwjOJqZx0slM0z3g1_M,4896
180
+ rich/pager.py,sha256=SO_ETBFKbg3n_AgOzXm41Sv36YxXAyI3_R-KOY2_uSc,828
181
+ rich/palette.py,sha256=Ar6ZUrYHiFt6-Rr2k-k9F8V7hxgJYHNdqjk2vVXsLgc,3288
182
+ rich/panel.py,sha256=9sQl00hPIqH5G2gALQo4NepFwpP0k9wT-s_gOms5pIc,11157
183
+ rich/pretty.py,sha256=lxW_bhBfDTKe-grtzP1KQhQsqPZxfZN14th4JRVoLzQ,36349
184
+ rich/progress.py,sha256=Z6Yz6pYO26LFXx24cXKvk2bEX6FkjK2Z5e2fy0Bt78s,60393
185
+ rich/progress_bar.py,sha256=mZTPpJUwcfcdgQCTTz3kyY-fc79ddLwtx6Ghhxfo064,8162
186
+ rich/prompt.py,sha256=1SIuBEelovvwCG2wp22PZwskA3IkmAsOxf0ruFkOhOk,12448
187
+ rich/protocol.py,sha256=Wt-2HZd67OYiopUkCTOz7lM38vyo5r3HEQZ9TOPDl5Q,1367
188
+ rich/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
189
+ rich/region.py,sha256=rNT9xZrVZTYIXZC0NYn41CJQwYNbR-KecPOxTgQvB8Y,166
190
+ rich/repr.py,sha256=HIsurPLZK9Gray75l3_vQx7S27AzTpAj4ChXSfe1Fes,4419
191
+ rich/rule.py,sha256=umO21Wjw0FcYAeTB3UumNLCsDWhejzxnjlf2VwiXiDI,4590
192
+ rich/scope.py,sha256=x-jkKIE-j7ZxA9I07lya5iVAuDAyUKM58HWtNZQUzRc,3239
193
+ rich/screen.py,sha256=rL_j2wX-4SeuIOI2oOlc418QP9EAvD59GInUmEAE6jQ,1579
194
+ rich/segment.py,sha256=aUh9qRteTyo6guePUn8cU7S1ccXRsfzLZ-VMDXXeNug,25795
195
+ rich/spinner.py,sha256=onIhpKlljRHppTZasxO8kXgtYyCHUkpSgKglRJ3o51g,4214
196
+ rich/status.py,sha256=kkPph3YeAZBo-X-4wPp8gTqZyU466NLwZBA4PZTTewo,4424
197
+ rich/style.py,sha256=W9Ccy8Py8lNICtlfcp-ryzMTuQaGxAU3av7-g5fHu0s,26990
198
+ rich/styled.py,sha256=wljVsVTXbABMMZvkzkO43ZEk_-irzEtvUiQ-sNnikQ8,1234
199
+ rich/syntax.py,sha256=5ZBNxjIj3C1FC92vLwBVN-C5YAdKjPHfH6SqCzFaOYE,36263
200
+ rich/table.py,sha256=6yv7wMLXZgOsGgzEDpKXpecXQOwcLBHNOn-MYcbo1Zk,40033
201
+ rich/terminal_theme.py,sha256=1j5-ufJfnvlAo5Qsi_ACZiXDmwMXzqgmFByObT9-yJY,3370
202
+ rich/text.py,sha256=t2J8iMquwR0BUUggm-cVNp30Wxw5M8fIF_p0jioYRV0,47655
203
+ rich/theme.py,sha256=oNyhXhGagtDlbDye3tVu3esWOWk0vNkuxFw-_unlaK0,3771
204
+ rich/themes.py,sha256=0xgTLozfabebYtcJtDdC5QkX5IVUEaviqDUJJh4YVFk,102
205
+ rich/traceback.py,sha256=TT03eLKEj5XapXFp9kgf0bBwNupIFrHquKxZtwBhz_8,37535
206
+ rich/tree.py,sha256=QoOwg424FkdwGfR8K0tZ6Q7qtzWNAUP_m4sFaYuG6nw,9391
TTS/Kokoro/.venv/Lib/site-packages/rich-14.3.3.dist-info/WHEEL ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ Wheel-Version: 1.0
2
+ Generator: poetry-core 2.3.1
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
TTS/Kokoro/.venv/Lib/site-packages/rich/__init__.py ADDED
@@ -0,0 +1,177 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Rich text and beautiful formatting in the terminal."""
2
+
3
+ import os
4
+ from typing import IO, TYPE_CHECKING, Any, Callable, Optional, Union
5
+
6
+ from ._extension import load_ipython_extension # noqa: F401
7
+
8
+ __all__ = ["get_console", "reconfigure", "print", "inspect", "print_json"]
9
+
10
+ if TYPE_CHECKING:
11
+ from .console import Console
12
+
13
+ # Global console used by alternative print
14
+ _console: Optional["Console"] = None
15
+
16
+ try:
17
+ _IMPORT_CWD = os.path.abspath(os.getcwd())
18
+ except FileNotFoundError:
19
+ # Can happen if the cwd has been deleted
20
+ _IMPORT_CWD = ""
21
+
22
+
23
+ def get_console() -> "Console":
24
+ """Get a global :class:`~rich.console.Console` instance. This function is used when Rich requires a Console,
25
+ and hasn't been explicitly given one.
26
+
27
+ Returns:
28
+ Console: A console instance.
29
+ """
30
+ global _console
31
+ if _console is None:
32
+ from .console import Console
33
+
34
+ _console = Console()
35
+
36
+ return _console
37
+
38
+
39
+ def reconfigure(*args: Any, **kwargs: Any) -> None:
40
+ """Reconfigures the global console by replacing it with another.
41
+
42
+ Args:
43
+ *args (Any): Positional arguments for the replacement :class:`~rich.console.Console`.
44
+ **kwargs (Any): Keyword arguments for the replacement :class:`~rich.console.Console`.
45
+ """
46
+ from rich.console import Console
47
+
48
+ new_console = Console(*args, **kwargs)
49
+ _console = get_console()
50
+ _console.__dict__ = new_console.__dict__
51
+
52
+
53
+ def print(
54
+ *objects: Any,
55
+ sep: str = " ",
56
+ end: str = "\n",
57
+ file: Optional[IO[str]] = None,
58
+ flush: bool = False,
59
+ ) -> None:
60
+ r"""Print object(s) supplied via positional arguments.
61
+ This function has an identical signature to the built-in print.
62
+ For more advanced features, see the :class:`~rich.console.Console` class.
63
+
64
+ Args:
65
+ sep (str, optional): Separator between printed objects. Defaults to " ".
66
+ end (str, optional): Character to write at end of output. Defaults to "\\n".
67
+ file (IO[str], optional): File to write to, or None for stdout. Defaults to None.
68
+ flush (bool, optional): Has no effect as Rich always flushes output. Defaults to False.
69
+
70
+ """
71
+ from .console import Console
72
+
73
+ write_console = get_console() if file is None else Console(file=file)
74
+ return write_console.print(*objects, sep=sep, end=end)
75
+
76
+
77
+ def print_json(
78
+ json: Optional[str] = None,
79
+ *,
80
+ data: Any = None,
81
+ indent: Union[None, int, str] = 2,
82
+ highlight: bool = True,
83
+ skip_keys: bool = False,
84
+ ensure_ascii: bool = False,
85
+ check_circular: bool = True,
86
+ allow_nan: bool = True,
87
+ default: Optional[Callable[[Any], Any]] = None,
88
+ sort_keys: bool = False,
89
+ ) -> None:
90
+ """Pretty prints JSON. Output will be valid JSON.
91
+
92
+ Args:
93
+ json (str): A string containing JSON.
94
+ data (Any): If json is not supplied, then encode this data.
95
+ indent (int, optional): Number of spaces to indent. Defaults to 2.
96
+ highlight (bool, optional): Enable highlighting of output: Defaults to True.
97
+ skip_keys (bool, optional): Skip keys not of a basic type. Defaults to False.
98
+ ensure_ascii (bool, optional): Escape all non-ascii characters. Defaults to False.
99
+ check_circular (bool, optional): Check for circular references. Defaults to True.
100
+ allow_nan (bool, optional): Allow NaN and Infinity values. Defaults to True.
101
+ default (Callable, optional): A callable that converts values that can not be encoded
102
+ in to something that can be JSON encoded. Defaults to None.
103
+ sort_keys (bool, optional): Sort dictionary keys. Defaults to False.
104
+ """
105
+
106
+ get_console().print_json(
107
+ json,
108
+ data=data,
109
+ indent=indent,
110
+ highlight=highlight,
111
+ skip_keys=skip_keys,
112
+ ensure_ascii=ensure_ascii,
113
+ check_circular=check_circular,
114
+ allow_nan=allow_nan,
115
+ default=default,
116
+ sort_keys=sort_keys,
117
+ )
118
+
119
+
120
+ def inspect(
121
+ obj: Any,
122
+ *,
123
+ console: Optional["Console"] = None,
124
+ title: Optional[str] = None,
125
+ help: bool = False,
126
+ methods: bool = False,
127
+ docs: bool = True,
128
+ private: bool = False,
129
+ dunder: bool = False,
130
+ sort: bool = True,
131
+ all: bool = False,
132
+ value: bool = True,
133
+ ) -> None:
134
+ """Inspect any Python object.
135
+
136
+ * inspect(<OBJECT>) to see summarized info.
137
+ * inspect(<OBJECT>, methods=True) to see methods.
138
+ * inspect(<OBJECT>, help=True) to see full (non-abbreviated) help.
139
+ * inspect(<OBJECT>, private=True) to see private attributes (single underscore).
140
+ * inspect(<OBJECT>, dunder=True) to see attributes beginning with double underscore.
141
+ * inspect(<OBJECT>, all=True) to see all attributes.
142
+
143
+ Args:
144
+ obj (Any): An object to inspect.
145
+ title (str, optional): Title to display over inspect result, or None use type. Defaults to None.
146
+ help (bool, optional): Show full help text rather than just first paragraph. Defaults to False.
147
+ methods (bool, optional): Enable inspection of callables. Defaults to False.
148
+ docs (bool, optional): Also render doc strings. Defaults to True.
149
+ private (bool, optional): Show private attributes (beginning with underscore). Defaults to False.
150
+ dunder (bool, optional): Show attributes starting with double underscore. Defaults to False.
151
+ sort (bool, optional): Sort attributes alphabetically, callables at the top, leading and trailing underscores ignored. Defaults to True.
152
+ all (bool, optional): Show all attributes. Defaults to False.
153
+ value (bool, optional): Pretty print value. Defaults to True.
154
+ """
155
+ _console = console or get_console()
156
+ from rich._inspect import Inspect
157
+
158
+ # Special case for inspect(inspect)
159
+ is_inspect = obj is inspect
160
+
161
+ _inspect = Inspect(
162
+ obj,
163
+ title=title,
164
+ help=is_inspect or help,
165
+ methods=is_inspect or methods,
166
+ docs=is_inspect or docs,
167
+ private=private,
168
+ dunder=dunder,
169
+ sort=sort,
170
+ all=all,
171
+ value=value,
172
+ )
173
+ _console.print(_inspect)
174
+
175
+
176
+ if __name__ == "__main__": # pragma: no cover
177
+ print("Hello, **World**")
TTS/Kokoro/.venv/Lib/site-packages/rich/__main__.py ADDED
@@ -0,0 +1,245 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import colorsys
2
+ import io
3
+ from time import process_time
4
+
5
+ from rich import box
6
+ from rich.color import Color
7
+ from rich.console import Console, ConsoleOptions, Group, RenderableType, RenderResult
8
+ from rich.markdown import Markdown
9
+ from rich.measure import Measurement
10
+ from rich.pretty import Pretty
11
+ from rich.segment import Segment
12
+ from rich.style import Style
13
+ from rich.syntax import Syntax
14
+ from rich.table import Table
15
+ from rich.text import Text
16
+
17
+
18
+ class ColorBox:
19
+ def __rich_console__(
20
+ self, console: Console, options: ConsoleOptions
21
+ ) -> RenderResult:
22
+ for y in range(0, 5):
23
+ for x in range(options.max_width):
24
+ h = x / options.max_width
25
+ l = 0.1 + ((y / 5) * 0.7)
26
+ r1, g1, b1 = colorsys.hls_to_rgb(h, l, 1.0)
27
+ r2, g2, b2 = colorsys.hls_to_rgb(h, l + 0.7 / 10, 1.0)
28
+ bgcolor = Color.from_rgb(r1 * 255, g1 * 255, b1 * 255)
29
+ color = Color.from_rgb(r2 * 255, g2 * 255, b2 * 255)
30
+ yield Segment("▄", Style(color=color, bgcolor=bgcolor))
31
+ yield Segment.line()
32
+
33
+ def __rich_measure__(
34
+ self, console: "Console", options: ConsoleOptions
35
+ ) -> Measurement:
36
+ return Measurement(1, options.max_width)
37
+
38
+
39
+ def make_test_card() -> Table:
40
+ """Get a renderable that demonstrates a number of features."""
41
+ table = Table.grid(padding=1, pad_edge=True)
42
+ table.title = "Rich features"
43
+ table.add_column("Feature", no_wrap=True, justify="center", style="bold red")
44
+ table.add_column("Demonstration")
45
+
46
+ color_table = Table(
47
+ box=None,
48
+ expand=False,
49
+ show_header=False,
50
+ show_edge=False,
51
+ pad_edge=False,
52
+ )
53
+ color_table.add_row(
54
+ (
55
+ "✓ [bold green]4-bit color[/]\n"
56
+ "✓ [bold blue]8-bit color[/]\n"
57
+ "✓ [bold magenta]Truecolor (16.7 million)[/]\n"
58
+ "✓ [bold yellow]Dumb terminals[/]\n"
59
+ "✓ [bold cyan]Automatic color conversion"
60
+ ),
61
+ ColorBox(),
62
+ )
63
+
64
+ table.add_row("Colors", color_table)
65
+
66
+ table.add_row(
67
+ "Styles",
68
+ "All ansi styles: [bold]bold[/], [dim]dim[/], [italic]italic[/italic], [underline]underline[/], [strike]strikethrough[/], [reverse]reverse[/], and even [blink]blink[/].",
69
+ )
70
+
71
+ lorem = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque in metus sed sapien ultricies pretium a at justo. Maecenas luctus velit et auctor maximus."
72
+ lorem_table = Table.grid(padding=1, collapse_padding=True)
73
+ lorem_table.pad_edge = False
74
+ lorem_table.add_row(
75
+ Text(lorem, justify="left", style="green"),
76
+ Text(lorem, justify="center", style="yellow"),
77
+ Text(lorem, justify="right", style="blue"),
78
+ Text(lorem, justify="full", style="red"),
79
+ )
80
+ table.add_row(
81
+ "Text",
82
+ Group(
83
+ Text.from_markup(
84
+ """Word wrap text. Justify [green]left[/], [yellow]center[/], [blue]right[/] or [red]full[/].\n"""
85
+ ),
86
+ lorem_table,
87
+ ),
88
+ )
89
+
90
+ def comparison(renderable1: RenderableType, renderable2: RenderableType) -> Table:
91
+ table = Table(show_header=False, pad_edge=False, box=None, expand=True)
92
+ table.add_column("1", ratio=1)
93
+ table.add_column("2", ratio=1)
94
+ table.add_row(renderable1, renderable2)
95
+ return table
96
+
97
+ table.add_row(
98
+ "Asian\nlanguage\nsupport",
99
+ ":flag_for_china: 该库支持中文,日文和韩文文本!\n:flag_for_japan: ライブラリは中国語、日本語、韓国語のテキストをサポートしています\n:flag_for_south_korea: 이 라이브러리는 중국어, 일본어 및 한국어 텍스트를 지원합니다",
100
+ )
101
+
102
+ markup_example = (
103
+ "[bold magenta]Rich[/] supports a simple [i]bbcode[/i]-like [b]markup[/b] for [yellow]color[/], [underline]style[/], and emoji! "
104
+ ":+1: :apple: :ant: :bear: :baguette_bread: :bus: "
105
+ )
106
+ table.add_row("Markup", markup_example)
107
+
108
+ example_table = Table(
109
+ show_edge=False,
110
+ show_header=True,
111
+ expand=False,
112
+ row_styles=["none", "dim"],
113
+ box=box.SIMPLE,
114
+ )
115
+ example_table.add_column("[green]Date", style="green", no_wrap=True)
116
+ example_table.add_column("[blue]Title", style="blue")
117
+ example_table.add_column(
118
+ "[cyan]Production Budget",
119
+ style="cyan",
120
+ justify="right",
121
+ no_wrap=True,
122
+ )
123
+ example_table.add_column(
124
+ "[magenta]Box Office",
125
+ style="magenta",
126
+ justify="right",
127
+ no_wrap=True,
128
+ )
129
+ example_table.add_row(
130
+ "Dec 20, 2019",
131
+ "Star Wars: The Rise of Skywalker",
132
+ "$275,000,000",
133
+ "$375,126,118",
134
+ )
135
+ example_table.add_row(
136
+ "May 25, 2018",
137
+ "[b]Solo[/]: A Star Wars Story",
138
+ "$275,000,000",
139
+ "$393,151,347",
140
+ )
141
+ example_table.add_row(
142
+ "Dec 15, 2017",
143
+ "Star Wars Ep. VIII: The Last Jedi",
144
+ "$262,000,000",
145
+ "[bold]$1,332,539,889[/bold]",
146
+ )
147
+ example_table.add_row(
148
+ "May 19, 1999",
149
+ "Star Wars Ep. [b]I[/b]: [i]The phantom Menace",
150
+ "$115,000,000",
151
+ "$1,027,044,677",
152
+ )
153
+
154
+ table.add_row("Tables", example_table)
155
+
156
+ code = '''\
157
+ def iter_last(values: Iterable[T]) -> Iterable[Tuple[bool, T]]:
158
+ """Iterate and generate a tuple with a flag for last value."""
159
+ iter_values = iter(values)
160
+ try:
161
+ previous_value = next(iter_values)
162
+ except StopIteration:
163
+ return
164
+ for value in iter_values:
165
+ yield False, previous_value
166
+ previous_value = value
167
+ yield True, previous_value'''
168
+
169
+ pretty_data = {
170
+ "foo": [
171
+ 3.1427,
172
+ (
173
+ "Paul Atreides",
174
+ "Vladimir Harkonnen",
175
+ "Thufir Hawat",
176
+ ),
177
+ ],
178
+ "atomic": (False, True, None),
179
+ }
180
+ table.add_row(
181
+ "Syntax\nhighlighting\n&\npretty\nprinting",
182
+ comparison(
183
+ Syntax(code, "python3", line_numbers=True, indent_guides=True),
184
+ Pretty(pretty_data, indent_guides=True),
185
+ ),
186
+ )
187
+
188
+ markdown_example = """\
189
+ # Markdown
190
+
191
+ Supports much of the *markdown* __syntax__!
192
+
193
+ - Headers
194
+ - Basic formatting: **bold**, *italic*, `code`
195
+ - Block quotes
196
+ - Lists, and more...
197
+ """
198
+ table.add_row(
199
+ "Markdown", comparison("[cyan]" + markdown_example, Markdown(markdown_example))
200
+ )
201
+
202
+ table.add_row(
203
+ "+more!",
204
+ """Progress bars, columns, styled logging handler, tracebacks, etc...""",
205
+ )
206
+ return table
207
+
208
+
209
+ if __name__ == "__main__": # pragma: no cover
210
+ from rich.panel import Panel
211
+
212
+ console = Console(
213
+ file=io.StringIO(),
214
+ force_terminal=True,
215
+ )
216
+ test_card = make_test_card()
217
+
218
+ # Print once to warm cache
219
+ start = process_time()
220
+ console.print(test_card)
221
+ pre_cache_taken = round((process_time() - start) * 1000.0, 1)
222
+
223
+ console.file = io.StringIO()
224
+
225
+ start = process_time()
226
+ console.print(test_card)
227
+ taken = round((process_time() - start) * 1000.0, 1)
228
+
229
+ c = Console(record=True)
230
+ c.print(test_card)
231
+
232
+ console = Console()
233
+ console.print(f"[dim]rendered in [not dim]{pre_cache_taken}ms[/] (cold cache)")
234
+ console.print(f"[dim]rendered in [not dim]{taken}ms[/] (warm cache)")
235
+ console.print()
236
+ console.print(
237
+ Panel(
238
+ "[b magenta]Hope you enjoy using Rich![/]\n\n"
239
+ "Consider sponsoring to ensure this project is maintained.\n\n"
240
+ "[cyan]https://github.com/sponsors/willmcgugan[/cyan]",
241
+ border_style="green",
242
+ title="Help ensure Rich is maintained",
243
+ padding=(1, 2),
244
+ )
245
+ )
TTS/Kokoro/.venv/Lib/site-packages/rich/_inspect.py ADDED
@@ -0,0 +1,272 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import inspect
2
+ from inspect import cleandoc, getdoc, getfile, isclass, ismodule, signature
3
+ from typing import Any, Collection, Iterable, Optional, Tuple, Type, Union
4
+
5
+ from .console import Group, RenderableType
6
+ from .control import escape_control_codes
7
+ from .highlighter import ReprHighlighter
8
+ from .jupyter import JupyterMixin
9
+ from .panel import Panel
10
+ from .pretty import Pretty
11
+ from .table import Table
12
+ from .text import Text, TextType
13
+
14
+
15
+ def _first_paragraph(doc: str) -> str:
16
+ """Get the first paragraph from a docstring."""
17
+ paragraph, _, _ = doc.partition("\n\n")
18
+ return paragraph
19
+
20
+
21
+ class Inspect(JupyterMixin):
22
+ """A renderable to inspect any Python Object.
23
+
24
+ Args:
25
+ obj (Any): An object to inspect.
26
+ title (str, optional): Title to display over inspect result, or None use type. Defaults to None.
27
+ help (bool, optional): Show full help text rather than just first paragraph. Defaults to False.
28
+ methods (bool, optional): Enable inspection of callables. Defaults to False.
29
+ docs (bool, optional): Also render doc strings. Defaults to True.
30
+ private (bool, optional): Show private attributes (beginning with underscore). Defaults to False.
31
+ dunder (bool, optional): Show attributes starting with double underscore. Defaults to False.
32
+ sort (bool, optional): Sort attributes alphabetically, callables at the top, leading and trailing underscores ignored. Defaults to True.
33
+ all (bool, optional): Show all attributes. Defaults to False.
34
+ value (bool, optional): Pretty print value of object. Defaults to True.
35
+ """
36
+
37
+ def __init__(
38
+ self,
39
+ obj: Any,
40
+ *,
41
+ title: Optional[TextType] = None,
42
+ help: bool = False,
43
+ methods: bool = False,
44
+ docs: bool = True,
45
+ private: bool = False,
46
+ dunder: bool = False,
47
+ sort: bool = True,
48
+ all: bool = True,
49
+ value: bool = True,
50
+ ) -> None:
51
+ self.highlighter = ReprHighlighter()
52
+ self.obj = obj
53
+ self.title = title or self._make_title(obj)
54
+ if all:
55
+ methods = private = dunder = True
56
+ self.help = help
57
+ self.methods = methods
58
+ self.docs = docs or help
59
+ self.private = private or dunder
60
+ self.dunder = dunder
61
+ self.sort = sort
62
+ self.value = value
63
+
64
+ def _make_title(self, obj: Any) -> Text:
65
+ """Make a default title."""
66
+ title_str = (
67
+ str(obj)
68
+ if (isclass(obj) or callable(obj) or ismodule(obj))
69
+ else str(type(obj))
70
+ )
71
+ title_text = self.highlighter(title_str)
72
+ return title_text
73
+
74
+ def __rich__(self) -> Panel:
75
+ return Panel.fit(
76
+ Group(*self._render()),
77
+ title=self.title,
78
+ border_style="scope.border",
79
+ padding=(0, 1),
80
+ )
81
+
82
+ def _get_signature(self, name: str, obj: Any) -> Optional[Text]:
83
+ """Get a signature for a callable."""
84
+ try:
85
+ _signature = str(signature(obj)) + ":"
86
+ except ValueError:
87
+ _signature = "(...)"
88
+ except TypeError:
89
+ return None
90
+
91
+ source_filename: Optional[str] = None
92
+ try:
93
+ source_filename = getfile(obj)
94
+ except (OSError, TypeError):
95
+ # OSError is raised if obj has no source file, e.g. when defined in REPL.
96
+ pass
97
+
98
+ callable_name = Text(name, style="inspect.callable")
99
+ if source_filename:
100
+ callable_name.stylize(f"link file://{source_filename}")
101
+ signature_text = self.highlighter(_signature)
102
+
103
+ qualname = name or getattr(obj, "__qualname__", name)
104
+ if not isinstance(qualname, str):
105
+ qualname = getattr(obj, "__name__", name)
106
+ if not isinstance(qualname, str):
107
+ qualname = name
108
+
109
+ # If obj is a module, there may be classes (which are callable) to display
110
+ if inspect.isclass(obj):
111
+ prefix = "class"
112
+ elif inspect.iscoroutinefunction(obj):
113
+ prefix = "async def"
114
+ else:
115
+ prefix = "def"
116
+
117
+ qual_signature = Text.assemble(
118
+ (f"{prefix} ", f"inspect.{prefix.replace(' ', '_')}"),
119
+ (qualname, "inspect.callable"),
120
+ signature_text,
121
+ )
122
+
123
+ return qual_signature
124
+
125
+ def _render(self) -> Iterable[RenderableType]:
126
+ """Render object."""
127
+
128
+ def sort_items(item: Tuple[str, Any]) -> Tuple[bool, str]:
129
+ key, (_error, value) = item
130
+ return (callable(value), key.strip("_").lower())
131
+
132
+ def safe_getattr(attr_name: str) -> Tuple[Any, Any]:
133
+ """Get attribute or any exception."""
134
+ try:
135
+ return (None, getattr(obj, attr_name))
136
+ except Exception as error:
137
+ return (error, None)
138
+
139
+ obj = self.obj
140
+ keys = dir(obj)
141
+ total_items = len(keys)
142
+ if not self.dunder:
143
+ keys = [key for key in keys if not key.startswith("__")]
144
+ if not self.private:
145
+ keys = [key for key in keys if not key.startswith("_")]
146
+ not_shown_count = total_items - len(keys)
147
+ items = [(key, safe_getattr(key)) for key in keys]
148
+ if self.sort:
149
+ items.sort(key=sort_items)
150
+
151
+ items_table = Table.grid(padding=(0, 1), expand=False)
152
+ items_table.add_column(justify="right")
153
+ add_row = items_table.add_row
154
+ highlighter = self.highlighter
155
+
156
+ if callable(obj):
157
+ signature = self._get_signature("", obj)
158
+ if signature is not None:
159
+ yield signature
160
+ yield ""
161
+
162
+ if self.docs:
163
+ _doc = self._get_formatted_doc(obj)
164
+ if _doc is not None:
165
+ doc_text = Text(_doc, style="inspect.help")
166
+ doc_text = highlighter(doc_text)
167
+ yield doc_text
168
+ yield ""
169
+
170
+ if self.value and not (isclass(obj) or callable(obj) or ismodule(obj)):
171
+ yield Panel(
172
+ Pretty(obj, indent_guides=True, max_length=10, max_string=60),
173
+ border_style="inspect.value.border",
174
+ )
175
+ yield ""
176
+
177
+ for key, (error, value) in items:
178
+ key_text = Text.assemble(
179
+ (
180
+ key,
181
+ "inspect.attr.dunder" if key.startswith("__") else "inspect.attr",
182
+ ),
183
+ (" =", "inspect.equals"),
184
+ )
185
+ if error is not None:
186
+ warning = key_text.copy()
187
+ warning.stylize("inspect.error")
188
+ add_row(warning, highlighter(repr(error)))
189
+ continue
190
+
191
+ if callable(value):
192
+ if not self.methods:
193
+ continue
194
+
195
+ _signature_text = self._get_signature(key, value)
196
+ if _signature_text is None:
197
+ add_row(key_text, Pretty(value, highlighter=highlighter))
198
+ else:
199
+ if self.docs:
200
+ docs = self._get_formatted_doc(value)
201
+ if docs is not None:
202
+ _signature_text.append("\n" if "\n" in docs else " ")
203
+ doc = highlighter(docs)
204
+ doc.stylize("inspect.doc")
205
+ _signature_text.append(doc)
206
+
207
+ add_row(key_text, _signature_text)
208
+ else:
209
+ add_row(key_text, Pretty(value, highlighter=highlighter))
210
+ if items_table.row_count:
211
+ yield items_table
212
+ elif not_shown_count:
213
+ yield Text.from_markup(
214
+ f"[b cyan]{not_shown_count}[/][i] attribute(s) not shown.[/i] "
215
+ f"Run [b][magenta]inspect[/]([not b]inspect[/])[/b] for options."
216
+ )
217
+
218
+ def _get_formatted_doc(self, object_: Any) -> Optional[str]:
219
+ """
220
+ Extract the docstring of an object, process it and returns it.
221
+ The processing consists in cleaning up the docstring's indentation,
222
+ taking only its 1st paragraph if `self.help` is not True,
223
+ and escape its control codes.
224
+
225
+ Args:
226
+ object_ (Any): the object to get the docstring from.
227
+
228
+ Returns:
229
+ Optional[str]: the processed docstring, or None if no docstring was found.
230
+ """
231
+ docs = getdoc(object_)
232
+ if docs is None:
233
+ return None
234
+ docs = cleandoc(docs).strip()
235
+ if not self.help:
236
+ docs = _first_paragraph(docs)
237
+ return escape_control_codes(docs)
238
+
239
+
240
+ def get_object_types_mro(obj: Union[object, Type[Any]]) -> Tuple[type, ...]:
241
+ """Returns the MRO of an object's class, or of the object itself if it's a class."""
242
+ if not hasattr(obj, "__mro__"):
243
+ # N.B. we cannot use `if type(obj) is type` here because it doesn't work with
244
+ # some types of classes, such as the ones that use abc.ABCMeta.
245
+ obj = type(obj)
246
+ return getattr(obj, "__mro__", ())
247
+
248
+
249
+ def get_object_types_mro_as_strings(obj: object) -> Collection[str]:
250
+ """
251
+ Returns the MRO of an object's class as full qualified names, or of the object itself if it's a class.
252
+
253
+ Examples:
254
+ `object_types_mro_as_strings(JSONDecoder)` will return `['json.decoder.JSONDecoder', 'builtins.object']`
255
+ """
256
+ return [
257
+ f'{getattr(type_, "__module__", "")}.{getattr(type_, "__qualname__", "")}'
258
+ for type_ in get_object_types_mro(obj)
259
+ ]
260
+
261
+
262
+ def is_object_one_of_types(
263
+ obj: object, fully_qualified_types_names: Collection[str]
264
+ ) -> bool:
265
+ """
266
+ Returns `True` if the given object's class (or the object itself, if it's a class) has one of the
267
+ fully qualified names in its MRO.
268
+ """
269
+ for type_name in get_object_types_mro_as_strings(obj):
270
+ if type_name in fully_qualified_types_names:
271
+ return True
272
+ return False
TTS/Kokoro/.venv/Lib/site-packages/rich/_loop.py ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import Iterable, Tuple, TypeVar
2
+
3
+ T = TypeVar("T")
4
+
5
+
6
+ def loop_first(values: Iterable[T]) -> Iterable[Tuple[bool, T]]:
7
+ """Iterate and generate a tuple with a flag for first value."""
8
+ iter_values = iter(values)
9
+ try:
10
+ value = next(iter_values)
11
+ except StopIteration:
12
+ return
13
+ yield True, value
14
+ for value in iter_values:
15
+ yield False, value
16
+
17
+
18
+ def loop_last(values: Iterable[T]) -> Iterable[Tuple[bool, T]]:
19
+ """Iterate and generate a tuple with a flag for last value."""
20
+ iter_values = iter(values)
21
+ try:
22
+ previous_value = next(iter_values)
23
+ except StopIteration:
24
+ return
25
+ for value in iter_values:
26
+ yield False, previous_value
27
+ previous_value = value
28
+ yield True, previous_value
29
+
30
+
31
+ def loop_first_last(values: Iterable[T]) -> Iterable[Tuple[bool, bool, T]]:
32
+ """Iterate and generate a tuple with a flag for first and last value."""
33
+ iter_values = iter(values)
34
+ try:
35
+ previous_value = next(iter_values)
36
+ except StopIteration:
37
+ return
38
+ first = True
39
+ for value in iter_values:
40
+ yield first, False, previous_value
41
+ first = False
42
+ previous_value = value
43
+ yield first, True, previous_value
TTS/Kokoro/.venv/Lib/site-packages/rich/_palettes.py ADDED
@@ -0,0 +1,309 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from .palette import Palette
2
+
3
+
4
+ # Taken from https://en.wikipedia.org/wiki/ANSI_escape_code (Windows 10 column)
5
+ WINDOWS_PALETTE = Palette(
6
+ [
7
+ (12, 12, 12),
8
+ (197, 15, 31),
9
+ (19, 161, 14),
10
+ (193, 156, 0),
11
+ (0, 55, 218),
12
+ (136, 23, 152),
13
+ (58, 150, 221),
14
+ (204, 204, 204),
15
+ (118, 118, 118),
16
+ (231, 72, 86),
17
+ (22, 198, 12),
18
+ (249, 241, 165),
19
+ (59, 120, 255),
20
+ (180, 0, 158),
21
+ (97, 214, 214),
22
+ (242, 242, 242),
23
+ ]
24
+ )
25
+
26
+ # # The standard ansi colors (including bright variants)
27
+ STANDARD_PALETTE = Palette(
28
+ [
29
+ (0, 0, 0),
30
+ (170, 0, 0),
31
+ (0, 170, 0),
32
+ (170, 85, 0),
33
+ (0, 0, 170),
34
+ (170, 0, 170),
35
+ (0, 170, 170),
36
+ (170, 170, 170),
37
+ (85, 85, 85),
38
+ (255, 85, 85),
39
+ (85, 255, 85),
40
+ (255, 255, 85),
41
+ (85, 85, 255),
42
+ (255, 85, 255),
43
+ (85, 255, 255),
44
+ (255, 255, 255),
45
+ ]
46
+ )
47
+
48
+
49
+ # The 256 color palette
50
+ EIGHT_BIT_PALETTE = Palette(
51
+ [
52
+ (0, 0, 0),
53
+ (128, 0, 0),
54
+ (0, 128, 0),
55
+ (128, 128, 0),
56
+ (0, 0, 128),
57
+ (128, 0, 128),
58
+ (0, 128, 128),
59
+ (192, 192, 192),
60
+ (128, 128, 128),
61
+ (255, 0, 0),
62
+ (0, 255, 0),
63
+ (255, 255, 0),
64
+ (0, 0, 255),
65
+ (255, 0, 255),
66
+ (0, 255, 255),
67
+ (255, 255, 255),
68
+ (0, 0, 0),
69
+ (0, 0, 95),
70
+ (0, 0, 135),
71
+ (0, 0, 175),
72
+ (0, 0, 215),
73
+ (0, 0, 255),
74
+ (0, 95, 0),
75
+ (0, 95, 95),
76
+ (0, 95, 135),
77
+ (0, 95, 175),
78
+ (0, 95, 215),
79
+ (0, 95, 255),
80
+ (0, 135, 0),
81
+ (0, 135, 95),
82
+ (0, 135, 135),
83
+ (0, 135, 175),
84
+ (0, 135, 215),
85
+ (0, 135, 255),
86
+ (0, 175, 0),
87
+ (0, 175, 95),
88
+ (0, 175, 135),
89
+ (0, 175, 175),
90
+ (0, 175, 215),
91
+ (0, 175, 255),
92
+ (0, 215, 0),
93
+ (0, 215, 95),
94
+ (0, 215, 135),
95
+ (0, 215, 175),
96
+ (0, 215, 215),
97
+ (0, 215, 255),
98
+ (0, 255, 0),
99
+ (0, 255, 95),
100
+ (0, 255, 135),
101
+ (0, 255, 175),
102
+ (0, 255, 215),
103
+ (0, 255, 255),
104
+ (95, 0, 0),
105
+ (95, 0, 95),
106
+ (95, 0, 135),
107
+ (95, 0, 175),
108
+ (95, 0, 215),
109
+ (95, 0, 255),
110
+ (95, 95, 0),
111
+ (95, 95, 95),
112
+ (95, 95, 135),
113
+ (95, 95, 175),
114
+ (95, 95, 215),
115
+ (95, 95, 255),
116
+ (95, 135, 0),
117
+ (95, 135, 95),
118
+ (95, 135, 135),
119
+ (95, 135, 175),
120
+ (95, 135, 215),
121
+ (95, 135, 255),
122
+ (95, 175, 0),
123
+ (95, 175, 95),
124
+ (95, 175, 135),
125
+ (95, 175, 175),
126
+ (95, 175, 215),
127
+ (95, 175, 255),
128
+ (95, 215, 0),
129
+ (95, 215, 95),
130
+ (95, 215, 135),
131
+ (95, 215, 175),
132
+ (95, 215, 215),
133
+ (95, 215, 255),
134
+ (95, 255, 0),
135
+ (95, 255, 95),
136
+ (95, 255, 135),
137
+ (95, 255, 175),
138
+ (95, 255, 215),
139
+ (95, 255, 255),
140
+ (135, 0, 0),
141
+ (135, 0, 95),
142
+ (135, 0, 135),
143
+ (135, 0, 175),
144
+ (135, 0, 215),
145
+ (135, 0, 255),
146
+ (135, 95, 0),
147
+ (135, 95, 95),
148
+ (135, 95, 135),
149
+ (135, 95, 175),
150
+ (135, 95, 215),
151
+ (135, 95, 255),
152
+ (135, 135, 0),
153
+ (135, 135, 95),
154
+ (135, 135, 135),
155
+ (135, 135, 175),
156
+ (135, 135, 215),
157
+ (135, 135, 255),
158
+ (135, 175, 0),
159
+ (135, 175, 95),
160
+ (135, 175, 135),
161
+ (135, 175, 175),
162
+ (135, 175, 215),
163
+ (135, 175, 255),
164
+ (135, 215, 0),
165
+ (135, 215, 95),
166
+ (135, 215, 135),
167
+ (135, 215, 175),
168
+ (135, 215, 215),
169
+ (135, 215, 255),
170
+ (135, 255, 0),
171
+ (135, 255, 95),
172
+ (135, 255, 135),
173
+ (135, 255, 175),
174
+ (135, 255, 215),
175
+ (135, 255, 255),
176
+ (175, 0, 0),
177
+ (175, 0, 95),
178
+ (175, 0, 135),
179
+ (175, 0, 175),
180
+ (175, 0, 215),
181
+ (175, 0, 255),
182
+ (175, 95, 0),
183
+ (175, 95, 95),
184
+ (175, 95, 135),
185
+ (175, 95, 175),
186
+ (175, 95, 215),
187
+ (175, 95, 255),
188
+ (175, 135, 0),
189
+ (175, 135, 95),
190
+ (175, 135, 135),
191
+ (175, 135, 175),
192
+ (175, 135, 215),
193
+ (175, 135, 255),
194
+ (175, 175, 0),
195
+ (175, 175, 95),
196
+ (175, 175, 135),
197
+ (175, 175, 175),
198
+ (175, 175, 215),
199
+ (175, 175, 255),
200
+ (175, 215, 0),
201
+ (175, 215, 95),
202
+ (175, 215, 135),
203
+ (175, 215, 175),
204
+ (175, 215, 215),
205
+ (175, 215, 255),
206
+ (175, 255, 0),
207
+ (175, 255, 95),
208
+ (175, 255, 135),
209
+ (175, 255, 175),
210
+ (175, 255, 215),
211
+ (175, 255, 255),
212
+ (215, 0, 0),
213
+ (215, 0, 95),
214
+ (215, 0, 135),
215
+ (215, 0, 175),
216
+ (215, 0, 215),
217
+ (215, 0, 255),
218
+ (215, 95, 0),
219
+ (215, 95, 95),
220
+ (215, 95, 135),
221
+ (215, 95, 175),
222
+ (215, 95, 215),
223
+ (215, 95, 255),
224
+ (215, 135, 0),
225
+ (215, 135, 95),
226
+ (215, 135, 135),
227
+ (215, 135, 175),
228
+ (215, 135, 215),
229
+ (215, 135, 255),
230
+ (215, 175, 0),
231
+ (215, 175, 95),
232
+ (215, 175, 135),
233
+ (215, 175, 175),
234
+ (215, 175, 215),
235
+ (215, 175, 255),
236
+ (215, 215, 0),
237
+ (215, 215, 95),
238
+ (215, 215, 135),
239
+ (215, 215, 175),
240
+ (215, 215, 215),
241
+ (215, 215, 255),
242
+ (215, 255, 0),
243
+ (215, 255, 95),
244
+ (215, 255, 135),
245
+ (215, 255, 175),
246
+ (215, 255, 215),
247
+ (215, 255, 255),
248
+ (255, 0, 0),
249
+ (255, 0, 95),
250
+ (255, 0, 135),
251
+ (255, 0, 175),
252
+ (255, 0, 215),
253
+ (255, 0, 255),
254
+ (255, 95, 0),
255
+ (255, 95, 95),
256
+ (255, 95, 135),
257
+ (255, 95, 175),
258
+ (255, 95, 215),
259
+ (255, 95, 255),
260
+ (255, 135, 0),
261
+ (255, 135, 95),
262
+ (255, 135, 135),
263
+ (255, 135, 175),
264
+ (255, 135, 215),
265
+ (255, 135, 255),
266
+ (255, 175, 0),
267
+ (255, 175, 95),
268
+ (255, 175, 135),
269
+ (255, 175, 175),
270
+ (255, 175, 215),
271
+ (255, 175, 255),
272
+ (255, 215, 0),
273
+ (255, 215, 95),
274
+ (255, 215, 135),
275
+ (255, 215, 175),
276
+ (255, 215, 215),
277
+ (255, 215, 255),
278
+ (255, 255, 0),
279
+ (255, 255, 95),
280
+ (255, 255, 135),
281
+ (255, 255, 175),
282
+ (255, 255, 215),
283
+ (255, 255, 255),
284
+ (8, 8, 8),
285
+ (18, 18, 18),
286
+ (28, 28, 28),
287
+ (38, 38, 38),
288
+ (48, 48, 48),
289
+ (58, 58, 58),
290
+ (68, 68, 68),
291
+ (78, 78, 78),
292
+ (88, 88, 88),
293
+ (98, 98, 98),
294
+ (108, 108, 108),
295
+ (118, 118, 118),
296
+ (128, 128, 128),
297
+ (138, 138, 138),
298
+ (148, 148, 148),
299
+ (158, 158, 158),
300
+ (168, 168, 168),
301
+ (178, 178, 178),
302
+ (188, 188, 188),
303
+ (198, 198, 198),
304
+ (208, 208, 208),
305
+ (218, 218, 218),
306
+ (228, 228, 228),
307
+ (238, 238, 238),
308
+ ]
309
+ )
TTS/Kokoro/.venv/Lib/site-packages/rich/_pick.py ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import Optional
2
+
3
+
4
+ def pick_bool(*values: Optional[bool]) -> bool:
5
+ """Pick the first non-none bool or return the last value.
6
+
7
+ Args:
8
+ *values (bool): Any number of boolean or None values.
9
+
10
+ Returns:
11
+ bool: First non-none boolean.
12
+ """
13
+ assert values, "1 or more values required"
14
+ for value in values:
15
+ if value is not None:
16
+ return value
17
+ return bool(value)
TTS/Kokoro/.venv/Lib/site-packages/rich/_ratio.py ADDED
@@ -0,0 +1,153 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from fractions import Fraction
2
+ from math import ceil
3
+ from typing import cast, List, Optional, Sequence, Protocol
4
+
5
+
6
+ class Edge(Protocol):
7
+ """Any object that defines an edge (such as Layout)."""
8
+
9
+ size: Optional[int] = None
10
+ ratio: int = 1
11
+ minimum_size: int = 1
12
+
13
+
14
+ def ratio_resolve(total: int, edges: Sequence[Edge]) -> List[int]:
15
+ """Divide total space to satisfy size, ratio, and minimum_size, constraints.
16
+
17
+ The returned list of integers should add up to total in most cases, unless it is
18
+ impossible to satisfy all the constraints. For instance, if there are two edges
19
+ with a minimum size of 20 each and `total` is 30 then the returned list will be
20
+ greater than total. In practice, this would mean that a Layout object would
21
+ clip the rows that would overflow the screen height.
22
+
23
+ Args:
24
+ total (int): Total number of characters.
25
+ edges (List[Edge]): Edges within total space.
26
+
27
+ Returns:
28
+ List[int]: Number of characters for each edge.
29
+ """
30
+ # Size of edge or None for yet to be determined
31
+ sizes = [(edge.size or None) for edge in edges]
32
+
33
+ _Fraction = Fraction
34
+
35
+ # While any edges haven't been calculated
36
+ while None in sizes:
37
+ # Get flexible edges and index to map these back on to sizes list
38
+ flexible_edges = [
39
+ (index, edge)
40
+ for index, (size, edge) in enumerate(zip(sizes, edges))
41
+ if size is None
42
+ ]
43
+ # Remaining space in total
44
+ remaining = total - sum(size or 0 for size in sizes)
45
+ if remaining <= 0:
46
+ # No room for flexible edges
47
+ return [
48
+ ((edge.minimum_size or 1) if size is None else size)
49
+ for size, edge in zip(sizes, edges)
50
+ ]
51
+ # Calculate number of characters in a ratio portion
52
+ portion = _Fraction(
53
+ remaining, sum((edge.ratio or 1) for _, edge in flexible_edges)
54
+ )
55
+
56
+ # If any edges will be less than their minimum, replace size with the minimum
57
+ for index, edge in flexible_edges:
58
+ if portion * edge.ratio <= edge.minimum_size:
59
+ sizes[index] = edge.minimum_size
60
+ # New fixed size will invalidate calculations, so we need to repeat the process
61
+ break
62
+ else:
63
+ # Distribute flexible space and compensate for rounding error
64
+ # Since edge sizes can only be integers we need to add the remainder
65
+ # to the following line
66
+ remainder = _Fraction(0)
67
+ for index, edge in flexible_edges:
68
+ size, remainder = divmod(portion * edge.ratio + remainder, 1)
69
+ sizes[index] = size
70
+ break
71
+ # Sizes now contains integers only
72
+ return cast(List[int], sizes)
73
+
74
+
75
+ def ratio_reduce(
76
+ total: int, ratios: List[int], maximums: List[int], values: List[int]
77
+ ) -> List[int]:
78
+ """Divide an integer total in to parts based on ratios.
79
+
80
+ Args:
81
+ total (int): The total to divide.
82
+ ratios (List[int]): A list of integer ratios.
83
+ maximums (List[int]): List of maximums values for each slot.
84
+ values (List[int]): List of values
85
+
86
+ Returns:
87
+ List[int]: A list of integers guaranteed to sum to total.
88
+ """
89
+ ratios = [ratio if _max else 0 for ratio, _max in zip(ratios, maximums)]
90
+ total_ratio = sum(ratios)
91
+ if not total_ratio:
92
+ return values[:]
93
+ total_remaining = total
94
+ result: List[int] = []
95
+ append = result.append
96
+ for ratio, maximum, value in zip(ratios, maximums, values):
97
+ if ratio and total_ratio > 0:
98
+ distributed = min(maximum, round(ratio * total_remaining / total_ratio))
99
+ append(value - distributed)
100
+ total_remaining -= distributed
101
+ total_ratio -= ratio
102
+ else:
103
+ append(value)
104
+ return result
105
+
106
+
107
+ def ratio_distribute(
108
+ total: int, ratios: List[int], minimums: Optional[List[int]] = None
109
+ ) -> List[int]:
110
+ """Distribute an integer total in to parts based on ratios.
111
+
112
+ Args:
113
+ total (int): The total to divide.
114
+ ratios (List[int]): A list of integer ratios.
115
+ minimums (List[int]): List of minimum values for each slot.
116
+
117
+ Returns:
118
+ List[int]: A list of integers guaranteed to sum to total.
119
+ """
120
+ if minimums:
121
+ ratios = [ratio if _min else 0 for ratio, _min in zip(ratios, minimums)]
122
+ total_ratio = sum(ratios)
123
+ assert total_ratio > 0, "Sum of ratios must be > 0"
124
+
125
+ total_remaining = total
126
+ distributed_total: List[int] = []
127
+ append = distributed_total.append
128
+ if minimums is None:
129
+ _minimums = [0] * len(ratios)
130
+ else:
131
+ _minimums = minimums
132
+ for ratio, minimum in zip(ratios, _minimums):
133
+ if total_ratio > 0:
134
+ distributed = max(minimum, ceil(ratio * total_remaining / total_ratio))
135
+ else:
136
+ distributed = total_remaining
137
+ append(distributed)
138
+ total_ratio -= ratio
139
+ total_remaining -= distributed
140
+ return distributed_total
141
+
142
+
143
+ if __name__ == "__main__":
144
+ from dataclasses import dataclass
145
+
146
+ @dataclass
147
+ class E:
148
+ size: Optional[int] = None
149
+ ratio: int = 1
150
+ minimum_size: int = 1
151
+
152
+ resolved = ratio_resolve(110, [E(None, 1, 1), E(None, 1, 1), E(None, 1, 1)])
153
+ print(sum(resolved))
TTS/Kokoro/.venv/Lib/site-packages/rich/_spinners.py ADDED
@@ -0,0 +1,482 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ Spinners are from:
3
+ * cli-spinners:
4
+ MIT License
5
+ Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights to
9
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
10
+ the Software, and to permit persons to whom the Software is furnished to do so,
11
+ subject to the following conditions:
12
+ The above copyright notice and this permission notice shall be included
13
+ in all copies or substantial portions of the Software.
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
15
+ INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
16
+ PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
17
+ FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
18
+ ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
19
+ IN THE SOFTWARE.
20
+ """
21
+
22
+ SPINNERS = {
23
+ "dots": {
24
+ "interval": 80,
25
+ "frames": "⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏",
26
+ },
27
+ "dots2": {"interval": 80, "frames": "⣾⣽⣻⢿⡿⣟⣯⣷"},
28
+ "dots3": {
29
+ "interval": 80,
30
+ "frames": "⠋⠙⠚⠞⠖⠦⠴⠲⠳⠓",
31
+ },
32
+ "dots4": {
33
+ "interval": 80,
34
+ "frames": "⠄⠆⠇⠋⠙⠸⠰⠠⠰⠸⠙⠋⠇⠆",
35
+ },
36
+ "dots5": {
37
+ "interval": 80,
38
+ "frames": "⠋⠙⠚⠒⠂⠂⠒⠲⠴⠦⠖⠒⠐⠐⠒⠓⠋",
39
+ },
40
+ "dots6": {
41
+ "interval": 80,
42
+ "frames": "⠁⠉⠙⠚⠒⠂⠂⠒⠲⠴⠤⠄⠄⠤⠴⠲⠒⠂⠂⠒⠚⠙⠉⠁",
43
+ },
44
+ "dots7": {
45
+ "interval": 80,
46
+ "frames": "⠈⠉⠋⠓⠒⠐⠐⠒⠖⠦⠤⠠⠠⠤⠦⠖⠒⠐⠐⠒⠓⠋⠉⠈",
47
+ },
48
+ "dots8": {
49
+ "interval": 80,
50
+ "frames": "⠁⠁⠉⠙⠚⠒⠂⠂⠒⠲⠴⠤⠄⠄⠤⠠⠠⠤⠦⠖⠒⠐⠐⠒⠓⠋⠉⠈⠈",
51
+ },
52
+ "dots9": {"interval": 80, "frames": "⢹⢺⢼⣸⣇⡧⡗⡏"},
53
+ "dots10": {"interval": 80, "frames": "⢄⢂⢁⡁⡈⡐⡠"},
54
+ "dots11": {"interval": 100, "frames": "⠁⠂⠄⡀⢀⠠⠐⠈"},
55
+ "dots12": {
56
+ "interval": 80,
57
+ "frames": [
58
+ "⢀⠀",
59
+ "⡀⠀",
60
+ "⠄⠀",
61
+ "⢂⠀",
62
+ "⡂⠀",
63
+ "⠅⠀",
64
+ "⢃⠀",
65
+ "⡃⠀",
66
+ "⠍⠀",
67
+ "⢋⠀",
68
+ "⡋⠀",
69
+ "⠍⠁",
70
+ "⢋⠁",
71
+ "⡋⠁",
72
+ "⠍⠉",
73
+ "⠋⠉",
74
+ "⠋⠉",
75
+ "⠉⠙",
76
+ "⠉⠙",
77
+ "⠉⠩",
78
+ "⠈⢙",
79
+ "⠈⡙",
80
+ "⢈⠩",
81
+ "⡀⢙",
82
+ "⠄⡙",
83
+ "⢂⠩",
84
+ "⡂⢘",
85
+ "⠅⡘",
86
+ "⢃⠨",
87
+ "⡃⢐",
88
+ "⠍⡐",
89
+ "⢋⠠",
90
+ "⡋⢀",
91
+ "⠍⡁",
92
+ "⢋⠁",
93
+ "⡋⠁",
94
+ "⠍⠉",
95
+ "⠋⠉",
96
+ "⠋⠉",
97
+ "⠉⠙",
98
+ "⠉⠙",
99
+ "⠉⠩",
100
+ "⠈⢙",
101
+ "⠈⡙",
102
+ "⠈⠩",
103
+ "⠀⢙",
104
+ "⠀⡙",
105
+ "⠀⠩",
106
+ "⠀⢘",
107
+ "⠀⡘",
108
+ "⠀⠨",
109
+ "⠀⢐",
110
+ "⠀⡐",
111
+ "⠀⠠",
112
+ "⠀⢀",
113
+ "⠀⡀",
114
+ ],
115
+ },
116
+ "dots8Bit": {
117
+ "interval": 80,
118
+ "frames": "⠀⠁⠂⠃⠄⠅⠆⠇⡀⡁⡂⡃⡄⡅⡆⡇⠈⠉⠊⠋⠌⠍⠎⠏⡈⡉⡊⡋⡌⡍⡎⡏⠐⠑⠒⠓⠔⠕⠖⠗⡐⡑⡒⡓⡔⡕⡖⡗⠘⠙⠚⠛⠜⠝⠞⠟⡘⡙"
119
+ "⡚⡛⡜⡝⡞⡟⠠⠡⠢⠣⠤⠥⠦⠧⡠⡡⡢⡣⡤⡥⡦⡧⠨⠩⠪⠫⠬⠭⠮⠯⡨⡩⡪⡫⡬⡭⡮⡯⠰⠱⠲⠳⠴⠵⠶⠷⡰⡱⡲⡳⡴⡵⡶⡷⠸⠹⠺⠻"
120
+ "⠼⠽⠾⠿⡸⡹⡺⡻⡼⡽⡾⡿⢀⢁⢂⢃⢄⢅⢆⢇⣀⣁⣂⣃⣄⣅⣆⣇⢈⢉⢊⢋⢌⢍⢎⢏⣈⣉⣊⣋⣌⣍⣎⣏⢐⢑⢒⢓⢔⢕⢖⢗⣐⣑⣒⣓⣔⣕"
121
+ "⣖⣗⢘⢙⢚⢛⢜⢝⢞⢟⣘⣙⣚⣛⣜⣝⣞⣟⢠⢡⢢⢣⢤⢥⢦⢧⣠⣡⣢⣣⣤⣥⣦⣧⢨⢩⢪⢫⢬⢭⢮⢯⣨⣩⣪⣫⣬⣭⣮⣯⢰⢱⢲⢳⢴⢵⢶⢷"
122
+ "⣰⣱⣲⣳⣴⣵⣶⣷⢸⢹⢺⢻⢼⢽⢾⢿⣸⣹⣺⣻⣼⣽⣾⣿",
123
+ },
124
+ "line": {"interval": 130, "frames": ["-", "\\", "|", "/"]},
125
+ "line2": {"interval": 100, "frames": "⠂-–—–-"},
126
+ "pipe": {"interval": 100, "frames": "┤┘┴└├┌┬┐"},
127
+ "simpleDots": {"interval": 400, "frames": [". ", ".. ", "...", " "]},
128
+ "simpleDotsScrolling": {
129
+ "interval": 200,
130
+ "frames": [". ", ".. ", "...", " ..", " .", " "],
131
+ },
132
+ "star": {"interval": 70, "frames": "✶✸✹✺✹✷"},
133
+ "star2": {"interval": 80, "frames": "+x*"},
134
+ "flip": {
135
+ "interval": 70,
136
+ "frames": "___-``'´-___",
137
+ },
138
+ "hamburger": {"interval": 100, "frames": "☱☲☴"},
139
+ "growVertical": {
140
+ "interval": 120,
141
+ "frames": "▁▃▄▅▆▇▆▅▄▃",
142
+ },
143
+ "growHorizontal": {
144
+ "interval": 120,
145
+ "frames": "▏▎▍▌▋▊▉▊▋▌▍▎",
146
+ },
147
+ "balloon": {"interval": 140, "frames": " .oO@* "},
148
+ "balloon2": {"interval": 120, "frames": ".oO°Oo."},
149
+ "noise": {"interval": 100, "frames": "▓▒░"},
150
+ "bounce": {"interval": 120, "frames": "⠁⠂⠄⠂"},
151
+ "boxBounce": {"interval": 120, "frames": "▖▘▝▗"},
152
+ "boxBounce2": {"interval": 100, "frames": "▌▀▐▄"},
153
+ "triangle": {"interval": 50, "frames": "◢◣◤◥"},
154
+ "arc": {"interval": 100, "frames": "◜◠◝◞◡◟"},
155
+ "circle": {"interval": 120, "frames": "◡⊙◠"},
156
+ "squareCorners": {"interval": 180, "frames": "◰◳◲◱"},
157
+ "circleQuarters": {"interval": 120, "frames": "◴◷◶◵"},
158
+ "circleHalves": {"interval": 50, "frames": "◐◓◑◒"},
159
+ "squish": {"interval": 100, "frames": "╫╪"},
160
+ "toggle": {"interval": 250, "frames": "⊶⊷"},
161
+ "toggle2": {"interval": 80, "frames": "▫▪"},
162
+ "toggle3": {"interval": 120, "frames": "□■"},
163
+ "toggle4": {"interval": 100, "frames": "■□▪▫"},
164
+ "toggle5": {"interval": 100, "frames": "▮▯"},
165
+ "toggle6": {"interval": 300, "frames": "ဝ၀"},
166
+ "toggle7": {"interval": 80, "frames": "⦾⦿"},
167
+ "toggle8": {"interval": 100, "frames": "◍◌"},
168
+ "toggle9": {"interval": 100, "frames": "◉◎"},
169
+ "toggle10": {"interval": 100, "frames": "㊂㊀㊁"},
170
+ "toggle11": {"interval": 50, "frames": "⧇⧆"},
171
+ "toggle12": {"interval": 120, "frames": "☗☖"},
172
+ "toggle13": {"interval": 80, "frames": "=*-"},
173
+ "arrow": {"interval": 100, "frames": "←↖↑↗→↘↓↙"},
174
+ "arrow2": {
175
+ "interval": 80,
176
+ "frames": ["⬆️ ", "↗️ ", "➡️ ", "↘️ ", "⬇️ ", "↙️ ", "⬅️ ", "↖️ "],
177
+ },
178
+ "arrow3": {
179
+ "interval": 120,
180
+ "frames": ["▹▹▹▹▹", "▸▹▹▹▹", "▹▸▹▹▹", "▹▹▸▹▹", "▹▹▹▸▹", "▹▹▹▹▸"],
181
+ },
182
+ "bouncingBar": {
183
+ "interval": 80,
184
+ "frames": [
185
+ "[ ]",
186
+ "[= ]",
187
+ "[== ]",
188
+ "[=== ]",
189
+ "[ ===]",
190
+ "[ ==]",
191
+ "[ =]",
192
+ "[ ]",
193
+ "[ =]",
194
+ "[ ==]",
195
+ "[ ===]",
196
+ "[====]",
197
+ "[=== ]",
198
+ "[== ]",
199
+ "[= ]",
200
+ ],
201
+ },
202
+ "bouncingBall": {
203
+ "interval": 80,
204
+ "frames": [
205
+ "( ● )",
206
+ "( ● )",
207
+ "( ● )",
208
+ "( ● )",
209
+ "( ●)",
210
+ "( ● )",
211
+ "( ● )",
212
+ "( ● )",
213
+ "( ● )",
214
+ "(● )",
215
+ ],
216
+ },
217
+ "smiley": {"interval": 200, "frames": ["😄 ", "😝 "]},
218
+ "monkey": {"interval": 300, "frames": ["🙈 ", "🙈 ", "🙉 ", "🙊 "]},
219
+ "hearts": {"interval": 100, "frames": ["💛 ", "💙 ", "💜 ", "💚 ", "❤️ "]},
220
+ "clock": {
221
+ "interval": 100,
222
+ "frames": [
223
+ "🕛 ",
224
+ "🕐 ",
225
+ "🕑 ",
226
+ "🕒 ",
227
+ "🕓 ",
228
+ "🕔 ",
229
+ "🕕 ",
230
+ "🕖 ",
231
+ "🕗 ",
232
+ "🕘 ",
233
+ "🕙 ",
234
+ "🕚 ",
235
+ ],
236
+ },
237
+ "earth": {"interval": 180, "frames": ["🌍 ", "🌎 ", "🌏 "]},
238
+ "material": {
239
+ "interval": 17,
240
+ "frames": [
241
+ "█▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁",
242
+ "██▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁",
243
+ "███▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁",
244
+ "████▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁",
245
+ "██████▁▁▁▁▁▁▁▁▁▁▁▁▁▁",
246
+ "██████▁▁▁▁▁▁▁▁▁▁▁▁▁▁",
247
+ "███████▁▁▁▁▁▁▁▁▁▁▁▁▁",
248
+ "████████▁▁▁▁▁▁▁▁▁▁▁▁",
249
+ "█████████▁▁▁▁▁▁▁▁▁▁▁",
250
+ "█████████▁▁▁▁▁▁▁▁▁▁▁",
251
+ "██████████▁▁▁▁▁▁▁▁▁▁",
252
+ "███████████▁▁▁▁▁▁▁▁▁",
253
+ "█████████████▁▁▁▁▁▁▁",
254
+ "██████████████▁▁▁▁▁▁",
255
+ "██████████████▁▁▁▁▁▁",
256
+ "▁██████████████▁▁▁▁▁",
257
+ "▁██████████████▁▁▁▁▁",
258
+ "▁██████████████▁▁▁▁▁",
259
+ "▁▁██████████████▁▁▁▁",
260
+ "▁▁▁██████████████▁▁▁",
261
+ "▁▁▁▁█████████████▁▁▁",
262
+ "▁▁▁▁██████████████▁▁",
263
+ "▁▁▁▁██████████████▁▁",
264
+ "▁▁▁▁▁██████████████▁",
265
+ "▁▁▁▁▁██████████████▁",
266
+ "▁▁▁▁▁██████████████▁",
267
+ "▁▁▁▁▁▁██████████████",
268
+ "▁▁▁▁▁▁██████████████",
269
+ "▁▁▁▁▁▁▁█████████████",
270
+ "▁▁▁▁▁▁▁█████████████",
271
+ "▁▁▁▁▁▁▁▁████████████",
272
+ "▁▁▁▁▁▁▁▁████████████",
273
+ "▁▁▁▁▁▁▁▁▁███████████",
274
+ "▁▁▁▁▁▁▁▁▁███████████",
275
+ "▁▁▁▁▁▁▁▁▁▁██████████",
276
+ "▁▁▁▁▁▁▁▁▁▁██████████",
277
+ "▁▁▁▁▁▁▁▁▁▁▁▁████████",
278
+ "▁▁▁▁▁▁▁▁▁▁▁▁▁███████",
279
+ "▁▁▁▁▁▁▁▁▁▁▁▁▁▁██████",
280
+ "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁█████",
281
+ "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁█████",
282
+ "█▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁████",
283
+ "██▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁███",
284
+ "██▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁███",
285
+ "███▁▁▁▁▁▁▁▁▁▁▁▁▁▁███",
286
+ "████▁▁▁▁▁▁▁▁▁▁▁▁▁▁██",
287
+ "█████▁▁▁▁▁▁▁▁▁▁▁▁▁▁█",
288
+ "█████▁▁▁▁▁▁▁▁▁▁▁▁▁▁█",
289
+ "██████▁▁▁▁▁▁▁▁▁▁▁▁▁█",
290
+ "████████▁▁▁▁▁▁▁▁▁▁▁▁",
291
+ "█████████▁▁▁▁▁▁▁▁▁▁▁",
292
+ "█████████▁▁▁▁▁▁▁▁▁▁▁",
293
+ "█████████▁▁▁▁▁▁▁▁▁▁▁",
294
+ "█████████▁▁▁▁▁▁▁▁▁▁▁",
295
+ "███████████▁▁▁▁▁▁▁▁▁",
296
+ "████████████▁▁▁▁▁▁▁▁",
297
+ "████████████▁▁▁▁▁▁▁▁",
298
+ "██████████████▁▁▁▁▁▁",
299
+ "██████████████▁▁▁▁▁▁",
300
+ "▁██████████████▁▁▁▁▁",
301
+ "▁██████████████▁▁▁▁▁",
302
+ "▁▁▁█████████████▁▁▁▁",
303
+ "▁▁▁▁▁████████████▁▁▁",
304
+ "▁▁▁▁▁████████████▁▁▁",
305
+ "▁▁▁▁▁▁███████████▁▁▁",
306
+ "▁▁▁▁▁▁▁▁█████████▁▁▁",
307
+ "▁▁▁▁▁▁▁▁█████████▁▁▁",
308
+ "▁▁▁▁▁▁▁▁▁█████████▁▁",
309
+ "▁▁▁▁▁▁▁▁▁█████████▁▁",
310
+ "▁▁▁▁▁▁▁▁▁▁█████████▁",
311
+ "▁▁▁▁▁▁▁▁▁▁▁████████▁",
312
+ "▁▁▁▁▁▁▁▁▁▁▁████████▁",
313
+ "▁▁▁▁▁▁▁▁▁▁▁▁███████▁",
314
+ "▁▁▁▁▁▁▁▁▁▁▁▁███████▁",
315
+ "▁▁▁▁▁▁▁▁▁▁▁▁▁███████",
316
+ "▁▁▁▁▁▁▁▁▁▁▁▁▁███████",
317
+ "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁█████",
318
+ "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁████",
319
+ "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁████",
320
+ "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁████",
321
+ "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁███",
322
+ "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁███",
323
+ "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁██",
324
+ "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁██",
325
+ "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁██",
326
+ "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁█",
327
+ "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁█",
328
+ "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁█",
329
+ "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁",
330
+ "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁",
331
+ "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁",
332
+ "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁",
333
+ ],
334
+ },
335
+ "moon": {
336
+ "interval": 80,
337
+ "frames": ["🌑 ", "🌒 ", "🌓 ", "🌔 ", "🌕 ", "🌖 ", "🌗 ", "🌘 "],
338
+ },
339
+ "runner": {"interval": 140, "frames": ["🚶 ", "🏃 "]},
340
+ "pong": {
341
+ "interval": 80,
342
+ "frames": [
343
+ "▐⠂ ▌",
344
+ "▐⠈ ▌",
345
+ "▐ ⠂ ▌",
346
+ "▐ ⠠ ▌",
347
+ "▐ ⡀ ▌",
348
+ "▐ ⠠ ▌",
349
+ "▐ ⠂ ▌",
350
+ "▐ ⠈ ▌",
351
+ "▐ ⠂ ▌",
352
+ "▐ ⠠ ▌",
353
+ "▐ ⡀ ▌",
354
+ "▐ ⠠ ▌",
355
+ "▐ ⠂ ▌",
356
+ "▐ ⠈ ▌",
357
+ "▐ ⠂▌",
358
+ "▐ ⠠▌",
359
+ "▐ ⡀▌",
360
+ "▐ ⠠ ▌",
361
+ "▐ ⠂ ▌",
362
+ "▐ ⠈ ▌",
363
+ "▐ ⠂ ▌",
364
+ "▐ ⠠ ▌",
365
+ "▐ ⡀ ▌",
366
+ "▐ ⠠ ▌",
367
+ "▐ ⠂ ▌",
368
+ "▐ ⠈ ▌",
369
+ "▐ ⠂ ▌",
370
+ "▐ ⠠ ▌",
371
+ "▐ ⡀ ▌",
372
+ "▐⠠ ▌",
373
+ ],
374
+ },
375
+ "shark": {
376
+ "interval": 120,
377
+ "frames": [
378
+ "▐|\\____________▌",
379
+ "▐_|\\___________▌",
380
+ "▐__|\\__________▌",
381
+ "▐___|\\_________▌",
382
+ "▐____|\\________▌",
383
+ "▐_____|\\_______▌",
384
+ "▐______|\\______▌",
385
+ "▐_______|\\_____▌",
386
+ "▐________|\\____▌",
387
+ "▐_________|\\___▌",
388
+ "▐__________|\\__▌",
389
+ "▐___________|\\_▌",
390
+ "▐____________|\\▌",
391
+ "▐____________/|▌",
392
+ "▐___________/|_▌",
393
+ "▐__________/|__▌",
394
+ "▐_________/|___▌",
395
+ "▐________/|____▌",
396
+ "▐_______/|_____▌",
397
+ "▐______/|______▌",
398
+ "▐_____/|_______▌",
399
+ "▐____/|________▌",
400
+ "▐___/|_________▌",
401
+ "▐__/|__________▌",
402
+ "▐_/|___________▌",
403
+ "▐/|____________▌",
404
+ ],
405
+ },
406
+ "dqpb": {"interval": 100, "frames": "dqpb"},
407
+ "weather": {
408
+ "interval": 100,
409
+ "frames": [
410
+ "☀️ ",
411
+ "☀️ ",
412
+ "☀️ ",
413
+ "🌤 ",
414
+ "⛅️ ",
415
+ "🌥 ",
416
+ "☁️ ",
417
+ "🌧 ",
418
+ "🌨 ",
419
+ "🌧 ",
420
+ "🌨 ",
421
+ "🌧 ",
422
+ "🌨 ",
423
+ "⛈ ",
424
+ "🌨 ",
425
+ "🌧 ",
426
+ "🌨 ",
427
+ "☁️ ",
428
+ "🌥 ",
429
+ "⛅️ ",
430
+ "🌤 ",
431
+ "☀️ ",
432
+ "☀️ ",
433
+ ],
434
+ },
435
+ "christmas": {"interval": 400, "frames": "🌲🎄"},
436
+ "grenade": {
437
+ "interval": 80,
438
+ "frames": [
439
+ "، ",
440
+ "′ ",
441
+ " ´ ",
442
+ " ‾ ",
443
+ " ⸌",
444
+ " ⸊",
445
+ " |",
446
+ " ⁎",
447
+ " ⁕",
448
+ " ෴ ",
449
+ " ⁓",
450
+ " ",
451
+ " ",
452
+ " ",
453
+ ],
454
+ },
455
+ "point": {"interval": 125, "frames": ["∙∙∙", "●∙∙", "∙●∙", "∙∙●", "∙∙∙"]},
456
+ "layer": {"interval": 150, "frames": "-=≡"},
457
+ "betaWave": {
458
+ "interval": 80,
459
+ "frames": [
460
+ "ρββββββ",
461
+ "βρβββββ",
462
+ "ββρββββ",
463
+ "βββρβββ",
464
+ "ββββρββ",
465
+ "βββββρβ",
466
+ "ββββββρ",
467
+ ],
468
+ },
469
+ "aesthetic": {
470
+ "interval": 80,
471
+ "frames": [
472
+ "▰▱▱▱▱▱▱",
473
+ "▰▰▱▱▱▱▱",
474
+ "▰▰▰▱▱▱▱",
475
+ "▰▰▰▰▱▱▱",
476
+ "▰▰▰▰▰▱▱",
477
+ "▰▰▰▰▰▰▱",
478
+ "▰▰▰▰▰▰▰",
479
+ "▰▱▱▱▱▱▱",
480
+ ],
481
+ },
482
+ }
TTS/Kokoro/.venv/Lib/site-packages/rich/_stack.py ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import List, TypeVar
2
+
3
+ T = TypeVar("T")
4
+
5
+
6
+ class Stack(List[T]):
7
+ """A small shim over builtin list."""
8
+
9
+ @property
10
+ def top(self) -> T:
11
+ """Get top of stack."""
12
+ return self[-1]
13
+
14
+ def push(self, item: T) -> None:
15
+ """Push an item on to the stack (append in stack nomenclature)."""
16
+ self.append(item)
TTS/Kokoro/.venv/Lib/site-packages/rich/_timer.py ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ Timer context manager, only used in debug.
3
+
4
+ """
5
+
6
+ from time import time
7
+
8
+ import contextlib
9
+ from typing import Generator
10
+
11
+
12
+ @contextlib.contextmanager
13
+ def timer(subject: str = "time") -> Generator[None, None, None]:
14
+ """print the elapsed time. (only used in debugging)"""
15
+ start = time()
16
+ yield
17
+ elapsed = time() - start
18
+ elapsed_ms = elapsed * 1000
19
+ print(f"{subject} elapsed {elapsed_ms:.1f}ms")
TTS/Kokoro/.venv/Lib/site-packages/rich/_win32_console.py ADDED
@@ -0,0 +1,661 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Light wrapper around the Win32 Console API - this module should only be imported on Windows
2
+
3
+ The API that this module wraps is documented at https://docs.microsoft.com/en-us/windows/console/console-functions
4
+ """
5
+
6
+ import ctypes
7
+ import sys
8
+ from typing import Any
9
+
10
+ windll: Any = None
11
+ if sys.platform == "win32":
12
+ windll = ctypes.LibraryLoader(ctypes.WinDLL)
13
+ else:
14
+ raise ImportError(f"{__name__} can only be imported on Windows")
15
+
16
+ import time
17
+ from ctypes import Structure, byref, wintypes
18
+ from typing import IO, NamedTuple, Type, cast
19
+
20
+ from rich.color import ColorSystem
21
+ from rich.style import Style
22
+
23
+ STDOUT = -11
24
+ ENABLE_VIRTUAL_TERMINAL_PROCESSING = 4
25
+
26
+ COORD = wintypes._COORD
27
+
28
+
29
+ class LegacyWindowsError(Exception):
30
+ pass
31
+
32
+
33
+ class WindowsCoordinates(NamedTuple):
34
+ """Coordinates in the Windows Console API are (y, x), not (x, y).
35
+ This class is intended to prevent that confusion.
36
+ Rows and columns are indexed from 0.
37
+ This class can be used in place of wintypes._COORD in arguments and argtypes.
38
+ """
39
+
40
+ row: int
41
+ col: int
42
+
43
+ @classmethod
44
+ def from_param(cls, value: "WindowsCoordinates") -> COORD:
45
+ """Converts a WindowsCoordinates into a wintypes _COORD structure.
46
+ This classmethod is internally called by ctypes to perform the conversion.
47
+
48
+ Args:
49
+ value (WindowsCoordinates): The input coordinates to convert.
50
+
51
+ Returns:
52
+ wintypes._COORD: The converted coordinates struct.
53
+ """
54
+ return COORD(value.col, value.row)
55
+
56
+
57
+ class CONSOLE_SCREEN_BUFFER_INFO(Structure):
58
+ _fields_ = [
59
+ ("dwSize", COORD),
60
+ ("dwCursorPosition", COORD),
61
+ ("wAttributes", wintypes.WORD),
62
+ ("srWindow", wintypes.SMALL_RECT),
63
+ ("dwMaximumWindowSize", COORD),
64
+ ]
65
+
66
+
67
+ class CONSOLE_CURSOR_INFO(ctypes.Structure):
68
+ _fields_ = [("dwSize", wintypes.DWORD), ("bVisible", wintypes.BOOL)]
69
+
70
+
71
+ _GetStdHandle = windll.kernel32.GetStdHandle
72
+ _GetStdHandle.argtypes = [
73
+ wintypes.DWORD,
74
+ ]
75
+ _GetStdHandle.restype = wintypes.HANDLE
76
+
77
+
78
+ def GetStdHandle(handle: int = STDOUT) -> wintypes.HANDLE:
79
+ """Retrieves a handle to the specified standard device (standard input, standard output, or standard error).
80
+
81
+ Args:
82
+ handle (int): Integer identifier for the handle. Defaults to -11 (stdout).
83
+
84
+ Returns:
85
+ wintypes.HANDLE: The handle
86
+ """
87
+ return cast(wintypes.HANDLE, _GetStdHandle(handle))
88
+
89
+
90
+ _GetConsoleMode = windll.kernel32.GetConsoleMode
91
+ _GetConsoleMode.argtypes = [wintypes.HANDLE, wintypes.LPDWORD]
92
+ _GetConsoleMode.restype = wintypes.BOOL
93
+
94
+
95
+ def GetConsoleMode(std_handle: wintypes.HANDLE) -> int:
96
+ """Retrieves the current input mode of a console's input buffer
97
+ or the current output mode of a console screen buffer.
98
+
99
+ Args:
100
+ std_handle (wintypes.HANDLE): A handle to the console input buffer or the console screen buffer.
101
+
102
+ Raises:
103
+ LegacyWindowsError: If any error occurs while calling the Windows console API.
104
+
105
+ Returns:
106
+ int: Value representing the current console mode as documented at
107
+ https://docs.microsoft.com/en-us/windows/console/getconsolemode#parameters
108
+ """
109
+
110
+ console_mode = wintypes.DWORD()
111
+ success = bool(_GetConsoleMode(std_handle, console_mode))
112
+ if not success:
113
+ raise LegacyWindowsError("Unable to get legacy Windows Console Mode")
114
+ return console_mode.value
115
+
116
+
117
+ _FillConsoleOutputCharacterW = windll.kernel32.FillConsoleOutputCharacterW
118
+ _FillConsoleOutputCharacterW.argtypes = [
119
+ wintypes.HANDLE,
120
+ ctypes.c_char,
121
+ wintypes.DWORD,
122
+ cast(Type[COORD], WindowsCoordinates),
123
+ ctypes.POINTER(wintypes.DWORD),
124
+ ]
125
+ _FillConsoleOutputCharacterW.restype = wintypes.BOOL
126
+
127
+
128
+ def FillConsoleOutputCharacter(
129
+ std_handle: wintypes.HANDLE,
130
+ char: str,
131
+ length: int,
132
+ start: WindowsCoordinates,
133
+ ) -> int:
134
+ """Writes a character to the console screen buffer a specified number of times, beginning at the specified coordinates.
135
+
136
+ Args:
137
+ std_handle (wintypes.HANDLE): A handle to the console input buffer or the console screen buffer.
138
+ char (str): The character to write. Must be a string of length 1.
139
+ length (int): The number of times to write the character.
140
+ start (WindowsCoordinates): The coordinates to start writing at.
141
+
142
+ Returns:
143
+ int: The number of characters written.
144
+ """
145
+ character = ctypes.c_char(char.encode())
146
+ num_characters = wintypes.DWORD(length)
147
+ num_written = wintypes.DWORD(0)
148
+ _FillConsoleOutputCharacterW(
149
+ std_handle,
150
+ character,
151
+ num_characters,
152
+ start,
153
+ byref(num_written),
154
+ )
155
+ return num_written.value
156
+
157
+
158
+ _FillConsoleOutputAttribute = windll.kernel32.FillConsoleOutputAttribute
159
+ _FillConsoleOutputAttribute.argtypes = [
160
+ wintypes.HANDLE,
161
+ wintypes.WORD,
162
+ wintypes.DWORD,
163
+ cast(Type[COORD], WindowsCoordinates),
164
+ ctypes.POINTER(wintypes.DWORD),
165
+ ]
166
+ _FillConsoleOutputAttribute.restype = wintypes.BOOL
167
+
168
+
169
+ def FillConsoleOutputAttribute(
170
+ std_handle: wintypes.HANDLE,
171
+ attributes: int,
172
+ length: int,
173
+ start: WindowsCoordinates,
174
+ ) -> int:
175
+ """Sets the character attributes for a specified number of character cells,
176
+ beginning at the specified coordinates in a screen buffer.
177
+
178
+ Args:
179
+ std_handle (wintypes.HANDLE): A handle to the console input buffer or the console screen buffer.
180
+ attributes (int): Integer value representing the foreground and background colours of the cells.
181
+ length (int): The number of cells to set the output attribute of.
182
+ start (WindowsCoordinates): The coordinates of the first cell whose attributes are to be set.
183
+
184
+ Returns:
185
+ int: The number of cells whose attributes were actually set.
186
+ """
187
+ num_cells = wintypes.DWORD(length)
188
+ style_attrs = wintypes.WORD(attributes)
189
+ num_written = wintypes.DWORD(0)
190
+ _FillConsoleOutputAttribute(
191
+ std_handle, style_attrs, num_cells, start, byref(num_written)
192
+ )
193
+ return num_written.value
194
+
195
+
196
+ _SetConsoleTextAttribute = windll.kernel32.SetConsoleTextAttribute
197
+ _SetConsoleTextAttribute.argtypes = [
198
+ wintypes.HANDLE,
199
+ wintypes.WORD,
200
+ ]
201
+ _SetConsoleTextAttribute.restype = wintypes.BOOL
202
+
203
+
204
+ def SetConsoleTextAttribute(
205
+ std_handle: wintypes.HANDLE, attributes: wintypes.WORD
206
+ ) -> bool:
207
+ """Set the colour attributes for all text written after this function is called.
208
+
209
+ Args:
210
+ std_handle (wintypes.HANDLE): A handle to the console input buffer or the console screen buffer.
211
+ attributes (int): Integer value representing the foreground and background colours.
212
+
213
+
214
+ Returns:
215
+ bool: True if the attribute was set successfully, otherwise False.
216
+ """
217
+ return bool(_SetConsoleTextAttribute(std_handle, attributes))
218
+
219
+
220
+ _GetConsoleScreenBufferInfo = windll.kernel32.GetConsoleScreenBufferInfo
221
+ _GetConsoleScreenBufferInfo.argtypes = [
222
+ wintypes.HANDLE,
223
+ ctypes.POINTER(CONSOLE_SCREEN_BUFFER_INFO),
224
+ ]
225
+ _GetConsoleScreenBufferInfo.restype = wintypes.BOOL
226
+
227
+
228
+ def GetConsoleScreenBufferInfo(
229
+ std_handle: wintypes.HANDLE,
230
+ ) -> CONSOLE_SCREEN_BUFFER_INFO:
231
+ """Retrieves information about the specified console screen buffer.
232
+
233
+ Args:
234
+ std_handle (wintypes.HANDLE): A handle to the console input buffer or the console screen buffer.
235
+
236
+ Returns:
237
+ CONSOLE_SCREEN_BUFFER_INFO: A CONSOLE_SCREEN_BUFFER_INFO ctype struct contain information about
238
+ screen size, cursor position, colour attributes, and more."""
239
+ console_screen_buffer_info = CONSOLE_SCREEN_BUFFER_INFO()
240
+ _GetConsoleScreenBufferInfo(std_handle, byref(console_screen_buffer_info))
241
+ return console_screen_buffer_info
242
+
243
+
244
+ _SetConsoleCursorPosition = windll.kernel32.SetConsoleCursorPosition
245
+ _SetConsoleCursorPosition.argtypes = [
246
+ wintypes.HANDLE,
247
+ cast(Type[COORD], WindowsCoordinates),
248
+ ]
249
+ _SetConsoleCursorPosition.restype = wintypes.BOOL
250
+
251
+
252
+ def SetConsoleCursorPosition(
253
+ std_handle: wintypes.HANDLE, coords: WindowsCoordinates
254
+ ) -> bool:
255
+ """Set the position of the cursor in the console screen
256
+
257
+ Args:
258
+ std_handle (wintypes.HANDLE): A handle to the console input buffer or the console screen buffer.
259
+ coords (WindowsCoordinates): The coordinates to move the cursor to.
260
+
261
+ Returns:
262
+ bool: True if the function succeeds, otherwise False.
263
+ """
264
+ return bool(_SetConsoleCursorPosition(std_handle, coords))
265
+
266
+
267
+ _GetConsoleCursorInfo = windll.kernel32.GetConsoleCursorInfo
268
+ _GetConsoleCursorInfo.argtypes = [
269
+ wintypes.HANDLE,
270
+ ctypes.POINTER(CONSOLE_CURSOR_INFO),
271
+ ]
272
+ _GetConsoleCursorInfo.restype = wintypes.BOOL
273
+
274
+
275
+ def GetConsoleCursorInfo(
276
+ std_handle: wintypes.HANDLE, cursor_info: CONSOLE_CURSOR_INFO
277
+ ) -> bool:
278
+ """Get the cursor info - used to get cursor visibility and width
279
+
280
+ Args:
281
+ std_handle (wintypes.HANDLE): A handle to the console input buffer or the console screen buffer.
282
+ cursor_info (CONSOLE_CURSOR_INFO): CONSOLE_CURSOR_INFO ctype struct that receives information
283
+ about the console's cursor.
284
+
285
+ Returns:
286
+ bool: True if the function succeeds, otherwise False.
287
+ """
288
+ return bool(_GetConsoleCursorInfo(std_handle, byref(cursor_info)))
289
+
290
+
291
+ _SetConsoleCursorInfo = windll.kernel32.SetConsoleCursorInfo
292
+ _SetConsoleCursorInfo.argtypes = [
293
+ wintypes.HANDLE,
294
+ ctypes.POINTER(CONSOLE_CURSOR_INFO),
295
+ ]
296
+ _SetConsoleCursorInfo.restype = wintypes.BOOL
297
+
298
+
299
+ def SetConsoleCursorInfo(
300
+ std_handle: wintypes.HANDLE, cursor_info: CONSOLE_CURSOR_INFO
301
+ ) -> bool:
302
+ """Set the cursor info - used for adjusting cursor visibility and width
303
+
304
+ Args:
305
+ std_handle (wintypes.HANDLE): A handle to the console input buffer or the console screen buffer.
306
+ cursor_info (CONSOLE_CURSOR_INFO): CONSOLE_CURSOR_INFO ctype struct containing the new cursor info.
307
+
308
+ Returns:
309
+ bool: True if the function succeeds, otherwise False.
310
+ """
311
+ return bool(_SetConsoleCursorInfo(std_handle, byref(cursor_info)))
312
+
313
+
314
+ _SetConsoleTitle = windll.kernel32.SetConsoleTitleW
315
+ _SetConsoleTitle.argtypes = [wintypes.LPCWSTR]
316
+ _SetConsoleTitle.restype = wintypes.BOOL
317
+
318
+
319
+ def SetConsoleTitle(title: str) -> bool:
320
+ """Sets the title of the current console window
321
+
322
+ Args:
323
+ title (str): The new title of the console window.
324
+
325
+ Returns:
326
+ bool: True if the function succeeds, otherwise False.
327
+ """
328
+ return bool(_SetConsoleTitle(title))
329
+
330
+
331
+ class LegacyWindowsTerm:
332
+ """This class allows interaction with the legacy Windows Console API. It should only be used in the context
333
+ of environments where virtual terminal processing is not available. However, if it is used in a Windows environment,
334
+ the entire API should work.
335
+
336
+ Args:
337
+ file (IO[str]): The file which the Windows Console API HANDLE is retrieved from, defaults to sys.stdout.
338
+ """
339
+
340
+ BRIGHT_BIT = 8
341
+
342
+ # Indices are ANSI color numbers, values are the corresponding Windows Console API color numbers
343
+ ANSI_TO_WINDOWS = [
344
+ 0, # black The Windows colours are defined in wincon.h as follows:
345
+ 4, # red define FOREGROUND_BLUE 0x0001 -- 0000 0001
346
+ 2, # green define FOREGROUND_GREEN 0x0002 -- 0000 0010
347
+ 6, # yellow define FOREGROUND_RED 0x0004 -- 0000 0100
348
+ 1, # blue define FOREGROUND_INTENSITY 0x0008 -- 0000 1000
349
+ 5, # magenta define BACKGROUND_BLUE 0x0010 -- 0001 0000
350
+ 3, # cyan define BACKGROUND_GREEN 0x0020 -- 0010 0000
351
+ 7, # white define BACKGROUND_RED 0x0040 -- 0100 0000
352
+ 8, # bright black (grey) define BACKGROUND_INTENSITY 0x0080 -- 1000 0000
353
+ 12, # bright red
354
+ 10, # bright green
355
+ 14, # bright yellow
356
+ 9, # bright blue
357
+ 13, # bright magenta
358
+ 11, # bright cyan
359
+ 15, # bright white
360
+ ]
361
+
362
+ def __init__(self, file: "IO[str]") -> None:
363
+ handle = GetStdHandle(STDOUT)
364
+ self._handle = handle
365
+ default_text = GetConsoleScreenBufferInfo(handle).wAttributes
366
+ self._default_text = default_text
367
+
368
+ self._default_fore = default_text & 7
369
+ self._default_back = (default_text >> 4) & 7
370
+ self._default_attrs = self._default_fore | (self._default_back << 4)
371
+
372
+ self._file = file
373
+ self.write = file.write
374
+ self.flush = file.flush
375
+
376
+ @property
377
+ def cursor_position(self) -> WindowsCoordinates:
378
+ """Returns the current position of the cursor (0-based)
379
+
380
+ Returns:
381
+ WindowsCoordinates: The current cursor position.
382
+ """
383
+ coord: COORD = GetConsoleScreenBufferInfo(self._handle).dwCursorPosition
384
+ return WindowsCoordinates(row=coord.Y, col=coord.X)
385
+
386
+ @property
387
+ def screen_size(self) -> WindowsCoordinates:
388
+ """Returns the current size of the console screen buffer, in character columns and rows
389
+
390
+ Returns:
391
+ WindowsCoordinates: The width and height of the screen as WindowsCoordinates.
392
+ """
393
+ screen_size: COORD = GetConsoleScreenBufferInfo(self._handle).dwSize
394
+ return WindowsCoordinates(row=screen_size.Y, col=screen_size.X)
395
+
396
+ def write_text(self, text: str) -> None:
397
+ """Write text directly to the terminal without any modification of styles
398
+
399
+ Args:
400
+ text (str): The text to write to the console
401
+ """
402
+ self.write(text)
403
+ self.flush()
404
+
405
+ def write_styled(self, text: str, style: Style) -> None:
406
+ """Write styled text to the terminal.
407
+
408
+ Args:
409
+ text (str): The text to write
410
+ style (Style): The style of the text
411
+ """
412
+ color = style.color
413
+ bgcolor = style.bgcolor
414
+ if style.reverse:
415
+ color, bgcolor = bgcolor, color
416
+
417
+ if color:
418
+ fore = color.downgrade(ColorSystem.WINDOWS).number
419
+ fore = fore if fore is not None else 7 # Default to ANSI 7: White
420
+ if style.bold:
421
+ fore = fore | self.BRIGHT_BIT
422
+ if style.dim:
423
+ fore = fore & ~self.BRIGHT_BIT
424
+ fore = self.ANSI_TO_WINDOWS[fore]
425
+ else:
426
+ fore = self._default_fore
427
+
428
+ if bgcolor:
429
+ back = bgcolor.downgrade(ColorSystem.WINDOWS).number
430
+ back = back if back is not None else 0 # Default to ANSI 0: Black
431
+ back = self.ANSI_TO_WINDOWS[back]
432
+ else:
433
+ back = self._default_back
434
+
435
+ assert fore is not None
436
+ assert back is not None
437
+
438
+ SetConsoleTextAttribute(
439
+ self._handle, attributes=ctypes.c_ushort(fore | (back << 4))
440
+ )
441
+ self.write_text(text)
442
+ SetConsoleTextAttribute(self._handle, attributes=self._default_text)
443
+
444
+ def move_cursor_to(self, new_position: WindowsCoordinates) -> None:
445
+ """Set the position of the cursor
446
+
447
+ Args:
448
+ new_position (WindowsCoordinates): The WindowsCoordinates representing the new position of the cursor.
449
+ """
450
+ if new_position.col < 0 or new_position.row < 0:
451
+ return
452
+ SetConsoleCursorPosition(self._handle, coords=new_position)
453
+
454
+ def erase_line(self) -> None:
455
+ """Erase all content on the line the cursor is currently located at"""
456
+ screen_size = self.screen_size
457
+ cursor_position = self.cursor_position
458
+ cells_to_erase = screen_size.col
459
+ start_coordinates = WindowsCoordinates(row=cursor_position.row, col=0)
460
+ FillConsoleOutputCharacter(
461
+ self._handle, " ", length=cells_to_erase, start=start_coordinates
462
+ )
463
+ FillConsoleOutputAttribute(
464
+ self._handle,
465
+ self._default_attrs,
466
+ length=cells_to_erase,
467
+ start=start_coordinates,
468
+ )
469
+
470
+ def erase_end_of_line(self) -> None:
471
+ """Erase all content from the cursor position to the end of that line"""
472
+ cursor_position = self.cursor_position
473
+ cells_to_erase = self.screen_size.col - cursor_position.col
474
+ FillConsoleOutputCharacter(
475
+ self._handle, " ", length=cells_to_erase, start=cursor_position
476
+ )
477
+ FillConsoleOutputAttribute(
478
+ self._handle,
479
+ self._default_attrs,
480
+ length=cells_to_erase,
481
+ start=cursor_position,
482
+ )
483
+
484
+ def erase_start_of_line(self) -> None:
485
+ """Erase all content from the cursor position to the start of that line"""
486
+ row, col = self.cursor_position
487
+ start = WindowsCoordinates(row, 0)
488
+ FillConsoleOutputCharacter(self._handle, " ", length=col, start=start)
489
+ FillConsoleOutputAttribute(
490
+ self._handle, self._default_attrs, length=col, start=start
491
+ )
492
+
493
+ def move_cursor_up(self) -> None:
494
+ """Move the cursor up a single cell"""
495
+ cursor_position = self.cursor_position
496
+ SetConsoleCursorPosition(
497
+ self._handle,
498
+ coords=WindowsCoordinates(
499
+ row=cursor_position.row - 1, col=cursor_position.col
500
+ ),
501
+ )
502
+
503
+ def move_cursor_down(self) -> None:
504
+ """Move the cursor down a single cell"""
505
+ cursor_position = self.cursor_position
506
+ SetConsoleCursorPosition(
507
+ self._handle,
508
+ coords=WindowsCoordinates(
509
+ row=cursor_position.row + 1,
510
+ col=cursor_position.col,
511
+ ),
512
+ )
513
+
514
+ def move_cursor_forward(self) -> None:
515
+ """Move the cursor forward a single cell. Wrap to the next line if required."""
516
+ row, col = self.cursor_position
517
+ if col == self.screen_size.col - 1:
518
+ row += 1
519
+ col = 0
520
+ else:
521
+ col += 1
522
+ SetConsoleCursorPosition(
523
+ self._handle, coords=WindowsCoordinates(row=row, col=col)
524
+ )
525
+
526
+ def move_cursor_to_column(self, column: int) -> None:
527
+ """Move cursor to the column specified by the zero-based column index, staying on the same row
528
+
529
+ Args:
530
+ column (int): The zero-based column index to move the cursor to.
531
+ """
532
+ row, _ = self.cursor_position
533
+ SetConsoleCursorPosition(self._handle, coords=WindowsCoordinates(row, column))
534
+
535
+ def move_cursor_backward(self) -> None:
536
+ """Move the cursor backward a single cell. Wrap to the previous line if required."""
537
+ row, col = self.cursor_position
538
+ if col == 0:
539
+ row -= 1
540
+ col = self.screen_size.col - 1
541
+ else:
542
+ col -= 1
543
+ SetConsoleCursorPosition(
544
+ self._handle, coords=WindowsCoordinates(row=row, col=col)
545
+ )
546
+
547
+ def hide_cursor(self) -> None:
548
+ """Hide the cursor"""
549
+ current_cursor_size = self._get_cursor_size()
550
+ invisible_cursor = CONSOLE_CURSOR_INFO(dwSize=current_cursor_size, bVisible=0)
551
+ SetConsoleCursorInfo(self._handle, cursor_info=invisible_cursor)
552
+
553
+ def show_cursor(self) -> None:
554
+ """Show the cursor"""
555
+ current_cursor_size = self._get_cursor_size()
556
+ visible_cursor = CONSOLE_CURSOR_INFO(dwSize=current_cursor_size, bVisible=1)
557
+ SetConsoleCursorInfo(self._handle, cursor_info=visible_cursor)
558
+
559
+ def set_title(self, title: str) -> None:
560
+ """Set the title of the terminal window
561
+
562
+ Args:
563
+ title (str): The new title of the console window
564
+ """
565
+ assert len(title) < 255, "Console title must be less than 255 characters"
566
+ SetConsoleTitle(title)
567
+
568
+ def _get_cursor_size(self) -> int:
569
+ """Get the percentage of the character cell that is filled by the cursor"""
570
+ cursor_info = CONSOLE_CURSOR_INFO()
571
+ GetConsoleCursorInfo(self._handle, cursor_info=cursor_info)
572
+ return int(cursor_info.dwSize)
573
+
574
+
575
+ if __name__ == "__main__":
576
+ handle = GetStdHandle()
577
+
578
+ from rich.console import Console
579
+
580
+ console = Console()
581
+
582
+ term = LegacyWindowsTerm(sys.stdout)
583
+ term.set_title("Win32 Console Examples")
584
+
585
+ style = Style(color="black", bgcolor="red")
586
+
587
+ heading = Style.parse("black on green")
588
+
589
+ # Check colour output
590
+ console.rule("Checking colour output")
591
+ console.print("[on red]on red!")
592
+ console.print("[blue]blue!")
593
+ console.print("[yellow]yellow!")
594
+ console.print("[bold yellow]bold yellow!")
595
+ console.print("[bright_yellow]bright_yellow!")
596
+ console.print("[dim bright_yellow]dim bright_yellow!")
597
+ console.print("[italic cyan]italic cyan!")
598
+ console.print("[bold white on blue]bold white on blue!")
599
+ console.print("[reverse bold white on blue]reverse bold white on blue!")
600
+ console.print("[bold black on cyan]bold black on cyan!")
601
+ console.print("[black on green]black on green!")
602
+ console.print("[blue on green]blue on green!")
603
+ console.print("[white on black]white on black!")
604
+ console.print("[black on white]black on white!")
605
+ console.print("[#1BB152 on #DA812D]#1BB152 on #DA812D!")
606
+
607
+ # Check cursor movement
608
+ console.rule("Checking cursor movement")
609
+ console.print()
610
+ term.move_cursor_backward()
611
+ term.move_cursor_backward()
612
+ term.write_text("went back and wrapped to prev line")
613
+ time.sleep(1)
614
+ term.move_cursor_up()
615
+ term.write_text("we go up")
616
+ time.sleep(1)
617
+ term.move_cursor_down()
618
+ term.write_text("and down")
619
+ time.sleep(1)
620
+ term.move_cursor_up()
621
+ term.move_cursor_backward()
622
+ term.move_cursor_backward()
623
+ term.write_text("we went up and back 2")
624
+ time.sleep(1)
625
+ term.move_cursor_down()
626
+ term.move_cursor_backward()
627
+ term.move_cursor_backward()
628
+ term.write_text("we went down and back 2")
629
+ time.sleep(1)
630
+
631
+ # Check erasing of lines
632
+ term.hide_cursor()
633
+ console.print()
634
+ console.rule("Checking line erasing")
635
+ console.print("\n...Deleting to the start of the line...")
636
+ term.write_text("The red arrow shows the cursor location, and direction of erase")
637
+ time.sleep(1)
638
+ term.move_cursor_to_column(16)
639
+ term.write_styled("<", Style.parse("black on red"))
640
+ term.move_cursor_backward()
641
+ time.sleep(1)
642
+ term.erase_start_of_line()
643
+ time.sleep(1)
644
+
645
+ console.print("\n\n...And to the end of the line...")
646
+ term.write_text("The red arrow shows the cursor location, and direction of erase")
647
+ time.sleep(1)
648
+
649
+ term.move_cursor_to_column(16)
650
+ term.write_styled(">", Style.parse("black on red"))
651
+ time.sleep(1)
652
+ term.erase_end_of_line()
653
+ time.sleep(1)
654
+
655
+ console.print("\n\n...Now the whole line will be erased...")
656
+ term.write_styled("I'm going to disappear!", style=Style.parse("black on cyan"))
657
+ time.sleep(1)
658
+ term.erase_line()
659
+
660
+ term.show_cursor()
661
+ print("\n")
TTS/Kokoro/.venv/Lib/site-packages/rich/_windows.py ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import sys
2
+ from dataclasses import dataclass
3
+
4
+
5
+ @dataclass
6
+ class WindowsConsoleFeatures:
7
+ """Windows features available."""
8
+
9
+ vt: bool = False
10
+ """The console supports VT codes."""
11
+ truecolor: bool = False
12
+ """The console supports truecolor."""
13
+
14
+
15
+ try:
16
+ import ctypes
17
+ from ctypes import LibraryLoader
18
+
19
+ if sys.platform == "win32":
20
+ windll = LibraryLoader(ctypes.WinDLL)
21
+ else:
22
+ windll = None
23
+ raise ImportError("Not windows")
24
+
25
+ from rich._win32_console import (
26
+ ENABLE_VIRTUAL_TERMINAL_PROCESSING,
27
+ GetConsoleMode,
28
+ GetStdHandle,
29
+ LegacyWindowsError,
30
+ )
31
+
32
+ except (AttributeError, ImportError, ValueError):
33
+ # Fallback if we can't load the Windows DLL
34
+ def get_windows_console_features() -> WindowsConsoleFeatures:
35
+ features = WindowsConsoleFeatures()
36
+ return features
37
+
38
+ else:
39
+
40
+ def get_windows_console_features() -> WindowsConsoleFeatures:
41
+ """Get windows console features.
42
+
43
+ Returns:
44
+ WindowsConsoleFeatures: An instance of WindowsConsoleFeatures.
45
+ """
46
+ handle = GetStdHandle()
47
+ try:
48
+ console_mode = GetConsoleMode(handle)
49
+ success = True
50
+ except LegacyWindowsError:
51
+ console_mode = 0
52
+ success = False
53
+ vt = bool(success and console_mode & ENABLE_VIRTUAL_TERMINAL_PROCESSING)
54
+ truecolor = False
55
+ if vt:
56
+ win_version = sys.getwindowsversion()
57
+ truecolor = win_version.major > 10 or (
58
+ win_version.major == 10 and win_version.build >= 15063
59
+ )
60
+ features = WindowsConsoleFeatures(vt=vt, truecolor=truecolor)
61
+ return features
62
+
63
+
64
+ if __name__ == "__main__":
65
+ import platform
66
+
67
+ features = get_windows_console_features()
68
+ from rich import print
69
+
70
+ print(f'platform="{platform.system()}"')
71
+ print(repr(features))
TTS/Kokoro/.venv/Lib/site-packages/rich/_windows_renderer.py ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import Iterable, Sequence, Tuple, cast
2
+
3
+ from rich._win32_console import LegacyWindowsTerm, WindowsCoordinates
4
+ from rich.segment import ControlCode, ControlType, Segment
5
+
6
+
7
+ def legacy_windows_render(buffer: Iterable[Segment], term: LegacyWindowsTerm) -> None:
8
+ """Makes appropriate Windows Console API calls based on the segments in the buffer.
9
+
10
+ Args:
11
+ buffer (Iterable[Segment]): Iterable of Segments to convert to Win32 API calls.
12
+ term (LegacyWindowsTerm): Used to call the Windows Console API.
13
+ """
14
+ for text, style, control in buffer:
15
+ if not control:
16
+ if style:
17
+ term.write_styled(text, style)
18
+ else:
19
+ term.write_text(text)
20
+ else:
21
+ control_codes: Sequence[ControlCode] = control
22
+ for control_code in control_codes:
23
+ control_type = control_code[0]
24
+ if control_type == ControlType.CURSOR_MOVE_TO:
25
+ _, x, y = cast(Tuple[ControlType, int, int], control_code)
26
+ term.move_cursor_to(WindowsCoordinates(row=y - 1, col=x - 1))
27
+ elif control_type == ControlType.CARRIAGE_RETURN:
28
+ term.write_text("\r")
29
+ elif control_type == ControlType.HOME:
30
+ term.move_cursor_to(WindowsCoordinates(0, 0))
31
+ elif control_type == ControlType.CURSOR_UP:
32
+ term.move_cursor_up()
33
+ elif control_type == ControlType.CURSOR_DOWN:
34
+ term.move_cursor_down()
35
+ elif control_type == ControlType.CURSOR_FORWARD:
36
+ term.move_cursor_forward()
37
+ elif control_type == ControlType.CURSOR_BACKWARD:
38
+ term.move_cursor_backward()
39
+ elif control_type == ControlType.CURSOR_MOVE_TO_COLUMN:
40
+ _, column = cast(Tuple[ControlType, int], control_code)
41
+ term.move_cursor_to_column(column - 1)
42
+ elif control_type == ControlType.HIDE_CURSOR:
43
+ term.hide_cursor()
44
+ elif control_type == ControlType.SHOW_CURSOR:
45
+ term.show_cursor()
46
+ elif control_type == ControlType.ERASE_IN_LINE:
47
+ _, mode = cast(Tuple[ControlType, int], control_code)
48
+ if mode == 0:
49
+ term.erase_end_of_line()
50
+ elif mode == 1:
51
+ term.erase_start_of_line()
52
+ elif mode == 2:
53
+ term.erase_line()
54
+ elif control_type == ControlType.SET_WINDOW_TITLE:
55
+ _, title = cast(Tuple[ControlType, str], control_code)
56
+ term.set_title(title)
TTS/Kokoro/.venv/Lib/site-packages/rich/_wrap.py ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from __future__ import annotations
2
+
3
+ import re
4
+ from typing import Iterable
5
+
6
+ from ._loop import loop_last
7
+ from .cells import cell_len, chop_cells
8
+
9
+ re_word = re.compile(r"\s*\S+\s*")
10
+
11
+
12
+ def words(text: str) -> Iterable[tuple[int, int, str]]:
13
+ """Yields each word from the text as a tuple
14
+ containing (start_index, end_index, word). A "word" in this context may
15
+ include the actual word and any whitespace to the right.
16
+ """
17
+ position = 0
18
+ word_match = re_word.match(text, position)
19
+ while word_match is not None:
20
+ start, end = word_match.span()
21
+ word = word_match.group(0)
22
+ yield start, end, word
23
+ word_match = re_word.match(text, end)
24
+
25
+
26
+ def divide_line(text: str, width: int, fold: bool = True) -> list[int]:
27
+ """Given a string of text, and a width (measured in cells), return a list
28
+ of cell offsets which the string should be split at in order for it to fit
29
+ within the given width.
30
+
31
+ Args:
32
+ text: The text to examine.
33
+ width: The available cell width.
34
+ fold: If True, words longer than `width` will be folded onto a new line.
35
+
36
+ Returns:
37
+ A list of indices to break the line at.
38
+ """
39
+ break_positions: list[int] = [] # offsets to insert the breaks at
40
+ append = break_positions.append
41
+ cell_offset = 0
42
+ _cell_len = cell_len
43
+
44
+ for start, _end, word in words(text):
45
+ word_length = _cell_len(word.rstrip())
46
+ remaining_space = width - cell_offset
47
+ word_fits_remaining_space = remaining_space >= word_length
48
+
49
+ if word_fits_remaining_space:
50
+ # Simplest case - the word fits within the remaining width for this line.
51
+ cell_offset += _cell_len(word)
52
+ else:
53
+ # Not enough space remaining for this word on the current line.
54
+ if word_length > width:
55
+ # The word doesn't fit on any line, so we can't simply
56
+ # place it on the next line...
57
+ if fold:
58
+ # Fold the word across multiple lines.
59
+ folded_word = chop_cells(word, width=width)
60
+ for last, line in loop_last(folded_word):
61
+ if start:
62
+ append(start)
63
+ if last:
64
+ cell_offset = _cell_len(line)
65
+ else:
66
+ start += len(line)
67
+ else:
68
+ # Folding isn't allowed, so crop the word.
69
+ if start:
70
+ append(start)
71
+ cell_offset = _cell_len(word)
72
+ elif cell_offset and start:
73
+ # The word doesn't fit within the remaining space on the current
74
+ # line, but it *can* fit on to the next (empty) line.
75
+ append(start)
76
+ cell_offset = _cell_len(word)
77
+
78
+ return break_positions
79
+
80
+
81
+ if __name__ == "__main__": # pragma: no cover
82
+ from .console import Console
83
+
84
+ console = Console(width=10)
85
+ console.print("12345 abcdefghijklmnopqrstuvwyxzABCDEFGHIJKLMNOPQRSTUVWXYZ 12345")
86
+ print(chop_cells("abcdefghijklmnopqrstuvwxyz", 10))
87
+
88
+ console = Console(width=20)
89
+ console.rule()
90
+ console.print("TextualはPythonの高速アプリケーション開発フレームワークです")
91
+
92
+ console.rule()
93
+ console.print("アプリケーションは1670万色を使用でき")
TTS/Kokoro/.venv/Lib/site-packages/rpds/__init__.py ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ from .rpds import *
2
+
3
+ __doc__ = rpds.__doc__
4
+ if hasattr(rpds, "__all__"):
5
+ __all__ = rpds.__all__
TTS/Kokoro/.venv/Lib/site-packages/rpds/__init__.pyi ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from collections.abc import (
2
+ ItemsView,
3
+ Iterable,
4
+ Iterator,
5
+ KeysView,
6
+ Mapping,
7
+ ValuesView,
8
+ )
9
+ from typing import (
10
+ TypeVar,
11
+ )
12
+
13
+ _T = TypeVar("_T")
14
+ _KT_co = TypeVar("_KT_co", covariant=True)
15
+ _VT_co = TypeVar("_VT_co", covariant=True)
16
+ _KU_co = TypeVar("_KU_co", covariant=True)
17
+ _VU_co = TypeVar("_VU_co", covariant=True)
18
+
19
+ class HashTrieMap(Mapping[_KT_co, _VT_co]):
20
+ def __init__(
21
+ self,
22
+ value: Mapping[_KT_co, _VT_co] | Iterable[tuple[_KT_co, _VT_co]] = {},
23
+ **kwds: Mapping[_KT_co, _VT_co],
24
+ ): ...
25
+ def __getitem__(self, key: _KT_co) -> _VT_co: ...
26
+ def __iter__(self) -> Iterator[_KT_co]: ...
27
+ def __len__(self) -> int: ...
28
+ def discard(self, key: _KT_co) -> HashTrieMap[_KT_co, _VT_co]: ...
29
+ def items(self) -> ItemsView[_KT_co, _VT_co]: ...
30
+ def keys(self) -> KeysView[_KT_co]: ...
31
+ def values(self) -> ValuesView[_VT_co]: ...
32
+ def remove(self, key: _KT_co) -> HashTrieMap[_KT_co, _VT_co]: ...
33
+ def insert(
34
+ self,
35
+ key: _KT_co,
36
+ val: _VT_co,
37
+ ) -> HashTrieMap[_KT_co, _VT_co]: ...
38
+ def update(
39
+ self,
40
+ *args: Mapping[_KU_co, _VU_co] | Iterable[tuple[_KU_co, _VU_co]],
41
+ ) -> HashTrieMap[_KT_co | _KU_co, _VT_co | _VU_co]: ...
42
+ @classmethod
43
+ def convert(
44
+ cls,
45
+ value: Mapping[_KT_co, _VT_co] | Iterable[tuple[_KT_co, _VT_co]],
46
+ ) -> HashTrieMap[_KT_co, _VT_co]: ...
47
+ @classmethod
48
+ def fromkeys(
49
+ cls,
50
+ keys: Iterable[_KT_co],
51
+ value: _VT_co = None,
52
+ ) -> HashTrieMap[_KT_co, _VT_co]: ...
53
+
54
+ class HashTrieSet(frozenset[_T]):
55
+ def __init__(self, value: Iterable[_T] = ()): ...
56
+ def __iter__(self) -> Iterator[_T]: ...
57
+ def __len__(self) -> int: ...
58
+ def discard(self, value: _T) -> HashTrieSet[_T]: ...
59
+ def remove(self, value: _T) -> HashTrieSet[_T]: ...
60
+ def insert(self, value: _T) -> HashTrieSet[_T]: ...
61
+ def update(self, *args: Iterable[_T]) -> HashTrieSet[_T]: ...
62
+
63
+ class List(Iterable[_T]):
64
+ def __init__(self, value: Iterable[_T] = (), *more: _T): ...
65
+ def __iter__(self) -> Iterator[_T]: ...
66
+ def __len__(self) -> int: ...
67
+ def push_front(self, value: _T) -> List[_T]: ...
68
+ def drop_first(self) -> List[_T]: ...
69
+
70
+ class Queue(Iterable[_T]):
71
+ def __init__(self, value: Iterable[_T] = (), *more: _T): ...
72
+ def __iter__(self) -> Iterator[_T]: ...
73
+ def __len__(self) -> int: ...
74
+ def enqueue(self, value: _T) -> Queue[_T]: ...
75
+ def dequeue(self, value: _T) -> Queue[_T]: ...
76
+ @property
77
+ def is_empty(self) -> _T: ...
78
+ @property
79
+ def peek(self) -> _T: ...
TTS/Kokoro/.venv/Lib/site-packages/rpds/py.typed ADDED
File without changes
TTS/Kokoro/.venv/Lib/site-packages/rpds_py-0.30.0.dist-info/INSTALLER ADDED
@@ -0,0 +1 @@
 
 
1
+ pip
TTS/Kokoro/.venv/Lib/site-packages/rpds_py-0.30.0.dist-info/METADATA ADDED
@@ -0,0 +1,99 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Metadata-Version: 2.4
2
+ Name: rpds-py
3
+ Version: 0.30.0
4
+ Classifier: Development Status :: 3 - Alpha
5
+ Classifier: Intended Audience :: Developers
6
+ Classifier: Operating System :: OS Independent
7
+ Classifier: Programming Language :: Rust
8
+ Classifier: Programming Language :: Python :: 3.10
9
+ Classifier: Programming Language :: Python :: 3.11
10
+ Classifier: Programming Language :: Python :: 3.12
11
+ Classifier: Programming Language :: Python :: 3.13
12
+ Classifier: Programming Language :: Python :: 3.14
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: Implementation :: CPython
15
+ Classifier: Programming Language :: Python :: Implementation :: PyPy
16
+ License-File: LICENSE
17
+ Summary: Python bindings to Rust's persistent data structures (rpds)
18
+ Keywords: data structures,rust,persistent
19
+ Author-email: Julian Berman <Julian+rpds@GrayVines.com>
20
+ License-Expression: MIT
21
+ Requires-Python: >=3.10
22
+ Description-Content-Type: text/x-rst; charset=UTF-8
23
+ Project-URL: Documentation, https://rpds.readthedocs.io/
24
+ Project-URL: Homepage, https://github.com/crate-py/rpds
25
+ Project-URL: Issues, https://github.com/crate-py/rpds/issues/
26
+ Project-URL: Funding, https://github.com/sponsors/Julian
27
+ Project-URL: Tidelift, https://tidelift.com/subscription/pkg/pypi-rpds-py?utm_source=pypi-rpds-py&utm_medium=referral&utm_campaign=pypi-link
28
+ Project-URL: Source, https://github.com/crate-py/rpds
29
+ Project-URL: Upstream, https://github.com/orium/rpds
30
+
31
+ ===========
32
+ ``rpds.py``
33
+ ===========
34
+
35
+ |PyPI| |Pythons| |CI|
36
+
37
+ .. |PyPI| image:: https://img.shields.io/pypi/v/rpds-py.svg
38
+ :alt: PyPI version
39
+ :target: https://pypi.org/project/rpds-py/
40
+
41
+ .. |Pythons| image:: https://img.shields.io/pypi/pyversions/rpds-py.svg
42
+ :alt: Supported Python versions
43
+ :target: https://pypi.org/project/rpds-py/
44
+
45
+ .. |CI| image:: https://github.com/crate-py/rpds/workflows/CI/badge.svg
46
+ :alt: Build status
47
+ :target: https://github.com/crate-py/rpds/actions?query=workflow%3ACI
48
+
49
+ .. |ReadTheDocs| image:: https://readthedocs.org/projects/referencing/badge/?version=stable&style=flat
50
+ :alt: ReadTheDocs status
51
+ :target: https://referencing.readthedocs.io/en/stable/
52
+
53
+
54
+ Python bindings to the `Rust rpds crate <https://docs.rs/rpds/>`_ for persistent data structures.
55
+
56
+ What's here is quite minimal (in transparency, it was written initially to support replacing ``pyrsistent`` in the `referencing library <https://github.com/python-jsonschema/referencing>`_).
57
+ If you see something missing (which is very likely), a PR is definitely welcome to add it.
58
+
59
+ Installation
60
+ ------------
61
+
62
+ The distribution on PyPI is named ``rpds.py`` (equivalently ``rpds-py``), and thus can be installed via e.g.:
63
+
64
+ .. code:: sh
65
+
66
+ $ pip install rpds-py
67
+
68
+ Note that if you install ``rpds-py`` from source, you will need a Rust toolchain installed, as it is a build-time dependency.
69
+ An example of how to do so in a ``Dockerfile`` can be found `here <https://github.com/bowtie-json-schema/bowtie/blob/e77fd93598cb6e7dc1b8b1f53c00e5aa410c201a/implementations/python-jsonschema/Dockerfile#L1-L8>`_.
70
+
71
+ If you believe you are on a common platform which should have wheels built (i.e. and not need to compile from source), feel free to file an issue or pull request modifying the GitHub action used here to build wheels via ``maturin``.
72
+
73
+ Usage
74
+ -----
75
+
76
+ Methods in general are named similarly to their ``rpds`` counterparts (rather than ``pyrsistent``\ 's conventions, though probably a full drop-in ``pyrsistent``\ -compatible wrapper module is a good addition at some point).
77
+
78
+ .. code:: python
79
+
80
+ >>> from rpds import HashTrieMap, HashTrieSet, List
81
+
82
+ >>> m = HashTrieMap({"foo": "bar", "baz": "quux"})
83
+ >>> m.insert("spam", 37) == HashTrieMap({"foo": "bar", "baz": "quux", "spam": 37})
84
+ True
85
+ >>> m.remove("foo") == HashTrieMap({"baz": "quux"})
86
+ True
87
+
88
+ >>> s = HashTrieSet({"foo", "bar", "baz", "quux"})
89
+ >>> s.insert("spam") == HashTrieSet({"foo", "bar", "baz", "quux", "spam"})
90
+ True
91
+ >>> s.remove("foo") == HashTrieSet({"bar", "baz", "quux"})
92
+ True
93
+
94
+ >>> L = List([1, 3, 5])
95
+ >>> L.push_front(-1) == List([-1, 1, 3, 5])
96
+ True
97
+ >>> L.rest == List([3, 5])
98
+ True
99
+
TTS/Kokoro/.venv/Lib/site-packages/rpds_py-0.30.0.dist-info/RECORD ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ rpds/__init__.py,sha256=w3MgXW7lpTCICw0KXbw20QX573_kbsEnWIeMsCAugvM,99
2
+ rpds/__init__.pyi,sha256=AC1SJpBQT3r0HyikMq0jJMm9PJgp6NL8iBjXiI4lbYQ,2681
3
+ rpds/__pycache__/__init__.cpython-312.pyc,,
4
+ rpds/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
+ rpds/rpds.cp312-win_amd64.pyd,sha256=aO6OAuMdDBU2t2QQ7WezAW5NCJ_gZsXfb2CxVBK03WY,628224
6
+ rpds_py-0.30.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
7
+ rpds_py-0.30.0.dist-info/METADATA,sha256=T-7MNIW5G2-ElJZRCcxl2OFe_Tcqhat29E8yDKc2uEE,4213
8
+ rpds_py-0.30.0.dist-info/RECORD,,
9
+ rpds_py-0.30.0.dist-info/WHEEL,sha256=MicGETHZ2NSvTN4l4NAAzDXbOHnrlOKS0CnBsnFTiLs,97
10
+ rpds_py-0.30.0.dist-info/licenses/LICENSE,sha256=i8tyyC6ornSAIpPEHZOtfVFDQAGwrkWmA6WvD1B67go,1076
TTS/Kokoro/.venv/Lib/site-packages/rpds_py-0.30.0.dist-info/WHEEL ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ Wheel-Version: 1.0
2
+ Generator: maturin (1.10.2)
3
+ Root-Is-Purelib: false
4
+ Tag: cp312-cp312-win_amd64
TTS/Kokoro/.venv/Lib/site-packages/safetensors-0.7.0.dist-info/INSTALLER ADDED
@@ -0,0 +1 @@
 
 
1
+ pip
TTS/Kokoro/.venv/Lib/site-packages/safetensors-0.7.0.dist-info/METADATA ADDED
@@ -0,0 +1,133 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Metadata-Version: 2.4
2
+ Name: safetensors
3
+ Version: 0.7.0
4
+ Classifier: Development Status :: 5 - Production/Stable
5
+ Classifier: Intended Audience :: Developers
6
+ Classifier: Intended Audience :: Education
7
+ Classifier: Intended Audience :: Science/Research
8
+ Classifier: License :: OSI Approved :: Apache Software License
9
+ Classifier: Operating System :: OS Independent
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Programming Language :: Python :: 3.7
12
+ Classifier: Programming Language :: Python :: 3.8
13
+ Classifier: Programming Language :: Python :: 3.9
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
16
+ Classifier: Typing :: Typed
17
+ Requires-Dist: numpy>=1.21.6 ; extra == 'numpy'
18
+ Requires-Dist: packaging ; extra == 'torch'
19
+ Requires-Dist: safetensors[numpy] ; extra == 'torch'
20
+ Requires-Dist: torch>=1.10 ; extra == 'torch'
21
+ Requires-Dist: safetensors[numpy] ; extra == 'tensorflow'
22
+ Requires-Dist: tensorflow>=2.11.0 ; extra == 'tensorflow'
23
+ Requires-Dist: safetensors[numpy] ; extra == 'pinned-tf'
24
+ Requires-Dist: tensorflow==2.18.0 ; extra == 'pinned-tf'
25
+ Requires-Dist: safetensors[numpy] ; extra == 'jax'
26
+ Requires-Dist: flax>=0.6.3 ; extra == 'jax'
27
+ Requires-Dist: jax>=0.3.25 ; extra == 'jax'
28
+ Requires-Dist: jaxlib>=0.3.25 ; extra == 'jax'
29
+ Requires-Dist: mlx>=0.0.9 ; extra == 'mlx'
30
+ Requires-Dist: safetensors[numpy] ; extra == 'paddlepaddle'
31
+ Requires-Dist: paddlepaddle>=2.4.1 ; extra == 'paddlepaddle'
32
+ Requires-Dist: ruff ; extra == 'quality'
33
+ Requires-Dist: safetensors[numpy] ; extra == 'testing'
34
+ Requires-Dist: h5py>=3.7.0 ; extra == 'testing'
35
+ Requires-Dist: huggingface-hub>=0.12.1 ; extra == 'testing'
36
+ Requires-Dist: setuptools-rust>=1.5.2 ; extra == 'testing'
37
+ Requires-Dist: pytest>=7.2.0 ; extra == 'testing'
38
+ Requires-Dist: pytest-benchmark>=4.0.0 ; extra == 'testing'
39
+ Requires-Dist: hypothesis>=6.70.2 ; extra == 'testing'
40
+ Requires-Dist: safetensors[numpy] ; extra == 'testingfree'
41
+ Requires-Dist: huggingface-hub>=0.12.1 ; extra == 'testingfree'
42
+ Requires-Dist: setuptools-rust>=1.5.2 ; extra == 'testingfree'
43
+ Requires-Dist: pytest>=7.2.0 ; extra == 'testingfree'
44
+ Requires-Dist: pytest-benchmark>=4.0.0 ; extra == 'testingfree'
45
+ Requires-Dist: hypothesis>=6.70.2 ; extra == 'testingfree'
46
+ Requires-Dist: safetensors[torch] ; extra == 'all'
47
+ Requires-Dist: safetensors[numpy] ; extra == 'all'
48
+ Requires-Dist: safetensors[pinned-tf] ; extra == 'all'
49
+ Requires-Dist: safetensors[jax] ; extra == 'all'
50
+ Requires-Dist: safetensors[paddlepaddle] ; extra == 'all'
51
+ Requires-Dist: safetensors[quality] ; extra == 'all'
52
+ Requires-Dist: safetensors[testing] ; extra == 'all'
53
+ Requires-Dist: safetensors[all] ; extra == 'dev'
54
+ Provides-Extra: numpy
55
+ Provides-Extra: torch
56
+ Provides-Extra: tensorflow
57
+ Provides-Extra: pinned-tf
58
+ Provides-Extra: jax
59
+ Provides-Extra: mlx
60
+ Provides-Extra: paddlepaddle
61
+ Provides-Extra: quality
62
+ Provides-Extra: testing
63
+ Provides-Extra: testingfree
64
+ Provides-Extra: all
65
+ Provides-Extra: dev
66
+ License-File: LICENSE
67
+ Author-email: Nicolas Patry <patry.nicolas@protonmail.com>
68
+ Requires-Python: >=3.9
69
+ Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
70
+ Project-URL: Homepage, https://github.com/huggingface/safetensors
71
+ Project-URL: Source, https://github.com/huggingface/safetensors
72
+
73
+ ## Installation
74
+
75
+ ```
76
+ pip install safetensors
77
+ ```
78
+
79
+
80
+ ## Usage
81
+
82
+ ### Numpy
83
+
84
+ ```python
85
+ from safetensors.numpy import save_file, load_file
86
+ import numpy as np
87
+
88
+ tensors = {
89
+ "a": np.zeros((2, 2)),
90
+ "b": np.zeros((2, 3), dtype=np.uint8)
91
+ }
92
+
93
+ save_file(tensors, "./model.safetensors")
94
+
95
+
96
+ # Now loading
97
+ loaded = load_file("./model.safetensors")
98
+ ```
99
+
100
+ ### Torch
101
+
102
+ ```python
103
+ from safetensors.torch import save_file, load_file
104
+ import torch
105
+
106
+ tensors = {
107
+ "a": torch.zeros((2, 2)),
108
+ "b": torch.zeros((2, 3), dtype=torch.uint8)
109
+ }
110
+
111
+ save_file(tensors, "./model.safetensors")
112
+
113
+
114
+ # Now loading
115
+ loaded = load_file("./model.safetensors")
116
+ ```
117
+
118
+ ### Developing
119
+
120
+ ```
121
+ # inside ./safetensors/bindings/python
122
+ pip install .[dev]
123
+ ```
124
+ Should be enough to install this library locally.
125
+
126
+ ### Testing
127
+
128
+ ```
129
+ # inside ./safetensors/bindings/python
130
+ pip install .[dev]
131
+ pytest -sv tests/
132
+ ```
133
+
TTS/Kokoro/.venv/Lib/site-packages/safetensors-0.7.0.dist-info/RECORD ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ safetensors-0.7.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
2
+ safetensors-0.7.0.dist-info/METADATA,sha256=j4yXpt97GFoHwriefq-dEwV9ZX_7SZKS795bMtYUiBs,4185
3
+ safetensors-0.7.0.dist-info/RECORD,,
4
+ safetensors-0.7.0.dist-info/WHEEL,sha256=MW5GXj0PFGHxdts4kUIyLDU55oFjz5S6uZmcnjsRmds,95
5
+ safetensors-0.7.0.dist-info/licenses/LICENSE,sha256=HrhfyXIkWY2tGFK11kg7vPCqhgh5DcxleloqdhrpyMY,11558
6
+ safetensors/__init__.py,sha256=HYY5VVsb3b-cxhZBwhNx53ZKqSIB4M14nIXLTOAM1Wc,204
7
+ safetensors/__init__.pyi,sha256=tnVaPqYbh8ggFbOZdYKUC4ArqitiWDfrIQt1BNJ377k,4183
8
+ safetensors/__pycache__/__init__.cpython-312.pyc,,
9
+ safetensors/__pycache__/flax.cpython-312.pyc,,
10
+ safetensors/__pycache__/mlx.cpython-312.pyc,,
11
+ safetensors/__pycache__/numpy.cpython-312.pyc,,
12
+ safetensors/__pycache__/paddle.cpython-312.pyc,,
13
+ safetensors/__pycache__/tensorflow.cpython-312.pyc,,
14
+ safetensors/__pycache__/torch.cpython-312.pyc,,
15
+ safetensors/_safetensors_rust.pyd,sha256=8gPLI70OVyFz6ze8U_qlSH1QD5vCVAkB0NpGbFq62vA,738304
16
+ safetensors/flax.py,sha256=SnuiGojmth0eCFIWoKEvAfh95nZP9uCZ9E-S4NndrbU,3991
17
+ safetensors/mlx.py,sha256=KvfTWusLSx1hSPWQgg99iL-z9VoD6zQ8l4-RAsCe7P8,3990
18
+ safetensors/numpy.py,sha256=8ci56gDXetlYHH1-Nru83auiUVi-Q1P9bKvfsdkLKPw,5215
19
+ safetensors/paddle.py,sha256=EhXpflqrhKr_NFh4jxV9SUnW0B1vcX_KdPdTqcytrDs,9011
20
+ safetensors/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
21
+ safetensors/tensorflow.py,sha256=DajI3qkz00Zy2h7jublSAvTaD51QOPdaIgKQIeSiCRs,4042
22
+ safetensors/torch.py,sha256=CLVWgWQdLm_tVzhRPaeihBHt-4iGAtUW5fY2ys3TyMc,19160
TTS/Kokoro/.venv/Lib/site-packages/safetensors-0.7.0.dist-info/WHEEL ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ Wheel-Version: 1.0
2
+ Generator: maturin (1.10.2)
3
+ Root-Is-Purelib: false
4
+ Tag: cp38-abi3-win_amd64
TTS/Kokoro/.venv/Lib/site-packages/safetensors/__init__.py ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ # Re-export this
2
+ from ._safetensors_rust import ( # noqa: F401
3
+ SafetensorError,
4
+ __version__,
5
+ deserialize,
6
+ safe_open,
7
+ _safe_open_handle,
8
+ serialize,
9
+ serialize_file,
10
+ )
TTS/Kokoro/.venv/Lib/site-packages/safetensors/__init__.pyi ADDED
@@ -0,0 +1,164 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Generated content DO NOT EDIT
2
+ @staticmethod
3
+ def deserialize(bytes):
4
+ """
5
+ Opens a safetensors lazily and returns tensors as asked
6
+
7
+ Args:
8
+ data (`bytes`):
9
+ The byte content of a file
10
+
11
+ Returns:
12
+ (`List[str, Dict[str, Dict[str, any]]]`):
13
+ The deserialized content is like:
14
+ [("tensor_name", {"shape": [2, 3], "dtype": "F32", "data": b"\0\0.." }), (...)]
15
+ """
16
+ pass
17
+
18
+ @staticmethod
19
+ def serialize(tensor_dict, metadata=None):
20
+ """
21
+ Serializes raw data.
22
+
23
+ Args:
24
+ tensor_dict (`Dict[str, Dict[Any]]`):
25
+ The tensor dict is like:
26
+ {"tensor_name": {"dtype": "F32", "shape": [2, 3], "data": b"\0\0"}}
27
+ metadata (`Dict[str, str]`, *optional*):
28
+ The optional purely text annotations
29
+
30
+ Returns:
31
+ (`bytes`):
32
+ The serialized content.
33
+ """
34
+ pass
35
+
36
+ @staticmethod
37
+ def serialize_file(tensor_dict, filename, metadata=None):
38
+ """
39
+ Serializes raw data into file.
40
+
41
+ Args:
42
+ tensor_dict (`Dict[str, Dict[Any]]`):
43
+ The tensor dict is like:
44
+ {"tensor_name": {"dtype": "F32", "shape": [2, 3], "data": b"\0\0"}}
45
+ filename (`str`, or `os.PathLike`):
46
+ The name of the file to write into.
47
+ metadata (`Dict[str, str]`, *optional*):
48
+ The optional purely text annotations
49
+
50
+ Returns:
51
+ (`NoneType`):
52
+ On success return None
53
+ """
54
+ pass
55
+
56
+ class safe_open:
57
+ """
58
+ Opens a safetensors lazily and returns tensors as asked
59
+
60
+ Args:
61
+ filename (`str`, or `os.PathLike`):
62
+ The filename to open
63
+
64
+ framework (`str`):
65
+ The framework you want you tensors in. Supported values:
66
+ `pt`, `tf`, `flax`, `numpy`.
67
+
68
+ device (`str`, defaults to `"cpu"`):
69
+ The device on which you want the tensors.
70
+ """
71
+ def __init__(self, filename, framework, device=...):
72
+ pass
73
+
74
+ def __enter__(self):
75
+ """
76
+ Start the context manager
77
+ """
78
+ pass
79
+
80
+ def __exit__(self, _exc_type, _exc_value, _traceback):
81
+ """
82
+ Exits the context manager
83
+ """
84
+ pass
85
+
86
+ def get_slice(self, name):
87
+ """
88
+ Returns a full slice view object
89
+
90
+ Args:
91
+ name (`str`):
92
+ The name of the tensor you want
93
+
94
+ Returns:
95
+ (`PySafeSlice`):
96
+ A dummy object you can slice into to get a real tensor
97
+ Example:
98
+ ```python
99
+ from safetensors import safe_open
100
+
101
+ with safe_open("model.safetensors", framework="pt", device=0) as f:
102
+ tensor_part = f.get_slice("embedding")[:, ::8]
103
+
104
+ ```
105
+ """
106
+ pass
107
+
108
+ def get_tensor(self, name):
109
+ """
110
+ Returns a full tensor
111
+
112
+ Args:
113
+ name (`str`):
114
+ The name of the tensor you want
115
+
116
+ Returns:
117
+ (`Tensor`):
118
+ The tensor in the framework you opened the file for.
119
+
120
+ Example:
121
+ ```python
122
+ from safetensors import safe_open
123
+
124
+ with safe_open("model.safetensors", framework="pt", device=0) as f:
125
+ tensor = f.get_tensor("embedding")
126
+
127
+ ```
128
+ """
129
+ pass
130
+
131
+ def keys(self):
132
+ """
133
+ Returns the names of the tensors in the file.
134
+
135
+ Returns:
136
+ (`List[str]`):
137
+ The name of the tensors contained in that file
138
+ """
139
+ pass
140
+
141
+ def metadata(self):
142
+ """
143
+ Return the special non tensor information in the header
144
+
145
+ Returns:
146
+ (`Dict[str, str]`):
147
+ The freeform metadata.
148
+ """
149
+ pass
150
+
151
+ def offset_keys(self):
152
+ """
153
+ Returns the names of the tensors in the file, ordered by offset.
154
+
155
+ Returns:
156
+ (`List[str]`):
157
+ The name of the tensors contained in that file
158
+ """
159
+ pass
160
+
161
+ class SafetensorError(Exception):
162
+ """
163
+ Custom Python Exception for Safetensor errors.
164
+ """
TTS/Kokoro/.venv/Lib/site-packages/safetensors/flax.py ADDED
@@ -0,0 +1,138 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ from typing import Dict, Optional, Union
3
+
4
+ import numpy as np
5
+
6
+ import jax.numpy as jnp
7
+ from jax import Array
8
+ from safetensors import numpy, safe_open
9
+
10
+
11
+ def save(tensors: Dict[str, Array], metadata: Optional[Dict[str, str]] = None) -> bytes:
12
+ """
13
+ Saves a dictionary of tensors into raw bytes in safetensors format.
14
+
15
+ Args:
16
+ tensors (`Dict[str, Array]`):
17
+ The incoming tensors. Tensors need to be contiguous and dense.
18
+ metadata (`Dict[str, str]`, *optional*, defaults to `None`):
19
+ Optional text only metadata you might want to save in your header.
20
+ For instance it can be useful to specify more about the underlying
21
+ tensors. This is purely informative and does not affect tensor loading.
22
+
23
+ Returns:
24
+ `bytes`: The raw bytes representing the format
25
+
26
+ Example:
27
+
28
+ ```python
29
+ from safetensors.flax import save
30
+ from jax import numpy as jnp
31
+
32
+ tensors = {"embedding": jnp.zeros((512, 1024)), "attention": jnp.zeros((256, 256))}
33
+ byte_data = save(tensors)
34
+ ```
35
+ """
36
+ np_tensors = _jnp2np(tensors)
37
+ return numpy.save(np_tensors, metadata=metadata)
38
+
39
+
40
+ def save_file(
41
+ tensors: Dict[str, Array],
42
+ filename: Union[str, os.PathLike],
43
+ metadata: Optional[Dict[str, str]] = None,
44
+ ) -> None:
45
+ """
46
+ Saves a dictionary of tensors into raw bytes in safetensors format.
47
+
48
+ Args:
49
+ tensors (`Dict[str, Array]`):
50
+ The incoming tensors. Tensors need to be contiguous and dense.
51
+ filename (`str`, or `os.PathLike`)):
52
+ The filename we're saving into.
53
+ metadata (`Dict[str, str]`, *optional*, defaults to `None`):
54
+ Optional text only metadata you might want to save in your header.
55
+ For instance it can be useful to specify more about the underlying
56
+ tensors. This is purely informative and does not affect tensor loading.
57
+
58
+ Returns:
59
+ `None`
60
+
61
+ Example:
62
+
63
+ ```python
64
+ from safetensors.flax import save_file
65
+ from jax import numpy as jnp
66
+
67
+ tensors = {"embedding": jnp.zeros((512, 1024)), "attention": jnp.zeros((256, 256))}
68
+ save_file(tensors, "model.safetensors")
69
+ ```
70
+ """
71
+ np_tensors = _jnp2np(tensors)
72
+ return numpy.save_file(np_tensors, filename, metadata=metadata)
73
+
74
+
75
+ def load(data: bytes) -> Dict[str, Array]:
76
+ """
77
+ Loads a safetensors file into flax format from pure bytes.
78
+
79
+ Args:
80
+ data (`bytes`):
81
+ The content of a safetensors file
82
+
83
+ Returns:
84
+ `Dict[str, Array]`: dictionary that contains name as key, value as `Array` on cpu
85
+
86
+ Example:
87
+
88
+ ```python
89
+ from safetensors.flax import load
90
+
91
+ file_path = "./my_folder/bert.safetensors"
92
+ with open(file_path, "rb") as f:
93
+ data = f.read()
94
+
95
+ loaded = load(data)
96
+ ```
97
+ """
98
+ flat = numpy.load(data)
99
+ return _np2jnp(flat)
100
+
101
+
102
+ def load_file(filename: Union[str, os.PathLike]) -> Dict[str, Array]:
103
+ """
104
+ Loads a safetensors file into flax format.
105
+
106
+ Args:
107
+ filename (`str`, or `os.PathLike`)):
108
+ The name of the file which contains the tensors
109
+
110
+ Returns:
111
+ `Dict[str, Array]`: dictionary that contains name as key, value as `Array`
112
+
113
+ Example:
114
+
115
+ ```python
116
+ from safetensors.flax import load_file
117
+
118
+ file_path = "./my_folder/bert.safetensors"
119
+ loaded = load_file(file_path)
120
+ ```
121
+ """
122
+ result = {}
123
+ with safe_open(filename, framework="flax") as f:
124
+ for k in f.offset_keys():
125
+ result[k] = f.get_tensor(k)
126
+ return result
127
+
128
+
129
+ def _np2jnp(numpy_dict: Dict[str, np.ndarray]) -> Dict[str, Array]:
130
+ for k, v in numpy_dict.items():
131
+ numpy_dict[k] = jnp.array(v)
132
+ return numpy_dict
133
+
134
+
135
+ def _jnp2np(jnp_dict: Dict[str, Array]) -> Dict[str, np.array]:
136
+ for k, v in jnp_dict.items():
137
+ jnp_dict[k] = np.asarray(v)
138
+ return jnp_dict
TTS/Kokoro/.venv/Lib/site-packages/safetensors/mlx.py ADDED
@@ -0,0 +1,140 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ from typing import Dict, Optional, Union
3
+
4
+ import numpy as np
5
+
6
+ import mlx.core as mx
7
+ from safetensors import numpy, safe_open
8
+
9
+
10
+ def save(
11
+ tensors: Dict[str, mx.array], metadata: Optional[Dict[str, str]] = None
12
+ ) -> bytes:
13
+ """
14
+ Saves a dictionary of tensors into raw bytes in safetensors format.
15
+
16
+ Args:
17
+ tensors (`Dict[str, mx.array]`):
18
+ The incoming tensors. Tensors need to be contiguous and dense.
19
+ metadata (`Dict[str, str]`, *optional*, defaults to `None`):
20
+ Optional text only metadata you might want to save in your header.
21
+ For instance it can be useful to specify more about the underlying
22
+ tensors. This is purely informative and does not affect tensor loading.
23
+
24
+ Returns:
25
+ `bytes`: The raw bytes representing the format
26
+
27
+ Example:
28
+
29
+ ```python
30
+ from safetensors.mlx import save
31
+ import mlx.core as mx
32
+
33
+ tensors = {"embedding": mx.zeros((512, 1024)), "attention": mx.zeros((256, 256))}
34
+ byte_data = save(tensors)
35
+ ```
36
+ """
37
+ np_tensors = _mx2np(tensors)
38
+ return numpy.save(np_tensors, metadata=metadata)
39
+
40
+
41
+ def save_file(
42
+ tensors: Dict[str, mx.array],
43
+ filename: Union[str, os.PathLike],
44
+ metadata: Optional[Dict[str, str]] = None,
45
+ ) -> None:
46
+ """
47
+ Saves a dictionary of tensors into raw bytes in safetensors format.
48
+
49
+ Args:
50
+ tensors (`Dict[str, mx.array]`):
51
+ The incoming tensors. Tensors need to be contiguous and dense.
52
+ filename (`str`, or `os.PathLike`)):
53
+ The filename we're saving into.
54
+ metadata (`Dict[str, str]`, *optional*, defaults to `None`):
55
+ Optional text only metadata you might want to save in your header.
56
+ For instance it can be useful to specify more about the underlying
57
+ tensors. This is purely informative and does not affect tensor loading.
58
+
59
+ Returns:
60
+ `None`
61
+
62
+ Example:
63
+
64
+ ```python
65
+ from safetensors.mlx import save_file
66
+ import mlx.core as mx
67
+
68
+ tensors = {"embedding": mx.zeros((512, 1024)), "attention": mx.zeros((256, 256))}
69
+ save_file(tensors, "model.safetensors")
70
+ ```
71
+ """
72
+ np_tensors = _mx2np(tensors)
73
+ return numpy.save_file(np_tensors, filename, metadata=metadata)
74
+
75
+
76
+ def load(data: bytes) -> Dict[str, mx.array]:
77
+ """
78
+ Loads a safetensors file into MLX format from pure bytes.
79
+
80
+ Args:
81
+ data (`bytes`):
82
+ The content of a safetensors file
83
+
84
+ Returns:
85
+ `Dict[str, mx.array]`: dictionary that contains name as key, value as `mx.array`
86
+
87
+ Example:
88
+
89
+ ```python
90
+ from safetensors.mlx import load
91
+
92
+ file_path = "./my_folder/bert.safetensors"
93
+ with open(file_path, "rb") as f:
94
+ data = f.read()
95
+
96
+ loaded = load(data)
97
+ ```
98
+ """
99
+ flat = numpy.load(data)
100
+ return _np2mx(flat)
101
+
102
+
103
+ def load_file(filename: Union[str, os.PathLike]) -> Dict[str, mx.array]:
104
+ """
105
+ Loads a safetensors file into MLX format.
106
+
107
+ Args:
108
+ filename (`str`, or `os.PathLike`)):
109
+ The name of the file which contains the tensors
110
+
111
+ Returns:
112
+ `Dict[str, mx.array]`: dictionary that contains name as key, value as `mx.array`
113
+
114
+ Example:
115
+
116
+ ```python
117
+ from safetensors.flax import load_file
118
+
119
+ file_path = "./my_folder/bert.safetensors"
120
+ loaded = load_file(file_path)
121
+ ```
122
+ """
123
+ result = {}
124
+ with safe_open(filename, framework="mlx") as f:
125
+ for k in f.offset_keys():
126
+ result[k] = f.get_tensor(k)
127
+ return result
128
+
129
+
130
+ def _np2mx(numpy_dict: Dict[str, np.ndarray]) -> Dict[str, mx.array]:
131
+ for k, v in numpy_dict.items():
132
+ numpy_dict[k] = mx.array(v)
133
+ return numpy_dict
134
+
135
+
136
+ def _mx2np(mx_dict: Dict[str, mx.array]) -> Dict[str, np.array]:
137
+ new_dict = {}
138
+ for k, v in mx_dict.items():
139
+ new_dict[k] = np.asarray(v)
140
+ return new_dict
TTS/Kokoro/.venv/Lib/site-packages/safetensors/numpy.py ADDED
@@ -0,0 +1,187 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import sys
3
+ from typing import Dict, Optional, Union
4
+
5
+ import numpy as np
6
+
7
+ from safetensors import deserialize, safe_open, serialize, serialize_file
8
+
9
+
10
+ def _tobytes(tensor: np.ndarray) -> bytes:
11
+ if not _is_little_endian(tensor):
12
+ tensor = tensor.byteswap(inplace=False)
13
+ return tensor.tobytes()
14
+
15
+
16
+ def save(
17
+ tensor_dict: Dict[str, np.ndarray], metadata: Optional[Dict[str, str]] = None
18
+ ) -> bytes:
19
+ """
20
+ Saves a dictionary of tensors into raw bytes in safetensors format.
21
+
22
+ Args:
23
+ tensor_dict (`Dict[str, np.ndarray]`):
24
+ The incoming tensors. Tensors need to be contiguous and dense.
25
+ metadata (`Dict[str, str]`, *optional*, defaults to `None`):
26
+ Optional text only metadata you might want to save in your header.
27
+ For instance it can be useful to specify more about the underlying
28
+ tensors. This is purely informative and does not affect tensor loading.
29
+
30
+ Returns:
31
+ `bytes`: The raw bytes representing the format
32
+
33
+ Example:
34
+
35
+ ```python
36
+ from safetensors.numpy import save
37
+ import numpy as np
38
+
39
+ tensors = {"embedding": np.zeros((512, 1024)), "attention": np.zeros((256, 256))}
40
+ byte_data = save(tensors)
41
+ ```
42
+ """
43
+ flattened = {
44
+ k: {"dtype": v.dtype.name, "shape": v.shape, "data": _tobytes(v)}
45
+ for k, v in tensor_dict.items()
46
+ }
47
+ serialized = serialize(flattened, metadata=metadata)
48
+ result = bytes(serialized)
49
+ return result
50
+
51
+
52
+ def save_file(
53
+ tensor_dict: Dict[str, np.ndarray],
54
+ filename: Union[str, os.PathLike],
55
+ metadata: Optional[Dict[str, str]] = None,
56
+ ) -> None:
57
+ """
58
+ Saves a dictionary of tensors into raw bytes in safetensors format.
59
+
60
+ Args:
61
+ tensor_dict (`Dict[str, np.ndarray]`):
62
+ The incoming tensors. Tensors need to be contiguous and dense.
63
+ filename (`str`, or `os.PathLike`)):
64
+ The filename we're saving into.
65
+ metadata (`Dict[str, str]`, *optional*, defaults to `None`):
66
+ Optional text only metadata you might want to save in your header.
67
+ For instance it can be useful to specify more about the underlying
68
+ tensors. This is purely informative and does not affect tensor loading.
69
+
70
+ Returns:
71
+ `None`
72
+
73
+ Example:
74
+
75
+ ```python
76
+ from safetensors.numpy import save_file
77
+ import numpy as np
78
+
79
+ tensors = {"embedding": np.zeros((512, 1024)), "attention": np.zeros((256, 256))}
80
+ save_file(tensors, "model.safetensors")
81
+ ```
82
+ """
83
+ flattened = {
84
+ k: {"dtype": v.dtype.name, "shape": v.shape, "data": _tobytes(v)}
85
+ for k, v in tensor_dict.items()
86
+ }
87
+ serialize_file(flattened, filename, metadata=metadata)
88
+
89
+
90
+ def load(data: bytes) -> Dict[str, np.ndarray]:
91
+ """
92
+ Loads a safetensors file into numpy format from pure bytes.
93
+
94
+ Args:
95
+ data (`bytes`):
96
+ The content of a safetensors file
97
+
98
+ Returns:
99
+ `Dict[str, np.ndarray]`: dictionary that contains name as key, value as `np.ndarray` on cpu
100
+
101
+ Example:
102
+
103
+ ```python
104
+ from safetensors.numpy import load
105
+
106
+ file_path = "./my_folder/bert.safetensors"
107
+ with open(file_path, "rb") as f:
108
+ data = f.read()
109
+
110
+ loaded = load(data)
111
+ ```
112
+ """
113
+ flat = deserialize(data)
114
+ return _view2np(flat)
115
+
116
+
117
+ def load_file(filename: Union[str, os.PathLike]) -> Dict[str, np.ndarray]:
118
+ """
119
+ Loads a safetensors file into numpy format.
120
+
121
+ Args:
122
+ filename (`str`, or `os.PathLike`)):
123
+ The name of the file which contains the tensors
124
+
125
+ Returns:
126
+ `Dict[str, np.ndarray]`: dictionary that contains name as key, value as `np.ndarray`
127
+
128
+ Example:
129
+
130
+ ```python
131
+ from safetensors.numpy import load_file
132
+
133
+ file_path = "./my_folder/bert.safetensors"
134
+ loaded = load_file(file_path)
135
+ ```
136
+ """
137
+ result = {}
138
+ with safe_open(filename, framework="np") as f:
139
+ for k in f.offset_keys():
140
+ result[k] = f.get_tensor(k)
141
+ return result
142
+
143
+
144
+ _TYPES = {
145
+ "F64": np.float64,
146
+ "F32": np.float32,
147
+ "F16": np.float16,
148
+ "I64": np.int64,
149
+ "U64": np.uint64,
150
+ "I32": np.int32,
151
+ "U32": np.uint32,
152
+ "I16": np.int16,
153
+ "U16": np.uint16,
154
+ "I8": np.int8,
155
+ "U8": np.uint8,
156
+ "BOOL": bool,
157
+ "C64": np.complex64,
158
+ }
159
+
160
+
161
+ def _getdtype(dtype_str: str) -> np.dtype:
162
+ return _TYPES[dtype_str]
163
+
164
+
165
+ def _view2np(safeview) -> Dict[str, np.ndarray]:
166
+ result = {}
167
+ for k, v in safeview:
168
+ dtype = _getdtype(v["dtype"])
169
+ arr = np.frombuffer(v["data"], dtype=dtype).reshape(v["shape"])
170
+ result[k] = arr
171
+ return result
172
+
173
+
174
+ def _is_little_endian(tensor: np.ndarray) -> bool:
175
+ byteorder = tensor.dtype.byteorder
176
+ if byteorder == "=":
177
+ if sys.byteorder == "little":
178
+ return True
179
+ else:
180
+ return False
181
+ elif byteorder == "|":
182
+ return True
183
+ elif byteorder == "<":
184
+ return True
185
+ elif byteorder == ">":
186
+ return False
187
+ raise ValueError(f"Unexpected byte order {byteorder}")
TTS/Kokoro/.venv/Lib/site-packages/safetensors/paddle.py ADDED
@@ -0,0 +1,290 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import sys
3
+ from typing import Any, Dict, Optional, Union
4
+
5
+ import numpy as np
6
+ import paddle
7
+
8
+ from safetensors import numpy, deserialize, safe_open, serialize, serialize_file
9
+
10
+
11
+ def save(
12
+ tensors: Dict[str, paddle.Tensor], metadata: Optional[Dict[str, str]] = None
13
+ ) -> bytes:
14
+ """
15
+ Saves a dictionary of tensors into raw bytes in safetensors format.
16
+
17
+ Args:
18
+ tensors (`Dict[str, paddle.Tensor]`):
19
+ The incoming tensors. Tensors need to be contiguous and dense.
20
+ metadata (`Dict[str, str]`, *optional*, defaults to `None`):
21
+ Optional text only metadata you might want to save in your header.
22
+ For instance it can be useful to specify more about the underlying
23
+ tensors. This is purely informative and does not affect tensor loading.
24
+
25
+ Returns:
26
+ `bytes`: The raw bytes representing the format
27
+
28
+ Example:
29
+
30
+ ```python
31
+ from safetensors.paddle import save
32
+ import paddle
33
+
34
+ tensors = {"embedding": paddle.zeros((512, 1024)), "attention": paddle.zeros((256, 256))}
35
+ byte_data = save(tensors)
36
+ ```
37
+ """
38
+ serialized = serialize(_flatten(tensors), metadata=metadata)
39
+ result = bytes(serialized)
40
+ return result
41
+
42
+
43
+ def save_file(
44
+ tensors: Dict[str, paddle.Tensor],
45
+ filename: Union[str, os.PathLike],
46
+ metadata: Optional[Dict[str, str]] = None,
47
+ ) -> None:
48
+ """
49
+ Saves a dictionary of tensors into raw bytes in safetensors format.
50
+
51
+ Args:
52
+ tensors (`Dict[str, paddle.Tensor]`):
53
+ The incoming tensors. Tensors need to be contiguous and dense.
54
+ filename (`str`, or `os.PathLike`)):
55
+ The filename we're saving into.
56
+ metadata (`Dict[str, str]`, *optional*, defaults to `None`):
57
+ Optional text only metadata you might want to save in your header.
58
+ For instance it can be useful to specify more about the underlying
59
+ tensors. This is purely informative and does not affect tensor loading.
60
+
61
+ Returns:
62
+ `None`
63
+
64
+ Example:
65
+
66
+ ```python
67
+ from safetensors.paddle import save_file
68
+ import paddle
69
+
70
+ tensors = {"embedding": paddle.zeros((512, 1024)), "attention": paddle.zeros((256, 256))}
71
+ save_file(tensors, "model.safetensors")
72
+ ```
73
+ """
74
+ serialize_file(_flatten(tensors), filename, metadata=metadata)
75
+
76
+
77
+ def load(data: bytes, device: str = "cpu") -> Dict[str, paddle.Tensor]:
78
+ """
79
+ Loads a safetensors file into paddle format from pure bytes.
80
+
81
+ Args:
82
+ data (`bytes`):
83
+ The content of a safetensors file
84
+
85
+ Returns:
86
+ `Dict[str, paddle.Tensor]`: dictionary that contains name as key, value as `paddle.Tensor` on cpu
87
+
88
+ Example:
89
+
90
+ ```python
91
+ from safetensors.paddle import load
92
+
93
+ file_path = "./my_folder/bert.safetensors"
94
+ with open(file_path, "rb") as f:
95
+ data = f.read()
96
+
97
+ loaded = load(data)
98
+ ```
99
+ """
100
+ if paddle.__version__ >= "3.2.0":
101
+ flat = deserialize(data)
102
+ return _view2paddle(flat, device)
103
+ else:
104
+ flat = numpy.load(data)
105
+ return _np2paddle(flat, device)
106
+
107
+
108
+ def load_file(
109
+ filename: Union[str, os.PathLike], device="cpu"
110
+ ) -> Dict[str, paddle.Tensor]:
111
+ """
112
+ Loads a safetensors file into paddle format.
113
+
114
+ Args:
115
+ filename (`str`, or `os.PathLike`)):
116
+ The name of the file which contains the tensors
117
+ device (`Union[Dict[str, any], str]`, *optional*, defaults to `cpu`):
118
+ The device where the tensors need to be located after load.
119
+ available options are all regular paddle device locations
120
+
121
+ Returns:
122
+ `Dict[str, paddle.Tensor]`: dictionary that contains name as key, value as `paddle.Tensor`
123
+
124
+ Example:
125
+
126
+ ```python
127
+ from safetensors.paddle import load_file
128
+
129
+ file_path = "./my_folder/bert.safetensors"
130
+ loaded = load_file(file_path)
131
+ ```
132
+ """
133
+ result = {}
134
+ if paddle.__version__ >= "3.2.0":
135
+ with safe_open(filename, framework="paddle", device=device) as f:
136
+ for k in f.offset_keys():
137
+ result[k] = f.get_tensor(k)
138
+ else:
139
+ flat = numpy.load_file(filename)
140
+ result = _np2paddle(flat, device)
141
+ return result
142
+
143
+
144
+ def _np2paddle(
145
+ numpy_dict: Dict[str, np.ndarray], device: str = "cpu"
146
+ ) -> Dict[str, paddle.Tensor]:
147
+ for k, v in numpy_dict.items():
148
+ numpy_dict[k] = paddle.to_tensor(v, place=device)
149
+ return numpy_dict
150
+
151
+
152
+ def _paddle2np(paddle_dict: Dict[str, paddle.Tensor]) -> Dict[str, np.array]:
153
+ for k, v in paddle_dict.items():
154
+ paddle_dict[k] = v.detach().cpu().numpy()
155
+ return paddle_dict
156
+
157
+
158
+ _SIZE = {
159
+ paddle.int64: 8,
160
+ paddle.float32: 4,
161
+ paddle.int32: 4,
162
+ paddle.bfloat16: 2,
163
+ paddle.float16: 2,
164
+ paddle.int16: 2,
165
+ paddle.uint8: 1,
166
+ paddle.int8: 1,
167
+ paddle.bool: 1,
168
+ paddle.float64: 8,
169
+ paddle.float8_e4m3fn: 1,
170
+ paddle.float8_e5m2: 1,
171
+ paddle.complex64: 8,
172
+ # XXX: These are not supported yet in paddle
173
+ # paddle.uint64: 8,
174
+ # paddle.uint32: 4,
175
+ # paddle.uint16: 2,
176
+ # paddle.float8_e8m0: 1,
177
+ # paddle.float4_e2m1_x2: 1,
178
+ }
179
+
180
+ _TYPES = {
181
+ "F64": paddle.float64,
182
+ "F32": paddle.float32,
183
+ "F16": paddle.float16,
184
+ "BF16": paddle.bfloat16,
185
+ "I64": paddle.int64,
186
+ "I32": paddle.int32,
187
+ "I16": paddle.int16,
188
+ "I8": paddle.int8,
189
+ "U8": paddle.uint8,
190
+ "BOOL": paddle.bool,
191
+ "F8_E4M3": paddle.float8_e4m3fn,
192
+ "F8_E5M2": paddle.float8_e5m2,
193
+ }
194
+
195
+ NPDTYPES = {
196
+ paddle.int64: np.int64,
197
+ paddle.float32: np.float32,
198
+ paddle.int32: np.int32,
199
+ # XXX: This is ok because both have the same width
200
+ paddle.bfloat16: np.float16,
201
+ paddle.float16: np.float16,
202
+ paddle.int16: np.int16,
203
+ paddle.uint8: np.uint8,
204
+ paddle.int8: np.int8,
205
+ paddle.bool: bool,
206
+ paddle.float64: np.float64,
207
+ # XXX: This is ok because both have the same width and byteswap is a no-op anyway
208
+ paddle.float8_e4m3fn: np.uint8,
209
+ paddle.float8_e5m2: np.uint8,
210
+ }
211
+
212
+
213
+ def _getdtype(dtype_str: str) -> paddle.dtype:
214
+ return _TYPES[dtype_str]
215
+
216
+
217
+ def _view2paddle(safeview, device) -> Dict[str, paddle.Tensor]:
218
+ result = {}
219
+ for k, v in safeview:
220
+ dtype = _getdtype(v["dtype"])
221
+ if len(v["data"]) == 0:
222
+ # Workaround because frombuffer doesn't accept zero-size tensors
223
+ assert any(x == 0 for x in v["shape"])
224
+ arr = paddle.empty(v["shape"], dtype=dtype)
225
+ else:
226
+ arr = paddle.base.core.frombuffer(v["data"], dtype).reshape(v["shape"])
227
+ if device != "cpu":
228
+ arr = arr.to(device)
229
+ if sys.byteorder == "big":
230
+ arr = paddle.to_tensor(arr.numpy().byteswap(inplace=False), place=device)
231
+ result[k] = arr
232
+
233
+ return result
234
+
235
+
236
+ def _tobytes(tensor: paddle.Tensor, name: str) -> bytes:
237
+ if not tensor.is_contiguous():
238
+ raise ValueError(
239
+ f"You are trying to save a non contiguous tensor: `{name}` which is not allowed. It either means you"
240
+ " are trying to save tensors which are reference of each other in which case it's recommended to save"
241
+ " only the full tensors, and reslice at load time, or simply call `.contiguous()` on your tensor to"
242
+ " pack it before saving."
243
+ )
244
+ if not tensor.place.is_cpu_place():
245
+ # Moving tensor to cpu before saving
246
+ tensor = tensor.cpu()
247
+
248
+ import ctypes
249
+
250
+ import numpy as np
251
+
252
+ # When shape is empty (scalar), np.prod returns a float
253
+ # we need a int for the following calculations
254
+ length = int(np.prod(tensor.shape).item())
255
+ bytes_per_item = _SIZE[tensor.dtype]
256
+
257
+ total_bytes = length * bytes_per_item
258
+
259
+ ptr = tensor.data_ptr()
260
+ if ptr == 0:
261
+ return b""
262
+ newptr = ctypes.cast(ptr, ctypes.POINTER(ctypes.c_ubyte))
263
+ data = np.ctypeslib.as_array(newptr, (total_bytes,)) # no internal copy
264
+ if sys.byteorder == "big":
265
+ npdtype = NPDTYPES[tensor.dtype]
266
+ # Not in place as that would potentially modify a live running model
267
+ data = data.view(npdtype).byteswap(inplace=False)
268
+ return data.tobytes()
269
+
270
+
271
+ def _flatten(tensors: Dict[str, paddle.Tensor]) -> Dict[str, Dict[str, Any]]:
272
+ if not isinstance(tensors, dict):
273
+ raise ValueError(
274
+ f"Expected a dict of [str, paddle.Tensor] but received {type(tensors)}"
275
+ )
276
+
277
+ for k, v in tensors.items():
278
+ if not isinstance(v, paddle.Tensor):
279
+ raise ValueError(
280
+ f"Key `{k}` is invalid, expected paddle.Tensor but received {type(v)}"
281
+ )
282
+
283
+ return {
284
+ k: {
285
+ "dtype": str(v.dtype).split(".")[-1],
286
+ "shape": v.shape,
287
+ "data": _tobytes(v, k),
288
+ }
289
+ for k, v in tensors.items()
290
+ }
TTS/Kokoro/.venv/Lib/site-packages/safetensors/py.typed ADDED
File without changes
TTS/Kokoro/.venv/Lib/site-packages/safetensors/tensorflow.py ADDED
@@ -0,0 +1,139 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ from typing import Dict, Optional, Union
3
+
4
+ import numpy as np
5
+ import tensorflow as tf
6
+
7
+ from safetensors import numpy, safe_open
8
+
9
+
10
+ def save(
11
+ tensors: Dict[str, tf.Tensor], metadata: Optional[Dict[str, str]] = None
12
+ ) -> bytes:
13
+ """
14
+ Saves a dictionary of tensors into raw bytes in safetensors format.
15
+
16
+ Args:
17
+ tensors (`Dict[str, tf.Tensor]`):
18
+ The incoming tensors. Tensors need to be contiguous and dense.
19
+ metadata (`Dict[str, str]`, *optional*, defaults to `None`):
20
+ Optional text only metadata you might want to save in your header.
21
+ For instance it can be useful to specify more about the underlying
22
+ tensors. This is purely informative and does not affect tensor loading.
23
+
24
+ Returns:
25
+ `bytes`: The raw bytes representing the format
26
+
27
+ Example:
28
+
29
+ ```python
30
+ from safetensors.tensorflow import save
31
+ import tensorflow as tf
32
+
33
+ tensors = {"embedding": tf.zeros((512, 1024)), "attention": tf.zeros((256, 256))}
34
+ byte_data = save(tensors)
35
+ ```
36
+ """
37
+ np_tensors = _tf2np(tensors)
38
+ return numpy.save(np_tensors, metadata=metadata)
39
+
40
+
41
+ def save_file(
42
+ tensors: Dict[str, tf.Tensor],
43
+ filename: Union[str, os.PathLike],
44
+ metadata: Optional[Dict[str, str]] = None,
45
+ ) -> None:
46
+ """
47
+ Saves a dictionary of tensors into raw bytes in safetensors format.
48
+
49
+ Args:
50
+ tensors (`Dict[str, tf.Tensor]`):
51
+ The incoming tensors. Tensors need to be contiguous and dense.
52
+ filename (`str`, or `os.PathLike`)):
53
+ The filename we're saving into.
54
+ metadata (`Dict[str, str]`, *optional*, defaults to `None`):
55
+ Optional text only metadata you might want to save in your header.
56
+ For instance it can be useful to specify more about the underlying
57
+ tensors. This is purely informative and does not affect tensor loading.
58
+
59
+ Returns:
60
+ `None`
61
+
62
+ Example:
63
+
64
+ ```python
65
+ from safetensors.tensorflow import save_file
66
+ import tensorflow as tf
67
+
68
+ tensors = {"embedding": tf.zeros((512, 1024)), "attention": tf.zeros((256, 256))}
69
+ save_file(tensors, "model.safetensors")
70
+ ```
71
+ """
72
+ np_tensors = _tf2np(tensors)
73
+ return numpy.save_file(np_tensors, filename, metadata=metadata)
74
+
75
+
76
+ def load(data: bytes) -> Dict[str, tf.Tensor]:
77
+ """
78
+ Loads a safetensors file into tensorflow format from pure bytes.
79
+
80
+ Args:
81
+ data (`bytes`):
82
+ The content of a safetensors file
83
+
84
+ Returns:
85
+ `Dict[str, tf.Tensor]`: dictionary that contains name as key, value as `tf.Tensor` on cpu
86
+
87
+ Example:
88
+
89
+ ```python
90
+ from safetensors.tensorflow import load
91
+
92
+ file_path = "./my_folder/bert.safetensors"
93
+ with open(file_path, "rb") as f:
94
+ data = f.read()
95
+
96
+ loaded = load(data)
97
+ ```
98
+ """
99
+ flat = numpy.load(data)
100
+ return _np2tf(flat)
101
+
102
+
103
+ def load_file(filename: Union[str, os.PathLike]) -> Dict[str, tf.Tensor]:
104
+ """
105
+ Loads a safetensors file into tensorflow format.
106
+
107
+ Args:
108
+ filename (`str`, or `os.PathLike`)):
109
+ The name of the file which contains the tensors
110
+
111
+ Returns:
112
+ `Dict[str, tf.Tensor]`: dictionary that contains name as key, value as `tf.Tensor`
113
+
114
+ Example:
115
+
116
+ ```python
117
+ from safetensors.tensorflow import load_file
118
+
119
+ file_path = "./my_folder/bert.safetensors"
120
+ loaded = load_file(file_path)
121
+ ```
122
+ """
123
+ result = {}
124
+ with safe_open(filename, framework="tf") as f:
125
+ for k in f.offset_keys():
126
+ result[k] = f.get_tensor(k)
127
+ return result
128
+
129
+
130
+ def _np2tf(numpy_dict: Dict[str, np.ndarray]) -> Dict[str, tf.Tensor]:
131
+ for k, v in numpy_dict.items():
132
+ numpy_dict[k] = tf.convert_to_tensor(v)
133
+ return numpy_dict
134
+
135
+
136
+ def _tf2np(tf_dict: Dict[str, tf.Tensor]) -> Dict[str, np.array]:
137
+ for k, v in tf_dict.items():
138
+ tf_dict[k] = v.numpy()
139
+ return tf_dict
TTS/Kokoro/.venv/Lib/site-packages/safetensors/torch.py ADDED
@@ -0,0 +1,550 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import sys
3
+ from collections import defaultdict
4
+ from typing import Any, Dict, List, Optional, Set, Tuple, Union
5
+ from packaging.version import Version
6
+
7
+ import torch
8
+
9
+ from safetensors import deserialize, safe_open, serialize, serialize_file
10
+
11
+
12
+ def storage_ptr(tensor: torch.Tensor) -> int:
13
+ try:
14
+ return tensor.untyped_storage().data_ptr()
15
+ except Exception:
16
+ # Fallback for torch==1.10
17
+ try:
18
+ return tensor.storage().data_ptr()
19
+ except NotImplementedError:
20
+ # Fallback for meta storage
21
+ return 0
22
+
23
+
24
+ def _end_ptr(tensor: torch.Tensor) -> int:
25
+ if tensor.nelement():
26
+ stop = tensor.view(-1)[-1].data_ptr() + _SIZE[tensor.dtype]
27
+ else:
28
+ stop = tensor.data_ptr()
29
+ return stop
30
+
31
+
32
+ def storage_size(tensor: torch.Tensor) -> int:
33
+ try:
34
+ return tensor.untyped_storage().nbytes()
35
+ except AttributeError:
36
+ # Fallback for torch==1.10
37
+ try:
38
+ return tensor.storage().size() * _SIZE[tensor.dtype]
39
+ except NotImplementedError:
40
+ # Fallback for meta storage
41
+ # On torch >=2.0 this is the tensor size
42
+ return tensor.nelement() * _SIZE[tensor.dtype]
43
+
44
+
45
+ def _filter_shared_not_shared(
46
+ tensors: List[Set[str]], state_dict: Dict[str, torch.Tensor]
47
+ ) -> List[Set[str]]:
48
+ filtered_tensors = []
49
+ for shared in tensors:
50
+ if len(shared) < 2:
51
+ filtered_tensors.append(shared)
52
+ continue
53
+
54
+ areas = []
55
+ for name in shared:
56
+ tensor = state_dict[name]
57
+ areas.append((tensor.data_ptr(), _end_ptr(tensor), name))
58
+ areas.sort()
59
+
60
+ _, last_stop, last_name = areas[0]
61
+ filtered_tensors.append({last_name})
62
+ for start, stop, name in areas[1:]:
63
+ if start >= last_stop:
64
+ filtered_tensors.append({name})
65
+ else:
66
+ filtered_tensors[-1].add(name)
67
+ last_stop = stop
68
+
69
+ return filtered_tensors
70
+
71
+
72
+ def _find_shared_tensors(state_dict: Dict[str, torch.Tensor]) -> List[Set[str]]:
73
+ tensors = defaultdict(set)
74
+ for k, v in state_dict.items():
75
+ if (
76
+ v.device != torch.device("meta")
77
+ and storage_ptr(v) != 0
78
+ and storage_size(v) != 0
79
+ ):
80
+ # Need to add device as key because of multiple GPU.
81
+ tensors[(v.device, storage_ptr(v), storage_size(v))].add(k)
82
+ tensors = list(sorted(tensors.values()))
83
+ tensors = _filter_shared_not_shared(tensors, state_dict)
84
+ return tensors
85
+
86
+
87
+ def _is_complete(tensor: torch.Tensor) -> bool:
88
+ return tensor.data_ptr() == storage_ptr(tensor) and tensor.nelement() * _SIZE[
89
+ tensor.dtype
90
+ ] == storage_size(tensor)
91
+
92
+
93
+ def _remove_duplicate_names(
94
+ state_dict: Dict[str, torch.Tensor],
95
+ *,
96
+ preferred_names: Optional[List[str]] = None,
97
+ discard_names: Optional[List[str]] = None,
98
+ ) -> Dict[str, List[str]]:
99
+ if preferred_names is None:
100
+ preferred_names = []
101
+ preferred_names = set(preferred_names)
102
+ if discard_names is None:
103
+ discard_names = []
104
+ discard_names = set(discard_names)
105
+
106
+ shareds = _find_shared_tensors(state_dict)
107
+ to_remove = defaultdict(list)
108
+ for shared in shareds:
109
+ complete_names = set(
110
+ [name for name in shared if _is_complete(state_dict[name])]
111
+ )
112
+ if not complete_names:
113
+ raise RuntimeError(
114
+ "Error while trying to find names to remove to save state dict, but found no suitable name to keep"
115
+ f" for saving amongst: {shared}. None is covering the entire storage.Refusing to save/load the model"
116
+ " since you could be storing much more memory than needed. Please refer to"
117
+ " https://huggingface.co/docs/safetensors/torch_shared_tensors for more information. Or open an"
118
+ " issue."
119
+ )
120
+
121
+ keep_name = sorted(list(complete_names))[0]
122
+
123
+ # Mechanism to preferentially select keys to keep
124
+ # coming from the on-disk file to allow
125
+ # loading models saved with a different choice
126
+ # of keep_name
127
+ preferred = complete_names.difference(discard_names)
128
+ if preferred:
129
+ keep_name = sorted(list(preferred))[0]
130
+
131
+ if preferred_names:
132
+ preferred = preferred_names.intersection(complete_names)
133
+ if preferred:
134
+ keep_name = sorted(list(preferred))[0]
135
+ for name in sorted(shared):
136
+ if name != keep_name:
137
+ to_remove[keep_name].append(name)
138
+ return to_remove
139
+
140
+
141
+ def save_model(
142
+ model: torch.nn.Module,
143
+ filename: str,
144
+ metadata: Optional[Dict[str, str]] = None,
145
+ force_contiguous: bool = True,
146
+ ):
147
+ """
148
+ Saves a given torch model to specified filename.
149
+ This method exists specifically to avoid tensor sharing issues which are
150
+ not allowed in `safetensors`. [More information on tensor sharing](../torch_shared_tensors)
151
+
152
+ Args:
153
+ model (`torch.nn.Module`):
154
+ The model to save on disk.
155
+ filename (`str`):
156
+ The filename location to save the file
157
+ metadata (`Dict[str, str]`, *optional*):
158
+ Extra information to save along with the file.
159
+ Some metadata will be added for each dropped tensors.
160
+ This information will not be enough to recover the entire
161
+ shared structure but might help understanding things
162
+ force_contiguous (`boolean`, *optional*, defaults to True):
163
+ Forcing the state_dict to be saved as contiguous tensors.
164
+ This has no effect on the correctness of the model, but it
165
+ could potentially change performance if the layout of the tensor
166
+ was chosen specifically for that reason.
167
+ """
168
+ state_dict = model.state_dict()
169
+ to_removes = _remove_duplicate_names(state_dict)
170
+
171
+ for kept_name, to_remove_group in to_removes.items():
172
+ for to_remove in to_remove_group:
173
+ if metadata is None:
174
+ metadata = {}
175
+
176
+ if to_remove not in metadata:
177
+ # Do not override user data
178
+ metadata[to_remove] = kept_name
179
+ del state_dict[to_remove]
180
+ if force_contiguous:
181
+ state_dict = {k: v.contiguous() for k, v in state_dict.items()}
182
+ try:
183
+ save_file(state_dict, filename, metadata=metadata)
184
+ except ValueError as e:
185
+ msg = str(e)
186
+ msg += " Or use save_model(..., force_contiguous=True), read the docs for potential caveats."
187
+ raise ValueError(msg)
188
+
189
+
190
+ def load_model(
191
+ model: torch.nn.Module,
192
+ filename: Union[str, os.PathLike],
193
+ strict: bool = True,
194
+ device: Union[str, int] = "cpu",
195
+ ) -> Tuple[List[str], List[str]]:
196
+ """
197
+ Loads a given filename onto a torch model.
198
+ This method exists specifically to avoid tensor sharing issues which are
199
+ not allowed in `safetensors`. [More information on tensor sharing](../torch_shared_tensors)
200
+
201
+ Args:
202
+ model (`torch.nn.Module`):
203
+ The model to load onto.
204
+ filename (`str`, or `os.PathLike`):
205
+ The filename location to load the file from.
206
+ strict (`bool`, *optional*, defaults to True):
207
+ Whether to fail if you're missing keys or having unexpected ones.
208
+ When false, the function simply returns missing and unexpected names.
209
+ device (`Union[str, int]`, *optional*, defaults to `cpu`):
210
+ The device where the tensors need to be located after load.
211
+ available options are all regular torch device locations.
212
+
213
+ Returns:
214
+ `(missing, unexpected): (List[str], List[str])`
215
+ `missing` are names in the model which were not modified during loading
216
+ `unexpected` are names that are on the file, but weren't used during
217
+ the load.
218
+ """
219
+ state_dict = load_file(filename, device=device)
220
+ model_state_dict = model.state_dict()
221
+ to_removes = _remove_duplicate_names(
222
+ model_state_dict, preferred_names=state_dict.keys()
223
+ )
224
+ missing, unexpected = model.load_state_dict(state_dict, strict=False)
225
+ missing = set(missing)
226
+ for to_remove_group in to_removes.values():
227
+ for to_remove in to_remove_group:
228
+ if to_remove not in missing:
229
+ unexpected.append(to_remove)
230
+ else:
231
+ missing.remove(to_remove)
232
+ if strict and (missing or unexpected):
233
+ missing_keys = ", ".join([f'"{k}"' for k in sorted(missing)])
234
+ unexpected_keys = ", ".join([f'"{k}"' for k in sorted(unexpected)])
235
+ error = f"Error(s) in loading state_dict for {model.__class__.__name__}:"
236
+ if missing:
237
+ error += f"\n Missing key(s) in state_dict: {missing_keys}"
238
+ if unexpected:
239
+ error += f"\n Unexpected key(s) in state_dict: {unexpected_keys}"
240
+ raise RuntimeError(error)
241
+ return missing, unexpected
242
+
243
+
244
+ def save(
245
+ tensors: Dict[str, torch.Tensor], metadata: Optional[Dict[str, str]] = None
246
+ ) -> bytes:
247
+ """
248
+ Saves a dictionary of tensors into raw bytes in safetensors format.
249
+
250
+ Args:
251
+ tensors (`Dict[str, torch.Tensor]`):
252
+ The incoming tensors. Tensors need to be contiguous and dense.
253
+ metadata (`Dict[str, str]`, *optional*, defaults to `None`):
254
+ Optional text only metadata you might want to save in your header.
255
+ For instance it can be useful to specify more about the underlying
256
+ tensors. This is purely informative and does not affect tensor loading.
257
+
258
+ Returns:
259
+ `bytes`: The raw bytes representing the format
260
+
261
+ Example:
262
+
263
+ ```python
264
+ from safetensors.torch import save
265
+ import torch
266
+
267
+ tensors = {"embedding": torch.zeros((512, 1024)), "attention": torch.zeros((256, 256))}
268
+ byte_data = save(tensors)
269
+ ```
270
+ """
271
+ serialized = serialize(_flatten(tensors), metadata=metadata)
272
+ result = bytes(serialized)
273
+ return result
274
+
275
+
276
+ def save_file(
277
+ tensors: Dict[str, torch.Tensor],
278
+ filename: Union[str, os.PathLike],
279
+ metadata: Optional[Dict[str, str]] = None,
280
+ ):
281
+ """
282
+ Saves a dictionary of tensors into raw bytes in safetensors format.
283
+
284
+ Args:
285
+ tensors (`Dict[str, torch.Tensor]`):
286
+ The incoming tensors. Tensors need to be contiguous and dense.
287
+ filename (`str`, or `os.PathLike`)):
288
+ The filename we're saving into.
289
+ metadata (`Dict[str, str]`, *optional*, defaults to `None`):
290
+ Optional text only metadata you might want to save in your header.
291
+ For instance it can be useful to specify more about the underlying
292
+ tensors. This is purely informative and does not affect tensor loading.
293
+
294
+ Returns:
295
+ `None`
296
+
297
+ Example:
298
+
299
+ ```python
300
+ from safetensors.torch import save_file
301
+ import torch
302
+
303
+ tensors = {"embedding": torch.zeros((512, 1024)), "attention": torch.zeros((256, 256))}
304
+ save_file(tensors, "model.safetensors")
305
+ ```
306
+ """
307
+ serialize_file(_flatten(tensors), filename, metadata=metadata)
308
+
309
+
310
+ def load_file(
311
+ filename: Union[str, os.PathLike], device: Union[str, int] = "cpu"
312
+ ) -> Dict[str, torch.Tensor]:
313
+ """
314
+ Loads a safetensors file into torch format.
315
+
316
+ Args:
317
+ filename (`str`, or `os.PathLike`):
318
+ The name of the file which contains the tensors
319
+ device (`Union[str, int]`, *optional*, defaults to `cpu`):
320
+ The device where the tensors need to be located after load.
321
+ available options are all regular torch device locations.
322
+
323
+ Returns:
324
+ `Dict[str, torch.Tensor]`: dictionary that contains name as key, value as `torch.Tensor`
325
+
326
+ Example:
327
+
328
+ ```python
329
+ from safetensors.torch import load_file
330
+
331
+ file_path = "./my_folder/bert.safetensors"
332
+ loaded = load_file(file_path)
333
+ ```
334
+ """
335
+ result = {}
336
+ with safe_open(filename, framework="pt", device=device) as f:
337
+ for k in f.offset_keys():
338
+ result[k] = f.get_tensor(k)
339
+ return result
340
+
341
+
342
+ def load(data: bytes) -> Dict[str, torch.Tensor]:
343
+ """
344
+ Loads a safetensors file into torch format from pure bytes.
345
+
346
+ Args:
347
+ data (`bytes`):
348
+ The content of a safetensors file
349
+
350
+ Returns:
351
+ `Dict[str, torch.Tensor]`: dictionary that contains name as key, value as `torch.Tensor` on cpu
352
+
353
+ Example:
354
+
355
+ ```python
356
+ from safetensors.torch import load
357
+
358
+ file_path = "./my_folder/bert.safetensors"
359
+ with open(file_path, "rb") as f:
360
+ data = f.read()
361
+
362
+ loaded = load(data)
363
+ ```
364
+ """
365
+ flat = deserialize(data)
366
+ return _view2torch(flat)
367
+
368
+
369
+ # torch.float8 formats require 2.1; we do not support these dtypes on earlier versions
370
+ _float8_e4m3fn = getattr(torch, "float8_e4m3fn", None)
371
+ _float8_e5m2 = getattr(torch, "float8_e5m2", None)
372
+ _float8_e8m0 = getattr(torch, "float8_e8m0fnu", None)
373
+ _float4_e2m1_x2 = getattr(torch, "float4_e2m1fn_x2", None)
374
+
375
+ _SIZE = {
376
+ torch.int64: 8,
377
+ torch.float32: 4,
378
+ torch.int32: 4,
379
+ torch.bfloat16: 2,
380
+ torch.float16: 2,
381
+ torch.int16: 2,
382
+ torch.uint8: 1,
383
+ torch.int8: 1,
384
+ torch.bool: 1,
385
+ torch.float64: 8,
386
+ torch.complex64: 8,
387
+ _float8_e4m3fn: 1,
388
+ _float8_e5m2: 1,
389
+ _float8_e8m0: 1,
390
+ _float4_e2m1_x2: 1,
391
+ }
392
+ if Version(torch.__version__) >= Version("2.3.0"):
393
+ _SIZE.update(
394
+ {
395
+ torch.uint64: 8,
396
+ torch.uint32: 4,
397
+ torch.uint16: 2,
398
+ }
399
+ )
400
+
401
+ _TYPES = {
402
+ "F64": torch.float64,
403
+ "F32": torch.float32,
404
+ "F16": torch.float16,
405
+ "BF16": torch.bfloat16,
406
+ "I64": torch.int64,
407
+ "I32": torch.int32,
408
+ "I16": torch.int16,
409
+ "I8": torch.int8,
410
+ "U8": torch.uint8,
411
+ "BOOL": torch.bool,
412
+ "F8_E4M3": _float8_e4m3fn,
413
+ "F8_E5M2": _float8_e5m2,
414
+ "C64": torch.complex64,
415
+ }
416
+ if Version(torch.__version__) >= Version("2.3.0"):
417
+ _TYPES.update(
418
+ {
419
+ "U64": torch.uint64,
420
+ "U32": torch.uint32,
421
+ "U16": torch.uint16,
422
+ }
423
+ )
424
+
425
+
426
+ def _getdtype(dtype_str: str) -> torch.dtype:
427
+ return _TYPES[dtype_str]
428
+
429
+
430
+ def _view2torch(safeview) -> Dict[str, torch.Tensor]:
431
+ result = {}
432
+ for k, v in safeview:
433
+ dtype = _getdtype(v["dtype"])
434
+ if len(v["data"]) == 0:
435
+ # Workaround because frombuffer doesn't accept zero-size tensors
436
+ assert any(x == 0 for x in v["shape"])
437
+ arr = torch.empty(v["shape"], dtype=dtype)
438
+ else:
439
+ arr = torch.frombuffer(v["data"], dtype=dtype).reshape(v["shape"])
440
+ if sys.byteorder == "big":
441
+ arr = torch.from_numpy(arr.numpy().byteswap(inplace=False))
442
+ result[k] = arr
443
+
444
+ return result
445
+
446
+
447
+ def _tobytes(tensor: torch.Tensor, name: str) -> bytes:
448
+ if tensor.layout != torch.strided:
449
+ raise ValueError(
450
+ f"You are trying to save a sparse tensor: `{name}` which this library does not support."
451
+ " You can make it a dense tensor before saving with `.to_dense()` but be aware this might"
452
+ " make a much larger file than needed."
453
+ )
454
+
455
+ if not tensor.is_contiguous():
456
+ raise ValueError(
457
+ f"You are trying to save a non contiguous tensor: `{name}` which is not allowed. It either means you"
458
+ " are trying to save tensors which are reference of each other in which case it's recommended to save"
459
+ " only the full tensors, and reslice at load time, or simply call `.contiguous()` on your tensor to"
460
+ " pack it before saving."
461
+ )
462
+ if tensor.device.type != "cpu":
463
+ # Moving tensor to cpu before saving
464
+ tensor = tensor.to("cpu")
465
+
466
+ import ctypes
467
+
468
+ import numpy as np
469
+
470
+ # When shape is empty (scalar), np.prod returns a float
471
+ # we need a int for the following calculations
472
+ length = int(np.prod(tensor.shape).item())
473
+ bytes_per_item = _SIZE[tensor.dtype]
474
+
475
+ total_bytes = length * bytes_per_item
476
+
477
+ ptr = tensor.data_ptr()
478
+ if ptr == 0:
479
+ return b""
480
+ newptr = ctypes.cast(ptr, ctypes.POINTER(ctypes.c_ubyte))
481
+ data = np.ctypeslib.as_array(newptr, (total_bytes,)) # no internal copy
482
+ if sys.byteorder == "big":
483
+ NPDTYPES = {
484
+ torch.int64: np.int64,
485
+ torch.float32: np.float32,
486
+ torch.int32: np.int32,
487
+ # XXX: This is ok because both have the same width
488
+ torch.bfloat16: np.float16,
489
+ torch.float16: np.float16,
490
+ torch.int16: np.int16,
491
+ torch.uint8: np.uint8,
492
+ torch.int8: np.int8,
493
+ torch.bool: bool,
494
+ torch.float64: np.float64,
495
+ # XXX: This is ok because both have the same width and byteswap is a no-op anyway
496
+ _float8_e4m3fn: np.uint8,
497
+ _float8_e5m2: np.uint8,
498
+ torch.complex64: np.complex64,
499
+ }
500
+ npdtype = NPDTYPES[tensor.dtype]
501
+ # Not in place as that would potentially modify a live running model
502
+ data = data.view(npdtype).byteswap(inplace=False)
503
+ return data.tobytes()
504
+
505
+
506
+ def _flatten(tensors: Dict[str, torch.Tensor]) -> Dict[str, Dict[str, Any]]:
507
+ if not isinstance(tensors, dict):
508
+ raise ValueError(
509
+ f"Expected a dict of [str, torch.Tensor] but received {type(tensors)}"
510
+ )
511
+
512
+ invalid_tensors = []
513
+ for k, v in tensors.items():
514
+ if not isinstance(v, torch.Tensor):
515
+ raise ValueError(
516
+ f"Key `{k}` is invalid, expected torch.Tensor but received {type(v)}"
517
+ )
518
+
519
+ if v.layout != torch.strided:
520
+ invalid_tensors.append(k)
521
+ if invalid_tensors:
522
+ raise ValueError(
523
+ f"You are trying to save a sparse tensors: `{invalid_tensors}` which this library does not support."
524
+ " You can make it a dense tensor before saving with `.to_dense()` but be aware this might"
525
+ " make a much larger file than needed."
526
+ )
527
+
528
+ shared_pointers = _find_shared_tensors(tensors)
529
+ failing = []
530
+ for names in shared_pointers:
531
+ if len(names) > 1:
532
+ failing.append(names)
533
+
534
+ if failing:
535
+ raise RuntimeError(
536
+ f"""
537
+ Some tensors share memory, this will lead to duplicate memory on disk and potential differences when loading them again: {failing}.
538
+ A potential way to correctly save your model is to use `save_model`.
539
+ More information at https://huggingface.co/docs/safetensors/torch_shared_tensors
540
+ """
541
+ )
542
+
543
+ return {
544
+ k: {
545
+ "dtype": str(v.dtype).split(".")[-1],
546
+ "shape": v.shape,
547
+ "data": _tobytes(v, k),
548
+ }
549
+ for k, v in tensors.items()
550
+ }
TTS/Kokoro/.venv/Lib/site-packages/segments-2.3.0.dist-info/INSTALLER ADDED
@@ -0,0 +1 @@
 
 
1
+ pip
TTS/Kokoro/.venv/Lib/site-packages/segments-2.3.0.dist-info/LICENSE ADDED
@@ -0,0 +1,202 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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.
202
+