A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/PyCQA/docformatter below:

PyCQA/docformatter: Formats docstrings to follow PEP 257

Formats docstrings to follow PEP 257.

docformatter automatically formats docstrings to follow a subset of the PEP 257 conventions. Below are the relevant items quoted from PEP 257.

docformatter also handles some of the PEP 8 conventions.

docformatter formats docstrings compatible with black when passed the --black option.

docformatter formats field lists that use Epytext or Sphinx styles.

See the the full documentation at read-the-docs, especially the requirements section for a more detailed discussion of PEP 257 and other requirements.

From pip:

$ pip install --upgrade docformatter

Or, if you want to use pyproject.toml to configure docformatter and you're using Python < 3.11:

$ pip install --upgrade docformatter[tomli]

With Python >=3.11, tomllib from the standard library is used.

Or, if you want to use a release candidate (or any other tag):

$ pip install git+https://github.com/PyCQA/docformatter.git@<RC_TAG>

Where <RC_TAG> is the release candidate tag you'd like to install. Release candidate tags will have the format v1.6.0-rc1 Release candidates will also be made available as a Github Release.

After running:

$ docformatter --in-place example.py

this code

"""   Here are some examples.

    This module docstring should be dedented."""


def factorial(x):
    '''

    Return x factorial.

    This uses math.factorial.

    '''
    import math
    return math.factorial(x)


def print_factorial(x):
    """Print x factorial"""
    print(factorial(x))


def main():
    """Main
    function"""
    print_factorial(5)
    if factorial(10):
        print_factorial(22)

gets formatted into this

"""Here are some examples.

This module docstring should be dedented.
"""

def factorial(x):
    """Return x factorial.

    This uses math.factorial.
    """
    import math
    return math.factorial(x)


def print_factorial(x):
    """Print x factorial."""
    print(factorial(x))


def main():
    """Main function."""
    print_factorial(5)
    if factorial(10):
        print_factorial(22)

Do you use docformatter? What style docstrings do you use? Add some badges to your project's README and let everyone know.

.. image:: https://img.shields.io/badge/%20formatter-docformatter-fedcba.svg
    :target: https://github.com/PyCQA/docformatter

.. image:: https://img.shields.io/badge/%20style-sphinx-0a507a.svg
    :target: https://www.sphinx-doc.org/en/master/usage/index.html

.. image:: https://img.shields.io/badge/%20style-numpy-459db9.svg
    :target: https://numpydoc.readthedocs.io/en/latest/format.html

.. image:: https://img.shields.io/badge/%20style-google-3666d6.svg
    :target: https://google.github.io/styleguide/pyguide.html#s3.8-comments-and-docstrings
docformatter has an IRC channel on Libera.Chat in the #docformatter room.

There is no docformatter channel on the Python Code Quality Discord server, but you can ask for help in the # general channel.

Bugs and patches can be reported on the GitHub page.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4