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


"""Simple Serial Example

This example shows how to use the ``circuits.io.Serial`` Component
to access serial data. This example simply echos back what it receives
on the serial port.

.. warning:: THis example is currently untested.
"""


from circuits.io import Serial
from circuits.io.events import write
from circuits import handler, Component, Debugger


class EchoSerial(Component):

    def init(self, port):
        Serial(port).register(self)

    @handler("read")
    def on_read(self, data):
        """Read Event Handler

        This is fired by the underlying Serial Component when there has been
        new data read from the serial port.
        """

        self.fire(write(data))


# Start and "run" the system.
# Bind to port 0.0.0.0:8000
app = EchoSerial("/dev/ttyS0")
Debugger().register(app)
app.run()<commit_msg>Fixed erroneous comment in echoserial example<commit_after>#!/usr/bin/env python


"""Simple Serial Example

This example shows how to use the ``circuits.io.Serial`` Component
to access serial data. This example simply echos back what it receives
on the serial port.

.. warning:: THis example is currently untested.
"""


from circuits.io import Serial
from circuits.io.events import write
from circuits import handler, Component, Debugger


class EchoSerial(Component):

    def init(self, port):
        Serial(port).register(self)

    @handler("read")
    def on_read(self, data):
        """Read Event Handler

        This is fired by the underlying Serial Component when there has been
        new data read from the serial port.
        """

        self.fire(write(data))


# Start and "run" the system.
# Connect to /dev/ttyS0
app = EchoSerial("/dev/ttyS0")
Debugger().register(app)
app.run()
{'fraction_non_alphanumeric': 0.09898762654668167, 'fraction_numerical': 0.006186726659167604, 'mean_word_length': 3.425373134328358, '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': '2811935', 'n_tokens_mistral': 523, 'n_tokens_neox': 486, 'n_words': 195}