From 8d56f2cbb9c413f64213b4507cdf6163f317d72c Mon Sep 17 00:00:00 2001 From: Remco de Boer <29308176+redeboer@users.noreply.github.com> Date: Wed, 8 Nov 2023 23:09:58 +0100 Subject: [PATCH] MAINT: update pip constraints and pre-commit (#504) * DX: switch to faster `black` pre-commit hook * MAINT: apply new `black` formatting --------- Co-authored-by: GitHub Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .constraints/py3.10.txt | 132 ++++++++++---------- .constraints/py3.11.txt | 132 ++++++++++---------- .constraints/py3.8.txt | 114 +++++++++--------- .constraints/py3.9.txt | 134 ++++++++++----------- .pre-commit-config.yaml | 16 +-- benchmarks/ampform.py | 10 +- benchmarks/expression.py | 2 +- docs/_relink_references.py | 1 + docs/amplitude-analysis.ipynb | 24 ++-- docs/conf.py | 22 ++-- docs/usage.ipynb | 6 +- docs/usage/basics.ipynb | 12 +- docs/usage/unbinned-fit.ipynb | 4 +- src/tensorwaves/data/__init__.py | 1 + src/tensorwaves/data/_data_sample.py | 1 + src/tensorwaves/data/phasespace.py | 1 + src/tensorwaves/data/rng.py | 1 + src/tensorwaves/data/transform.py | 1 + src/tensorwaves/estimator.py | 5 +- src/tensorwaves/function/__init__.py | 1 + src/tensorwaves/function/_backend.py | 10 +- src/tensorwaves/function/sympy/__init__.py | 1 + src/tensorwaves/function/sympy/_printer.py | 34 +++--- src/tensorwaves/interface.py | 3 +- src/tensorwaves/optimizer/callbacks.py | 1 + tests/data/test_phasespace.py | 10 +- tests/optimizer/test_fit_simple_model.py | 2 +- tests/optimizer/test_minuit.py | 8 +- 28 files changed, 336 insertions(+), 353 deletions(-) diff --git a/.constraints/py3.10.txt b/.constraints/py3.10.txt index 1dc62e46..dd7fa0bb 100644 --- a/.constraints/py3.10.txt +++ b/.constraints/py3.10.txt @@ -12,26 +12,25 @@ anyio==4.0.0 argon2-cffi==23.1.0 argon2-cffi-bindings==21.2.0 arrow==1.3.0 -asttokens==2.4.0 +asttokens==2.4.1 astunparse==1.6.3 async-lru==2.0.4 attrs==23.1.0 -babel==2.13.0 -backcall==0.2.0 +babel==2.13.1 beautifulsoup4==4.12.2 -black==23.9.1 +black==23.11.0 bleach==6.1.0 -cachetools==5.3.1 +cachetools==5.3.2 certifi==2023.7.22 cffi==1.16.0 cfgv==3.4.0 chardet==5.2.0 -charset-normalizer==3.3.0 +charset-normalizer==3.3.2 click==8.1.7 -cloudpickle==2.2.1 +cloudpickle==3.0.0 colorama==0.4.6 -comm==0.1.4 -contourpy==1.1.1 +comm==0.2.0 +contourpy==1.2.0 coverage==7.3.2 cycler==0.12.1 debugpy==1.8.0 @@ -40,146 +39,145 @@ defusedxml==0.7.1 deprecated==1.2.14 distlib==0.3.7 dm-tree==0.1.8 -docstring-to-markdown==0.12 +docstring-to-markdown==0.13 docutils==0.19 exceptiongroup==1.1.3 execnet==2.0.2 -executing==2.0.0 +executing==2.0.1 fastjsonschema==2.18.1 -filelock==3.12.4 +filelock==3.13.1 flatbuffers==23.5.26 -fonttools==4.43.1 +fonttools==4.44.0 fqdn==1.5.1 gast==0.5.4 -google-auth==2.23.2 +google-auth==2.23.4 google-auth-oauthlib==1.0.0 google-pasta==0.2.0 graphviz==0.20.1 -greenlet==3.0.0 -grpcio==1.59.0 +greenlet==3.0.1 +grpcio==1.59.2 h5py==3.10.0 hepunits==2.3.2 -identify==2.5.30 +identify==2.5.31 idna==3.4 imagesize==1.4.1 iminuit==2.24.0 importlib-metadata==6.8.0 iniconfig==2.0.0 -ipykernel==6.25.2 +ipykernel==6.26.0 ipympl==0.9.3 -ipython==8.16.1 +ipython==8.17.2 ipython-genutils==0.2.0 ipywidgets==8.1.1 isoduration==20.11.0 -jax==0.4.18 -jaxlib==0.4.18 +jax==0.4.20 +jaxlib==0.4.20 jedi==0.19.1 jinja2==3.1.2 json5==0.9.14 jsonpointer==2.4 -jsonschema==4.19.1 +jsonschema==4.19.2 jsonschema-specifications==2023.7.1 jupyter==1.0.0 jupyter-cache==0.6.1 -jupyter-client==8.3.1 +jupyter-client==8.6.0 jupyter-console==6.6.3 -jupyter-core==5.3.2 -jupyter-events==0.7.0 +jupyter-core==5.5.0 +jupyter-events==0.9.0 jupyter-lsp==2.2.0 -jupyter-server==2.7.3 +jupyter-server==2.10.0 jupyter-server-terminals==0.4.4 -jupyterlab==4.0.6 +jupyterlab==4.0.8 jupyterlab-code-formatter==2.2.1 jupyterlab-lsp==5.0.0 -jupyterlab-myst==2.0.2 +jupyterlab-myst==2.1.0 jupyterlab-pygments==0.2.2 -jupyterlab-server==2.25.0 +jupyterlab-server==2.25.1 jupyterlab-widgets==3.0.9 keras==2.14.0 kiwisolver==1.4.5 libclang==16.0.6 livereload==2.6.3 -llvmlite==0.41.0 -markdown==3.5 +llvmlite==0.41.1 +markdown==3.5.1 markdown-it-py==2.2.0 markupsafe==2.1.3 -matplotlib==3.8.0 +matplotlib==3.8.1 matplotlib-inline==0.1.6 mdit-py-plugins==0.3.5 mdurl==0.1.2 mistune==3.0.2 ml-dtypes==0.2.0 mpmath==1.3.0 -mypy==1.5.1 +mypy==1.6.1 mypy-extensions==1.0.0 myst-nb==0.17.2 myst-parser==0.18.1 nbclient==0.6.8 -nbconvert==7.9.2 +nbconvert==7.11.0 nbformat==5.9.2 -nbmake==1.4.5 +nbmake==1.4.6 nest-asyncio==1.5.8 nodeenv==1.8.0 -notebook==7.0.4 +notebook==7.0.6 notebook-shim==0.2.3 -numba==0.58.0 -numpy==1.25.2 +numba==0.58.1 +numpy==1.26.1 oauthlib==3.2.2 opt-einsum==3.3.0 overrides==7.4.0 packaging==23.2 -pandas==2.1.1 +pandas==2.1.2 pandocfilters==1.5.0 parso==0.8.3 particle==0.23.0 pathspec==0.11.2 pexpect==4.8.0 phasespace==1.9.0 -pickleshare==0.7.5 -pillow==10.0.1 +pillow==10.1.0 platformdirs==3.11.0 pluggy==1.3.0 -pre-commit==3.4.0 -prometheus-client==0.17.1 +pre-commit==3.5.0 +prometheus-client==0.18.0 prompt-toolkit==3.0.39 -protobuf==4.24.4 -psutil==5.9.5 +protobuf==4.25.0 +psutil==5.9.6 ptyprocess==0.7.0 pure-eval==0.2.2 py-cpuinfo==9.0.0 pyasn1==0.5.0 pyasn1-modules==0.3.0 pycparser==2.21 -pydata-sphinx-theme==0.14.1 +pydata-sphinx-theme==0.14.3 pygments==2.16.1 pyparsing==3.1.1 pyproject-api==1.6.1 -pytest==7.4.2 +pytest==7.4.3 pytest-benchmark==4.0.0 pytest-cov==4.1.0 -pytest-mock==3.11.1 +pytest-mock==3.12.0 pytest-xdist==3.3.1 python-constraint==1.4.0 python-dateutil==2.8.2 python-json-logger==2.0.7 python-lsp-jsonrpc==1.1.2 -python-lsp-server==1.8.2 -pytoolconfig==1.2.5 +python-lsp-server==1.9.0 +pytoolconfig==1.2.6 pytz==2023.3.post1 pyyaml==6.0.1 pyzmq==25.1.1 qrules==0.9.8 -qtconsole==5.4.4 -qtpy==2.4.0 +qtconsole==5.5.0 +qtpy==2.4.1 referencing==0.30.2 requests==2.31.0 requests-oauthlib==1.3.1 rfc3339-validator==0.1.4 rfc3986-validator==0.1.1 -rope==1.10.0 -rpds-py==0.10.4 +rope==1.11.0 +rpds-py==0.12.0 rsa==4.9 -ruff==0.0.292 +ruff==0.1.4 scipy==1.11.3 send2trash==1.8.2 six==1.16.0 @@ -193,7 +191,7 @@ sphinx-codeautolink==0.15.0 sphinx-comments==0.0.3 sphinx-copybutton==0.5.2 sphinx-design==0.5.0 -sphinx-thebe==0.2.1 +sphinx-thebe==0.3.0 sphinx-togglebutton==0.3.2 sphinxcontrib-applehelp==1.0.7 sphinxcontrib-devhelp==1.0.5 @@ -202,16 +200,16 @@ sphinxcontrib-jsmath==1.0.1 sphinxcontrib-qthelp==1.0.6 sphinxcontrib-serializinghtml==1.1.9 sphobjinv==2.3.1 -sqlalchemy==2.0.21 +sqlalchemy==2.0.23 stack-data==0.6.3 sympy==1.12 tabulate==0.9.0 tensorboard==2.14.1 -tensorboard-data-server==0.7.1 +tensorboard-data-server==0.7.2 tensorflow==2.14.0 tensorflow-estimator==2.14.0 tensorflow-io-gcs-filesystem==0.34.0 -tensorflow-probability==0.22.0 +tensorflow-probability==0.22.1 termcolor==2.3.0 terminado==0.17.1 tinycss2==1.2.1 @@ -219,25 +217,25 @@ tomli==2.0.1 tornado==6.3.3 tox==4.11.3 tqdm==4.66.1 -traitlets==5.11.2 +traitlets==5.13.0 types-docutils==0.20.0.3 types-pkg-resources==0.1.3 types-python-dateutil==2.8.19.14 types-pyyaml==6.0.12.12 -types-requests==2.31.0.8 +types-requests==2.31.0.10 types-setuptools==68.2.0.0 -typing-extensions==4.5.0 +typing-extensions==4.8.0 tzdata==2023.3 ujson==5.8.0 uri-template==1.3.0 -urllib3==2.0.6 -virtualenv==20.24.5 -wcwidth==0.2.8 +urllib3==2.0.7 +virtualenv==20.24.6 +wcwidth==0.2.9 webcolors==1.13 webencodings==0.5.1 websocket-client==1.6.4 -werkzeug==3.0.0 -wheel==0.41.2 +werkzeug==3.0.1 +wheel==0.41.3 widgetsnbextension==4.0.9 wrapt==1.14.1 zipp==3.17.0 diff --git a/.constraints/py3.11.txt b/.constraints/py3.11.txt index 3a2bf19f..54b76c8a 100644 --- a/.constraints/py3.11.txt +++ b/.constraints/py3.11.txt @@ -12,26 +12,25 @@ anyio==4.0.0 argon2-cffi==23.1.0 argon2-cffi-bindings==21.2.0 arrow==1.3.0 -asttokens==2.4.0 +asttokens==2.4.1 astunparse==1.6.3 async-lru==2.0.4 attrs==23.1.0 -babel==2.13.0 -backcall==0.2.0 +babel==2.13.1 beautifulsoup4==4.12.2 -black==23.9.1 +black==23.11.0 bleach==6.1.0 -cachetools==5.3.1 +cachetools==5.3.2 certifi==2023.7.22 cffi==1.16.0 cfgv==3.4.0 chardet==5.2.0 -charset-normalizer==3.3.0 +charset-normalizer==3.3.2 click==8.1.7 -cloudpickle==2.2.1 +cloudpickle==3.0.0 colorama==0.4.6 -comm==0.1.4 -contourpy==1.1.1 +comm==0.2.0 +contourpy==1.2.0 coverage==7.3.2 cycler==0.12.1 debugpy==1.8.0 @@ -40,145 +39,144 @@ defusedxml==0.7.1 deprecated==1.2.14 distlib==0.3.7 dm-tree==0.1.8 -docstring-to-markdown==0.12 +docstring-to-markdown==0.13 docutils==0.19 execnet==2.0.2 -executing==2.0.0 +executing==2.0.1 fastjsonschema==2.18.1 -filelock==3.12.4 +filelock==3.13.1 flatbuffers==23.5.26 -fonttools==4.43.1 +fonttools==4.44.0 fqdn==1.5.1 gast==0.5.4 -google-auth==2.23.2 +google-auth==2.23.4 google-auth-oauthlib==1.0.0 google-pasta==0.2.0 graphviz==0.20.1 -greenlet==3.0.0 -grpcio==1.59.0 +greenlet==3.0.1 +grpcio==1.59.2 h5py==3.10.0 hepunits==2.3.2 -identify==2.5.30 +identify==2.5.31 idna==3.4 imagesize==1.4.1 iminuit==2.24.0 importlib-metadata==6.8.0 iniconfig==2.0.0 -ipykernel==6.25.2 +ipykernel==6.26.0 ipympl==0.9.3 -ipython==8.16.1 +ipython==8.17.2 ipython-genutils==0.2.0 ipywidgets==8.1.1 isoduration==20.11.0 -jax==0.4.18 -jaxlib==0.4.18 +jax==0.4.20 +jaxlib==0.4.20 jedi==0.19.1 jinja2==3.1.2 json5==0.9.14 jsonpointer==2.4 -jsonschema==4.19.1 +jsonschema==4.19.2 jsonschema-specifications==2023.7.1 jupyter==1.0.0 jupyter-cache==0.6.1 -jupyter-client==8.3.1 +jupyter-client==8.6.0 jupyter-console==6.6.3 -jupyter-core==5.3.2 -jupyter-events==0.7.0 +jupyter-core==5.5.0 +jupyter-events==0.9.0 jupyter-lsp==2.2.0 -jupyter-server==2.7.3 +jupyter-server==2.10.0 jupyter-server-terminals==0.4.4 -jupyterlab==4.0.6 +jupyterlab==4.0.8 jupyterlab-code-formatter==2.2.1 jupyterlab-lsp==5.0.0 -jupyterlab-myst==2.0.2 +jupyterlab-myst==2.1.0 jupyterlab-pygments==0.2.2 -jupyterlab-server==2.25.0 +jupyterlab-server==2.25.1 jupyterlab-widgets==3.0.9 keras==2.14.0 kiwisolver==1.4.5 libclang==16.0.6 livereload==2.6.3 -llvmlite==0.41.0 -markdown==3.5 +llvmlite==0.41.1 +markdown==3.5.1 markdown-it-py==2.2.0 markupsafe==2.1.3 -matplotlib==3.8.0 +matplotlib==3.8.1 matplotlib-inline==0.1.6 mdit-py-plugins==0.3.5 mdurl==0.1.2 mistune==3.0.2 ml-dtypes==0.2.0 mpmath==1.3.0 -mypy==1.5.1 +mypy==1.6.1 mypy-extensions==1.0.0 myst-nb==0.17.2 myst-parser==0.18.1 nbclient==0.6.8 -nbconvert==7.9.2 +nbconvert==7.11.0 nbformat==5.9.2 -nbmake==1.4.5 +nbmake==1.4.6 nest-asyncio==1.5.8 nodeenv==1.8.0 -notebook==7.0.4 +notebook==7.0.6 notebook-shim==0.2.3 -numba==0.58.0 -numpy==1.25.2 +numba==0.58.1 +numpy==1.26.1 oauthlib==3.2.2 opt-einsum==3.3.0 overrides==7.4.0 packaging==23.2 -pandas==2.1.1 +pandas==2.1.2 pandocfilters==1.5.0 parso==0.8.3 particle==0.23.0 pathspec==0.11.2 pexpect==4.8.0 phasespace==1.9.0 -pickleshare==0.7.5 -pillow==10.0.1 +pillow==10.1.0 platformdirs==3.11.0 pluggy==1.3.0 -pre-commit==3.4.0 -prometheus-client==0.17.1 +pre-commit==3.5.0 +prometheus-client==0.18.0 prompt-toolkit==3.0.39 -protobuf==4.24.4 -psutil==5.9.5 +protobuf==4.25.0 +psutil==5.9.6 ptyprocess==0.7.0 pure-eval==0.2.2 py-cpuinfo==9.0.0 pyasn1==0.5.0 pyasn1-modules==0.3.0 pycparser==2.21 -pydata-sphinx-theme==0.14.1 +pydata-sphinx-theme==0.14.3 pygments==2.16.1 pyparsing==3.1.1 pyproject-api==1.6.1 -pytest==7.4.2 +pytest==7.4.3 pytest-benchmark==4.0.0 pytest-cov==4.1.0 -pytest-mock==3.11.1 +pytest-mock==3.12.0 pytest-xdist==3.3.1 python-constraint==1.4.0 python-dateutil==2.8.2 python-json-logger==2.0.7 python-lsp-jsonrpc==1.1.2 -python-lsp-server==1.8.2 -pytoolconfig==1.2.5 +python-lsp-server==1.9.0 +pytoolconfig==1.2.6 pytz==2023.3.post1 pyyaml==6.0.1 pyzmq==25.1.1 qrules==0.9.8 -qtconsole==5.4.4 -qtpy==2.4.0 +qtconsole==5.5.0 +qtpy==2.4.1 referencing==0.30.2 requests==2.31.0 requests-oauthlib==1.3.1 rfc3339-validator==0.1.4 rfc3986-validator==0.1.1 -rope==1.10.0 -rpds-py==0.10.4 +rope==1.11.0 +rpds-py==0.12.0 rsa==4.9 -ruff==0.0.292 +ruff==0.1.4 scipy==1.11.3 send2trash==1.8.2 six==1.16.0 @@ -192,7 +190,7 @@ sphinx-codeautolink==0.15.0 sphinx-comments==0.0.3 sphinx-copybutton==0.5.2 sphinx-design==0.5.0 -sphinx-thebe==0.2.1 +sphinx-thebe==0.3.0 sphinx-togglebutton==0.3.2 sphinxcontrib-applehelp==1.0.7 sphinxcontrib-devhelp==1.0.5 @@ -201,41 +199,41 @@ sphinxcontrib-jsmath==1.0.1 sphinxcontrib-qthelp==1.0.6 sphinxcontrib-serializinghtml==1.1.9 sphobjinv==2.3.1 -sqlalchemy==2.0.21 +sqlalchemy==2.0.23 stack-data==0.6.3 sympy==1.12 tabulate==0.9.0 tensorboard==2.14.1 -tensorboard-data-server==0.7.1 +tensorboard-data-server==0.7.2 tensorflow==2.14.0 tensorflow-estimator==2.14.0 tensorflow-io-gcs-filesystem==0.34.0 -tensorflow-probability==0.22.0 +tensorflow-probability==0.22.1 termcolor==2.3.0 terminado==0.17.1 tinycss2==1.2.1 tornado==6.3.3 tox==4.11.3 tqdm==4.66.1 -traitlets==5.11.2 +traitlets==5.13.0 types-docutils==0.20.0.3 types-pkg-resources==0.1.3 types-python-dateutil==2.8.19.14 types-pyyaml==6.0.12.12 -types-requests==2.31.0.8 +types-requests==2.31.0.10 types-setuptools==68.2.0.0 -typing-extensions==4.5.0 +typing-extensions==4.8.0 tzdata==2023.3 ujson==5.8.0 uri-template==1.3.0 -urllib3==2.0.6 -virtualenv==20.24.5 -wcwidth==0.2.8 +urllib3==2.0.7 +virtualenv==20.24.6 +wcwidth==0.2.9 webcolors==1.13 webencodings==0.5.1 websocket-client==1.6.4 -werkzeug==3.0.0 -wheel==0.41.2 +werkzeug==3.0.1 +wheel==0.41.3 widgetsnbextension==4.0.9 wrapt==1.14.1 zipp==3.17.0 diff --git a/.constraints/py3.8.txt b/.constraints/py3.8.txt index d32df9c2..034c7640 100644 --- a/.constraints/py3.8.txt +++ b/.constraints/py3.8.txt @@ -12,25 +12,25 @@ anyio==4.0.0 argon2-cffi==23.1.0 argon2-cffi-bindings==21.2.0 arrow==1.3.0 -asttokens==2.4.0 +asttokens==2.4.1 astunparse==1.6.3 async-lru==2.0.4 attrs==23.1.0 -babel==2.13.0 +babel==2.13.1 backcall==0.2.0 beautifulsoup4==4.12.2 -black==23.9.1 +black==23.11.0 bleach==6.1.0 -cachetools==5.3.1 +cachetools==5.3.2 certifi==2023.7.22 cffi==1.16.0 cfgv==3.4.0 chardet==5.2.0 -charset-normalizer==3.3.0 +charset-normalizer==3.3.2 click==8.1.7 -cloudpickle==2.2.1 +cloudpickle==3.0.0 colorama==0.4.6 -comm==0.1.4 +comm==0.2.0 contourpy==1.1.1 coverage==7.3.2 cycler==0.12.1 @@ -40,33 +40,33 @@ defusedxml==0.7.1 deprecated==1.2.14 distlib==0.3.7 dm-tree==0.1.8 -docstring-to-markdown==0.12 +docstring-to-markdown==0.13 docutils==0.19 exceptiongroup==1.1.3 execnet==2.0.2 -executing==2.0.0 +executing==2.0.1 fastjsonschema==2.18.1 -filelock==3.12.4 +filelock==3.13.1 flatbuffers==23.5.26 -fonttools==4.43.1 +fonttools==4.44.0 fqdn==1.5.1 gast==0.4.0 -google-auth==2.23.2 +google-auth==2.23.4 google-auth-oauthlib==1.0.0 google-pasta==0.2.0 graphviz==0.20.1 -greenlet==3.0.0 -grpcio==1.59.0 +greenlet==3.0.1 +grpcio==1.59.2 h5py==3.10.0 hepunits==2.3.2 -identify==2.5.30 +identify==2.5.31 idna==3.4 imagesize==1.4.1 iminuit==2.24.0 importlib-metadata==6.8.0 -importlib-resources==6.1.0 +importlib-resources==6.1.1 iniconfig==2.0.0 -ipykernel==6.25.2 +ipykernel==6.26.0 ipympl==0.9.3 ipython==8.12.3 ipython-genutils==0.2.0 @@ -78,30 +78,30 @@ jedi==0.19.1 jinja2==3.1.2 json5==0.9.14 jsonpointer==2.4 -jsonschema==4.19.1 +jsonschema==4.19.2 jsonschema-specifications==2023.7.1 jupyter==1.0.0 jupyter-cache==0.6.1 -jupyter-client==8.3.1 +jupyter-client==8.6.0 jupyter-console==6.6.3 -jupyter-core==5.3.2 -jupyter-events==0.7.0 +jupyter-core==5.5.0 +jupyter-events==0.9.0 jupyter-lsp==2.2.0 -jupyter-server==2.7.3 +jupyter-server==2.10.0 jupyter-server-terminals==0.4.4 -jupyterlab==4.0.6 +jupyterlab==4.0.8 jupyterlab-code-formatter==2.2.1 jupyterlab-lsp==5.0.0 -jupyterlab-myst==2.0.2 +jupyterlab-myst==2.1.0 jupyterlab-pygments==0.2.2 -jupyterlab-server==2.25.0 +jupyterlab-server==2.25.1 jupyterlab-widgets==3.0.9 keras==2.13.1 kiwisolver==1.4.5 libclang==16.0.6 livereload==2.6.3 -llvmlite==0.41.0 -markdown==3.5 +llvmlite==0.41.1 +markdown==3.5.1 markdown-it-py==2.2.0 markupsafe==2.1.3 matplotlib==3.7.3 @@ -111,19 +111,19 @@ mdurl==0.1.2 mistune==3.0.2 ml-dtypes==0.2.0 mpmath==1.3.0 -mypy==1.5.1 +mypy==1.6.1 mypy-extensions==1.0.0 myst-nb==0.17.2 myst-parser==0.18.1 nbclient==0.6.8 -nbconvert==7.9.2 +nbconvert==7.11.0 nbformat==5.9.2 -nbmake==1.4.5 +nbmake==1.4.6 nest-asyncio==1.5.8 nodeenv==1.8.0 -notebook==7.0.4 +notebook==7.0.6 notebook-shim==0.2.3 -numba==0.58.0 +numba==0.58.1 numpy==1.24.3 oauthlib==3.2.2 opt-einsum==3.3.0 @@ -137,51 +137,51 @@ pathspec==0.11.2 pexpect==4.8.0 phasespace==1.9.0 pickleshare==0.7.5 -pillow==10.0.1 +pillow==10.1.0 pkgutil-resolve-name==1.3.10 platformdirs==3.11.0 pluggy==1.3.0 -pre-commit==3.4.0 -prometheus-client==0.17.1 +pre-commit==3.5.0 +prometheus-client==0.18.0 prompt-toolkit==3.0.39 -protobuf==4.24.4 -psutil==5.9.5 +protobuf==4.25.0 +psutil==5.9.6 ptyprocess==0.7.0 pure-eval==0.2.2 py-cpuinfo==9.0.0 pyasn1==0.5.0 pyasn1-modules==0.3.0 pycparser==2.21 -pydata-sphinx-theme==0.14.1 +pydata-sphinx-theme==0.14.3 pygments==2.16.1 pyparsing==3.1.1 pyproject-api==1.6.1 -pytest==7.4.2 +pytest==7.4.3 pytest-benchmark==4.0.0 pytest-cov==4.1.0 -pytest-mock==3.11.1 +pytest-mock==3.12.0 pytest-xdist==3.3.1 python-constraint==1.4.0 python-dateutil==2.8.2 python-json-logger==2.0.7 python-lsp-jsonrpc==1.1.2 -python-lsp-server==1.8.2 -pytoolconfig==1.2.5 +python-lsp-server==1.9.0 +pytoolconfig==1.2.6 pytz==2023.3.post1 pyyaml==6.0.1 pyzmq==25.1.1 qrules==0.9.8 -qtconsole==5.4.4 -qtpy==2.4.0 +qtconsole==5.5.0 +qtpy==2.4.1 referencing==0.30.2 requests==2.31.0 requests-oauthlib==1.3.1 rfc3339-validator==0.1.4 rfc3986-validator==0.1.1 -rope==1.10.0 -rpds-py==0.10.4 +rope==1.11.0 +rpds-py==0.12.0 rsa==4.9 -ruff==0.0.292 +ruff==0.1.4 scipy==1.10.1 send2trash==1.8.2 six==1.16.0 @@ -195,7 +195,7 @@ sphinx-codeautolink==0.15.0 sphinx-comments==0.0.3 sphinx-copybutton==0.5.2 sphinx-design==0.5.0 -sphinx-thebe==0.2.1 +sphinx-thebe==0.3.0 sphinx-togglebutton==0.3.2 sphinxcontrib-applehelp==1.0.4 sphinxcontrib-devhelp==1.0.2 @@ -204,12 +204,12 @@ sphinxcontrib-jsmath==1.0.1 sphinxcontrib-qthelp==1.0.3 sphinxcontrib-serializinghtml==1.1.5 sphobjinv==2.3.1 -sqlalchemy==2.0.21 +sqlalchemy==2.0.23 stack-data==0.6.3 sympy==1.12 tabulate==0.9.0 tensorboard==2.13.0 -tensorboard-data-server==0.7.1 +tensorboard-data-server==0.7.2 tensorflow==2.13.1 tensorflow-estimator==2.13.0 tensorflow-io-gcs-filesystem==0.34.0 @@ -221,25 +221,25 @@ tomli==2.0.1 tornado==6.3.3 tox==4.11.3 tqdm==4.66.1 -traitlets==5.11.2 +traitlets==5.13.0 types-docutils==0.20.0.3 types-pkg-resources==0.1.3 types-python-dateutil==2.8.19.14 types-pyyaml==6.0.12.12 -types-requests==2.31.0.8 +types-requests==2.31.0.10 types-setuptools==68.2.0.0 typing-extensions==4.5.0 tzdata==2023.3 ujson==5.8.0 uri-template==1.3.0 -urllib3==2.0.6 -virtualenv==20.24.5 -wcwidth==0.2.8 +urllib3==2.0.7 +virtualenv==20.24.6 +wcwidth==0.2.9 webcolors==1.13 webencodings==0.5.1 websocket-client==1.6.4 -werkzeug==3.0.0 -wheel==0.41.2 +werkzeug==3.0.1 +wheel==0.41.3 widgetsnbextension==4.0.9 wrapt==1.15.0 zipp==3.17.0 diff --git a/.constraints/py3.9.txt b/.constraints/py3.9.txt index 0938615b..fd177994 100644 --- a/.constraints/py3.9.txt +++ b/.constraints/py3.9.txt @@ -12,26 +12,25 @@ anyio==4.0.0 argon2-cffi==23.1.0 argon2-cffi-bindings==21.2.0 arrow==1.3.0 -asttokens==2.4.0 +asttokens==2.4.1 astunparse==1.6.3 async-lru==2.0.4 attrs==23.1.0 -babel==2.13.0 -backcall==0.2.0 +babel==2.13.1 beautifulsoup4==4.12.2 -black==23.9.1 +black==23.11.0 bleach==6.1.0 -cachetools==5.3.1 +cachetools==5.3.2 certifi==2023.7.22 cffi==1.16.0 cfgv==3.4.0 chardet==5.2.0 -charset-normalizer==3.3.0 +charset-normalizer==3.3.2 click==8.1.7 -cloudpickle==2.2.1 +cloudpickle==3.0.0 colorama==0.4.6 -comm==0.1.4 -contourpy==1.1.1 +comm==0.2.0 +contourpy==1.2.0 coverage==7.3.2 cycler==0.12.1 debugpy==1.8.0 @@ -40,147 +39,146 @@ defusedxml==0.7.1 deprecated==1.2.14 distlib==0.3.7 dm-tree==0.1.8 -docstring-to-markdown==0.12 +docstring-to-markdown==0.13 docutils==0.19 exceptiongroup==1.1.3 execnet==2.0.2 -executing==2.0.0 +executing==2.0.1 fastjsonschema==2.18.1 -filelock==3.12.4 +filelock==3.13.1 flatbuffers==23.5.26 -fonttools==4.43.1 +fonttools==4.44.0 fqdn==1.5.1 gast==0.5.4 -google-auth==2.23.2 +google-auth==2.23.4 google-auth-oauthlib==1.0.0 google-pasta==0.2.0 graphviz==0.20.1 -greenlet==3.0.0 -grpcio==1.59.0 +greenlet==3.0.1 +grpcio==1.59.2 h5py==3.10.0 hepunits==2.3.2 -identify==2.5.30 +identify==2.5.31 idna==3.4 imagesize==1.4.1 iminuit==2.24.0 importlib-metadata==6.8.0 -importlib-resources==6.1.0 +importlib-resources==6.1.1 iniconfig==2.0.0 -ipykernel==6.25.2 +ipykernel==6.26.0 ipympl==0.9.3 -ipython==8.16.1 +ipython==8.17.2 ipython-genutils==0.2.0 ipywidgets==8.1.1 isoduration==20.11.0 -jax==0.4.18 -jaxlib==0.4.18 +jax==0.4.20 +jaxlib==0.4.20 jedi==0.19.1 jinja2==3.1.2 json5==0.9.14 jsonpointer==2.4 -jsonschema==4.19.1 +jsonschema==4.19.2 jsonschema-specifications==2023.7.1 jupyter==1.0.0 jupyter-cache==0.6.1 -jupyter-client==8.3.1 +jupyter-client==8.6.0 jupyter-console==6.6.3 -jupyter-core==5.3.2 -jupyter-events==0.7.0 +jupyter-core==5.5.0 +jupyter-events==0.9.0 jupyter-lsp==2.2.0 -jupyter-server==2.7.3 +jupyter-server==2.10.0 jupyter-server-terminals==0.4.4 -jupyterlab==4.0.6 +jupyterlab==4.0.8 jupyterlab-code-formatter==2.2.1 jupyterlab-lsp==5.0.0 -jupyterlab-myst==2.0.2 +jupyterlab-myst==2.1.0 jupyterlab-pygments==0.2.2 -jupyterlab-server==2.25.0 +jupyterlab-server==2.25.1 jupyterlab-widgets==3.0.9 keras==2.14.0 kiwisolver==1.4.5 libclang==16.0.6 livereload==2.6.3 -llvmlite==0.41.0 -markdown==3.5 +llvmlite==0.41.1 +markdown==3.5.1 markdown-it-py==2.2.0 markupsafe==2.1.3 -matplotlib==3.8.0 +matplotlib==3.8.1 matplotlib-inline==0.1.6 mdit-py-plugins==0.3.5 mdurl==0.1.2 mistune==3.0.2 ml-dtypes==0.2.0 mpmath==1.3.0 -mypy==1.5.1 +mypy==1.6.1 mypy-extensions==1.0.0 myst-nb==0.17.2 myst-parser==0.18.1 nbclient==0.6.8 -nbconvert==7.9.2 +nbconvert==7.11.0 nbformat==5.9.2 -nbmake==1.4.5 +nbmake==1.4.6 nest-asyncio==1.5.8 nodeenv==1.8.0 -notebook==7.0.4 +notebook==7.0.6 notebook-shim==0.2.3 -numba==0.58.0 -numpy==1.25.2 +numba==0.58.1 +numpy==1.26.1 oauthlib==3.2.2 opt-einsum==3.3.0 overrides==7.4.0 packaging==23.2 -pandas==2.1.1 +pandas==2.1.2 pandocfilters==1.5.0 parso==0.8.3 particle==0.23.0 pathspec==0.11.2 pexpect==4.8.0 phasespace==1.9.0 -pickleshare==0.7.5 -pillow==10.0.1 +pillow==10.1.0 platformdirs==3.11.0 pluggy==1.3.0 -pre-commit==3.4.0 -prometheus-client==0.17.1 +pre-commit==3.5.0 +prometheus-client==0.18.0 prompt-toolkit==3.0.39 -protobuf==4.24.4 -psutil==5.9.5 +protobuf==4.25.0 +psutil==5.9.6 ptyprocess==0.7.0 pure-eval==0.2.2 py-cpuinfo==9.0.0 pyasn1==0.5.0 pyasn1-modules==0.3.0 pycparser==2.21 -pydata-sphinx-theme==0.14.1 +pydata-sphinx-theme==0.14.3 pygments==2.16.1 pyparsing==3.1.1 pyproject-api==1.6.1 -pytest==7.4.2 +pytest==7.4.3 pytest-benchmark==4.0.0 pytest-cov==4.1.0 -pytest-mock==3.11.1 +pytest-mock==3.12.0 pytest-xdist==3.3.1 python-constraint==1.4.0 python-dateutil==2.8.2 python-json-logger==2.0.7 python-lsp-jsonrpc==1.1.2 -python-lsp-server==1.8.2 -pytoolconfig==1.2.5 +python-lsp-server==1.9.0 +pytoolconfig==1.2.6 pytz==2023.3.post1 pyyaml==6.0.1 pyzmq==25.1.1 qrules==0.9.8 -qtconsole==5.4.4 -qtpy==2.4.0 +qtconsole==5.5.0 +qtpy==2.4.1 referencing==0.30.2 requests==2.31.0 requests-oauthlib==1.3.1 rfc3339-validator==0.1.4 rfc3986-validator==0.1.1 -rope==1.10.0 -rpds-py==0.10.4 +rope==1.11.0 +rpds-py==0.12.0 rsa==4.9 -ruff==0.0.292 +ruff==0.1.4 scipy==1.11.3 send2trash==1.8.2 six==1.16.0 @@ -194,7 +192,7 @@ sphinx-codeautolink==0.15.0 sphinx-comments==0.0.3 sphinx-copybutton==0.5.2 sphinx-design==0.5.0 -sphinx-thebe==0.2.1 +sphinx-thebe==0.3.0 sphinx-togglebutton==0.3.2 sphinxcontrib-applehelp==1.0.7 sphinxcontrib-devhelp==1.0.5 @@ -203,16 +201,16 @@ sphinxcontrib-jsmath==1.0.1 sphinxcontrib-qthelp==1.0.6 sphinxcontrib-serializinghtml==1.1.9 sphobjinv==2.3.1 -sqlalchemy==2.0.21 +sqlalchemy==2.0.23 stack-data==0.6.3 sympy==1.12 tabulate==0.9.0 tensorboard==2.14.1 -tensorboard-data-server==0.7.1 +tensorboard-data-server==0.7.2 tensorflow==2.14.0 tensorflow-estimator==2.14.0 tensorflow-io-gcs-filesystem==0.34.0 -tensorflow-probability==0.22.0 +tensorflow-probability==0.22.1 termcolor==2.3.0 terminado==0.17.1 tinycss2==1.2.1 @@ -220,25 +218,25 @@ tomli==2.0.1 tornado==6.3.3 tox==4.11.3 tqdm==4.66.1 -traitlets==5.11.2 +traitlets==5.13.0 types-docutils==0.20.0.3 types-pkg-resources==0.1.3 types-python-dateutil==2.8.19.14 types-pyyaml==6.0.12.12 -types-requests==2.31.0.8 +types-requests==2.31.0.10 types-setuptools==68.2.0.0 -typing-extensions==4.5.0 +typing-extensions==4.8.0 tzdata==2023.3 ujson==5.8.0 uri-template==1.3.0 -urllib3==2.0.6 -virtualenv==20.24.5 -wcwidth==0.2.8 +urllib3==2.0.7 +virtualenv==20.24.6 +wcwidth==0.2.9 webcolors==1.13 webencodings==0.5.1 websocket-client==1.6.4 -werkzeug==3.0.0 -wheel==0.41.2 +werkzeug==3.0.1 +wheel==0.41.3 widgetsnbextension==4.0.9 wrapt==1.14.1 zipp==3.17.0 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 4d0d3e5a..1dc96a2c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -41,7 +41,7 @@ repos: - id: trailing-whitespace - repo: https://github.com/ComPWA/repo-maintenance - rev: 0.1.0 + rev: 0.1.1 hooks: - id: check-dev-files args: @@ -69,8 +69,8 @@ repos: args: - --fix - - repo: https://github.com/psf/black - rev: 23.9.1 + - repo: https://github.com/psf/black-pre-commit-mirror + rev: 23.11.0 hooks: - id: black - id: black-jupyter @@ -83,7 +83,7 @@ repos: - id: blacken-docs - repo: https://github.com/python-jsonschema/check-jsonschema - rev: 0.27.0 + rev: 0.27.1 hooks: - id: check-jsonschema name: Check CITATION.cff @@ -96,12 +96,12 @@ repos: pass_filenames: false - repo: https://github.com/streetsidesoftware/cspell-cli - rev: v7.3.1 + rev: v8.0.0 hooks: - id: cspell - repo: https://github.com/editorconfig-checker/editorconfig-checker.python - rev: 2.7.2 + rev: 2.7.3 hooks: - id: editorconfig-checker name: editorconfig @@ -152,7 +152,7 @@ repos: - id: prettier - repo: https://github.com/ComPWA/mirrors-pyright - rev: v1.1.330 + rev: v1.1.334 hooks: - id: pyright @@ -164,7 +164,7 @@ repos: - --py38-plus - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.0.292 + rev: v0.1.4 hooks: - id: ruff args: diff --git a/benchmarks/ampform.py b/benchmarks/ampform.py index ad7662f9..54f76c16 100644 --- a/benchmarks/ampform.py +++ b/benchmarks/ampform.py @@ -196,9 +196,7 @@ def test_fit(self, backend, benchmark, model, size): def print_data_sample(data: DataSample, sample_size: int) -> None: """Print a `.DataSample`, so it can be pasted into the expected sample.""" print() # noqa: T201 - pprint( # noqa: T203 - { - i: np.round(four_momenta[:sample_size], decimals=11).tolist() - for i, four_momenta in data.items() - } - ) + pprint({ # noqa: T203 + i: np.round(four_momenta[:sample_size], decimals=11).tolist() + for i, four_momenta in data.items() + }) diff --git a/benchmarks/expression.py b/benchmarks/expression.py index be6532eb..c524b390 100644 --- a/benchmarks/expression.py +++ b/benchmarks/expression.py @@ -114,7 +114,7 @@ def test_data(backend, benchmark, size): def test_fit( backend: str, benchmark, - optimizer_type: (type[Minuit2] | type[ScipyMinimizer]), + optimizer_type: type[Minuit2] | type[ScipyMinimizer], size: int, ): domain, data = generate_data_and_domain(backend, n_data=size, n_domain=10 * size) diff --git a/docs/_relink_references.py b/docs/_relink_references.py index 4155d269..876b02a3 100644 --- a/docs/_relink_references.py +++ b/docs/_relink_references.py @@ -5,6 +5,7 @@ See also https://github.com/sphinx-doc/sphinx/issues/5868. """ + # pyright: reportMissingImports=false from __future__ import annotations diff --git a/docs/amplitude-analysis.ipynb b/docs/amplitude-analysis.ipynb index 7e2f82dc..f1fdf6ea 100644 --- a/docs/amplitude-analysis.ipynb +++ b/docs/amplitude-analysis.ipynb @@ -456,13 +456,11 @@ "import numpy as np\n", "import pandas as pd\n", "\n", - "pd.DataFrame(\n", - " {\n", - " (k, label): np.transpose(v)[i]\n", - " for k, v in phsp_momenta.items()\n", - " for i, label in enumerate([\"E\", \"px\", \"py\", \"pz\"])\n", - " }\n", - ")" + "pd.DataFrame({\n", + " (k, label): np.transpose(v)[i]\n", + " for k, v in phsp_momenta.items()\n", + " for i, label in enumerate([\"E\", \"px\", \"py\", \"pz\"])\n", + "})" ] }, { @@ -628,13 +626,11 @@ " domain_transformer=helicity_transformer,\n", ")\n", "data_momenta = data_generator.generate(10_000, rng)\n", - "pd.DataFrame(\n", - " {\n", - " (k, label): np.transpose(v)[i]\n", - " for k, v in data_momenta.items()\n", - " for i, label in enumerate([\"E\", \"px\", \"py\", \"pz\"])\n", - " }\n", - ")" + "pd.DataFrame({\n", + " (k, label): np.transpose(v)[i]\n", + " for k, v in data_momenta.items()\n", + " for i, label in enumerate([\"E\", \"px\", \"py\", \"pz\"])\n", + "})" ] }, { diff --git a/docs/conf.py b/docs/conf.py index fbcb2f64..e27f7d58 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -67,18 +67,16 @@ def fetch_logo(url: str, output_path: str) -> None: relink_references() shutil.rmtree("api", ignore_errors=True) subprocess.call( - " ".join( - [ - "sphinx-apidoc", - f"../src/{PACKAGE}/", - f"../src/{PACKAGE}/version.py", - "-o api/", - "--force", - "--no-toc", - "--templatedir _templates", - "--separate", - ] - ), + " ".join([ + "sphinx-apidoc", + f"../src/{PACKAGE}/", + f"../src/{PACKAGE}/version.py", + "-o api/", + "--force", + "--no-toc", + "--templatedir _templates", + "--separate", + ]), shell=True, # noqa: S602 ) diff --git a/docs/usage.ipynb b/docs/usage.ipynb index 8defa17a..3b73195a 100644 --- a/docs/usage.ipynb +++ b/docs/usage.ipynb @@ -804,9 +804,9 @@ ")\n", "def plot(dphi, k_r, k_phi, sigma):\n", " global color_mesh, X, Y\n", - " polar_function.update_parameters(\n", - " {R\"\\Delta\\phi\": dphi, \"k_r\": k_r, \"k_phi\": k_phi, \"sigma\": sigma}\n", - " )\n", + " polar_function.update_parameters({\n", + " R\"\\Delta\\phi\": dphi, \"k_r\": k_r, \"k_phi\": k_phi, \"sigma\": sigma\n", + " })\n", " Z = polar_function(polar_domain)\n", " if color_mesh is not None:\n", " color_mesh.remove()\n", diff --git a/docs/usage/basics.ipynb b/docs/usage/basics.ipynb index ac3fcd0c..bff3e467 100644 --- a/docs/usage/basics.ipynb +++ b/docs/usage/basics.ipynb @@ -740,13 +740,11 @@ "outputs": [], "source": [ "minuit2 = Minuit2(\n", - " callback=CallbackList(\n", - " [\n", - " CSVSummary(\"traceback-1D.csv\"),\n", - " YAMLSummary(\"fit-result-1D.yaml\"),\n", - " TFSummary(),\n", - " ]\n", - " )\n", + " callback=CallbackList([\n", + " CSVSummary(\"traceback-1D.csv\"),\n", + " YAMLSummary(\"fit-result-1D.yaml\"),\n", + " TFSummary(),\n", + " ])\n", ")\n", "fit_result = minuit2.optimize(estimator, initial_parameters)\n", "fit_result" diff --git a/docs/usage/unbinned-fit.ipynb b/docs/usage/unbinned-fit.ipynb index 9add79ef..de747b1f 100644 --- a/docs/usage/unbinned-fit.ipynb +++ b/docs/usage/unbinned-fit.ipynb @@ -186,9 +186,7 @@ "\n", "\n", "def gaussian(x, mu, sigma):\n", - " return sp.exp(-((x - mu) ** 2) / (2 * sigma**2)) / sp.sqrt(\n", - " 2 * sp.pi * sigma**2\n", - " )\n", + " return sp.exp(-((x - mu) ** 2) / (2 * sigma**2)) / sp.sqrt(2 * sp.pi * sigma**2)\n", "\n", "\n", "x, y, mu, sigma_x, sigma_y = sp.symbols(\"x y mu sigma_x sigma_y\")\n", diff --git a/src/tensorwaves/data/__init__.py b/src/tensorwaves/data/__init__.py index 5381e730..8be4e7d5 100644 --- a/src/tensorwaves/data/__init__.py +++ b/src/tensorwaves/data/__init__.py @@ -1,4 +1,5 @@ """The `.data` module takes care of data generation.""" + from __future__ import annotations import logging diff --git a/src/tensorwaves/data/_data_sample.py b/src/tensorwaves/data/_data_sample.py index b8fcd871..d524e7fa 100644 --- a/src/tensorwaves/data/_data_sample.py +++ b/src/tensorwaves/data/_data_sample.py @@ -1,4 +1,5 @@ """Helper functions for modifying `.DataSample` instances.""" + from __future__ import annotations from typing import TYPE_CHECKING, Any, Callable diff --git a/src/tensorwaves/data/phasespace.py b/src/tensorwaves/data/phasespace.py index 863ae1b7..09d4fc87 100644 --- a/src/tensorwaves/data/phasespace.py +++ b/src/tensorwaves/data/phasespace.py @@ -1,4 +1,5 @@ """Implementations of a `.DataGenerator` for four-momentum samples.""" + from __future__ import annotations import logging diff --git a/src/tensorwaves/data/rng.py b/src/tensorwaves/data/rng.py index c429442b..9ff2c546 100644 --- a/src/tensorwaves/data/rng.py +++ b/src/tensorwaves/data/rng.py @@ -1,4 +1,5 @@ """Implementations of `.RealNumberGenerator`.""" + from __future__ import annotations from typing import TYPE_CHECKING, Optional, Union diff --git a/src/tensorwaves/data/transform.py b/src/tensorwaves/data/transform.py index 44da1f80..2fea0154 100644 --- a/src/tensorwaves/data/transform.py +++ b/src/tensorwaves/data/transform.py @@ -1,4 +1,5 @@ """Implementations of `.DataTransformer`.""" + from __future__ import annotations from typing import TYPE_CHECKING, Mapping diff --git a/src/tensorwaves/estimator.py b/src/tensorwaves/estimator.py index 44b618ce..d3ac9816 100644 --- a/src/tensorwaves/estimator.py +++ b/src/tensorwaves/estimator.py @@ -2,6 +2,7 @@ All estimators have to implement the `.Estimator` interface. """ + from __future__ import annotations from typing import TYPE_CHECKING, Callable, Iterable, Mapping @@ -78,12 +79,10 @@ def gradient_creator( if backend == "jax": try: import jax - from jax.config import config except ImportError: # pragma: no cover raise_missing_module_error("jax", extras_require="jax") - config.update("jax_enable_x64", True) - + jax.config.update("jax_enable_x64", True) return jax.grad(function) def raise_gradient_not_implemented( diff --git a/src/tensorwaves/function/__init__.py b/src/tensorwaves/function/__init__.py index da288da1..39263092 100644 --- a/src/tensorwaves/function/__init__.py +++ b/src/tensorwaves/function/__init__.py @@ -1,4 +1,5 @@ """Express mathematical expressions in terms of computational functions.""" + from __future__ import annotations import inspect diff --git a/src/tensorwaves/function/_backend.py b/src/tensorwaves/function/_backend.py index d7859bcb..a9a9e96a 100644 --- a/src/tensorwaves/function/_backend.py +++ b/src/tensorwaves/function/_backend.py @@ -1,4 +1,5 @@ """Computational back-end handling.""" + from __future__ import annotations from functools import partial @@ -31,13 +32,12 @@ def get_backend_modules(backend: str | tuple | dict) -> str | tuple | dict: if isinstance(backend, str): if backend == "jax": try: - from jax import numpy as jnp - from jax import scipy as jsp - from jax.config import config + import jax + import jax.numpy as jnp + import jax.scipy as jsp except ImportError: # pragma: no cover raise_missing_module_error("jax", extras_require="jax") - - config.update("jax_enable_x64", True) + jax.config.update("jax_enable_x64", True) return (jnp, jsp.special) if backend in {"numpy", "numba"}: import numpy as np diff --git a/src/tensorwaves/function/sympy/__init__.py b/src/tensorwaves/function/sympy/__init__.py index f63ab6f2..6b1a8c01 100644 --- a/src/tensorwaves/function/sympy/__init__.py +++ b/src/tensorwaves/function/sympy/__init__.py @@ -1,4 +1,5 @@ """Lambdify `sympy` expression trees to a `.Function`.""" + from __future__ import annotations import logging diff --git a/src/tensorwaves/function/sympy/_printer.py b/src/tensorwaves/function/sympy/_printer.py index 3c8d8c2c..228abe70 100644 --- a/src/tensorwaves/function/sympy/_printer.py +++ b/src/tensorwaves/function/sympy/_printer.py @@ -58,24 +58,22 @@ def _get_numpy_code(self: _T, expr: sp.Expr, *args: Any) -> str: return decorator -@_forward_to_numpy_printer( - [ - "ArrayAxisSum", - "ArrayMultiplication", - "BoostZ", - "BoostZMatrix", - "RotationY", - "RotationYMatrix", - "RotationZ", - "RotationZMatrix", - "_ArraySize", - "_BoostZMatrixImplementation", - "_OnesArray", - "_RotationYMatrixImplementation", - "_RotationZMatrixImplementation", - "_ZerosArray", - ] -) +@_forward_to_numpy_printer([ + "ArrayAxisSum", + "ArrayMultiplication", + "BoostZ", + "BoostZMatrix", + "RotationY", + "RotationYMatrix", + "RotationZ", + "RotationZMatrix", + "_ArraySize", + "_BoostZMatrixImplementation", + "_OnesArray", + "_RotationYMatrixImplementation", + "_RotationZMatrixImplementation", + "_ZerosArray", +]) class TensorflowPrinter(CustomNumPyPrinter): module_imports = {"tensorflow.experimental": {"numpy as tnp"}} _module = "tnp" diff --git a/src/tensorwaves/interface.py b/src/tensorwaves/interface.py index 5d0bb548..0ea1345d 100644 --- a/src/tensorwaves/interface.py +++ b/src/tensorwaves/interface.py @@ -1,4 +1,5 @@ """Defines top-level interface of tensorwaves.""" + from __future__ import annotations from abc import ABC, abstractmethod @@ -140,7 +141,7 @@ def _repr_pretty_(self, p: PrettyPrinter, cycle: bool) -> None: p.text(f"{class_name}(...)") else: with p.group(indent=1, open=f"{class_name}("): - for attribute in attrs.fields(type(self)): + for attribute in attrs.fields(type(self)): # type: ignore[misc] if attribute.name in {"specifics"}: continue value = getattr(self, attribute.name) diff --git a/src/tensorwaves/optimizer/callbacks.py b/src/tensorwaves/optimizer/callbacks.py index a212fafb..277dcd4b 100644 --- a/src/tensorwaves/optimizer/callbacks.py +++ b/src/tensorwaves/optimizer/callbacks.py @@ -1,4 +1,5 @@ """Collection of loggers that can be inserted into an optimizer as callback.""" + from __future__ import annotations import csv diff --git a/tests/data/test_phasespace.py b/tests/data/test_phasespace.py index 3027e496..c4c67f49 100644 --- a/tests/data/test_phasespace.py +++ b/tests/data/test_phasespace.py @@ -153,12 +153,10 @@ def test_generate_deterministic(self, pdg: "ParticleCollection"): weights = phsp_momenta.get("weights", []) # type: ignore[var-annotated] del phsp_momenta["weights"] print("Expected values, get by running pytest with the -s flag") # noqa: T201 - pprint( # noqa: T203 - { - i: np.round(four_momenta, decimals=10).tolist() - for i, four_momenta in phsp_momenta.items() - } - ) + pprint({ # noqa: T203 + i: np.round(four_momenta, decimals=10).tolist() + for i, four_momenta in phsp_momenta.items() + }) expected_sample = { "p0": [ [0.7059154068, 0.3572095625, 0.251997269, 0.2441281612], diff --git a/tests/optimizer/test_fit_simple_model.py b/tests/optimizer/test_fit_simple_model.py index d724e304..89a9a5f8 100644 --- a/tests/optimizer/test_fit_simple_model.py +++ b/tests/optimizer/test_fit_simple_model.py @@ -116,7 +116,7 @@ def test_optimize_all_parameters( backend: str, domain_and_data_sample: tuple[DataSample, DataSample], expression_and_parameters: tuple[sp.Expr, dict[sp.Symbol, float]], - optimizer_type: (type[Minuit2] | type[ScipyMinimizer]), + optimizer_type: type[Minuit2] | type[ScipyMinimizer], output_dir: Path, ): domain, data = domain_and_data_sample diff --git a/tests/optimizer/test_minuit.py b/tests/optimizer/test_minuit.py index d568b64a..980b97d9 100644 --- a/tests/optimizer/test_minuit.py +++ b/tests/optimizer/test_minuit.py @@ -72,16 +72,12 @@ def test_mock_callback(self, mocker: MockerFixture) -> None: {"x": 2.5}, # 2 (x - 1) - 3 == 0 -> x = 3/2 + 1 ), ( - Polynomial1DMinimaEstimator( - lambda x: x**3 + (x - 1) ** 2 - 3 * x + 1 - ), + Polynomial1DMinimaEstimator(lambda x: x**3 + (x - 1) ** 2 - 3 * x + 1), {"x": -1.0}, {"x": 1.0}, ), ( - Polynomial1DMinimaEstimator( - lambda x: x**3 + (x - 1) ** 2 - 3 * x + 1 - ), + Polynomial1DMinimaEstimator(lambda x: x**3 + (x - 1) ** 2 - 3 * x + 1), {"x": -2.0}, None, # no convergence ),