<commit_before>from django.core.management.base import BaseCommand
from django.db import transaction

from courses.models import Course
from tasks.models import Task

from xml.dom.minidom import parse
from optparse import make_option
import copy


def get_users_from_cs_xml(cs_xml_fn):
    doc = parse(cs_xml_fn)
    for student_el in doc.getElementsByTagName("student"):
        student = {
            'login': student_el.getAttribute('login'),
            'name': student_el.getAttribute('name'),
            'grp': student_el.getAttribute('grp'),
        }
        yield student


class Command(BaseCommand):
    help = "Copy course"

    def add_arguments(self, parser):
        parser.add_argument('--course_id', dest='course_id', help='Course id', type=int)

    @transaction.atomic
    def handle(self, **options):
        course_id = options['course_id']
        if course_id:
            course_id = int(course_id)<commit_msg>Drop useless code from course_copy management script<commit_after>from django.core.management.base import BaseCommand
from django.db import transaction

from courses.models import Course
from tasks.models import Task

from xml.dom.minidom import parse
import copy


class Command(BaseCommand):
    help = "Copy course"

    def add_arguments(self, parser):
        parser.add_argument('--course_id', dest='course_id', help='Course id', type=int)

    @transaction.atomic
    def handle(self, **options):
        course_id = options['course_id']
        if course_id:
            course_id = int(course_id)
{'fraction_non_alphanumeric': 0.09863724853990916, 'fraction_numerical': 0.0, 'mean_word_length': 3.5352941176470587, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 5}, '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': '5707295', 'n_tokens_mistral': 441, 'n_tokens_neox': 436, 'n_words': 116}