DocumentedItem

Base class for documented items.

Methods

  • __init__(self, obj : GriffeObjType, type_ : str) -> None

    Parameters

    • Name
      self
      Type
      Default
      Description

    • Name
      obj
      Type
      GriffeObjType
      Default
      Description

    • Name
      type_
      Type
      str
      Default
      Description

  • as_dict(self) -> None

    Returns a dict representation of the annotated item, filtering out the all Falsy values except the boolean `False`.

  • get_docstring(self, kind : str) -> typing.Optional[str]

    Extract a `griffe.DocstringSection` of a given `kind`s parsed value.

    Parameters

    • Name
      self
      Type
      Default
      Description

    • Name
      kind
      Type
      str
      Default
      Description

      The kind of `griffe.DocstringSection` to extract. Valid values are `text`, `parameters`, `returns`, `raises`, and `examples`.

    Response

    Type
    typing.Optional[str]
    Description

Attributes

  • Name
    obj
    Type
    Value

    = obj

    Description

  • Name
    type
    Type
    Value

    = type_

    Description

  • Name
    name
    Type
    Value

    = get_name(obj)

    Description

  • Name
    path
    Type
    Value

    = str(obj.relative_package_filepath)

    Description

  • Name
    parent
    Type
    Value

    = obj.parent if obj.parent is None else get_name(obj.parent)

    Description

  • Name
    description
    Type
    Value

    = self.get_docstring('text')

    Description

  • Name
    lines
    Type
    Value

    = () if self.type == 'package' else (obj.lineno, obj.endlineno)

    Description

Copyright © 2024