<commit_before>package repository

import (
	"encoding/json"
	"io/ioutil"
)

type StateConfig struct {
	Path          string `json:"-"`
	DefaultServer string
}

func (sc *StateConfig) Load() error {
	data, err := ioutil.ReadFile(sc.Path)
	if err != nil {
		return err
	}
	err = json.Unmarshal(data, sc)
	return nil
}

func (sc *StateConfig) Save() error {
	data, err := json.MarshalIndent(sc, "", "  ")
	if err != nil {
		return err
	}
	err = ioutil.WriteFile(sc.Path, data, defaultFilePerms)
	return err
}<commit_msg>repository.StateConfig: comments<commit_after>package repository

import (
	"encoding/json"
	"io/ioutil"
)

// StateConfig is used to keep track of state information
// which has be be read and written programatically.
type StateConfig struct {
	Path          string `json:"-"`
	DefaultServer string
}

// Load attempts to load previous state config from disk.
func (sc *StateConfig) Load() error {
	data, err := ioutil.ReadFile(sc.Path)
	if err != nil {
		return err
	}
	err = json.Unmarshal(data, sc)
	return nil
}

// Save serializes the current StateConfig to disk.
func (sc *StateConfig) Save() error {
	data, err := json.MarshalIndent(sc, "", "  ")
	if err != nil {
		return err
	}
	err = ioutil.WriteFile(sc.Path, data, defaultFilePerms)
	return err
}
{'fraction_non_alphanumeric': 0.12304075235109718, 'fraction_numerical': 0.0, 'mean_word_length': 3.6776556776556775, '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': '1276921', 'n_tokens_mistral': 442, 'n_tokens_neox': 434, 'n_words': 134}