// Component implements runner.Context.
180430
func (ctx *hookContext) Component(name string) (jujuc.ContextComponent, error) {
	return nil, errors.NotFoundf("context component %q", name)
}
189804
func (c *GetTaskDefCall) Context(ctx context.Context) *GetTaskDefCall {
	c.ctx_ = ctx
	return c
}
53931
func (c *TaskResultCall) Context(ctx context.Context) *TaskResultCall {
	c.ctx_ = ctx
	return c
}
407201
func (c *UnitStateGetCall) Context(ctx context.Context) *UnitStateGetCall {
	c.ctx_ = ctx
	return c
}
978088
func main() {
	// Imports the hello component declared above in order to make it loadable
	// in a page or usable in other components.
	//
	// Imported component can be used as URL or html tags by referencing them by
	// their lowercased names.
	// E.g:
	//  Hello   => hello
	//  foo.Bar => foo.bar
	app.Import(&Hello{})

	// Defines the component to load when an URL without path is loaded.
	app.DefaultPath = "/hello"

	// Runs the app in the browser.
	if err := app.Run(); err != nil {
		log.Print(err)
	}
}
684816
func (c *UnitsListCall) Context(ctx context.Context) *UnitsListCall {
	c.ctx_ = ctx
	return c
}
844397
func (c *GetConfigByHashCall) Context(ctx context.Context) *GetConfigByHashCall {
	c.ctx_ = ctx
	return c
}
834589
func ContextComponent(ctx HookContext) (Component, error) {
	compCtx, err := ctx.Component(payload.ComponentName)
	if errors.IsNotFound(err) {
		return nil, errors.Errorf("component %q not registered", payload.ComponentName)
	}
	if err != nil {
		return nil, errors.Trace(err)
	}
	if compCtx == nil {
		return nil, errors.Errorf("component %q disabled", payload.ComponentName)
	}
	return compCtx, nil
}
174349
func (paths Paths) ComponentDir(name string) string {
	return filepath.Join(paths.State.BaseDir, name)
}
1186722
func (c *TasksListCall) Context(ctx context.Context) *TasksListCall {
	c.ctx_ = ctx
	return c
}
180034
func RenderInterface(v interface{}, ctx *Context) (interface{}, error) {
	f := func(v string) (string, error) {
		return Render(v, ctx)
	}

	walker := &renderWalker{
		F:       f,
		Replace: true,
	}
	err := reflectwalk.Walk(v, walker)
	if err != nil {
		return nil, err
	}

	if walker.Top != nil {
		v = walker.Top
	}
	return v, nil
}
156090
func (c *PutCall) Context(ctx context.Context) *PutCall {
	c.ctx_ = ctx
	return c
}
819977
func (c *GetRefsCall) Context(ctx context.Context) *GetRefsCall {
	c.ctx_ = ctx
	return c
}
270369
func (engine *Engine) Context(ctx context.Context) *Session {
	session := engine.NewSession()
	session.isAutoClose = true
	return session.Context(ctx)
}
216317
func components(c context.Context, b *buildbot.Build) (result []*ui.BuildComponent) {
	for _, step := range b.Steps {
		if step.Hidden == true {
			continue
		}
		bc := &ui.BuildComponent{
			Label: ui.NewEmptyLink(step.Name),
		}
		// Step text sometimes contains <br>, which we want to parse into new lines.
		bc.Text = step.Text

		// Figure out the status.
		if !step.IsStarted {
			bc.Status = model.NotRun
		} else {
			bc.Status = step.Results.Status()
		}

		remainingAliases := stringset.New(len(step.Aliases))
		for linkAnchor := range step.Aliases {
			remainingAliases.Add(linkAnchor)
		}

		getLinksWithAliases := func(logLink *ui.Link, isLog bool) ui.LinkSet {
			// Generate alias links.
			var aliases ui.LinkSet
			if remainingAliases.Del(logLink.Label) {
				stepAliases := step.Aliases[logLink.Label]
				aliases = make(ui.LinkSet, len(stepAliases))
				for i, alias := range stepAliases {
					aliases[i] = alias.Link()
				}
			}

			// Step log link takes primary, with aliases as secondary.
			links := make(ui.LinkSet, 1, 1+len(aliases))
			links[0] = logLink

			for _, a := range aliases {
				a.Alias = true
			}
			return append(links, aliases...)
		}

		for _, l := range step.Logs {
			ariaName := l.Name
			switch ariaName {
			case "stdio":
				ariaName = "standard i/o"
			case "stdout":
				ariaName = "standard out"
			case "stderr":
				ariaName = "standard error"
			}
			logLink := ui.NewLink(l.Name, l.URL, fmt.Sprintf("log %s for step %s", ariaName, step.Name))

			links := getLinksWithAliases(logLink, true)
			if logLink.Label == "stdio" {
				bc.MainLink = links
			} else {
				bc.SubLink = append(bc.SubLink, links)
			}
		}

		// Step links are stored as maps of name: url
		// Because Go doesn't believe in nice things, we now create another array
		// just so that we can iterate through this map in order.
		names := make([]string, 0, len(step.Urls))
		for name := range step.Urls {
			names = append(names, name)
		}
		sort.Strings(names)
		for _, name := range names {
			logLink := ui.NewLink(name, step.Urls[name], fmt.Sprintf("step link %s for step %s", name, step.Name))

			bc.SubLink = append(bc.SubLink, getLinksWithAliases(logLink, false))
		}

		// Add any unused aliases directly.
		if remainingAliases.Len() > 0 {
			unusedAliases := remainingAliases.ToSlice()
			sort.Strings(unusedAliases)

			for _, label := range unusedAliases {
				var baseLink ui.LinkSet
				for _, alias := range step.Aliases[label] {
					aliasLink := alias.Link()
					if len(baseLink) == 0 {
						aliasLink.Label = label
					} else {
						aliasLink.Alias = true
					}
					baseLink = append(baseLink, aliasLink)
				}

				if len(baseLink) > 0 {
					bc.SubLink = append(bc.SubLink, baseLink)
				}
			}
		}

		// Copy times.
		times := step.Times
		if times.Finish.IsZero() {
			times.Finish = b.Times.Finish
		}
		bc.ExecutionTime = ui.NewInterval(c, times.Start.Time, times.Finish.Time)
		result = append(result, bc)
	}
	return
}
77477
func (o *CiliumAPI) Context() *middleware.Context {
	if o.context == nil {
		o.context = middleware.NewRoutableContext(o.spec, o, nil)
	}

	return o.context
}
998153
func (s *PutScriptService) Context(context string) *PutScriptService {
	s.context = context
	return s
}