Skip to content

Docstring models¤

Main API¤

Docstring ¤

Docstring(
    value: str,
    *,
    lineno: int | None = None,
    endlineno: int | None = None,
    parent: Object | None = None,
    parser: DocstringStyle | Parser | None = None,
    parser_options: dict[str, Any] | None = None
)

This class represents docstrings.

Parameters:

  • value ¤

    (str) –

    The docstring value.

  • lineno ¤

    (int | None, default: None ) –

    The starting line number.

  • endlineno ¤

    (int | None, default: None ) –

    The ending line number.

  • parent ¤

    (Object | None, default: None ) –

    The parent object on which this docstring is attached.

  • parser ¤

    (DocstringStyle | Parser | None, default: None ) –

    The docstring parser to use. By default, no parsing is done.

  • parser_options ¤

    (dict[str, Any] | None, default: None ) –

    Additional docstring parsing options.

Methods:

  • as_dict

    Return this docstring's data as a dictionary.

  • parse

    Parse the docstring into structured data.

Attributes:

endlineno instance-attribute ¤

endlineno: int | None = endlineno

The ending line number of the docstring.

lineno instance-attribute ¤

lineno: int | None = lineno

The starting line number of the docstring.

lines property ¤

lines: list[str]

The lines of the docstring.

parent instance-attribute ¤

parent: Object | None = parent

The object this docstring is attached to.

parsed cached property ¤

The docstring sections, parsed into structured data.

parser instance-attribute ¤

parser: DocstringStyle | Parser | None = parser

The selected docstring parser.

parser_options instance-attribute ¤

parser_options: dict[str, Any] = parser_options or {}

The configured parsing options.

source property ¤

source: str

The original, uncleaned value of the docstring as written in the source.

value instance-attribute ¤

value: str = cleandoc(rstrip())

The original value of the docstring, cleaned by inspect.cleandoc.

as_dict ¤

as_dict(
    *, full: bool = False, **kwargs: Any
) -> dict[str, Any]

Return this docstring's data as a dictionary.

Parameters:

  • full ¤

    (bool, default: False ) –

    Whether to return full info, or just base info.

  • **kwargs ¤

    (Any, default: {} ) –

    Additional serialization options.

Returns:

parse ¤

parse(
    parser: DocstringStyle | Parser | None = None,
    **options: Any,
) -> list[DocstringSection]

Parse the docstring into structured data.

Parameters:

  • parser ¤

    (DocstringStyle | Parser | None, default: None ) –

    The docstring parser to use. In order: use the given parser, or the self parser, or no parser (return a single text section).

  • **options ¤

    (Any, default: {} ) –

    Additional docstring parsing options.

Returns:

Advanced API: Sections¤

DocstringSectionKind ¤


              flowchart TD
              griffe.DocstringSectionKind[DocstringSectionKind]

              

              click griffe.DocstringSectionKind href "" "griffe.DocstringSectionKind"
            

Enumeration of the possible docstring section kinds.

Attributes:

admonition class-attribute instance-attribute ¤

admonition = 'admonition'

Admonition block.

attributes class-attribute instance-attribute ¤

attributes = 'attributes'

Attributes section.

classes class-attribute instance-attribute ¤

classes = 'classes'

Classes section.

deprecated class-attribute instance-attribute ¤

deprecated = 'deprecated'

Deprecation section.

examples class-attribute instance-attribute ¤

examples = 'examples'

Examples section.

functions class-attribute instance-attribute ¤

functions = 'functions'

Functions section.

modules class-attribute instance-attribute ¤

modules = 'modules'

Modules section.

other_parameters class-attribute instance-attribute ¤

other_parameters = 'other parameters'

Other parameters (keyword arguments) section.

parameters class-attribute instance-attribute ¤

parameters = 'parameters'

Parameters section.

raises class-attribute instance-attribute ¤

raises = 'raises'

Raises (exceptions) section.

receives class-attribute instance-attribute ¤

receives = 'receives'

Received value(s) (generators) section.

returns class-attribute instance-attribute ¤

returns = 'returns'

Returned value(s) section.

text class-attribute instance-attribute ¤

text = 'text'

Text section.

warns class-attribute instance-attribute ¤

warns = 'warns'

Warnings section.

yields class-attribute instance-attribute ¤

yields = 'yields'

Yielded value(s) (generators) section.

DocstringSectionText ¤

DocstringSectionText(value: str, title: str | None = None)

              flowchart TD
              griffe.DocstringSectionText[DocstringSectionText]
              _griffe.docstrings.models.DocstringSection[DocstringSection]

                              _griffe.docstrings.models.DocstringSection --> griffe.DocstringSectionText
                


              click griffe.DocstringSectionText href "" "griffe.DocstringSectionText"
              click _griffe.docstrings.models.DocstringSection href "" "_griffe.docstrings.models.DocstringSection"
            

This class represents a text section.

Parameters:

  • value ¤

    (str) –

    The section text.

  • title ¤

    (str | None, default: None ) –

    An optional title.

Methods:

  • __bool__

    Whether this section has a true-ish value.

  • as_dict

    Return this section's data as a dictionary.

Attributes:

kind class-attribute instance-attribute ¤

The section kind.

title instance-attribute ¤

title: str | None = title

The section title.

value instance-attribute ¤

value: str = value

The section value.

__bool__ ¤

__bool__() -> bool

Whether this section has a true-ish value.

as_dict ¤

as_dict(**kwargs: Any) -> dict[str, Any]

Return this section's data as a dictionary.

Parameters:

  • **kwargs ¤

    (Any, default: {} ) –

    Additional serialization options.

Returns:

DocstringSectionParameters ¤

