<commit_before>﻿namespace WorkoutWotch.Models.Parsers
{
    using System;
    using Sprache;

    internal static class TimeSpanParser
    {
        private static readonly Parser<int> hoursParser = Parse.Number.Then(x => Parse.IgnoreCase('h').Return(int.Parse(x)));

        private static readonly Parser<int> minutesParser = Parse.Number.Then(x => Parse.IgnoreCase('m').Return(int.Parse(x)));

        private static readonly Parser<double> secondsParser = Parse.Decimal.Then(x => Parse.IgnoreCase('s').Return(double.Parse(x)));

        public static readonly Parser<TimeSpan> Parser =
            from hours in hoursParser.Optional()
            from _ in (hours.IsDefined ? Parse.WhiteSpace.Except(NewLineParser.Parser).Many() : Parse.String(""))
            from minutes in minutesParser.Optional()
            from __ in (minutes.IsDefined ? Parse.WhiteSpace.Except(NewLineParser.Parser).Many() : Parse.String(""))
            from seconds in secondsParser.Optional()
            where hours.IsDefined || minutes.IsDefined || seconds.IsDefined
            select new TimeSpan(hours.GetOrDefault(), minutes.GetOrDefault(), 0) + TimeSpan.FromSeconds(seconds.GetOrDefault());
    }
}<commit_msg>Using Parse.Return instead of Parse.String("").<commit_after>﻿namespace WorkoutWotch.Models.Parsers
{
    using System;
    using System.Linq;
    using Sprache;

    internal static class TimeSpanParser
    {
        private static readonly Parser<int> hoursParser = Parse.Number.Then(x => Parse.IgnoreCase('h').Return(int.Parse(x)));

        private static readonly Parser<int> minutesParser = Parse.Number.Then(x => Parse.IgnoreCase('m').Return(int.Parse(x)));

        private static readonly Parser<double> secondsParser = Parse.Decimal.Then(x => Parse.IgnoreCase('s').Return(double.Parse(x)));

        public static readonly Parser<TimeSpan> Parser =
            from hours in hoursParser.Optional()
            from _ in (hours.IsDefined ? Parse.WhiteSpace.Except(NewLineParser.Parser).Many() : Parse.Return(Enumerable.Empty<char>()))
            from minutes in minutesParser.Optional()
            from __ in (minutes.IsDefined ? Parse.WhiteSpace.Except(NewLineParser.Parser).Many() : Parse.Return(Enumerable.Empty<char>()))
            from seconds in secondsParser.Optional()
            where hours.IsDefined || minutes.IsDefined || seconds.IsDefined
            select new TimeSpan(hours.GetOrDefault(), minutes.GetOrDefault(), 0) + TimeSpan.FromSeconds(seconds.GetOrDefault());
    }
}
{'fraction_non_alphanumeric': 0.12435025989604158, 'fraction_numerical': 0.0007996801279488205, 'mean_word_length': 3.557377049180328, 'pattern_counts': {'":': 0, '<': 13, '<?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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2006111', 'n_tokens_mistral': 692, 'n_tokens_neox': 671, 'n_words': 142}