<commit_before># -*- coding: utf-8 -*-
""" Varian Vista-PRO ICP
"""
import csv
import logging

from bika.lims.exportimport.instruments.resultsimport import \
    AnalysisResultsImporter, InstrumentResultsFileParser
from bika.lims import bikaMessageFactory as _
from bika.lims.utils import t
import json
import traceback

logger = logging.getLogger(__name__)

title = "Varian Vista-PRO ICP"


class VistaPROICPParser(InstrumentResultsFileParser):
    """ Vista-PRO Parser
    """
    def __init__(self, rsf):
        InstrumentResultsFileParser.__init__(self, rsf, 'CSV')

    def parse(self):
        """ CSV Parser
        """

        reader = csv.DictReader(self.getInputFile(), delimiter=',')

        for n, row in enumerate(reader):

            resid = row.get("Solution Label", "").strip()

            # Service Keyword
            element = row.get("Element", "").split()[0]

            rawdict = row
            rawdict['DefaultResult'] = 'Solution Label'

            self._addRawResult(resid, values={element: rawdict}, override=False)


class VistaPROICPImporter(AnalysisResultsImporter):
    """ Importer
    """

    def __init__(self, parser, context, idsearchcriteria, override,
                 allowed_ar_states=None, allowed_analysis_states=None,
                 instrument_uid=None):

        AnalysisResultsImporter.__init__(self,
                                         parser,
                                         context,
                                         idsearchcriteria,
                                         override,
                                         allowed_ar_states,
                                         allowed_analysis_states,
                                         instrument_uid)

<commit_msg>Changed default result column (guessed)<commit_after># -*- coding: utf-8 -*-
""" Varian Vista-PRO ICP
"""
import csv
import logging

from bika.lims.exportimport.instruments.resultsimport import \
    AnalysisResultsImporter, InstrumentResultsFileParser
from bika.lims import bikaMessageFactory as _
from bika.lims.utils import t
import json
import traceback

logger = logging.getLogger(__name__)

title = "Varian Vista-PRO ICP"


class VistaPROICPParser(InstrumentResultsFileParser):
    """ Vista-PRO Parser
    """
    def __init__(self, rsf):
        InstrumentResultsFileParser.__init__(self, rsf, 'CSV')

    def parse(self):
        """ CSV Parser
        """

        reader = csv.DictReader(self.getInputFile(), delimiter=',')

        for n, row in enumerate(reader):

            resid = row.get("Solution Label", "").strip()

            # Service Keyword
            element = row.get("Element", "").split()[0]

            rawdict = row
            rawdict['DefaultResult'] = 'Soln Conc'

            self._addRawResult(resid, values={element: rawdict}, override=False)


class VistaPROICPImporter(AnalysisResultsImporter):
    """ Importer
    """

    def __init__(self, parser, context, idsearchcriteria, override,
                 allowed_ar_states=None, allowed_analysis_states=None,
                 instrument_uid=None):

        AnalysisResultsImporter.__init__(self,
                                         parser,
                                         context,
                                         idsearchcriteria,
                                         override,
                                         allowed_ar_states,
                                         allowed_analysis_states,
                                         instrument_uid)


{'fraction_non_alphanumeric': 0.09031893875246966, 'fraction_numerical': 0.0011289867344058708, 'mean_word_length': 1.8015810276679842, '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': 28, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '11523', 'n_tokens_mistral': 888, 'n_tokens_neox': 833, 'n_words': 192}