DocstringSectionParameters(
    value: list[DocstringParameter],
    title: str | None = None,
)

              flowchart TD
              griffe.DocstringSectionParameters[DocstringSectionParameters]
              _griffe.docstrings.models.DocstringSection[DocstringSection]

                              _griffe.docstrings.models.DocstringSection --> griffe.DocstringSectionParameters
                


              click griffe.DocstringSectionParameters href "" "griffe.DocstringSectionParameters"
              click _griffe.docstrings.models.DocstringSection href "" "_griffe.docstrings.models.DocstringSection"
            

This class represents a parameters section.

Parameters:

Methods:

  • __bool__

    Whether this section has a true-ish value.

  • as_dict

    Return this section's data as a dictionary.

Attributes:

kind class-attribute instance-attribute ¤

The section kind.

title instance-attribute ¤

title: str | None = title

The section title.

value instance-attribute ¤

The section value.

__bool__ ¤

__bool__() -> bool

Whether this section has a true-ish value.

as_dict ¤

as_dict(**kwargs: Any) -> dict[str, Any]

Return this section's data as a dictionary.

Parameters:

  • **kwargs ¤

    (Any, default: {} ) –

    Additional serialization options.

Returns:

DocstringSectionOtherParameters ¤

DocstringSectionOtherParameters(
    value: list[DocstringParameter],
    title: str | None = None,
)

              flowchart TD
              griffe.DocstringSectionOtherParameters[DocstringSectionOtherParameters]
              _griffe.docstrings.models.DocstringSectionParameters[DocstringSectionParameters]
              _griffe.docstrings.models.DocstringSection[DocstringSection]

                              _griffe.docstrings.models.DocstringSectionParameters --> griffe.DocstringSectionOtherParameters
                                _griffe.docstrings.models.DocstringSection --> _griffe.docstrings.models.DocstringSectionParameters
                



              click griffe.DocstringSectionOtherParameters href "" "griffe.DocstringSectionOtherParameters"
              click _griffe.docstrings.models.DocstringSectionParameters href "" "_griffe.docstrings.models.DocstringSectionParameters"
              click _griffe.docstrings.models.DocstringSection href "" "_griffe.docstrings.models.DocstringSection"
            

This class represents an other parameters section.

Parameters:

Methods:

  • __bool__

    Whether this section has a true-ish value.

  • as_dict

    Return this section's data as a dictionary.

Attributes:

kind class-attribute instance-attribute ¤

The section kind.

title instance-attribute ¤

title: str | None = title

The section title.

value instance-attribute ¤

The section value.

__bool__ ¤

__bool__() -> bool

Whether this section has a true-ish value.

as_dict ¤

as_dict(**kwargs: Any) -> dict[str, Any]

Return this section's data as a dictionary.

Parameters:

  • **kwargs ¤

    (Any, default: {} ) –

    Additional serialization options.

Returns:

DocstringSectionRaises ¤

DocstringSectionRaises(
    value: list[DocstringRaise], title: str | None = None
)

              flowchart TD
              griffe.DocstringSectionRaises[DocstringSectionRaises]
              _griffe.docstrings.models.DocstringSection[DocstringSection]

                              _griffe.docstrings.models.DocstringSection --> griffe.DocstringSectionRaises
                


              click griffe.DocstringSectionRaises href "" "griffe.DocstringSectionRaises"
              click _griffe.docstrings.models.DocstringSection href "" "_griffe.docstrings.models.DocstringSection"
            

This class represents a raises section.

Parameters:

Methods:

  • __bool__

    Whether this section has a true-ish value.

  • as_dict

    Return this section's data as a dictionary.

Attributes:

kind class-attribute instance-attribute ¤

The section kind.

title instance-attribute ¤

title: str | None = title

The section title.

value instance-attribute ¤

The section value.

__bool__ ¤

__bool__() -> bool

Whether this section has a true-ish value.

as_dict ¤

as_dict(**kwargs: Any) -> dict[str, Any]

Return this section's data as a dictionary.

Parameters:

  • **kwargs ¤

    (Any, default: {} ) –

    Additional serialization options.

Returns:

DocstringSectionWarns ¤

DocstringSectionWarns(
    value: list[DocstringWarn], title: str | None = None
)

              flowchart TD
              griffe.DocstringSectionWarns[DocstringSectionWarns]
              _griffe.docstrings.models.DocstringSection[DocstringSection]

                              _griffe.docstrings.models.DocstringSection --> griffe.DocstringSectionWarns
                


              click griffe.DocstringSectionWarns href "" "griffe.DocstringSectionWarns"
              click _griffe.docstrings.models.DocstringSection href "" "_griffe.docstrings.models.DocstringSection"
            

This class represents a warns section.

Parameters:

Methods:

  • __bool__

    Whether this section has a true-ish value.

  • as_dict

    Return this section's data as a dictionary.

Attributes:

kind class-attribute instance-attribute ¤

The section kind.

title instance-attribute ¤

title: str | None = title

The section title.

value instance-attribute ¤

The section value.

__bool__ ¤

__bool__() -> bool

Whether this section has a true-ish value.

as_dict ¤

as_dict(**kwargs: Any) -> dict[str, Any]

Return this section's data as a dictionary.

Parameters:

  • **kwargs ¤

    (Any, default: {} ) –

    Additional serialization options.

Returns:

DocstringSectionReturns ¤

DocstringSectionReturns(
    value: list[DocstringReturn], title: str | None = None
)

              flowchart TD
              griffe.DocstringSectionReturns[DocstringSectionReturns]
              _griffe.docstrings.models.DocstringSection[DocstringSection]

                              _griffe.docstrings.models.DocstringSection --> griffe.DocstringSectionReturns
                


              click griffe.DocstringSectionReturns href "" "griffe.DocstringSectionReturns"
              click _griffe.docstrings.models.DocstringSection href "" "_griffe.docstrings.models.DocstringSection"
            

This class represents a returns section.

Parameters:

Methods:

  • __bool__

    Whether this section has a true-ish value.

  • as_dict

    Return this section's data as a dictionary.

