<commit_before>
import webapp2
from google.appengine.ext import blobstore
from google.appengine.ext.webapp import blobstore_handlers
from google.appengine.ext.webapp import template

import logging
import storage

class FormHandler( webapp2.RequestHandler ):
	def get( self ):
		submitUrl = "/beta/upload/submit/"
		submitUrl = blobstore.create_upload_url( submitUrl );
		
		path = "./templates/upload.html"
		values = \
		{
			'url' : submitUrl
		}
		self.response.write( template.render( path, values ) )
		
		
class UploadHandler( blobstore_handlers.BlobstoreUploadHandler ):
	def post( self ):
		
		existingFile = storage.FindBetaKey()
		logging.debug( "existingFile: " + str( existingFile ) )
		logging.debug( "existingFile id: " + str( existingFile.id ) )
		if existingFile is not None:
			blobstore.delete( existingFile.id.key() )
		
		blob_info = self.get_uploads()[ 0 ]
		newFile = storage.CreateBetaKey( blob_info.key() )
		newFile.put()
		self.redirect( "/beta" )

class DownloadHandler( blobstore_handlers.BlobstoreDownloadHandler ):
	def get( self ):
		existingFile = storage.FindBetaKey()
		if existingFile is not None:
			if blobstore.get( existingFile.id.key() ):
				self.send_blob( existingFile.id, save_as = True )<commit_msg>Fixed bug in beta upload<commit_after>
import webapp2
from google.appengine.ext import blobstore
from google.appengine.ext.webapp import blobstore_handlers
from google.appengine.ext.webapp import template

import logging
import storage

class FormHandler( webapp2.RequestHandler ):
	def get( self ):
		submitUrl = "/beta/upload/submit/"
		submitUrl = blobstore.create_upload_url( submitUrl );
		
		path = "./templates/upload.html"
		values = \
		{
			'url' : submitUrl
		}
		self.response.write( template.render( path, values ) )
		
		
class UploadHandler( blobstore_handlers.BlobstoreUploadHandler ):
	def post( self ):
		
		existingFile = storage.FindBetaKey()
		if existingFile is not None:
			logging.debug( "existingFile: " + str( existingFile ) )
			logging.debug( "existingFile id: " + str( existingFile.id ) )
			blobstore.delete( existingFile.id.key() )
		
		blob_info = self.get_uploads()[ 0 ]
		newFile = storage.CreateBetaKey( blob_info.key() )
		newFile.put()
		self.redirect( "/beta/" )

class DownloadHandler( blobstore_handlers.BlobstoreDownloadHandler ):
	def get( self ):
		existingFile = storage.FindBetaKey()
		if existingFile is not None:
			if blobstore.get( existingFile.id.key() ):
				self.send_blob( existingFile.id, save_as = True )
{'fraction_non_alphanumeric': 0.11062300319488817, 'fraction_numerical': 0.0023961661341853034, 'mean_word_length': 4.175619834710743, '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': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2516490', 'n_tokens_mistral': 865, 'n_tokens_neox': 780, 'n_words': 188}