<commit_before>
import socket


class Socket:

	TCP = 0
	UDP = 1

	def __init__(self, type):
		if type == self.TCP:
			self.s = socket.socket(socket.AF_INET, socket.SOCK_STREAM, socket.IPPROTO_TCP)
		else:
			self.s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP)
		self.s.setblocking(False)
		
	def connect(self, host, port): self.s.connect((host, port))
	def close(self): self.s.close()
	def send(self, data): self.s.sendall(data)
	def recv(self, num):
		try:
			return self.s.recv(num)
		except BlockingIOError:
			pass
			
	def get_address(self): return self.s.getsockname()[0]
	def get_port(self): return self.s.getsockname()[1]
<commit_msg>Add a few functions to Socket class<commit_after>
import socket


class Socket:

	TCP = 0
	UDP = 1

	def __init__(self, type):
		if type == self.TCP:
			self.s = socket.socket(socket.AF_INET, socket.SOCK_STREAM, socket.IPPROTO_TCP)
		else:
			self.s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP)
		self.s.setblocking(False)
		
	def connect(self, host, port): self.s.connect((host, port))
	def close(self): self.s.close()
	def send(self, data): self.s.sendall(data)
	def recv(self, num):
		try:
			return self.s.recv(num)
		except BlockingIOError:
			pass
			
	def bind(self, addr=("", 0)): self.s.bind(addr)
	def sendto(self, data, addr): self.s.sendto(data, addr)
	def recvfrom(self, num):
		try:
			return self.s.recvfrom(num)
		except BlockingIOError:
			return None, None
			
	def get_address(self): return self.s.getsockname()[0]
	def get_port(self): return self.s.getsockname()[1]

{'fraction_non_alphanumeric': 0.14104996837444655, 'fraction_numerical': 0.0056925996204933585, 'mean_word_length': 4.169934640522876, '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': '6787556', 'n_tokens_mistral': 668, 'n_tokens_neox': 599, 'n_words': 138}