<commit_before>using Nager.Date.Contract;
using Nager.Date.Model;
using Nager.Date.PublicHolidays;
using Nager.Date.Weekends;
using System;
using System.Collections.Generic;
using System.Linq;

namespace Nager.Date
{
    /// <summary>
    /// DateSystem
    /// </summary>
    public static class DateSystem
    {
        private static readonly NoHolidaysProvider _noHolidaysProvider = new NoHolidaysProvider();
        private static readonly ICatholicProvider _catholicProvider = new CatholicProvider();
        private static readonly IOrthodoxProvider _orthodoxProvider = new OrthodoxProvider();

        private static readonly Dictionary<CountryCode, IPublicHolidayProvider> _publicHolidaysProviders =
            new Dictionary<CountryCode, IPublicHolidayProvider>
            {
                { CountryCode.AL, new AlbaniaProvider(_orthodoxProvider) },
                { CountryCode.AD, new AndorraProvider() },
                { CountryCode.AR, new ArgentinaProvider(_catholicProvider) },
                { CountryCode.AT, new AustriaProvider(_catholicProvider) },
                { CountryCode.AU, new AustraliaProvider(_catholicProvider) },
                { CountryCode.AX, new AlandProvider(_catholicProvider) },
                { CountryCode.BB, new BarbadosProvider(_catholicProvider) },
                { CountryCode.BE, new BelgiumProvider(_catholicProvider) },
                { CountryCode.BG, new BulgariaProvider(_orthodoxProvider) },
                { CountryCode.BJ, new BeninProvider(_catholicProvider) },
                { CountryCode.BO, new BoliviaProvider(_catholicProvider) },
                { CountryCode.BR, new BrazilProvider(_catholicProvider) },
                { CountryCode.BS, new BahamasProvider(_catholicProvider) },
                { CountryCode.BW, new BotswanaProvider(_catholicProvider) },
                { CountryCode.BY, new BelarusProvider(_orthodoxProvider) },
                { CountryCode.BZ, new BelizeProvider(_catholicProvider) },
                { CountryCode.CA, new CanadaProvider(_catholicProvider) },
                { CountryCode.CH, new SwitzerlandProvider(_catholicProvider) },
                { CountryCode.CL, new ChileProvider(_catholicProvider) },
                { CountryCode.CN, new ChinaProvider() },
                { CountryCode.CO, new ColombiaProvider(_catholicProvider) },
                { CountryCode.CR, new CostaRicaProvider(_catholicProvider) },
                { CountryCode.CU, new CubaProvider(_catholicProvider) },
                { CountryCode.CY, new CyprusProvider(_catholicProvider) },
                { CountryCode.CZ, new CzechRepublicProvider(_catholicProvider) },
                { CountryCode.DE, new GermanyProvider(_catholicProvider) },
                { CountryCode.DK, new DenmarkProvider(_catholicProvider) },
                { CountryCode.DO, new DominicanRepublicProvider(_catholicProvider) },
                { CountryCode.EC, new EcuadorProvider(_catholicProvider) },
                { CountryCode.EE, new EstoniaProvider(_catholicProvider) },
                { CountryCode.EG, new EgyptProvider() },
                { CountryCode.ES, new SpainProvider(_catholicProvider) },
                { CountryCode.FI, new FinlandProvider(_catholicProvider) },
                { CountryCode.FO, new FaroeIslandsProvider(_catholicProvider) },
                { CountryCode.FR, new FranceProvider(_catholicProvider) },
                { CountryCode.GA, new GabonProvider(_catholicProvider) },
                { CountryCode.GB, new UnitedKingdomProvider(_catholicProvider) },
                { CountryCode.GD, new GrenadaProvider(_catholicProvider) },
                { CountryCode.GL, new GreenlandProvider(_catholicProvider) },
                { CountryCode.GM, new GambiaProvider(_catholicProvider) },
                { CountryCode.GR, new GreeceProvider(_orthodoxProvider) },
                { CountryCode.GT, new GuatemalaProvider(_catholicProvider) },
                { CountryCode.GY, new GuyanaProvider(_catholicProvider) },
                { CountryCode.HN, new HondurasProvider(_catholicProvider) },
                { CountryCode.HR, new CroatiaProvider(_catholicProvider) },
                { CountryCode.HT, new HaitiProvider(_catholicProvider) },
                { CountryCode.HU, new HungaryProvider(_catholicProvider) },
                { CountryCode.IE, new IrelandProvider(_catholicProvider) },
                { CountryCode.ID, new IndonesiaProvider(_catholicProvider) },
                { CountryCode.IM, new IsleOfManProvider(_catholicProvider) },
                { CountryCode.IS, new IcelandProvider(_catholicProvider) },
                { CountryCode.IT, new ItalyProvider(_catholicProvider) },
                { CountryCode.LI, new LiechtensteinProvider(_catholicProvider) },
                { CountryCode.LS, new LesothoProvider(_catholicProvider) },
                { CountryCode.LT, new LithuaniaProvider(_catholicProvider) },
                { CountryCode.LU, new LuxembourgProvider(_catholicProvider) },
                { CountryCode.LV, new LatviaProvider(_catholicProvider) },
                { CountryCode.JE, new JerseyProvider(_catholicProvider) },
                { CountryCode.JM, new JamaicaProvider(_catholicProvider) },
                { CountryCode.JP, new JapanProvider() },
                { CountryCode.MA, new MoroccoProvider() },
                { CountryCode.MC, new MonacoProvider(_catholicProvider) },
                { CountryCode.MD, new MoldovaProvider(_orthodoxProvider) },
                { CountryCode.MG, new MadagascarProvider(_catholicProvider) },
                { CountryCode.MK, new MacedoniaProvider(_orthodoxProvider) },
                { CountryCode.MN, new MongoliaProvider() },
                { CountryCode.MT, new MaltaProvider(_catholicProvider) },
                { CountryCode.MX, new MexicoProvider(_catholicProvider) },
                { CountryCode.MZ, new MozambiqueProvider() },
                { CountryCode.NA, new NamibiaProvider(_catholicProvider) },
                { CountryCode.NE, new NigerProvider(_catholicProvider) },
                { CountryCode.NI, new NicaraguaProvider(_catholicProvider) },
                { CountryCode.NL, new NetherlandsProvider(_catholicProvider) },
                { CountryCode.NO, new NorwayProvider(_catholicProvider) },
                { CountryCode.NZ, new NewZealandProvider(_catholicProvider) },
                { CountryCode.PA, new PanamaProvider(_catholicProvider) },
                { CountryCode.PE, new PeruProvider(_catholicProvider) },
                { CountryCode.PL, new PolandProvider(_catholicProvider) },
                { CountryCode.PR, new PuertoRicoProvider(_catholicProvider) },
                { CountryCode.PT, new PortugalProvider(_catholicProvider) },
                { CountryCode.PY, new ParaguayProvider(_catholicProvider) },
                { CountryCode.RO, new RomaniaProvider(_orthodoxProvider) },
                { CountryCode.RS, new SerbiaProvider(_orthodoxProvider) },
                { CountryCode.RU, new RussiaProvider() },
                { CountryCode.SE, new SwedenProvider(_catholicProvider) },
                { CountryCode.SI, new SloveniaProvider(_catholicProvider) },
                { CountryCode.SJ, new SvalbardAndJanMayenProvider(_catholicProvider) },
                { CountryCode.SK, new SlovakiaProvider(_catholicProvider) },
                { CountryCode.SM, new SanMarinoProvider(_catholicProvider) },
                { CountryCode.SR, new SurinameProvider(_catholicProvider) },
                { CountryCode.SV, new ElSalvadorProvider(_catholicProvider) },
                { CountryCode.TN, new TunisiaProvider() },
                { CountryCode.TR, new TurkeyProvider() },
                { CountryCode.UA, new UkraineProvider(_orthodoxProvider) },
                { CountryCode.US, new UnitedStatesProvider() },
                { CountryCode.UY, new UruguayProvider(_catholicProvider) },
                { CountryCode.VA, new VaticanCityProvider(_catholicProvider) },
                { CountryCode.VE, new VenezuelaProvider(_catholicProvider) },
                { CountryCode.VN, new VietnamProvider() },
                //Not officially assigned https://www.iso.org/obp/ui/#iso:pub:PUB500001:en
                //{ CountryCode.XK, new KosovoProvider(_orthodoxProvider, _catholicProvider) },
                { CountryCode.ZA, new SouthAfricaProvider(_catholicProvider) },
                { CountryCode.ZW, new ZimbabweProvider(_catholicProvider) }
            };

