<commit_before>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using static LanguageExt.Prelude;

namespace LanguageExt
{
    class Reflect
    {
        public static IEnumerable<FieldInfo> GetPublicInstanceFields<A>(params Type[] excludeAttrs)
        {
            var excludeAttrsSet = toSet(excludeAttrs.Map(a => a.Name));
            var publicFields = typeof(A)
                .GetTypeInfo()
                .GetAllFields()
#if !COREFX13
                .OrderBy(f => f.MetadataToken)
#endif
                .Where(f =>
                {
                    if (!f.IsPublic || f.IsStatic) return false;
                    if (toSet(f.CustomAttributes.Map(a => a.AttributeType.Name)).Intersect(excludeAttrsSet).Any()) return false;
                    return true;
                });

            var publicPropNames = typeof(A)
                                    .GetTypeInfo()
                                    .GetAllProperties()
#if !COREFX13
                                    .OrderBy(p => p.MetadataToken)
#endif
                                    .Where(p => p.CanRead && p.GetMethod.IsPublic)
                                    .Where(p => !toSet(p.CustomAttributes.Map(a => a.AttributeType.Name)).Intersect(excludeAttrsSet).Any())
                                    .ToArray();

            var backingFields = typeof(A)
                                    .GetTypeInfo()
                                    .GetAllFields()
#if !COREFX13
                                    .OrderBy(p => p.MetadataToken)
#endif
                                    .Where(f => f.IsPrivate &&
                                                publicPropNames.Exists(p => f.Name.StartsWith($"<{p.Name}>")))
                                    .ToArray();

            return Enumerable.Concat(publicFields, backingFields);<commit_msg>Filter out static properties<commit_after>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using static LanguageExt.Prelude;

namespace LanguageExt
{
    class Reflect
    {
        public static IEnumerable<FieldInfo> GetPublicInstanceFields<A>(params Type[] excludeAttrs)
        {
            var excludeAttrsSet = toSet(excludeAttrs.Map(a => a.Name));
            var publicFields = typeof(A)
                .GetTypeInfo()
                .GetAllFields()
#if !COREFX13
                .OrderBy(f => f.MetadataToken)
#endif
                .Where(f =>
                {
                    if (!f.IsPublic || f.IsStatic) return false;
                    if (toSet(f.CustomAttributes.Map(a => a.AttributeType.Name)).Intersect(excludeAttrsSet).Any()) return false;
                    return true;
                });

            var publicPropNames = typeof(A)
                                    .GetTypeInfo()
                                    .GetAllProperties()
#if !COREFX13
                                    .OrderBy(p => p.MetadataToken)
#endif
                                    .Where(p => p.CanRead && p.GetMethod.IsPublic && !p.GetAccessors(true)[0].IsStatic)
                                    .Where(p => !toSet(p.CustomAttributes.Map(a => a.AttributeType.Name)).Intersect(excludeAttrsSet).Any())
                                    .ToArray();

            var backingFields = typeof(A)
                                    .GetTypeInfo()
                                    .GetAllFields()
#if !COREFX13
                                    .OrderBy(p => p.MetadataToken)
#endif
                                    .Where(f => f.IsPrivate &&
                                                publicPropNames.Exists(p => f.Name.StartsWith($"<{p.Name}>")))
                                    .ToArray();

            return Enumerable.Concat(publicFields, backingFields);
{'fraction_non_alphanumeric': 0.1044502617801047, 'fraction_numerical': 0.0034031413612565444, 'mean_word_length': 1.2609467455621302, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 31, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 26, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4133275', 'n_tokens_mistral': 982, 'n_tokens_neox': 925, 'n_words': 169}