<commit_before>def getCommand(command_name, server=None, caller=None, arguments=[]):
	"""
	Try to instantiate a command from the command_name
	command_name: The name of the command to instantiate.
	throws: NameError, if the command is not found
	returns: A Command object.
	"""
	try:
		return globals()[command_name](server, caller, arguments)
	except KeyError, e:
		raise NameError("The command '"+command_name+"' was not found. Is it properly defined in commands.py? Is it correctly spelled?")

class Command(object):
	_server = None
	_caller = None
	_arguments = []
	
	@property
	def server(self):
		"""The server in which this command is executed"""
		return self._server
	@server.setter
	def server(self, value):
		self._server = value

	@property
	def caller(self):
		"""The Client representing the caller of this command"""
		return self._caller
	@caller.setter
	def caller(self, value):
		self._caller = value

	@property
	def arguments(self):
		"""The arguments passed to the command"""
		return self._arguments
	@arguments.setter
	def arguments(self, value):
		self._arguments = value

	def __init__(self, server = None, caller = None, arguments=[]):
		self.server = server
		self.caller = caller
		self.arguments = arguments

	def execute(self):
		"""Overide this method"""
		raise NotImplementedError()

class Help(Command):
	def execute(self):
		import inspect
		import sys
		classes = inspect.getmembers(sys.modules[__name__], inspect.isclass) 
		self.caller.send("Available commands are:")		
		for class_info in classes:
			if issubclass(class_info[1], Command) and class_info[0] != "Command":
				self.caller.send("/"+class_info[0].lower())		

class Exit(Command):
	"""
	Remove the caller from the server socket list and close it's connection.
	arguments:Takes no args
	"""
	def execute(self):
		self.server.disconnect_client(self.caller)

class Rename(Command):
	"""
	Set the name of the caller to the specified argument.
	arguments[0]:The new name for the caller
	"""
	def execute(self):
		if self.arguments[0]:<commit_msg>Fix a bug that would crash the server when sending the /rename command without arguments<commit_after>def getCommand(command_name, server=None, caller=None, arguments=[]):
	"""
	Try to instantiate a command from the command_name
	command_name: The name of the command to instantiate.
	throws: NameError, if the command is not found
	returns: A Command object.
	"""
	try:
		return globals()[command_name](server, caller, arguments)
	except KeyError, e:
		raise NameError("The command '"+command_name+"' was not found. Is it properly defined in commands.py? Is it correctly spelled?")

class Command(object):
	_server = None
	_caller = None
	_arguments = []
	
	@property
	def server(self):
		"""The server in which this command is executed"""
		return self._server
	@server.setter
	def server(self, value):
		self._server = value

	@property
	def caller(self):
		"""The Client representing the caller of this command"""
		return self._caller
	@caller.setter
	def caller(self, value):
		self._caller = value

	@property
	def arguments(self):
		"""The arguments passed to the command"""
		return self._arguments
	@arguments.setter
	def arguments(self, value):
		self._arguments = value

	def __init__(self, server = None, caller = None, arguments=[]):
		self.server = server
		self.caller = caller
		self.arguments = arguments

	def execute(self):
		"""Overide this method"""
		raise NotImplementedError()

class Help(Command):
	def execute(self):
		import inspect
		import sys
		classes = inspect.getmembers(sys.modules[__name__], inspect.isclass) 
		self.caller.send("Available commands are:")		
		for class_info in classes:
			if issubclass(class_info[1], Command) and class_info[0] != "Command":
				self.caller.send("/"+class_info[0].lower())		

class Exit(Command):
	"""
	Remove the caller from the server socket list and close it's connection.
	arguments:Takes no args
	"""
	def execute(self):
		self.server.disconnect_client(self.caller)

class Rename(Command):
	"""
	Set the name of the caller to the specified argument.
	arguments[0]:The new name for the caller
	"""
	def execute(self):
		if len(self.arguments) == 1:
{'fraction_non_alphanumeric': 0.11215177713736792, 'fraction_numerical': 0.0024015369836695487, 'mean_word_length': 4.628378378378378, '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': '1241239', 'n_tokens_mistral': 1346, 'n_tokens_neox': 1261, 'n_words': 428}