Skip to content

Commit

Permalink
style: pre-commit fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
pre-commit-ci[bot] authored and Saransh-cpp committed Aug 26, 2024
1 parent 3646408 commit f2988b2
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 27 deletions.
42 changes: 17 additions & 25 deletions docs/usage/intro.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
"metadata": {},
"outputs": [],
"source": [
"from __future__ import annotations\n",
"\n",
"import numbers\n",
"\n",
"import awkward as ak # at least version 1.2.0rc5\n",
Expand Down Expand Up @@ -3249,12 +3251,12 @@
"v1 = vector.obj(x=1, y=2, z=3)\n",
"v2 = vector.obj(x=1, y=2)\n",
"\n",
"print(v1 - v2.like(v1)) # transforms v2 to v1's coordinate system (imputes z=0)\n",
"print(v1.like(v2) - v2) # transforms v1 to v2's coordinate system (removes z)\n",
"print(v1 - v2.to_xyz()) # transforms v2 to xyz coordinates (imputes z=0)\n",
"print(v1.to_xy() - v2) # transforms v1 to xy coordinates (removes z)\n",
"print(v1 - v2.to_Vector3D(z=3)) # transforms v2 to 3D (imputes z=3)\n",
"print(v1.to_Vector2D() - v2) # transforms v1 to 2D (removes z)"
"print(v1 - v2.like(v1)) # transforms v2 to v1's coordinate system (imputes z=0)\n",
"print(v1.like(v2) - v2) # transforms v1 to v2's coordinate system (removes z)\n",
"print(v1 - v2.to_xyz()) # transforms v2 to xyz coordinates (imputes z=0)\n",
"print(v1.to_xy() - v2) # transforms v1 to xy coordinates (removes z)\n",
"print(v1 - v2.to_Vector3D(z=3)) # transforms v2 to 3D (imputes z=3)\n",
"print(v1.to_Vector2D() - v2) # transforms v1 to 2D (removes z)"
]
},
{
Expand Down Expand Up @@ -3573,10 +3575,12 @@
"class TwoVector(vector.backends.awkward.MomentumAwkward2D):\n",
" pass\n",
"\n",
"\n",
"@ak.mixin_class(behavior)\n",
"class ThreeVector(vector.backends.awkward.MomentumAwkward3D):\n",
" pass\n",
"\n",
"\n",
"# required for transforming vectors\n",
"# the class names must always end with \"Array\"\n",
"TwoVectorArray.ProjectionClass2D = TwoVectorArray # noqa: F821\n",
Expand Down Expand Up @@ -3857,10 +3861,10 @@
"outputs": [],
"source": [
"_binary_dispatch_cls = {\n",
" \"TwoVector\": TwoVector,\n",
" \"ThreeVector\": ThreeVector,\n",
" \"LorentzVector\": LorentzVector,\n",
" }\n",
" \"TwoVector\": TwoVector,\n",
" \"ThreeVector\": ThreeVector,\n",
" \"LorentzVector\": LorentzVector,\n",
"}\n",
"_rank = [TwoVector, ThreeVector, LorentzVector]\n",
"\n",
"for lhs, lhs_to in _binary_dispatch_cls.items():\n",
Expand Down Expand Up @@ -3951,21 +3955,9 @@
"metadata": {},
"outputs": [],
"source": [
"behavior.update(\n",
" ak._util.copy_behaviors(\n",
" \"Vector2D\", \"TwoVector\", behavior\n",
" )\n",
")\n",
"behavior.update(\n",
" ak._util.copy_behaviors(\n",
" \"Vector3D\", \"ThreeVector\", behavior\n",
" )\n",
")\n",
"behavior.update(\n",
" ak._util.copy_behaviors(\n",
" \"Momentum4D\", \"LorentzVector\", behavior\n",
" )\n",
")"
"behavior.update(ak._util.copy_behaviors(\"Vector2D\", \"TwoVector\", behavior))\n",
"behavior.update(ak._util.copy_behaviors(\"Vector3D\", \"ThreeVector\", behavior))\n",
"behavior.update(ak._util.copy_behaviors(\"Momentum4D\", \"LorentzVector\", behavior))"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion tests/test_compute_features.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@


@pytest.mark.skipif(is_unsupported, reason=unsupported_message)
@pytest.mark.slow()
@pytest.mark.slow
@pytest.mark.parametrize("signature", functions.keys())
def test(signature):
analyze_function(functions[signature])
Expand Down
2 changes: 1 addition & 1 deletion tests/test_notebooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import pytest


@pytest.fixture()
@pytest.fixture
def common_kwargs(tmpdir):
outputnb = tmpdir.join("output.ipynb")
return {
Expand Down

0 comments on commit f2988b2

Please sign in to comment.