Skip to content

Commit 6940a1a

Browse files
committed
skpkg: apply black to all files in the project directory
1 parent 4065098 commit 6940a1a

39 files changed

+1080
-305
lines changed

devutils/sgtbx_extra_groups.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,12 @@
1616
import numpy
1717
from cctbx import sgtbx
1818

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

2126

2227
def tupleToSGArray(tpl):

doc/source/conf.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,13 @@
221221
# (source start file, target name, title,
222222
# author, documentclass [howto, manual, or own class]).
223223
latex_documents = [
224-
("index", "diffpy.structure.tex", "diffpy.structure Documentation", ab_authors, "manual"),
224+
(
225+
"index",
226+
"diffpy.structure.tex",
227+
"diffpy.structure Documentation",
228+
ab_authors,
229+
"manual",
230+
),
225231
]
226232

227233
# The name of an image file (relative to this directory) to place at the top of
@@ -249,7 +255,15 @@
249255

250256
# One entry per manual page. List of tuples
251257
# (source start file, name, description, authors, manual section).
252-
man_pages = [("index", "diffpy.structure", "diffpy.structure Documentation", ab_authors, 1)]
258+
man_pages = [
259+
(
260+
"index",
261+
"diffpy.structure",
262+
"diffpy.structure Documentation",
263+
ab_authors,
264+
1,
265+
)
266+
]
253267

254268
# If true, show URL addresses after external links.
255269
# man_show_urls = False

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ namespaces = false # to disable scanning PEP 420 namespaces (true by default)
5555
dependencies = {file = ["requirements/pip.txt"]}
5656

