<commit_before>import six

from gssapi.raw import names as rname
from gssapi.raw import NameType
from gssapi import _utils


class Name(rname.Name):
    __slots__ = ()

    def __new__(cls, base=None, name_type=None, token=None):
        if token is not None:
            base_name = rname.import_name(token, NameType.export)
        elif isinstance(base, rname.Name):
            base_name = base
        else:
            base_name = rname.import_name(base, name_type)

        return super(Name, cls).__new__(cls, base_name)

    def __str__(self):
        if issubclass(str, six.text_type):
            # Python 3 -- we should return unicode
            return bytes(self).decode(_utils._get_encoding())<commit_msg>Allow Name to take a unicode name<commit_after>import six

from gssapi.raw import names as rname
from gssapi.raw import NameType
from gssapi import _utils


class Name(rname.Name):
    __slots__ = ()

    def __new__(cls, base=None, name_type=None, token=None):
        if token is not None:
            base_name = rname.import_name(token, NameType.export)
        elif isinstance(base, rname.Name):
            base_name = base
        else:
            if isinstance(base, six.text_type):
                base = base.encode(_utils._get_encoding())

            base_name = rname.import_name(base, name_type)

        return super(Name, cls).__new__(cls, base_name)

    def __str__(self):
        if issubclass(str, six.text_type):
            # Python 3 -- we should return unicode
            return bytes(self).decode(_utils._get_encoding())
{'fraction_non_alphanumeric': 0.09195402298850575, 'fraction_numerical': 0.001277139208173691, 'mean_word_length': 2.6022988505747127, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '1149167', 'n_tokens_mistral': 483, 'n_tokens_neox': 469, 'n_words': 126}