Attributes:

kind class-attribute instance-attribute ¤

The section kind.

title instance-attribute ¤

title: str | None = title

The section title.

value instance-attribute ¤

The section value.

__bool__ ¤

__bool__() -> bool

Whether this section has a true-ish value.

as_dict ¤

as_dict(**kwargs: Any) -> dict[str, Any]

Return this section's data as a dictionary.

Parameters:

  • **kwargs ¤

    (Any, default: {} ) –

    Additional serialization options.

Returns:

DocstringSectionYields ¤

DocstringSectionYields(
    value: list[DocstringYield], title: str | None = None
)

              flowchart TD
              griffe.DocstringSectionYields[DocstringSectionYields]
              _griffe.docstrings.models.DocstringSection[DocstringSection]

                              _griffe.docstrings.models.DocstringSection --> griffe.DocstringSectionYields
                


              click griffe.DocstringSectionYields href "" "griffe.DocstringSectionYields"
              click _griffe.docstrings.models.DocstringSection href "" "_griffe.docstrings.models.DocstringSection"
            

This class represents a yields section.

Parameters:

  • value ¤

    (list[DocstringYield]) –

    The section yielded items.

  • title ¤

    (str | None, default: None ) –

    An optional title.

Methods:

  • __bool__

    Whether this section has a true-ish value.

  • as_dict

    Return this section's data as a dictionary.

Attributes:

kind class-attribute instance-attribute ¤

The section kind.

title instance-attribute ¤

title: str | None = title

The section title.

value instance-attribute ¤

The section value.

__bool__ ¤

__bool__() -> bool

Whether this section has a true-ish value.

as_dict ¤

as_dict(**kwargs: Any) -> dict[str, Any]

Return this section's data as a dictionary.

Parameters:

  • **kwargs ¤

    (Any, default: {} ) –

    Additional serialization options.

Returns:

DocstringSectionReceives ¤

DocstringSectionReceives(
    value: list[DocstringReceive], title: str | None = None
)

              flowchart TD
              griffe.DocstringSectionReceives[DocstringSectionReceives]
              _griffe.docstrings.models.DocstringSection[DocstringSection]

                              _griffe.docstrings.models.DocstringSection --> griffe.DocstringSectionReceives
                


              click griffe.DocstringSectionReceives href "" "griffe.DocstringSectionReceives"
              click _griffe.docstrings.models.DocstringSection href "" "_griffe.docstrings.models.DocstringSection"
            

This class represents a receives section.

Parameters:

Methods:

  • __bool__

    Whether this section has a true-ish value.

  • as_dict

    Return this section's data as a dictionary.

Attributes:

kind class-attribute instance-attribute ¤

The section kind.

title instance-attribute ¤

title: str | None = title

The section title.

value instance-attribute ¤

The section value.

__bool__ ¤

__bool__() -> bool

Whether this section has a true-ish value.

as_dict ¤

as_dict(**kwargs: Any) -> dict[str, Any]

Return this section's data as a dictionary.

Parameters:

  • **kwargs ¤

    (Any, default: {} ) –

    Additional serialization options.

Returns:

DocstringSectionExamples ¤

DocstringSectionExamples(
    value: list[tuple[Literal[text, examples], str]],
    title: str | None = None,
)

              flowchart TD
              griffe.DocstringSectionExamples[DocstringSectionExamples]
              _griffe.docstrings.models.DocstringSection[DocstringSection]

                              _griffe.docstrings.models.DocstringSection --> griffe.DocstringSectionExamples
                


              click griffe.DocstringSectionExamples href "" "griffe.DocstringSectionExamples"
              click _griffe.docstrings.models.DocstringSection href "" "_griffe.docstrings.models.DocstringSection"
            

This class represents an examples section.

Parameters:

Methods:

  • __bool__

    Whether this section has a true-ish value.

  • as_dict

    Return this section's data as a dictionary.

Attributes:

kind class-attribute instance-attribute ¤

The section kind.

title instance-attribute ¤

title: str | None = title

The section title.

value instance-attribute ¤

The section value.

__bool__ ¤

__bool__() -> bool

Whether this section has a true-ish value.

as_dict ¤

as_dict(**kwargs: Any) -> dict[str, Any]

Return this section's data as a dictionary.

Parameters:

  • **kwargs ¤

    (Any, default: {} ) –

    Additional serialization options.

Returns:

DocstringSectionAttributes ¤

DocstringSectionAttributes(
    value: list[DocstringAttribute],
    title: str | None = None,
)

              flowchart TD
              griffe.DocstringSectionAttributes[DocstringSectionAttributes]
              _griffe.docstrings.models.DocstringSection[DocstringSection]

                              _griffe.docstrings.models.DocstringSection --> griffe.DocstringSectionAttributes
                


              click griffe.DocstringSectionAttributes href "" "griffe.DocstringSectionAttributes"
              click _griffe.docstrings.models.DocstringSection href "" "_griffe.docstrings.models.DocstringSection"
            

This class represents an attributes section.

Parameters:

Methods:

  • __bool__

    Whether this section has a true-ish value.

  • as_dict

    Return this section's data as a dictionary.

Attributes:

kind class-attribute instance-attribute ¤

The section kind.

title instance-attribute ¤

title: str | None = title

The section title.

value instance-attribute ¤

The section value.

__bool__ ¤

__bool__() -> bool

Whether this section has a true-ish value.

as_dict ¤

as_dict(**kwargs: Any) -> dict[str, Any]

Return this section's data as a dictionary.

Parameters:

  • **kwargs ¤

    (Any, default: {} ) –

    Additional serialization options.

Returns:

DocstringSectionFunctions ¤

