<commit_before>import os

from google.appengine.api import namespace_manager
from google.appengine.dist import use_library

import config

## Configure Django
os.environ['DJANGO_SETTINGS_MODULE'] = config.DJANGO_CONFIG_MODULE
use_library('django', '1.2')
# # Need to force import of settings, see http://stackoverflow.com/questions/5845607/
#from django.conf import settings

def namespace_manager_default_namespace_for_request():
  """Must return the default namespace for a given request."""
  #google_apps_namespace does not include subdomain -- so not suitable for us
  #return namespace_manager.google_apps_namespace()
  return os.environ['SERVER_NAME']

# Enable google appstats
# http://code.google.com/appengine/docs/python/tools/appstats.html
def webapp_add_wsgi_middleware(app):
    from google.appengine.ext.appstats import recording
    app = recording.appstats_wsgi_middleware(app)
    return app



<commit_msg>Modified namespace definition to exclude app version<commit_after>import os

from google.appengine.api import namespace_manager
from google.appengine.dist import use_library

import config

## Configure Django
os.environ['DJANGO_SETTINGS_MODULE'] = config.DJANGO_CONFIG_MODULE
use_library('django', '1.2')
# # Need to force import of settings, see http://stackoverflow.com/questions/5845607/
#from django.conf import settings

def namespace_manager_default_namespace_for_request():
  """Must return the default namespace for a given request."""
  #google_apps_namespace does not include subdomain -- so not suitable for us
  #On the other hand, server name might include a version number -- so check for that
  version = os.environ['CURRENT_VERSION_ID'].split('.')[0]
  server = os.environ['SERVER_NAME']
  if server.startswith(version):
    return server[len(version)+1:]
  return server

# Enable google appstats
# http://code.google.com/appengine/docs/python/tools/appstats.html
def webapp_add_wsgi_middleware(app):
    from google.appengine.ext.appstats import recording
    app = recording.appstats_wsgi_middleware(app)
    return app




{'fraction_non_alphanumeric': 0.09042553191489362, 'fraction_numerical': 0.009671179883945842, 'mean_word_length': 5.425465838509317, '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': '1957154', 'n_tokens_mistral': 619, 'n_tokens_neox': 599, 'n_words': 165}