Git Product home page Git Product logo

Comments (4)

pawamoy avatar pawamoy commented on June 15, 2024

Closing for cleanup, but if you'd like to work on this, just ask and I'll reopen!

from griffe.

griff-rees avatar griff-rees commented on June 15, 2024

Hi @pawamoy. The only clear example I've found was last updated in 2014 and isn't part of official documentation and uses :Example: singular rather than plural.

https://thomas-cokelaer.info/tutorials/sphinx/docstring_python.html#template-py-source-file

A relevant snippet:

def function1(self, arg1, arg2, arg3):
    """returns (arg1 / arg2) + arg3

    This is a longer explanation, which may include math with latex syntax
    :math:`\\alpha` (abbridged for ease of example):

    :param arg1: the first value
    :param arg2: the first value
    :param arg3: the first value
    :type arg1: int, float,...
    :type arg2: int, float,...
    :type arg3: int, float,...
    :returns: arg1/arg2 +arg3
    :rtype: int, float

    :Example:

    >>> import template
    >>> a = template.MainClass1()
    >>> a.function1(1,1,1)
    2
    """
    return arg1/arg2 + arg3

Note: it renders >>> in an on/off way in html for ease of copying.

from griffe.

griff-rees avatar griff-rees commented on June 15, 2024

Two more:

from griffe.

pawamoy avatar pawamoy commented on June 15, 2024

Thanks @griff-rees!

Note that in the Sphinx link, :Example: is in a Google style test and is actually used to test that it is not recognized and rendered in any useful way: the expected result is the exact same docstring.

I'll leave this issue closed for now, because I don't plan on working on it (and you switched to the Google-style anyway 👍), but if anyone would like to work on it, just let me know.

from griffe.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.