DocstringSectionFunctions(
    value: list[DocstringFunction], title: str | None = None
)

              flowchart TD
              griffe.DocstringSectionFunctions[DocstringSectionFunctions]
              _griffe.docstrings.models.DocstringSection[DocstringSection]

                              _griffe.docstrings.models.DocstringSection --> griffe.DocstringSectionFunctions
                


              click griffe.DocstringSectionFunctions href "" "griffe.DocstringSectionFunctions"
              click _griffe.docstrings.models.DocstringSection href "" "_griffe.docstrings.models.DocstringSection"
            

This class represents a functions/methods section.

Parameters:

Methods:

  • __bool__

    Whether this section has a true-ish value.

  • as_dict

    Return this section's data as a dictionary.

Attributes:

kind class-attribute instance-attribute ¤

The section kind.

title instance-attribute ¤

title: str | None = title

The section title.

value instance-attribute ¤

The section value.

__bool__ ¤

__bool__() -> bool

Whether this section has a true-ish value.

as_dict ¤

as_dict(**kwargs: Any) -> dict[str, Any]

Return this section's data as a dictionary.

Parameters:

  • **kwargs ¤

    (Any, default: {} ) –

    Additional serialization options.

Returns:

DocstringSectionClasses ¤

DocstringSectionClasses(
    value: list[DocstringClass], title: str | None = None
)

              flowchart TD
              griffe.DocstringSectionClasses[DocstringSectionClasses]
              _griffe.docstrings.models.DocstringSection[DocstringSection]

                              _griffe.docstrings.models.DocstringSection --> griffe.DocstringSectionClasses
                


              click griffe.DocstringSectionClasses href "" "griffe.DocstringSectionClasses"
              click _griffe.docstrings.models.DocstringSection href "" "_griffe.docstrings.models.DocstringSection"
            

This class represents a classes section.

Parameters:

Methods:

  • __bool__

    Whether this section has a true-ish value.

  • as_dict

    Return this section's data as a dictionary.

Attributes:

kind class-attribute instance-attribute ¤

The section kind.

title instance-attribute ¤

title: str | None = title

The section title.

value instance-attribute ¤

The section value.

__bool__ ¤

__bool__() -> bool

Whether this section has a true-ish value.

as_dict ¤

as_dict(**kwargs: Any) -> dict[str, Any]

Return this section's data as a dictionary.

Parameters:

  • **kwargs ¤

    (Any, default: {} ) –

    Additional serialization options.

Returns:

DocstringSectionModules ¤

DocstringSectionModules(
    value: list[DocstringModule], title: str | None = None
)

              flowchart TD
              griffe.DocstringSectionModules[DocstringSectionModules]
              _griffe.docstrings.models.DocstringSection[DocstringSection]

                              _griffe.docstrings.models.DocstringSection --> griffe.DocstringSectionModules
                


              click griffe.DocstringSectionModules href "" "griffe.DocstringSectionModules"
              click _griffe.docstrings.models.DocstringSection href "" "_griffe.docstrings.models.DocstringSection"
            

This class represents a modules section.

Parameters:

Methods:

  • __bool__

    Whether this section has a true-ish value.

  • as_dict

    Return this section's data as a dictionary.

Attributes:

kind class-attribute instance-attribute ¤

The section kind.

title instance-attribute ¤

title: str | None = title

The section title.

value instance-attribute ¤

The section value.

__bool__ ¤

__bool__() -> bool

Whether this section has a true-ish value.

as_dict ¤

as_dict(**kwargs: Any) -> dict[str, Any]

Return this section's data as a dictionary.

Parameters:

  • **kwargs ¤

    (Any, default: {} ) –

    Additional serialization options.

Returns:

DocstringSectionDeprecated ¤

DocstringSectionDeprecated(
    version: str, text: str, title: str | None = None
)

              flowchart TD
              griffe.DocstringSectionDeprecated[DocstringSectionDeprecated]
              _griffe.docstrings.models.DocstringSection[DocstringSection]

                              _griffe.docstrings.models.DocstringSection --> griffe.DocstringSectionDeprecated
                


              click griffe.DocstringSectionDeprecated href "" "griffe.DocstringSectionDeprecated"
              click _griffe.docstrings.models.DocstringSection href "" "_griffe.docstrings.models.DocstringSection"
            

This class represents a deprecated section.

Parameters:

  • version ¤

    (str) –

    The deprecation version.

  • text ¤

    (str) –

    The deprecation text.

  • title ¤

    (str | None, default: None ) –

    An optional title.

Methods:

  • __bool__

    Whether this section has a true-ish value.

  • as_dict

    Return this section's data as a dictionary.

Attributes:

kind class-attribute instance-attribute ¤

The section kind.

title instance-attribute ¤

title: str | None = title

The section title.

value instance-attribute ¤

value: DocstringDeprecated = DocstringDeprecated(
    annotation=version, description=text
)

The section value.

__bool__ ¤

__bool__() -> bool

Whether this section has a true-ish value.

as_dict ¤

as_dict(**kwargs: Any) -> dict[str, Any]

Return this section's data as a dictionary.

Parameters:

  • **kwargs ¤

    (Any, default: {} ) –

    Additional serialization options.

Returns:

DocstringSectionAdmonition ¤

DocstringSectionAdmonition(
    kind: str, text: str, title: str | None = None
)

              flowchart TD
              griffe.DocstringSectionAdmonition[DocstringSectionAdmonition]
              _griffe.docstrings.models.DocstringSection[DocstringSection]

                              _griffe.docstrings.models.DocstringSection --> griffe.DocstringSectionAdmonition
                


              click griffe.DocstringSectionAdmonition href "" "griffe.DocstringSectionAdmonition"
              click _griffe.docstrings.models.DocstringSection href "" "_griffe.docstrings.models.DocstringSection"
            

This class represents an admonition section.

Parameters:

  • kind ¤

    (str) –

    The admonition kind.

  • text ¤

    (str) –

    The admonition text.

  • title ¤

    (str | None, default: None ) –

    An optional title.

