Skip to main content

Formats Python code (using autoflake, autopep8, docformatter, etc.).

Project description

Build status

Formats Python code (using autoflake, autopep8, docformatter, etc.).

Example

After running:

$ pyformat 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
    import re
    import os
    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()

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

pyformat-0.1.tar.gz (4.8 kB view details)

Uploaded Source

File details

Details for the file pyformat-0.1.tar.gz.

File metadata

  • Download URL: pyformat-0.1.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pyformat-0.1.tar.gz
Algorithm Hash digest
SHA256 0d084365ec534b5e193f4b94e27ead06711e16cee0b043db6ce963a370d8aac1
MD5 5ac555f2623df7301835cd5759bc40d6
BLAKE2b-256 68767413d2313bd316a86c3b12b6acd076f1ba65f61554a5f452e93ea035afbd

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