Skip to content

Commit 8a7abbe

Browse files
committed
fixed all codespell issues; fixed all line length issues
1 parent bfb7f77 commit 8a7abbe

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+1294
-517
lines changed

.codespell/ignore_words.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,11 @@ socio-economic
99

1010
;; Frobenius norm used in np.linalg.norm
1111
fro
12+
13+
DISCUS
14+
discus
15+
CONECT
16+
Discus
17+
Te
18+
Nd
19+
BU

.pre-commit-config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ repos:
5050
- id: codespell
5151
additional_dependencies:
5252
- tomli
53+
args: [--ignore-words=.codespell/ignore_words.txt]
5354
# prettier - multi formatter for .json, .yml, and .md files
5455
- repo: https://github.com/pre-commit/mirrors-prettier
5556
rev: f12edd9c7be1c20cfa42420fd0e6df71e42b51ea # frozen: v4.0.0-alpha.8

CHANGELOG.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Release Notes
2828
**Fixed:**
2929

3030
* Add getting started section and re-arrange install success check instructions
31-
* Added termial script for transtru app in pyproject.toml
31+
* Added terminal script for transtru app in pyproject.toml
3232
* Changed requires-python to align with classifiers
3333

3434

devutils/sgtbx_extra_groups.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
#!/usr/bin/env python
22

