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

Uploaded Source

File details

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

File metadata

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

File hashes

Hashes for pyformat-0.2.tar.gz
Algorithm Hash digest
SHA256 5842975b20fb42501d922c27a98136759d4a2bbadec642a44d4dd04bff7c9962
MD5 ea279c1d207db425476505cf77da1a4a
BLAKE2b-256 a0e4eed80e050c907fb5b80cb82f533b3337685177b660ce85f4ce1a910dbfa8

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