// GetAttributePaths returns a list of entries in .gitattributes which are
// configured with the filter=lfs attribute
// workingDir is the root of the working copy
// gitDir is the root of the git repo
10136
func GetAttributePaths(mp *gitattr.MacroProcessor, workingDir, gitDir string) []AttributePath {
	paths := make([]AttributePath, 0)

	for _, file := range findAttributeFiles(workingDir, gitDir) {
		paths = append(paths, attrPaths(mp, file.path, workingDir, file.readMacros)...)
	}

	return paths
}
637691
func getAttributesFromCert(cert *x509.Certificate) ([]byte, error) {
	for _, ext := range cert.Extensions {
		if isAttrOID(ext.Id) {
			return ext.Value, nil
		}
	}
	return nil, nil
}
497321
func ExtractRootPaths(paths []string) []string {
	r := make([]string, len(paths))
	for i, p := range paths {
		root := filepath.ToSlash(p)
		sections := strings.Split(root, "/")
		for _, section := range sections {
			if section != "" {
				root = section
				break
			}
		}
		r[i] = root
	}
	return r

}
709339
func getAbsolutePath(p string) (string, error) {
	root, err := git.RootDir()
	if err != nil {
		return "", err
	}

	return filepath.Join(root, p), nil
}
546512
func GetAttributeNames(attributes map[string]types.Attribute) []string {
	var out []string
	for _, attr := range attributes {
		out = append(out, attr.Name)
	}
	return out
}
635375
func ParseCSVGetAttributes(filepath string, hasHeaders bool) []Attribute {
	f, err := os.Open(filepath)
	if err != nil {
		panic(err)
	}
	defer f.Close()

	return ParseCSVGetAttributesFromReader(f, hasHeaders)
}
1164887
func (o *SAMLConnectorV2) MapAttributes(assertionInfo saml2.AssertionInfo) []string {
	var roles []string
	for _, mapping := range o.Spec.AttributesToRoles {
		for _, attr := range assertionInfo.Values {
			if attr.Name != mapping.Name {
				continue
			}
		mappingLoop:
			for _, value := range attr.Values {
				for _, role := range mapping.Roles {
					outRole, err := utils.ReplaceRegexp(mapping.Value, role, value.Value)
					switch {
					case err != nil:
						if !trace.IsNotFound(err) {
							log.Debugf("Failed to match expression %v, replace with: %v input: %v, err: %v", mapping.Value, role, value.Value, err)
						}
						// if value input did not match, no need to apply
						// to all roles
						continue mappingLoop
					case outRole == "":
						// skip empty role matches
					case outRole != "":
						roles = append(roles, outRole)
					}
				}
			}
		}
	}
	return utils.Deduplicate(roles)
}
1023820
func ValidateAbsolutePath(path string, fldPath *field.Path) field.ErrorList {
	allErrs := field.ErrorList{}
	if !filepath.IsAbs(path) {
		allErrs = append(allErrs, field.Invalid(fldPath, path, "path is not absolute"))
	}
	return allErrs
}
968920
func (c *ChiMergeFilter) GetAttributesAfterFiltering() []base.FilteredAttribute {
	oldAttrs := c.train.AllAttributes()
	ret := make([]base.FilteredAttribute, len(oldAttrs))
	for i, a := range oldAttrs {
		if c.attrs[a] {
			retAttr := new(base.CategoricalAttribute)
			retAttr.SetName(a.GetName())
			for _, k := range c.tables[a] {
				retAttr.GetSysValFromString(fmt.Sprintf("%f", k.Value))
			}
			ret[i] = base.FilteredAttribute{a, retAttr}
		} else {
			ret[i] = base.FilteredAttribute{a, a}
		}
	}
	return ret
}
964709
func (v *InstancesView) GetAttribute(a Attribute) (AttributeSpec, error) {
	if a == nil {
		return AttributeSpec{}, fmt.Errorf("Attribute can't be nil")
	}
	// Pass-through on nil
	if v.attrs == nil {
		return v.src.GetAttribute(a)
	}
	// Otherwise
	for _, r := range v.attrs {
		// If the attribute matches...
		if r.GetAttribute().Equals(a) {
			return r, nil
		}
	}
	return AttributeSpec{}, fmt.Errorf("Requested Attribute has been filtered")
}
1164720
func (fs *errorFS) GetInodeAttributes(
	ctx context.Context,
	op *fuseops.GetInodeAttributesOp) (err error) {
	if fs.transformError(op, &err) {
		return
	}

	// Figure out which inode the request is for.
	switch {
	case op.Inode == fuseops.RootInodeID:
		op.Attributes = fuseops.InodeAttributes{
			Mode: os.ModeDir | 0777,
		}

	case op.Inode == fooInodeID:
		op.Attributes = fooAttrs

	default:
		err = fmt.Errorf("Unknown inode: %d", op.Inode)
		return
	}

	return
}
19797
func (r *Repository) GetContributorsURL() string {
	if r == nil || r.ContributorsURL == nil {
		return ""
	}
	return *r.ContributorsURL
}
52967
func (m *Mount) GetParentPaths() ([]string, error) {
	var parentLayerPaths []string
	for _, option := range m.Options {
		if strings.HasPrefix(option, ParentLayerPathsFlag) {
			err := json.Unmarshal([]byte(option[len(ParentLayerPathsFlag):]), &parentLayerPaths)
			if err != nil {
				return nil, errors.Wrap(err, "failed to unmarshal parent layer paths from mount")
			}
		}
	}
	return parentLayerPaths, nil
}
1224145
func (r *Request) Attributes() *FileStat {
	fs, _ := getFileStat(r.Flags, r.Attrs)
	return fs
}
1160922
func ListProjectPaths(projectDir string, include, exclude matcher.Matcher) ([]string, error) {
	wd, err := os.Getwd()
	if err != nil {
		return nil, errors.Wrapf(err, "failed to determine working directory")
	}
	if !filepath.IsAbs(projectDir) {
		projectDir = path.Join(wd, projectDir)
	}
	relPathPrefix, err := filepath.Rel(wd, projectDir)
	if err != nil {
		return nil, errors.Wrapf(err, "failed to determine relative path")
	}

	files, err := matcher.ListFiles(projectDir, include, exclude)
	if err != nil {
		return nil, err
	}
	if relPathPrefix != "" {
		for i, file := range files {
			files[i] = path.Join(relPathPrefix, file)
		}
	}
	return files, nil
}
853329
func (s Slice) Get(attributePath ...string) (Slice, error) {
	result := s
	parent := s
	for _, a := range attributePath {
		var err error
		result, err = parent.get(a)
		if err != nil {
			return nil, WithStack(err)
		}
		if result.IsNone() {
			return result, nil
		}
		parent = result
	}
	return result, nil
}
255775
func ParseARFFGetAttributes(filepath string) []Attribute {
	var ret []Attribute

	f, err := os.Open(filepath)
	if err != nil {
		panic(err)
	}
	defer f.Close()

	scanner := bufio.NewScanner(f)
	for scanner.Scan() {
		var attr Attribute
		line := scanner.Text()
		if len(line) == 0 {
			continue
		}
		if line[0] != '@' {
			continue
		}
		fields := strings.Fields(line)
		if len(fields) < 3 {
			continue
		}
		fields[0] = strings.ToLower(fields[0])
		attrType := strings.ToLower(fields[2])
		if fields[0] != "@attribute" {
			continue
		}
		switch attrType {
		case "real":
			attr = new(FloatAttribute)
			break
		default:
			if fields[2][0] == '{' {
				if strings.HasSuffix(fields[len(fields)-1], "}") {
					var cats []string
					if len(fields) > 3 {
						cats = fields[2:len(fields)]
					} else {
						cats = strings.Split(fields[2], ",")
					}
					if len(cats) == 0 {
						panic(fmt.Errorf("Empty categorical field on line '%s'", line))
					}
					cats[0] = cats[0][1:]                                            // Remove leading '{'
					cats[len(cats)-1] = cats[len(cats)-1][:len(cats[len(cats)-1])-1] // Remove trailing '}'
					for i, v := range cats {                                         // Miaow
						cats[i] = strings.TrimSpace(v)
						if strings.HasSuffix(cats[i], ",") {
							// Strip end comma
							cats[i] = cats[i][0 : len(cats[i])-1]
						}
					}
					attr = NewCategoricalAttribute()
					for _, v := range cats {
						attr.GetSysValFromString(v)
					}
				} else {
					panic(fmt.Errorf("Missing categorical bracket on line '%s'", line))
				}
			} else {
				panic(fmt.Errorf("Unsupported Attribute type %s on line '%s'", fields[2], line))
			}
		}

		if attr == nil {
			panic(fmt.Errorf(line))
		}
		attr.SetName(fields[1])
		ret = append(ret, attr)
	}

	maxPrecision, err := ParseCSVEstimateFilePrecision(filepath)
	if err != nil {
		panic(err)
	}
	for _, a := range ret {
		if f, ok := a.(*FloatAttribute); ok {
			f.Precision = maxPrecision
		}
	}
	return ret
}