mirror of
https://github.com/wassname/optuna-dashboard.git
synced 2026-09-11 12:30:25 +08:00
Make the code pass lint checking
This commit is contained in:
+3
-1
@@ -2,4 +2,6 @@ venv
|
||||
.venv
|
||||
standalone_app
|
||||
vscode
|
||||
tslib
|
||||
tslib
|
||||
jupyterlab
|
||||
pkg
|
||||
@@ -3,7 +3,8 @@ try:
|
||||
except ImportError:
|
||||
# Fallback when using the package in dev mode without installing
|
||||
# in editable mode with pip. It is highly recommended to install
|
||||
# the package from a stable release or in editable mode: https://pip.pypa.io/en/stable/topics/local-project-installs/#editable-installs
|
||||
# the package from a stable release or in editable mode:
|
||||
# https://pip.pypa.io/en/stable/topics/local-project-installs/#editable-installs
|
||||
import warnings
|
||||
warnings.warn("Importing 'jupyterlab_optuna' outside a proper installation.")
|
||||
__version__ = "dev"
|
||||
|
||||
@@ -4,10 +4,11 @@ import json
|
||||
import threading
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
import tornado
|
||||
from jupyter_server.base.handlers import APIHandler
|
||||
from jupyter_server.utils import url_path_join
|
||||
from optuna_dashboard.artifact._backend_to_store import to_artifact_store
|
||||
import tornado
|
||||
|
||||
|
||||
try:
|
||||
from optuna.artifacts import FileSystemArtifactStore
|
||||
@@ -19,6 +20,7 @@ from optuna_dashboard import wsgi
|
||||
from tornado.web import FallbackHandler
|
||||
from tornado.wsgi import WSGIContainer
|
||||
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from _typeshed.wsgi import WSGIApplication
|
||||
|
||||
|
||||
+23
-30
@@ -114,6 +114,9 @@ export class JupyterlabAPIClient extends APIClient {
|
||||
): Promise<void> =>
|
||||
requestAPI<void>(`/api/studies/${studyId}`, {
|
||||
method: "DELETE",
|
||||
body: JSON.stringify({
|
||||
remove_associated_artifacts: removeAssociatedArtifacts,
|
||||
}),
|
||||
}).then(() => {
|
||||
return
|
||||
})
|
||||
@@ -177,16 +180,13 @@ export class JupyterlabAPIClient extends APIClient {
|
||||
fileName: string,
|
||||
dataUrl: string
|
||||
): Promise<UploadArtifactAPIResponse> =>
|
||||
requestAPI<UploadArtifactAPIResponse>(
|
||||
`/api/artifacts/${studyId}`,
|
||||
{
|
||||
body: JSON.stringify({
|
||||
file: dataUrl,
|
||||
filename: fileName,
|
||||
}),
|
||||
method: "POST",
|
||||
}
|
||||
).then((res) => {
|
||||
requestAPI<UploadArtifactAPIResponse>(`/api/artifacts/${studyId}`, {
|
||||
body: JSON.stringify({
|
||||
file: dataUrl,
|
||||
filename: fileName,
|
||||
}),
|
||||
method: "POST",
|
||||
}).then((res) => {
|
||||
return res
|
||||
})
|
||||
deleteTrialArtifact = (
|
||||
@@ -194,21 +194,15 @@ export class JupyterlabAPIClient extends APIClient {
|
||||
trialId: number,
|
||||
artifactId: string
|
||||
): Promise<void> =>
|
||||
requestAPI<void>(
|
||||
`/api/artifacts/${studyId}/${trialId}/${artifactId}`,
|
||||
{
|
||||
method: "DELETE",
|
||||
}
|
||||
).then(() => {
|
||||
requestAPI<void>(`/api/artifacts/${studyId}/${trialId}/${artifactId}`, {
|
||||
method: "DELETE",
|
||||
}).then(() => {
|
||||
return
|
||||
})
|
||||
deleteStudyArtifact = (studyId: number, artifactId: string): Promise<void> =>
|
||||
requestAPI<void>(
|
||||
`/api/artifacts/${studyId}/${artifactId}`,
|
||||
{
|
||||
method: "DELETE",
|
||||
}
|
||||
).then(() => {
|
||||
requestAPI<void>(`/api/artifacts/${studyId}/${artifactId}`, {
|
||||
method: "DELETE",
|
||||
}).then(() => {
|
||||
return
|
||||
})
|
||||
tellTrial = async (
|
||||
@@ -293,17 +287,16 @@ export class JupyterlabAPIClient extends APIClient {
|
||||
}).then(() => {
|
||||
return
|
||||
})
|
||||
getPlot = (studyId: number, plotType: PlotType): Promise<PlotResponse> =>
|
||||
requestAPI<PlotResponse>(`/api/studies/${studyId}/plot/${plotType}`)
|
||||
.then<PlotResponse>((res) => (res))
|
||||
getPlot = (studyId: number, plotType: PlotType): Promise<PlotResponse> =>
|
||||
requestAPI<PlotResponse>(
|
||||
`/api/studies/${studyId}/plot/${plotType}`
|
||||
).then<PlotResponse>((res) => res)
|
||||
getCompareStudiesPlot = (
|
||||
studyIds: number[],
|
||||
plotType: CompareStudiesPlotType
|
||||
): Promise<PlotResponse> => {
|
||||
return requestAPI<PlotResponse>(
|
||||
`/api/compare-studies/plot/${plotType}`, {
|
||||
body: JSON.stringify({ study_ids: studyIds }),
|
||||
}
|
||||
).then<PlotResponse>((res) => (res))
|
||||
return requestAPI<PlotResponse>(`/api/compare-studies/plot/${plotType}`, {
|
||||
body: JSON.stringify({ study_ids: studyIds }),
|
||||
}).then<PlotResponse>((res) => res)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -182,7 +182,7 @@ const StartDashboardForm: FC<{
|
||||
artifact_path: artifactPath,
|
||||
}),
|
||||
})
|
||||
.then((res) => {
|
||||
.then((_res) => {
|
||||
setLoading(false)
|
||||
showOptunaDashboard()
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user