Skip to content

ci: add docformatter in pyproject.toml #285

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion doc/source/manual_resources/tui_mno_bond_lengths.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env python

"""Extract the shortest Mn-O bond lengths from all fits in PDFgui project.
"""Extract the shortest Mn-O bond lengths from all fits in PDFgui
project.

This script loops through all refined phases in PDFgui project and
calculates their shortest Mn-O bond lengths using diffpy.pdffit2
Expand Down
4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,7 @@ exclude = '''
| tests/data
)/
'''
[tool.docformatter]
recursive = true
wrap-summaries = 72
wrap-descriptions = 72
6 changes: 3 additions & 3 deletions src/diffpy/pdfgui/applications/pdfgui.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ def version():


def processArguments(argv1):
"""Process command line arguments and store results in pdfguiglobals. This
method updates cmdopts, cmdargs and dbopts attributes in the pdfguiglobals
module.
"""Process command line arguments and store results in
pdfguiglobals. This method updates cmdopts, cmdargs and dbopts
attributes in the pdfguiglobals module.

argv1 -- list of command line arguments excluding the executable

Expand Down
7 changes: 4 additions & 3 deletions src/diffpy/pdfgui/control/calculation.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
# See LICENSE.txt for license information.
#
##############################################################################
"""Class Calculation for performing PDF simulation from model structure."""
"""Class Calculation for performing PDF simulation from model
structure."""

import copy
import math
Expand Down Expand Up @@ -76,8 +77,8 @@ def _getStrId(self):
return "c_" + self.name

def setRGrid(self, rmin=None, rstep=None, rmax=None):
"""Change specified r-grid parameters (rmin, rstep, rmax). Adjust rmax
for integer number of steps.
"""Change specified r-grid parameters (rmin, rstep, rmax).
Adjust rmax for integer number of steps.

rmin -- new low rcalc boundary
rstep -- new r-grid step
Expand Down
8 changes: 4 additions & 4 deletions src/diffpy/pdfgui/control/constraint.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
# See LICENSE.txt for license information.
#
##############################################################################
"""Class Constraint for storage of a single constraint equation constraints
will be stored in { variable : constraint } dictionary."""
"""Class Constraint for storage of a single constraint equation
constraints will be stored in { variable : constraint } dictionary."""

import math
import re
Expand Down Expand Up @@ -67,8 +67,8 @@ def evalFormula(self, parvalues):
return result

def lambdaFormula(self):
"""Build lambda function from constraint formula. Lambda function
expects dictionary argument.
"""Build lambda function from constraint formula. Lambda
function expects dictionary argument.

returns lambda function
"""
Expand Down
10 changes: 6 additions & 4 deletions src/diffpy/pdfgui/control/controlerrors.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ class ControlFileError(ControlError):


class ControlKeyError(ControlError):
"""PDFGuiControl exception class -- requested object can't be found."""
"""PDFGuiControl exception class -- requested object can't be
found."""

pass

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


class ControlRuntimeError(ControlError):
"""PDFGuiControl exception class -- various irrecoverable runtime error."""
"""PDFGuiControl exception class -- various irrecoverable runtime
error."""

pass

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


class TempControlSelectError(ControlError):
"""Temporary define this error to identify the select-control error in
python3."""
"""Temporary define this error to identify the select-control error
in python3."""

pass

Expand Down
42 changes: 23 additions & 19 deletions src/diffpy/pdfgui/control/fitdataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@


class FitDataSet(PDFDataSet):
"""FitDataSet stores experimental and calculated PDF data and related
fitting parameters. Inherited from PDFDataSet.
"""FitDataSet stores experimental and calculated PDF data and
related fitting parameters. Inherited from PDFDataSet.

Data members (in addition to those in PDFDataSet):

Expand Down Expand Up @@ -204,8 +204,8 @@ def read(self, filename):
return self.readObs(filename)

def _updateRcalcRange(self):
"""Helper method for updating fitrmin, fitrmax and fitrstep just after
reading observed values.
"""Helper method for updating fitrmin, fitrmax and fitrstep just
after reading observed values.

No return value.
"""
Expand Down Expand Up @@ -243,7 +243,8 @@ def readObsStr(self, datastring):
return self

def write(self, filename):
"""Same as writeCalc(). Use writeObs() to save experimental PDF data.
"""Same as writeCalc(). Use writeObs() to save experimental PDF
data.

filename -- name of file to write to

Expand All @@ -266,7 +267,8 @@ def writeCalc(self, filename):
return

def writeStr(self):
"""Same as writeCalcStr. Use writeObsStr() for experimental PDF.
"""Same as writeCalcStr. Use writeObsStr() for experimental
PDF.

Return data string.
"""
Expand Down Expand Up @@ -377,9 +379,9 @@ def writeResampledObsStr(self):
return s

def findParameters(self):
"""Obtain dictionary of parameters used by self.constraints. The keys
of returned dictionary are integer parameter indices, and their values
Parameter instances, with guessed initial values.
"""Obtain dictionary of parameters used by self.constraints. The
keys of returned dictionary are integer parameter indices, and
their values Parameter instances, with guessed initial values.

returns dictionary of indices and Parameter instances
"""
Expand Down Expand Up @@ -527,9 +529,9 @@ def save(self, z, subpath):
# interface for data sampling

def getFitSamplingType(self):
"""Description of r-sampling used in the fit. This method compares
self.fitrstep with r-sampling in the observed data and with Nyquist r
step.
"""Description of r-sampling used in the fit. This method
compares self.fitrstep with r-sampling in the observed data and
with Nyquist r step.

Return a string, possible values are "data", "Nyquist" or
"custom".
Expand Down Expand Up @@ -568,7 +570,8 @@ def setFitSamplingType(self, tp, value=None):
return

def getObsSampling(self):
"""Return the average r-step used in robs or zero when not defined."""
"""Return the average r-step used in robs or zero when not
defined."""
n = len(self.robs)
if n > 1:
rv = (self.robs[-1] - self.robs[0]) / (n - 1.0)
Expand All @@ -577,7 +580,8 @@ def getObsSampling(self):
return rv

def getNyquistSampling(self):
"""Return r-step corresponding to Nyquist sampling at the qmax value.
"""Return r-step corresponding to Nyquist sampling at the qmax
value.

When qmax is zero, return r-step in the observed data.
"""
Expand All @@ -590,9 +594,9 @@ def getNyquistSampling(self):
# Property Attributes

def _updateRcalcSampling(self):
"""Helper method for resampling rcalc and interpolating related data.
This method interpolates Gcalc, dGcalc, Gtrunc, dGtrunc, crw to new r
grid.
"""Helper method for resampling rcalc and interpolating related
data. This method interpolates Gcalc, dGcalc, Gtrunc, dGtrunc,
crw to new r grid.

No return value.
"""
Expand Down Expand Up @@ -815,8 +819,8 @@ def _linear_interpolation(x0, y0, x1, youtleft, youtright):


def grid_interpolation(x0, y0, x1, left=None, right=None, tp=None):
"""Interpolate values from one grid onto another using either linear or
Whittaker–Shannon interpolation.
"""Interpolate values from one grid onto another using either linear
or Whittaker–Shannon interpolation.

Parameters
----------
Expand Down
Loading
Loading