<commit_before>// Copyright 2016 Keybase Inc. All rights reserved.
// Use of this source code is governed by a BSD
// license that can be found in the LICENSE file.

package libkbfs

import (
	"fmt"
	"strings"

	"github.com/keybase/kbfs/tlf"
)

// PathType describes the types for different paths
type PathType string

const (
	// KeybasePathType is the keybase root (like /keybase)
	KeybasePathType PathType = "keybase"
	// PublicPathType is the keybase public folder list (like /keybase/public)
	PublicPathType PathType = "public"
	// PrivatePathType is the keybase private folder list (like
	// /keybase/private)
	PrivatePathType PathType = "private"
	// SingleTeamPathType is the keybase team folder list (like /keybase/teams)
	SingleTeamPathType PathType = "teams"
)

// BuildCanonicalPath returns a canonical path for a path components.
// This a canonical path and may need to be converted to a platform
// specific path, for example, on Windows, this might correspond to
// k:\private\username.
func BuildCanonicalPath(pathType PathType, paths ...string) string {
	var prefix string
	switch pathType {
	case KeybasePathType:
		prefix = "/" + string(KeybasePathType)
	case PublicPathType:
		prefix = "/" + string(KeybasePathType) + "/" + string(PublicPathType)
	case PrivatePathType:
		prefix = "/" + string(KeybasePathType) + "/" + string(PrivatePathType)
	}
	pathElements := []string{prefix}
	for _, p := range paths {
		if p != "" {
			pathElements = append(pathElements, p)
		}
	}
	return strings.Join(pathElements, "/")
}<commit_msg>path: BuildCanonicalPath should work for single teams<commit_after>// Copyright 2016 Keybase Inc. All rights reserved.
// Use of this source code is governed by a BSD
// license that can be found in the LICENSE file.

package libkbfs

import (
	"fmt"
	"strings"

	"github.com/keybase/kbfs/tlf"
)

// PathType describes the types for different paths
type PathType string

const (
	// KeybasePathType is the keybase root (like /keybase)
	KeybasePathType PathType = "keybase"
	// PublicPathType is the keybase public folder list (like /keybase/public)
	PublicPathType PathType = "public"
	// PrivatePathType is the keybase private folder list (like
	// /keybase/private)
	PrivatePathType PathType = "private"
	// SingleTeamPathType is the keybase team folder list (like /keybase/teams)
	SingleTeamPathType PathType = "teams"
)

// BuildCanonicalPath returns a canonical path for a path components.
// This a canonical path and may need to be converted to a platform
// specific path, for example, on Windows, this might correspond to
// k:\private\username.
func BuildCanonicalPath(pathType PathType, paths ...string) string {
	var prefix string
	switch pathType {
	case KeybasePathType:
		prefix = "/" + string(KeybasePathType)
	default:
		prefix = "/" + string(KeybasePathType) + "/" + string(pathType)
	}
	pathElements := []string{prefix}
	for _, p := range paths {
		if p != "" {
			pathElements = append(pathElements, p)
		}
	}
	return strings.Join(pathElements, "/")
}
{'fraction_non_alphanumeric': 0.09946949602122016, 'fraction_numerical': 0.002652519893899204, 'mean_word_length': 4.028333333333333, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5747605', 'n_tokens_mistral': 933, 'n_tokens_neox': 908, 'n_words': 322}