Skip to content

Commit

Permalink
2 lambda functions less in closure
Browse files Browse the repository at this point in the history
  • Loading branch information
francoislaurent committed Mar 30, 2021
1 parent 37d3b23 commit f705de5
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 11 deletions.
4 changes: 0 additions & 4 deletions tramway/core/parallel/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@
# knowledge of the CeCILL license and that you accept its terms.


try:
import dill
except ImportError:
pass
try:
import cloudpickle
except ImportError:
Expand Down
4 changes: 0 additions & 4 deletions tramway/inference/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,6 @@
from copy import copy
from collections import OrderedDict

try:
import dill
except ImportError:
pass
try:
import cloudpickle
except ImportError:
Expand Down
7 changes: 4 additions & 3 deletions tramway/inference/optimization.py
Original file line number Diff line number Diff line change
Expand Up @@ -860,9 +860,10 @@ def push(self, _x=None):
parallel.abc.VehicleJobStep.register(Component)


def _all(i):
return None
def _fun_args(fun, x0, component, covariate, gradient_subspace, descent_subspace,
args, bounds, _sum, gradient_sum, gradient_covariate):
_all = None
if not callable(fun):
raise TypeError('fun is not callable')
if not isinstance(x0, np.ndarray):
Expand All @@ -889,11 +890,11 @@ def _component(k):
if not callable(covariate):
raise TypeError('covariate is not callable')
if gradient_subspace is None:
gradient_subspace = lambda i: _all
gradient_subspace = _all
elif not callable(gradient_subspace):
raise TypeError('gradient_subspace is not callable')
if descent_subspace is None:
descent_subspace = lambda i: _all
descent_subspace = _all
elif not callable(descent_subspace):
raise TypeError('descent_subspace is not callable')
if not callable(_sum):
Expand Down

0 comments on commit f705de5

Please sign in to comment.