// Returns formatXL.XL.Version information, this code is specifically
// used to read XL `format.json` and capture any version information
// that it may have.
772665
func formatXLGetVersion(formatPath string) (string, error) {
	format := &formatXLVersionDetect{}
	b, err := ioutil.ReadFile(formatPath)
	if err != nil {
		return "", err
	}
	if err = json.Unmarshal(b, format); err != nil {
		return "", err
	}
	return format.XL.Version, nil
}
864674
func (s *VersionService) Get(versionID int) (*Version, *Response, error) {
	apiEndpoint := fmt.Sprintf("/rest/api/2/version/%v", versionID)
	req, err := s.client.NewRequest("GET", apiEndpoint, nil)
	if err != nil {
		return nil, nil, err
	}

	version := new(Version)
	resp, err := s.client.Do(req, version)
	if err != nil {
		return nil, resp, NewJiraError(resp, err)
	}
	return version, resp, nil
}
254094
func getVersion() string {
	slurp, err := ioutil.ReadFile(filepath.Join(pkRoot, "VERSION"))
	v := strings.TrimSpace(string(slurp))
	if err != nil && !os.IsNotExist(err) {
		log.Fatal(err)
	}
	if v == "" {
		return "unknown"
	}
	return v
}
1197559
func getFormatter(f string) (Formatter, error) {
	registry.RLock()
	defer registry.RUnlock()

	formatter := registry.r[f]
	if formatter == nil {
		return nil, errors.Reason("unknown formatter: %q", f).Err()
	}
	return formatter, nil
}
1068639
func (s *DescribeServicesInput) SetFormatVersion(v string) *DescribeServicesInput {
	s.FormatVersion = &v
	return s
}
1359150
func GetFormat(X *xgbutil.XUtil, depth byte) *xproto.Format {
	for _, pixForm := range X.Setup().PixmapFormats {
		if pixForm.Depth == depth {
			return &pixForm
		}
	}
	return nil
}
231450
func (driver *Driver) Version() (file.Version, error) {
	versions, err := driver.Versions()
	if len(versions) == 0 {
		return 0, err
	}
	return versions[0], err
}
710777
func getFormatXLInQuorum(formats []*formatXLV3) (*formatXLV3, error) {
	formatHashes := make([]string, len(formats))
	for i, format := range formats {
		if format == nil {
			continue
		}
		h := sha256.New()
		for _, set := range format.XL.Sets {
			for _, diskID := range set {
				h.Write([]byte(diskID))
			}
		}
		formatHashes[i] = hex.EncodeToString(h.Sum(nil))
	}

	formatCountMap := make(map[string]int)
	for _, hash := range formatHashes {
		if hash == "" {
			continue
		}
		formatCountMap[hash]++
	}

	maxHash := ""
	maxCount := 0
	for hash, count := range formatCountMap {
		if count > maxCount {
			maxCount = count
			maxHash = hash
		}
	}

	if maxCount < len(formats)/2 {
		return nil, errXLReadQuorum
	}

	for i, hash := range formatHashes {
		if hash == maxHash {
			format := *formats[i]
			format.XL.This = ""
			return &format, nil
		}
	}

	return nil, errXLReadQuorum
}
774122
func getVersion(job *api.Job) uint64 {
	if job.Version != nil {
		return *job.Version
	}

	return 0
}
159355
func GetVersion() Version {
	var versionStr string
	if gitCommit != "" && gitTag != "" && gitTreeState == "clean" {
		// if we have a clean tree state and the current commit is tagged,
		// this is an official release.
		versionStr = gitTag
	} else {
		// otherwise formulate a version string based on as much metadata
		// information we have available.
		versionStr = "v" + version
		if len(gitCommit) >= 7 {
			versionStr += "+" + gitCommit[0:7]
			if gitTreeState != "clean" {
				versionStr += ".dirty"
			}
		} else {
			versionStr += "+unknown"
		}
	}
	return Version{
		Version:      versionStr,
		BuildDate:    buildDate,
		GitCommit:    gitCommit,
		GitTag:       gitTag,
		GitTreeState: gitTreeState,
		GoVersion:    runtime.Version(),
		Compiler:     runtime.Compiler,
		Platform:     fmt.Sprintf("%s/%s", runtime.GOOS, runtime.GOARCH),
	}
}
101201
func loadFormatXL(disk StorageAPI) (format *formatXLV3, err error) {
	buf, err := disk.ReadAll(minioMetaBucket, formatConfigFile)
	if err != nil {
		// 'file not found' and 'volume not found' as
		// same. 'volume not found' usually means its a fresh disk.
		if err == errFileNotFound || err == errVolumeNotFound {
			var vols []VolInfo
			vols, err = disk.ListVols()
			if err != nil {
				return nil, err
			}
			if len(vols) > 1 || (len(vols) == 1 && !isIgnoreHiddenDirectories(vols[0].Name)) {
				// 'format.json' not found, but we
				// found user data.
				return nil, errCorruptedFormat
			}
			// No other data found, its a fresh disk.
			return nil, errUnformattedDisk
		}
		return nil, err
	}

	// Try to decode format json into formatConfigV1 struct.
	format = &formatXLV3{}
	if err = json.Unmarshal(buf, format); err != nil {
		return nil, err
	}

	// Success.
	return format, nil
}
1241025
func GetFormatType(format string) (isDuration, isDate bool) {
	format = skipWhiteSpace(format)
	var token string
	var succ bool
	for {
		token, format, succ = getFormatToken(format)
		if len(token) == 0 {
			break
		}
		if !succ {
			isDuration, isDate = false, false
			break
		}
		var durationTokens bool
		var dateTokens bool
		if len(token) >= 2 && token[0] == '%' {
			switch token[1] {
			case 'h', 'H', 'i', 'I', 's', 'S', 'k', 'l':
				durationTokens = true
			case 'y', 'Y', 'm', 'M', 'c', 'b', 'D', 'd', 'e':
				dateTokens = true
			}
		}
		if durationTokens {
			isDuration = true
		} else if dateTokens {
			isDate = true
		}
		if isDuration && isDate {
			break
		}
	}
	return
}
1326659
func Version() string {
	b, _ := ioutil.ReadFile("../VERSION")
	v := string(b)
	return v
}
424763
func (c *Cell) getNumberFormat() *parsedNumberFormat {
	if c.parsedNumFmt == nil || c.parsedNumFmt.numFmt != c.NumFmt {
		c.parsedNumFmt = parseFullNumberFormatString(c.NumFmt)
	}
	return c.parsedNumFmt
}
392487
func (f *File) stylesReader() *xlsxStyleSheet {
	if f.Styles == nil {
		var styleSheet xlsxStyleSheet
		_ = xml.Unmarshal(namespaceStrictToTransitional(f.readXML("xl/styles.xml")), &styleSheet)
		f.Styles = &styleSheet
	}
	return f.Styles
}
1289757
func (f *File) GetCellStyle(sheet, axis string) (int, error) {
	xlsx, err := f.workSheetReader(sheet)
	if err != nil {
		return 0, err
	}
	cellData, col, _, err := f.prepareCell(xlsx, sheet, axis)
	if err != nil {
		return 0, err
	}
	return f.prepareCellStyle(xlsx, col, cellData.S), err
}
1261551
func getVersion(mts map[int]*metricType, ver int) (*metricType, error) {
	if len(mts) == 0 {
		return nil, errMetricNotFound
	}
	if ver > 0 {
		// a version IS given
		if mt, exist := mts[ver]; exist {
			return mt, nil
		}
		return nil, errMetricNotFound
	}
	// or get the latest
	return getLatest(mts), nil
}