<commit_before>import time

import webapp2
from google.appengine.api import channel

import config
import web.forms as forms
from web.basehandler import BaseHandler
from web.basehandler import user_required, admin_required
from web.models.models import User, Flavor, Image

class AdminHandler(BaseHandler):
	@user_required
	@admin_required
	def get(self):
		# lookup user's auth info
		user_info = User.get_by_id(long(self.user_id))

		params = {}
		return self.render_template('admin/status.html', **params)


class UsersHandler(BaseHandler):
	@user_required
	@admin_required
	def get(self):
		# lookup user's auth info
		user_info = User.get_by_id(long(self.user_id))

		# look up usrs
		users = User.get_all()

		params = {
			'users': users
		}

		return self.render_template('admin/users.html', **params)


class FlavorsListHandler(BaseHandler):
	@user_required
	@admin_required
	def get(self):
		# lookup user's auth info
		user_info = User.get_by_id(long(self.user_id))

		# look up user's articles
		flavors = Flavor.get_all()

		# setup channel to do page refresh
		channel_token = user_info.key.urlsafe()
		refresh_channel = channel.create_channel(channel_token)
		params = {
			'flavors': flavors, 
			'refresh_channel': refresh_channel,
			'channel_token': channel_token 
		}

		return self.render_template('admin/flavors.html', **params)

	@user_required
	@admin_required
	def post(self):
		if not self.form.validate():          
			self.add_message("The form did not validate.", 'error')
			return self.get()

		# load values out of the form
		name = self.form.name.data.strip()
		description = self.form.description.data.strip()
		vpus = self.form.vpus.data
		memory = self.form.memory.data
		disk = self.form.disk.data
		network_down = self.form.network_down.data
		network_up = self.form.network_up.data
		rate = self.form.rate.data

		# save the flavor in our database
		flavor = Flavor(
			name = name,
			description = description,
			vpus = vpus,
			memory = memory,
			disk = disk,
			network_down = network_down,
			network_up = network_up,
			rate = rate, # current market rate
			launches = 0, # number of total launches
			hot = 2 # suggest minimum two instance addresses hot<commit_msg>remove description from flavor admin handler<commit_after>import time

import webapp2
from google.appengine.api import channel

import config
import web.forms as forms
from web.basehandler import BaseHandler
from web.basehandler import user_required, admin_required
from web.models.models import User, Flavor, Image

class AdminHandler(BaseHandler):
	@user_required
	@admin_required
	def get(self):
		# lookup user's auth info
		user_info = User.get_by_id(long(self.user_id))

		params = {}
		return self.render_template('admin/status.html', **params)


class UsersHandler(BaseHandler):
	@user_required
	@admin_required
	def get(self):
		# lookup user's auth info
		user_info = User.get_by_id(long(self.user_id))

		# look up usrs
		users = User.get_all()

		params = {
			'users': users
		}

		return self.render_template('admin/users.html', **params)


class FlavorsListHandler(BaseHandler):
	@user_required
	@admin_required
	def get(self):
		# lookup user's auth info
		user_info = User.get_by_id(long(self.user_id))

		# look up user's articles
		flavors = Flavor.get_all()

		# setup channel to do page refresh
		channel_token = user_info.key.urlsafe()
		refresh_channel = channel.create_channel(channel_token)
		params = {
			'flavors': flavors, 
			'refresh_channel': refresh_channel,
			'channel_token': channel_token 
		}

		return self.render_template('admin/flavors.html', **params)

	@user_required
	@admin_required
	def post(self):
		if not self.form.validate():          
			self.add_message("The form did not validate.", 'error')
			return self.get()

		# load values out of the form
		name = self.form.name.data.strip()
		vpus = self.form.vpus.data
		memory = self.form.memory.data
		disk = self.form.disk.data
		network_down = self.form.network_down.data
		network_up = self.form.network_up.data
		rate = self.form.rate.data

		# save the flavor in our database
		flavor = Flavor(
			name = name,
			vpus = vpus,
			memory = memory,
			disk = disk,
			network_down = network_down,
			network_up = network_up,
			rate = rate, # current market rate
			launches = 0, # number of total launches
			hot = 2 # suggest minimum two instance addresses hot
{'fraction_non_alphanumeric': 0.1003199268738574, 'fraction_numerical': 0.0013711151736745886, 'mean_word_length': 4.013745704467354, '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': '3491727', 'n_tokens_mistral': 1581, 'n_tokens_neox': 1417, 'n_words': 368}