<commit_before>using System;
using System.Net;
using System.Net.Sockets;
using System.Configuration;
using System.Text;

namespace Tests
{
    namespace Helpers
    {
        // A small UDP server that can be used for testing.
        // Stores the last message that was received by the server
        // until it is accessed using GetAndClearLastMessage().

        // By design received messages can only be read once. This
        // allows one instance of the listener to be used across
        // multiple tests without risk of the results of previous tests
        // affecting the current one.

        // Intended use:
        // udpListener = new UdpListener(serverName, serverPort);
        // listenThread = new Thread(new ThreadStart(udpListener.Listen));
        // listenThread.Start();
        // { send something to the listener }
        // while(listenThread.IsAlive); // wait for listen thread to receive message or time out
        // received_message = udpListener.GetAndClearLastMessage()
        // { make sure that the received message is what was expected }
        public class UdpListener : IDisposable 
        {
            byte[] lastReceivedBytes;
            IPEndPoint localIpEndPoint;
            IPEndPoint senderIpEndPoint;
            UdpClient socket;

            public UdpListener(string hostname, int port) 
            {
                lastReceivedBytes = new byte[1024];
                localIpEndPoint = new IPEndPoint(IPAddress.Parse(hostname), port);
                socket = new UdpClient(localIpEndPoint);
                socket.Client.ReceiveTimeout = 5000;<commit_msg>Reduced timeout from 5 seconds to 2.<commit_after>using System;
using System.Net;
using System.Net.Sockets;
using System.Configuration;
using System.Text;

namespace Tests
{
    namespace Helpers
    {
        // A small UDP server that can be used for testing.
        // Stores the last message that was received by the server
        // until it is accessed using GetAndClearLastMessage().

        // By design received messages can only be read once. This
        // allows one instance of the listener to be used across
        // multiple tests without risk of the results of previous tests
        // affecting the current one.

        // Intended use:
        // udpListener = new UdpListener(serverName, serverPort);
        // listenThread = new Thread(new ThreadStart(udpListener.Listen));
        // listenThread.Start();
        // { send something to the listener }
        // while(listenThread.IsAlive); // wait for listen thread to receive message or time out
        // received_message = udpListener.GetAndClearLastMessage()
        // { make sure that the received message is what was expected }
        public class UdpListener : IDisposable 
        {
            byte[] lastReceivedBytes;
            IPEndPoint localIpEndPoint;
            IPEndPoint senderIpEndPoint;
            UdpClient socket;

            public UdpListener(string hostname, int port) 
            {
                lastReceivedBytes = new byte[1024];
                localIpEndPoint = new IPEndPoint(IPAddress.Parse(hostname), port);
                socket = new UdpClient(localIpEndPoint);
                socket.Client.ReceiveTimeout = 2000;
{'fraction_non_alphanumeric': 0.07018081520073552, 'fraction_numerical': 0.0055163959546429666, 'mean_word_length': 2.1937377690802347, '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': '5969149', 'n_tokens_mistral': 818, 'n_tokens_neox': 772, 'n_words': 289}