Skip to content

Commit 4b2e0ea

Browse files
authored
Merge pull request #285 from ycexiao/add-docformatter
ci: add `docformatter` in `pyproject.toml`
2 parents 4af7868 + df988d7 commit 4b2e0ea

33 files changed

+238
-181
lines changed

doc/source/manual_resources/tui_mno_bond_lengths.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/usr/bin/env python
22

3-
"""Extract the shortest Mn-O bond lengths from all fits in PDFgui project.
3+
"""Extract the shortest Mn-O bond lengths from all fits in PDFgui
4+
project.
45
56
This script loops through all refined phases in PDFgui project and
67
calculates their shortest Mn-O bond lengths using diffpy.pdffit2

pyproject.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,3 +81,7 @@ exclude = '''
8181
| tests/data
8282
)/
8383
'''
84+
[tool.docformatter]
85+
recursive = true
86+
wrap-summaries = 72
87+
wrap-descriptions = 72

src/diffpy/pdfgui/applications/pdfgui.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,9 @@ def version():
5454

5555

5656
def processArguments(argv1):
57-
"""Process command line arguments and store results in pdfguiglobals. This
58-
method updates cmdopts, cmdargs and dbopts attributes in the pdfguiglobals
59-
module.
57+
"""Process command line arguments and store results in
58+
pdfguiglobals. This method updates cmdopts, cmdargs and dbopts
59+
attributes in the pdfguiglobals module.
6060
6161
argv1 -- list of command line arguments excluding the executable
6262

src/diffpy/pdfgui/control/calculation.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
# See LICENSE.txt for license information.
1313
#
1414
##############################################################################
15-
"""Class Calculation for performing PDF simulation from model structure."""
15+
"""Class Calculation for performing PDF simulation from model
16+
structure."""
1617

1718
import copy
1819
import math
@@ -76,8 +77,8 @@ def _getStrId(self):
7677
return "c_" + self.name
7778

7879
def setRGrid(self, rmin=None, rstep=None, rmax=None):
79-
"""Change specified r-grid parameters (rmin, rstep, rmax). Adjust rmax
80-
for integer number of steps.
80+
"""Change specified r-grid parameters (rmin, rstep, rmax).
81+
Adjust rmax for integer number of steps.
8182
8283
rmin -- new low rcalc boundary
8384
rstep -- new r-grid step

src/diffpy/pdfgui/control/constraint.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
# See LICENSE.txt for license information.
1313
#
1414
##############################################################################
15-
"""Class Constraint for storage of a single constraint equation constraints
16-
will be stored in { variable : constraint } dictionary."""
15+
"""Class Constraint for storage of a single constraint equation
16+
constraints will be stored in { variable : constraint } dictionary."""
1717

1818
import math
1919
import re
@@ -67,8 +67,8 @@ def evalFormula(self, parvalues):
6767
return result
6868

6969
def lambdaFormula(self):
70-
"""Build lambda function from constraint formula. Lambda function
71-
expects dictionary argument.
70+
"""Build lambda function from constraint formula. Lambda
71+
function expects dictionary argument.
7272
7373
returns lambda function
7474
"""

src/diffpy/pdfgui/control/controlerrors.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ class ControlFileError(ControlError):
4242

4343

4444
class ControlKeyError(ControlError):
45-
"""PDFGuiControl exception class -- requested object can't be found."""
45+
"""PDFGuiControl exception class -- requested object can't be
46+
found."""
4647

4748
pass
4849

@@ -66,7 +67,8 @@ class ControlStatusError(ControlError):
6667

6768

6869
class ControlRuntimeError(ControlError):
69-
"""PDFGuiControl exception class -- various irrecoverable runtime error."""
70+
"""PDFGuiControl exception class -- various irrecoverable runtime
71+
error."""
7072

7173
pass
7274

@@ -85,8 +87,8 @@ class ControlSyntaxError(ControlError):
8587

8688

8789
class TempControlSelectError(ControlError):
88-
"""Temporary define this error to identify the select-control error in
89-
python3."""
90+
"""Temporary define this error to identify the select-control error
91+
in python3."""
9092

9193
pass
9294

src/diffpy/pdfgui/control/fitdataset.py

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626

