def check_order()

in scripts/interface_order.py [0:0]


def check_order(file_path: pathlib.Path, quiet: bool) -> bool:
    content = _read_file_content(file_path)
    if content is None:
        sys.exit(ExitCode.FAILURE)

    tree = _parse_python_code(content, str(file_path))
    if tree is None:
        sys.exit(ExitCode.FAILURE)

    class_names = _extract_top_level_class_names(tree)
    function_names = _extract_top_level_function_names(tree)

    all_ok = True
    if not _verify_names_are_sorted(function_names, str(file_path), "function"):
        all_ok = False

    for class_name in class_names:
        if class_name.startswith("_"):
            print(f"!! {file_path} - class '{class_name}' is private", file=sys.stderr)
            all_ok = False

    if (not quiet) or (str(file_path) not in _CLASS_EXEMPTIONS):
        if not _verify_names_are_sorted(class_names, str(file_path), "class"):
            all_ok = False

    return all_ok