<commit_before>package welove

import (
	"io"
	"os"
	"hash"
	"crypto/hmac"
	"crypto/sha1"
	"net/url"
	"encoding/base64"
)

type CustomOutput struct {
	out []io.Writer
}

func New(out ...io.Writer) CustomOutput {
	return CustomOutput{out}
}

func (c *CustomOutput) Add(out io.Writer) {
	c.out = append(c.out, out)
}

func (c *CustomOutput) Write(p []byte) (int, error) {
	var n int = 0
	var err error = nil
	for _, v := range c.out {
		n, err = v.Write(p)
	}
	return n, err
}

func DefaultLog(path string) CustomOutput {
	var file, _ = os.OpenFile(path, os.O_APPEND | os.O_CREATE, os.ModeAppend)
	return New(os.Stdout, file)
}

type Sig struct {
	key   []byte
	myMac hash.Hash
}

func NewSig(key []byte) *Sig {
	mac := hmac.New(sha1.New, key)
	love := new(Sig)
	love.myMac = mac
	return love
}

func (l *Sig)Encode(method, u string, data ...Data) string {
	var content string
	for _, v := range data {
		content = content + v.key + "=" + v.value + "&"
	}
	content = content[0:len(content) - 1]
	l.myMac.Write([]byte(method + "&" + url.QueryEscape(u) + "&" + url.QueryEscape(content)))
	return base64.StdEncoding.EncodeToString(l.myMac.Sum(nil))
}

type Data struct {
	key   string<commit_msg>日志文件读写权限<commit_after>package welove

import (
	"io"
	"os"
	"hash"
	"crypto/hmac"
	"crypto/sha1"
	"net/url"
	"encoding/base64"
)

type CustomOutput struct {
	out []io.Writer
}

func New(out ...io.Writer) CustomOutput {
	return CustomOutput{out}
}

func (c *CustomOutput) Add(out io.Writer) {
	c.out = append(c.out, out)
}

func (c *CustomOutput) Write(p []byte) (int, error) {
	var n int = 0
	var err error = nil
	for _, v := range c.out {
		n, err = v.Write(p)
	}
	return n, err
}

func DefaultLog(path string) CustomOutput {
	var file, _ = os.OpenFile(path, os.O_APPEND | os.O_CREATE | os.O_RDWR, os.ModeAppend)
	return New(os.Stdout, file)
}

type Sig struct {
	key   []byte
	myMac hash.Hash
}

func NewSig(key []byte) *Sig {
	mac := hmac.New(sha1.New, key)
	love := new(Sig)
	love.myMac = mac
	return love
}

func (l *Sig)Encode(method, u string, data ...Data) string {
	var content string
	for _, v := range data {
		content = content + v.key + "=" + v.value + "&"
	}
	content = content[0:len(content) - 1]
	l.myMac.Write([]byte(method + "&" + url.QueryEscape(u) + "&" + url.QueryEscape(content)))
	return base64.StdEncoding.EncodeToString(l.myMac.Sum(nil))
}

type Data struct {
	key   string
{'fraction_non_alphanumeric': 0.16157388028463793, 'fraction_numerical': 0.007534533277521975, 'mean_word_length': 3.649805447470817, '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': '6367052', 'n_tokens_mistral': 987, 'n_tokens_neox': 977, 'n_words': 238}