3-
"""Quick and extremely dirty script for generating code for SpaceGroup that
4-
are defined in cctbx, but not in mmLib. It was used to generate module
3+
"""Quick and extremely dirty script for generating code for SpaceGroup that are
4+
defined in cctbx, but not in mmLib. It was used to generate module
55
sgtbxspacegroups.
66
7-
This is a utility script that should not be included with code distribution.
7+
This is a utility script that should not be included with code
8+
distribution.
89
910
Not to be included with code distributions.
1011
"""
@@ -16,7 +17,12 @@
1617
import numpy
1718
from cctbx import sgtbx
1819

19-
from diffpy.structure.spacegroups import IsSpaceGroupIdentifier, SpaceGroup, SymOp, mmLibSpaceGroupList
20+
from diffpy.structure.spacegroups import (
21+
IsSpaceGroupIdentifier,
22+
SpaceGroup,
23+
SymOp,
24+
mmLibSpaceGroupList,
25+
)
2026

2127

2228
def tupleToSGArray(tpl):

src/diffpy/structure/__init__.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@
1212
# See LICENSE.rst for license information.
1313
#
1414
##############################################################################
15-
16-
"""
17-
Crystal structure container and parsers for structure formats.
15+
"""Crystal structure container and parsers for structure formats.
1816
1917
Classes related to the structure of materials:
2018
* Atom
@@ -42,7 +40,11 @@
4240
from diffpy.structure.parsers import getParser
4341
from diffpy.structure.pdffitstructure import PDFFitStructure
4442
from diffpy.structure.structure import Structure
45-
from diffpy.structure.structureerrors import LatticeError, StructureFormatError, SymmetryError
43+
from diffpy.structure.structureerrors import (
44+
LatticeError,
45+
StructureFormatError,
46+
SymmetryError,
47+
)
4648

4749
# package version
4850
from diffpy.structure.version import __version__

src/diffpy/structure/_legacy_importer.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@
1212
# See LICENSE.txt for license information.
1313
#
1414
##############################################################################
15-
16-
"""
17-
Support import of old camel-case module names with DeprecationWarning.
15+
"""Support import of old camel-case module names with DeprecationWarning.
1816
1917
The imported camel-case modules are aliases for the current module
2018
instances. Their `__name__` attributes are thus all in lower-case.
@@ -61,6 +59,7 @@ def find_spec(self, fullname, path=None, target=None):
6159

6260
class MapRenamedStructureModule(importlib.abc.Loader):
6361
"""Loader for old camel-case module names.
62+
6463
Import the current module and alias it under the old name.
6564
"""
6665

@@ -80,7 +79,11 @@ def exec_module(self, module):
8079
# ----------------------------------------------------------------------------
8180

8281
# show deprecation warning for diffpy.Structure
83-
warn(WMSG.format("diffpy.Structure", "diffpy.structure"), DeprecationWarning, stacklevel=2)
82+
warn(
83+
WMSG.format("diffpy.Structure", "diffpy.structure"),
84+
DeprecationWarning,
85+
stacklevel=2,
86+
)
8487

8588
# install meta path finder for diffpy.Structure submodules
8689
sys.meta_path.append(FindRenamedStructureModule())

src/diffpy/structure/apps/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,4 @@
1212
# See LICENSE_DANSE.txt for license information.
1313
#
1414
##############################################################################
15-
1615
"""Script applications that use the `diffpy.structure` package."""

src/diffpy/structure/apps/anyeye.py

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,13 @@
1212
# See LICENSE_DANSE.txt for license information.
1313
#
1414
##############################################################################
15-
16-
"""
17-
Anyeye view structure file in atomeye.
15+
"""Anyeye view structure file in atomeye.
1816
1917
Usage: ``anyeye [options] strufile``
2018
21-
Anyeye understands more `Structure` formats than atomeye. It converts `strufile`
22-
to a temporary XCFG file which is opened in atomeye. See supported file formats:
19+
Anyeye understands more `Structure` formats than atomeye. It converts
20+
`strufile` to a temporary XCFG file which is opened in atomeye. See supported
21+
file formats:
2322
``inputFormats``
2423
2524
Options:
@@ -71,7 +70,11 @@ def usage(style=None):
7170
myname = os.path.basename(sys.argv[0])
7271
msg = __doc__.replace("anyeye", myname)
7372
if style == "brief":
74-
msg = msg.split("\n")[1] + "\n" + "Try `%s --help' for more information." % myname
73+
msg = (
74+
msg.split("\n")[1]
75+
+ "\n"
76+
+ "Try `%s --help' for more information." % myname
77+
)
7578
else:
7679
from diffpy.structure.parsers import inputFormats
7780

@@ -139,7 +142,10 @@ def convertStructureFile(pd):
139142
if pd["formula"]:
140143
formula = pd["formula"]
141144
if len(formula) != len(stru):
142-
emsg = "Formula has %i atoms while structure %i" % (len(formula), len(stru))
145+
emsg = "Formula has %i atoms while structure %i" % (
146+
len(formula),
147+
len(stru),
148+
)
143149
raise RuntimeError(emsg)
144150
for a, el in zip(stru, formula):
145151
a.element = el
@@ -175,7 +181,7 @@ def cleanUp(pd):
175181

176182

177183
def parseFormula(formula):
178-
"""Parse chemical formula and return a list of elements"""
184+
"""Parse chemical formula and return a list of elements."""
179185
# remove all blanks
180186
formula = re.sub(r"\s", "", formula)
181187
if not re.match("^[A-Z]", formula):
@@ -218,7 +224,9 @@ def main():
218224
pd["watch"] = False
219225
try:
220226
opts, args = getopt.getopt(
221-
sys.argv[1:], "f:whV", ["formula=", "watch", "viewer=", "formats=", "help", "version"]
227+
sys.argv[1:],
228+
"f:whV",
229+
["formula=", "watch", "viewer=", "formats=", "help", "version"],
222230
)
223231
except getopt.GetoptError as errmsg:
224232
print(errmsg, file=sys.stderr)

src/diffpy/structure/apps/transtru.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,13 @@
1212
# See LICENSE_DANSE.txt for license information.
1313
#
1414
##############################################################################
15-
1615
"""Translate structure file to different format.
1716
1817
Usage: ``transtru INFMT..OUTFMT strufile``
1918
20-
Translates structure file strufile from `INFMT` to `OUTFMT` format and prints it
21-
to the screen. Use "-" as `strufile` to read from standard input. To save the
22-
translated file, use
19+
Translates structure file strufile from `INFMT` to `OUTFMT` format and prints
20+
it to the screen. Use "-" as `strufile` to read from standard input. To save
21+
the translated file, use
2322
2423
``transtru INFMT..OUTFMT strufile > strufile.out``
2524
@@ -50,7 +49,11 @@ def usage(style=None):
5049
myname = os.path.basename(sys.argv[0])
5150
msg = __doc__.replace("transtru", myname)
5251
if style == "brief":
53-
msg = msg.split("\n")[1] + "\n" + "Try `%s --help' for more information." % myname
52+
msg = (
53+
msg.split("\n")[1]
54+
+ "\n"
55+
+ "Try `%s --help' for more information." % myname
56+
)
5457
else:
5558
from diffpy.structure.parsers import inputFormats, outputFormats
5659

@@ -99,7 +102,10 @@ def main():
99102
print("'%s' is not valid output format" % outfmt, file=sys.stderr)
100103
sys.exit(2)
101104
except ValueError:
102-
print("invalid format specification '%s' does not contain .." % args[0], file=sys.stderr)
105+
print(
106+
"invalid format specification '%s' does not contain .." % args[0],
107+
file=sys.stderr,
108+
)
103109
sys.exit(2)
104110
# ready to do some real work
105111
try:

