<commit_before>from flask import make_response, request, render_template, current_app, g, \
    Blueprint, abort
from flask.ext.cache import Cache
from functools import update_wrapper
import os
import re
import math
from datetime import date, datetime, timedelta
from dateutil.parser import parse
from datetime_truncate import truncate
import time
import json
from sqlalchemy import func, distinct, Column, Float, Table
from sqlalchemy.exc import NoSuchTableError
from sqlalchemy.types import NullType
from sqlalchemy.sql.expression import cast
from geoalchemy2 import Geometry
from operator import itemgetter
from itertools import groupby
from cStringIO import StringIO
import csv
from shapely.wkb import loads
from shapely.geometry import box, asShape
from collections import OrderedDict
from urlparse import urlparse
from hashlib import md5

from plenario.models import MasterTable, MetaTable
from plenario.database import session, app_engine as engine, Base
from plenario.utils.helpers import get_socrata_data_info, slugify, increment_datetime_aggregate
from plenario.tasks import add_dataset
from plenario.settings import CACHE_CONFIG

cache = Cache(config=CACHE_CONFIG)

API_VERSION = '/v1'
RESPONSE_LIMIT = 500
CACHE_TIMEOUT = 60*60*24*7
VALID_DATA_TYPE = ['csv', 'json']
VALID_AGG = ['day', 'week', 'month', 'quarter', 'year']
WEATHER_COL_LOOKUP = {
    'daily': {
        'temp_lo': 'temp_min',
        'temp_hi': 'temp_max',
        'temp_avg': 'temp_avg',
        'precip_amount': 'precip_total',
    },
    'hourly': {
        'temp_lo': 'drybulb_fahrenheit',
        'temp_hi': 'drybulb_fahrenheit',
        'temp_avg': 'drybulb_fahrenheit',
        'precip_amount': 'hourly_precip',
    },
}

api = Blueprint('api', __name__)
dthandler = lambda obj: obj.isoformat() if isinstance(obj, date) else None

def crossdomain(origin=None, methods=None, headers=None,
                max_age=21600, attach_to_all=True,
                automatic_options=True): # pragma: no cover
    if methods is not None:
        methods = ', '.join(sorted(x.upper() for x in methods))<commit_msg>Lowered cache timeout. Raised query limit<commit_after>from flask import make_response, request, render_template, current_app, g, \
    Blueprint, abort
from flask.ext.cache import Cache
from functools import update_wrapper
import os
import re
import math
from datetime import date, datetime, timedelta
from dateutil.parser import parse
from datetime_truncate import truncate
import time
import json
from sqlalchemy import func, distinct, Column, Float, Table
from sqlalchemy.exc import NoSuchTableError
from sqlalchemy.types import NullType
from sqlalchemy.sql.expression import cast
from geoalchemy2 import Geometry
from operator import itemgetter
from itertools import groupby
from cStringIO import StringIO
import csv
from shapely.wkb import loads
from shapely.geometry import box, asShape
from collections import OrderedDict
from urlparse import urlparse
from hashlib import md5

from plenario.models import MasterTable, MetaTable
from plenario.database import session, app_engine as engine, Base
from plenario.utils.helpers import get_socrata_data_info, slugify, increment_datetime_aggregate
from plenario.tasks import add_dataset
from plenario.settings import CACHE_CONFIG

cache = Cache(config=CACHE_CONFIG)

API_VERSION = '/v1'
RESPONSE_LIMIT = 1000
CACHE_TIMEOUT = 60*60*6
VALID_DATA_TYPE = ['csv', 'json']
VALID_AGG = ['day', 'week', 'month', 'quarter', 'year']
WEATHER_COL_LOOKUP = {
    'daily': {
        'temp_lo': 'temp_min',
        'temp_hi': 'temp_max',
        'temp_avg': 'temp_avg',
        'precip_amount': 'precip_total',
    },
    'hourly': {
        'temp_lo': 'drybulb_fahrenheit',
        'temp_hi': 'drybulb_fahrenheit',
        'temp_avg': 'drybulb_fahrenheit',
        'precip_amount': 'hourly_precip',
    },
}

api = Blueprint('api', __name__)
dthandler = lambda obj: obj.isoformat() if isinstance(obj, date) else None

def crossdomain(origin=None, methods=None, headers=None,
                max_age=21600, attach_to_all=True,
                automatic_options=True): # pragma: no cover
    if methods is not None:
        methods = ', '.join(sorted(x.upper() for x in methods))
{'fraction_non_alphanumeric': 0.08619047619047619, 'fraction_numerical': 0.008333333333333333, 'mean_word_length': 4.654104979811574, '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': '1626018', 'n_tokens_mistral': 1332, 'n_tokens_neox': 1276, 'n_words': 398}