<commit_before>using System;
using System.Net.Http;
using System.Web.Http;
using System.Web.Http.ExceptionHandling;
using System.Web.Http.Hosting;
using System.Web.Routing;
using Graphite.Extensions;
using Graphite.Http;

namespace Graphite.Setup
{
    public partial class ConfigurationDsl
    {
        /// <summary>
        /// Allows you to configure Web Api.
        /// </summary>
        public ConfigurationDsl ConfigureWebApi(Action<WebApiDsl> configure)
        {
            configure(new WebApiDsl(_httpConfiguration));
            return this;
        }
    }

    public class WebApiDsl
    {
        public WebApiDsl(HttpConfiguration configuration)
        {
            Configuration = configuration;
        }

        public HttpConfiguration Configuration { get; }

        /// <summary>
        /// Creates and applies a new buffer policy selector.
        /// </summary>
        public WebApiDsl CreateBufferPolicy(Action<BufferPolicyDsl> configure)
        {
            var policy = new BufferPolicySelector();
            configure(new BufferPolicyDsl(policy));
            Configuration.Services.Replace<IHostBufferPolicySelector>(policy);
            return this;
        }

        /// <summary>
        /// Adds an exception logger.
        /// </summary>
        public WebApiDsl AddExceptionLogger<T>() where T : IExceptionLogger, new()
        {
            Configuration.Services.Add<IExceptionLogger, T>();
            return this;
        }

        /// <summary>
        /// Allows you to have a url that is the same as a physical path.
        /// </summary>
        public WebApiDsl RouteExistingFiles()
        {
            RouteTable.Routes.RouteExistingFiles = true;
            return this;
        }
    }

    public class BufferPolicyDsl
    {
        private readonly BufferPolicySelector _policy;

        public BufferPolicyDsl(BufferPolicySelector policy)
        {
            _policy = policy;
        }

        /// <summary>
        /// Prevents buffering of input.
        /// </summary>
        public BufferPolicyDsl DoNotBufferInput()
        {
            _policy.BufferAllInput = false;
            return this;
        }

        /// <summary>
        /// Prevents buffering of output.
        /// </summary>
        public BufferPolicyDsl DoNotBufferOutput()
        {
            _policy.BufferAllOutput = false;
            return this;
        }

        /// <summary>
        /// Includes a specific type of content to buffer.
        /// </summary>
        public BufferPolicyDsl BufferOutputOf<T>() where T : HttpContent
        {
            _policy.BufferAllOutput = false;
            _policy.IncludeForOutput.Add<T>();
            return this;
        }

        /// <summary>
        /// Excludes a specific type of content from buffering.
        /// </summary>
        public BufferPolicyDsl DoNotBufferOutputOf<T>() where T : HttpContent
        {
            _policy.ExcludeForOutput.Add<T>();
            return this;
        }

        /// <summary>
        /// Applies the WebApi buffering defaults. 
        /// Excludes StreamContent and PushStreamContent from buffering.
        /// </summary>
        public BufferPolicyDsl ApplyWebApiDefaults()
        {
            _policy.BufferAllInput = true;
            _policy.BufferAllOutput = true;
            _policy.ExcludeForOutput.Add<StreamContent>().Add<PushStreamContent>();
            return this;
        }

        /// <summary>
        /// Applies the Graphite buffering defaults. 
        /// Excludes AsyncContent from buffering.
        /// </summary>
        public BufferPolicyDsl ApplyGraphiteDefaults()
        {
            _policy.BufferAllInput = true;
            _policy.BufferAllOutput = true;
            _policy.ExcludeForOutput.Add<AsyncContent>();
            return this;
        }
    }
}<commit_msg>Modded the web api exception handling dsl.<commit_after>using System;
using System.Net.Http;
using System.Web.Http;
using System.Web.Http.ExceptionHandling;
using System.Web.Http.Hosting;
using System.Web.Routing;
using Graphite.Extensions;
using Graphite.Http;

