Skip to content

Commit

Permalink
[Fix] Fix pre-commit-hook for python3.12
Browse files Browse the repository at this point in the history
  • Loading branch information
HAOCHENYE committed Nov 1, 2024
1 parent c46684c commit 24726cd
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 8 deletions.
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down Expand Up @@ -54,15 +54,15 @@ 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: |-
(?x)(
^test
| ^docs
)
# - repo: local
additional_dependencies: ["types-setuptools", "types-requests"]
# hooks:
# - id: clang-format
# name: clang-format
Expand Down
2 changes: 1 addition & 1 deletion mmcv/ops/iou3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion mmcv/transforms/processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion mmcv/transforms/wrappers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion mmcv/visualization/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
3 changes: 3 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,6 @@ default_section = THIRDPARTY
[codespell]
quiet-level = 3
ignore-words-list = inout,hist,ba,ro,inh

[mypy]
ignore_missing_imports = true

0 comments on commit 24726cd

Please sign in to comment.