<commit_before>package gentle

import (
	"errors"
	"github.com/afex/hystrix-go/hystrix"
	log15 "gopkg.in/inconshreveable/log15.v2"
	"time"
)

var (
	// Package level logger. It uses log15(gopkg.in/inconshreveable/log15.v2)
	// to provide finer control over logging.
	Log = log15.New()

	// Errors that CircuitBreakerStream.Get() and
	// CircuitBreakerHandler.Handle() might return. They are replacement of
	// hystrix errors.
	ErrCbOpen           = errors.New(hystrix.ErrCircuitOpen.Error())
	ErrCbMaxConcurrency = errors.New(hystrix.ErrMaxConcurrency.Error())
	ErrCbTimeout        = errors.New(hystrix.ErrTimeout.Error())

	ErrMaxConcurrency = errors.New("Reached Max Concurrency")
	ErrInvalidType    = errors.New("Invalid Type")
)

func init() {
	Log.SetHandler(log15.DiscardHandler())
}

type Message interface {
	// A Message is obliged to implement Id() for better tracing.
	Id() string
}

// errors that implements IgnorableError would be examined and ignored if
// necessary by RetryXXX and CircuitBreakerXXX.
type IgnorableError interface {
	Ignored() bool
}

func ToIgnore(err error) bool {
	if ig, ok := err.(IgnorableError); !ok {
		return false
	} else {
		return ig.Ignored()
	}
}

// Stream emits Message. Messages of a stream goes one way. Though two streams
// can simulate two-way communication but it would require out-of-band logic.
type Stream interface {
	// Get() returns either a Message or an error. Returned Message is nil
	// if only if error is not nil.
	Get() (Message, error)
}

// Handler transforms a Message.
type Handler interface {
	// Handle() transforms an Message. Returned Message is nil if only if
	// error is not nil.
	Handle(msg Message) (Message, error)
}

type Names struct {
	Namespace string
	Mixin     string
	Name      string
}<commit_msg>add IgnorableErr<commit_after>package gentle

import (
	"errors"
	"github.com/afex/hystrix-go/hystrix"
	log15 "gopkg.in/inconshreveable/log15.v2"
	"time"
)

var (
	// Package level logger. It uses log15(gopkg.in/inconshreveable/log15.v2)
	// to provide finer control over logging.
	Log = log15.New()

	// Errors that CircuitBreakerStream.Get() and
	// CircuitBreakerHandler.Handle() might return. They are replacement of
	// hystrix errors.
	ErrCbOpen           = errors.New(hystrix.ErrCircuitOpen.Error())
	ErrCbMaxConcurrency = errors.New(hystrix.ErrMaxConcurrency.Error())
	ErrCbTimeout        = errors.New(hystrix.ErrTimeout.Error())

	ErrMaxConcurrency = errors.New("Reached Max Concurrency")
	ErrInvalidType    = errors.New("Invalid Type")
)

func init() {
	Log.SetHandler(log15.DiscardHandler())
}

type Message interface {
	// A Message is obliged to implement Id() for better tracing.
	Id() string
}

// errors that implements IgnorableError would be examined and ignored if
// necessary by RetryXXX and CircuitBreakerXXX.
type IgnorableError interface {
	error
	Ignored() bool
}

func ToIgnore(err error) bool {
	if ig, ok := err.(IgnorableError); !ok {
		return false
	} else {
		return ig.Ignored()
	}
}

// Stream emits Message. Messages of a stream goes one way. Though two streams
// can simulate two-way communication but it would require out-of-band logic.
type Stream interface {
	// Get() returns either a Message or an error. Returned Message is nil
	// if only if error is not nil.
	Get() (Message, error)
}

// Handler transforms a Message.
type Handler interface {
	// Handle() transforms an Message. Returned Message is nil if only if
	// error is not nil.
	Handle(msg Message) (Message, error)
}

type Names struct {
	Namespace string
	Mixin     string
	Name      string
}
{'fraction_non_alphanumeric': 0.1015625, 'fraction_numerical': 0.0078125, 'mean_word_length': 3.6924083769633507, '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': '6766545', 'n_tokens_mistral': 1183, 'n_tokens_neox': 1131, 'n_words': 370}