<commit_before>#!/usr/bin/env python
"""
Reads & Prints KISS frames from a TCP Socket.

For use with programs like Dire Wolf.
"""


import aprs
import kiss
import logging


def print_frame(frame):
    try:
        # Decode raw APRS frame into dictionary of separate sections
        decoded_frame = aprs.util.decode_frame(frame)

        # Format the APRS frame (in Raw ASCII Text) as a human readable frame
        formatted_aprs = aprs.util.format_aprs_frame(decoded_frame)

        # This is the human readable APRS output:
        print formatted_aprs

    except Exception as ex:
        print ex
        print "Error decoding frame:"
        print "\t%s" % frame


def main():
    ki = kiss.KISS(host='10.42.10.170', tcp_port=8001)
    ki.logger.setLevel(logging.INFO)
    ki.start()
    ki.read(callback=print_frame)
<commit_msg>Small bugs<commit_after>#!/usr/bin/env python
"""
Reads & Prints KISS frames from a TCP Socket.

For use with programs like Dire Wolf.
"""


import aprs
import kiss
import logging


def print_frame(frame):
    try:
        # Decode raw APRS frame into dictionary of separate sections
        decoded_frame = aprs.util.decode_frame(frame[1:])

        # Format the APRS frame (in Raw ASCII Text) as a human readable frame
        formatted_aprs = aprs.util.format_aprs_frame(decoded_frame)

        # This is the human readable APRS output:
        print formatted_aprs

    except Exception as ex:
        print ex
        print "Error decoding frame:"
        print "\t%s" % frame


def main():
    ki = kiss.KISS(host='10.42.10.170', tcp_port=8001)
    ki._logger.setLevel(logging.INFO)
    ki.start()
    ki.read(callback=print_frame)

{'fraction_non_alphanumeric': 0.08900836320191159, 'fraction_numerical': 0.016129032258064516, 'mean_word_length': 2.841743119266055, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, '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': '4588408', 'n_tokens_mistral': 567, 'n_tokens_neox': 518, 'n_words': 165}