Skip to content

Commit d3eb142

Browse files
Change docformatter, update all other hooks (#302)
* Change docformatter, update all other hooks * News * [pre-commit.ci] auto fixes from pre-commit hooks * Fix black/docformatter conflict --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 268435c commit d3eb142

32 files changed

Lines changed: 80 additions & 85 deletions

.pre-commit-config.yaml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ ci:
1111
submodules: false
1212
repos:
1313
- repo: https://github.com/pre-commit/pre-commit-hooks
14-
rev: v4.6.0
14+
rev: v6.0.0
1515
hooks:
1616
- id: check-yaml
1717
- id: end-of-file-fixer
@@ -21,45 +21,45 @@ repos:
2121
- id: check-toml
2222
- id: check-added-large-files
2323
- repo: https://github.com/psf/black
24-
rev: 24.4.2
24+
rev: 26.3.1
2525
hooks:
2626
- id: black
2727
- repo: https://github.com/pycqa/flake8
28-
rev: 7.0.0
28+
rev: 7.3.0
2929
hooks:
3030
- id: flake8
3131
- repo: https://github.com/pycqa/isort
32-
rev: 5.13.2
32+
rev: 9.0.0a3
3333
hooks:
3434
- id: isort
3535
args: ["--profile", "black"]
3636
- repo: https://github.com/kynan/nbstripout
37-
rev: 0.7.1
37+
rev: 0.9.1
3838
hooks:
3939
- id: nbstripout
4040
- repo: https://github.com/pre-commit/pre-commit-hooks
41-
rev: v4.4.0
41+
rev: v6.0.0
4242
hooks:
4343
- id: no-commit-to-branch
4444
name: Prevent Commit to Main Branch
4545
args: ["--branch", "main"]
4646
stages: [pre-commit]
4747
- repo: https://github.com/codespell-project/codespell
48-
rev: v2.3.0
48+
rev: v2.4.2
4949
hooks:
5050
- id: codespell
5151
additional_dependencies:
5252
- tomli
5353
# prettier - multi formatter for .json, .yml, and .md files
5454
- repo: https://github.com/pre-commit/mirrors-prettier
55-
rev: f12edd9c7be1c20cfa42420fd0e6df71e42b51ea # frozen: v4.0.0-alpha.8
55+
rev: v4.0.0-alpha.8
5656
hooks:
5757
- id: prettier
5858
additional_dependencies:
5959
- "prettier@^3.2.4"
6060
# docformatter - PEP 257 compliant docstring formatter
61-
- repo: https://github.com/s-weigand/docformatter
62-
rev: 5757c5190d95e5449f102ace83df92e7d3b06c6c
61+
- repo: https://github.com/PyCQA/docformatter
62+
rev: v1.7.8
6363
hooks:
6464
- id: docformatter
6565
additional_dependencies: [tomli]

news/docformatter.rst

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
**Added:**
2+
3+
* <news item>
4+
5+
**Changed:**
6+
7+
* Now use `PyCQA/docformatter` to format Python docstrings.
8+
9+
**Deprecated:**
10+
11+
* <news item>
12+
13+
**Removed:**
14+
15+
* <news item>
16+
17+
**Fixed:**
18+
19+
* <news item>
20+
21+
**Security:**
22+
23+
* <news item>

src/diffpy/morph/morph_helpers/transformpdftordf.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
##############################################################################
1515
"""Class TransformXtalPDFtoRDF -- Transform crystal PDFs to RDFs."""
1616

17-
1817
from diffpy.morph.morphs.morph import LABEL_GR, LABEL_RA, LABEL_RR, Morph
1918

2019

src/diffpy/morph/morph_helpers/transformrdftopdf.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
##############################################################################
1515
"""Class TransformXtalRDFtoPDF -- Transform crystal RDFs to PDFs."""
1616

17-
1817
import numpy
1918

2019
from diffpy.morph.morphs.morph import LABEL_GR, LABEL_RA, LABEL_RR, Morph

src/diffpy/morph/morph_io.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,6 @@ def single_morph_output(
155155
stdout_flag: bool
156156
Print to terminal when True (default False).
157157
"""
158-
159158
# Input and output parameters
160159
morphs_in = "\n# Input morphing parameters:\n"
161160
morphs_in += (
@@ -302,7 +301,6 @@ def get_multisave_names(target_list: list, save_names_file=None, mm=False):
302301
The names to save each morph as. Keys are the target function file
303302
names used to produce that morph.
304303
"""
305-
306304
# Dictionary storing save file names
307305
save_names = {}
308306

@@ -382,7 +380,6 @@ def multiple_morph_output(
382380
Multiple morphs done with a single target rather than multiple
383381
targets for a single morphed file. Swaps morph and target in the code.
384382
"""
385-
386383
# Input parameters used for every morph
387384
inputs = "\n# Input morphing parameters:\n"
388385
inputs += "\n".join(
@@ -480,7 +477,6 @@ def tabulate_results(multiple_morph_results):
480477
Keys in tabulated_results are the table's column names and each
481478
corresponding value is a list of data for that column.
482479
"""
483-
484480
# We only care about the following parameters in our data tables
485481
relevant_parameters = ["Scale", "Smear", "Stretch", "Pearson", "Rw"]
486482

src/diffpy/morph/morphapp.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ def morph_error(self, msg, error):
242242
help=(
243243
"Slope of the baseline. "
244244
"For a bulk material with scale factor 1, "
245-
"this will have value -4\u03C0 times the atomic density. "
245+
"this will have value -4\u03c0 times the atomic density. "
246246
"Otherwise, you can estimate it by dividing the y "
247247
"position from the x position "
248248
"of the base of the first peak. "
@@ -334,7 +334,7 @@ def morph_error(self, msg, error):
334334
"--noplot",
335335
action="store_false",
336336
dest="plot",
337-
help="""Do not show a plot.""",
337+
help="Do not show a plot.",
338338
)
339339
group.add_option(
340340
"--mlabel",
@@ -446,7 +446,7 @@ def morph_error(self, msg, error):
446446
"--reverse",
447447
dest="reverse",
448448
action="store_true",
449-
help="""Sort from highest to lowest instead.""",
449+
help="Sort from highest to lowest instead.",
450450
)
451451
group.add_option(
452452
"--serial-file",
@@ -1278,7 +1278,7 @@ def getPDFFromFile(fn):
12781278

12791279
def main():
12801280
parser = create_option_parser()
1281-
(opts, pargs) = parser.parse_args()
1281+
opts, pargs = parser.parse_args()
12821282
if opts.multiple_targets:
12831283
multiple_targets(parser, opts, pargs, stdout_flag=True)
12841284
elif opts.multiple_morphs:

src/diffpy/morph/morphpy.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def get_args(parser, params, kwargs):
2222
else:
2323
inputs.append(f"--{key}")
2424
inputs.append(f"{value}")
25-
(opts, pargs) = parser.parse_args(inputs)
25+
opts, pargs = parser.parse_args(inputs)
2626
return opts, pargs
2727

2828

src/diffpy/morph/morphs/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
##############################################################################
1515
"""Definition of morphs."""
1616

17-
1817
from diffpy.morph.morphs.morph import Morph # noqa: F401
1918
from diffpy.morph.morphs.morphchain import MorphChain # noqa: F401
2019
from diffpy.morph.morphs.morphfuncx import MorphFuncx

src/diffpy/morph/morphs/morph.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#
1414
##############################################################################
1515
"""Morph -- base class for defining a morph."""
16+
1617
import numpy
1718

1819
LABEL_RA = "r (A)" # r-grid
@@ -189,9 +190,10 @@ def applyConfig(self, config):
189190
return
190191

191192
def checkConfig(self):
192-
"""Verify data in self.config. No action by default.
193+
"""Verify data in self.config.
193194
194-
To be overridden in a derived class.
195+
No action by default. To be overridden in a derived
196+
class.
195197
"""
196198
return
197199

@@ -257,7 +259,6 @@ def set_extrapolation_info(self, x_true, x_extrapolate):
257259
x_extrapolate : array
258260
x values after a morphing process
259261
"""
260-
261262
cutoff_low = min(x_true)
262263
extrap_low_x = numpy.where(x_extrapolate < cutoff_low)[0]
263264
is_extrap_low = False if len(extrap_low_x) == 0 else True

src/diffpy/morph/morphs/morphchain.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@
1212
# See LICENSE.txt for license information.
1313
#
1414
##############################################################################
15-
"""MorphChain -- Chain of morphs executed in order.
16-
"""
15+
"""MorphChain -- Chain of morphs executed in order."""
16+
17+
# Comment required to resolve black/docformatter conflict
1718

1819

1920
class MorphChain(list):

0 commit comments

Comments
 (0)