<commit_before>from decorator import decorator
import traceback as tb
from StringIO import StringIO
import sys
import config

@decorator
def exception_managed(fn, *args, **kws):
	try:
		fn(*args, **kws)
	except Exception, e:
		f_contents = StringIO()
		tb.print_tb(sys.exc_traceback, file=f_contents)
		contents = f_contents.getvalue()
		f_contents.close()

		try:
			conn = config.get_conn()
			conn.request('POST', '/upload/error', contents, 
							{'Content-Type':'text/plain'})
			conn.getresponse().read()
		except Exception:
			return

		if config.current['debug']:
			import pdb; pdb.set_trace()
<commit_msg>decorator module wasnt getting packaged correctly so Im just making a decorator manually.<commit_after>import traceback as tb
from StringIO import StringIO
import sys
import config

def exception_managed(fn):
	def wrapper(*args, **kws):
		try:
			fn(*args, **kws)
		except Exception, e:
			f_contents = StringIO()
			tb.print_tb(sys.exc_traceback, file=f_contents)
			contents = f_contents.getvalue()
			f_contents.close()

			try:
				conn = config.get_conn()
				conn.request('POST', '/upload/error', contents, 
								{'Content-Type':'text/plain'})
				conn.getresponse().read()
			except Exception:
				return

			if config.current['debug']:
				import pdb; pdb.set_trace()
	return wrapper

{'fraction_non_alphanumeric': 0.11885546588407923, 'fraction_numerical': 0.0, 'mean_word_length': 3.486842105263158, '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': '3364160', 'n_tokens_mistral': 517, 'n_tokens_neox': 435, 'n_words': 110}