qrenderer.RenderDocFunction

RenderDocFunction(
    layout_obj,
    renderer,
    level=1,
    show_title=True,
    show_signature=True,
    show_description=True,
    show_body=True,
    show_signature_name=True,
    show_signature_annotation=False,
    show_object_name=True,
    show_object_symbol=True,
    show_object_labels=True
)

Extend Rendering of a layout.DocFunction object

Parameter Attributes

layout_obj: (
    layout.DocClass
    | layout.DocFunction
    | layout.DocAttribute
    | layout.DocModule
    | layout.Page
    | layout.Section
    | layout.Link
    | layout.Layout
)

Layout object to be documented

renderer: QRenderer

Renderer that holds the configured values

level: int = 1

The depth of the object in the documentation

show_title: bool = True

Whether to show the title of the object

The title includes:

1. symbol for the object
2. name of the object
3. labels the object

Each of this can be independently turned off.

show_signature: bool = True

Whether to show the signature

show_description: bool = True

Whether to show the description of the object

This only applies to objects that have descriptions that are not considered part of the body documentation body.

This attribute is not well defined and it may change in the future.

show_body: bool = True

Whether to show the documentation body of the object

show_signature_name: bool = True

Whether to show the name of the object in the signature

show_signature_annotation: bool = False

Where to show type annotations in the signature

The default is False because they are better displayed in the parameter definitions.

show_object_name: bool = True

Whether to show the name of the object

This is part of the title

show_object_symbol: bool = True

Whether to show the symbol of the object

This is part of the title

show_object_labels: bool = True

Whether to show the labels of the object

This is part of the title

Attributes

Name Description
body The body that the documented object
description The description that the documented object
function_parameters Return the parameters of the function
kind Return the object’s kind
labels Return labels for an object (iff object is a function/method)
signature The signature of the object (if any)
summary The summary of the documented object
title The title/header of a docstring, including any anchors

body

body : BlockContent

The body that the documented object

Do not override this property.

description

description : BlockContent

The description that the documented object

Do not override this property.

function_parameters

function_parameters : gf.Parameters

Return the parameters of the function

kind

kind : DocObjectKind

Return the object’s kind

labels

labels : Sequence[str]

Return labels for an object (iff object is a function/method)

signature

signature : BlockContent

The signature of the object (if any)

Do not override this property.

summary

summary

The summary of the documented object

Do not override this property.

title

title : BlockContent

The title/header of a docstring, including any anchors

Do not override this property.

Methods

Name Description
clear_page_path Set the page to the page where object will be rendered to nothing
format_name Return a name to use for the object
render_annotation Render an annotation
render_body Render the docsting of the Doc object
render_description Render the description of the documentation page
render_labels Create codes used for doc labels
render_section Render a section of a docstring
render_signature_parameter Parameter for the function/method signature
render_signature_parameters Render parameters in a function / method signature
render_summary Return a line item that summarises the object
render_title Render the header of a docstring, including any anchors
render_variable_definition Create code snippet that declares a variable

clear_page_path

clear_page_path()

Set the page to the page where object will be rendered to nothing

Do this for objects contained on a parent page

format_name

format_name(format="relative")

Return a name to use for the object

Parameters

format : DisplayNameFormat = "relative"

The format to use for the object’s name.

render_annotation

render_annotation(annotation=None)

Render an annotation

This can be used to renderer the annotation of:

1. self - if it is an Attribute & annotation is None
2. annotation - annotation of a parameter in the signature
   of self

render_body

render_body()

Render the docsting of the Doc object

render_description

render_description()

Render the description of the documentation page

render_labels

render_labels()

Create codes used for doc labels

Given the label names, it returns a Code object that creates the following HTML

render_section

render_section(el)

Render a section of a docstring

Parameters

el : gf.DocstringSection

The section to render

Notes

To render a given type of section differently, register a singledispatchmethod method for that type of section.

render_signature_parameter

render_signature_parameter(el)

Parameter for the function/method signature

This is a single item in the brackets of

func(a, b, c=3, d=4, **kwargs)

render_signature_parameters

render_signature_parameters()

Render parameters in a function / method signature

i.e. The stuff in the brackets of func(a, b, c=3, d=4, **kwargs)

render_summary

render_summary()

Return a line item that summarises the object

render_title

render_title()

Render the header of a docstring, including any anchors

render_variable_definition

render_variable_definition(name, annotation, default)

Create code snippet that declares a variable

This applies to function parameters and module/class attributes

Parameters

name : str

Name of the variable

annotation : str | None

Type Annotation of the variable or parameter

default : str | gf.Expr | None

Default value of the variable/parameter.