Merge pull request #77 from optuna/isort

Introduce isort: sorting import statements alphabetically.
This commit is contained in:
Masashi Shibata
2021-04-09 18:08:28 +09:00
committed by GitHub
13 changed files with 77 additions and 16 deletions
+2 -1
View File
@@ -21,7 +21,8 @@ jobs:
python -m pip install --upgrade pip setuptools
pip install --progress-bar off .[lint]
- run: flake8 . --show-source
- run: black --check .
- run: black --check --diff .
- run: isort --check --diff .
- run: mypy .
test:
runs-on: ubuntu-latest
+1
View File
@@ -76,6 +76,7 @@ $ tox -e py39
$ pip install .[lint]
$ flake8
$ black --check .
$ isort . --check
$ mypy .
```
+22 -5
View File
@@ -1,22 +1,39 @@
from datetime import datetime, timedelta
from datetime import datetime
from datetime import timedelta
import functools
import json
import logging
import os
import threading
import traceback
from typing import Union, Dict, List, Optional, TypeVar, Callable, Any, cast
from typing import Any
from typing import Callable
from typing import cast
from typing import Dict
from typing import List
from typing import Optional
from typing import TypeVar
from typing import Union
from bottle import Bottle, BaseResponse, redirect, request, response, static_file
from bottle import BaseResponse
from bottle import Bottle
from bottle import redirect
from bottle import request
from bottle import response
from bottle import static_file
import optuna
from optuna.exceptions import DuplicatedStudyError
from optuna.storages import BaseStorage
from optuna.trial import FrozenTrial, TrialState
from optuna.study import StudyDirection, StudySummary, Study
from optuna.study import Study
from optuna.study import StudyDirection
from optuna.study import StudySummary
from optuna.trial import FrozenTrial
from optuna.trial import TrialState
from . import serializer
from .search_space import get_search_space
BottleViewReturn = Union[str, bytes, Dict[str, Any], BaseResponse]
BottleView = TypeVar("BottleView", bound=Callable[..., BottleViewReturn])
+8 -2
View File
@@ -1,9 +1,15 @@
import copy
import threading
from typing import Dict, List, Optional, Set, Tuple
from typing import Dict
from typing import List
from typing import Optional
from typing import Set
from typing import Tuple
from optuna.distributions import BaseDistribution
from optuna.trial import TrialState, FrozenTrial
from optuna.trial import FrozenTrial
from optuna.trial import TrialState
SearchSpaceSetT = Set[Tuple[str, BaseDistribution]]
SearchSpaceListT = List[Tuple[str, BaseDistribution]]
+5 -1
View File
@@ -1,9 +1,13 @@
from typing import Any, Dict, List, Tuple
from typing import Any
from typing import Dict
from typing import List
from typing import Tuple
from optuna.distributions import BaseDistribution
from optuna.study import StudySummary
from optuna.trial import FrozenTrial
try:
from typing import TypedDict
except ImportError:
+13 -1
View File
@@ -35,6 +35,7 @@ install_requires =
[options.extras_require]
lint =
black
isort
mypy
flake8
@@ -56,4 +57,15 @@ exclude = venv,build,.tox
[mypy]
ignore_missing_imports = True
disallow_untyped_defs = True
disallow_untyped_defs = True
[isort]
profile = black
src_paths =
optuna_dashboard
tests
line_length = 99
lines_after_imports = 2
force_single_line = True
force_sort_within_sections = True
order_by_type = False
+1
View File
@@ -1,4 +1,5 @@
from setuptools import setup
if __name__ == "__main__":
setup()
+2
View File
@@ -2,7 +2,9 @@ import json
from unittest import TestCase
import optuna
from optuna_dashboard.app import create_app
from .wsgi_client import send_request
+1 -1
View File
@@ -1,5 +1,5 @@
import warnings
from unittest import TestCase
import warnings
import optuna
from optuna import create_trial
+1
View File
@@ -1,4 +1,5 @@
from unittest import TestCase
from optuna_dashboard.serializer import serialize_attrs
+9 -1
View File
@@ -1,5 +1,13 @@
import io
from typing import Dict, Optional, Union, Any, Tuple, List, Callable, Iterable
from typing import Any
from typing import Callable
from typing import Dict
from typing import Iterable
from typing import List
from typing import Optional
from typing import Tuple
from typing import Union
WSGIEnv = Dict[str, Any] # Cannot use TypedDict because of 'HTTP_' variables
StartResponse = Callable[[str, List[Tuple[str, str]]], None]
+5
View File
@@ -6,6 +6,7 @@ envlist =
py39
flake8
black
isort
mypy
[testenv:py36]
@@ -32,6 +33,10 @@ commands = flake8 . {posargs}
deps = black
commands = black --check . {posargs}
[testenv:isort]
deps = isort
commands = isort . --check
[testenv:mypy]
deps = mypy
commands = mypy . {posargs}
+7 -4
View File
@@ -1,13 +1,16 @@
import asyncio
import os
import threading
import time
from typing import List
from typing import Tuple
from wsgiref.simple_server import make_server
import optuna
import os
from pyppeteer import launch
from optuna_dashboard.app import create_app
from pyppeteer import launch
from typing import List, Tuple
from wsgiref.simple_server import make_server
host = "127.0.0.1"
port = 8080