Skip to content

utils ¤

Functions:

Name Description
compare

compare ¤

compare(a: Sequence[str], b: Sequence[str], name_a: str = 'source', name_b: str = 'updated', *, diff_format: Literal['unified', 'html'])
Source code in src/bioimageio/core/utils/_compare.py
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
def compare(
    a: Sequence[str],
    b: Sequence[str],
    name_a: str = "source",
    name_b: str = "updated",
    *,
    diff_format: Literal["unified", "html"],
):
    if diff_format == "html":
        diff = HtmlDiff().make_file(a, b, name_a, name_b, charset="utf-8")
    elif diff_format == "unified":
        diff = "\n".join(
            unified_diff(
                a,
                b,
                name_a,
                name_b,
                lineterm="",
            )
        )
    else:
        assert_never(diff_format)

    return diff