Skip to content

Sphinx docstrings examples

Handsdown API Index / Examples / Sphinx docstrings examples

Auto-generated documentation for examples.sphinx_docstrings module.

RSTExample

Show source in sphinx_docstrings.py:10

Signature

class RSTExample:
    ...

RSTExample.directives_test

Show source in sphinx_docstrings.py:33

Test for some random Sphinx directives

def sum_eq_n?(arr, n)
    return true if arr.empty? && n == 0
    arr.product(arr).reject { |a,b| a == b }.any? { |a,b| a + b == n }
end

Notes

short note

(a + b)^2 = a^2 + 2ab + b^2

(a - b)^2 = a^2 - 2ab + b^2

See also

modules 🇵🇾mod:zipfile, 🇵🇾mod:tarfile

Signature

@staticmethod
def directives_test():
    ...

RSTExample.reference

Show source in sphinx_docstrings.py:11

This is a reference for Sphinx-style RST-style docstrings. Check source code to see how it works.

Code example

data = {
    'key': 'value',
}

print(data)

Arguments

  • my_param - Parameter example
  • typed_param int - Typed parameter example

Returns

Type: str Return statement

Raises

  • ValueError - Raises example

Signature

@staticmethod
def reference():
    ...

RSTExample.version_directives_test

Show source in sphinx_docstrings.py:57

Test for Version-related directives

Notes

Added in version 2.5 The spam parameter.

Changed in version 2.7 Mandatory spam parameter.

Deprecated in version 3.1 Use :func:spam instead.

Signature

@staticmethod
def version_directives_test():
    ...