<commit_before>import os
import re
from lxml import etree

class DndToCatsoop:
    '''
    Convert DND xml file (+ associated) to format used in catsoop LMS
    '''
    def __init__(self, l2d, check_fn=None):
        '''
        l2d = LatexToDragDrop instance
        '''
        ofn = l2d.fnpre + ".md"
        xmlfn = l2d.xmlfn
        clean_fn = l2d.fnpre.replace(' ', '_')
        clean_fn = clean_fn.replace('.', '_')
        xmlmd = self.make_drag_and_drop(xmlfn, check_fn)
        md = "<question drag_and_drop>\n"
        md += xmlmd
        md += "\n"
        md += 'csq_name="""%s"""\n' % clean_fn
        md += "</question>\n"<commit_msg>allow nsubmit=xx to be added as an option, to pass through to catsoop<commit_after>import os
import re
from lxml import etree

class DndToCatsoop:
    '''
    Convert DND xml file (+ associated) to format used in catsoop LMS
    '''
    def __init__(self, l2d, check_fn=None):
        '''
        l2d = LatexToDragDrop instance
        '''
        ofn = l2d.fnpre + ".md"
        xmlfn = l2d.xmlfn
        clean_fn = l2d.fnpre.replace(' ', '_')
        clean_fn = clean_fn.replace('.', '_')
        xmlmd = self.make_drag_and_drop(xmlfn, check_fn)
        md = "<question drag_and_drop>\n"
        md += xmlmd
        md += "\n"
        md += 'csq_name = """%s"""\n' % clean_fn
        md += 'csq_nsubmits = %s\n' % l2d.options.get('nsubmits', 10)
        md += "</question>\n"
{'fraction_non_alphanumeric': 0.14375876577840113, 'fraction_numerical': 0.0091164095371669, 'mean_word_length': 2.1995515695067263, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 14}, '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': '4086802', 'n_tokens_mistral': 513, 'n_tokens_neox': 508, 'n_words': 121}