Skip to content

Commit 7bed9c2

Browse files
committed
flake8 fixes
1 parent 3a8ab08 commit 7bed9c2

File tree

17 files changed

+221
-220
lines changed

17 files changed

+221
-220
lines changed

devutils/makesdist

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,11 @@ import os
1010
import subprocess
1111
import sys
1212
import tarfile
13+
from setup import FALLBACK_VERSION, versiondata
1314

1415
BASEDIR = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
1516
sys.path.insert(0, BASEDIR)
1617

17-
from setup import FALLBACK_VERSION, versiondata
18-
1918
timestamp = versiondata.getint("DEFAULT", "timestamp")
2019

2120
vfb = versiondata.get("DEFAULT", "version").split(".post")[0] + ".post0"

src/diffpy/structure/__init__.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,13 @@
3232
from diffpy.structure.pdffitstructure import PDFFitStructure
3333
from diffpy.structure.structure import Structure
3434
from diffpy.structure.structureerrors import LatticeError, StructureFormatError, SymmetryError
35-
36-
# obtain version information
37-
38-
"""Crystal structure container and parsers for structure formats."""
35+
from diffpy.structure.parsers import getParser
3936

4037
# package version
4138
from diffpy.structure.version import __version__
4239

40+
"""Crystal structure container and parsers for structure formats."""
41+
4342
# top level routines
4443

4544

@@ -68,7 +67,6 @@ def loadStructure(filename, fmt="auto", **kw):
6867
Return a more specific PDFFitStructure type for 'pdffit'
6968
and 'discus' formats.
7069
"""
71-
from diffpy.structure.parsers import getParser
7270

7371
p = getParser(fmt, **kw)
7472
rv = p.parseFile(filename)

src/diffpy/structure/mmlibspacegroups.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#!/usr/bin/env python
2-
## Copyright 2002 by PyMMLib Development Group, http://pymmlib.sourceforge.net/
3-
## This code is part of the PyMMLib distribution and governed by
4-
## its license. Please see the LICENSE_pymmlib file that should have been
5-
## included as part of this package.
2+
# Copyright 2002 by PyMMLib Development Group, http://pymmlib.sourceforge.net/
3+
# This code is part of the PyMMLib distribution and governed by
4+
# its license. Please see the LICENSE_pymmlib file that should have been
5+
# included as part of this package.
66
"""Space groups defined as a part of the pymmlib.
77
"""
88

@@ -107,7 +107,7 @@
107107
Tr_34_34_34,
108108
)
109109

110-
## spacegroup definitions
110+
# spacegroup definitions
111111
sg1 = SpaceGroup(
112112
number=1,
113113
num_sym_equiv=1,
@@ -7884,7 +7884,7 @@
78847884
)
78857885

78867886

7887-
## list of the space groups
7887+
# list of the space groups
78887888
mmLibSpaceGroupList = [
78897889
sg1,
78907890
sg2,

src/diffpy/structure/parsers/p_cif.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ def _parse_atom_site_aniso_label(self, block):
460460
break
461461
idx = self.labelindex[lb]
462462
a = self.stru[idx]
463-
if not lb in self.anisotropy:
463+
if lb not in self.anisotropy:
464464
a.anisotropy = True
465465
self.anisotropy[lb] = True
466466
for fset, val in zip(prop_setters, values):
@@ -544,7 +544,7 @@ def _expandAsymmetricUnit(self, block):
544544
# setup anisotropy according to symmetry requirements
545545
# unless it was already explicitly set
546546
for ca, uisotropy in zip(self.stru, self.eau.Uisotropy):
547-
if not ca.label in self.anisotropy:
547+
if ca.label not in self.anisotropy:
548548
ca.anisotropy = not uisotropy
549549
self.anisotropy[ca.label] = ca.anisotropy
550550
# build a nested list of new atoms:

src/diffpy/structure/parsers/p_pdffit.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -54,17 +54,17 @@ def parseLines(self, lines):
5454
stop -= 1
5555
ilines = iter(lines[:stop])
5656
# read header of PDFFit file
57-
for l in ilines:
57+
for line in ilines:
5858
p_nl += 1
59-
words = l.split()
59+
words = line.split()
6060
if len(words) == 0 or words[0][0] == "#":
6161
continue
6262
elif words[0] == "title":
63-
stru.title = l.lstrip()[5:].strip()
63+
stru.title = line.lstrip()[5:].strip()
6464
elif words[0] == "scale":
6565
stru.pdffit["scale"] = float(words[1])
6666
elif words[0] == "sharp":
67-
l1 = l.replace(",", " ")
67+
l1 = line.replace(",", " ")
6868
sharp_pars = [float(w) for w in l1.split()[1:]]
6969
if len(sharp_pars) < 4:
7070
stru.pdffit["delta2"] = sharp_pars[0]
@@ -77,21 +77,21 @@ def parseLines(self, lines):
7777
stru.pdffit["rcut"] = sharp_pars[3]
7878
elif words[0] == "spcgr":
7979
key = "spcgr"
80-
start = l.find(key) + len(key)
81-
value = l[start:].strip()
80+
start = line.find(key) + len(key)
81+
value = line[start:].strip()
8282
stru.pdffit["spcgr"] = value
8383
elif words[0] == "shape":
84-
self._parse_shape(l)
84+
self._parse_shape(line)
8585
elif words[0] == "cell":
8686
cell_line_read = True
87-
l1 = l.replace(",", " ")
87+
l1 = line.replace(",", " ")
8888
latpars = [float(w) for w in l1.split()[1:7]]
8989
stru.lattice = Lattice(*latpars)
9090
elif words[0] == "dcell":
91-
l1 = l.replace(",", " ")
91+
l1 = line.replace(",", " ")
9292
stru.pdffit["dcell"] = [float(w) for w in l1.split()[1:7]]
9393
elif words[0] == "ncell":
94-
l1 = l.replace(",", " ")
94+
l1 = line.replace(",", " ")
9595
stru.pdffit["ncell"] = [int(w) for w in l1.split()[1:5]]
9696
elif words[0] == "format":
9797
if words[1] != "pdffit":
@@ -100,17 +100,17 @@ def parseLines(self, lines):
100100
elif words[0] == "atoms" and cell_line_read:
101101
break
102102
else:
103-
self.ignored_lines.append(l)
103+
self.ignored_lines.append(line)
104104
# Header reading finished, check if required lines were present.
105105
if not cell_line_read:
106106
emsg = "%d: file is not in PDFfit format" % p_nl
107107
raise StructureFormatError(emsg)
108108
# Load data from atom entries.
109109
p_natoms = reduce(lambda x, y: x * y, stru.pdffit["ncell"])
110110
# we are now inside data block
111-
for l in ilines:
111+
for line in ilines:
112112
p_nl += 1
113-
wl1 = l.split()
113+
wl1 = line.split()
114114
element = wl1[0][0].upper() + wl1[0][1:].lower()
115115
xyz = [float(w) for w in wl1[1:4]]
116116
occ = float(wl1[4])
@@ -176,8 +176,8 @@ def toLines(self, stru):
176176
d_sigo = 0.0
177177
d_sigU = numpy.zeros((3, 3), dtype=float)
178178
# here we can start
179-
l = "title " + stru.title
180-
lines.append(l.strip())
179+
line = "title " + stru.title
180+
lines.append(line.strip())
181181
lines.append("format pdffit")
182182
lines.append("scale %9.6f" % stru_pdffit["scale"])
183183
lines.append(

src/diffpy/structure/parsers/p_rawxyz.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def parseLines(self, lines):
4040
4141
Return Structure object or raise StructureFormatError.
4242
"""
43-
linefields = [l.split() for l in lines]
43+
linefields = [line.split() for line in lines]
4444
# prepare output structure
4545
stru = Structure()
4646
# find first valid record

