mirror of
https://github.com/wassname/optuna-dashboard.git
synced 2026-09-09 11:28:14 +08:00
Fix mypy errors in Optuna 4.0+
This commit is contained in:
@@ -142,7 +142,9 @@ def test_successful_study_artifact_retrieval() -> None:
|
||||
with tempfile.NamedTemporaryFile() as f:
|
||||
f.write(b"dummy_content")
|
||||
f.flush()
|
||||
artifact_id = upload_artifact(study, f.name, artifact_store=artifact_store)
|
||||
artifact_id = upload_artifact(
|
||||
study_or_trial=study, file_path=f.name, artifact_store=artifact_store
|
||||
)
|
||||
app = create_app(storage, artifact_store)
|
||||
status, _, body = send_request(
|
||||
app,
|
||||
@@ -188,7 +190,9 @@ def test_successful_trial_artifact_retrieval() -> None:
|
||||
with tempfile.NamedTemporaryFile() as f:
|
||||
f.write(b"dummy_content")
|
||||
f.flush()
|
||||
artifact_id = upload_artifact(trial, f.name, artifact_store=artifact_store)
|
||||
artifact_id = upload_artifact(
|
||||
study_or_trial=trial, file_path=f.name, artifact_store=artifact_store
|
||||
)
|
||||
app = create_app(storage, artifact_store)
|
||||
status, _, body = send_request(
|
||||
app,
|
||||
@@ -281,7 +285,9 @@ def test_delete_study_artifact() -> None:
|
||||
with tempfile.NamedTemporaryFile() as f:
|
||||
f.write(b"dummy_content")
|
||||
f.flush()
|
||||
artifact_id = upload_artifact(study, f.name, artifact_store=artifact_store)
|
||||
artifact_id = upload_artifact(
|
||||
study_or_trial=study, file_path=f.name, artifact_store=artifact_store
|
||||
)
|
||||
app = create_app(storage, artifact_store)
|
||||
status, _, _ = send_request(
|
||||
app,
|
||||
@@ -306,7 +312,9 @@ def test_delete_trial_artifact() -> None:
|
||||
with tempfile.NamedTemporaryFile() as f:
|
||||
f.write(b"dummy_content")
|
||||
f.flush()
|
||||
artifact_id = upload_artifact(trial, f.name, artifact_store=artifact_store)
|
||||
artifact_id = upload_artifact(
|
||||
study_or_trial=trial, file_path=f.name, artifact_store=artifact_store
|
||||
)
|
||||
app = create_app(storage, artifact_store)
|
||||
status, _, _ = send_request(
|
||||
app,
|
||||
|
||||
@@ -31,7 +31,7 @@ def test_list_optuna_trial_artifacts() -> None:
|
||||
with tempfile.NamedTemporaryFile() as f:
|
||||
f.write(dummy_content)
|
||||
f.flush()
|
||||
upload_artifact(trial, f.name, artifact_store=artifact_store)
|
||||
upload_artifact(study_or_trial=trial, file_path=f.name, artifact_store=artifact_store)
|
||||
|
||||
study.tell(trial, 0.0)
|
||||
|
||||
@@ -76,7 +76,9 @@ def test_delete_optuna_study_artifacts() -> None:
|
||||
artifact_store = FileSystemArtifactStore(tmpdir)
|
||||
|
||||
def objective(trial: optuna.Trial) -> float:
|
||||
upload_artifact(trial, dummy_file_path, artifact_store=artifact_store)
|
||||
upload_artifact(
|
||||
study_or_trial=trial, file_path=dummy_file_path, artifact_store=artifact_store
|
||||
)
|
||||
return 0.0
|
||||
|
||||
study.optimize(objective, n_trials=10)
|
||||
|
||||
Reference in New Issue
Block a user