Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • pelson/geoff-app
  • geoff/geoff-app
2 results
Show changes
Commits on Source (3)
......@@ -5,8 +5,12 @@
# SPDX-License-Identifier: GPL-3.0-or-later OR EUPL-1.2+
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
# See https://pre-commit.com/hooks.html and
# https://acc-py.docs.cern.ch/howto/use-pre-commit-with-acc-py/#available-pre-commit-hooks
# for more hooks
repos:
- repo: ssh://git@gitlab.cern.ch:7999/acc-co/devops/python/devtools/acc-py-deploy-pre-commit.git
rev: v2.8.1
hooks:
......@@ -22,14 +26,21 @@ repos:
args: ["--unsafe"]
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://gitlab.cern.ch/pre-commit-hook-mirrors/psf/black-pre-commit-mirror
rev: 24.8.0
- repo: https://gitlab.cern.ch/pre-commit-hook-mirrors/astral-sh/ruff-pre-commit
rev: v0.9.4
hooks:
- id: black
# Run the linter.
- id: ruff
args: [ --fix ]
# Run the formatter.
- id: ruff-format
- repo: https://gitlab.cern.ch/pre-commit-hook-mirrors/fsfe/reuse-tool
rev: v4.0.3
hooks:
- id: reuse
- repo: https://gitlab.cern.ch/pre-commit-hook-mirrors/pre-commit/mirrors-mypy
rev: v1.11.2
hooks:
......
# SPDX-FileCopyrightText: 2020-2023 CERN
# SPDX-FileCopyrightText: 2023 GSI Helmholtzzentrum für Schwerionenforschung
# SPDX-FileNotice: All rights not expressly granted are reserved.
#
# SPDX-License-Identifier: GPL-3.0-or-later OR EUPL-1.2+
[flake8]
max-line-length = 88
extend-ignore =
# Line too long / doc line too long; they can't handle
# our copyright header correctly. We disable them and
# use flake8-length instead.
E501
W505
# Bare except, already caught by Pylint.
E722
# Whitespace before colon, handled by Black.
E203
......@@ -149,9 +149,9 @@ class ControlPane(QtWidgets.QWidget):
self.rl_exec_tab.setMachine(machine)
def _on_lsa_user_changed(self, user_name: str) -> None:
assert (
self.lsa_selector.selected_context is not None
), "This should never happen"
assert self.lsa_selector.selected_context is not None, (
"This should never happen"
)
context_name = self.lsa_selector.selected_context.name
LOG.debug("cycle changed: %s, %s", context_name, user_name)
self._last_lsa_selection[self.machine_combo.currentText()] = user_name
......
......@@ -549,7 +549,7 @@ class NumOptTab(QtWidgets.QWidget):
)
headers.append(("objective", job.get_objective_name()))
names, descs = zip(*headers)
header = f'# {", ".join(names)}\n# {", ".join(descs)}'
header = f"# {', '.join(names)}\n# {', '.join(descs)}"
data_blocks = [
np.array(job.actions_log),
np.array(job.objectives_log)[:, np.newaxis],
......
......@@ -477,13 +477,13 @@ def _iter_colored_layers(count: int) -> t.Iterator[t.Tuple[ColorSpec, t.Optional
def _assert_same_length(first: np.ndarray, *others: np.ndarray) -> None:
"""Assert that the first dimension of all given arrays has the same length."""
expected = len(first)
assert set(len(other) for other in others) == {
expected
}, f"arrays have inequal first dimension: {list(map(len, [first, *others]))}"
assert set(len(other) for other in others) == {expected}, (
f"arrays have inequal first dimension: {list(map(len, [first, *others]))}"
)
def _assert_ndim(ndim: int, *arrays: np.ndarray) -> None:
"""Assert that the given arrays have a given number of dimensions."""
assert all(
np.ndim(arr) == ndim for arr in arrays
), f"arrays don't all have {ndim} dimension(s): {list(map(np.ndim, arrays))}"
assert all(np.ndim(arr) == ndim for arr in arrays), (
f"arrays don't all have {ndim} dimension(s): {list(map(np.ndim, arrays))}"
)
......@@ -4,7 +4,7 @@
#
# SPDX-License-Identifier: GPL-3.0-or-later OR EUPL-1.2+
"""Single-objective optimization. """
"""Single-objective optimization."""
from .builder import CannotBuildJob, OptJobBuilder
from .jobs import OptJob
......
......@@ -48,5 +48,5 @@ def coerce_float(number: t.SupportsFloat) -> float:
return type_.__float__(number) # pylint: disable=unnecessary-dunder-call
except TypeError:
raise AttributeError(
f'type object {type.__name__!r} has no attribute {"__float__"!r}'
f"type object {type.__name__!r} has no attribute {'__float__'!r}"
) from None
......@@ -23,7 +23,7 @@ def print_parent_chain(widget: QObject, printer: Printer = print) -> None:
"""
depth = 0
while widget is not None:
printer(f"{depth*' '}{widget!s}")
printer(f"{depth * ' '}{widget!s}")
widget = widget.parent()
depth += 1
......