Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pre-commit.ci] pre-commit autoupdate #537

Merged
merged 5 commits into from
Oct 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ repos:
always_run: true
require_serial: true
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
rev: v5.0.0
hooks:
- id: check-added-large-files
args:
Expand Down Expand Up @@ -56,7 +56,7 @@ repos:
- id: yamllint
exclude: tests/optimagic/optimizers/_pounders/fixtures
- repo: https://github.com/PyCQA/docformatter
rev: v1.7.5
rev: eb1df34
hooks:
- id: docformatter
args:
Expand All @@ -68,7 +68,7 @@ repos:
- --blank
exclude: src/optimagic/optimization/algo_options.py
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.3
rev: v0.7.1
hooks:
# Run the linter.
- id: ruff
Expand All @@ -85,7 +85,7 @@ repos:
- pyi
- jupyter
- repo: https://github.com/executablebooks/mdformat
rev: 0.7.17
rev: 0.7.18
hooks:
- id: mdformat
additional_dependencies:
Expand All @@ -97,7 +97,7 @@ repos:
- '88'
files: (README\.md)
- repo: https://github.com/executablebooks/mdformat
rev: 0.7.17
rev: 0.7.18
hooks:
- id: mdformat
additional_dependencies:
Expand All @@ -119,7 +119,7 @@ repos:
args:
- --drop-empty-cells
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.11.2
rev: v1.13.0
hooks:
- id: mypy
files: src|tests
Expand Down
2 changes: 1 addition & 1 deletion .tools/envs/testenv-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ dependencies:
- scipy>=1.2.1 # run, tests
- sqlalchemy # run, tests
- seaborn # dev, tests
- mypy>=1.11 # dev, tests
- mypy>=1.13 # dev, tests
- pyyaml # dev, tests
- jinja2 # dev, tests
- annotated-types # dev, tests
Expand Down
2 changes: 1 addition & 1 deletion .tools/envs/testenv-others.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ dependencies:
- scipy>=1.2.1 # run, tests
- sqlalchemy # run, tests
- seaborn # dev, tests
- mypy>=1.11 # dev, tests
- mypy>=1.13 # dev, tests
- pyyaml # dev, tests
- jinja2 # dev, tests
- annotated-types # dev, tests
Expand Down
2 changes: 1 addition & 1 deletion .tools/envs/testenv-pandas.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ dependencies:
- scipy>=1.2.1 # run, tests
- sqlalchemy # run, tests
- seaborn # dev, tests
- mypy>=1.11 # dev, tests
- mypy>=1.13 # dev, tests
- pyyaml # dev, tests
- jinja2 # dev, tests
- annotated-types # dev, tests
Expand Down
4 changes: 2 additions & 2 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ dependencies:
- sphinx-panels # docs
- sphinxcontrib-bibtex # docs
- seaborn # dev, tests
- mypy>=1.11 # dev, tests
- mypy>=1.13 # dev, tests
- pyyaml # dev, tests
- jinja2 # dev, tests
- furo # dev, docs
Expand All @@ -42,7 +42,7 @@ dependencies:
- Py-BOBYQA # dev, tests
- fides==0.7.4 # dev, tests
- kaleido # dev, tests
- pre-commit # dev
- pre-commit>=4 # dev
- -e . # dev
# type stubs
- pandas-stubs # dev, tests
Expand Down
6 changes: 4 additions & 2 deletions src/optimagic/algorithms.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,12 @@
name = candidate.__algo_info__.name
if issubclass(candidate, Algorithm) and candidate is not Algorithm:
ALL_ALGORITHMS[name] = candidate
if candidate.__algo_info__.is_available:
if candidate.__algo_info__.is_available: # type: ignore[attr-defined]
AVAILABLE_ALGORITHMS[name] = candidate


GLOBAL_ALGORITHMS = [
name for name, algo in ALL_ALGORITHMS.items() if algo.__algo_info__.is_global
name
for name, algo in ALL_ALGORITHMS.items()
if algo.__algo_info__.is_global # type: ignore[attr-defined]
]
2 changes: 1 addition & 1 deletion src/optimagic/optimization/algorithm.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ def _solve_internal_problem(
def __post_init__(self) -> None:
for field in self.__dataclass_fields__:
raw_value = getattr(self, field)
target_type = self.__dataclass_fields__[field].type
target_type = typing.cast(type, self.__dataclass_fields__[field].type)
if target_type in TYPE_CONVERTERS:
try:
value = TYPE_CONVERTERS[target_type](raw_value)
Expand Down
4 changes: 2 additions & 2 deletions src/optimagic/optimization/create_optimization_problem.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import warnings
from dataclasses import dataclass
from pathlib import Path
from typing import Any, Callable, Type, cast
from typing import Any, Callable, Type

from optimagic import deprecations
from optimagic.algorithms import ALL_ALGORITHMS
Expand Down Expand Up @@ -591,4 +591,4 @@ def pre_process_user_algorithm(
elif isinstance(algorithm, type) and issubclass(algorithm, Algorithm):
algorithm = algorithm()

return cast(Algorithm, algorithm)
return algorithm