<commit_before># -*- mode:python -*-

import flask
import json
import logging
import copy
import datetime
import inflection
import urllib

from flask import Flask, render_template, request, redirect, jsonify, abort, session
from cask import Entity

import toolbox
from .demo import demo_dashboard, gbc_demo_dashboard
from .model import *

# =============================================================================
# Setup
# =============================================================================

log = logging.getLogger(__name__)

app = Flask(__name__)
app.config.from_pyfile('config.py')
app.secret_key = '<KEY>'

mgr = cask.web.WebManagerAdapter(DashboardManager(app.config['DASHBOARD_DATADIR']))
env = toolbox.CLUSTO.environment(app.config['ENVIRONMENT_NAME'])

# =============================================================================
# API Helpers
# =============================================================================

def _get_entities(cls):
    pattern = request.args.get('filter', '*')
    return mgr.load_all(cls, pattern=pattern)

def _to_json(entity):
    if not isinstance(entity, Entity):
        return entity
    json = entity.to_json()
#    json['uri'] = entity_uri(entity, 'api')
#    json['data_uri'] = entity_uri(entity, 'data')<commit_msg>Fix import<commit_after># -*- mode:python -*-

import flask
import json
import logging
import copy
import datetime
import inflection
import urllib

from flask import Flask, render_template, request, redirect, jsonify, abort, session
from cask import Entity

import toolbox
from .model import *

# =============================================================================
# Setup
# =============================================================================

log = logging.getLogger(__name__)

app = Flask(__name__)
app.config.from_pyfile('config.py')
app.secret_key = '<KEY>'

mgr = cask.web.WebManagerAdapter(DashboardManager(app.config['DASHBOARD_DATADIR']))
env = toolbox.CLUSTO.environment(app.config['ENVIRONMENT_NAME'])

# =============================================================================
# API Helpers
# =============================================================================

def _get_entities(cls):
    pattern = request.args.get('filter', '*')
    return mgr.load_all(cls, pattern=pattern)

def _to_json(entity):
    if not isinstance(entity, Entity):
        return entity
    json = entity.to_json()
#    json['uri'] = entity_uri(entity, 'api')
#    json['data_uri'] = entity_uri(entity, 'data')
{'fraction_non_alphanumeric': 0.3399523431294678, 'fraction_numerical': 0.0, 'mean_word_length': 6.871875, 'pattern_counts': {'":': 0, '<': 5, '<?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': '4859922', 'n_tokens_mistral': 677, 'n_tokens_neox': 646, 'n_words': 149}