<commit_before>package blog

import (
	"github.com/crockeo/personalwebsite/config"
	"io/ioutil"
	"strings"
)

type Auth struct {
	Username string
	Password string
}

// Loading an Auth from a file
func LoadAuth(path string) (*Auth, error) {
	val, err := ioutil.ReadFile(path)

	if err != nil {
		return nil, err
	}

	vals := strings.Split(string(val), "\n")

	if len(vals) != 2 {
		return nil, nil
	} else {
		auth := new(Auth)

		auth.Username = vals[0]
		auth.Password = vals[1]

		return auth, nil
	}
}

// Loading the default Auth
func LoadDefaultAuth() (*Auth, error) {
	return LoadAuth(config.AuthLoc)
}

// Checking if two Auths are equal
func (auth *Auth) Equal(auth2 *Auth) bool {
	return auth.Username == auth2.Username &&
		auth.Password == <PASSWORD>
}

// Converting an Auth to a string
func (auth *Auth) String() string {
	return auth.Username + "\n" + auth.Password
}
<commit_msg>Changed the way auths are saved.<commit_after>package blog

import (
	"github.com/crockeo/personalwebsite/config"
	"io/ioutil"
	"strings"
)

type Auth struct {
	Username string
	Password string
}

// Creating a new Auth
func NewAuth(username string, password string) *Auth {
	auth := new(Auth)

	auth.Username = username
	auth.Password = password

	return auth
}

// Loading an Auth from a file
func LoadAuth(path string) (*Auth, error) {
	val, err := ioutil.ReadFile(path)

	if err != nil {
		return nil, err
	}

	val = val[0 : len(val)-1]
	vals := strings.Split(string(val), "|")

	if len(vals) != 2 {
		return nil, nil
	} else {
		return NewAuth(vals[0], vals[1]), nil
	}
}

// Loading the default Auth
func LoadDefaultAuth() (*Auth, error) {
	return LoadAuth(config.AuthLoc)
}

// Checking if two Auths are equal
func (auth *Auth) Equal(auth2 *Auth) bool {
	return auth.Username == auth2.Username &&
		auth.Password == <PASSWORD>
}

// Converting an Auth to a string
func (auth *Auth) String() string {
	return auth.Username + "|" + auth.Password
}

{'fraction_non_alphanumeric': 0.13501026694045173, 'fraction_numerical': 0.006160164271047228, 'mean_word_length': 3.6963855421686747, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '4386110', 'n_tokens_mistral': 714, 'n_tokens_neox': 679, 'n_words': 207}