mirror of
https://github.com/kennethreitz/python-guide.git
synced 2026-06-05 23:00:18 +00:00
Merge pull request #577 from kdelwat/master
Added usage instructions for autopep8
This commit is contained in:
@@ -452,6 +452,23 @@ Then run it on a file or series of files to get a report of any violations.
|
|||||||
optparse.py:472:29: E221 multiple spaces before operator
|
optparse.py:472:29: E221 multiple spaces before operator
|
||||||
optparse.py:544:21: W601 .has_key() is deprecated, use 'in'
|
optparse.py:544:21: W601 .has_key() is deprecated, use 'in'
|
||||||
|
|
||||||
|
The program `autopep8 <https://pypi.python.org/pypi/autopep8/>`_ can be used to
|
||||||
|
automatically reformat code in the PEP 8 style. Install the program with:
|
||||||
|
|
||||||
|
.. code-block:: console
|
||||||
|
|
||||||
|
$ pip install autopep8
|
||||||
|
|
||||||
|
Use it to format a file in-place with:
|
||||||
|
|
||||||
|
.. code-block:: console
|
||||||
|
|
||||||
|
$ autopep8 --in-place optparse.py
|
||||||
|
|
||||||
|
Excluding the ``--in-place`` flag will cause the program to output the modified
|
||||||
|
code directly to the console for review. The ``--aggressive`` flag will perform
|
||||||
|
more substantial changes and can be applied multiple times for greater effect.
|
||||||
|
|
||||||
Conventions
|
Conventions
|
||||||
----------------
|
----------------
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user