<commit_before>package eneru

import (
	"encoding/json"
	"github.com/plimble/utils/strings2"
	"net/http"
	"strings"
)

func buildUrl(url, path string, query *Query) string {
	if query == nil {
		return string2.ConcatBase(url, path)
	}

	return string2.ConcatBase(url, path, query.String())
}

func addTailingSlash(url string) string {
	if !strings.HasSuffix(url, "/") {
		return string2.ConcatBase(url, "/")
	}

	return url
}

func decodeResp(resp *http.Response, v interface{}) error {
	defer resp.Body.Close()
	return json.NewDecoder(resp.Body).Decode(v)
}

func encodeResp(w http.ResponseWriter, v interface{}) {
	json.NewEncoder(w).Encode(v)
}

func buildPathIndexType(index, ty string) string {
	switch {
	case index != "" && ty == "" && action == "":
		return string2.Concat(index)
	case index != "" && ty != "" && action == "":
		return string2.Concat(index, "/", ty)
	}

	return string2.Concat(index, "/", ty)
}

func buildPathIndexTypeAction(index, ty, action string) string {
	switch {
	case index == "" && ty == "" && action != "":
		return action
	case index != "" && ty == "" && action != "":
		return string2.Concat(index, "/", action)
	}

	return string2.Concat(index, "/", ty, "/", action)
}<commit_msg>fix buildPathIndexType no action variable<commit_after>package eneru

import (
	"encoding/json"
	"github.com/plimble/utils/strings2"
	"net/http"
	"strings"
)

func buildUrl(url, path string, query *Query) string {
	if query == nil {
		return string2.ConcatBase(url, path)
	}

	return string2.ConcatBase(url, path, query.String())
}

func addTailingSlash(url string) string {
	if !strings.HasSuffix(url, "/") {
		return string2.ConcatBase(url, "/")
	}

	return url
}

func decodeResp(resp *http.Response, v interface{}) error {
	defer resp.Body.Close()
	return json.NewDecoder(resp.Body).Decode(v)
}

func encodeResp(w http.ResponseWriter, v interface{}) {
	json.NewEncoder(w).Encode(v)
}

func buildPathIndexType(index, ty string) string {
	switch {
	case index != "" && ty == "":
		return string2.Concat(index)
	case index != "" && ty != "":
		return string2.Concat(index, "/", ty)
	}

	return string2.Concat(index, "/", ty)
}

func buildPathIndexTypeAction(index, ty, action string) string {
	switch {
	case index == "" && ty == "" && action != "":
		return action
	case index != "" && ty == "" && action != "":
		return string2.Concat(index, "/", action)
	}

	return string2.Concat(index, "/", ty, "/", action)
}
{'fraction_non_alphanumeric': 0.17584223500410848, 'fraction_numerical': 0.007395234182415777, 'mean_word_length': 4.214132762312634, 'pattern_counts': {'":': 8, '<': 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': '3532652', 'n_tokens_mistral': 884, 'n_tokens_neox': 858, 'n_words': 194}