        private static readonly Dictionary<CountryCode, IWeekendProvider> _nonUniversalWeekendProviders =
            new Dictionary<CountryCode, IWeekendProvider>
            {
                // https://en.wikipedia.org/wiki/Workweek_and_weekend
                { CountryCode.AE, WeekendProvider.SemiUniversal }, // since 2006 // TODO handle launch dates in weekends
                { CountryCode.AF, WeekendProvider.SemiUniversal },
                { CountryCode.BD, WeekendProvider.SemiUniversal },
                { CountryCode.BH, WeekendProvider.SemiUniversal },
                { CountryCode.BN, WeekendProvider.FridaySunday },
                // { CountryCode.CO, WeekendProvider.SundayOnly }, // No information on in which case it occurs
                { CountryCode.DJ, WeekendProvider.FridayOnly },
                { CountryCode.DZ, WeekendProvider.SemiUniversal },
                { CountryCode.EG, WeekendProvider.SemiUniversal },
                { CountryCode.GQ, WeekendProvider.SundayOnly },
                { CountryCode.HK, WeekendProvider.SundayOnly },
                { CountryCode.IL, WeekendProvider.SemiUniversal },
                // { CountryCode.IN, WeekendProvider.SundayOnly }, // Except for Government offices and IT industry
                { CountryCode.IQ, WeekendProvider.SemiUniversal },
                { CountryCode.IR, WeekendProvider.SemiUniversal }, // Or friday only (no information on in which case it occurs)
                { CountryCode.JO, WeekendProvider.SemiUniversal },
                { CountryCode.KW, WeekendProvider.SemiUniversal },
                { CountryCode.LY, WeekendProvider.SemiUniversal },
                { CountryCode.MV, WeekendProvider.SemiUniversal },
                { CountryCode.MX, WeekendProvider.SundayOnly },
                // { CountryCode.MY, WeekendProvider.SemiUniversal }, // except in some counties // TODO Add county in weekend handling
                { CountryCode.NP, WeekendProvider.SaturdayOnly },
                { CountryCode.OM, WeekendProvider.SemiUniversal },
                { CountryCode.PH, WeekendProvider.SundayOnly },
                // { CountryCode.PK, WeekendProvider.SemiUniversal }, // only partially, often universal
                { CountryCode.PS, WeekendProvider.SemiUniversal },
                { CountryCode.QA, WeekendProvider.SemiUniversal },
                { CountryCode.SA, WeekendProvider.SemiUniversal },
                { CountryCode.SD, WeekendProvider.SemiUniversal },
                { CountryCode.SO, WeekendProvider.FridayOnly },
                { CountryCode.SY, WeekendProvider.SemiUniversal },
                { CountryCode.UG, WeekendProvider.SundayOnly },
                { CountryCode.YE, WeekendProvider.SemiUniversal },
            };<commit_msg>Fix Iran's weekend provider<commit_after>using Nager.Date.Contract;
using Nager.Date.Model;
using Nager.Date.PublicHolidays;
using Nager.Date.Weekends;
using System;
using System.Collections.Generic;
using System.Linq;

namespace Nager.Date
{
    /// <summary>
    /// DateSystem
    /// </summary>
    public static class DateSystem
    {
        private static readonly NoHolidaysProvider _noHolidaysProvider = new NoHolidaysProvider();
        private static readonly ICatholicProvider _catholicProvider = new CatholicProvider();
        private static readonly IOrthodoxProvider _orthodoxProvider = new OrthodoxProvider();

