Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Oct 24, 2024
1 parent 4706ea2 commit e62ffdb
Show file tree
Hide file tree
Showing 8 changed files with 52 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lock.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:
- epic/*
paths:
- .pre-commit-config.yaml
- "**/Manifest.toml"
- Manifest.toml
- pixi.lock
- uv.lock
workflow_dispatch:
Expand Down
20 changes: 19 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,26 @@ uv sync
source .venv/bin/activate
```

Formatting and linting checks are automatically performed when committing changes. This is done with [pre-commit](https://pre-commit.com). To install the hooks in your local repository, run [`pre-commit install`](https://pre-commit.com/#3-install-the-git-hook-scripts) **once**:
Formatting and linting checks are automatically performed when committing changes. This is done with [pre-commit](https://pre-commit.com). To install the hooks in your local repository, run install `pre-commit` with `uv`:

```shell
uv tool install pre-commit --with pre-commit-uv --force-reinstall
```

and [`pre-commit install`](https://pre-commit.com/#3-install-the-git-hook-scripts) **once**:

```shell
pre-commit install --install-hooks
```

In addition, it may be handy to install `tox`:

```shell
uv tool install tox --with tox-uv
```

If the repository provides a Tox configuration under [`pyproject.toml`](./pyproject.toml), you can see which jobs it defines with:

```shell
tox list
```
3 changes: 1 addition & 2 deletions docs/001/index.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -433,8 +433,7 @@
" arg = expr.args[0]\n",
" x = self._print(arg)\n",
" return (\n",
" f\"select([less({x}, 0), True], [1j * sqrt(-{x}), sqrt({x})],\"\n",
" \" default=nan,)\"\n",
" f\"select([less({x}, 0), True], [1j * sqrt(-{x}), sqrt({x})], default=nan,)\"\n",
" )"
]
},
Expand Down
2 changes: 1 addition & 1 deletion docs/028/index.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@
" except (PdgAmbiguousValueError, PdgNoDataError):\n",
" pass\n",
" else:\n",
" print(f\"{initial_state:>20} → {\" \".join(final_state)}\")"
" print(f\"{initial_state:>20} → {' '.join(final_state)}\")"
]
},
{
Expand Down
6 changes: 3 additions & 3 deletions docs/030/index.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -983,7 +983,7 @@
" coupling_pattern: str,\n",
"):\n",
" original_parameters = dict(func.parameters)\n",
" negative_lookahead = f\"(?!{\"|\".join(map(re.escape, resonances))})\"\n",
" negative_lookahead = f\"(?!{'|'.join(map(re.escape, resonances))})\"\n",
" # https://regex101.com/r/WrgGyD/1\n",
" pattern = rf\"^{coupling_pattern}({negative_lookahead}.)*$\"\n",
" set_parameters_to_zero(func, pattern)\n",
Expand Down Expand Up @@ -1274,7 +1274,7 @@
"\n",
" ax1.legend(loc=\"upper left\")\n",
"\n",
" output_file = f\"argand-{title.lower().replace(\" \", \"-\")}.svg\"\n",
" output_file = f\"argand-{title.lower().replace(' ', '-')}.svg\"\n",
" fig.savefig(output_file, bbox_inches=\"tight\")\n",
" fig.show()"
]
Expand Down Expand Up @@ -1443,7 +1443,7 @@
" fig.legend(bbox_to_anchor=(0.1, 0.9), loc=\"upper left\")\n",
" fig.tight_layout()\n",
"\n",
" output_file = f\"phase-{title.lower().replace(\" \", \"-\")}.svg\"\n",
" output_file = f\"phase-{title.lower().replace(' ', '-')}.svg\"\n",
" fig.savefig(output_file, bbox_inches=\"tight\")\n",
" fig.show()"
]
Expand Down
2 changes: 1 addition & 1 deletion docs/031/index.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -885,7 +885,7 @@
" coupling_pattern: str,\n",
"):\n",
" original_parameters = dict(func.parameters)\n",
" negative_lookahead = f\"(?!{\"|\".join(map(re.escape, resonances))})\"\n",
" negative_lookahead = f\"(?!{'|'.join(map(re.escape, resonances))})\"\n",
" # https://regex101.com/r/WrgGyD/1\n",
" pattern = rf\"^{coupling_pattern}({negative_lookahead}.)*$\"\n",
" set_parameters_to_zero(func, pattern)\n",
Expand Down
10 changes: 5 additions & 5 deletions docs/032/index.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -1056,7 +1056,7 @@
" m_thr = sum(p.mass for p in decay.children)\n",
" label = None\n",
" if set_labels:\n",
" label = f\"${\"+\".join(f\"m_{{{p.latex}}}\" for p in decay.children)}$\"\n",
" label = f\"${'+'.join(f'm_{{{p.latex}}}' for p in decay.children)}$\"\n",
" ax.axvline(m_thr, c=f\"C{i}\", label=label, ls=\"dotted\")"
]
},
Expand Down Expand Up @@ -1101,7 +1101,7 @@
" alpha=0.5,\n",
" bins=200,\n",
" density=True,\n",
" label=f\"${\" \".join(p.latex for p in DECAYS[i].children)}$\",\n",
" label=f\"${' '.join(p.latex for p in DECAYS[i].children)}$\",\n",
" ax=ax,\n",
" )\n",
"indicate_thresholds(ax)\n",
Expand Down Expand Up @@ -1174,7 +1174,7 @@
" alpha=0.5,\n",
" bins=200,\n",
" density=True,\n",
" label=f\"${\" \".join(p.latex for p in DECAYS[i].children)}$\",\n",
" label=f\"${' '.join(p.latex for p in DECAYS[i].children)}$\",\n",
" ax=ax,\n",
" )\n",
"indicate_thresholds(ax)\n",
Expand Down Expand Up @@ -1285,7 +1285,7 @@
" fig.legend()\n",
" fig.tight_layout()\n",
"\n",
" output_file = f\"{title.lower().replace(\" \", \"-\")}.svg\"\n",
" output_file = f\"{title.lower().replace(' ', '-')}.svg\"\n",
" fig.savefig(output_file, bbox_inches=\"tight\")\n",
" fig.show()\n",
"\n",
Expand All @@ -1306,7 +1306,7 @@
" bins=bins,\n",
" color=color,\n",
" density=True,\n",
" label=f\"Data ${\" \".join(p.latex for p in DECAYS[decay_id].children)}$\",\n",
" label=f\"Data ${' '.join(p.latex for p in DECAYS[decay_id].children)}$\",\n",
" ax=ax,\n",
" )\n",
" fast_histogram(\n",
Expand Down
21 changes: 21 additions & 0 deletions pixi.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,24 @@ env = {PYTHONHASHSEED = "0"}
graphviz = "*"
julia = {channel = "https://repo.prefix.dev/julia-forge", version = "*"}
uv = "*"

[feature.dev.tasks.ci]
depends_on = ["doc", "linkcheck", "sty"]

[feature.dev.tasks.doc]
cmd = "sphinx-build --builder=html --fail-on-warning --keep-going --show-traceback docs/ docs/_build/html"
env = {PYTHONWARNINGS = "", TF_CPP_MIN_LOG_LEVEL = "3", ZFIT_DISABLE_TF_WARNINGS = "1"}

[feature.dev.tasks.doclive]
cmd = "sphinx-autobuild --ignore=docs/_build/ --ignore=docs/_static/exported_intensity_model.py --open-browser --port=0 --re-ignore='.*/__pycache__/.*' --re-ignore='.*/.ipynb_checkpoints/.*' --re-ignore='.*/.virtual_documents/.*' --re-ignore='.*\\.csv' --re-ignore='.*\\.gif' --re-ignore='.*\\.gitignore' --re-ignore='.*\\.gv' --re-ignore='.*\\.inv' --re-ignore='.*\\.json' --re-ignore='.*\\.pickle' --re-ignore='.*\\.png' --re-ignore='.*\\.svg' --re-ignore='.*\\.yaml' --re-ignore='.*\\.yml' --watch docs docs/ docs/_build/html"
env = {PYTHONWARNINGS = "", ZFIT_DISABLE_TF_WARNINGS = "1"}

[feature.dev.tasks.linkcheck]
cmd = "sphinx-build --builder=linkcheck --show-traceback docs/ docs/_build/linkcheck"

[feature.dev.tasks.nb]
cmd = "pytest docs"

[feature.dev.tasks.sty]
cmd = "pre-commit run --all-files"
env = {SKIP = "pyright"}

0 comments on commit e62ffdb

Please sign in to comment.