<commit_before>import xmpp
import threading
import Agent
import Envelope
import FIPAMessage
import AID
import Behaviour
import ACLParser
import socket
import SocketServer

SIMBAPORT = 20001

class SIMBA(Agent.PlatformAgent):
	class OutboxBehaviour(Behaviour.Behaviour):
	'''
	Behaviour that routes outgoing SIMBA messages
	'''
		def __init__(self):
			Behaviour.Behaviour.__init__(self)

		def sendToSimba(self, msg, to):
			'''Sends a message to a SIMBA receiver'''
			
			# Socket work
			ip = to.strip("simba://")
			s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
			try:
				s.connect((ip, SIMBAPORT))
			except:
				print "Could not connect to SIMBA socket on " + str(ip)
			s.send(str(msg))
			s.close()			
	
		def _process(self):
			msg = self._receive(True)
			if (msg != None):
				to_list = msg.getReceivers()
				d = {}
				for to in to_list:
					self.sendToSimba(msg, to)
			else:
				print "SIMBA::dying... it shouldn't happen"
			
	class InboxBehaviour(Behaviour.Behaviour):
	'''
	Behaviour that routes incoming SIMBA messages
	'''
		class SimbaRequestHandler(SocketServer.DatagramRequestHandler):
		'''
		Request handler for SIMBA messages
		'''
			def handle(self):
				print "SIMBA SS: New incoming message"
<commit_msg>packaging<commit_after>import xmpp
import threading
import Agent
import Envelope
import FIPAMessage
import AID
import Behaviour
import ACLParser
import socket
import SocketServer

SIMBAPORT = 20001

class SIMBA(Agent.PlatformAgent):
	class OutboxBehaviour(Behaviour.Behaviour):
		'''
		Behaviour that routes outgoing SIMBA messages
		'''
	
		def __init__(self):
			Behaviour.Behaviour.__init__(self)

		def sendToSimba(self, msg, to):
			'''Sends a message to a SIMBA receiver'''
			
			# Socket work
			ip = to.strip("simba://")
			s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
			try:
				s.connect((ip, SIMBAPORT))
			except:
				print "Could not connect to SIMBA socket on " + str(ip)
			s.send(str(msg))
			s.close()			
	
		def _process(self):
			msg = self._receive(True)
			if (msg != None):
				to_list = msg.getReceivers()
				d = {}
				for to in to_list:
					self.sendToSimba(msg, to)
			else:
				print "SIMBA::dying... it shouldn't happen"
			
	class InboxBehaviour(Behaviour.Behaviour):
		'''
		Behaviour that routes incoming SIMBA messages
		'''
	
		class SimbaRequestHandler(SocketServer.DatagramRequestHandler):
			'''
			Request handler for SIMBA messages
			'''
			def handle(self):
				print "SIMBA SS: New incoming message"

{'fraction_non_alphanumeric': 0.1065278334000801, 'fraction_numerical': 0.004004805766920304, 'mean_word_length': 3.66044776119403, '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': '6133611', 'n_tokens_mistral': 1031, 'n_tokens_neox': 823, 'n_words': 226}