// explodeSensorFilename splits a sensor name into <type><num>_<property>.
339431
func explodeSensorFilename(filename string) (ok bool, sensorType string, sensorNum int, sensorProperty string) {
	matches := hwmonFilenameFormat.FindStringSubmatch(filename)
	if len(matches) == 0 {
		return false, sensorType, sensorNum, sensorProperty
	}
	for i, match := range hwmonFilenameFormat.SubexpNames() {
		if i >= len(matches) {
			return true, sensorType, sensorNum, sensorProperty
		}
		if match == "type" {
			sensorType = matches[i]
		}
		if match == "property" {
			sensorProperty = matches[i]
		}
		if match == "id" && len(matches[i]) > 0 {
			if num, err := strconv.Atoi(matches[i]); err == nil {
				sensorNum = num
			} else {
				return false, sensorType, sensorNum, sensorProperty
			}
		}
	}
	return true, sensorType, sensorNum, sensorProperty
}
9718
func (c *ContainerServer) ContainerRename(container, name string) error {
	ctr, err := c.LookupContainer(container)
	if err != nil {
		return err
	}

	oldName := ctr.Name()
	_, err = c.ReserveContainerName(ctr.ID(), name)
	if err != nil {
		return err
	}
	defer func() {
		if err != nil {
			c.ReleaseContainerName(name)
		} else {
			c.ReleaseContainerName(oldName)
		}
	}()

	// Update state.json
	if err = c.updateStateName(ctr, name); err != nil {
		return err
	}

	// Update config.json
	configRuntimePath := filepath.Join(ctr.BundlePath(), configFile)
	if err = updateConfigName(configRuntimePath, name); err != nil {
		return err
	}
	configStoragePath := filepath.Join(ctr.Dir(), configFile)
	if err = updateConfigName(configStoragePath, name); err != nil {
		return err
	}

	// Update containers.json
	if err = c.store.SetNames(ctr.ID(), []string{name}); err != nil {
		return err
	}
	return nil
}
772106
func (s *ModifyEndpointInput) SetEngineName(v string) *ModifyEndpointInput {
	s.EngineName = &v
	return s
}
1276031
func (c *Client) ValueDescriptorByName(name string) (value contract.ValueDescriptor, err error) {
	conn := c.Pool.Get()
	defer conn.Close()

	value, err = valueByName(conn, name)
	if err != nil {
		if err == redis.ErrNil {
			return value, db.ErrNotFound
		}
		return value, err
	}

	return value, nil
}
838262
func (a *API) ExportableName(name string) string {
	if name == "" {
		return name
	}

	return strings.ToUpper(name[0:1]) + name[1:]
}
264000
func ParseName(v string) (wn Name, err error) {
	base := strings.TrimSuffix(v, ".whl")
	if len(base) == len(v) {
		err = errors.New("missing .whl suffix")
		return
	}

	skip := 0
	switch parts := strings.Split(base, "-"); len(parts) {
	case 6:
		// Extra part: build tag.
		wn.BuildTag = parts[2]
		skip = 1
		fallthrough

	case 5:
		wn.Distribution = parts[0]
		wn.Version = parts[1]
		wn.PythonTag = parts[2+skip]
		wn.ABITag = parts[3+skip]
		wn.PlatformTag = parts[4+skip]

	default:
		err = errors.Reason("unknown number of segments (%d)", len(parts)).Err()
		return
	}
	return
}
1335683
func deviceName(zone string, diskId uint64) string {
	return fmt.Sprintf("%s-%d", zone, diskId)
}
866939
func ParseName(name pkix.Name) Name {
	n := Name{
		CommonName:         name.CommonName,
		SerialNumber:       name.SerialNumber,
		Country:            strings.Join(name.Country, ","),
		Organization:       strings.Join(name.Organization, ","),
		OrganizationalUnit: strings.Join(name.OrganizationalUnit, ","),
		Locality:           strings.Join(name.Locality, ","),
		Province:           strings.Join(name.Province, ","),
		StreetAddress:      strings.Join(name.StreetAddress, ","),
		PostalCode:         strings.Join(name.PostalCode, ","),
	}

	for i := range name.Names {
		n.Names = append(n.Names, name.Names[i].Value)
	}

	// ExtraNames aren't supported in Go 1.4
	// for i := range name.ExtraNames {
	// 	n.ExtraNames = append(n.ExtraNames, name.ExtraNames[i].Value)
	// }

	return n
}
521835
func (mc MongoClient) ValueDescriptorsByName(names []string) ([]contract.ValueDescriptor, error) {
	vList := make([]contract.ValueDescriptor, 0)
	for _, name := range names {
		v, err := mc.ValueDescriptorByName(name)
		if err != nil && err != db.ErrNotFound {
			return []contract.ValueDescriptor{}, err
		}
		if err == nil {
			vList = append(vList, v)
		}
	}

	return vList, nil
}
620141
func (ctx *Context) PushGlobalStruct(name string, s interface{}) (int, error) {
	ctx.PushGlobalObject()
	obj, err := ctx.PushStruct(s)
	if err != nil {
		return -1, err
	}

	ctx.PutPropString(-2, name)
	ctx.Pop()

	return obj, nil
}
501563
func WarnWordSepNormalizeFunc(f *pflag.FlagSet, name string) pflag.NormalizedName {
	if strings.Contains(name, "_") {
		nname := strings.Replace(name, "_", "-", -1)
		glog.Warningf("%s is DEPRECATED and will be removed in a future version. Use %s instead.", name, nname)

		return pflag.NormalizedName(nname)
	}
	return pflag.NormalizedName(name)
}
231790
func (reactorFunc DynamoDBReactorFunc) ReactorName() string {
	return runtime.FuncForPC(reflect.ValueOf(reactorFunc).Pointer()).Name()
}
47504
func ValidBreakpointName(name string) error {
	if _, err := strconv.Atoi(name); err == nil {
		return errors.New("breakpoint name can not be a number")
	}

	for _, ch := range name {
		if !(unicode.IsLetter(ch) || unicode.IsDigit(ch)) {
			return fmt.Errorf("invalid character in breakpoint name '%c'", ch)
		}
	}

	return nil
}
1345778
func (sensor *Sensor) GetName() (name string) {
	name = C.GoString(C.SDL_SensorGetName((*C.SDL_Sensor)(sensor)))
	return
}
80341
func (s *LifecycleEvent) SetLifecycleEventName(v string) *LifecycleEvent {
	s.LifecycleEventName = &v
	return s
}
449893
func sanitizeName(name string) string {
	output := strings.ToLower(illegalChars.ReplaceAllString(name, "_"))

	if legalLabel.MatchString(output) {
		return output
	}
	// Prefix name with _ if it begins with a number
	return "_" + output
}
1343900
func validateExtendedResourceName(name v1.ResourceName) []error {
	var validationErrors []error
	for _, msg := range validation.IsQualifiedName(string(name)) {
		validationErrors = append(validationErrors, errors.New(msg))
	}
	if len(validationErrors) != 0 {
		return validationErrors
	}
	if !v1helper.IsExtendedResourceName(name) {
		validationErrors = append(validationErrors, fmt.Errorf("%s is an invalid extended resource name", name))
	}
	return validationErrors
}