src/diffpy/structure/parsers/p_xcfg.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,12 +215,12 @@ def parseLines(self, lines):
215215
else:
216216
break
217217
# check header for consistency
218-
if numpy.any(xcfg_H0_set == False):
218+
if not numpy.all(xcfg_H0_set):
219219
emsg = "H0 tensor is not properly defined"
220220
raise StructureFormatError(emsg)
221221
p_auxnum = len(p_auxiliary) and max(p_auxiliary.keys()) + 1
222222
for i in range(p_auxnum):
223-
if not i in p_auxiliary:
223+
if i not in p_auxiliary:
224224
p_auxiliary[i] = "aux%d" % i
225225
sorted_aux_keys = sorted(p_auxiliary.keys())
226226
if p_auxnum != 0:

src/diffpy/structure/parsers/p_xyz.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def parseLines(self, lines):
4040
4141
Return Structure object or raise StructureFormatError.
4242
"""
43-
linefields = [l.split() for l in lines]
43+
linefields = [line.split() for line in lines]
4444
# prepare output structure
4545
stru = Structure()
4646
# find first valid record

src/diffpy/structure/spacegroupmod.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
#!/usr/bin/env python
2-
## Copyright 2002 by PyMMLib Development Group, http://pymmlib.sourceforge.net/
3-
## This code is part of the PyMMLib distribution and governed by
4-
## its license. Please see the LICENSE_pymmlib file that should have been
5-
## included as part of this package.
2+
# Copyright 2002 by PyMMLib Development Group, http://pymmlib.sourceforge.net/
3+
# This code is part of the PyMMLib distribution and governed by
4+
# its license. Please see the LICENSE_pymmlib file that should have been
5+
# included as part of this package.
66
"""Symmetry operations as functions on vectors or arrays.
77
"""
88

99
import numpy
1010

11-
## 64 unique rotation matricies
11+
# 64 unique rotation matricies
1212
Rot_Z_mY_X = numpy.array([[0.0, 0.0, 1.0], [0.0, -1.0, 0.0], [1.0, 0.0, 0.0]], float)
1313
Rot_Y_mX_mZ = numpy.array([[0.0, 1.0, 0.0], [-1.0, 0.0, 0.0], [0.0, 0.0, -1.0]], float)
1414
Rot_XmY_X_mZ = numpy.array([[1.0, -1.0, 0.0], [1.0, 0.0, 0.0], [0.0, 0.0, -1.0]], float)
@@ -74,7 +74,7 @@
7474
Rot_mZ_X_mY = numpy.array([[0.0, 0.0, -1.0], [1.0, 0.0, 0.0], [0.0, -1.0, 0.0]], float)
7575
Rot_Y_X_Z = numpy.array([[0.0, 1.0, 0.0], [1.0, 0.0, 0.0], [0.0, 0.0, 1.0]], float)
7676

77-
## 32 unique translation vectors
77+
# 32 unique translation vectors
7878
Tr_0_0_34 = numpy.array([0.0, 0.0, 3.0 / 4.0], float)
7979
Tr_12_0_34 = numpy.array([1.0 / 2.0, 0.0, 3.0 / 4.0], float)
8080
Tr_0_0_56 = numpy.array([0.0, 0.0, 5.0 / 6.0], float)

0 commit comments

Comments
 (0)