// NewPath takes a Unicode string representing an OGDL path, parses it and
// returns it as a Graph object.
//
// It also parses extended paths, as those used in templates, which may have
// argument lists.
506685
func NewPath(s string) *Graph {
	p := NewParser(bytes.NewBuffer([]byte(s)))
	p.Path()
	g := p.Graph()
	g.This = TypePath
	return g
}
10213
func (u *OfferURL) Path() string {
	var parts []string
	if u.User != "" {
		parts = append(parts, u.User)
	}
	if u.ModelName != "" {
		parts = append(parts, u.ModelName)
	}
	path := strings.Join(parts, "/")
	path = fmt.Sprintf("%s.%s", path, u.ApplicationName)
	if u.Source == "" {
		return path
	}
	return fmt.Sprintf("%s:%s", u.Source, path)
}
817569
func CommonPath(path1, path2 string) string {
	parts1 := strings.Split(path1, "/")
	parts2 := strings.Split(path2, "/")
	maxIdx := len(parts1)
	if len(parts2) < maxIdx {
		maxIdx = len(parts2)
	}

	common := make([]string, 0, maxIdx)
	for i := 0; i < maxIdx; i++ {
		if parts1[i] == parts2[i] {
			common = append(common, parts1[i])
		}
	}

	return strings.Join(common, "/")
}
461321
func (s *UpdateGroupInput) SetNewPath(v string) *UpdateGroupInput {
	s.NewPath = &v
	return s
}
509877
func NewWithWalk(paths ...string) i18n.Backend {
	backend := &Backend{}

	var files []string
	for _, p := range paths {
		filepath.Walk(p, func(path string, fileInfo os.FileInfo, err error) error {
			if isYamlFile(fileInfo) {
				files = append(files, path)
			}
			return nil
		})
	}
	for _, file := range files {
		if content, err := ioutil.ReadFile(file); err == nil {
			backend.contents = append(backend.contents, content)
		}
	}

	return backend
}
298116
func NewPathFromXYSlice(data [][]float64) *Path {
	p := NewPathPreallocate(0, len(data))

	for i := range data {
		if data[i] != nil && len(data[i]) >= 2 {
			p.PointSet = append(p.PointSet, Point{data[i][0], data[i][1]})
		}
	}

	return p
}
1290879
func (b *Bogus) AddPath(path string) *paths.Path {
	if _, ok := b.paths[path]; !ok {
		b.paths[path] = paths.New()
	}

	return b.paths[path]
}
1054166
func (s *UpdateUserInput) SetNewPath(v string) *UpdateUserInput {
	s.NewPath = &v
	return s
}
665325
func (ut *URLTransformer) LoadPath(path string) error {
	path = ut.rxStripQuery.ReplaceAllString(path, "")
	i1 := strings.Index(path, "{")
	i2 := strings.Index(path, "}")
	if i1 < 0 && i2 < 0 {
		ut.ExactPaths = append(ut.ExactPaths, path)
		return nil
	}
	linkPattern := ut.rxMatchPattern.ReplaceAllString(path, rxMatchParameterActual)
	linkPattern = `^` + linkPattern + `$`
	rx, err := regexp.Compile(linkPattern)
	if err != nil {
		return err
	}
	ut.RegexpPaths[path] = rx
	return nil
}
164764
func New(basePath string) (*bytes.Buffer, error) {
	fi, err := os.Stat(basePath)
	if err != nil {
		return nil, err
	}
	if !fi.IsDir() {
		return nil, fmt.Errorf("path %q is not a directory, which is required for a Firefox profile", basePath)
	}

	buf := new(bytes.Buffer)
	w := zip.NewWriter(buf)
	err = filepath.Walk(basePath, func(filePath string, info os.FileInfo, err error) error {
		if err != nil {
			return err
		}
		if !info.Mode().IsRegular() {
			return nil
		}

		zipFI, err := zip.FileInfoHeader(info)
		if err != nil {
			return err
		}

		// Strip the prefix from the filename (and the trailing directory
		// separator) so that the files are at the root of the zip file.
		zipFI.Name = filePath[len(basePath)+1:]

		// Without this, the Java zip reader throws a java.util.zip.ZipException:
		// "only DEFLATED entries can have EXT descriptor".
		zipFI.Method = zip.Deflate

		w, err := w.CreateHeader(zipFI)
		if err != nil {
			return err
		}

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

		_, err = io.Copy(w, bufio.NewReader(f))
		return err
	})
	if err != nil {
		return nil, err
	}
	if err := w.Close(); err != nil {
		return nil, err
	}
	return buf, nil
}
772944
func (d Datastore) NewURL(path string) *url.URL {
	u := d.c.URL()

	return &url.URL{
		Scheme: u.Scheme,
		Host:   u.Host,
		Path:   fmt.Sprintf("/folder/%s", path),
		RawQuery: url.Values{
			"dcPath": []string{d.DatacenterPath},
			"dsName": []string{d.Name()},
		}.Encode(),
	}
}
534909
func GoPath() string {
	if path := os.Getenv("GOPATH"); path != "" {
		return path
	}
	// https://github.com/golang/go/issues/17262
	return filepath.Join(os.Getenv("HOME"), "go")
}
874539
func newView(path, index, field, name string, fieldOptions FieldOptions) *view {
	return &view{
		path:  path,
		index: index,
		field: field,
		name:  name,

		fieldType: fieldOptions.Type,
		cacheType: fieldOptions.CacheType,
		cacheSize: fieldOptions.CacheSize,

		fragments: make(map[uint64]*fragment),

		broadcaster: NopBroadcaster,
		stats:       stats.NopStatsClient,
		logger:      logger.NopLogger,
	}
}
436487
func (d *Decoder) Path() JsonPath {
	p := make(JsonPath, len(d.path))
	copy(p, d.path)
	return p
}
688630
func NewPathForRef(ref ast.Ref) (path Path, err error) {

	if len(ref) == 0 {
		return nil, fmt.Errorf("empty reference (indicates error in caller)")
	}

	if len(ref) == 1 {
		return Path{}, nil
	}

	for _, term := range ref[1:] {
		switch v := term.Value.(type) {
		case ast.String:
			path = append(path, string(v))
		case ast.Number:
			path = append(path, v.String())
		case ast.Boolean, ast.Null:
			return nil, &Error{
				Code:    NotFoundErr,
				Message: fmt.Sprintf("%v: does not exist", ref),
			}
		case ast.Array, ast.Object, ast.Set:
			return nil, fmt.Errorf("composites cannot be base document keys: %v", ref)
		default:
			return nil, fmt.Errorf("unresolved reference (indicates error in caller): %v", ref)
		}
	}

	return path, nil
}
207822
func (s *UpdateServerCertificateInput) SetNewPath(v string) *UpdateServerCertificateInput {
	s.NewPath = &v
	return s
}
625581
func New(name string) *JSONPath {
	return &JSONPath{
		name:       name,
		beginRange: 0,
		inRange:    0,
		endRange:   0,
	}
}