Skip to content

Commit

Permalink
[Enhancement] Upgrade isort in pre-commit hook (#1217)
Browse files Browse the repository at this point in the history
* update isort

* update setuptools

* fix

* pre-commit run --all-files
  • Loading branch information
ZCMax authored Feb 9, 2022
1 parent 53488da commit 6f1a268
Show file tree
Hide file tree
Showing 122 changed files with 276 additions and 157 deletions.
5 changes: 3 additions & 2 deletions .dev_scripts/gather_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,13 @@
import argparse
import glob
import json
import mmcv
import shutil
import subprocess
import torch
from os import path as osp

import mmcv
import torch

# build schedule look-up table to automatically find the final model
SCHEDULES_LUT = {
'_1x_': 12,
Expand Down
8 changes: 2 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,8 @@ repos:
rev: 3.8.3
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: 5.0.2
- repo: https://github.com/PyCQA/isort
rev: 5.10.1
hooks:
- id: isort
- repo: https://github.com/pre-commit/mirrors-yapf
Expand Down
2 changes: 1 addition & 1 deletion configs/pgd/metafile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Models:
Metrics:
mAP: 18.33
Weights: https://download.openmmlab.com/mmdetection3d/v1.0.0_models/pgd/pgd_r101_caffe_fpn_gn-head_3x4_4x_kitti-mono3d/pgd_r101_caffe_fpn_gn-head_3x4_4x_kitti-mono3d_20211022_102608-8a97533b.pth

- Name: pgd_r101_caffe_fpn_gn-head_2x16_1x_nus-mono3d
In Collection: PGD
Config: configs/pgd/pgd_r101_caffe_fpn_gn-head_2x16_1x_nus-mono3d.py
Expand Down
3 changes: 2 additions & 1 deletion data/s3dis/collect_indoor3d_data.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import argparse
from os import path as osp

import mmcv
from indoor3d_util import export
from os import path as osp

parser = argparse.ArgumentParser()
parser.add_argument(
Expand Down
3 changes: 2 additions & 1 deletion data/s3dis/indoor3d_util.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import glob
import numpy as np
from os import path as osp

import numpy as np

# -----------------------------------------------------------------------------
# CONSTANTS
# -----------------------------------------------------------------------------
Expand Down
5 changes: 3 additions & 2 deletions data/scannet/batch_load_scannet_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@
"""
import argparse
import datetime
import numpy as np
import os
from load_scannet_data import export
from os import path as osp

import numpy as np
from load_scannet_data import export

DONOTCARE_CLASS_IDS = np.array([])
OBJ_CLASS_IDS = np.array(
[3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14, 16, 24, 28, 33, 34, 36, 39])
Expand Down
7 changes: 4 additions & 3 deletions data/scannet/extract_posed_images.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
# Modified from https://github.com/ScanNet/ScanNet/blob/master/SensReader/python/SensorData.py # noqa
import imageio
import mmcv
import numpy as np
import os
import struct
import zlib
from argparse import ArgumentParser
from functools import partial

import imageio
import mmcv
import numpy as np

COMPRESSION_TYPE_COLOR = {-1: 'unknown', 0: 'raw', 1: 'png', 2: 'jpeg'}

COMPRESSION_TYPE_DEPTH = {
Expand Down
3 changes: 2 additions & 1 deletion data/scannet/load_scannet_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@
import argparse
import inspect
import json
import numpy as np
import os

import numpy as np
import scannet_utils

currentdir = os.path.dirname(
Expand Down
3 changes: 2 additions & 1 deletion data/scannet/scannet_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@
"""

import csv
import numpy as np
import os

import numpy as np
from plyfile import PlyData


Expand Down
3 changes: 2 additions & 1 deletion docs/en/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
import os
import pytorch_sphinx_theme
import subprocess
import sys

import pytorch_sphinx_theme
from m2r import MdInclude
from recommonmark.transform import AutoStructify
from sphinx.builders.html import StandaloneHTMLBuilder
Expand Down
3 changes: 2 additions & 1 deletion docs/en/stat.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
#!/usr/bin/env python
import functools as func
import glob
import numpy as np
import re
from os import path as osp

import numpy as np

url_prefix = 'https://github.com/open-mmlab/mmdetection3d/blob/master/'

files = sorted(glob.glob('../configs/*/README.md'))
Expand Down
3 changes: 2 additions & 1 deletion docs/zh_cn/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
import os
import pytorch_sphinx_theme
import subprocess
import sys

import pytorch_sphinx_theme
from m2r import MdInclude
from recommonmark.transform import AutoStructify
from sphinx.builders.html import StandaloneHTMLBuilder
Expand Down
3 changes: 2 additions & 1 deletion docs/zh_cn/stat.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
#!/usr/bin/env python
import functools as func
import glob
import numpy as np
import re
from os import path as osp

import numpy as np

url_prefix = 'https://github.com/open-mmlab/mmdetection3d/blob/master/'

files = sorted(glob.glob('../configs/*/README.md'))
Expand Down
7 changes: 4 additions & 3 deletions mmdet3d/apis/inference.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
# Copyright (c) OpenMMLab. All rights reserved.
import re
from copy import deepcopy
from os import path as osp

import mmcv
import numpy as np
import re
import torch
from copy import deepcopy
from mmcv.parallel import collate, scatter
from mmcv.runner import load_checkpoint
from os import path as osp

from mmdet3d.core import (Box3DMode, CameraInstance3DBoxes, Coord3DMode,
DepthInstance3DBoxes, LiDARInstance3DBoxes,
Expand Down
3 changes: 2 additions & 1 deletion mmdet3d/apis/test.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# Copyright (c) OpenMMLab. All rights reserved.
from os import path as osp

import mmcv
import torch
from mmcv.image import tensor2imgs
from os import path as osp

from mmdet3d.models import (Base3DDetector, Base3DSegmentor,
SingleStageMono3DDetector)
Expand Down
5 changes: 3 additions & 2 deletions mmdet3d/core/bbox/structures/base_box3d.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# Copyright (c) OpenMMLab. All rights reserved.
import numpy as np
import torch
import warnings
from abc import abstractmethod

import numpy as np
import torch

from mmdet3d.ops import points_in_boxes_all, points_in_boxes_part
from mmdet3d.ops.iou3d import iou3d_cuda
from .utils import limit_period, xywhr2xyxyr
Expand Down
3 changes: 2 additions & 1 deletion mmdet3d/core/bbox/structures/box_3d_mode.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Copyright (c) OpenMMLab. All rights reserved.
from enum import IntEnum, unique

import numpy as np
import torch
from enum import IntEnum, unique

from .base_box3d import BaseInstance3DBoxes
from .cam_box3d import CameraInstance3DBoxes
Expand Down
3 changes: 2 additions & 1 deletion mmdet3d/core/bbox/structures/coord_3d_mode.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Copyright (c) OpenMMLab. All rights reserved.
from enum import IntEnum, unique

import numpy as np
import torch
from enum import IntEnum, unique

from ...points import BasePoints, CameraPoints, DepthPoints, LiDARPoints
from .base_box3d import BaseInstance3DBoxes
Expand Down
3 changes: 2 additions & 1 deletion mmdet3d/core/bbox/structures/utils.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Copyright (c) OpenMMLab. All rights reserved.
from logging import warning

import numpy as np
import torch
from logging import warning

from mmdet3d.core.utils import array_converter

Expand Down
1 change: 1 addition & 0 deletions mmdet3d/core/evaluation/kitti_utils/eval.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Copyright (c) OpenMMLab. All rights reserved.
import gc
import io as sysio

import numba
import numpy as np

Expand Down
1 change: 1 addition & 0 deletions mmdet3d/core/evaluation/kitti_utils/rotate_iou.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
# Author: yanyan, scrin@foxmail.com
#####################
import math

import numba
import numpy as np
from numba import cuda
Expand Down
3 changes: 2 additions & 1 deletion mmdet3d/core/evaluation/lyft_eval.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Copyright (c) OpenMMLab. All rights reserved.
from os import path as osp

import mmcv
import numpy as np
from lyft_dataset_sdk.eval.detection.mAP_evaluation import (Box3D, get_ap,
Expand All @@ -7,7 +9,6 @@
group_by_key,
wrap_in_box)
from mmcv.utils import print_log
from os import path as osp
from terminaltables import AsciiTable


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@
'Please run "pip install waymo-open-dataset-tf-2-1-0==1.2.0" '
'to install the official devkit first.')

from glob import glob
from os.path import join

import mmcv
import numpy as np
import tensorflow as tf
from glob import glob
from os.path import join
from waymo_open_dataset import label_pb2
from waymo_open_dataset.protos import metrics_pb2

Expand Down
5 changes: 3 additions & 2 deletions mmdet3d/core/points/base_points.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# Copyright (c) OpenMMLab. All rights reserved.
import numpy as np
import torch
import warnings
from abc import abstractmethod

import numpy as np
import torch

from ..bbox.structures.utils import rotation_3d_in_axis


Expand Down
3 changes: 2 additions & 1 deletion mmdet3d/core/utils/array_converter.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# Copyright (c) OpenMMLab. All rights reserved.
import functools
from inspect import getfullargspec

import numpy as np
import torch
from inspect import getfullargspec


def array_converter(to_torch=True,
Expand Down
1 change: 1 addition & 0 deletions mmdet3d/core/visualizer/image_vis.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Copyright (c) OpenMMLab. All rights reserved.
import copy

import cv2
import numpy as np
import torch
Expand Down
1 change: 1 addition & 0 deletions mmdet3d/core/visualizer/open3d_vis.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Copyright (c) OpenMMLab. All rights reserved.
import copy

import numpy as np
import torch

Expand Down
3 changes: 2 additions & 1 deletion mmdet3d/core/visualizer/show_result.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# Copyright (c) OpenMMLab. All rights reserved.
from os import path as osp

import mmcv
import numpy as np
import trimesh
from os import path as osp

from .image_vis import (draw_camera_bbox3d_on_img, draw_depth_bbox3d_on_img,
draw_lidar_bbox3d_on_img)
Expand Down
1 change: 1 addition & 0 deletions mmdet3d/datasets/builder.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Copyright (c) OpenMMLab. All rights reserved.
import platform

from mmcv.utils import Registry, build_from_cfg

from mmdet.datasets import DATASETS
Expand Down
5 changes: 3 additions & 2 deletions mmdet3d/datasets/custom_3d.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# Copyright (c) OpenMMLab. All rights reserved.
import mmcv
import numpy as np
import tempfile
import warnings
from os import path as osp

import mmcv
import numpy as np
from torch.utils.data import Dataset

from mmdet.datasets import DATASETS
Expand Down
5 changes: 3 additions & 2 deletions mmdet3d/datasets/custom_3d_seg.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# Copyright (c) OpenMMLab. All rights reserved.
import mmcv
import numpy as np
import tempfile
import warnings
from os import path as osp

import mmcv
import numpy as np
from torch.utils.data import Dataset

from mmdet.datasets import DATASETS
Expand Down
7 changes: 4 additions & 3 deletions mmdet3d/datasets/kitti_dataset.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
# Copyright (c) OpenMMLab. All rights reserved.
import copy
import mmcv
import numpy as np
import os
import tempfile
from os import path as osp

import mmcv
import numpy as np
import torch
from mmcv.utils import print_log
from os import path as osp

from mmdet.datasets import DATASETS
from ..core import show_multi_modality_result, show_result
Expand Down
5 changes: 3 additions & 2 deletions mmdet3d/datasets/kitti_mono_dataset.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
# Copyright (c) OpenMMLab. All rights reserved.
import copy
import tempfile
from os import path as osp

import mmcv
import numpy as np
import tempfile
import torch
from mmcv.utils import print_log
from os import path as osp

from mmdet.datasets import DATASETS
from ..core.bbox import Box3DMode, CameraInstance3DBoxes, points_cam2img
Expand Down
Loading

0 comments on commit 6f1a268

Please sign in to comment.