5757
[tool.black]
58-
line-length = 115
58+
line-length = 79
5959
include = '\.pyi?$'
6060
exclude = '''
6161
/(

src/diffpy/structure/__init__.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,11 @@
4242
from diffpy.structure.parsers import getParser
4343
from diffpy.structure.pdffitstructure import PDFFitStructure
4444
from diffpy.structure.structure import Structure
45-
from diffpy.structure.structureerrors import LatticeError, StructureFormatError, SymmetryError
45+
from diffpy.structure.structureerrors import (
46+
LatticeError,
47+
StructureFormatError,
48+
SymmetryError,
49+
)
4650

4751
# package version
4852
from diffpy.structure.version import __version__

src/diffpy/structure/_legacy_importer.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,11 @@ def exec_module(self, module):
8080
# ----------------------------------------------------------------------------
8181

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

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

src/diffpy/structure/apps/__init__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,4 @@
1313
#
1414
##############################################################################
1515

16-
"""Script applications that use the `diffpy.structure` package.
17-
"""
16+
"""Script applications that use the `diffpy.structure` package."""

src/diffpy/structure/apps/anyeye.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,11 @@ def usage(style=None):
7171
myname = os.path.basename(sys.argv[0])
7272
msg = __doc__.replace("anyeye", myname)
7373
if style == "brief":
74-
msg = msg.split("\n")[1] + "\n" + "Try `%s --help' for more information." % myname
74+
msg = (
75+
msg.split("\n")[1]
76+
+ "\n"
77+
+ "Try `%s --help' for more information." % myname
78+
)
7579
else:
7680
from diffpy.structure.parsers import inputFormats
7781

@@ -139,7 +143,10 @@ def convertStructureFile(pd):
139143
if pd["formula"]:
140144
formula = pd["formula"]
141145
if len(formula) != len(stru):
142-
emsg = "Formula has %i atoms while structure %i" % (len(formula), len(stru))
146+
emsg = "Formula has %i atoms while structure %i" % (
147+
len(formula),
148+
len(stru),
149+
)
143150
raise RuntimeError(emsg)
144151
for a, el in zip(stru, formula):
145152
a.element = el
@@ -218,7 +225,9 @@ def main():
218225
pd["watch"] = False
219226
try:
220227
opts, args = getopt.getopt(
221-
sys.argv[1:], "f:whV", ["formula=", "watch", "viewer=", "formats=", "help", "version"]
228+
sys.argv[1:],
229+
"f:whV",
230+
["formula=", "watch", "viewer=", "formats=", "help", "version"],
222231
)
223232
except getopt.GetoptError as errmsg:
224233
print(errmsg, file=sys.stderr)

src/diffpy/structure/apps/transtru.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,11 @@ def usage(style=None):
5050
myname = os.path.basename(sys.argv[0])
5151
msg = __doc__.replace("transtru", myname)
5252
if style == "brief":
53-
msg = msg.split("\n")[1] + "\n" + "Try `%s --help' for more information." % myname
53+
msg = (
54+
msg.split("\n")[1]
55+
+ "\n"
56+
+ "Try `%s --help' for more information." % myname
57+
)
5458
else:
5559
from diffpy.structure.parsers import inputFormats, outputFormats
5660

@@ -99,7 +103,10 @@ def main():
99103
print("'%s' is not valid output format" % outfmt, file=sys.stderr)
100104
sys.exit(2)
101105
except ValueError:
102-
print("invalid format specification '%s' does not contain .." % args[0], file=sys.stderr)
106+
print(
107+
"invalid format specification '%s' does not contain .." % args[0],
108+
file=sys.stderr,
109+
)
103110
sys.exit(2)
104111
# ready to do some real work
105112
try:

src/diffpy/structure/atom.py

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,9 @@ def msdLat(self, vl):
170170
lat = self.lattice or cartesian_lattice
171171
vln = numpy.array(vl, dtype=float) / lat.norm(vl)
172172
G = lat.metrics
173-
rhs = numpy.array([G[0] * lat.ar, G[1] * lat.br, G[2] * lat.cr], dtype=float)
173+
rhs = numpy.array(
174+
[G[0] * lat.ar, G[1] * lat.br, G[2] * lat.cr], dtype=float
175+
)
174176
rhs = numpy.dot(rhs, vln)
175177
msd = numpy.dot(rhs, numpy.dot(self.U, rhs))
176178
return msd
@@ -202,7 +204,13 @@ def msdCart(self, vc):
202204
def __repr__(self):
203205
"""String representation of this Atom."""
204206
xyz = self.xyz
205-
s = "%-4s %8.6f %8.6f %8.6f %6.4f" % (self.element, xyz[0], xyz[1], xyz[2], self.occupancy)
207+
s = "%-4s %8.6f %8.6f %8.6f %6.4f" % (
208+
self.element,
209+
xyz[0],
210+
xyz[1],
211+
xyz[2],
212+
self.occupancy,
213+
)
206214
return s
207215

208216
def __copy__(self, target=None):
@@ -354,13 +362,19 @@ def _set_Uij(self, i, j, value):
354362
"""
355363

356364
U11 = property(
357-
lambda self: self._get_Uij(0, 0), lambda self, value: self._set_Uij(0, 0, value), doc=_doc_uii.format(0)
365+
lambda self: self._get_Uij(0, 0),
366+
lambda self, value: self._set_Uij(0, 0, value),
367+
doc=_doc_uii.format(0),
358368
)
359369
U22 = property(
360-
lambda self: self._get_Uij(1, 1), lambda self, value: self._set_Uij(1, 1, value), doc=_doc_uii.format(1)
370+
lambda self: self._get_Uij(1, 1),
371+
lambda self, value: self._set_Uij(1, 1, value),
372+
doc=_doc_uii.format(1),
361373
)
362374
U33 = property(
363-
lambda self: self._get_Uij(2, 2), lambda self, value: self._set_Uij(2, 2, value), doc=_doc_uii.format(2)
375+
lambda self: self._get_Uij(2, 2),
376+
lambda self, value: self._set_Uij(2, 2, value),
377+
doc=_doc_uii.format(2),
364378
)
365379

366380
_doc_uij = """
@@ -371,13 +385,19 @@ def _set_Uij(self, i, j, value):
371385
"""
372386

373387
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)
388+
lambda self: self._get_Uij(0, 1),
389+
lambda self, value: self._set_Uij(0, 1, value),
390+
doc=_doc_uij.format(0, 1),
375391
)
376392
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)
393+
lambda self: self._get_Uij(0, 2),
394+
lambda self, value: self._set_Uij(0, 2, value),
395+
doc=_doc_uij.format(0, 2),
378396
)
379397
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)
398+
lambda self: self._get_Uij(1, 2),
399+
lambda self, value: self._set_Uij(1, 2, value),
400+
doc=_doc_uij.format(1, 2),
381401
)
382402

383403
# clean local variables

src/diffpy/structure/expansion/supercell_mod.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@
1313
#
1414
##############################################################################
1515

16-
"""This module contains functions for simple `Structure` manipulation.
17-
"""
16+
"""This module contains functions for simple `Structure` manipulation."""
1817

1918
import numpy
2019

@@ -69,7 +68,12 @@ def supercell(S, mno):
6968
return newS
7069

7170
# back to business
72-
ijklist = [(i, j, k) for i in range(mno[0]) for j in range(mno[1]) for k in range(mno[2])]
71+
ijklist = [
72+
(i, j, k)
73+
for i in range(mno[0])
74+
for j in range(mno[1])
75+
for k in range(mno[2])
76+
]
7377
# numpy.floor returns float array
7478
mnofloats = numpy.array(mno, dtype=float)
7579

@@ -84,7 +88,9 @@ def supercell(S, mno):
8488
newS.__setitem__(slice(None), newAtoms, copy=False)
8589

8690
# take care of lattice parameters
87-
newS.lattice.setLatPar(a=mno[0] * S.lattice.a, b=mno[1] * S.lattice.b, c=mno[2] * S.lattice.c)
91+
newS.lattice.setLatPar(
92+
a=mno[0] * S.lattice.a, b=mno[1] * S.lattice.b, c=mno[2] * S.lattice.c
93+
)
8894
return newS
8995

9096

0 commit comments

Comments
 (0)