from typing import List
from typing import Dict
from typing import Any
from typing import Set


def parse_kinds(taints: List[Dict[str, Any]]) -> Set[str]:
    """
    Parse the list of sources/sinks/tito from a Pysa JSON output
    dump, e.g.
        [ { "decl": null, "kinds": [ { "kind": "Test" } ]
    into a set consisting of just the leaf names, i.e.
        { "Test" }
    """
    kinds = set()

    for taint in taints:
        for kind in taint.get("kinds", []):
            kinds.add(kind["kind"])
        for kind in taint.get("leaves", []):
            kinds.add(kind["kind"])

    return kinds