<commit_before>// Gin middleware, handling authentication against the Google App Engine users
// service.
package gingae

import (
	"appengine"
	"appengine/user"
	"github.com/gin-gonic/gin"
)

const (
	Context        = "GaeContext"
	User           = "GaeUser"
	UserOAuthError = "GaeUserOAuthError"
)

type gaeContextProvider func(c *gin.Context) appengine.Context

// Set a variable on the Gin context, containing the GAE Context.
func GaeContext() gin.HandlerFunc {
	return gaeContextFromProvider(func(c *gin.Context) appengine.Context {
		return appengine.NewContext(c.Req)
	})
}

func gaeContextFromProvider(gaeContextProvider gaeContextProvider) gin.HandlerFunc {
	return func(c *gin.Context) {
		gaeCtx := gaeContextProvider(c)
		c.Set(Context, gaeCtx)
	}
}

// Set a variable on the Gin context, containing the GAE User.
func GaeUser() gin.HandlerFunc {<commit_msg>Req renamed to Request in Context<commit_after>// Gin middleware, handling authentication against the Google App Engine users
// service.
package gingae

import (
	"appengine"
	"appengine/user"
	"github.com/gin-gonic/gin"
)

const (
	Context        = "GaeContext"
	User           = "GaeUser"
	UserOAuthError = "GaeUserOAuthError"
)

type gaeContextProvider func(c *gin.Context) appengine.Context

// Set a variable on the Gin context, containing the GAE Context.
func GaeContext() gin.HandlerFunc {
	return gaeContextFromProvider(func(c *gin.Context) appengine.Context {
		return appengine.NewContext(c.Request)
	})
}

func gaeContextFromProvider(gaeContextProvider gaeContextProvider) gin.HandlerFunc {
	return func(c *gin.Context) {
		gaeCtx := gaeContextProvider(c)
		c.Set(Context, gaeCtx)
	}
}

// Set a variable on the Gin context, containing the GAE User.
func GaeUser() gin.HandlerFunc {
{'fraction_non_alphanumeric': 0.0985277463193658, 'fraction_numerical': 0.0, 'mean_word_length': 4.420245398773006, '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': '5464577', 'n_tokens_mistral': 592, 'n_tokens_neox': 579, 'n_words': 155}