Skip to main content

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

Project description

Build status

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

Installation

From pip:

$ pip install --upgrade pyformat

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.2.1.tar.gz (13.0 kB view details)

Uploaded Source

File details

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

File metadata

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

File hashes

Hashes for pyformat-0.2.1.tar.gz
Algorithm Hash digest
SHA256 53782e6288e0155f971e7794cd4fcae2ff2e9129c05dc6ffdde00f66c7408f77
MD5 149c20e16ede0eba91519b29046475d1
BLAKE2b-256 39c3b148d6ceae7974dc77cd911dbf280e02fdc9dbffe07eae0eaa62fb896b75

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