<commit_before>package middleware

import (
	"container/list"
	"net/http"
)

// Middleware handler is an interface that objects can implement to be registered to serve as middleware
// in the stack.
// ServeHTTP should yield to the next middleware in the chain by invoking the next MiddlewareFunc.
// passed in.
type Middleware interface {
	ServeHTTP(rw http.ResponseWriter, r *http.Request, next http.HandlerFunc)
}

// MiddlewareFunc is an adapter to allow the use of ordinary functions as middleware handlers.
// If f is a function with the appropriate signature, MiddlewareFunc(f) is a Middleware object that calls f.
type MiddlewareFunc func(rw http.ResponseWriter, r *http.Request, next http.HandlerFunc)

func (h MiddlewareFunc) ServeHTTP(rw http.ResponseWriter, r *http.Request, next http.HandlerFunc) {
	h(rw, r, next)
}

// Wrap converts a Handler into a Middleware so it can be used as a
// middleware. The next HandlerFunc is automatically called after the Middleware
// is executed.
func Wrap(handler http.HandlerFunc) Middleware {
	return MiddlewareFunc(func(rw http.ResponseWriter, r *http.Request, next http.HandlerFunc) {
		handler.ServeHTTP(rw, r)
		next(rw, r)
	})
}

// Compose converts a Middleware into a func(http.HandlerFunc)http.HandlerFunc<commit_msg>spelling error<commit_after>package middleware

import (
	"container/list"
	"net/http"
)

// Middleware handler is an interface that objects can implement to be registered to serve as middleware
// in the stack.
// ServeHTTP should yield to the next middleware in the chain by invoking the next MiddlewareFunc.
// passed in.
type Middleware interface {
	ServeHTTP(rw http.ResponseWriter, r *http.Request, next http.HandlerFunc)
}

// MiddlewareFunc is an adapter to allow the use of ordinary functions as middleware handlers.
// If f is a function with the appropriate signature, MiddlewareFunc(f) is a Middleware object that calls f.
type MiddlewareFunc func(rw http.ResponseWriter, r *http.Request, next http.HandlerFunc)

func (h MiddlewareFunc) ServeHTTP(rw http.ResponseWriter, r *http.Request, next http.HandlerFunc) {
	h(rw, r, next)
}

// Wrap converts a Handler into a Middleware so it can be used as a
// middleware. The next HandlerFunc is automatically called after the Middleware
// is executed.
func Wrap(handler http.HandlerFunc) Middleware {
	return MiddlewareFunc(func(rw http.ResponseWriter, r *http.Request, next http.HandlerFunc) {
		handler.ServeHTTP(rw, r)
		next(rw, r)
	})
}

// Compose converts a Middleware into a func(http.Handler)http.Handler
{'fraction_non_alphanumeric': 0.08087946603847664, 'fraction_numerical': 0.0, 'mean_word_length': 4.539130434782609, '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': '3338847', 'n_tokens_mistral': 745, 'n_tokens_neox': 724, 'n_words': 298}