Inject STRIPE_PUBLIC_KEY and plans into context_data.
429632
def get_context_data(self, **kwargs):
		""""""
		context = super().get_context_data(**kwargs)
		context.update(
			{
				"STRIPE_PUBLIC_KEY": djstripe_settings.STRIPE_PUBLIC_KEY,
				"plans": Plan.objects.all(),
			}
		)
		return context
491769
def append(self, context, data):
        
        return ContextStack(self._contexts + [context], self._data + [data])
1236420
def receive(self, data, api_context):
        """"""
        self.log.debug(f"Putting data on the pipeline: {data}")
        result = {
            "api_contexts": self.api_contexts,
            "api_context": api_context,
            "strategy": dict(),  # Shared strategy data
            "result": data,
            "log_level": api_context["log_level"],
        }
        self.strat.execute(self.strategy_context_schema().load(result).data)
465217
def populate_context(self, context, environ):
        """"""
        url = self.get_url(environ)
        context['base_url'] = url
        transaction_id = uuid.uuid4().hex
        context['transaction_id'] = transaction_id
        LOG.debug("Context created: base_url=%s, tid=%s", url, transaction_id)
1054485
function addDeviceXPubKey(wallet, device_address, xPubKey, onDone){
	db.query(
		"INSERT "+db.getIgnore()+" INTO extended_pubkeys (wallet, device_address) VALUES(?,?)",
		[wallet, device_address],
		function(){
			db.query(
				"UPDATE extended_pubkeys SET extended_pubkey=?, approval_date="+db.getNow()+" WHERE wallet=? AND device_address=?", 
				[xPubKey, wallet, device_address],
				function(){
					eventBus.emit('wallet_approved', wallet, device_address);
					checkAndFullyApproveWallet(wallet, onDone);
				}
			);
		}
	);
}
1126302
def insert(self, context, plan):
	
		
		
		op = execution.Insert(self.__comp_name, self.__comp())
		if op not in plan and self.available(context) != True:
			for dep_stub in self.dependencies():
				dep_stub.insert(context, plan)
			plan.append(op)
1230863
public PaymentMethod attach(Map<String, Object> params) throws StripeException {
    return attach(params, (RequestOptions) null);
  }
333713
def sync_from_stripe_data(cls, data, field_name="id"):
		
		current_ids = set()

		if data.get(field_name, None):
			# stop nested objects from trying to retrieve this object before initial sync is complete
			current_ids.add(cls._id_from_data(data.get(field_name)))

		instance, created = cls._get_or_create_from_stripe_object(
			data, field_name=field_name, current_ids=current_ids
		)

		if not created:
			instance._sync(cls._stripe_object_to_record(data))
			instance._attach_objects_hook(cls, data)
			instance.save()
			instance._attach_objects_post_save_hook(cls, data)

		return instance
87471
def _setup(self):
        ""
        self.example.error = None
        self.example.traceback = ''
        # inject function contexts from parent functions
        c = Context(parent=self.context)
        #for parent in reversed(self.example.parents):
        #    c._update_properties(locals_from_function(parent))
        self.context = c
        if self.is_root_runner:
            run.before_all.execute(self.context)
        self.example.before(self.context)
553193
def insert(self, context):
	
		
		
		status_code, msg = self.__endpoint.post(
			"/resources/custom-resource",
			data={
				"id": self.__name,
				"restype": self.__restype,
				"factoryclass": self.__factclass,
				"property": props_value(self.__props)
			}
		)
		self.__available = True
570128
public static Map<String, Map<String, String>> addContext(final String key, final Map<String, String> data,
                                                              final Map<String, Map<String, String>> context) {
        final Map<String, Map<String, String>> newdata = new HashMap<>();
        if (null != context) {
            newdata.putAll(context);
        }
        newdata.put(key, data);
        return newdata;
    }
294340
def update_from_stripe_data(self, stripe_coupon, exclude_fields=None, commit=True):
        
        fields_to_update = self.STRIPE_FIELDS - set(exclude_fields or [])
        update_data = {key: stripe_coupon[key] for key in fields_to_update}
        for field in ["created", "redeem_by"]:
            if update_data.get(field):
                update_data[field] = timestamp_to_timezone_aware_date(update_data[field])

        if update_data.get("amount_off"):
            update_data["amount_off"] = Decimal(update_data["amount_off"]) / 100

        # also make sure the object is up to date (without the need to call database)
        for key, value in six.iteritems(update_data):
            setattr(self, key, value)

        if commit:
            return StripeCoupon.objects.filter(pk=self.pk).update(**update_data)
947275
def inject(span_context, format, carrier)
      case format
      when OpenTracing::FORMAT_TEXT_MAP
        inject_to_text_map(span_context, carrier)
      when OpenTracing::FORMAT_BINARY
        warn 'Binary inject format not yet implemented'
      when OpenTracing::FORMAT_RACK
        inject_to_rack(span_context, carrier)
      else
        warn 'Unknown inject format'
      end
    end
634823
def wrap_options(self, data, renderer_context):
        ''''''
        request = renderer_context.get("request", None)
        method = request and getattr(request, 'method')
        if method != 'OPTIONS':
            raise WrapperNotApplicable("Request method must be OPTIONS")

        wrapper = self.dict_class()
        wrapper["meta"] = data
        return wrapper
212123
function createOrAppendInjectionPoint(contract, key, value) {
  if (contract.injectionPoints[key]) {
    contract.injectionPoints[key].push(value);
  } else {
    contract.injectionPoints[key] = [value];
  }
}
883702
def add(ctx, secret, name, issuer, period, oath_type, digits, touch, algorithm,
        counter, force):
    

    oath_type = OATH_TYPE[oath_type]
    algorithm = ALGO[algorithm]
    digits = int(digits)

    if not secret:
        while True:
            secret = click.prompt('Enter a secret key (base32)', err=True)
            try:
                secret = parse_b32_key(secret)
                break
            except Exception as e:
                click.echo(e)

    ensure_validated(ctx)

    _add_cred(ctx, CredentialData(secret, issuer, name, oath_type, algorithm,
                                  digits, period, counter, touch), force)
827650
def inject_context(self, __context_dict__=None, **context):
        
        context = context or __context_dict__
        self.context_keys |= set(context.keys())
        for key, value in context.items():
            setattr(self, key, value)
        for command in self.subcommands.values():
            command.inject_context(context)