<commit_before>"""Module for shared playground functions."""

import httplib
import logging
import os

from mimic.__mimic import common
from mimic.__mimic import mimic

import model
import settings

from google.appengine.api import app_identity
from google.appengine.api import namespace_manager
from google.appengine.api import urlfetch


# 10 minutes
MEMCACHE_TIME = 3600


def e(msg, *args, **kwargs):
  if isinstance(msg, basestring):
    if args or kwargs:
      msg = msg.format(*args, **kwargs)
  raise RuntimeError(repr(msg))


def w(msg, *args, **kwargs):
  if isinstance(msg, basestring):
    if args or kwargs:
      msg = msg.format(*args, **kwargs)
  logging.warning('##### {0}'.format(repr(msg)))


class FetchError(urlfetch.Error):
  """URL Fetch error for response code != 200."""

  def __init__(self, url, response):
    self.url = url
    self.response = response
<commit_msg>shared.i helper method<commit_after>"""Module for shared playground functions."""

import httplib
import logging
import os

from mimic.__mimic import common
from mimic.__mimic import mimic

import model
import settings

from google.appengine.api import app_identity
from google.appengine.api import namespace_manager
from google.appengine.api import urlfetch


# 10 minutes
MEMCACHE_TIME = 3600


def e(msg, *args, **kwargs):
  if isinstance(msg, basestring):
    if args or kwargs:
      msg = msg.format(*args, **kwargs)
  raise RuntimeError(repr(msg))


def i(msg, *args, **kwargs):
  if isinstance(msg, basestring):
    if args or kwargs:
      msg = msg.format(*args, **kwargs)
  logging.info('@@@@@ {0}'.format(repr(msg)))


def w(msg, *args, **kwargs):
  if isinstance(msg, basestring):
    if args or kwargs:
      msg = msg.format(*args, **kwargs)
  logging.warning('##### {0}'.format(repr(msg)))


class FetchError(urlfetch.Error):
  """URL Fetch error for response code != 200."""

  def __init__(self, url, response):
    self.url = url
    self.response = response

{'fraction_non_alphanumeric': 0.12620375063355296, 'fraction_numerical': 0.010643689812468323, 'mean_word_length': 4.335135135135135, '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': '5843700', 'n_tokens_mistral': 650, 'n_tokens_neox': 615, 'n_words': 194}