<commit_before>"""
    verktyg.http.accept
    ~~~~~~~~~~~~~~~~~~~

    :copyright:
        (c) 2015 <NAME>
    :license:
        BSD, see LICENSE for more details.
"""
import re
import functools

from verktyg.datastructures import ImmutableDict
from verktyg.exceptions import NotAcceptable


_token_re_str = r'''
    (?:
        [a-zA-Z0-9]+
        (?:
            - [a-zA-Z0-9]+
        )*
    )
'''

# TODO
_value_re = re.compile(
    r'''
        ^
        ''' + _token_re_str + ''' | \*
        $
    ''', re.VERBOSE
)

# TODO
_content_type_value_re = re.compile(
    r'''
        ^
        (?: ''' + _token_re_str + ''' | \*)
        /
        (?:
            (?:
                (?:''' + _token_re_str + ''' \.)?
                ''' + _token_re_str + '''
                (?: \+ ''' + _token_re_str + ''')?
            ) | \*
        )
    ''', re.VERBOSE
)


# TODO better name
class _Value(object):
    """Base class for a value that the server to be proposed during content
    negotiation.
    """
    match_type = None<commit_msg>Use format instead of string concatenation for building accept regexes<commit_after>"""
    verktyg.http.accept
    ~~~~~~~~~~~~~~~~~~~

    :copyright:
        (c) 2015 <NAME>
    :license:
        BSD, see LICENSE for more details.
"""
import re
import functools

from verktyg.datastructures import ImmutableDict
from verktyg.exceptions import NotAcceptable


_token_re_str = r'''
    (?:
        [a-zA-Z0-9]+
        (?:
            - [a-zA-Z0-9]+
        )*
    )
'''

# TODO
_value_re = re.compile(
    r'''
        ^
        {token} | \*
        $
    '''.format(token=_token_re_str), re.VERBOSE
)

# TODO
_content_type_value_re = re.compile(
    r'''
        ^
        (?: {token} | \*)
        /
        (?:
            (?:
                (?:{token} \.)?
                {token}
                (?: \+ {token})?
            ) | \*
        )
    '''.format(token=_token_re_str), re.VERBOSE
)


# TODO better name
class _Value(object):
    """Base class for a value that the server to be proposed during content
    negotiation.
    """
    match_type = None
{'fraction_non_alphanumeric': 0.16801139060275272, 'fraction_numerical': 0.007593735168485999, 'mean_word_length': 1.6751269035532994, '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': '3358045', 'n_tokens_mistral': 737, 'n_tokens_neox': 689, 'n_words': 140}