Skip to main content

Formats docstrings to follow PEP 257.

Project description

Formats docstrings to follow PEP 257.

Build status

Example

After running:

$ docformatter example.py

this code:

def launch_rocket():
    """Launch
the
rocket. Go colonize space."""


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):
        launch_rocket()

gets formatted into this:

def launch_rocket():
    """Launch the rocket.

    Go colonize space.

    """


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):
        launch_rocket()

Options

Below is the help output:

usage: docformatter [-h] [--in-place] [--no-backup]
                    [--wrap-long-summaries LENGTH] [--version]
                    files [files ...]

Formats docstrings to follow PEP 257.

positional arguments:
  files                 files to format

optional arguments:
  -h, --help            show this help message and exit
  --in-place            make changes to files instead of printing diffs
  --no-backup           do not write backup files
  --wrap-long-summaries LENGTH
                        wrap long summary lines at this length (default: 0)
  --version             show program's version number and exit

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

docformatter-0.1.6.tar.gz (3.7 kB view details)

Uploaded Source

File details

Details for the file docformatter-0.1.6.tar.gz.

File metadata

  • Download URL: docformatter-0.1.6.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for docformatter-0.1.6.tar.gz
Algorithm Hash digest
SHA256 1676b6f1fbc133852875c6663b32f28e6b64b85e9ccee21b95615b005744089d
MD5 6662ebd7842526538d07444ef4e3025e
BLAKE2b-256 e233e957d0ef2cd86434eb343468b518f817e31e87f841c625359e9c562e6f6c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page