Ensures a enrichched flw context when a flow is starting
@private
554744
function _checkContext(c) {
    if (c.hasOwnProperty('_stopped')) return; // Already done?

    c._stopped = null;

    // Indicate that we gracefully stop
    //  if set, stops the flow until we are back to the main callback
    function _flw_stop(reason, cb) {
      if (!cb && typeof reason === 'function') {
        cb = reason;
        reason = 'stopped';
      }
      c._stopped = reason;
      return cb();
    }
    Object.defineProperty(c, '_stop', {
      enumerable: false,
      configurable: false,
      writable: false,
      value: _flw_stop,
    });

    // Stores the data returned from the callback in the context with key 'key'
    //  then calls the callback
    function _flw_store(key, cb) {
      const self = this;

      const fn = function (err, data) {
        if (err) return cb(err);

        self[key] = data;
        return cb();
      };
      return fn;
    }
    Object.defineProperty(c, '_store', {
      enumerable: false,
      configurable: false,
      value: _flw_store,
    });

    // Cleans all flw related properties from the context object
    function _flw_clean() {
      const self = this;
      const contextCopy = {};
      Object.keys(this).forEach(function (k) {
        if (ourContextKeys.indexOf(k) !== -1) return;
        contextCopy[k] = self[k];
      });
      return contextCopy;
    }
    Object.defineProperty(c, '_clean', {
      enumerable: false,
      configurable: false,
      value: _flw_clean,
    });

    // compatibilty for a while
    Object.defineProperty(c, '_flw_store', {
      enumerable: false,
      configurable: false,
      writable: false,
      value: _flw_store,
    });

    return c;
  }
243589
function CallContext(msg, channel) {
  this.channel = channel;
  this.locals = {};
  this.message = msg;
  Object.freeze(this);
}
68358
function setTimeoutContext(fn, ctx, timeout) {
  var id;

  var cancel = function() {
    clearTimeout(id);
  };

  id = setTimeout(function() {
    ctx.removeListener('cancel', cancel);

    fn();
  }, timeout);

  ctx.once('cancel', cancel);
}
1333298
def ensure_context(**vars):
    
    ctx = _context_stack.top
    stacked = False
    if not ctx:
        ctx = Context()
        stacked = True
        _context_stack.push(ctx)
    ctx.update(vars)
    try:
        yield ctx
    finally:
        if stacked:
            _context_stack.pop()
953546
function(event, flowEvents) {
      if (event.outFlowEvents === undefined ||
          event.outFlowEvents.length === 0)
        return false;

      // Once we fix the bug of flow event binding, there should exist one and
      // only one outgoing flow (PostTask) from ScheduleBeginImplFrameDeadline
      // and PostComposite.
      var flow = event.outFlowEvents[0];

      if (flow.category !== POSTTASK_FLOW_EVENT ||
          !flow.endSlice)
        return false;

      var endSlice = flow.endSlice;
      if (this.belongToOtherInputs(endSlice.mostTopLevelSlice, flowEvents))
        return true;

      return false;
    }
151983
function (callback) {
                var self = this;
                flow()
                    .seq(function (cb) {
                        self.$handlers.stop(function () {
                            // ignore errors during stop
                            cb();
                        });
                    })
                    .seq(function (cb) {
                        self.$authenticationService.stop(function () {
                            cb();
                        });
                    })
                    .seq(function (cb) {
                        self.$filters.stop(function () {
                            // ignore errors during stop
                            cb();
                        });
                    })
                    .seq(function (cb) {
                        self.$endPoints.shutdown(function () {
                            // ignore errors during shutdown
                            cb();
                        });
                    })
                    .exec(function (err) {
                        callback && callback(err);

                        process.stdin.end();
                    });
            }
345933
function handleStart(context) {

    var resizeConstraints = context.resizeConstraints,
        // evaluate minBounds for backwards compatibility
        minBounds = context.minBounds;

    if (resizeConstraints !== undefined) {
      return;
    }

    if (minBounds === undefined) {
      minBounds = self.computeMinResizeBox(context);
    }

    context.resizeConstraints = {
      min: asTRBL(minBounds)
    };
  }
1073100
function (obj, fn, context) {
            for (var key in obj) {
                if (hasOwnProp.call(obj, key)) {
                    //inx,element
                    fn.call(context || this, key, obj[key]);
                }
            }
        }
1233814
public static void addFlowContext(final FlowContext flowContext) {

        if (null == flowContext) {
            clearFlowcontext();
            return;
        }

        FLOW_CONTEXT_THREAD_LOCAL.set(flowContext);
        MDC.put("flowCtxt", flowContext.toString());
    }
977278
function setContext(req, res, next) {
    currentContext = {req: req, res: res};
    next();
}
132007
def wraps_with_context(func, context):
    """"""
    wrapped = functools.partial(func, context)
    wrapped = functools.wraps(func)(wrapped)
    if asyncio.iscoroutinefunction(func):
        wrapped = asyncio.coroutine(wrapped)
    return wrapped
1194378
private static void initializeDrawee(Context context, @Nullable DraweeConfig draweeConfig) {
    if (FrescoSystrace.isTracing()) {
      FrescoSystrace.beginSection("Fresco.initializeDrawee");
    }
    sDraweeControllerBuilderSupplier =
        new PipelineDraweeControllerBuilderSupplier(context, draweeConfig);
    SimpleDraweeView.initialize(sDraweeControllerBuilderSupplier);
    if (FrescoSystrace.isTracing()) {
      FrescoSystrace.endSection();
    }
  }
695272
function(contexts) {

        if ( typeof(contexts) == 'undefined' ) {
            var contexts = {
                paths : {}
            }
        }

        self.contexts = contexts;

        if ( typeof(ContextHelper.initialized) != 'undefined' && ContextHelper.instance) {
            self = ContextHelper.instance;
        } else {
            ContextHelper.initialized = true;
            ContextHelper.instance = self
        }



        return self
    }
962623
protected void flow(Env<AttrContext> env, Queue<Env<AttrContext>> results) {
        if (compileStates.isDone(env, CompileState.FLOW)) {
            results.add(env);
            return;
        }

        try {
            if (shouldStop(CompileState.FLOW))
                return;

            if (relax) {
                results.add(env);
                return;
            }

            if (verboseCompilePolicy)
                printNote("[flow " + env.enclClass.sym + "]");
            JavaFileObject prev = log.useSource(
                                                env.enclClass.sym.sourcefile != null ?
                                                env.enclClass.sym.sourcefile :
                                                env.toplevel.sourcefile);
            try {
                make.at(Position.FIRSTPOS);
                TreeMaker localMake = make.forToplevel(env.toplevel);
                flow.analyzeTree(env, localMake);
                compileStates.put(env, CompileState.FLOW);

                if (shouldStop(CompileState.FLOW))
                    return;

                results.add(env);
            }
            finally {
                log.useSource(prev);
            }
        }
        finally {
            if (!taskListener.isEmpty()) {
                TaskEvent e = new TaskEvent(TaskEvent.Kind.ANALYZE, env.toplevel, env.enclClass.sym);
                taskListener.finished(e);
            }
        }
    }
590369
function initChangeDetectorIfExisting(injector, instance, view) {
    if (injector && injector.changeDetectorRef != null) {
        injector.changeDetectorRef._setComponentContext(view, instance);
    }
}
467676
function storeCleanupWithContext(view, context, cleanupFn) {
    if (!view)
        view = viewData;
    getCleanup(view).push(context);
    if (view[TVIEW].firstTemplatePass) {
        getTViewCleanup(view).push(cleanupFn, view[CLEANUP].length - 1);
    }
}
4586
function( max, startFunc ) {
		var self = this;

		if ( max < self.state ) {
			self._stateError( startFunc || self.requireMaxState );
		}

		return self;
	}