#NEWLINE# def domain_constructor( **b_kwargs ) : #NEWLINE# #INDENT# "\n    Decorate a function that returns a pyll expressions so that\n    it becomes a Domain instance instead of a function\n\n    Example:\n\n    @domain_constructor(loss_target=0)\n    def f(low, high):\n        return {'loss': hp.uniform('x', low, high) ** 2 }\n\n    " #NEWLINE# def deco( f ) : #NEWLINE# #INDENT# def wrapper( * args , **kwargs ) : #NEWLINE# #INDENT# if ( 'name' in b_kwargs ) : #NEWLINE# #INDENT# _b_kwargs = b_kwargs #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# _b_kwargs = dict ( b_kwargs , name = f . __name__ ) #NEWLINE# #UNINDENT# f_rval = f ( * args , ** kwargs ) #NEWLINE# domain = Domain ( ( lambda x : x ) , f_rval , ** _b_kwargs ) #NEWLINE# return domain #NEWLINE# #UNINDENT# wrapper . __name__ = f . __name__ #NEWLINE# return wrapper #NEWLINE# #UNINDENT# return deco