Skip to content

Commit ddbecd1

Browse files
committed
[Fix] Fix pre-commit-hook for python3.12
1 parent c46684c commit ddbecd1

File tree

7 files changed

+15
-13
lines changed

7 files changed

+15
-13
lines changed

.github/workflows/lint.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
- name: Set up Python 3.7
1515
uses: actions/setup-python@v2
1616
with:
17-
python-version: 3.7
17+
python-version: 3.10
1818
- name: Install pre-commit hook
1919
run: |
2020
pip install pre-commit

.pre-commit-config-zh-cn.yaml

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
exclude: ^tests/data/
22
repos:
3-
- repo: https://gitee.com/openmmlab/mirrors-flake8
4-
rev: 5.0.4
3+
- repo: https://github.com/PyCQA/flake8
4+
rev: 7.1.1
55
hooks:
66
- id: flake8
77
- repo: https://gitee.com/openmmlab/mirrors-isort
@@ -13,7 +13,7 @@ repos:
1313
hooks:
1414
- id: yapf
1515
- repo: https://gitee.com/openmmlab/mirrors-pre-commit-hooks
16-
rev: v4.3.0
16+
rev: v5.0.0
1717
hooks:
1818
- id: trailing-whitespace
1919
- id: check-yaml
@@ -53,15 +53,16 @@ repos:
5353
hooks:
5454
- id: check-copyright
5555
args: ["mmcv", "tests", "--excludes", "mmcv/ops"]
56-
- repo: https://gitee.com/openmmlab/mirrors-mypy
57-
rev: v0.812
56+
- repo: https://github.com/pre-commit/mirrors-mypy
57+
rev: v1.2.0
5858
hooks:
5959
- id: mypy
6060
exclude: |-
6161
(?x)(
6262
^test
6363
| ^docs
6464
)
65+
additional_dependencies: ["types-setuptools", "types-requests"]
6566
# - repo: local
6667
# hooks:
6768
# - id: clang-format

.pre-commit-config.yaml

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
exclude: ^tests/data/
22
repos:
33
- repo: https://github.com/PyCQA/flake8
4-
rev: 5.0.4
4+
rev: 7.1.1
55
hooks:
66
- id: flake8
77
- repo: https://github.com/PyCQA/isort
@@ -13,7 +13,7 @@ repos:
1313
hooks:
1414
- id: yapf
1515
- repo: https://github.com/pre-commit/pre-commit-hooks
16-
rev: v4.3.0
16+
rev: v5.0.0
1717
hooks:
1818
- id: trailing-whitespace
1919
- id: check-yaml
@@ -54,14 +54,15 @@ repos:
5454
- id: check-copyright
5555
args: ["mmcv", "tests", "--excludes", "mmcv/ops"]
5656
- repo: https://github.com/pre-commit/mirrors-mypy
57-
rev: v0.812
57+
rev: v1.2.0
5858
hooks:
5959
- id: mypy
6060
exclude: |-
6161
(?x)(
6262
^test
6363
| ^docs
6464
)
65+
additional_dependencies: ["types-setuptools", "types-requests"]
6566
# - repo: local
6667
# hooks:
6768
# - id: clang-format

mmcv/ops/iou3d.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def boxes_iou3d(boxes_a: Tensor, boxes_b: Tensor) -> Tensor:
4242
Returns:
4343
torch.Tensor: 3D IoU result with shape (M, N).
4444
"""
45-
assert boxes_a.shape[1] == boxes_b.shape[1] == 7,\
45+
assert boxes_a.shape[1] == boxes_b.shape[1] == 7, \
4646
'Input boxes shape should be (N, 7)'
4747

4848
boxes_a_height_max = (boxes_a[:, 2] + boxes_a[:, 5] / 2).view(-1, 1)

mmcv/transforms/processing.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1457,7 +1457,7 @@ class RandomResize(BaseTransform):
14571457
def __init__(
14581458
self,
14591459
scale: Union[Tuple[int, int], Sequence[Tuple[int, int]]],
1460-
ratio_range: Tuple[float, float] = None,
1460+
ratio_range: Optional[Tuple[float, float]] = None,
14611461
resize_type: str = 'Resize',
14621462
**resize_kwargs,
14631463
) -> None:

mmcv/transforms/wrappers.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ class KeyMapper(BaseTransform):
177177
"""
178178

179179
def __init__(self,
180-
transforms: Union[Transform, List[Transform]] = None,
180+
transforms: Union[Transform, List[Transform], None] = None,
181181
mapping: Optional[Dict] = None,
182182
remapping: Optional[Dict] = None,
183183
auto_remap: Optional[bool] = None,

mmcv/visualization/image.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ def imshow_bboxes(img: Union[str, np.ndarray],
9191
def imshow_det_bboxes(img: Union[str, np.ndarray],
9292
bboxes: np.ndarray,
9393
labels: np.ndarray,
94-
class_names: List[str] = None,
94+
class_names: Optional[List[str]] = None,
9595
score_thr: float = 0,
9696
bbox_color: ColorType = 'green',
9797
text_color: ColorType = 'green',

0 commit comments

Comments
 (0)