// LocaleExists checks to see if any messages files exist for the requested
// locale string.
540803
func (f *TranslatorFactory) LocaleExists(localeCode string) (exists bool, errs []error) {
	for _, p := range f.messagesPaths {
		p = strings.TrimRight(p, pathSeparator)
		_, err := os.Stat(p + pathSeparator + localeCode + ".yaml")
		if err == nil {
			exists = true
			return
		} else if !os.IsNotExist(err) {
			errs = append(errs, translatorError{message: "error getting file info: " + err.Error()})
		}

		info, err := os.Stat(p + pathSeparator + localeCode)
		if err == nil && info.IsDir() {
			files, _ := filepath.Glob(p + pathSeparator + localeCode + pathSeparator + "*.yaml")
			for _, file := range files {
				_, err := os.Stat(file)
				if err == nil {
					exists = true
					return
				} else if !os.IsNotExist(err) {
					errs = append(errs, translatorError{message: "error getting file info: " + err.Error()})
				}
			}
		}
	}

	return
}
568541
func (e *environ) AvailabilityZones(ctx context.ProviderCallContext) ([]common.AvailabilityZone, error) {
	e.availabilityZonesMutex.Lock()
	defer e.availabilityZonesMutex.Unlock()
	if e.availabilityZones == nil {
		filter := ec2.NewFilter()
		filter.Add("region-name", e.cloud.Region)
		resp, err := ec2AvailabilityZones(e.ec2, filter)
		if err != nil {
			return nil, maybeConvertCredentialError(err, ctx)
		}
		logger.Debugf("availability zones: %+v", resp)
		e.availabilityZones = make([]common.AvailabilityZone, len(resp.Zones))
		for i, z := range resp.Zones {
			e.availabilityZones[i] = &ec2AvailabilityZone{z}
		}
	}
	return e.availabilityZones, nil
}
540132
func IsOSNotExist(err error) bool {
	if err == nil {
		return false
	}

	switch v := err.(type) {
	case Error:
		for _, err := range v.ErrSet {
			if IsOSNotExist(err) {
				return true
			}
		}
		return false
	default:
		return os.IsNotExist(err)
	}
}
32553
func (d *Daemon) ExecExists(name string) (bool, error) {
	if _, err := d.getExecConfig(name); err != nil {
		return false, err
	}
	return true, nil
}
443359
func (db *RedisDB) ssetExists(key, member string) bool {
	ss := db.sortedsetKeys[key]
	_, ok := ss[member]
	return ok
}
532539
func aprintIfExists(n string, v []string, a bool) {
	if len(v) != 0 {
		fmt.Printf("----> %s: ", n)
		for i := range v {
			if !a && i == 10 {
				fmt.Printf("...")
				break
			}
			fmt.Printf("%s ", v[i])
		}
		fmt.Printf("\n")
	}
}
953195
func IsDirExists(pth string) (bool, error) {
	fileInf, isExists, err := genericIsPathExists(pth)
	if err != nil {
		return false, err
	}
	if !isExists {
		return false, nil
	}
	if fileInf == nil {
		return false, errors.New("No file info available")
	}
	return fileInf.IsDir(), nil
}
162272
func GetExits(err error) string {
	if err == nil {
		return ""
	}
	cast, ok := err.(*Error)
	if !ok {
		return ""
	}
	return cast.Exits()
}
1036527
func (env *environ) AvailabilityZones(ctx context.ProviderCallContext) ([]common.AvailabilityZone, error) {
	// TODO(dimitern): Fix this properly.
	return []common.AvailabilityZone{
		azShim{"zone1", true},
		azShim{"zone2", false},
		azShim{"zone3", true},
		azShim{"zone4", true},
	}, nil
}
1207032
func (s *IndicesExistsService) Local(local bool) *IndicesExistsService {
	s.local = &local
	return s
}
155882
func readLocalCharsets() {
	csdata, err := readFile("charsets.json")
	if err != nil {
		fmt.Fprintf(os.Stderr, "charset: cannot open \"charsets.json\": %v\n", err)
		return
	}

	var entries map[string]charsetEntry
	err = json.Unmarshal(csdata, &entries)
	if err != nil {
		fmt.Fprintf(os.Stderr, "charset: cannot decode config file: %v\n", err)
	}
	for name, e := range entries {
		class := classes[e.Class]
		if class == nil {
			continue
		}
		name = NormalizedName(name)
		for i, a := range e.Aliases {
			e.Aliases[i] = NormalizedName(a)
		}
		cs := &localCharset{
			Charset: Charset{
				Name:    name,
				Aliases: e.Aliases,
				Desc:    e.Desc,
				NoFrom:  class.from == nil,
				NoTo:    class.to == nil,
			},
			arg:   e.Arg,
			class: class,
		}
		localCharsets[cs.Name] = cs
		for _, a := range cs.Aliases {
			localCharsets[a] = cs
		}
	}
}
420707
func extractMessages(buf []byte) ([]*i18n.Message, error) {
	fset := token.NewFileSet()
	file, err := parser.ParseFile(fset, "", buf, parser.AllErrors)
	if err != nil {
		return nil, err
	}
	extractor := newExtractor(file)
	ast.Walk(extractor, file)
	return extractor.messages, nil
}
1211002
func IsKeyEExistsError(err error) bool {

	res, ok := err.(*gomemcached.MCResponse)
	if ok && res.Status == gomemcached.KEY_EEXISTS {
		return true
	}

	return false
}
806387
func (env *environ) AvailabilityZones(ctx context.ProviderCallContext) (zones []common.AvailabilityZone, err error) {
	err = env.withSession(ctx, func(env *sessionEnviron) error {
		zones, err = env.AvailabilityZones(ctx)
		return err
	})
	return zones, err
}
724118
func (q *SimpleQueryStringQuery) Locale(locale string) *SimpleQueryStringQuery {
	q.locale = locale
	return q
}
1006880
func (cfg *cloudConfig) Locale() string {
	locale, _ := cfg.attrs["locale"].(string)
	return locale
}
421577
func (s *IndicesExistsTypeService) Local(local bool) *IndicesExistsTypeService {
	s.local = &local
	return s
}