<commit_before># -*- coding: utf-8 -*-
from __future__ import absolute_import
from os.path import splitext


class Toctree(object):
    """ This class helps building Sphinx toctrees.

    :param int maxdepth:
        The number of levels included in the TOC. If the TOC entry has
        children and ``maxdepth > 1`` those children will be inlined
        as well. This makes the toctree a tree.
    """

    def __init__(self, maxdepth=1):
        self.maxdepth = maxdepth
        self.indent = 4
        self.entries = []

    def add(self, entry):
        """ Add entry to the TOC.

        :param str entry:
            This is a relative path to the ReST file. The function can
            correctly handle cases where the path is given with the ext or
            without (as Sphinx uses file names without the extension for
            toctree entries).
        """
        name, ext = splitext(entry)
        self.entries.append(name)

    def __str__(self):
        """
        :return str:
            The sphinx ``toctree`` directive.
        """
        indent = ' ' * self.indent

        toctree_directive = [
            '.. toctree::',
            indent + ':maxdepth: 1',
            '',
        ] + [
            indent + e for e in self.entries
        ]

        return '\n'.join(toctree_directive)<commit_msg>Toctree didn't have a trailing newline<commit_after># -*- coding: utf-8 -*-
from __future__ import absolute_import
from os.path import splitext


class Toctree(object):
    """ This class helps building Sphinx toctrees.

    :param int maxdepth:
        The number of levels included in the TOC. If the TOC entry has
        children and ``maxdepth > 1`` those children will be inlined
        as well. This makes the toctree a tree.
    """

    def __init__(self, maxdepth=1):
        self.maxdepth = maxdepth
        self.indent = 4
        self.entries = []

    def add(self, entry):
        """ Add entry to the TOC.

        :param str entry:
            This is a relative path to the ReST file. The function can
            correctly handle cases where the path is given with the ext or
            without (as Sphinx uses file names without the extension for
            toctree entries).
        """
        name, ext = splitext(entry)
        self.entries.append(name)

    def __str__(self):
        """
        :return str:
            The sphinx ``toctree`` directive.
        """
        indent = ' ' * self.indent

        toctree_directive = [
            '.. toctree::',
            indent + ':maxdepth: 1',
            '',
        ] + [
            indent + e for e in self.entries
        ] + [
            ''
        ]

        return '\n'.join(toctree_directive)
{'fraction_non_alphanumeric': 0.09204712812960236, 'fraction_numerical': 0.003681885125184094, 'mean_word_length': 1.75, 'pattern_counts': {'":': 0, '<': 3, '<?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': '2933622', 'n_tokens_mistral': 773, 'n_tokens_neox': 746, 'n_words': 272}