<commit_before>import code
import sys

from util.nick import nickeq, nicklower

class Repl(code.InteractiveConsole):
	def __init__(self, circa, channel):
		code.InteractiveConsole.__init__(self, {"circa": circa})
		self.circa = circa
		self.channel = channel
		self.buf = ""
	
	def write(self, data):
		self.buf += data
	
	def flush(self):
		msg = self.buf.rstrip("\n")
		if len(msg) > 0:
			self.circa.say(self.channel, msg)
		self.buf = ""
	
	def run(self, code):
		sys.stdout = sys.interp = self
		self.push(code)
		sys.stdout = sys.__stdout__
		self.flush()

class ReplModule:
	def __init__(self, circa):
		import logging
		logging.info("Loading repl")
		self.circa = circa
		self.repls = {}

	def onload(self):
		self.circa.add_listener("message", self.handle_repl)

	def onunload(self):
		self.circa.remove_listener("message", self.handle_repl)

	def handle_repl(self, fr, to, text):
		if text.startswith(">>> "):
			self.repl(nicklower(fr), nicklower(fr) if nickeq(to, self.circa.nick) \
					else nicklower(to), text[len(">>> "):])

	def repl(self, fr, to, command):
		if self.circa.is_admin(fr):
			if to not in self.repls:
				self.repls[to] = Repl(self.circa, to)
			self.repls[to].run(command)

module = ReplModule<commit_msg>forgot to remove logging<commit_after>import code
import sys

from util.nick import nickeq, nicklower

class Repl(code.InteractiveConsole):
	def __init__(self, circa, channel):
		code.InteractiveConsole.__init__(self, {"circa": circa})
		self.circa = circa
		self.channel = channel
		self.buf = ""
	
	def write(self, data):
		self.buf += data
	
	def flush(self):
		msg = self.buf.rstrip("\n")
		if len(msg) > 0:
			self.circa.say(self.channel, msg)
		self.buf = ""
	
	def run(self, code):
		sys.stdout = sys.interp = self
		self.push(code)
		sys.stdout = sys.__stdout__
		self.flush()

class ReplModule:
	def __init__(self, circa):
		self.circa = circa
		self.repls = {}

	def onload(self):
		self.circa.add_listener("message", self.handle_repl)

	def onunload(self):
		self.circa.remove_listener("message", self.handle_repl)

	def handle_repl(self, fr, to, text):
		if text.startswith(">>> "):
			self.repl(nicklower(fr), nicklower(fr) if nickeq(to, self.circa.nick) \
					else nicklower(to), text[len(">>> "):])

	def repl(self, fr, to, command):
		if self.circa.is_admin(fr):
			if to not in self.repls:
				self.repls[to] = Repl(self.circa, to)
			self.repls[to].run(command)

module = ReplModule
{'fraction_non_alphanumeric': 0.15293152931529316, 'fraction_numerical': 0.0008200082000820008, 'mean_word_length': 4.0102669404517455, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 17, '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': '2044995', 'n_tokens_mistral': 1010, 'n_tokens_neox': 933, 'n_words': 200}