<commit_before>package uploadthis

import (
	"launchpad.net/goamz/aws"
	"launchpad.net/goamz/s3"
)

var s3Conn *s3.S3

func GetS3() *s3.S3 {
	if s3Conn == nil {
		auth := aws.Auth{Settings.Auth.AccessKey, Settings.Auth.SecretKey}
		s3Conn = s3.New(auth, aws.USEast)
	}
	return s3Conn
}

func UploadBuffer(bucket string, path string, data []byte) {
	s := GetS3()
        b := s.Bucket(bucket)
        b.Put(path, data, "content-type", s3.Private)
}

func DownloadBuffer(bucket string, path string) []byte {
	s := GetS3()
        b := s.Bucket(bucket)
	data, err := b.Get(path)
        if err != nil {
                return []byte{}
        } else {
                return data
        }
	return []byte{}
}<commit_msg>fixed merge issues with interim commit<commit_after>package uploadthis

import (
	"launchpad.net/goamz/aws"
	"launchpad.net/goamz/s3"
	"log"
)

type S3Mocker interface {
	Bucket(name string) BucketMocker
}
type BucketMocker interface {
	Name string
	Get(path string) (data []byte, err error)
	Put(path string, data []byte, contType string, perm ACL) error
}

var s3Conn *s3.S3

var GetS3 = func() *s3.S3 {
	if s3Conn == nil {
		auth := aws.Auth{Settings.Auth.AccessKey, Settings.Auth.SecretKey}
		s3Conn = s3.New(auth, aws.USEast)
	}
	return s3Conn
}

func UploadBuffer(bucket string, path string, data []byte) {
	s := GetS3()
	b := s.Bucket(bucket)
	err := b.Put(path, data, "content-type", s3.Private)
	if err != nil {
		log.Panic(err)
	}
}

func DownloadBuffer(bucket string, path string) []byte {
	s := GetS3()
	b := s.Bucket(bucket)
	data, err := b.Get(path)
	if err != nil {
		log.Panic(err)
		return []byte{}
	} else {
		return data
	}
	return []byte{}
}
{'fraction_non_alphanumeric': 0.1471990464839094, 'fraction_numerical': 0.01728247914183552, 'mean_word_length': 3.250632911392405, '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': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '266414', 'n_tokens_mistral': 665, 'n_tokens_neox': 647, 'n_words': 159}