<commit_before>import csv, re, json
from django.contrib.admin.views.decorators import staff_member_required
from django.contrib.auth.decorators import login_required
from django.shortcuts import render_to_response
from django.http import HttpResponse, HttpResponseBadRequest, HttpResponseNotAllowed
from django.template import RequestContext
from django.conf import settings
from imp5.sqladmin import dbx
import django.db.models.fields
from dojango.decorators import json_response, __prepare_json_ret
from dojango.util import json_encode
import datetime

TABLE_NAME_SEPARATOR='/'

#@staff_member_required
#def table(request, db, table):
#    print "Request: " + str(request)
#    conn = dbx.Conn()
#    data = conn.select(table, limit=100)
#    table_obj = conn.db(db).table(table)
#    context = {
#        'root_path': '/',
#        'table': table_obj, 'data': data, 'table_name': table, 'db_name': db,
#    }
#
#    return render_to_response("sqladmin/table.html", context, context_instance=RequestContext(request))

def debug(*msg):
    import logging
    logging.debug(''.join(msg))

@staff_member_required
@json_response
def database_tree(request):
    conn = dbx.Conn()
    return {
      'identifier': 'id',<commit_msg>Better comply with PEP 8 on imports<commit_after>import csv
import datetime
import json
import re

from django.conf import settings
from django.contrib.admin.views.decorators import staff_member_required
from django.contrib.auth.decorators import login_required
import django.db.models.fields
from django.http import HttpResponse, HttpResponseBadRequest, HttpResponseNotAllowed
from django.shortcuts import render_to_response
from django.template import RequestContext

from dojango.decorators import json_response, __prepare_json_ret
from dojango.util import json_encode

from imp5.sqladmin import dbx

TABLE_NAME_SEPARATOR='/'

#@staff_member_required
#def table(request, db, table):
#    print "Request: " + str(request)
#    conn = dbx.Conn()
#    data = conn.select(table, limit=100)
#    table_obj = conn.db(db).table(table)
#    context = {
#        'root_path': '/',
#        'table': table_obj, 'data': data, 'table_name': table, 'db_name': db,
#    }
#
#    return render_to_response("sqladmin/table.html", context, context_instance=RequestContext(request))

def debug(*msg):
    import logging
    logging.debug(''.join(msg))

@staff_member_required
@json_response
def database_tree(request):
    conn = dbx.Conn()
    return {
      'identifier': 'id',
{'fraction_non_alphanumeric': 0.10758731433159374, 'fraction_numerical': 0.0036130068245684463, 'mean_word_length': 5.048543689320389, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '5728440', 'n_tokens_mistral': 763, 'n_tokens_neox': 754, 'n_words': 189}