Skip to content

Commit 52096a6

Browse files
committed
Apply some low hanging lints
1 parent b30a072 commit 52096a6

File tree

6 files changed

+15
-17
lines changed

6 files changed

+15
-17
lines changed

src/pineko/cli/gen_sv.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import pathlib
44

55
import click
6-
import pineappl
76
import rich
87

98
from .. import scale_variations

src/pineko/cli/kfactor.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import pathlib
44

55
import click
6-
import rich
76

87
from .. import kfactor
98
from ._base import command

src/pineko/comparator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def compare(pine, fktable, max_as, max_al, pdf, xir, xif):
3030
df : pd.DataFrame
3131
comparison table
3232
"""
33-
import lhapdf # pylint: disable=import-error
33+
import lhapdf # pylint: disable=import-error,import-outside-toplevel
3434

3535
pdfset = lhapdf.mkPDF(pdf, 0)
3636
pdgid = int(pdfset.set().get_entry("Particle"))

src/pineko/kfactor.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -308,10 +308,10 @@ def do_it(
308308
(first_nonzero_order[0] + max_as_test, min_al, 0, 0), grid_orders_filtered
309309
)
310310
if is_in and not order_exists:
311-
rich.print(f"[green] Success: Requested order already in the grid.")
311+
rich.print("[green] Success: Requested order already in the grid.")
312312
return
313-
elif not is_in and order_exists:
314-
rich.print(f"[red] Abort: order exists is True but order not in the grid.")
313+
if not is_in and order_exists:
314+
rich.print("[red] Abort: order exists is True but order not in the grid.")
315315
return
316316
construct_and_merge_grids(
317317
grid_path,
@@ -329,19 +329,19 @@ def filter_k_factors(pigrid, centrals_kfactor):
329329
"""Filter the centrals k-factors according to their lenght compared to the number of bins of the grid."""
330330
centrals_kfactor_filtered = np.array([])
331331
if pigrid.bins() == len(centrals_kfactor):
332-
rich.print(f"[orange] The number of bins match the lenght of the k-factor.")
332+
rich.print("[orange] The number of bins match the lenght of the k-factor.")
333333
centrals_kfactor_filtered = centrals_kfactor
334334
elif pigrid.bins() < len(centrals_kfactor):
335335
rich.print(
336-
f"[yellow] The number of bins is less than the lenght of the k-factor."
336+
"[yellow] The number of bins is less than the lenght of the k-factor."
337337
)
338338
if not all(elem == centrals_kfactor[0] for elem in centrals_kfactor):
339339
# This case is actually wrong.
340340
raise ValueError("KFactor contains too many different values.")
341341
centrals_kfactor_filtered = centrals_kfactor
342342
else:
343343
rich.print(
344-
f"[yellow] The number of bins is more than the lenght of the k-factor."
344+
"[yellow] The number of bins is more than the lenght of the k-factor."
345345
)
346346

347347
# This is the last case in which grid.bins() > len(centrals_kfactor)
@@ -388,7 +388,7 @@ def compute_k_factor_grid(
388388
target_folder: pathlib.Path
389389
path where store the new grid (optional)
390390
"""
391-
import lhapdf # pylint: disable=import-error
391+
import lhapdf # pylint: disable=import-error,import-outside-toplevel
392392

393393
# With respect to the usual convention here max_as is max_as-1
394394
max_as_test = max_as - 1

src/pineko/scale_variations.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
import numpy as np
77
import pineappl
8-
import rich
98
from eko import beta
109

1110
from . import check
@@ -18,12 +17,12 @@
1817
class ReturnState(Enum):
1918
"""Auxiliary class to list the possible return states."""
2019

21-
ALREADY_THERE = f"[green]Renormalization scale variations are already in the grid"
20+
ALREADY_THERE = "[green]Renormalization scale variations are already in the grid"
2221
ORDER_EXISTS_FAILURE = (
2322
"Order_exists is True but the order does not appear to be in the grid"
2423
)
2524
MISSING_CENTRAL = "Central order is not high enough to compute requested sv orders"
26-
SUCCESS = f"[green]Success: scale variation orders included!"
25+
SUCCESS = "[green]Success: scale variation orders included!"
2726

2827

2928
def qcd(order: OrderTuple) -> int:
@@ -168,7 +167,7 @@ def write_grids(gridpath, grid_list):
168167

169168

170169
def merge_grids(
171-
gridpath, grid_list_path, target_path=None, nec_orders={}, order_exists=False
170+
gridpath, grid_list_path, target_path=None, nec_orders=None, order_exists=False
172171
):
173172
"""Merge the single grids in the original."""
174173
grid = pineappl.grid.Grid.read(gridpath)
@@ -177,7 +176,9 @@ def merge_grids(
177176
else:
178177
target_path = target_path / gridpath.name
179178
if order_exists:
180-
grid = construct_and_dump_order_exists_grid(grid, list(nec_orders.keys())[0])
179+
grid = construct_and_dump_order_exists_grid(
180+
grid, list(nec_orders.keys())[0] if nec_orders is not None else []
181+
)
181182
for grid_path in grid_list_path:
182183
grid.merge_from_file(grid_path)
183184
grid_path.unlink()

src/pineko/theory.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -325,8 +325,7 @@ def eko(self, name, _grid, tcard):
325325
if not self.overwrite:
326326
rich.print(f"Skipping existing operator {eko_filename}")
327327
return
328-
else:
329-
eko_filename.unlink()
328+
eko_filename.unlink()
330329
# do it!
331330
logger.info("Start computation of %s", name)
332331
start_time = time.perf_counter()

0 commit comments

Comments
 (0)