// EndSnoozeContext ends the current user's snooze mode with a custom context
557011
func (api *Client) EndSnoozeContext(ctx context.Context) (*DNDStatus, error) {
	values := url.Values{
		"token": {api.token},
	}

	response, err := api.dndRequest(ctx, "dnd.endSnooze", values)
	if err != nil {
		return nil, err
	}
	return &response.DNDStatus, nil
}
339068
func (api *Client) CloseIMChannelContext(ctx context.Context, channel string) (bool, bool, error) {
	values := url.Values{
		"token":   {api.token},
		"channel": {channel},
	}

	response, err := api.imRequest(ctx, "im.close", values)
	if err != nil {
		return false, false, err
	}
	return response.NoOp, response.AlreadyClosed, nil
}
974815
func IsContextNotFound(err error) bool {
	if err == nil {
		return false
	}
	if _, ok := err.(*errContextNotFound); ok || err == ErrNoContext {
		return true
	}
	return strings.Contains(err.Error(), "context was not found for specified context")
}
16991
func (f *Future) DoneWithContext(ctx context.Context, sender autorest.Sender) (done bool, err error) {
	ctx = tracing.StartSpan(ctx, "github.com/Azure/go-autorest/autorest/azure/async.DoneWithContext")
	defer func() {
		sc := -1
		resp := f.Response()
		if resp != nil {
			sc = resp.StatusCode
		}
		tracing.EndSpan(ctx, sc, err)
	}()

	if f.pt == nil {
		return false, autorest.NewError("Future", "Done", "future is not initialized")
	}
	if f.pt.hasTerminated() {
		return true, f.pt.pollingError()
	}
	if err := f.pt.pollForStatus(ctx, sender); err != nil {
		return false, err
	}
	if err := f.pt.checkForErrors(); err != nil {
		return f.pt.hasTerminated(), err
	}
	if err := f.pt.updatePollingState(f.pt.provisioningStateApplicable()); err != nil {
		return false, err
	}
	if err := f.pt.initPollingMethod(); err != nil {
		return false, err
	}
	if err := f.pt.updatePollingMethod(); err != nil {
		return false, err
	}
	return f.pt.hasTerminated(), f.pt.pollingError()
}
712335
func (ctx *CoalescingContext) AddContext(other context.Context) error {
	select {
	case ctx.mutateCh <- other:
		return nil
	case <-ctx.doneCh:
		return context.Canceled
	}
}
1016726
func (n *NamedStmt) GetContext(ctx context.Context, dest interface{}, arg interface{}) error {
	r := n.QueryRowxContext(ctx, arg)
	return r.scanAny(dest, false)
}
160093
func NewContext() *Context {
	ctx, cancel := context.WithCancel(context.Background())
	sctx := &Context{
		values:      make(map[fmt.Stringer]interface{}),
		sessionVars: variable.NewSessionVars(),
		ctx:         ctx,
		cancel:      cancel,
	}
	sctx.sessionVars.InitChunkSize = 2
	sctx.sessionVars.MaxChunkSize = 32
	sctx.sessionVars.StmtCtx.TimeZone = time.UTC
	sctx.sessionVars.GlobalVarsAccessor = variable.NewMockGlobalAccessor()
	return sctx
}
1181455
func (p *PUContext) SynServiceContext() []byte {
	p.RLock()
	defer p.RUnlock()
	return p.synServiceContext
}
467518
func (client *Client) SetHttpContext(h *Http) {
	client.mu.Lock()
	defer client.mu.Unlock()
	client.context.setHttp(h)
}
797690
func (p *Provider) StopContext() context.Context {
	p.stopOnce.Do(p.stopInit)

	p.stopMu.Lock()
	defer p.stopMu.Unlock()

	return p.stopCtx
}
772576
func (api *Client) CloseConversationContext(ctx context.Context, channelID string) (noOp bool, alreadyClosed bool, err error) {
	values := url.Values{
		"token":   {api.token},
		"channel": {channelID},
	}
	response := struct {
		SlackResponse
		NoOp          bool `json:"no_op"`
		AlreadyClosed bool `json:"already_closed"`
	}{}

	err = api.postMethod(ctx, "conversations.close", values, &response)
	if err != nil {
		return false, false, err
	}

	return response.NoOp, response.AlreadyClosed, response.Err()
}
1101917
func NewFSMContext(
	serialization FSMSerializer,
	wfType WorkflowType, wfExec WorkflowExecution,
	pending *ActivityCorrelator,
	state string, stateData interface{}, stateVersion uint64,
) *FSMContext {
	return &FSMContext{
		serialization:     serialization,
		WorkflowType:      wfType,
		WorkflowExecution: wfExec,
		pendingActivities: pending,
		State:             state,
		stateData:         stateData,
		stateVersion:      stateVersion,
	}
}
250522
func Context() context.Context {
	appContextOnce.Do(func() {
		signals := make(chan os.Signal, 2048)
		signal.Notify(signals, terminationSignals...)

		const exitLimit = 3
		retries := 0

		ctx, cancel := context.WithCancel(context.Background())
		appContextCache = ctx

		go func() {
			for {
				<-signals
				cancel()
				retries++
				if retries >= exitLimit {
					logrus.Errorf("got %d SIGTERM/SIGINTs, forcing shutdown", retries)
					os.Exit(1)
				}
			}
		}()
	})
	return appContextCache
}
176686
func BootstrapContext(cmdContext *cmd.Context) environs.BootstrapContext {
	return &bootstrapContext{
		Context:           cmdContext,
		verifyCredentials: true,
	}
}
1196174
func (c *BackfillTagIndexCall) Context(ctx context.Context) *BackfillTagIndexCall {
	c.ctx_ = ctx
	return c
}
135924
func (m *Debuggee) GetExtSourceContexts() []*v1.ExtendedSourceContext {
	if m != nil {
		return m.ExtSourceContexts
	}
	return nil
}
830161
func LoggerDummyContext() context.Context {
	ctx := context.Background()
	ctx = LoggerNewContext(ctx)
	return ctx
}