<commit_before>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;

namespace Maverick
{
    public class MethodCaptureDelegator
    {
        public MethodCaptureDelegator(object target)
        {
            _target = target;
            Type targetGetType = _target.GetType();
            _targetType = ((_static = (targetGetType == typeof(LuaInterface.ProxyType))) ? ((LuaInterface.ProxyType)_target).UnderlyingSystemType : targetGetType);
        }

        readonly object _target;
        readonly Type _targetType;
        string _methodName = null;
        bool _static;

        public object this[string idx]
        {
            get
            {
                if (_methodName != null) { throw new InvalidOperationException("Method already set."); }
                _methodName = idx;
                return this;
            }
        }       

        public object go(object[] args)
        {
            args = args.Take(args.Length-1).ToArray();
            return new Func<object>(() => {
                MethodBase method = null;
                
                if (!_static) { args = args.Skip(1).ToArray(); }

                int i = 0;
                    do
                    {

                        if (i > args.Length) { throw new Exception("Could not resolve method " + _methodName + " from type " + _targetType.ToString() + " target " + _target.ToString()); }
                        int iters = 0;
                        method = _targetType.GetMethod(_methodName, args.Select((x) =>
                        {
                            Type type = x.GetType();
                            if (type == typeof(double) && iters <= i) { args[iters] = Convert.ToInt32(args[iters]); type = typeof(int); }
                            iters++;
                            return type;
                        }).ToArray());
                        i++;
                    }
                    while (method == null);
               
                return method.Invoke(_target, args); 
            
            });
        
        }
        public object go()
        {
            return go(null);
        }


    }
}
<commit_msg>Update MethodCaptureDelegator.cs<commit_after>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;

namespace Maverick
{
    public class MethodCaptureDelegator
    {
        public MethodCaptureDelegator(object target)
        {
            _target = target;
            Type targetGetType = _target.GetType();
            _targetType = ((_static = (targetGetType == typeof(LuaInterface.ProxyType))) ? ((LuaInterface.ProxyType)_target).UnderlyingSystemType : targetGetType);
        }

        readonly object _target;
        readonly Type _targetType;
        string _methodName = null;
        bool _static;

        public object this[string idx]
        {
            get
            {
                if (_methodName != null) { throw new InvalidOperationException("Method already set."); }
                _methodName = idx;
                return this;
            }
        }       

        public object go(object[] args)
        {
            if (args == null) { args = new object[] { }; } 
            else
            { 
                args = args.Take(args.Length-1).ToArray();
            }
            
            return new Func<object>(() => {
                MethodBase method = null;
                
                if (!_static) { args = args.Skip(1).ToArray(); }

                int i = 0;
                    do
                    {

                        if (i > args.Length) { throw new Exception("Could not resolve method " + _methodName + " from type " + _targetType.ToString() + " target " + _target.ToString()); }
                        int iters = 0;
                        method = _targetType.GetMethod(_methodName, args.Select((x) =>
                        {
                            Type type = x.GetType();
                            if (type == typeof(double) && iters <= i) { args[iters] = Convert.ToInt32(args[iters]); type = typeof(int); }
                            iters++;
                            return type;
                        }).ToArray());
                        i++;
                    }
                    while (method == null);
               
                return method.Invoke(_target, args); 
            
            });
        
        }
        public object go()
        {
            return go(null);
        }


    }
}

{'fraction_non_alphanumeric': 0.10030461270670148, 'fraction_numerical': 0.0026109660574412533, 'mean_word_length': 1.2197006277160791, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 11, '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': '6506560', 'n_tokens_mistral': 1151, 'n_tokens_neox': 1091, 'n_words': 260}