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

Uploaded Source

File details

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

File metadata

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

File hashes

Hashes for pyformat-0.1.1.tar.gz
Algorithm Hash digest
SHA256 a6c7e619f09f6d81ec26a4d0af7ca1194fb60fcc67896a7bdd2d15146dd93617
MD5 abae1cf21c201f231866bbb8466dbbb4
BLAKE2b-256 62381f4dd6c334480f34c4f269dbb1cccef9aafa2c42314e02815e13879d7264

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