<commit_before># Generated by Django 3.2.12 on 2022-03-27 01:11

import InvenTree.fields
import django.core.validators
from django.core import serializers
from django.db import migrations, models
import django.db.models.deletion
import djmoney.models.fields
import djmoney.models.validators


def _convert_model(apps, line_item_ref, extra_line_ref, price_ref):
    """Convert the OrderLineItem instances if applicable to new ExtraLine instances"""
    OrderLineItem = apps.get_model('order', line_item_ref)
    OrderExtraLine = apps.get_model('order', extra_line_ref)

    items_to_change = OrderLineItem.objects.filter(part=None)

    print(f'\nFound {items_to_change.count()} old {line_item_ref} instance(s)')
    print(f'Starting to convert - currently at {OrderExtraLine.objects.all().count()} {extra_line_ref} / {OrderLineItem.objects.all().count()} {line_item_ref} instance(s)')
    for lineItem in items_to_change:
        newitem = OrderExtraLine(
            order=lineItem.order,
            notes=lineItem.notes,
            price=getattr(lineItem, price_ref),<commit_msg>only print if models found<commit_after># Generated by Django 3.2.12 on 2022-03-27 01:11

import InvenTree.fields
import django.core.validators
from django.core import serializers
from django.db import migrations, models
import django.db.models.deletion
import djmoney.models.fields
import djmoney.models.validators


def _convert_model(apps, line_item_ref, extra_line_ref, price_ref):
    """Convert the OrderLineItem instances if applicable to new ExtraLine instances"""
    OrderLineItem = apps.get_model('order', line_item_ref)
    OrderExtraLine = apps.get_model('order', extra_line_ref)

    items_to_change = OrderLineItem.objects.filter(part=None)
    if items_to_change.count() == 0:
        return

    print(f'\nFound {items_to_change.count()} old {line_item_ref} instance(s)')
    print(f'Starting to convert - currently at {OrderExtraLine.objects.all().count()} {extra_line_ref} / {OrderLineItem.objects.all().count()} {line_item_ref} instance(s)')
    for lineItem in items_to_change:
        newitem = OrderExtraLine(
            order=lineItem.order,
            notes=lineItem.notes,
            price=getattr(lineItem, price_ref),
{'fraction_non_alphanumeric': 0.10309278350515463, 'fraction_numerical': 0.014791573285522188, 'mean_word_length': 4.566084788029925, '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': '19607', 'n_tokens_mistral': 719, 'n_tokens_neox': 687, 'n_words': 157}