<commit_before>import threading
import traceback

class Event(object):
	def __init__(self):
		self.lst = []
		self.lck = threading.Lock()
		self.post_add = None

	def __call__(self, *args, **kwargs):
		with self.lck:
			l = self.lst[:]

		for f in l:
			try:
				f(*args, **kwargs)
			except Exception:
				tbck.format_exc()

		return self

	def __iadd__(self, f):
		with self.lck:
			self.lst.append(f)

		if self.post_add:
			self.post_add(self, f)

		return self

	def __isub__(self, f):
		with self.lck:
			self.lst.remove(f)

		return self

debug = Event()
init = Event()
<commit_msg>* add missing print to output the traceback in case of an exception when calling a callback<commit_after>import threading
import traceback

class Event(object):
	def __init__(self):
		self.lst = []
		self.lck = threading.Lock()
		self.post_add = None

	def __call__(self, *args, **kwargs):
		with self.lck:
			l = self.lst[:]

		for f in l:
			try:
				f(*args, **kwargs)
			except Exception:
				print(tbck.format_exc())

		return self

	def __iadd__(self, f):
		with self.lck:
			self.lst.append(f)

		if self.post_add:
			self.post_add(self, f)

		return self

	def __isub__(self, f):
		with self.lck:
			self.lst.remove(f)

		return self

debug = Event()
init = Event()

{'fraction_non_alphanumeric': 0.12747426761678543, 'fraction_numerical': 0.0, 'mean_word_length': 3.2274247491638794, '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': '1618480', 'n_tokens_mistral': 546, 'n_tokens_neox': 471, 'n_words': 130}