namespace Graphite.Setup
{
    public partial class ConfigurationDsl
    {
        /// <summary>
        /// Allows you to configure Web Api.
        /// </summary>
        public ConfigurationDsl ConfigureWebApi(Action<WebApiDsl> configure)
        {
            configure(new WebApiDsl(_httpConfiguration));
            return this;
        }
    }

    public class WebApiDsl
    {
        public WebApiDsl(HttpConfiguration configuration)
        {
            Configuration = configuration;
        }

        public HttpConfiguration Configuration { get; }

        /// <summary>
        /// Creates and applies a new buffer policy selector.
        /// </summary>
        public WebApiDsl CreateBufferPolicy(Action<BufferPolicyDsl> configure)
        {
            var policy = new BufferPolicySelector();
            configure(new BufferPolicyDsl(policy));
            Configuration.Services.Replace<IHostBufferPolicySelector>(policy);
            return this;
        }

        /// <summary>
        /// Adds an exception logger.
        /// </summary>
        public WebApiDsl AddExceptionLogger<T>() where T : IExceptionLogger, new()
        {
            Configuration.Services.Add<IExceptionLogger, T>();
            return this;
        }

        /// <summary>
        /// Sets the exception handler.
        /// </summary>
        public WebApiDsl SetExceptionHandler<T>() where T : IExceptionHandler, new()
        {
            Configuration.Services.Replace<IExceptionHandler, T>();
            return this;
        }

        /// <summary>
        /// Allows you to have a url that is the same as a physical path.
        /// </summary>
        public WebApiDsl RouteExistingFiles()
        {
            RouteTable.Routes.RouteExistingFiles = true;
            return this;
        }
    }

    public class BufferPolicyDsl
    {
        private readonly BufferPolicySelector _policy;

        public BufferPolicyDsl(BufferPolicySelector policy)
        {
            _policy = policy;
        }

        /// <summary>
        /// Prevents buffering of input.
        /// </summary>
        public BufferPolicyDsl DoNotBufferInput()
        {
            _policy.BufferAllInput = false;
            return this;
        }

        /// <summary>
        /// Prevents buffering of output.
        /// </summary>
        public BufferPolicyDsl DoNotBufferOutput()
        {
            _policy.BufferAllOutput = false;
            return this;
        }

        /// <summary>
        /// Includes a specific type of content to buffer.
        /// </summary>
        public BufferPolicyDsl BufferOutputOf<T>() where T : HttpContent
        {
            _policy.BufferAllOutput = false;
            _policy.IncludeForOutput.Add<T>();
            return this;
        }

        /// <summary>
        /// Excludes a specific type of content from buffering.
        /// </summary>
        public BufferPolicyDsl DoNotBufferOutputOf<T>() where T : HttpContent
        {
            _policy.ExcludeForOutput.Add<T>();
            return this;
        }

        /// <summary>
        /// Applies the WebApi buffering defaults. 
        /// Excludes StreamContent and PushStreamContent from buffering.
        /// </summary>
        public BufferPolicyDsl ApplyWebApiDefaults()
        {
            _policy.BufferAllInput = true;
            _policy.BufferAllOutput = true;
            _policy.ExcludeForOutput.Add<StreamContent>().Add<PushStreamContent>();
            return this;
        }

        /// <summary>
        /// Applies the Graphite buffering defaults. 
        /// Excludes AsyncContent from buffering.
        /// </summary>
        public BufferPolicyDsl ApplyGraphiteDefaults()
        {
            _policy.BufferAllInput = true;
            _policy.BufferAllOutput = true;
            _policy.ExcludeForOutput.Add<AsyncContent>();
            return this;
        }
    }
}
{'fraction_non_alphanumeric': 0.09113893570912593, 'fraction_numerical': 0.0, 'mean_word_length': 1.5575738916256157, 'pattern_counts': {'":': 0, '<': 71, '<?xml version=': 0, '>': 71, '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': '2991187', 'n_tokens_mistral': 2083, 'n_tokens_neox': 2008, 'n_words': 493}