2727

2828
class FitDataSet(PDFDataSet):
29-
"""FitDataSet stores experimental and calculated PDF data and related
30-
fitting parameters. Inherited from PDFDataSet.
29+
"""FitDataSet stores experimental and calculated PDF data and
30+
related fitting parameters. Inherited from PDFDataSet.
3131
3232
Data members (in addition to those in PDFDataSet):
3333
@@ -204,8 +204,8 @@ def read(self, filename):
204204
return self.readObs(filename)
205205

206206
def _updateRcalcRange(self):
207-
"""Helper method for updating fitrmin, fitrmax and fitrstep just after
208-
reading observed values.
207+
"""Helper method for updating fitrmin, fitrmax and fitrstep just
208+
after reading observed values.
209209
210210
No return value.
211211
"""
@@ -243,7 +243,8 @@ def readObsStr(self, datastring):
243243
return self
244244

245245
def write(self, filename):
246-
"""Same as writeCalc(). Use writeObs() to save experimental PDF data.
246+
"""Same as writeCalc(). Use writeObs() to save experimental PDF
247+
data.
247248
248249
filename -- name of file to write to
249250
@@ -266,7 +267,8 @@ def writeCalc(self, filename):
266267
return
267268

268269
def writeStr(self):
269-
"""Same as writeCalcStr. Use writeObsStr() for experimental PDF.
270+
"""Same as writeCalcStr. Use writeObsStr() for experimental
271+
PDF.
270272
271273
Return data string.
272274
"""
@@ -377,9 +379,9 @@ def writeResampledObsStr(self):
377379
return s
378380

379381
def findParameters(self):
380-
"""Obtain dictionary of parameters used by self.constraints. The keys
381-
of returned dictionary are integer parameter indices, and their values
382-
Parameter instances, with guessed initial values.
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.
383385
384386
returns dictionary of indices and Parameter instances
385387
"""
@@ -527,9 +529,9 @@ def save(self, z, subpath):
527529
# interface for data sampling
528530

529531
def getFitSamplingType(self):
530-
"""Description of r-sampling used in the fit. This method compares
531-
self.fitrstep with r-sampling in the observed data and with Nyquist r
532-
step.
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.
533535
534536
Return a string, possible values are "data", "Nyquist" or
535537
"custom".
@@ -568,7 +570,8 @@ def setFitSamplingType(self, tp, value=None):
568570
return
569571

570572
def getObsSampling(self):
571-
"""Return the average r-step used in robs or zero when not defined."""
573+
"""Return the average r-step used in robs or zero when not
574+
defined."""
572575
n = len(self.robs)
573576
if n > 1:
574577
rv = (self.robs[-1] - self.robs[0]) / (n - 1.0)
@@ -577,7 +580,8 @@ def getObsSampling(self):
577580
return rv
578581

579582
def getNyquistSampling(self):
580-
"""Return r-step corresponding to Nyquist sampling at the qmax value.
583+
"""Return r-step corresponding to Nyquist sampling at the qmax
584+
value.
581585
582586
When qmax is zero, return r-step in the observed data.
583587
"""
@@ -590,9 +594,9 @@ def getNyquistSampling(self):
590594
# Property Attributes
591595

592596
def _updateRcalcSampling(self):
593-
"""Helper method for resampling rcalc and interpolating related data.
594-
This method interpolates Gcalc, dGcalc, Gtrunc, dGtrunc, crw to new r
595-
grid.
597+
"""Helper method for resampling rcalc and interpolating related
598+
data. This method interpolates Gcalc, dGcalc, Gtrunc, dGtrunc,
599+
crw to new r grid.
596600
597601
No return value.
598602
"""
@@ -815,8 +819,8 @@ def _linear_interpolation(x0, y0, x1, youtleft, youtright):
815819

816820

817821
def grid_interpolation(x0, y0, x1, left=None, right=None, tp=None):
818-
"""Interpolate values from one grid onto another using either linear or
819-
Whittaker–Shannon interpolation.
822+
"""Interpolate values from one grid onto another using either linear
823+
or Whittaker–Shannon interpolation.
820824
821825
Parameters
822826
----------

0 commit comments

Comments
 (0)