**Thenables returned by tasks are not assimilated, but instead are treated as objects.**
354198
function pipeline(arrayOfTasks) {
  return promise.Promise.all(
    slice.call(arguments, 1)
  ).then(function(firstArgs) {
    var value;

    function perform(task) {
      var outcome;
      if (firstArgs) {
        outcome = task.apply(undefined, firstArgs);
        firstArgs = null;
      } else {
        outcome = task(value);
      }

      if (promise.Promise.isInstance(outcome)) {
        return outcome.then(function(outcome) {
          value = outcome;
        });
      } else {
        value = outcome;
      }
    }

    return series.Series.from(arrayOfTasks)
      .each(perform)
      .then(function() { return value; });
  });
}
1004824
function iterable (data) {
    if (! haveSymbols) {
      // Fall back to `arrayLike` predicate in pre-ES6 environments.
      return arrayLike(data);
    }

    return assigned(data) && isFunction(data[Symbol.iterator]);
  }
1238005
function Task(options) {
  if (!(this instanceof Task)) {
    return new Task(options);
  }

  utils.is(this, 'task');
  use(this);

  this.options = options || {};
  if (utils.isTask(options)) {
    this.options = {};
    this.addTargets(options);
    return this;
  }
}
688752
@Trivial
    Map<String, String> getExecutionProperties(Object task) {
        Map<String, String> execProps = task instanceof ManagedTask ? ((ManagedTask) task).getExecutionProperties() : null;
        if (execProps == null)
            execProps = defaultExecProps;
        else {
            Map<String, String> mergedProps = new TreeMap<String, String>(defaultExecProps);
            mergedProps.putAll(execProps);
            execProps = mergedProps;
        }
        return execProps;
    }
993197
function Task(entry) {
  if (!(this instanceof Task)) {
    return new Task(entry);
  }

  this.called = 0;
  this.now = this.calledAt = hrTime();

  if (resolutionDivisor !== DEFAULT_RESOLUTION) {
    entry.time = ~~(entry.time * (DEFAULT_RESOLUTION / resolutionDivisor));
  }

  // Side table property definitions
  this.isRunnable = true;
  this.later = this.now + entry.time;
  this.task = entry.task;
  this.type = entry.type;
  this.time = entry.time;

  if (this.later > gLast) {
    gLast = this.later;
  }

  if (!queue[this.later]) {
    queue[this.later] = [];
  }
  // console.log( entry.later, this );
  queue[this.later].push(this);
}
603747
public static <T> Object[] toArray(Iterable<T> iterable)
    {
        if (iterable == null)
        {
            throw new NullPointerException();
        }
        if (iterable instanceof Collection)
        {
            return ((Collection<T>) iterable).toArray();
        }
        if (iterable instanceof RichIterable)
        {
            return ((RichIterable<T>) iterable).toArray();
        }
        MutableList<T> result = Lists.mutable.empty();
        Iterate.addAllTo(iterable, result);
        return result.toArray();
    }
736801
function(value, context, scope) {
				return this.isInstance(value, context, scope) || (Jsonix.Util.Type.isObject(value) && !Jsonix.Util.Type.isArray(value));
			}
1005518
static void loadFromIterable(Context cx, Scriptable scope, ScriptableObject map, Object arg1)
    {
        if ((arg1 == null) || Undefined.instance.equals(arg1)) {
            return;
        }

        // Call the "[Symbol.iterator]" property as a function.
        final Object ito = ScriptRuntime.callIterator(arg1, cx, scope);
        if (Undefined.instance.equals(ito)) {
            // Per spec, ignore if the iterator is undefined
            return;
        }

        // Find the "add" function of our own prototype, since it might have
        // been replaced. Since we're not fully constructed yet, create a dummy instance
        // so that we can get our own prototype.
        ScriptableObject dummy = ensureScriptableObject(cx.newObject(scope, map.getClassName()));
        final Callable set =
                ScriptRuntime.getPropFunctionAndThis(dummy.getPrototype(), "set", cx, scope);
        ScriptRuntime.lastStoredScriptable(cx);

        // Finally, run through all the iterated values and add them!
        try (IteratorLikeIterable it = new IteratorLikeIterable(cx, scope, ito)) {
            for (Object val : it) {
                Scriptable sVal = ScriptableObject.ensureScriptable(val);
                if (sVal instanceof Symbol) {
                    throw ScriptRuntime.typeError1("msg.arg.not.object", ScriptRuntime.typeof(sVal));
                }
                Object finalKey = sVal.get(0, sVal);
                if (finalKey == NOT_FOUND) {
                    finalKey = Undefined.instance;
                }
                Object finalVal = sVal.get(1, sVal);
                if (finalVal == NOT_FOUND) {
                    finalVal = Undefined.instance;
                }
                set.call(cx, scope, map, new Object[] { finalKey, finalVal });
            }
        }
    }
588493
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
        ULocale locale = (ULocale)in.readObject();
        initialize(locale);
    }
850610
function isThenable(o) {
		var _then, o_type = typeof o;

		if (o != null &&
			(
				o_type == "object" || o_type == "function"
			)
		) {
			_then = o.then;
		}
		return typeof _then == "function" ? _then : false;
	}
996039
@SuppressWarnings("unchecked")
    public AsyncProcessFunction<Object, TBase<?, ?>, Object> asyncFunc() {
        return (AsyncProcessFunction<Object, TBase<?, ?>, Object>) func;
    }
543696
function importNonExisting(from, to) {
	if (from) {
		for (var prop in from) {
			if (!(prop in to)) {
				to[prop] = from[prop];
			}
		}
	}
}
1217593
def bind(self, __fun, *args, **kwargs):
    

    with self._lock:
      if self._running or self._completed or self._cancelled:
        raise RuntimeError('Future object can not be reused')
      if self._worker:
        raise RuntimeError('Future object is already bound')
      self._worker = functools.partial(__fun, *args, **kwargs)
    return self
1137558
def _validate_entities(self, tasks):
        

        if not tasks:
            raise TypeError(expected_type=Task, actual_type=type(tasks))

        if not isinstance(tasks, set):

            if not isinstance(tasks, list):
                tasks = set([tasks])
            else:
                tasks = set(tasks)

        for t in tasks:

            if not isinstance(t, Task):
                raise TypeError(expected_type=Task, actual_type=type(t))

        return tasks
295703
function Q(value) {
    // If the object is already a Promise, return it directly.  This enables
    // the resolve function to both be used to created references from objects,
    // but to tolerably coerce non-promises to promises.
    if (value instanceof Promise) {
        return value;
    }

    // assimilate thenables
    if (isPromiseAlike(value)) {
        return coerce(value);
    } else {
        return fulfill(value);
    }
}
672273
@Override
    public T data(Object... values) {
        if (values == null || values.length == 0) {
            return (T) this;
        }
        for (Object value : values) {
            this.data().add(value);
        }
        return (T) this;
    }
129151
@Override
    public IPromise<T> thenAnd(Supplier<IPromise<T>> callable) {
        Promise res = new Promise<>();
        then( new Callback<T>() {
            @Override
            public void complete(T result, Object error) {
                if ( Actor.isError(error) ) {
                    res.complete(null, error);
                } else {
                    IPromise<T> call = null;
                    call = callable.get().then(res);
                }
            }
        });
        return res;
    }