<commit_before>'use strict';

define(['src/util/util', './PrintServer', './printProcessors'], function (Util, PrintServer, processors) {

    class Printer {
        constructor(printer, printServer) {
            this.url = String(printServer.url);
            this.id = String(printer.id);
            this.printServer = new PrintServer(this.url);

        }

        async print(printFormat, data) {
            if(!processors[printFormat.processor]) throw new Error('processor does not exist');
            processData(printFormat, data);
            const printData = await processors[String(printFormat.processor)].call(null, printFormat, data);
            return await this.printServer.print(this.id, printData);
        }
    }

    function processData(printFormat, data) {
        switch(printFormat.type) {
            case 'sample': {
                if(data.$content && data.$content) {
                    data.uuidShort = data._id.substring(0,12);
                    data.b64Short = Util.hexToBase64(data.uuidShort);
                    data.id = data.$id.join(' ');
                    if(data.$content.general) {
                        data.line1 = data.$content.general.description.substring(0,60);
                        data.line2 = data.$content.general.description.substring(60,120);
                        data.molfile = data.$content.general.molfile;
                    }
                }
                break;
            }
            case 'location': {
                break;
            }
            default: {
                throw new Error('Printer could not process data');
            }
        }
    }

    return Printer;
});<commit_msg>print fix if no description<commit_after>'use strict';

define(['src/util/util', './PrintServer', './printProcessors'], function (Util, PrintServer, processors) {

    class Printer {
        constructor(printer, printServer) {
            this.url = String(printServer.url);
            this.id = String(printer.id);
            this.printServer = new PrintServer(this.url);

        }

        async print(printFormat, data) {
            if(!processors[printFormat.processor]) throw new Error('processor does not exist');
            processData(printFormat, data);
            const printData = await processors[String(printFormat.processor)].call(null, printFormat, data);
            return await this.printServer.print(this.id, printData);
        }
    }

    function processData(printFormat, data) {
        switch(printFormat.type) {
            case 'sample': {
                if(data.$content && data.$content) {
                    data.uuidShort = data._id.substring(0,12);
                    data.b64Short = Util.hexToBase64(data.uuidShort);
                    data.id = data.$id.join(' ');
                    if(data.$content.general) {
                        if(data.$content.general.description) {
                            data.line1 = data.$content.general.description.substring(0,60);
                            data.line2 = data.$content.general.description.substring(60,120);
                        } else {
                            data.line1 = '';
                            data.line2 = '';
                        }
                        data.molfile = data.$content.general.molfile;
                    }
                }
                break;
            }
            case 'location': {
                break;
            }
            default: {
                throw new Error('Printer could not process data');
            }
        }
    }

    return Printer;
});
{'fraction_non_alphanumeric': 0.11565193216569364, 'fraction_numerical': 0.010008340283569641, 'mean_word_length': 1.5090655509065551, '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': '4093995', 'n_tokens_mistral': 939, 'n_tokens_neox': 877, 'n_words': 162}