Methods:

  • __bool__

    Whether this section has a true-ish value.

  • as_dict

    Return this section's data as a dictionary.

Attributes:

kind class-attribute instance-attribute ¤

The section kind.

title instance-attribute ¤

title: str | None = title

The section title.

value instance-attribute ¤

value: DocstringAdmonition = DocstringAdmonition(
    annotation=kind, description=text
)

The section value.

__bool__ ¤

__bool__() -> bool

Whether this section has a true-ish value.

as_dict ¤

as_dict(**kwargs: Any) -> dict[str, Any]

Return this section's data as a dictionary.

Parameters:

  • **kwargs ¤

    (Any, default: {} ) –

    Additional serialization options.

Returns:

Advanced API: Section items¤

DocstringAdmonition ¤

DocstringAdmonition(
    *,
    description: str,
    annotation: str | Expr | None = None
)

              flowchart TD
              griffe.DocstringAdmonition[DocstringAdmonition]
              _griffe.docstrings.models.DocstringElement[DocstringElement]

                              _griffe.docstrings.models.DocstringElement --> griffe.DocstringAdmonition
                


              click griffe.DocstringAdmonition href "" "griffe.DocstringAdmonition"
              click _griffe.docstrings.models.DocstringElement href "" "_griffe.docstrings.models.DocstringElement"
            

This class represents an admonition.

Parameters:

  • annotation ¤

    (str | Expr | None, default: None ) –

    The element annotation, if any.

  • description ¤

    (str) –

    The element description.

Methods:

  • as_dict

    Return this element's data as a dictionary.

Attributes:

annotation instance-attribute ¤

annotation: str | Expr | None = annotation

The element annotation.

contents property writable ¤

contents: str

The contents of this admonition.

description instance-attribute ¤

description: str = description

The element description.

kind property writable ¤

kind: str | Expr | None

The kind of this admonition.

as_dict ¤

as_dict(**kwargs: Any) -> dict[str, Any]

Return this element's data as a dictionary.

Parameters:

  • **kwargs ¤

    (Any, default: {} ) –

    Additional serialization options.

Returns:

DocstringDeprecated ¤

DocstringDeprecated(
    *,
    description: str,
    annotation: str | Expr | None = None
)

              flowchart TD
              griffe.DocstringDeprecated[DocstringDeprecated]
              _griffe.docstrings.models.DocstringElement[DocstringElement]

                              _griffe.docstrings.models.DocstringElement --> griffe.DocstringDeprecated
                


              click griffe.DocstringDeprecated href "" "griffe.DocstringDeprecated"
              click _griffe.docstrings.models.DocstringElement href "" "_griffe.docstrings.models.DocstringElement"
            

This class represents a documented deprecated item.

Parameters:

  • annotation ¤

    (str | Expr | None, default: None ) –

    The element annotation, if any.

  • description ¤

    (str) –

    The element description.

Methods:

  • as_dict

    Return this element's data as a dictionary.

Attributes:

annotation instance-attribute ¤

annotation: str | Expr | None = annotation

The element annotation.

description instance-attribute ¤

description: str = description

The element description.

version property writable ¤

version: str

The version of this deprecation.

as_dict ¤

as_dict(**kwargs: Any) -> dict[str, Any]

Return this element's data as a dictionary.

Parameters:

  • **kwargs ¤

    (Any, default: {} ) –

    Additional serialization options.

Returns:

DocstringRaise ¤

DocstringRaise(
    *,
    description: str,
    annotation: str | Expr | None = None
)

              flowchart TD
              griffe.DocstringRaise[DocstringRaise]
              _griffe.docstrings.models.DocstringElement[DocstringElement]

                              _griffe.docstrings.models.DocstringElement --> griffe.DocstringRaise
                


              click griffe.DocstringRaise href "" "griffe.DocstringRaise"
              click _griffe.docstrings.models.DocstringElement href "" "_griffe.docstrings.models.DocstringElement"
            

This class represents a documented raise value.

Parameters:

  • annotation ¤

    (str | Expr | None, default: None ) –

    The element annotation, if any.

  • description ¤

    (str) –

    The element description.

Methods:

  • as_dict

    Return this element's data as a dictionary.

Attributes:

annotation instance-attribute ¤

annotation: str | Expr | None = annotation

The element annotation.

description instance-attribute ¤

description: str = description

The element description.

as_dict ¤

as_dict(**kwargs: Any) -> dict[str, Any]

Return this element's data as a dictionary.

Parameters:

  • **kwargs ¤

    (Any, default: {} ) –

    Additional serialization options.

Returns:

DocstringWarn ¤

DocstringWarn(
    *,
    description: str,
    annotation: str | Expr | None = None
)

              flowchart TD
              griffe.DocstringWarn[DocstringWarn]
              _griffe.docstrings.models.DocstringElement[DocstringElement]

                              _griffe.docstrings.models.DocstringElement --> griffe.DocstringWarn
                


              click griffe.DocstringWarn href "" "griffe.DocstringWarn"
              click _griffe.docstrings.models.DocstringElement href "" "_griffe.docstrings.models.DocstringElement"
            

This class represents a documented warn value.

Parameters:

  • annotation ¤

    (str | Expr | None, default: None ) –

    The element annotation, if any.

  • description ¤

    (str) –

    The element description.

Methods:

  • as_dict

    Return this element's data as a dictionary.

Attributes:

annotation instance-attribute ¤

annotation: str | Expr | None = annotation

The element annotation.

description instance-attribute ¤

description: str = description

The element description.

as_dict ¤

as_dict(**kwargs: Any) -> dict[str, Any]

Return this element's data as a dictionary.

Parameters:

  • **kwargs ¤

    (Any, default: {} ) –

    Additional serialization options.

Returns:

DocstringReturn ¤

