<commit_before>package main

import (
	"bytes"
	"encoding/json"
	"fmt"
	"github.com/martini-contrib/render"
	"html/template"
	"net/url"
	"sync"
	"time"
)

var Pipelines = template.FuncMap{
	"strftime": Strftime,
	"json":     Json,
}

func Strftime(ts int64) string {
	if ts == 0 {
		return ""
	}
	t := time.Unix(ts, 0)
	return t.Format("2006-01-02 15:04:05")
}

func Json(value interface{}) string {
	if value == nil {
		return "{}"
	}
	result, _ := json.Marshal(value)
	return string(result)
}

func BodyBytes(data map[string]interface{}) []byte {
	var buffer bytes.Buffer
	for k, v := range data {
		var item = fmt.Sprintf("%s:%v", k, v)
		buffer.WriteString(item)
	}
	return buffer.Bytes()
}

func Urlcat(host string, urls string, params map[string]interface{}) string {
	var protocol = "http"
	var u, _ = url.Parse(fmt.Sprintf("%s://%s%s", protocol, host, urls))
	var values, _ = url.ParseQuery(u.RawQuery)
	for k, v := range params {
		values.Add(k, fmt.Sprintf("%v", v))
	}
	u.RawQuery = values.Encode()
	return u.String()
}

func GenMethodSelectors(method string) []MethodSelector {
	methods := make([]MethodSelector, 5)
	methods[0] = MethodSelector{"GET", false}
	methods[1] = MethodSelector{"POST", false}
	methods[2] = MethodSelector{"PUT", false}<commit_msg>bugfix<commit_after>package main

import (
	"bytes"
	"encoding/json"
	"fmt"
	"github.com/martini-contrib/render"
	"html/template"
	"net/url"
	"sync"
	"time"
)

var Pipelines = template.FuncMap{
	"strftime": Strftime,
	"json":     Json,
}

func Strftime(ts int64) string {
	if ts == 0 {
		return ""
	}
	t := time.Unix(ts, 0)
	return t.Format("2006-01-02 15:04:05")
}

func Json(value interface{}) string {
	if value == nil {
		return "{}"
	}
	result, _ := json.Marshal(value)
	return string(result)
}

func BodyBytes(data map[string]interface{}) []byte {
	var buffer bytes.Buffer
	i := 0
	for k, v := range data {
		var item = fmt.Sprintf("%s=%v", k, v)
		buffer.WriteString(item)
		if i < len(data)-1 {
			buffer.WriteString("&")
		}
		i++
	}
	return buffer.Bytes()
}

func Urlcat(host string, urls string, params map[string]interface{}) string {
	var protocol = "http"
	var u, _ = url.Parse(fmt.Sprintf("%s://%s%s", protocol, host, urls))
	var values, _ = url.ParseQuery(u.RawQuery)
	for k, v := range params {
		values.Add(k, fmt.Sprintf("%v", v))
	}
	u.RawQuery = values.Encode()
	return u.String()
}

func GenMethodSelectors(method string) []MethodSelector {
	methods := make([]MethodSelector, 5)
	methods[0] = MethodSelector{"GET", false}
	methods[1] = MethodSelector{"POST", false}
	methods[2] = MethodSelector{"PUT", false}
{'fraction_non_alphanumeric': 0.17391304347826086, 'fraction_numerical': 0.017699115044247787, 'mean_word_length': 4.284552845528455, 'pattern_counts': {'":': 4, '<': 4, '<?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': '6359802', 'n_tokens_mistral': 1028, 'n_tokens_neox': 976, 'n_words': 230}