Skip to content

Commit 563de3f

Browse files
authored
Merge pull request #77 from bobleesj/cookie-flake8-rest
Fix flake8 error of unambigous variable names and "not xxx in" expression (E741, E713)
2 parents 0927c7a + 91835f7 commit 563de3f

File tree

6 files changed

+16
-15
lines changed

6 files changed

+16
-15
lines changed

doc/examples/npintensity.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -337,15 +337,15 @@ def plotResults(recipe):
337337
# All this should be pretty familiar by now.
338338
q = recipe.bucky.profile.x
339339

340-
I = recipe.bucky.profile.y
341-
Icalc = recipe.bucky.profile.ycalc
340+
intensity = recipe.bucky.profile.y
341+
intensity_calc = recipe.bucky.profile.ycalc
342342
bkgd = recipe.bucky.evaluateEquation("bkgd")
343-
diff = I - Icalc
343+
diff = intensity - intensity_calc
344344

345345
import pylab
346346

347-
pylab.plot(q, I, "ob", label="I(Q) Data")
348-
pylab.plot(q, Icalc, "r-", label="I(Q) Fit")
347+
pylab.plot(q, intensity, "ob", label="I(Q) Data")
348+
pylab.plot(q, intensity_calc, "r-", label="I(Q) Fit")
349349
pylab.plot(q, diff, "g-", label="I(Q) diff")
350350
pylab.plot(q, bkgd, "c-", label="Bkgd. Fit")
351351
pylab.xlabel(r"$Q (\AA^{-1})$")

src/diffpy/srfit/equation/builder.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -363,9 +363,11 @@ def _getUndefinedArgs(self, eqstr):
363363
# generated.
364364
for tok in set(args):
365365
# Move genuine varibles to the eqargs dictionary
366-
if (tok in self.builders or # Check registered builders
367-
tok in EquationFactory.symbols or # Check symbols
368-
tok in EquationFactory.ignore): # Check ignored characters
366+
if (
367+
tok in self.builders # Check registered builders
368+
or tok in EquationFactory.symbols # Check symbols
369+
or tok in EquationFactory.ignore # Check ignored characters
370+
):
369371
args.remove(tok)
370372

371373
return args
@@ -665,7 +667,7 @@ def __wrapSrFitOperators():
665667
inspect.isclass(cls)
666668
and issubclass(cls, opmod.Operator)
667669
and not inspect.isabstract(cls)
668-
and not cls in excluded_types
670+
and cls not in excluded_types
669671
)
670672
# create OperatorBuilder objects
671673
for nm, opclass in inspect.getmembers(opmod, is_exported_type):

src/diffpy/srfit/equation/equationmod.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ def __getattr__(self, name):
125125
"""Gives access to the Arguments as attributes."""
126126
# Avoid infinite loop on argdict lookup.
127127
argdict = object.__getattribute__(self, "argdict")
128-
if not name in argdict:
128+
if name not in argdict:
129129
raise AttributeError("No argument named '%s' here" % name)
130130
return argdict[name]
131131

src/diffpy/srfit/equation/literals/operators.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ def addLiteral(self, literal):
123123
def getValue(self):
124124
"""Get or evaluate the value of the operator."""
125125
if self._value is None:
126-
vals = [l.value for l in self.args]
126+
vals = [arg.value for arg in self.args]
127127
self._value = self.operation(*vals)
128128
return self._value
129129

@@ -136,8 +136,8 @@ def _loopCheck(self, literal):
136136

137137
# Check to see if I am a dependency of the literal.
138138
if hasattr(literal, "args"):
139-
for l in literal.args:
140-
self._loopCheck(l)
139+
for arg in literal.args:
140+
self._loopCheck(arg)
141141
return
142142

143143

src/diffpy/srfit/fitbase/fitresults.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ def formatResults(self, header="", footer="", update=False):
326326

327327
if not certain:
328328
error_message = "Some quantities invalid due to missing profile uncertainty"
329-
if not error_message in self.messages:
329+
if error_message not in self.messages:
330330
self.messages.append(error_message)
331331

332332
lines.extend(self.messages)

src/diffpy/srfit/util/argbinders.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919

2020

2121
class bind2nd(object):
22-
2322
"""Freeze second argument of a callable object to a given constant."""
2423

2524
def __init__(self, func, arg1):

0 commit comments

Comments
 (0)