h2o-bindings/bin/bindings.py
def schemas(raw=False):
    """
    Return the list of H₂O schemas.

    :param raw: if True, then the complete response to .../schemas is returned (including the metadata)
    """
    json = _request_or_exit("/3/Metadata/schemas")
    if raw: return json
    assert "schemas" in json, "Unexpected result from /3/Metadata/schemas call"

    # Simplify names of some horribly sounding enums
    pattern0 = re.compile(r"^\w+(V\d+)\D\w+$")
    pattern1 = re.compile(r"^(\w{3,})(\1)Model\1Parameters(\w+)$", re.IGNORECASE)
    pattern2 = re.compile(r"^(\w{3,})(\1)(\w+)$", re.IGNORECASE)

    def translate_name(name):
        if name is None: return
        if name.startswith("Apischemas3"): name = name[len("Apischemas3"):]
        if name.startswith("Apischemas4input"): name = name[len("Apischemas4input"):]
        if name.startswith("Apischemas4output"): name = name[len("Apischemas4output"):]
        if "V3" in name: name = name.replace("V3", "") + "V3"  # force multiple "V3"s at the end
        if "V4" in name: name = name.replace("V4", "") + "V4"  # force multiple "V4"s at the end
        if name == "CreateframerecipesSimpleCreateFrameRecipeResponseType": return "SimpleRecipeResponseType"
        assert not pattern0.match(name), "Bad schema name %s (version number in the middle)" % name
        mm = pattern1.match(name) or pattern2.match(name)
        if mm: return mm.group(2) + mm.group(3)
        return name
    for schema in json["schemas"]:
        schema["name"] = translate_name(schema["name"])
        for field in schema["fields"]:
            field["schema_name"] = translate_name(field["schema_name"])

    return json["schemas"]
def schemas(raw=False):
    """
    Return the list of H₂O schemas.

    :param raw: if True, then the complete response to .../schemas is returned (including the metadata)
    """
    json = _request_or_exit("/3/Metadata/schemas")
    if raw: return json
    assert "schemas" in json, "Unexpected result from /3/Metadata/schemas call"

    # Simplify names of some horribly sounding enums
    pattern0 = re.compile(r"^\w+(V\d+)\D\w+$")
    pattern1 = re.compile(r"^(\w{3,})(\1)Model\1Parameters(\w+)$", re.IGNORECASE)
    pattern2 = re.compile(r"^(\w{3,})(\1)(\w+)$", re.IGNORECASE)

    def translate_name(name):
        if name is None: return
        if name.startswith("Apischemas3"): name = name[len("Apischemas3"):]
        if name.startswith("Apischemas4input"): name = name[len("Apischemas4input"):]
        if name.startswith("Apischemas4output"): name = name[len("Apischemas4output"):]
        if "V3" in name: name = name.replace("V3", "") + "V3"  # force multiple "V3"s at the end
        if "V4" in name: name = name.replace("V4", "") + "V4"  # force multiple "V4"s at the end
        if name == "CreateframerecipesSimpleCreateFrameRecipeResponseType": return "SimpleRecipeResponseType"
        assert not pattern0.match(name), "Bad schema name %s (version number in the middle)" % name
        mm = pattern1.match(name) or pattern2.match(name)
        if mm: return mm.group(2) + mm.group(3)
        return name
    for schema in json["schemas"]:
        schema["name"] = translate_name(schema["name"])
        for field in schema["fields"]:
            field["schema_name"] = translate_name(field["schema_name"])

    return json["schemas"]
Return the list of H₂O schemas.

    :param raw: if True, then the complete response to .../schemas is returned (including the metadata)