Skip to content

Commit 8cdf035

Browse files
committed
Fixes for issues identified by pre-commit
As usual, I should probably ignore pylance given it has so many false positives
1 parent 3460aa8 commit 8cdf035

File tree

3 files changed

+8
-10
lines changed

3 files changed

+8
-10
lines changed

src/pachyderm/fit/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ def func_wrap(args_to_vary: Sequence[float], x: npt.NDArray[Any]) -> float:
403403
# parameters. So we just accept the inefficiency.
404404
partial_derivative_result: npt.NDArray[Any] = partial_derivative_func(list(args_at_minimum.values()), x)
405405
end = time.time()
406-
logger.debug(f"Finished calculating the gradient in {end-start} seconds.")
406+
logger.debug(f"Finished calculating the gradient in {end - start} seconds.")
407407

408408
# If we are only in 1D, we need to promote to a 2D (shape of 1D, 1) to get the indexing correct below.
409409
# This only occurs if we only have one parameter that is varied.

src/pachyderm/histogram.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -191,9 +191,7 @@ def _extract_values_from_hepdata_dependent_variable(var: Mapping[str, Any]) -> T
191191

192192
# Validate the collected values.
193193
if len(hist_stat_errors) == 0:
194-
msg = (
195-
f"Could not retrieve statistical errors for dependent var {var}.\n" f" hist_stat_errors: {hist_stat_errors}"
196-
)
194+
msg = f"Could not retrieve statistical errors for dependent var {var}.\n hist_stat_errors: {hist_stat_errors}"
197195
raise ValueError(msg)
198196
if len(hist_values) != len(hist_stat_errors):
199197
msg = (
@@ -546,7 +544,7 @@ def _integral(
546544
# Provide the opportunity to scale by bin width
547545
widths = np.ones(len(self.y))
548546
if multiply_by_bin_width:
549-
widths = self.bin_widths
547+
widths = self.bin_widths # type: ignore[assignment]
550548

551549
# Integrate by summing up all of the bins and the errors.
552550
# Perform the integral.
@@ -813,7 +811,7 @@ def from_hepdata(
813811
Returns:
814812
List of Histogram1D constructed from the input HEPdata.
815813
"""
816-
# HEP Data is just a map containing the data.
814+
# HEPData is just a map containing the data.
817815
if not isinstance(hist, collections.abc.Mapping):
818816
msg = f"Does not appear to be valid HEPdata. Must pass a map with the HEPdata information. Passed: {hist}" # type: ignore[unreachable]
819817
raise TypeError(msg)

tests/test_histogram.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -571,9 +571,9 @@ def test_get_array_from_hist2D(self, use_bin_edges, set_zero_to_NaN, test_root_h
571571

572572

573573
@pytest.fixture
574-
def setup_basic_hist() -> (
575-
tuple[histogram.Histogram1D, npt.NDArray[np.float64], npt.NDArray[np.float64], npt.NDArray[np.float64]]
576-
):
574+
def setup_basic_hist() -> tuple[
575+
histogram.Histogram1D, npt.NDArray[np.float64], npt.NDArray[np.float64], npt.NDArray[np.float64]
576+
]:
577577
"""Setup a basic `Histogram1D` for basic tests.
578578
579579
This histogram contains 4 bins, with edges of [0, 1, 2, 3, 5], values of [2, 2, 3, 0], with
@@ -1247,7 +1247,7 @@ def test_convert_HEPdata_hist() -> None:
12471247
hepdata_path = Path(__file__).parent / "testFiles" / "pionHadron.yaml"
12481248
print(hepdata_path)
12491249

1250-
# Load the HEP data.
1250+
# Load the HEPdata.
12511251
from pachyderm import yaml
12521252

12531253
y = yaml.yaml()

0 commit comments

Comments
 (0)