From 115dc9b73be5ef9524a8d21d81cd576478a780eb Mon Sep 17 00:00:00 2001 From: eddiebergman Date: Thu, 28 Nov 2024 16:00:59 +0100 Subject: [PATCH] style: Fix pre-commit --- neps/runtime.py | 7 +++---- neps/state/neps_state.py | 3 ++- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/neps/runtime.py b/neps/runtime.py index ac667a82..1cdc1347 100644 --- a/neps/runtime.py +++ b/neps/runtime.py @@ -515,8 +515,7 @@ def _launch_runtime( # noqa: PLR0913 ) shutil.rmtree(optimization_dir) - retry_count = 0 - for retry_count in range(N_FAILED_CREATE_LOAD_STATE_ATTEMPTS): + for _retry_count in range(N_FAILED_CREATE_LOAD_STATE_ATTEMPTS): try: neps_state = create_or_load_filebased_neps_state( directory=optimization_dir, @@ -534,7 +533,7 @@ def _launch_runtime( # noqa: PLR0913 ), ) break - except Exception as e: + except Exception: # noqa: BLE001 time.sleep(0.5) logger.debug( "Error while trying to create or load the NePS state. Retrying...", @@ -543,7 +542,7 @@ def _launch_runtime( # noqa: PLR0913 else: raise RuntimeError( "Failed to create or load the NePS state after" - f" {retry_count} attempts. Bailing!" + f" {N_FAILED_CREATE_LOAD_STATE_ATTEMPTS} attempts. Bailing!" " Please enable debug logging to see the errors that occured." ) diff --git a/neps/state/neps_state.py b/neps/state/neps_state.py index a2249ed9..0390c8c0 100644 --- a/neps/state/neps_state.py +++ b/neps/state/neps_state.py @@ -102,7 +102,8 @@ def sample_trial( for hook in _sample_hooks: optimizer = hook(optimizer) - # NOTE: Re-work this, as the part's that are recomputed do not need to be serialized + # NOTE: Re-work this, as the part's that are recomputed + # do not need to be serialized budget = opt_state.budget if budget is not None: budget = budget.clone()