<commit_before>
import sys, os, glob, time, datetime, stat, json, tempfile, shutil, psutil, random, urlparse, getpass
import h2o_args
import h2o_nodes
import h2o_sandbox

# print "h2o_test"
# generic python object generation from json object.
class OutputObj(object):
    def __iter__(self):
        for attr, value in self.__dict__.iteritems():
            yield attr, value

    def __init__(self, output, name, noPrint=False):
        assert isinstance(output, dict), "top level json given to OutputObj should be dict"
        for k1,v1 in output.iteritems():
            # let's go 2 levels deep
            # list/dict/value should be only choices
            if not isinstance(v1, dict):
                setattr(self, k1, v1) # achieves self.k1 = v
            else:
                for k2,v2 in v1.iteritems():
                    if isinstance(v2, dict):
                        print "Warning: the json object has dict. at 3rd level" +\
                            "Keeping those as json-like dicts. never check at >3" 
                        setattr(self.k1, k2, v2) # achieves self.k1.k2 = v2
<commit_msg>temp hack to fix the problem cliff was seeing with my json obj inte<commit_after>
import sys, os, glob, time, datetime, stat, json, tempfile, shutil, psutil, random, urlparse, getpass
import h2o_args
import h2o_nodes
import h2o_sandbox

# print "h2o_test"
# generic python object generation from json object.
class OutputObj(object):
    def __iter__(self):
        for attr, value in self.__dict__.iteritems():
            yield attr, value

    def __init__(self, output, name, noPrint=False):
        assert isinstance(output, dict), "top level json given to OutputObj should be dict"
        for k1,v1 in output.iteritems():
            # let's go 2 levels deep
            # list/dict/value should be only choices
            setattr(self, k1, v1) # achieves self.k1 = v
            if 1==0:
                if not isinstance(v1, dict):
                    setattr(self, k1, v1) # achieves self.k1 = v
                else:
                    for k2,v2 in v1.iteritems():
                        if isinstance(v2, dict):
                            print "Warning: the json object has dict. at 3rd level" +\
                                "Keeping those as json-like dicts. never check at >3" 
                            setattr(k1, k2, v2) # achieves self.k1.k2 = v2

{'fraction_non_alphanumeric': 0.08483075637275386, 'fraction_numerical': 0.02131216046803176, 'mean_word_length': 1.9702233250620347, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '1303743', 'n_tokens_mistral': 710, 'n_tokens_neox': 679, 'n_words': 253}