<commit_before>#!/usr/bin/env python

from circuits.net.sockets import TCPServer

class EchoServer(TCPServer):

    def read(self, sock, data):
        return data
    
(EchoServer(8000)).run()
<commit_msg>Documented Echo Server Example -- [#40112459]<commit_after>#!/usr/bin/env python

"""Simple TCP Echo Server

This example shows how you can create a simple TCP Server (an Echo Service)
utilizing the builtin Socket Components that the circuits library ships with.
"""

from circuits.net.sockets import TCPServer


class EchoServer(TCPServer):

    def read(self, sock, data):
        """Read Event Handler

        This is fired by the underlying Socket Component when there has been
        new data read from the connected client.
        """

        return data

# Start and "run" the system.
# Bind to port 0.0.0.0:8000
(EchoServer(8000)).run()

{'fraction_non_alphanumeric': 0.0935672514619883, 'fraction_numerical': 0.028070175438596492, 'mean_word_length': 3.435233160621762, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 1, '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': '5287415', 'n_tokens_mistral': 274, 'n_tokens_neox': 245, 'n_words': 94}