Ejemplo n.º 1
0
 def setUp(self):
     super(TestHeap, self).setUp()
     self.threads = set()
     self.content_stream = []
     self.content_counter = 0
     self.forum = forum.forum(self.feed)
     heap.priority_list(self.forum, lambda x: analyze.evaluate(x))
     heap.priority_list(self.forum, lambda x: -analyze.evaluate(x))
Ejemplo n.º 2
0
@app.route('/read/thread_day')
def read_next_day():
	forum_list[forum_index].get_next_day()
	return redirect('/')

@app.route('/thread/<int:thread_id>')
def thread_page(thread_id):
	posts = [make_ascii(p.text) for p in forum_list[forum_index].thread_list[int(thread_id)].post_list()]
	return render_template('thread.html', posts=posts)

def make_ascii(text):
	return Markup(filter(lambda x: x in string.printable, text))

if __name__ == '__main__':
	forum_list.append(forum(feed('OnlineGames')))
	forum_list.append(forum(feed('OnlineGames2')))
	forum_list.append(forum(feed('Nutrition')))
	forum_list.append(forum(feed('Nutrition2')))
	forum_list.append(forum(feed('Innovation')))
	forum_list.append(forum(feed('Innovation2')))
	forum_list.append(forum(feed('POSA')))
	forum_list.append(forum(feed('POSA2')))
	for f in forum_list:
		heap.priority_list(f, analyze.evaluate, 'default')
		heap.priority_list(f, analyze.question_marks, 'question_marks')
		heap.priority_list(f, analyze.question_words, 'question_words')
		heap.priority_list(f, analyze.social_words, 'social_words')
		f.get_next_day()
	app.run(debug=True, host='0.0.0.0')
	
Ejemplo n.º 3
0
	def setUp(self):
		self.pl = heap.priority_list()