[Enhancement] Upgrade isort (#771)

* [Enhancement] Upgrade isort

* Fix files
pull/778/head
Tong Gao 2022-02-09 23:22:14 +08:00 committed by GitHub
parent 00ac7ab850
commit c466e6f82d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 12 additions and 23 deletions

View File

@ -4,12 +4,8 @@ repos:
rev: 4.0.1
hooks:
- id: flake8
- repo: https://github.com/asottile/seed-isort-config
rev: v2.2.0
hooks:
- id: seed-isort-config
- repo: https://github.com/timothycrosley/isort
rev: 4.3.21
- repo: https://github.com/PyCQA/isort
rev: 5.10.1
hooks:
- id: isort
- repo: https://github.com/pre-commit/mirrors-yapf

View File

@ -3,7 +3,6 @@ from argparse import ArgumentParser
from mmocr.apis import init_detector
from mmocr.apis.inference import text_model_inference
from mmocr.datasets import build_dataset # NOQA
from mmocr.models import build_detector # NOQA

View File

@ -1,13 +1,12 @@
# Copyright (c) OpenMMLab. All rights reserved.
from . import evaluation
from .evaluation import * # NOQA
from .mask import extract_boundary, points2boundary, seg2boundary
from .visualize import (det_recog_show_result, imshow_edge, imshow_node,
imshow_pred_boundary, imshow_text_char_boundary,
imshow_text_label, overlay_mask_img, show_feature,
show_img_boundary, show_pred_gt)
from .evaluation import * # NOQA
__all__ = [
'points2boundary', 'seg2boundary', 'extract_boundary', 'overlay_mask_img',
'show_feature', 'show_img_boundary', 'show_pred_gt',

View File

@ -48,6 +48,7 @@ class ONNXRuntimeDetector(TextDetectorMixin, SingleStageTextDetector):
SingleStageTextDetector.__init__(self, **(cfg.model))
TextDetectorMixin.__init__(self, show_score)
import onnxruntime as ort
# get the custom op path
ort_custom_op_path = ''
try:
@ -122,6 +123,7 @@ class ONNXRuntimeRecognizer(EncodeDecodeRecognizer):
cfg.model.pop('type')
EncodeDecodeRecognizer.__init__(self, **(cfg.model))
import onnxruntime as ort
# get the custom op path
ort_custom_op_path = ''
try:

View File

@ -12,7 +12,6 @@ from .openset_kie_dataset import OpensetKIEDataset
from .pipelines import CustomFormatBundle, DBNetTargets, FCENetTargets
from .text_det_dataset import TextDetDataset
from .uniform_concat_dataset import UniformConcatDataset
from .utils import * # NOQA
__all__ = [

View File

@ -4,7 +4,6 @@ from .builder import (BACKBONES, CONVERTORS, DECODERS, DETECTORS, ENCODERS,
HEADS, LOSSES, NECKS, PREPROCESSOR, build_backbone,
build_convertor, build_decoder, build_detector,
build_encoder, build_loss, build_preprocessor)
from .common import * # NOQA
from .kie import * # NOQA
from .ner import * # NOQA

View File

@ -1,9 +1,8 @@
# Copyright (c) OpenMMLab. All rights reserved.
from . import backbones, layers, losses, modules
from .backbones import * # NOQA
from .losses import * # NOQA
from .layers import * # NOQA
from .losses import * # NOQA
from .modules import * # NOQA
__all__ = backbones.__all__ + losses.__all__ + layers.__all__ + modules.__all__

View File

@ -1,6 +1,5 @@
# Copyright (c) OpenMMLab. All rights reserved.
from . import extractors, heads, losses
from .extractors import * # NOQA
from .heads import * # NOQA
from .losses import * # NOQA

View File

@ -1,6 +1,5 @@
# Copyright (c) OpenMMLab. All rights reserved.
from . import classifiers, convertors, decoders, encoders, losses
from .classifiers import * # NOQA
from .convertors import * # NOQA
from .decoders import * # NOQA

View File

@ -1,6 +1,5 @@
# Copyright (c) OpenMMLab. All rights reserved.
from . import dense_heads, detectors, losses, necks, postprocess
from .dense_heads import * # NOQA
from .detectors import * # NOQA
from .losses import * # NOQA

View File

@ -1,17 +1,16 @@
# Copyright (c) OpenMMLab. All rights reserved.
from . import (backbones, convertors, decoders, encoders, fusers, heads,
losses, necks, preprocessor, recognizer)
from .backbones import * # NOQA
from .convertors import * # NOQA
from .decoders import * # NOQA
from .encoders import * # NOQA
from .fusers import * # NOQA
from .heads import * # NOQA
from .losses import * # NOQA
from .necks import * # NOQA
from .preprocessor import * # NOQA
from .recognizer import * # NOQA
from .fusers import * # NOQA
__all__ = (
backbones.__all__ + convertors.__all__ + decoders.__all__ +

View File

@ -18,7 +18,7 @@ SPLIT_PENALTY_AFTER_OPENING_BRACKET=800
[isort]
line_length = 79
multi_line_output = 0
known_standard_library = setuptools
extra_standard_library = setuptools
known_first_party = mmocr
known_third_party = PIL,cv2,imgaug,lanms,lmdb,matplotlib,mmcv,mmdet,numpy,packaging,pyclipper,pytest,pytorch_sphinx_theme,rapidfuzz,requests,scipy,shapely,skimage,titlecase,torch,torchvision,ts,yaml
no_lines_before = STDLIB,LOCALFOLDER

View File

@ -80,6 +80,7 @@ def get_version():
with open(version_file, 'r') as f:
exec(compile(f.read(), version_file, 'exec'))
import sys
# return short version for sdist
if 'sdist' in sys.argv or 'bdist_wheel' in sys.argv:
return locals()['short_version']
@ -99,9 +100,9 @@ def parse_requirements(fname='requirements.txt', with_version=True):
CommandLine:
python -c "import setup; print(setup.parse_requirements())"
"""
import re
import sys
from os.path import exists
import re
require_fpath = fname
def parse_line(line):

View File

@ -23,7 +23,7 @@ def test_detector_wrapper():
try:
import onnxruntime as ort # noqa: F401
import tensorrt as trt
from mmcv.tensorrt import (onnx2trt, save_trt_engine)
from mmcv.tensorrt import onnx2trt, save_trt_engine
except ImportError:
pytest.skip('ONNXRuntime or TensorRT is not available.')
@ -129,7 +129,7 @@ def test_recognizer_wrapper():
try:
import onnxruntime as ort # noqa: F401
import tensorrt as trt
from mmcv.tensorrt import (onnx2trt, save_trt_engine)
from mmcv.tensorrt import onnx2trt, save_trt_engine
except ImportError:
pytest.skip('ONNXRuntime or TensorRT is not available.')

View File

@ -7,7 +7,6 @@ import torch
from ts.torch_handler.base_handler import BaseHandler
from mmocr.apis import init_detector, model_inference
from mmocr.datasets.pipelines import * # NOQA