// descriptionToken returns a human-readable string describing the contents of
// this item.
168424
func (vi *ValueItem) descriptionToken() string {
	return fmt.Sprintf("[%s:%s@%s]", vi.ConfigSet, vi.Path, vi.Revision)
}
378516
func Describe(val interface{}) string {
	switch val := val.(type) {
	case *usb.Descriptor:
		if v, ok := Vendors[val.Vendor]; ok {
			if d, ok := v.Product[val.Product]; ok {
				return fmt.Sprintf("%s (%s)", d, v)
			}
			return fmt.Sprintf("Unknown (%s)", v)
		}
		return fmt.Sprintf("Unknown %s:%s", val.Vendor, val.Product)
	}
	return fmt.Sprintf("Unknown (%T)", val)
}
119968
func (c *schemaConverter) description(file *descriptor.FileDescriptorProto, ptr interface{}) string {
	description := c.sourceCodeInfo[file][ptr].GetLeadingComments()

	// Trim leading whitespace.
	lines := strings.Split(description, "\n")
	trimSize := -1
	for _, l := range lines {
		if len(strings.TrimSpace(l)) == 0 {
			// skip empty lines
			continue
		}
		space := 0
		for _, r := range l {
			if unicode.IsSpace(r) {
				space++
			} else {
				break
			}
		}
		if trimSize == -1 || space < trimSize {
			trimSize = space
		}
	}
	if trimSize > 0 {
		for i := range lines {
			if len(lines[i]) >= trimSize {
				lines[i] = lines[i][trimSize:]
			}
		}
		description = strings.Join(lines, "\n")
	}
	description = strings.TrimSpace(description)

	// Append valid enum values.
	if field, ok := ptr.(*descriptor.FieldDescriptorProto); ok && field.GetType() == descriptor.FieldDescriptorProto_TYPE_ENUM {
		_, obj, _ := descutil.Resolve(c.desc, strings.TrimPrefix(field.GetTypeName(), "."))
		if enum, ok := obj.(*descriptor.EnumDescriptorProto); ok {
			names := make([]string, len(enum.Value))
			for i, v := range enum.Value {
				names[i] = v.GetName()
			}
			if description != "" {
				description += "\n"
			}
			description += fmt.Sprintf("Valid values: %s.", strings.Join(names, ", "))
		}
	}
	return description
}
1184014
func (c *Client) Describe(ch chan<- *prometheus.Desc) {
	ch <- orgsDesc
	ch <- bucketsDesc
	ch <- usersDesc
	ch <- tokensDesc
	ch <- dashboardsDesc
	ch <- scrapersDesc
	ch <- telegrafsDesc
	ch <- boltWritesDesc
	ch <- boltReadsDesc
}
984043
func (d *ChainDescriber) Describe(ist *imagev1.ImageStreamTag, includeInputImages, reverse bool) (string, error) {
	g, err := d.MakeGraph()
	if err != nil {
		return "", err
	}

	// Retrieve the imageStreamTag node of interest
	istNode := g.Find(imagegraph.ImageStreamTagNodeName(ist))
	if istNode == nil {
		return "", NotFoundErr(fmt.Sprintf("%q", ist.Name))
	}

	markers := buildanalysis.FindCircularBuilds(g, d.namer)
	if len(markers) > 0 {
		for _, marker := range markers {
			if strings.Contains(marker.Message, ist.Name) {
				return marker.Message, nil
			}
		}
	}

	buildInputEdgeKinds := []string{buildedges.BuildTriggerImageEdgeKind}
	if includeInputImages {
		buildInputEdgeKinds = append(buildInputEdgeKinds, buildedges.BuildInputImageEdgeKind)
	}

	// Partition down to the subgraph containing the imagestreamtag of interest
	var partitioned osgraph.Graph
	if reverse {
		partitioned = partitionReverse(g, istNode, buildInputEdgeKinds)
	} else {
		partitioned = partition(g, istNode, buildInputEdgeKinds)
	}

	switch strings.ToLower(d.outputFormat) {
	case "dot":
		data, err := dot.Marshal(partitioned, dotutil.Quote(ist.Name), "", "  ", false)
		if err != nil {
			return "", err
		}
		return string(data), nil
	case "":
		return d.humanReadableOutput(partitioned, d.namer, istNode, reverse), nil
	}

	return "", fmt.Errorf("unknown specified format %q", d.outputFormat)
}
1212333
func ParseTokenDetails(token string) (jwtToken *JWTToken) {
	jwtToken = &JWTToken{}

	chunks := strings.Split(token, ".")
	for _, chunk := range chunks {
		json_string, err := base64.RawURLEncoding.DecodeString(chunk)
		if err == nil {
			// Ignore errors. We expect that the signature is not JSON,
			// so unmarshalling it will fail. That's fine. We'll extract
			// all the data we can.
			_ = json.Unmarshal(json_string, &jwtToken)
		}
	}

	return jwtToken
}
1184564
func (tok Token) String() string {
	if _, ok := tokens[tok]; ok {
		return tokens[tok]
	}
	return ""
}
1166882
func (h *Exception) Description(description string) *Exception {
	h.description = description
	h.descriptionSet = true
	return h
}
999818
func (c classifier) classifyTokens(tokens []string) *dt.StructuredInput {
	var s dt.StructuredInput
	var sections []string
	for _, t := range tokens {
		var found bool
		lower := strings.ToLower(t)
		_, exists := c["C"+lower]
		if exists {
			s.Commands = append(s.Commands, lower)
			found = true
		}
		_, exists = c["O"+lower]
		if exists {
			s.Objects = append(s.Objects, lower)
			found = true
		}

		// Identify the sex of any people being discussed.
		var sex dt.Sex
		_, exists = c["PM"+lower]
		if exists {
			_, exists = c["PF"+lower]
			if exists {
				sex = dt.SexEither
			} else {
				sex = dt.SexMale
			}
			person := dt.Person{
				Name: t,
				Sex:  sex,
			}
			s.People = append(s.People, person)
			found = true
		}

		// If we haven't found a male or male+female name yet, check
		// for female.
		if sex == dt.SexInvalid {
			_, exists = c["PF"+lower]
			if exists {
				person := dt.Person{
					Name: t,
					Sex:  dt.SexFemale,
				}
				s.People = append(s.People, person)
				found = true
			}
		}

		// Each time we find an object, add a separator to sections,
		// enabling us to check for times only along continuous
		// stretches of a sentence (i.e. a single time won't appear on
		// either side of the word "Jim" or "Bring")
		if found || len(sections) == 0 {
			sections = append(sections, t)
		} else {
			switch t {
			case ".", ",", ";", "?", "-", "_", "=", "+", "#", "@",
				"!", "$", "%", "^", "&", "*", "(", ")", "'":
				continue
			}
			sections[len(sections)-1] += " " + t
		}
	}
	for _, sec := range sections {
		if len(sec) == 0 {
			continue
		}
		s.Times = append(s.Times, timeparse.Parse(sec)...)
	}
	return &s
}
1265215
func (sc *scanner) endToken(val *tokenValue) {
	if val.raw == "" {
		val.raw = string(sc.token[:len(sc.token)-len(sc.rest)])
	}
}
271790
func (d *Decoder) RawToken() (Token, error) {
	if d.unmarshalDepth > 0 {
		return nil, errRawToken
	}
	return d.rawToken()
}
747063
func (d *IdentityDescriber) Describe(namespace, name string, settings describe.DescriberSettings) (string, error) {
	userClient := d.c.Users()
	identityClient := d.c.Identities()

	identity, err := identityClient.Get(name, metav1.GetOptions{})
	if err != nil {
		return "", err
	}

	return tabbedString(func(out *tabwriter.Writer) error {
		formatMeta(out, identity.ObjectMeta)

		if len(identity.User.Name) == 0 {
			formatString(out, "User Name", identity.User.Name)
			formatString(out, "User UID", identity.User.UID)
		} else {
			resolvedUser, err := userClient.Get(identity.User.Name, metav1.GetOptions{})

			nameValue := identity.User.Name
			uidValue := string(identity.User.UID)

			if kerrs.IsNotFound(err) {
				nameValue += fmt.Sprintf(" (Error: User does not exist)")
			} else if err != nil {
				nameValue += fmt.Sprintf(" (Error: User lookup failed)")
			} else {
				if !sets.NewString(resolvedUser.Identities...).Has(name) {
					nameValue += fmt.Sprintf(" (Error: User identities do not include %s)", name)
				}
				if resolvedUser.UID != identity.User.UID {
					uidValue += fmt.Sprintf(" (Error: Actual user UID is %s)", string(resolvedUser.UID))
				}
			}

			formatString(out, "User Name", nameValue)
			formatString(out, "User UID", uidValue)
		}
		return nil
	})

}
808245
func (c ComponentName) Description() string {
	switch c {
	case ComponentNameService:
		return "Service"
	case ComponentNameKBFS:
		return "KBFS"
	case ComponentNameApp:
		return "App"
	case ComponentNameCLI:
		return "Command Line"
	case ComponentNameUpdater:
		return "Updater"
	case ComponentNameFuse:
		return "Fuse"
	case ComponentNameHelper:
		return "Privileged Helper Tool"
	case ComponentNameKBNM:
		return "Browser Native Messaging"
	case ComponentNameCLIPaths:
		return "Command Line (privileged)"
	case ComponentNameRedirector:
		return "Redirector (privileged)"
	}
	return "Unknown"
}
432131
func (i tokenType) String() string {
	s := tokenName[i]
	if s == "" {
		return fmt.Sprintf("t_unknown_%d", int(i))
	}
	return s
}
1300027
func DiscoveryToken() string {
	if len(modes) == 0 {
		return Token()
	}
	if _, ok := modes[0].(None); ok {
		return OmitAuthToken
	}
	return Token()
}
1254634
func Description(d string) {
	switch def := dslengine.CurrentDefinition().(type) {
	case *design.APIDefinition:
		def.Description = d
	case *design.ResourceDefinition:
		def.Description = d
	case *design.FileServerDefinition:
		def.Description = d
	case *design.ActionDefinition:
		def.Description = d
	case *design.MediaTypeDefinition:
		def.Description = d
	case *design.AttributeDefinition:
		def.Description = d
	case *design.ResponseDefinition:
		def.Description = d
	case *design.DocsDefinition:
		def.Description = d
	case *design.SecuritySchemeDefinition:
		def.Description = d
	default:
		dslengine.IncompatibleDSL()
	}
}
424050
func (p *PushEventRepository) GetDescription() string {
	if p == nil || p.Description == nil {
		return ""
	}
	return *p.Description
}