Skip to content
Open
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
20 changes: 10 additions & 10 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ ci:
submodules: false
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
rev: v6.0.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
Expand All @@ -21,45 +21,45 @@ repos:
- id: check-toml
- id: check-added-large-files
- repo: https://github.com/psf/black
rev: 24.4.2
rev: 26.3.1
hooks:
- id: black
- repo: https://github.com/pycqa/flake8
rev: 7.0.0
rev: 7.3.0
hooks:
- id: flake8
- repo: https://github.com/pycqa/isort
rev: 5.13.2
rev: 9.0.0a3
hooks:
- id: isort
args: ["--profile", "black"]
- repo: https://github.com/kynan/nbstripout
rev: 0.7.1
rev: 0.9.1
hooks:
- id: nbstripout
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v6.0.0
hooks:
- id: no-commit-to-branch
name: Prevent Commit to Main Branch
args: ["--branch", "main"]
stages: [pre-commit]
- repo: https://github.com/codespell-project/codespell
rev: v2.3.0
rev: v2.4.2
hooks:
- id: codespell
additional_dependencies:
- tomli
# prettier - multi formatter for .json, .yml, and .md files
- repo: https://github.com/pre-commit/mirrors-prettier
rev: f12edd9c7be1c20cfa42420fd0e6df71e42b51ea # frozen: v4.0.0-alpha.8
rev: v4.0.0-alpha.8
hooks:
- id: prettier
additional_dependencies:
- "prettier@^3.2.4"
# docformatter - PEP 257 compliant docstring formatter
- repo: https://github.com/s-weigand/docformatter
rev: 5757c5190d95e5449f102ace83df92e7d3b06c6c
- repo: https://github.com/PyCQA/docformatter
rev: v1.7.8
hooks:
- id: docformatter
additional_dependencies: [tomli]
Expand Down
23 changes: 23 additions & 0 deletions news/precommit-hook-update.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
**Added:**

* No news needed: updating docformatter not user facing

**Changed:**

* <news item>

**Deprecated:**

* <news item>

**Removed:**

* <news item>

**Fixed:**

* <news item>

**Security:**

* <news item>
1 change: 0 additions & 1 deletion src/diffpy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
##############################################################################
"""Blank namespace package for module diffpy."""


from pkgutil import extend_path

__path__ = extend_path(__path__, __name__)
Expand Down
5 changes: 2 additions & 3 deletions src/diffpy/pdfgui/applications/pdfgui.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@
# See LICENSE.txt for license information.
#
##############################################################################
"""
PDFgui Graphical User Interface for Pair Distribution Function fitting
Usage: pdfgui [project.dpp]
"""PDFgui Graphical User Interface for Pair Distribution Function
fitting Usage: pdfgui [project.dpp]

PDFgui is graphical user interface to PDFfit2 - a Python library for PDF
simulation and structure refinement. PDFgui has many nice features such
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 @@ -291,11 +291,12 @@ def save(self, z, subpath):
return

def copy(self, other=None):
"""Copy self to other. if other is None, create new instance.
"""Copy self to other.

other -- reference to other object
if other is None, create new instance.
other -- reference to other object

returns reference to copied object
returns reference to copied object
"""
if other is None:
other = Calculation(self.name)
Expand Down
5 changes: 3 additions & 2 deletions src/diffpy/pdfgui/control/constraint.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,9 @@ 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
35 changes: 21 additions & 14 deletions src/diffpy/pdfgui/control/fitdataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,8 +243,9 @@ 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 @@ -267,8 +268,9 @@ 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 @@ -379,9 +381,11 @@ 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 @@ -434,11 +438,12 @@ def changeParameterIndex(self, oldidx, newidx):
return

def copy(self, other=None):
"""Copy self to other. if other is None, create new instance.
"""Copy self to other.

other -- ref to other object
if other is None, create new instance.
other -- ref to other object

returns reference to copied object
returns reference to copied object
"""
# check arguments
if other is None:
Expand Down Expand Up @@ -529,9 +534,10 @@ 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 @@ -683,7 +689,8 @@ def _set_rcalc(self, value):
_get_rcalc,
_set_rcalc,
doc="""R-grid for refined data, read-only.
Use fitrmin, fitrmax, fitrstep to change it""",
Use fitrmin, fitrmax, fitrstep to change it"""
,
)

# Gcalc
Expand Down
27 changes: 16 additions & 11 deletions src/diffpy/pdfgui/control/fitstructure.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,11 @@ def obtainRefined(self, server, iphase):
return

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

The keys of returned dictionary are integer parameter indices,
and the values are Parameter instances, with guessed initial
values.

returns dictionary of indices and Parameter instances
"""
Expand Down Expand Up @@ -677,11 +679,13 @@ def _parseAtomSelectionString(self, s):
# delayed initialization of the class variable
if self._rxatomselection is None:
FitStructure._rxatomselection = re.compile(
r"""
(?P<negate>!?) # exclamation point
(?:(?P<element>[a-zA-Z]+)$| # element|all or
(?P<start>\d+)(?P<stop>:\d+)?$ # number range
)""",
r"""(?P<negate>!?) # exclamation
point (?:(?P<element>[a-zA-Z]+)$| # element|all
or.

(?P<start>\d+)(?P<stop>:\d+)?$ # number range )
"""
,
re.VERBOSE,
)
assert self._rxatomselection
Expand Down Expand Up @@ -724,11 +728,12 @@ def _parseAtomSelectionString(self, s):
return rv