        private static readonly Dictionary<CountryCode, IPublicHolidayProvider> _publicHolidaysProviders =
            new Dictionary<CountryCode, IPublicHolidayProvider>
            {
                { CountryCode.AL, new AlbaniaProvider(_orthodoxProvider) },
                { CountryCode.AD, new AndorraProvider() },
                { CountryCode.AR, new ArgentinaProvider(_catholicProvider) },
                { CountryCode.AT, new AustriaProvider(_catholicProvider) },
                { CountryCode.AU, new AustraliaProvider(_catholicProvider) },
                { CountryCode.AX, new AlandProvider(_catholicProvider) },
                { CountryCode.BB, new BarbadosProvider(_catholicProvider) },
                { CountryCode.BE, new BelgiumProvider(_catholicProvider) },
                { CountryCode.BG, new BulgariaProvider(_orthodoxProvider) },
                { CountryCode.BJ, new BeninProvider(_catholicProvider) },
                { CountryCode.BO, new BoliviaProvider(_catholicProvider) },
                { CountryCode.BR, new BrazilProvider(_catholicProvider) },
                { CountryCode.BS, new BahamasProvider(_catholicProvider) },
                { CountryCode.BW, new BotswanaProvider(_catholicProvider) },
                { CountryCode.BY, new BelarusProvider(_orthodoxProvider) },
                { CountryCode.BZ, new BelizeProvider(_catholicProvider) },
                { CountryCode.CA, new CanadaProvider(_catholicProvider) },
                { CountryCode.CH, new SwitzerlandProvider(_catholicProvider) },
                { CountryCode.CL, new ChileProvider(_catholicProvider) },
                { CountryCode.CN, new ChinaProvider() },
                { CountryCode.CO, new ColombiaProvider(_catholicProvider) },
                { CountryCode.CR, new CostaRicaProvider(_catholicProvider) },
                { CountryCode.CU, new CubaProvider(_catholicProvider) },
                { CountryCode.CY, new CyprusProvider(_catholicProvider) },
                { CountryCode.CZ, new CzechRepublicProvider(_catholicProvider) },
                { CountryCode.DE, new GermanyProvider(_catholicProvider) },
                { CountryCode.DK, new DenmarkProvider(_catholicProvider) },
                { CountryCode.DO, new DominicanRepublicProvider(_catholicProvider) },
                { CountryCode.EC, new EcuadorProvider(_catholicProvider) },
                { CountryCode.EE, new EstoniaProvider(_catholicProvider) },
                { CountryCode.EG, new EgyptProvider() },
                { CountryCode.ES, new SpainProvider(_catholicProvider) },
                { CountryCode.FI, new FinlandProvider(_catholicProvider) },
                { CountryCode.FO, new FaroeIslandsProvider(_catholicProvider) },
                { CountryCode.FR, new FranceProvider(_catholicProvider) },
                { CountryCode.GA, new GabonProvider(_catholicProvider) },
                { CountryCode.GB, new UnitedKingdomProvider(_catholicProvider) },
                { CountryCode.GD, new GrenadaProvider(_catholicProvider) },
                { CountryCode.GL, new GreenlandProvider(_catholicProvider) },
                { CountryCode.GM, new GambiaProvider(_catholicProvider) },
                { CountryCode.GR, new GreeceProvider(_orthodoxProvider) },
                { CountryCode.GT, new GuatemalaProvider(_catholicProvider) },
                { CountryCode.GY, new GuyanaProvider(_catholicProvider) },
                { CountryCode.HN, new HondurasProvider(_catholicProvider) },
                { CountryCode.HR, new CroatiaProvider(_catholicProvider) },
                { CountryCode.HT, new HaitiProvider(_catholicProvider) },
                { CountryCode.HU, new HungaryProvider(_catholicProvider) },
                { CountryCode.IE, new IrelandProvider(_catholicProvider) },
                { CountryCode.ID, new IndonesiaProvider(_catholicProvider) },
                { CountryCode.IM, new IsleOfManProvider(_catholicProvider) },
                { CountryCode.IS, new IcelandProvider(_catholicProvider) },
                { CountryCode.IT, new ItalyProvider(_catholicProvider) },
                { CountryCode.LI, new LiechtensteinProvider(_catholicProvider) },
                { CountryCode.LS, new LesothoProvider(_catholicProvider) },
                { CountryCode.LT, new LithuaniaProvider(_catholicProvider) },
                { CountryCode.LU, new LuxembourgProvider(_catholicProvider) },
                { CountryCode.LV, new LatviaProvider(_catholicProvider) },
                { CountryCode.JE, new JerseyProvider(_catholicProvider) },
                { CountryCode.JM, new JamaicaProvider(_catholicProvider) },
                { CountryCode.JP, new JapanProvider() },
                { CountryCode.MA, new MoroccoProvider() },
                { CountryCode.MC, new MonacoProvider(_catholicProvider) },
                { CountryCode.MD, new MoldovaProvider(_orthodoxProvider) },
                { CountryCode.MG, new MadagascarProvider(_catholicProvider) },
                { CountryCode.MK, new MacedoniaProvider(_orthodoxProvider) },
                { CountryCode.MN, new MongoliaProvider() },
                { CountryCode.MT, new MaltaProvider(_catholicProvider) },
                { CountryCode.MX, new MexicoProvider(_catholicProvider) },
                { CountryCode.MZ, new MozambiqueProvider() },
                { CountryCode.NA, new NamibiaProvider(_catholicProvider) },
                { CountryCode.NE, new NigerProvider(_catholicProvider) },
                { CountryCode.NI, new NicaraguaProvider(_catholicProvider) },
                { CountryCode.NL, new NetherlandsProvider(_catholicProvider) },
                { CountryCode.NO, new NorwayProvider(_catholicProvider) },
                { CountryCode.NZ, new NewZealandProvider(_catholicProvider) },
                { CountryCode.PA, new PanamaProvider(_catholicProvider) },
                { CountryCode.PE, new PeruProvider(_catholicProvider) },
                { CountryCode.PL, new PolandProvider(_catholicProvider) },
                { CountryCode.PR, new PuertoRicoProvider(_catholicProvider) },
                { CountryCode.PT, new PortugalProvider(_catholicProvider) },
                { CountryCode.PY, new ParaguayProvider(_catholicProvider) },
                { CountryCode.RO, new RomaniaProvider(_orthodoxProvider) },
                { CountryCode.RS, new SerbiaProvider(_orthodoxProvider) },
                { CountryCode.RU, new RussiaProvider() },
                { CountryCode.SE, new SwedenProvider(_catholicProvider) },
                { CountryCode.SI, new SloveniaProvider(_catholicProvider) },
                { CountryCode.SJ, new SvalbardAndJanMayenProvider(_catholicProvider) },
                { CountryCode.SK, new SlovakiaProvider(_catholicProvider) },
                { CountryCode.SM, new SanMarinoProvider(_catholicProvider) },
                { CountryCode.SR, new SurinameProvider(_catholicProvider) },
                { CountryCode.SV, new ElSalvadorProvider(_catholicProvider) },
                { CountryCode.TN, new TunisiaProvider() },
                { CountryCode.TR, new TurkeyProvider() },
                { CountryCode.UA, new UkraineProvider(_orthodoxProvider) },
                { CountryCode.US, new UnitedStatesProvider() },
                { CountryCode.UY, new UruguayProvider(_catholicProvider) },
                { CountryCode.VA, new VaticanCityProvider(_catholicProvider) },
                { CountryCode.VE, new VenezuelaProvider(_catholicProvider) },
                { CountryCode.VN, new VietnamProvider() },
                //Not officially assigned https://www.iso.org/obp/ui/#iso:pub:PUB500001:en
                //{ CountryCode.XK, new KosovoProvider(_orthodoxProvider, _catholicProvider) },
                { CountryCode.ZA, new SouthAfricaProvider(_catholicProvider) },
                { CountryCode.ZW, new ZimbabweProvider(_catholicProvider) }
            };

