<commit_before>package kami

import (
	"golang.org/x/net/context"
)

type key int

const (
	paramsKey key = iota
	panicKey
)

// Param returns a request URL parameter, or a blank string if it doesn't exist.
// For example, with the path /v2/papers/:page
// use kami.Param(ctx, "page") to access the :page variable.
func Param(ctx context.Context, name string) string {
	params, ok := ctx.Value(paramsKey).(map[string]string)
	if !ok {
		return ""
	}
	return params[name]
}

// Exception gets the "v" in panic(v). The panic details.
// Only PanicHandler will receive a context you can use this with.<commit_msg>add the SetParameters method<commit_after>package kami

import (
	"golang.org/x/net/context"
)

type key int

const (
	paramsKey key = iota
	panicKey
)

// Param returns a request URL parameter, or a blank string if it doesn't exist.
// For example, with the path /v2/papers/:page
// use kami.Param(ctx, "page") to access the :page variable.
func Param(ctx context.Context, name string) string {
	params, ok := ctx.Value(paramsKey).(map[string]string)
	if !ok {
		return ""
	}
	return params[name]
}

// SetParameter will set the value of a path parameter in a given context.
func SetParameter(ctx context.Context, name string, value string) context.Context {
	params, ok := ctx.Value(paramsKey).(map[string]string)
	if !ok {
		params = make(map[string]string)
	}
	params[name] = value
	return context.WithValue(ctx, paramsKey, params)
}

// Exception gets the "v" in panic(v). The panic details.
// Only PanicHandler will receive a context you can use this with.
{'fraction_non_alphanumeric': 0.11443102352193261, 'fraction_numerical': 0.0012714558169103624, 'mean_word_length': 3.91875, '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': '1236532', 'n_tokens_mistral': 515, 'n_tokens_neox': 509, 'n_words': 184}