Skip to content

Commit

Permalink
add flake pre-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
adamltyson committed Jul 16, 2020
1 parent 559a954 commit a212e61
Show file tree
Hide file tree
Showing 8 changed files with 45 additions and 11 deletions.
12 changes: 12 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
repos:
- repo: https://github.com/python/black
rev: 19.10b0
hooks:
- id: black
pass_filenames: true
- repo: https://gitlab.com/pycqa/flake8
rev: 3.7.9
hooks:
- id: flake8
pass_filenames: true
# exclude: __init__.py
2 changes: 1 addition & 1 deletion brainreg/backend/niftyreg/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def run_niftyreg(
registration_output_folder, f"downsampled_standard_{name}.tiff"
)

## do the tiff part at the beginning
# do the tiff part at the beginning
downsampled_brain = imio.load_any(
target_brain_path,
x_scaling,
Expand Down
2 changes: 0 additions & 2 deletions brainreg/main.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import logging
import numpy as np

from pathlib import Path

import bg_space as bg
import imio

Expand Down
7 changes: 1 addition & 6 deletions brainreg/utils/misc.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
from argparse import (
ArgumentParser,
ArgumentDefaultsHelpFormatter,
ArgumentTypeError,
Namespace,
)
from argparse import Namespace


def get_arg_groups(args, parser):
Expand Down
2 changes: 1 addition & 1 deletion brainreg/utils/volume.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def calculate_volumes(
"total_volume_mm3",
)
for atlas_value in unique_vals_left:
if atlas_value is not 0: # outside brain
if atlas_value != 0: # outside brain
try:
df = add_structure_volume_to_df(
df,
Expand Down
16 changes: 16 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[tool.black]
line-length = 79
include = '\.pyi?$'
exclude = '''
/(
\.git
| \.hg
| \.mypy_cache
| \.tox
| \.venv
| _build
| buck-out
| build
| dist
)/
'''
6 changes: 6 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,9 @@ replace = version="{new_version}"
[bumpversion:file:brainreg/__init__.py]
search = __version__ = "{current_version}"
replace = __version__ = "{new_version}"

[flake8]
ignore = E203, E231, W503
max-line-length = 79
;max-complexity = 5
exclude = __init__.py
9 changes: 8 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,14 @@
long_description_content_type="text/markdown",
install_requires=requirements,
extras_require={
"dev": ["black", "pytest-cov", "pytest", "coverage", "bump2version"]
"dev": [
"black",
"pytest-cov",
"pytest",
"coverage",
"bump2version",
"pre-commit",
]
},
python_requires=">=3.6, <3.8",
packages=find_namespace_packages(exclude=("docs", "tests*")),
Expand Down

0 comments on commit a212e61

Please sign in to comment.