def __call__(self, fn):
    """Returns decorated function"""
    def semisync_fn(*args, **kwargs):
      fn_call = {'callback': self.callback, 'args': [args], 'kwargs': [kwargs],
                 'dependencies': set([semisync.map[d] for d in self.dependencies])}
      semisync.tree[fn] = merge_dicts(fn_call, semisync.tree.get(fn, {}))

    # functions cannot be added to queue
    # work around this by passing an id inst
    semisync.fn_map[id(fn)] = fn

    #mapping from decorated function to undecorated function
    semisync.map[semisync_fn] = fn
    return semisync_fn
def __call__ ( self , fn ) : def semisync_fn ( * args , ** kwargs ) : fn_call = { 'callback' : self . callback , 'args' : [ args ] , 'kwargs' : [ kwargs ] , 'dependencies' : set ( [ semisync . map [ d ] for d in self . dependencies ] ) } semisync . tree [ fn ] = merge_dicts ( fn_call , semisync . tree . get ( fn , { } ) ) semisync . fn_map [ id ( fn ) ] = fn semisync . map [ semisync_fn ] = fn return semisync_fn
Returns decorated function