<commit_before>﻿using Ditto.AsyncInit.Internal;
using Ditto.AsyncInit.Services.Internal;
using Microsoft.Runtime.CompilerServices;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;

namespace Ditto.AsyncInit.Services
{
    /// <summary>
    /// Asynchronous initializer.
    /// </summary>
    /// <typeparam name="TFrom">The requested type.</typeparam>
    /// <typeparam name="TTo">The actual type.</typeparam>
    public class AsyncInitializer<TFrom, TTo> : IAsyncInitializer<TFrom>
        where TTo : TFrom
    {
        /// <summary>
        /// An initializer with no initialization arguments.
        /// </summary>
        public static readonly AsyncInitializer<TFrom, TTo> Empty = new AsyncInitializer<TFrom, TTo>(AsyncInitArgs.Empty);

        private readonly IArgumentsStrategy _arguments;

        /// <summary>
        /// Creates a new initializer with typed initialization arguments.
        /// </summary>
        /// <param name="args">Arguments.</param>
        public AsyncInitializer(AsyncInitArgs args)
            : this(new StaticArgumentsStrategy(args))
        {
        }

        /// <summary>
        /// Creates a new initializer with the specified arguments strategy.
        /// </summary>
        /// <param name="arguments">Arguments strategy.</param>
        internal AsyncInitializer(IArgumentsStrategy arguments)
        {
            this._arguments = arguments;
        }

        /// <summary>
        /// Gets an awaiter used to await the initialization.
        /// </summary><commit_msg>Used StaticArgumentsStrategy.Empty<commit_after>﻿using Ditto.AsyncInit.Internal;
using Ditto.AsyncInit.Services.Internal;
using Microsoft.Runtime.CompilerServices;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;

namespace Ditto.AsyncInit.Services
{
    /// <summary>
    /// Asynchronous initializer.
    /// </summary>
    /// <typeparam name="TFrom">The requested type.</typeparam>
    /// <typeparam name="TTo">The actual type.</typeparam>
    public class AsyncInitializer<TFrom, TTo> : IAsyncInitializer<TFrom>
        where TTo : TFrom
    {
        /// <summary>
        /// An initializer with no initialization arguments.
        /// </summary>
        public static readonly AsyncInitializer<TFrom, TTo> Empty = new AsyncInitializer<TFrom, TTo>(StaticArgumentsStrategy.Empty);

        private readonly IArgumentsStrategy _arguments;

        /// <summary>
        /// Creates a new initializer with typed initialization arguments.
        /// </summary>
        /// <param name="args">Arguments.</param>
        public AsyncInitializer(AsyncInitArgs args)
            : this(new StaticArgumentsStrategy(args))
        {
        }

        /// <summary>
        /// Creates a new initializer with the specified arguments strategy.
        /// </summary>
        /// <param name="arguments">Arguments strategy.</param>
        internal AsyncInitializer(IArgumentsStrategy arguments)
        {
            this._arguments = arguments;
        }

        /// <summary>
        /// Gets an awaiter used to await the initialization.
        /// </summary>
{'fraction_non_alphanumeric': 0.11584800741427248, 'fraction_numerical': 0.0, 'mean_word_length': 2.455709711846318, 'pattern_counts': {'":': 0, '<': 47, '<?xml version=': 0, '>': 47, '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': '6807634', 'n_tokens_mistral': 818, 'n_tokens_neox': 810, 'n_words': 210}