Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- pythonProject/.venv/Lib/site-packages/MarkupSafe-2.1.5.dist-info/INSTALLER +1 -0
- pythonProject/.venv/Lib/site-packages/MarkupSafe-2.1.5.dist-info/LICENSE.rst +28 -0
- pythonProject/.venv/Lib/site-packages/MarkupSafe-2.1.5.dist-info/METADATA +93 -0
- pythonProject/.venv/Lib/site-packages/MarkupSafe-2.1.5.dist-info/RECORD +14 -0
- pythonProject/.venv/Lib/site-packages/MarkupSafe-2.1.5.dist-info/WHEEL +5 -0
- pythonProject/.venv/Lib/site-packages/MarkupSafe-2.1.5.dist-info/top_level.txt +1 -0
- pythonProject/.venv/Lib/site-packages/markupsafe/__init__.py +332 -0
- pythonProject/.venv/Lib/site-packages/markupsafe/__pycache__/__init__.cpython-310.pyc +0 -0
- pythonProject/.venv/Lib/site-packages/markupsafe/__pycache__/_native.cpython-310.pyc +0 -0
- pythonProject/.venv/Lib/site-packages/markupsafe/_native.py +63 -0
- pythonProject/.venv/Lib/site-packages/markupsafe/_speedups.c +320 -0
- pythonProject/.venv/Lib/site-packages/markupsafe/_speedups.cp310-win_amd64.pyd +0 -0
- pythonProject/.venv/Lib/site-packages/markupsafe/_speedups.pyi +9 -0
- pythonProject/.venv/Lib/site-packages/ml_dtypes-0.5.3.dist-info/INSTALLER +1 -0
- pythonProject/.venv/Lib/site-packages/ml_dtypes-0.5.3.dist-info/METADATA +268 -0
- pythonProject/.venv/Lib/site-packages/ml_dtypes-0.5.3.dist-info/RECORD +15 -0
- pythonProject/.venv/Lib/site-packages/ml_dtypes-0.5.3.dist-info/WHEEL +5 -0
- pythonProject/.venv/Lib/site-packages/ml_dtypes-0.5.3.dist-info/licenses/LICENSE +202 -0
- pythonProject/.venv/Lib/site-packages/ml_dtypes-0.5.3.dist-info/licenses/LICENSE.eigen +373 -0
- pythonProject/.venv/Lib/site-packages/ml_dtypes-0.5.3.dist-info/top_level.txt +1 -0
- pythonProject/.venv/Lib/site-packages/ml_dtypes/__init__.py +77 -0
- pythonProject/.venv/Lib/site-packages/ml_dtypes/__pycache__/__init__.cpython-310.pyc +0 -0
- pythonProject/.venv/Lib/site-packages/ml_dtypes/__pycache__/_finfo.cpython-310.pyc +0 -0
- pythonProject/.venv/Lib/site-packages/ml_dtypes/__pycache__/_iinfo.cpython-310.pyc +0 -0
- pythonProject/.venv/Lib/site-packages/ml_dtypes/_finfo.py +713 -0
- pythonProject/.venv/Lib/site-packages/ml_dtypes/_iinfo.py +73 -0
- pythonProject/.venv/Lib/site-packages/ml_dtypes/py.typed +0 -0
- pythonProject/.venv/Lib/site-packages/mpmath-1.3.0.dist-info/INSTALLER +1 -0
- pythonProject/.venv/Lib/site-packages/mpmath-1.3.0.dist-info/LICENSE +27 -0
- pythonProject/.venv/Lib/site-packages/mpmath-1.3.0.dist-info/METADATA +233 -0
- pythonProject/.venv/Lib/site-packages/mpmath-1.3.0.dist-info/RECORD +180 -0
- pythonProject/.venv/Lib/site-packages/mpmath-1.3.0.dist-info/WHEEL +5 -0
- pythonProject/.venv/Lib/site-packages/mpmath-1.3.0.dist-info/top_level.txt +1 -0
- pythonProject/.venv/Lib/site-packages/mpmath/__pycache__/__init__.cpython-310.pyc +0 -0
- pythonProject/.venv/Lib/site-packages/mpmath/__pycache__/ctx_base.cpython-310.pyc +0 -0
- pythonProject/.venv/Lib/site-packages/mpmath/__pycache__/ctx_fp.cpython-310.pyc +0 -0
- pythonProject/.venv/Lib/site-packages/mpmath/__pycache__/ctx_iv.cpython-310.pyc +0 -0
- pythonProject/.venv/Lib/site-packages/mpmath/__pycache__/ctx_mp.cpython-310.pyc +0 -0
- pythonProject/.venv/Lib/site-packages/mpmath/__pycache__/ctx_mp_python.cpython-310.pyc +0 -0
- pythonProject/.venv/Lib/site-packages/mpmath/__pycache__/identification.cpython-310.pyc +0 -0
- pythonProject/.venv/Lib/site-packages/mpmath/__pycache__/math2.cpython-310.pyc +0 -0
- pythonProject/.venv/Lib/site-packages/mpmath/__pycache__/rational.cpython-310.pyc +0 -0
- pythonProject/.venv/Lib/site-packages/mpmath/__pycache__/usertools.cpython-310.pyc +0 -0
- pythonProject/.venv/Lib/site-packages/mpmath/__pycache__/visualization.cpython-310.pyc +0 -0
- pythonProject/.venv/Lib/site-packages/mpmath/calculus/__pycache__/__init__.cpython-310.pyc +0 -0
- pythonProject/.venv/Lib/site-packages/mpmath/calculus/__pycache__/odes.cpython-310.pyc +0 -0
- pythonProject/.venv/Lib/site-packages/mpmath/calculus/__pycache__/optimization.cpython-310.pyc +0 -0
- pythonProject/.venv/Lib/site-packages/mpmath/calculus/__pycache__/polynomials.cpython-310.pyc +0 -0
- pythonProject/.venv/Lib/site-packages/mpmath/calculus/__pycache__/quadrature.cpython-310.pyc +0 -0
- pythonProject/.venv/Lib/site-packages/mpmath/ctx_base.py +494 -0
pythonProject/.venv/Lib/site-packages/MarkupSafe-2.1.5.dist-info/INSTALLER
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
pip
|
pythonProject/.venv/Lib/site-packages/MarkupSafe-2.1.5.dist-info/LICENSE.rst
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Copyright 2010 Pallets
|
| 2 |
+
|
| 3 |
+
Redistribution and use in source and binary forms, with or without
|
| 4 |
+
modification, are permitted provided that the following conditions are
|
| 5 |
+
met:
|
| 6 |
+
|
| 7 |
+
1. Redistributions of source code must retain the above copyright
|
| 8 |
+
notice, this list of conditions and the following disclaimer.
|
| 9 |
+
|
| 10 |
+
2. Redistributions in binary form must reproduce the above copyright
|
| 11 |
+
notice, this list of conditions and the following disclaimer in the
|
| 12 |
+
documentation and/or other materials provided with the distribution.
|
| 13 |
+
|
| 14 |
+
3. Neither the name of the copyright holder nor the names of its
|
| 15 |
+
contributors may be used to endorse or promote products derived from
|
| 16 |
+
this software without specific prior written permission.
|
| 17 |
+
|
| 18 |
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
| 19 |
+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
| 20 |
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
| 21 |
+
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
| 22 |
+
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
| 23 |
+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
|
| 24 |
+
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
| 25 |
+
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
| 26 |
+
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
| 27 |
+
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
| 28 |
+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
pythonProject/.venv/Lib/site-packages/MarkupSafe-2.1.5.dist-info/METADATA
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Metadata-Version: 2.1
|
| 2 |
+
Name: MarkupSafe
|
| 3 |
+
Version: 2.1.5
|
| 4 |
+
Summary: Safely add untrusted strings to HTML/XML markup.
|
| 5 |
+
Home-page: https://palletsprojects.com/p/markupsafe/
|
| 6 |
+
Maintainer: Pallets
|
| 7 |
+
Maintainer-email: contact@palletsprojects.com
|
| 8 |
+
License: BSD-3-Clause
|
| 9 |
+
Project-URL: Donate, https://palletsprojects.com/donate
|
| 10 |
+
Project-URL: Documentation, https://markupsafe.palletsprojects.com/
|
| 11 |
+
Project-URL: Changes, https://markupsafe.palletsprojects.com/changes/
|
| 12 |
+
Project-URL: Source Code, https://github.com/pallets/markupsafe/
|
| 13 |
+
Project-URL: Issue Tracker, https://github.com/pallets/markupsafe/issues/
|
| 14 |
+
Project-URL: Chat, https://discord.gg/pallets
|
| 15 |
+
Classifier: Development Status :: 5 - Production/Stable
|
| 16 |
+
Classifier: Environment :: Web Environment
|
| 17 |
+
Classifier: Intended Audience :: Developers
|
| 18 |
+
Classifier: License :: OSI Approved :: BSD License
|
| 19 |
+
Classifier: Operating System :: OS Independent
|
| 20 |
+
Classifier: Programming Language :: Python
|
| 21 |
+
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
|
| 22 |
+
Classifier: Topic :: Text Processing :: Markup :: HTML
|
| 23 |
+
Requires-Python: >=3.7
|
| 24 |
+
Description-Content-Type: text/x-rst
|
| 25 |
+
License-File: LICENSE.rst
|
| 26 |
+
|
| 27 |
+
MarkupSafe
|
| 28 |
+
==========
|
| 29 |
+
|
| 30 |
+
MarkupSafe implements a text object that escapes characters so it is
|
| 31 |
+
safe to use in HTML and XML. Characters that have special meanings are
|
| 32 |
+
replaced so that they display as the actual characters. This mitigates
|
| 33 |
+
injection attacks, meaning untrusted user input can safely be displayed
|
| 34 |
+
on a page.
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
Installing
|
| 38 |
+
----------
|
| 39 |
+
|
| 40 |
+
Install and update using `pip`_:
|
| 41 |
+
|
| 42 |
+
.. code-block:: text
|
| 43 |
+
|
| 44 |
+
pip install -U MarkupSafe
|
| 45 |
+
|
| 46 |
+
.. _pip: https://pip.pypa.io/en/stable/getting-started/
|
| 47 |
+
|
| 48 |
+
|
| 49 |
+
Examples
|
| 50 |
+
--------
|
| 51 |
+
|
| 52 |
+
.. code-block:: pycon
|
| 53 |
+
|
| 54 |
+
>>> from markupsafe import Markup, escape
|
| 55 |
+
|
| 56 |
+
>>> # escape replaces special characters and wraps in Markup
|
| 57 |
+
>>> escape("<script>alert(document.cookie);</script>")
|
| 58 |
+
Markup('<script>alert(document.cookie);</script>')
|
| 59 |
+
|
| 60 |
+
>>> # wrap in Markup to mark text "safe" and prevent escaping
|
| 61 |
+
>>> Markup("<strong>Hello</strong>")
|
| 62 |
+
Markup('<strong>hello</strong>')
|
| 63 |
+
|
| 64 |
+
>>> escape(Markup("<strong>Hello</strong>"))
|
| 65 |
+
Markup('<strong>hello</strong>')
|
| 66 |
+
|
| 67 |
+
>>> # Markup is a str subclass
|
| 68 |
+
>>> # methods and operators escape their arguments
|
| 69 |
+
>>> template = Markup("Hello <em>{name}</em>")
|
| 70 |
+
>>> template.format(name='"World"')
|
| 71 |
+
Markup('Hello <em>"World"</em>')
|
| 72 |
+
|
| 73 |
+
|
| 74 |
+
Donate
|
| 75 |
+
------
|
| 76 |
+
|
| 77 |
+
The Pallets organization develops and supports MarkupSafe and other
|
| 78 |
+
popular packages. In order to grow the community of contributors and
|
| 79 |
+
users, and allow the maintainers to devote more time to the projects,
|
| 80 |
+
`please donate today`_.
|
| 81 |
+
|
| 82 |
+
.. _please donate today: https://palletsprojects.com/donate
|
| 83 |
+
|
| 84 |
+
|
| 85 |
+
Links
|
| 86 |
+
-----
|
| 87 |
+
|
| 88 |
+
- Documentation: https://markupsafe.palletsprojects.com/
|
| 89 |
+
- Changes: https://markupsafe.palletsprojects.com/changes/
|
| 90 |
+
- PyPI Releases: https://pypi.org/project/MarkupSafe/
|
| 91 |
+
- Source Code: https://github.com/pallets/markupsafe/
|
| 92 |
+
- Issue Tracker: https://github.com/pallets/markupsafe/issues/
|
| 93 |
+
- Chat: https://discord.gg/pallets
|
pythonProject/.venv/Lib/site-packages/MarkupSafe-2.1.5.dist-info/RECORD
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
MarkupSafe-2.1.5.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
|
| 2 |
+
MarkupSafe-2.1.5.dist-info/LICENSE.rst,sha256=RjHsDbX9kKVH4zaBcmTGeYIUM4FG-KyUtKV_lu6MnsQ,1503
|
| 3 |
+
MarkupSafe-2.1.5.dist-info/METADATA,sha256=icNlaniV7YIQZ1BScCVqNaRtm7MAgfw8d3OBmoSVyAY,3096
|
| 4 |
+
MarkupSafe-2.1.5.dist-info/RECORD,,
|
| 5 |
+
MarkupSafe-2.1.5.dist-info/WHEEL,sha256=5JPYeYl5ZdvdSkrGS4u21mmpPzpFx42qrXOSIgWf4pg,102
|
| 6 |
+
MarkupSafe-2.1.5.dist-info/top_level.txt,sha256=qy0Plje5IJuvsCBjejJyhDCjEAdcDLK_2agVcex8Z6U,11
|
| 7 |
+
markupsafe/__init__.py,sha256=m1ysNeqf55zbEoJtaovca40ivrkEFolPlw5bGoC5Gi4,11290
|
| 8 |
+
markupsafe/__pycache__/__init__.cpython-310.pyc,,
|
| 9 |
+
markupsafe/__pycache__/_native.cpython-310.pyc,,
|
| 10 |
+
markupsafe/_native.py,sha256=_Q7UsXCOvgdonCgqG3l5asANI6eo50EKnDM-mlwEC5M,1776
|
| 11 |
+
markupsafe/_speedups.c,sha256=n3jzzaJwXcoN8nTFyA53f3vSqsWK2vujI-v6QYifjhQ,7403
|
| 12 |
+
markupsafe/_speedups.cp310-win_amd64.pyd,sha256=f7I42eA3ZdDubzr--gvmEu2tzH32l9kfbhyWzWLfI7o,15872
|
| 13 |
+
markupsafe/_speedups.pyi,sha256=f5QtwIOP0eLrxh2v5p6SmaYmlcHIGIfmz0DovaqL0OU,238
|
| 14 |
+
markupsafe/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
pythonProject/.venv/Lib/site-packages/MarkupSafe-2.1.5.dist-info/WHEEL
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Wheel-Version: 1.0
|
| 2 |
+
Generator: bdist_wheel (0.42.0)
|
| 3 |
+
Root-Is-Purelib: false
|
| 4 |
+
Tag: cp310-cp310-win_amd64
|
| 5 |
+
|
pythonProject/.venv/Lib/site-packages/MarkupSafe-2.1.5.dist-info/top_level.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
markupsafe
|
pythonProject/.venv/Lib/site-packages/markupsafe/__init__.py
ADDED
|
@@ -0,0 +1,332 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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 |
+
class HasHTML(te.Protocol):
|
| 10 |
+
def __html__(self) -> str:
|
| 11 |
+
pass
|
| 12 |
+
|
| 13 |
+
_P = te.ParamSpec("_P")
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
__version__ = "2.1.5"
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
def _simple_escaping_wrapper(func: "t.Callable[_P, str]") -> "t.Callable[_P, Markup]":
|
| 20 |
+
@functools.wraps(func)
|
| 21 |
+
def wrapped(self: "Markup", *args: "_P.args", **kwargs: "_P.kwargs") -> "Markup":
|
| 22 |
+
arg_list = _escape_argspec(list(args), enumerate(args), self.escape)
|
| 23 |
+
_escape_argspec(kwargs, kwargs.items(), self.escape)
|
| 24 |
+
return self.__class__(func(self, *arg_list, **kwargs)) # type: ignore[arg-type]
|
| 25 |
+
|
| 26 |
+
return wrapped # type: ignore[return-value]
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
class Markup(str):
|
| 30 |
+
"""A string that is ready to be safely inserted into an HTML or XML
|
| 31 |
+
document, either because it was escaped or because it was marked
|
| 32 |
+
safe.
|
| 33 |
+
|
| 34 |
+
Passing an object to the constructor converts it to text and wraps
|
| 35 |
+
it to mark it safe without escaping. To escape the text, use the
|
| 36 |
+
:meth:`escape` class method instead.
|
| 37 |
+
|
| 38 |
+
>>> Markup("Hello, <em>World</em>!")
|
| 39 |
+
Markup('Hello, <em>World</em>!')
|
| 40 |
+
>>> Markup(42)
|
| 41 |
+
Markup('42')
|
| 42 |
+
>>> Markup.escape("Hello, <em>World</em>!")
|
| 43 |
+
Markup('Hello <em>World</em>!')
|
| 44 |
+
|
| 45 |
+
This implements the ``__html__()`` interface that some frameworks
|
| 46 |
+
use. Passing an object that implements ``__html__()`` will wrap the
|
| 47 |
+
output of that method, marking it safe.
|
| 48 |
+
|
| 49 |
+
>>> class Foo:
|
| 50 |
+
... def __html__(self):
|
| 51 |
+
... return '<a href="/foo">foo</a>'
|
| 52 |
+
...
|
| 53 |
+
>>> Markup(Foo())
|
| 54 |
+
Markup('<a href="/foo">foo</a>')
|
| 55 |
+
|
| 56 |
+
This is a subclass of :class:`str`. It has the same methods, but
|
| 57 |
+
escapes their arguments and returns a ``Markup`` instance.
|
| 58 |
+
|
| 59 |
+
>>> Markup("<em>%s</em>") % ("foo & bar",)
|
| 60 |
+
Markup('<em>foo & bar</em>')
|
| 61 |
+
>>> Markup("<em>Hello</em> ") + "<foo>"
|
| 62 |
+
Markup('<em>Hello</em> <foo>')
|
| 63 |
+
"""
|
| 64 |
+
|
| 65 |
+
__slots__ = ()
|
| 66 |
+
|
| 67 |
+
def __new__(
|
| 68 |
+
cls, base: t.Any = "", encoding: t.Optional[str] = None, errors: str = "strict"
|
| 69 |
+
) -> "te.Self":
|
| 70 |
+
if hasattr(base, "__html__"):
|
| 71 |
+
base = base.__html__()
|
| 72 |
+
|
| 73 |
+
if encoding is None:
|
| 74 |
+
return super().__new__(cls, base)
|
| 75 |
+
|
| 76 |
+
return super().__new__(cls, base, encoding, errors)
|
| 77 |
+
|
| 78 |
+
def __html__(self) -> "te.Self":
|
| 79 |
+
return self
|
| 80 |
+
|
| 81 |
+
def __add__(self, other: t.Union[str, "HasHTML"]) -> "te.Self":
|
| 82 |
+
if isinstance(other, str) or hasattr(other, "__html__"):
|
| 83 |
+
return self.__class__(super().__add__(self.escape(other)))
|
| 84 |
+
|
| 85 |
+
return NotImplemented
|
| 86 |
+
|
| 87 |
+
def __radd__(self, other: t.Union[str, "HasHTML"]) -> "te.Self":
|
| 88 |
+
if isinstance(other, str) or hasattr(other, "__html__"):
|
| 89 |
+
return self.escape(other).__add__(self)
|
| 90 |
+
|
| 91 |
+
return NotImplemented
|
| 92 |
+
|
| 93 |
+
def __mul__(self, num: "te.SupportsIndex") -> "te.Self":
|
| 94 |
+
if isinstance(num, int):
|
| 95 |
+
return self.__class__(super().__mul__(num))
|
| 96 |
+
|
| 97 |
+
return NotImplemented
|
| 98 |
+
|
| 99 |
+
__rmul__ = __mul__
|
| 100 |
+
|
| 101 |
+
def __mod__(self, arg: t.Any) -> "te.Self":
|
| 102 |
+
if isinstance(arg, tuple):
|
| 103 |
+
# a tuple of arguments, each wrapped
|
| 104 |
+
arg = tuple(_MarkupEscapeHelper(x, self.escape) for x in arg)
|
| 105 |
+
elif hasattr(type(arg), "__getitem__") and not isinstance(arg, str):
|
| 106 |
+
# a mapping of arguments, wrapped
|
| 107 |
+
arg = _MarkupEscapeHelper(arg, self.escape)
|
| 108 |
+
else:
|
| 109 |
+
# a single argument, wrapped with the helper and a tuple
|
| 110 |
+
arg = (_MarkupEscapeHelper(arg, self.escape),)
|
| 111 |
+
|
| 112 |
+
return self.__class__(super().__mod__(arg))
|
| 113 |
+
|
| 114 |
+
def __repr__(self) -> str:
|
| 115 |
+
return f"{self.__class__.__name__}({super().__repr__()})"
|
| 116 |
+
|
| 117 |
+
def join(self, seq: t.Iterable[t.Union[str, "HasHTML"]]) -> "te.Self":
|
| 118 |
+
return self.__class__(super().join(map(self.escape, seq)))
|
| 119 |
+
|
| 120 |
+
join.__doc__ = str.join.__doc__
|
| 121 |
+
|
| 122 |
+
def split( # type: ignore[override]
|
| 123 |
+
self, sep: t.Optional[str] = None, maxsplit: int = -1
|
| 124 |
+
) -> t.List["te.Self"]:
|
| 125 |
+
return [self.__class__(v) for v in super().split(sep, maxsplit)]
|
| 126 |
+
|
| 127 |
+
split.__doc__ = str.split.__doc__
|
| 128 |
+
|
| 129 |
+
def rsplit( # type: ignore[override]
|
| 130 |
+
self, sep: t.Optional[str] = None, maxsplit: int = -1
|
| 131 |
+
) -> t.List["te.Self"]:
|
| 132 |
+
return [self.__class__(v) for v in super().rsplit(sep, maxsplit)]
|
| 133 |
+
|
| 134 |
+
rsplit.__doc__ = str.rsplit.__doc__
|
| 135 |
+
|
| 136 |
+
def splitlines( # type: ignore[override]
|
| 137 |
+
self, keepends: bool = False
|
| 138 |
+
) -> t.List["te.Self"]:
|
| 139 |
+
return [self.__class__(v) for v in super().splitlines(keepends)]
|
| 140 |
+
|
| 141 |
+
splitlines.__doc__ = str.splitlines.__doc__
|
| 142 |
+
|
| 143 |
+
def unescape(self) -> str:
|
| 144 |
+
"""Convert escaped markup back into a text string. This replaces
|
| 145 |
+
HTML entities with the characters they represent.
|
| 146 |
+
|
| 147 |
+
>>> Markup("Main » <em>About</em>").unescape()
|
| 148 |
+
'Main » <em>About</em>'
|
| 149 |
+
"""
|
| 150 |
+
from html import unescape
|
| 151 |
+
|
| 152 |
+
return unescape(str(self))
|
| 153 |
+
|
| 154 |
+
def striptags(self) -> str:
|
| 155 |
+
""":meth:`unescape` the markup, remove tags, and normalize
|
| 156 |
+
whitespace to single spaces.
|
| 157 |
+
|
| 158 |
+
>>> Markup("Main »\t<em>About</em>").striptags()
|
| 159 |
+
'Main » About'
|
| 160 |
+
"""
|
| 161 |
+
value = str(self)
|
| 162 |
+
|
| 163 |
+
# Look for comments then tags separately. Otherwise, a comment that
|
| 164 |
+
# contains a tag would end early, leaving some of the comment behind.
|
| 165 |
+
|
| 166 |
+
while True:
|
| 167 |
+
# keep finding comment start marks
|
| 168 |
+
start = value.find("<!--")
|
| 169 |
+
|
| 170 |
+
if start == -1:
|
| 171 |
+
break
|
| 172 |
+
|
| 173 |
+
# find a comment end mark beyond the start, otherwise stop
|
| 174 |
+
end = value.find("-->", start)
|
| 175 |
+
|
| 176 |
+
if end == -1:
|
| 177 |
+
break
|
| 178 |
+
|
| 179 |
+
value = f"{value[:start]}{value[end + 3:]}"
|
| 180 |
+
|
| 181 |
+
# remove tags using the same method
|
| 182 |
+
while True:
|
| 183 |
+
start = value.find("<")
|
| 184 |
+
|
| 185 |
+
if start == -1:
|
| 186 |
+
break
|
| 187 |
+
|
| 188 |
+
end = value.find(">", start)
|
| 189 |
+
|
| 190 |
+
if end == -1:
|
| 191 |
+
break
|
| 192 |
+
|
| 193 |
+
value = f"{value[:start]}{value[end + 1:]}"
|
| 194 |
+
|
| 195 |
+
# collapse spaces
|
| 196 |
+
value = " ".join(value.split())
|
| 197 |
+
return self.__class__(value).unescape()
|
| 198 |
+
|
| 199 |
+
@classmethod
|
| 200 |
+
def escape(cls, s: t.Any) -> "te.Self":
|
| 201 |
+
"""Escape a string. Calls :func:`escape` and ensures that for
|
| 202 |
+
subclasses the correct type is returned.
|
| 203 |
+
"""
|
| 204 |
+
rv = escape(s)
|
| 205 |
+
|
| 206 |
+
if rv.__class__ is not cls:
|
| 207 |
+
return cls(rv)
|
| 208 |
+
|
| 209 |
+
return rv # type: ignore[return-value]
|
| 210 |
+
|
| 211 |
+
__getitem__ = _simple_escaping_wrapper(str.__getitem__)
|
| 212 |
+
capitalize = _simple_escaping_wrapper(str.capitalize)
|
| 213 |
+
title = _simple_escaping_wrapper(str.title)
|
| 214 |
+
lower = _simple_escaping_wrapper(str.lower)
|
| 215 |
+
upper = _simple_escaping_wrapper(str.upper)
|
| 216 |
+
replace = _simple_escaping_wrapper(str.replace)
|
| 217 |
+
ljust = _simple_escaping_wrapper(str.ljust)
|
| 218 |
+
rjust = _simple_escaping_wrapper(str.rjust)
|
| 219 |
+
lstrip = _simple_escaping_wrapper(str.lstrip)
|
| 220 |
+
rstrip = _simple_escaping_wrapper(str.rstrip)
|
| 221 |
+
center = _simple_escaping_wrapper(str.center)
|
| 222 |
+
strip = _simple_escaping_wrapper(str.strip)
|
| 223 |
+
translate = _simple_escaping_wrapper(str.translate)
|
| 224 |
+
expandtabs = _simple_escaping_wrapper(str.expandtabs)
|
| 225 |
+
swapcase = _simple_escaping_wrapper(str.swapcase)
|
| 226 |
+
zfill = _simple_escaping_wrapper(str.zfill)
|
| 227 |
+
casefold = _simple_escaping_wrapper(str.casefold)
|
| 228 |
+
|
| 229 |
+
if sys.version_info >= (3, 9):
|
| 230 |
+
removeprefix = _simple_escaping_wrapper(str.removeprefix)
|
| 231 |
+
removesuffix = _simple_escaping_wrapper(str.removesuffix)
|
| 232 |
+
|
| 233 |
+
def partition(self, sep: str) -> t.Tuple["te.Self", "te.Self", "te.Self"]:
|
| 234 |
+
l, s, r = super().partition(self.escape(sep))
|
| 235 |
+
cls = self.__class__
|
| 236 |
+
return cls(l), cls(s), cls(r)
|
| 237 |
+
|
| 238 |
+
def rpartition(self, sep: str) -> t.Tuple["te.Self", "te.Self", "te.Self"]:
|
| 239 |
+
l, s, r = super().rpartition(self.escape(sep))
|
| 240 |
+
cls = self.__class__
|
| 241 |
+
return cls(l), cls(s), cls(r)
|
| 242 |
+
|
| 243 |
+
def format(self, *args: t.Any, **kwargs: t.Any) -> "te.Self":
|
| 244 |
+
formatter = EscapeFormatter(self.escape)
|
| 245 |
+
return self.__class__(formatter.vformat(self, args, kwargs))
|
| 246 |
+
|
| 247 |
+
def format_map( # type: ignore[override]
|
| 248 |
+
self, map: t.Mapping[str, t.Any]
|
| 249 |
+
) -> "te.Self":
|
| 250 |
+
formatter = EscapeFormatter(self.escape)
|
| 251 |
+
return self.__class__(formatter.vformat(self, (), map))
|
| 252 |
+
|
| 253 |
+
def __html_format__(self, format_spec: str) -> "te.Self":
|
| 254 |
+
if format_spec:
|
| 255 |
+
raise ValueError("Unsupported format specification for Markup.")
|
| 256 |
+
|
| 257 |
+
return self
|
| 258 |
+
|
| 259 |
+
|
| 260 |
+
class EscapeFormatter(string.Formatter):
|
| 261 |
+
__slots__ = ("escape",)
|
| 262 |
+
|
| 263 |
+
def __init__(self, escape: t.Callable[[t.Any], Markup]) -> None:
|
| 264 |
+
self.escape = escape
|
| 265 |
+
super().__init__()
|
| 266 |
+
|
| 267 |
+
def format_field(self, value: t.Any, format_spec: str) -> str:
|
| 268 |
+
if hasattr(value, "__html_format__"):
|
| 269 |
+
rv = value.__html_format__(format_spec)
|
| 270 |
+
elif hasattr(value, "__html__"):
|
| 271 |
+
if format_spec:
|
| 272 |
+
raise ValueError(
|
| 273 |
+
f"Format specifier {format_spec} given, but {type(value)} does not"
|
| 274 |
+
" define __html_format__. A class that defines __html__ must define"
|
| 275 |
+
" __html_format__ to work with format specifiers."
|
| 276 |
+
)
|
| 277 |
+
rv = value.__html__()
|
| 278 |
+
else:
|
| 279 |
+
# We need to make sure the format spec is str here as
|
| 280 |
+
# otherwise the wrong callback methods are invoked.
|
| 281 |
+
rv = string.Formatter.format_field(self, value, str(format_spec))
|
| 282 |
+
return str(self.escape(rv))
|
| 283 |
+
|
| 284 |
+
|
| 285 |
+
_ListOrDict = t.TypeVar("_ListOrDict", list, dict)
|
| 286 |
+
|
| 287 |
+
|
| 288 |
+
def _escape_argspec(
|
| 289 |
+
obj: _ListOrDict, iterable: t.Iterable[t.Any], escape: t.Callable[[t.Any], Markup]
|
| 290 |
+
) -> _ListOrDict:
|
| 291 |
+
"""Helper for various string-wrapped functions."""
|
| 292 |
+
for key, value in iterable:
|
| 293 |
+
if isinstance(value, str) or hasattr(value, "__html__"):
|
| 294 |
+
obj[key] = escape(value)
|
| 295 |
+
|
| 296 |
+
return obj
|
| 297 |
+
|
| 298 |
+
|
| 299 |
+
class _MarkupEscapeHelper:
|
| 300 |
+
"""Helper for :meth:`Markup.__mod__`."""
|
| 301 |
+
|
| 302 |
+
__slots__ = ("obj", "escape")
|
| 303 |
+
|
| 304 |
+
def __init__(self, obj: t.Any, escape: t.Callable[[t.Any], Markup]) -> None:
|
| 305 |
+
self.obj = obj
|
| 306 |
+
self.escape = escape
|
| 307 |
+
|
| 308 |
+
def __getitem__(self, item: t.Any) -> "te.Self":
|
| 309 |
+
return self.__class__(self.obj[item], self.escape)
|
| 310 |
+
|
| 311 |
+
def __str__(self) -> str:
|
| 312 |
+
return str(self.escape(self.obj))
|
| 313 |
+
|
| 314 |
+
def __repr__(self) -> str:
|
| 315 |
+
return str(self.escape(repr(self.obj)))
|
| 316 |
+
|
| 317 |
+
def __int__(self) -> int:
|
| 318 |
+
return int(self.obj)
|
| 319 |
+
|
| 320 |
+
def __float__(self) -> float:
|
| 321 |
+
return float(self.obj)
|
| 322 |
+
|
| 323 |
+
|
| 324 |
+
# circular import
|
| 325 |
+
try:
|
| 326 |
+
from ._speedups import escape as escape
|
| 327 |
+
from ._speedups import escape_silent as escape_silent
|
| 328 |
+
from ._speedups import soft_str as soft_str
|
| 329 |
+
except ImportError:
|
| 330 |
+
from ._native import escape as escape
|
| 331 |
+
from ._native import escape_silent as escape_silent # noqa: F401
|
| 332 |
+
from ._native import soft_str as soft_str # noqa: F401
|
pythonProject/.venv/Lib/site-packages/markupsafe/__pycache__/__init__.cpython-310.pyc
ADDED
|
Binary file (11.3 kB). View file
|
|
|
pythonProject/.venv/Lib/site-packages/markupsafe/__pycache__/_native.cpython-310.pyc
ADDED
|
Binary file (1.99 kB). View file
|
|
|
pythonProject/.venv/Lib/site-packages/markupsafe/_native.py
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import typing as t
|
| 2 |
+
|
| 3 |
+
from . import Markup
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
def escape(s: t.Any) -> Markup:
|
| 7 |
+
"""Replace the characters ``&``, ``<``, ``>``, ``'``, and ``"`` in
|
| 8 |
+
the string with HTML-safe sequences. Use this if you need to display
|
| 9 |
+
text that might contain such characters in HTML.
|
| 10 |
+
|
| 11 |
+
If the object has an ``__html__`` method, it is called and the
|
| 12 |
+
return value is assumed to already be safe for HTML.
|
| 13 |
+
|
| 14 |
+
:param s: An object to be converted to a string and escaped.
|
| 15 |
+
:return: A :class:`Markup` string with the escaped text.
|
| 16 |
+
"""
|
| 17 |
+
if hasattr(s, "__html__"):
|
| 18 |
+
return Markup(s.__html__())
|
| 19 |
+
|
| 20 |
+
return Markup(
|
| 21 |
+
str(s)
|
| 22 |
+
.replace("&", "&")
|
| 23 |
+
.replace(">", ">")
|
| 24 |
+
.replace("<", "<")
|
| 25 |
+
.replace("'", "'")
|
| 26 |
+
.replace('"', """)
|
| 27 |
+
)
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
def escape_silent(s: t.Optional[t.Any]) -> Markup:
|
| 31 |
+
"""Like :func:`escape` but treats ``None`` as the empty string.
|
| 32 |
+
Useful with optional values, as otherwise you get the string
|
| 33 |
+
``'None'`` when the value is ``None``.
|
| 34 |
+
|
| 35 |
+
>>> escape(None)
|
| 36 |
+
Markup('None')
|
| 37 |
+
>>> escape_silent(None)
|
| 38 |
+
Markup('')
|
| 39 |
+
"""
|
| 40 |
+
if s is None:
|
| 41 |
+
return Markup()
|
| 42 |
+
|
| 43 |
+
return escape(s)
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
def soft_str(s: t.Any) -> str:
|
| 47 |
+
"""Convert an object to a string if it isn't already. This preserves
|
| 48 |
+
a :class:`Markup` string rather than converting it back to a basic
|
| 49 |
+
string, so it will still be marked as safe and won't be escaped
|
| 50 |
+
again.
|
| 51 |
+
|
| 52 |
+
>>> value = escape("<User 1>")
|
| 53 |
+
>>> value
|
| 54 |
+
Markup('<User 1>')
|
| 55 |
+
>>> escape(str(value))
|
| 56 |
+
Markup('&lt;User 1&gt;')
|
| 57 |
+
>>> escape(soft_str(value))
|
| 58 |
+
Markup('<User 1>')
|
| 59 |
+
"""
|
| 60 |
+
if not isinstance(s, str):
|
| 61 |
+
return str(s)
|
| 62 |
+
|
| 63 |
+
return s
|
pythonProject/.venv/Lib/site-packages/markupsafe/_speedups.c
ADDED
|
@@ -0,0 +1,320 @@
|
|
|
|
|
|
|
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|
+
/* import markup type so that we can mark the return value */
|
| 11 |
+
module = PyImport_ImportModule("markupsafe");
|
| 12 |
+
if (!module)
|
| 13 |
+
return 0;
|
| 14 |
+
markup = PyObject_GetAttrString(module, "Markup");
|
| 15 |
+
Py_DECREF(module);
|
| 16 |
+
|
| 17 |
+
return 1;
|
| 18 |
+
}
|
| 19 |
+
|
| 20 |
+
#define GET_DELTA(inp, inp_end, delta) \
|
| 21 |
+
while (inp < inp_end) { \
|
| 22 |
+
switch (*inp++) { \
|
| 23 |
+
case '"': \
|
| 24 |
+
case '\'': \
|
| 25 |
+
case '&': \
|
| 26 |
+
delta += 4; \
|
| 27 |
+
break; \
|
| 28 |
+
case '<': \
|
| 29 |
+
case '>': \
|
| 30 |
+
delta += 3; \
|
| 31 |
+
break; \
|
| 32 |
+
} \
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
#define DO_ESCAPE(inp, inp_end, outp) \
|
| 36 |
+
{ \
|
| 37 |
+
Py_ssize_t ncopy = 0; \
|
| 38 |
+
while (inp < inp_end) { \
|
| 39 |
+
switch (*inp) { \
|
| 40 |
+
case '"': \
|
| 41 |
+
memcpy(outp, inp-ncopy, sizeof(*outp)*ncopy); \
|
| 42 |
+
outp += ncopy; ncopy = 0; \
|
| 43 |
+
*outp++ = '&'; \
|
| 44 |
+
*outp++ = '#'; \
|
| 45 |
+
*outp++ = '3'; \
|
| 46 |
+
*outp++ = '4'; \
|
| 47 |
+
*outp++ = ';'; \
|
| 48 |
+
break; \
|
| 49 |
+
case '\'': \
|
| 50 |
+
memcpy(outp, inp-ncopy, sizeof(*outp)*ncopy); \
|
| 51 |
+
outp += ncopy; ncopy = 0; \
|
| 52 |
+
*outp++ = '&'; \
|
| 53 |
+
*outp++ = '#'; \
|
| 54 |
+
*outp++ = '3'; \
|
| 55 |
+
*outp++ = '9'; \
|
| 56 |
+
*outp++ = ';'; \
|
| 57 |
+
break; \
|
| 58 |
+
case '&': \
|
| 59 |
+
memcpy(outp, inp-ncopy, sizeof(*outp)*ncopy); \
|
| 60 |
+
outp += ncopy; ncopy = 0; \
|
| 61 |
+
*outp++ = '&'; \
|
| 62 |
+
*outp++ = 'a'; \
|
| 63 |
+
*outp++ = 'm'; \
|
| 64 |
+
*outp++ = 'p'; \
|
| 65 |
+
*outp++ = ';'; \
|
| 66 |
+
break; \
|
| 67 |
+
case '<': \
|
| 68 |
+
memcpy(outp, inp-ncopy, sizeof(*outp)*ncopy); \
|
| 69 |
+
outp += ncopy; ncopy = 0; \
|
| 70 |
+
*outp++ = '&'; \
|
| 71 |
+
*outp++ = 'l'; \
|
| 72 |
+
*outp++ = 't'; \
|
| 73 |
+
*outp++ = ';'; \
|
| 74 |
+
break; \
|
| 75 |
+
case '>': \
|
| 76 |
+
memcpy(outp, inp-ncopy, sizeof(*outp)*ncopy); \
|
| 77 |
+
outp += ncopy; ncopy = 0; \
|
| 78 |
+
*outp++ = '&'; \
|
| 79 |
+
*outp++ = 'g'; \
|
| 80 |
+
*outp++ = 't'; \
|
| 81 |
+
*outp++ = ';'; \
|
| 82 |
+
break; \
|
| 83 |
+
default: \
|
| 84 |
+
ncopy++; \
|
| 85 |
+
} \
|
| 86 |
+
inp++; \
|
| 87 |
+
} \
|
| 88 |
+
memcpy(outp, inp-ncopy, sizeof(*outp)*ncopy); \
|
| 89 |
+
}
|
| 90 |
+
|
| 91 |
+
static PyObject*
|
| 92 |
+
escape_unicode_kind1(PyUnicodeObject *in)
|
| 93 |
+
{
|
| 94 |
+
Py_UCS1 *inp = PyUnicode_1BYTE_DATA(in);
|
| 95 |
+
Py_UCS1 *inp_end = inp + PyUnicode_GET_LENGTH(in);
|
| 96 |
+
Py_UCS1 *outp;
|
| 97 |
+
PyObject *out;
|
| 98 |
+
Py_ssize_t delta = 0;
|
| 99 |
+
|
| 100 |
+
GET_DELTA(inp, inp_end, delta);
|
| 101 |
+
if (!delta) {
|
| 102 |
+
Py_INCREF(in);
|
| 103 |
+
return (PyObject*)in;
|
| 104 |
+
}
|
| 105 |
+
|
| 106 |
+
out = PyUnicode_New(PyUnicode_GET_LENGTH(in) + delta,
|
| 107 |
+
PyUnicode_IS_ASCII(in) ? 127 : 255);
|
| 108 |
+
if (!out)
|
| 109 |
+
return NULL;
|
| 110 |
+
|
| 111 |
+
inp = PyUnicode_1BYTE_DATA(in);
|
| 112 |
+
outp = PyUnicode_1BYTE_DATA(out);
|
| 113 |
+
DO_ESCAPE(inp, inp_end, outp);
|
| 114 |
+
return out;
|
| 115 |
+
}
|
| 116 |
+
|
| 117 |
+
static PyObject*
|
| 118 |
+
escape_unicode_kind2(PyUnicodeObject *in)
|
| 119 |
+
{
|
| 120 |
+
Py_UCS2 *inp = PyUnicode_2BYTE_DATA(in);
|
| 121 |
+
Py_UCS2 *inp_end = inp + PyUnicode_GET_LENGTH(in);
|
| 122 |
+
Py_UCS2 *outp;
|
| 123 |
+
PyObject *out;
|
| 124 |
+
Py_ssize_t delta = 0;
|
| 125 |
+
|
| 126 |
+
GET_DELTA(inp, inp_end, delta);
|
| 127 |
+
if (!delta) {
|
| 128 |
+
Py_INCREF(in);
|
| 129 |
+
return (PyObject*)in;
|
| 130 |
+
}
|
| 131 |
+
|
| 132 |
+
out = PyUnicode_New(PyUnicode_GET_LENGTH(in) + delta, 65535);
|
| 133 |
+
if (!out)
|
| 134 |
+
return NULL;
|
| 135 |
+
|
| 136 |
+
inp = PyUnicode_2BYTE_DATA(in);
|
| 137 |
+
outp = PyUnicode_2BYTE_DATA(out);
|
| 138 |
+
DO_ESCAPE(inp, inp_end, outp);
|
| 139 |
+
return out;
|
| 140 |
+
}
|
| 141 |
+
|
| 142 |
+
|
| 143 |
+
static PyObject*
|
| 144 |
+
escape_unicode_kind4(PyUnicodeObject *in)
|
| 145 |
+
{
|
| 146 |
+
Py_UCS4 *inp = PyUnicode_4BYTE_DATA(in);
|
| 147 |
+
Py_UCS4 *inp_end = inp + PyUnicode_GET_LENGTH(in);
|
| 148 |
+
Py_UCS4 *outp;
|
| 149 |
+
PyObject *out;
|
| 150 |
+
Py_ssize_t delta = 0;
|
| 151 |
+
|
| 152 |
+
GET_DELTA(inp, inp_end, delta);
|
| 153 |
+
if (!delta) {
|
| 154 |
+
Py_INCREF(in);
|
| 155 |
+
return (PyObject*)in;
|
| 156 |
+
}
|
| 157 |
+
|
| 158 |
+
out = PyUnicode_New(PyUnicode_GET_LENGTH(in) + delta, 1114111);
|
| 159 |
+
if (!out)
|
| 160 |
+
return NULL;
|
| 161 |
+
|
| 162 |
+
inp = PyUnicode_4BYTE_DATA(in);
|
| 163 |
+
outp = PyUnicode_4BYTE_DATA(out);
|
| 164 |
+
DO_ESCAPE(inp, inp_end, outp);
|
| 165 |
+
return out;
|
| 166 |
+
}
|
| 167 |
+
|
| 168 |
+
static PyObject*
|
| 169 |
+
escape_unicode(PyUnicodeObject *in)
|
| 170 |
+
{
|
| 171 |
+
if (PyUnicode_READY(in))
|
| 172 |
+
return NULL;
|
| 173 |
+
|
| 174 |
+
switch (PyUnicode_KIND(in)) {
|
| 175 |
+
case PyUnicode_1BYTE_KIND:
|
| 176 |
+
return escape_unicode_kind1(in);
|
| 177 |
+
case PyUnicode_2BYTE_KIND:
|
| 178 |
+
return escape_unicode_kind2(in);
|
| 179 |
+
case PyUnicode_4BYTE_KIND:
|
| 180 |
+
return escape_unicode_kind4(in);
|
| 181 |
+
}
|
| 182 |
+
assert(0); /* shouldn't happen */
|
| 183 |
+
return NULL;
|
| 184 |
+
}
|
| 185 |
+
|
| 186 |
+
static PyObject*
|
| 187 |
+
escape(PyObject *self, PyObject *text)
|
| 188 |
+
{
|
| 189 |
+
static PyObject *id_html;
|
| 190 |
+
PyObject *s = NULL, *rv = NULL, *html;
|
| 191 |
+
|
| 192 |
+
if (id_html == NULL) {
|
| 193 |
+
id_html = PyUnicode_InternFromString("__html__");
|
| 194 |
+
if (id_html == NULL) {
|
| 195 |
+
return NULL;
|
| 196 |
+
}
|
| 197 |
+
}
|
| 198 |
+
|
| 199 |
+
/* we don't have to escape integers, bools or floats */
|
| 200 |
+
if (PyLong_CheckExact(text) ||
|
| 201 |
+
PyFloat_CheckExact(text) || PyBool_Check(text) ||
|
| 202 |
+
text == Py_None)
|
| 203 |
+
return PyObject_CallFunctionObjArgs(markup, text, NULL);
|
| 204 |
+
|
| 205 |
+
/* if the object has an __html__ method that performs the escaping */
|
| 206 |
+
html = PyObject_GetAttr(text ,id_html);
|
| 207 |
+
if (html) {
|
| 208 |
+
s = PyObject_CallObject(html, NULL);
|
| 209 |
+
Py_DECREF(html);
|
| 210 |
+
if (s == NULL) {
|
| 211 |
+
return NULL;
|
| 212 |
+
}
|
| 213 |
+
/* Convert to Markup object */
|
| 214 |
+
rv = PyObject_CallFunctionObjArgs(markup, (PyObject*)s, NULL);
|
| 215 |
+
Py_DECREF(s);
|
| 216 |
+
return rv;
|
| 217 |
+
}
|
| 218 |
+
|
| 219 |
+
/* otherwise make the object unicode if it isn't, then escape */
|
| 220 |
+
PyErr_Clear();
|
| 221 |
+
if (!PyUnicode_Check(text)) {
|
| 222 |
+
PyObject *unicode = PyObject_Str(text);
|
| 223 |
+
if (!unicode)
|
| 224 |
+
return NULL;
|
| 225 |
+
s = escape_unicode((PyUnicodeObject*)unicode);
|
| 226 |
+
Py_DECREF(unicode);
|
| 227 |
+
}
|
| 228 |
+
else
|
| 229 |
+
s = escape_unicode((PyUnicodeObject*)text);
|
| 230 |
+
|
| 231 |
+
/* convert the unicode string into a markup object. */
|
| 232 |
+
rv = PyObject_CallFunctionObjArgs(markup, (PyObject*)s, NULL);
|
| 233 |
+
Py_DECREF(s);
|
| 234 |
+
return rv;
|
| 235 |
+
}
|
| 236 |
+
|
| 237 |
+
|
| 238 |
+
static PyObject*
|
| 239 |
+
escape_silent(PyObject *self, PyObject *text)
|
| 240 |
+
{
|
| 241 |
+
if (text != Py_None)
|
| 242 |
+
return escape(self, text);
|
| 243 |
+
return PyObject_CallFunctionObjArgs(markup, NULL);
|
| 244 |
+
}
|
| 245 |
+
|
| 246 |
+
|
| 247 |
+
static PyObject*
|
| 248 |
+
soft_str(PyObject *self, PyObject *s)
|
| 249 |
+
{
|
| 250 |
+
if (!PyUnicode_Check(s))
|
| 251 |
+
return PyObject_Str(s);
|
| 252 |
+
Py_INCREF(s);
|
| 253 |
+
return s;
|
| 254 |
+
}
|
| 255 |
+
|
| 256 |
+
|
| 257 |
+
static PyMethodDef module_methods[] = {
|
| 258 |
+
{
|
| 259 |
+
"escape",
|
| 260 |
+
(PyCFunction)escape,
|
| 261 |
+
METH_O,
|
| 262 |
+
"Replace the characters ``&``, ``<``, ``>``, ``'``, and ``\"`` in"
|
| 263 |
+
" the string with HTML-safe sequences. Use this if you need to display"
|
| 264 |
+
" text that might contain such characters in HTML.\n\n"
|
| 265 |
+
"If the object has an ``__html__`` method, it is called and the"
|
| 266 |
+
" return value is assumed to already be safe for HTML.\n\n"
|
| 267 |
+
":param s: An object to be converted to a string and escaped.\n"
|
| 268 |
+
":return: A :class:`Markup` string with the escaped text.\n"
|
| 269 |
+
},
|
| 270 |
+
{
|
| 271 |
+
"escape_silent",
|
| 272 |
+
(PyCFunction)escape_silent,
|
| 273 |
+
METH_O,
|
| 274 |
+
"Like :func:`escape` but treats ``None`` as the empty string."
|
| 275 |
+
" Useful with optional values, as otherwise you get the string"
|
| 276 |
+
" ``'None'`` when the value is ``None``.\n\n"
|
| 277 |
+
">>> escape(None)\n"
|
| 278 |
+
"Markup('None')\n"
|
| 279 |
+
">>> escape_silent(None)\n"
|
| 280 |
+
"Markup('')\n"
|
| 281 |
+
},
|
| 282 |
+
{
|
| 283 |
+
"soft_str",
|
| 284 |
+
(PyCFunction)soft_str,
|
| 285 |
+
METH_O,
|
| 286 |
+
"Convert an object to a string if it isn't already. This preserves"
|
| 287 |
+
" a :class:`Markup` string rather than converting it back to a basic"
|
| 288 |
+
" string, so it will still be marked as safe and won't be escaped"
|
| 289 |
+
" again.\n\n"
|
| 290 |
+
">>> value = escape(\"<User 1>\")\n"
|
| 291 |
+
">>> value\n"
|
| 292 |
+
"Markup('<User 1>')\n"
|
| 293 |
+
">>> escape(str(value))\n"
|
| 294 |
+
"Markup('&lt;User 1&gt;')\n"
|
| 295 |
+
">>> escape(soft_str(value))\n"
|
| 296 |
+
"Markup('<User 1>')\n"
|
| 297 |
+
},
|
| 298 |
+
{NULL, NULL, 0, NULL} /* Sentinel */
|
| 299 |
+
};
|
| 300 |
+
|
| 301 |
+
static struct PyModuleDef module_definition = {
|
| 302 |
+
PyModuleDef_HEAD_INIT,
|
| 303 |
+
"markupsafe._speedups",
|
| 304 |
+
NULL,
|
| 305 |
+
-1,
|
| 306 |
+
module_methods,
|
| 307 |
+
NULL,
|
| 308 |
+
NULL,
|
| 309 |
+
NULL,
|
| 310 |
+
NULL
|
| 311 |
+
};
|
| 312 |
+
|
| 313 |
+
PyMODINIT_FUNC
|
| 314 |
+
PyInit__speedups(void)
|
| 315 |
+
{
|
| 316 |
+
if (!init_constants())
|
| 317 |
+
return NULL;
|
| 318 |
+
|
| 319 |
+
return PyModule_Create(&module_definition);
|
| 320 |
+
}
|
pythonProject/.venv/Lib/site-packages/markupsafe/_speedups.cp310-win_amd64.pyd
ADDED
|
Binary file (15.9 kB). View file
|
|
|
pythonProject/.venv/Lib/site-packages/markupsafe/_speedups.pyi
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from typing import Any
|
| 2 |
+
from typing import Optional
|
| 3 |
+
|
| 4 |
+
from . import Markup
|
| 5 |
+
|
| 6 |
+
def escape(s: Any) -> Markup: ...
|
| 7 |
+
def escape_silent(s: Optional[Any]) -> Markup: ...
|
| 8 |
+
def soft_str(s: Any) -> str: ...
|
| 9 |
+
def soft_unicode(s: Any) -> str: ...
|
pythonProject/.venv/Lib/site-packages/ml_dtypes-0.5.3.dist-info/INSTALLER
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
pip
|
pythonPro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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Metadata-Version: 2.4
|
| 2 |
+
Name: ml_dtypes
|
| 3 |
+
Version: 0.5.3
|
| 4 |
+
Summary: ml_dtypes is a stand-alone implementation of several NumPy dtype extensions used in machine learning.
|
| 5 |
+
Author-email: ml_dtypes authors <ml_dtypes@google.com>
|
| 6 |
+
License-Expression: Apache-2.0
|
| 7 |
+
Project-URL: homepage, https://github.com/jax-ml/ml_dtypes
|
| 8 |
+
Project-URL: repository, https://github.com/jax-ml/ml_dtypes
|
| 9 |
+
Classifier: Programming Language :: Python :: 3
|
| 10 |
+
Classifier: Programming Language :: Python :: 3 :: Only
|
| 11 |
+
Classifier: Intended Audience :: Science/Research
|
| 12 |
+
Requires-Python: >=3.9
|
| 13 |
+
Description-Content-Type: text/markdown
|
| 14 |
+
License-File: LICENSE
|
| 15 |
+
License-File: LICENSE.eigen
|
| 16 |
+
Requires-Dist: numpy>=1.21
|
| 17 |
+
Requires-Dist: numpy>=1.21.2; python_version >= "3.10"
|
| 18 |
+
Requires-Dist: numpy>=1.23.3; python_version >= "3.11"
|
| 19 |
+
Requires-Dist: numpy>=1.26.0; python_version >= "3.12"
|
| 20 |
+
Requires-Dist: numpy>=2.1.0; python_version >= "3.13"
|
| 21 |
+
Provides-Extra: dev
|
| 22 |
+
Requires-Dist: absl-py; extra == "dev"
|
| 23 |
+
Requires-Dist: pytest; extra == "dev"
|
| 24 |
+
Requires-Dist: pytest-xdist; extra == "dev"
|
| 25 |
+
Requires-Dist: pylint>=2.6.0; extra == "dev"
|
| 26 |
+
Requires-Dist: pyink; extra == "dev"
|
| 27 |
+
Dynamic: license-file
|
| 28 |
+
|
| 29 |
+
# ml_dtypes
|
| 30 |
+
|
| 31 |
+
[](https://github.com/jax-ml/ml_dtypes/actions/workflows/test.yml)
|
| 32 |
+
[](https://github.com/jax-ml/ml_dtypes/actions/workflows/wheels.yml)
|
| 33 |
+
[](https://badge.fury.io/py/ml_dtypes)
|
| 34 |
+
|
| 35 |
+
`ml_dtypes` is a stand-alone implementation of several NumPy dtype extensions used in machine learning libraries, including:
|
| 36 |
+
|
| 37 |
+
- [`bfloat16`](https://en.wikipedia.org/wiki/Bfloat16_floating-point_format):
|
| 38 |
+
an alternative to the standard [`float16`](https://en.wikipedia.org/wiki/Half-precision_floating-point_format) format
|
| 39 |
+
- 8-bit floating point representations, parameterized by number of exponent and
|
| 40 |
+
mantissa bits, as well as the bias (if any) and representability of infinity,
|
| 41 |
+
NaN, and signed zero.
|
| 42 |
+
* `float8_e3m4`
|
| 43 |
+
* `float8_e4m3`
|
| 44 |
+
* `float8_e4m3b11fnuz`
|
| 45 |
+
* `float8_e4m3fn`
|
| 46 |
+
* `float8_e4m3fnuz`
|
| 47 |
+
* `float8_e5m2`
|
| 48 |
+
* `float8_e5m2fnuz`
|
| 49 |
+
* `float8_e8m0fnu`
|
| 50 |
+
- Microscaling (MX) sub-byte floating point representations:
|
| 51 |
+
* `float4_e2m1fn`
|
| 52 |
+
* `float6_e2m3fn`
|
| 53 |
+
* `float6_e3m2fn`
|
| 54 |
+
- Narrow integer encodings:
|
| 55 |
+
* `int2`
|
| 56 |
+
* `int4`
|
| 57 |
+
* `uint2`
|
| 58 |
+
* `uint4`
|
| 59 |
+
|
| 60 |
+
See below for specifications of these number formats.
|
| 61 |
+
|
| 62 |
+
## Installation
|
| 63 |
+
|
| 64 |
+
The `ml_dtypes` package is tested with Python versions 3.9-3.12, and can be installed
|
| 65 |
+
with the following command:
|
| 66 |
+
```
|
| 67 |
+
pip install ml_dtypes
|
| 68 |
+
```
|
| 69 |
+
To test your installation, you can run the following:
|
| 70 |
+
```
|
| 71 |
+
pip install absl-py pytest
|
| 72 |
+
pytest --pyargs ml_dtypes
|
| 73 |
+
```
|
| 74 |
+
To build from source, clone the repository and run:
|
| 75 |
+
```
|
| 76 |
+
git submodule init
|
| 77 |
+
git submodule update
|
| 78 |
+
pip install .
|
| 79 |
+
```
|
| 80 |
+
|
| 81 |
+
## Example Usage
|
| 82 |
+
|
| 83 |
+
```python
|
| 84 |
+
>>> from ml_dtypes import bfloat16
|
| 85 |
+
>>> import numpy as np
|
| 86 |
+
>>> np.zeros(4, dtype=bfloat16)
|
| 87 |
+
array([0, 0, 0, 0], dtype=bfloat16)
|
| 88 |
+
```
|
| 89 |
+
Importing `ml_dtypes` also registers the data types with numpy, so that they may
|
| 90 |
+
be referred to by their string name:
|
| 91 |
+
|
| 92 |
+
```python
|
| 93 |
+
>>> np.dtype('bfloat16')
|
| 94 |
+
dtype(bfloat16)
|
| 95 |
+
>>> np.dtype('float8_e5m2')
|
| 96 |
+
dtype(float8_e5m2)
|
| 97 |
+
```
|
| 98 |
+
|
| 99 |
+
## Specifications of implemented floating point formats
|
| 100 |
+
|
| 101 |
+
### `bfloat16`
|
| 102 |
+
|
| 103 |
+
A `bfloat16` number is a single-precision float truncated at 16 bits.
|
| 104 |
+
|
| 105 |
+
Exponent: 8, Mantissa: 7, exponent bias: 127. IEEE 754, with NaN and inf.
|
| 106 |
+
|
| 107 |
+
### `float4_e2m1fn`
|
| 108 |
+
|
| 109 |
+
Exponent: 2, Mantissa: 1, bias: 1.
|
| 110 |
+
|
| 111 |
+
Extended range: no inf, no NaN.
|
| 112 |
+
|
| 113 |
+
Microscaling format, 4 bits (encoding: `0bSEEM`) using byte storage (higher 4
|
| 114 |
+
bits are unused). NaN representation is undefined.
|
| 115 |
+
|
| 116 |
+
Possible absolute values: [`0`, `0.5`, `1`, `1.5`, `2`, `3`, `4`, `6`]
|
| 117 |
+
|
| 118 |
+
### `float6_e2m3fn`
|
| 119 |
+
|
| 120 |
+
Exponent: 2, Mantissa: 3, bias: 1.
|
| 121 |
+
|
| 122 |
+
Extended range: no inf, no NaN.
|
| 123 |
+
|
| 124 |
+
Microscaling format, 6 bits (encoding: `0bSEEMMM`) using byte storage (higher 2
|
| 125 |
+
bits are unused). NaN representation is undefined.
|
| 126 |
+
|
| 127 |
+
Possible values range: [`-7.5`; `7.5`]
|
| 128 |
+
|
| 129 |
+
### `float6_e3m2fn`
|
| 130 |
+
|
| 131 |
+
Exponent: 3, Mantissa: 2, bias: 3.
|
| 132 |
+
|
| 133 |
+
Extended range: no inf, no NaN.
|
| 134 |
+
|
| 135 |
+
Microscaling format, 4 bits (encoding: `0bSEEEMM`) using byte storage (higher 2
|
| 136 |
+
bits are unused). NaN representation is undefined.
|
| 137 |
+
|
| 138 |
+
Possible values range: [`-28`; `28`]
|
| 139 |
+
|
| 140 |
+
### `float8_e3m4`
|
| 141 |
+
|
| 142 |
+
Exponent: 3, Mantissa: 4, bias: 3. IEEE 754, with NaN and inf.
|
| 143 |
+
|
| 144 |
+
### `float8_e4m3`
|
| 145 |
+
|
| 146 |
+
Exponent: 4, Mantissa: 3, bias: 7. IEEE 754, with NaN and inf.
|
| 147 |
+
|
| 148 |
+
### `float8_e4m3b11fnuz`
|
| 149 |
+
|
| 150 |
+
Exponent: 4, Mantissa: 3, bias: 11.
|
| 151 |
+
|
| 152 |
+
Extended range: no inf, NaN represented by 0b1000'0000.
|
| 153 |
+
|
| 154 |
+
### `float8_e4m3fn`
|
| 155 |
+
|
| 156 |
+
Exponent: 4, Mantissa: 3, bias: 7.
|
| 157 |
+
|
| 158 |
+
Extended range: no inf, NaN represented by 0bS111'1111.
|
| 159 |
+
|
| 160 |
+
The `fn` suffix is for consistency with the corresponding LLVM/MLIR type, signaling this type is not consistent with IEEE-754. The `f` indicates it is finite values only. The `n` indicates it includes NaNs, but only at the outer range.
|
| 161 |
+
|
| 162 |
+
### `float8_e4m3fnuz`
|
| 163 |
+
|
| 164 |
+
8-bit floating point with 3 bit mantissa.
|
| 165 |
+
|
| 166 |
+
An 8-bit floating point type with 1 sign bit, 4 bits exponent and 3 bits mantissa. The suffix `fnuz` is consistent with LLVM/MLIR naming and is derived from the differences to IEEE floating point conventions. `F` is for "finite" (no infinities), `N` for with special NaN encoding, `UZ` for unsigned zero.
|
| 167 |
+
|
| 168 |
+
This type has the following characteristics:
|
| 169 |
+
* bit encoding: S1E4M3 - `0bSEEEEMMM`
|
| 170 |
+
* exponent bias: 8
|
| 171 |
+
* infinities: Not supported
|
| 172 |
+
* NaNs: Supported with sign bit set to 1, exponent bits and mantissa bits set to all 0s - `0b10000000`
|
| 173 |
+
* denormals when exponent is 0
|
| 174 |
+
|
| 175 |
+
### `float8_e5m2`
|
| 176 |
+
|
| 177 |
+
Exponent: 5, Mantissa: 2, bias: 15. IEEE 754, with NaN and inf.
|
| 178 |
+
|
| 179 |
+
### `float8_e5m2fnuz`
|
| 180 |
+
|
| 181 |
+
8-bit floating point with 2 bit mantissa.
|
| 182 |
+
|
| 183 |
+
An 8-bit floating point type with 1 sign bit, 5 bits exponent and 2 bits mantissa. The suffix `fnuz` is consistent with LLVM/MLIR naming and is derived from the differences to IEEE floating point conventions. `F` is for "finite" (no infinities), `N` for with special NaN encoding, `UZ` for unsigned zero.
|
| 184 |
+
|
| 185 |
+
This type has the following characteristics:
|
| 186 |
+
* bit encoding: S1E5M2 - `0bSEEEEEMM`
|
| 187 |
+
* exponent bias: 16
|
| 188 |
+
* infinities: Not supported
|
| 189 |
+
* NaNs: Supported with sign bit set to 1, exponent bits and mantissa bits set to all 0s - `0b10000000`
|
| 190 |
+
* denormals when exponent is 0
|
| 191 |
+
|
| 192 |
+
### `float8_e8m0fnu`
|
| 193 |
+
|
| 194 |
+
[OpenCompute MX](https://www.opencompute.org/documents/ocp-microscaling-formats-mx-v1-0-spec-final-pdf)
|
| 195 |
+
scale format E8M0, which has the following properties:
|
| 196 |
+
* Unsigned format
|
| 197 |
+
* 8 exponent bits
|
| 198 |
+
* Exponent range from -127 to 127
|
| 199 |
+
* No zero and infinity
|
| 200 |
+
* Single NaN value (0xFF).
|
| 201 |
+
|
| 202 |
+
## `int2`, `int4`, `uint2` and `uint4`
|
| 203 |
+
|
| 204 |
+
2 and 4-bit integer types, where each element is represented unpacked (i.e.,
|
| 205 |
+
padded up to a byte in memory).
|
| 206 |
+
|
| 207 |
+
NumPy does not support types smaller than a single byte: for example, the
|
| 208 |
+
distance between adjacent elements in an array (`.strides`) is expressed as
|
| 209 |
+
an integer number of bytes. Relaxing this restriction would be a considerable
|
| 210 |
+
engineering project. These types therefore use an unpacked representation, where
|
| 211 |
+
each element of the array is padded up to a byte in memory. The lower two or four
|
| 212 |
+
bits of each byte contain the representation of the number, whereas the remaining
|
| 213 |
+
upper bits are ignored.
|
| 214 |
+
|
| 215 |
+
## Quirks of low-precision Arithmetic
|
| 216 |
+
|
| 217 |
+
If you're exploring the use of low-precision dtypes in your code, you should be
|
| 218 |
+
careful to anticipate when the precision loss might lead to surprising results.
|
| 219 |
+
One example is the behavior of aggregations like `sum`; consider this `bfloat16`
|
| 220 |
+
summation in NumPy (run with version 1.24.2):
|
| 221 |
+
|
| 222 |
+
```python
|
| 223 |
+
>>> from ml_dtypes import bfloat16
|
| 224 |
+
>>> import numpy as np
|
| 225 |
+
>>> rng = np.random.default_rng(seed=0)
|
| 226 |
+
>>> vals = rng.uniform(size=10000).astype(bfloat16)
|
| 227 |
+
>>> vals.sum()
|
| 228 |
+
256
|
| 229 |
+
```
|
| 230 |
+
The true sum should be close to 5000, but numpy returns exactly 256: this is
|
| 231 |
+
because `bfloat16` does not have the precision to increment `256` by values less than
|
| 232 |
+
`1`:
|
| 233 |
+
|
| 234 |
+
```python
|
| 235 |
+
>>> bfloat16(256) + bfloat16(1)
|
| 236 |
+
256
|
| 237 |
+
```
|
| 238 |
+
After 256, the next representable value in bfloat16 is 258:
|
| 239 |
+
|
| 240 |
+
```python
|
| 241 |
+
>>> np.nextafter(bfloat16(256), bfloat16(np.inf))
|
| 242 |
+
258
|
| 243 |
+
```
|
| 244 |
+
For better results you can specify that the accumulation should happen in a
|
| 245 |
+
higher-precision type like `float32`:
|
| 246 |
+
|
| 247 |
+
```python
|
| 248 |
+
>>> vals.sum(dtype='float32').astype(bfloat16)
|
| 249 |
+
4992
|
| 250 |
+
```
|
| 251 |
+
In contrast to NumPy, projects like [JAX](http://jax.readthedocs.io/) which support
|
| 252 |
+
low-precision arithmetic more natively will often do these kinds of higher-precision
|
| 253 |
+
accumulations automatically:
|
| 254 |
+
|
| 255 |
+
```python
|
| 256 |
+
>>> import jax.numpy as jnp
|
| 257 |
+
>>> jnp.array(vals).sum()
|
| 258 |
+
Array(4992, dtype=bfloat16)
|
| 259 |
+
```
|
| 260 |
+
|
| 261 |
+
## License
|
| 262 |
+
|
| 263 |
+
*This is not an officially supported Google product.*
|
| 264 |
+
|
| 265 |
+
The `ml_dtypes` source code is licensed under the Apache 2.0 license
|
| 266 |
+
(see [LICENSE](LICENSE)). Pre-compiled wheels are built with the
|
| 267 |
+
[EIGEN](https://eigen.tuxfamily.org/) project, which is released under the
|
| 268 |
+
MPL 2.0 license (see [LICENSE.eigen](LICENSE.eigen)).
|
pythonProject/.venv/Lib/site-packages/ml_dtypes-0.5.3.dist-info/RECORD
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
ml_dtypes-0.5.3.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
|
| 2 |
+
ml_dtypes-0.5.3.dist-info/METADATA,sha256=vTuE8TEQUarkGkqN9k74SDyAJwKu6NuyseNbQuXFnUg,9176
|
| 3 |
+
ml_dtypes-0.5.3.dist-info/RECORD,,
|
| 4 |
+
ml_dtypes-0.5.3.dist-info/WHEEL,sha256=d0clRNJVaR7HXdCKNsk2VLvFV9HQ7R7Q1JcMhuI_WV0,101
|
| 5 |
+
ml_dtypes-0.5.3.dist-info/licenses/LICENSE,sha256=Pd-b5cKP4n2tFDpdx27qJSIq0d1ok0oEcGTlbtL6QMU,11560
|
| 6 |
+
ml_dtypes-0.5.3.dist-info/licenses/LICENSE.eigen,sha256=kiHC-TYVm4RG0ykkn7TA8lvlEPRHODoPEzNqx5hWaKM,17099
|
| 7 |
+
ml_dtypes-0.5.3.dist-info/top_level.txt,sha256=meeeNkM1LLmTU5q_0ssFs21A_42VAoES24ntCrPqASw,10
|
| 8 |
+
ml_dtypes/__init__.py,sha256=qgl4mRKusn8HKVoy50flhBUujpXRWet7a3DxdfpZ7VQ,2434
|
| 9 |
+
ml_dtypes/__pycache__/__init__.cpython-310.pyc,,
|
| 10 |
+
ml_dtypes/__pycache__/_finfo.cpython-310.pyc,,
|
| 11 |
+
ml_dtypes/__pycache__/_iinfo.cpython-310.pyc,,
|
| 12 |
+
ml_dtypes/_finfo.py,sha256=JWqJABIHDtgVFaxoy5dkmCRmwbQYdahH-CqA-xH1kos,23612
|
| 13 |
+
ml_dtypes/_iinfo.py,sha256=il9ONlgDbzJeV2vVlnSRhwut4WQ7LxXmsYWNTgiL4-o,2100
|
| 14 |
+
ml_dtypes/_ml_dtypes_ext.cp310-win_amd64.pyd,sha256=MxvH6qwQg2btrVngK7FwEaZ9SGCThAzKQrLub7dOSRU,790016
|
| 15 |
+
ml_dtypes/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
pythonProject/.venv/Lib/site-packages/ml_dtypes-0.5.3.dist-info/WHEEL
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Wheel-Version: 1.0
|
| 2 |
+
Generator: setuptools (80.8.0)
|
| 3 |
+
Root-Is-Purelib: false
|
| 4 |
+
Tag: cp310-cp310-win_amd64
|
| 5 |
+
|
pythonProject/.venv/Lib/site-packages/ml_dtypes-0.5.3.dist-info/licenses/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
Apache License
|
| 3 |
+
Version 2.0, January 2004
|
| 4 |
+
http://www.apache.org/licenses/
|
| 5 |
+
|
| 6 |
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
| 7 |
+
|
| 8 |
+
1. Definitions.
|
| 9 |
+
|
| 10 |
+
"License" shall mean the terms and conditions for use, reproduction,
|
| 11 |
+
and distribution as defined by Sections 1 through 9 of this document.
|
| 12 |
+
|
| 13 |
+
"Licensor" shall mean the copyright owner or entity authorized by
|
| 14 |
+
the copyright owner that is granting the License.
|
| 15 |
+
|
| 16 |
+
"Legal Entity" shall mean the union of the acting entity and all
|
| 17 |
+
other entities that control, are controlled by, or are under common
|
| 18 |
+
control with that entity. For the purposes of this definition,
|
| 19 |
+
"control" means (i) the power, direct or indirect, to cause the
|
| 20 |
+
direction or management of such entity, whether by contract or
|
| 21 |
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
| 22 |
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
| 23 |
+
|
| 24 |
+
"You" (or "Your") shall mean an individual or Legal Entity
|
| 25 |
+
exercising permissions granted by this License.
|
| 26 |
+
|
| 27 |
+
"Source" form shall mean the preferred form for making modifications,
|
| 28 |
+
including but not limited to software source code, documentation
|
| 29 |
+
source, and configuration files.
|
| 30 |
+
|
| 31 |
+
"Object" form shall mean any form resulting from mechanical
|
| 32 |
+
transformation or translation of a Source form, including but
|
| 33 |
+
not limited to compiled object code, generated documentation,
|
| 34 |
+
and conversions to other media types.
|
| 35 |
+
|
| 36 |
+
"Work" shall mean the work of authorship, whether in Source or
|
| 37 |
+
Object form, made available under the License, as indicated by a
|
| 38 |
+
copyright notice that is included in or attached to the work
|
| 39 |
+
(an example is provided in the Appendix below).
|
| 40 |
+
|
| 41 |
+
"Derivative Works" shall mean any work, whether in Source or Object
|
| 42 |
+
form, that is based on (or derived from) the Work and for which the
|
| 43 |
+
editorial revisions, annotations, elaborations, or other modifications
|
| 44 |
+
represent, as a whole, an original work of authorship. For the purposes
|
| 45 |
+
of this License, Derivative Works shall not include works that remain
|
| 46 |
+
separable from, or merely link (or bind by name) to the interfaces of,
|
| 47 |
+
the Work and Derivative Works thereof.
|
| 48 |
+
|
| 49 |
+
"Contribution" shall mean any work of authorship, including
|
| 50 |
+
the original version of the Work and any modifications or additions
|
| 51 |
+
to that Work or Derivative Works thereof, that is intentionally
|
| 52 |
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
| 53 |
+
or by an individual or Legal Entity authorized to submit on behalf of
|
| 54 |
+
the copyright owner. For the purposes of this definition, "submitted"
|
| 55 |
+
means any form of electronic, verbal, or written communication sent
|
| 56 |
+
to the Licensor or its representatives, including but not limited to
|
| 57 |
+
communication on electronic mailing lists, source code control systems,
|
| 58 |
+
and issue tracking systems that are managed by, or on behalf of, the
|
| 59 |
+
Licensor for the purpose of discussing and improving the Work, but
|
| 60 |
+
excluding communication that is conspicuously marked or otherwise
|
| 61 |
+
designated in writing by the copyright owner as "Not a Contribution."
|
| 62 |
+
|
| 63 |
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
| 64 |
+
on behalf of whom a Contribution has been received by Licensor and
|
| 65 |
+
subsequently incorporated within the Work.
|
| 66 |
+
|
| 67 |
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
| 68 |
+
this License, each Contributor hereby grants to You a perpetual,
|
| 69 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
| 70 |
+
copyright license to reproduce, prepare Derivative Works of,
|
| 71 |
+
publicly display, publicly perform, sublicense, and distribute the
|
| 72 |
+
Work and such Derivative Works in Source or Object form.
|
| 73 |
+
|
| 74 |
+
3. Grant of Patent License. Subject to the terms and conditions of
|
| 75 |
+
this License, each Contributor hereby grants to You a perpetual,
|
| 76 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
| 77 |
+
(except as stated in this section) patent license to make, have made,
|
| 78 |
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
| 79 |
+
where such license applies only to those patent claims licensable
|
| 80 |
+
by such Contributor that are necessarily infringed by their
|
| 81 |
+
Contribution(s) alone or by combination of their Contribution(s)
|
| 82 |
+
with the Work to which such Contribution(s) was submitted. If You
|
| 83 |
+
institute patent litigation against any entity (including a
|
| 84 |
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
| 85 |
+
or a Contribution incorporated within the Work constitutes direct
|
| 86 |
+
or contributory patent infringement, then any patent licenses
|
| 87 |
+
granted to You under this License for that Work shall terminate
|
| 88 |
+
as of the date such litigation is filed.
|
| 89 |
+
|
| 90 |
+
4. Redistribution. You may reproduce and distribute copies of the
|
| 91 |
+
Work or Derivative Works thereof in any medium, with or without
|
| 92 |
+
modifications, and in Source or Object form, provided that You
|
| 93 |
+
meet the following conditions:
|
| 94 |
+
|
| 95 |
+
(a) You must give any other recipients of the Work or
|
| 96 |
+
Derivative Works a copy of this License; and
|
| 97 |
+
|
| 98 |
+
(b) You must cause any modified files to carry prominent notices
|
| 99 |
+
stating that You changed the files; and
|
| 100 |
+
|
| 101 |
+
(c) You must retain, in the Source form of any Derivative Works
|
| 102 |
+
that You distribute, all copyright, patent, trademark, and
|
| 103 |
+
attribution notices from the Source form of the Work,
|
| 104 |
+
excluding those notices that do not pertain to any part of
|
| 105 |
+
the Derivative Works; and
|
| 106 |
+
|
| 107 |
+
(d) If the Work includes a "NOTICE" text file as part of its
|
| 108 |
+
distribution, then any Derivative Works that You distribute must
|
| 109 |
+
include a readable copy of the attribution notices contained
|
| 110 |
+
within such NOTICE file, excluding those notices that do not
|
| 111 |
+
pertain to any part of the Derivative Works, in at least one
|
| 112 |
+
of the following places: within a NOTICE text file distributed
|
| 113 |
+
as part of the Derivative Works; within the Source form or
|
| 114 |
+
documentation, if provided along with the Derivative Works; or,
|
| 115 |
+
within a display generated by the Derivative Works, if and
|
| 116 |
+
wherever such third-party notices normally appear. The contents
|
| 117 |
+
of the NOTICE file are for informational purposes only and
|
| 118 |
+
do not modify the License. You may add Your own attribution
|
| 119 |
+
notices within Derivative Works that You distribute, alongside
|
| 120 |
+
or as an addendum to the NOTICE text from the Work, provided
|
| 121 |
+
that such additional attribution notices cannot be construed
|
| 122 |
+
as modifying the License.
|
| 123 |
+
|
| 124 |
+
You may add Your own copyright statement to Your modifications and
|
| 125 |
+
may provide additional or different license terms and conditions
|
| 126 |
+
for use, reproduction, or distribution of Your modifications, or
|
| 127 |
+
for any such Derivative Works as a whole, provided Your use,
|
| 128 |
+
reproduction, and distribution of the Work otherwise complies with
|
| 129 |
+
the conditions stated in this License.
|
| 130 |
+
|
| 131 |
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
| 132 |
+
any Contribution intentionally submitted for inclusion in the Work
|
| 133 |
+
by You to the Licensor shall be under the terms and conditions of
|
| 134 |
+
this License, without any additional terms or conditions.
|
| 135 |
+
Notwithstanding the above, nothing herein shall supersede or modify
|
| 136 |
+
the terms of any separate license agreement you may have executed
|
| 137 |
+
with Licensor regarding such Contributions.
|
| 138 |
+
|
| 139 |
+
6. Trademarks. This License does not grant permission to use the trade
|
| 140 |
+
names, trademarks, service marks, or product names of the Licensor,
|
| 141 |
+
except as required for reasonable and customary use in describing the
|
| 142 |
+
origin of the Work and reproducing the content of the NOTICE file.
|
| 143 |
+
|
| 144 |
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
| 145 |
+
agreed to in writing, Licensor provides the Work (and each
|
| 146 |
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
| 147 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
| 148 |
+
implied, including, without limitation, any warranties or conditions
|
| 149 |
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
| 150 |
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
| 151 |
+
appropriateness of using or redistributing the Work and assume any
|
| 152 |
+
risks associated with Your exercise of permissions under this License.
|
| 153 |
+
|
| 154 |
+
8. Limitation of Liability. In no event and under no legal theory,
|
| 155 |
+
whether in tort (including negligence), contract, or otherwise,
|
| 156 |
+
unless required by applicable law (such as deliberate and grossly
|
| 157 |
+
negligent acts) or agreed to in writing, shall any Contributor be
|
| 158 |
+
liable to You for damages, including any direct, indirect, special,
|
| 159 |
+
incidental, or consequential damages of any character arising as a
|
| 160 |
+
result of this License or out of the use or inability to use the
|
| 161 |
+
Work (including but not limited to damages for loss of goodwill,
|
| 162 |
+
work stoppage, computer failure or malfunction, or any and all
|
| 163 |
+
other commercial damages or losses), even if such Contributor
|
| 164 |
+
has been advised of the possibility of such damages.
|
| 165 |
+
|
| 166 |
+
9. Accepting Warranty or Additional Liability. While redistributing
|
| 167 |
+
the Work or Derivative Works thereof, You may choose to offer,
|
| 168 |
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
| 169 |
+
or other liability obligations and/or rights consistent with this
|
| 170 |
+
License. However, in accepting such obligations, You may act only
|
| 171 |
+
on Your own behalf and on Your sole responsibility, not on behalf
|
| 172 |
+
of any other Contributor, and only if You agree to indemnify,
|
| 173 |
+
defend, and hold each Contributor harmless for any liability
|
| 174 |
+
incurred by, or claims asserted against, such Contributor by reason
|
| 175 |
+
of your accepting any such warranty or additional liability.
|
| 176 |
+
|
| 177 |
+
END OF TERMS AND CONDITIONS
|
| 178 |
+
|
| 179 |
+
APPENDIX: How to apply the Apache License to your work.
|
| 180 |
+
|
| 181 |
+
To apply the Apache License to your work, attach the following
|
| 182 |
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
| 183 |
+
replaced with your own identifying information. (Don't include
|
| 184 |
+
the brackets!) The text should be enclosed in the appropriate
|
| 185 |
+
comment syntax for the file format. We also recommend that a
|
| 186 |
+
file or class name and description of purpose be included on the
|
| 187 |
+
same "printed page" as the copyright notice for easier
|
| 188 |
+
identification within third-party archives.
|
| 189 |
+
|
| 190 |
+
Copyright [yyyy] [name of copyright owner]
|
| 191 |
+
|
| 192 |
+
Licensed under the Apache License, Version 2.0 (the "License");
|
| 193 |
+
you may not use this file except in compliance with the License.
|
| 194 |
+
You may obtain a copy of the License at
|
| 195 |
+
|
| 196 |
+
http://www.apache.org/licenses/LICENSE-2.0
|
| 197 |
+
|
| 198 |
+
Unless required by applicable law or agreed to in writing, software
|
| 199 |
+
distributed under the License is distributed on an "AS IS" BASIS,
|
| 200 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 201 |
+
See the License for the specific language governing permissions and
|
| 202 |
+
limitations under the License.
|
pythonProject/.venv/Lib/site-packages/ml_dtypes-0.5.3.dist-info/licenses/LICENSE.eigen
ADDED
|
@@ -0,0 +1,373 @@
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Mozilla Public License Version 2.0
|
| 2 |
+
==================================
|
| 3 |
+
|
| 4 |
+
1. Definitions
|
| 5 |
+
--------------
|
| 6 |
+
|
| 7 |
+
1.1. "Contributor"
|
| 8 |
+
means each individual or legal entity that creates, contributes to
|
| 9 |
+
the creation of, or owns Covered Software.
|
| 10 |
+
|
| 11 |
+
1.2. "Contributor Version"
|
| 12 |
+
means the combination of the Contributions of others (if any) used
|
| 13 |
+
by a Contributor and that particular Contributor's Contribution.
|
| 14 |
+
|
| 15 |
+
1.3. "Contribution"
|
| 16 |
+
means Covered Software of a particular Contributor.
|
| 17 |
+
|
| 18 |
+
1.4. "Covered Software"
|
| 19 |
+
means Source Code Form to which the initial Contributor has attached
|
| 20 |
+
the notice in Exhibit A, the Executable Form of such Source Code
|
| 21 |
+
Form, and Modifications of such Source Code Form, in each case
|
| 22 |
+
including portions thereof.
|
| 23 |
+
|
| 24 |
+
1.5. "Incompatible With Secondary Licenses"
|
| 25 |
+
means
|
| 26 |
+
|
| 27 |
+
(a) that the initial Contributor has attached the notice described
|
| 28 |
+
in Exhibit B to the Covered Software; or
|
| 29 |
+
|
| 30 |
+
(b) that the Covered Software was made available under the terms of
|
| 31 |
+
version 1.1 or earlier of the License, but not also under the
|
| 32 |
+
terms of a Secondary License.
|
| 33 |
+
|
| 34 |
+
1.6. "Executable Form"
|
| 35 |
+
means any form of the work other than Source Code Form.
|
| 36 |
+
|
| 37 |
+
1.7. "Larger Work"
|
| 38 |
+
means a work that combines Covered Software with other material, in
|
| 39 |
+
a separate file or files, that is not Covered Software.
|
| 40 |
+
|
| 41 |
+
1.8. "License"
|
| 42 |
+
means this document.
|
| 43 |
+
|
| 44 |
+
1.9. "Licensable"
|
| 45 |
+
means having the right to grant, to the maximum extent possible,
|
| 46 |
+
whether at the time of the initial grant or subsequently, any and
|
| 47 |
+
all of the rights conveyed by this License.
|
| 48 |
+
|
| 49 |
+
1.10. "Modifications"
|
| 50 |
+
means any of the following:
|
| 51 |
+
|
| 52 |
+
(a) any file in Source Code Form that results from an addition to,
|
| 53 |
+
deletion from, or modification of the contents of Covered
|
| 54 |
+
Software; or
|
| 55 |
+
|
| 56 |
+
(b) any new file in Source Code Form that contains any Covered
|
| 57 |
+
Software.
|
| 58 |
+
|
| 59 |
+
1.11. "Patent Claims" of a Contributor
|
| 60 |
+
means any patent claim(s), including without limitation, method,
|
| 61 |
+
process, and apparatus claims, in any patent Licensable by such
|
| 62 |
+
Contributor that would be infringed, but for the grant of the
|
| 63 |
+
License, by the making, using, selling, offering for sale, having
|
| 64 |
+
made, import, or transfer of either its Contributions or its
|
| 65 |
+
Contributor Version.
|
| 66 |
+
|
| 67 |
+
1.12. "Secondary License"
|
| 68 |
+
means either the GNU General Public License, Version 2.0, the GNU
|
| 69 |
+
Lesser General Public License, Version 2.1, the GNU Affero General
|
| 70 |
+
Public License, Version 3.0, or any later versions of those
|
| 71 |
+
licenses.
|
| 72 |
+
|
| 73 |
+
1.13. "Source Code Form"
|
| 74 |
+
means the form of the work preferred for making modifications.
|
| 75 |
+
|
| 76 |
+
1.14. "You" (or "Your")
|
| 77 |
+
means an individual or a legal entity exercising rights under this
|
| 78 |
+
License. For legal entities, "You" includes any entity that
|
| 79 |
+
controls, is controlled by, or is under common control with You. For
|
| 80 |
+
purposes of this definition, "control" means (a) the power, direct
|
| 81 |
+
or indirect, to cause the direction or management of such entity,
|
| 82 |
+
whether by contract or otherwise, or (b) ownership of more than
|
| 83 |
+
fifty percent (50%) of the outstanding shares or beneficial
|
| 84 |
+
ownership of such entity.
|
| 85 |
+
|
| 86 |
+
2. License Grants and Conditions
|
| 87 |
+
--------------------------------
|
| 88 |
+
|
| 89 |
+
2.1. Grants
|
| 90 |
+
|
| 91 |
+
Each Contributor hereby grants You a world-wide, royalty-free,
|
| 92 |
+
non-exclusive license:
|
| 93 |
+
|
| 94 |
+
(a) under intellectual property rights (other than patent or trademark)
|
| 95 |
+
Licensable by such Contributor to use, reproduce, make available,
|
| 96 |
+
modify, display, perform, distribute, and otherwise exploit its
|
| 97 |
+
Contributions, either on an unmodified basis, with Modifications, or
|
| 98 |
+
as part of a Larger Work; and
|
| 99 |
+
|
| 100 |
+
(b) under Patent Claims of such Contributor to make, use, sell, offer
|
| 101 |
+
for sale, have made, import, and otherwise transfer either its
|
| 102 |
+
Contributions or its Contributor Version.
|
| 103 |
+
|
| 104 |
+
2.2. Effective Date
|
| 105 |
+
|
| 106 |
+
The licenses granted in Section 2.1 with respect to any Contribution
|
| 107 |
+
become effective for each Contribution on the date the Contributor first
|
| 108 |
+
distributes such Contribution.
|
| 109 |
+
|
| 110 |
+
2.3. Limitations on Grant Scope
|
| 111 |
+
|
| 112 |
+
The licenses granted in this Section 2 are the only rights granted under
|
| 113 |
+
this License. No additional rights or licenses will be implied from the
|
| 114 |
+
distribution or licensing of Covered Software under this License.
|
| 115 |
+
Notwithstanding Section 2.1(b) above, no patent license is granted by a
|
| 116 |
+
Contributor:
|
| 117 |
+
|
| 118 |
+
(a) for any code that a Contributor has removed from Covered Software;
|
| 119 |
+
or
|
| 120 |
+
|
| 121 |
+
(b) for infringements caused by: (i) Your and any other third party's
|
| 122 |
+
modifications of Covered Software, or (ii) the combination of its
|
| 123 |
+
Contributions with other software (except as part of its Contributor
|
| 124 |
+
Version); or
|
| 125 |
+
|
| 126 |
+
(c) under Patent Claims infringed by Covered Software in the absence of
|
| 127 |
+
its Contributions.
|
| 128 |
+
|
| 129 |
+
This License does not grant any rights in the trademarks, service marks,
|
| 130 |
+
or logos of any Contributor (except as may be necessary to comply with
|
| 131 |
+
the notice requirements in Section 3.4).
|
| 132 |
+
|
| 133 |
+
2.4. Subsequent Licenses
|
| 134 |
+
|
| 135 |
+
No Contributor makes additional grants as a result of Your choice to
|
| 136 |
+
distribute the Covered Software under a subsequent version of this
|
| 137 |
+
License (see Section 10.2) or under the terms of a Secondary License (if
|
| 138 |
+
permitted under the terms of Section 3.3).
|
| 139 |
+
|
| 140 |
+
2.5. Representation
|
| 141 |
+
|
| 142 |
+
Each Contributor represents that the Contributor believes its
|
| 143 |
+
Contributions are its original creation(s) or it has sufficient rights
|
| 144 |
+
to grant the rights to its Contributions conveyed by this License.
|
| 145 |
+
|
| 146 |
+
2.6. Fair Use
|
| 147 |
+
|
| 148 |
+
This License is not intended to limit any rights You have under
|
| 149 |
+
applicable copyright doctrines of fair use, fair dealing, or other
|
| 150 |
+
equivalents.
|
| 151 |
+
|
| 152 |
+
2.7. Conditions
|
| 153 |
+
|
| 154 |
+
Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
|
| 155 |
+
in Section 2.1.
|
| 156 |
+
|
| 157 |
+
3. Responsibilities
|
| 158 |
+
-------------------
|
| 159 |
+
|
| 160 |
+
3.1. Distribution of Source Form
|
| 161 |
+
|
| 162 |
+
All distribution of Covered Software in Source Code Form, including any
|
| 163 |
+
Modifications that You create or to which You contribute, must be under
|
| 164 |
+
the terms of this License. You must inform recipients that the Source
|
| 165 |
+
Code Form of the Covered Software is governed by the terms of this
|
| 166 |
+
License, and how they can obtain a copy of this License. You may not
|
| 167 |
+
attempt to alter or restrict the recipients' rights in the Source Code
|
| 168 |
+
Form.
|
| 169 |
+
|
| 170 |
+
3.2. Distribution of Executable Form
|
| 171 |
+
|
| 172 |
+
If You distribute Covered Software in Executable Form then:
|
| 173 |
+
|
| 174 |
+
(a) such Covered Software must also be made available in Source Code
|
| 175 |
+
Form, as described in Section 3.1, and You must inform recipients of
|
| 176 |
+
the Executable Form how they can obtain a copy of such Source Code
|
| 177 |
+
Form by reasonable means in a timely manner, at a charge no more
|
| 178 |
+
than the cost of distribution to the recipient; and
|
| 179 |
+
|
| 180 |
+
(b) You may distribute such Executable Form under the terms of this
|
| 181 |
+
License, or sublicense it under different terms, provided that the
|
| 182 |
+
license for the Executable Form does not attempt to limit or alter
|
| 183 |
+
the recipients' rights in the Source Code Form under this License.
|
| 184 |
+
|
| 185 |
+
3.3. Distribution of a Larger Work
|
| 186 |
+
|
| 187 |
+
You may create and distribute a Larger Work under terms of Your choice,
|
| 188 |
+
provided that You also comply with the requirements of this License for
|
| 189 |
+
the Covered Software. If the Larger Work is a combination of Covered
|
| 190 |
+
Software with a work governed by one or more Secondary Licenses, and the
|
| 191 |
+
Covered Software is not Incompatible With Secondary Licenses, this
|
| 192 |
+
License permits You to additionally distribute such Covered Software
|
| 193 |
+
under the terms of such Secondary License(s), so that the recipient of
|
| 194 |
+
the Larger Work may, at their option, further distribute the Covered
|
| 195 |
+
Software under the terms of either this License or such Secondary
|
| 196 |
+
License(s).
|
| 197 |
+
|
| 198 |
+
3.4. Notices
|
| 199 |
+
|
| 200 |
+
You may not remove or alter the substance of any license notices
|
| 201 |
+
(including copyright notices, patent notices, disclaimers of warranty,
|
| 202 |
+
or limitations of liability) contained within the Source Code Form of
|
| 203 |
+
the Covered Software, except that You may alter any license notices to
|
| 204 |
+
the extent required to remedy known factual inaccuracies.
|
| 205 |
+
|
| 206 |
+
3.5. Application of Additional Terms
|
| 207 |
+
|
| 208 |
+
You may choose to offer, and to charge a fee for, warranty, support,
|
| 209 |
+
indemnity or liability obligations to one or more recipients of Covered
|
| 210 |
+
Software. However, You may do so only on Your own behalf, and not on
|
| 211 |
+
behalf of any Contributor. You must make it absolutely clear that any
|
| 212 |
+
such warranty, support, indemnity, or liability obligation is offered by
|
| 213 |
+
You alone, and You hereby agree to indemnify every Contributor for any
|
| 214 |
+
liability incurred by such Contributor as a result of warranty, support,
|
| 215 |
+
indemnity or liability terms You offer. You may include additional
|
| 216 |
+
disclaimers of warranty and limitations of liability specific to any
|
| 217 |
+
jurisdiction.
|
| 218 |
+
|
| 219 |
+
4. Inability to Comply Due to Statute or Regulation
|
| 220 |
+
---------------------------------------------------
|
| 221 |
+
|
| 222 |
+
If it is impossible for You to comply with any of the terms of this
|
| 223 |
+
License with respect to some or all of the Covered Software due to
|
| 224 |
+
statute, judicial order, or regulation then You must: (a) comply with
|
| 225 |
+
the terms of this License to the maximum extent possible; and (b)
|
| 226 |
+
describe the limitations and the code they affect. Such description must
|
| 227 |
+
be placed in a text file included with all distributions of the Covered
|
| 228 |
+
Software under this License. Except to the extent prohibited by statute
|
| 229 |
+
or regulation, such description must be sufficiently detailed for a
|
| 230 |
+
recipient of ordinary skill to be able to understand it.
|
| 231 |
+
|
| 232 |
+
5. Termination
|
| 233 |
+
--------------
|
| 234 |
+
|
| 235 |
+
5.1. The rights granted under this License will terminate automatically
|
| 236 |
+
if You fail to comply with any of its terms. However, if You become
|
| 237 |
+
compliant, then the rights granted under this License from a particular
|
| 238 |
+
Contributor are reinstated (a) provisionally, unless and until such
|
| 239 |
+
Contributor explicitly and finally terminates Your grants, and (b) on an
|
| 240 |
+
ongoing basis, if such Contributor fails to notify You of the
|
| 241 |
+
non-compliance by some reasonable means prior to 60 days after You have
|
| 242 |
+
come back into compliance. Moreover, Your grants from a particular
|
| 243 |
+
Contributor are reinstated on an ongoing basis if such Contributor
|
| 244 |
+
notifies You of the non-compliance by some reasonable means, this is the
|
| 245 |
+
first time You have received notice of non-compliance with this License
|
| 246 |
+
from such Contributor, and You become compliant prior to 30 days after
|
| 247 |
+
Your receipt of the notice.
|
| 248 |
+
|
| 249 |
+
5.2. If You initiate litigation against any entity by asserting a patent
|
| 250 |
+
infringement claim (excluding declaratory judgment actions,
|
| 251 |
+
counter-claims, and cross-claims) alleging that a Contributor Version
|
| 252 |
+
directly or indirectly infringes any patent, then the rights granted to
|
| 253 |
+
You by any and all Contributors for the Covered Software under Section
|
| 254 |
+
2.1 of this License shall terminate.
|
| 255 |
+
|
| 256 |
+
5.3. In the event of termination under Sections 5.1 or 5.2 above, all
|
| 257 |
+
end user license agreements (excluding distributors and resellers) which
|
| 258 |
+
have been validly granted by You or Your distributors under this License
|
| 259 |
+
prior to termination shall survive termination.
|
| 260 |
+
|
| 261 |
+
************************************************************************
|
| 262 |
+
* *
|
| 263 |
+
* 6. Disclaimer of Warranty *
|
| 264 |
+
* ------------------------- *
|
| 265 |
+
* *
|
| 266 |
+
* Covered Software is provided under this License on an "as is" *
|
| 267 |
+
* basis, without warranty of any kind, either expressed, implied, or *
|
| 268 |
+
* statutory, including, without limitation, warranties that the *
|
| 269 |
+
* Covered Software is free of defects, merchantable, fit for a *
|
| 270 |
+
* particular purpose or non-infringing. The entire risk as to the *
|
| 271 |
+
* quality and performance of the Covered Software is with You. *
|
| 272 |
+
* Should any Covered Software prove defective in any respect, You *
|
| 273 |
+
* (not any Contributor) assume the cost of any necessary servicing, *
|
| 274 |
+
* repair, or correction. This disclaimer of warranty constitutes an *
|
| 275 |
+
* essential part of this License. No use of any Covered Software is *
|
| 276 |
+
* authorized under this License except under this disclaimer. *
|
| 277 |
+
* *
|
| 278 |
+
************************************************************************
|
| 279 |
+
|
| 280 |
+
************************************************************************
|
| 281 |
+
* *
|
| 282 |
+
* 7. Limitation of Liability *
|
| 283 |
+
* -------------------------- *
|
| 284 |
+
* *
|
| 285 |
+
* Under no circumstances and under no legal theory, whether tort *
|
| 286 |
+
* (including negligence), contract, or otherwise, shall any *
|
| 287 |
+
* Contributor, or anyone who distributes Covered Software as *
|
| 288 |
+
* permitted above, be liable to You for any direct, indirect, *
|
| 289 |
+
* special, incidental, or consequential damages of any character *
|
| 290 |
+
* including, without limitation, damages for lost profits, loss of *
|
| 291 |
+
* goodwill, work stoppage, computer failure or malfunction, or any *
|
| 292 |
+
* and all other commercial damages or losses, even if such party *
|
| 293 |
+
* shall have been informed of the possibility of such damages. This *
|
| 294 |
+
* limitation of liability shall not apply to liability for death or *
|
| 295 |
+
* personal injury resulting from such party's negligence to the *
|
| 296 |
+
* extent applicable law prohibits such limitation. Some *
|
| 297 |
+
* jurisdictions do not allow the exclusion or limitation of *
|
| 298 |
+
* incidental or consequential damages, so this exclusion and *
|
| 299 |
+
* limitation may not apply to You. *
|
| 300 |
+
* *
|
| 301 |
+
************************************************************************
|
| 302 |
+
|
| 303 |
+
8. Litigation
|
| 304 |
+
-------------
|
| 305 |
+
|
| 306 |
+
Any litigation relating to this License may be brought only in the
|
| 307 |
+
courts of a jurisdiction where the defendant maintains its principal
|
| 308 |
+
place of business and such litigation shall be governed by laws of that
|
| 309 |
+
jurisdiction, without reference to its conflict-of-law provisions.
|
| 310 |
+
Nothing in this Section shall prevent a party's ability to bring
|
| 311 |
+
cross-claims or counter-claims.
|
| 312 |
+
|
| 313 |
+
9. Miscellaneous
|
| 314 |
+
----------------
|
| 315 |
+
|
| 316 |
+
This License represents the complete agreement concerning the subject
|
| 317 |
+
matter hereof. If any provision of this License is held to be
|
| 318 |
+
unenforceable, such provision shall be reformed only to the extent
|
| 319 |
+
necessary to make it enforceable. Any law or regulation which provides
|
| 320 |
+
that the language of a contract shall be construed against the drafter
|
| 321 |
+
shall not be used to construe this License against a Contributor.
|
| 322 |
+
|
| 323 |
+
10. Versions of the License
|
| 324 |
+
---------------------------
|
| 325 |
+
|
| 326 |
+
10.1. New Versions
|
| 327 |
+
|
| 328 |
+
Mozilla Foundation is the license steward. Except as provided in Section
|
| 329 |
+
10.3, no one other than the license steward has the right to modify or
|
| 330 |
+
publish new versions of this License. Each version will be given a
|
| 331 |
+
distinguishing version number.
|
| 332 |
+
|
| 333 |
+
10.2. Effect of New Versions
|
| 334 |
+
|
| 335 |
+
You may distribute the Covered Software under the terms of the version
|
| 336 |
+
of the License under which You originally received the Covered Software,
|
| 337 |
+
or under the terms of any subsequent version published by the license
|
| 338 |
+
steward.
|
| 339 |
+
|
| 340 |
+
10.3. Modified Versions
|
| 341 |
+
|
| 342 |
+
If you create software not governed by this License, and you want to
|
| 343 |
+
create a new license for such software, you may create and use a
|
| 344 |
+
modified version of this License if you rename the license and remove
|
| 345 |
+
any references to the name of the license steward (except to note that
|
| 346 |
+
such modified license differs from this License).
|
| 347 |
+
|
| 348 |
+
10.4. Distributing Source Code Form that is Incompatible With Secondary
|
| 349 |
+
Licenses
|
| 350 |
+
|
| 351 |
+
If You choose to distribute Source Code Form that is Incompatible With
|
| 352 |
+
Secondary Licenses under the terms of this version of the License, the
|
| 353 |
+
notice described in Exhibit B of this License must be attached.
|
| 354 |
+
|
| 355 |
+
Exhibit A - Source Code Form License Notice
|
| 356 |
+
-------------------------------------------
|
| 357 |
+
|
| 358 |
+
This Source Code Form is subject to the terms of the Mozilla Public
|
| 359 |
+
License, v. 2.0. If a copy of the MPL was not distributed with this
|
| 360 |
+
file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
| 361 |
+
|
| 362 |
+
If it is not possible or desirable to put the notice in a particular
|
| 363 |
+
file, then You may include the notice in a location (such as a LICENSE
|
| 364 |
+
file in a relevant directory) where a recipient would be likely to look
|
| 365 |
+
for such a notice.
|
| 366 |
+
|
| 367 |
+
You may add additional accurate notices of copyright ownership.
|
| 368 |
+
|
| 369 |
+
Exhibit B - "Incompatible With Secondary Licenses" Notice
|
| 370 |
+
---------------------------------------------------------
|
| 371 |
+
|
| 372 |
+
This Source Code Form is "Incompatible With Secondary Licenses", as
|
| 373 |
+
defined by the Mozilla Public License, v. 2.0.
|
pythonProject/.venv/Lib/site-packages/ml_dtypes-0.5.3.dist-info/top_level.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
ml_dtypes
|
pythonProject/.venv/Lib/site-packages/ml_dtypes/__init__.py
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright 2022 The ml_dtypes Authors.
|
| 2 |
+
#
|
| 3 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 4 |
+
# you may not use this file except in compliance with the License.
|
| 5 |
+
# You may obtain a copy of the License at
|
| 6 |
+
#
|
| 7 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 8 |
+
#
|
| 9 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 10 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 11 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 12 |
+
# See the License for the specific language governing permissions and
|
| 13 |
+
# limitations under the License.
|
| 14 |
+
|
| 15 |
+
__version__ = "0.5.3"
|
| 16 |
+
__all__ = [
|
| 17 |
+
"__version__",
|
| 18 |
+
"bfloat16",
|
| 19 |
+
"finfo",
|
| 20 |
+
"float4_e2m1fn",
|
| 21 |
+
"float6_e2m3fn",
|
| 22 |
+
"float6_e3m2fn",
|
| 23 |
+
"float8_e3m4",
|
| 24 |
+
"float8_e4m3",
|
| 25 |
+
"float8_e4m3b11fnuz",
|
| 26 |
+
"float8_e4m3fn",
|
| 27 |
+
"float8_e4m3fnuz",
|
| 28 |
+
"float8_e5m2",
|
| 29 |
+
"float8_e5m2fnuz",
|
| 30 |
+
"float8_e8m0fnu",
|
| 31 |
+
"iinfo",
|
| 32 |
+
"int2",
|
| 33 |
+
"int4",
|
| 34 |
+
"uint2",
|
| 35 |
+
"uint4",
|
| 36 |
+
]
|
| 37 |
+
|
| 38 |
+
from typing import Type
|
| 39 |
+
|
| 40 |
+
from ml_dtypes._finfo import finfo
|
| 41 |
+
from ml_dtypes._iinfo import iinfo
|
| 42 |
+
from ml_dtypes._ml_dtypes_ext import bfloat16
|
| 43 |
+
from ml_dtypes._ml_dtypes_ext import float4_e2m1fn
|
| 44 |
+
from ml_dtypes._ml_dtypes_ext import float6_e2m3fn
|
| 45 |
+
from ml_dtypes._ml_dtypes_ext import float6_e3m2fn
|
| 46 |
+
from ml_dtypes._ml_dtypes_ext import float8_e3m4
|
| 47 |
+
from ml_dtypes._ml_dtypes_ext import float8_e4m3
|
| 48 |
+
from ml_dtypes._ml_dtypes_ext import float8_e4m3b11fnuz
|
| 49 |
+
from ml_dtypes._ml_dtypes_ext import float8_e4m3fn
|
| 50 |
+
from ml_dtypes._ml_dtypes_ext import float8_e4m3fnuz
|
| 51 |
+
from ml_dtypes._ml_dtypes_ext import float8_e5m2
|
| 52 |
+
from ml_dtypes._ml_dtypes_ext import float8_e5m2fnuz
|
| 53 |
+
from ml_dtypes._ml_dtypes_ext import float8_e8m0fnu
|
| 54 |
+
from ml_dtypes._ml_dtypes_ext import int2
|
| 55 |
+
from ml_dtypes._ml_dtypes_ext import int4
|
| 56 |
+
from ml_dtypes._ml_dtypes_ext import uint2
|
| 57 |
+
from ml_dtypes._ml_dtypes_ext import uint4
|
| 58 |
+
import numpy as np
|
| 59 |
+
|
| 60 |
+
bfloat16: Type[np.generic]
|
| 61 |
+
float4_e2m1fn: Type[np.generic]
|
| 62 |
+
float6_e2m3fn: Type[np.generic]
|
| 63 |
+
float6_e3m2fn: Type[np.generic]
|
| 64 |
+
float8_e3m4: Type[np.generic]
|
| 65 |
+
float8_e4m3: Type[np.generic]
|
| 66 |
+
float8_e4m3b11fnuz: Type[np.generic]
|
| 67 |
+
float8_e4m3fn: Type[np.generic]
|
| 68 |
+
float8_e4m3fnuz: Type[np.generic]
|
| 69 |
+
float8_e5m2: Type[np.generic]
|
| 70 |
+
float8_e5m2fnuz: Type[np.generic]
|
| 71 |
+
float8_e8m0fnu: Type[np.generic]
|
| 72 |
+
int2: Type[np.generic]
|
| 73 |
+
int4: Type[np.generic]
|
| 74 |
+
uint2: Type[np.generic]
|
| 75 |
+
uint4: Type[np.generic]
|
| 76 |
+
|
| 77 |
+
del np, Type
|
pythonProject/.venv/Lib/site-packages/ml_dtypes/__pycache__/__init__.cpython-310.pyc
ADDED
|
Binary file (1.39 kB). View file
|
|
|
pythonProject/.venv/Lib/site-packages/ml_dtypes/__pycache__/_finfo.cpython-310.pyc
ADDED
|
Binary file (13.9 kB). View file
|
|
|
pythonProject/.venv/Lib/site-packages/ml_dtypes/__pycache__/_iinfo.cpython-310.pyc
ADDED
|
Binary file (1.6 kB). View file
|
|
|
pythonProject/.venv/Lib/site-packages/ml_dtypes/_finfo.py
ADDED
|
@@ -0,0 +1,713 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright 2023 The ml_dtypes Authors.
|
| 2 |
+
#
|
| 3 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 4 |
+
# you may not use this file except in compliance with the License.
|
| 5 |
+
# You may obtain a copy of the License at
|
| 6 |
+
#
|
| 7 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 8 |
+
#
|
| 9 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 10 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 11 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 12 |
+
# See the License for the specific language governing permissions and
|
| 13 |
+
# limitations under the License.
|
| 14 |
+
|
| 15 |
+
"""Overload of numpy.finfo to handle dtypes defined in ml_dtypes."""
|
| 16 |
+
|
| 17 |
+
from ml_dtypes._ml_dtypes_ext import bfloat16
|
| 18 |
+
from ml_dtypes._ml_dtypes_ext import float4_e2m1fn
|
| 19 |
+
from ml_dtypes._ml_dtypes_ext import float6_e2m3fn
|
| 20 |
+
from ml_dtypes._ml_dtypes_ext import float6_e3m2fn
|
| 21 |
+
from ml_dtypes._ml_dtypes_ext import float8_e3m4
|
| 22 |
+
from ml_dtypes._ml_dtypes_ext import float8_e4m3
|
| 23 |
+
from ml_dtypes._ml_dtypes_ext import float8_e4m3b11fnuz
|
| 24 |
+
from ml_dtypes._ml_dtypes_ext import float8_e4m3fn
|
| 25 |
+
from ml_dtypes._ml_dtypes_ext import float8_e4m3fnuz
|
| 26 |
+
from ml_dtypes._ml_dtypes_ext import float8_e5m2
|
| 27 |
+
from ml_dtypes._ml_dtypes_ext import float8_e5m2fnuz
|
| 28 |
+
from ml_dtypes._ml_dtypes_ext import float8_e8m0fnu
|
| 29 |
+
import numpy as np
|
| 30 |
+
|
| 31 |
+
_bfloat16_dtype = np.dtype(bfloat16)
|
| 32 |
+
_float4_e2m1fn_dtype = np.dtype(float4_e2m1fn)
|
| 33 |
+
_float6_e2m3fn_dtype = np.dtype(float6_e2m3fn)
|
| 34 |
+
_float6_e3m2fn_dtype = np.dtype(float6_e3m2fn)
|
| 35 |
+
_float8_e3m4_dtype = np.dtype(float8_e3m4)
|
| 36 |
+
_float8_e4m3_dtype = np.dtype(float8_e4m3)
|
| 37 |
+
_float8_e4m3b11fnuz_dtype = np.dtype(float8_e4m3b11fnuz)
|
| 38 |
+
_float8_e4m3fn_dtype = np.dtype(float8_e4m3fn)
|
| 39 |
+
_float8_e4m3fnuz_dtype = np.dtype(float8_e4m3fnuz)
|
| 40 |
+
_float8_e5m2_dtype = np.dtype(float8_e5m2)
|
| 41 |
+
_float8_e5m2fnuz_dtype = np.dtype(float8_e5m2fnuz)
|
| 42 |
+
_float8_e8m0fnu_dtype = np.dtype(float8_e8m0fnu)
|
| 43 |
+
|
| 44 |
+
|
| 45 |
+
class _Bfloat16MachArLike:
|
| 46 |
+
|
| 47 |
+
def __init__(self):
|
| 48 |
+
smallest_normal = float.fromhex("0x1p-126")
|
| 49 |
+
self.smallest_normal = bfloat16(smallest_normal)
|
| 50 |
+
smallest_subnormal = float.fromhex("0x1p-133")
|
| 51 |
+
self.smallest_subnormal = bfloat16(smallest_subnormal)
|
| 52 |
+
|
| 53 |
+
|
| 54 |
+
class _Float4E2m1fnMachArLike:
|
| 55 |
+
|
| 56 |
+
def __init__(self):
|
| 57 |
+
smallest_normal = float.fromhex("0x1p0")
|
| 58 |
+
self.smallest_normal = float4_e2m1fn(smallest_normal)
|
| 59 |
+
smallest_subnormal = float.fromhex("0x0.8p0")
|
| 60 |
+
self.smallest_subnormal = float4_e2m1fn(smallest_subnormal)
|
| 61 |
+
|
| 62 |
+
|
| 63 |
+
class _Float6E2m3fnMachArLike:
|
| 64 |
+
|
| 65 |
+
def __init__(self):
|
| 66 |
+
smallest_normal = float.fromhex("0x1p0")
|
| 67 |
+
self.smallest_normal = float6_e2m3fn(smallest_normal)
|
| 68 |
+
smallest_subnormal = float.fromhex("0x0.2p0")
|
| 69 |
+
self.smallest_subnormal = float6_e2m3fn(smallest_subnormal)
|
| 70 |
+
|
| 71 |
+
|
| 72 |
+
class _Float6E3m2fnMachArLike:
|
| 73 |
+
|
| 74 |
+
def __init__(self):
|
| 75 |
+
smallest_normal = float.fromhex("0x1p-2")
|
| 76 |
+
self.smallest_normal = float6_e3m2fn(smallest_normal)
|
| 77 |
+
smallest_subnormal = float.fromhex("0x0.4p-2")
|
| 78 |
+
self.smallest_subnormal = float6_e3m2fn(smallest_subnormal)
|
| 79 |
+
|
| 80 |
+
|
| 81 |
+
class _Float8E3m4MachArLike:
|
| 82 |
+
|
| 83 |
+
def __init__(self):
|
| 84 |
+
smallest_normal = float.fromhex("0x1p-2")
|
| 85 |
+
self.smallest_normal = float8_e3m4(smallest_normal)
|
| 86 |
+
smallest_subnormal = float.fromhex("0x0.1p-2")
|
| 87 |
+
self.smallest_subnormal = float8_e3m4(smallest_subnormal)
|
| 88 |
+
|
| 89 |
+
|
| 90 |
+
class _Float8E4m3MachArLike:
|
| 91 |
+
|
| 92 |
+
def __init__(self):
|
| 93 |
+
smallest_normal = float.fromhex("0x1p-6")
|
| 94 |
+
self.smallest_normal = float8_e4m3(smallest_normal)
|
| 95 |
+
smallest_subnormal = float.fromhex("0x0.2p-6")
|
| 96 |
+
self.smallest_subnormal = float8_e4m3(smallest_subnormal)
|
| 97 |
+
|
| 98 |
+
|
| 99 |
+
class _Float8E4m3b11fnuzMachArLike:
|
| 100 |
+
|
| 101 |
+
def __init__(self):
|
| 102 |
+
smallest_normal = float.fromhex("0x1p-10")
|
| 103 |
+
self.smallest_normal = float8_e4m3b11fnuz(smallest_normal)
|
| 104 |
+
smallest_subnormal = float.fromhex("0x1p-13")
|
| 105 |
+
self.smallest_subnormal = float8_e4m3b11fnuz(smallest_subnormal)
|
| 106 |
+
|
| 107 |
+
|
| 108 |
+
class _Float8E4m3fnMachArLike:
|
| 109 |
+
|
| 110 |
+
def __init__(self):
|
| 111 |
+
smallest_normal = float.fromhex("0x1p-6")
|
| 112 |
+
self.smallest_normal = float8_e4m3fn(smallest_normal)
|
| 113 |
+
smallest_subnormal = float.fromhex("0x1p-9")
|
| 114 |
+
self.smallest_subnormal = float8_e4m3fn(smallest_subnormal)
|
| 115 |
+
|
| 116 |
+
|
| 117 |
+
class _Float8E4m3fnuzMachArLike:
|
| 118 |
+
|
| 119 |
+
def __init__(self):
|
| 120 |
+
smallest_normal = float.fromhex("0x1p-7")
|
| 121 |
+
self.smallest_normal = float8_e4m3fnuz(smallest_normal)
|
| 122 |
+
smallest_subnormal = float.fromhex("0x1p-10")
|
| 123 |
+
self.smallest_subnormal = float8_e4m3fnuz(smallest_subnormal)
|
| 124 |
+
|
| 125 |
+
|
| 126 |
+
class _Float8E5m2MachArLike:
|
| 127 |
+
|
| 128 |
+
def __init__(self):
|
| 129 |
+
smallest_normal = float.fromhex("0x1p-14")
|
| 130 |
+
self.smallest_normal = float8_e5m2(smallest_normal)
|
| 131 |
+
smallest_subnormal = float.fromhex("0x1p-16")
|
| 132 |
+
self.smallest_subnormal = float8_e5m2(smallest_subnormal)
|
| 133 |
+
|
| 134 |
+
|
| 135 |
+
class _Float8E5m2fnuzMachArLike:
|
| 136 |
+
|
| 137 |
+
def __init__(self):
|
| 138 |
+
smallest_normal = float.fromhex("0x1p-15")
|
| 139 |
+
self.smallest_normal = float8_e5m2fnuz(smallest_normal)
|
| 140 |
+
smallest_subnormal = float.fromhex("0x1p-17")
|
| 141 |
+
self.smallest_subnormal = float8_e5m2fnuz(smallest_subnormal)
|
| 142 |
+
|
| 143 |
+
|
| 144 |
+
class _Float8E8m0fnuMachArLike:
|
| 145 |
+
|
| 146 |
+
def __init__(self):
|
| 147 |
+
smallest_normal = float.fromhex("0x1p-127")
|
| 148 |
+
self.smallest_normal = float8_e8m0fnu(smallest_normal)
|
| 149 |
+
smallest_subnormal = float.fromhex("0x1p-127")
|
| 150 |
+
self.smallest_subnormal = float8_e8m0fnu(smallest_subnormal)
|
| 151 |
+
|
| 152 |
+
|
| 153 |
+
class finfo(np.finfo): # pylint: disable=invalid-name,missing-class-docstring
|
| 154 |
+
__doc__ = np.finfo.__doc__
|
| 155 |
+
|
| 156 |
+
@staticmethod
|
| 157 |
+
def _bfloat16_finfo():
|
| 158 |
+
def float_to_str(f):
|
| 159 |
+
return "%12.4e" % float(f)
|
| 160 |
+
|
| 161 |
+
tiny = float.fromhex("0x1p-126")
|
| 162 |
+
resolution = 0.01
|
| 163 |
+
eps = float.fromhex("0x1p-7")
|
| 164 |
+
epsneg = float.fromhex("0x1p-8")
|
| 165 |
+
max_ = float.fromhex("0x1.FEp127")
|
| 166 |
+
|
| 167 |
+
obj = object.__new__(np.finfo)
|
| 168 |
+
obj.dtype = _bfloat16_dtype
|
| 169 |
+
obj.bits = 16
|
| 170 |
+
obj.eps = bfloat16(eps)
|
| 171 |
+
obj.epsneg = bfloat16(epsneg)
|
| 172 |
+
obj.machep = -7
|
| 173 |
+
obj.negep = -8
|
| 174 |
+
obj.max = bfloat16(max_)
|
| 175 |
+
obj.min = bfloat16(-max_)
|
| 176 |
+
obj.nexp = 8
|
| 177 |
+
obj.nmant = 7
|
| 178 |
+
obj.iexp = obj.nexp
|
| 179 |
+
obj.maxexp = 128
|
| 180 |
+
obj.minexp = -126
|
| 181 |
+
obj.precision = 2
|
| 182 |
+
obj.resolution = bfloat16(resolution)
|
| 183 |
+
# pylint: disable=protected-access
|
| 184 |
+
obj._machar = _Bfloat16MachArLike()
|
| 185 |
+
if not hasattr(obj, "tiny"):
|
| 186 |
+
obj.tiny = bfloat16(tiny)
|
| 187 |
+
if not hasattr(obj, "smallest_normal"):
|
| 188 |
+
obj.smallest_normal = obj._machar.smallest_normal
|
| 189 |
+
obj.smallest_subnormal = obj._machar.smallest_subnormal
|
| 190 |
+
|
| 191 |
+
obj._str_tiny = float_to_str(tiny)
|
| 192 |
+
obj._str_smallest_normal = float_to_str(tiny)
|
| 193 |
+
obj._str_smallest_subnormal = float_to_str(obj.smallest_subnormal)
|
| 194 |
+
obj._str_max = float_to_str(max_)
|
| 195 |
+
obj._str_epsneg = float_to_str(epsneg)
|
| 196 |
+
obj._str_eps = float_to_str(eps)
|
| 197 |
+
obj._str_resolution = float_to_str(resolution)
|
| 198 |
+
# pylint: enable=protected-access
|
| 199 |
+
return obj
|
| 200 |
+
|
| 201 |
+
@staticmethod
|
| 202 |
+
def _float4_e2m1fn_finfo():
|
| 203 |
+
eps = float.fromhex("0x0.8p0") # 0.5
|
| 204 |
+
max_ = float.fromhex("0x1.8p2") # 6.0
|
| 205 |
+
|
| 206 |
+
obj = object.__new__(np.finfo)
|
| 207 |
+
obj.dtype = _float4_e2m1fn_dtype
|
| 208 |
+
obj.bits = 4
|
| 209 |
+
obj.eps = eps
|
| 210 |
+
obj.epsneg = eps
|
| 211 |
+
obj.machep = -1
|
| 212 |
+
obj.negep = -1
|
| 213 |
+
obj.max = float4_e2m1fn(max_)
|
| 214 |
+
obj.min = float4_e2m1fn(-max_)
|
| 215 |
+
obj.nexp = 2
|
| 216 |
+
obj.nmant = 1
|
| 217 |
+
obj.iexp = obj.nexp
|
| 218 |
+
obj.maxexp = 3
|
| 219 |
+
obj.minexp = 0
|
| 220 |
+
obj.precision = 0
|
| 221 |
+
obj.resolution = float4_e2m1fn(1.0)
|
| 222 |
+
# pylint: disable=protected-access
|
| 223 |
+
obj._machar = _Float4E2m1fnMachArLike()
|
| 224 |
+
tiny = obj._machar.smallest_normal
|
| 225 |
+
if not hasattr(obj, "tiny"):
|
| 226 |
+
obj.tiny = tiny
|
| 227 |
+
if not hasattr(obj, "smallest_normal"):
|
| 228 |
+
obj.smallest_normal = tiny
|
| 229 |
+
obj.smallest_subnormal = obj._machar.smallest_subnormal
|
| 230 |
+
|
| 231 |
+
float_to_str = str
|
| 232 |
+
obj._str_tiny = float_to_str(tiny)
|
| 233 |
+
obj._str_smallest_normal = float_to_str(tiny)
|
| 234 |
+
obj._str_smallest_subnormal = float_to_str(obj.smallest_subnormal)
|
| 235 |
+
obj._str_max = float_to_str(obj.max)
|
| 236 |
+
obj._str_epsneg = float_to_str(obj.epsneg)
|
| 237 |
+
obj._str_eps = float_to_str(obj.eps)
|
| 238 |
+
obj._str_resolution = float_to_str(obj.resolution)
|
| 239 |
+
# pylint: enable=protected-access
|
| 240 |
+
return obj
|
| 241 |
+
|
| 242 |
+
@staticmethod
|
| 243 |
+
def _float6_e2m3fn_finfo():
|
| 244 |
+
eps = float.fromhex("0x0.2p0") # 0.125
|
| 245 |
+
max_ = float.fromhex("0x1.Ep2") # 7.5
|
| 246 |
+
|
| 247 |
+
obj = object.__new__(np.finfo)
|
| 248 |
+
obj.dtype = _float6_e2m3fn_dtype
|
| 249 |
+
obj.bits = 6
|
| 250 |
+
obj.eps = eps
|
| 251 |
+
obj.epsneg = eps
|
| 252 |
+
obj.machep = -3
|
| 253 |
+
obj.negep = -3
|
| 254 |
+
obj.max = float6_e2m3fn(max_)
|
| 255 |
+
obj.min = float6_e2m3fn(-max_)
|
| 256 |
+
obj.nexp = 2
|
| 257 |
+
obj.nmant = 3
|
| 258 |
+
obj.iexp = obj.nexp
|
| 259 |
+
obj.maxexp = 3
|
| 260 |
+
obj.minexp = 0
|
| 261 |
+
obj.precision = 0
|
| 262 |
+
obj.resolution = float6_e2m3fn(1.0)
|
| 263 |
+
# pylint: disable=protected-access
|
| 264 |
+
obj._machar = _Float6E2m3fnMachArLike()
|
| 265 |
+
tiny = obj._machar.smallest_normal
|
| 266 |
+
if not hasattr(obj, "tiny"):
|
| 267 |
+
obj.tiny = tiny
|
| 268 |
+
if not hasattr(obj, "smallest_normal"):
|
| 269 |
+
obj.smallest_normal = tiny
|
| 270 |
+
obj.smallest_subnormal = obj._machar.smallest_subnormal
|
| 271 |
+
|
| 272 |
+
float_to_str = str
|
| 273 |
+
obj._str_tiny = float_to_str(tiny)
|
| 274 |
+
obj._str_smallest_normal = float_to_str(tiny)
|
| 275 |
+
obj._str_smallest_subnormal = float_to_str(obj.smallest_subnormal)
|
| 276 |
+
obj._str_max = float_to_str(obj.max)
|
| 277 |
+
obj._str_epsneg = float_to_str(obj.epsneg)
|
| 278 |
+
obj._str_eps = float_to_str(obj.eps)
|
| 279 |
+
obj._str_resolution = float_to_str(obj.resolution)
|
| 280 |
+
# pylint: enable=protected-access
|
| 281 |
+
return obj
|
| 282 |
+
|
| 283 |
+
@staticmethod
|
| 284 |
+
def _float6_e3m2fn_finfo():
|
| 285 |
+
eps = float.fromhex("0x1p-2") # 0.25
|
| 286 |
+
max_ = float.fromhex("0x1.Cp4") # 28
|
| 287 |
+
|
| 288 |
+
obj = object.__new__(np.finfo)
|
| 289 |
+
obj.dtype = _float6_e3m2fn_dtype
|
| 290 |
+
obj.bits = 6
|
| 291 |
+
obj.eps = eps
|
| 292 |
+
obj.epsneg = eps / 2
|
| 293 |
+
obj.machep = -2
|
| 294 |
+
obj.negep = -3
|
| 295 |
+
obj.max = float6_e3m2fn(max_)
|
| 296 |
+
obj.min = float6_e3m2fn(-max_)
|
| 297 |
+
obj.nexp = 3
|
| 298 |
+
obj.nmant = 2
|
| 299 |
+
obj.iexp = obj.nexp
|
| 300 |
+
obj.maxexp = 5
|
| 301 |
+
obj.minexp = -2
|
| 302 |
+
obj.precision = 0
|
| 303 |
+
obj.resolution = float6_e3m2fn(1.0)
|
| 304 |
+
# pylint: disable=protected-access
|
| 305 |
+
obj._machar = _Float6E3m2fnMachArLike()
|
| 306 |
+
tiny = obj._machar.smallest_normal
|
| 307 |
+
if not hasattr(obj, "tiny"):
|
| 308 |
+
obj.tiny = tiny
|
| 309 |
+
if not hasattr(obj, "smallest_normal"):
|
| 310 |
+
obj.smallest_normal = tiny
|
| 311 |
+
obj.smallest_subnormal = obj._machar.smallest_subnormal
|
| 312 |
+
|
| 313 |
+
float_to_str = str
|
| 314 |
+
obj._str_tiny = float_to_str(tiny)
|
| 315 |
+
obj._str_smallest_normal = float_to_str(tiny)
|
| 316 |
+
obj._str_smallest_subnormal = float_to_str(obj.smallest_subnormal)
|
| 317 |
+
obj._str_max = float_to_str(obj.max)
|
| 318 |
+
obj._str_epsneg = float_to_str(obj.epsneg)
|
| 319 |
+
obj._str_eps = float_to_str(obj.eps)
|
| 320 |
+
obj._str_resolution = float_to_str(obj.resolution)
|
| 321 |
+
# pylint: enable=protected-access
|
| 322 |
+
return obj
|
| 323 |
+
|
| 324 |
+
@staticmethod
|
| 325 |
+
def _float8_e3m4_finfo():
|
| 326 |
+
def float_to_str(f):
|
| 327 |
+
return "%6.2e" % float(f)
|
| 328 |
+
|
| 329 |
+
tiny = float.fromhex("0x1p-2") # 1/4 min normal
|
| 330 |
+
resolution = 0.1
|
| 331 |
+
eps = float.fromhex("0x1p-4") # 1/16
|
| 332 |
+
epsneg = float.fromhex("0x1p-5") # 1/32
|
| 333 |
+
max_ = float.fromhex("0x1.Fp3") # 15.5 max normal
|
| 334 |
+
|
| 335 |
+
obj = object.__new__(np.finfo)
|
| 336 |
+
obj.dtype = _float8_e3m4_dtype
|
| 337 |
+
obj.bits = 8
|
| 338 |
+
obj.eps = float8_e3m4(eps)
|
| 339 |
+
obj.epsneg = float8_e3m4(epsneg)
|
| 340 |
+
obj.machep = -4
|
| 341 |
+
obj.negep = -5
|
| 342 |
+
obj.max = float8_e3m4(max_)
|
| 343 |
+
obj.min = float8_e3m4(-max_)
|
| 344 |
+
obj.nexp = 3
|
| 345 |
+
obj.nmant = 4
|
| 346 |
+
obj.iexp = obj.nexp
|
| 347 |
+
obj.maxexp = 4
|
| 348 |
+
obj.minexp = -2
|
| 349 |
+
obj.precision = 1
|
| 350 |
+
obj.resolution = float8_e3m4(resolution)
|
| 351 |
+
# pylint: disable=protected-access
|
| 352 |
+
obj._machar = _Float8E3m4MachArLike()
|
| 353 |
+
if not hasattr(obj, "tiny"):
|
| 354 |
+
obj.tiny = float8_e3m4(tiny)
|
| 355 |
+
if not hasattr(obj, "smallest_normal"):
|
| 356 |
+
obj.smallest_normal = obj._machar.smallest_normal
|
| 357 |
+
obj.smallest_subnormal = obj._machar.smallest_subnormal
|
| 358 |
+
|
| 359 |
+
obj._str_tiny = float_to_str(tiny)
|
| 360 |
+
obj._str_smallest_normal = float_to_str(tiny)
|
| 361 |
+
obj._str_smallest_subnormal = float_to_str(obj.smallest_subnormal)
|
| 362 |
+
obj._str_max = float_to_str(max_)
|
| 363 |
+
obj._str_epsneg = float_to_str(epsneg)
|
| 364 |
+
obj._str_eps = float_to_str(eps)
|
| 365 |
+
obj._str_resolution = float_to_str(resolution)
|
| 366 |
+
# pylint: enable=protected-access
|
| 367 |
+
return obj
|
| 368 |
+
|
| 369 |
+
@staticmethod
|
| 370 |
+
def _float8_e4m3_finfo():
|
| 371 |
+
def float_to_str(f):
|
| 372 |
+
return "%6.2e" % float(f)
|
| 373 |
+
|
| 374 |
+
tiny = float.fromhex("0x1p-6") # 1/64 min normal
|
| 375 |
+
resolution = 0.1
|
| 376 |
+
eps = float.fromhex("0x1p-3") # 1/8
|
| 377 |
+
epsneg = float.fromhex("0x1p-4") # 1/16
|
| 378 |
+
max_ = float.fromhex("0x1.Ep7") # 240 max normal
|
| 379 |
+
|
| 380 |
+
obj = object.__new__(np.finfo)
|
| 381 |
+
obj.dtype = _float8_e4m3_dtype
|
| 382 |
+
obj.bits = 8
|
| 383 |
+
obj.eps = float8_e4m3(eps)
|
| 384 |
+
obj.epsneg = float8_e4m3(epsneg)
|
| 385 |
+
obj.machep = -3
|
| 386 |
+
obj.negep = -4
|
| 387 |
+
obj.max = float8_e4m3(max_)
|
| 388 |
+
obj.min = float8_e4m3(-max_)
|
| 389 |
+
obj.nexp = 4
|
| 390 |
+
obj.nmant = 3
|
| 391 |
+
obj.iexp = obj.nexp
|
| 392 |
+
obj.maxexp = 8
|
| 393 |
+
obj.minexp = -6
|
| 394 |
+
obj.precision = 1
|
| 395 |
+
obj.resolution = float8_e4m3(resolution)
|
| 396 |
+
# pylint: disable=protected-access
|
| 397 |
+
obj._machar = _Float8E4m3MachArLike()
|
| 398 |
+
if not hasattr(obj, "tiny"):
|
| 399 |
+
obj.tiny = float8_e4m3(tiny)
|
| 400 |
+
if not hasattr(obj, "smallest_normal"):
|
| 401 |
+
obj.smallest_normal = obj._machar.smallest_normal
|
| 402 |
+
obj.smallest_subnormal = obj._machar.smallest_subnormal
|
| 403 |
+
|
| 404 |
+
obj._str_tiny = float_to_str(tiny)
|
| 405 |
+
obj._str_smallest_normal = float_to_str(tiny)
|
| 406 |
+
obj._str_smallest_subnormal = float_to_str(obj.smallest_subnormal)
|
| 407 |
+
obj._str_max = float_to_str(max_)
|
| 408 |
+
obj._str_epsneg = float_to_str(epsneg)
|
| 409 |
+
obj._str_eps = float_to_str(eps)
|
| 410 |
+
obj._str_resolution = float_to_str(resolution)
|
| 411 |
+
# pylint: enable=protected-access
|
| 412 |
+
return obj
|
| 413 |
+
|
| 414 |
+
@staticmethod
|
| 415 |
+
def _float8_e4m3b11fnuz_finfo():
|
| 416 |
+
def float_to_str(f):
|
| 417 |
+
return "%6.2e" % float(f)
|
| 418 |
+
|
| 419 |
+
tiny = float.fromhex("0x1p-10")
|
| 420 |
+
resolution = 0.1
|
| 421 |
+
eps = float.fromhex("0x1p-3")
|
| 422 |
+
epsneg = float.fromhex("0x1p-4")
|
| 423 |
+
max_ = float.fromhex("0x1.Ep4")
|
| 424 |
+
|
| 425 |
+
obj = object.__new__(np.finfo)
|
| 426 |
+
obj.dtype = _float8_e4m3b11fnuz_dtype
|
| 427 |
+
obj.bits = 8
|
| 428 |
+
obj.eps = float8_e4m3b11fnuz(eps)
|
| 429 |
+
obj.epsneg = float8_e4m3b11fnuz(epsneg)
|
| 430 |
+
obj.machep = -3
|
| 431 |
+
obj.negep = -4
|
| 432 |
+
obj.max = float8_e4m3b11fnuz(max_)
|
| 433 |
+
obj.min = float8_e4m3b11fnuz(-max_)
|
| 434 |
+
obj.nexp = 4
|
| 435 |
+
obj.nmant = 3
|
| 436 |
+
obj.iexp = obj.nexp
|
| 437 |
+
obj.maxexp = 5
|
| 438 |
+
obj.minexp = -10
|
| 439 |
+
obj.precision = 1
|
| 440 |
+
obj.resolution = float8_e4m3b11fnuz(resolution)
|
| 441 |
+
# pylint: disable=protected-access
|
| 442 |
+
obj._machar = _Float8E4m3b11fnuzMachArLike()
|
| 443 |
+
if not hasattr(obj, "tiny"):
|
| 444 |
+
obj.tiny = float8_e4m3b11fnuz(tiny)
|
| 445 |
+
if not hasattr(obj, "smallest_normal"):
|
| 446 |
+
obj.smallest_normal = obj._machar.smallest_normal
|
| 447 |
+
obj.smallest_subnormal = obj._machar.smallest_subnormal
|
| 448 |
+
|
| 449 |
+
obj._str_tiny = float_to_str(tiny)
|
| 450 |
+
obj._str_smallest_normal = float_to_str(tiny)
|
| 451 |
+
obj._str_smallest_subnormal = float_to_str(obj.smallest_subnormal)
|
| 452 |
+
obj._str_max = float_to_str(max_)
|
| 453 |
+
obj._str_epsneg = float_to_str(epsneg)
|
| 454 |
+
obj._str_eps = float_to_str(eps)
|
| 455 |
+
obj._str_resolution = float_to_str(resolution)
|
| 456 |
+
# pylint: enable=protected-access
|
| 457 |
+
return obj
|
| 458 |
+
|
| 459 |
+
@staticmethod
|
| 460 |
+
def _float8_e4m3fn_finfo():
|
| 461 |
+
def float_to_str(f):
|
| 462 |
+
return "%6.2e" % float(f)
|
| 463 |
+
|
| 464 |
+
tiny = float.fromhex("0x1p-6")
|
| 465 |
+
resolution = 0.1
|
| 466 |
+
eps = float.fromhex("0x1p-3")
|
| 467 |
+
epsneg = float.fromhex("0x1p-4")
|
| 468 |
+
max_ = float.fromhex("0x1.Cp8")
|
| 469 |
+
|
| 470 |
+
obj = object.__new__(np.finfo)
|
| 471 |
+
obj.dtype = _float8_e4m3fn_dtype
|
| 472 |
+
obj.bits = 8
|
| 473 |
+
obj.eps = float8_e4m3fn(eps)
|
| 474 |
+
obj.epsneg = float8_e4m3fn(epsneg)
|
| 475 |
+
obj.machep = -3
|
| 476 |
+
obj.negep = -4
|
| 477 |
+
obj.max = float8_e4m3fn(max_)
|
| 478 |
+
obj.min = float8_e4m3fn(-max_)
|
| 479 |
+
obj.nexp = 4
|
| 480 |
+
obj.nmant = 3
|
| 481 |
+
obj.iexp = obj.nexp
|
| 482 |
+
obj.maxexp = 9
|
| 483 |
+
obj.minexp = -6
|
| 484 |
+
obj.precision = 1
|
| 485 |
+
obj.resolution = float8_e4m3fn(resolution)
|
| 486 |
+
# pylint: disable=protected-access
|
| 487 |
+
obj._machar = _Float8E4m3fnMachArLike()
|
| 488 |
+
if not hasattr(obj, "tiny"):
|
| 489 |
+
obj.tiny = float8_e4m3fn(tiny)
|
| 490 |
+
if not hasattr(obj, "smallest_normal"):
|
| 491 |
+
obj.smallest_normal = obj._machar.smallest_normal
|
| 492 |
+
obj.smallest_subnormal = obj._machar.smallest_subnormal
|
| 493 |
+
|
| 494 |
+
obj._str_tiny = float_to_str(tiny)
|
| 495 |
+
obj._str_smallest_normal = float_to_str(tiny)
|
| 496 |
+
obj._str_smallest_subnormal = float_to_str(obj.smallest_subnormal)
|
| 497 |
+
obj._str_max = float_to_str(max_)
|
| 498 |
+
obj._str_epsneg = float_to_str(epsneg)
|
| 499 |
+
obj._str_eps = float_to_str(eps)
|
| 500 |
+
obj._str_resolution = float_to_str(resolution)
|
| 501 |
+
# pylint: enable=protected-access
|
| 502 |
+
return obj
|
| 503 |
+
|
| 504 |
+
@staticmethod
|
| 505 |
+
def _float8_e4m3fnuz_finfo():
|
| 506 |
+
def float_to_str(f):
|
| 507 |
+
return "%6.2e" % float(f)
|
| 508 |
+
|
| 509 |
+
tiny = float.fromhex("0x1p-7")
|
| 510 |
+
resolution = 0.1
|
| 511 |
+
eps = float.fromhex("0x1p-3")
|
| 512 |
+
epsneg = float.fromhex("0x1p-4")
|
| 513 |
+
max_ = float.fromhex("0x1.Ep7")
|
| 514 |
+
|
| 515 |
+
obj = object.__new__(np.finfo)
|
| 516 |
+
obj.dtype = _float8_e4m3fnuz_dtype
|
| 517 |
+
obj.bits = 8
|
| 518 |
+
obj.eps = float8_e4m3fnuz(eps)
|
| 519 |
+
obj.epsneg = float8_e4m3fnuz(epsneg)
|
| 520 |
+
obj.machep = -3
|
| 521 |
+
obj.negep = -4
|
| 522 |
+
obj.max = float8_e4m3fnuz(max_)
|
| 523 |
+
obj.min = float8_e4m3fnuz(-max_)
|
| 524 |
+
obj.nexp = 4
|
| 525 |
+
obj.nmant = 3
|
| 526 |
+
obj.iexp = obj.nexp
|
| 527 |
+
obj.maxexp = 8
|
| 528 |
+
obj.minexp = -7
|
| 529 |
+
obj.precision = 1
|
| 530 |
+
obj.resolution = float8_e4m3fnuz(resolution)
|
| 531 |
+
# pylint: disable=protected-access
|
| 532 |
+
obj._machar = _Float8E4m3fnuzMachArLike()
|
| 533 |
+
if not hasattr(obj, "tiny"):
|
| 534 |
+
obj.tiny = float8_e4m3fnuz(tiny)
|
| 535 |
+
if not hasattr(obj, "smallest_normal"):
|
| 536 |
+
obj.smallest_normal = obj._machar.smallest_normal
|
| 537 |
+
obj.smallest_subnormal = obj._machar.smallest_subnormal
|
| 538 |
+
|
| 539 |
+
obj._str_tiny = float_to_str(tiny)
|
| 540 |
+
obj._str_smallest_normal = float_to_str(tiny)
|
| 541 |
+
obj._str_smallest_subnormal = float_to_str(obj.smallest_subnormal)
|
| 542 |
+
obj._str_max = float_to_str(max_)
|
| 543 |
+
obj._str_epsneg = float_to_str(epsneg)
|
| 544 |
+
obj._str_eps = float_to_str(eps)
|
| 545 |
+
obj._str_resolution = float_to_str(resolution)
|
| 546 |
+
# pylint: enable=protected-access
|
| 547 |
+
return obj
|
| 548 |
+
|
| 549 |
+
@staticmethod
|
| 550 |
+
def _float8_e5m2_finfo():
|
| 551 |
+
def float_to_str(f):
|
| 552 |
+
return "%6.2e" % float(f)
|
| 553 |
+
|
| 554 |
+
tiny = float.fromhex("0x1p-14")
|
| 555 |
+
resolution = 0.1
|
| 556 |
+
eps = float.fromhex("0x1p-2")
|
| 557 |
+
epsneg = float.fromhex("0x1p-3")
|
| 558 |
+
max_ = float.fromhex("0x1.Cp15")
|
| 559 |
+
|
| 560 |
+
obj = object.__new__(np.finfo)
|
| 561 |
+
obj.dtype = _float8_e5m2_dtype
|
| 562 |
+
obj.bits = 8
|
| 563 |
+
obj.eps = float8_e5m2(eps)
|
| 564 |
+
obj.epsneg = float8_e5m2(epsneg)
|
| 565 |
+
obj.machep = -2
|
| 566 |
+
obj.negep = -3
|
| 567 |
+
obj.max = float8_e5m2(max_)
|
| 568 |
+
obj.min = float8_e5m2(-max_)
|
| 569 |
+
obj.nexp = 5
|
| 570 |
+
obj.nmant = 2
|
| 571 |
+
obj.iexp = obj.nexp
|
| 572 |
+
obj.maxexp = 16
|
| 573 |
+
obj.minexp = -14
|
| 574 |
+
obj.precision = 1
|
| 575 |
+
obj.resolution = float8_e5m2(resolution)
|
| 576 |
+
# pylint: disable=protected-access
|
| 577 |
+
obj._machar = _Float8E5m2MachArLike()
|
| 578 |
+
if not hasattr(obj, "tiny"):
|
| 579 |
+
obj.tiny = float8_e5m2(tiny)
|
| 580 |
+
if not hasattr(obj, "smallest_normal"):
|
| 581 |
+
obj.smallest_normal = obj._machar.smallest_normal
|
| 582 |
+
obj.smallest_subnormal = obj._machar.smallest_subnormal
|
| 583 |
+
|
| 584 |
+
obj._str_tiny = float_to_str(tiny)
|
| 585 |
+
obj._str_smallest_normal = float_to_str(tiny)
|
| 586 |
+
obj._str_smallest_subnormal = float_to_str(obj.smallest_subnormal)
|
| 587 |
+
obj._str_max = float_to_str(max_)
|
| 588 |
+
obj._str_epsneg = float_to_str(epsneg)
|
| 589 |
+
obj._str_eps = float_to_str(eps)
|
| 590 |
+
obj._str_resolution = float_to_str(resolution)
|
| 591 |
+
# pylint: enable=protected-access
|
| 592 |
+
return obj
|
| 593 |
+
|
| 594 |
+
@staticmethod
|
| 595 |
+
def _float8_e5m2fnuz_finfo():
|
| 596 |
+
def float_to_str(f):
|
| 597 |
+
return "%6.2e" % float(f)
|
| 598 |
+
|
| 599 |
+
tiny = float.fromhex("0x1p-15")
|
| 600 |
+
resolution = 0.1
|
| 601 |
+
eps = float.fromhex("0x1p-2")
|
| 602 |
+
epsneg = float.fromhex("0x1p-3")
|
| 603 |
+
max_ = float.fromhex("0x1.Cp15")
|
| 604 |
+
|
| 605 |
+
obj = object.__new__(np.finfo)
|
| 606 |
+
obj.dtype = _float8_e5m2fnuz_dtype
|
| 607 |
+
obj.bits = 8
|
| 608 |
+
obj.eps = float8_e5m2fnuz(eps)
|
| 609 |
+
obj.epsneg = float8_e5m2fnuz(epsneg)
|
| 610 |
+
obj.machep = -2
|
| 611 |
+
obj.negep = -3
|
| 612 |
+
obj.max = float8_e5m2fnuz(max_)
|
| 613 |
+
obj.min = float8_e5m2fnuz(-max_)
|
| 614 |
+
obj.nexp = 5
|
| 615 |
+
obj.nmant = 2
|
| 616 |
+
obj.iexp = obj.nexp
|
| 617 |
+
obj.maxexp = 16
|
| 618 |
+
obj.minexp = -15
|
| 619 |
+
obj.precision = 1
|
| 620 |
+
obj.resolution = float8_e5m2fnuz(resolution)
|
| 621 |
+
# pylint: disable=protected-access
|
| 622 |
+
obj._machar = _Float8E5m2fnuzMachArLike()
|
| 623 |
+
if not hasattr(obj, "tiny"):
|
| 624 |
+
obj.tiny = float8_e5m2fnuz(tiny)
|
| 625 |
+
if not hasattr(obj, "smallest_normal"):
|
| 626 |
+
obj.smallest_normal = obj._machar.smallest_normal
|
| 627 |
+
obj.smallest_subnormal = obj._machar.smallest_subnormal
|
| 628 |
+
|
| 629 |
+
obj._str_tiny = float_to_str(tiny)
|
| 630 |
+
obj._str_smallest_normal = float_to_str(tiny)
|
| 631 |
+
obj._str_smallest_subnormal = float_to_str(obj.smallest_subnormal)
|
| 632 |
+
obj._str_max = float_to_str(max_)
|
| 633 |
+
obj._str_epsneg = float_to_str(epsneg)
|
| 634 |
+
obj._str_eps = float_to_str(eps)
|
| 635 |
+
obj._str_resolution = float_to_str(resolution)
|
| 636 |
+
# pylint: enable=protected-access
|
| 637 |
+
return obj
|
| 638 |
+
|
| 639 |
+
@staticmethod
|
| 640 |
+
def _float8_e8m0fnu_finfo():
|
| 641 |
+
def float_to_str(f):
|
| 642 |
+
return "%6.2e" % float(f)
|
| 643 |
+
|
| 644 |
+
tiny = float.fromhex("0x1p-127")
|
| 645 |
+
resolution = 0.1
|
| 646 |
+
eps = float.fromhex("0x1p+0")
|
| 647 |
+
epsneg = float.fromhex("0x1p-1")
|
| 648 |
+
max_ = float.fromhex("0x1p+127")
|
| 649 |
+
|
| 650 |
+
obj = object.__new__(np.finfo)
|
| 651 |
+
obj.dtype = _float8_e8m0fnu_dtype
|
| 652 |
+
obj.bits = 8
|
| 653 |
+
obj.eps = float8_e8m0fnu(eps)
|
| 654 |
+
obj.epsneg = float8_e8m0fnu(epsneg)
|
| 655 |
+
obj.machep = 0
|
| 656 |
+
obj.negep = -1
|
| 657 |
+
obj.max = float8_e8m0fnu(max_)
|
| 658 |
+
obj.min = float8_e8m0fnu(tiny)
|
| 659 |
+
obj.nexp = 8
|
| 660 |
+
obj.nmant = 0
|
| 661 |
+
obj.iexp = obj.nexp
|
| 662 |
+
obj.maxexp = 128
|
| 663 |
+
obj.minexp = -127
|
| 664 |
+
obj.precision = 1
|
| 665 |
+
obj.resolution = float8_e8m0fnu(resolution)
|
| 666 |
+
# pylint: disable=protected-access
|
| 667 |
+
obj._machar = _Float8E8m0fnuMachArLike()
|
| 668 |
+
if not hasattr(obj, "tiny"):
|
| 669 |
+
obj.tiny = float8_e8m0fnu(tiny)
|
| 670 |
+
if not hasattr(obj, "smallest_normal"):
|
| 671 |
+
obj.smallest_normal = obj._machar.smallest_normal
|
| 672 |
+
obj.smallest_subnormal = obj._machar.smallest_subnormal
|
| 673 |
+
|
| 674 |
+
obj._str_tiny = float_to_str(tiny)
|
| 675 |
+
obj._str_smallest_normal = float_to_str(tiny)
|
| 676 |
+
obj._str_smallest_subnormal = float_to_str(obj.smallest_subnormal)
|
| 677 |
+
obj._str_max = float_to_str(max_)
|
| 678 |
+
obj._str_epsneg = float_to_str(epsneg)
|
| 679 |
+
obj._str_eps = float_to_str(eps)
|
| 680 |
+
obj._str_resolution = float_to_str(resolution)
|
| 681 |
+
# pylint: enable=protected-access
|
| 682 |
+
return obj
|
| 683 |
+
|
| 684 |
+
_finfo_type_map = {
|
| 685 |
+
_bfloat16_dtype: _bfloat16_finfo,
|
| 686 |
+
_float4_e2m1fn_dtype: _float4_e2m1fn_finfo,
|
| 687 |
+
_float6_e2m3fn_dtype: _float6_e2m3fn_finfo,
|
| 688 |
+
_float6_e3m2fn_dtype: _float6_e3m2fn_finfo,
|
| 689 |
+
_float8_e3m4_dtype: _float8_e3m4_finfo,
|
| 690 |
+
_float8_e4m3_dtype: _float8_e4m3_finfo,
|
| 691 |
+
_float8_e4m3fn_dtype: _float8_e4m3fn_finfo,
|
| 692 |
+
_float8_e4m3fnuz_dtype: _float8_e4m3fnuz_finfo,
|
| 693 |
+
_float8_e4m3b11fnuz_dtype: _float8_e4m3b11fnuz_finfo,
|
| 694 |
+
_float8_e5m2_dtype: _float8_e5m2_finfo,
|
| 695 |
+
_float8_e5m2fnuz_dtype: _float8_e5m2fnuz_finfo,
|
| 696 |
+
_float8_e8m0fnu_dtype: _float8_e8m0fnu_finfo,
|
| 697 |
+
}
|
| 698 |
+
_finfo_name_map = {t.name: t for t in _finfo_type_map}
|
| 699 |
+
_finfo_cache = {
|
| 700 |
+
t: init_fn.__func__() for t, init_fn in _finfo_type_map.items() # pytype: disable=attribute-error
|
| 701 |
+
}
|
| 702 |
+
|
| 703 |
+
def __new__(cls, dtype):
|
| 704 |
+
if isinstance(dtype, str):
|
| 705 |
+
key = cls._finfo_name_map.get(dtype)
|
| 706 |
+
elif isinstance(dtype, np.dtype):
|
| 707 |
+
key = dtype
|
| 708 |
+
else:
|
| 709 |
+
key = np.dtype(dtype)
|
| 710 |
+
i = cls._finfo_cache.get(key)
|
| 711 |
+
if i is not None:
|
| 712 |
+
return i
|
| 713 |
+
return super().__new__(cls, dtype)
|
pythonProject/.venv/Lib/site-packages/ml_dtypes/_iinfo.py
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright 2023 The ml_dtypes Authors.
|
| 2 |
+
#
|
| 3 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 4 |
+
# you may not use this file except in compliance with the License.
|
| 5 |
+
# You may obtain a copy of the License at
|
| 6 |
+
#
|
| 7 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 8 |
+
#
|
| 9 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 10 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 11 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 12 |
+
# See the License for the specific language governing permissions and
|
| 13 |
+
# limitations under the License.
|
| 14 |
+
|
| 15 |
+
"""Overload of numpy.iinfo to handle dtypes defined in ml_dtypes."""
|
| 16 |
+
|
| 17 |
+
from ml_dtypes._ml_dtypes_ext import int2
|
| 18 |
+
from ml_dtypes._ml_dtypes_ext import int4
|
| 19 |
+
from ml_dtypes._ml_dtypes_ext import uint2
|
| 20 |
+
from ml_dtypes._ml_dtypes_ext import uint4
|
| 21 |
+
import numpy as np
|
| 22 |
+
|
| 23 |
+
_int2_dtype = np.dtype(int2)
|
| 24 |
+
_uint2_dtype = np.dtype(uint2)
|
| 25 |
+
_int4_dtype = np.dtype(int4)
|
| 26 |
+
_uint4_dtype = np.dtype(uint4)
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
class iinfo: # pylint: disable=invalid-name,missing-class-docstring
|
| 30 |
+
kind: str
|
| 31 |
+
bits: int
|
| 32 |
+
min: int
|
| 33 |
+
max: int
|
| 34 |
+
dtype: np.dtype
|
| 35 |
+
|
| 36 |
+
def __init__(self, int_type):
|
| 37 |
+
if int_type == _int2_dtype:
|
| 38 |
+
self.dtype = _int2_dtype
|
| 39 |
+
self.kind = "i"
|
| 40 |
+
self.bits = 2
|
| 41 |
+
self.min = -2
|
| 42 |
+
self.max = 1
|
| 43 |
+
elif int_type == _uint2_dtype:
|
| 44 |
+
self.dtype = _uint2_dtype
|
| 45 |
+
self.kind = "u"
|
| 46 |
+
self.bits = 2
|
| 47 |
+
self.min = 0
|
| 48 |
+
self.max = 3
|
| 49 |
+
elif int_type == _int4_dtype:
|
| 50 |
+
self.dtype = _int4_dtype
|
| 51 |
+
self.kind = "i"
|
| 52 |
+
self.bits = 4
|
| 53 |
+
self.min = -8
|
| 54 |
+
self.max = 7
|
| 55 |
+
elif int_type == _uint4_dtype:
|
| 56 |
+
self.dtype = _uint4_dtype
|
| 57 |
+
self.kind = "u"
|
| 58 |
+
self.bits = 4
|
| 59 |
+
self.min = 0
|
| 60 |
+
self.max = 15
|
| 61 |
+
else:
|
| 62 |
+
ii = np.iinfo(int_type)
|
| 63 |
+
self.dtype = ii.dtype
|
| 64 |
+
self.kind = ii.kind
|
| 65 |
+
self.bits = ii.bits
|
| 66 |
+
self.min = ii.min
|
| 67 |
+
self.max = ii.max
|
| 68 |
+
|
| 69 |
+
def __repr__(self):
|
| 70 |
+
return f"iinfo(min={self.min}, max={self.max}, dtype={self.dtype})"
|
| 71 |
+
|
| 72 |
+
def __str__(self):
|
| 73 |
+
return repr(self)
|
pythonProject/.venv/Lib/site-packages/ml_dtypes/py.typed
ADDED
|
File without changes
|
pythonProject/.venv/Lib/site-packages/mpmath-1.3.0.dist-info/INSTALLER
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
pip
|
pythonProject/.venv/Lib/site-packages/mpmath-1.3.0.dist-info/LICENSE
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Copyright (c) 2005-2021 Fredrik Johansson and mpmath contributors
|
| 2 |
+
|
| 3 |
+
All rights reserved.
|
| 4 |
+
|
| 5 |
+
Redistribution and use in source and binary forms, with or without
|
| 6 |
+
modification, are permitted provided that the following conditions are met:
|
| 7 |
+
|
| 8 |
+
a. Redistributions of source code must retain the above copyright notice,
|
| 9 |
+
this list of conditions and the following disclaimer.
|
| 10 |
+
b. Redistributions in binary form must reproduce the above copyright
|
| 11 |
+
notice, this list of conditions and the following disclaimer in the
|
| 12 |
+
documentation and/or other materials provided with the distribution.
|
| 13 |
+
c. Neither the name of the copyright holder nor the names of its
|
| 14 |
+
contributors may be used to endorse or promote products derived
|
| 15 |
+
from this software without specific prior written permission.
|
| 16 |
+
|
| 17 |
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
| 18 |
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
| 19 |
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
| 20 |
+
ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR
|
| 21 |
+
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
| 22 |
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
| 23 |
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
| 24 |
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
| 25 |
+
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
| 26 |
+
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSI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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Metadata-Version: 2.1
|
| 2 |
+
Name: mpmath
|
| 3 |
+
Version: 1.3.0
|
| 4 |
+
Summary: Python library for arbitrary-precision floating-point arithmetic
|
| 5 |
+
Home-page: http://mpmath.org/
|
| 6 |
+
Author: Fredrik Johansson
|
| 7 |
+
Author-email: fredrik.johansson@gmail.com
|
| 8 |
+
License: BSD
|
| 9 |
+
Project-URL: Source, https://github.com/fredrik-johansson/mpmath
|
| 10 |
+
Project-URL: Tracker, https://github.com/fredrik-johansson/mpmath/issues
|
| 11 |
+
Project-URL: Documentation, http://mpmath.org/doc/current/
|
| 12 |
+
Classifier: License :: OSI Approved :: BSD License
|
| 13 |
+
Classifier: Topic :: Scientific/Engineering :: Mathematics
|
| 14 |
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
| 15 |
+
Classifier: Programming Language :: Python
|
| 16 |
+
Classifier: Programming Language :: Python :: 2
|
| 17 |
+
Classifier: Programming Language :: Python :: 2.7
|
| 18 |
+
Classifier: Programming Language :: Python :: 3
|
| 19 |
+
Classifier: Programming Language :: Python :: 3.5
|
| 20 |
+
Classifier: Programming Language :: Python :: 3.6
|
| 21 |
+
Classifier: Programming Language :: Python :: 3.7
|
| 22 |
+
Classifier: Programming Language :: Python :: 3.8
|
| 23 |
+
Classifier: Programming Language :: Python :: 3.9
|
| 24 |
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
| 25 |
+
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
| 26 |
+
License-File: LICENSE
|
| 27 |
+
Provides-Extra: develop
|
| 28 |
+
Requires-Dist: pytest (>=4.6) ; extra == 'develop'
|
| 29 |
+
Requires-Dist: pycodestyle ; extra == 'develop'
|
| 30 |
+
Requires-Dist: pytest-cov ; extra == 'develop'
|
| 31 |
+
Requires-Dist: codecov ; extra == 'develop'
|
| 32 |
+
Requires-Dist: wheel ; extra == 'develop'
|
| 33 |
+
Provides-Extra: docs
|
| 34 |
+
Requires-Dist: sphinx ; extra == 'docs'
|
| 35 |
+
Provides-Extra: gmpy
|
| 36 |
+
Requires-Dist: gmpy2 (>=2.1.0a4) ; (platform_python_implementation != "PyPy") and extra == 'gmpy'
|
| 37 |
+
Provides-Extra: tests
|
| 38 |
+
Requires-Dist: pytest (>=4.6) ; extra == 'tests'
|
| 39 |
+
|
| 40 |
+
mpmath
|
| 41 |
+
======
|
| 42 |
+
|
| 43 |
+
|pypi version| |Build status| |Code coverage status| |Zenodo Badge|
|
| 44 |
+
|
| 45 |
+
.. |pypi version| image:: https://img.shields.io/pypi/v/mpmath.svg
|
| 46 |
+
:target: https://pypi.python.org/pypi/mpmath
|
| 47 |
+
.. |Build status| image:: https://github.com/fredrik-johansson/mpmath/workflows/test/badge.svg
|
| 48 |
+
:target: https://github.com/fredrik-johansson/mpmath/actions?workflow=test
|
| 49 |
+
.. |Code coverage status| image:: https://codecov.io/gh/fredrik-johansson/mpmath/branch/master/graph/badge.svg
|
| 50 |
+
:target: https://codecov.io/gh/fredrik-johansson/mpmath
|
| 51 |
+
.. |Zenodo Badge| image:: https://zenodo.org/badge/2934512.svg
|
| 52 |
+
:target: https://zenodo.org/badge/latestdoi/2934512
|
| 53 |
+
|
| 54 |
+
A Python library for arbitrary-precision floating-point arithmetic.
|
| 55 |
+
|
| 56 |
+
Website: http://mpmath.org/
|
| 57 |
+
Main author: Fredrik Johansson <fredrik.johansson@gmail.com>
|
| 58 |
+
|
| 59 |
+
Mpmath is free software released under the New BSD License (see the
|
| 60 |
+
LICENSE file for details)
|
| 61 |
+
|
| 62 |
+
0. History and credits
|
| 63 |
+
----------------------
|
| 64 |
+
|
| 65 |
+
The following people (among others) have contributed major patches
|
| 66 |
+
or new features to mpmath:
|
| 67 |
+
|
| 68 |
+
* Pearu Peterson <pearu.peterson@gmail.com>
|
| 69 |
+
* Mario Pernici <mario.pernici@mi.infn.it>
|
| 70 |
+
* Ondrej Certik <ondrej@certik.cz>
|
| 71 |
+
* Vinzent Steinberg <vinzent.steinberg@gmail.cm>
|
| 72 |
+
* Nimish Telang <ntelang@gmail.com>
|
| 73 |
+
* Mike Taschuk <mtaschuk@ece.ualberta.ca>
|
| 74 |
+
* Case Van Horsen <casevh@gmail.com>
|
| 75 |
+
* Jorn Baayen <jorn.baayen@gmail.com>
|
| 76 |
+
* Chris Smith <smichr@gmail.com>
|
| 77 |
+
* Juan Arias de Reyna <arias@us.es>
|
| 78 |
+
* Ioannis Tziakos <itziakos@gmail.com>
|
| 79 |
+
* Aaron Meurer <asmeurer@gmail.com>
|
| 80 |
+
* Stefan Krastanov <krastanov.stefan@gmail.com>
|
| 81 |
+
* Ken Allen <ken.allen@sbcglobal.net>
|
| 82 |
+
* Timo Hartmann <thartmann15@gmail.com>
|
| 83 |
+
* Sergey B Kirpichev <skirpichev@gmail.com>
|
| 84 |
+
* Kris Kuhlman <kristopher.kuhlman@gmail.com>
|
| 85 |
+
* Paul Masson <paulmasson@analyticphysics.com>
|
| 86 |
+
* Michael Kagalenko <michael.kagalenko@gmail.com>
|
| 87 |
+
* Jonathan Warner <warnerjon12@gmail.com>
|
| 88 |
+
* Max Gaukler <max.gaukler@fau.de>
|
| 89 |
+
* Guillermo Navas-Palencia <g.navas.palencia@gmail.com>
|
| 90 |
+
* Nike Dattani <nike@hpqc.org>
|
| 91 |
+
|
| 92 |
+
Numerous other people have contributed by reporting bugs,
|
| 93 |
+
requesting new features, or suggesting improvements to the
|
| 94 |
+
documentation.
|
| 95 |
+
|
| 96 |
+
For a detailed changelog, including individual contributions,
|
| 97 |
+
see the CHANGES file.
|
| 98 |
+
|
| 99 |
+
Fredrik's work on mpmath during summer 2008 was sponsored by Google
|
| 100 |
+
as part of the Google Summer of Code program.
|
| 101 |
+
|
| 102 |
+
Fredrik's work on mpmath during summer 2009 was sponsored by the
|
| 103 |
+
American Institute of Mathematics under the support of the National Science
|
| 104 |
+
Foundation Grant No. 0757627 (FRG: L-functions and Modular Forms).
|
| 105 |
+
|
| 106 |
+
Any opinions, findings, and conclusions or recommendations expressed in this
|
| 107 |
+
material are those of the author(s) and do not necessarily reflect the
|
| 108 |
+
views of the sponsors.
|
| 109 |
+
|
| 110 |
+
Credit also goes to:
|
| 111 |
+
|
| 112 |
+
* The authors of the GMP library and the Python wrapper
|
| 113 |
+
gmpy, enabling mpmath to become much faster at
|
| 114 |
+
high precision
|
| 115 |
+
* The authors of MPFR, pari/gp, MPFUN, and other arbitrary-
|
| 116 |
+
precision libraries, whose documentation has been helpful
|
| 117 |
+
for implementing many of the algorithms in mpmath
|
| 118 |
+
* Wikipedia contributors; Abramowitz & Stegun; Gradshteyn & Ryzhik;
|
| 119 |
+
Wolfram Research for MathWorld and the Wolfram Functions site.
|
| 120 |
+
These are the main references used for special functions
|
| 121 |
+
implementations.
|
| 122 |
+
* George Brandl for developing the Sphinx documentation tool
|
| 123 |
+
used to build mpmath's documentation
|
| 124 |
+
|
| 125 |
+
Release history:
|
| 126 |
+
|
| 127 |
+
* Version 1.3.0 released on March 7, 2023
|
| 128 |
+
* Version 1.2.0 released on February 1, 2021
|
| 129 |
+
* Version 1.1.0 released on December 11, 2018
|
| 130 |
+
* Version 1.0.0 released on September 27, 2017
|
| 131 |
+
* Version 0.19 released on June 10, 2014
|
| 132 |
+
* Version 0.18 released on December 31, 2013
|
| 133 |
+
* Version 0.17 released on February 1, 2011
|
| 134 |
+
* Version 0.16 released on September 24, 2010
|
| 135 |
+
* Version 0.15 released on June 6, 2010
|
| 136 |
+
* Version 0.14 released on February 5, 2010
|
| 137 |
+
* Version 0.13 released on August 13, 2009
|
| 138 |
+
* Version 0.12 released on June 9, 2009
|
| 139 |
+
* Version 0.11 released on January 26, 2009
|
| 140 |
+
* Version 0.10 released on October 15, 2008
|
| 141 |
+
* Version 0.9 released on August 23, 2008
|
| 142 |
+
* Version 0.8 released on April 20, 2008
|
| 143 |
+
* Version 0.7 released on March 12, 2008
|
| 144 |
+
* Version 0.6 released on January 13, 2008
|
| 145 |
+
* Version 0.5 released on November 24, 2007
|
| 146 |
+
* Version 0.4 released on November 3, 2007
|
| 147 |
+
* Version 0.3 released on October 5, 2007
|
| 148 |
+
* Version 0.2 released on October 2, 2007
|
| 149 |
+
* Version 0.1 released on September 27, 2007
|
| 150 |
+
|
| 151 |
+
1. Download & installation
|
| 152 |
+
--------------------------
|
| 153 |
+
|
| 154 |
+
Mpmath requires Python 2.7 or 3.5 (or later versions). It has been tested
|
| 155 |
+
with CPython 2.7, 3.5 through 3.7 and for PyPy.
|
| 156 |
+
|
| 157 |
+
The latest release of mpmath can be downloaded from the mpmath
|
| 158 |
+
website and from https://github.com/fredrik-johansson/mpmath/releases
|
| 159 |
+
|
| 160 |
+
It should also be available in the Python Package Index at
|
| 161 |
+
https://pypi.python.org/pypi/mpmath
|
| 162 |
+
|
| 163 |
+
To install latest release of Mpmath with pip, simply run
|
| 164 |
+
|
| 165 |
+
``pip install mpmath``
|
| 166 |
+
|
| 167 |
+
Or unpack the mpmath archive and run
|
| 168 |
+
|
| 169 |
+
``python setup.py install``
|
| 170 |
+
|
| 171 |
+
Mpmath can also be installed using
|
| 172 |
+
|
| 173 |
+
``python -m easy_install mpmath``
|
| 174 |
+
|
| 175 |
+
The latest development code is available from
|
| 176 |
+
https://github.com/fredrik-johansson/mpmath
|
| 177 |
+
|
| 178 |
+
See the main documentation for more detailed instructions.
|
| 179 |
+
|
| 180 |
+
2. Running tests
|
| 181 |
+
----------------
|
| 182 |
+
|
| 183 |
+
The unit tests in mpmath/tests/ can be run via the script
|
| 184 |
+
runtests.py, but it is recommended to run them with py.test
|
| 185 |
+
(https://pytest.org/), especially
|
| 186 |
+
to generate more useful reports in case there are failures.
|
| 187 |
+
|
| 188 |
+
You may also want to check out the demo scripts in the demo
|
| 189 |
+
directory.
|
| 190 |
+
|
| 191 |
+
The master branch is automatically tested by Travis CI.
|
| 192 |
+
|
| 193 |
+
3. Documentation
|
| 194 |
+
----------------
|
| 195 |
+
|
| 196 |
+
Documentation in reStructuredText format is available in the
|
| 197 |
+
doc directory included with the source package. These files
|
| 198 |
+
are human-readable, but can be compiled to prettier HTML using
|
| 199 |
+
the build.py script (requires Sphinx, http://sphinx.pocoo.org/).
|
| 200 |
+
|
| 201 |
+
See setup.txt in the documentation for more information.
|
| 202 |
+
|
| 203 |
+
The most recent documentation is also available in HTML format:
|
| 204 |
+
|
| 205 |
+
http://mpmath.org/doc/current/
|
| 206 |
+
|
| 207 |
+
4. Known problems
|
| 208 |
+
-----------------
|
| 209 |
+
|
| 210 |
+
Mpmath is a work in progress. Major issues include:
|
| 211 |
+
|
| 212 |
+
* Some functions may return incorrect values when given extremely
|
| 213 |
+
large arguments or arguments very close to singularities.
|
| 214 |
+
|
| 215 |
+
* Directed rounding works for arithmetic operations. It is implemented
|
| 216 |
+
heuristically for other operations, and their results may be off by one
|
| 217 |
+
or two units in the last place (even if otherwise accurate).
|
| 218 |
+
|
| 219 |
+
* Some IEEE 754 features are not available. Inifinities and NaN are
|
| 220 |
+
partially supported; denormal rounding is currently not available
|
| 221 |
+
at all.
|
| 222 |
+
|
| 223 |
+
* The interface for switching precision and rounding is not finalized.
|
| 224 |
+
The current method is not threadsafe.
|
| 225 |
+
|
| 226 |
+
5. Help and bug reports
|
| 227 |
+
-----------------------
|
| 228 |
+
|
| 229 |
+
General questions and comments can be sent to the mpmath mailinglist,
|
| 230 |
+
mpmath@googlegroups.com
|
| 231 |
+
|
| 232 |
+
You can also report bugs and send patches to the mpmath issue tracker,
|
| 233 |
+
https://github.com/fredrik-johansson/mpmath/issues
|
pythonProject/.venv/Lib/site-packages/mpmath-1.3.0.dist-info/RECORD
ADDED
|
@@ -0,0 +1,180 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
mpmath-1.3.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
|
| 2 |
+
mpmath-1.3.0.dist-info/LICENSE,sha256=wmyugdpFCOXiSZhXd6M4IfGDIj67dNf4z7-Q_n7vL7c,1537
|
| 3 |
+
mpmath-1.3.0.dist-info/METADATA,sha256=RLZupES5wNGa6UgV01a_BHrmtoDBkmi1wmVofNaoFAY,8630
|
| 4 |
+
mpmath-1.3.0.dist-info/RECORD,,
|
| 5 |
+
mpmath-1.3.0.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
|
| 6 |
+
mpmath-1.3.0.dist-info/top_level.txt,sha256=BUVWrh8EVlkOhM1n3X9S8msTaVcC-3s6Sjt60avHYus,7
|
| 7 |
+
mpmath/__init__.py,sha256=skFYTSwfwDBLChAV6pI3SdewgAQR3UBtyrfIK_Jdn-g,8765
|
| 8 |
+
mpmath/__pycache__/__init__.cpython-310.pyc,,
|
| 9 |
+
mpmath/__pycache__/ctx_base.cpython-310.pyc,,
|
| 10 |
+
mpmath/__pycache__/ctx_fp.cpython-310.pyc,,
|
| 11 |
+
mpmath/__pycache__/ctx_iv.cpython-310.pyc,,
|
| 12 |
+
mpmath/__pycache__/ctx_mp.cpython-310.pyc,,
|
| 13 |
+
mpmath/__pycache__/ctx_mp_python.cpython-310.pyc,,
|
| 14 |
+
mpmath/__pycache__/function_docs.cpython-310.pyc,,
|
| 15 |
+
mpmath/__pycache__/identification.cpython-310.pyc,,
|
| 16 |
+
mpmath/__pycache__/math2.cpython-310.pyc,,
|
| 17 |
+
mpmath/__pycache__/rational.cpython-310.pyc,,
|
| 18 |
+
mpmath/__pycache__/usertools.cpython-310.pyc,,
|
| 19 |
+
mpmath/__pycache__/visualization.cpython-310.pyc,,
|
| 20 |
+
mpmath/calculus/__init__.py,sha256=UAgCIJ1YmaeyTqpNzjBlCZGeIzLtUZMEEpl99VWNjus,162
|
| 21 |
+
mpmath/calculus/__pycache__/__init__.cpython-310.pyc,,
|
| 22 |
+
mpmath/calculus/__pycache__/approximation.cpython-310.pyc,,
|
| 23 |
+
mpmath/calculus/__pycache__/calculus.cpython-310.pyc,,
|
| 24 |
+
mpmath/calculus/__pycache__/differentiation.cpython-310.pyc,,
|
| 25 |
+
mpmath/calculus/__pycache__/extrapolation.cpython-310.pyc,,
|
| 26 |
+
mpmath/calculus/__pycache__/inverselaplace.cpython-310.pyc,,
|
| 27 |
+
mpmath/calculus/__pycache__/odes.cpython-310.pyc,,
|
| 28 |
+
mpmath/calculus/__pycache__/optimization.cpython-310.pyc,,
|
| 29 |
+
mpmath/calculus/__pycache__/polynomials.cpython-310.pyc,,
|
| 30 |
+
mpmath/calculus/__pycache__/quadrature.cpython-310.pyc,,
|
| 31 |
+
mpmath/calculus/approximation.py,sha256=vyzu3YI6r63Oq1KFHrQz02mGXAcH23emqNYhJuUaFZ4,8817
|
| 32 |
+
mpmath/calculus/calculus.py,sha256=A0gSp0hxSyEDfugJViY3CeWalF-vK701YftzrjSQzQ4,112
|
| 33 |
+
mpmath/calculus/differentiation.py,sha256=2L6CBj8xtX9iip98NPbKsLtwtRjxi571wYmTMHFeL90,20226
|
| 34 |
+
mpmath/calculus/extrapolation.py,sha256=xM0rvk2DFEF4iR1Jhl-Y3aS93iW9VVJX7y9IGpmzC-A,73306
|
| 35 |
+
mpmath/calculus/inverselaplace.py,sha256=5-pn8N_t0PtgBTXixsXZ4xxrihK2J5gYsVfTKfDx4gA,36056
|
| 36 |
+
mpmath/calculus/odes.py,sha256=gaHiw7IJjsONNTAa6izFPZpmcg9uyTp8MULnGdzTIGo,9908
|
| 37 |
+
mpmath/calculus/optimization.py,sha256=bKnShXElBOmVOIOlFeksDsYCp9fYSmYwKmXDt0z26MM,32856
|
| 38 |
+
mpmath/calculus/polynomials.py,sha256=D16BhU_SHbVi06IxNwABHR-H77IylndNsN3muPTuFYs,7877
|
| 39 |
+
mpmath/calculus/quadrature.py,sha256=n-avtS8E43foV-5tr5lofgOBaiMUYE8AJjQcWI9QcKk,42432
|
| 40 |
+
mpmath/ctx_base.py,sha256=rfjmfMyA55x8R_cWFINUwWVTElfZmyx5erKDdauSEVw,15985
|
| 41 |
+
mpmath/ctx_fp.py,sha256=ctUjx_NoU0iFWk05cXDYCL2ZtLZOlWs1n6Zao3pbG2g,6572
|
| 42 |
+
mpmath/ctx_iv.py,sha256=tqdMr-GDfkZk1EhoGeCAajy7pQv-RWtrVqhYjfI8r4g,17211
|
| 43 |
+
mpmath/ctx_mp.py,sha256=d3r4t7xHNqSFtmqsA9Btq1Npy3WTM-pcM2_jeCyECxY,49452
|
| 44 |
+
mpmath/ctx_mp_python.py,sha256=3olYWo4lk1SnQ0A_IaZ181qqG8u5pxGat_v-L4Qtn3Y,37815
|
| 45 |
+
mpmath/function_docs.py,sha256=g4PP8n6ILXmHcLyA50sxK6Tmp_Z4_pRN-wDErU8D1i4,283512
|
| 46 |
+
mpmath/functions/__init__.py,sha256=YXVdhqv-6LKm6cr5xxtTNTtuD9zDPKGQl8GmS0xz2xo,330
|
| 47 |
+
mpmath/functions/__pycache__/__init__.cpython-310.pyc,,
|
| 48 |
+
mpmath/functions/__pycache__/bessel.cpython-310.pyc,,
|
| 49 |
+
mpmath/functions/__pycache__/elliptic.cpython-310.pyc,,
|
| 50 |
+
mpmath/functions/__pycache__/expintegrals.cpython-310.pyc,,
|
| 51 |
+
mpmath/functions/__pycache__/factorials.cpython-310.pyc,,
|
| 52 |
+
mpmath/functions/__pycache__/functions.cpython-310.pyc,,
|
| 53 |
+
mpmath/functions/__pycache__/hypergeometric.cpython-310.pyc,,
|
| 54 |
+
mpmath/functions/__pycache__/orthogonal.cpython-310.pyc,,
|
| 55 |
+
mpmath/functions/__pycache__/qfunctions.cpython-310.pyc,,
|
| 56 |
+
mpmath/functions/__pycache__/rszeta.cpython-310.pyc,,
|
| 57 |
+
mpmath/functions/__pycache__/signals.cpython-310.pyc,,
|
| 58 |
+
mpmath/functions/__pycache__/theta.cpython-310.pyc,,
|
| 59 |
+
mpmath/functions/__pycache__/zeta.cpython-310.pyc,,
|
| 60 |
+
mpmath/functions/__pycache__/zetazeros.cpython-310.pyc,,
|
| 61 |
+
mpmath/functions/bessel.py,sha256=dUPLu8frlK-vmf3-irX_7uvwyw4xccv6EIizmIZ88kM,37938
|
| 62 |
+
mpmath/functions/elliptic.py,sha256=qz0yVMb4lWEeOTDL_DWz5u5awmGIPKAsuZFJXgwHJNU,42237
|
| 63 |
+
mpmath/functions/expintegrals.py,sha256=75X_MRdYc1F_X73bgNiOJqwRlS2hqAzcFLl3RM2tCDc,11644
|
| 64 |
+
mpmath/functions/factorials.py,sha256=8_6kCR7e4k1GwxiAOJu0NRadeF4jA28qx4hidhu4ILk,5273
|
| 65 |
+
mpmath/functions/functions.py,sha256=ub2JExvqzCWLkm5yAm72Fr6fdWmZZUknq9_3w9MEigI,18100
|
| 66 |
+
mpmath/functions/hypergeometric.py,sha256=Z0OMAMC4ylK42n_SnamyFVnUx6zHLyCLCoJDSZ1JrHY,51570
|
| 67 |
+
mpmath/functions/orthogonal.py,sha256=FabkxKfBoSseA5flWu1a3re-2BYaew9augqIsT8LaLw,16097
|
| 68 |
+
mpmath/functions/qfunctions.py,sha256=a3EHGKQt_jMd4x9I772Jz-TGFnGY-arWqPvZGz9QSe0,7633
|
| 69 |
+
mpmath/functions/rszeta.py,sha256=yuUVp4ilIyDmXyE3WTBxDDjwfEJNypJnbPS-xPH5How,46184
|
| 70 |
+
mpmath/functions/signals.py,sha256=ELotwQaW1CDpv-eeJzOZ5c23NhfaZcj9_Gkb3psvS0Q,703
|
| 71 |
+
mpmath/functions/theta.py,sha256=KggOocczoMG6_HMoal4oEP7iZ4SKOou9JFE-WzY2r3M,37320
|
| 72 |
+
mpmath/functions/zeta.py,sha256=ue7JY7GXA0oX8q08sQJl2CSRrZ7kOt8HsftpVjnTwrE,36410
|
| 73 |
+
mpmath/functions/zetazeros.py,sha256=uq6TVyZBcY2MLX7VSdVfn0TOkowBLM9fXtnySEwaNzw,30858
|
| 74 |
+
mpmath/identification.py,sha256=7aMdngRAaeL_MafDUNbmEIlGQSklHDZ8pmPFt-OLgkw,29253
|
| 75 |
+
mpmath/libmp/__init__.py,sha256=UCDjLZw4brbklaCmSixCcPdLdHkz8sF_-6F_wr0duAg,3790
|
| 76 |
+
mpmath/libmp/__pycache__/__init__.cpython-310.pyc,,
|
| 77 |
+
mpmath/libmp/__pycache__/backend.cpython-310.pyc,,
|
| 78 |
+
mpmath/libmp/__pycache__/gammazeta.cpython-310.pyc,,
|
| 79 |
+
mpmath/libmp/__pycache__/libelefun.cpython-310.pyc,,
|
| 80 |
+
mpmath/libmp/__pycache__/libhyper.cpython-310.pyc,,
|
| 81 |
+
mpmath/libmp/__pycache__/libintmath.cpython-310.pyc,,
|
| 82 |
+
mpmath/libmp/__pycache__/libmpc.cpython-310.pyc,,
|
| 83 |
+
mpmath/libmp/__pycache__/libmpf.cpython-310.pyc,,
|
| 84 |
+
mpmath/libmp/__pycache__/libmpi.cpython-310.pyc,,
|
| 85 |
+
mpmath/libmp/backend.py,sha256=26A8pUkaGov26vrrFNQVyWJ5LDtK8sl3UHrYLecaTjA,3360
|
| 86 |
+
mpmath/libmp/gammazeta.py,sha256=Xqdw6PMoswDaSca_sOs-IglRuk3fb8c9p43M_lbcrlc,71469
|
| 87 |
+
mpmath/libmp/libelefun.py,sha256=joBZP4FOdxPfieWso1LPtSr6dHydpG_LQiF_bYQYWMg,43861
|
| 88 |
+
mpmath/libmp/libhyper.py,sha256=J9fmdDF6u27EcssEWvBuVaAa3hFjPvPN1SgRgu1dEbc,36624
|
| 89 |
+
mpmath/libmp/libintmath.py,sha256=aIRT0rkUZ_sdGQf3TNCLd-pBMvtQWjssbvFLfK7U0jc,16688
|
| 90 |
+
mpmath/libmp/libmpc.py,sha256=KBndUjs5YVS32-Id3fflDfYgpdW1Prx6zfo8Ez5Qbrs,26875
|
| 91 |
+
mpmath/libmp/libmpf.py,sha256=vpP0kNVkScbCVoZogJ4Watl4I7Ce0d4dzHVjfVe57so,45021
|
| 92 |
+
mpmath/libmp/libmpi.py,sha256=u0I5Eiwkqa-4-dXETi5k7MuaxBeZbvCAPFtl93U9YF0,27622
|
| 93 |
+
mpmath/math2.py,sha256=O5Dglg81SsW0wfHDUJcXOD8-cCaLvbVIvyw0sVmRbpI,18561
|
| 94 |
+
mpmath/matrices/__init__.py,sha256=ETzGDciYbq9ftiKwaMbJ15EI-KNXHrzRb-ZHehhqFjs,94
|
| 95 |
+
mpmath/matrices/__pycache__/__init__.cpython-310.pyc,,
|
| 96 |
+
mpmath/matrices/__pycache__/calculus.cpython-310.pyc,,
|
| 97 |
+
mpmath/matrices/__pycache__/eigen.cpython-310.pyc,,
|
| 98 |
+
mpmath/matrices/__pycache__/eigen_symmetric.cpython-310.pyc,,
|
| 99 |
+
mpmath/matrices/__pycache__/linalg.cpython-310.pyc,,
|
| 100 |
+
mpmath/matrices/__pycache__/matrices.cpython-310.pyc,,
|
| 101 |
+
mpmath/matrices/calculus.py,sha256=PNRq-p2nxgT-fzC54K2depi8ddhdx6Q86G8qpUiHeUY,18609
|
| 102 |
+
mpmath/matrices/eigen.py,sha256=GbDXI3CixzEdXxr1G86uUWkAngAvd-05MmSQ-Tsu_5k,24394
|
| 103 |
+
mpmath/matrices/eigen_symmetric.py,sha256=FPKPeQr1cGYw6Y6ea32a1YdEWQDLP6JlQHEA2WfNLYg,58534
|
| 104 |
+
mpmath/matrices/linalg.py,sha256=04C3ijzMFom7ob5fXBCDfyPPdo3BIboIeE8x2A6vqF0,26958
|
| 105 |
+
mpmath/matrices/matrices.py,sha256=o78Eq62EHQnxcsR0LBoWDEGREOoN4L2iDM1q3dQrw0o,32331
|
| 106 |
+
mpmath/rational.py,sha256=64d56fvZXngYZT7nOAHeFRUX77eJ1A0R3rpfWBU-mSo,5976
|
| 107 |
+
mpmath/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
| 108 |
+
mpmath/tests/__pycache__/__init__.cpython-310.pyc,,
|
| 109 |
+
mpmath/tests/__pycache__/extratest_gamma.cpython-310.pyc,,
|
| 110 |
+
mpmath/tests/__pycache__/extratest_zeta.cpython-310.pyc,,
|
| 111 |
+
mpmath/tests/__pycache__/runtests.cpython-310.pyc,,
|
| 112 |
+
mpmath/tests/__pycache__/test_basic_ops.cpython-310.pyc,,
|
| 113 |
+
mpmath/tests/__pycache__/test_bitwise.cpython-310.pyc,,
|
| 114 |
+
mpmath/tests/__pycache__/test_calculus.cpython-310.pyc,,
|
| 115 |
+
mpmath/tests/__pycache__/test_compatibility.cpython-310.pyc,,
|
| 116 |
+
mpmath/tests/__pycache__/test_convert.cpython-310.pyc,,
|
| 117 |
+
mpmath/tests/__pycache__/test_diff.cpython-310.pyc,,
|
| 118 |
+
mpmath/tests/__pycache__/test_division.cpython-310.pyc,,
|
| 119 |
+
mpmath/tests/__pycache__/test_eigen.cpython-310.pyc,,
|
| 120 |
+
mpmath/tests/__pycache__/test_eigen_symmetric.cpython-310.pyc,,
|
| 121 |
+
mpmath/tests/__pycache__/test_elliptic.cpython-310.pyc,,
|
| 122 |
+
mpmath/tests/__pycache__/test_fp.cpython-310.pyc,,
|
| 123 |
+
mpmath/tests/__pycache__/test_functions.cpython-310.pyc,,
|
| 124 |
+
mpmath/tests/__pycache__/test_functions2.cpython-310.pyc,,
|
| 125 |
+
mpmath/tests/__pycache__/test_gammazeta.cpython-310.pyc,,
|
| 126 |
+
mpmath/tests/__pycache__/test_hp.cpython-310.pyc,,
|
| 127 |
+
mpmath/tests/__pycache__/test_identify.cpython-310.pyc,,
|
| 128 |
+
mpmath/tests/__pycache__/test_interval.cpython-310.pyc,,
|
| 129 |
+
mpmath/tests/__pycache__/test_levin.cpython-310.pyc,,
|
| 130 |
+
mpmath/tests/__pycache__/test_linalg.cpython-310.pyc,,
|
| 131 |
+
mpmath/tests/__pycache__/test_matrices.cpython-310.pyc,,
|
| 132 |
+
mpmath/tests/__pycache__/test_mpmath.cpython-310.pyc,,
|
| 133 |
+
mpmath/tests/__pycache__/test_ode.cpython-310.pyc,,
|
| 134 |
+
mpmath/tests/__pycache__/test_pickle.cpython-310.pyc,,
|
| 135 |
+
mpmath/tests/__pycache__/test_power.cpython-310.pyc,,
|
| 136 |
+
mpmath/tests/__pycache__/test_quad.cpython-310.pyc,,
|
| 137 |
+
mpmath/tests/__pycache__/test_rootfinding.cpython-310.pyc,,
|
| 138 |
+
mpmath/tests/__pycache__/test_special.cpython-310.pyc,,
|
| 139 |
+
mpmath/tests/__pycache__/test_str.cpython-310.pyc,,
|
| 140 |
+
mpmath/tests/__pycache__/test_summation.cpython-310.pyc,,
|
| 141 |
+
mpmath/tests/__pycache__/test_trig.cpython-310.pyc,,
|
| 142 |
+
mpmath/tests/__pycache__/test_visualization.cpython-310.pyc,,
|
| 143 |
+
mpmath/tests/__pycache__/torture.cpython-310.pyc,,
|
| 144 |
+
mpmath/tests/extratest_gamma.py,sha256=xidhXUelILcxtiPGoTBHjqUOKIJzEaZ_v3nntGQyWZQ,7228
|
| 145 |
+
mpmath/tests/extratest_zeta.py,sha256=sg10j9RhjBpV2EdUqyYhGV2ERWvM--EvwwGIz6HTmlw,1003
|
| 146 |
+
mpmath/tests/runtests.py,sha256=7NUV82F3K_5AhU8mCLUFf5OibtT7uloFCwPyM3l71wM,5189
|
| 147 |
+
mpmath/tests/test_basic_ops.py,sha256=dsB8DRG-GrPzBaZ-bIauYabaeqXbfqBo9SIP9BqcTSs,15348
|
| 148 |
+
mpmath/tests/test_bitwise.py,sha256=-nLYhgQbhDza3SQM63BhktYntACagqMYx9ib3dPnTKM,7686
|
| 149 |
+
mpmath/tests/test_calculus.py,sha256=4oxtNfMpO4RLLoOzrv7r9-h8BcqfBsJIE6UpsHe7c4w,9187
|
| 150 |
+
mpmath/tests/test_compatibility.py,sha256=_t3ASZ3jhfAMnN1voWX7PDNIDzn-3PokkJGIdT1x7y0,2306
|
| 151 |
+
mpmath/tests/test_convert.py,sha256=JPcDcTJIWh5prIxjx5DM1aNWgqlUoF2KpHvAgK3uHi4,8834
|
| 152 |
+
mpmath/tests/test_diff.py,sha256=qjiF8NxQ8vueuZ5ZHGPQ-kjcj_I7Jh_fEdFtaA8DzEI,2466
|
| 153 |
+
mpmath/tests/test_division.py,sha256=6lUeZfmaBWvvszdqlWLMHgXPjVsxvW1WZpd4-jFWCpU,5340
|
| 154 |
+
mpmath/tests/test_eigen.py,sha256=2mnqVATGbsJkvSVHPpitfAk881twFfb3LsO3XikV9Hs,3905
|
| 155 |
+
mpmath/tests/test_eigen_symmetric.py,sha256=v0VimCicIU2owASDMBaP-t-30uq-pXcsglt95KBtNO4,8778
|
| 156 |
+
mpmath/tests/test_elliptic.py,sha256=Kjiwq9Bb6N_OOzzWewGQ1M_PMa7vRs42V0t90gloZxo,26225
|
| 157 |
+
mpmath/tests/test_fp.py,sha256=AJo0FTyH4BuUnUsv176LD956om308KGYndy-b54KGxM,89997
|
| 158 |
+
mpmath/tests/test_functions.py,sha256=b47VywdomoOX6KmMmz9-iv2IqVIydwKSuUw2pWlFHrY,30955
|
| 159 |
+
mpmath/tests/test_functions2.py,sha256=vlw2RWhL1oTcifnOMDx1a_YzN96UgNNIE5STeKRv1HY,96990
|
| 160 |
+
mpmath/tests/test_gammazeta.py,sha256=AB34O0DV7AlEf9Z4brnCadeQU5-uAwhWRw5FZas65DA,27917
|
| 161 |
+
mpmath/tests/test_hp.py,sha256=6hcENu6Te2klPEiTSeLBIRPlH7PADlJwFKbx8xpnOhg,10461
|
| 162 |
+
mpmath/tests/test_identify.py,sha256=lGUIPfrB2paTg0cFUo64GmMzF77F9gs9FQjX7gxGHV8,692
|
| 163 |
+
mpmath/tests/test_interval.py,sha256=TjYd7a9ca6iRJiLjw06isLeZTuGoGAPmgleDZ0cYfJ0,17527
|
| 164 |
+
mpmath/tests/test_levin.py,sha256=P8M11yV1dj_gdSNv5xuwCzFiF86QyRDtPMjURy6wJ28,5090
|
| 165 |
+
mpmath/tests/test_linalg.py,sha256=miKEnwB8iwWV13hi1bF1cg3hgB4rTKOR0fvDVfWmXds,10440
|
| 166 |
+
mpmath/tests/test_matrices.py,sha256=qyA4Ml2CvNvW034lzB01G6wVgNr7UrgZqh2wkMXtpzM,7944
|
| 167 |
+
mpmath/tests/test_mpmath.py,sha256=LVyJUeofiaxW-zLKWVBCz59L9UQsjlW0Ts9_oBiEv_4,196
|
| 168 |
+
mpmath/tests/test_ode.py,sha256=zAxexBH4fnmFNO4bvEHbug1NJWC5zqfFaVDlYijowkY,1822
|
| 169 |
+
mpmath/tests/test_pickle.py,sha256=Y8CKmDLFsJHUqG8CDaBw5ilrPP4YT1xijVduLpQ7XFE,401
|
| 170 |
+
mpmath/tests/test_power.py,sha256=sz_K02SmNxpa6Kb1uJLN_N4tXTJGdQ___vPRshEN7Gk,5227
|
| 171 |
+
mpmath/tests/test_quad.py,sha256=49Ltft0vZ_kdKLL5s-Kj-BzAVoF5LPVEUeNUzdOkghI,3893
|
| 172 |
+
mpmath/tests/test_rootfinding.py,sha256=umQegEaKHmYOEl5jEyoD-VLKDtXsTJJkepKEr4c0dC0,3132
|
| 173 |
+
mpmath/tests/test_special.py,sha256=YbMIoMIkJEvvKYIzS0CXthJFG0--j6un7-tcE6b7FPM,2848
|
| 174 |
+
mpmath/tests/test_str.py,sha256=0WsGD9hMPRi8zcuYMA9Cu2mOvQiCFskPwMsMf8lBDK4,544
|
| 175 |
+
mpmath/tests/test_summation.py,sha256=fdNlsvRVOsbWxbhlyDLDaEO2S8kTJrRMKIvB5-aNci0,2035
|
| 176 |
+
mpmath/tests/test_trig.py,sha256=zPtkIEnZaThxcWur4k7BX8-2Jmj-AhO191Svv7ANYUU,4799
|
| 177 |
+
mpmath/tests/test_visualization.py,sha256=1PqtkoUx-WsKYgTRiu5o9pBc85kwhf1lzU2eobDQCJM,944
|
| 178 |
+
mpmath/tests/torture.py,sha256=LD95oES7JY2KroELK-m-jhvtbvZaKChnt0Cq7kFMNCw,7868
|
| 179 |
+
mpmath/usertools.py,sha256=a-TDw7XSRsPdBEffxOooDV4WDFfuXnO58P75dcAD87I,3029
|
| 180 |
+
mpmath/visualization.py,sha256=pnnbjcd9AhFVRBZavYX5gjx4ytK_kXoDDisYR6EpXhs,10627
|
pythonProject/.venv/Lib/site-packages/mpmath-1.3.0.dist-info/WHEEL
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Wheel-Version: 1.0
|
| 2 |
+
Generator: bdist_wheel (0.38.4)
|
| 3 |
+
Root-Is-Purelib: true
|
| 4 |
+
Tag: py3-none-any
|
| 5 |
+
|
pythonProject/.venv/Lib/site-packages/mpmath-1.3.0.dist-info/top_level.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
mpmath
|
pythonProject/.venv/Lib/site-packages/mpmath/__pycache__/__init__.cpython-310.pyc
ADDED
|
Binary file (8.27 kB). View file
|
|
|
pythonProject/.venv/Lib/site-packages/mpmath/__pycache__/ctx_base.cpython-310.pyc
ADDED
|
Binary file (16.3 kB). View file
|
|
|
pythonProject/.venv/Lib/site-packages/mpmath/__pycache__/ctx_fp.cpython-310.pyc
ADDED
|
Binary file (7.81 kB). View file
|
|
|
pythonProject/.venv/Lib/site-packages/mpmath/__pycache__/ctx_iv.cpython-310.pyc
ADDED
|
Binary file (20.5 kB). View file
|
|
|
pythonProject/.venv/Lib/site-packages/mpmath/__pycache__/ctx_mp.cpython-310.pyc
ADDED
|
Binary file (43 kB). View file
|
|
|
pythonProject/.venv/Lib/site-packages/mpmath/__pycache__/ctx_mp_python.cpython-310.pyc
ADDED
|
Binary file (34.5 kB). View file
|
|
|
pythonProject/.venv/Lib/site-packages/mpmath/__pycache__/identification.cpython-310.pyc
ADDED
|
Binary file (28.3 kB). View file
|
|
|
pythonProject/.venv/Lib/site-packages/mpmath/__pycache__/math2.cpython-310.pyc
ADDED
|
Binary file (15 kB). View file
|
|
|
pythonProject/.venv/Lib/site-packages/mpmath/__pycache__/rational.cpython-310.pyc
ADDED
|
Binary file (5.96 kB). View file
|
|
|
pythonProject/.venv/Lib/site-packages/mpmath/__pycache__/usertools.cpython-310.pyc
ADDED
|
Binary file (3.6 kB). View file
|
|
|
pythonProject/.venv/Lib/site-packages/mpmath/__pycache__/visualization.cpython-310.pyc
ADDED
|
Binary file (9.7 kB). View file
|
|
|
pythonProject/.venv/Lib/site-packages/mpmath/calculus/__pycache__/__init__.cpython-310.pyc
ADDED
|
Binary file (349 Bytes). View file
|
|
|
pythonProject/.venv/Lib/site-packages/mpmath/calculus/__pycache__/odes.cpython-310.pyc
ADDED
|
Binary file (10.2 kB). View file
|
|
|
pythonProject/.venv/Lib/site-packages/mpmath/calculus/__pycache__/optimization.cpython-310.pyc
ADDED
|
Binary file (29.9 kB). View file
|
|
|
pythonProject/.venv/Lib/site-packages/mpmath/calculus/__pycache__/polynomials.cpython-310.pyc
ADDED
|
Binary file (7.73 kB). View file
|
|
|
pythonProject/.venv/Lib/site-packages/mpmath/calculus/__pycache__/quadrature.cpython-310.pyc
ADDED
|
Binary file (39.6 kB). View file
|
|
|
pythonProject/.venv/Lib/site-packages/mpmath/ctx_base.py
ADDED
|
@@ -0,0 +1,494 @@
|
|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rszeta import RSCache
|
| 7 |
+
from .calculus.quadrature import QuadratureMethods
|
| 8 |
+
from .calculus.inverselaplace import LaplaceTransformInversionMethods
|
| 9 |
+
from .calculus.calculus import CalculusMethods
|
| 10 |
+
from .calculus.optimization import OptimizationMethods
|
| 11 |
+
from .calculus.odes import ODEMethods
|
| 12 |
+
from .matrices.matrices import MatrixMethods
|
| 13 |
+
from .matrices.calculus import MatrixCalculusMethods
|
| 14 |
+
from .matrices.linalg import LinearAlgebraMethods
|
| 15 |
+
from .matrices.eigen import Eigen
|
| 16 |
+
from .identification import IdentificationMethods
|
| 17 |
+
from .visualization import VisualizationMethods
|
| 18 |
+
|
| 19 |
+
from . import libmp
|
| 20 |
+
|
| 21 |
+
class Context(object):
|
| 22 |
+
pass
|
| 23 |
+
|
| 24 |
+
class StandardBaseContext(Context,
|
| 25 |
+
SpecialFunctions,
|
| 26 |
+
RSCache,
|
| 27 |
+
QuadratureMethods,
|
| 28 |
+
LaplaceTransformInversionMethods,
|
| 29 |
+
CalculusMethods,
|
| 30 |
+
MatrixMethods,
|
| 31 |
+
MatrixCalculusMethods,
|
| 32 |
+
LinearAlgebraMethods,
|
| 33 |
+
Eigen,
|
| 34 |
+
IdentificationMethods,
|
| 35 |
+
OptimizationMethods,
|
| 36 |
+
ODEMethods,
|
| 37 |
+
VisualizationMethods):
|
| 38 |
+
|
| 39 |
+
NoConvergence = libmp.NoConvergence
|
| 40 |
+
ComplexResult = libmp.ComplexResult
|
| 41 |
+
|
| 42 |
+
def __init__(ctx):
|
| 43 |
+
ctx._aliases = {}
|
| 44 |
+
# Call those that need preinitialization (e.g. for wrappers)
|
| 45 |
+
SpecialFunctions.__init__(ctx)
|
| 46 |
+
RSCache.__init__(ctx)
|
| 47 |
+
QuadratureMethods.__init__(ctx)
|
| 48 |
+
LaplaceTransformInversionMethods.__init__(ctx)
|
| 49 |
+
CalculusMethods.__init__(ctx)
|
| 50 |
+
MatrixMethods.__init__(ctx)
|
| 51 |
+
|
| 52 |
+
def _init_aliases(ctx):
|
| 53 |
+
for alias, value in ctx._aliases.items():
|
| 54 |
+
try:
|
| 55 |
+
setattr(ctx, alias, getattr(ctx, value))
|
| 56 |
+
except AttributeError:
|
| 57 |
+
pass
|
| 58 |
+
|
| 59 |
+
_fixed_precision = False
|
| 60 |
+
|
| 61 |
+
# XXX
|
| 62 |
+
verbose = False
|
| 63 |
+
|
| 64 |
+
def warn(ctx, msg):
|
| 65 |
+
print("Warning:", msg)
|
| 66 |
+
|
| 67 |
+
def bad_domain(ctx, msg):
|
| 68 |
+
raise ValueError(msg)
|
| 69 |
+
|
| 70 |
+
def _re(ctx, x):
|
| 71 |
+
if hasattr(x, "real"):
|
| 72 |
+
return x.real
|
| 73 |
+
return x
|
| 74 |
+
|
| 75 |
+
def _im(ctx, x):
|
| 76 |
+
if hasattr(x, "imag"):
|
| 77 |
+
return x.imag
|
| 78 |
+
return ctx.zero
|
| 79 |
+
|
| 80 |
+
def _as_points(ctx, x):
|
| 81 |
+
return x
|
| 82 |
+
|
| 83 |
+
def fneg(ctx, x, **kwargs):
|
| 84 |
+
return -ctx.convert(x)
|
| 85 |
+
|
| 86 |
+
def fadd(ctx, x, y, **kwargs):
|
| 87 |
+
return ctx.convert(x)+ctx.convert(y)
|
| 88 |
+
|
| 89 |
+
def fsub(ctx, x, y, **kwargs):
|
| 90 |
+
return ctx.convert(x)-ctx.convert(y)
|
| 91 |
+
|
| 92 |
+
def fmul(ctx, x, y, **kwargs):
|
| 93 |
+
return ctx.convert(x)*ctx.convert(y)
|
| 94 |
+
|
| 95 |
+
def fdiv(ctx, x, y, **kwargs):
|
| 96 |
+
return ctx.convert(x)/ctx.convert(y)
|
| 97 |
+
|
| 98 |
+
def fsum(ctx, args, absolute=False, squared=False):
|
| 99 |
+
if absolute:
|
| 100 |
+
if squared:
|
| 101 |
+
return sum((abs(x)**2 for x in args), ctx.zero)
|
| 102 |
+
return sum((abs(x) for x in args), ctx.zero)
|
| 103 |
+
if squared:
|
| 104 |
+
return sum((x**2 for x in args), ctx.zero)
|
| 105 |
+
return sum(args, ctx.zero)
|
| 106 |
+
|
| 107 |
+
def fdot(ctx, xs, ys=None, conjugate=False):
|
| 108 |
+
if ys is not None:
|
| 109 |
+
xs = zip(xs, ys)
|
| 110 |
+
if conjugate:
|
| 111 |
+
cf = ctx.conj
|
| 112 |
+
return sum((x*cf(y) for (x,y) in xs), ctx.zero)
|
| 113 |
+
else:
|
| 114 |
+
return sum((x*y for (x,y) in xs), ctx.zero)
|
| 115 |
+
|
| 116 |
+
def fprod(ctx, args):
|
| 117 |
+
prod = ctx.one
|
| 118 |
+
for arg in args:
|
| 119 |
+
prod *= arg
|
| 120 |
+
return prod
|
| 121 |
+
|
| 122 |
+
def nprint(ctx, x, n=6, **kwargs):
|
| 123 |
+
"""
|
| 124 |
+
Equivalent to ``print(nstr(x, n))``.
|
| 125 |
+
"""
|
| 126 |
+
print(ctx.nstr(x, n, **kwargs))
|
| 127 |
+
|
| 128 |
+
def chop(ctx, x, tol=None):
|
| 129 |
+
"""
|
| 130 |
+
Chops off small real or imaginary parts, or converts
|
| 131 |
+
numbers close to zero to exact zeros. The input can be a
|
| 132 |
+
single number or an iterable::
|
| 133 |
+
|
| 134 |
+
>>> from mpmath import *
|
| 135 |
+
>>> mp.dps = 15; mp.pretty = False
|
| 136 |
+
>>> chop(5+1e-10j, tol=1e-9)
|
| 137 |
+
mpf('5.0')
|
| 138 |
+
>>> nprint(chop([1.0, 1e-20, 3+1e-18j, -4, 2]))
|
| 139 |
+
[1.0, 0.0, 3.0, -4.0, 2.0]
|
| 140 |
+
|
| 141 |
+
The tolerance defaults to ``100*eps``.
|
| 142 |
+
"""
|
| 143 |
+
if tol is None:
|
| 144 |
+
tol = 100*ctx.eps
|
| 145 |
+
try:
|
| 146 |
+
x = ctx.convert(x)
|
| 147 |
+
absx = abs(x)
|
| 148 |
+
if abs(x) < tol:
|
| 149 |
+
return ctx.zero
|
| 150 |
+
if ctx._is_complex_type(x):
|
| 151 |
+
#part_tol = min(tol, absx*tol)
|
| 152 |
+
part_tol = max(tol, absx*tol)
|
| 153 |
+
if abs(x.imag) < part_tol:
|
| 154 |
+
return x.real
|
| 155 |
+
if abs(x.real) < part_tol:
|
| 156 |
+
return ctx.mpc(0, x.imag)
|
| 157 |
+
except TypeError:
|
| 158 |
+
if isinstance(x, ctx.matrix):
|
| 159 |
+
return x.apply(lambda a: ctx.chop(a, tol))
|
| 160 |
+
if hasattr(x, "__iter__"):
|
| 161 |
+
return [ctx.chop(a, tol) for a in x]
|
| 162 |
+
return x
|
| 163 |
+
|
| 164 |
+
def almosteq(ctx, s, t, rel_eps=None, abs_eps=None):
|
| 165 |
+
r"""
|
| 166 |
+
Determine whether the difference between `s` and `t` is smaller
|
| 167 |
+
than a given epsilon, either relatively or absolutely.
|
| 168 |
+
|
| 169 |
+
Both a maximum relative difference and a maximum difference
|
| 170 |
+
('epsilons') may be specified. The absolute difference is
|
| 171 |
+
defined as `|s-t|` and the relative difference is defined
|
| 172 |
+
as `|s-t|/\max(|s|, |t|)`.
|
| 173 |
+
|
| 174 |
+
If only one epsilon is given, both are set to the same value.
|
| 175 |
+
If none is given, both epsilons are set to `2^{-p+m}` where
|
| 176 |
+
`p` is the current working precision and `m` is a small
|
| 177 |
+
integer. The default setting typically allows :func:`~mpmath.almosteq`
|
| 178 |
+
to be used to check for mathematical equality
|
| 179 |
+
in the presence of small rounding errors.
|
| 180 |
+
|
| 181 |
+
**Examples**
|
| 182 |
+
|
| 183 |
+
>>> from mpmath import *
|
| 184 |
+
>>> mp.dps = 15
|
| 185 |
+
>>> almosteq(3.141592653589793, 3.141592653589790)
|
| 186 |
+
True
|
| 187 |
+
>>> almosteq(3.141592653589793, 3.141592653589700)
|
| 188 |
+
False
|
| 189 |
+
>>> almosteq(3.141592653589793, 3.141592653589700, 1e-10)
|
| 190 |
+
True
|
| 191 |
+
>>> almosteq(1e-20, 2e-20)
|
| 192 |
+
True
|
| 193 |
+
>>> almosteq(1e-20, 2e-20, rel_eps=0, abs_eps=0)
|
| 194 |
+
False
|
| 195 |
+
|
| 196 |
+
"""
|
| 197 |
+
t = ctx.convert(t)
|
| 198 |
+
if abs_eps is None and rel_eps is None:
|
| 199 |
+
rel_eps = abs_eps = ctx.ldexp(1, -ctx.prec+4)
|
| 200 |
+
if abs_eps is None:
|
| 201 |
+
abs_eps = rel_eps
|
| 202 |
+
elif rel_eps is None:
|
| 203 |
+
rel_eps = abs_eps
|
| 204 |
+
diff = abs(s-t)
|
| 205 |
+
if diff <= abs_eps:
|
| 206 |
+
return True
|
| 207 |
+
abss = abs(s)
|
| 208 |
+
abst = abs(t)
|
| 209 |
+
if abss < abst:
|
| 210 |
+
err = diff/abst
|
| 211 |
+
else:
|
| 212 |
+
err = diff/abss
|
| 213 |
+
return err <= rel_eps
|
| 214 |
+
|
| 215 |
+
def arange(ctx, *args):
|
| 216 |
+
r"""
|
| 217 |
+
This is a generalized version of Python's :func:`~mpmath.range` function
|
| 218 |
+
that accepts fractional endpoints and step sizes and
|
| 219 |
+
returns a list of ``mpf`` instances. Like :func:`~mpmath.range`,
|
| 220 |
+
:func:`~mpmath.arange` can be called with 1, 2 or 3 arguments:
|
| 221 |
+
|
| 222 |
+
``arange(b)``
|
| 223 |
+
`[0, 1, 2, \ldots, x]`
|
| 224 |
+
``arange(a, b)``
|
| 225 |
+
`[a, a+1, a+2, \ldots, x]`
|
| 226 |
+
``arange(a, b, h)``
|
| 227 |
+
`[a, a+h, a+h, \ldots, x]`
|
| 228 |
+
|
| 229 |
+
where `b-1 \le x < b` (in the third case, `b-h \le x < b`).
|
| 230 |
+
|
| 231 |
+
Like Python's :func:`~mpmath.range`, the endpoint is not included. To
|
| 232 |
+
produce ranges where the endpoint is included, :func:`~mpmath.linspace`
|
| 233 |
+
is more convenient.
|
| 234 |
+
|
| 235 |
+
**Examples**
|
| 236 |
+
|
| 237 |
+
>>> from mpmath import *
|
| 238 |
+
>>> mp.dps = 15; mp.pretty = False
|
| 239 |
+
>>> arange(4)
|
| 240 |
+
[mpf('0.0'), mpf('1.0'), mpf('2.0'), mpf('3.0')]
|
| 241 |
+
>>> arange(1, 2, 0.25)
|
| 242 |
+
[mpf('1.0'), mpf('1.25'), mpf('1.5'), mpf('1.75')]
|
| 243 |
+
>>> arange(1, -1, -0.75)
|
| 244 |
+
[mpf('1.0'), mpf('0.25'), mpf('-0.5')]
|
| 245 |
+
|
| 246 |
+
"""
|
| 247 |
+
if not len(args) <= 3:
|
| 248 |
+
raise TypeError('arange expected at most 3 arguments, got %i'
|
| 249 |
+
% len(args))
|
| 250 |
+
if not len(args) >= 1:
|
| 251 |
+
raise TypeError('arange expected at least 1 argument, got %i'
|
| 252 |
+
% len(args))
|
| 253 |
+
# set default
|
| 254 |
+
a = 0
|
| 255 |
+
dt = 1
|
| 256 |
+
# interpret arguments
|
| 257 |
+
if len(args) == 1:
|
| 258 |
+
b = args[0]
|
| 259 |
+
elif len(args) >= 2:
|
| 260 |
+
a = args[0]
|
| 261 |
+
b = args[1]
|
| 262 |
+
if len(args) == 3:
|
| 263 |
+
dt = args[2]
|
| 264 |
+
a, b, dt = ctx.mpf(a), ctx.mpf(b), ctx.mpf(dt)
|
| 265 |
+
assert a + dt != a, 'dt is too small and would cause an infinite loop'
|
| 266 |
+
# adapt code for sign of dt
|
| 267 |
+
if a > b:
|
| 268 |
+
if dt > 0:
|
| 269 |
+
return []
|
| 270 |
+
op = gt
|
| 271 |
+
else:
|
| 272 |
+
if dt < 0:
|
| 273 |
+
return []
|
| 274 |
+
op = lt
|
| 275 |
+
# create list
|
| 276 |
+
result = []
|
| 277 |
+
i = 0
|
| 278 |
+
t = a
|
| 279 |
+
while 1:
|
| 280 |
+
t = a + dt*i
|
| 281 |
+
i += 1
|
| 282 |
+
if op(t, b):
|
| 283 |
+
result.append(t)
|
| 284 |
+
else:
|
| 285 |
+
break
|
| 286 |
+
return result
|
| 287 |
+
|
| 288 |
+
def linspace(ctx, *args, **kwargs):
|
| 289 |
+
"""
|
| 290 |
+
``linspace(a, b, n)`` returns a list of `n` evenly spaced
|
| 291 |
+
samples from `a` to `b`. The syntax ``linspace(mpi(a,b), n)``
|
| 292 |
+
is also valid.
|
| 293 |
+
|
| 294 |
+
This function is often more convenient than :func:`~mpmath.arange`
|
| 295 |
+
for partitioning an interval into subintervals, since
|
| 296 |
+
the endpoint is included::
|
| 297 |
+
|
| 298 |
+
>>> from mpmath import *
|
| 299 |
+
>>> mp.dps = 15; mp.pretty = False
|
| 300 |
+
>>> linspace(1, 4, 4)
|
| 301 |
+
[mpf('1.0'), mpf('2.0'), mpf('3.0'), mpf('4.0')]
|
| 302 |
+
|
| 303 |
+
You may also provide the keyword argument ``endpoint=False``::
|
| 304 |
+
|
| 305 |
+
>>> linspace(1, 4, 4, endpoint=False)
|
| 306 |
+
[mpf('1.0'), mpf('1.75'), mpf('2.5'), mpf('3.25')]
|
| 307 |
+
|
| 308 |
+
"""
|
| 309 |
+
if len(args) == 3:
|
| 310 |
+
a = ctx.mpf(args[0])
|
| 311 |
+
b = ctx.mpf(args[1])
|
| 312 |
+
n = int(args[2])
|
| 313 |
+
elif len(args) == 2:
|
| 314 |
+
assert hasattr(args[0], '_mpi_')
|
| 315 |
+
a = args[0].a
|
| 316 |
+
b = args[0].b
|
| 317 |
+
n = int(args[1])
|
| 318 |
+
else:
|
| 319 |
+
raise TypeError('linspace expected 2 or 3 arguments, got %i' \
|
| 320 |
+
% len(args))
|
| 321 |
+
if n < 1:
|
| 322 |
+
raise ValueError('n must be greater than 0')
|
| 323 |
+
if not 'endpoint' in kwargs or kwargs['endpoint']:
|
| 324 |
+
if n == 1:
|
| 325 |
+
return [ctx.mpf(a)]
|
| 326 |
+
step = (b - a) / ctx.mpf(n - 1)
|
| 327 |
+
y = [i*step + a for i in xrange(n)]
|
| 328 |
+
y[-1] = b
|
| 329 |
+
else:
|
| 330 |
+
step = (b - a) / ctx.mpf(n)
|
| 331 |
+
y = [i*step + a for i in xrange(n)]
|
| 332 |
+
return y
|
| 333 |
+
|
| 334 |
+
def cos_sin(ctx, z, **kwargs):
|
| 335 |
+
return ctx.cos(z, **kwargs), ctx.sin(z, **kwargs)
|
| 336 |
+
|
| 337 |
+
def cospi_sinpi(ctx, z, **kwargs):
|
| 338 |
+
return ctx.cospi(z, **kwargs), ctx.sinpi(z, **kwargs)
|
| 339 |
+
|
| 340 |
+
def _default_hyper_maxprec(ctx, p):
|
| 341 |
+
return int(1000 * p**0.25 + 4*p)
|
| 342 |
+
|
| 343 |
+
_gcd = staticmethod(libmp.gcd)
|
| 344 |
+
list_primes = staticmethod(libmp.list_primes)
|
| 345 |
+
isprime = staticmethod(libmp.isprime)
|
| 346 |
+
bernfrac = staticmethod(libmp.bernfrac)
|
| 347 |
+
moebius = staticmethod(libmp.moebius)
|
| 348 |
+
_ifac = staticmethod(libmp.ifac)
|
| 349 |
+
_eulernum = staticmethod(libmp.eulernum)
|
| 350 |
+
_stirling1 = staticmethod(libmp.stirling1)
|
| 351 |
+
_stirling2 = staticmethod(libmp.stirling2)
|
| 352 |
+
|
| 353 |
+
def sum_accurately(ctx, terms, check_step=1):
|
| 354 |
+
prec = ctx.prec
|
| 355 |
+
try:
|
| 356 |
+
extraprec = 10
|
| 357 |
+
while 1:
|
| 358 |
+
ctx.prec = prec + extraprec + 5
|
| 359 |
+
max_mag = ctx.ninf
|
| 360 |
+
s = ctx.zero
|
| 361 |
+
k = 0
|
| 362 |
+
for term in terms():
|
| 363 |
+
s += term
|
| 364 |
+
if (not k % check_step) and term:
|
| 365 |
+
term_mag = ctx.mag(term)
|
| 366 |
+
max_mag = max(max_mag, term_mag)
|
| 367 |
+
sum_mag = ctx.mag(s)
|
| 368 |
+
if sum_mag - term_mag > ctx.prec:
|
| 369 |
+
break
|
| 370 |
+
k += 1
|
| 371 |
+
cancellation = max_mag - sum_mag
|
| 372 |
+
if cancellation != cancellation:
|
| 373 |
+
break
|
| 374 |
+
if cancellation < extraprec or ctx._fixed_precision:
|
| 375 |
+
break
|
| 376 |
+
extraprec += min(ctx.prec, cancellation)
|
| 377 |
+
return s
|
| 378 |
+
finally:
|
| 379 |
+
ctx.prec = prec
|
| 380 |
+
|
| 381 |
+
def mul_accurately(ctx, factors, check_step=1):
|
| 382 |
+
prec = ctx.prec
|
| 383 |
+
try:
|
| 384 |
+
extraprec = 10
|
| 385 |
+
while 1:
|
| 386 |
+
ctx.prec = prec + extraprec + 5
|
| 387 |
+
max_mag = ctx.ninf
|
| 388 |
+
one = ctx.one
|
| 389 |
+
s = one
|
| 390 |
+
k = 0
|
| 391 |
+
for factor in factors():
|
| 392 |
+
s *= factor
|
| 393 |
+
term = factor - one
|
| 394 |
+
if (not k % check_step):
|
| 395 |
+
term_mag = ctx.mag(term)
|
| 396 |
+
max_mag = max(max_mag, term_mag)
|
| 397 |
+
sum_mag = ctx.mag(s-one)
|
| 398 |
+
#if sum_mag - term_mag > ctx.prec:
|
| 399 |
+
# break
|
| 400 |
+
if -term_mag > ctx.prec:
|
| 401 |
+
break
|
| 402 |
+
k += 1
|
| 403 |
+
cancellation = max_mag - sum_mag
|
| 404 |
+
if cancellation != cancellation:
|
| 405 |
+
break
|
| 406 |
+
if cancellation < extraprec or ctx._fixed_precision:
|
| 407 |
+
break
|
| 408 |
+
extraprec += min(ctx.prec, cancellation)
|
| 409 |
+
return s
|
| 410 |
+
finally:
|
| 411 |
+
ctx.prec = prec
|
| 412 |
+
|
| 413 |
+
def power(ctx, x, y):
|
| 414 |
+
r"""Converts `x` and `y` to mpmath numbers and evaluates
|
| 415 |
+
`x^y = \exp(y \log(x))`::
|
| 416 |
+
|
| 417 |
+
>>> from mpmath import *
|
| 418 |
+
>>> mp.dps = 30; mp.pretty = True
|
| 419 |
+
>>> power(2, 0.5)
|
| 420 |
+
1.41421356237309504880168872421
|
| 421 |
+
|
| 422 |
+
This shows the leading few digits of a large Mersenne prime
|
| 423 |
+
(performing the exact calculation ``2**43112609-1`` and
|
| 424 |
+
displaying the result in Python would be very slow)::
|
| 425 |
+
|
| 426 |
+
>>> power(2, 43112609)-1
|
| 427 |
+
3.16470269330255923143453723949e+12978188
|
| 428 |
+
"""
|
| 429 |
+
return ctx.convert(x) ** ctx.convert(y)
|
| 430 |
+
|
| 431 |
+
def _zeta_int(ctx, n):
|
| 432 |
+
return ctx.zeta(n)
|
| 433 |
+
|
| 434 |
+
def maxcalls(ctx, f, N):
|
| 435 |
+
"""
|
| 436 |
+
Return a wrapped copy of *f* that raises ``NoConvergence`` when *f*
|
| 437 |
+
has been called more than *N* times::
|
| 438 |
+
|
| 439 |
+
>>> from mpmath import *
|
| 440 |
+
>>> mp.dps = 15
|
| 441 |
+
>>> f = maxcalls(sin, 10)
|
| 442 |
+
>>> print(sum(f(n) for n in range(10)))
|
| 443 |
+
1.95520948210738
|
| 444 |
+
>>> f(10) # doctest: +IGNORE_EXCEPTION_DETAIL
|
| 445 |
+
Traceback (most recent call last):
|
| 446 |
+
...
|
| 447 |
+
NoConvergence: maxcalls: function evaluated 10 times
|
| 448 |
+
|
| 449 |
+
"""
|
| 450 |
+
counter = [0]
|
| 451 |
+
def f_maxcalls_wrapped(*args, **kwargs):
|
| 452 |
+
counter[0] += 1
|
| 453 |
+
if counter[0] > N:
|
| 454 |
+
raise ctx.NoConvergence("maxcalls: function evaluated %i times" % N)
|
| 455 |
+
return f(*args, **kwargs)
|
| 456 |
+
return f_maxcalls_wrapped
|
| 457 |
+
|
| 458 |
+
def memoize(ctx, f):
|
| 459 |
+
"""
|
| 460 |
+
Return a wrapped copy of *f* that caches computed values, i.e.
|
| 461 |
+
a memoized copy of *f*. Values are only reused if the cached precision
|
| 462 |
+
is equal to or higher than the working precision::
|
| 463 |
+
|
| 464 |
+
>>> from mpmath import *
|
| 465 |
+
>>> mp.dps = 15; mp.pretty = True
|
| 466 |
+
>>> f = memoize(maxcalls(sin, 1))
|
| 467 |
+
>>> f(2)
|
| 468 |
+
0.909297426825682
|
| 469 |
+
>>> f(2)
|
| 470 |
+
0.909297426825682
|
| 471 |
+
>>> mp.dps = 25
|
| 472 |
+
>>> f(2) # doctest: +IGNORE_EXCEPTION_DETAIL
|
| 473 |
+
Traceback (most recent call last):
|
| 474 |
+
...
|
| 475 |
+
NoConvergence: maxcalls: function evaluated 1 times
|
| 476 |
+
|
| 477 |
+
"""
|
| 478 |
+
f_cache = {}
|
| 479 |
+
def f_cached(*args, **kwargs):
|
| 480 |
+
if kwargs:
|
| 481 |
+
key = args, tuple(kwargs.items())
|
| 482 |
+
else:
|
| 483 |
+
key = args
|
| 484 |
+
prec = ctx.prec
|
| 485 |
+
if key in f_cache:
|
| 486 |
+
cprec, cvalue = f_cache[key]
|
| 487 |
+
if cprec >= prec:
|
| 488 |
+
return +cvalue
|
| 489 |
+
value = f(*args, **kwargs)
|
| 490 |
+
f_cache[key] = (prec, value)
|
| 491 |
+
return value
|
| 492 |
+
f_cached.__name__ = f.__name__
|
| 493 |
+
f_cached.__doc__ = f.__doc__
|
| 494 |
+
return f_cached
|