Aim Python Library Master (48) Autopep8

[Description de la bibliothèque]

Changer le code en style pep8

【programme】

Méthode d'exécution du programme  autopep8 --in-place --aggressive --aggressive <filename>

Avant l'exécution

autopep8_before.py


import math, sys;

def example1():
    ####This is a long comment. This should be wrapped to fit within 72 characters.
    some_tuple=(   1,2, 3,'a'  );
    some_variable={'long':'Long code lines should be wrapped within 79 characters.',
    'other':[math.pi, 100,200,300,9876543210,'This is a long string that goes on'],
    'more':{'inner':'This whole logical line should be wrapped.',some_tuple:[1,
    20,300,40000,500000000,60000000000000000]}}
    return (some_tuple, some_variable)
def example2(): return {'has_key() is deprecated':True}.has_key({'f':2}.has_key(''));
class Example3(   object ):
    def __init__    ( self, bar ):
     #Comments should have a space after the hash.
     if bar : bar+=1;  bar=bar* bar   ; return bar
     else:
                    some_string = """
                       Indentation in multiline strings should not be touched.
Only actual code should be reindented.
"""
                    return (sys.path, some_string)

Après exécution

autopep8_after.py


import math
import sys


def example1():
    # This is a long comment. This should be wrapped to fit within 72
    # characters.
    some_tuple = (1, 2, 3, 'a')
    some_variable = {
        'long': 'Long code lines should be wrapped within 79 characters.',
        'other': [
            math.pi,
            100,
            200,
            300,
            9876543210,
            'This is a long string that goes on'],
        'more': {
            'inner': 'This whole logical line should be wrapped.',
            some_tuple: [
                1,
                20,
                300,
                40000,
                500000000,
                60000000000000000]}}
    return (some_tuple, some_variable)


def example2(): return ('' in {'f': 2}) in {'has_key() is deprecated': True}


class Example3(object):

    def __init__(self, bar):
        # Comments should have a space after the hash.
        if bar:
            bar += 1
            bar = bar * bar
            return bar
        else:
            some_string = """
                       Indentation in multiline strings should not be touched.
Only actual code should be reindented.
"""
            return (sys.path, some_string)

[Site de référence]

pypi  github

Recommended Posts

Aim Python Library Master (48) Autopep8
Aim Python Library Master (36) json2html
Aim Python Library Master (49) psidialogs
Aim Python Library Master (26) easyxml
Aim python library master (29) table_printer
Espaces de noms Aim Python Library Master (55)
AIM Python Library Master (46) BrowserPlus
Aim Python Library Master (30) Chronyk
AIM Python Library Master (3) Workalendar
Aim Python Library Master (42) Speedrecorder
Aim Python Library Master (37) Slimurl
Aim Python Library Master (44) pynetviz
Aim Python Library Master (8) Rolex
Aim Python Library Master (52) Marktime
Aim Python Library Master (7) Numparser
Aim Python Library Master (21) hy
Viser les requêtes du maître de bibliothèque python (18)
Aim Python Library Master (13) Easydev
Aim Python Library Master (20) Pyyaml
Aim Python Library Master (34) simultané
Viser la segmentation de mots du maître de la bibliothèque python
Aim Python Library Master (43) cpmoptimize
Aim Python Library Master (68) pazudorasolver
Aim Python Library Master (58) Faker
Aim Python Library Master (11) nlist
Aimez le maître de la bibliothèque python (38) beautiful_print
Aim Python Library Master (65) Geopy
Aim Python Library Master (2) Vincenty
Journal de bord Aim Python Library Master (59)
Aim Python Library Master (51) Pyautogui
Aim Python Library Master (10) Timeit
Aim Python Library Master (0) Liens
Aim Python Library Master (66) youtube-dl
Aim Python Library Master (53) psutil
Aim Python Library Master (22) HTMltag
Aim Python Library Master (67) httpie
Aim Python Library Master (45) xlsxwriter
Aim Python Library Master (9) WebHelpers
Aim Python Library Master (32) SQL
Aim Python Library Master (60) Colourettu
Viser maître de la bibliothèque python (64) pretty_cron
Aim Python Library Master (56) colorthief
Aim Python Library Master (61) recherche imbriquée
Aim Python Library Master (17) Rangeparser
Aim Python Library Master (47) Deckor
Aim Python Library Master (25) Orderset
Viser le maître de la bibliothèque python (62)
Aim Python Library Master (12) Excel
Aim Python Library Master (24) combi
Aim Python Library Master (63) EasyGui
Aim Python Library Master (19) Riemann
Aim Python Library Master (39) Goless
Aim Python Library Master (54) tqdm
Aim Python Library Master (16) byteplay
Aim Python Library Master (23) memory_utils
AIM Python Library Master (27) Benchit
Visez le maître de la bibliothèque python (35) pywildcard
Aim Python Library Master (14) Pyknon
Aim Python Library Master (15) Brute
Aim Python Library Master (50) xlwings
Aim Python Library Master (31) Adipy