<commit_before>import os
import imp

class Commander():
	commands = {}

	def __init__(self):
		self.update_commands()
		# TODO: Load this dynamically?
		self.admins = []

	def update_commands(self):
		mods = []
		self.commands = {}
		self.admincommands = {}
		for f in os.listdir("./modules"):
			if f[-2:] != "py":
				continue
			file,pathname,description = imp.find_module("./modules/" + f[:-3])
			mods.append(imp.load_module(f[:-3],file,pathname,description))


		for m in mods:
			try:
				for c in m.commands.keys():
					self.register(c, m.commands[c])
				if hasattr(m, "admincommands"):
					for c in m.admincommands:
						self.adminregister(c, m.admincommands[c])
				if hasattr(m, "init"):
					m.init()
			except Exception as e:
				print("Error loading commands from " + m.__name__)
				print(e)

		return "Registered commands: " + ",".join(self.commands.keys())
	
	def register(self, command, handler):
		if command in self.commands.keys():
			print("Command '{}' already registered!".format(command))
			return
		self.commands[command] = handler

	def adminregister(self, command, handler):
		if command in self.admincommands.keys():
			print("Command '{}' already registered!".format(command))
			return
		self.admincommands[command] = handler

	def handle_command(self, message, jid=None):
		print(jid)<commit_msg>Removed debug print call in handle_command<commit_after>import os
import imp

# TODO: Replace all calls to print() with appropriate logging statements

class Commander():
	commands = {}

	def __init__(self):
		self.update_commands()
		# TODO: Load this dynamically?
		self.admins = []

	def update_commands(self):
		mods = []
		self.commands = {}
		self.admincommands = {}
		for f in os.listdir("./modules"):
			if f[-2:] != "py":
				continue
			file,pathname,description = imp.find_module("./modules/" + f[:-3])
			mods.append(imp.load_module(f[:-3],file,pathname,description))


		for m in mods:
			try:
				for c in m.commands.keys():
					self.register(c, m.commands[c])
				if hasattr(m, "admincommands"):
					for c in m.admincommands:
						self.adminregister(c, m.admincommands[c])
				if hasattr(m, "init"):
					m.init()
			except Exception as e:
				print("Error loading commands from " + m.__name__)
				print(e)

		return "Registered commands: " + ",".join(self.commands.keys())
	
	def register(self, command, handler):
		if command in self.commands.keys():
			print("Command '{}' already registered!".format(command))
			return
		self.commands[command] = handler

	def adminregister(self, command, handler):
		if command in self.admincommands.keys():
			print("Command '{}' already registered!".format(command))
			return
		self.admincommands[command] = handler

	def handle_command(self, message, jid=None):
{'fraction_non_alphanumeric': 0.14804063860667635, 'fraction_numerical': 0.0021770682148040637, 'mean_word_length': 3.8624338624338623, 'pattern_counts': {'":': 2, '<': 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': '7270545', 'n_tokens_mistral': 1033, 'n_tokens_neox': 881, 'n_words': 219}