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 baseclassname 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
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
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-11.tar.gz
(4.9 kB
view details)
File details
Details for the file sortpythonmethods-11.tar.gz
.
File metadata
- Download URL: sortpythonmethods-11.tar.gz
- Upload date:
- Size: 4.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 82abe7dbefc84b52e5cdb9ab8694bd8628ad556a560434a7cbe7d79c5f54184b |
|
MD5 | 98d95ae9ce5dba7c235d0b4e8d9df1d4 |
|
BLAKE2b-256 | 68946e379969248382a161e0f26fcb43e800bfcca569327fa273e6dc068a700e |