<commit_before>package amazonec2

import (
	"errors"

	"github.com/aws/aws-sdk-go/aws/credentials"
	"github.com/aws/aws-sdk-go/service/ec2"

	"github.com/stretchr/testify/mock"
)

type fakeEC2 struct {
	*ec2.EC2
}

type errorProvider struct{}

func (p *errorProvider) Retrieve() (credentials.Value, error) {
	return credentials.Value{}, errors.New("bad credentials")
}

func (p *errorProvider) IsExpired() bool {
	return true
}

type okProvider struct {
	accessKeyID     string
	secretAccessKey string
	sessionToken    string
}

func (p *okProvider) Retrieve() (credentials.Value, error) {
	return credentials.Value{
		AccessKeyID:     p.accessKeyID,
		SecretAccessKey: p.secretAccessKey,
		SessionToken:    p.sessionToken,
	}, nil
}

func (p *okProvider) IsExpired() bool {
	return true
}

type fallbackCredentials struct{}

func (c *fallbackCredentials) Credentials() *credentials.Credentials {
	return credentials.NewStaticCredentials("fallback_access", "fallback_secret", "fallback_token")
}

func NewValidAwsCredentials() awsCredentials {
	return &fallbackCredentials{}
}

type errorFallbackCredentials struct{}

func (c *errorFallbackCredentials) Credentials() *credentials.Credentials {
	return credentials.NewCredentials(&errorProvider{})
}

func NewErrorAwsCredentials() awsCredentials {
	return &errorFallbackCredentials{}
}

//type testFileCredentialsProvider struct {
//	fileProvider credentials.Provider
//	staticError  bool
//}
//
//func NewTestFileCredentialsProvider(id, secret, token string) *testFileCredentialsProvider {
//	return &testFileCredentialsProvider{
//		fileProvider: &okProvider{id, secret, token},
//		staticError:  false,
//	}
//}
//
//func NewTestFileCredentialsProviderWithStaticError(id, secret, token string) *testFileCredentialsProvider {
//	return &testFileCredentialsProvider{
//		fileProvider: &okProvider{id, secret, token},
//		staticError:  true,
//	}
//}
//
//func (c *testFileCredentialsProvider) NewStaticProvider(id, secret, token string) credentials.Provider {
//	if c.staticError {
//		return &errorProvider{}
//	} else {
//		return &okProvider{id, secret, token}
//	}
//}
//
//func (c *testFileCredentialsProvider) NewSharedProvider(filename, profile string) credentials.Provider {
//	return c.fileProvider
//}

type errorCredentialsProvider struct{}

func (c *errorCredentialsProvider) NewStaticProvider(id, secret, token string) credentials.Provider {
	return &errorProvider{}
}

type fakeEC2WithDescribe struct {
	*fakeEC2
	output *ec2.DescribeAccountAttributesOutput
	err    error
}

func (f *fakeEC2WithDescribe) DescribeAccountAttributes(input *ec2.DescribeAccountAttributesInput) (*ec2.DescribeAccountAttributesOutput, error) {<commit_msg>Removed test code that had been commented out.<commit_after>package amazonec2

import (
	"errors"

	"github.com/aws/aws-sdk-go/aws/credentials"
	"github.com/aws/aws-sdk-go/service/ec2"

	"github.com/stretchr/testify/mock"
)

type fakeEC2 struct {
	*ec2.EC2
}

type errorProvider struct{}

func (p *errorProvider) Retrieve() (credentials.Value, error) {
	return credentials.Value{}, errors.New("bad credentials")
}

func (p *errorProvider) IsExpired() bool {
	return true
}

type okProvider struct {
	accessKeyID     string
	secretAccessKey string
	sessionToken    string
}

func (p *okProvider) Retrieve() (credentials.Value, error) {
	return credentials.Value{
		AccessKeyID:     p.accessKeyID,
		SecretAccessKey: p.secretAccessKey,
		SessionToken:    p.sessionToken,
	}, nil
}

func (p *okProvider) IsExpired() bool {
	return true
}

type fallbackCredentials struct{}

func (c *fallbackCredentials) Credentials() *credentials.Credentials {
	return credentials.NewStaticCredentials("fallback_access", "fallback_secret", "fallback_token")
}

func NewValidAwsCredentials() awsCredentials {
	return &fallbackCredentials{}
}

type errorFallbackCredentials struct{}

func (c *errorFallbackCredentials) Credentials() *credentials.Credentials {
	return credentials.NewCredentials(&errorProvider{})
}

func NewErrorAwsCredentials() awsCredentials {
	return &errorFallbackCredentials{}
}

type errorCredentialsProvider struct{}

func (c *errorCredentialsProvider) NewStaticProvider(id, secret, token string) credentials.Provider {
	return &errorProvider{}
}

type fakeEC2WithDescribe struct {
	*fakeEC2
	output *ec2.DescribeAccountAttributesOutput
	err    error
}

func (f *fakeEC2WithDescribe) DescribeAccountAttributes(input *ec2.DescribeAccountAttributesInput) (*ec2.DescribeAccountAttributesOutput, error) {
{'fraction_non_alphanumeric': 0.11133333333333334, 'fraction_numerical': 0.004888888888888889, 'mean_word_length': 5.6484490398818314, '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': '4714248', 'n_tokens_mistral': 1375, 'n_tokens_neox': 1419, 'n_words': 312}