def copy(self, other=None):
"""Copy self to other. if other is None, create new instance.
"""Copy self to other.

other -- reference to other object
if other is None, create new instance.
other -- reference to other object

returns reference to copied object
returns reference to copied object
"""
# check arguments
if other is None:
Expand Down
17 changes: 10 additions & 7 deletions src/diffpy/pdfgui/control/fitting.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,10 +178,11 @@ def _getStrId(self):
return "f_" + self.name

def copy(self, other=None):
"""Copy self to other. if other is None, create an instance.
"""Copy self to other.

other -- ref to other object
return value: reference to copied object
if other is None, create an instance.
other -- ref to other object
return value: reference to copied object
"""
if other is None:
other = Fitting(self.name)
Expand Down Expand Up @@ -448,8 +449,9 @@ def _configureBondCalculation(self, struc):
return

def outputBondAngle(self, struc, i, j, k):
"""Output bond angle defined by atoms i, j, k. The angle is
calculated using the shortest lengths ji and jk with respect to
"""Output bond angle defined by atoms i, j, k.

The angle is calculated using the shortest lengths ji and jk with respect to
periodic boundary conditions.

struc -- instance of PDFStructure
Expand All @@ -472,8 +474,9 @@ def outputBondAngle(self, struc, i, j, k):
return

def outputBondLengthAtoms(self, struc, i, j):
"""Output shortest bond between atoms i, j. Periodic boundary
conditions are applied to find the shortest bond.
"""Output shortest bond between atoms i, j.

Periodic boundary conditions are applied to find the shortest bond.

struc -- instance of PDFStructure
i, j -- atom indices starting at 1
Expand Down
12 changes: 7 additions & 5 deletions src/diffpy/pdfgui/control/organizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ def spd_constrained(ds):


class Organizer(PDFComponent):
"""Base class for Fitting. It holds separate lists of datasets,
strucs and calculations.
"""Base class for Fitting.

It holds separate lists of datasets, strucs and calculations.

datasets: dataset list
strucs: structure list
Expand Down Expand Up @@ -204,10 +205,11 @@ def save(self, z, subpath):
return

def copy(self, other=None):
"""Copy self to other. if other is None, create an instance.
"""Copy self to other.

other -- ref to other object
returns reference to copied object
if other is None, create an instance.
other -- ref to other object
returns reference to copied object
"""
if other is None:
other = Organizer(self.name)
Expand Down
17 changes: 10 additions & 7 deletions src/diffpy/pdfgui/control/pdfdataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,9 @@ def clear(self):
return

def setvar(self, var, value):
"""Assign data member using PdfFit-style variable. Used by
applyParameters().
"""Assign data member using PdfFit-style variable.

Used by applyParameters().

var -- string representation of dataset PdfFit variable.
Possible values: qdamp, qbroad, dscale
Expand All @@ -116,8 +117,9 @@ def setvar(self, var, value):
return

def getvar(self, var):
"""Obtain value corresponding to PdfFit dataset variable. Used
by findParameters().
"""Obtain value corresponding to PdfFit dataset variable.

Used by findParameters().

var -- string representation of dataset PdfFit variable.
Possible values: qdamp, qbroad, dscale
Expand Down Expand Up @@ -334,10 +336,11 @@ def writeStr(self):
return datastring

def copy(self, other=None):
"""Copy self to other. if other is None, create new instance.
"""Copy self to other.

other -- ref to other object
returns reference to copied object
if other is None, create new instance.
other -- ref to other object
returns reference to copied object
"""
if other is None:
other = PDFDataSet(self.name)
Expand Down
Loading
Loading