<commit_before>
from django.utils import six
from glaze.utils.text import deslugify


def foreign_fields(*args):
    items = []
    for i in args:
        if isinstance(i, six.string_types) and '__' in i:
            names = i.split('__')
            accessor = lambda obj: reduce(getattr, names, obj)
            accessor.short_description = deslugify(names[-1])
            accessor.admin_order_field = i
            items.append(accessor)
        else:
            items.append(i)
    return items
<commit_msg>set __name__ attribute in foreign_fields<commit_after>
from django.utils import six
from glaze.utils.text import deslugify


def foreign_fields(*args):
    items = []
    for i in args:
        if isinstance(i, six.string_types) and '__' in i:
            names = i.split('__')
            accessor = lambda obj: reduce(getattr, names, obj)
            accessor.__name__ = names[-1]
            accessor.short_description = deslugify(names[-1])
            accessor.admin_order_field = i
            items.append(accessor)
        else:
            items.append(i)
    return items

{'fraction_non_alphanumeric': 0.09406392694063927, 'fraction_numerical': 0.0027397260273972603, 'mean_word_length': 2.242603550295858, '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': '4399105', 'n_tokens_mistral': 327, 'n_tokens_neox': 324, 'n_words': 84}