We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents e20dfa2 + 2418032 commit 9323d6aCopy full SHA for 9323d6a
4 files changed
.pre-commit-config.yaml
@@ -67,7 +67,7 @@ repos:
67
- id: yamllint
68
exclude: tests/optimagic/optimizers/_pounders/fixtures
69
- repo: https://github.com/PyCQA/docformatter
70
- rev: eb1df34
+ rev: v1.7.7
71
hooks:
72
- id: docformatter
73
args:
@@ -79,7 +79,7 @@ repos:
79
- --blank
80
exclude: src/optimagic/optimization/algo_options.py
81
- repo: https://github.com/astral-sh/ruff-pre-commit
82
- rev: v0.11.8
+ rev: v0.12.2
83
84
# Run the linter.
85
- id: ruff
@@ -131,7 +131,7 @@ repos:
131
132
- --drop-empty-cells
133
- repo: https://github.com/pre-commit/mirrors-mypy
134
- rev: v1.15.0
+ rev: v1.14.1
135
136
- id: mypy
137
files: src|tests
@@ -143,8 +143,6 @@ repos:
143
- types-cffi
144
- types-openpyxl
145
- types-jinja2
146
- args:
147
- - --config=pyproject.toml
148
ci:
149
autoupdate_schedule: monthly
150
skip:
src/optimagic/deprecations.py
@@ -371,11 +371,11 @@ def throw_dict_constraints_future_warning_if_required(
371
if not isinstance(constraints, list):
372
constraints = [constraints]
373
374
- types = [
+ types_or_none = [
375
constraint.get("type", None) if isinstance(constraint, dict) else None
376
for constraint in constraints
377
]
378
- types = list(set(types) - {None})
+ types = [t for t in types_or_none if t is not None]
379
380
if types:
381
msg = (
src/optimagic/examples/criterion_functions.py
@@ -105,16 +105,11 @@ def rosenbrock_scalar(params: PyTree) -> float:
105
def rosenbrock_gradient(params: PyTree) -> PyTree:
106
"""Calculate gradient of rosenbrock function."""
107
x = _get_x(params)
108
- l1 = np.delete(x, [-1])
109
- l1 = np.append(l1, 0)
110
- l2 = np.insert(x, 0, 0)
111
- l2 = np.delete(l2, [1])
112
- l3 = np.insert(x, 0, 0)
113
- l3 = np.delete(l3, [-1])
114
- l4 = np.delete(x, [0])
115
- l4 = np.append(l4, 0)
116
- l5 = np.full((len(x) - 1), 2)
117
- l5 = np.append(l5, 0) # type: ignore[assignment]
+ l1 = np.append(np.delete(x, [-1]), 0)
+ l2 = np.delete(np.insert(x, 0, 0), [1])
+ l3 = np.delete(np.insert(x, 0, 0), [-1])
+ l4 = np.append(np.delete(x, [0]), 0)
+ l5 = np.append(np.full((len(x) - 1), 2), 0)
118
flat = 100 * (4 * (l1**3) + 2 * l2 - 2 * (l3**2) - 4 * (l4 * x)) + 2 * l1 - l5
119
return _unflatten_gradient(flat, params)
120
src/optimagic/logging/logger.py
@@ -242,7 +242,7 @@ def _extract_best_history(
242
best_idx, level="step"
243
)
244
245
- def _to_dict(pandas_obj: pd.DataFrame | pd.Series) -> dict[str, Any]: # type:ignore
+ def _to_dict(pandas_obj: pd.DataFrame | pd.Series) -> dict[str, Any]:
246
if isinstance(pandas_obj, pd.DataFrame):
247
result = pandas_obj.to_dict(orient="list")
248
else:
0 commit comments