src/diffpy/structure/atom.py

Lines changed: 31 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,7 @@
1212
# See LICENSE_DANSE.txt for license information.
1313
#
1414
##############################################################################
15-
16-
"""
17-
Provide class Atom for managing properties of an atom in structure model.
18-
"""
15+
"""Provide class Atom for managing properties of an atom in structure model."""
1916

2017
import numpy
2118

@@ -170,7 +167,9 @@ def msdLat(self, vl):
170167
lat = self.lattice or cartesian_lattice
171168
vln = numpy.array(vl, dtype=float) / lat.norm(vl)
172169
G = lat.metrics
173-
rhs = numpy.array([G[0] * lat.ar, G[1] * lat.br, G[2] * lat.cr], dtype=float)
170+
rhs = numpy.array(
171+
[G[0] * lat.ar, G[1] * lat.br, G[2] * lat.cr], dtype=float
172+
)
174173
rhs = numpy.dot(rhs, vln)
175174
msd = numpy.dot(rhs, numpy.dot(self.U, rhs))
176175
return msd
@@ -202,7 +201,13 @@ def msdCart(self, vc):
202201
def __repr__(self):
203202
"""String representation of this Atom."""
204203
xyz = self.xyz
205-
s = "%-4s %8.6f %8.6f %8.6f %6.4f" % (self.element, xyz[0], xyz[1], xyz[2], self.occupancy)
204+
s = "%-4s %8.6f %8.6f %8.6f %6.4f" % (
205+
self.element,
206+
xyz[0],
207+
xyz[1],
208+
xyz[2],
209+
self.occupancy,
210+
)
206211
return s
207212

208213
def __copy__(self, target=None):
@@ -354,13 +359,19 @@ def _set_Uij(self, i, j, value):
354359
"""
355360

356361
U11 = property(
357-
lambda self: self._get_Uij(0, 0), lambda self, value: self._set_Uij(0, 0, value), doc=_doc_uii.format(0)
362+
lambda self: self._get_Uij(0, 0),
363+
lambda self, value: self._set_Uij(0, 0, value),
364+
doc=_doc_uii.format(0),
358365
)
359366
U22 = property(
360-
lambda self: self._get_Uij(1, 1), lambda self, value: self._set_Uij(1, 1, value), doc=_doc_uii.format(1)
367+
lambda self: self._get_Uij(1, 1),
368+
lambda self, value: self._set_Uij(1, 1, value),
369+
doc=_doc_uii.format(1),
361370
)
362371
U33 = property(
363-
lambda self: self._get_Uij(2, 2), lambda self, value: self._set_Uij(2, 2, value), doc=_doc_uii.format(2)
372+
lambda self: self._get_Uij(2, 2),
373+
lambda self, value: self._set_Uij(2, 2, value),
374+
doc=_doc_uii.format(2),
364375
)
365376

366377
_doc_uij = """
@@ -371,13 +382,19 @@ def _set_Uij(self, i, j, value):
371382
"""
372383

373384
U12 = property(
374-
lambda self: self._get_Uij(0, 1), lambda self, value: self._set_Uij(0, 1, value), doc=_doc_uij.format(0, 1)
385+
lambda self: self._get_Uij(0, 1),
386+
lambda self, value: self._set_Uij(0, 1, value),
387+
doc=_doc_uij.format(0, 1),
375388
)
376389
U13 = property(
377-
lambda self: self._get_Uij(0, 2), lambda self, value: self._set_Uij(0, 2, value), doc=_doc_uij.format(0, 2)
390+
lambda self: self._get_Uij(0, 2),
391+
lambda self, value: self._set_Uij(0, 2, value),
392+
doc=_doc_uij.format(0, 2),
378393
)
379394
U23 = property(
380-
lambda self: self._get_Uij(1, 2), lambda self, value: self._set_Uij(1, 2, value), doc=_doc_uij.format(1, 2)
395+
lambda self: self._get_Uij(1, 2),
396+
lambda self, value: self._set_Uij(1, 2, value),
397+
doc=_doc_uij.format(1, 2),
381398
)
382399

383400
# clean local variables
@@ -481,7 +498,8 @@ def Uisoequiv(self, value):
481498

482499
@property
483500
def Bisoequiv(self):
484-
"""float : The Debye-Waller isotropic displacement or an equivalent value.
501+
"""float : The Debye-Waller isotropic displacement or an equivalent
502+
value.
485503
486504
This equals ``8 * pi**2 * Uisoequiv``. Setting a new value
487505
rescales `U` tensor to yield equivalent direction-average of

0 commit comments

Comments
 (0)