INNER CODE UNIT · Python

fraction

ProtonVPN/android-app · jacocoConverter.py:92

def fraction(covered, missed):
    return covered / (covered + missed)

def sum(covered, missed):
    return covered + missed

def counter(source, type, operation=fraction):
    cs = source.findall('counter')
    c = next((ct for ct in cs if ct.attrib.get('type') == type), None)

    if c is not None:
        covered = float(c.attrib['covered'])
        missed  = float(c.attrib['missed'])

        return str(operation(covered, missed))
    else:
        return '0.0'

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…