<commit_before># This file is part of RinohType, the Python document preparation system.
#
# Copyright (c) <NAME>.
#
# Use of this source code is subject to the terms of the GNU Affero General
# Public License v3. See the LICENSE file or http://www.gnu.org/licenses/.


import unicodedata

from copy import copy
from itertools import chain, tee

from .layout import EndOfContainer, MaybeContainer
from .flowable import Flowable, FlowableState, GroupedFlowables
from .number import format_number, NUMBER
from .paragraph import ParagraphStyle, ParagraphBase, Paragraph, ParagraphState
from .paragraph import TabStop, RIGHT
from .reference import Reference, Referenceable, REFERENCE, TITLE, PAGE
from .reference import Variable, PAGE_NUMBER, NUMBER_OF_PAGES
from .reference import SECTION_NUMBER, SECTION_TITLE
from .text import SingleStyledText, MixedStyledText, FixedWidthSpace, Tab
from .dimension import PT
from .style import PARENT_STYLE


__all__ = ['HeadingStyle', 'Heading', 'ListStyle', 'List',
           'DefinitionListStyle', 'DefinitionList',
           'HeaderStyle', 'Header', 'FooterStyle', 'Footer',
           'TableOfContentsStyle', 'TableOfContents']


class HeadingStyle(ParagraphStyle):
    attributes = {'numbering_style': NUMBER,
                  'numbering_separator': '.'}

    def __init__(self, base=None, **attributes):
        super().__init__(base=base, **attributes)


# TODO: share superclass with List (numbering)
class Heading(Referenceable, ParagraphBase):
    style_class = HeadingStyle

    def __init__(self, title, style=None, level=1, id=None):
        ParagraphBase.__init__(self, style)
        Referenceable.__init__(self, id)
        self.title = title
        self.level = level
<commit_msg>__repr__ for Heading<commit_after># This file is part of RinohType, the Python document preparation system.
#
# Copyright (c) <NAME>.
#
# Use of this source code is subject to the terms of the GNU Affero General
# Public License v3. See the LICENSE file or http://www.gnu.org/licenses/.


import unicodedata

from copy import copy
from itertools import chain, tee

from .layout import EndOfContainer, MaybeContainer
from .flowable import Flowable, FlowableState, GroupedFlowables
from .number import format_number, NUMBER
from .paragraph import ParagraphStyle, ParagraphBase, Paragraph, ParagraphState
from .paragraph import TabStop, RIGHT
from .reference import Reference, Referenceable, REFERENCE, TITLE, PAGE
from .reference import Variable, PAGE_NUMBER, NUMBER_OF_PAGES
from .reference import SECTION_NUMBER, SECTION_TITLE
from .text import SingleStyledText, MixedStyledText, FixedWidthSpace, Tab
from .dimension import PT
from .style import PARENT_STYLE


__all__ = ['HeadingStyle', 'Heading', 'ListStyle', 'List',
           'DefinitionListStyle', 'DefinitionList',
           'HeaderStyle', 'Header', 'FooterStyle', 'Footer',
           'TableOfContentsStyle', 'TableOfContents']


class HeadingStyle(ParagraphStyle):
    attributes = {'numbering_style': NUMBER,
                  'numbering_separator': '.'}

    def __init__(self, base=None, **attributes):
        super().__init__(base=base, **attributes)


# TODO: share superclass with List (numbering)
class Heading(Referenceable, ParagraphBase):
    style_class = HeadingStyle

    def __init__(self, title, style=None, level=1, id=None):
        ParagraphBase.__init__(self, style)
        Referenceable.__init__(self, id)
        self.title = title
        self.level = level

    def __repr__(self):
        return '{}({}) (style={})'.format(self.__class__.__name__, self.title,
                                        self.style)

{'fraction_non_alphanumeric': 0.09331131296449216, 'fraction_numerical': 0.0011010184420589045, 'mean_word_length': 4.132768361581921, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7204587', 'n_tokens_mistral': 1048, 'n_tokens_neox': 1000, 'n_words': 332}