[Enhancement] Upgrade isort in pre-commit hook (#1270)
parent
0d978a8822
commit
d4f5bb25fc
|
@ -3,13 +3,8 @@ repos:
|
||||||
rev: 3.8.3
|
rev: 3.8.3
|
||||||
hooks:
|
hooks:
|
||||||
- id: flake8
|
- id: flake8
|
||||||
- repo: https://github.com/asottile/seed-isort-config
|
- repo: https://github.com/PyCQA/isort
|
||||||
rev: v2.2.0
|
rev: 5.10.1
|
||||||
hooks:
|
|
||||||
- id: seed-isort-config
|
|
||||||
args: ["--exclude", ".dev"]
|
|
||||||
- repo: https://github.com/timothycrosley/isort
|
|
||||||
rev: 4.3.21
|
|
||||||
hooks:
|
hooks:
|
||||||
- id: isort
|
- id: isort
|
||||||
- repo: https://github.com/pre-commit/mirrors-yapf
|
- repo: https://github.com/pre-commit/mirrors-yapf
|
||||||
|
|
|
@ -64,8 +64,8 @@ def _concat_dataset(cfg, default_args=None):
|
||||||
|
|
||||||
def build_dataset(cfg, default_args=None):
|
def build_dataset(cfg, default_args=None):
|
||||||
"""Build datasets."""
|
"""Build datasets."""
|
||||||
from .dataset_wrappers import (ConcatDataset, RepeatDataset,
|
from .dataset_wrappers import (ConcatDataset, MultiImageMixDataset,
|
||||||
MultiImageMixDataset)
|
RepeatDataset)
|
||||||
if isinstance(cfg, (list, tuple)):
|
if isinstance(cfg, (list, tuple)):
|
||||||
dataset = ConcatDataset([build_dataset(c, default_args) for c in cfg])
|
dataset = ConcatDataset([build_dataset(c, default_args) for c in cfg])
|
||||||
elif cfg['type'] == 'RepeatDataset':
|
elif cfg['type'] == 'RepeatDataset':
|
||||||
|
|
|
@ -6,7 +6,7 @@ split_before_expression_after_opening_paren = true
|
||||||
[isort]
|
[isort]
|
||||||
line_length = 79
|
line_length = 79
|
||||||
multi_line_output = 0
|
multi_line_output = 0
|
||||||
known_standard_library = setuptools
|
extra_standard_library = setuptools
|
||||||
known_first_party = mmseg
|
known_first_party = mmseg
|
||||||
known_third_party = PIL,cityscapesscripts,cv2,detail,matplotlib,mmcv,numpy,onnxruntime,packaging,prettytable,pytest,pytorch_sphinx_theme,requests,scipy,seaborn,torch,ts
|
known_third_party = PIL,cityscapesscripts,cv2,detail,matplotlib,mmcv,numpy,onnxruntime,packaging,prettytable,pytest,pytorch_sphinx_theme,requests,scipy,seaborn,torch,ts
|
||||||
no_lines_before = STDLIB,LOCALFOLDER
|
no_lines_before = STDLIB,LOCALFOLDER
|
||||||
|
|
|
@ -66,9 +66,10 @@ def test_config_data_pipeline():
|
||||||
CommandLine:
|
CommandLine:
|
||||||
xdoctest -m tests/test_config.py test_config_build_data_pipeline
|
xdoctest -m tests/test_config.py test_config_build_data_pipeline
|
||||||
"""
|
"""
|
||||||
from mmcv import Config
|
|
||||||
from mmseg.datasets.pipelines import Compose
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
from mmcv import Config
|
||||||
|
|
||||||
|
from mmseg.datasets.pipelines import Compose
|
||||||
|
|
||||||
config_dpath = _get_config_directory()
|
config_dpath = _get_config_directory()
|
||||||
print('Found config_dpath = {!r}'.format(config_dpath))
|
print('Found config_dpath = {!r}'.format(config_dpath))
|
||||||
|
|
|
@ -308,9 +308,10 @@ def test_mean_fscore():
|
||||||
|
|
||||||
|
|
||||||
def test_filename_inputs():
|
def test_filename_inputs():
|
||||||
import cv2
|
|
||||||
import tempfile
|
import tempfile
|
||||||
|
|
||||||
|
import cv2
|
||||||
|
|
||||||
def save_arr(input_arrays: list, title: str, is_image: bool, dir: str):
|
def save_arr(input_arrays: list, title: str, is_image: bool, dir: str):
|
||||||
filenames = []
|
filenames = []
|
||||||
SUFFIX = '.png' if is_image else '.npy'
|
SUFFIX = '.png' if is_image else '.npy'
|
||||||
|
|
|
@ -30,6 +30,7 @@ def test_ce_loss():
|
||||||
# test loss with class weights from file
|
# test loss with class weights from file
|
||||||
import os
|
import os
|
||||||
import tempfile
|
import tempfile
|
||||||
|
|
||||||
import mmcv
|
import mmcv
|
||||||
import numpy as np
|
import numpy as np
|
||||||
tmp_file = tempfile.NamedTemporaryFile()
|
tmp_file = tempfile.NamedTemporaryFile()
|
||||||
|
|
|
@ -21,6 +21,7 @@ def test_dice_lose():
|
||||||
# test loss with class weights from file
|
# test loss with class weights from file
|
||||||
import os
|
import os
|
||||||
import tempfile
|
import tempfile
|
||||||
|
|
||||||
import mmcv
|
import mmcv
|
||||||
import numpy as np
|
import numpy as np
|
||||||
tmp_file = tempfile.NamedTemporaryFile()
|
tmp_file = tempfile.NamedTemporaryFile()
|
||||||
|
|
|
@ -51,6 +51,7 @@ def test_lovasz_loss():
|
||||||
# test loss with class weights from file
|
# test loss with class weights from file
|
||||||
import os
|
import os
|
||||||
import tempfile
|
import tempfile
|
||||||
|
|
||||||
import mmcv
|
import mmcv
|
||||||
import numpy as np
|
import numpy as np
|
||||||
tmp_file = tempfile.NamedTemporaryFile()
|
tmp_file = tempfile.NamedTemporaryFile()
|
||||||
|
|
|
@ -242,8 +242,9 @@ def pytorch2onnx(model,
|
||||||
None, {net_feed_input[0]: img_list[0].detach().numpy()})[0][0]
|
None, {net_feed_input[0]: img_list[0].detach().numpy()})[0][0]
|
||||||
# show segmentation results
|
# show segmentation results
|
||||||
if show:
|
if show:
|
||||||
import cv2
|
|
||||||
import os.path as osp
|
import os.path as osp
|
||||||
|
|
||||||
|
import cv2
|
||||||
img = img_meta_list[0][0]['filename']
|
img = img_meta_list[0][0]['filename']
|
||||||
if not osp.exists(img):
|
if not osp.exists(img):
|
||||||
img = imgs[0][:3, ...].permute(1, 2, 0) * 255
|
img = imgs[0][:3, ...].permute(1, 2, 0) * 255
|
||||||
|
|
Loading…
Reference in New Issue