Skip to content

Commit b84d9bc

Browse files
Apply ruff/flake8-simplify rule SIM103
SIM103 Return the (negated) condition directly
1 parent 2c1cf76 commit b84d9bc

File tree

2 files changed

+3
-10
lines changed

2 files changed

+3
-10
lines changed

nipy/algorithms/registration/optimizer.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,4 @@ def configure_optimizer(optimizer, fprime=None, fhess=None, **kwargs):
4646

4747

4848
def use_derivatives(optimizer):
49-
if optimizer in ('simplex', 'powell'):
50-
return False
51-
else:
52-
return True
49+
return optimizer not in ('simplex', 'powell')

nipy/algorithms/statistics/models/regression.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -264,9 +264,7 @@ def has_intercept(self):
264264
o = np.ones(self.design.shape[0])
265265
obeta = np.dot(self.calc_beta, o)
266266
ohat = np.dot(self.wdesign, obeta)
267-
if np.allclose(ohat, o):
268-
return True
269-
return False
267+
return np.allclose(ohat, o)
270268

271269
@cached_property
272270
def rank(self):
@@ -872,6 +870,4 @@ def isestimable(C, D):
872870
if C.shape[1] != D.shape[1]:
873871
raise ValueError('Contrast should have %d columns' % D.shape[1])
874872
new = np.vstack([C, D])
875-
if matrix_rank(new) != matrix_rank(D):
876-
return False
877-
return True
873+
return matrix_rank(new) == matrix_rank(D)

0 commit comments

Comments
 (0)