// Airbrake returns the airbrake client
482169
func Airbrake(ctx context.Context) (*gobrake.Notifier, bool) {
	a, ok := ctx.Value(airbrakeKey("heroku")).(*gobrake.Notifier)
	return a, ok
}
214549
func (h *connectionHeap) DropIdle() {
	for i := 0; i < len(h.heaps); i++ {
		for h.heaps[i].DropIdleTail() {
		}
	}
}
936939
func waitForDropletUnlocked(
	client *godo.Client, dropletId int, timeout time.Duration) error {
	done := make(chan struct{})
	defer close(done)

	result := make(chan error, 1)
	go func() {
		attempts := 0
		for {
			attempts += 1

			log.Printf("[DEBUG] Checking droplet lock state... (attempt: %d)", attempts)
			droplet, _, err := client.Droplets.Get(context.TODO(), dropletId)
			if err != nil {
				result <- err
				return
			}

			if !droplet.Locked {
				result <- nil
				return
			}

			// Wait 3 seconds in between
			time.Sleep(3 * time.Second)

			// Verify we shouldn't exit
			select {
			case <-done:
				// We finished, so just exit the goroutine
				return
			default:
				// Keep going
			}
		}
	}()

	log.Printf("[DEBUG] Waiting for up to %d seconds for droplet to unlock", timeout/time.Second)
	select {
	case err := <-result:
		return err
	case <-time.After(timeout):
		return fmt.Errorf(
			"Timeout while waiting to for droplet to unlock")
	}
}
867710
func (m *PodMonitor) Resync(ctx context.Context) error {
	if m.kubeClient == nil {
		return errors.New("pod: client has not been initialized yet")
	}

	return ResyncWithAllPods(ctx, m.kubeClient, m.eventsCh)
}
75486
func (c *Command) LeaseKey() lease.Key {
	return lease.Key{
		Namespace: c.Namespace,
		ModelUUID: c.ModelUUID,
		Lease:     c.Lease,
	}
}
998076
func (conn *Conn) h_KICK(line *Line) {
	if !line.argslen(1) {
		return
	}
	// XXX: this won't handle autorejoining channels on KICK
	// it's trivial to do this in a seperate handler...
	conn.st.Dissociate(line.Args[0], line.Args[1])
}
1016952
func (g *Driver) Halt() (err error) {
	g.resetAll()
	time.Sleep(10 * time.Millisecond)
	return
}
78030
func (v *evalVisitor) curBlock() *ast.BlockStatement {
	if len(v.blocks) == 0 {
		return nil
	}

	return v.blocks[len(v.blocks)-1]
}
255023
func (p *Plugin) Client() *plugins.Client {
	p.mu.RLock()
	defer p.mu.RUnlock()

	return p.pClient
}
118100
func (c *Client) Clone() *Client {
	n := &Client{
		AccessToken:            c.AccessToken,
		AccessTokenSecret:      c.AccessTokenSecret,
		Zone:                   c.Zone,
		TraceMode:              c.TraceMode,
		DefaultTimeoutDuration: c.DefaultTimeoutDuration,
		UserAgent:              c.UserAgent,
		AcceptLanguage:         c.AcceptLanguage,
		RequestTracer:          c.RequestTracer,
		ResponseTracer:         c.ResponseTracer,
		RetryMax:               c.RetryMax,
		RetryInterval:          c.RetryInterval,
		HTTPClient:             c.HTTPClient,
	}
	n.API = newAPI(n)
	return n
}
875753
func (d *driver) CloudBackupCreate(
	input *api.CloudBackupCreateRequest,
) (*api.CloudBackupCreateResponse, error) {
	name, _, err := d.cloudBackupCreate(input)
	if err == nil {
		resp := &api.CloudBackupCreateResponse{Name: name}
		return resp, err
	}
	return nil, err
}
525425
func (tc *serverTransportCredentials) ClientHandshake(ctx context.Context, addr string, rawConn net.Conn) (net.Conn, credentials.AuthInfo, error) {
	return nil, nil, ClientHandshakeNopErr
}
912959
func (c CloudstackClient) StopVirtualMachine(id string) (StopVirtualMachineResponse, error) {
	var resp StopVirtualMachineResponse
	params := url.Values{}
	params.Set("id", id)
	response, err := NewRequest(c, "stopVirtualMachine", params)
	if err != nil {
		return resp, err
	}
	resp = response.(StopVirtualMachineResponse)
	return resp, err
}
34618
func (n *NomadAgent) Client() (*api.Client, error) {
	conf := api.DefaultConfig()
	conf.Address = fmt.Sprintf("http://127.0.0.1:%d", n.Vars.HTTP)
	return api.NewClient(conf)
}
204113
func (c *UserClient) RESTClient() rest.Interface {
	if c == nil {
		return nil
	}
	return c.restClient
}
562992
func (d *driverPluginClient) SignalTask(taskID string, signal string) error {
	req := &proto.SignalTaskRequest{
		TaskId: taskID,
		Signal: signal,
	}
	_, err := d.client.SignalTask(d.doneCtx, req)
	return grpcutils.HandleGrpcErr(err, d.doneCtx)
}
228727
func (t *Tree) consumeRbrack() error {
	t.scanner.mode = scanRbrack
	if t.scanner.scan() != tokenRbrack {
		return ErrBadSubstitution
	}
	return nil
}