<commit_before>#!/usr/bin/env python
"""
Import various important system tables.
"""
from eve_db.models import *
from importer_classes import SQLImporter

class Importer_eveUnits(SQLImporter):
    def import_row(self, row):
        imp_obj, created = EveUnit.objects.get_or_create(id=row['unitid'])
        imp_obj.name = row['unitname']
        imp_obj.display_name = row['displayname']
        imp_obj.description = row['description']
        imp_obj.save()

class Importer_eveNames(SQLImporter):
    DEPENDENCIES = ['invTypes', 'invCategories', 'invGroups']

    def import_row(self, row):
        imp_obj = EveName(id=row['itemID'])
        imp_obj.name = row['itemName']
        imp_obj.category = InvCategory(id=row['categoryID'])
        imp_obj.group = InvGroup(id=row['groupID'])
        imp_obj.type = InvType(id=row['typeID'])
        imp_obj.save()

class Importer_eveIcons(SQLImporter):
    def import_row(self, row):
        graphic, created = EveIcon.objects.get_or_create(id=row['iconID'])
        graphic.file = row['iconFile']
        graphic.description = row['description']

        graphic.save()


class Importer_eveGraphics(SQLImporter):
    def import_row(self, row):
        graphic, created = EveGraphic.objects.get_or_create(id=row['graphicID'])
        graphic.name = row['graphicName']
        graphic.file = row['graphicFile']
        graphic.description = row['description']
<commit_msg>speed up system importers<commit_after>#!/usr/bin/env python
"""
Import various important system tables.
"""
from eve_db.models import *
from importer_classes import SQLImporter

class Importer_eveUnits(SQLImporter):
    def import_row(self, row):
        imp_obj = EveUnit(id=row['unitid'])
        imp_obj.name = row['unitname']
        imp_obj.display_name = row['displayname']
        imp_obj.description = row['description']
        imp_obj.save()

class Importer_eveNames(SQLImporter):
    DEPENDENCIES = ['invTypes', 'invCategories', 'invGroups']

    def import_row(self, row):
        imp_obj = EveName(id=row['itemID'])
        imp_obj.name = row['itemName']
        imp_obj.category = InvCategory(id=row['categoryID'])
        imp_obj.group = InvGroup(id=row['groupID'])
        imp_obj.type = InvType(id=row['typeID'])
        imp_obj.save()

class Importer_eveIcons(SQLImporter):
    def import_row(self, row):
        graphic = EveIcon(id=row['iconID'])
        graphic.file = row['iconFile']
        graphic.description = row['description']
        graphic.save()


class Importer_eveGraphics(SQLImporter):
    def import_row(self, row):
        graphic = EveGraphic(id=row['graphicID'])
        graphic.name = row['graphicName']
        graphic.file = row['graphicFile']
        graphic.description = row['description']

{'fraction_non_alphanumeric': 0.13253449527959332, 'fraction_numerical': 0.0, 'mean_word_length': 3.62248322147651, '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': '961641', 'n_tokens_mistral': 887, 'n_tokens_neox': 872, 'n_words': 152}