<commit_before>import argparse
import functools
import os
import sys

import blessings
from pyfiglet import Figlet
import plotille as pt
import scipy
import numpy as np
from scipy.spatial import distance as dmetrics

from boink.args import (add_output_interval_args, 
                        add_pairing_args)
from boink.minimizers import UKHSCountSignature
from boink.processors import UKHSCountSignatureProcessor
from boink.parsing import grouper
from boink.utils  import find_common_basename, remove_fx_suffix


class TextBlock:

    def __init__(self, text):
        self.text = text.split('\n')
        self.height = len(self.text)
        self.width = max((len(line) for line in self.text))

    def __iter__(self):
        yield from self.text

    def draw(self, term, x, shift_y=None):
        out = term.stream

        if shift_y:
            out.write(term.move_down * shift_y)

        for line in self.text:
            out.write(term.move_x(x))
            out.write(line)
            out.write(term.move_down)


class DraffStreamFrame:

    def __init__(self, term, args):
        self.args   = args

        self.distance_figure = pt.Figure()
        self.distance_figure.width = 60
        self.distance_figure.height = 20
        self.distance_figure.x_label = '# sequences'
        self.distance_figure.y_label = 'Δdistance'
        self.distance_figure.set_x_limits(min_=0)
        self.distance_figure.set_y_limits(min_=0)
        self.distance_figure.color_mode = 'byte'

        self.hist_figure = pt.Figure()
        self.hist_figure.width = 30
        self.hist_figure.height = 20
        self.hist_figure.x_label = 'Δdistance'
        self.hist_figure.y_label = 'counts'
        self.hist_figure.color_mode = 'byte'

        self.term = term

        name_block = Figlet(font='doom').renderText('draff').rstrip().split('\n')
        name_block[-1] = name_block[-1] + ' stream, v0.1'<commit_msg>Concat block text and print rather than printing line by line<commit_after>import argparse
import functools
import os
import sys

import blessings
from pyfiglet import Figlet
import plotille as pt
import scipy
import numpy as np
from scipy.spatial import distance as dmetrics

from boink.args import (add_output_interval_args, 
                        add_pairing_args)
from boink.minimizers import UKHSCountSignature
from boink.processors import UKHSCountSignatureProcessor
from boink.parsing import grouper
from boink.utils  import find_common_basename, remove_fx_suffix


class TextBlock:

    def __init__(self, text):
        self.text = text.split('\n')
        self.height = len(self.text)
        self.width = max((len(line) for line in self.text))

    def __iter__(self):
        yield from self.text

    def draw(self, term, x, shift_y=None):
        out = term.stream
        
        if shift_y:
            buf = term.move_down * shift_y
        else:
            buf = ''

        for line in self.text:
            buf += term.move_x(x)
            buf += line
            buf += term.move_down
        
        out.write(buf)


class DraffStreamFrame:

    def __init__(self, term, args):
        self.args   = args

        self.distance_figure = pt.Figure()
        self.distance_figure.width = 60
        self.distance_figure.height = 20
        self.distance_figure.x_label = '# sequences'
        self.distance_figure.y_label = 'Δdistance'
        self.distance_figure.set_x_limits(min_=0)
        self.distance_figure.set_y_limits(min_=0)
        self.distance_figure.color_mode = 'byte'

        self.hist_figure = pt.Figure()
        self.hist_figure.width = 30
        self.hist_figure.height = 20
        self.hist_figure.x_label = 'Δdistance'
        self.hist_figure.y_label = 'counts'
        self.hist_figure.color_mode = 'byte'

        self.term = term

        name_block = Figlet(font='doom').renderText('draff').rstrip().split('\n')
        name_block[-1] = name_block[-1] + ' stream, v0.1'
{'fraction_non_alphanumeric': 0.0911854103343465, 'fraction_numerical': 0.0070921985815602835, 'mean_word_length': 2.551258992805755, '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': '1593923', 'n_tokens_mistral': 1265, 'n_tokens_neox': 1219, 'n_words': 280}