// FromContext returns the lease from the context.
326526
func FromContext(ctx context.Context) (string, bool) {
	lid, ok := ctx.Value(leaseKey{}).(string)
	if !ok {
		return fromGRPCHeader(ctx)
	}

	return lid, ok
}
1203591
func WithContext(c Context) *Big {
	z := new(Big)
	z.Context = c
	return z
}
1041165
func (c *Ctx) WithContext(ctx context.Context) {
	c.request = c.request.WithContext(ctx)
}
210560
func (c *Component) GetContext(token string) context.Context {
	if c.Context == nil {
		c.initBgCtx()
	}
	ctx := c.Context
	if token == "" && c.Identity != nil {
		token, _ = c.BuildJWT()
	}
	ctx = ttnctx.OutgoingContextWithToken(ctx, token)
	return ctx
}
896076
func (o *GetOAuth2ClientParams) WithContext(ctx context.Context) *GetOAuth2ClientParams {
	o.SetContext(ctx)
	return o
}
279621
func (q *Query) WithContext(ctx context.Context) *Query {
	q.ctx = ctx
	return q
}
809677
func FromContext(ctx context.Context) Logger {
	if ctx == nil {
		return NopLogger
	}
	l, ok := ctx.Value(logKey).(Logger)
	if !ok {
		return NopLogger
	}
	return l
}
983921
func (fs *FS) WithContext(ctx context.Context) *FS {
	return &FS{
		ctx:     ctx,
		fsInner: fs.fsInner,
	}
}
632745
func FromContext(ctx context.Context) *Info {
	info, ok := ctx.Value(infoKey).(*Info)
	if !ok {
		return nil
	}
	return info
}
419190
func FromContext(ctx context.Context) (*Tracing, error) {
	if ctx == nil {
		panic("nil context")
	}

	tracer, ok := ctx.Value(tracingKey).(*Tracing)
	if !ok {
		return nil, errors.New("unable to find tracing in the context")
	}
	return tracer, nil
}
210302
func FromContext(ctx context.Context) (*Tracer, bool) {
	// ctx.Value returns nil if ctx has no value for the key;
	// the net.IP type assertion returns ok=false for nil.
	t, ok := ctx.Value(tracerKey).(*Tracer)
	return t, ok
}
1085346
func FromContext(ctx context.Context) (Etc, bool) {
	cfg, ok := ctx.Value(etcKey).(Etc)
	return cfg, ok
}
1304582
func NewContext(ctx context.Context, r *Registration, plugins *Set, root, state string) *InitContext {
	return &InitContext{
		Context: ctx,
		Root:    filepath.Join(root, r.URI()),
		State:   filepath.Join(state, r.URI()),
		Meta: &Meta{
			Exports: map[string]string{},
		},
		plugins: plugins,
	}
}
472842
func FromContextError(err error) *Status {
	switch err {
	case nil:
		return New(codes.OK, "")
	case context.DeadlineExceeded:
		return New(codes.DeadlineExceeded, err.Error())
	case context.Canceled:
		return New(codes.Canceled, err.Error())
	default:
		return New(codes.Unknown, err.Error())
	}
}
731641
func FromContext(ctx context.Context) (*LoggerMeta, bool) {
	v, ok := ctx.Value(loggerMetaKey).(*LoggerMeta)
	return v, ok
}
899847
func FromContext(ctx context.Context) (Reporter, bool) {
	h, ok := ctx.Value(reporterKey).(Reporter)
	return h, ok
}
17993
func ToContext(ctx context.Context, logger *zap.Logger) context.Context {
	return ctxzap.ToContext(ctx, logger)
}