MCPcopy Index your code
hub / github.com/hyperopt/hyperopt / partial

Function partial

hyperopt/pyll/base.py:650–669  ·  view source on GitHub ↗
(name, *args, **kwargs)

Source from the content-addressed store, hash-verified

648
649@scope.define
650def partial(name, *args, **kwargs):
651 # TODO: introspect the named instruction, to retrieve the
652 # list of parameters *not* accounted for by args and kwargs
653 # then delete these stupid functions and just have one `partial`
654 try:
655 name = name.apply_name # to retrieve name from scope.foo methods
656 except AttributeError:
657 pass
658
659 my_id = len(scope._impls)
660 # -- create a function with this name
661 # the name is the string used index into scope._impls
662 temp_name = "partial_%s_id%i" % (name, my_id)
663 l = Lambda(temp_name, [("x", p0)], expr=apply(name, *(args + (p0,)), **kwargs))
664 scope.define(l)
665 # assert that the next partial will get a different id
666 # XXX; THIS ASSUMES THAT SCOPE ONLY GROWS
667 assert my_id < len(scope._impls)
668 rval = getattr(scope, temp_name)
669 return rval
670
671
672def dfs(aa, seq=None, seqset=None):

Callers 7

test_tpeMethod · 0.50
test_annealMethod · 0.50
test_tpe_runsMethod · 0.50
workMethod · 0.50
workMethod · 0.50
workMethod · 0.50
workMethod · 0.50

Calls 3

LambdaClass · 0.85
applyFunction · 0.85
defineMethod · 0.80

Tested by 7

test_tpeMethod · 0.40
test_annealMethod · 0.40
test_tpe_runsMethod · 0.40
workMethod · 0.40
workMethod · 0.40
workMethod · 0.40
workMethod · 0.40