sortpythonmethods
Rearrange methods alphabetically in a Python source file. - Python3
sortorder
docstring
future imports
imports first on alphabet then on length (apo, alpha-pipe-organ)
from, modules on apo, imports on alpa
classes sorted on baseclassname then on classname alpha (internals of class unchanged)
methods sorted on methodname alpha
pep8
Can be combined with cp-pep8 for consistent readable code
sortpythonmethods -f myfile.py -w
python2 ~/cp.py -f myfile.py
example
Source file before sort
"""
Docstring is required
"""
import sys
import http
import email
import concurrent.futures
import os
class Zorro(object):
pass
class actie(object):
pass
def applemethod():
pass
def foobar():
pass
class Alpha1(object):
pass
def helloworld():
pass
class ZZ(object):
pass
class Alpha2(ZZ):
pass
Run command
sortpythonmethods -f myfile.py
Sorted source file
#!/usr/bin/env python3
# coding=utf-8
"""
Docstring is required
"""
import email
import http
import os
import sys
import concurrent.futures
class ZZ(object):
pass
class Alpha1(object):
pass
class Alpha2(ZZ):
pass
class Zorro(object):
pass
class actie(object):
pass
def applemethod():
pass
def foobar():
pass
def helloworld():
pass
completeness
baseclasses
globals
globalmethod calls
comments
todo
global pycharm directives
screenshot
sorted_methods
Metadata
Release files for sortpythonmethods 16
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| sortpythonmethods-16.tar.gz | 5.3 kB | Details |
Release files / sortpythonmethods-16.tar.gz
| Download URL | sortpythonmethods-16.tar.gz |
|---|---|
| Size | 5.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8644f7e469ed6aa6e90d13be6d92dd83260122a02238706a254a2814955cb367
|
|
BLAKE2b-256 checksum How to use checksums |
6a70c2d8a53a1656a4cbae713fb0a90a9e6377561aa9b2e4df2f60fad73b6759
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |