Skip to content

Commit e101397

Browse files
committed
fix flake8 linting warnings
1 parent d2699a6 commit e101397

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

chempy/util/_expr.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
import math
1717
from itertools import chain
1818
from operator import add, mul, truediv, sub, pow
19-
from ..units import is_quantity, unit_of, to_unitless, is_quantity
19+
from ..units import is_quantity, unit_of, to_unitless
2020
from .pyutil import defaultkeydict, deprecated
2121

2222

@@ -213,10 +213,10 @@ def __call__(self, variables, backend=math, **kwargs):
213213
raise NotImplementedError("Subclass and implement __call__")
214214

215215
def __float__(self):
216-
try:
217-
return float(self({}))
218-
except KeyError:
219-
raise ValueError("Missing values for variables")
216+
try:
217+
return float(self({}))
218+
except KeyError:
219+
raise ValueError("Missing values for variables")
220220

221221
def _all_keys(self, attr):
222222
_keys = getattr(self, attr)
@@ -534,9 +534,11 @@ def make(cls, arg, *args, **kwargs):
534534
else:
535535
return cls((arg,), *args, **kwargs)
536536

537+
537538
class _NegExpr(_UnaryExpr):
538539

539-
_op = lambda x: -x
540+
def _op(x):
541+
return -x
540542

541543
def _str(self, *args, **kwargs):
542544
return "-%s" % args[0]._str(*args, **kwargs)
@@ -647,7 +649,6 @@ def __lt__(self, other):
647649
return NotImplemented
648650

649651

650-
651652
class Symbol(Expr):
652653
nargs = 1
653654

@@ -718,9 +719,9 @@ def _pw(bounds_exprs, x, backend=math, **kwargs):
718719
upper = [bounds_exprs[2*(i+1)] for i in range(n_exprs)]
719720
exprs = [bounds_exprs[2*i + 1] for i in range(n_exprs)]
720721

721-
722722
if is_quantity(x):
723723
xunit = unit_of(x)
724+
724725
def ulx(arg):
725726
return to_unitless(arg, xunit)
726727
lower = list(map(ulx, lower))

0 commit comments

Comments
 (0)