<commit_before>using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Reflection;

namespace Node.Net.Json.Internal
{
    class JsonReader
    {
        private static JsonReader _default = new JsonReader() { AutoResolveTypes = true };
        public static JsonReader Default { get { return _default; } }

        public static object Load(string value)
        {
            return Default.Read(value);
        }
        public static object Load(string value, IDictionary dictionary)
        {
            IDictionary d = Load(value) as IDictionary;
            dictionary.Clear();
            Collections.Copier.Copy(d, dictionary);
            return dictionary;
        }
        public static object Load(Stream stream)
        {
            return Default.Read(stream);
        }
        public static object Load(Stream stream, IDictionary dictionary)
        {
            IDictionary d = Load(stream) as IDictionary;
            dictionary.Clear();
            Collections.Copier.Copy(d, dictionary);
            return dictionary;
        }

        public Type DefaultListType = typeof(List<object>);
        public Type DefaultDictionaryType = typeof(Dictionary<string, dynamic>);
        public Dictionary<string, Type> Types = new Dictionary<string, Type>();
        public void AddTypes(Assembly assembly)
        {
            foreach (Type type in assembly.GetTypes())
            {
                if (!Types.ContainsKey(type.FullName))
                {
                    Types.Add(type.FullName, type);
                }
            }
        }
        public bool AutoResolveTypes = false;
        public object Read(string value)
        {
            if (File.Exists(value))
            {
                using (StreamReader reader = new StreamReader(value))
                {<commit_msg>'1.0.9'<commit_after>using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Reflection;

namespace Node.Net.Json.Internal
{
    class JsonReader
    {
        private static JsonReader _default = new JsonReader() { AutoResolveTypes = true };
        public static JsonReader Default { get { return _default; } }

        public static object Load(string value)
        {
            return Default.Read(value);
        }
        public static object Load(string value, IDictionary dictionary)
        {
            IDictionary d = Load(value) as IDictionary;
            dictionary.Clear();
            Collections.Copier.Copy(d, dictionary);
            return dictionary;
        }
        public static object Load(Stream stream)
        {
            return Default.Read(stream);
        }
        public static object Load(Stream stream, IDictionary dictionary)
        {
            IDictionary d = Load(stream) as IDictionary;
            dictionary.Clear();
            Collections.Copier.Copy(d, dictionary);
            return dictionary;
        }

        public Type DefaultListType = typeof(List<object>);
        public Type DefaultDictionaryType = typeof(Dictionary<string, dynamic>);
        public Dictionary<string, Type> Types = new Dictionary<string, Type>();
        public void AddTypes(Assembly assembly)
        {
            foreach (Type type in assembly.GetTypes())
            {
                if (!Types.ContainsKey(type.FullName))
                {
                    Types.Add(type.FullName, type);
                }
            }
        }
        public bool AutoResolveTypes = false;
        public object Read(string value)
        {
            bool isJson = false;
            if (value.Length > 0 && (value[0] == '{' || value[0] == '[')) isJson = true;
            if (!isJson && File.Exists(value))
            {
                using (StreamReader reader = new StreamReader(value))
                {
{'fraction_non_alphanumeric': 0.08793774319066149, 'fraction_numerical': 0.0015564202334630351, 'mean_word_length': 1.854182087342709, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 12, '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': '912526', 'n_tokens_mistral': 922, 'n_tokens_neox': 908, 'n_words': 253}