DocstringReturn(
    name: str,
    *,
    description: str,
    annotation: str | Expr | None = None,
    value: str | None = None
)

              flowchart TD
              griffe.DocstringReturn[DocstringReturn]
              _griffe.docstrings.models.DocstringNamedElement[DocstringNamedElement]
              _griffe.docstrings.models.DocstringElement[DocstringElement]

                              _griffe.docstrings.models.DocstringNamedElement --> griffe.DocstringReturn
                                _griffe.docstrings.models.DocstringElement --> _griffe.docstrings.models.DocstringNamedElement
                



              click griffe.DocstringReturn href "" "griffe.DocstringReturn"
              click _griffe.docstrings.models.DocstringNamedElement href "" "_griffe.docstrings.models.DocstringNamedElement"
              click _griffe.docstrings.models.DocstringElement href "" "_griffe.docstrings.models.DocstringElement"
            

This class represents a documented return value.

Parameters:

  • name ¤

    (str) –

    The element name.

  • description ¤

    (str) –

    The element description.

  • annotation ¤

    (str | Expr | None, default: None ) –

    The element annotation, if any.

  • value ¤

    (str | None, default: None ) –

    The element value, as a string.

Methods:

  • as_dict

    Return this element's data as a dictionary.

Attributes:

annotation instance-attribute ¤

annotation: str | Expr | None = annotation

The element annotation.

description instance-attribute ¤

description: str = description

The element description.

name instance-attribute ¤

name: str = name

The element name.

value instance-attribute ¤

value: str | None = value

The element value, if any

as_dict ¤

as_dict(**kwargs: Any) -> dict[str, Any]

Return this element's data as a dictionary.

Parameters:

  • **kwargs ¤

    (Any, default: {} ) –

    Additional serialization options.

Returns:

DocstringYield ¤

DocstringYield(
    name: str,
    *,
    description: str,
    annotation: str | Expr | None = None,
    value: str | None = None
)

              flowchart TD
              griffe.DocstringYield[DocstringYield]
              _griffe.docstrings.models.DocstringNamedElement[DocstringNamedElement]
              _griffe.docstrings.models.DocstringElement[DocstringElement]

                              _griffe.docstrings.models.DocstringNamedElement --> griffe.DocstringYield
                                _griffe.docstrings.models.DocstringElement --> _griffe.docstrings.models.DocstringNamedElement
                



              click griffe.DocstringYield href "" "griffe.DocstringYield"
              click _griffe.docstrings.models.DocstringNamedElement href "" "_griffe.docstrings.models.DocstringNamedElement"
              click _griffe.docstrings.models.DocstringElement href "" "_griffe.docstrings.models.DocstringElement"
            

This class represents a documented yield value.

Parameters:

  • name ¤

    (str) –

    The element name.

  • description ¤

    (str) –

    The element description.

  • annotation ¤

    (str | Expr | None, default: None ) –

    The element annotation, if any.

  • value ¤

    (str | None, default: None ) –

    The element value, as a string.

Methods:

  • as_dict

    Return this element's data as a dictionary.

Attributes:

annotation instance-attribute ¤

annotation: str | Expr | None = annotation

The element annotation.

description instance-attribute ¤

description: str = description

The element description.

name instance-attribute ¤

name: str = name

The element name.

value instance-attribute ¤

value: str | None = value

The element value, if any

as_dict ¤

as_dict(**kwargs: Any) -> dict[str, Any]

Return this element's data as a dictionary.

Parameters:

  • **kwargs ¤

    (Any, default: {} ) –

    Additional serialization options.

Returns:

DocstringReceive ¤

DocstringReceive(
    name: str,
    *,
    description: str,
    annotation: str | Expr | None = None,
    value: str | None = None
)

              flowchart TD
              griffe.DocstringReceive[DocstringReceive]
              _griffe.docstrings.models.DocstringNamedElement[DocstringNamedElement]
              _griffe.docstrings.models.DocstringElement[DocstringElement]

                              _griffe.docstrings.models.DocstringNamedElement --> griffe.DocstringReceive
                                _griffe.docstrings.models.DocstringElement --> _griffe.docstrings.models.DocstringNamedElement
                



              click griffe.DocstringReceive href "" "griffe.DocstringReceive"
              click _griffe.docstrings.models.DocstringNamedElement href "" "_griffe.docstrings.models.DocstringNamedElement"
              click _griffe.docstrings.models.DocstringElement href "" "_griffe.docstrings.models.DocstringElement"
            

This class represents a documented receive value.

Parameters:

  • name ¤

    (str) –

    The element name.

  • description ¤

    (str) –

    The element description.

  • annotation ¤

    (str | Expr | None, default: None ) –

    The element annotation, if any.

  • value ¤

    (str | None, default: None ) –

    The element value, as a string.

Methods:

  • as_dict

    Return this element's data as a dictionary.

Attributes:

annotation instance-attribute ¤

annotation: str | Expr | None = annotation

The element annotation.

description instance-attribute ¤

description: str = description

The element description.

name instance-attribute ¤

name: str = name

The element name.

value instance-attribute ¤

value: str | None = value

The element value, if any

as_dict ¤

as_dict(**kwargs: Any) -> dict[str, Any]

Return this element's data as a dictionary.

Parameters:

  • **kwargs ¤

    (Any, default: {} ) –

    Additional serialization options.

Returns:

DocstringParameter ¤

DocstringParameter(
    name: str,
    *,
    description: str,
    annotation: str | Expr | None = None,
    value: str | None = None
)

              flowchart TD
              griffe.DocstringParameter[DocstringParameter]
              _griffe.docstrings.models.DocstringNamedElement[DocstringNamedElement]
              _griffe.docstrings.models.DocstringElement[DocstringElement]

                              _griffe.docstrings.models.DocstringNamedElement --> griffe.DocstringParameter
                                _griffe.docstrings.models.DocstringElement --> _griffe.docstrings.models.DocstringNamedElement
                



              click griffe.DocstringParameter href "" "griffe.DocstringParameter"
              click _griffe.docstrings.models.DocstringNamedElement href "" "_griffe.docstrings.models.DocstringNamedElement"
              click _griffe.docstrings.models.DocstringElement href "" "_griffe.docstrings.models.DocstringElement"
            

