From e5cd7554810f916d333665dda2adea69e4240893 Mon Sep 17 00:00:00 2001 From: Miao Zheng <76149310+MeowZheng@users.noreply.github.com> Date: Wed, 23 Feb 2022 23:44:27 +0800 Subject: [PATCH] [Enhancement] Revise pre-commit-hooks (#1315) --- .pre-commit-config.yaml | 6 ++++++ demo/video_demo.py | 1 + mmseg/datasets/coco_stuff.py | 1 + mmseg/datasets/dark_zurich.py | 1 + mmseg/datasets/isaid.py | 1 + mmseg/datasets/night_driving.py | 1 + mmseg/models/backbones/icnet.py | 1 + mmseg/models/backbones/twins.py | 1 + mmseg/models/decode_heads/dpt_head.py | 1 + mmseg/models/decode_heads/isa_head.py | 1 + mmseg/models/necks/ic_neck.py | 1 + mmseg/models/utils/__init__.py | 1 + tests/test_apis/test_single_gpu.py | 1 + tests/test_models/test_backbones/test_swin.py | 1 + tests/test_models/test_backbones/test_twins.py | 1 + tests/test_models/test_heads/test_dpt_head.py | 1 + tests/test_models/test_utils/__init__.py | 1 + tools/browse_dataset.py | 1 + tools/convert_datasets/coco_stuff10k.py | 1 + tools/convert_datasets/coco_stuff164k.py | 1 + tools/convert_datasets/isaid.py | 1 + tools/model_converters/vitjax2mmseg.py | 1 + tools/torchserve/test_torchserve.py | 1 + 23 files changed, 28 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 90f7ebab8..9448c7ade 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -49,3 +49,9 @@ repos: language: python files: ^configs/.*\.md$ require_serial: true + - repo: https://github.com/open-mmlab/pre-commit-hooks + rev: v0.2.0 # Use the rev to fix revision + hooks: + - id: check-algo-readme + - id: check-copyright + args: ["mmseg", "tools", "tests", "demo"] # the dir_to_check with expected directory to check diff --git a/demo/video_demo.py b/demo/video_demo.py index acdb531b7..eb4fd6994 100644 --- a/demo/video_demo.py +++ b/demo/video_demo.py @@ -1,3 +1,4 @@ +# Copyright (c) OpenMMLab. All rights reserved. from argparse import ArgumentParser import cv2 diff --git a/mmseg/datasets/coco_stuff.py b/mmseg/datasets/coco_stuff.py index 546a01428..24d089556 100644 --- a/mmseg/datasets/coco_stuff.py +++ b/mmseg/datasets/coco_stuff.py @@ -1,3 +1,4 @@ +# Copyright (c) OpenMMLab. All rights reserved. from .builder import DATASETS from .custom import CustomDataset diff --git a/mmseg/datasets/dark_zurich.py b/mmseg/datasets/dark_zurich.py index efc088f31..0b6fda6e9 100644 --- a/mmseg/datasets/dark_zurich.py +++ b/mmseg/datasets/dark_zurich.py @@ -1,3 +1,4 @@ +# Copyright (c) OpenMMLab. All rights reserved. from .builder import DATASETS from .cityscapes import CityscapesDataset diff --git a/mmseg/datasets/isaid.py b/mmseg/datasets/isaid.py index 2b63d9273..d6108b280 100644 --- a/mmseg/datasets/isaid.py +++ b/mmseg/datasets/isaid.py @@ -1,3 +1,4 @@ +# Copyright (c) OpenMMLab. All rights reserved. import os.path as osp import mmcv diff --git a/mmseg/datasets/night_driving.py b/mmseg/datasets/night_driving.py index a9289a27a..6620586e3 100644 --- a/mmseg/datasets/night_driving.py +++ b/mmseg/datasets/night_driving.py @@ -1,3 +1,4 @@ +# Copyright (c) OpenMMLab. All rights reserved. from .builder import DATASETS from .cityscapes import CityscapesDataset diff --git a/mmseg/models/backbones/icnet.py b/mmseg/models/backbones/icnet.py index 10e542785..6faaeab01 100644 --- a/mmseg/models/backbones/icnet.py +++ b/mmseg/models/backbones/icnet.py @@ -1,3 +1,4 @@ +# Copyright (c) OpenMMLab. All rights reserved. import torch import torch.nn as nn from mmcv.cnn import ConvModule diff --git a/mmseg/models/backbones/twins.py b/mmseg/models/backbones/twins.py index b41325b88..6bd946911 100644 --- a/mmseg/models/backbones/twins.py +++ b/mmseg/models/backbones/twins.py @@ -1,3 +1,4 @@ +# Copyright (c) OpenMMLab. All rights reserved. import math import warnings diff --git a/mmseg/models/decode_heads/dpt_head.py b/mmseg/models/decode_heads/dpt_head.py index a63f9d297..6c895d02d 100644 --- a/mmseg/models/decode_heads/dpt_head.py +++ b/mmseg/models/decode_heads/dpt_head.py @@ -1,3 +1,4 @@ +# Copyright (c) OpenMMLab. All rights reserved. import math import torch diff --git a/mmseg/models/decode_heads/isa_head.py b/mmseg/models/decode_heads/isa_head.py index c9224b610..0bf345557 100644 --- a/mmseg/models/decode_heads/isa_head.py +++ b/mmseg/models/decode_heads/isa_head.py @@ -1,3 +1,4 @@ +# Copyright (c) OpenMMLab. All rights reserved. import math import torch diff --git a/mmseg/models/necks/ic_neck.py b/mmseg/models/necks/ic_neck.py index d836a6b9c..a5d81cef8 100644 --- a/mmseg/models/necks/ic_neck.py +++ b/mmseg/models/necks/ic_neck.py @@ -1,3 +1,4 @@ +# Copyright (c) OpenMMLab. All rights reserved. import torch.nn.functional as F from mmcv.cnn import ConvModule from mmcv.runner import BaseModule diff --git a/mmseg/models/utils/__init__.py b/mmseg/models/utils/__init__.py index 2417c5183..23f59b5d1 100644 --- a/mmseg/models/utils/__init__.py +++ b/mmseg/models/utils/__init__.py @@ -1,3 +1,4 @@ +# Copyright (c) OpenMMLab. All rights reserved. from .embed import PatchEmbed from .inverted_residual import InvertedResidual, InvertedResidualV3 from .make_divisible import make_divisible diff --git a/tests/test_apis/test_single_gpu.py b/tests/test_apis/test_single_gpu.py index b741896e5..0b484f201 100644 --- a/tests/test_apis/test_single_gpu.py +++ b/tests/test_apis/test_single_gpu.py @@ -1,3 +1,4 @@ +# Copyright (c) OpenMMLab. All rights reserved. import shutil from unittest.mock import MagicMock diff --git a/tests/test_models/test_backbones/test_swin.py b/tests/test_models/test_backbones/test_swin.py index 4690001d3..8d14d47ab 100644 --- a/tests/test_models/test_backbones/test_swin.py +++ b/tests/test_models/test_backbones/test_swin.py @@ -1,3 +1,4 @@ +# Copyright (c) OpenMMLab. All rights reserved. import pytest import torch diff --git a/tests/test_models/test_backbones/test_twins.py b/tests/test_models/test_backbones/test_twins.py index c7d4a8eb5..aa3eaf9f4 100644 --- a/tests/test_models/test_backbones/test_twins.py +++ b/tests/test_models/test_backbones/test_twins.py @@ -1,3 +1,4 @@ +# Copyright (c) OpenMMLab. All rights reserved. import pytest import torch diff --git a/tests/test_models/test_heads/test_dpt_head.py b/tests/test_models/test_heads/test_dpt_head.py index d8cd8b028..0a6af610e 100644 --- a/tests/test_models/test_heads/test_dpt_head.py +++ b/tests/test_models/test_heads/test_dpt_head.py @@ -1,3 +1,4 @@ +# Copyright (c) OpenMMLab. All rights reserved. import pytest import torch diff --git a/tests/test_models/test_utils/__init__.py b/tests/test_models/test_utils/__init__.py index e69de29bb..ef101fec6 100644 --- a/tests/test_models/test_utils/__init__.py +++ b/tests/test_models/test_utils/__init__.py @@ -0,0 +1 @@ +# Copyright (c) OpenMMLab. All rights reserved. diff --git a/tools/browse_dataset.py b/tools/browse_dataset.py index d46487bf2..0aa9430ea 100644 --- a/tools/browse_dataset.py +++ b/tools/browse_dataset.py @@ -1,3 +1,4 @@ +# Copyright (c) OpenMMLab. All rights reserved. import argparse import os import warnings diff --git a/tools/convert_datasets/coco_stuff10k.py b/tools/convert_datasets/coco_stuff10k.py index 4f0fd5306..374f81970 100644 --- a/tools/convert_datasets/coco_stuff10k.py +++ b/tools/convert_datasets/coco_stuff10k.py @@ -1,3 +1,4 @@ +# Copyright (c) OpenMMLab. All rights reserved. import argparse import os.path as osp import shutil diff --git a/tools/convert_datasets/coco_stuff164k.py b/tools/convert_datasets/coco_stuff164k.py index 4533bf53b..6d8e2f2a3 100644 --- a/tools/convert_datasets/coco_stuff164k.py +++ b/tools/convert_datasets/coco_stuff164k.py @@ -1,3 +1,4 @@ +# Copyright (c) OpenMMLab. All rights reserved. import argparse import os.path as osp import shutil diff --git a/tools/convert_datasets/isaid.py b/tools/convert_datasets/isaid.py index e641ef828..ff2ce2fcf 100644 --- a/tools/convert_datasets/isaid.py +++ b/tools/convert_datasets/isaid.py @@ -1,3 +1,4 @@ +# Copyright (c) OpenMMLab. All rights reserved. import argparse import glob import os diff --git a/tools/model_converters/vitjax2mmseg.py b/tools/model_converters/vitjax2mmseg.py index e3a0986ac..585f40836 100644 --- a/tools/model_converters/vitjax2mmseg.py +++ b/tools/model_converters/vitjax2mmseg.py @@ -1,3 +1,4 @@ +# Copyright (c) OpenMMLab. All rights reserved. import argparse import os.path as osp diff --git a/tools/torchserve/test_torchserve.py b/tools/torchserve/test_torchserve.py index 59752853f..432834a8d 100644 --- a/tools/torchserve/test_torchserve.py +++ b/tools/torchserve/test_torchserve.py @@ -1,3 +1,4 @@ +# Copyright (c) OpenMMLab. All rights reserved. from argparse import ArgumentParser from io import BytesIO