Skip to content

Commit ecc77da

Browse files
PhDPhD
authored andcommitted
CODE: update pre-commit hooks
1 parent 9496a69 commit ecc77da

40 files changed

Lines changed: 177 additions & 171 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/precommit-hook-update.rst

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
**Added:**
2+
3+
* No news needed: updating docformatter not user facing
4+
5+
**Changed:**
6+
7+
* <news item>
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/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
##############################################################################
1515
"""Blank namespace package for module diffpy."""
1616

17-
1817
from pkgutil import extend_path
1918

2019
__path__ = extend_path(__path__, __name__)

src/diffpy/pdfgui/applications/pdfgui.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,8 @@
1212
# See LICENSE.txt for license information.
1313
#
1414
##############################################################################
15-
"""
16-
PDFgui Graphical User Interface for Pair Distribution Function fitting
17-
Usage: pdfgui [project.dpp]
15+
"""PDFgui Graphical User Interface for Pair Distribution Function
16+
fitting Usage: pdfgui [project.dpp]
1817
1918
PDFgui is graphical user interface to PDFfit2 - a Python library for PDF
2019
simulation and structure refinement. PDFgui has many nice features such

src/diffpy/pdfgui/control/calculation.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -291,11 +291,12 @@ def save(self, z, subpath):
291291
return
292292

293293
def copy(self, other=None):
294-
"""Copy self to other. if other is None, create new instance.
294+
"""Copy self to other.
295295
296-
other -- reference to other object
296+
if other is None, create new instance.
297+
other -- reference to other object
297298
298-
returns reference to copied object
299+
returns reference to copied object
299300
"""
300301
if other is None:
301302
other = Calculation(self.name)

src/diffpy/pdfgui/control/constraint.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,9 @@ def evalFormula(self, parvalues):
6767
return result
6868

6969
def lambdaFormula(self):
70-
"""Build lambda function from constraint formula. Lambda
71-
function expects dictionary argument.
70+
"""Build lambda function from constraint formula.
71+
72+
Lambda function expects dictionary argument.
7273
7374
returns lambda function
7475
"""

src/diffpy/pdfgui/control/fitdataset.py

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -243,8 +243,9 @@ def readObsStr(self, datastring):
243243
return self
244244

245245
def write(self, filename):
246-
"""Same as writeCalc(). Use writeObs() to save experimental PDF
247-
data.
246+
"""Same as writeCalc().
247+
248+
Use writeObs() to save experimental PDF data.
248249
249250
filename -- name of file to write to
250251
@@ -267,8 +268,9 @@ def writeCalc(self, filename):
267268
return
268269

269270
def writeStr(self):
270-
"""Same as writeCalcStr. Use writeObsStr() for experimental
271-
PDF.
271+
"""Same as writeCalcStr.
272+
273+
Use writeObsStr() for experimental PDF.
272274
273275
Return data string.
274276
"""
@@ -379,9 +381,11 @@ def writeResampledObsStr(self):
379381
return s
380382

381383
def findParameters(self):
382-
"""Obtain dictionary of parameters used by self.constraints. The
383-
keys of returned dictionary are integer parameter indices, and
384-
their values Parameter instances, with guessed initial values.
384+
"""Obtain dictionary of parameters used by self.constraints.
385+
386+
The keys of returned dictionary are integer parameter indices,
387+
and their values Parameter instances, with guessed initial
388+
values.
385389
386390
returns dictionary of indices and Parameter instances
387391
"""
@@ -434,11 +438,12 @@ def changeParameterIndex(self, oldidx, newidx):
434438
return
435439

436440
def copy(self, other=None):
437-
"""Copy self to other. if other is None, create new instance.
441+
"""Copy self to other.
438442
439-
other -- ref to other object
443+
if other is None, create new instance.
444+
other -- ref to other object
440445
441-
returns reference to copied object
446+
returns reference to copied object
442447
"""
443448
# check arguments
444449
if other is None:
@@ -529,9 +534,10 @@ def save(self, z, subpath):
529534
# interface for data sampling
530535

531536
def getFitSamplingType(self):
532-
"""Description of r-sampling used in the fit. This method
533-
compares self.fitrstep with r-sampling in the observed data and
534-
with Nyquist r step.
537+
"""Description of r-sampling used in the fit.
538+
539+
This method compares self.fitrstep with r-sampling in the
540+
observed data and with Nyquist r step.
535541
536542
Return a string, possible values are "data", "Nyquist" or
537543
"custom".
@@ -683,7 +689,8 @@ def _set_rcalc(self, value):
683689
_get_rcalc,
684690
_set_rcalc,
685691
doc="""R-grid for refined data, read-only.
686-
Use fitrmin, fitrmax, fitrstep to change it""",
692+
Use fitrmin, fitrmax, fitrstep to change it"""
693+
,
687694
)
688695

