(d, name="", sep=".", out=sys.stdout)
recursively dump comments, all but the toplevel preceded by the path
    in dotted form x.0.a
recursively dump comments, all but the toplevel preceded by the path
    in dotted form x.0.a
recursively dump comments all but the toplevel preceded by the path in dotted form x . 0 . a
def dump_comments(d, name="", sep=".", out=sys.stdout):
    # type: (Any, str, str, Any) -> None
    """
    recursively dump comments, all but the toplevel preceded by the path
    in dotted form x.0.a
    """
    if isinstance(d, dict) and hasattr(d, "ca"):
        if name:
            sys.stdout.write("{}\n".format(name))
        out.write("{}\n".format(d.ca))  # type: ignore
        for k in d:
            dump_comments(d[k], name=(name + sep + k) if name else k, sep=sep, out=out)
    elif isinstance(d, list) and hasattr(d, "ca"):
        if name:
            sys.stdout.write("{}\n".format(name))
        out.write("{}\n".format(d.ca))  # type: ignore
        for idx, k in enumerate(d):
            dump_comments(
                k, name=(name + sep + str(idx)) if name else str(idx), sep=sep, out=out
            )
def dump_comments ( d , name = "" , sep = "." , out = sys . stdout ) : # type: (Any, str, str, Any) -> None if isinstance ( d , dict ) and hasattr ( d , "ca" ) : if name : sys . stdout . write ( "{}\n" . format ( name ) ) out . write ( "{}\n" . format ( d . ca ) ) # type: ignore for k in d : dump_comments ( d [ k ] , name = ( name + sep + k ) if name else k , sep = sep , out = out ) elif isinstance ( d , list ) and hasattr ( d , "ca" ) : if name : sys . stdout . write ( "{}\n" . format ( name ) ) out . write ( "{}\n" . format ( d . ca ) ) # type: ignore for idx , k in enumerate ( d ) : dump_comments ( k , name = ( name + sep + str ( idx ) ) if name else str ( idx ) , sep = sep , out = out )