<commit_before>from collections import defaultdict
from xml.etree import ElementTree
from django.conf import settings
from corehq.apps.fixtures.models import FixtureDataItem, FixtureDataType
from corehq.apps.users.models import CommCareUser
from dimagi.utils.modules import to_function


def item_lists_by_domain(domain):
    ret = list()
    for data_type in FixtureDataType.by_domain(domain):
        ret.append({
            'sourceUri': 'jr://fixture/item-list:%s' % data_type.tag,
            'defaultId': data_type.tag,
            'initialQuery': "instance('{tag}')/item-list:{tag}/{tag}".format(tag=data_type.tag),
            'name': data_type.tag,
            'structure': {
                f.field_name: {
                    'name': f.field_name,
                    'no_option': True
                } for f in data_type.fields},
        })
    return ret

def item_lists(user, version, last_sync=None):
    assert isinstance(user, CommCareUser)

    all_types = dict([(t._id, t) for t in FixtureDataType.by_domain(user.domain)])
    global_types = dict([(id, t) for id, t in all_types.items() if t.is_global])

    items_by_type = defaultdict(list)

    def _set_cached_type(item, data_type):<commit_msg>remove unused imports<commit_after>from collections import defaultdict
from xml.etree import ElementTree
from corehq.apps.fixtures.models import FixtureDataItem, FixtureDataType
from corehq.apps.users.models import CommCareUser


def item_lists_by_domain(domain):
    ret = list()
    for data_type in FixtureDataType.by_domain(domain):
        ret.append({
            'sourceUri': 'jr://fixture/item-list:%s' % data_type.tag,
            'defaultId': data_type.tag,
            'initialQuery': "instance('{tag}')/item-list:{tag}/{tag}".format(tag=data_type.tag),
            'name': data_type.tag,
            'structure': {
                f.field_name: {
                    'name': f.field_name,
                    'no_option': True
                } for f in data_type.fields},
        })
    return ret

def item_lists(user, version, last_sync=None):
    assert isinstance(user, CommCareUser)

    all_types = dict([(t._id, t) for t in FixtureDataType.by_domain(user.domain)])
    global_types = dict([(id, t) for id, t in all_types.items() if t.is_global])

    items_by_type = defaultdict(list)

    def _set_cached_type(item, data_type):
{'fraction_non_alphanumeric': 0.11707523245984784, 'fraction_numerical': 0.0, 'mean_word_length': 2.8676470588235294, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, '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': '2260324', 'n_tokens_mistral': 752, 'n_tokens_neox': 739, 'n_words': 161}