<commit_before>﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using NDjango;
using NDjango.Interfaces;

namespace FifteenBelow.Deployment.Update
{
    public static class NDjangoWrapper
    {
        private const string ErrorGuid = "{668B7536-C32B-4D86-B065-70C143EB4AD9}";
        private const string StringProvider = "string://";

        private static readonly Lazy<TemplateManagerProvider> Instance =
            new Lazy<TemplateManagerProvider>(
                () =>
                new TemplateManagerProvider()
                    .WithLoader(new StringLoader())
                    .WithSetting(Constants.TEMPLATE_STRING_IF_INVALID, ErrorGuid)
                    .WithSetting(Constants.DEFAULT_AUTOESCAPE, false)
                    .WithFilters(NDjango.FiltersCS.FilterManager.GetFilters().Where(f => f.name != "default"))
                    .WithFilter("concat", new NDjangoExpansions.ConcatFilter())
                    .WithFilter("default", new NDjangoExpansions.DefaultFilter(ErrorGuid))
                    .WithFilter("exists", new NDjangoExpansions.ExistsFilter(ErrorGuid))
                    .WithFilter("empty", new NDjangoExpansions.EmptyFilter(ErrorGuid))
                );

        private static readonly Lazy<TemplateManagerProvider> XmlSafeInstance =
            new Lazy<TemplateManagerProvider>(
                () =>
                new TemplateManagerProvider()
                    .WithLoader(new StringLoader())
                    .WithSetting(Constants.TEMPLATE_STRING_IF_INVALID, ErrorGuid)
                    .WithSetting(Constants.DEFAULT_AUTOESCAPE, true)
                    .WithFilters(NDjango.FiltersCS.FilterManager.GetFilters().Where(f => f.name != "default"))
                    .WithFilter("concat", new NDjangoExpansions.ConcatFilter())
                    .WithFilter("default", new NDjangoExpansions.DefaultFilter(ErrorGuid))
                    .WithFilter("exists", new NDjangoExpansions.ExistsFilter(ErrorGuid))
                    .WithFilter("empty", new NDjangoExpansions.EmptyFilter(ErrorGuid))
                );

        static NDjangoWrapper()
        {
        }

        private static ITemplateManager GetTemplateManager()
        {
            return Instance.Value.GetNewManager();
        }
        
        private static ITemplateManager GetXmlSafeTemplateManager()
        {
            return XmlSafeInstance.Value.GetNewManager();
        }<commit_msg>Correct code formatting<commit_after>﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using NDjango;
using NDjango.Interfaces;

namespace FifteenBelow.Deployment.Update
{
    public static class NDjangoWrapper
    {
        private const string ErrorGuid = "{668B7536-C32B-4D86-B065-70C143EB4AD9}";
        private const string StringProvider = "string://";

        private static readonly Lazy<TemplateManagerProvider> Instance = new Lazy<TemplateManagerProvider>(() => new TemplateManagerProvider().WithLoader(new StringLoader())
                                                                                                                                              .WithSetting(Constants.TEMPLATE_STRING_IF_INVALID, ErrorGuid)
                                                                                                                                              .WithSetting(Constants.DEFAULT_AUTOESCAPE, false)
                                                                                                                                              .WithFilters(NDjango.FiltersCS.FilterManager.GetFilters().Where(f => f.name != "default"))
                                                                                                                                              .WithFilter("concat", new NDjangoExpansions.ConcatFilter())
                                                                                                                                              .WithFilter("default", new NDjangoExpansions.DefaultFilter(ErrorGuid))
                                                                                                                                              .WithFilter("exists", new NDjangoExpansions.ExistsFilter(ErrorGuid))
                                                                                                                                              .WithFilter("empty", new NDjangoExpansions.EmptyFilter(ErrorGuid)));

        private static readonly Lazy<TemplateManagerProvider> XmlSafeInstance = new Lazy<TemplateManagerProvider>(() => new TemplateManagerProvider().WithLoader(new StringLoader())
                                                                                                                                                     .WithSetting(Constants.TEMPLATE_STRING_IF_INVALID, ErrorGuid)
                                                                                                                                                     .WithSetting(Constants.DEFAULT_AUTOESCAPE, true)
                                                                                                                                                     .WithFilters(NDjango.FiltersCS.FilterManager.GetFilters().Where(f => f.name != "default"))
                                                                                                                                                     .WithFilter("concat", new NDjangoExpansions.ConcatFilter())
                                                                                                                                                     .WithFilter("default", new NDjangoExpansions.DefaultFilter(ErrorGuid))
                                                                                                                                                     .WithFilter("exists", new NDjangoExpansions.ExistsFilter(ErrorGuid))
                                                                                                                                                     .WithFilter("empty", new NDjangoExpansions.EmptyFilter(ErrorGuid)));

        private static ITemplateManager GetTemplateManager()
        {
            return Instance.Value.GetNewManager();
        }

        private static ITemplateManager GetXmlSafeTemplateManager()
        {
            return XmlSafeInstance.Value.GetNewManager();
        }
{'fraction_non_alphanumeric': 0.06851851851851852, 'fraction_numerical': 0.006790123456790123, 'mean_word_length': 1.0953766569673455, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 98, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5099870', 'n_tokens_mistral': 1205, 'n_tokens_neox': 1146, 'n_words': 202}