        private static readonly Dictionary<CountryCode, IWeekendProvider> _nonUniversalWeekendProviders =
            new Dictionary<CountryCode, IWeekendProvider>
            {
                // https://en.wikipedia.org/wiki/Workweek_and_weekend
                { CountryCode.AE, WeekendProvider.SemiUniversal }, // since 2006 // TODO handle launch dates in weekends
                { CountryCode.AF, WeekendProvider.SemiUniversal },
                { CountryCode.BD, WeekendProvider.SemiUniversal },
                { CountryCode.BH, WeekendProvider.SemiUniversal },
                { CountryCode.BN, WeekendProvider.FridaySunday },
                // { CountryCode.CO, WeekendProvider.SundayOnly }, // No information on in which case it occurs
                { CountryCode.DJ, WeekendProvider.FridayOnly },
                { CountryCode.DZ, WeekendProvider.SemiUniversal },
                { CountryCode.EG, WeekendProvider.SemiUniversal },
                { CountryCode.GQ, WeekendProvider.SundayOnly },
                { CountryCode.HK, WeekendProvider.SundayOnly },
                { CountryCode.IL, WeekendProvider.SemiUniversal },
                // { CountryCode.IN, WeekendProvider.SundayOnly }, // Except for Government offices and IT industry
                { CountryCode.IQ, WeekendProvider.SemiUniversal },
                { CountryCode.IR, WeekendProvider.FridayOnly },
                { CountryCode.JO, WeekendProvider.SemiUniversal },
                { CountryCode.KW, WeekendProvider.SemiUniversal },
                { CountryCode.LY, WeekendProvider.SemiUniversal },
                { CountryCode.MV, WeekendProvider.SemiUniversal },
                { CountryCode.MX, WeekendProvider.SundayOnly },
                // { CountryCode.MY, WeekendProvider.SemiUniversal }, // except in some counties // TODO Add county in weekend handling
                { CountryCode.NP, WeekendProvider.SaturdayOnly },
                { CountryCode.OM, WeekendProvider.SemiUniversal },
                { CountryCode.PH, WeekendProvider.SundayOnly },
                // { CountryCode.PK, WeekendProvider.SemiUniversal }, // only partially, often universal
                { CountryCode.PS, WeekendProvider.SemiUniversal },
                { CountryCode.QA, WeekendProvider.SemiUniversal },
                { CountryCode.SA, WeekendProvider.SemiUniversal },
                { CountryCode.SD, WeekendProvider.SemiUniversal },
                { CountryCode.SO, WeekendProvider.FridayOnly },
                { CountryCode.SY, WeekendProvider.SemiUniversal },
                { CountryCode.UG, WeekendProvider.SundayOnly },
                { CountryCode.YE, WeekendProvider.SemiUniversal },
            };
{'fraction_non_alphanumeric': 0.09148907890656152, 'fraction_numerical': 0.0008860927739134288, 'mean_word_length': 2.3800539083557952, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 4, 'lorem ipsum': 0, 'www.': 2, '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': '4795101', 'n_tokens_mistral': 5998, 'n_tokens_neox': 5478, 'n_words': 968}