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 12
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| sortpythonmethods-12.tar.gz | 5.1 kB | Without provenance | Details for sortpythonmethods-12.tar.gz |
Release files / sortpythonmethods-12.tar.gz
| Download URL | sortpythonmethods-12.tar.gz |
|---|---|
| Size | 5.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6d6daec6f540d995dd87aca3af211af7a0be721cfbb557674ced3ef1385c144c
|
|
BLAKE2b-256 checksum How to use checksums |
7dc4f1d87c34e9a4463d301c0de14f091ede45342e058dfc5b1f9595b52aa094
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for sortpythonmethods 12
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.