This class represent a documented function parameter.

Parameters:

  • name ¤

    (str) –

    The element name.

  • description ¤

    (str) –

    The element description.

  • annotation ¤

    (str | Expr | None, default: None ) –

    The element annotation, if any.

  • value ¤

    (str | None, default: None ) –

    The element value, as a string.

Methods:

  • as_dict

    Return this element's data as a dictionary.

Attributes:

annotation instance-attribute ¤

annotation: str | Expr | None = annotation

The element annotation.

default property writable ¤

default: str | None

The default value of this parameter.

description instance-attribute ¤

description: str = description

The element description.

name instance-attribute ¤

name: str = name

The element name.

value instance-attribute ¤

value: str | None = value

The element value, if any

as_dict ¤

as_dict(**kwargs: Any) -> dict[str, Any]

Return this element's data as a dictionary.

Parameters:

  • **kwargs ¤

    (Any, default: {} ) –

    Additional serialization options.

Returns:

DocstringAttribute ¤

DocstringAttribute(
    name: str,
    *,
    description: str,
    annotation: str | Expr | None = None,
    value: str | None = None
)

              flowchart TD
              griffe.DocstringAttribute[DocstringAttribute]
              _griffe.docstrings.models.DocstringNamedElement[DocstringNamedElement]
              _griffe.docstrings.models.DocstringElement[DocstringElement]

                              _griffe.docstrings.models.DocstringNamedElement --> griffe.DocstringAttribute
                                _griffe.docstrings.models.DocstringElement --> _griffe.docstrings.models.DocstringNamedElement
                



              click griffe.DocstringAttribute href "" "griffe.DocstringAttribute"
              click _griffe.docstrings.models.DocstringNamedElement href "" "_griffe.docstrings.models.DocstringNamedElement"
              click _griffe.docstrings.models.DocstringElement href "" "_griffe.docstrings.models.DocstringElement"
            

This class represents a documented module/class attribute.

Parameters:

  • name ¤

    (str) –

    The element name.

  • description ¤

    (str) –

    The element description.

  • annotation ¤

    (str | Expr | None, default: None ) –

    The element annotation, if any.

  • value ¤

    (str | None, default: None ) –

    The element value, as a string.

Methods:

  • as_dict

    Return this element's data as a dictionary.

Attributes:

annotation instance-attribute ¤

annotation: str | Expr | None = annotation

The element annotation.

description instance-attribute ¤

description: str = description

The element description.

name instance-attribute ¤

name: str = name

The element name.

value instance-attribute ¤

value: str | None = value

The element value, if any

as_dict ¤

as_dict(**kwargs: Any) -> dict[str, Any]

Return this element's data as a dictionary.

Parameters:

  • **kwargs ¤

    (Any, default: {} ) –

    Additional serialization options.

Returns:

DocstringFunction ¤

DocstringFunction(
    name: str,
    *,
    description: str,
    annotation: str | Expr | None = None,
    value: str | None = None
)

              flowchart TD
              griffe.DocstringFunction[DocstringFunction]
              _griffe.docstrings.models.DocstringNamedElement[DocstringNamedElement]
              _griffe.docstrings.models.DocstringElement[DocstringElement]

                              _griffe.docstrings.models.DocstringNamedElement --> griffe.DocstringFunction
                                _griffe.docstrings.models.DocstringElement --> _griffe.docstrings.models.DocstringNamedElement
                



              click griffe.DocstringFunction href "" "griffe.DocstringFunction"
              click _griffe.docstrings.models.DocstringNamedElement href "" "_griffe.docstrings.models.DocstringNamedElement"
              click _griffe.docstrings.models.DocstringElement href "" "_griffe.docstrings.models.DocstringElement"
            

This class represents a documented function.

Parameters:

  • name ¤

    (str) –

    The element name.

  • description ¤

    (str) –

    The element description.

  • annotation ¤

    (str | Expr | None, default: None ) –

    The element annotation, if any.

  • value ¤

    (str | None, default: None ) –

    The element value, as a string.

Methods:

  • as_dict

    Return this element's data as a dictionary.

Attributes:

annotation instance-attribute ¤

annotation: str | Expr | None = annotation

The element annotation.

description instance-attribute ¤

description: str = description

The element description.

name instance-attribute ¤

name: str = name

The element name.

signature property ¤

signature: str | Expr | None

The function signature.

value instance-attribute ¤

value: str | None = value

The element value, if any

as_dict ¤

as_dict(**kwargs: Any) -> dict[str, Any]

Return this element's data as a dictionary.

Parameters:

  • **kwargs ¤

    (Any, default: {} ) –

    Additional serialization options.

Returns:

DocstringClass ¤

DocstringClass(
    name: str,
    *,
    description: str,
    annotation: str | Expr | None = None,
    value: str | None = None
)

              flowchart TD
              griffe.DocstringClass[DocstringClass]
              _griffe.docstrings.models.DocstringNamedElement[DocstringNamedElement]
              _griffe.docstrings.models.DocstringElement[DocstringElement]

                              _griffe.docstrings.models.DocstringNamedElement --> griffe.DocstringClass
                                _griffe.docstrings.models.DocstringElement --> _griffe.docstrings.models.DocstringNamedElement
                



              click griffe.DocstringClass href "" "griffe.DocstringClass"
              click _griffe.docstrings.models.DocstringNamedElement href "" "_griffe.docstrings.models.DocstringNamedElement"
              click _griffe.docstrings.models.DocstringElement href "" "_griffe.docstrings.models.DocstringElement"
            

