<commit_before>"""
tabled.tabled
~~~~~~~~~~~~~

:synopsis: Pretty print data in tabular format.
:copyright: (c) 2017, <NAME>.
:license: MIT
"""

from typing import Any, List, Optional, Text

import sys

from .pretty_print import generate_table


class TableD:
    """ The main interface to interact with a TableD object.

    Attributes:
        headings: Valid list of unicode strings for column headings.
        data: Nested list of cell data.
        style: Visual styling of the output table.
        device: Where should the output be presented.
        _output (internal): Cached table string.
        _cache_valid (internal): Validity of the cached table string.

    Example:
        >>> TableD(
        ...     ['Repo', 'Author', 'Url'],
        ...     [['tableD', 'Me', 'http://github.com/tommyip/tabled'],
        ...      ['Exmaple', 'Someone', 'http://example.com']]
        ... )
        <tabled.tabled.TableD object at 0x...>
    """

    def __init__(self,
                 headings: Optional[List[Text]] = None,
                 data: Optional[List[List[Any]]] = None,
                 style: Text = 'default',
                 device: Text = 'stdout') -> None:
        """ Initialize data storage engine for TableD. """

        # Python gotcha: mutable default argument
        self.headings = headings or []
        self.data = data or []
        self.style = style<commit_msg>docs: Improve TableD class string example.<commit_after>"""
tabled.tabled
~~~~~~~~~~~~~

:synopsis: Pretty print data in tabular format.
:copyright: (c) 2017, <NAME>.
:license: MIT
"""

from typing import Any, List, Optional, Text

import sys

from .pretty_print import generate_table


class TableD:
    """ The main interface to interact with a TableD object.

    Attributes:
        headings: Valid list of unicode strings for column headings.
        data: Nested list of cell data.
        style: Visual styling of the output table.
        device: Where should the output be presented.
        _output (*internal*): Cached table string.
        _cache_valid (*internal*): Validity of the cached table string.

    Example:
        >>> table = TableD(
        ...     ['Repository', 'Author', 'Type'],
        ...     [['tableD', 'Tommy Ip', 'Python library'],
        ...      ['VueJS', 'Evan You', 'Frontend JS framework'],
        ...      ['flask', '<NAME>', 'Web framework']]
        ... )
        >>> table.show()
        +------------+----------------+-----------------------+
        | Repository | Author         | Type                  |
        +------------+----------------+-----------------------+
        | tableD     | Tommy Ip       | Python library        |
        | VueJS      | Evan You       | Frontend JS framework |
        | flask      | <NAME> | Web framework         |
        +------------+----------------+-----------------------+
    """

    def __init__(self,
                 headings: Optional[List[Text]] = None,
                 data: Optional[List[List[Any]]] = None,
                 style: Text = 'default',
                 device: Text = 'stdout') -> None:
        """ Initialize data storage engine for TableD. """

        # Python gotcha: mutable default argument
        self.headings = headings or []
        self.data = data or []
        self.style = style
{'fraction_non_alphanumeric': 0.17014203686914475, 'fraction_numerical': 0.0027198549410698096, 'mean_word_length': 1.7242798353909465, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 19, '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': '6153462', 'n_tokens_mistral': 888, 'n_tokens_neox': 850, 'n_words': 291}