Skip to content

Commit d6b688d

Browse files
committed
style: apply pre-commit hooks with no manual edits
Signed-off-by: Dasun Abeykoon <Dasun20202020@hotmail.com>
1 parent d27df2c commit d6b688d

File tree

11 files changed

+98
-17
lines changed

11 files changed

+98
-17
lines changed

.flake8

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# As of now, flake8 does not natively support configuration via pyproject.toml
2+
# https://github.com/microsoft/vscode-flake8/issues/135
3+
[flake8]
4+
exclude =
5+
.git,
6+
__pycache__,
7+
build,
8+
dist,
9+
docs/source/conf.py
10+
max-line-length = 79
11+
# Ignore some style 'errors' produced while formatting by 'black'
12+
# https://black.readthedocs.io/en/stable/guides/using_black_with_other_tools.html#labels-why-pycodestyle-warnings
13+
extend-ignore = E203

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,4 @@ setup.cfg
4545
/DistancePrinter/gitarchive.cfg
4646

4747
# test output
48-
actual.res
48+
actual.res

.isort.cfg

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[settings]
2+
# Keep import statement below line_length character limit
3+
line_length = 79
4+
multi_line_output = 3
5+
include_trailing_comma = True

.pre-commit-config.yaml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
default_language_version:
2+
python: python3
3+
ci:
4+
autofix_commit_msg: |
5+
[pre-commit.ci] auto fixes from pre-commit hooks
6+
autofix_prs: true
7+
autoupdate_branch: "pre-commit-autoupdate"
8+
autoupdate_commit_msg: "[pre-commit.ci] pre-commit autoupdate"
9+
autoupdate_schedule: monthly
10+
skip: [no-commit-to-branch]
11+
submodules: false
12+
repos:
13+
- repo: https://github.com/pre-commit/pre-commit-hooks
14+
rev: v4.6.0
15+
hooks:
16+
- id: check-yaml
17+
- id: end-of-file-fixer
18+
- id: trailing-whitespace
19+
- id: check-case-conflict
20+
- id: check-merge-conflict
21+
- id: check-toml
22+
- id: check-added-large-files
23+
- repo: https://github.com/psf/black
24+
rev: 24.4.2
25+
hooks:
26+
- id: black
27+
- repo: https://github.com/pycqa/flake8
28+
rev: 7.0.0
29+
hooks:
30+
- id: flake8
31+
- repo: https://github.com/pycqa/isort
32+
rev: 5.13.2
33+
hooks:
34+
- id: isort
35+
args: ["--profile", "black"]
36+
- repo: https://github.com/kynan/nbstripout
37+
rev: 0.7.1
38+
hooks:
39+
- id: nbstripout
40+
- repo: https://github.com/pre-commit/pre-commit-hooks
41+
rev: v4.4.0
42+
hooks:
43+
- id: no-commit-to-branch
44+
name: Prevent Commit to Main Branch
45+
args: ["--branch", "main"]
46+
stages: [pre-commit]
47+
- repo: https://github.com/codespell-project/codespell
48+
rev: v2.3.0
49+
hooks:
50+
- id: codespell
51+
additional_dependencies:
52+
- tomli
53+
# prettier - multi formatter for .json, .yml, and .md files
54+
- repo: https://github.com/pre-commit/mirrors-prettier
55+
rev: f12edd9c7be1c20cfa42420fd0e6df71e42b51ea # frozen: v4.0.0-alpha.8
56+
hooks:
57+
- id: prettier
58+
additional_dependencies:
59+
- "prettier@^3.2.4"
60+
# docformatter - PEP 257 compliant docstring formatter
61+
- repo: https://github.com/s-weigand/docformatter
62+
rev: 5757c5190d95e5449f102ace83df92e7d3b06c6c
63+
hooks:
64+
- id: docformatter
65+
additional_dependencies: [tomli]
66+
args: [--in-place, --config, ./pyproject.toml]

AUTHORS.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Xiaohao Yang
1+
Xiaohao Yang

MANIFEST.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
recursive-include DistancePrinter *
22
prune doc
3-
exclude MANIFEST.in
3+
exclude MANIFEST.in

README.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ To install the DistancePrinter package:
1818

1919
python setup.py install
2020

21-
By default the files are installed in the system directories, which are
22-
usually only writeable by the root. See the usage info "./setup.py install
23-
--help" for options to install as a normal user under a different location.
24-
Note that installation to non-standard directories you may require adjustments
21+
By default the files are installed in the system directories, which are
22+
usually only writeable by the root. See the usage info "./setup.py install
23+
--help" for options to install as a normal user under a different location.
24+
Note that installation to non-standard directories you may require adjustments
2525
to the PATH and PYTHONPATH environment variables.
2626

2727
CONTACTS

src/diffpy/distanceprinter/__init__.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@
1212
#
1313
##############################################################################
1414

15-
"""
16-
Blank namespace package.
17-
"""
15+
"""Blank namespace package."""
1816

1917
__import__("pkg_resources").declare_namespace(__name__)
2018

src/diffpy/distanceprinter/distanceprinter.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
##############################################################################
1414

1515
import sys
16+
1617
import numpy as np
1718

1819
from diffpy.pdffit2 import PdfFit
@@ -70,9 +71,7 @@ def calDistance(strufile, atomi, atomj, lb, ub, complete):
7071

7172

7273
def formatResults(stru, distlist, complete, all0ddij, **kw):
73-
"""
74-
format the distlist to string
75-
"""
74+
"""Format the distlist to string."""
7675
lines = []
7776
# header
7877
lines.append("# Structure file: %s" % kw["strufile"])

src/diffpy/distanceprinter/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515

1616
"""Definition of __version__, __date__, __gitsha__."""
1717

18-
from pkg_resources import resource_filename
1918
from ConfigParser import RawConfigParser
19+
from pkg_resources import resource_filename
2020

2121
# obtain version information from the version.cfg file
2222
cp = RawConfigParser(dict(version="", date="", commit="", timestamp=0))

0 commit comments

Comments
 (0)