Sort methods, imports and classes in a python source file
Project description
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 classname alpha (internals of class unchanged)
methods sorted on methodname alpha
example
Source file before sort
"""
Docstring is required
"""
import sys
import httplib
import email
import concurrent.futures
import os
class Zorro(object):
pass
def foobar():
pass
def helloworld():
pass
def applemethod():
pass
class Alpha(object):
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
sortpythonmethods-6.tar.gz
(4.0 kB
view details)
File details
Details for the file sortpythonmethods-6.tar.gz
.
File metadata
- Download URL: sortpythonmethods-6.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 01e3a25b1033903ae182723743f09a3c89b85c64e1aa41fc23cdb9b77ffb97ab |
|
MD5 | 722d21bbdf9c57b32193e31e72708bb5 |
|
BLAKE2b-256 | 9a0065aad80a25daa7cc7f85e3f1627345ece932781159fa61d989ad12fc01cc |