<commit_before>#!/usr/bin/env python
# Script for printing to LCD display
#
# Author: <NAME> <<EMAIL>>

import argparse
import time
import os
import sys

# Add src directory to path
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "../src"))
from pylis.lis import LISDisplay, NCHARS, LINES

DEFAULT_DELAY = 0.5 # sec

def show_lines(vfd, lines, delay=DEFAULT_DELAY):
    """
    Display multiple lines on a display by scrolling through them.
    If the line is wider than the display, it will be truncated.
    """
    display = [""]*LINES
    for line in lines:
        display.append(line.rstrip())
        display.pop(0)
        for i, d in enumerate(display):
            vfd.write_line(i, d.ljust(NCHARS))
        time.sleep(delay)


if __name__ == "__main__":
    # Uncomment for debugging
    #logging.basicConfig(level=logging.DEBUG)
<commit_msg>lcd-cat: Use readline to avoid buffering stdin<commit_after>#!/usr/bin/env python
# Script for printing to LCD display
#
# Author: <NAME> <<EMAIL>>

import argparse
import time
import logging
import os
import sys

# Add src directory to path
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "../src"))
from pylis.lis import LISDisplay, NCHARS, LINES

DEFAULT_DELAY = 0.5 # sec

def show_lines(vfd, lines, delay=DEFAULT_DELAY):
    """
    Display multiple lines on a display by scrolling through them.
    If the line is wider than the display, it will be truncated.
    """
    display = [""]*LINES
    while True:
        line = lines.readline()
        if line == "":
            break
        display.append(line.rstrip())
        display.pop(0)
        for i, d in enumerate(display):
            vfd.write_line(i, d.ljust(NCHARS))
        time.sleep(delay)


if __name__ == "__main__":
    # Uncomment for debugging
    #logging.basicConfig(level=logging.DEBUG)

{'fraction_non_alphanumeric': 0.11563517915309446, 'fraction_numerical': 0.004343105320304018, 'mean_word_length': 3.10467706013363, 'pattern_counts': {'":': 3, '<': 9, '<?xml version=': 0, '>': 9, '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': '1951856', 'n_tokens_mistral': 608, 'n_tokens_neox': 587, 'n_words': 181}