Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/blampe/indently
A tool to apply consistent indentation to your Python code.
https://github.com/blampe/indently
Last synced: 16 days ago
JSON representation
A tool to apply consistent indentation to your Python code.
- Host: GitHub
- URL: https://github.com/blampe/indently
- Owner: blampe
- Created: 2014-04-18T20:48:30.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2015-06-25T05:20:27.000Z (over 9 years ago)
- Last Synced: 2024-04-30T07:17:41.842Z (9 months ago)
- Language: Python
- Size: 145 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Indently
========A tool to apply consistent indentation and formatting to your Python code.
This is still **very much** a work in progress. In addition to being full of
hacks, the source might look weird because the tool is used to format itself.Example
-------A long line (over 80 characters) like this
```python
models.Membership.objects.filter(account__in=owner, active=True, created__lte='2014-01-01').select_related('user').distinct().order_by('id')
```will automatically be indented to look like this:
```python
models.Membership.objects.filter(
account__in=owner,
active=True,
created__lte='2014-01-01',
).select_related(
'user'
).distinct().order_by(
'id'
)
```Frequently Asked Questions
--------------------------### This doesn't look very PEP-8, question mark?
Actually, it is! I prefer this "waterfall" indentation (for lack of a better
term) over PEP-8's [alignment
style](http://legacy.python.org/dev/peps/pep-0008/#indentation) for a few
reasons:* Readability. One arg per line keeps lines short and easier to scan.
Flush-left formatting is more reminiscent of reading a book.* Malleability. I can add or remove lines without needing to significantly
alter surrounding code. The dangling paren makes it easier to chain function
calls.* Blame. I can quickly see who added a particular argument if I want to ask
them something about it.Usage
-----```shell
$ cat code.py | indently
```