<commit_before># -*- coding: utf-8 -*-
# Copyright (c) 2013-2015, <NAME>

# Released under the Simplified BSD license
# (see LICENSE file for details).

"""
Highlevel functions to support some cases where columnizing can be useful.
"""

from __future__ import print_function

from . import config, core, helpers

__all__ = ['print_columnized', 'print_attr_names', 'print_filenames']

def print_columnized(items, output_stream=config.OUTPUT_STREAM, **options):
    """
    Shorthand for writing columnized `items` to `output_stream`.

    `items` can be a sequence or a dictionary. In case of being a dictionary
    the result will be a string with two columns (i.e. one for the keys and one
    for the values). In case of a sequence the resulting number of columns is
    calculated by the underlying algorithm.

    `output_stream` should be a file-like object that provides at least a
    `.write()`-method.

    Additional `options` are passed as-is to the `columnize()`-function and are
    interpreted there. See `core.columnize()`-documentation for details.
    """
    result = core.columnize(items, **options)
    print(result, file=output_stream)

def print_attr_names(obj, pattern=None, **options):
    """
    Like `print_columnized()` but columnizes the attribute names of `obj`.
<commit_msg>Remove mention of `core` from `print_columnized()`-docstring.<commit_after># -*- coding: utf-8 -*-
# Copyright (c) 2013-2015, <NAME>

# Released under the Simplified BSD license
# (see LICENSE file for details).

"""
Highlevel functions to support some cases where columnizing can be useful.
"""

from __future__ import print_function

from . import config, core, helpers

__all__ = ['print_columnized', 'print_attr_names', 'print_filenames']

def print_columnized(items, output_stream=config.OUTPUT_STREAM, **options):
    """
    Shorthand for writing columnized `items` to `output_stream`.

    `items` can be a sequence or a dictionary. In case of being a dictionary
    the result will be a string with two columns (i.e. one for the keys and one
    for the values). In case of a sequence the resulting number of columns is
    calculated by the underlying algorithm.

    `output_stream` should be a file-like object that provides at least a
    `.write()`-method.

    Additional `options` are passed as-is to the `columnize()`-function and are
    interpreted there. See `columnize()`-documentation for details.
    """
    result = core.columnize(items, **options)
    print(result, file=output_stream)

def print_attr_names(obj, pattern=None, **options):
    """
    Like `print_columnized()` but columnizes the attribute names of `obj`.

{'fraction_non_alphanumeric': 0.0998869204673954, 'fraction_numerical': 0.006784771956275914, 'mean_word_length': 4.055238095238095, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '3555483', 'n_tokens_mistral': 771, 'n_tokens_neox': 743, 'n_words': 301}