def rate(hit: int, num: int) -> str:
    """Return the fraction of `hit`/`num`, as a string."""
    if num == 0:
        return "1"
    else:
        return "%.4g" % (hit / num)
Return the fraction of `hit`/`num`, as a string.
coverage/xmlreport.py