mirror of
https://github.com/wassname/optuna-dashboard.git
synced 2026-09-10 12:23:22 +08:00
Remove typing_extensions from the dependencies
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from datetime import datetime
|
||||
from datetime import timedelta
|
||||
import functools
|
||||
@@ -425,7 +427,7 @@ def run_server(
|
||||
run(app, host=host, port=port)
|
||||
|
||||
|
||||
def wsgi(storage: Union[str, BaseStorage]) -> "WSGIApplication":
|
||||
def wsgi(storage: Union[str, BaseStorage]) -> WSGIApplication:
|
||||
"""This function exposes WSGI interface for people who want to run on the
|
||||
production-class WSGI servers like Gunicorn or uWSGI.
|
||||
"""
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import copy
|
||||
import threading
|
||||
from typing import Dict
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import os
|
||||
from socketserver import ThreadingMixIn
|
||||
import sys
|
||||
from typing import TYPE_CHECKING
|
||||
from wsgiref.simple_server import make_server
|
||||
from wsgiref.simple_server import WSGIServer
|
||||
|
||||
@@ -16,10 +19,8 @@ from ._app import get_storage
|
||||
from ._sql_profiler import register_profiler_view
|
||||
|
||||
|
||||
try:
|
||||
if TYPE_CHECKING:
|
||||
from typing import Literal
|
||||
except ImportError:
|
||||
from typing_extensions import Literal # type: ignore
|
||||
|
||||
|
||||
DEBUG = os.environ.get("OPTUNA_DASHBOARD_DEBUG") == "1"
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import threading
|
||||
from typing import Dict
|
||||
from typing import List
|
||||
from typing import Tuple
|
||||
from typing import TYPE_CHECKING
|
||||
import warnings
|
||||
|
||||
from optuna.importance import BaseImportanceEvaluator
|
||||
@@ -13,11 +16,6 @@ from optuna.trial import FrozenTrial
|
||||
from optuna.trial import TrialState
|
||||
|
||||
|
||||
try:
|
||||
from typing import TypedDict
|
||||
except ImportError:
|
||||
from typing_extensions import TypedDict
|
||||
|
||||
try:
|
||||
from optuna_fast_fanova import FanovaImportanceEvaluator as FastFanovaImportanceEvaluator
|
||||
except ModuleNotFoundError:
|
||||
@@ -27,21 +25,24 @@ except Exception as e:
|
||||
FastFanovaImportanceEvaluator = None # type: ignore
|
||||
|
||||
|
||||
ImportanceItemType = TypedDict(
|
||||
"ImportanceItemType",
|
||||
{
|
||||
"name": str,
|
||||
"importance": float,
|
||||
"distribution": str,
|
||||
},
|
||||
)
|
||||
ImportanceType = TypedDict(
|
||||
"ImportanceType",
|
||||
{
|
||||
"target_name": str,
|
||||
"param_importances": List[ImportanceItemType],
|
||||
},
|
||||
)
|
||||
if TYPE_CHECKING:
|
||||
from typing import TypedDict
|
||||
|
||||
ImportanceItemType = TypedDict(
|
||||
"ImportanceItemType",
|
||||
{
|
||||
"name": str,
|
||||
"importance": float,
|
||||
"distribution": str,
|
||||
},
|
||||
)
|
||||
ImportanceType = TypedDict(
|
||||
"ImportanceType",
|
||||
{
|
||||
"target_name": str,
|
||||
"param_importances": List[ImportanceItemType],
|
||||
},
|
||||
)
|
||||
|
||||
target_name = "Objective Value"
|
||||
param_importance_cache_lock = threading.Lock()
|
||||
|
||||
+12
-11
@@ -1,27 +1,28 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import math
|
||||
from typing import Any
|
||||
from typing import Dict
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from optuna.storages import BaseStorage
|
||||
|
||||
|
||||
try:
|
||||
if TYPE_CHECKING:
|
||||
from typing import TypedDict
|
||||
except ImportError:
|
||||
from typing_extensions import TypedDict
|
||||
|
||||
NoteType = TypedDict(
|
||||
"NoteType",
|
||||
{
|
||||
"version": int,
|
||||
"body": str,
|
||||
},
|
||||
)
|
||||
|
||||
SYSTEM_ATTR_MAX_LENGTH = 2045
|
||||
NOTE_VER_KEY = "dashboard:note_ver"
|
||||
NOTE_STR_KEY_PREFIX = "dashboard:note_str:"
|
||||
|
||||
NoteType = TypedDict(
|
||||
"NoteType",
|
||||
{
|
||||
"version": int,
|
||||
"body": str,
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
def get_note_from_system_attrs(system_attrs: Dict[str, Any]) -> NoteType:
|
||||
if NOTE_VER_KEY not in system_attrs:
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
from typing import Any
|
||||
from typing import Dict
|
||||
from typing import List
|
||||
from typing import Tuple
|
||||
from typing import TYPE_CHECKING
|
||||
from typing import Union
|
||||
|
||||
import numpy as np
|
||||
@@ -13,36 +16,34 @@ from optuna.trial import FrozenTrial
|
||||
from . import _note as note
|
||||
|
||||
|
||||
try:
|
||||
if TYPE_CHECKING:
|
||||
from typing import Literal
|
||||
from typing import TypedDict
|
||||
except ImportError:
|
||||
from typing_extensions import Literal # type: ignore
|
||||
from typing_extensions import TypedDict
|
||||
|
||||
Attribute = TypedDict(
|
||||
"Attribute",
|
||||
{
|
||||
"key": str,
|
||||
"value": str,
|
||||
},
|
||||
)
|
||||
AttributeSpec = TypedDict(
|
||||
"AttributeSpec",
|
||||
{
|
||||
"key": str,
|
||||
"sortable": bool,
|
||||
},
|
||||
)
|
||||
IntermediateValue = TypedDict(
|
||||
"IntermediateValue",
|
||||
{
|
||||
"step": int,
|
||||
"value": Union[float, Literal["inf", "-inf", "nan"]],
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
MAX_ATTR_LENGTH = 1024
|
||||
Attribute = TypedDict(
|
||||
"Attribute",
|
||||
{
|
||||
"key": str,
|
||||
"value": str,
|
||||
},
|
||||
)
|
||||
AttributeSpec = TypedDict(
|
||||
"AttributeSpec",
|
||||
{
|
||||
"key": str,
|
||||
"sortable": bool,
|
||||
},
|
||||
)
|
||||
IntermediateValue = TypedDict(
|
||||
"IntermediateValue",
|
||||
{
|
||||
"step": int,
|
||||
"value": Union[float, Literal["inf", "-inf", "nan"]],
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
def serialize_attrs(attrs: Dict[str, Any]) -> List[Attribute]:
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import threading
|
||||
from time import perf_counter
|
||||
from typing import Dict
|
||||
|
||||
@@ -30,7 +30,6 @@ dependencies = [
|
||||
"optuna>=2.4.0",
|
||||
"packaging",
|
||||
"scikit-learn",
|
||||
'typing-extensions; python_version<"3.8"',
|
||||
]
|
||||
dynamic = ["version"]
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
# project dependency
|
||||
optuna>=2.4
|
||||
bottle
|
||||
typing-extensions;python_version<'3.8'
|
||||
scikit-learn
|
||||
|
||||
# lint
|
||||
|
||||
Reference in New Issue
Block a user