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."""


def factorial(x):
    '''

    Return x factorial.

    This uses math.factorial.

    '''
    import math
    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."""


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

    This uses math.factorial.

    """
    import math
    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] [--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 file instead of printing diff
  --no-backup  do not write backup files
  --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.4.tar.gz (3.1 kB view details)

Uploaded Source

File details

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

File metadata

File hashes

Hashes for docformatter-0.1.4.tar.gz
Algorithm Hash digest
SHA256 5058854f581963f955896b15b028b733c1a5a28cee18bbabbef6f969e53624d0
MD5 03164c885a51e89b9cbd915a129913c8
BLAKE2b-256 a4cb1a4b978b33446cf060b5ed1479ca3796e258528bd5099416aac0a900b24d

See more details on using hashes here.

Supported by

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