Skip to content

Commit

Permalink
Add copyright pre-commit-hook (#1742)
Browse files Browse the repository at this point in the history
* first commit

* Add copyright pre-commit-hook
  • Loading branch information
zhouzaida authored Feb 24, 2022
1 parent 0a8e67f commit 6e9ce18
Show file tree
Hide file tree
Showing 119 changed files with 124 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ repos:
hooks:
- id: docformatter
args: ["--in-place", "--wrap-descriptions", "79"]

- repo: https://github.com/open-mmlab/pre-commit-hooks
rev: v0.2.0 # Use the ref you want to point at
hooks:
- id: check-copyright
args: ["mmcv", "tests", "--excludes", "mmcv/ops"]
# - repo: local
# hooks:
# - id: clang-format
Expand Down
1 change: 1 addition & 0 deletions mmcv/cnn/bricks/plugin.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright (c) OpenMMLab. All rights reserved.
import inspect
import platform

Expand Down
1 change: 1 addition & 0 deletions mmcv/cnn/utils/sync_bn.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright (c) OpenMMLab. All rights reserved.
import torch

import mmcv
Expand Down
1 change: 1 addition & 0 deletions mmcv/runner/default_constructor.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright (c) OpenMMLab. All rights reserved.
from .builder import RUNNER_BUILDERS, RUNNERS


Expand Down
1 change: 1 addition & 0 deletions mmcv/tensorrt/preprocess.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright (c) OpenMMLab. All rights reserved.
import numpy as np
import onnx

Expand Down
1 change: 1 addition & 0 deletions mmcv/utils/hub.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright (c) OpenMMLab. All rights reserved.
# The 1.6 release of PyTorch switched torch.save to use a new zipfile-based
# file format. It will cause RuntimeError when a checkpoint was saved in
# torch >= 1.6.0 but loaded in torch < 1.7.0.
Expand Down
1 change: 1 addition & 0 deletions mmcv/utils/trace.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright (c) OpenMMLab. All rights reserved.
import warnings

import torch
Expand Down
1 change: 1 addition & 0 deletions tests/data/config/a.b.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright (c) OpenMMLab. All rights reserved.
item1 = [1, 2]
item2 = {'a': 0}
item3 = True
Expand Down
1 change: 1 addition & 0 deletions tests/data/config/a.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright (c) OpenMMLab. All rights reserved.
item1 = [1, 2]
item2 = {'a': 0}
item3 = True
Expand Down
1 change: 1 addition & 0 deletions tests/data/config/base.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright (c) OpenMMLab. All rights reserved.
item1 = [1, 2]
item2 = {'a': 0}
item3 = True
Expand Down
1 change: 1 addition & 0 deletions tests/data/config/code.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright (c) OpenMMLab. All rights reserved.
from mmcv import Config # isort:skip

cfg = Config.fromfile('./tests/data/config/a.py')
Expand Down
1 change: 1 addition & 0 deletions tests/data/config/d.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright (c) OpenMMLab. All rights reserved.
_base_ = './base.py'
item1 = [2, 3]
item2 = {'a': 1}
Expand Down
1 change: 1 addition & 0 deletions tests/data/config/delete.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright (c) OpenMMLab. All rights reserved.
_base_ = './base.py'
item1 = {'a': 0, '_delete_': True}
item2 = {'b': 0}
1 change: 1 addition & 0 deletions tests/data/config/deprecated.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright (c) OpenMMLab. All rights reserved.
_base_ = './expected.py'

_deprecation_ = dict(
Expand Down
1 change: 1 addition & 0 deletions tests/data/config/deprecated_as_base.py
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
# Copyright (c) OpenMMLab. All rights reserved.
_base_ = './deprecated.py'
1 change: 1 addition & 0 deletions tests/data/config/e.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# Copyright (c) OpenMMLab. All rights reserved.
_base_ = './base.py'
item3 = {'a': 1}
1 change: 1 addition & 0 deletions tests/data/config/expected.py
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
# Copyright (c) OpenMMLab. All rights reserved.
item1 = 'expected'
1 change: 1 addition & 0 deletions tests/data/config/f.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# Copyright (c) OpenMMLab. All rights reserved.
_base_ = './d.py'
item4 = 'test_recursive_bases'
1 change: 1 addition & 0 deletions tests/data/config/g.py
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
# Copyright (c) OpenMMLab. All rights reserved.
filename = 'reserved.py'
1 change: 1 addition & 0 deletions tests/data/config/h.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright (c) OpenMMLab. All rights reserved.
item1 = '{{fileBasename}}'
item2 = '{{ fileDirname}}'
item3 = 'abc_{{ fileBasenameNoExtension }}'
1 change: 1 addition & 0 deletions tests/data/config/i_base.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright (c) OpenMMLab. All rights reserved.
item1 = [1, 2]
item2 = {'a': 0}
item3 = True
Expand Down
1 change: 1 addition & 0 deletions tests/data/config/i_child.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright (c) OpenMMLab. All rights reserved.
_base_ = './i_base.py'
item_cfg = {'b': 2}
item6 = {'cfg': item_cfg}
1 change: 1 addition & 0 deletions tests/data/config/l.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright (c) OpenMMLab. All rights reserved.
_base_ = ['./l1.py', './l2.yaml', './l3.json', './l4.py']
item3 = False
item4 = 'test'
1 change: 1 addition & 0 deletions tests/data/config/l1.py
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
# Copyright (c) OpenMMLab. All rights reserved.
item1 = [1, 2]
1 change: 1 addition & 0 deletions tests/data/config/l4.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright (c) OpenMMLab. All rights reserved.
item5 = dict(a=0, b=1)
item6 = [dict(a=0), dict(b=1)]
item7 = dict(a=[0, 1, 2], b=dict(c=[3.1, 4.2, 5.3]))
1 change: 1 addition & 0 deletions tests/data/config/m.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright (c) OpenMMLab. All rights reserved.
_base_ = ['./l1.py', './l2.yaml', './l3.json', 'a.py']
item3 = False
item4 = 'test'
1 change: 1 addition & 0 deletions tests/data/config/n.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright (c) OpenMMLab. All rights reserved.
test_item1 = [1, 2]
bool_item2 = True
str_item3 = 'test'
Expand Down
1 change: 1 addition & 0 deletions tests/data/config/q.py
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
# Copyright (c) OpenMMLab. All rights reserved.
custom_imports = dict(imports=['r'], allow_failed_imports=False)
1 change: 1 addition & 0 deletions tests/data/config/r.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright (c) OpenMMLab. All rights reserved.
import os

os.environ["TEST_VALUE"] = 'test'
1 change: 1 addition & 0 deletions tests/data/config/s.py
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
# Copyright (c) OpenMMLab. All rights reserved.
item = [{'a': 0}, {'b': 0, 'c': 0}]
1 change: 1 addition & 0 deletions tests/data/config/t.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright (c) OpenMMLab. All rights reserved.
_base_ = ['./l1.py', './l2.yaml', './l3.json', './l4.py']
item3 = False
item4 = 'test'
Expand Down
1 change: 1 addition & 0 deletions tests/data/config/u.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright (c) OpenMMLab. All rights reserved.
_base_ = ['./t.py']
base = '_base_.item8'
item11 = {{ _base_.item8 }}
Expand Down
1 change: 1 addition & 0 deletions tests/data/config/v.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright (c) OpenMMLab. All rights reserved.
_base_ = ['./u.py']
item21 = {{ _base_.item11 }}
item22 = item21
Expand Down
1 change: 1 addition & 0 deletions tests/data/scripts/hello.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright (c) OpenMMLab. All rights reserved.
#!/usr/bin/env python

import argparse
Expand Down
1 change: 1 addition & 0 deletions tests/test_cnn/test_build_layers.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright (c) OpenMMLab. All rights reserved.
import numpy as np
import pytest
import torch
Expand Down
1 change: 1 addition & 0 deletions tests/test_cnn/test_context_block.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright (c) OpenMMLab. All rights reserved.
import pytest
import torch

Expand Down
1 change: 1 addition & 0 deletions tests/test_cnn/test_conv2d_adaptive_padding.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright (c) OpenMMLab. All rights reserved.
import torch

from mmcv.cnn.bricks import Conv2dAdaptivePadding
Expand Down
1 change: 1 addition & 0 deletions tests/test_cnn/test_conv_module.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright (c) OpenMMLab. All rights reserved.
import warnings
from unittest.mock import patch

Expand Down
1 change: 1 addition & 0 deletions tests/test_cnn/test_depthwise_seperable_conv_module.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright (c) OpenMMLab. All rights reserved.
import pytest
import torch
import torch.nn as nn
Expand Down
1 change: 1 addition & 0 deletions tests/test_cnn/test_flops_counter.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright (c) OpenMMLab. All rights reserved.
import pytest
import torch
import torch.nn as nn
Expand Down
1 change: 1 addition & 0 deletions tests/test_cnn/test_fuse_conv_bn.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright (c) OpenMMLab. All rights reserved.
import torch
import torch.nn as nn

Expand Down
1 change: 1 addition & 0 deletions tests/test_cnn/test_generalized_attention.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright (c) OpenMMLab. All rights reserved.
import torch

from mmcv.cnn.bricks import GeneralizedAttention
Expand Down
1 change: 1 addition & 0 deletions tests/test_cnn/test_hsigmoid.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright (c) OpenMMLab. All rights reserved.
import pytest
import torch

Expand Down
1 change: 1 addition & 0 deletions tests/test_cnn/test_hswish.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright (c) OpenMMLab. All rights reserved.
import torch
from torch.nn.functional import relu6

Expand Down
1 change: 1 addition & 0 deletions tests/test_cnn/test_model_registry.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright (c) OpenMMLab. All rights reserved.
import torch.nn as nn

import mmcv
Expand Down
1 change: 1 addition & 0 deletions tests/test_cnn/test_non_local.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright (c) OpenMMLab. All rights reserved.
import pytest
import torch
import torch.nn as nn
Expand Down
1 change: 1 addition & 0 deletions tests/test_cnn/test_revert_syncbn.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright (c) OpenMMLab. All rights reserved.
import os
import platform

Expand Down
1 change: 1 addition & 0 deletions tests/test_cnn/test_scale.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright (c) OpenMMLab. All rights reserved.
import torch

from mmcv.cnn.bricks import Scale
Expand Down
1 change: 1 addition & 0 deletions tests/test_cnn/test_swish.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright (c) OpenMMLab. All rights reserved.
import torch
import torch.nn.functional as F

Expand Down
1 change: 1 addition & 0 deletions tests/test_cnn/test_transformer.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright (c) OpenMMLab. All rights reserved.
import copy

import pytest
Expand Down
1 change: 1 addition & 0 deletions tests/test_cnn/test_wrappers.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright (c) OpenMMLab. All rights reserved.
from unittest.mock import patch

import pytest
Expand Down
1 change: 1 addition & 0 deletions tests/test_fileclient.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright (c) OpenMMLab. All rights reserved.
import os
import os.path as osp
import sys
Expand Down
1 change: 1 addition & 0 deletions tests/test_ops/test_active_rotated_filter.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright (c) OpenMMLab. All rights reserved.
import numpy as np
import pytest
import torch
Expand Down
1 change: 1 addition & 0 deletions tests/test_ops/test_assign_score_withk.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright (c) OpenMMLab. All rights reserved.
import pytest
import torch

Expand Down
1 change: 1 addition & 0 deletions tests/test_ops/test_ball_query.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright (c) OpenMMLab. All rights reserved.
import pytest
import torch

Expand Down
1 change: 1 addition & 0 deletions tests/test_ops/test_bbox.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright (c) OpenMMLab. All rights reserved.
import numpy as np
import pytest
import torch
Expand Down
1 change: 1 addition & 0 deletions tests/test_ops/test_bilinear_grid_sample.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright (c) OpenMMLab. All rights reserved.
import numpy as np
import torch
import torch.nn.functional as F
Expand Down
1 change: 1 addition & 0 deletions tests/test_ops/test_border_align.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright (c) OpenMMLab. All rights reserved.
import copy

import numpy as np
Expand Down
1 change: 1 addition & 0 deletions tests/test_ops/test_box_iou_rotated.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright (c) OpenMMLab. All rights reserved.
import numpy as np
import pytest
import torch
Expand Down
1 change: 1 addition & 0 deletions tests/test_ops/test_carafe.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright (c) OpenMMLab. All rights reserved.
import torch
from torch.autograd import gradcheck

Expand Down
1 change: 1 addition & 0 deletions tests/test_ops/test_cc_attention.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright (c) OpenMMLab. All rights reserved.
import numpy as np
import torch
import torch.nn as nn
Expand Down
1 change: 1 addition & 0 deletions tests/test_ops/test_contour_expand.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright (c) OpenMMLab. All rights reserved.
import numpy as np
import torch

Expand Down
1 change: 1 addition & 0 deletions tests/test_ops/test_convex_iou.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright (c) OpenMMLab. All rights reserved.
import numpy as np
import pytest
import torch
Expand Down
1 change: 1 addition & 0 deletions tests/test_ops/test_corner_pool.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright (c) OpenMMLab. All rights reserved.
"""
CommandLine:
pytest tests/test_corner_pool.py
Expand Down
1 change: 1 addition & 0 deletions tests/test_ops/test_deform_conv.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright (c) OpenMMLab. All rights reserved.
import numpy as np
import pytest
import torch
Expand Down
1 change: 1 addition & 0 deletions tests/test_ops/test_deform_roi_pool.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright (c) OpenMMLab. All rights reserved.
import os

import numpy as np
Expand Down
1 change: 1 addition & 0 deletions tests/test_ops/test_focal_loss.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright (c) OpenMMLab. All rights reserved.
import numpy as np
import torch

Expand Down
1 change: 1 addition & 0 deletions tests/test_ops/test_furthest_point_sample.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright (c) OpenMMLab. All rights reserved.
import pytest
import torch

Expand Down
1 change: 1 addition & 0 deletions tests/test_ops/test_fused_bias_leakyrelu.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright (c) OpenMMLab. All rights reserved.
import pytest
import torch

Expand Down
1 change: 1 addition & 0 deletions tests/test_ops/test_gather_points.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright (c) OpenMMLab. All rights reserved.
import pytest
import torch

Expand Down
1 change: 1 addition & 0 deletions tests/test_ops/test_group_points.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright (c) OpenMMLab. All rights reserved.
import pytest
import torch

Expand Down
1 change: 1 addition & 0 deletions tests/test_ops/test_info.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright (c) OpenMMLab. All rights reserved.
import torch


Expand Down
1 change: 1 addition & 0 deletions tests/test_ops/test_iou3d.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright (c) OpenMMLab. All rights reserved.
import numpy as np
import pytest
import torch
Expand Down
1 change: 1 addition & 0 deletions tests/test_ops/test_knn.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright (c) OpenMMLab. All rights reserved.
import pytest
import torch

Expand Down
1 change: 1 addition & 0 deletions tests/test_ops/test_masked_conv2d.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright (c) OpenMMLab. All rights reserved.
import torch


Expand Down
1 change: 1 addition & 0 deletions tests/test_ops/test_merge_cells.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright (c) OpenMMLab. All rights reserved.
"""
CommandLine:
pytest tests/test_merge_cells.py
Expand Down
1 change: 1 addition & 0 deletions tests/test_ops/test_min_area_polygons.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright (c) OpenMMLab. All rights reserved.
import numpy as np
import pytest
import torch
Expand Down
1 change: 1 addition & 0 deletions tests/test_ops/test_modulated_deform_conv.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright (c) OpenMMLab. All rights reserved.
import os

import numpy
Expand Down
1 change: 1 addition & 0 deletions tests/test_ops/test_ms_deformable_attn.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright (c) OpenMMLab. All rights reserved.
import pytest
import torch

Expand Down
1 change: 1 addition & 0 deletions tests/test_ops/test_nms.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright (c) OpenMMLab. All rights reserved.
import numpy as np
import pytest
import torch
Expand Down
1 change: 1 addition & 0 deletions tests/test_ops/test_nms_rotated.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright (c) OpenMMLab. All rights reserved.
import numpy as np
import pytest
import torch
Expand Down
Loading

0 comments on commit 6e9ce18

Please sign in to comment.