<commit_before>#!/usr/bin/python2.4
#
# Copyright 2008 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""Tests that the core module functionality is present and functioning."""

import httplib
import logging
import os
import unittest
import sys
import threading

from django import http
from django import test
from django.test import client
from django.conf import settings

from google.appengine.tools import dev_appserver
from google.appengine.tools import dev_appserver_login

PORT = 8000
ROOT_PATH = os.path.dirname(os.path.dirname(os.path.dirname(__file__)))
APP_ID = 'google-app-engine-django'
LOGIN_URL = '/_ah/login'

# ########
# NOTE: All this stuff is expected to break with SDK updates
# TODO: get an interface for this into the SDK proper
# ########

def start_server(root_path=ROOT_PATH, port=PORT, app_id=APP_ID):
  dev_appserver.ApplicationLoggingHandler.InitializeTemplates(
      'HEADER', 'SCRIPT', 'MIDDLE', 'FOOTER')
  dev_appserver.SetupStubs(app_id,
                           login_url=LOGIN_URL,
                           datastore_path='/dev/null',
                           history_path='/dev/null',
                           clear_datastore=False)
  server = dev_appserver.CreateServer(ROOT_PATH,
                                      LOGIN_URL,
                                      port,
                                      '/unused/templates/path')

  server_thread = threading.Thread(target=server.serve_forever)
  server_thread.setDaemon(True)
  server_thread.start()
  return port

def RetrieveURL(method,
                host_port,
                relative_url,
                user_info=None,
                body=None,
                extra_headers=[]):<commit_msg>Fix Compatibility with App Engine SDK 1.3.0<commit_after>#!/usr/bin/python2.4
#
# Copyright 2008 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""Tests that the core module functionality is present and functioning."""

import httplib
import logging
import os
import unittest
import sys
import threading

from django import http
from django import test
from django.test import client
from django.conf import settings

from google.appengine.tools import dev_appserver
from google.appengine.tools import dev_appserver_login

PORT = 8000
ROOT_PATH = os.path.dirname(os.path.dirname(os.path.dirname(__file__)))
APP_ID = 'google-app-engine-django'
LOGIN_URL = '/_ah/login'

# ########
# NOTE: All this stuff is expected to break with SDK updates
# TODO: get an interface for this into the SDK proper
# ########

def start_server(root_path=ROOT_PATH, port=PORT, app_id=APP_ID):
  dev_appserver.ApplicationLoggingHandler.InitializeTemplates(
      'HEADER', 'SCRIPT', 'MIDDLE', 'FOOTER')
  dev_appserver.SetupStubs(app_id,
                           login_url=LOGIN_URL,
                           datastore_path='/dev/null',
                           history_path='/dev/null',
                           blobstore_path='/dev/null',
                           clear_datastore=False)
  server = dev_appserver.CreateServer(ROOT_PATH,
                                      LOGIN_URL,
                                      port,
                                      '/unused/templates/path')

  server_thread = threading.Thread(target=server.serve_forever)
  server_thread.setDaemon(True)
  server_thread.start()
  return port

def RetrieveURL(method,
                host_port,
                relative_url,
                user_info=None,
                body=None,
                extra_headers=[]):
{'fraction_non_alphanumeric': 0.08441988950276243, 'fraction_numerical': 0.006850828729281768, 'mean_word_length': 2.6529459241323647, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6333519', 'n_tokens_mistral': 1266, 'n_tokens_neox': 1219, 'n_words': 386}