[Python] Pythonic Doxygen function signature rendering

Discussão em 'Python' iniciado por Stack, Março 14, 2025.

  1. Stack

    Stack Membro Participativo

    given the python function:

    @staticmethod
    def check_for_conflicting_method(
    this_scope: Scope, target_scope: Scope, new_function: Asts.FunctionPrototypeAst,
    conflict_type: FunctionConflictCheckType)\
    -> Optional[Asts.FunctionPrototypeAst]:

    """!
    Check for conflicting methods between the new function, and functions in the type scope. This function has two
    uses:
    * Check if an overload conflicts with an existing overload in the same type.
    * Check if a method is overriding a base class method (ie there is a signature conflict).

    @param this_scope The scope of the new function being checked.
    @param target_scope The scope to check for conflicts in (for example a class).
    @param new_function The new function AST (its scope is @p this_scope).
    @param conflict_type The type of conflict to check for: overload or override.

    @return A conflicting function if one is found, or None if no conflict is found.
    """


    the Doxygen render is:

    [​IMG]

    i'd like, at the very least, for the render to look like:

    Optional[Asts.FunctionPrototypeAst]
    check_for_conflicting_method(
    Scope this_scope,
    Scope target_scope,
    Asts.FunctionPrototypeAst new_function,
    FunctionConflictCheckType conflict_type)


    or even better:

    check_for_conflicting_method(
    this_scope: Scope,
    target_scope: Scope,
    new_function: Asts.FunctionPrototypeAst,
    conflict_type: FunctionConflictCheckType)
    -> Optional[Asts.FunctionPrototypeAst]


    but i'm not too bothered about if the trailing types. really i'd just like a newline between the return type and function name, and every parameter on a newline, tabbed in.

    i've tried a variety of css options with table.memname td.funcname/memproto/params/sig-parm/sig-return/tr etc but haven't found suitable css for moving all the parameters onto newlines with a visible indentation.

    table.memname td.funcname {
    display: block;
    font-weight: bold;
    padding-bottom: 5px;
    }

    table.memname tr {
    display: block;
    margin-bottom: 5px;
    }


    brings the parameters, except for the first one, onto new lines, but without an indentation, but i'm not sure where to go from here.

    Continue reading...

Compartilhe esta Página