This class represents a documented class.

Parameters:

  • name ¤

    (str) –

    The element name.

  • description ¤

    (str) –

    The element description.

  • annotation ¤

    (str | Expr | None, default: None ) –

    The element annotation, if any.

  • value ¤

    (str | None, default: None ) –

    The element value, as a string.

Methods:

  • as_dict

    Return this element's data as a dictionary.

Attributes:

annotation instance-attribute ¤

annotation: str | Expr | None = annotation

The element annotation.

description instance-attribute ¤

description: str = description

The element description.

name instance-attribute ¤

name: str = name

The element name.

signature property ¤

signature: str | Expr | None

The class signature.

value instance-attribute ¤

value: str | None = value

The element value, if any

as_dict ¤

as_dict(**kwargs: Any) -> dict[str, Any]

Return this element's data as a dictionary.

Parameters:

  • **kwargs ¤

    (Any, default: {} ) –

    Additional serialization options.

Returns:

DocstringModule ¤

DocstringModule(
    name: str,
    *,
    description: str,
    annotation: str | Expr | None = None,
    value: str | None = None
)

              flowchart TD
              griffe.DocstringModule[DocstringModule]
              _griffe.docstrings.models.DocstringNamedElement[DocstringNamedElement]
              _griffe.docstrings.models.DocstringElement[DocstringElement]

                              _griffe.docstrings.models.DocstringNamedElement --> griffe.DocstringModule
                                _griffe.docstrings.models.DocstringElement --> _griffe.docstrings.models.DocstringNamedElement
                



              click griffe.DocstringModule href "" "griffe.DocstringModule"
              click _griffe.docstrings.models.DocstringNamedElement href "" "_griffe.docstrings.models.DocstringNamedElement"
              click _griffe.docstrings.models.DocstringElement href "" "_griffe.docstrings.models.DocstringElement"
            

This class represents a documented module.

Parameters:

  • name ¤

    (str) –

    The element name.

  • description ¤

    (str) –

    The element description.

  • annotation ¤

    (str | Expr | None, default: None ) –

    The element annotation, if any.

  • value ¤

    (str | None, default: None ) –

    The element value, as a string.

Methods:

  • as_dict

    Return this element's data as a dictionary.

Attributes:

annotation instance-attribute ¤

annotation: str | Expr | None = annotation

The element annotation.

description instance-attribute ¤

description: str = description

The element description.

name instance-attribute ¤

name: str = name

The element name.

value instance-attribute ¤

value: str | None = value

The element value, if any

as_dict ¤

as_dict(**kwargs: Any) -> dict[str, Any]

Return this element's data as a dictionary.

Parameters:

  • **kwargs ¤

    (Any, default: {} ) –

    Additional serialization options.

Returns:

Models base classes¤

DocstringElement ¤

DocstringElement(
    *,
    description: str,
    annotation: str | Expr | None = None
)

This base class represents annotated, nameless elements.

Parameters:

  • annotation ¤

    (str | Expr | None, default: None ) –

    The element annotation, if any.

  • description ¤

    (str) –

    The element description.

Methods:

  • as_dict

    Return this element's data as a dictionary.

Attributes:

annotation instance-attribute ¤

annotation: str | Expr | None = annotation

The element annotation.

description instance-attribute ¤

description: str = description

The element description.

as_dict ¤

as_dict(**kwargs: Any) -> dict[str, Any]

Return this element's data as a dictionary.

Parameters:

  • **kwargs ¤

    (Any, default: {} ) –

    Additional serialization options.

Returns:

DocstringNamedElement ¤

DocstringNamedElement(
    name: str,
    *,
    description: str,
    annotation: str | Expr | None = None,
    value: str | None = None
)

              flowchart TD
              griffe.DocstringNamedElement[DocstringNamedElement]
              _griffe.docstrings.models.DocstringElement[DocstringElement]

                              _griffe.docstrings.models.DocstringElement --> griffe.DocstringNamedElement
                


              click griffe.DocstringNamedElement href "" "griffe.DocstringNamedElement"
              click _griffe.docstrings.models.DocstringElement href "" "_griffe.docstrings.models.DocstringElement"
            

This base class represents annotated, named elements.

Parameters:

  • name ¤

    (str) –

    The element name.

  • description ¤

    (str) –

    The element description.

  • annotation ¤

    (str | Expr | None, default: None ) –

    The element annotation, if any.

  • value ¤

    (str | None, default: None ) –

    The element value, as a string.

Methods:

  • as_dict

    Return this element's data as a dictionary.

Attributes:

annotation instance-attribute ¤

annotation: str | Expr | None = annotation

The element annotation.

description instance-attribute ¤

description: str = description

The element description.

name instance-attribute ¤

name: str = name

The element name.

value instance-attribute ¤

value: str | None = value

The element value, if any

as_dict ¤

as_dict(**kwargs: Any) -> dict[str, Any]

Return this element's data as a dictionary.

Parameters:

  • **kwargs ¤

    (Any, default: {} ) –

    Additional serialization options.

Returns:

DocstringSection ¤

DocstringSection(title: str | None = None)

This class represents a docstring section.

Parameters:

  • title ¤

    (str | None, default: None ) –

    An optional title.

Methods:

  • __bool__

    Whether this section has a true-ish value.

  • as_dict

    Return this section's data as a dictionary.

Attributes:

kind instance-attribute ¤

The section kind.

title instance-attribute ¤

title: str | None = title

The section title.

value instance-attribute ¤

value: Any = None

The section value.

__bool__ ¤

__bool__() -> bool

Whether this section has a true-ish value.

as_dict ¤

as_dict(**kwargs: Any) -> dict[str, Any]

Return this section's data as a dictionary.

Parameters:

  • **kwargs ¤

    (Any, default: {} ) –

    Additional serialization options.

Returns: