// writeActionSymbol writes a symbol to represent the given action, followed
// by a space.
//
// It only supports the actions that can be represented with a single character:
// Create, Delete, Update and NoAction.
480400
func (p *blockBodyDiffPrinter) writeActionSymbol(action plans.Action) {
	switch action {
	case plans.Create:
		p.buf.WriteString(p.color.Color("[green]+[reset] "))
	case plans.Delete:
		p.buf.WriteString(p.color.Color("[red]-[reset] "))
	case plans.Update:
		p.buf.WriteString(p.color.Color("[yellow]~[reset] "))
	case plans.NoOp:
		p.buf.WriteString("  ")
	default:
		// Should never happen
		p.buf.WriteString(p.color.Color("? "))
	}
}
219828
func (u *Unit) AddAction(name string, payload map[string]interface{}) (Action, error) {
	if len(name) == 0 {
		return nil, errors.New("no action name given")
	}

	// If the action is predefined inside juju, get spec from map
	spec, ok := actions.PredefinedActionsSpec[name]
	if !ok {
		specs, err := u.ActionSpecs()
		if err != nil {
			return nil, err
		}
		spec, ok = specs[name]
		if !ok {
			return nil, errors.Errorf("action %q not defined on unit %q", name, u.Name())
		}
	}
	// Reject bad payloads before attempting to insert defaults.
	err := spec.ValidateParams(payload)
	if err != nil {
		return nil, err
	}
	payloadWithDefaults, err := spec.InsertDefaults(payload)
	if err != nil {
		return nil, err
	}

	m, err := u.st.Model()
	if err != nil {
		return nil, errors.Trace(err)
	}
	return m.EnqueueAction(u.Tag(), name, payloadWithDefaults)
}
251401
func (b *bitWriter) encSymbol(ct cTable, symbol byte) {
	enc := ct[symbol]
	b.bitContainer |= uint64(enc.val) << (b.nBits & 63)
	b.nBits += enc.nBits
}
247612
func (b *Bmattermost) replaceAction(text string) (string, bool) {
	if strings.HasPrefix(text, "*") && strings.HasSuffix(text, "*") {
		return strings.Replace(text, "*", "", -1), true
	}
	return text, false
}
760422
func (w StdlibWriter) Write(p []byte) (int, error) {
	log.Print(strings.TrimSpace(string(p)))
	return len(p), nil
}
188346
func (a *ArgClause) HintAction(action HintAction) *ArgClause {
	a.addHintAction(action)
	return a
}
234866
func (s *Struct) addSymbol(sym Symbol) {
	if s.frozen {
		panic("frozen")
	}
	s.symbols = append(s.symbols, sym)
}
532866
func (c *CyclePDB) Write(towrite []boltcycle.KvPair) (err error) {
	atomic.AddInt64(&c.stats.TotalWriteCount, int64(len(towrite)))

	return c.blobs.latest().Update(func(tx *bolt.Tx) error {
		bucket := tx.Bucket(c.bucketTimesIn)
		if bucket == nil {
			return errorUnableToFindRootBucket
		}

		for i := 0; err == nil && i < len(towrite); i++ {
			p := towrite[i]
			err = bucket.Put(p.Key, p.Value)
		}
		return err
	})
}
1286945
func (s *CreateRuleInput) SetActions(v []*Action) *CreateRuleInput {
	s.Actions = v
	return s
}
844769
func encodeSymbol(buf *bytes.Buffer, name string, val Symbol) error {
	// type
	if err := buf.WriteByte(_SYMBOL); err != nil {
		return err
	}

	// name
	if err := writeCstring(buf, name); err != nil {
		return err
	}

	// value
	return writeString(buf, string(val))
}
1200349
func (a *ActionOutput) WriteTo(w io.Writer) (int64, error) {
	return encoding.WriteTo(w, action{a.Type(), 16}, *a, pad6{})
}
37412
func (h *LangHandler) handleTextDocumentSymbol(ctx context.Context, conn jsonrpc2.JSONRPC2, req *jsonrpc2.Request, params lsp.DocumentSymbolParams) ([]lsp.SymbolInformation, error) {
	if !util.IsURI(params.TextDocument.URI) {
		return nil, &jsonrpc2.Error{
			Code:    jsonrpc2.CodeInvalidParams,
			Message: fmt.Sprintf("textDocument/documentSymbol not yet supported for out-of-workspace URI (%q)", params.TextDocument.URI),
		}
	}
	path := util.UriToPath(params.TextDocument.URI)

	fset := token.NewFileSet()
	bctx := h.BuildContext(ctx)
	src, err := buildutil.ParseFile(fset, bctx, nil, filepath.Dir(path), filepath.Base(path), 0)
	if err != nil {
		return nil, err
	}
	pkg := &ast.Package{
		Name:  src.Name.Name,
		Files: map[string]*ast.File{},
	}
	pkg.Files[filepath.Base(path)] = src

	symbols := astPkgToSymbols(fset, pkg, &build.Package{})
	res := make([]lsp.SymbolInformation, len(symbols))
	for i, s := range symbols {
		res[i] = s.SymbolInformation
	}
	return res, nil
}
456231
func NewAction(name string, params map[string]interface{}) (*Action, error) {
	return &Action{name: name, params: params}, nil
}
592993
func NewAction(name string, params map[string]interface{}) *Action {
	return &Action{name: name, params: params}
}
382687
func (a *ActionExperimenter) WriteTo(w io.Writer) (int64, error) {
	return encoding.WriteTo(w, action{a.Type(), actionLen}, a.Experimenter)
}
818814
func (w *encbuf) Write(b []byte) (int, error) {
	w.str = append(w.str, b...)
	return len(b), nil
}
1360907
func (sm3 *SM3) Write(p []byte) (int, error) {
	toWrite := len(p)
	sm3.length += uint64(len(p) * 8)

	msg := append(sm3.unhandleMsg, p...)
	nblocks := len(msg) / sm3.BlockSize()
	sm3.update(msg, nblocks)

	// Update unhandleMsg
	sm3.unhandleMsg = msg[nblocks*sm3.BlockSize():]

	return toWrite, nil
}