<commit_before>﻿using System;
using System.Collections.Generic;

namespace Natasha
{
    public static class TypeExtension
    {
        public static bool IsImplementFrom(this Type type,Type iType)
        {
            HashSet<Type> types = new HashSet<Type>(type.GetInterfaces());
            return types.Contains(iType);
        }
        public static bool IsImplementFrom<T>(this Type type)
        {
            HashSet<Type> types = new HashSet<Type>(type.GetInterfaces());
            return types.Contains(typeof(T));
        }

        public static List<Type> GetAllGenericTypes(this Type type)
        {
            List<Type> result = new List<Type>();
            result.Add(type);
            if (type.IsGenericType && type.FullName != null)
            {
                foreach (var item in type.GetGenericArguments())
                {
                    result.AddRange(item.GetAllGenericTypes());
                }
            }
            return result;
        }

        public static List<Type> GetAllGenericTypes<T>()
        {
            return typeof(T).GetAllGenericTypes();
        }


        public static string GetAvailableName(this Type type)
        {
            return AvailableNameReverser.GetName(type);
        }

        public static string GetDevelopName(this Type type)
        {
            return ClassNameReverser.GetName(type);
        }

        public static Type With(this Type type,params Type[] types)
        {
            return type.MakeGenericType(types);
        }


        public static bool IsOnceType(this Type type)
        {
            if (type==null){return false;}
            return type.IsPrimitive
                           || type == typeof(string)
                           || type == typeof(Delegate)
                           || type.IsEnum
                           || (!type.IsClass && !type.IsInterface);
        }
    }
}<commit_msg>Update TypeExtension.cs<commit_after>﻿using System;
using System.Collections.Generic;

namespace Natasha
{
    public static class TypeExtension
    {
        public static bool IsImplementFrom(this Type type,Type iType)
        {
            HashSet<Type> types = new HashSet<Type>(type.GetInterfaces());
            return types.Contains(iType);
        }
        public static bool IsImplementFrom<T>(this Type type)
        {
            HashSet<Type> types = new HashSet<Type>(type.GetInterfaces());
            return types.Contains(typeof(T));
        }

        public static List<Type> GetAllGenericTypes(this Type type)
        {
            List<Type> result = new List<Type>();
            result.Add(type);
            if (type.IsGenericType && type.FullName != null)
            {
                foreach (var item in type.GetGenericArguments())
                {
                    result.AddRange(item.GetAllGenericTypes());
                }
            }
            return result;
        }

        public static List<Type> GetAllGenericTypes<T>()
        {
            return typeof(T).GetAllGenericTypes();
        }


        public static string GetAvailableName(this Type type)
        {
            return AvailableNameReverser.GetName(type);
        }

        public static string GetDevelopName(this Type type)
        {
            return ClassNameReverser.GetName(type);
        }

        public static Type With(this Type type,params Type[] types)
        {
            return type.MakeGenericType(types);
        }


        public static bool IsOnceType(this Type type)
        {
            if (type==null){return false;}
            return type.IsPrimitive
                           || type == typeof(string)
                           || type == typeof(Delegate)
                           || type.IsEnum
                           || type == typeof(object)
                           || (!type.IsClass && !type.IsInterface);
        }
    }
}
{'fraction_non_alphanumeric': 0.09249295413784268, 'fraction_numerical': 0.0, 'mean_word_length': 1.5650459921156372, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5040195', 'n_tokens_mistral': 977, 'n_tokens_neox': 953, 'n_words': 219}