// Rego returns a RegoFile object loaded from the given path.
767500
func Rego(path string) (*RegoFile, error) {
	bs, err := ioutil.ReadFile(path)
	if err != nil {
		return nil, err
	}
	return loadRego(path, bs)
}
311062
func (tracker *DefaultImportTracker) PathOf(localName string) (string, bool) {
	name, ok := tracker.nameToPath[localName]
	return name, ok
}
910782
func validatePath(fs []string, requestBase string) bool {

	for _, a := range fs {
		str1 := strings.Replace(a, "**", "(.*)", -1)
		str2 := strings.Replace(a, "*", "([^/]+)", -1)
		if a != str1 {
			reg, _ := regexp.Compile(str1)
			res := reg.MatchString(requestBase)
			if res == true {
				return true
			}
		} else if a != str2 {
			reg, _ := regexp.Compile(str2)
			res := reg.MatchString(requestBase)
			if res == true {
				return true
			}
		} else if requestBase == a {
			return true
		}

		/*
		 * FIXME: SINGLE_FORWARD_SLASH_PATTERN not supported yet
		 */
	}
	/* if the i/p resource is empty, no checks need to be made */
	return len(fs) == 0
}
672545
func FuncPath(i interface{}) (pkgName string, objName string, funcName string) {
	s := FuncName(i)
	_, file := path.Split(s)
	return ParseFuncName(file)
}
540655
func splitRepository(fullRepo string) (registry string, path string) {
	parts := strings.Split(fullRepo, "/")

	if len(parts) < 2 {
		return "", parts[0]
	}

	if len(parts) == 2 {
		return "", strings.Join(parts, "/")
	}

	return parts[0], strings.Join(parts[1:], "/")
}
830653
func (ftp *FTP) Dele(path string) (err error) {
	if err = ftp.send("DELE %s", path); err != nil {
		return
	}

	var line string
	if line, err = ftp.receive(); err != nil {
		return
	}

	if !strings.HasPrefix(line, StatusActionOK) {
		return errors.New(line)
	}

	return
}
948864
func (g *Group) File(path, file string) {
	g.echo.File(g.prefix+path, file)
}
1273407
func (l *LogFile) Path() string {
	if l.idx == 0 {
		return l.path
	}
	return fmt.Sprintf("%s.%d", l.path, l.idx)
}
130060
func (clnt *Clnt) FOpen(path string, mode uint8) (*File, error) {
	fid, err := clnt.FWalk(path)
	if err != nil {
		return nil, err
	}

	err = clnt.Open(fid, mode)
	if err != nil {
		clnt.Clunk(fid)
		return nil, err
	}

	return &File{fid, 0}, nil
}
808605
func (t *Tree) File(path string) (*File, error) {
	e, err := t.FindEntry(path)
	if err != nil {
		return nil, ErrFileNotFound
	}

	blob, err := GetBlob(t.s, e.Hash)
	if err != nil {
		if err == plumbing.ErrObjectNotFound {
			return nil, ErrFileNotFound
		}
		return nil, err
	}

	return NewFile(path, e.Mode, blob), nil
}
7491
func DecodePathBytes(path []byte) []byte {
	var expression = regexp.MustCompile(`\\[0-9]{3}`)
	var buffer bytes.Buffer

	// strip quotes if any
	if len(path) > 2 && path[0] == '"' && path[len(path)-1] == '"' {
		path = path[1 : len(path)-1]
	}

	base := 0
	for _, submatches := range expression.FindAllSubmatchIndex(path, -1) {
		buffer.Write(path[base:submatches[0]])

		match := string(path[submatches[0]+1 : submatches[0]+4])

		k, err := strconv.ParseUint(match, 8, 64)
		if err != nil {
			return path
		} // abort on error

		buffer.Write([]byte{byte(k)})
		base = submatches[1]
	}

	buffer.Write(path[base:len(path)])

	return buffer.Bytes()
}
355328
func Grep(root string, pattern *regexp.Regexp) (paths []string) {
	panic(fmt.Errorf("Not Implemented"))
}
725045
func (g *Group) File(path, file string) {
	g.server.File(g.prefix+path, file)
}
240169
func (r *runtimeVerbose) pathFromGopath(path string) string {
	return filepath.Dir(path[len(r.Gopath)+len("/src/"):])
}
143202
func regexMatch(pattern, path string) bool {
	matched, e := regexp.MatchString(pattern, path)
	errorIf(probe.NewError(e).Trace(pattern), "Unable to regex match with input pattern.")
	return matched
}
158651
func sanitizePath(p string) (ret key) {
	if p == "" {
		return
	}
	ret = key(path.Clean("/" + p))
	if ret[0] == '/' {
		ret = ret[1:]
	}
	return
}
745375
func (r *Rego) PartialResult(ctx context.Context) (PartialResult, error) {
	var err error
	if r.txn == nil {
		r.txn, err = r.store.NewTransaction(ctx)
		if err != nil {
			return PartialResult{}, err
		}
		defer r.store.Abort(ctx, r.txn)
	}

	pq, err := r.PrepareForEval(ctx, WithPartialEval())
	if err != nil {
		return PartialResult{}, err
	}

	pr := PartialResult{
		compiler: pq.r.compiler,
		store:    pq.r.store,
		body:     pq.r.parsedQuery,
	}

	return pr, nil
}