Inject evaluated tasks to functions.

@param {Object} funcs reference
@param {Object} task
512725
function evalTasks (funcs, task) {
  /**
  * Evaluate a single task and inject it.
  *
  * @param {String} taskKey
  */

  function inject (taskKey) {
    var taskName = task[taskKey]

    try {
      var e = eval(taskName) // eslint-disable-line

      if (typeof e === 'function') {
        funcs[taskName] = e
      } else {
        funcs[taskName] = function () { return e }
      }
    } catch (err) {
      var msg = 'Task not compiled: ' + taskName + ' [' + taskKey + ']' + err
      throw new Error(msg)
    }
  }

  Object.keys(task)
    .filter(reserved(task))
    .filter(dflowDSL(task))
    .filter(alreadyDefined(funcs, task))
    .forEach(inject)
}
895094
def func_globals_inject(func, **overrides):
    '''
    
    '''
    # recognize methods
    if hasattr(func, 'im_func'):
        func = func.__func__

    # Get a reference to the function globals dictionary
    func_globals = func.__globals__
    # Save the current function globals dictionary state values for the
    # overridden objects
    injected_func_globals = []
    overridden_func_globals = {}
    for override in overrides:
        if override in func_globals:
            overridden_func_globals[override] = func_globals[override]
        else:
            injected_func_globals.append(override)

    # Override the function globals with what's passed in the above overrides
    func_globals.update(overrides)

    # The context is now ready to be used
    yield

    # We're now done with the context

    # Restore the overwritten function globals
    func_globals.update(overridden_func_globals)

    # Remove any entry injected in the function globals
    for injected in injected_func_globals:
        del func_globals[injected]
8797
public void runTask(Handler<Task> task) {
    if (currentTask == null) {
      currentTask = new Task(this);
      task.handle(currentTask);
    } else {
      queue.add(task);
    }
  }
1157306
function validateTask(task) {
  if (typeof task === 'function') {
    return task;
  }

  if (typeof task.command !== 'string') {
    return;
  }

  if (task.options === null) {
    return;
  }

  if (task.options && typeof task.options !== 'object') {
    return;
  }

  return task;
}
794734
def taskit(func):
    
    class NewTask(Task):
        def work(self, *args, **kw):
            return func(*args, **kw)
    return NewTask()
1295519
public static void convert(Task task, Function<Throwable, RuntimeException> function) {
        try {
            task.run();
        } catch (Throwable e) {
            throw function.apply(e);
        }
    }
544754
function Task(func) {
        _super.call(this);
        if (!TypeUtils.isNullOrUndefined(func)) {
            if (typeof func !== "function") {
                throw "'func' must be a function!";
            }
        }
        this._FUNC = func;
        this.updateStatus(TaskStatus.Created);
    }
57929
function moduleTask(taskname, depsOrFn, fn, noAutoRegister) {

    var module = this;

    if (typeof(depsOrFn) == 'string') {
      depsOrFn = [depsOrFn];
    }

    if (Array.isArray(depsOrFn)) {

      var map = [];

      depsOrFn.forEach(function (dep) {
        map.push(module.name + '-' + dep);
      });

      depsOrFn = map;

    }

    var fulltaskname = module.name + '-' + taskname;
    gulp.task(fulltaskname, depsOrFn, fn);

    if(!noAutoRegister) {
      module.tasks.push(fulltaskname);
    }

  }
