# Path: voidwalker/framework/utils/recipes.py
# def grouper(n, iterable, fillvalue=None):
#     args = [iter(iterable)] * n
#     return izip_longest(*args, fillvalue=fillvalue)


import string
from flowui import Widget
from flowui.widgets.table import Cell
from flowui.widgets.table import Row
from flowui.widgets.table import Table
from ..utils.recipes import grouper
        return len(self._buffer)

    def address(self):
        return self._address

    def buffer(self):
        return self._buffer


class DataWidget(Widget):
    _ascii_filter = ''.join([['.', chr(x)]
                             [chr(x) in string.printable[:-5]]
                             for x in xrange(256)])

    def __init__(self, data_chunk):
        super(DataWidget, self).__init__()
        self._data_chunk = data_chunk

    def draw(self, terminal, width):
        table = Table()

        line_len = 16
        if width < 100:
            line_len = 8

        address = self._data_chunk.address()
        for line in grouper(line_len, self._data_chunk.buffer()):
            hex_string = []
            ascii_string = []
            for octuple in grouper(8, line):

# Path: voidwalker/framework/utils/recipes.py
# def grouper(n, iterable, fillvalue=None):
#     args = [iter(iterable)] * n
#     return izip_longest(*args, fillvalue=fillvalue)


# Path: voidwalker/framework/types/data.py
import string
from flowui import Widget
from flowui.widgets.table import Cell
from flowui.widgets.table import Row
from flowui.widgets.table import Table
from ..utils.recipes import grouper

        return len(self._buffer)

    def address(self):
        return self._address

    def buffer(self):
        return self._buffer


class DataWidget(Widget):
    _ascii_filter = ''.join([['.', chr(x)]
                             [chr(x) in string.printable[:-5]]
                             for x in xrange(256)])

    def __init__(self, data_chunk):
        super(DataWidget, self).__init__()
        self._data_chunk = data_chunk

    def draw(self, terminal, width):
        table = Table()

        line_len = 16
        if width < 100:
            line_len = 8

        address = self._data_chunk.address()
        for line in grouper(line_len, self._data_chunk.buffer()):
            hex_string = []
            ascii_string = []
            for octuple in grouper(8, line):

                for quadruple in grouper(4, octuple):