<commit_before>import importlib
from config.probeconfig import probe_celery
from lib.irma.common.objects import ScanResults
from lib.irma.fileobject.handler import FileObject
from config.config import AVNAME

mscan = importlib.import_module("probe." + AVNAME)

@probe_celery.task()
def probe_scan(scan_oid, file_oid):
    sfile = FileObject(_id=file_oid)
    scan_results = mscan.scan(sfile)
    r = ScanResults(_id=file_oid)
    if AVNAME not in r.probelist:
        r.probelist.append(AVNAME)
        r.results.update({AVNAME:scan_results})
    return {'scan_oid':scan_oid, 'file_oid': file_oid, 'avname': AVNAME}
<commit_msg>class for task return values and one for frontend return values<commit_after>import importlib
from config.probeconfig import probe_celery
from lib.irma.common.objects import ScanResults
from lib.irma.common.utils import IrmaTaskReturn
from lib.irma.fileobject.handler import FileObject
from config.config import AVNAME

mscan = importlib.import_module("probe." + AVNAME)

@probe_celery.task()
def probe_scan(scan_oid, file_oid):
    sfile = FileObject(_id=file_oid)
    scan_results = mscan.scan(sfile)
    r = ScanResults(_id=file_oid)
    if AVNAME not in r.probelist:
        r.probelist.append(AVNAME)
        r.results.update({AVNAME:scan_results})
    return IrmaTaskReturn.success({'scan_oid':scan_oid, 'file_oid': file_oid, 'avname': AVNAME})

{'fraction_non_alphanumeric': 0.09862218999274837, 'fraction_numerical': 0.0, 'mean_word_length': 5.079295154185022, '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': '7168732', 'n_tokens_mistral': 458, 'n_tokens_neox': 453, 'n_words': 102}