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 baseclass then on classname alpha (internals of class unchanged)
methods sorted on methodname alpha
example
Source file before sort
"""
Docstring is required
"""
import sys
import http
import email
import concurrent.futures
import os
class Zorro(object):
pass
def foobar():
pass
def helloworld():
pass
def applemethod():
pass
class Alpha(object):
pass
class ZZ(object):
pass
class AA(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 Alpha(object):
pass
class Zorro(object):
pass
def applemethod():
pass
def foobar():
pass
def helloworld():
pass
Metadata
Release files for sortpythonmethods 7
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-7.tar.gz | 4.3 kB | Details |
Release files / sortpythonmethods-7.tar.gz
| Download URL | sortpythonmethods-7.tar.gz |
|---|---|
| Size | 4.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fc078f1abbcb986c85de64200fe34e199111e90ab46054ad8c14cdbe91800229
|
|
BLAKE2b-256 checksum How to use checksums |
31146b8ebd34ce9254f7263f93d0bb02e6680d50d11dc961f25a57f65ce30c17
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |