produce instance and bind to context
979962
function(context, callback, binds) {
		var instance = new Instance(this);
		var count = 0,
			binded = false;
		for (var i = 1, len = this.parts.length; i < len; i = i + 2) {
			var block = this.parts[i];
			if (block.binded) {
				binded = true;
				var h = handler(instance, context, block.func, count, callback),
					dep = block.dep;
				for (var j = 0, lenJ = dep.length; j < lenJ; j++)
					context.subscribe(dep[j], h, false, instance.binds);
			}
			count++;
		}
		if (binded && binds)
			binds.push(unsub(instance));
		return instance;
	}
747617
def new_context(environment, template_name, blocks, vars=None,
                shared=None, globals=None, locals=None):
    """"""
    if vars is None:
        vars = {}
    if shared:
        parent = vars
    else:
        parent = dict(globals or (), **vars)
    if locals:
        # if the parent is shared a copy should be created because
        # we don't want to modify the dict passed
        if shared:
            parent = dict(parent)
        for key, value in iteritems(locals):
            if value is not missing:
                parent[key] = value
    return environment.context_class(environment, parent, template_name,
                                     blocks)
1031342
def create(cls, expr, binds):
        
        return cls(expr=expr, binds=binds, dtype=bool_dtype)
1297304
public static Todo instance(Context context) {
        Todo instance = context.get(todoKey);
        if (instance == null)
            instance = new Todo(context);
        return instance;
    }
198342
def _render_context(self, template, block, **context):
        
        return u''.join(block(template.new_context(context)))
1230708
def bind(self, container, method_name):
        
        instance = super(Entrypoint, self).bind(container)
        instance.method_name = method_name
        return instance
171557
def get_context(self, name, value, attrs):
        """"""
        context = {}
        context['widget'] = {
            'name': name,
            'type': 'text',
            'is_hidden': self.is_hidden,
            'required': self.is_required,
            'value': self.format_value(value),
            'attrs': {**self.attrs, **(attrs or {})},
            'template_name': self.template_name,
        }
        return context
1096831
function createContext(script) {
  const INITIAL_CONTEXT = {
    vars: {
      target: script.config.target,
      $environment: script._environment,
      $processEnvironment: process.env
    },
    funcs: {
      $randomNumber: $randomNumber,
      $randomString: $randomString,
      $template: input => engineUtil.template(input, { vars: result.vars })
    }
  };

  let result = _.cloneDeep(INITIAL_CONTEXT);

  // variables from payloads:
  const variableValues1 = datafileVariables(script);
  Object.assign(result.vars, variableValues1);
  // inline variables:
  const variableValues2 = inlineVariables(script);
  Object.assign(result.vars, variableValues2);

  result._uid = uuid.v4();
  result.vars.$uuid = result._uid;
  return result;
}
585624
function createInstanceContext (
  instanceId,
  runtimeContext,
  data
) {
  if ( data === void 0 ) data = {};

  var weex = runtimeContext.weex;
  var instance = instanceOptions[instanceId] = {
    instanceId: instanceId,
    config: weex.config,
    document: weex.document,
    data: data
  };

  // Each instance has a independent `Vue` module instance
  var Vue = instance.Vue = createVueModuleInstance(instanceId, weex);

  // DEPRECATED
  var timerAPIs = getInstanceTimer(instanceId, weex.requireModule);

  var instanceContext = Object.assign({ Vue: Vue }, timerAPIs);
  Object.freeze(instanceContext);
  return instanceContext
}
973220
def get_instance(self, node, *args, **kwargs):
        
        # string is a ref to an existing plugin instance
        if isinstance(node, basestring):
            if node in self._instance:
                return self._instance[node]
            # if not an instance, try for init with empty config
            return self.new_plugin({'type': node}, *args, **kwargs)

        if isinstance(node, collections.Mapping):
            if "type" in node:
                # node was a plugin config passed directly
                name = node.get("name", node.get("type"))
            elif len(node) == 1:
                # node was a container with a single plugin config keyed
                # to it
                typ, config = list(node.items())[0]
                name = config.get("name", config.get("type", typ))

            # retrieve existing instance if it exists
            if name in self._instance:
                return self._instance[name]

            # otherwise spawn new plugin
            return self.new_plugin(node, *args, **kwargs)

        raise ValueError("unable to parse plugin for output %s" % str(node))
849136
public static Arguments instance(Context context) {
        Arguments instance = context.get(argsKey);
        if (instance == null) {
            instance = new Arguments(context);
        }
        return instance;
    }
83764
def _create_with_scope(body, kwargs):
    '''
    
    '''
    return ast.With(
        items=[
            ast.withitem(
                context_expr=_a.Call(
                    _a.Name('ContextScope'),
                    [_a.Name('context')],
                    keywords=kwargs,
                ),
                optional_vars=_a.Name('context', ctx=ast.Store())
            ),
        ],
        body=body,
    )
1058923
def bind(self, instance, auto=False):
        
        methods = [
            (m, cls.__dict__[m])
            for cls in inspect.getmro(type(instance))
            for m in cls.__dict__ if inspect.isfunction(cls.__dict__[m])
            ]

        try:
            deps_of_endpoints = [(method_ptr, self.entrypoint_deps(method_ptr))
                                 for (method_name, method_ptr) in methods]

            for (method_ptr, method_deps) in deps_of_endpoints:
                if len(method_deps) > 0:
                    method_ptr(instance, **method_deps)
        except KeyError:
            pass

        if auto and instance not in self.current_scope.get_auto_bind_list():
            self.current_scope.auto_bind(instance)

        return instance
942587
def construct(self, **bindings):
    
    context = _assign_values_to_unbound_vars(self._unbound_vars, bindings)
    context.update(self._partial_context)
    return self._construct(context)
62724
def raw_default(context)
      value = options.fetch(:default)
      return value unless value.is_a?(Proc)

      case value.arity
      when 1 then context.instance_exec(self, &value)
      else context.instance_exec(&value)
      end
    end
312308
def from_events(self, instance, ev_args, ctx):
        
        obj = yield from self._process(instance, ev_args, ctx)
        self.__set__(instance, obj)
        return obj
804218
def get_context(self, name, value, attrs):
        
        context = super(NgWidgetMixin, self).get_context(name, value, attrs)
        if callable(getattr(self._field, 'update_widget_rendering_context', None)):
            self._field.update_widget_rendering_context(context)
        return context