Skip to content

Commit 0791e42

Browse files
committed
Use default line length for Python
1 parent a36799d commit 0791e42

File tree

8 files changed

+13
-34
lines changed

8 files changed

+13
-34
lines changed

.pre-commit-config.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ repos:
1818
args: [--fix]
1919
exclude: ^pineappl_cli/src/plot.py
2020
- id: ruff-format
21-
args: [--line-length=80]
21+
args: []
22+
# TODO: remove this exclusion once we've merged this into master
2223
exclude: ^pineappl_cli/src/plot.py
2324
- repo: local
2425
hooks:

examples/python/positivity.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,7 @@ def main(filename, Q2):
3838
)
3939
grid.set_subgrid(0, bin_, 0, subgrid.into())
4040
# set the correct observables
41-
normalizations = np.array(
42-
[1.0] * bins
43-
) # `normalizations` has to be `np.ndarray`
41+
normalizations = np.array([1.0] * bins) # `normalizations` has to be `np.ndarray`
4442
remapper = pineappl.bin.BinRemapper(normalizations, limits)
4543
grid.set_remapper(remapper)
4644

pineappl_cli/src/subgrid-pull-plot.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@
1919

2020
xi = np.linspace(sym_min, sym_max, (nrap // 2) * 2 + 1)
2121
yi = np.logspace(log10(np.min(y)), log10(np.max(y)), nmass)
22-
zi = griddata(
23-
(x, y), z, (xi[None, :], yi[:, None]), method="linear", rescale=True
24-
)
22+
zi = griddata((x, y), z, (xi[None, :], yi[:, None]), method="linear", rescale=True)
2523

2624
# print(xi.shape)
2725
# print(yi.shape)
@@ -54,9 +52,7 @@
5452
(x1, x2), z, (x1i[None, :], x2i[:, None]), method="linear", rescale=True
5553
)
5654

57-
mesh = axes[1].pcolormesh(
58-
x1i, x2i, z12i, shading="nearest", linewidth=0, snap=True
59-
)
55+
mesh = axes[1].pcolormesh(x1i, x2i, z12i, shading="nearest", linewidth=0, snap=True)
6056
axes[1].set_xscale("log")
6157
axes[1].set_yscale("log")
6258
axes[1].scatter(x1, x2, marker="*", s=5)

pineappl_cli/tests/plot.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -443,9 +443,7 @@ sym_max = max(fabs(np.min(x)), fabs(np.max(x)))
443443
444444
xi = np.linspace(sym_min, sym_max, (nrap // 2) * 2 + 1)
445445
yi = np.logspace(log10(np.min(y)), log10(np.max(y)), nmass)
446-
zi = griddata(
447-
(x, y), z, (xi[None, :], yi[:, None]), method="linear", rescale=True
448-
)
446+
zi = griddata((x, y), z, (xi[None, :], yi[:, None]), method="linear", rescale=True)
449447
450448
# print(xi.shape)
451449
# print(yi.shape)
@@ -478,9 +476,7 @@ z12i = griddata(
478476
(x1, x2), z, (x1i[None, :], x2i[:, None]), method="linear", rescale=True
479477
)
480478
481-
mesh = axes[1].pcolormesh(
482-
x1i, x2i, z12i, shading="nearest", linewidth=0, snap=True
483-
)
479+
mesh = axes[1].pcolormesh(x1i, x2i, z12i, shading="nearest", linewidth=0, snap=True)
484480
axes[1].set_xscale("log")
485481
axes[1].set_yscale("log")
486482
axes[1].scatter(x1, x2, marker="*", s=5)

pineappl_py/docs/source/advanced.ipynb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -414,9 +414,7 @@
414414
"edges = np.arange(0.0, 2.4, 0.1)\n",
415415
"\n",
416416
"ax.step(edges, nbins, where=\"post\", color=\"C1\")\n",
417-
"plt.fill_between(\n",
418-
" np.arange(0.0, 2.4, 0.1), nbins, step=\"post\", color=\"C1\", alpha=0.2\n",
419-
")\n",
417+
"plt.fill_between(np.arange(0.0, 2.4, 0.1), nbins, step=\"post\", color=\"C1\", alpha=0.2)\n",
420418
"ax.set_xlabel(\"$|y_{\\ell\\ell}|$\")\n",
421419
"ax.set_ylabel(\"$\\mathrm{d} \\sigma / \\mathrm{d} |y_{\\ell\\ell}|$ [pb]\")\n",
422420
"ax.grid(True, alpha=0.5)\n",

pineappl_py/docs/source/introduction.ipynb

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -258,9 +258,7 @@
258258
")\n",
259259
"\n",
260260
"# Normalization for each bin. See Section below for more details.\n",
261-
"bin_norm = np.array(\n",
262-
" [0.125 for _ in range(predictions.size - 2)] + [0.250, 0.250]\n",
263-
")\n",
261+
"bin_norm = np.array([0.125 for _ in range(predictions.size - 2)] + [0.250, 0.250])\n",
264262
"\n",
265263
"fig, ax = plt.subplots(figsize=(5.6, 3.9))\n",
266264
"# Factor of `1e3` takes into account the unit conversion into `fb`\n",
@@ -633,9 +631,7 @@
633631
"# Extract the left & right bin limits\n",
634632
"bin_limits = [\n",
635633
" (left, right)\n",
636-
" for left, right in zip(\n",
637-
" grid.bin_left(bin_dims - 1), grid.bin_right(bin_dims - 1)\n",
638-
" )\n",
634+
" for left, right in zip(grid.bin_left(bin_dims - 1), grid.bin_right(bin_dims - 1))\n",
639635
"]\n",
640636
"\n",
641637
"# Multiply the normalization by a factor of `2`\n",
@@ -705,9 +701,7 @@
705701
],
706702
"source": [
707703
"# Load our modified grids\n",
708-
"grid_nrm = pineappl.grid.Grid.read(\n",
709-
" \"./LHCB_DY_8TEV_custom_normalizations.pineappl.lz4\"\n",
710-
")\n",
704+
"grid_nrm = pineappl.grid.Grid.read(\"./LHCB_DY_8TEV_custom_normalizations.pineappl.lz4\")\n",
711705
"df_nbins = pl.DataFrame({\"bin normalization\": grid_nrm.bin_normalizations()})\n",
712706
"df_nbins.with_row_index()"
713707
]

pineappl_py/tests/test_fk_table.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@ class TestFkTable:
77
def fake_grid(self, bins=None):
88
channels = [pineappl.boc.Channel([(1, 21, 1.0)])]
99
orders = [pineappl.grid.Order(0, 0, 0, 0)]
10-
bin_limits = np.array(
11-
[1e-7, 1e-3, 1] if bins is None else bins, dtype=float
12-
)
10+
bin_limits = np.array([1e-7, 1e-3, 1] if bins is None else bins, dtype=float)
1311
subgrid_params = pineappl.subgrid.SubgridParams()
1412
g = pineappl.grid.Grid(channels, orders, bin_limits, subgrid_params)
1513
return g

pineappl_py/tests/test_grid.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,7 @@ class TestGrid:
1717
def fake_grid(self, bins=None):
1818
channels = [pineappl.boc.Channel([(1, 21, 0.1)])]
1919
orders = [pineappl.grid.Order(3, 0, 0, 0)]
20-
bin_limits = np.array(
21-
[1e-7, 1e-3, 1] if bins is None else bins, dtype=float
22-
)
20+
bin_limits = np.array([1e-7, 1e-3, 1] if bins is None else bins, dtype=float)
2321
subgrid_params = pineappl.subgrid.SubgridParams()
2422
g = pineappl.grid.Grid(channels, orders, bin_limits, subgrid_params)
2523
return g

0 commit comments

Comments
 (0)