Skip to content

skpkg: apply black line-length 79 to all files in the project directory #131

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

Closed
wants to merge 2 commits into from
Closed
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
18 changes: 16 additions & 2 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,13 @@
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
("index", "diffpy.structure.tex", "diffpy.structure Documentation", ab_authors, "manual"),
(
"index",
"diffpy.structure.tex",
"diffpy.structure Documentation",
ab_authors,
"manual",
),
]

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

# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [("index", "diffpy.structure", "diffpy.structure Documentation", ab_authors, 1)]
man_pages = [
(
"index",
"diffpy.structure",
"diffpy.structure Documentation",
ab_authors,
1,
)
]

# If true, show URL addresses after external links.
# man_show_urls = False
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ namespaces = false # to disable scanning PEP 420 namespaces (true by default)
dependencies = {file = ["requirements/pip.txt"]}

[tool.black]
line-length = 115
line-length = 79
include = '\.pyi?$'
exclude = '''
/(
Expand Down
6 changes: 5 additions & 1 deletion src/diffpy/structure/_legacy_importer.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,11 @@ def exec_module(self, module):
# ----------------------------------------------------------------------------

# show deprecation warning for diffpy.Structure
warn(WMSG.format("diffpy.Structure", "diffpy.structure"), DeprecationWarning, stacklevel=2)
warn(
WMSG.format("diffpy.Structure", "diffpy.structure"),
DeprecationWarning,
stacklevel=2,
)

# install meta path finder for diffpy.Structure submodules
sys.meta_path.append(FindRenamedStructureModule())
Expand Down
3 changes: 1 addition & 2 deletions src/diffpy/structure/apps/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,4 @@
#
##############################################################################

"""Script applications that use the `diffpy.structure` package.
"""
"""Script applications that use the `diffpy.structure` package."""
15 changes: 12 additions & 3 deletions src/diffpy/structure/apps/anyeye.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,11 @@ def usage(style=None):
myname = os.path.basename(sys.argv[0])
msg = __doc__.replace("anyeye", myname)
if style == "brief":
msg = msg.split("\n")[1] + "\n" + "Try `%s --help' for more information." % myname
msg = (
msg.split("\n")[1]
+ "\n"
+ "Try `%s --help' for more information." % myname
)
else:
from diffpy.structure.parsers import inputFormats

Expand Down Expand Up @@ -139,7 +143,10 @@ def convertStructureFile(pd):
if pd["formula"]:
formula = pd["formula"]
if len(formula) != len(stru):
emsg = "Formula has %i atoms while structure %i" % (len(formula), len(stru))
emsg = "Formula has %i atoms while structure %i" % (
len(formula),
len(stru),
)
raise RuntimeError(emsg)
for a, el in zip(stru, formula):
a.element = el
Expand Down Expand Up @@ -218,7 +225,9 @@ def main():
pd["watch"] = False
try:
opts, args = getopt.getopt(
sys.argv[1:], "f:whV", ["formula=", "watch", "viewer=", "formats=", "help", "version"]
sys.argv[1:],
"f:whV",
["formula=", "watch", "viewer=", "formats=", "help", "version"],
)
except getopt.GetoptError as errmsg:
print(errmsg, file=sys.stderr)
Expand Down
11 changes: 9 additions & 2 deletions src/diffpy/structure/apps/transtru.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,11 @@ def usage(style=None):
myname = os.path.basename(sys.argv[0])
msg = __doc__.replace("transtru", myname)
if style == "brief":
msg = msg.split("\n")[1] + "\n" + "Try `%s --help' for more information." % myname
msg = (
msg.split("\n")[1]
+ "\n"
+ "Try `%s --help' for more information." % myname
)
else:
from diffpy.structure.parsers import inputFormats, outputFormats

Expand Down Expand Up @@ -99,7 +103,10 @@ def main():
print("'%s' is not valid output format" % outfmt, file=sys.stderr)
sys.exit(2)
except ValueError:
print("invalid format specification '%s' does not contain .." % args[0], file=sys.stderr)
print(
"invalid format specification '%s' does not contain .." % args[0],
file=sys.stderr,
)
sys.exit(2)
# ready to do some real work
try:
Expand Down
36 changes: 28 additions & 8 deletions src/diffpy/structure/atom.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,9 @@ def msdLat(self, vl):
lat = self.lattice or cartesian_lattice
vln = numpy.array(vl, dtype=float) / lat.norm(vl)
G = lat.metrics
rhs = numpy.array([G[0] * lat.ar, G[1] * lat.br, G[2] * lat.cr], dtype=float)
rhs = numpy.array(
[G[0] * lat.ar, G[1] * lat.br, G[2] * lat.cr], dtype=float
)
rhs = numpy.dot(rhs, vln)
msd = numpy.dot(rhs, numpy.dot(self.U, rhs))
return msd
Expand Down Expand Up @@ -202,7 +204,13 @@ def msdCart(self, vc):
def __repr__(self):
"""String representation of this Atom."""
xyz = self.xyz
s = "%-4s %8.6f %8.6f %8.6f %6.4f" % (self.element, xyz[0], xyz[1], xyz[2], self.occupancy)
s = "%-4s %8.6f %8.6f %8.6f %6.4f" % (
self.element,
xyz[0],
xyz[1],
xyz[2],
self.occupancy,
)
return s

def __copy__(self, target=None):
Expand Down Expand Up @@ -354,13 +362,19 @@ def _set_Uij(self, i, j, value):
"""

U11 = property(
lambda self: self._get_Uij(0, 0), lambda self, value: self._set_Uij(0, 0, value), doc=_doc_uii.format(0)
lambda self: self._get_Uij(0, 0),
lambda self, value: self._set_Uij(0, 0, value),
doc=_doc_uii.format(0),
)
U22 = property(
lambda self: self._get_Uij(1, 1), lambda self, value: self._set_Uij(1, 1, value), doc=_doc_uii.format(1)
lambda self: self._get_Uij(1, 1),
lambda self, value: self._set_Uij(1, 1, value),
doc=_doc_uii.format(1),
)
U33 = property(
lambda self: self._get_Uij(2, 2), lambda self, value: self._set_Uij(2, 2, value), doc=_doc_uii.format(2)
lambda self: self._get_Uij(2, 2),
lambda self, value: self._set_Uij(2, 2, value),
doc=_doc_uii.format(2),
)

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

U12 = property(
lambda self: self._get_Uij(0, 1), lambda self, value: self._set_Uij(0, 1, value), doc=_doc_uij.format(0, 1)
lambda self: self._get_Uij(0, 1),
lambda self, value: self._set_Uij(0, 1, value),
doc=_doc_uij.format(0, 1),
)
U13 = property(
lambda self: self._get_Uij(0, 2), lambda self, value: self._set_Uij(0, 2, value), doc=_doc_uij.format(0, 2)
lambda self: self._get_Uij(0, 2),
lambda self, value: self._set_Uij(0, 2, value),
doc=_doc_uij.format(0, 2),
)
U23 = property(
lambda self: self._get_Uij(1, 2), lambda self, value: self._set_Uij(1, 2, value), doc=_doc_uij.format(1, 2)
lambda self: self._get_Uij(1, 2),
lambda self, value: self._set_Uij(1, 2, value),
doc=_doc_uij.format(1, 2),
)

# clean local variables
Expand Down
14 changes: 10 additions & 4 deletions src/diffpy/structure/expansion/supercell_mod.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@
#
##############################################################################

"""This module contains functions for simple `Structure` manipulation.
"""
"""This module contains functions for simple `Structure` manipulation."""

import numpy

Expand Down Expand Up @@ -69,7 +68,12 @@ def supercell(S, mno):
return newS

# back to business
ijklist = [(i, j, k) for i in range(mno[0]) for j in range(mno[1]) for k in range(mno[2])]
ijklist = [
(i, j, k)
for i in range(mno[0])
for j in range(mno[1])
for k in range(mno[2])
]
# numpy.floor returns float array
mnofloats = numpy.array(mno, dtype=float)

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

# take care of lattice parameters
newS.lattice.setLatPar(a=mno[0] * S.lattice.a, b=mno[1] * S.lattice.b, c=mno[2] * S.lattice.c)
newS.lattice.setLatPar(
a=mno[0] * S.lattice.a, b=mno[1] * S.lattice.b, c=mno[2] * S.lattice.c
)
return newS


Expand Down
Loading