689696
# Gcalc

src/diffpy/pdfgui/control/fitstructure.py

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -170,9 +170,11 @@ def obtainRefined(self, server, iphase):
170170
return
171171

172172
def findParameters(self):
173-
"""Obtain dictionary of parameters used by self.constraints. The
174-
keys of returned dictionary are integer parameter indices, and
175-
the values are Parameter instances, with guessed initial values.
173+
"""Obtain dictionary of parameters used by self.constraints.
174+
175+
The keys of returned dictionary are integer parameter indices,
176+
and the values are Parameter instances, with guessed initial
177+
values.
176178
177179
returns dictionary of indices and Parameter instances
178180
"""
@@ -677,11 +679,13 @@ def _parseAtomSelectionString(self, s):
677679
# delayed initialization of the class variable
678680
if self._rxatomselection is None:
679681
FitStructure._rxatomselection = re.compile(
680-
r"""
681-
(?P<negate>!?) # exclamation point
682-
(?:(?P<element>[a-zA-Z]+)$| # element|all or
683-
(?P<start>\d+)(?P<stop>:\d+)?$ # number range
684-
)""",
682+
r"""(?P<negate>!?) # exclamation
683+
point (?:(?P<element>[a-zA-Z]+)$| # element|all
684+
or.
685+
686+
(?P<start>\d+)(?P<stop>:\d+)?$ # number range )
687+
"""
688+
,
685689
re.VERBOSE,
686690
)
687691
assert self._rxatomselection
@@ -724,11 +728,12 @@ def _parseAtomSelectionString(self, s):
724728
return rv
725729

726730
def copy(self, other=None):
727-
"""Copy self to other. if other is None, create new instance.
731+
"""Copy self to other.
728732
729-
other -- reference to other object
733+
if other is None, create new instance.
734+
other -- reference to other object
730735
731-
returns reference to copied object
736+
returns reference to copied object
732737
"""
733738
# check arguments
734739
if other is None:

src/diffpy/pdfgui/control/fitting.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -178,10 +178,11 @@ def _getStrId(self):
178178
return "f_" + self.name
179179

180180
def copy(self, other=None):
181-
"""Copy self to other. if other is None, create an instance.
181+
"""Copy self to other.
182182
183-
other -- ref to other object
184-
return value: reference to copied object
183+
if other is None, create an instance.
184+
other -- ref to other object
185+
return value: reference to copied object
185186
"""
186187
if other is None:
187188
other = Fitting(self.name)
@@ -448,8 +449,9 @@ def _configureBondCalculation(self, struc):
448449
return
449450

450451
def outputBondAngle(self, struc, i, j, k):
451-
"""Output bond angle defined by atoms i, j, k. The angle is
452-
calculated using the shortest lengths ji and jk with respect to
452+
"""Output bond angle defined by atoms i, j, k.
453+
454+
The angle is calculated using the shortest lengths ji and jk with respect to
453455
periodic boundary conditions.
454456
455457
struc -- instance of PDFStructure
@@ -472,8 +474,9 @@ def outputBondAngle(self, struc, i, j, k):
472474
return
473475

474476
def outputBondLengthAtoms(self, struc, i, j):
475-
"""Output shortest bond between atoms i, j. Periodic boundary
476-
conditions are applied to find the shortest bond.
477+
"""Output shortest bond between atoms i, j.
478+
479+
Periodic boundary conditions are applied to find the shortest bond.
477480
478481
struc -- instance of PDFStructure
479482
i, j -- atom indices starting at 1

src/diffpy/pdfgui/control/organizer.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,9 @@ def spd_constrained(ds):
3030

3131

3232
class Organizer(PDFComponent):
33-
"""Base class for Fitting. It holds separate lists of datasets,
34-
strucs and calculations.
33+
"""Base class for Fitting.
34+
35+
It holds separate lists of datasets, strucs and calculations.
3536
3637
datasets: dataset list
3738
strucs: structure list
@@ -204,10 +205,11 @@ def save(self, z, subpath):
204205
return
205206

206207
def copy(self, other=None):
207-
"""Copy self to other. if other is None, create an instance.
208+
"""Copy self to other.
208209
209-
other -- ref to other object
210-
returns reference to copied object
210+
if other is None, create an instance.
211+
other -- ref to other object
212+
returns reference to copied object
211213
"""
212214
if other is None:
213215
other = Organizer(self.name)

0 commit comments

Comments
 (0)