Skip to content

comicbox.identifiers ΒΆ

Identifier consts.

match_id_source_str(match) ΒΆ

Get the id source from either of the two source groups.

Source code in comicbox/identifiers/__init__.py
73
74
75
def match_id_source_str(match: re.Match) -> str:
    """Get the id source from either of the two source groups."""
    return match.group(ID_SOURCE_GROUP) or match.group(ALT_ID_SOURCE_GROUP) or ""

ranked_id_sources(candidates) ΒΆ

Yield the id source values in candidates, best ranked source first.

Source code in comicbox/identifiers/__init__.py
23
24
25
26
27
28
29
def ranked_id_sources(candidates: Container[str]) -> Iterator[str]:
    """Yield the id source values in candidates, best ranked source first."""
    return (
        id_source_str
        for id_source_str in ID_SOURCE_VALUES
        if id_source_str in candidates
    )