<commit_before>package main

import (
	"encoding/json"
	"io/ioutil"
	"log"
	"net/http"
	"os"
)

type Leaderboard struct {
	Rows []LeaderboardEntry
}

type LeaderboardEntry struct {
	Name string
	Ranking int
	Rating int
	RealmId int
	RealmName string
	RealmSlug string
	RaceId int
	ClassId int
	SpecId int
	FactionId int
	GenderId int
	SeasonWins int
	SeasonLosses int
	WeeklyWins int
	WeeklyLosses int
}

var logger *log.Logger = log.New(os.Stdout, "main|", log.Ltime|log.Lmicroseconds)
const errPrefix string = "[ERROR]"

var uriBase string = "https://us.battle.net/api/wow/"

func main() {
	logger.Println("PvPLeaderBoard Starting")
	if len(os.Args) > 1 {
		uriBase = os.Args[1]
	}
	logger.Printf("WoW API URIs using '%s'", uriBase)
	getLeaderboard("2v2")
	logger.Println("PvPLeaderBoard Complete")
}

func get(path string) *string {
	resp, err := http.Get(uriBase + path)

	if err != nil {
		logger.Printf("%s GET failed: %s", errPrefix, err)
		return nil
	}
	if resp.StatusCode != 200 {
		logger.Printf("%s non-200 status code: %s", errPrefix, err)
		return nil
	}

	body, err := ioutil.ReadAll(resp.Body)
	defer resp.Body.Close()
	if err != nil {
		logger.Printf("%s reading body failed: %s", errPrefix, err)
		return nil
	}

	logger.Printf("%s returned %v bytes", path, len(body))
	str := string(body[:])
	return &str
}

func parseLeaderboard(data *string) []LeaderboardEntry {
	var leaderboard Leaderboard
	err := json.Unmarshal([]byte(*data), &leaderboard)
	if err != nil {
		logger.Printf("%s json parsing failed: %s", errPrefix, err)
		return make([]LeaderboardEntry, 0)
	}
	return leaderboard.Rows
}

func getLeaderboard(bracket string) {
	var leaderboardJson *string = get("leaderboard/" + bracket)
	var entries []LeaderboardEntry = parseLeaderboard(leaderboardJson)
	logger.Printf("Parsed %v %s entries", len(entries), bracket)
}<commit_msg>keep response body as byte array<commit_after>package main

import (
	"encoding/json"
	"io/ioutil"
	"log"
	"net/http"
	"os"
)

type Leaderboard struct {
	Rows []LeaderboardEntry
}

type LeaderboardEntry struct {
	Name string
	Ranking int
	Rating int
	RealmId int
	RealmName string
	RealmSlug string
	RaceId int
	ClassId int
	SpecId int
	FactionId int
	GenderId int
	SeasonWins int
	SeasonLosses int
	WeeklyWins int
	WeeklyLosses int
}

var logger *log.Logger = log.New(os.Stdout, "main|", log.Ltime|log.Lmicroseconds)
const errPrefix string = "[ERROR]"

var uriBase string = "https://us.battle.net/api/wow/"

func main() {
	logger.Println("PvPLeaderBoard Starting")
	if len(os.Args) > 1 {
		uriBase = os.Args[1]
	}
	logger.Printf("WoW API URIs using '%s'", uriBase)
	getLeaderboard("2v2")
	logger.Println("PvPLeaderBoard Complete")
}

func get(path string) *[]byte {
	resp, err := http.Get(uriBase + path)

	if err != nil {
		logger.Printf("%s GET failed: %s", errPrefix, err)
		return nil
	}
	if resp.StatusCode != 200 {
		logger.Printf("%s non-200 status code: %s", errPrefix, err)
		return nil
	}

	body, err := ioutil.ReadAll(resp.Body)
	defer resp.Body.Close()
	if err != nil {
		logger.Printf("%s reading body failed: %s", errPrefix, err)
		return nil
	}

	logger.Printf("%s returned %v bytes", path, len(body))
	return &body
}

func parseLeaderboard(data *[]byte) []LeaderboardEntry {
	var leaderboard Leaderboard
	err := json.Unmarshal(*data, &leaderboard)
	if err != nil {
		logger.Printf("%s json parsing failed: %s", errPrefix, err)
		return make([]LeaderboardEntry, 0)
	}
	return leaderboard.Rows
}

func getLeaderboard(bracket string) {
	var leaderboardJson *[]byte = get("leaderboard/" + bracket)
	var entries []LeaderboardEntry = parseLeaderboard(leaderboardJson)
	logger.Printf("Parsed %v %s entries", len(entries), bracket)
}
{'fraction_non_alphanumeric': 0.1312229437229437, 'fraction_numerical': 0.005952380952380952, 'mean_word_length': 4.551051051051051, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 2, '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': '148178', 'n_tokens_mistral': 1406, 'n_tokens_neox': 1350, 'n_words': 361}