[Python-modules-commits] [autopep8] 01/05: New upstream version 1.3.2
Sylvestre Ledru
sylvestre at moszumanska.debian.org
Mon Jun 19 20:48:14 UTC 2017
This is an automated email from the git hooks/post-receive script.
sylvestre pushed a commit to branch master
in repository autopep8.
commit 15850c49c636cdb740cc87d416f133c2903fd737
Author: Sylvestre Ledru <sylvestre at debian.org>
Date: Mon Jun 19 22:33:30 2017 +0200
New upstream version 1.3.2
---
.gitignore | 19 +
.travis.yml | 51 +
AUTHORS.rst | 24 +
CONTRIBUTING.rst | 38 +
LICENSE | 23 +
MANIFEST.in | 24 +
Makefile | 131 +
PKG-INFO | 315 ---
README.rst | 290 +-
autopep8.egg-info/PKG-INFO | 315 ---
autopep8.egg-info/SOURCES.txt | 18 -
autopep8.egg-info/dependency_links.txt | 1 -
autopep8.egg-info/entry_points.txt | 3 -
autopep8.egg-info/not-zip-safe | 1 -
autopep8.egg-info/requires.txt | 1 -
autopep8.egg-info/top_level.txt | 1 -
autopep8.py | 3779 +++++++++++++++++--------
coveralls.bash | 8 +
hooks/pre-push | 12 +
install_hooks.bash | 5 +
setup.cfg | 7 +-
setup.py | 20 +-
test/.gitignore | 2 +
test/acid.py | 259 ++
test/acid_pypi.py | 141 +
test/example.py | 4 +-
test/example_with_reduce.py | 2727 +++++++++++++++++++
test/fake_configuration/.pep8 | 2 +
test/fake_pycodestyle_configuration/tox.ini | 2 +
test/inspect_example.py | 2765 +++++++++++++++++++
test/suite/E10.py | 41 +
test/suite/E11.py | 16 +
test/suite/E12.py | 376 +++
test/suite/E20.py | 55 +
test/suite/E21.py | 14 +
test/suite/E22.py | 152 ++
test/suite/E23.py | 15 +
test/suite/E24.py | 13 +
test/suite/E25.py | 26 +
test/suite/E26.py | 36 +
test/suite/E27.py | 30 +
test/suite/E30.py | 106 +
test/suite/E30not.py | 134 +
test/suite/E40.py | 13 +
test/suite/E50.py | 104 +
test/suite/E70.py | 13 +
test/suite/E71.py | 41 +
test/suite/E72.py | 51 +
test/suite/W19.py | 145 +
test/suite/W29.py | 13 +
test/suite/W39.py | 9 +
test/suite/W60.py | 15 +
test/suite/latin-1.py | 6 +
test/suite/long_lines.py | 7 +
test/suite/noqa.py | 15 +
test/suite/out/E10.py | 44 +
test/suite/out/E11.py | 16 +
test/suite/out/E12.py | 377 +++
test/suite/out/E20.py | 56 +
test/suite/out/E21.py | 14 +
test/suite/out/E22.py | 156 ++
test/suite/out/E23.py | 15 +
test/suite/out/E24.py | 13 +
test/suite/out/E25.py | 28 +
test/suite/out/E26.py | 36 +
test/suite/out/E27.py | 30 +
test/suite/out/E30.py | 122 +
test/suite/out/E30not.py | 141 +
test/suite/out/E40.py | 14 +
test/suite/out/E50.py | 106 +
test/suite/out/E70.py | 17 +
test/suite/out/E71.py | 41 +
test/suite/out/E72.py | 51 +
test/suite/out/W19.py | 151 +
test/suite/out/W29.py | 17 +
test/suite/out/W39.py | 9 +
test/suite/out/W60.py | 15 +
test/suite/out/latin-1.py | 1 +
test/suite/out/long_lines.py | 8 +
test/suite/out/noqa.py | 1 +
test/suite/out/python3.py | 1 +
test/suite/out/utf-8-bom.py | 1 +
test/suite/out/utf-8.py | 52 +
test/suite/python3.py | 6 +
test/suite/utf-8-bom.py | 6 +
test/suite/utf-8.py | 52 +
test/test_autopep8.py | 3939 +++++++++++++++++++++++----
test/test_suite.py | 122 +
test/vectors_example.py | 1063 ++++++++
test/vim_autopep8.py | 55 +
tox.ini | 18 +
update_readme.py | 93 +
92 files changed, 16920 insertions(+), 2401 deletions(-)
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..7139401
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,19 @@
+.eggs
+.idea/
+*.class
+*.egg-info/
+*.egg/
+*.pyc
+*.swo
+*.swp
+.tox
+.travis-solo/
+.build-*/
+README.html
+__pycache__
+build
+.coverage
+coverage.xml
+dist
+htmlcov
+pep8.py
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..2ae6c45
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,51 @@
+language: python
+
+python:
+ - "2.6"
+ - "2.7"
+ - "3.3"
+ - "3.4"
+ - "3.5"
+ - "3.6"
+ - "pypy"
+ # commenting "pypy3" because it's been broken on TravisCI for several months
+ # using alpha target instead
+ # https://github.com/travis-ci/travis-ci/issues/6277
+ - "pypy3.3-5.5-alpha" #- "pypy3"
+
+env:
+ - LANG=
+ - PEP8_VERSION=pypi
+ - PEP8_VERSION=github
+
+matrix:
+ allow_failures:
+ - env: PEP8_VERSION=github
+
+install:
+ - if [ "$TRAVIS_PYTHON_VERSION" == "2.6" ]; then pip install unittest2; fi
+ - if [ "$PEP8_VERSION" == "github" ]; then pip install git+https://github.com/PyCQA/pycodestyle; fi
+ - python setup.py build --build-base=".build-$TRAVIS_PYTHON_VERSION" install
+
+script:
+ - python test/test_autopep8.py
+ - python test/acid.py -aaa --experimental test/example.py
+ - python test/acid.py -aaa --experimental test/example_with_reduce.py
+
+ - if [ "$TRAVIS_PYTHON_VERSION" == "3.3" ]; then python -m doctest -v README.rst; fi
+
+ - if [[ "$TRAVIS_PYTHON_VERSION" != "pypy"* ]]; then pycodestyle autopep8.py; fi
+ - if [[ "$TRAVIS_PYTHON_VERSION" != "pypy"* ]]; then pip install pyflakes; pyflakes autopep8.py; fi
+
+ - pip install pydiff
+ - python test/acid.py --pycodestyle= -aaa --compare-bytecode --experimental test/example.py
+
+ # See issue #175.
+ - python test/acid.py --pycodestyle= --aggressive --line-range 550 610 test/inspect_example.py
+ - python test/acid.py --pycodestyle= --line-range 289 925 test/vectors_example.py
+
+ - python test/test_suite.py
+
+after_success:
+ # pypy is too slow.
+ - if [[ "$TRAVIS_PYTHON_VERSION" != "pypy"* ]]; then ./coveralls.bash; fi
diff --git a/AUTHORS.rst b/AUTHORS.rst
new file mode 100644
index 0000000..f842542
--- /dev/null
+++ b/AUTHORS.rst
@@ -0,0 +1,24 @@
+Main contributors
+-----------------
+- Hideo Hattori (https://github.com/hhatto)
+- Steven Myint (https://github.com/myint)
+- Bill Wendling (https://github.com/gwelymernans)
+
+Patches
+-------
+- Fraser Tweedale (https://github.com/frasertweedale)
+- clach04 (https://github.com/clach04)
+- Marc Abramowitz (https://github.com/msabramo)
+- dellis23 (https://github.com/dellis23)
+- Sam Vilain (https://github.com/samv)
+- Florent Xicluna (https://github.com/florentx)
+- Andras Tim (https://github.com/andras-tim)
+- tomscytale (https://github.com/tomscytale)
+- Filip Noetzel (https://github.com/peritus)
+- Erik Bray (https://github.com/iguananaut)
+- Christopher Medrela (https://github.com/chrismedrela)
+- 小明 (https://github.com/dongweiming)
+- Andy Hayden (https://github.com/hayd)
+- Fabio Zadrozny (https://github.com/fabioz)
+- Alex Chernetz (https://github.com/achernet)
+- Marc Schlaich (https://github.com/schlamar)
diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst
new file mode 100644
index 0000000..1580b38
--- /dev/null
+++ b/CONTRIBUTING.rst
@@ -0,0 +1,38 @@
+============
+Contributing
+============
+
+Contributions are appreciated.
+
+
+Issues
+======
+
+When submitting a bug report, please provide the following:
+
+1. Does the ``pycodestyle`` tool behave correctly? If not, then the bug
+ report should be filed at the pycodestyle_ repository instead.
+2. ``autopep8 --version``
+3. ``pycodestyle --version``
+4. ``python --version``
+5. ``uname -a`` if on Unix.
+6. The example input that causes the bug.
+7. The ``autopep8`` command-line options used to cause the bug.
+8. The expected output.
+9. Does the bug happen with the latest version of autopep8? To upgrade::
+
+ $ pip install --upgrade git+https://github.com/hhatto/autopep8
+
+
+Pull requests
+=============
+
+When submitting a pull request, please do the following.
+
+1. Does the ``pycodestyle`` tool behave correctly? If not, then a pull request
+ should be filed at the pycodestyle_ repository instead.
+2. Add a test case to ``test/test_autopep8.py`` that demonstrates what your
+ change does.
+3. Make sure all tests pass.
+
+.. _pycodestyle: https://github.com/PyCQA/pycodestyle
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..df9738f
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,23 @@
+Copyright (C) 2010-2011 Hideo Hattori
+Copyright (C) 2011-2013 Hideo Hattori, Steven Myint
+Copyright (C) 2013-2016 Hideo Hattori, Steven Myint, Bill Wendling
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/MANIFEST.in b/MANIFEST.in
index c994dfd..8dd24dc 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -1,7 +1,31 @@
+include AUTHORS.rst
+include LICENSE
include README.rst
include test/__init__.py
include test/bad_encoding.py
include test/bad_encoding2.py
include test/e101_example.py
+include test/example
+include test/example/x.py
+include test/example_with_reduce.py
include test/example.py
include test/iso_8859_1.py
+include test/fake_configuration/.pep8
+include test/fake_pycodestyle_configuration/tox.ini
+recursive-exclude test/suite *.py
+recursive-exclude test/suite/out *.py
+exclude .travis.yml
+exclude CONTRIBUTING.rst
+exclude Makefile
+exclude coveralls.bash
+exclude hooks
+exclude hooks/pre-push
+exclude install_hooks.bash
+exclude test/.gitignore
+exclude test/acid.py
+exclude test/acid_pypi.py
+exclude test/suite
+exclude test/suite/out
+exclude test/vim_autopep8.py
+exclude tox.ini
+exclude update_readme.py
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..54400c5
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,131 @@
+all:
+ @echo "make test(test_basic, test_diff, test_unit)"
+ @echo "make fasttest"
+ @echo "make benchmark"
+ @echo "make pypireg"
+ @echo "make coverage"
+ @echo "make check"
+ @echo "make clean"
+
+PYTHON?=python
+COVERAGE?=coverage
+
+TEST_DIR=test
+
+test: test_basic test_diff test_unit
+fasttest: test_fast
+
+test_basic:
+ @echo '---> Running basic test'
+ @${PYTHON} autopep8.py --aggressive test/example.py > .tmp.test.py
+ pycodestyle --repeat .tmp.test.py
+ @rm .tmp.test.py
+
+test_diff:
+ @echo '---> Running --diff test'
+ @cp test/example.py .tmp.example.py
+ @${PYTHON} autopep8.py --aggressive --diff .tmp.example.py > .tmp.example.py.patch
+ patch < .tmp.example.py.patch
+ @rm .tmp.example.py.patch
+ pycodestyle --repeat .tmp.example.py && ${PYTHON} -m py_compile .tmp.example.py
+ @rm .tmp.example.py
+
+test_unit:
+ @echo '---> Running unit tests'
+ @${PYTHON} test/test_autopep8.py
+
+test_fast:
+ @echo '[run]' > .pytest.coveragerc
+ @echo 'branch = True' >> .pytest.coveragerc
+ @echo 'omit = "*/site-packages/*"' >> .pytest.coveragerc
+ @echo '[report]' >> .pytest.coveragerc
+ @echo 'include = autopep8.py' >> .pytest.coveragerc
+ @AUTOPEP8_COVERAGE=1 py.test -n4 --cov-config .pytest.coveragerc \
+ --cov-report term-missing --cov autopep8 test/test_autopep8.py
+ @rm .pytest.coveragerc .coverage
+
+coverage:
+ @coverage erase
+ @AUTOPEP8_COVERAGE=1 ${COVERAGE} run --branch --parallel-mode --omit='*/site-packages/*' test/test_autopep8.py
+ @${COVERAGE} combine
+ @${COVERAGE} report --show-missing
+ @${COVERAGE} xml --include=autopep8.py
+
+open_coverage: coverage
+ @${COVERAGE} html
+ @python -m webbrowser -n "file://${PWD}/htmlcov/index.html"
+
+benchmark:
+ @echo '---> Benchmark of autopep8.py test/example.py'
+ @time ${PYTHON} autopep8.py --aggressive test/example.py > /dev/null
+ @echo '---> Benchmark of test_unit'
+ @time ${PYTHON} test/test_autopep8.py > /dev/null
+ @echo '---> Benchmark of autopep8.py -d test/*.py'
+ @time ${PYTHON} autopep8.py -d test/*.py > /dev/null
+
+readme:
+ @${PYTHON} update_readme.py
+ @rstcheck README.rst
+ @${PYTHON} -m doctest -v README.rst
+
+open_readme: readme
+ @python -m webbrowser -n "file://${PWD}/README.html"
+
+check:
+ pycodestyle \
+ --ignore=E402 \
+ autopep8.py setup.py test/acid.py test/acid_pypi.py update_readme.py
+ pylint \
+ --reports=no \
+ --msg-template='{path}:{line}: [{msg_id}({symbol}), {obj}] {msg}' \
+ --disable=bad-builtin \
+ --disable=bad-continuation \
+ --disable=fixme \
+ --disable=import-error \
+ --disable=invalid-name \
+ --disable=locally-disabled \
+ --disable=missing-docstring \
+ --disable=no-member \
+ --disable=no-self-use \
+ --disable=not-callable \
+ --disable=protected-access \
+ --disable=redefined-builtin \
+ --disable=star-args \
+ --disable=super-on-old-class \
+ --disable=too-few-public-methods \
+ --disable=too-many-arguments \
+ --disable=too-many-boolean-expressions \
+ --disable=too-many-branches \
+ --disable=too-many-instance-attributes \
+ --disable=too-many-lines \
+ --disable=too-many-locals \
+ --disable=too-many-nested-blocks \
+ --disable=too-many-public-methods \
+ --disable=too-many-statements \
+ --disable=undefined-loop-variable \
+ --rcfile=/dev/null autopep8.py setup.py update_readme.py
+ pylint \
+ --reports=no \
+ --msg-template='{path}:{line}: [{msg_id}({symbol}), {obj}] {msg}' \
+ --errors-only \
+ --disable=no-member \
+ --rcfile=/dev/null \
+ test/acid.py test/acid_pypi.py test/test_autopep8.py
+ ./autopep8.py --diff autopep8.py setup.py test/test_autopep8.py update_readme.py
+
+mutant:
+ @mut.py --disable-operator RIL -t autopep8 -u test.test_autopep8 -mc
+
+pypireg:
+ ${PYTHON} setup.py register
+ ${PYTHON} setup.py sdist upload
+
+clean:
+ rm -rf .tmp.test.py temp *.pyc *egg-info dist build \
+ __pycache__ */__pycache__ */*/__pycache__ \
+ htmlcov coverage.xml
+
+.PHONY: \
+ all clean mutant pypireg test_basic test_unit \
+ benchmark coverage open_coverage readme test_diff \
+ check fasttest open_readme test test_fast
diff --git a/PKG-INFO b/PKG-INFO
deleted file mode 100644
index bf79611..0000000
--- a/PKG-INFO
+++ /dev/null
@@ -1,315 +0,0 @@
-Metadata-Version: 1.1
-Name: autopep8
-Version: 0.9.1
-Summary: A tool that automatically formats Python code to conform to the PEP 8 style guide
-Home-page: https://github.com/hhatto/autopep8
-Author: Hideo Hattori
-Author-email: hhatto.jp at gmail.com
-License: Expat License
-Description: ========
- autopep8
- ========
-
- .. image:: https://travis-ci.org/hhatto/autopep8.png?branch=master
- :target: https://travis-ci.org/hhatto/autopep8
- :alt: Build status
-
- .. image:: https://coveralls.io/repos/hhatto/autopep8/badge.png?branch=master
- :target: https://coveralls.io/r/hhatto/autopep8
- :alt: Test coverage status
-
-
- About
- =====
-
- autopep8 automatically formats Python code to conform to the `PEP 8`_ style
- guide. It uses the pep8_ utility to determine what parts of the code needs to
- be formatted. autopep8 is capable of fixing most of the formatting issues_ that
- can be reported by pep8.
-
- .. _PEP 8: http://www.python.org/dev/peps/pep-0008
- .. _issues: https://pep8.readthedocs.org/en/latest/intro.html#error-codes
-
-
- Installation
- ============
-
- From pip::
-
- $ pip install --upgrade autopep8
-
- From easy_install::
-
- $ easy_install -ZU autopep8
-
-
- Requirements
- ============
-
- autopep8 requires pep8_ (>= 1.4.5).
-
- .. _pep8: https://github.com/jcrocholl/pep8
-
-
- Usage
- =====
-
- To modify a file in place (with all fixes enabled)::
-
- $ autopep8 --in-place --aggressive <filename>
-
- Before running autopep8.
-
- .. code-block:: python
-
- import sys, os;
-
- def someone_likes_semicolons( foo = None ,\
- bar='bar'):
-
-
- """Hello; bye."""; print( 'A'<>foo) #<> is a deprecated form of !=
- return 0;
- def func11():
- a=( 1,2, 3,"a" );
- ####This is a long comment. This should be wrapped to fit within 72 characters.
- x = [a,[100,200,300,9876543210,'This is a long string that goes on and on']]
- def func22(): return {True: True}.has_key({'foo': 2}.has_key('foo'));
- class UselessClass( object ):
- def __init__ ( self, bar ):
- #Comments should have a space after the hash.
- if bar : bar+=1; bar=bar* bar ; return bar
- else:
- indentation_in_strings_should_not_be_touched = """
- hello
- world
- """
- raise ValueError, indentation_in_strings_should_not_be_touched
- def my_method(self):
- print(self);
-
- After running autopep8.
-
- .. code-block:: python
-
- import sys
- import os
-
-
- def someone_likes_semicolons(foo=None,
- bar='bar'):
- """Hello; bye."""
- print('A' != foo) # <> is a deprecated form of !=
- return 0
-
-
- def func11():
- a = (1, 2, 3, "a")
- # This is a long comment. This should be wrapped to fit within 72
- # characters.
- x = [a, [100, 200, 300, 9876543210,
- 'This is a long string that goes on and on']]
-
-
- def func22():
- return ('foo' in {'foo': 2}) in {True: True}
-
-
- class UselessClass(object):
-
- def __init__(self, bar):
- # Comments should have a space after the hash.
- if bar:
- bar += 1
- bar = bar * bar
- return bar
- else:
- indentation_in_strings_should_not_be_touched = """
- hello
- world
- """
- raise ValueError(indentation_in_strings_should_not_be_touched)
-
- def my_method(self):
- print(self)
-
-
- Options::
-
- Usage: autopep8 [options] [filename [filename ...]]
- Use filename '-' for stdin.
-
- Automatically formats Python code to conform to the PEP 8 style guide.
-
- Options:
- --version show program's version number and exit
- -h, --help show this help message and exit
- -v, --verbose print verbose messages; multiple -v result in more
- verbose messages
- -d, --diff print the diff for the fixed source
- -i, --in-place make changes to files in place
- -r, --recursive run recursively; must be used with --in-place or
- --diff
- -j n, --jobs=n number of parallel jobs; match CPU count if value is
- less than 1
- -p n, --pep8-passes=n
- maximum number of additional pep8 passes (default:
- infinite)
- -a, --aggressive enable non-whitespace changes; multiple -a result in
- more aggressive changes
- --exclude=globs exclude files/directories that match these comma-
- separated globs
- --list-fixes list codes for fixes; used by --ignore and --select
- --ignore=errors do not fix these errors/warnings (default: E24,W6)
- --select=errors fix only these errors/warnings (e.g. E4,W)
- --max-line-length=n set maximum allowed line length (default: 79)
-
-
- Features
- ========
-
- autopep8 fixes the following issues_ reported by pep8_::
-
- E101 - Reindent all lines.
- E111 - Reindent all lines.
- E121 - Fix indentation to be a multiple of four.
- E122 - Add absent indentation for hanging indentation.
- E123 - Align closing bracket to match opening bracket.
- E124 - Align closing bracket to match visual indentation.
- E125 - Indent to distinguish line from next logical line.
- E126 - Fix over-indented hanging indentation.
- E127 - Fix visual indentation.
- E128 - Fix visual indentation.
- E20 - Remove extraneous whitespace.
- E211 - Remove extraneous whitespace.
- E22 - Fix extraneous whitespace around keywords.
- E224 - Remove extraneous whitespace around operator.
- E22 - Fix missing whitespace around operator.
- E231 - Add missing whitespace.
- E241 - Fix extraneous whitespace around keywords.
- E242 - Remove extraneous whitespace around operator.
- E251 - Remove whitespace around parameter '=' sign.
- E26 - Fix spacing after comment hash.
- E27 - Fix extraneous whitespace around keywords.
- E301 - Add missing blank line.
- E302 - Add missing 2 blank lines.
- E303 - Remove extra blank lines.
- E304 - Remove blank line following function decorator.
- E401 - Put imports on separate lines.
- E501 - Try to make lines fit within --max-line-length characters.
- E502 - Remove extraneous escape of newline.
- E701 - Put colon-separated compound statement on separate lines.
- E70 - Put semicolon-separated compound statement on separate lines.
- E711 - Fix comparison with None.
- E712 - Fix comparison with boolean.
- W191 - Reindent all lines.
- W291 - Remove trailing whitespace.
- W293 - Remove trailing whitespace on blank line.
- W391 - Remove trailing blank lines.
- E26 - Format block comments.
- W6 - Fix various deprecated code (via lib2to3).
- W602 - Fix deprecated form of raising exception.
-
- autopep8 also fixes some issues not found by pep8_.
-
- - Correct deprecated or non-idiomatic Python code (via ``lib2to3``). (This is
- triggered if ``W6`` is enabled.)
- - Format block comments. (This is triggered if ``E26`` is enabled.)
- - Normalize files with mixed line endings.
- - Put a blank line between a class declaration and its first method
- declaration. (Enabled with ``E301``.)
- - Remove blank lines between a function declaration and its docstring. (Enabled
- with ``E303``.)
-
-
- More advanced usage
- ===================
-
- To enable only a subset of the fixes, use the ``--select`` option. For example,
- to fix various types of indentation issues::
-
- $ autopep8 --select=E1,W1 <filename>
-
- Similarly, to just fix deprecated code::
-
- $ autopep8 --select=W6 <filename>
-
- The above is useful when trying to port a single code base to work with both
- Python 2 and Python 3 at the same time.
-
- If the file being fixed is large, you may want to enable verbose progress
- messages::
-
- $ autopep8 -v <filename>
-
- By default autopep8 only makes whitespace changes. Thus, by default, it does
- not fix ``E711`` and ``E712``. (Changing ``x == None`` to ``x is None`` may
- change the meaning of the program if ``x`` has its ``__eq__`` method
- overridden.) Nor does it correct deprecated code ``W6``. To enable these
- more aggressive fixes, use the ``--aggressive`` option::
-
- $ autopep8 --aggressive <filename>
-
- ``--aggressive`` will also shorten lines more aggressively.
-
-
- Use as a module
- ===============
-
- The simplest way of using autopep8 as a module is via the ``fix_string()``
- function.
-
- .. code-block:: python
-
- >>> import autopep8
- >>> autopep8.fix_string('x= 123\n')
- 'x = 123\n'
-
-
- Testing
- =======
-
- Test cases are in ``test/test_autopep8.py``. They can be run directly via
- ``python test/test_autopep8.py`` or via tox_. The latter is useful for
- testing against multiple Python interpreters. (We currently test against
- CPython versions 2.6, 2.7, 3.2, and 3.3. We also test against PyPy.)
-
- .. _`tox`: https://pypi.python.org/pypi/tox
-
- Broad spectrum testing is available via ``test/acid.py``. This script runs
- autopep8 against Python code and checks for correctness and completeness of the
- code fixes. It can check that the bytecode remains identical.
- ``test/acid_pypi.py`` makes use of ``acid.py`` to test against the latest
- released packages on PyPI. In a similar fashion, ``test/acid_github.py`` tests
- against Python code in Github repositories.
-
-
- Links
- =====
-
- * PyPI_
- * GitHub_
- * `Travis CI`_
- * Jenkins_
-
- .. _PyPI: https://pypi.python.org/pypi/autopep8/
- .. _GitHub: https://github.com/hhatto/autopep8
- .. _`Travis CI`: https://travis-ci.org/hhatto/autopep8
- .. _Jenkins: http://jenkins.hexacosa.net/job/autopep8/
-
-Keywords: automation,pep8,format
-Platform: UNKNOWN
-Classifier: Development Status :: 5 - Production/Stable
-Classifier: Environment :: Console
-Classifier: Intended Audience :: Developers
-Classifier: License :: OSI Approved :: MIT License
-Classifier: Operating System :: OS Independent
-Classifier: Programming Language :: Python
-Classifier: Programming Language :: Python :: 2
-Classifier: Programming Language :: Python :: 2.6
-Classifier: Programming Language :: Python :: 2.7
-Classifier: Programming Language :: Python :: 3
-Classifier: Programming Language :: Python :: 3.2
-Classifier: Programming Language :: Python :: 3.3
-Classifier: Topic :: Software Development :: Libraries :: Python Modules
-Classifier: Topic :: Software Development :: Quality Assurance
diff --git a/README.rst b/README.rst
index a8831cb..667e9ad 100644
--- a/README.rst
+++ b/README.rst
@@ -2,25 +2,19 @@
autopep8
========
-.. image:: https://travis-ci.org/hhatto/autopep8.png?branch=master
- :target: https://travis-ci.org/hhatto/autopep8
- :alt: Build status
-
-.. image:: https://coveralls.io/repos/hhatto/autopep8/badge.png?branch=master
- :target: https://coveralls.io/r/hhatto/autopep8
- :alt: Test coverage status
-
-
-About
-=====
+.. image:: https://travis-ci.org/hhatto/autopep8.svg?branch=master
+ :target: https://travis-ci.org/hhatto/autopep8
+ :alt: Build status
autopep8 automatically formats Python code to conform to the `PEP 8`_ style
-guide. It uses the pep8_ utility to determine what parts of the code needs to
-be formatted. autopep8 is capable of fixing most of the formatting issues_ that
-can be reported by pep8.
+guide. It uses the pycodestyle_ utility to determine what parts of the code
+needs to be formatted. autopep8 is capable of fixing most of the formatting
+issues_ that can be reported by pycodestyle.
-.. _PEP 8: http://www.python.org/dev/peps/pep-0008
-.. _issues: https://pep8.readthedocs.org/en/latest/intro.html#error-codes
+.. _PEP 8: https://www.python.org/dev/peps/pep-0008/
+.. _issues: https://pycodestyle.readthedocs.org/en/latest/intro.html#error-codes
+
+.. contents::
Installation
@@ -30,84 +24,89 @@ From pip::
$ pip install --upgrade autopep8
-From easy_install::
+Consider using the ``--user`` option_.
- $ easy_install -ZU autopep8
+.. _option: https://pip.pypa.io/en/latest/user_guide/#user-installs
Requirements
============
-autopep8 requires pep8_ (>= 1.4.5).
+autopep8 requires pycodestyle_.
-.. _pep8: https://github.com/jcrocholl/pep8
+.. _pycodestyle: https://github.com/PyCQA/pycodestyle
Usage
=====
-To modify a file in place (with all fixes enabled)::
+To modify a file in place (with aggressive level 2)::
- $ autopep8 --in-place --aggressive <filename>
+ $ autopep8 --in-place --aggressive --aggressive <filename>
Before running autopep8.
.. code-block:: python
- import sys, os;
-
- def someone_likes_semicolons( foo = None ,\
- bar='bar'):
-
+ import math, sys;
- """Hello; bye."""; print( 'A'<>foo) #<> is a deprecated form of !=
- return 0;
- def func11():
- a=( 1,2, 3,"a" );
+ def example1():
####This is a long comment. This should be wrapped to fit within 72 characters.
- x = [a,[100,200,300,9876543210,'This is a long string that goes on and on']]
- def func22(): return {True: True}.has_key({'foo': 2}.has_key('foo'));
- class UselessClass( object ):
+ some_tuple=( 1,2, 3,'a' );
+ some_variable={'long':'Long code lines should be wrapped within 79 characters.',
+ 'other':[math.pi, 100,200,300,9876543210,'This is a long string that goes on'],
+ 'more':{'inner':'This whole logical line should be wrapped.',some_tuple:[1,
+ 20,300,40000,500000000,60000000000000000]}}
+ return (some_tuple, some_variable)
+ def example2(): return {'has_key() is deprecated':True}.has_key({'f':2}.has_key(''));
+ class Example3( object ):
def __init__ ( self, bar ):
#Comments should have a space after the hash.
if bar : bar+=1; bar=bar* bar ; return bar
else:
- indentation_in_strings_should_not_be_touched = """
- hello
- world
+ some_string = """
+ Indentation in multiline strings should not be touched.
+ Only actual code should be reindented.
"""
- raise ValueError, indentation_in_strings_should_not_be_touched
- def my_method(self):
- print(self);
+ return (sys.path, some_string)
After running autopep8.
.. code-block:: python
+ import math
import sys
- import os
- def someone_likes_semicolons(foo=None,
- bar='bar'):
- """Hello; bye."""
- print('A' != foo) # <> is a deprecated form of !=
- return 0
-
-
- def func11():
- a = (1, 2, 3, "a")
+ def example1():
# This is a long comment. This should be wrapped to fit within 72
# characters.
- x = [a, [100, 200, 300, 9876543210,
- 'This is a long string that goes on and on']]
-
-
- def func22():
- return ('foo' in {'foo': 2}) in {True: True}
-
-
- class UselessClass(object):
+ some_tuple = (1, 2, 3, 'a')
+ some_variable = {
+ 'long': 'Long code lines should be wrapped within 79 characters.',
+ 'other': [
+ math.pi,
+ 100,
+ 200,
+ 300,
+ 9876543210,
+ 'This is a long string that goes on'],
+ 'more': {
+ 'inner': 'This whole logical line should be wrapped.',
+ some_tuple: [
+ 1,
+ 20,
+ 300,
+ 40000,
+ 500000000,
+ 60000000000000000]}}
+ return (some_tuple, some_variable)
+
+
+ def example2(): return ('' in {'f': 2}) in {'has_key() is deprecated': True}
+
+
+ class Example3(object):
def __init__(self, bar):
# Comments should have a space after the hash.
@@ -116,54 +115,70 @@ After running autopep8.
bar = bar * bar
return bar
else:
- indentation_in_strings_should_not_be_touched = """
- hello
- world
+ some_string = """
+ Indentation in multiline strings should not be touched.
+ Only actual code should be reindented.
"""
- raise ValueError(indentation_in_strings_should_not_be_touched)
-
- def my_method(self):
- print(self)
-
+ return (sys.path, some_string)
Options::
- Usage: autopep8 [options] [filename [filename ...]]
- Use filename '-' for stdin.
+ usage: autopep8 [-h] [--version] [-v] [-d] [-i] [--global-config filename]
+ [--ignore-local-config] [-r] [-j n] [-p n] [-a]
+ [--experimental] [--exclude globs] [--list-fixes]
+ [--ignore errors] [--select errors] [--max-line-length n]
+ [--line-range line line]
+ [files [files ...]]
Automatically formats Python code to conform to the PEP 8 style guide.
- Options:
- --version show program's version number and exit
+ positional arguments:
+ files files to format or '-' for standard in
+
+ optional arguments:
-h, --help show this help message and exit
+ --version show program's version number and exit
-v, --verbose print verbose messages; multiple -v result in more
verbose messages
-d, --diff print the diff for the fixed source
-i, --in-place make changes to files in place
- -r, --recursive run recursively; must be used with --in-place or
- --diff
- -j n, --jobs=n number of parallel jobs; match CPU count if value is
+ --global-config filename
+ path to a global pep8 config file; if this file does
... 21477 lines suppressed ...
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/autopep8.git
More information about the Python-modules-commits
mailing list