Skip to content

Commit

Permalink
chore: pre-commit update
Browse files Browse the repository at this point in the history
  • Loading branch information
eddiebergman committed Jan 8, 2025
1 parent 0c7f66f commit 1aaf053
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 24 deletions.
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ repos:
files: '^src/.*\.py$'

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.11.2
rev: v1.14.1
hooks:
- id: mypy
files: |
Expand All @@ -43,7 +43,7 @@ repos:
- "--show-traceback"

- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.29.3
rev: 0.31.0
hooks:
- id: check-github-workflows
files: '^github/workflows/.*\.ya?ml$'
Expand All @@ -52,7 +52,7 @@ repos:
files: '^\.github/dependabot\.ya?ml$'

- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.6.9
rev: v0.8.6
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix, --no-cache]
Expand Down
21 changes: 2 additions & 19 deletions neps/optimizers/base_optimizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from abc import abstractmethod
from collections.abc import Mapping
from dataclasses import dataclass
from typing import TYPE_CHECKING, Any, overload
from typing import TYPE_CHECKING, Any

from neps.state.trial import Report, Trial

Expand Down Expand Up @@ -107,22 +107,6 @@ def __init__(
self.learning_curve_on_error = learning_curve_on_error
self.ignore_errors = ignore_errors

@overload
def ask(
self,
trials: Mapping[str, Trial],
budget_info: BudgetInfo | None,
n: int,
) -> list[SampledConfig]: ...

@overload
def ask(
self,
trials: Mapping[str, Trial],
budget_info: BudgetInfo | None,
n: None = None,
) -> SampledConfig: ...

@abstractmethod
def ask(
self,
Expand All @@ -137,8 +121,7 @@ def ask(
budget_info: information about the budget constraints.
Returns:
SampledConfig: a sampled configuration
dict: state the optimizer would like to keep between calls
The sampled configuration(s)
"""
...

Expand Down
2 changes: 1 addition & 1 deletion neps/optimizers/multi_fidelity/successive_halving.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ def ask(
trials: Mapping[str, Trial],
budget_info: BudgetInfo | None,
n: int | None = None,
) -> SampledConfig:
) -> SampledConfig | list[SampledConfig]:
"""This is basically the fit method."""
assert n is None, "TODO"
completed: dict[str, ConfigResult] = {
Expand Down
2 changes: 1 addition & 1 deletion neps/state/filebased.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def write( # noqa: C901, PLR0912
raise ValueError(f"Invalid hint: {hints}")
elif isinstance(hints, Iterable):
for hint in hints:
cls.write(trial, directory, hints=hint)
cls.write(trial, directory, hints=hint) # type: ignore
elif hints is None:
# We don't know, write everything
cls.write(trial, directory, hints=["config", "metadata"])
Expand Down

0 comments on commit 1aaf053

Please sign in to comment.