906430
function prepareTasks (allTasks, support) {
    const tasks = {before: {}, after: {}};
    let i;

    for (i = allTasks.length - 1; i >= 0; i--) {
        const task = allTasks[i];

        //browser compatibility
        if (!needFix(support, task, 'forBrowsersLowerThan')) {
            continue;
        }

        if (!needFix(support, task, 'forBrowsersUpperOrEqualTo')) {
            continue;
        }

        //Get type and name
        let types, names;

        if (typeof task.filter === 'string') {
            types = [task.filter];
            names = ['_'];
        } else {
            types = (task.filter.type instanceof Array ? task.filter.type : (task.filter.type ? [task.filter.type] : ['_']));
            names = (task.filter.name instanceof Array ? task.filter.name : (task.filter.name ? [task.filter.name] : ['_']));
        }

        types.forEach(function (type) {
            if (!tasks[task.position].hasOwnProperty(type)) {
                tasks[task.position][type] = {};
            }

            names.forEach(function (name) {
                if (!tasks[task.position][type].hasOwnProperty(name)) {
                    tasks[task.position][type][name] = [];
                }

                tasks[task.position][type][name].push(task);
            });
        });
    }

    return tasks;
}
460486
function(list) {

        var i = self.tasksCount;

        if (i > list.length-1) {
            process.exit(0)
        }

        var err = false;
        var cb = ( typeof(list[i].cb) != 'undefined' ) ? list[i].cb : false;

        if (cb) {
            list[i].func( function done(err, data) {
                if (err) {
                    console.error(err.stack||err.message);
                    process.exit(1)
                } else {
                    if (data) {
                        //var str = data.toString();
                        console.info(data);
                    }
                    ++self.tasksCount;
                    run(list)
                }

            })
        } else {
            try {
                list[i].func();
                ++self.tasksCount;
                run(list)
            } catch (err) {
                console.error(err.stack);
                process.exit(1)
            }
        }
    }
706865
function(task) {

		if (this._active_tasks.indexOf(task) == -1) {

			this._active_tasks.push(task);

		}

		this._enable();

		if (!this.is_running) {
			this._enable();
			this.is_running = true;
		}

	}
1142656
function(task, context, args) {
            // can used to default task
            if (!_.isFunction(task)) {
                args = task;
                task = null;
                context = null;
            }

            if (!_.isArray(args)) args = [args];

            var d = Q.defer();
            this.tasks.push({
                "task": task,
                "args": args || [],
                "context": context,
                "result": d
            });
            if (this.empty == true) {
                this.startNext();
            }
            return d.promise;
        }
1339483
function chain(tasks) {
      return function() {
        var pipeline = fullPipeline();

        _.each(tasks, function(task) {
          pipeline = pipeline.pipe(task.callback(options)());
        });

        return pipeline;
      };
    }
584751
void runTasks(Task[] tasks, int maxTaskIndex) {
        for (int i = 0; i <= maxTaskIndex; i++) {
            runTasksInChain(tasks[i]);
            tasks[i] = null;
        }
    }
214668
private void setTasks(String tasks) {
		for (String task : tasks.split(",")) {
			if (KNOWN_TASKS.containsKey(task)) {
				this.tasks |= KNOWN_TASKS.get(task);
				this.taskName += (this.taskName.isEmpty() ? "" : "-") + task;
			} else {
				logger.warn("Unsupported RDF serialization task \"" + task
						+ "\". Run without specifying any tasks for help.");
			}
		}
	}
209094
function inject (taskKey) {
    var taskName = task[taskKey]

    var num = parseFloat(taskName)

    if (!isNaN(num)) {
      funcs[taskName] = function () { return num }
    }
  }
1135324
function (tasks, callback) {
    if(typeof callback !== 'function'){
      return new Error('Second argument to ordenado must be a callback function');
    }
    if (!_isArray(tasks)) {
      var e = new Error('First argument to ordenado must be an array of functions');
      return callback(e);
    }
    if (!tasks.length) {
      var er = new Error('ordenado expects at least one task (function) to run');
      return callback(er);
    }
    var wrap = function (iterator) {
      return function (err) {
        if (err) {
          callback.apply(err, arguments);
        } else {
          var args = Array.prototype.slice.call(arguments, 1);
          var next = iterator.next();
          if (next) {
            args.push(wrap(next));
          } else {
            args.push(callback);
          }
          setTimeout(function () {
            iterator.apply(null, args);
          },0);
        }
      };
    };
    wrap(iterator(tasks))();
  }