<commit_before>package connector

import (
	"net"
	"net/url"

	"github.com/aws/aws-sdk-go/aws/awserr"
)

type isRecoverableErrorFunc func(error) bool

var isRecoverableErrors = []isRecoverableErrorFunc{
	kinesisIsRecoverableError,
	netIsRecoverableError,
	urlIsRecoverableError,
}

// isRecoverableError determines whether the error is recoverable
func isRecoverableError(err error) bool {
	for _, errF := range isRecoverableErrors {
		if errF(err) {
			return true
		}
	}

	return false
}

func kinesisIsRecoverableError(err error) bool {
	recoverableErrorCodes := map[string]bool{
		"InternalFailure":                        true,
		"ProvisionedThroughputExceededException": true,
		"RequestError":                           true,
		"ServiceUnavailable":                     true,
		"Throttling":                             true,
	}

	if err, ok := err.(awserr.Error); ok {
		if ok && recoverableErrorCodes[err.Code()] == true {
			return true
		}
	}

	return false
}

func urlIsRecoverableError(err error) bool {
	_, ok := err.(*url.Error)
	if ok {
		return true
	}
	return false
}

func netIsRecoverableError(err error) bool {
	recoverableErrors := map[string]bool{
		"connection reset by peer": true,
	}
	cErr, ok := err.(*net.OpError)
	if ok && recoverableErrors[cErr.Err.Error()] == true {
		return true
	}
	return false
}<commit_msg>Add line-breaks after blocks<commit_after>package connector

import (
	"net"
	"net/url"

	"github.com/aws/aws-sdk-go/aws/awserr"
)

type isRecoverableErrorFunc func(error) bool

var isRecoverableErrors = []isRecoverableErrorFunc{
	kinesisIsRecoverableError,
	netIsRecoverableError,
	urlIsRecoverableError,
}

// isRecoverableError determines whether the error is recoverable
func isRecoverableError(err error) bool {
	for _, errF := range isRecoverableErrors {
		if errF(err) {
			return true
		}
	}

	return false
}

func kinesisIsRecoverableError(err error) bool {
	recoverableErrorCodes := map[string]bool{
		"InternalFailure":                        true,
		"ProvisionedThroughputExceededException": true,
		"RequestError":                           true,
		"ServiceUnavailable":                     true,
		"Throttling":                             true,
	}

	if err, ok := err.(awserr.Error); ok {
		if ok && recoverableErrorCodes[err.Code()] == true {
			return true
		}
	}

	return false
}

func urlIsRecoverableError(err error) bool {
	_, ok := err.(*url.Error)
	if ok {
		return true
	}

	return false
}

func netIsRecoverableError(err error) bool {
	recoverableErrors := map[string]bool{
		"connection reset by peer": true,
	}

	cErr, ok := err.(*net.OpError)
	if ok && recoverableErrors[cErr.Err.Error()] == true {
		return true
	}

	return false
}
{'fraction_non_alphanumeric': 0.10621761658031088, 'fraction_numerical': 0.0, 'mean_word_length': 3.1842105263157894, 'pattern_counts': {'":': 12, '<': 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': '2292472', 'n_tokens_mistral': 958, 'n_tokens_neox': 909, 'n_words': 203}