diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index ac5afd597a..9a1677a9d4 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -14,7 +14,7 @@ jobs: - name: Set up Python 3.7 uses: actions/setup-python@v2 with: - python-version: 3.7 + python-version: 3.10.15 - name: Install pre-commit hook run: | pip install pre-commit diff --git a/.pre-commit-config-zh-cn.yaml b/.pre-commit-config-zh-cn.yaml index 313c83c84b..ee604e0d60 100644 --- a/.pre-commit-config-zh-cn.yaml +++ b/.pre-commit-config-zh-cn.yaml @@ -1,7 +1,7 @@ exclude: ^tests/data/ repos: - - repo: https://gitee.com/openmmlab/mirrors-flake8 - rev: 5.0.4 + - repo: https://github.com/PyCQA/flake8 + rev: 7.1.1 hooks: - id: flake8 - repo: https://gitee.com/openmmlab/mirrors-isort @@ -13,7 +13,7 @@ repos: hooks: - id: yapf - repo: https://gitee.com/openmmlab/mirrors-pre-commit-hooks - rev: v4.3.0 + rev: v5.0.0 hooks: - id: trailing-whitespace - id: check-yaml @@ -53,8 +53,8 @@ repos: hooks: - id: check-copyright args: ["mmcv", "tests", "--excludes", "mmcv/ops"] - - repo: https://gitee.com/openmmlab/mirrors-mypy - rev: v0.812 + - repo: https://github.com/pre-commit/mirrors-mypy + rev: v1.2.0 hooks: - id: mypy exclude: |- @@ -62,6 +62,7 @@ repos: ^test | ^docs ) + additional_dependencies: ["types-setuptools", "types-requests"] # - repo: local # hooks: # - id: clang-format diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 76ded556f9..7cc75d290b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,7 +1,7 @@ exclude: ^tests/data/ repos: - repo: https://github.com/PyCQA/flake8 - rev: 5.0.4 + rev: 7.1.1 hooks: - id: flake8 - repo: https://github.com/PyCQA/isort @@ -13,7 +13,7 @@ repos: hooks: - id: yapf - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.3.0 + rev: v5.0.0 hooks: - id: trailing-whitespace - id: check-yaml @@ -54,7 +54,7 @@ repos: - id: check-copyright args: ["mmcv", "tests", "--excludes", "mmcv/ops"] - repo: https://github.com/pre-commit/mirrors-mypy - rev: v0.812 + rev: v1.2.0 hooks: - id: mypy exclude: |- @@ -62,6 +62,7 @@ repos: ^test | ^docs ) + additional_dependencies: ["types-setuptools", "types-requests"] # - repo: local # hooks: # - id: clang-format diff --git a/mmcv/ops/iou3d.py b/mmcv/ops/iou3d.py index 94e2057ad2..dd47993917 100755 --- a/mmcv/ops/iou3d.py +++ b/mmcv/ops/iou3d.py @@ -42,7 +42,7 @@ def boxes_iou3d(boxes_a: Tensor, boxes_b: Tensor) -> Tensor: Returns: torch.Tensor: 3D IoU result with shape (M, N). """ - assert boxes_a.shape[1] == boxes_b.shape[1] == 7,\ + assert boxes_a.shape[1] == boxes_b.shape[1] == 7, \ 'Input boxes shape should be (N, 7)' boxes_a_height_max = (boxes_a[:, 2] + boxes_a[:, 5] / 2).view(-1, 1) diff --git a/mmcv/transforms/processing.py b/mmcv/transforms/processing.py index 8b65b112b6..d490745a65 100644 --- a/mmcv/transforms/processing.py +++ b/mmcv/transforms/processing.py @@ -1457,7 +1457,7 @@ class RandomResize(BaseTransform): def __init__( self, scale: Union[Tuple[int, int], Sequence[Tuple[int, int]]], - ratio_range: Tuple[float, float] = None, + ratio_range: Optional[Tuple[float, float]] = None, resize_type: str = 'Resize', **resize_kwargs, ) -> None: diff --git a/mmcv/transforms/wrappers.py b/mmcv/transforms/wrappers.py index 27e07d6335..ed20449d1e 100644 --- a/mmcv/transforms/wrappers.py +++ b/mmcv/transforms/wrappers.py @@ -177,7 +177,7 @@ class KeyMapper(BaseTransform): """ def __init__(self, - transforms: Union[Transform, List[Transform]] = None, + transforms: Union[Transform, List[Transform], None] = None, mapping: Optional[Dict] = None, remapping: Optional[Dict] = None, auto_remap: Optional[bool] = None, diff --git a/mmcv/visualization/image.py b/mmcv/visualization/image.py index e7ac4c1817..0c4624aabd 100644 --- a/mmcv/visualization/image.py +++ b/mmcv/visualization/image.py @@ -91,7 +91,7 @@ def imshow_bboxes(img: Union[str, np.ndarray], def imshow_det_bboxes(img: Union[str, np.ndarray], bboxes: np.ndarray, labels: np.ndarray, - class_names: List[str] = None, + class_names: Optional[List[str]] = None, score_thr: float = 0, bbox_color: ColorType = 'green', text_color: ColorType = 'green',