Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
MMCV
Commits
3fa58518
Unverified
Commit
3fa58518
authored
Mar 01, 2020
by
Kai Chen
Committed by
GitHub
Mar 01, 2020
Browse files
Update pre-commit hook config (#200)
* update pre-commit hook config * update the contributing guide
parent
ac78bdc2
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
38 additions
and
15 deletions
+38
-15
.pre-commit-config.yaml
.pre-commit-config.yaml
+12
-6
CONTRIBUTING.md
CONTRIBUTING.md
+21
-3
docs/conf.py
docs/conf.py
+0
-1
mmcv/cnn/resnet.py
mmcv/cnn/resnet.py
+1
-1
mmcv/cnn/vgg.py
mmcv/cnn/vgg.py
+1
-1
mmcv/parallel/collate.py
mmcv/parallel/collate.py
+1
-1
mmcv/runner/__init__.py
mmcv/runner/__init__.py
+1
-1
tests/test_runner.py
tests/test_runner.py
+1
-1
No files found.
.pre-commit-config.yaml
View file @
3fa58518
exclude
:
^tests/data/
repos
:
-
repo
:
https://gitlab.com/pycqa/flake8
rev
:
3.7.9
hooks
:
-
id
:
flake8
-
repo
:
https://github.com/asottile/seed-isort-config
rev
:
v
1.9.3
rev
:
v
2.1.0
hooks
:
-
id
:
seed-isort-config
-
repo
:
https://github.com/
pre-commit/mirrors-
isort
rev
:
v
4.3.21
-
repo
:
https://github.com/
timothycrosley/
isort
rev
:
4.3.21
hooks
:
-
id
:
isort
-
repo
:
https://github.com/pre-commit/mirrors-yapf
...
...
@@ -13,10 +17,12 @@ repos:
hooks
:
-
id
:
yapf
-
repo
:
https://github.com/pre-commit/pre-commit-hooks
rev
:
v2.
3
.0
rev
:
v2.
5
.0
hooks
:
-
id
:
flake8
-
id
:
trailing-whitespace
-
id
:
check-yaml
-
id
:
end-of-file-fixer
-
id
:
requirements-txt-fixer
-
id
:
double-quote-string-fixer
-
id
:
fix-encoding-pragma
args
:
[
"
--remove"
]
CONTRIBUTING.md
View file @
3fa58518
# Contributing to
mmcv
# Contributing to
MMCV
All kinds of contributions are welcome, including but not limited to the following.
...
...
@@ -7,7 +7,7 @@ All kinds of contributions are welcome, including but not limited to the followi
## Workflow
1.
fork and pull the latest
mmcv
1.
fork and pull the latest
MMCV
2.
checkout a new branch (do not use master branch for PRs)
3.
commit your changes
4.
create a PR
...
...
@@ -24,7 +24,25 @@ We use the following tools for linting and formatting:
-
[
yapf
](
https://github.com/google/yapf
)
: formatter
-
[
isort
](
https://github.com/timothycrosley/isort
)
: sort imports
Style configurations of yapf and isort can be found in
[
.style.yapf
](
.style.yapf
)
and
[
.isort.cfg
](
.isort.cfg
)
.
Style configurations of yapf and isort can be found in
[
setup.cfg
](
./setup.cfg
)
.
We use
[
pre-commit hook
](
https://pre-commit.com/
)
that checks and formats for
`flake8`
,
`yapf`
,
`isort`
,
`trailing whitespaces`
,
fixes
`end-of-files`
, sorts
`requirments.txt`
automatically on every commit.
The config for a pre-commit hook is stored in
[
.pre-commit-config
](
./.pre-commit-config.yaml
)
.
After you clone the repository, you will need to install initialize pre-commit hook.
```
pip install -U pre-commit
```
From the repository folder
```
pre-commit install
```
After this on every commit check code linters and formatter will be enforced.
>Before you create a PR, make sure that your code lints and is formatted by yapf.
...
...
docs/conf.py
View file @
3fa58518
# -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
...
...
mmcv/cnn/resnet.py
View file @
3fa58518
...
...
@@ -9,7 +9,7 @@ from .weight_init import constant_init, kaiming_init
def
conv3x3
(
in_planes
,
out_planes
,
stride
=
1
,
dilation
=
1
):
"3x3 convolution with padding"
""
"3x3 convolution with padding"
""
return
nn
.
Conv2d
(
in_planes
,
out_planes
,
...
...
mmcv/cnn/vgg.py
View file @
3fa58518
...
...
@@ -8,7 +8,7 @@ from .weight_init import constant_init, kaiming_init, normal_init
def
conv3x3
(
in_planes
,
out_planes
,
dilation
=
1
):
"3x3 convolution with padding"
""
"3x3 convolution with padding"
""
return
nn
.
Conv2d
(
in_planes
,
out_planes
,
...
...
mmcv/parallel/collate.py
View file @
3fa58518
...
...
@@ -21,7 +21,7 @@ def collate(batch, samples_per_gpu=1):
"""
if
not
isinstance
(
batch
,
collections
.
Sequence
):
raise
TypeError
(
"
{} is not supported.
"
.
format
(
batch
.
dtype
))
raise
TypeError
(
'
{} is not supported.
'
.
format
(
batch
.
dtype
))
if
isinstance
(
batch
[
0
],
DataContainer
):
assert
len
(
batch
)
%
samples_per_gpu
==
0
...
...
mmcv/runner/__init__.py
View file @
3fa58518
...
...
@@ -2,7 +2,7 @@
from
.checkpoint
import
(
_load_checkpoint
,
load_checkpoint
,
load_state_dict
,
save_checkpoint
,
weights_to_cpu
)
from
.dist_utils
import
get_dist_info
,
init_dist
,
master_only
from
.hooks
import
(
CheckpointHook
,
ClosureHook
,
DistSamplerSeedHook
,
HOOKS
,
from
.hooks
import
(
HOOKS
,
CheckpointHook
,
ClosureHook
,
DistSamplerSeedHook
,
Hook
,
IterTimerHook
,
LoggerHook
,
LrUpdaterHook
,
OptimizerHook
,
PaviLoggerHook
,
TensorboardLoggerHook
,
TextLoggerHook
,
WandbLoggerHook
)
...
...
tests/test_runner.py
View file @
3fa58518
...
...
@@ -53,7 +53,7 @@ def test_wandb_hook():
model
=
model
,
batch_processor
=
lambda
model
,
x
,
**
kwargs
:
{
'log_vars'
:
{
"
accuracy
"
:
0.98
'
accuracy
'
:
0.98
},
'num_samples'
:
5
})
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment