Add pep8 Python package (1.4.6)
authorGregory Szorc <gps@mozilla.com>
Mon, 22 Jul 2013 20:55:45 -0700
changeset 20 3f6f66219a7232c94d9dbc88e9570e19d59d0476
parent 19 26fbd682dfce1d932628d32296712bd624ff9c4c
child 21 baf677f16f850924a9a3627e39d0bcde468faebe
push id9
push usergszorc@mozilla.com
push dateTue, 23 Jul 2013 03:56:04 +0000
Add pep8 Python package (1.4.6)
pep8/CHANGES.txt
pep8/MANIFEST.in
pep8/PKG-INFO
pep8/README.rst
pep8/docs/Makefile
pep8/docs/advanced.rst
pep8/docs/api.rst
pep8/docs/conf.py
pep8/docs/developer.rst
pep8/docs/index.rst
pep8/docs/intro.rst
pep8/docs/make.bat
pep8/pep8.egg-info/PKG-INFO
pep8/pep8.egg-info/SOURCES.txt
pep8/pep8.egg-info/dependency_links.txt
pep8/pep8.egg-info/entry_points.txt
pep8/pep8.egg-info/namespace_packages.txt
pep8/pep8.egg-info/not-zip-safe
pep8/pep8.egg-info/top_level.txt
pep8/pep8.py
pep8/setup.cfg
pep8/setup.py
pep8/testsuite/E10.py
pep8/testsuite/E11.py
pep8/testsuite/E12.py
pep8/testsuite/E12not.py
pep8/testsuite/E20.py
pep8/testsuite/E21.py
pep8/testsuite/E22.py
pep8/testsuite/E23.py
pep8/testsuite/E24.py
pep8/testsuite/E25.py
pep8/testsuite/E26.py
pep8/testsuite/E27.py
pep8/testsuite/E30.py
pep8/testsuite/E30not.py
pep8/testsuite/E40.py
pep8/testsuite/E50.py
pep8/testsuite/E70.py
pep8/testsuite/E71.py
pep8/testsuite/E72.py
pep8/testsuite/E90.py
pep8/testsuite/W19.py
pep8/testsuite/W29.py
pep8/testsuite/W39.py
pep8/testsuite/W60.py
pep8/testsuite/__init__.py
pep8/testsuite/latin-1.py
pep8/testsuite/noqa.py
pep8/testsuite/python3.py
pep8/testsuite/support.py
pep8/testsuite/test_all.py
pep8/testsuite/test_api.py
pep8/testsuite/test_shell.py
pep8/testsuite/utf-8-bom.py
pep8/testsuite/utf-8.py
new file mode 100644
--- /dev/null
+++ b/pep8/CHANGES.txt
@@ -0,0 +1,460 @@
+Changelog
+=========
+
+
+1.4.6 (2013-07-02)
+------------------
+
+* Honor ``# noqa`` for errors E711 and E712. (Issue #180)
+
+* When both a ``tox.ini`` and a ``setup.cfg`` are present in the project
+  directory, merge their contents.  The ``tox.ini`` file takes
+  precedence (same as before). (Issue #182)
+
+* Give priority to ``--select`` over ``--ignore``. (Issue #188)
+
+* Compare full path when excluding a file. (Issue #186)
+
+* Correctly report other E12 errors when E123 is ignored. (Issue #103)
+
+* New option ``--hang-closing`` to switch to the alternative style of
+  closing bracket indentation for hanging indent.  Add error E133 for
+  closing bracket which is missing indentation. (Issue #103)
+
+* Accept both styles of closing bracket indentation for hanging indent.
+  Do not report error E123 in the default configuration. (Issue #103)
+
+* Do not crash when running AST checks and the document contains null bytes.
+  (Issue #184)
+
+* Fix false positive E261/E262 when the file contains a BOM. (Issue #193)
+
+* Fix E701, E702 and E703 not detected sometimes. (Issue #196)
+
+* Fix E122 not detected in some cases. (Issue #201 and #208)
+
+* Fix false positive E121 with multiple brackets. (Issue #203)
+
+
+1.4.5 (2013-03-06)
+------------------
+
+* When no path is specified, do not try to read from stdin.  The feature
+  was added in 1.4.3, but it is not supported on Windows.  Use ``-``
+  filename argument to read from stdin.  This usage is supported
+  since 1.3.4. (Issue #170)
+
+* Do not require ``setuptools`` in setup.py.  It works around an issue
+  with ``pip`` and Python 3. (Issue #172)
+
+* Add ``__pycache__`` to the ignore list.
+
+* Change misleading message for E251. (Issue #171)
+
+* Do not report false E302 when the source file has a coding cookie or a
+  comment on the first line. (Issue #174)
+
+* Reorganize the tests and add tests for the API and for the command line
+  usage and options. (Issues #161 and #162)
+
+* Ignore all checks which are not explicitly selected when ``select`` is
+  passed to the ``StyleGuide`` constructor.
+
+
+1.4.4 (2013-02-24)
+------------------
+
+* Report E227 or E228 instead of E225 for whitespace around bitwise, shift
+  or modulo operators. (Issue #166)
+
+* Change the message for E226 to make clear that it is about arithmetic
+  operators.
+
+* Fix a false positive E128 for continuation line indentation with tabs.
+
+* Fix regression with the ``--diff`` option. (Issue #169)
+
+* Fix the ``TestReport`` class to print the unexpected warnings and
+  errors.
+
+
+1.4.3 (2013-02-22)
+------------------
+
+* Hide the ``--doctest`` and ``--testsuite`` options when installed.
+
+* Fix crash with AST checkers when the syntax is invalid. (Issue #160)
+
+* Read from standard input if no path is specified.
+
+* Initiate a graceful shutdown on ``Control+C``.
+
+* Allow to change the ``checker_class`` for the ``StyleGuide``.
+
+
+1.4.2 (2013-02-10)
+------------------
+
+* Support AST checkers provided by third-party applications.
+
+* Register new checkers with ``register_check(func_or_cls, codes)``.
+
+* Allow to construct a ``StyleGuide`` with a custom parser.
+
+* Accept visual indentation without parenthesis after the ``if``
+  statement. (Issue #151)
+
+* Fix UnboundLocalError when using ``# noqa`` with continued lines.
+  (Issue #158)
+
+* Re-order the lines for the ``StandardReport``.
+
+* Expand tabs when checking E12 continuation lines. (Issue #155)
+
+* Refactor the testing class ``TestReport`` and the specific test
+  functions into a separate test module.
+
+
+1.4.1 (2013-01-18)
+------------------
+
+* Allow sphinx.ext.autodoc syntax for comments. (Issue #110)
+
+* Report E703 instead of E702 for the trailing semicolon. (Issue #117)
+
+* Honor ``# noqa`` in addition to ``# nopep8``. (Issue #149)
+
+* Expose the ``OptionParser`` factory for better extensibility.
+
+
+1.4 (2012-12-22)
+----------------
+
+* Report E226 instead of E225 for optional whitespace around common
+  operators (``*``, ``**``, ``/``, ``+`` and ``-``).  This new error
+  code is ignored in the default configuration because PEP 8 recommends
+  to "use your own judgement". (Issue #96)
+
+* Lines with a ``# nopep8`` at the end will not issue errors on line
+  length E501 or continuation line indentation E12*. (Issue #27)
+
+* Fix AssertionError when the source file contains an invalid line
+  ending ``"\r\r\n"``. (Issue #119)
+
+* Read the ``[pep8]`` section of ``tox.ini`` or ``setup.cfg`` if present.
+  (Issue #93 and #141)
+
+* Add the Sphinx-based documentation, and publish it
+  on http://pep8.readthedocs.org/. (Issue #105)
+
+
+1.3.4 (2012-12-18)
+------------------
+
+* Fix false positive E124 and E128 with comments. (Issue #100)
+
+* Fix error on stdin when running with bpython. (Issue #101)
+
+* Fix false positive E401. (Issue #104)
+
+* Report E231 for nested dictionary in list. (Issue #142)
+
+* Catch E271 at the beginning of the line. (Issue #133)
+
+* Fix false positive E126 for multi-line comments. (Issue #138)
+
+* Fix false positive E221 when operator is preceded by a comma. (Issue #135)
+
+* Fix ``--diff`` failing on one-line hunk. (Issue #137)
+
+* Fix the ``--exclude`` switch for directory paths. (Issue #111)
+
+* Use ``-`` filename to read from standard input. (Issue #128)
+
+
+1.3.3 (2012-06-27)
+------------------
+
+* Fix regression with continuation line checker. (Issue #98)
+
+
+1.3.2 (2012-06-26)
+------------------
+
+* Revert to the previous behaviour for ``--show-pep8``:
+  do not imply ``--first``. (Issue #89)
+
+* Add E902 for IO errors. (Issue #87)
+
+* Fix false positive for E121, and missed E124. (Issue #92)
+
+* Set a sensible default path for config file on Windows. (Issue #95)
+
+* Allow ``verbose`` in the configuration file. (Issue #91)
+
+* Show the enforced ``max-line-length`` in the error message. (Issue #86)
+
+
+1.3.1 (2012-06-18)
+------------------
+
+* Explain which configuration options are expected.  Accept and recommend
+  the options names with hyphen instead of underscore. (Issue #82)
+
+* Do not read the user configuration when used as a module
+  (except if ``config_file=True`` is passed to the ``StyleGuide`` constructor).
+
+* Fix wrong or missing cases for the E12 series.
+
+* Fix cases where E122 was missed. (Issue #81)
+
+
+1.3 (2012-06-15)
+----------------
+
+.. warning::
+   The internal API is backwards incompatible.
+
+* Remove global configuration and refactor the library around
+  a ``StyleGuide`` class; add the ability to configure various
+  reporters. (Issue #35 and #66)
+
+* Read user configuration from ``~/.config/pep8``
+  and local configuration from ``./.pep8``. (Issue #22)
+
+* Fix E502 for backslash embedded in multi-line string. (Issue #68)
+
+* Fix E225 for Python 3 iterable unpacking (PEP 3132). (Issue #72)
+
+* Enable the new checkers from the E12 series in the default
+  configuration.
+
+* Suggest less error-prone alternatives for E712 errors.
+
+* Rewrite checkers to run faster (E22, E251, E27).
+
+* Fixed a crash when parsed code is invalid (too many
+  closing brackets).
+
+* Fix E127 and E128 for continuation line indentation. (Issue #74)
+
+* New option ``--format`` to customize the error format. (Issue #23)
+
+* New option ``--diff`` to check only modified code.  The unified
+  diff is read from STDIN.  Example: ``hg diff | pep8 --diff``
+  (Issue #39)
+
+* Correctly report the count of failures and set the exit code to 1
+  when the ``--doctest`` or the ``--testsuite`` fails.
+
+* Correctly detect the encoding in Python 3. (Issue #69)
+
+* Drop support for Python 2.3, 2.4 and 3.0. (Issue #78)
+
+
+1.2 (2012-06-01)
+----------------
+
+* Add E121 through E128 for continuation line indentation.  These
+  checks are disabled by default.  If you want to force all checks,
+  use switch ``--select=E,W``.  Patch by Sam Vilain. (Issue #64)
+
+* Add E721 for direct type comparisons. (Issue #47)
+
+* Add E711 and E712 for comparisons to singletons. (Issue #46)
+
+* Fix spurious E225 and E701 for function annotations. (Issue #29)
+
+* Add E502 for explicit line join between brackets.
+
+* Fix E901 when printing source with ``--show-source``.
+
+* Report all errors for each checker, instead of reporting only the
+  first occurence for each line.
+
+* Option ``--show-pep8`` implies ``--first``.
+
+
+1.1 (2012-05-24)
+----------------
+
+* Add E901 for syntax errors. (Issues #63 and #30)
+
+* Add E271, E272, E273 and E274 for extraneous whitespace around
+  keywords. (Issue #57)
+
+* Add ``tox.ini`` configuration file for tests. (Issue #61)
+
+* Add ``.travis.yml`` configuration file for continuous integration.
+  (Issue #62)
+
+
+1.0.1 (2012-04-06)
+------------------
+
+* Fix inconsistent version numbers.
+
+
+1.0 (2012-04-04)
+----------------
+
+* Fix W602 ``raise`` to handle multi-char names. (Issue #53)
+
+
+0.7.0 (2012-03-26)
+------------------
+
+* Now ``--first`` prints only the first occurence of each error.
+  The ``--repeat`` flag becomes obsolete because it is the default
+  behaviour. (Issue #6)
+
+* Allow to specify ``--max-line-length``. (Issue #36)
+
+* Make the shebang more flexible. (Issue #26)
+
+* Add testsuite to the bundle. (Issue #25)
+
+* Fixes for Jython. (Issue #49)
+
+* Add PyPI classifiers. (Issue #43)
+
+* Fix the ``--exclude`` option. (Issue #48)
+
+* Fix W602, accept ``raise`` with 3 arguments. (Issue #34)
+
+* Correctly select all tests if ``DEFAULT_IGNORE == ''``.
+
+
+0.6.1 (2010-10-03)
+------------------
+
+* Fix inconsistent version numbers. (Issue #21)
+
+
+0.6.0 (2010-09-19)
+------------------
+
+* Test suite reorganized and enhanced in order to check more failures
+  with fewer test files.  Read the ``run_tests`` docstring for details
+  about the syntax.
+
+* Fix E225: accept ``print >>sys.stderr, "..."`` syntax.
+
+* Fix E501 for lines containing multibyte encoded characters. (Issue #7)
+
+* Fix E221, E222, E223, E224 not detected in some cases. (Issue #16)
+
+* Fix E211 to reject ``v = dic['a'] ['b']``. (Issue #17)
+
+* Exit code is always 1 if any error or warning is found. (Issue #10)
+
+* ``--ignore`` checks are now really ignored, especially in
+  conjunction with ``--count``. (Issue #8)
+
+* Blank lines with spaces yield W293 instead of W291: some developers
+  want to ignore this warning and indent the blank lines to paste their
+  code easily in the Python interpreter.
+
+* Fix E301: do not require a blank line before an indented block. (Issue #14)
+
+* Fix E203 to accept NumPy slice notation ``a[0, :]``. (Issue #13)
+
+* Performance improvements.
+
+* Fix decoding and checking non-UTF8 files in Python 3.
+
+* Fix E225: reject ``True+False`` when running on Python 3.
+
+* Fix an exception when the line starts with an operator.
+
+* Allow a new line before closing ``)``, ``}`` or ``]``. (Issue #5)
+
+
+0.5.0 (2010-02-17)
+------------------
+
+* Changed the ``--count`` switch to print to sys.stderr and set
+  exit code to 1 if any error or warning is found.
+
+* E241 and E242 are removed from the standard checks. If you want to
+  include these checks, use switch ``--select=E,W``. (Issue #4)
+
+* Blank line is not mandatory before the first class method or nested
+  function definition, even if there's a docstring. (Issue #1)
+
+* Add the switch ``--version``.
+
+* Fix decoding errors with Python 3. (Issue #13 [1]_)
+
+* Add ``--select`` option which is mirror of ``--ignore``.
+
+* Add checks E261 and E262 for spaces before inline comments.
+
+* New check W604 warns about deprecated usage of backticks.
+
+* New check W603 warns about the deprecated operator ``<>``.
+
+* Performance improvement, due to rewriting of E225.
+
+* E225 now accepts:
+
+  - no whitespace after unary operator or similar. (Issue #9 [1]_)
+
+  - lambda function with argument unpacking or keyword defaults.
+
+* Reserve "2 blank lines" for module-level logical blocks. (E303)
+
+* Allow multi-line comments. (E302, issue #10 [1]_)
+
+
+0.4.2 (2009-10-22)
+------------------
+
+* Decorators on classes and class methods are OK now.
+
+
+0.4 (2009-10-20)
+----------------
+
+* Support for all versions of Python from 2.3 to 3.1.
+
+* New and greatly expanded self tests.
+
+* Added ``--count`` option to print the total number of errors and warnings.
+
+* Further improvements to the handling of comments and blank lines.
+  (Issue #1 [1]_ and others changes.)
+
+* Check all py files in directory when passed a directory (Issue
+  #2 [1]_). This also prevents an exception when traversing directories
+  with non ``*.py`` files.
+
+* E231 should allow commas to be followed by ``)``. (Issue #3 [1]_)
+
+* Spaces are no longer required around the equals sign for keyword
+  arguments or default parameter values.
+
+
+.. [1] These issues refer to the `previous issue tracker`__.
+.. __:  http://github.com/cburroughs/pep8.py/issues
+
+
+0.3.1 (2009-09-14)
+------------------
+
+* Fixes for comments: do not count them when checking for blank lines between
+  items.
+
+* Added setup.py for pypi upload and easy_installability.
+
+
+0.2 (2007-10-16)
+----------------
+
+* Loads of fixes and improvements.
+
+
+0.1 (2006-10-01)
+----------------
+
+* First release.
new file mode 100644
--- /dev/null
+++ b/pep8/MANIFEST.in
@@ -0,0 +1,9 @@
+include *.txt
+include *.rst
+recursive-include docs *
+recursive-include testsuite *
+recursive-exclude docs *.pyc
+recursive-exclude docs *.pyo
+recursive-exclude testsuite *.pyc
+recursive-exclude testsuite *.pyo
+prune docs/_build
new file mode 100644
--- /dev/null
+++ b/pep8/PKG-INFO
@@ -0,0 +1,569 @@
+Metadata-Version: 1.1
+Name: pep8
+Version: 1.4.6
+Summary: Python style guide checker
+Home-page: http://pep8.readthedocs.org/
+Author: Johann C. Rocholl
+Author-email: johann@rocholl.net
+License: Expat license
+Description: pep8 - Python style guide checker
+        =================================
+        
+        pep8 is a tool to check your Python code against some of the style
+        conventions in `PEP 8`_.
+        
+        .. _PEP 8: http://www.python.org/dev/peps/pep-0008/
+        
+        
+        Features
+        --------
+        
+        * Plugin architecture: Adding new checks is easy.
+        
+        * Parseable output: Jump to error location in your editor.
+        
+        * Small: Just one Python file, requires only stdlib. You can use just
+          the pep8.py file for this purpose.
+        
+        * Comes with a comprehensive test suite.
+        
+        Installation
+        ------------
+        
+        You can install, upgrade, uninstall pep8.py with these commands::
+        
+          $ pip install pep8
+          $ pip install --upgrade pep8
+          $ pip uninstall pep8
+        
+        There's also a package for Debian/Ubuntu, but it's not always the
+        latest version.
+        
+        Example usage and output
+        ------------------------
+        
+        ::
+        
+          $ pep8 --first optparse.py
+          optparse.py:69:11: E401 multiple imports on one line
+          optparse.py:77:1: E302 expected 2 blank lines, found 1
+          optparse.py:88:5: E301 expected 1 blank line, found 0
+          optparse.py:222:34: W602 deprecated form of raising exception
+          optparse.py:347:31: E211 whitespace before '('
+          optparse.py:357:17: E201 whitespace after '{'
+          optparse.py:472:29: E221 multiple spaces before operator
+          optparse.py:544:21: W601 .has_key() is deprecated, use 'in'
+        
+        You can also make pep8.py show the source code for each error, and
+        even the relevant text from PEP 8::
+        
+          $ pep8 --show-source --show-pep8 testsuite/E40.py
+          testsuite/E40.py:2:10: E401 multiple imports on one line
+          import os, sys
+                   ^
+              Imports should usually be on separate lines.
+        
+              Okay: import os\nimport sys
+              E401: import sys, os
+        
+        
+        Or you can display how often each error was found::
+        
+          $ pep8 --statistics -qq Python-2.5/Lib
+          232     E201 whitespace after '['
+          599     E202 whitespace before ')'
+          631     E203 whitespace before ','
+          842     E211 whitespace before '('
+          2531    E221 multiple spaces before operator
+          4473    E301 expected 1 blank line, found 0
+          4006    E302 expected 2 blank lines, found 1
+          165     E303 too many blank lines (4)
+          325     E401 multiple imports on one line
+          3615    E501 line too long (82 characters)
+          612     W601 .has_key() is deprecated, use 'in'
+          1188    W602 deprecated form of raising exception
+        
+        Links
+        -----
+        
+        .. image:: https://api.travis-ci.org/jcrocholl/pep8.png?branch=master
+           :target: https://travis-ci.org/jcrocholl/pep8
+           :alt: Build status
+        
+        * `Read the documentation <http://pep8.readthedocs.org/>`_
+        
+        * `Fork me on GitHub <http://github.com/jcrocholl/pep8>`_
+        
+        
+        Changelog
+        =========
+        
+        
+        1.4.6 (2013-07-02)
+        ------------------
+        
+        * Honor ``# noqa`` for errors E711 and E712. (Issue #180)
+        
+        * When both a ``tox.ini`` and a ``setup.cfg`` are present in the project
+          directory, merge their contents.  The ``tox.ini`` file takes
+          precedence (same as before). (Issue #182)
+        
+        * Give priority to ``--select`` over ``--ignore``. (Issue #188)
+        
+        * Compare full path when excluding a file. (Issue #186)
+        
+        * Correctly report other E12 errors when E123 is ignored. (Issue #103)
+        
+        * New option ``--hang-closing`` to switch to the alternative style of
+          closing bracket indentation for hanging indent.  Add error E133 for
+          closing bracket which is missing indentation. (Issue #103)
+        
+        * Accept both styles of closing bracket indentation for hanging indent.
+          Do not report error E123 in the default configuration. (Issue #103)
+        
+        * Do not crash when running AST checks and the document contains null bytes.
+          (Issue #184)
+        
+        * Fix false positive E261/E262 when the file contains a BOM. (Issue #193)
+        
+        * Fix E701, E702 and E703 not detected sometimes. (Issue #196)
+        
+        * Fix E122 not detected in some cases. (Issue #201 and #208)
+        
+        * Fix false positive E121 with multiple brackets. (Issue #203)
+        
+        
+        1.4.5 (2013-03-06)
+        ------------------
+        
+        * When no path is specified, do not try to read from stdin.  The feature
+          was added in 1.4.3, but it is not supported on Windows.  Use ``-``
+          filename argument to read from stdin.  This usage is supported
+          since 1.3.4. (Issue #170)
+        
+        * Do not require ``setuptools`` in setup.py.  It works around an issue
+          with ``pip`` and Python 3. (Issue #172)
+        
+        * Add ``__pycache__`` to the ignore list.
+        
+        * Change misleading message for E251. (Issue #171)
+        
+        * Do not report false E302 when the source file has a coding cookie or a
+          comment on the first line. (Issue #174)
+        
+        * Reorganize the tests and add tests for the API and for the command line
+          usage and options. (Issues #161 and #162)
+        
+        * Ignore all checks which are not explicitly selected when ``select`` is
+          passed to the ``StyleGuide`` constructor.
+        
+        
+        1.4.4 (2013-02-24)
+        ------------------
+        
+        * Report E227 or E228 instead of E225 for whitespace around bitwise, shift
+          or modulo operators. (Issue #166)
+        
+        * Change the message for E226 to make clear that it is about arithmetic
+          operators.
+        
+        * Fix a false positive E128 for continuation line indentation with tabs.
+        
+        * Fix regression with the ``--diff`` option. (Issue #169)
+        
+        * Fix the ``TestReport`` class to print the unexpected warnings and
+          errors.
+        
+        
+        1.4.3 (2013-02-22)
+        ------------------
+        
+        * Hide the ``--doctest`` and ``--testsuite`` options when installed.
+        
+        * Fix crash with AST checkers when the syntax is invalid. (Issue #160)
+        
+        * Read from standard input if no path is specified.
+        
+        * Initiate a graceful shutdown on ``Control+C``.
+        
+        * Allow to change the ``checker_class`` for the ``StyleGuide``.
+        
+        
+        1.4.2 (2013-02-10)
+        ------------------
+        
+        * Support AST checkers provided by third-party applications.
+        
+        * Register new checkers with ``register_check(func_or_cls, codes)``.
+        
+        * Allow to construct a ``StyleGuide`` with a custom parser.
+        
+        * Accept visual indentation without parenthesis after the ``if``
+          statement. (Issue #151)
+        
+        * Fix UnboundLocalError when using ``# noqa`` with continued lines.
+          (Issue #158)
+        
+        * Re-order the lines for the ``StandardReport``.
+        
+        * Expand tabs when checking E12 continuation lines. (Issue #155)
+        
+        * Refactor the testing class ``TestReport`` and the specific test
+          functions into a separate test module.
+        
+        
+        1.4.1 (2013-01-18)
+        ------------------
+        
+        * Allow sphinx.ext.autodoc syntax for comments. (Issue #110)
+        
+        * Report E703 instead of E702 for the trailing semicolon. (Issue #117)
+        
+        * Honor ``# noqa`` in addition to ``# nopep8``. (Issue #149)
+        
+        * Expose the ``OptionParser`` factory for better extensibility.
+        
+        
+        1.4 (2012-12-22)
+        ----------------
+        
+        * Report E226 instead of E225 for optional whitespace around common
+          operators (``*``, ``**``, ``/``, ``+`` and ``-``).  This new error
+          code is ignored in the default configuration because PEP 8 recommends
+          to "use your own judgement". (Issue #96)
+        
+        * Lines with a ``# nopep8`` at the end will not issue errors on line
+          length E501 or continuation line indentation E12*. (Issue #27)
+        
+        * Fix AssertionError when the source file contains an invalid line
+          ending ``"\r\r\n"``. (Issue #119)
+        
+        * Read the ``[pep8]`` section of ``tox.ini`` or ``setup.cfg`` if present.
+          (Issue #93 and #141)
+        
+        * Add the Sphinx-based documentation, and publish it
+          on http://pep8.readthedocs.org/. (Issue #105)
+        
+        
+        1.3.4 (2012-12-18)
+        ------------------
+        
+        * Fix false positive E124 and E128 with comments. (Issue #100)
+        
+        * Fix error on stdin when running with bpython. (Issue #101)
+        
+        * Fix false positive E401. (Issue #104)
+        
+        * Report E231 for nested dictionary in list. (Issue #142)
+        
+        * Catch E271 at the beginning of the line. (Issue #133)
+        
+        * Fix false positive E126 for multi-line comments. (Issue #138)
+        
+        * Fix false positive E221 when operator is preceded by a comma. (Issue #135)
+        
+        * Fix ``--diff`` failing on one-line hunk. (Issue #137)
+        
+        * Fix the ``--exclude`` switch for directory paths. (Issue #111)
+        
+        * Use ``-`` filename to read from standard input. (Issue #128)
+        
+        
+        1.3.3 (2012-06-27)
+        ------------------
+        
+        * Fix regression with continuation line checker. (Issue #98)
+        
+        
+        1.3.2 (2012-06-26)
+        ------------------
+        
+        * Revert to the previous behaviour for ``--show-pep8``:
+          do not imply ``--first``. (Issue #89)
+        
+        * Add E902 for IO errors. (Issue #87)
+        
+        * Fix false positive for E121, and missed E124. (Issue #92)
+        
+        * Set a sensible default path for config file on Windows. (Issue #95)
+        
+        * Allow ``verbose`` in the configuration file. (Issue #91)
+        
+        * Show the enforced ``max-line-length`` in the error message. (Issue #86)
+        
+        
+        1.3.1 (2012-06-18)
+        ------------------
+        
+        * Explain which configuration options are expected.  Accept and recommend
+          the options names with hyphen instead of underscore. (Issue #82)
+        
+        * Do not read the user configuration when used as a module
+          (except if ``config_file=True`` is passed to the ``StyleGuide`` constructor).
+        
+        * Fix wrong or missing cases for the E12 series.
+        
+        * Fix cases where E122 was missed. (Issue #81)
+        
+        
+        1.3 (2012-06-15)
+        ----------------
+        
+        .. warning::
+           The internal API is backwards incompatible.
+        
+        * Remove global configuration and refactor the library around
+          a ``StyleGuide`` class; add the ability to configure various
+          reporters. (Issue #35 and #66)
+        
+        * Read user configuration from ``~/.config/pep8``
+          and local configuration from ``./.pep8``. (Issue #22)
+        
+        * Fix E502 for backslash embedded in multi-line string. (Issue #68)
+        
+        * Fix E225 for Python 3 iterable unpacking (PEP 3132). (Issue #72)
+        
+        * Enable the new checkers from the E12 series in the default
+          configuration.
+        
+        * Suggest less error-prone alternatives for E712 errors.
+        
+        * Rewrite checkers to run faster (E22, E251, E27).
+        
+        * Fixed a crash when parsed code is invalid (too many
+          closing brackets).
+        
+        * Fix E127 and E128 for continuation line indentation. (Issue #74)
+        
+        * New option ``--format`` to customize the error format. (Issue #23)
+        
+        * New option ``--diff`` to check only modified code.  The unified
+          diff is read from STDIN.  Example: ``hg diff | pep8 --diff``
+          (Issue #39)
+        
+        * Correctly report the count of failures and set the exit code to 1
+          when the ``--doctest`` or the ``--testsuite`` fails.
+        
+        * Correctly detect the encoding in Python 3. (Issue #69)
+        
+        * Drop support for Python 2.3, 2.4 and 3.0. (Issue #78)
+        
+        
+        1.2 (2012-06-01)
+        ----------------
+        
+        * Add E121 through E128 for continuation line indentation.  These
+          checks are disabled by default.  If you want to force all checks,
+          use switch ``--select=E,W``.  Patch by Sam Vilain. (Issue #64)
+        
+        * Add E721 for direct type comparisons. (Issue #47)
+        
+        * Add E711 and E712 for comparisons to singletons. (Issue #46)
+        
+        * Fix spurious E225 and E701 for function annotations. (Issue #29)
+        
+        * Add E502 for explicit line join between brackets.
+        
+        * Fix E901 when printing source with ``--show-source``.
+        
+        * Report all errors for each checker, instead of reporting only the
+          first occurence for each line.
+        
+        * Option ``--show-pep8`` implies ``--first``.
+        
+        
+        1.1 (2012-05-24)
+        ----------------
+        
+        * Add E901 for syntax errors. (Issues #63 and #30)
+        
+        * Add E271, E272, E273 and E274 for extraneous whitespace around
+          keywords. (Issue #57)
+        
+        * Add ``tox.ini`` configuration file for tests. (Issue #61)
+        
+        * Add ``.travis.yml`` configuration file for continuous integration.
+          (Issue #62)
+        
+        
+        1.0.1 (2012-04-06)
+        ------------------
+        
+        * Fix inconsistent version numbers.
+        
+        
+        1.0 (2012-04-04)
+        ----------------
+        
+        * Fix W602 ``raise`` to handle multi-char names. (Issue #53)
+        
+        
+        0.7.0 (2012-03-26)
+        ------------------
+        
+        * Now ``--first`` prints only the first occurence of each error.
+          The ``--repeat`` flag becomes obsolete because it is the default
+          behaviour. (Issue #6)
+        
+        * Allow to specify ``--max-line-length``. (Issue #36)
+        
+        * Make the shebang more flexible. (Issue #26)
+        
+        * Add testsuite to the bundle. (Issue #25)
+        
+        * Fixes for Jython. (Issue #49)
+        
+        * Add PyPI classifiers. (Issue #43)
+        
+        * Fix the ``--exclude`` option. (Issue #48)
+        
+        * Fix W602, accept ``raise`` with 3 arguments. (Issue #34)
+        
+        * Correctly select all tests if ``DEFAULT_IGNORE == ''``.
+        
+        
+        0.6.1 (2010-10-03)
+        ------------------
+        
+        * Fix inconsistent version numbers. (Issue #21)
+        
+        
+        0.6.0 (2010-09-19)
+        ------------------
+        
+        * Test suite reorganized and enhanced in order to check more failures
+          with fewer test files.  Read the ``run_tests`` docstring for details
+          about the syntax.
+        
+        * Fix E225: accept ``print >>sys.stderr, "..."`` syntax.
+        
+        * Fix E501 for lines containing multibyte encoded characters. (Issue #7)
+        
+        * Fix E221, E222, E223, E224 not detected in some cases. (Issue #16)
+        
+        * Fix E211 to reject ``v = dic['a'] ['b']``. (Issue #17)
+        
+        * Exit code is always 1 if any error or warning is found. (Issue #10)
+        
+        * ``--ignore`` checks are now really ignored, especially in
+          conjunction with ``--count``. (Issue #8)
+        
+        * Blank lines with spaces yield W293 instead of W291: some developers
+          want to ignore this warning and indent the blank lines to paste their
+          code easily in the Python interpreter.
+        
+        * Fix E301: do not require a blank line before an indented block. (Issue #14)
+        
+        * Fix E203 to accept NumPy slice notation ``a[0, :]``. (Issue #13)
+        
+        * Performance improvements.
+        
+        * Fix decoding and checking non-UTF8 files in Python 3.
+        
+        * Fix E225: reject ``True+False`` when running on Python 3.
+        
+        * Fix an exception when the line starts with an operator.
+        
+        * Allow a new line before closing ``)``, ``}`` or ``]``. (Issue #5)
+        
+        
+        0.5.0 (2010-02-17)
+        ------------------
+        
+        * Changed the ``--count`` switch to print to sys.stderr and set
+          exit code to 1 if any error or warning is found.
+        
+        * E241 and E242 are removed from the standard checks. If you want to
+          include these checks, use switch ``--select=E,W``. (Issue #4)
+        
+        * Blank line is not mandatory before the first class method or nested
+          function definition, even if there's a docstring. (Issue #1)
+        
+        * Add the switch ``--version``.
+        
+        * Fix decoding errors with Python 3. (Issue #13 [1]_)
+        
+        * Add ``--select`` option which is mirror of ``--ignore``.
+        
+        * Add checks E261 and E262 for spaces before inline comments.
+        
+        * New check W604 warns about deprecated usage of backticks.
+        
+        * New check W603 warns about the deprecated operator ``<>``.
+        
+        * Performance improvement, due to rewriting of E225.
+        
+        * E225 now accepts:
+        
+          - no whitespace after unary operator or similar. (Issue #9 [1]_)
+        
+          - lambda function with argument unpacking or keyword defaults.
+        
+        * Reserve "2 blank lines" for module-level logical blocks. (E303)
+        
+        * Allow multi-line comments. (E302, issue #10 [1]_)
+        
+        
+        0.4.2 (2009-10-22)
+        ------------------
+        
+        * Decorators on classes and class methods are OK now.
+        
+        
+        0.4 (2009-10-20)
+        ----------------
+        
+        * Support for all versions of Python from 2.3 to 3.1.
+        
+        * New and greatly expanded self tests.
+        
+        * Added ``--count`` option to print the total number of errors and warnings.
+        
+        * Further improvements to the handling of comments and blank lines.
+          (Issue #1 [1]_ and others changes.)
+        
+        * Check all py files in directory when passed a directory (Issue
+          #2 [1]_). This also prevents an exception when traversing directories
+          with non ``*.py`` files.
+        
+        * E231 should allow commas to be followed by ``)``. (Issue #3 [1]_)
+        
+        * Spaces are no longer required around the equals sign for keyword
+          arguments or default parameter values.
+        
+        
+        .. [1] These issues refer to the `previous issue tracker`__.
+        .. __:  http://github.com/cburroughs/pep8.py/issues
+        
+        
+        0.3.1 (2009-09-14)
+        ------------------
+        
+        * Fixes for comments: do not count them when checking for blank lines between
+          items.
+        
+        * Added setup.py for pypi upload and easy_installability.
+        
+        
+        0.2 (2007-10-16)
+        ----------------
+        
+        * Loads of fixes and improvements.
+        
+        
+        0.1 (2006-10-01)
+        ----------------
+        
+        * First release.
+        
+Keywords: pep8
+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 :: 3
+Classifier: Topic :: Software Development :: Libraries :: Python Modules
new file mode 100644
--- /dev/null
+++ b/pep8/README.rst
@@ -0,0 +1,87 @@
+pep8 - Python style guide checker
+=================================
+
+pep8 is a tool to check your Python code against some of the style
+conventions in `PEP 8`_.
+
+.. _PEP 8: http://www.python.org/dev/peps/pep-0008/
+
+
+Features
+--------
+
+* Plugin architecture: Adding new checks is easy.
+
+* Parseable output: Jump to error location in your editor.
+
+* Small: Just one Python file, requires only stdlib. You can use just
+  the pep8.py file for this purpose.
+
+* Comes with a comprehensive test suite.
+
+Installation
+------------
+
+You can install, upgrade, uninstall pep8.py with these commands::
+
+  $ pip install pep8
+  $ pip install --upgrade pep8
+  $ pip uninstall pep8
+
+There's also a package for Debian/Ubuntu, but it's not always the
+latest version.
+
+Example usage and output
+------------------------
+
+::
+
+  $ pep8 --first optparse.py
+  optparse.py:69:11: E401 multiple imports on one line
+  optparse.py:77:1: E302 expected 2 blank lines, found 1
+  optparse.py:88:5: E301 expected 1 blank line, found 0
+  optparse.py:222:34: W602 deprecated form of raising exception
+  optparse.py:347:31: E211 whitespace before '('
+  optparse.py:357:17: E201 whitespace after '{'
+  optparse.py:472:29: E221 multiple spaces before operator
+  optparse.py:544:21: W601 .has_key() is deprecated, use 'in'
+
+You can also make pep8.py show the source code for each error, and
+even the relevant text from PEP 8::
+
+  $ pep8 --show-source --show-pep8 testsuite/E40.py
+  testsuite/E40.py:2:10: E401 multiple imports on one line
+  import os, sys
+           ^
+      Imports should usually be on separate lines.
+
+      Okay: import os\nimport sys
+      E401: import sys, os
+
+
+Or you can display how often each error was found::
+
+  $ pep8 --statistics -qq Python-2.5/Lib
+  232     E201 whitespace after '['
+  599     E202 whitespace before ')'
+  631     E203 whitespace before ','
+  842     E211 whitespace before '('
+  2531    E221 multiple spaces before operator
+  4473    E301 expected 1 blank line, found 0
+  4006    E302 expected 2 blank lines, found 1
+  165     E303 too many blank lines (4)
+  325     E401 multiple imports on one line
+  3615    E501 line too long (82 characters)
+  612     W601 .has_key() is deprecated, use 'in'
+  1188    W602 deprecated form of raising exception
+
+Links
+-----
+
+.. image:: https://api.travis-ci.org/jcrocholl/pep8.png?branch=master
+   :target: https://travis-ci.org/jcrocholl/pep8
+   :alt: Build status
+
+* `Read the documentation <http://pep8.readthedocs.org/>`_
+
+* `Fork me on GitHub <http://github.com/jcrocholl/pep8>`_
new file mode 100644
--- /dev/null
+++ b/pep8/docs/Makefile
@@ -0,0 +1,153 @@
+# Makefile for Sphinx documentation
+#
+
+# You can set these variables from the command line.
+SPHINXOPTS    =
+SPHINXBUILD   = sphinx-build
+PAPER         =
+BUILDDIR      = _build
+
+# Internal variables.
+PAPEROPT_a4     = -D latex_paper_size=a4
+PAPEROPT_letter = -D latex_paper_size=letter
+ALLSPHINXOPTS   = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
+# the i18n builder cannot share the environment and doctrees with the others
+I18NSPHINXOPTS  = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
+
+.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext
+
+help:
+	@echo "Please use \`make <target>' where <target> is one of"
+	@echo "  html       to make standalone HTML files"
+	@echo "  dirhtml    to make HTML files named index.html in directories"
+	@echo "  singlehtml to make a single large HTML file"
+	@echo "  pickle     to make pickle files"
+	@echo "  json       to make JSON files"
+	@echo "  htmlhelp   to make HTML files and a HTML help project"
+	@echo "  qthelp     to make HTML files and a qthelp project"
+	@echo "  devhelp    to make HTML files and a Devhelp project"
+	@echo "  epub       to make an epub"
+	@echo "  latex      to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
+	@echo "  latexpdf   to make LaTeX files and run them through pdflatex"
+	@echo "  text       to make text files"
+	@echo "  man        to make manual pages"
+	@echo "  texinfo    to make Texinfo files"
+	@echo "  info       to make Texinfo files and run them through makeinfo"
+	@echo "  gettext    to make PO message catalogs"
+	@echo "  changes    to make an overview of all changed/added/deprecated items"
+	@echo "  linkcheck  to check all external links for integrity"
+	@echo "  doctest    to run all doctests embedded in the documentation (if enabled)"
+
+clean:
+	-rm -rf $(BUILDDIR)/*
+
+html:
+	$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
+	@echo
+	@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
+
+dirhtml:
+	$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
+	@echo
+	@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
+
+singlehtml:
+	$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
+	@echo
+	@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
+
+pickle:
+	$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
+	@echo
+	@echo "Build finished; now you can process the pickle files."
+
+json:
+	$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
+	@echo
+	@echo "Build finished; now you can process the JSON files."
+
+htmlhelp:
+	$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
+	@echo
+	@echo "Build finished; now you can run HTML Help Workshop with the" \
+	      ".hhp project file in $(BUILDDIR)/htmlhelp."
+
+qthelp:
+	$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
+	@echo
+	@echo "Build finished; now you can run "qcollectiongenerator" with the" \
+	      ".qhcp project file in $(BUILDDIR)/qthelp, like this:"
+	@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/pep8.qhcp"
+	@echo "To view the help file:"
+	@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/pep8.qhc"
+
+devhelp:
+	$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
+	@echo
+	@echo "Build finished."
+	@echo "To view the help file:"
+	@echo "# mkdir -p $$HOME/.local/share/devhelp/pep8"
+	@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/pep8"
+	@echo "# devhelp"
+
+epub:
+	$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
+	@echo
+	@echo "Build finished. The epub file is in $(BUILDDIR)/epub."
+
+latex:
+	$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
+	@echo
+	@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
+	@echo "Run \`make' in that directory to run these through (pdf)latex" \
+	      "(use \`make latexpdf' here to do that automatically)."
+
+latexpdf:
+	$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
+	@echo "Running LaTeX files through pdflatex..."
+	$(MAKE) -C $(BUILDDIR)/latex all-pdf
+	@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
+
+text:
+	$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
+	@echo
+	@echo "Build finished. The text files are in $(BUILDDIR)/text."
+
+man:
+	$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
+	@echo
+	@echo "Build finished. The manual pages are in $(BUILDDIR)/man."
+
+texinfo:
+	$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
+	@echo
+	@echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
+	@echo "Run \`make' in that directory to run these through makeinfo" \
+	      "(use \`make info' here to do that automatically)."
+
+info:
+	$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
+	@echo "Running Texinfo files through makeinfo..."
+	make -C $(BUILDDIR)/texinfo info
+	@echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
+
+gettext:
+	$(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
+	@echo
+	@echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
+
+changes:
+	$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
+	@echo
+	@echo "The overview file is in $(BUILDDIR)/changes."
+
+linkcheck:
+	$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
+	@echo
+	@echo "Link check complete; look for any errors in the above output " \
+	      "or in $(BUILDDIR)/linkcheck/output.txt."
+
+doctest:
+	$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
+	@echo "Testing of doctests in the sources finished, look at the " \
+	      "results in $(BUILDDIR)/doctest/output.txt."
new file mode 100644
--- /dev/null
+++ b/pep8/docs/advanced.rst
@@ -0,0 +1,77 @@
+.. currentmodule:: pep8
+
+==============
+Advanced usage
+==============
+
+
+Automated tests
+---------------
+
+You can also execute `pep8` tests from Python code.  For example, this
+can be highly useful for automated testing of coding style conformance
+in your project::
+
+  import unittest
+  import pep8
+
+
+  class TestCodeFormat(unittest.TestCase):
+
+      def test_pep8_conformance(self):
+          """Test that we conform to PEP8."""
+          pep8style = pep8.StyleGuide(quiet=True)
+          result = pep8style.check_files(['file1.py', 'file2.py'])
+          self.assertEqual(result.total_errors, 0,
+                           "Found code style errors (and warnings).")
+
+If you are using `nosetests` for running tests, remove `quiet=True`
+since Nose suppresses stdout.
+
+There's also a shortcut for checking a single file::
+
+  import pep8
+
+  fchecker = pep8.Checker('testsuite/E27.py', show_source=True)
+  file_errors = fchecker.check_all()
+
+  print("Found %s errors (and warnings)" % file_errors)
+
+
+Skip file header
+----------------
+
+Another example is related to the `feature request #143
+<https://github.com/jcrocholl/pep8/issues/143>`_: skip a number of lines
+at the beginning and the end of a file.  This use case is easy to implement
+through a custom wrapper for the PEP 8 library::
+
+  #!python
+  import pep8
+
+  LINES_SLICE = slice(14, -20)
+
+  class PEP8(pep8.StyleGuide):
+      """This subclass of pep8.StyleGuide will skip the first and last lines
+      of each file."""
+
+      def input_file(self, filename, lines=None, expected=None, line_offset=0):
+          if lines is None:
+              assert line_offset == 0
+              line_offset = LINES_SLICE.start or 0
+              lines = pep8.readlines(filename)[LINES_SLICE]
+          return super(PEP8, self).input_file(
+              filename, lines=lines, expected=expected, line_offset=line_offset)
+
+  if __name__ == '__main__':
+      pep8style = PEP8(parse_argv=True, config_file=True)
+      report = pep8style.check_files()
+      if report.total_errors:
+          raise SystemExit(1)
+
+This module declares a lines' window which skips 14 lines at the beginning
+and 20 lines at the end.  If there's no line to skip at the end, it could be
+changed with ``LINES_SLICE = slice(14, None)`` for example.
+
+You can save it in a file and use it with the same options as the
+original ``pep8``.
new file mode 100644
--- /dev/null
+++ b/pep8/docs/api.rst
@@ -0,0 +1,89 @@
+========
+pep8 API
+========
+
+.. module:: pep8
+
+The library provides classes which are usable by third party tools.
+
+.. contents::
+   :local:
+
+
+.. _main_classes:
+
+Checker Classes
+---------------
+
+The :class:`StyleGuide` class is used to configure a style guide checker
+instance to check multiple files.
+
+The :class:`Checker` class can be used to check a single file.
+
+
+.. autoclass:: StyleGuide(parse_argv=False, config_file=None, parser=None, paths=None, report=None, **kwargs)
+
+   .. automethod:: init_report(reporter=None)
+   .. automethod:: check_files(paths=None)
+   .. automethod:: input_file(filename, lines=None, expected=None, line_offset=0)
+   .. automethod:: input_dir(dirname)
+   .. automethod:: excluded(filename, parent=None)
+   .. automethod:: ignore_code(code)
+   .. automethod:: get_checks(argument_name)
+
+.. autoclass:: Checker(filename=None, lines=None, report=None, **kwargs)
+
+   .. automethod:: readline
+   .. automethod:: readline_check_physical
+   .. automethod:: run_check(check, argument_names)
+   .. automethod:: check_physical(line)
+   .. automethod:: build_tokens_line
+   .. automethod:: check_logical
+   .. automethod:: check_ast
+   .. automethod:: generate_tokens
+   .. automethod:: check_all(expected=None, line_offset=0)
+
+
+.. _report_classes:
+
+Report Classes
+--------------
+
+.. autoclass:: BaseReport(options)
+
+   .. automethod:: start
+   .. automethod:: stop
+   .. automethod:: init_file(filename, lines, expected, line_offset)
+   .. automethod:: increment_logical_line
+   .. automethod:: error(line_number, offset, text, check)
+   .. automethod:: get_file_results
+   .. automethod:: get_count(prefix='')
+   .. automethod:: get_statistics(prefix='')
+   .. automethod:: print_statistics(prefix='')
+   .. automethod:: print_benchmark
+
+.. autoclass:: FileReport
+
+.. autoclass:: StandardReport
+
+.. autoclass:: DiffReport
+
+
+Utilities
+---------
+
+.. autofunction:: expand_indent(line)
+.. autofunction:: mute_string(text)
+.. autofunction:: read_config(options, args, arglist, parser)
+.. autofunction:: process_options(arglist=None, parse_argv=False, config_file=None)
+.. autofunction:: register_check(func_or_cls, codes=None)
+
+..
+  These ones are used internally, but they don't need advertising
+  .. autofunction:: readlines(filename)
+  .. autofunction:: isidentifier(word)
+  .. autofunction:: stdin_get_value()
+  .. autofunction:: parse_udiff(diff, patterns=None, parent='.')
+  .. autofunction:: filename_match(filename, patterns, default=True)
+  .. autofunction:: get_parser(prog='pep8', version=pep8.__version__)
+  .. autofunction:: init_checks_registry()
new file mode 100644
--- /dev/null
+++ b/pep8/docs/conf.py
@@ -0,0 +1,250 @@
+# -*- coding: utf-8 -*-
+#
+# pep8 documentation build configuration file, created by
+# sphinx-quickstart on Tue Aug 21 09:47:49 2012.
+#
+# This file is execfile()d with the current directory set to its
+# containing dir.
+#
+# Note that not all possible configuration values are present in this
+# autogenerated file.
+#
+# All configuration values have a default; values that are commented out
+# serve to show the default.
+
+import sys
+import os
+
+# If extensions (or modules to document with autodoc) are in another directory,
+# add these directories to sys.path here. If the directory is relative to the
+# documentation root, use os.path.abspath to make it absolute, like shown here.
+#sys.path.insert(0, os.path.abspath('.'))
+sys.path.insert(0, os.path.abspath('..'))
+
+# -- General configuration ----------------------------------------------------
+
+# If your documentation needs a minimal Sphinx version, state it here.
+#needs_sphinx = '1.0'
+
+# Add any Sphinx extension module names here, as strings. They can be
+# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
+extensions = ['sphinx.ext.autodoc', 'sphinx.ext.doctest',
+              'sphinx.ext.coverage', 'sphinx.ext.viewcode']
+
+# Add any paths that contain templates here, relative to this directory.
+templates_path = ['_templates']
+
+# The suffix of source filenames.
+source_suffix = '.rst'
+
+# The encoding of source files.
+#source_encoding = 'utf-8-sig'
+
+# The master toctree document.
+master_doc = 'index'
+
+# General information about the project.
+project = u'pep8'
+copyright = u'2012-2013, Florent Xicluna'
+
+# The version info for the project you're documenting, acts as replacement for
+# |version| and |release|, also used in various other places throughout the
+# built documents.
+#
+
+pep8_version = __import__('pep8').__version__.split('.')
+# The short X.Y version.
+version = '.'.join(pep8_version[:2])
+# The full version, including alpha/beta/rc tags.
+release = '.'.join(pep8_version)
+
+# The language for content autogenerated by Sphinx. Refer to documentation
+# for a list of supported languages.
+#language = None
+
+# There are two options for replacing |today|: either, you set today to some
+# non-false value, then it is used:
+#today = ''
+# Else, today_fmt is used as the format for a strftime call.
+#today_fmt = '%B %d, %Y'
+
+# List of patterns, relative to source directory, that match files and
+# directories to ignore when looking for source files.
+exclude_patterns = ['_build']
+
+# The reST default role (used for this markup: `text`) to use for
+# all documents.
+#default_role = None
+
+# If true, '()' will be appended to :func: etc. cross-reference text.
+#add_function_parentheses = True
+
+# If true, the current module name will be prepended to all description
+# unit titles (such as .. function::).
+#add_module_names = True
+
+# If true, sectionauthor and moduleauthor directives will be shown in the
+# output. They are ignored by default.
+#show_authors = False
+
+# The name of the Pygments (syntax highlighting) style to use.
+pygments_style = 'sphinx'
+
+# A list of ignored prefixes for module index sorting.
+#modindex_common_prefix = []
+
+
+# -- Options for HTML output --------------------------------------------------
+
+# The theme to use for HTML and HTML Help pages.  See the documentation for
+# a list of builtin themes.
+html_theme = 'default'
+
+# Theme options are theme-specific and customize the look and feel of a theme
+# further.  For a list of options available for each theme, see the
+# documentation.
+#html_theme_options = {}
+
+# Add any paths that contain custom themes here, relative to this directory.
+#html_theme_path = []
+
+# The name for this set of Sphinx documents.  If None, it defaults to
+# "<project> v<release> documentation".
+#html_title = None
+
+# A shorter title for the navigation bar.  Default is the same as html_title.
+#html_short_title = None
+
+# The name of an image file (relative to this directory) to place at the top
+# of the sidebar.
+#html_logo = None
+
+# The name of an image file (within the static path) to use as favicon of the
+# docs.  This file should be a Windows icon file (.ico) being 16x16 or 32x32
+# pixels large.
+#html_favicon = None
+
+# Add any paths that contain custom static files (such as style sheets) here,
+# relative to this directory. They are copied after the builtin static files,
+# so a file named "default.css" will overwrite the builtin "default.css".
+html_static_path = ['_static']
+
+# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
+# using the given strftime format.
+#html_last_updated_fmt = '%b %d, %Y'
+
+# If true, SmartyPants will be used to convert quotes and dashes to
+# typographically correct entities.
+#html_use_smartypants = True
+
+# Custom sidebar templates, maps document names to template names.
+#html_sidebars = {}
+
+# Additional templates that should be rendered to pages, maps page names to
+# template names.
+#html_additional_pages = {}
+
+# If false, no module index is generated.
+#html_domain_indices = True
+
+# If false, no index is generated.
+#html_use_index = True
+
+# If true, the index is split into individual pages for each letter.
+#html_split_index = False
+
+# If true, links to the reST sources are added to the pages.
+#html_show_sourcelink = True
+
+# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
+#html_show_sphinx = True
+
+# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
+#html_show_copyright = True
+
+# If true, an OpenSearch description file will be output, and all pages will
+# contain a <link> tag referring to it.  The value of this option must be the
+# base URL from which the finished HTML is served.
+#html_use_opensearch = ''
+
+# This is the file name suffix for HTML files (e.g. ".xhtml").
+#html_file_suffix = None
+
+# Output file base name for HTML help builder.
+htmlhelp_basename = 'pep8doc'
+
+
+# -- Options for LaTeX output -------------------------------------------------
+
+latex_elements = {
+    # The paper size ('letterpaper' or 'a4paper').
+    #'papersize': 'letterpaper',
+
+    # The font size ('10pt', '11pt' or '12pt').
+    #'pointsize': '10pt',
+
+    # Additional stuff for the LaTeX preamble.
+    #'preamble': '',
+}
+
+# Grouping the document tree into LaTeX files. List of tuples
+# (source start file, target name, title,
+#  author, documentclass [howto/manual]).
+latex_documents = [
+    ('index', 'pep8.tex', u'pep8 documentation',
+     u'Florent Xicluna', 'manual'),
+]
+
+# The name of an image file (relative to this directory) to place at the top of
+# the title page.
+#latex_logo = None
+
+# For "manual" documents, if this is true, then toplevel headings are parts,
+# not chapters.
+#latex_use_parts = False
+
+# If true, show page references after internal links.
+#latex_show_pagerefs = False
+
+# If true, show URL addresses after external links.
+#latex_show_urls = False
+
+# Documents to append as an appendix to all manuals.
+#latex_appendices = []
+
+# If false, no module index is generated.
+#latex_domain_indices = True
+
+
+# -- Options for manual page output -------------------------------------------
+
+# One entry per manual page. List of tuples
+# (source start file, name, description, authors, manual section).
+man_pages = [
+    ('index', 'pep8', u'pep8 documentation',
+     [u'Florent Xicluna'], 1)
+]
+
+# If true, show URL addresses after external links.
+#man_show_urls = False
+
+
+# -- Options for Texinfo output -----------------------------------------------
+
+# Grouping the document tree into Texinfo files. List of tuples
+# (source start file, target name, title, author,
+#  dir menu entry, description, category)
+texinfo_documents = [
+    ('index', 'pep8', u'pep8 documentation', u'Florent Xicluna',
+     'pep8', 'One line description of project.',
+     'Miscellaneous'),
+]
+
+# Documents to append as an appendix to all manuals.
+#texinfo_appendices = []
+
+# If false, no module index is generated.
+#texinfo_domain_indices = True
+
+# How to display URL addresses: 'footnote', 'no', or 'inline'.
+#texinfo_show_urls = 'footnote'
new file mode 100644
--- /dev/null
+++ b/pep8/docs/developer.rst
@@ -0,0 +1,89 @@
+.. currentmodule:: pep8
+
+=================
+Developer's notes
+=================
+
+
+Source code
+~~~~~~~~~~~
+
+The source code is currently `available on GitHub`_ under the terms and
+conditions of the :ref:`Expat license <license>`.  Fork away!
+
+* `Source code <https://github.com/jcrocholl/pep8>`_ and
+  `issue tracker <https://github.com/jcrocholl/pep8/issues>`_ on GitHub.
+* `Continuous tests <http://travis-ci.org/jcrocholl/pep8>`_ against Python
+  2.5 through 3.3 and PyPy, on `Travis-CI platform
+  <http://about.travis-ci.org/>`_.
+
+.. _available on GitHub: https://github.com/jcrocholl/pep8
+
+
+Contribute
+~~~~~~~~~~
+
+You can add checks to this program by writing plugins.  Each plugin is
+a simple function that is called for each line of source code, either
+physical or logical.
+
+Physical line:
+
+* Raw line of text from the input file.
+
+Logical line:
+
+* Multi-line statements converted to a single line.
+* Stripped left and right.
+* Contents of strings replaced with ``"xxx"`` of same length.
+* Comments removed.
+
+The check function requests physical or logical lines by the name of
+the first argument::
+
+  def maximum_line_length(physical_line)
+  def extraneous_whitespace(logical_line)
+  def blank_lines(logical_line, blank_lines, indent_level, line_number)
+
+The last example above demonstrates how check plugins can request
+additional information with extra arguments.  All attributes of the
+:class:`Checker` object are available.  Some examples:
+
+* ``lines``: a list of the raw lines from the input file
+* ``tokens``: the tokens that contribute to this logical line
+* ``line_number``: line number in the input file
+* ``blank_lines``: blank lines before this one
+* ``indent_char``: first indentation character in this file (``" "`` or ``"\t"``)
+* ``indent_level``: indentation (with tabs expanded to multiples of 8)
+* ``previous_indent_level``: indentation on previous line
+* ``previous_logical``: previous logical line
+
+The docstring of each check function shall be the relevant part of
+text from `PEP 8`_.  It is printed if the user enables ``--show-pep8``.
+Several docstrings contain examples directly from the `PEP 8`_ document.
+
+::
+
+  Okay: spam(ham[1], {eggs: 2})
+  E201: spam( ham[1], {eggs: 2})
+
+These examples are verified automatically when pep8.py is run with the
+``--doctest`` option.  You can add examples for your own check functions.
+The format is simple: ``"Okay"`` or error/warning code followed by colon
+and space, the rest of the line is example source code.  If you put ``'r'``
+before the docstring, you can use ``\n`` for newline and ``\t`` for tab.
+
+Then be sure to pass the tests::
+
+  $ python pep8.py --testsuite testsuite
+  $ python pep8.py --doctest
+  $ python pep8.py --verbose pep8.py
+
+.. _PEP 8: http://www.python.org/dev/peps/pep-0008/
+
+
+Changes
+~~~~~~~
+
+.. include:: ../CHANGES.txt
+   :start-line: 3
new file mode 100644
--- /dev/null
+++ b/pep8/docs/index.rst
@@ -0,0 +1,69 @@
+.. pep8 documentation master file
+
+pep8's documentation
+====================
+
+*Python style guide checker*
+
+pep8 is a tool to check your Python code against some of the style
+conventions in `PEP 8`_.
+
+.. _PEP 8: http://www.python.org/dev/peps/pep-0008/
+
+
+Contents:
+
+.. toctree::
+   :maxdepth: 2
+
+   intro
+   advanced
+   API <api>
+   developer
+
+* Online documentation: http://pep8.readthedocs.org/
+* Source code and issue tracker: https://github.com/jcrocholl/pep8
+
+
+Indices and tables
+==================
+
+* :ref:`genindex`
+* :ref:`search`
+
+
+Credits
+=======
+
+Created by Johann C. Rocholl.
+
+Maintained by Florent Xicluna.
+
+
+.. _license:
+
+License
+=======
+
+The ``pep8`` library is provided under the terms and conditions of the
+Expat license::
+
+  # 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.
new file mode 100644
--- /dev/null
+++ b/pep8/docs/intro.rst
@@ -0,0 +1,372 @@
+.. currentmodule:: pep8
+
+Introduction
+============
+
+pep8 is a tool to check your Python code against some of the style
+conventions in `PEP 8`_.
+
+.. contents::
+   :local:
+
+
+Features
+--------
+
+* Plugin architecture: Adding new checks is easy.
+
+* Parseable output: Jump to error location in your editor.
+
+* Small: Just one Python file, requires only stdlib.  You can use just
+  the pep8.py file for this purpose.
+
+* Comes with a comprehensive test suite.
+
+
+Disclaimer
+----------
+
+This utility does not enforce every single rule of PEP 8.  It helps to
+verify that some coding conventions are applied but it does not intend
+to be exhaustive.  Some rules cannot be expressed with a simple algorithm,
+and other rules are only guidelines which you could circumvent when you
+need to.
+
+Always remember this statement from `PEP 8`_:
+
+  *A style guide is about consistency. Consistency with this style guide is
+  important. Consistency within a project is more important. Consistency
+  within one module or function is most important.*
+
+
+Among other things, these features are currently not in the scope of
+the ``pep8`` library:
+
+* **naming conventions**: this kind of feature is supported through plugins.
+  Install `flake8 <https://pypi.python.org/pypi/flake8>`_ and the
+  `pep8-naming extension <https://pypi.python.org/pypi/pep8-naming>`_ to use
+  this feature.
+* **docstring conventions**: they are not in the scope of this library;
+  see the `pep257 project <https://github.com/GreenSteam/pep257>`_.
+* **automatic fixing**: see the section *PEP8 Fixers* in the
+  :ref:`related tools <related-tools>` page.
+
+
+Installation
+------------
+
+You can install, upgrade, uninstall pep8.py with these commands::
+
+  $ pip install pep8
+  $ pip install --upgrade pep8
+  $ pip uninstall pep8
+
+There's also a package for Debian/Ubuntu, but it's not always the
+latest version::
+
+  $ sudo apt-get install pep8
+
+
+Example usage and output
+------------------------
+
+::
+
+  $ pep8 --first optparse.py
+  optparse.py:69:11: E401 multiple imports on one line
+  optparse.py:77:1: E302 expected 2 blank lines, found 1
+  optparse.py:88:5: E301 expected 1 blank line, found 0
+  optparse.py:222:34: W602 deprecated form of raising exception
+  optparse.py:347:31: E211 whitespace before '('
+  optparse.py:357:17: E201 whitespace after '{'
+  optparse.py:472:29: E221 multiple spaces before operator
+  optparse.py:544:21: W601 .has_key() is deprecated, use 'in'
+
+You can also make pep8.py show the source code for each error, and
+even the relevant text from PEP 8::
+
+  $ pep8 --show-source --show-pep8 testsuite/E40.py
+  testsuite/E40.py:2:10: E401 multiple imports on one line
+  import os, sys
+           ^
+      Imports should usually be on separate lines.
+
+      Okay: import os\nimport sys
+      E401: import sys, os
+
+
+Or you can display how often each error was found::
+
+  $ pep8 --statistics -qq Python-2.5/Lib
+  232     E201 whitespace after '['
+  599     E202 whitespace before ')'
+  631     E203 whitespace before ','
+  842     E211 whitespace before '('
+  2531    E221 multiple spaces before operator
+  4473    E301 expected 1 blank line, found 0
+  4006    E302 expected 2 blank lines, found 1
+  165     E303 too many blank lines (4)
+  325     E401 multiple imports on one line
+  3615    E501 line too long (82 characters)
+  612     W601 .has_key() is deprecated, use 'in'
+  1188    W602 deprecated form of raising exception
+
+Quick help is available on the command line::
+
+  $ pep8 -h
+  Usage: pep8 [options] input ...
+
+  Options:
+    --version            show program's version number and exit
+    -h, --help           show this help message and exit
+    -v, --verbose        print status messages, or debug with -vv
+    -q, --quiet          report only file names, or nothing with -qq
+    --first              show first occurrence of each error
+    --exclude=patterns   exclude files or directories which match these comma
+                         separated patterns (default: .svn,CVS,.bzr,.hg,.git)
+    --filename=patterns  when parsing directories, only check filenames matching
+                         these comma separated patterns (default: *.py)
+    --select=errors      select errors and warnings (e.g. E,W6)
+    --ignore=errors      skip errors and warnings (e.g. E4,W)
+    --show-source        show source code for each error
+    --show-pep8          show text of PEP 8 for each error (implies --first)
+    --statistics         count errors and warnings
+    --count              print total number of errors and warnings to standard
+                         error and set exit code to 1 if total is not null
+    --max-line-length=n  set maximum allowed line length (default: 79)
+    --hang-closing       hang closing bracket instead of matching indentation of
+                         opening bracket's line
+    --format=format      set the error format [default|pylint|<custom>]
+    --diff               report only lines changed according to the unified diff
+                         received on STDIN
+
+    Testing Options:
+      --benchmark        measure processing speed
+
+    Configuration:
+      The project options are read from the [pep8] section of the tox.ini
+      file or the setup.cfg file located in any parent folder of the path(s)
+      being processed.  Allowed options are: exclude, filename, select,
+      ignore, max-line-length, hang-closing, count, format, quiet, show-pep8,
+      show-source, statistics, verbose.
+
+      --config=path      user config file location (default: ~/.config/pep8)
+
+
+Configuration
+-------------
+
+The behaviour may be configured at two levels.
+
+The user settings are read from the ``~/.config/pep8`` file.
+Example::
+
+  [pep8]
+  ignore = E226,E302,E41
+  max-line-length = 160
+
+At the project level, a ``tox.ini`` file or a ``setup.cfg`` file is read if
+present (``.pep8`` file is also supported, but it is deprecated).  If none of
+these files have a ``[pep8]`` section, no project specific configuration is
+loaded.
+
+If the ``ignore`` option is not in the configuration and not in the arguments,
+only the error codes ``E226`` and ``E241/E242`` are ignored (see below).
+
+
+Error codes
+-----------
+
+This is the current list of error and warning codes:
+
++----------+----------------------------------------------------------------------+
+| code     | sample message                                                       |
++==========+======================================================================+
+| **E1**   | *Indentation*                                                        |
++----------+----------------------------------------------------------------------+
+| E101     | indentation contains mixed spaces and tabs                           |
++----------+----------------------------------------------------------------------+
+| E111     | indentation is not a multiple of four                                |
++----------+----------------------------------------------------------------------+
+| E112     | expected an indented block                                           |
++----------+----------------------------------------------------------------------+
+| E113     | unexpected indentation                                               |
++----------+----------------------------------------------------------------------+
++----------+----------------------------------------------------------------------+
+| E121 (^) | continuation line indentation is not a multiple of four              |
++----------+----------------------------------------------------------------------+
+| E122 (^) | continuation line missing indentation or outdented                   |
++----------+----------------------------------------------------------------------+
+| E123 (*) | closing bracket does not match indentation of opening bracket's line |
++----------+----------------------------------------------------------------------+
+| E124 (^) | closing bracket does not match visual indentation                    |
++----------+----------------------------------------------------------------------+
+| E125 (^) | continuation line does not distinguish itself from next logical line |
++----------+----------------------------------------------------------------------+
+| E126 (^) | continuation line over-indented for hanging indent                   |
++----------+----------------------------------------------------------------------+
+| E127 (^) | continuation line over-indented for visual indent                    |
++----------+----------------------------------------------------------------------+
+| E128 (^) | continuation line under-indented for visual indent                   |
++----------+----------------------------------------------------------------------+
+| E133 (*) | closing bracket is missing indentation                               |
++----------+----------------------------------------------------------------------+
++----------+----------------------------------------------------------------------+
+| **E2**   | *Whitespace*                                                         |
++----------+----------------------------------------------------------------------+
+| E201     | whitespace after '('                                                 |
++----------+----------------------------------------------------------------------+
+| E202     | whitespace before ')'                                                |
++----------+----------------------------------------------------------------------+
+| E203     | whitespace before ':'                                                |
++----------+----------------------------------------------------------------------+
++----------+----------------------------------------------------------------------+
+| E211     | whitespace before '('                                                |
++----------+----------------------------------------------------------------------+
++----------+----------------------------------------------------------------------+
+| E221     | multiple spaces before operator                                      |
++----------+----------------------------------------------------------------------+
+| E222     | multiple spaces after operator                                       |
++----------+----------------------------------------------------------------------+
+| E223     | tab before operator                                                  |
++----------+----------------------------------------------------------------------+
+| E224     | tab after operator                                                   |
++----------+----------------------------------------------------------------------+
+| E225     | missing whitespace around operator                                   |
++----------+----------------------------------------------------------------------+
+| E226 (*) | missing whitespace around arithmetic operator                        |
++----------+----------------------------------------------------------------------+
+| E227     | missing whitespace around bitwise or shift operator                  |
++----------+----------------------------------------------------------------------+
+| E228     | missing whitespace around modulo operator                            |
++----------+----------------------------------------------------------------------+
++----------+----------------------------------------------------------------------+
+| E231     | missing whitespace after ','                                         |
++----------+----------------------------------------------------------------------+
++----------+----------------------------------------------------------------------+
+| E241 (*) | multiple spaces after ','                                            |
++----------+----------------------------------------------------------------------+
+| E242 (*) | tab after ','                                                        |
++----------+----------------------------------------------------------------------+
++----------+----------------------------------------------------------------------+
+| E251     | unexpected spaces around keyword / parameter equals                  |
++----------+----------------------------------------------------------------------+
++----------+----------------------------------------------------------------------+
+| E261     | at least two spaces before inline comment                            |
++----------+----------------------------------------------------------------------+
+| E262     | inline comment should start with '# '                                |
++----------+----------------------------------------------------------------------+
++----------+----------------------------------------------------------------------+
+| E271     | multiple spaces after keyword                                        |
++----------+----------------------------------------------------------------------+
+| E272     | multiple spaces before keyword                                       |
++----------+----------------------------------------------------------------------+
+| E273     | tab after keyword                                                    |
++----------+----------------------------------------------------------------------+
+| E274     | tab before keyword                                                   |
++----------+----------------------------------------------------------------------+
++----------+----------------------------------------------------------------------+
+| **E3**   | *Blank line*                                                         |
++----------+----------------------------------------------------------------------+
+| E301     | expected 1 blank line, found 0                                       |
++----------+----------------------------------------------------------------------+
+| E302     | expected 2 blank lines, found 0                                      |
++----------+----------------------------------------------------------------------+
+| E303     | too many blank lines (3)                                             |
++----------+----------------------------------------------------------------------+
+| E304     | blank lines found after function decorator                           |
++----------+----------------------------------------------------------------------+
++----------+----------------------------------------------------------------------+
+| **E4**   | *Import*                                                             |
++----------+----------------------------------------------------------------------+
+| E401     | multiple imports on one line                                         |
++----------+----------------------------------------------------------------------+
++----------+----------------------------------------------------------------------+
+| **E5**   | *Line length*                                                        |
++----------+----------------------------------------------------------------------+
+| E501 (^) | line too long (82 > 79 characters)                                   |
++----------+----------------------------------------------------------------------+
+| E502     | the backslash is redundant between brackets                          |
++----------+----------------------------------------------------------------------+
++----------+----------------------------------------------------------------------+
+| **E7**   | *Statement*                                                          |
++----------+----------------------------------------------------------------------+
+| E701     | multiple statements on one line (colon)                              |
++----------+----------------------------------------------------------------------+
+| E702     | multiple statements on one line (semicolon)                          |
++----------+----------------------------------------------------------------------+
+| E703     | statement ends with a semicolon                                      |
++----------+----------------------------------------------------------------------+
+| E711 (^) | comparison to None should be 'if cond is None:'                      |
++----------+----------------------------------------------------------------------+
+| E712 (^) | comparison to True should be 'if cond is True:' or 'if cond:'        |
++----------+----------------------------------------------------------------------+
+| E721     | do not compare types, use 'isinstance()'                             |
++----------+----------------------------------------------------------------------+
++----------+----------------------------------------------------------------------+
+| **E9**   | *Runtime*                                                            |
++----------+----------------------------------------------------------------------+
+| E901     | SyntaxError or IndentationError                                      |
++----------+----------------------------------------------------------------------+
+| E902     | IOError                                                              |
++----------+----------------------------------------------------------------------+
++----------+----------------------------------------------------------------------+
+| **W1**   | *Indentation warning*                                                |
++----------+----------------------------------------------------------------------+
+| W191     | indentation contains tabs                                            |
++----------+----------------------------------------------------------------------+
++----------+----------------------------------------------------------------------+
+| **W2**   | *Whitespace warning*                                                 |
++----------+----------------------------------------------------------------------+
+| W291     | trailing whitespace                                                  |
++----------+----------------------------------------------------------------------+
+| W292     | no newline at end of file                                            |
++----------+----------------------------------------------------------------------+
+| W293     | blank line contains whitespace                                       |
++----------+----------------------------------------------------------------------+
++----------+----------------------------------------------------------------------+
+| **W3**   | *Blank line warning*                                                 |
++----------+----------------------------------------------------------------------+
+| W391     | blank line at end of file                                            |
++----------+----------------------------------------------------------------------+
++----------+----------------------------------------------------------------------+
+| **W6**   | *Deprecation warning*                                                |
++----------+----------------------------------------------------------------------+
+| W601     | .has_key() is deprecated, use 'in'                                   |
++----------+----------------------------------------------------------------------+
+| W602     | deprecated form of raising exception                                 |
++----------+----------------------------------------------------------------------+
+| W603     | '<>' is deprecated, use '!='                                         |
++----------+----------------------------------------------------------------------+
+| W604     | backticks are deprecated, use 'repr()'                               |
++----------+----------------------------------------------------------------------+
+
+**(*)** In the default configuration, the checks **E123**, **E133**, **E226**,
+**E241** and **E242** are ignored because they are not rules unanimously
+accepted, and `PEP 8`_ does not enforce them.  The check **E133** is mutually
+exclusive with check **E123**.  Use switch ``--hang-closing`` to report **E133**
+instead of **E123**.
+
+**(^)** These checks can be disabled at the line level using the ``# noqa``
+special comment.  This possibility should be reserved for special cases.
+
+  *Special cases aren't special enough to break the rules.*
+
+
+Note: most errors can be listed with such one-liner::
+
+  $ python pep8.py --first --select E,W testsuite/ --format '%(code)s: %(text)s'
+
+
+.. _related-tools:
+
+Related tools
+-------------
+
+The `flake8 checker <https://flake8.readthedocs.org>`_ is a wrapper around
+``pep8`` and similar tools. It supports plugins.
+
+Other tools which use ``pep8`` are referenced in the Wiki: `list of related tools
+<https://github.com/jcrocholl/pep8/wiki/RelatedTools>`_.
+
+.. _PEP 8: http://www.python.org/dev/peps/pep-0008/
new file mode 100644
--- /dev/null
+++ b/pep8/docs/make.bat
@@ -0,0 +1,190 @@
+@ECHO OFF
+
+REM Command file for Sphinx documentation
+
+if "%SPHINXBUILD%" == "" (
+	set SPHINXBUILD=sphinx-build
+)
+set BUILDDIR=_build
+set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% .
+set I18NSPHINXOPTS=%SPHINXOPTS% .
+if NOT "%PAPER%" == "" (
+	set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS%
+	set I18NSPHINXOPTS=-D latex_paper_size=%PAPER% %I18NSPHINXOPTS%
+)
+
+if "%1" == "" goto help
+
+if "%1" == "help" (
+	:help
+	echo.Please use `make ^<target^>` where ^<target^> is one of
+	echo.  html       to make standalone HTML files
+	echo.  dirhtml    to make HTML files named index.html in directories
+	echo.  singlehtml to make a single large HTML file
+	echo.  pickle     to make pickle files
+	echo.  json       to make JSON files
+	echo.  htmlhelp   to make HTML files and a HTML help project
+	echo.  qthelp     to make HTML files and a qthelp project
+	echo.  devhelp    to make HTML files and a Devhelp project
+	echo.  epub       to make an epub
+	echo.  latex      to make LaTeX files, you can set PAPER=a4 or PAPER=letter
+	echo.  text       to make text files
+	echo.  man        to make manual pages
+	echo.  texinfo    to make Texinfo files
+	echo.  gettext    to make PO message catalogs
+	echo.  changes    to make an overview over all changed/added/deprecated items
+	echo.  linkcheck  to check all external links for integrity
+	echo.  doctest    to run all doctests embedded in the documentation if enabled
+	goto end
+)
+
+if "%1" == "clean" (
+	for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i
+	del /q /s %BUILDDIR%\*
+	goto end
+)
+
+if "%1" == "html" (
+	%SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html
+	if errorlevel 1 exit /b 1
+	echo.
+	echo.Build finished. The HTML pages are in %BUILDDIR%/html.
+	goto end
+)
+
+if "%1" == "dirhtml" (
+	%SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml
+	if errorlevel 1 exit /b 1
+	echo.
+	echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml.
+	goto end
+)
+
+if "%1" == "singlehtml" (
+	%SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml
+	if errorlevel 1 exit /b 1
+	echo.
+	echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml.
+	goto end
+)
+
+if "%1" == "pickle" (
+	%SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle
+	if errorlevel 1 exit /b 1
+	echo.
+	echo.Build finished; now you can process the pickle files.
+	goto end
+)
+
+if "%1" == "json" (
+	%SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json
+	if errorlevel 1 exit /b 1
+	echo.
+	echo.Build finished; now you can process the JSON files.
+	goto end
+)
+
+if "%1" == "htmlhelp" (
+	%SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp
+	if errorlevel 1 exit /b 1
+	echo.
+	echo.Build finished; now you can run HTML Help Workshop with the ^
+.hhp project file in %BUILDDIR%/htmlhelp.
+	goto end
+)
+
+if "%1" == "qthelp" (
+	%SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp
+	if errorlevel 1 exit /b 1
+	echo.
+	echo.Build finished; now you can run "qcollectiongenerator" with the ^
+.qhcp project file in %BUILDDIR%/qthelp, like this:
+	echo.^> qcollectiongenerator %BUILDDIR%\qthelp\pep8.qhcp
+	echo.To view the help file:
+	echo.^> assistant -collectionFile %BUILDDIR%\qthelp\pep8.ghc
+	goto end
+)
+
+if "%1" == "devhelp" (
+	%SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp
+	if errorlevel 1 exit /b 1
+	echo.
+	echo.Build finished.
+	goto end
+)
+
+if "%1" == "epub" (
+	%SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub
+	if errorlevel 1 exit /b 1
+	echo.
+	echo.Build finished. The epub file is in %BUILDDIR%/epub.
+	goto end
+)
+
+if "%1" == "latex" (
+	%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
+	if errorlevel 1 exit /b 1
+	echo.
+	echo.Build finished; the LaTeX files are in %BUILDDIR%/latex.
+	goto end
+)
+
+if "%1" == "text" (
+	%SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text
+	if errorlevel 1 exit /b 1
+	echo.
+	echo.Build finished. The text files are in %BUILDDIR%/text.
+	goto end
+)
+
+if "%1" == "man" (
+	%SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man
+	if errorlevel 1 exit /b 1
+	echo.
+	echo.Build finished. The manual pages are in %BUILDDIR%/man.
+	goto end
+)
+
+if "%1" == "texinfo" (
+	%SPHINXBUILD% -b texinfo %ALLSPHINXOPTS% %BUILDDIR%/texinfo
+	if errorlevel 1 exit /b 1
+	echo.
+	echo.Build finished. The Texinfo files are in %BUILDDIR%/texinfo.
+	goto end
+)
+
+if "%1" == "gettext" (
+	%SPHINXBUILD% -b gettext %I18NSPHINXOPTS% %BUILDDIR%/locale
+	if errorlevel 1 exit /b 1
+	echo.
+	echo.Build finished. The message catalogs are in %BUILDDIR%/locale.
+	goto end
+)
+
+if "%1" == "changes" (
+	%SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes
+	if errorlevel 1 exit /b 1
+	echo.
+	echo.The overview file is in %BUILDDIR%/changes.
+	goto end
+)
+
+if "%1" == "linkcheck" (
+	%SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck
+	if errorlevel 1 exit /b 1
+	echo.
+	echo.Link check complete; look for any errors in the above output ^
+or in %BUILDDIR%/linkcheck/output.txt.
+	goto end
+)
+
+if "%1" == "doctest" (
+	%SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest
+	if errorlevel 1 exit /b 1
+	echo.
+	echo.Testing of doctests in the sources finished, look at the ^
+results in %BUILDDIR%/doctest/output.txt.
+	goto end
+)
+
+:end
new file mode 100644
--- /dev/null
+++ b/pep8/pep8.egg-info/PKG-INFO
@@ -0,0 +1,569 @@
+Metadata-Version: 1.1
+Name: pep8
+Version: 1.4.6
+Summary: Python style guide checker
+Home-page: http://pep8.readthedocs.org/
+Author: Johann C. Rocholl
+Author-email: johann@rocholl.net
+License: Expat license
+Description: pep8 - Python style guide checker
+        =================================
+        
+        pep8 is a tool to check your Python code against some of the style
+        conventions in `PEP 8`_.
+        
+        .. _PEP 8: http://www.python.org/dev/peps/pep-0008/
+        
+        
+        Features
+        --------
+        
+        * Plugin architecture: Adding new checks is easy.
+        
+        * Parseable output: Jump to error location in your editor.
+        
+        * Small: Just one Python file, requires only stdlib. You can use just
+          the pep8.py file for this purpose.
+        
+        * Comes with a comprehensive test suite.
+        
+        Installation
+        ------------
+        
+        You can install, upgrade, uninstall pep8.py with these commands::
+        
+          $ pip install pep8
+          $ pip install --upgrade pep8
+          $ pip uninstall pep8
+        
+        There's also a package for Debian/Ubuntu, but it's not always the
+        latest version.
+        
+        Example usage and output
+        ------------------------
+        
+        ::
+        
+          $ pep8 --first optparse.py
+          optparse.py:69:11: E401 multiple imports on one line
+          optparse.py:77:1: E302 expected 2 blank lines, found 1
+          optparse.py:88:5: E301 expected 1 blank line, found 0
+          optparse.py:222:34: W602 deprecated form of raising exception
+          optparse.py:347:31: E211 whitespace before '('
+          optparse.py:357:17: E201 whitespace after '{'
+          optparse.py:472:29: E221 multiple spaces before operator
+          optparse.py:544:21: W601 .has_key() is deprecated, use 'in'
+        
+        You can also make pep8.py show the source code for each error, and
+        even the relevant text from PEP 8::
+        
+          $ pep8 --show-source --show-pep8 testsuite/E40.py
+          testsuite/E40.py:2:10: E401 multiple imports on one line
+          import os, sys
+                   ^
+              Imports should usually be on separate lines.
+        
+              Okay: import os\nimport sys
+              E401: import sys, os
+        
+        
+        Or you can display how often each error was found::
+        
+          $ pep8 --statistics -qq Python-2.5/Lib
+          232     E201 whitespace after '['
+          599     E202 whitespace before ')'
+          631     E203 whitespace before ','
+          842     E211 whitespace before '('
+          2531    E221 multiple spaces before operator
+          4473    E301 expected 1 blank line, found 0
+          4006    E302 expected 2 blank lines, found 1
+          165     E303 too many blank lines (4)
+          325     E401 multiple imports on one line
+          3615    E501 line too long (82 characters)
+          612     W601 .has_key() is deprecated, use 'in'
+          1188    W602 deprecated form of raising exception
+        
+        Links
+        -----
+        
+        .. image:: https://api.travis-ci.org/jcrocholl/pep8.png?branch=master
+           :target: https://travis-ci.org/jcrocholl/pep8
+           :alt: Build status
+        
+        * `Read the documentation <http://pep8.readthedocs.org/>`_
+        
+        * `Fork me on GitHub <http://github.com/jcrocholl/pep8>`_
+        
+        
+        Changelog
+        =========
+        
+        
+        1.4.6 (2013-07-02)
+        ------------------
+        
+        * Honor ``# noqa`` for errors E711 and E712. (Issue #180)
+        
+        * When both a ``tox.ini`` and a ``setup.cfg`` are present in the project
+          directory, merge their contents.  The ``tox.ini`` file takes
+          precedence (same as before). (Issue #182)
+        
+        * Give priority to ``--select`` over ``--ignore``. (Issue #188)
+        
+        * Compare full path when excluding a file. (Issue #186)
+        
+        * Correctly report other E12 errors when E123 is ignored. (Issue #103)
+        
+        * New option ``--hang-closing`` to switch to the alternative style of
+          closing bracket indentation for hanging indent.  Add error E133 for
+          closing bracket which is missing indentation. (Issue #103)
+        
+        * Accept both styles of closing bracket indentation for hanging indent.
+          Do not report error E123 in the default configuration. (Issue #103)
+        
+        * Do not crash when running AST checks and the document contains null bytes.
+          (Issue #184)
+        
+        * Fix false positive E261/E262 when the file contains a BOM. (Issue #193)
+        
+        * Fix E701, E702 and E703 not detected sometimes. (Issue #196)
+        
+        * Fix E122 not detected in some cases. (Issue #201 and #208)
+        
+        * Fix false positive E121 with multiple brackets. (Issue #203)
+        
+        
+        1.4.5 (2013-03-06)
+        ------------------
+        
+        * When no path is specified, do not try to read from stdin.  The feature
+          was added in 1.4.3, but it is not supported on Windows.  Use ``-``
+          filename argument to read from stdin.  This usage is supported
+          since 1.3.4. (Issue #170)
+        
+        * Do not require ``setuptools`` in setup.py.  It works around an issue
+          with ``pip`` and Python 3. (Issue #172)
+        
+        * Add ``__pycache__`` to the ignore list.
+        
+        * Change misleading message for E251. (Issue #171)
+        
+        * Do not report false E302 when the source file has a coding cookie or a
+          comment on the first line. (Issue #174)
+        
+        * Reorganize the tests and add tests for the API and for the command line
+          usage and options. (Issues #161 and #162)
+        
+        * Ignore all checks which are not explicitly selected when ``select`` is
+          passed to the ``StyleGuide`` constructor.
+        
+        
+        1.4.4 (2013-02-24)
+        ------------------
+        
+        * Report E227 or E228 instead of E225 for whitespace around bitwise, shift
+          or modulo operators. (Issue #166)
+        
+        * Change the message for E226 to make clear that it is about arithmetic
+          operators.
+        
+        * Fix a false positive E128 for continuation line indentation with tabs.
+        
+        * Fix regression with the ``--diff`` option. (Issue #169)
+        
+        * Fix the ``TestReport`` class to print the unexpected warnings and
+          errors.
+        
+        
+        1.4.3 (2013-02-22)
+        ------------------
+        
+        * Hide the ``--doctest`` and ``--testsuite`` options when installed.
+        
+        * Fix crash with AST checkers when the syntax is invalid. (Issue #160)
+        
+        * Read from standard input if no path is specified.
+        
+        * Initiate a graceful shutdown on ``Control+C``.
+        
+        * Allow to change the ``checker_class`` for the ``StyleGuide``.
+        
+        
+        1.4.2 (2013-02-10)
+        ------------------
+        
+        * Support AST checkers provided by third-party applications.
+        
+        * Register new checkers with ``register_check(func_or_cls, codes)``.
+        
+        * Allow to construct a ``StyleGuide`` with a custom parser.
+        
+        * Accept visual indentation without parenthesis after the ``if``
+          statement. (Issue #151)
+        
+        * Fix UnboundLocalError when using ``# noqa`` with continued lines.
+          (Issue #158)
+        
+        * Re-order the lines for the ``StandardReport``.
+        
+        * Expand tabs when checking E12 continuation lines. (Issue #155)
+        
+        * Refactor the testing class ``TestReport`` and the specific test
+          functions into a separate test module.
+        
+        
+        1.4.1 (2013-01-18)
+        ------------------
+        
+        * Allow sphinx.ext.autodoc syntax for comments. (Issue #110)
+        
+        * Report E703 instead of E702 for the trailing semicolon. (Issue #117)
+        
+        * Honor ``# noqa`` in addition to ``# nopep8``. (Issue #149)
+        
+        * Expose the ``OptionParser`` factory for better extensibility.
+        
+        
+        1.4 (2012-12-22)
+        ----------------
+        
+        * Report E226 instead of E225 for optional whitespace around common
+          operators (``*``, ``**``, ``/``, ``+`` and ``-``).  This new error
+          code is ignored in the default configuration because PEP 8 recommends
+          to "use your own judgement". (Issue #96)
+        
+        * Lines with a ``# nopep8`` at the end will not issue errors on line
+          length E501 or continuation line indentation E12*. (Issue #27)
+        
+        * Fix AssertionError when the source file contains an invalid line
+          ending ``"\r\r\n"``. (Issue #119)
+        
+        * Read the ``[pep8]`` section of ``tox.ini`` or ``setup.cfg`` if present.
+          (Issue #93 and #141)
+        
+        * Add the Sphinx-based documentation, and publish it
+          on http://pep8.readthedocs.org/. (Issue #105)
+        
+        
+        1.3.4 (2012-12-18)
+        ------------------
+        
+        * Fix false positive E124 and E128 with comments. (Issue #100)
+        
+        * Fix error on stdin when running with bpython. (Issue #101)
+        
+        * Fix false positive E401. (Issue #104)
+        
+        * Report E231 for nested dictionary in list. (Issue #142)
+        
+        * Catch E271 at the beginning of the line. (Issue #133)
+        
+        * Fix false positive E126 for multi-line comments. (Issue #138)
+        
+        * Fix false positive E221 when operator is preceded by a comma. (Issue #135)
+        
+        * Fix ``--diff`` failing on one-line hunk. (Issue #137)
+        
+        * Fix the ``--exclude`` switch for directory paths. (Issue #111)
+        
+        * Use ``-`` filename to read from standard input. (Issue #128)
+        
+        
+        1.3.3 (2012-06-27)
+        ------------------
+        
+        * Fix regression with continuation line checker. (Issue #98)
+        
+        
+        1.3.2 (2012-06-26)
+        ------------------
+        
+        * Revert to the previous behaviour for ``--show-pep8``:
+          do not imply ``--first``. (Issue #89)
+        
+        * Add E902 for IO errors. (Issue #87)
+        
+        * Fix false positive for E121, and missed E124. (Issue #92)
+        
+        * Set a sensible default path for config file on Windows. (Issue #95)
+        
+        * Allow ``verbose`` in the configuration file. (Issue #91)
+        
+        * Show the enforced ``max-line-length`` in the error message. (Issue #86)
+        
+        
+        1.3.1 (2012-06-18)
+        ------------------
+        
+        * Explain which configuration options are expected.  Accept and recommend
+          the options names with hyphen instead of underscore. (Issue #82)
+        
+        * Do not read the user configuration when used as a module
+          (except if ``config_file=True`` is passed to the ``StyleGuide`` constructor).
+        
+        * Fix wrong or missing cases for the E12 series.
+        
+        * Fix cases where E122 was missed. (Issue #81)
+        
+        
+        1.3 (2012-06-15)
+        ----------------
+        
+        .. warning::
+           The internal API is backwards incompatible.
+        
+        * Remove global configuration and refactor the library around
+          a ``StyleGuide`` class; add the ability to configure various
+          reporters. (Issue #35 and #66)
+        
+        * Read user configuration from ``~/.config/pep8``
+          and local configuration from ``./.pep8``. (Issue #22)
+        
+        * Fix E502 for backslash embedded in multi-line string. (Issue #68)
+        
+        * Fix E225 for Python 3 iterable unpacking (PEP 3132). (Issue #72)
+        
+        * Enable the new checkers from the E12 series in the default
+          configuration.
+        
+        * Suggest less error-prone alternatives for E712 errors.
+        
+        * Rewrite checkers to run faster (E22, E251, E27).
+        
+        * Fixed a crash when parsed code is invalid (too many
+          closing brackets).
+        
+        * Fix E127 and E128 for continuation line indentation. (Issue #74)
+        
+        * New option ``--format`` to customize the error format. (Issue #23)
+        
+        * New option ``--diff`` to check only modified code.  The unified
+          diff is read from STDIN.  Example: ``hg diff | pep8 --diff``
+          (Issue #39)
+        
+        * Correctly report the count of failures and set the exit code to 1
+          when the ``--doctest`` or the ``--testsuite`` fails.
+        
+        * Correctly detect the encoding in Python 3. (Issue #69)
+        
+        * Drop support for Python 2.3, 2.4 and 3.0. (Issue #78)
+        
+        
+        1.2 (2012-06-01)
+        ----------------
+        
+        * Add E121 through E128 for continuation line indentation.  These
+          checks are disabled by default.  If you want to force all checks,
+          use switch ``--select=E,W``.  Patch by Sam Vilain. (Issue #64)
+        
+        * Add E721 for direct type comparisons. (Issue #47)
+        
+        * Add E711 and E712 for comparisons to singletons. (Issue #46)
+        
+        * Fix spurious E225 and E701 for function annotations. (Issue #29)
+        
+        * Add E502 for explicit line join between brackets.
+        
+        * Fix E901 when printing source with ``--show-source``.
+        
+        * Report all errors for each checker, instead of reporting only the
+          first occurence for each line.
+        
+        * Option ``--show-pep8`` implies ``--first``.
+        
+        
+        1.1 (2012-05-24)
+        ----------------
+        
+        * Add E901 for syntax errors. (Issues #63 and #30)
+        
+        * Add E271, E272, E273 and E274 for extraneous whitespace around
+          keywords. (Issue #57)
+        
+        * Add ``tox.ini`` configuration file for tests. (Issue #61)
+        
+        * Add ``.travis.yml`` configuration file for continuous integration.
+          (Issue #62)
+        
+        
+        1.0.1 (2012-04-06)
+        ------------------
+        
+        * Fix inconsistent version numbers.
+        
+        
+        1.0 (2012-04-04)
+        ----------------
+        
+        * Fix W602 ``raise`` to handle multi-char names. (Issue #53)
+        
+        
+        0.7.0 (2012-03-26)
+        ------------------
+        
+        * Now ``--first`` prints only the first occurence of each error.
+          The ``--repeat`` flag becomes obsolete because it is the default
+          behaviour. (Issue #6)
+        
+        * Allow to specify ``--max-line-length``. (Issue #36)
+        
+        * Make the shebang more flexible. (Issue #26)
+        
+        * Add testsuite to the bundle. (Issue #25)
+        
+        * Fixes for Jython. (Issue #49)
+        
+        * Add PyPI classifiers. (Issue #43)
+        
+        * Fix the ``--exclude`` option. (Issue #48)
+        
+        * Fix W602, accept ``raise`` with 3 arguments. (Issue #34)
+        
+        * Correctly select all tests if ``DEFAULT_IGNORE == ''``.
+        
+        
+        0.6.1 (2010-10-03)
+        ------------------
+        
+        * Fix inconsistent version numbers. (Issue #21)
+        
+        
+        0.6.0 (2010-09-19)
+        ------------------
+        
+        * Test suite reorganized and enhanced in order to check more failures
+          with fewer test files.  Read the ``run_tests`` docstring for details
+          about the syntax.
+        
+        * Fix E225: accept ``print >>sys.stderr, "..."`` syntax.
+        
+        * Fix E501 for lines containing multibyte encoded characters. (Issue #7)
+        
+        * Fix E221, E222, E223, E224 not detected in some cases. (Issue #16)
+        
+        * Fix E211 to reject ``v = dic['a'] ['b']``. (Issue #17)
+        
+        * Exit code is always 1 if any error or warning is found. (Issue #10)
+        
+        * ``--ignore`` checks are now really ignored, especially in
+          conjunction with ``--count``. (Issue #8)
+        
+        * Blank lines with spaces yield W293 instead of W291: some developers
+          want to ignore this warning and indent the blank lines to paste their
+          code easily in the Python interpreter.
+        
+        * Fix E301: do not require a blank line before an indented block. (Issue #14)
+        
+        * Fix E203 to accept NumPy slice notation ``a[0, :]``. (Issue #13)
+        
+        * Performance improvements.
+        
+        * Fix decoding and checking non-UTF8 files in Python 3.
+        
+        * Fix E225: reject ``True+False`` when running on Python 3.
+        
+        * Fix an exception when the line starts with an operator.
+        
+        * Allow a new line before closing ``)``, ``}`` or ``]``. (Issue #5)
+        
+        
+        0.5.0 (2010-02-17)
+        ------------------
+        
+        * Changed the ``--count`` switch to print to sys.stderr and set
+          exit code to 1 if any error or warning is found.
+        
+        * E241 and E242 are removed from the standard checks. If you want to
+          include these checks, use switch ``--select=E,W``. (Issue #4)
+        
+        * Blank line is not mandatory before the first class method or nested
+          function definition, even if there's a docstring. (Issue #1)
+        
+        * Add the switch ``--version``.
+        
+        * Fix decoding errors with Python 3. (Issue #13 [1]_)
+        
+        * Add ``--select`` option which is mirror of ``--ignore``.
+        
+        * Add checks E261 and E262 for spaces before inline comments.
+        
+        * New check W604 warns about deprecated usage of backticks.
+        
+        * New check W603 warns about the deprecated operator ``<>``.
+        
+        * Performance improvement, due to rewriting of E225.
+        
+        * E225 now accepts:
+        
+          - no whitespace after unary operator or similar. (Issue #9 [1]_)
+        
+          - lambda function with argument unpacking or keyword defaults.
+        
+        * Reserve "2 blank lines" for module-level logical blocks. (E303)
+        
+        * Allow multi-line comments. (E302, issue #10 [1]_)
+        
+        
+        0.4.2 (2009-10-22)
+        ------------------
+        
+        * Decorators on classes and class methods are OK now.
+        
+        
+        0.4 (2009-10-20)
+        ----------------
+        
+        * Support for all versions of Python from 2.3 to 3.1.
+        
+        * New and greatly expanded self tests.
+        
+        * Added ``--count`` option to print the total number of errors and warnings.
+        
+        * Further improvements to the handling of comments and blank lines.
+          (Issue #1 [1]_ and others changes.)
+        
+        * Check all py files in directory when passed a directory (Issue
+          #2 [1]_). This also prevents an exception when traversing directories
+          with non ``*.py`` files.
+        
+        * E231 should allow commas to be followed by ``)``. (Issue #3 [1]_)
+        
+        * Spaces are no longer required around the equals sign for keyword
+          arguments or default parameter values.
+        
+        
+        .. [1] These issues refer to the `previous issue tracker`__.
+        .. __:  http://github.com/cburroughs/pep8.py/issues
+        
+        
+        0.3.1 (2009-09-14)
+        ------------------
+        
+        * Fixes for comments: do not count them when checking for blank lines between
+          items.
+        
+        * Added setup.py for pypi upload and easy_installability.
+        
+        
+        0.2 (2007-10-16)
+        ----------------
+        
+        * Loads of fixes and improvements.
+        
+        
+        0.1 (2006-10-01)
+        ----------------
+        
+        * First release.
+        
+Keywords: pep8
+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 :: 3
+Classifier: Topic :: Software Development :: Libraries :: Python Modules
new file mode 100644
--- /dev/null
+++ b/pep8/pep8.egg-info/SOURCES.txt
@@ -0,0 +1,54 @@
+CHANGES.txt
+MANIFEST.in
+README.rst
+pep8.py
+setup.py
+docs/Makefile
+docs/advanced.rst
+docs/api.rst
+docs/conf.py
+docs/developer.rst
+docs/index.rst
+docs/intro.rst
+docs/make.bat
+pep8.egg-info/PKG-INFO
+pep8.egg-info/SOURCES.txt
+pep8.egg-info/dependency_links.txt
+pep8.egg-info/entry_points.txt
+pep8.egg-info/namespace_packages.txt
+pep8.egg-info/not-zip-safe
+pep8.egg-info/top_level.txt
+testsuite/E10.py
+testsuite/E11.py
+testsuite/E12.py
+testsuite/E12not.py
+testsuite/E20.py
+testsuite/E21.py
+testsuite/E22.py
+testsuite/E23.py
+testsuite/E24.py
+testsuite/E25.py
+testsuite/E26.py
+testsuite/E27.py
+testsuite/E30.py
+testsuite/E30not.py
+testsuite/E40.py
+testsuite/E50.py
+testsuite/E70.py
+testsuite/E71.py
+testsuite/E72.py
+testsuite/E90.py
+testsuite/W19.py
+testsuite/W29.py
+testsuite/W39.py
+testsuite/W60.py
+testsuite/__init__.py
+testsuite/latin-1.py
+testsuite/noqa.py
+testsuite/python3.py
+testsuite/support.py
+testsuite/test_all.py
+testsuite/test_api.py
+testsuite/test_shell.py
+testsuite/utf-8-bom.py
+testsuite/utf-8.py
\ No newline at end of file
new file mode 100644
--- /dev/null
+++ b/pep8/pep8.egg-info/dependency_links.txt
@@ -0,0 +1,1 @@
+
new file mode 100644
--- /dev/null
+++ b/pep8/pep8.egg-info/entry_points.txt
@@ -0,0 +1,3 @@
+[console_scripts]
+pep8 = pep8:_main
+
new file mode 100644
--- /dev/null
+++ b/pep8/pep8.egg-info/namespace_packages.txt
@@ -0,0 +1,1 @@
+
new file mode 100644
--- /dev/null
+++ b/pep8/pep8.egg-info/not-zip-safe
@@ -0,0 +1,1 @@
+
new file mode 100644
--- /dev/null
+++ b/pep8/pep8.egg-info/top_level.txt
@@ -0,0 +1,1 @@
+pep8
new file mode 100755
--- /dev/null
+++ b/pep8/pep8.py
@@ -0,0 +1,1876 @@
+#!/usr/bin/env python
+# pep8.py - Check Python source code formatting, according to PEP 8
+# Copyright (C) 2006-2009 Johann C. Rocholl <johann@rocholl.net>
+# Copyright (C) 2009-2013 Florent Xicluna <florent.xicluna@gmail.com>
+#
+# 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.
+
+r"""
+Check Python source code formatting, according to PEP 8:
+http://www.python.org/dev/peps/pep-0008/
+
+For usage and a list of options, try this:
+$ python pep8.py -h
+
+This program and its regression test suite live here:
+http://github.com/jcrocholl/pep8
+
+Groups of errors and warnings:
+E errors
+W warnings
+100 indentation
+200 whitespace
+300 blank lines
+400 imports
+500 line length
+600 deprecation
+700 statements
+900 syntax error
+"""
+__version__ = '1.4.6'
+
+import os
+import sys
+import re
+import time
+import inspect
+import keyword
+import tokenize
+from optparse import OptionParser
+from fnmatch import fnmatch
+try:
+    from configparser import RawConfigParser
+    from io import TextIOWrapper
+except ImportError:
+    from ConfigParser import RawConfigParser
+
+DEFAULT_EXCLUDE = '.svn,CVS,.bzr,.hg,.git,__pycache__'
+DEFAULT_IGNORE = 'E123,E226,E24'
+if sys.platform == 'win32':
+    DEFAULT_CONFIG = os.path.expanduser(r'~\.pep8')
+else:
+    DEFAULT_CONFIG = os.path.join(os.getenv('XDG_CONFIG_HOME') or
+                                  os.path.expanduser('~/.config'), 'pep8')
+PROJECT_CONFIG = ('setup.cfg', 'tox.ini', '.pep8')
+TESTSUITE_PATH = os.path.join(os.path.dirname(__file__), 'testsuite')
+MAX_LINE_LENGTH = 79
+REPORT_FORMAT = {
+    'default': '%(path)s:%(row)d:%(col)d: %(code)s %(text)s',
+    'pylint': '%(path)s:%(row)d: [%(code)s] %(text)s',
+}
+
+PyCF_ONLY_AST = 1024
+SINGLETONS = frozenset(['False', 'None', 'True'])
+KEYWORDS = frozenset(keyword.kwlist + ['print']) - SINGLETONS
+UNARY_OPERATORS = frozenset(['>>', '**', '*', '+', '-'])
+ARITHMETIC_OP = frozenset(['**', '*', '/', '//', '+', '-'])
+WS_OPTIONAL_OPERATORS = ARITHMETIC_OP.union(['^', '&', '|', '<<', '>>', '%'])
+WS_NEEDED_OPERATORS = frozenset([
+    '**=', '*=', '/=', '//=', '+=', '-=', '!=', '<>', '<', '>',
+    '%=', '^=', '&=', '|=', '==', '<=', '>=', '<<=', '>>=', '='])
+WHITESPACE = frozenset(' \t')
+SKIP_TOKENS = frozenset([tokenize.COMMENT, tokenize.NL, tokenize.NEWLINE,
+                         tokenize.INDENT, tokenize.DEDENT])
+BENCHMARK_KEYS = ['directories', 'files', 'logical lines', 'physical lines']
+
+INDENT_REGEX = re.compile(r'([ \t]*)')
+RAISE_COMMA_REGEX = re.compile(r'raise\s+\w+\s*,')
+RERAISE_COMMA_REGEX = re.compile(r'raise\s+\w+\s*,\s*\w+\s*,\s*\w+')
+ERRORCODE_REGEX = re.compile(r'\b[A-Z]\d{3}\b')
+DOCSTRING_REGEX = re.compile(r'u?r?["\']')
+EXTRANEOUS_WHITESPACE_REGEX = re.compile(r'[[({] | []}),;:]')
+WHITESPACE_AFTER_COMMA_REGEX = re.compile(r'[,;:]\s*(?:  |\t)')
+COMPARE_SINGLETON_REGEX = re.compile(r'([=!]=)\s*(None|False|True)')
+COMPARE_TYPE_REGEX = re.compile(r'(?:[=!]=|is(?:\s+not)?)\s*type(?:s.\w+Type'
+                                r'|\s*\(\s*([^)]*[^ )])\s*\))')
+KEYWORD_REGEX = re.compile(r'(\s*)\b(?:%s)\b(\s*)' % r'|'.join(KEYWORDS))
+OPERATOR_REGEX = re.compile(r'(?:[^,\s])(\s*)(?:[-+*/|!<=>%&^]+)(\s*)')
+LAMBDA_REGEX = re.compile(r'\blambda\b')
+HUNK_REGEX = re.compile(r'^@@ -\d+(?:,\d+)? \+(\d+)(?:,(\d+))? @@.*$')
+
+# Work around Python < 2.6 behaviour, which does not generate NL after
+# a comment which is on a line by itself.
+COMMENT_WITH_NL = tokenize.generate_tokens(['#\n'].pop).send(None)[1] == '#\n'
+
+
+##############################################################################
+# Plugins (check functions) for physical lines
+##############################################################################
+
+
+def tabs_or_spaces(physical_line, indent_char):
+    r"""
+    Never mix tabs and spaces.
+
+    The most popular way of indenting Python is with spaces only.  The
+    second-most popular way is with tabs only.  Code indented with a mixture
+    of tabs and spaces should be converted to using spaces exclusively.  When
+    invoking the Python command line interpreter with the -t option, it issues
+    warnings about code that illegally mixes tabs and spaces.  When using -tt
+    these warnings become errors.  These options are highly recommended!
+
+    Okay: if a == 0:\n        a = 1\n        b = 1
+    E101: if a == 0:\n        a = 1\n\tb = 1
+    """
+    indent = INDENT_REGEX.match(physical_line).group(1)
+    for offset, char in enumerate(indent):
+        if char != indent_char:
+            return offset, "E101 indentation contains mixed spaces and tabs"
+
+
+def tabs_obsolete(physical_line):
+    r"""
+    For new projects, spaces-only are strongly recommended over tabs.  Most
+    editors have features that make this easy to do.
+
+    Okay: if True:\n    return
+    W191: if True:\n\treturn
+    """
+    indent = INDENT_REGEX.match(physical_line).group(1)
+    if '\t' in indent:
+        return indent.index('\t'), "W191 indentation contains tabs"
+
+
+def trailing_whitespace(physical_line):
+    r"""
+    JCR: Trailing whitespace is superfluous.
+    FBM: Except when it occurs as part of a blank line (i.e. the line is
+         nothing but whitespace). According to Python docs[1] a line with only
+         whitespace is considered a blank line, and is to be ignored. However,
+         matching a blank line to its indentation level avoids mistakenly
+         terminating a multi-line statement (e.g. class declaration) when
+         pasting code into the standard Python interpreter.
+
+         [1] http://docs.python.org/reference/lexical_analysis.html#blank-lines
+
+    The warning returned varies on whether the line itself is blank, for easier
+    filtering for those who want to indent their blank lines.
+
+    Okay: spam(1)\n#
+    W291: spam(1) \n#
+    W293: class Foo(object):\n    \n    bang = 12
+    """
+    physical_line = physical_line.rstrip('\n')    # chr(10), newline
+    physical_line = physical_line.rstrip('\r')    # chr(13), carriage return
+    physical_line = physical_line.rstrip('\x0c')  # chr(12), form feed, ^L
+    stripped = physical_line.rstrip(' \t\v')
+    if physical_line != stripped:
+        if stripped:
+            return len(stripped), "W291 trailing whitespace"
+        else:
+            return 0, "W293 blank line contains whitespace"
+
+
+def trailing_blank_lines(physical_line, lines, line_number):
+    r"""
+    JCR: Trailing blank lines are superfluous.
+
+    Okay: spam(1)
+    W391: spam(1)\n
+    """
+    if not physical_line.rstrip() and line_number == len(lines):
+        return 0, "W391 blank line at end of file"
+
+
+def missing_newline(physical_line):
+    """
+    JCR: The last line should have a newline.
+
+    Reports warning W292.
+    """
+    if physical_line.rstrip() == physical_line:
+        return len(physical_line), "W292 no newline at end of file"
+
+
+def maximum_line_length(physical_line, max_line_length):
+    """
+    Limit all lines to a maximum of 79 characters.
+
+    There are still many devices around that are limited to 80 character
+    lines; plus, limiting windows to 80 characters makes it possible to have
+    several windows side-by-side.  The default wrapping on such devices looks
+    ugly.  Therefore, please limit all lines to a maximum of 79 characters.
+    For flowing long blocks of text (docstrings or comments), limiting the
+    length to 72 characters is recommended.
+
+    Reports error E501.
+    """
+    line = physical_line.rstrip()
+    length = len(line)
+    if length > max_line_length and not noqa(line):
+        if hasattr(line, 'decode'):   # Python 2
+            # The line could contain multi-byte characters
+            try:
+                length = len(line.decode('utf-8'))
+            except UnicodeError:
+                pass
+        if length > max_line_length:
+            return (max_line_length, "E501 line too long "
+                    "(%d > %d characters)" % (length, max_line_length))
+
+
+##############################################################################
+# Plugins (check functions) for logical lines
+##############################################################################
+
+
+def blank_lines(logical_line, blank_lines, indent_level, line_number,
+                previous_logical, previous_indent_level):
+    r"""
+    Separate top-level function and class definitions with two blank lines.
+
+    Method definitions inside a class are separated by a single blank line.
+
+    Extra blank lines may be used (sparingly) to separate groups of related
+    functions.  Blank lines may be omitted between a bunch of related
+    one-liners (e.g. a set of dummy implementations).
+
+    Use blank lines in functions, sparingly, to indicate logical sections.
+
+    Okay: def a():\n    pass\n\n\ndef b():\n    pass
+    Okay: def a():\n    pass\n\n\n# Foo\n# Bar\n\ndef b():\n    pass
+
+    E301: class Foo:\n    b = 0\n    def bar():\n        pass
+    E302: def a():\n    pass\n\ndef b(n):\n    pass
+    E303: def a():\n    pass\n\n\n\ndef b(n):\n    pass
+    E303: def a():\n\n\n\n    pass
+    E304: @decorator\n\ndef a():\n    pass
+    """
+    if line_number < 3 and not previous_logical:
+        return  # Don't expect blank lines before the first line
+    if previous_logical.startswith('@'):
+        if blank_lines:
+            yield 0, "E304 blank lines found after function decorator"
+    elif blank_lines > 2 or (indent_level and blank_lines == 2):
+        yield 0, "E303 too many blank lines (%d)" % blank_lines
+    elif logical_line.startswith(('def ', 'class ', '@')):
+        if indent_level:
+            if not (blank_lines or previous_indent_level < indent_level or
+                    DOCSTRING_REGEX.match(previous_logical)):
+                yield 0, "E301 expected 1 blank line, found 0"
+        elif blank_lines != 2:
+            yield 0, "E302 expected 2 blank lines, found %d" % blank_lines
+
+
+def extraneous_whitespace(logical_line):
+    """
+    Avoid extraneous whitespace in the following situations:
+
+    - Immediately inside parentheses, brackets or braces.
+
+    - Immediately before a comma, semicolon, or colon.
+
+    Okay: spam(ham[1], {eggs: 2})
+    E201: spam( ham[1], {eggs: 2})
+    E201: spam(ham[ 1], {eggs: 2})
+    E201: spam(ham[1], { eggs: 2})
+    E202: spam(ham[1], {eggs: 2} )
+    E202: spam(ham[1 ], {eggs: 2})
+    E202: spam(ham[1], {eggs: 2 })
+
+    E203: if x == 4: print x, y; x, y = y , x
+    E203: if x == 4: print x, y ; x, y = y, x
+    E203: if x == 4 : print x, y; x, y = y, x
+    """
+    line = logical_line
+    for match in EXTRANEOUS_WHITESPACE_REGEX.finditer(line):
+        text = match.group()
+        char = text.strip()
+        found = match.start()
+        if text == char + ' ':
+            # assert char in '([{'
+            yield found + 1, "E201 whitespace after '%s'" % char
+        elif line[found - 1] != ',':
+            code = ('E202' if char in '}])' else 'E203')  # if char in ',;:'
+            yield found, "%s whitespace before '%s'" % (code, char)
+
+
+def whitespace_around_keywords(logical_line):
+    r"""
+    Avoid extraneous whitespace around keywords.
+
+    Okay: True and False
+    E271: True and  False
+    E272: True  and False
+    E273: True and\tFalse
+    E274: True\tand False
+    """
+    for match in KEYWORD_REGEX.finditer(logical_line):
+        before, after = match.groups()
+
+        if '\t' in before:
+            yield match.start(1), "E274 tab before keyword"
+        elif len(before) > 1:
+            yield match.start(1), "E272 multiple spaces before keyword"
+
+        if '\t' in after:
+            yield match.start(2), "E273 tab after keyword"
+        elif len(after) > 1:
+            yield match.start(2), "E271 multiple spaces after keyword"
+
+
+def missing_whitespace(logical_line):
+    """
+    JCR: Each comma, semicolon or colon should be followed by whitespace.
+
+    Okay: [a, b]
+    Okay: (3,)
+    Okay: a[1:4]
+    Okay: a[:4]
+    Okay: a[1:]
+    Okay: a[1:4:2]
+    E231: ['a','b']
+    E231: foo(bar,baz)
+    E231: [{'a':'b'}]
+    """
+    line = logical_line
+    for index in range(len(line) - 1):
+        char = line[index]
+        if char in ',;:' and line[index + 1] not in WHITESPACE:
+            before = line[:index]
+            if char == ':' and before.count('[') > before.count(']') and \
+                    before.rfind('{') < before.rfind('['):
+                continue  # Slice syntax, no space required
+            if char == ',' and line[index + 1] == ')':
+                continue  # Allow tuple with only one element: (3,)
+            yield index, "E231 missing whitespace after '%s'" % char
+
+
+def indentation(logical_line, previous_logical, indent_char,
+                indent_level, previous_indent_level):
+    r"""
+    Use 4 spaces per indentation level.
+
+    For really old code that you don't want to mess up, you can continue to
+    use 8-space tabs.
+
+    Okay: a = 1
+    Okay: if a == 0:\n    a = 1
+    E111:   a = 1
+
+    Okay: for item in items:\n    pass
+    E112: for item in items:\npass
+
+    Okay: a = 1\nb = 2
+    E113: a = 1\n    b = 2
+    """
+    if indent_char == ' ' and indent_level % 4:
+        yield 0, "E111 indentation is not a multiple of four"
+    indent_expect = previous_logical.endswith(':')
+    if indent_expect and indent_level <= previous_indent_level:
+        yield 0, "E112 expected an indented block"
+    if indent_level > previous_indent_level and not indent_expect:
+        yield 0, "E113 unexpected indentation"
+
+
+def continued_indentation(logical_line, tokens, indent_level, hang_closing,
+                          noqa, verbose):
+    r"""
+    Continuation lines should align wrapped elements either vertically using
+    Python's implicit line joining inside parentheses, brackets and braces, or
+    using a hanging indent.
+
+    When using a hanging indent the following considerations should be applied:
+
+    - there should be no arguments on the first line, and
+
+    - further indentation should be used to clearly distinguish itself as a
+      continuation line.
+
+    Okay: a = (\n)
+    E123: a = (\n    )
+
+    Okay: a = (\n    42)
+    E121: a = (\n   42)
+    E122: a = (\n42)
+    E123: a = (\n    42\n    )
+    E124: a = (24,\n     42\n)
+    E125: if (a or\n    b):\n    pass
+    E126: a = (\n        42)
+    E127: a = (24,\n      42)
+    E128: a = (24,\n    42)
+    """
+    first_row = tokens[0][2][0]
+    nrows = 1 + tokens[-1][2][0] - first_row
+    if noqa or nrows == 1:
+        return
+
+    # indent_next tells us whether the next block is indented; assuming
+    # that it is indented by 4 spaces, then we should not allow 4-space
+    # indents on the final continuation line; in turn, some other
+    # indents are allowed to have an extra 4 spaces.
+    indent_next = logical_line.endswith(':')
+
+    row = depth = 0
+    # remember how many brackets were opened on each line
+    parens = [0] * nrows
+    # relative indents of physical lines
+    rel_indent = [0] * nrows
+    # visual indents
+    indent_chances = {}
+    last_indent = tokens[0][2]
+    indent = [last_indent[1]]
+    if verbose >= 3:
+        print(">>> " + tokens[0][4].rstrip())
+
+    for token_type, text, start, end, line in tokens:
+
+        newline = row < start[0] - first_row
+        if newline:
+            row = start[0] - first_row
+            newline = (not last_token_multiline and
+                       token_type not in (tokenize.NL, tokenize.NEWLINE))
+
+        if newline:
+            # this is the beginning of a continuation line.
+            last_indent = start
+            if verbose >= 3:
+                print("... " + line.rstrip())
+
+            # record the initial indent.
+            rel_indent[row] = expand_indent(line) - indent_level
+
+            if depth:
+                # a bracket expression in a continuation line.
+                # find the line that it was opened on
+                for open_row in range(row - 1, -1, -1):
+                    if parens[open_row]:
+                        break
+            else:
+                # an unbracketed continuation line (ie, backslash)
+                open_row = 0
+            hang = rel_indent[row] - rel_indent[open_row]
+            close_bracket = (token_type == tokenize.OP and text in ']})')
+            visual_indent = (not close_bracket and hang > 0 and
+                             indent_chances.get(start[1]))
+
+            if close_bracket and indent[depth]:
+                # closing bracket for visual indent
+                if start[1] != indent[depth]:
+                    yield (start, "E124 closing bracket does not match "
+                           "visual indentation")
+            elif close_bracket and not hang:
+                # closing bracket matches indentation of opening bracket's line
+                if hang_closing:
+                    yield start, "E133 closing bracket is missing indentation"
+            elif visual_indent is True:
+                # visual indent is verified
+                if not indent[depth]:
+                    indent[depth] = start[1]
+            elif visual_indent in (text, str):
+                # ignore token lined up with matching one from a previous line
+                pass
+            elif indent[depth] and start[1] < indent[depth]:
+                # visual indent is broken
+                yield (start, "E128 continuation line "
+                       "under-indented for visual indent")
+            elif hang == 4 or (indent_next and rel_indent[row] == 8):
+                # hanging indent is verified
+                if close_bracket and not hang_closing:
+                    yield (start, "E123 closing bracket does not match "
+                           "indentation of opening bracket's line")
+            else:
+                # indent is broken
+                if hang <= 0:
+                    error = "E122", "missing indentation or outdented"
+                elif indent[depth]:
+                    error = "E127", "over-indented for visual indent"
+                elif hang % 4:
+                    error = "E121", "indentation is not a multiple of four"
+                else:
+                    error = "E126", "over-indented for hanging indent"
+                yield start, "%s continuation line %s" % error
+
+        # look for visual indenting
+        if (parens[row] and token_type not in (tokenize.NL, tokenize.COMMENT)
+                and not indent[depth]):
+            indent[depth] = start[1]
+            indent_chances[start[1]] = True
+            if verbose >= 4:
+                print("bracket depth %s indent to %s" % (depth, start[1]))
+        # deal with implicit string concatenation
+        elif (token_type in (tokenize.STRING, tokenize.COMMENT) or
+              text in ('u', 'ur', 'b', 'br')):
+            indent_chances[start[1]] = str
+        # special case for the "if" statement because len("if (") == 4
+        elif not indent_chances and not row and not depth and text == 'if':
+            indent_chances[end[1] + 1] = True
+
+        # keep track of bracket depth
+        if token_type == tokenize.OP:
+            if text in '([{':
+                depth += 1
+                indent.append(0)
+                parens[row] += 1
+                if verbose >= 4:
+                    print("bracket depth %s seen, col %s, visual min = %s" %
+                          (depth, start[1], indent[depth]))
+            elif text in ')]}' and depth > 0:
+                # parent indents should not be more than this one
+                prev_indent = indent.pop() or last_indent[1]
+                for d in range(depth):
+                    if indent[d] > prev_indent:
+                        indent[d] = 0
+                for ind in list(indent_chances):
+                    if ind >= prev_indent:
+                        del indent_chances[ind]
+                depth -= 1
+                if depth:
+                    indent_chances[indent[depth]] = True
+                for idx in range(row, -1, -1):
+                    if parens[idx]:
+                        parens[idx] -= 1
+                        rel_indent[row] = rel_indent[idx]
+                        break
+            assert len(indent) == depth + 1
+            if start[1] not in indent_chances:
+                # allow to line up tokens
+                indent_chances[start[1]] = text
+
+        last_token_multiline = (start[0] != end[0])
+
+    if indent_next and expand_indent(line) == indent_level + 4:
+        yield (last_indent, "E125 continuation line does not distinguish "
+               "itself from next logical line")
+
+
+def whitespace_before_parameters(logical_line, tokens):
+    """
+    Avoid extraneous whitespace in the following situations:
+
+    - Immediately before the open parenthesis that starts the argument
+      list of a function call.
+
+    - Immediately before the open parenthesis that starts an indexing or
+      slicing.
+
+    Okay: spam(1)
+    E211: spam (1)
+
+    Okay: dict['key'] = list[index]
+    E211: dict ['key'] = list[index]
+    E211: dict['key'] = list [index]
+    """
+    prev_type, prev_text, __, prev_end, __ = tokens[0]
+    for index in range(1, len(tokens)):
+        token_type, text, start, end, __ = tokens[index]
+        if (token_type == tokenize.OP and
+            text in '([' and
+            start != prev_end and
+            (prev_type == tokenize.NAME or prev_text in '}])') and
+            # Syntax "class A (B):" is allowed, but avoid it
+            (index < 2 or tokens[index - 2][1] != 'class') and
+                # Allow "return (a.foo for a in range(5))"
+                not keyword.iskeyword(prev_text)):
+            yield prev_end, "E211 whitespace before '%s'" % text
+        prev_type = token_type
+        prev_text = text
+        prev_end = end
+
+
+def whitespace_around_operator(logical_line):
+    r"""
+    Avoid extraneous whitespace in the following situations:
+
+    - More than one space around an assignment (or other) operator to
+      align it with another.
+
+    Okay: a = 12 + 3
+    E221: a = 4  + 5
+    E222: a = 4 +  5
+    E223: a = 4\t+ 5
+    E224: a = 4 +\t5
+    """
+    for match in OPERATOR_REGEX.finditer(logical_line):
+        before, after = match.groups()
+
+        if '\t' in before:
+            yield match.start(1), "E223 tab before operator"
+        elif len(before) > 1:
+            yield match.start(1), "E221 multiple spaces before operator"
+
+        if '\t' in after:
+            yield match.start(2), "E224 tab after operator"
+        elif len(after) > 1:
+            yield match.start(2), "E222 multiple spaces after operator"
+
+
+def missing_whitespace_around_operator(logical_line, tokens):
+    r"""
+    - Always surround these binary operators with a single space on
+      either side: assignment (=), augmented assignment (+=, -= etc.),
+      comparisons (==, <, >, !=, <>, <=, >=, in, not in, is, is not),
+      Booleans (and, or, not).
+
+    - Use spaces around arithmetic operators.
+
+    Okay: i = i + 1
+    Okay: submitted += 1
+    Okay: x = x * 2 - 1
+    Okay: hypot2 = x * x + y * y
+    Okay: c = (a + b) * (a - b)
+    Okay: foo(bar, key='word', *args, **kwargs)
+    Okay: alpha[:-i]
+
+    E225: i=i+1
+    E225: submitted +=1
+    E225: x = x /2 - 1
+    E225: z = x **y
+    E226: c = (a+b) * (a-b)
+    E226: hypot2 = x*x + y*y
+    E227: c = a|b
+    E228: msg = fmt%(errno, errmsg)
+    """
+    parens = 0
+    need_space = False
+    prev_type = tokenize.OP
+    prev_text = prev_end = None
+    for token_type, text, start, end, line in tokens:
+        if token_type in (tokenize.NL, tokenize.NEWLINE, tokenize.ERRORTOKEN):
+            # ERRORTOKEN is triggered by backticks in Python 3
+            continue
+        if text in ('(', 'lambda'):
+            parens += 1
+        elif text == ')':
+            parens -= 1
+        if need_space:
+            if start != prev_end:
+                # Found a (probably) needed space
+                if need_space is not True and not need_space[1]:
+                    yield (need_space[0],
+                           "E225 missing whitespace around operator")
+                need_space = False
+            elif text == '>' and prev_text in ('<', '-'):
+                # Tolerate the "<>" operator, even if running Python 3
+                # Deal with Python 3's annotated return value "->"
+                pass
+            else:
+                if need_space is True or need_space[1]:
+                    # A needed trailing space was not found
+                    yield prev_end, "E225 missing whitespace around operator"
+                else:
+                    code, optype = 'E226', 'arithmetic'
+                    if prev_text == '%':
+                        code, optype = 'E228', 'modulo'
+                    elif prev_text not in ARITHMETIC_OP:
+                        code, optype = 'E227', 'bitwise or shift'
+                    yield (need_space[0], "%s missing whitespace "
+                           "around %s operator" % (code, optype))
+                need_space = False
+        elif token_type == tokenize.OP and prev_end is not None:
+            if text == '=' and parens:
+                # Allow keyword args or defaults: foo(bar=None).
+                pass
+            elif text in WS_NEEDED_OPERATORS:
+                need_space = True
+            elif text in UNARY_OPERATORS:
+                # Check if the operator is being used as a binary operator
+                # Allow unary operators: -123, -x, +1.
+                # Allow argument unpacking: foo(*args, **kwargs).
+                if prev_type == tokenize.OP:
+                    binary_usage = (prev_text in '}])')
+                elif prev_type == tokenize.NAME:
+                    binary_usage = (prev_text not in KEYWORDS)
+                else:
+                    binary_usage = (prev_type not in SKIP_TOKENS)
+
+                if binary_usage:
+                    need_space = None
+            elif text in WS_OPTIONAL_OPERATORS:
+                need_space = None
+
+            if need_space is None:
+                # Surrounding space is optional, but ensure that
+                # trailing space matches opening space
+                need_space = (prev_end, start != prev_end)
+            elif need_space and start == prev_end:
+                # A needed opening space was not found
+                yield prev_end, "E225 missing whitespace around operator"
+                need_space = False
+        prev_type = token_type
+        prev_text = text
+        prev_end = end
+
+
+def whitespace_around_comma(logical_line):
+    r"""
+    Avoid extraneous whitespace in the following situations:
+
+    - More than one space around an assignment (or other) operator to
+      align it with another.
+
+    Note: these checks are disabled by default
+
+    Okay: a = (1, 2)
+    E241: a = (1,  2)
+    E242: a = (1,\t2)
+    """
+    line = logical_line
+    for m in WHITESPACE_AFTER_COMMA_REGEX.finditer(line):
+        found = m.start() + 1
+        if '\t' in m.group():
+            yield found, "E242 tab after '%s'" % m.group()[0]
+        else:
+            yield found, "E241 multiple spaces after '%s'" % m.group()[0]
+
+
+def whitespace_around_named_parameter_equals(logical_line, tokens):
+    """
+    Don't use spaces around the '=' sign when used to indicate a
+    keyword argument or a default parameter value.
+
+    Okay: def complex(real, imag=0.0):
+    Okay: return magic(r=real, i=imag)
+    Okay: boolean(a == b)
+    Okay: boolean(a != b)
+    Okay: boolean(a <= b)
+    Okay: boolean(a >= b)
+
+    E251: def complex(real, imag = 0.0):
+    E251: return magic(r = real, i = imag)
+    """
+    parens = 0
+    no_space = False
+    prev_end = None
+    message = "E251 unexpected spaces around keyword / parameter equals"
+    for token_type, text, start, end, line in tokens:
+        if no_space:
+            no_space = False
+            if start != prev_end:
+                yield (prev_end, message)
+        elif token_type == tokenize.OP:
+            if text == '(':
+                parens += 1
+            elif text == ')':
+                parens -= 1
+            elif parens and text == '=':
+                no_space = True
+                if start != prev_end:
+                    yield (prev_end, message)
+        prev_end = end
+
+
+def whitespace_before_inline_comment(logical_line, tokens):
+    """
+    Separate inline comments by at least two spaces.
+
+    An inline comment is a comment on the same line as a statement.  Inline
+    comments should be separated by at least two spaces from the statement.
+    They should start with a # and a single space.
+
+    Okay: x = x + 1  # Increment x
+    Okay: x = x + 1    # Increment x
+    E261: x = x + 1 # Increment x
+    E262: x = x + 1  #Increment x
+    E262: x = x + 1  #  Increment x
+    """
+    prev_end = (0, 0)
+    for token_type, text, start, end, line in tokens:
+        if token_type == tokenize.COMMENT:
+            if not line[:start[1]].strip():
+                continue
+            if prev_end[0] == start[0] and start[1] < prev_end[1] + 2:
+                yield (prev_end,
+                       "E261 at least two spaces before inline comment")
+            symbol, sp, comment = text.partition(' ')
+            if symbol not in ('#', '#:') or comment[:1].isspace():
+                yield start, "E262 inline comment should start with '# '"
+        elif token_type != tokenize.NL:
+            prev_end = end
+
+
+def imports_on_separate_lines(logical_line):
+    r"""
+    Imports should usually be on separate lines.
+
+    Okay: import os\nimport sys
+    E401: import sys, os
+
+    Okay: from subprocess import Popen, PIPE
+    Okay: from myclas import MyClass
+    Okay: from foo.bar.yourclass import YourClass
+    Okay: import myclass
+    Okay: import foo.bar.yourclass
+    """
+    line = logical_line
+    if line.startswith('import '):
+        found = line.find(',')
+        if -1 < found and ';' not in line[:found]:
+            yield found, "E401 multiple imports on one line"
+
+
+def compound_statements(logical_line):
+    r"""
+    Compound statements (multiple statements on the same line) are
+    generally discouraged.
+
+    While sometimes it's okay to put an if/for/while with a small body
+    on the same line, never do this for multi-clause statements. Also
+    avoid folding such long lines!
+
+    Okay: if foo == 'blah':\n    do_blah_thing()
+    Okay: do_one()
+    Okay: do_two()
+    Okay: do_three()
+
+    E701: if foo == 'blah': do_blah_thing()
+    E701: for x in lst: total += x
+    E701: while t < 10: t = delay()
+    E701: if foo == 'blah': do_blah_thing()
+    E701: else: do_non_blah_thing()
+    E701: try: something()
+    E701: finally: cleanup()
+    E701: if foo == 'blah': one(); two(); three()
+
+    E702: do_one(); do_two(); do_three()
+    E703: do_four();  # useless semicolon
+    """
+    line = logical_line
+    last_char = len(line) - 1
+    found = line.find(':')
+    while -1 < found < last_char:
+        before = line[:found]
+        if (before.count('{') <= before.count('}') and  # {'a': 1} (dict)
+            before.count('[') <= before.count(']') and  # [1:2] (slice)
+            before.count('(') <= before.count(')') and  # (Python 3 annotation)
+                not LAMBDA_REGEX.search(before)):       # lambda x: x
+            yield found, "E701 multiple statements on one line (colon)"
+        found = line.find(':', found + 1)
+    found = line.find(';')
+    while -1 < found:
+        if found < last_char:
+            yield found, "E702 multiple statements on one line (semicolon)"
+        else:
+            yield found, "E703 statement ends with a semicolon"
+        found = line.find(';', found + 1)
+
+
+def explicit_line_join(logical_line, tokens):
+    r"""
+    Avoid explicit line join between brackets.
+
+    The preferred way of wrapping long lines is by using Python's implied line
+    continuation inside parentheses, brackets and braces.  Long lines can be
+    broken over multiple lines by wrapping expressions in parentheses.  These
+    should be used in preference to using a backslash for line continuation.
+
+    E502: aaa = [123, \\n       123]
+    E502: aaa = ("bbb " \\n       "ccc")
+
+    Okay: aaa = [123,\n       123]
+    Okay: aaa = ("bbb "\n       "ccc")
+    Okay: aaa = "bbb " \\n    "ccc"
+    """
+    prev_start = prev_end = parens = 0
+    for token_type, text, start, end, line in tokens:
+        if start[0] != prev_start and parens and backslash:
+            yield backslash, "E502 the backslash is redundant between brackets"
+        if end[0] != prev_end:
+            if line.rstrip('\r\n').endswith('\\'):
+                backslash = (end[0], len(line.splitlines()[-1]) - 1)
+            else:
+                backslash = None
+            prev_start = prev_end = end[0]
+        else:
+            prev_start = start[0]
+        if token_type == tokenize.OP:
+            if text in '([{':
+                parens += 1
+            elif text in ')]}':
+                parens -= 1
+
+
+def comparison_to_singleton(logical_line, noqa):
+    """
+    Comparisons to singletons like None should always be done
+    with "is" or "is not", never the equality operators.
+
+    Okay: if arg is not None:
+    E711: if arg != None:
+    E712: if arg == True:
+
+    Also, beware of writing if x when you really mean if x is not None --
+    e.g. when testing whether a variable or argument that defaults to None was
+    set to some other value.  The other value might have a type (such as a
+    container) that could be false in a boolean context!
+    """
+    match = not noqa and COMPARE_SINGLETON_REGEX.search(logical_line)
+    if match:
+        same = (match.group(1) == '==')
+        singleton = match.group(2)
+        msg = "'if cond is %s:'" % (('' if same else 'not ') + singleton)
+        if singleton in ('None',):
+            code = 'E711'
+        else:
+            code = 'E712'
+            nonzero = ((singleton == 'True' and same) or
+                       (singleton == 'False' and not same))
+            msg += " or 'if %scond:'" % ('' if nonzero else 'not ')
+        yield match.start(1), ("%s comparison to %s should be %s" %
+                               (code, singleton, msg))
+
+
+def comparison_type(logical_line):
+    """
+    Object type comparisons should always use isinstance() instead of
+    comparing types directly.
+
+    Okay: if isinstance(obj, int):
+    E721: if type(obj) is type(1):
+
+    When checking if an object is a string, keep in mind that it might be a
+    unicode string too! In Python 2.3, str and unicode have a common base
+    class, basestring, so you can do:
+
+    Okay: if isinstance(obj, basestring):
+    Okay: if type(a1) is type(b1):
+    """
+    match = COMPARE_TYPE_REGEX.search(logical_line)
+    if match:
+        inst = match.group(1)
+        if inst and isidentifier(inst) and inst not in SINGLETONS:
+            return  # Allow comparison for types which are not obvious
+        yield match.start(), "E721 do not compare types, use 'isinstance()'"
+
+
+def python_3000_has_key(logical_line):
+    r"""
+    The {}.has_key() method is removed in the Python 3.
+    Use the 'in' operation instead.
+
+    Okay: if "alph" in d:\n    print d["alph"]
+    W601: assert d.has_key('alph')
+    """
+    pos = logical_line.find('.has_key(')
+    if pos > -1:
+        yield pos, "W601 .has_key() is deprecated, use 'in'"
+
+
+def python_3000_raise_comma(logical_line):
+    """
+    When raising an exception, use "raise ValueError('message')"
+    instead of the older form "raise ValueError, 'message'".
+
+    The paren-using form is preferred because when the exception arguments
+    are long or include string formatting, you don't need to use line
+    continuation characters thanks to the containing parentheses.  The older
+    form is removed in Python 3.
+
+    Okay: raise DummyError("Message")
+    W602: raise DummyError, "Message"
+    """
+    match = RAISE_COMMA_REGEX.match(logical_line)
+    if match and not RERAISE_COMMA_REGEX.match(logical_line):
+        yield match.end() - 1, "W602 deprecated form of raising exception"
+
+
+def python_3000_not_equal(logical_line):
+    """
+    != can also be written <>, but this is an obsolete usage kept for
+    backwards compatibility only. New code should always use !=.
+    The older syntax is removed in Python 3.
+
+    Okay: if a != 'no':
+    W603: if a <> 'no':
+    """
+    pos = logical_line.find('<>')
+    if pos > -1:
+        yield pos, "W603 '<>' is deprecated, use '!='"
+
+
+def python_3000_backticks(logical_line):
+    """
+    Backticks are removed in Python 3.
+    Use repr() instead.
+
+    Okay: val = repr(1 + 2)
+    W604: val = `1 + 2`
+    """
+    pos = logical_line.find('`')
+    if pos > -1:
+        yield pos, "W604 backticks are deprecated, use 'repr()'"
+
+
+##############################################################################
+# Helper functions
+##############################################################################
+
+
+if '' == ''.encode():
+    # Python 2: implicit encoding.
+    def readlines(filename):
+        f = open(filename)
+        try:
+            return f.readlines()
+        finally:
+            f.close()
+    isidentifier = re.compile(r'[a-zA-Z_]\w*').match
+    stdin_get_value = sys.stdin.read
+else:
+    # Python 3
+    def readlines(filename):
+        f = open(filename, 'rb')
+        try:
+            coding, lines = tokenize.detect_encoding(f.readline)
+            f = TextIOWrapper(f, coding, line_buffering=True)
+            return [l.decode(coding) for l in lines] + f.readlines()
+        except (LookupError, SyntaxError, UnicodeError):
+            f.close()
+            # Fall back if files are improperly declared
+            f = open(filename, encoding='latin-1')
+            return f.readlines()
+        finally:
+            f.close()
+    isidentifier = str.isidentifier
+
+    def stdin_get_value():
+        return TextIOWrapper(sys.stdin.buffer, errors='ignore').read()
+readlines.__doc__ = "    Read the source code."
+noqa = re.compile(r'# no(?:qa|pep8)\b', re.I).search
+
+
+def expand_indent(line):
+    r"""
+    Return the amount of indentation.
+    Tabs are expanded to the next multiple of 8.
+
+    >>> expand_indent('    ')
+    4
+    >>> expand_indent('\t')
+    8
+    >>> expand_indent('    \t')
+    8
+    >>> expand_indent('       \t')
+    8
+    >>> expand_indent('        \t')
+    16
+    """
+    if '\t' not in line:
+        return len(line) - len(line.lstrip())
+    result = 0
+    for char in line:
+        if char == '\t':
+            result = result // 8 * 8 + 8
+        elif char == ' ':
+            result += 1
+        else:
+            break
+    return result
+
+
+def mute_string(text):
+    """
+    Replace contents with 'xxx' to prevent syntax matching.
+
+    >>> mute_string('"abc"')
+    '"xxx"'
+    >>> mute_string("'''abc'''")
+    "'''xxx'''"
+    >>> mute_string("r'abc'")
+    "r'xxx'"
+    """
+    # String modifiers (e.g. u or r)
+    start = text.index(text[-1]) + 1
+    end = len(text) - 1
+    # Triple quotes
+    if text[-3:] in ('"""', "'''"):
+        start += 2
+        end -= 2
+    return text[:start] + 'x' * (end - start) + text[end:]
+
+
+def parse_udiff(diff, patterns=None, parent='.'):
+    """Return a dictionary of matching lines."""
+    # For each file of the diff, the entry key is the filename,
+    # and the value is a set of row numbers to consider.
+    rv = {}
+    path = nrows = None
+    for line in diff.splitlines():
+        if nrows:
+            if line[:1] != '-':
+                nrows -= 1
+            continue
+        if line[:3] == '@@ ':
+            hunk_match = HUNK_REGEX.match(line)
+            row, nrows = [int(g or '1') for g in hunk_match.groups()]
+            rv[path].update(range(row, row + nrows))
+        elif line[:3] == '+++':
+            path = line[4:].split('\t', 1)[0]
+            if path[:2] == 'b/':
+                path = path[2:]
+            rv[path] = set()
+    return dict([(os.path.join(parent, path), rows)
+                 for (path, rows) in rv.items()
+                 if rows and filename_match(path, patterns)])
+
+
+def filename_match(filename, patterns, default=True):
+    """
+    Check if patterns contains a pattern that matches filename.
+    If patterns is unspecified, this always returns True.
+    """
+    if not patterns:
+        return default
+    return any(fnmatch(filename, pattern) for pattern in patterns)
+
+
+##############################################################################
+# Framework to run all checks
+##############################################################################
+
+
+_checks = {'physical_line': {}, 'logical_line': {}, 'tree': {}}
+
+
+def register_check(check, codes=None):
+    """
+    Register a new check object.
+    """
+    def _add_check(check, kind, codes, args):
+        if check in _checks[kind]:
+            _checks[kind][check][0].extend(codes or [])
+        else:
+            _checks[kind][check] = (codes or [''], args)
+    if inspect.isfunction(check):
+        args = inspect.getargspec(check)[0]
+        if args and args[0] in ('physical_line', 'logical_line'):
+            if codes is None:
+                codes = ERRORCODE_REGEX.findall(check.__doc__ or '')
+            _add_check(check, args[0], codes, args)
+    elif inspect.isclass(check):
+        if inspect.getargspec(check.__init__)[0][:2] == ['self', 'tree']:
+            _add_check(check, 'tree', codes, None)
+
+
+def init_checks_registry():
+    """
+    Register all globally visible functions where the first argument name
+    is 'physical_line' or 'logical_line'.
+    """
+    mod = inspect.getmodule(register_check)
+    for (name, function) in inspect.getmembers(mod, inspect.isfunction):
+        register_check(function)
+init_checks_registry()
+
+
+class Checker(object):
+    """
+    Load a Python source file, tokenize it, check coding style.
+    """
+
+    def __init__(self, filename=None, lines=None,
+                 options=None, report=None, **kwargs):
+        if options is None:
+            options = StyleGuide(kwargs).options
+        else:
+            assert not kwargs
+        self._io_error = None
+        self._physical_checks = options.physical_checks
+        self._logical_checks = options.logical_checks
+        self._ast_checks = options.ast_checks
+        self.max_line_length = options.max_line_length
+        self.hang_closing = options.hang_closing
+        self.verbose = options.verbose
+        self.filename = filename
+        if filename is None:
+            self.filename = 'stdin'
+            self.lines = lines or []
+        elif filename == '-':
+            self.filename = 'stdin'
+            self.lines = stdin_get_value().splitlines(True)
+        elif lines is None:
+            try:
+                self.lines = readlines(filename)
+            except IOError:
+                exc_type, exc = sys.exc_info()[:2]
+                self._io_error = '%s: %s' % (exc_type.__name__, exc)
+                self.lines = []
+        else:
+            self.lines = lines
+        if self.lines:
+            ord0 = ord(self.lines[0][0])
+            if ord0 in (0xef, 0xfeff):  # Strip the UTF-8 BOM
+                if ord0 == 0xfeff:
+                    self.lines[0] = self.lines[0][1:]
+                elif self.lines[0][:3] == '\xef\xbb\xbf':
+                    self.lines[0] = self.lines[0][3:]
+        self.report = report or options.report
+        self.report_error = self.report.error
+
+    def report_invalid_syntax(self):
+        exc_type, exc = sys.exc_info()[:2]
+        if len(exc.args) > 1:
+            offset = exc.args[1]
+            if len(offset) > 2:
+                offset = offset[1:3]
+        else:
+            offset = (1, 0)
+        self.report_error(offset[0], offset[1] or 0,
+                          'E901 %s: %s' % (exc_type.__name__, exc.args[0]),
+                          self.report_invalid_syntax)
+    report_invalid_syntax.__doc__ = "    Check if the syntax is valid."
+
+    def readline(self):
+        """
+        Get the next line from the input buffer.
+        """
+        self.line_number += 1
+        if self.line_number > len(self.lines):
+            return ''
+        return self.lines[self.line_number - 1]
+
+    def readline_check_physical(self):
+        """
+        Check and return the next physical line. This method can be
+        used to feed tokenize.generate_tokens.
+        """
+        line = self.readline()
+        if line:
+            self.check_physical(line)
+        return line
+
+    def run_check(self, check, argument_names):
+        """
+        Run a check plugin.
+        """
+        arguments = []
+        for name in argument_names:
+            arguments.append(getattr(self, name))
+        return check(*arguments)
+
+    def check_physical(self, line):
+        """
+        Run all physical checks on a raw input line.
+        """
+        self.physical_line = line
+        if self.indent_char is None and line[:1] in WHITESPACE:
+            self.indent_char = line[0]
+        for name, check, argument_names in self._physical_checks:
+            result = self.run_check(check, argument_names)
+            if result is not None:
+                offset, text = result
+                self.report_error(self.line_number, offset, text, check)
+
+    def build_tokens_line(self):
+        """
+        Build a logical line from tokens.
+        """
+        self.mapping = []
+        logical = []
+        comments = []
+        length = 0
+        previous = None
+        for token in self.tokens:
+            token_type, text = token[0:2]
+            if token_type == tokenize.COMMENT:
+                comments.append(text)
+                continue
+            if token_type in SKIP_TOKENS:
+                continue
+            if token_type == tokenize.STRING:
+                text = mute_string(text)
+            if previous:
+                end_row, end = previous[3]
+                start_row, start = token[2]
+                if end_row != start_row:    # different row
+                    prev_text = self.lines[end_row - 1][end - 1]
+                    if prev_text == ',' or (prev_text not in '{[('
+                                            and text not in '}])'):
+                        logical.append(' ')
+                        length += 1
+                elif end != start:  # different column
+                    fill = self.lines[end_row - 1][end:start]
+                    logical.append(fill)
+                    length += len(fill)
+            self.mapping.append((length, token))
+            logical.append(text)
+            length += len(text)
+            previous = token
+        self.logical_line = ''.join(logical)
+        self.noqa = comments and noqa(''.join(comments))
+        # With Python 2, if the line ends with '\r\r\n' the assertion fails
+        # assert self.logical_line.strip() == self.logical_line
+
+    def check_logical(self):
+        """
+        Build a line from tokens and run all logical checks on it.
+        """
+        self.build_tokens_line()
+        self.report.increment_logical_line()
+        first_line = self.lines[self.mapping[0][1][2][0] - 1]
+        indent = first_line[:self.mapping[0][1][2][1]]
+        self.previous_indent_level = self.indent_level
+        self.indent_level = expand_indent(indent)
+        if self.verbose >= 2:
+            print(self.logical_line[:80].rstrip())
+        for name, check, argument_names in self._logical_checks:
+            if self.verbose >= 4:
+                print('   ' + name)
+            for result in self.run_check(check, argument_names):
+                offset, text = result
+                if isinstance(offset, tuple):
+                    orig_number, orig_offset = offset
+                else:
+                    for token_offset, token in self.mapping:
+                        if offset >= token_offset:
+                            orig_number = token[2][0]
+                            orig_offset = (token[2][1] + offset - token_offset)
+                self.report_error(orig_number, orig_offset, text, check)
+        self.previous_logical = self.logical_line
+
+    def check_ast(self):
+        try:
+            tree = compile(''.join(self.lines), '', 'exec', PyCF_ONLY_AST)
+        except (SyntaxError, TypeError):
+            return self.report_invalid_syntax()
+        for name, cls, _ in self._ast_checks:
+            checker = cls(tree, self.filename)
+            for lineno, offset, text, check in checker.run():
+                if not noqa(self.lines[lineno - 1]):
+                    self.report_error(lineno, offset, text, check)
+
+    def generate_tokens(self):
+        if self._io_error:
+            self.report_error(1, 0, 'E902 %s' % self._io_error, readlines)
+        tokengen = tokenize.generate_tokens(self.readline_check_physical)
+        try:
+            for token in tokengen:
+                yield token
+        except (SyntaxError, tokenize.TokenError):
+            self.report_invalid_syntax()
+
+    def check_all(self, expected=None, line_offset=0):
+        """
+        Run all checks on the input file.
+        """
+        self.report.init_file(self.filename, self.lines, expected, line_offset)
+        if self._ast_checks:
+            self.check_ast()
+        self.line_number = 0
+        self.indent_char = None
+        self.indent_level = 0
+        self.previous_logical = ''
+        self.tokens = []
+        self.blank_lines = blank_lines_before_comment = 0
+        parens = 0
+        for token in self.generate_tokens():
+            self.tokens.append(token)
+            token_type, text = token[0:2]
+            if self.verbose >= 3:
+                if token[2][0] == token[3][0]:
+                    pos = '[%s:%s]' % (token[2][1] or '', token[3][1])
+                else:
+                    pos = 'l.%s' % token[3][0]
+                print('l.%s\t%s\t%s\t%r' %
+                      (token[2][0], pos, tokenize.tok_name[token[0]], text))
+            if token_type == tokenize.OP:
+                if text in '([{':
+                    parens += 1
+                elif text in '}])':
+                    parens -= 1
+            elif not parens:
+                if token_type == tokenize.NEWLINE:
+                    if self.blank_lines < blank_lines_before_comment:
+                        self.blank_lines = blank_lines_before_comment
+                    self.check_logical()
+                    self.tokens = []
+                    self.blank_lines = blank_lines_before_comment = 0
+                elif token_type == tokenize.NL:
+                    if len(self.tokens) == 1:
+                        # The physical line contains only this token.
+                        self.blank_lines += 1
+                    self.tokens = []
+                elif token_type == tokenize.COMMENT and len(self.tokens) == 1:
+                    if blank_lines_before_comment < self.blank_lines:
+                        blank_lines_before_comment = self.blank_lines
+                    self.blank_lines = 0
+                    if COMMENT_WITH_NL:
+                        # The comment also ends a physical line
+                        self.tokens = []
+        return self.report.get_file_results()
+
+
+class BaseReport(object):
+    """Collect the results of the checks."""
+    print_filename = False
+
+    def __init__(self, options):
+        self._benchmark_keys = options.benchmark_keys
+        self._ignore_code = options.ignore_code
+        # Results
+        self.elapsed = 0
+        self.total_errors = 0
+        self.counters = dict.fromkeys(self._benchmark_keys, 0)
+        self.messages = {}
+
+    def start(self):
+        """Start the timer."""
+        self._start_time = time.time()
+
+    def stop(self):
+        """Stop the timer."""
+        self.elapsed = time.time() - self._start_time
+
+    def init_file(self, filename, lines, expected, line_offset):
+        """Signal a new file."""
+        self.filename = filename
+        self.lines = lines
+        self.expected = expected or ()
+        self.line_offset = line_offset
+        self.file_errors = 0
+        self.counters['files'] += 1
+        self.counters['physical lines'] += len(lines)
+
+    def increment_logical_line(self):
+        """Signal a new logical line."""
+        self.counters['logical lines'] += 1
+
+    def error(self, line_number, offset, text, check):
+        """Report an error, according to options."""
+        code = text[:4]
+        if self._ignore_code(code):
+            return
+        if code in self.counters:
+            self.counters[code] += 1
+        else:
+            self.counters[code] = 1
+            self.messages[code] = text[5:]
+        # Don't care about expected errors or warnings
+        if code in self.expected:
+            return
+        if self.print_filename and not self.file_errors:
+            print(self.filename)
+        self.file_errors += 1
+        self.total_errors += 1
+        return code
+
+    def get_file_results(self):
+        """Return the count of errors and warnings for this file."""
+        return self.file_errors
+
+    def get_count(self, prefix=''):
+        """Return the total count of errors and warnings."""
+        return sum([self.counters[key]
+                    for key in self.messages if key.startswith(prefix)])
+
+    def get_statistics(self, prefix=''):
+        """
+        Get statistics for message codes that start with the prefix.
+
+        prefix='' matches all errors and warnings
+        prefix='E' matches all errors
+        prefix='W' matches all warnings
+        prefix='E4' matches all errors that have to do with imports
+        """
+        return ['%-7s %s %s' % (self.counters[key], key, self.messages[key])
+                for key in sorted(self.messages) if key.startswith(prefix)]
+
+    def print_statistics(self, prefix=''):
+        """Print overall statistics (number of errors and warnings)."""
+        for line in self.get_statistics(prefix):
+            print(line)
+
+    def print_benchmark(self):
+        """Print benchmark numbers."""
+        print('%-7.2f %s' % (self.elapsed, 'seconds elapsed'))
+        if self.elapsed:
+            for key in self._benchmark_keys:
+                print('%-7d %s per second (%d total)' %
+                      (self.counters[key] / self.elapsed, key,
+                       self.counters[key]))
+
+
+class FileReport(BaseReport):
+    """Collect the results of the checks and print only the filenames."""
+    print_filename = True
+
+
+class StandardReport(BaseReport):
+    """Collect and print the results of the checks."""
+
+    def __init__(self, options):
+        super(StandardReport, self).__init__(options)
+        self._fmt = REPORT_FORMAT.get(options.format.lower(),
+                                      options.format)
+        self._repeat = options.repeat
+        self._show_source = options.show_source
+        self._show_pep8 = options.show_pep8
+
+    def init_file(self, filename, lines, expected, line_offset):
+        """Signal a new file."""
+        self._deferred_print = []
+        return super(StandardReport, self).init_file(
+            filename, lines, expected, line_offset)
+
+    def error(self, line_number, offset, text, check):
+        """Report an error, according to options."""
+        code = super(StandardReport, self).error(line_number, offset,
+                                                 text, check)
+        if code and (self.counters[code] == 1 or self._repeat):
+            self._deferred_print.append(
+                (line_number, offset, code, text[5:], check.__doc__))
+        return code
+
+    def get_file_results(self):
+        """Print the result and return the overall count for this file."""
+        self._deferred_print.sort()
+        for line_number, offset, code, text, doc in self._deferred_print:
+            print(self._fmt % {
+                'path': self.filename,
+                'row': self.line_offset + line_number, 'col': offset + 1,
+                'code': code, 'text': text,
+            })
+            if self._show_source:
+                if line_number > len(self.lines):
+                    line = ''
+                else:
+                    line = self.lines[line_number - 1]
+                print(line.rstrip())
+                print(' ' * offset + '^')
+            if self._show_pep8 and doc:
+                print(doc.lstrip('\n').rstrip())
+        return self.file_errors
+
+
+class DiffReport(StandardReport):
+    """Collect and print the results for the changed lines only."""
+
+    def __init__(self, options):
+        super(DiffReport, self).__init__(options)
+        self._selected = options.selected_lines
+
+    def error(self, line_number, offset, text, check):
+        if line_number not in self._selected[self.filename]:
+            return
+        return super(DiffReport, self).error(line_number, offset, text, check)
+
+
+class StyleGuide(object):
+    """Initialize a PEP-8 instance with few options."""
+
+    def __init__(self, *args, **kwargs):
+        # build options from the command line
+        self.checker_class = kwargs.pop('checker_class', Checker)
+        parse_argv = kwargs.pop('parse_argv', False)
+        config_file = kwargs.pop('config_file', None)
+        parser = kwargs.pop('parser', None)
+        options, self.paths = process_options(
+            parse_argv=parse_argv, config_file=config_file, parser=parser)
+        if args or kwargs:
+            # build options from dict
+            options_dict = dict(*args, **kwargs)
+            options.__dict__.update(options_dict)
+            if 'paths' in options_dict:
+                self.paths = options_dict['paths']
+
+        self.runner = self.input_file
+        self.options = options
+
+        if not options.reporter:
+            options.reporter = BaseReport if options.quiet else StandardReport
+
+        for index, value in enumerate(options.exclude):
+            options.exclude[index] = value.rstrip('/')
+        options.select = tuple(options.select or ())
+        if not (options.select or options.ignore or
+                options.testsuite or options.doctest) and DEFAULT_IGNORE:
+            # The default choice: ignore controversial checks
+            options.ignore = tuple(DEFAULT_IGNORE.split(','))
+        else:
+            # Ignore all checks which are not explicitly selected
+            options.ignore = ('',) if options.select else tuple(options.ignore)
+        options.benchmark_keys = BENCHMARK_KEYS[:]
+        options.ignore_code = self.ignore_code
+        options.physical_checks = self.get_checks('physical_line')
+        options.logical_checks = self.get_checks('logical_line')
+        options.ast_checks = self.get_checks('tree')
+        self.init_report()
+
+    def init_report(self, reporter=None):
+        """Initialize the report instance."""
+        self.options.report = (reporter or self.options.reporter)(self.options)
+        return self.options.report
+
+    def check_files(self, paths=None):
+        """Run all checks on the paths."""
+        if paths is None:
+            paths = self.paths
+        report = self.options.report
+        runner = self.runner
+        report.start()
+        try:
+            for path in paths:
+                if os.path.isdir(path):
+                    self.input_dir(path)
+                elif not self.excluded(path):
+                    runner(path)
+        except KeyboardInterrupt:
+            print('... stopped')
+        report.stop()
+        return report
+
+    def input_file(self, filename, lines=None, expected=None, line_offset=0):
+        """Run all checks on a Python source file."""
+        if self.options.verbose:
+            print('checking %s' % filename)
+        fchecker = self.checker_class(
+            filename, lines=lines, options=self.options)
+        return fchecker.check_all(expected=expected, line_offset=line_offset)
+
+    def input_dir(self, dirname):
+        """Check all files in this directory and all subdirectories."""
+        dirname = dirname.rstrip('/')
+        if self.excluded(dirname):
+            return 0
+        counters = self.options.report.counters
+        verbose = self.options.verbose
+        filepatterns = self.options.filename
+        runner = self.runner
+        for root, dirs, files in os.walk(dirname):
+            if verbose:
+                print('directory ' + root)
+            counters['directories'] += 1
+            for subdir in sorted(dirs):
+                if self.excluded(subdir, root):
+                    dirs.remove(subdir)
+            for filename in sorted(files):
+                # contain a pattern that matches?
+                if ((filename_match(filename, filepatterns) and
+                     not self.excluded(filename, root))):
+                    runner(os.path.join(root, filename))
+
+    def excluded(self, filename, parent=None):
+        """
+        Check if options.exclude contains a pattern that matches filename.
+        """
+        if not self.options.exclude:
+            return False
+        basename = os.path.basename(filename)
+        if filename_match(basename, self.options.exclude):
+            return True
+        if parent:
+            filename = os.path.join(parent, filename)
+        return filename_match(filename, self.options.exclude)
+
+    def ignore_code(self, code):
+        """
+        Check if the error code should be ignored.
+
+        If 'options.select' contains a prefix of the error code,
+        return False.  Else, if 'options.ignore' contains a prefix of
+        the error code, return True.
+        """
+        return (code.startswith(self.options.ignore) and
+                not code.startswith(self.options.select))
+
+    def get_checks(self, argument_name):
+        """
+        Find all globally visible functions where the first argument name
+        starts with argument_name and which contain selected tests.
+        """
+        checks = []
+        for check, attrs in _checks[argument_name].items():
+            (codes, args) = attrs
+            if any(not (code and self.ignore_code(code)) for code in codes):
+                checks.append((check.__name__, check, args))
+        return sorted(checks)
+
+
+def get_parser(prog='pep8', version=__version__):
+    parser = OptionParser(prog=prog, version=version,
+                          usage="%prog [options] input ...")
+    parser.config_options = [
+        'exclude', 'filename', 'select', 'ignore', 'max-line-length',
+        'hang-closing', 'count', 'format', 'quiet', 'show-pep8',
+        'show-source', 'statistics', 'verbose']
+    parser.add_option('-v', '--verbose', default=0, action='count',
+                      help="print status messages, or debug with -vv")
+    parser.add_option('-q', '--quiet', default=0, action='count',
+                      help="report only file names, or nothing with -qq")
+    parser.add_option('-r', '--repeat', default=True, action='store_true',
+                      help="(obsolete) show all occurrences of the same error")
+    parser.add_option('--first', action='store_false', dest='repeat',
+                      help="show first occurrence of each error")
+    parser.add_option('--exclude', metavar='patterns', default=DEFAULT_EXCLUDE,
+                      help="exclude files or directories which match these "
+                           "comma separated patterns (default: %default)")
+    parser.add_option('--filename', metavar='patterns', default='*.py',
+                      help="when parsing directories, only check filenames "
+                           "matching these comma separated patterns "
+                           "(default: %default)")
+    parser.add_option('--select', metavar='errors', default='',
+                      help="select errors and warnings (e.g. E,W6)")
+    parser.add_option('--ignore', metavar='errors', default='',
+                      help="skip errors and warnings (e.g. E4,W)")
+    parser.add_option('--show-source', action='store_true',
+                      help="show source code for each error")
+    parser.add_option('--show-pep8', action='store_true',
+                      help="show text of PEP 8 for each error "
+                           "(implies --first)")
+    parser.add_option('--statistics', action='store_true',
+                      help="count errors and warnings")
+    parser.add_option('--count', action='store_true',
+                      help="print total number of errors and warnings "
+                           "to standard error and set exit code to 1 if "
+                           "total is not null")
+    parser.add_option('--max-line-length', type='int', metavar='n',
+                      default=MAX_LINE_LENGTH,
+                      help="set maximum allowed line length "
+                           "(default: %default)")
+    parser.add_option('--hang-closing', action='store_true',
+                      help="hang closing bracket instead of matching "
+                           "indentation of opening bracket's line")
+    parser.add_option('--format', metavar='format', default='default',
+                      help="set the error format [default|pylint|<custom>]")
+    parser.add_option('--diff', action='store_true',
+                      help="report only lines changed according to the "
+                           "unified diff received on STDIN")
+    group = parser.add_option_group("Testing Options")
+    if os.path.exists(TESTSUITE_PATH):
+        group.add_option('--testsuite', metavar='dir',
+                         help="run regression tests from dir")
+        group.add_option('--doctest', action='store_true',
+                         help="run doctest on myself")
+    group.add_option('--benchmark', action='store_true',
+                     help="measure processing speed")
+    return parser
+
+
+def read_config(options, args, arglist, parser):
+    """Read both user configuration and local configuration."""
+    config = RawConfigParser()
+
+    user_conf = options.config
+    if user_conf and os.path.isfile(user_conf):
+        if options.verbose:
+            print('user configuration: %s' % user_conf)
+        config.read(user_conf)
+
+    parent = tail = args and os.path.abspath(os.path.commonprefix(args))
+    while tail:
+        if config.read([os.path.join(parent, fn) for fn in PROJECT_CONFIG]):
+            if options.verbose:
+                print('local configuration: in %s' % parent)
+            break
+        parent, tail = os.path.split(parent)
+
+    pep8_section = parser.prog
+    if config.has_section(pep8_section):
+        option_list = dict([(o.dest, o.type or o.action)
+                            for o in parser.option_list])
+
+        # First, read the default values
+        new_options, _ = parser.parse_args([])
+
+        # Second, parse the configuration
+        for opt in config.options(pep8_section):
+            if options.verbose > 1:
+                print("  %s = %s" % (opt, config.get(pep8_section, opt)))
+            if opt.replace('_', '-') not in parser.config_options:
+                print("Unknown option: '%s'\n  not in [%s]" %
+                      (opt, ' '.join(parser.config_options)))
+                sys.exit(1)
+            normalized_opt = opt.replace('-', '_')
+            opt_type = option_list[normalized_opt]
+            if opt_type in ('int', 'count'):
+                value = config.getint(pep8_section, opt)
+            elif opt_type == 'string':
+                value = config.get(pep8_section, opt)
+            else:
+                assert opt_type in ('store_true', 'store_false')
+                value = config.getboolean(pep8_section, opt)
+            setattr(new_options, normalized_opt, value)
+
+        # Third, overwrite with the command-line options
+        options, _ = parser.parse_args(arglist, values=new_options)
+    options.doctest = options.testsuite = False
+    return options
+
+
+def process_options(arglist=None, parse_argv=False, config_file=None,
+                    parser=None):
+    """Process options passed either via arglist or via command line args."""
+    if not arglist and not parse_argv:
+        # Don't read the command line if the module is used as a library.
+        arglist = []
+    if not parser:
+        parser = get_parser()
+    if not parser.has_option('--config'):
+        if config_file is True:
+            config_file = DEFAULT_CONFIG
+        group = parser.add_option_group("Configuration", description=(
+            "The project options are read from the [%s] section of the "
+            "tox.ini file or the setup.cfg file located in any parent folder "
+            "of the path(s) being processed.  Allowed options are: %s." %
+            (parser.prog, ', '.join(parser.config_options))))
+        group.add_option('--config', metavar='path', default=config_file,
+                         help="user config file location (default: %default)")
+    options, args = parser.parse_args(arglist)
+    options.reporter = None
+
+    if options.ensure_value('testsuite', False):
+        args.append(options.testsuite)
+    elif not options.ensure_value('doctest', False):
+        if parse_argv and not args:
+            if options.diff or any(os.path.exists(name)
+                                   for name in PROJECT_CONFIG):
+                args = ['.']
+            else:
+                parser.error('input not specified')
+        options = read_config(options, args, arglist, parser)
+        options.reporter = parse_argv and options.quiet == 1 and FileReport
+
+    options.filename = options.filename and options.filename.split(',')
+    options.exclude = options.exclude.split(',')
+    options.select = options.select and options.select.split(',')
+    options.ignore = options.ignore and options.ignore.split(',')
+
+    if options.diff:
+        options.reporter = DiffReport
+        stdin = stdin_get_value()
+        options.selected_lines = parse_udiff(stdin, options.filename, args[0])
+        args = sorted(options.selected_lines)
+
+    return options, args
+
+
+def _main():
+    """Parse options and run checks on Python source."""
+    pep8style = StyleGuide(parse_argv=True, config_file=True)
+    options = pep8style.options
+    if options.doctest or options.testsuite:
+        from testsuite.support import run_tests
+        report = run_tests(pep8style)
+    else:
+        report = pep8style.check_files()
+    if options.statistics:
+        report.print_statistics()
+    if options.benchmark:
+        report.print_benchmark()
+    if options.testsuite and not options.quiet:
+        report.print_results()
+    if report.total_errors:
+        if options.count:
+            sys.stderr.write(str(report.total_errors) + '\n')
+        sys.exit(1)
+
+if __name__ == '__main__':
+    _main()
new file mode 100644
--- /dev/null
+++ b/pep8/setup.cfg
@@ -0,0 +1,5 @@
+[egg_info]
+tag_build = 
+tag_date = 0
+tag_svn_revision = 0
+
new file mode 100644
--- /dev/null
+++ b/pep8/setup.py
@@ -0,0 +1,56 @@
+# -*- coding: utf-8 -*-
+from __future__ import with_statement
+from setuptools import setup
+
+
+def get_version():
+    with open('pep8.py') as f:
+        for line in f:
+            if line.startswith('__version__'):
+                return eval(line.split('=')[-1])
+
+
+def get_long_description():
+    descr = []
+    for fname in 'README.rst', 'CHANGES.txt':
+        with open(fname) as f:
+            descr.append(f.read())
+    return '\n\n'.join(descr)
+
+
+setup(
+    name='pep8',
+    version=get_version(),
+    description="Python style guide checker",
+    long_description=get_long_description(),
+    keywords='pep8',
+    author='Johann C. Rocholl',
+    author_email='johann@rocholl.net',
+    url='http://pep8.readthedocs.org/',
+    license='Expat license',
+    py_modules=['pep8'],
+    namespace_packages=[],
+    include_package_data=True,
+    zip_safe=False,
+    install_requires=[
+        # Broken with Python 3: https://github.com/pypa/pip/issues/650
+        # 'setuptools',
+    ],
+    entry_points={
+        'console_scripts': [
+            'pep8 = pep8:_main',
+        ],
+    },
+    classifiers=[
+        'Development Status :: 5 - Production/Stable',
+        'Environment :: Console',
+        'Intended Audience :: Developers',
+        'License :: OSI Approved :: MIT License',
+        'Operating System :: OS Independent',
+        'Programming Language :: Python',
+        'Programming Language :: Python :: 2',
+        'Programming Language :: Python :: 3',
+        'Topic :: Software Development :: Libraries :: Python Modules',
+    ],
+    test_suite='testsuite.test_all.suite',
+)
new file mode 100644
--- /dev/null
+++ b/pep8/testsuite/E10.py
@@ -0,0 +1,5 @@
+#: E101 W191
+for a in 'abc':
+    for b in 'xyz':
+        print a  # indented with 8 spaces
+	print b  # indented with 1 tab
new file mode 100644
--- /dev/null
+++ b/pep8/testsuite/E11.py
@@ -0,0 +1,12 @@
+#: E111
+if x > 2:
+  print x
+#: E111
+if True:
+     print
+#: E112
+if False:
+print
+#: E113
+print
+    print
new file mode 100644
--- /dev/null
+++ b/pep8/testsuite/E12.py
@@ -0,0 +1,343 @@
+#: E121
+print "E121", (
+  "dent")
+#: E122
+print "E122", (
+"dent")
+#: E123
+my_list = [
+    1, 2, 3,
+    4, 5, 6,
+    ]
+#: E124
+print "E124", ("visual",
+               "indent_two"
+              )
+#: E124
+print "E124", ("visual",
+               "indent_five"
+)
+#: E124
+a = (123,
+)
+#: E125
+if (row < 0 or self.moduleCount <= row or
+    col < 0 or self.moduleCount <= col):
+    raise Exception("%s,%s - %s" % (row, col, self.moduleCount))
+#: E126
+print "E126", (
+            "dent")
+#: E126
+print "E126", (
+        "dent")
+#: E127
+print "E127", ("over-",
+                  "over-indent")
+#: E128
+print "E128", ("visual",
+    "hanging")
+#: E128
+print "E128", ("under-",
+              "under-indent")
+#:
+
+
+#: E121
+my_list = [
+    1, 2, 3,
+    4, 5, 6,
+     ]
+#: E121
+result = {
+   'key1': 'value',
+   'key2': 'value',
+}
+#: E121
+rv.update(dict.fromkeys((
+    'qualif_nr', 'reasonComment_en', 'reasonComment_fr',
+    'reasonComment_de', 'reasonComment_it'),
+          '?'),
+          "foo")
+#: E121
+abricot = 3 + \
+          4 + \
+          5 + 6
+#: E121
+print "hello", (
+
+    "there",
+     # "john",
+    "dude")
+#: E121
+part = set_mimetype((
+    a.get('mime_type', 'text')),
+                       'default')
+#:
+
+
+#: E122
+if True:
+    result = some_function_that_takes_arguments(
+        'a', 'b', 'c',
+        'd', 'e', 'f',
+)
+#: E122
+if some_very_very_very_long_variable_name or var \
+or another_very_long_variable_name:
+    raise Exception()
+#: E122
+if some_very_very_very_long_variable_name or var[0] \
+or another_very_long_variable_name:
+    raise Exception()
+#: E122
+if True:
+    if some_very_very_very_long_variable_name or var \
+    or another_very_long_variable_name:
+        raise Exception()
+#: E122
+if True:
+    if some_very_very_very_long_variable_name or var[0] \
+    or another_very_long_variable_name:
+        raise Exception()
+#: E122
+dictionary = [
+    "is": {
+    "nested": yes(),
+    },
+]
+#: E122
+setup('',
+      scripts=[''],
+      classifiers=[
+      'Development Status :: 4 - Beta',
+          'Environment :: Console',
+          'Intended Audience :: Developers',
+      ])
+#:
+
+
+#: E123 W291
+print "E123", (   
+    "bad", "hanging", "close"
+    )
+#
+#: E123
+result = {
+    'foo': [
+        'bar', {
+            'baz': 'frop',
+            }
+        ]
+    }
+#: E123
+result = some_function_that_takes_arguments(
+    'a', 'b', 'c',
+    'd', 'e', 'f',
+    )
+#: E124
+my_list = [1, 2, 3,
+           4, 5, 6,
+]
+#: E124
+my_list = [1, 2, 3,
+           4, 5, 6,
+                   ]
+#: E124
+result = some_function_that_takes_arguments('a', 'b', 'c',
+                                            'd', 'e', 'f',
+)
+#: E124
+fooff(aaaa,
+      cca(
+          vvv,
+          dadd
+      ), fff,
+)
+#: E124
+fooff(aaaa,
+      ccaaa(
+          vvv,
+          dadd
+      ),
+      fff,
+)
+#: E124
+d = dict('foo',
+         help="exclude files or directories which match these "
+              "comma separated patterns (default: %s)" % DEFAULT_EXCLUDE
+              )
+#: E124 E128
+if line_removed:
+    self.event(cr, uid,
+        name="Removing the option for contract",
+        description="contract line has been removed",
+        )
+#:
+
+
+#: E125
+if foo is None and bar is "frop" and \
+    blah == 'yeah':
+    blah = 'yeahnah'
+#: E125
+# Further indentation required as indentation is not distinguishable
+
+
+def long_function_name(
+    var_one, var_two, var_three,
+    var_four):
+    print(var_one)
+#
+#: E125
+
+
+def qualify_by_address(
+    self, cr, uid, ids, context=None,
+    params_to_check=frozenset(QUALIF_BY_ADDRESS_PARAM)):
+    """ This gets called by the web server """
+#: E125
+if (a == 2 or
+    b == "abc def ghi"
+    "jkl mno"):
+    return True
+#:
+
+
+#: E126
+my_list = [
+    1, 2, 3,
+    4, 5, 6,
+        ]
+#: E126
+abris = 3 + \
+        4 + \
+        5 + 6
+#: E126
+fixed = re.sub(r'\t+', ' ', target[c::-1], 1)[::-1] + \
+        target[c + 1:]
+#: E126
+rv.update(dict.fromkeys((
+            'qualif_nr', 'reasonComment_en', 'reasonComment_fr',
+            'reasonComment_de', 'reasonComment_it'),
+        '?'),
+    "foo")
+#: E126
+eat_a_dict_a_day({
+        "foo": "bar",
+})
+#: E126
+if (
+    x == (
+            3
+    ) or
+        y == 4):
+    pass
+#: E126
+if (
+    x == (
+        3
+    ) or
+    x == (
+            3
+    ) or
+        y == 4):
+    pass
+#: E126
+troublesome_hash = {
+    "hash": "value",
+    "long": "the quick brown fox jumps over the lazy dog before doing a "
+        "somersault",
+}
+#: E126
+# probably not easily fixed, without using 'ast'
+troublesome_hash_ii = {
+    "long key that tends to happen more when you're indented":
+        "stringwithalongtoken you don't want to break",
+}
+#:
+
+
+#: E128
+# Arguments on first line forbidden when not using vertical alignment
+foo = long_function_name(var_one, var_two,
+    var_three, var_four)
+#
+#: E128
+print('l.%s\t%s\t%s\t%r' %
+    (token[2][0], pos, tokenize.tok_name[token[0]], token[1]))
+#: E128
+
+
+def qualify_by_address(self, cr, uid, ids, context=None,
+        params_to_check=frozenset(QUALIF_BY_ADDRESS_PARAM)):
+    """ This gets called by the web server """
+#:
+
+
+#: E128
+foo(1, 2, 3,
+4, 5, 6)
+#: E128
+foo(1, 2, 3,
+ 4, 5, 6)
+#: E128
+foo(1, 2, 3,
+  4, 5, 6)
+#: E128
+foo(1, 2, 3,
+   4, 5, 6)
+#: E127
+foo(1, 2, 3,
+     4, 5, 6)
+#: E127
+foo(1, 2, 3,
+      4, 5, 6)
+#: E127
+foo(1, 2, 3,
+       4, 5, 6)
+#: E127
+foo(1, 2, 3,
+        4, 5, 6)
+#: E127
+foo(1, 2, 3,
+         4, 5, 6)
+#: E127
+foo(1, 2, 3,
+          4, 5, 6)
+#: E127
+foo(1, 2, 3,
+           4, 5, 6)
+#: E127
+foo(1, 2, 3,
+            4, 5, 6)
+#: E127
+foo(1, 2, 3,
+             4, 5, 6)
+#: E128
+if line_removed:
+    self.event(cr, uid,
+              name="Removing the option for contract",
+              description="contract line has been removed",
+               )
+#: E124 E127
+if line_removed:
+    self.event(cr, uid,
+                name="Removing the option for contract",
+                description="contract line has been removed",
+                )
+#: E127
+rv.update(d=('a', 'b', 'c'),
+             e=42)
+#
+#: E127
+rv.update(d=('a' + 'b', 'c'),
+          e=42, f=42
+                 + 42)
+#: E127
+input1 = {'a': {'calc': 1 + 2}, 'b': 1
+                          + 42}
+#: E128
+rv.update(d=('a' + 'b', 'c'),
+          e=42, f=(42
+                 + 42))
+#:
new file mode 100644
--- /dev/null
+++ b/pep8/testsuite/E12not.py
@@ -0,0 +1,581 @@
+if (
+        x == (
+            3
+        ) or
+        y == 4):
+    pass
+
+y = x == 2 \
+    or x == 3
+
+if x == 2 \
+    or y > 1 \
+        or x == 3:
+    pass
+
+if x == 2 \
+        or y > 1 \
+        or x == 3:
+    pass
+
+
+if (foo == bar and
+        baz == frop):
+    pass
+
+if (
+    foo == bar and
+    baz == frop
+):
+    pass
+
+
+a = (
+)
+
+a = (123,
+     )
+
+
+#
+
+
+if start[1] > end_col and not (
+        over_indent == 4 and indent_next):
+    return(0, "E121 continuation line over-"
+           "indented for visual indent")
+
+
+print "OK", ("visual",
+             "indent")
+
+print "Okay", ("visual",
+               "indent_three"
+               )
+
+print "a-ok", (
+    "there",
+    "dude",
+)
+
+print "hello", (
+    "there",
+    "dude")
+
+print "hello", (
+
+    "there",
+    # "john",
+    "dude")
+
+print "hello", (
+    "there", "dude")
+
+print "hello", (
+    "there", "dude",
+)
+
+# Aligned with opening delimiter
+foo = long_function_name(var_one, var_two,
+                         var_three, var_four)
+
+#
+# Extra indentation is not necessary.
+foo = long_function_name(
+    var_one, var_two,
+    var_three, var_four)
+
+
+arm = 'AAA'    \
+      'BBB'    \
+      'CCC'
+
+bbb = 'AAA'    \
+      'BBB'    \
+      'CCC'
+
+cc = ('AAA'
+      'BBB'
+      'CCC')
+
+cc = {'text': 'AAA'
+              'BBB'
+              'CCC'}
+
+cc = dict(text='AAA'
+               'BBB')
+
+sat = 'AAA'    \
+      'BBB'    \
+      'iii'    \
+      'CCC'
+
+abricot = (3 +
+           4 +
+           5 + 6)
+
+abricot = 3 + \
+    4 + \
+    5 + 6
+
+part = [-1, 2, 3,
+        4, 5, 6]
+
+part = [-1, (2, 3,
+        4, 5, 6), 7,
+        8, 9, 0]
+
+fnct(1, 2, 3,
+     4, 5, 6)
+
+fnct(1, 2, 3
+     4, 5, 6,
+     7, 8, 9,
+     10, 11)
+
+
+def long_function_name(
+        var_one, var_two, var_three,
+        var_four):
+    print(var_one)
+
+if ((row < 0 or self.moduleCount <= row or
+     col < 0 or self.moduleCount <= col)):
+    raise Exception("%s,%s - %s" % (row, col, self.moduleCount))
+
+
+result = {
+    'foo': [
+        'bar', {
+            'baz': 'frop',
+        }
+    ]
+}
+
+
+foo = my.func({
+    "foo": "bar",
+}, "baz")
+
+
+#
+
+fooff(aaaa,
+      cca(
+          vvv,
+          dadd
+      ), fff,
+      ggg)
+
+fooff(aaaa,
+      abbb,
+      cca(
+          vvv,
+          aaa,
+          dadd),
+      "visual indentation is not a multiple of four",)
+#
+
+if bar:
+    return(
+        start, 'E121 lines starting with a '
+        'closing bracket should be indented '
+        "to match that of the opening "
+        "bracket's line"
+    )
+#
+# you want vertical alignment, so use a parens
+if ((foo.bar("baz") and
+     foo.bar("frop")
+     )):
+    print "yes"
+
+# also ok, but starting to look like LISP
+if ((foo.bar("baz") and
+     foo.bar("frop"))):
+    print "yes"
+
+if (a == 2 or
+    b == "abc def ghi"
+         "jkl mno"):
+    return True
+
+if (a == 2 or
+    b == """abc def ghi
+jkl mno"""):
+    return True
+
+if length > options.max_line_length:
+    return options.max_line_length, \
+        "E501 line too long (%d characters)" % length
+
+
+#
+
+
+print 'l.{line}\t{pos}\t{name}\t{text}'.format(
+    line=token[2][0],
+    pos=pos,
+    name=tokenize.tok_name[token[0]],
+    text=repr(token[1]),
+)
+
+print('%-7d %s per second (%d total)' % (
+      options.counters[key] / elapsed, key,
+      options.counters[key]))
+
+
+if os.path.exists(os.path.join(path, PEP8_BIN)):
+    cmd = ([os.path.join(path, PEP8_BIN)] +
+           self._pep8_options(targetfile))
+
+
+fixed = (re.sub(r'\t+', ' ', target[c::-1], 1)[::-1] +
+         target[c + 1:])
+
+fixed = (
+    re.sub(r'\t+', ' ', target[c::-1], 1)[::-1] +
+    target[c + 1:]
+)
+
+
+if foo is None and bar is "frop" and \
+        blah == 'yeah':
+    blah = 'yeahnah'
+
+
+"""This is a multi-line
+   docstring."""
+
+
+if blah:
+    # is this actually readable?  :)
+    multiline_literal = """
+while True:
+    if True:
+        1
+""".lstrip()
+    multiline_literal = (
+        """
+while True:
+    if True:
+        1
+""".lstrip()
+    )
+    multiline_literal = (
+        """
+while True:
+    if True:
+        1
+"""
+        .lstrip()
+    )
+
+
+if blah:
+    multiline_visual = ("""
+while True:
+    if True:
+        1
+"""
+                        .lstrip())
+
+
+rv = {'aaa': 42}
+rv.update(dict.fromkeys((
+    'qualif_nr', 'reasonComment_en', 'reasonComment_fr',
+    'reasonComment_de', 'reasonComment_it'), '?'))
+
+rv.update(dict.fromkeys(('qualif_nr', 'reasonComment_en',
+                         'reasonComment_fr', 'reasonComment_de',
+                         'reasonComment_it'), '?'))
+
+rv.update(dict.fromkeys(('qualif_nr', 'reasonComment_en', 'reasonComment_fr',
+          'reasonComment_de', 'reasonComment_it'), '?'))
+
+
+rv.update(dict.fromkeys(
+    ('qualif_nr', 'reasonComment_en', 'reasonComment_fr',
+     'reasonComment_de', 'reasonComment_it'), '?'
+), "foo", context={
+    'alpha': 4, 'beta': 53242234, 'gamma': 17,
+})
+
+
+rv.update(
+    dict.fromkeys((
+        'qualif_nr', 'reasonComment_en', 'reasonComment_fr',
+        'reasonComment_de', 'reasonComment_it'), '?'),
+    "foo",
+    context={
+        'alpha': 4, 'beta': 53242234, 'gamma': 17,
+    },
+)
+
+
+#
+
+
+event_obj.write(cursor, user_id, {
+    'user': user,
+    'summary': text,
+    'data': data,
+})
+
+event_obj.write(cursor, user_id, {
+    'user': user,
+    'summary': text,
+    'data': {'aaa': 1, 'bbb': 2},
+})
+
+event_obj.write(cursor, user_id, {
+    'user': user,
+    'summary': text,
+    'data': {
+        'aaa': 1,
+        'bbb': 2},
+})
+
+event_obj.write(cursor, user_id, {
+    'user': user,
+    'summary': text,
+    'data': {'timestamp': now, 'content': {
+        'aaa': 1,
+        'bbb': 2
+    }},
+})
+
+
+def qualify_by_address(
+        self, cr, uid, ids, context=None,
+        params_to_check=frozenset(QUALIF_BY_ADDRESS_PARAM)):
+    """ This gets called by the web server """
+
+
+def qualify_by_address(self, cr, uid, ids, context=None,
+                       params_to_check=frozenset(QUALIF_BY_ADDRESS_PARAM)):
+    """ This gets called by the web server """
+
+
+_ipv4_re = re.compile('^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.'
+                      '(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.'
+                      '(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.'
+                      '(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$')
+
+
+fct("""
+    AAA """ + status_2_string)
+
+
+if context:
+    msg = """\
+action: GET-CONFIG
+payload:
+    ip_address: "%(ip)s"
+    username: "%(username)s"
+""" % context
+
+
+if context:
+    msg = """\
+action: \
+GET-CONFIG
+""" % context
+
+
+if context:
+    msg = """\
+action: """\
+"""GET-CONFIG
+""" % context
+
+
+def unicode2html(s):
+    """Convert the characters &<>'" in string s to HTML-safe sequences.
+    Convert newline to <br> too."""
+    return unicode((s or '').replace('&', '&amp;')
+                            .replace('>', '&gt;')
+                            .replace('<', '&lt;')
+                            .replace("'", '&#39;')
+                            .replace('"', '&#34;')
+                            .replace('\n', '<br>\n'))
+
+#
+parser.add_option('--count', action='store_true',
+                  help="print total number of errors and warnings "
+                       "to standard error and set exit code to 1 if "
+                       "total is not null")
+
+parser.add_option('--exclude', metavar='patterns', default=DEFAULT_EXCLUDE,
+                  help="exclude files or directories which match these "
+                       "comma separated patterns (default: %s)" %
+                       DEFAULT_EXCLUDE)
+
+add_option('--count',
+           help="print total number of errors "
+           "to standard error total is not null")
+
+add_option('--count',
+           help="print total number of errors "
+                "to standard error "
+                "total is not null")
+
+
+#
+
+
+help = ("print total number of errors " +
+        "to standard error")
+
+help = "print total number of errors " \
+       "to standard error"
+
+help = u"print total number of errors " \
+       u"to standard error"
+
+help = ur"print total number of errors " \
+       ur"to standard error"
+
+help = b"print total number of errors " \
+       b"to standard error"
+
+help = br"print total number of errors " \
+       br"to standard error"
+
+d = dict('foo', help="exclude files or directories which match these "
+                     "comma separated patterns (default: %s)" %
+                     DEFAULT_EXCLUDE)
+
+d = dict('foo', help=u"exclude files or directories which match these "
+                     u"comma separated patterns (default: %s)" %
+                     DEFAULT_EXCLUDE)
+
+d = dict('foo', help=b"exclude files or directories which match these "
+                     b"comma separated patterns (default: %s)" %
+                     DEFAULT_EXCLUDE)
+
+d = dict('foo', help=br"exclude files or directories which match these "
+                     br"comma separated patterns (default: %s)" %
+                     DEFAULT_EXCLUDE)
+
+d = dict('foo',
+         help="exclude files or directories which match these "
+              "comma separated patterns (default: %s)" %
+              DEFAULT_EXCLUDE)
+
+d = dict('foo',
+         help="exclude files or directories which match these "
+              "comma separated patterns (default: %s, %s)" %
+              (DEFAULT_EXCLUDE, DEFAULT_IGNORE)
+         )
+
+d = dict('foo',
+         help="exclude files or directories which match these "
+              "comma separated patterns (default: %s, %s)" %
+              # who knows what might happen here?
+              (DEFAULT_EXCLUDE, DEFAULT_IGNORE)
+         )
+
+# parens used to allow the indenting.
+troublefree_hash = {
+    "hash": "value",
+    "long": ("the quick brown fox jumps over the lazy dog before doing a "
+             "somersault"),
+    "long key that tends to happen more when you're indented": (
+        "stringwithalongtoken you don't want to break"
+    ),
+}
+
+# another accepted form
+troublefree_hash = {
+    "hash": "value",
+    "long": "the quick brown fox jumps over the lazy dog before doing "
+            "a somersault",
+    ("long key that tends to happen more "
+     "when you're indented"): "stringwithalongtoken you don't want to break",
+}
+# confusing but accepted... don't do that
+troublesome_hash = {
+    "hash": "value",
+    "long": "the quick brown fox jumps over the lazy dog before doing a "
+    "somersault",
+    "long key that tends to happen more "
+    "when you're indented": "stringwithalongtoken you don't want to break",
+}
+
+#
+d = dict('foo',
+         help="exclude files or directories which match these "
+              "comma separated patterns (default: %s)" %
+              DEFAULT_EXCLUDE
+         )
+d = dict('foo',
+         help="exclude files or directories which match these "
+              "comma separated patterns (default: %s)" % DEFAULT_EXCLUDE,
+         foobar="this clearly should work, because it is at "
+                "the right indent level",
+         )
+
+rv.update(dict.fromkeys(
+          ('qualif_nr', 'reasonComment_en', 'reasonComment_fr',
+           'reasonComment_de', 'reasonComment_it'),
+          '?'), "foo",
+          context={'alpha': 4, 'beta': 53242234, 'gamma': 17})
+
+
+def f():
+    try:
+        if not Debug:
+            print('''
+If you would like to see debugging output,
+try: %s -d5
+''' % sys.argv[0])
+
+
+d = {  # comment
+    1: 2
+}
+
+# issue 138
+[
+    12,  # this is a multi-line inline
+         # comment
+]
+# issue 151
+if a > b and \
+   c > d:
+    moo_like_a_cow()
+#
+my_list = [
+    1, 2, 3,
+    4, 5, 6,
+]
+
+my_list = [1, 2, 3,
+           4, 5, 6,
+           ]
+
+result = some_function_that_takes_arguments(
+    'a', 'b', 'c',
+    'd', 'e', 'f',
+)
+
+result = some_function_that_takes_arguments('a', 'b', 'c',
+                                            'd', 'e', 'f',
+                                            )
+
+# issue 203
+dica = {
+    ('abc'
+     'def'): (
+        'abc'),
+}
+
+(abcdef[0]
+       [1]) = (
+    'abc')
+
+('abc'
+ 'def') == (
+    'abc')
+#
new file mode 100644
--- /dev/null
+++ b/pep8/testsuite/E20.py
@@ -0,0 +1,55 @@
+#: E201
+spam( ham[1], {eggs: 2})
+#: E201
+spam(ham[ 1], {eggs: 2})
+#: E201
+spam(ham[1], { eggs: 2})
+#: Okay
+spam(ham[1], {eggs: 2})
+#:
+
+
+#: E202
+spam(ham[1], {eggs: 2} )
+#: E202
+spam(ham[1], {eggs: 2 })
+#: E202
+spam(ham[1 ], {eggs: 2})
+#: Okay
+spam(ham[1], {eggs: 2})
+
+result = func(
+    arg1='some value',
+    arg2='another value',
+)
+
+result = func(
+    arg1='some value',
+    arg2='another value'
+)
+
+result = [
+    item for item in items
+    if item > 5
+]
+#:
+
+
+#: E203
+if x == 4 :
+    print x, y
+    x, y = y, x
+#: E203 E702
+if x == 4:
+    print x, y ; x, y = y, x
+#: E203
+if x == 4:
+    print x, y
+    x, y = y , x
+#: Okay
+if x == 4:
+    print x, y
+    x, y = y, x
+a[b1, :] == a[b1, ...]
+b = a[:, b1]
+#:
new file mode 100644
--- /dev/null
+++ b/pep8/testsuite/E21.py
@@ -0,0 +1,14 @@
+#: E211
+spam (1)
+#: E211
+dict ['key'] = list [index]
+#: E211
+dict['key'] ['subkey'] = list[index]
+#: Okay
+spam(1)
+dict['key'] = list[index]
+
+
+# This is not prohibited by PEP8, but avoid it.
+class Foo (Bar, Baz):
+    pass
new file mode 100644
--- /dev/null
+++ b/pep8/testsuite/E22.py
@@ -0,0 +1,148 @@
+#: E221
+a = 12 + 3
+b = 4  + 5
+#: E221
+x             = 1
+y             = 2
+long_variable = 3
+#: E221
+x[0]          = 1
+x[1]          = 2
+long_variable = 3
+#: E221
+x = f(x)          + 1
+y = long_variable + 2
+z = x[0]          + 3
+#: Okay
+x = 1
+y = 2
+long_variable = 3
+#:
+
+
+#: E222
+a = a +  1
+b = b + 10
+#: E222
+x =            -1
+y =            -2
+long_variable = 3
+#: E222
+x[0] =          1
+x[1] =          2
+long_variable = 3
+#:
+
+
+#: E223
+foobart = 4
+a	= 3  # aligned with tab
+#:
+
+
+#: E224
+a +=	1
+b += 1000
+#:
+
+
+#: E225
+submitted +=1
+#: E225
+submitted+= 1
+#: E225
+c =-1
+#: E225
+x = x /2 - 1
+#: E225
+c = alpha -4
+#: E225
+c = alpha- 4
+#: E225
+z = x **y
+#: E225
+z = (x + 1) **y
+#: E225
+z = (x + 1)** y
+#: E225
+_1kB = _1MB >>10
+#: E225
+_1kB = _1MB>> 10
+#: E225
+i=i+ 1
+#: E225
+i=i +1
+#: E225 E226
+i=i+1
+#: E225 E226
+i =i+1
+#: E225 E226
+i= i+1
+#: E225 E226
+c = (a +b)*(a - b)
+#: E225 E226
+c = (a+ b)*(a - b)
+#:
+
+#: E226
+z = 2**30
+#: E226
+c = (a+b) * (a-b)
+#: E226
+norman = True+False
+#: E226
+x = x*2 - 1
+#: E226
+x = x/2 - 1
+#: E226
+hypot2 = x*x + y*y
+#: E226
+c = (a + b)*(a - b)
+#: E226
+def squares(n):
+    return (i**2 for i in range(n))
+#: E227
+_1kB = _1MB>>10
+#: E227
+_1MB = _1kB<<10
+#: E227
+a = b|c
+#: E227
+b = c&a
+#: E227
+c = b^a
+#: E228
+a = b%c
+#: E228
+msg = fmt%(errno, errmsg)
+#: E228
+msg = "Error %d occured"%errno
+#:
+
+#: Okay
+i = i + 1
+submitted += 1
+x = x * 2 - 1
+hypot2 = x * x + y * y
+c = (a + b) * (a - b)
+_1MB = 2 ** 20
+foo(bar, key='word', *args, **kwargs)
+baz(**kwargs)
+negative = -1
+spam(-1)
+-negative
+lambda *args, **kw: (args, kw)
+lambda a, b=h[:], c=0: (a, b, c)
+if not -5 < x < +5:
+    print >>sys.stderr, "x is out of range."
+print >> sys.stdout, "x is an integer."
+z = 2 ** 30
+x = x / 2 - 1
+
+if alpha[:-i]:
+    *a, b = (1, 2, 3)
+
+
+def squares(n):
+    return (i ** 2 for i in range(n))
+#:
new file mode 100644
--- /dev/null
+++ b/pep8/testsuite/E23.py
@@ -0,0 +1,15 @@
+#: E231
+a = (1,2)
+#: E231
+a[b1,:]
+#: E231
+a = [{'a':''}]
+#: Okay
+a = (4,)
+b = (5, )
+c = {'text': text[5:]}
+
+result = {
+    'key1': 'value',
+    'key2': 'value',
+}
new file mode 100644
--- /dev/null
+++ b/pep8/testsuite/E24.py
@@ -0,0 +1,13 @@
+#: E241
+a = (1,  2)
+#: Okay
+b = (1, 20)
+#: E242
+a = (1,	2)  # tab before 2
+#: Okay
+b = (1, 20)  # space before 20
+#: E241
+# issue 135
+more_spaces = [a,    b,
+               ef,  +h,
+               c,   -d]
new file mode 100644
--- /dev/null
+++ b/pep8/testsuite/E25.py
@@ -0,0 +1,19 @@
+#: E251
+def foo(bar = False):
+    '''Test function with an error in declaration'''
+    pass
+#: E251
+foo(bar= True)
+#: E251
+foo(bar =True)
+#: E251
+foo(bar = True)
+#: E251
+y = bar(root= "sdasd")
+#: Okay
+foo(bar=(1 == 1))
+foo(bar=(1 != 1))
+foo(bar=(1 >= 1))
+foo(bar=(1 <= 1))
+(options, args) = parser.parse_args()
+d[type(None)] = _deepcopy_atomic
new file mode 100644
--- /dev/null
+++ b/pep8/testsuite/E26.py
@@ -0,0 +1,13 @@
+#: E261
+pass # an inline comment
+#: E262
+x = x + 1  #Increment x
+#: E262
+x = x + 1  #  Increment x
+#: E262
+x = y + 1  #:  Increment x
+#: Okay
+pass  # an inline comment
+x = x + 1   # Increment x
+y = y + 1   #: Increment x
+#:
new file mode 100644
--- /dev/null
+++ b/pep8/testsuite/E27.py
@@ -0,0 +1,30 @@
+#: Okay
+True and False
+#: E271
+True and  False
+#: E272
+True  and False
+#: E271
+if   1:
+#: E273
+True and		False
+#: E273 E274
+True		and	False
+#: E271
+a and  b
+#: E271
+1 and  b
+#: E271
+a and  2
+#: E271 E272
+1  and  b
+#: E271 E272
+a  and  2
+#: E272
+this  and False
+#: E273
+a and	b
+#: E274
+a		and b
+#: E273 E274
+this		and	False
new file mode 100644
--- /dev/null
+++ b/pep8/testsuite/E30.py
@@ -0,0 +1,79 @@
+#: E301
+class X:
+
+    def a():
+        pass
+    def b():
+        pass
+#: E301
+class X:
+
+    def a():
+        pass
+    # comment
+    def b():
+        pass
+#:
+
+
+#: E302
+#!python
+# -*- coding: utf-8 -*-
+def a():
+    pass
+#: E302
+"""Main module."""
+def _main():
+    pass
+#: E302
+import sys
+def get_sys_path():
+    return sys.path
+#: E302
+def a():
+    pass
+
+def b():
+    pass
+#: E302
+def a():
+    pass
+
+# comment
+
+def b():
+    pass
+#:
+
+
+#: E303
+print
+
+
+
+print
+#: E303
+print
+
+
+
+# comment
+
+print
+#: E303
+def a():
+    print
+
+
+    # comment
+
+    print
+#:
+
+
+#: E304
+@decorator
+
+def function():
+    pass
+#:
new file mode 100644
--- /dev/null
+++ b/pep8/testsuite/E30not.py
@@ -0,0 +1,134 @@
+#: Okay
+class X:
+    pass
+#: Okay
+
+def foo():
+    pass
+#: Okay
+# -*- coding: utf-8 -*-
+class X:
+    pass
+#: Okay
+# -*- coding: utf-8 -*-
+def foo():
+    pass
+#: Okay
+class X:
+
+    def a():
+        pass
+
+    # comment
+    def b():
+        pass
+
+    # This is a
+    # ... multi-line comment
+
+    def c():
+        pass
+
+
+# This is a
+# ... multi-line comment
+
+@some_decorator
+class Y:
+
+    def a():
+        pass
+
+    # comment
+
+    def b():
+        pass
+
+    @property
+    def c():
+        pass
+
+
+try:
+    from nonexistent import Bar
+except ImportError:
+    class Bar(object):
+        """This is a Bar replacement"""
+
+
+def with_feature(f):
+    """Some decorator"""
+    wrapper = f
+    if has_this_feature(f):
+        def wrapper(*args):
+            call_feature(args[0])
+            return f(*args)
+    return wrapper
+
+
+try:
+    next
+except NameError:
+    def next(iterator, default):
+        for item in iterator:
+            return item
+        return default
+
+
+def a():
+    pass
+
+
+class Foo():
+    """Class Foo"""
+
+    def b():
+
+        pass
+
+
+# comment
+def c():
+    pass
+
+
+# comment
+
+
+def d():
+    pass
+
+# This is a
+# ... multi-line comment
+
+# And this one is
+# ... a second paragraph
+# ... which spans on 3 lines
+
+
+# Function `e` is below
+# NOTE: Hey this is a testcase
+
+def e():
+    pass
+
+
+def a():
+    print
+
+    # comment
+
+    print
+
+    print
+
+# Comment 1
+
+# Comment 2
+
+
+# Comment 3
+
+def b():
+
+    pass
new file mode 100644
--- /dev/null
+++ b/pep8/testsuite/E40.py
@@ -0,0 +1,13 @@
+#: E401
+import os, sys
+#: Okay
+import os
+import sys
+
+from subprocess import Popen, PIPE
+
+from myclass import MyClass
+from foo.bar.yourclass import YourClass
+
+import myclass
+import foo.bar.yourclass
new file mode 100644
--- /dev/null
+++ b/pep8/testsuite/E50.py
@@ -0,0 +1,47 @@
+#: E501
+a = '12345678901234567890123456789012345678901234567890123456789012345678901234567890'
+#: E502
+a = ('123456789012345678901234567890123456789012345678901234567890123456789'  \
+     '01234567890')
+#: E502
+a = ('AAA  \
+      BBB' \
+     'CCC')
+#: E502
+if (foo is None and bar is "e000" and \
+        blah == 'yeah'):
+    blah = 'yeahnah'
+#
+#: Okay
+a = ('AAA'
+     'BBB')
+
+a = ('AAA  \
+      BBB'
+     'CCC')
+
+a = 'AAA'    \
+    'BBB'    \
+    'CCC'
+
+a = ('AAA\
+BBBBBBBBB\
+CCCCCCCCC\
+DDDDDDDDD')
+#
+#: Okay
+if aaa:
+    pass
+elif bbb or \
+        ccc:
+    pass
+
+ddd = \
+    ccc
+
+('\
+    ' + ' \
+')
+('''
+    ''' + ' \
+')
new file mode 100644
--- /dev/null
+++ b/pep8/testsuite/E70.py
@@ -0,0 +1,13 @@
+#: E701
+if a: a = False
+#: E701
+if not header or header[:6] != 'bytes=': return
+#: E702
+a = False; b = True
+#: E702
+import bdist_egg; bdist_egg.write_safety_flag(cmd.egg_info, safe)
+#: E703
+import shlex;
+#: E702 E703
+del a[:]; a.append(42);
+#:
new file mode 100644
--- /dev/null
+++ b/pep8/testsuite/E71.py
@@ -0,0 +1,9 @@
+#: E712
+if res == True:
+    pass
+#: E712
+if res != False:
+    pass
+#: E711
+if res == None:
+    pass
new file mode 100644
--- /dev/null
+++ b/pep8/testsuite/E72.py
@@ -0,0 +1,51 @@
+#: E721
+if type(res) == type(42):
+    pass
+#: E721
+if type(res) != type(""):
+    pass
+#: E721
+import types
+
+if res == types.IntType:
+    pass
+#: E721
+import types
+
+if type(res) is not types.ListType:
+    pass
+#: E721
+assert type(res) == type(False) or type(res) == type(None)
+#: E721
+assert type(res) == type([])
+#: E721
+assert type(res) == type(())
+#: E721
+assert type(res) == type((0,))
+#: E721
+assert type(res) == type((0))
+#: E721
+assert type(res) != type((1, ))
+#: E721
+assert type(res) is type((1, ))
+#: E721
+assert type(res) is not type((1, ))
+#: E211 E721
+assert type(res) == type ([2, ])
+#: E201 E202 E721
+assert type(res) == type( ( ) )
+#: E201 E202 E721
+assert type(res) == type( (0, ) )
+#:
+
+#: Okay
+import types
+
+if isinstance(res, int):
+    pass
+if isinstance(res, str):
+    pass
+if isinstance(res, types.MethodType):
+    pass
+if type(a) != type(b) or type(a) == type(ccc):
+    pass
new file mode 100644
--- /dev/null
+++ b/pep8/testsuite/E90.py
@@ -0,0 +1,26 @@
+#: E901
+}
+#: E901
+= [x
+#: E901 E101 W191
+while True:
+    try:
+	    pass
+	except:
+		print 'Whoops'
+#: E122 E225 E251 E701
+
+# Do not crash if code is invalid
+if msg:
+    errmsg = msg % progress.get(cr_dbname))
+
+def lasting(self, duration=300):
+    progress = self._progress.setdefault('foo', {}
+#: Okay
+
+# Issue #119
+# Do not crash with Python2 if the line endswith '\r\r\n'
+EMPTY_SET = set()
+SET_TYPE = type(EMPTY_SET)
+toto = 0 + 0
+#:
new file mode 100644
--- /dev/null
+++ b/pep8/testsuite/W19.py
@@ -0,0 +1,104 @@
+#: W191
+if False:
+	print  # indented with 1 tab
+#:
+
+
+#: E126 W191
+y = x == 2 \
+	or x == 3
+#: E101 W191
+if (
+        x == (
+            3
+        ) or
+        y == 4):
+	pass
+#: E101 W191
+if x == 2 \
+    or y > 1 \
+        or x == 3:
+	pass
+#: E101 W191
+if x == 2 \
+        or y > 1 \
+        or x == 3:
+	pass
+#:
+
+#: E101 W191
+if (foo == bar and
+        baz == frop):
+	pass
+#: E101 W191
+if (
+    foo == bar and
+    baz == frop
+):
+	pass
+#:
+
+#: E101 W191
+if start[1] > end_col and not (
+        over_indent == 4 and indent_next):
+	return(0, "E121 continuation line over-"
+	       "indented for visual indent")
+#:
+
+#: E101 W191
+
+
+def long_function_name(
+        var_one, var_two, var_three,
+        var_four):
+	print(var_one)
+#: E101 W191
+if ((row < 0 or self.moduleCount <= row or
+     col < 0 or self.moduleCount <= col)):
+	raise Exception("%s,%s - %s" % (row, col, self.moduleCount))
+#: E101 W191
+if bar:
+	return(
+	    start, 'E121 lines starting with a '
+	    'closing bracket should be indented '
+	    "to match that of the opening "
+	    "bracket's line"
+	)
+#
+#: E101 W191
+# you want vertical alignment, so use a parens
+if ((foo.bar("baz") and
+     foo.bar("frop")
+     )):
+	print "yes"
+#: E101 W191
+# also ok, but starting to look like LISP
+if ((foo.bar("baz") and
+     foo.bar("frop"))):
+	print "yes"
+#: E101 W191
+if (a == 2 or
+    b == "abc def ghi"
+         "jkl mno"):
+	return True
+#: E101 W191
+if (a == 2 or
+    b == """abc def ghi
+jkl mno"""):
+	return True
+#: E101 W191
+if length > options.max_line_length:
+	return options.max_line_length, \
+	    "E501 line too long (%d characters)" % length
+
+
+#
+#: E101 W191
+if os.path.exists(os.path.join(path, PEP8_BIN)):
+	cmd = ([os.path.join(path, PEP8_BIN)] +
+	       self._pep8_options(targetfile))
+#: E101 W191
+if foo is None and bar is "frop" and \
+        blah == 'yeah':
+	blah = 'yeahnah'
+#:
new file mode 100644
--- /dev/null
+++ b/pep8/testsuite/W29.py
@@ -0,0 +1,10 @@
+#: Okay
+# 情
+#: W291
+print 
+#: W293
+class Foo(object):
+    
+    bang = 12
+#: W292
+# This line doesn't have a linefeed
\ No newline at end of file
new file mode 100644
--- /dev/null
+++ b/pep8/testsuite/W39.py
@@ -0,0 +1,3 @@
+#: W391
+# The next line is blank
+
new file mode 100644
--- /dev/null
+++ b/pep8/testsuite/W60.py
@@ -0,0 +1,14 @@
+#: W601
+if a.has_key("b"):
+    print a
+#: W602
+raise DummyError, "Message"
+#: W602
+raise ValueError, "hello %s %s" % (1, 2)
+#: Okay
+raise type_, val, tb
+#: W603
+if x <> 0:
+    x = 0
+#: W604
+val = `1 + 2`
new file mode 100644
new file mode 100644
--- /dev/null
+++ b/pep8/testsuite/latin-1.py
@@ -0,0 +1,6 @@
+# -*- coding: latin-1 -*-
+# Test non-UTF8 encoding
+latin1 = (''
+          '')
+
+c = ("w")
new file mode 100644
--- /dev/null
+++ b/pep8/testsuite/noqa.py
@@ -0,0 +1,15 @@
+#: Okay
+# silence E501
+url = 'https://api.github.com/repos/sigmavirus24/Todo.txt-python/branches/master?client_id=xxxxxxxxxxxxxxxxxxxxxxxxxxxx&?client_secret=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'  # noqa
+
+# silence E128
+from functools import (partial, reduce, wraps,  # noqa
+    cmp_to_key)
+
+from functools import (partial, reduce, wraps,
+    cmp_to_key)   # noqa
+
+a = 1
+if a == None:   # noqa
+    pass
+#:
new file mode 100644
--- /dev/null
+++ b/pep8/testsuite/python3.py
@@ -0,0 +1,6 @@
+#!/usr/bin/env python3
+
+
+# Annotated function (Issue #29)
+def foo(x: int) -> int:
+    return x + 1
new file mode 100644
--- /dev/null
+++ b/pep8/testsuite/support.py
@@ -0,0 +1,171 @@
+# -*- coding: utf-8 -*-
+import os.path
+import re
+import sys
+
+from pep8 import Checker, BaseReport, StandardReport, readlines
+
+SELFTEST_REGEX = re.compile(r'\b(Okay|[EW]\d{3}):\s(.*)')
+ROOT_DIR = os.path.dirname(os.path.dirname(__file__))
+
+
+class PseudoFile(list):
+    """Simplified file interface."""
+    write = list.append
+
+    def getvalue(self):
+        return ''.join(self)
+
+
+class TestReport(StandardReport):
+    """Collect the results for the tests."""
+
+    def __init__(self, options):
+        options.benchmark_keys += ['test cases', 'failed tests']
+        super(TestReport, self).__init__(options)
+        self._verbose = options.verbose
+
+    def get_file_results(self):
+        # Check if the expected errors were found
+        label = '%s:%s:1' % (self.filename, self.line_offset)
+        codes = sorted(self.expected)
+        for code in codes:
+            if not self.counters.get(code):
+                self.file_errors += 1
+                self.total_errors += 1
+                print('%s: error %s not found' % (label, code))
+        if self._verbose and not self.file_errors:
+            print('%s: passed (%s)' %
+                  (label, ' '.join(codes) or 'Okay'))
+        self.counters['test cases'] += 1
+        if self.file_errors:
+            self.counters['failed tests'] += 1
+        # Reset counters
+        for key in set(self.counters) - set(self._benchmark_keys):
+            del self.counters[key]
+        self.messages = {}
+        return super(TestReport, self).get_file_results()
+
+    def print_results(self):
+        results = ("%(physical lines)d lines tested: %(files)d files, "
+                   "%(test cases)d test cases%%s." % self.counters)
+        if self.total_errors:
+            print(results % ", %s failures" % self.total_errors)
+        else:
+            print(results % "")
+        print("Test failed." if self.total_errors else "Test passed.")
+
+
+def selftest(options):
+    """
+    Test all check functions with test cases in docstrings.
+    """
+    count_failed = count_all = 0
+    report = BaseReport(options)
+    counters = report.counters
+    checks = options.physical_checks + options.logical_checks
+    for name, check, argument_names in checks:
+        for line in check.__doc__.splitlines():
+            line = line.lstrip()
+            match = SELFTEST_REGEX.match(line)
+            if match is None:
+                continue
+            code, source = match.groups()
+            lines = [part.replace(r'\t', '\t') + '\n'
+                     for part in source.split(r'\n')]
+            checker = Checker(lines=lines, options=options, report=report)
+            checker.check_all()
+            error = None
+            if code == 'Okay':
+                if len(counters) > len(options.benchmark_keys):
+                    codes = [key for key in counters
+                             if key not in options.benchmark_keys]
+                    error = "incorrectly found %s" % ', '.join(codes)
+            elif not counters.get(code):
+                error = "failed to find %s" % code
+            # Keep showing errors for multiple tests
+            for key in set(counters) - set(options.benchmark_keys):
+                del counters[key]
+            report.messages = {}
+            count_all += 1
+            if not error:
+                if options.verbose:
+                    print("%s: %s" % (code, source))
+            else:
+                count_failed += 1
+                print("pep8.py: %s:" % error)
+                for line in checker.lines:
+                    print(line.rstrip())
+    return count_failed, count_all
+
+
+def init_tests(pep8style):
+    """
+    Initialize testing framework.
+
+    A test file can provide many tests.  Each test starts with a
+    declaration.  This declaration is a single line starting with '#:'.
+    It declares codes of expected failures, separated by spaces or 'Okay'
+    if no failure is expected.
+    If the file does not contain such declaration, it should pass all
+    tests.  If the declaration is empty, following lines are not checked,
+    until next declaration.
+
+    Examples:
+
+     * Only E224 and W701 are expected:         #: E224 W701
+     * Following example is conform:            #: Okay
+     * Don't check these lines:                 #:
+    """
+    report = pep8style.init_report(TestReport)
+    runner = pep8style.input_file
+
+    def run_tests(filename):
+        """Run all the tests from a file."""
+        lines = readlines(filename) + ['#:\n']
+        line_offset = 0
+        codes = ['Okay']
+        testcase = []
+        count_files = report.counters['files']
+        for index, line in enumerate(lines):
+            if not line.startswith('#:'):
+                if codes:
+                    # Collect the lines of the test case
+                    testcase.append(line)
+                continue
+            if codes and index:
+                codes = [c for c in codes if c != 'Okay']
+                # Run the checker
+                runner(filename, testcase, expected=codes,
+                       line_offset=line_offset)
+            # output the real line numbers
+            line_offset = index + 1
+            # configure the expected errors
+            codes = line.split()[1:]
+            # empty the test case buffer
+            del testcase[:]
+        report.counters['files'] = count_files + 1
+        return report.counters['failed tests']
+
+    pep8style.runner = run_tests
+
+
+def run_tests(style):
+    options = style.options
+    if options.doctest:
+        import doctest
+        fail_d, done_d = doctest.testmod(report=False, verbose=options.verbose)
+        fail_s, done_s = selftest(options)
+        count_failed = fail_s + fail_d
+        if not options.quiet:
+            count_passed = done_d + done_s - count_failed
+            print("%d passed and %d failed." % (count_passed, count_failed))
+            print("Test failed." if count_failed else "Test passed.")
+        if count_failed:
+            sys.exit(1)
+    if options.testsuite:
+        init_tests(style)
+    return style.check_files()
+
+# nose should not collect these functions
+init_tests.__test__ = run_tests.__test__ = False
new file mode 100644
--- /dev/null
+++ b/pep8/testsuite/test_all.py
@@ -0,0 +1,62 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+import os.path
+import sys
+import unittest
+
+import pep8
+from testsuite.support import init_tests, selftest, ROOT_DIR
+
+# Note: please only use a subset of unittest methods which were present
+# in Python 2.5: assert(True|False|Equal|NotEqual|Raises)
+
+
+class Pep8TestCase(unittest.TestCase):
+    """Test the standard errors and warnings (E and W)."""
+
+    def setUp(self):
+        self._style = pep8.StyleGuide(
+            paths=[os.path.join(ROOT_DIR, 'testsuite')],
+            select='E,W', quiet=True)
+
+    def test_doctest(self):
+        import doctest
+        fail_d, done_d = doctest.testmod(pep8, verbose=False, report=False)
+        self.assertTrue(done_d, msg='tests not found')
+        self.assertFalse(fail_d, msg='%s failure(s)' % fail_d)
+
+    def test_selftest(self):
+        fail_s, done_s = selftest(self._style.options)
+        self.assertTrue(done_s, msg='tests not found')
+        self.assertFalse(fail_s, msg='%s failure(s)' % fail_s)
+
+    def test_checkers_testsuite(self):
+        init_tests(self._style)
+        report = self._style.check_files()
+        self.assertFalse(report.total_errors,
+                         msg='%s failure(s)' % report.total_errors)
+
+    def test_own_dog_food(self):
+        files = [pep8.__file__.rstrip('oc'), __file__.rstrip('oc'),
+                 os.path.join(ROOT_DIR, 'setup.py')]
+        report = self._style.init_report(pep8.StandardReport)
+        report = self._style.check_files(files)
+        self.assertFalse(report.total_errors,
+                         msg='Failures: %s' % report.messages)
+
+
+def suite():
+    from testsuite import test_api, test_shell
+
+    suite = unittest.TestSuite()
+    suite.addTest(unittest.makeSuite(Pep8TestCase))
+    suite.addTest(unittest.makeSuite(test_api.APITestCase))
+    suite.addTest(unittest.makeSuite(test_shell.ShellTestCase))
+    return suite
+
+
+def _main():
+    return unittest.TextTestRunner(verbosity=2).run(suite())
+
+if __name__ == '__main__':
+    sys.exit(not _main())
new file mode 100644
--- /dev/null
+++ b/pep8/testsuite/test_api.py
@@ -0,0 +1,331 @@
+# -*- coding: utf-8 -*-
+import os.path
+import shlex
+import sys
+import unittest
+
+import pep8
+from testsuite.support import ROOT_DIR, PseudoFile
+
+E11 = os.path.join(ROOT_DIR, 'testsuite', 'E11.py')
+
+
+class DummyChecker(object):
+    def __init__(self, tree, filename):
+        pass
+
+    def run(self):
+        if False:
+            yield
+
+
+class APITestCase(unittest.TestCase):
+    """Test the public methods."""
+
+    def setUp(self):
+        self._saved_stdout = sys.stdout
+        self._saved_stderr = sys.stderr
+        self._saved_checks = pep8._checks
+        sys.stdout = PseudoFile()
+        sys.stderr = PseudoFile()
+        pep8._checks = dict((k, dict((f, (vals[0][:], vals[1]))
+                                     for (f, vals) in v.items()))
+                            for (k, v) in self._saved_checks.items())
+
+    def tearDown(self):
+        sys.stdout = self._saved_stdout
+        sys.stderr = self._saved_stderr
+        pep8._checks = self._saved_checks
+
+    def reset(self):
+        del sys.stdout[:], sys.stderr[:]
+
+    def test_register_physical_check(self):
+        def check_dummy(physical_line, line_number):
+            if False:
+                yield
+        pep8.register_check(check_dummy, ['Z001'])
+
+        self.assertTrue(check_dummy in pep8._checks['physical_line'])
+        codes, args = pep8._checks['physical_line'][check_dummy]
+        self.assertTrue('Z001' in codes)
+        self.assertEqual(args, ['physical_line', 'line_number'])
+
+        options = pep8.StyleGuide().options
+        self.assertTrue(any(func == check_dummy
+                            for name, func, args in options.physical_checks))
+
+    def test_register_logical_check(self):
+        def check_dummy(logical_line, tokens):
+            if False:
+                yield
+        pep8.register_check(check_dummy, ['Z401'])
+
+        self.assertTrue(check_dummy in pep8._checks['logical_line'])
+        codes, args = pep8._checks['logical_line'][check_dummy]
+        self.assertTrue('Z401' in codes)
+        self.assertEqual(args, ['logical_line', 'tokens'])
+
+        pep8.register_check(check_dummy, [])
+        pep8.register_check(check_dummy, ['Z402', 'Z403'])
+        codes, args = pep8._checks['logical_line'][check_dummy]
+        self.assertEqual(codes, ['Z401', 'Z402', 'Z403'])
+        self.assertEqual(args, ['logical_line', 'tokens'])
+
+        options = pep8.StyleGuide().options
+        self.assertTrue(any(func == check_dummy
+                            for name, func, args in options.logical_checks))
+
+    def test_register_ast_check(self):
+        pep8.register_check(DummyChecker, ['Z701'])
+
+        self.assertTrue(DummyChecker in pep8._checks['tree'])
+        codes, args = pep8._checks['tree'][DummyChecker]
+        self.assertTrue('Z701' in codes)
+        self.assertTrue(args is None)
+
+        options = pep8.StyleGuide().options
+        self.assertTrue(any(cls == DummyChecker
+                            for name, cls, args in options.ast_checks))
+
+    def test_register_invalid_check(self):
+        class InvalidChecker(DummyChecker):
+            def __init__(self, filename):
+                pass
+
+        def check_dummy(logical, tokens):
+            if False:
+                yield
+        pep8.register_check(InvalidChecker, ['Z741'])
+        pep8.register_check(check_dummy, ['Z441'])
+
+        for checkers in pep8._checks.values():
+            self.assertTrue(DummyChecker not in checkers)
+            self.assertTrue(check_dummy not in checkers)
+
+        self.assertRaises(TypeError, pep8.register_check)
+
+    def test_styleguide(self):
+        report = pep8.StyleGuide().check_files()
+        self.assertEqual(report.total_errors, 0)
+        self.assertFalse(sys.stdout)
+        self.assertFalse(sys.stderr)
+        self.reset()
+
+        report = pep8.StyleGuide().check_files(['missing-file'])
+        stdout = sys.stdout.getvalue().splitlines()
+        self.assertEqual(len(stdout), report.total_errors)
+        self.assertEqual(report.total_errors, 1)
+        # < 3.3 returns IOError; >= 3.3 returns FileNotFoundError
+        self.assertTrue(stdout[0].startswith("missing-file:1:1: E902 "))
+        self.assertFalse(sys.stderr)
+        self.reset()
+
+        report = pep8.StyleGuide().check_files([E11])
+        stdout = sys.stdout.getvalue().splitlines()
+        self.assertEqual(len(stdout), report.total_errors)
+        self.assertEqual(report.total_errors, 4)
+        self.assertFalse(sys.stderr)
+        self.reset()
+
+        # Passing the paths in the constructor gives same result
+        report = pep8.StyleGuide(paths=[E11]).check_files()
+        stdout = sys.stdout.getvalue().splitlines()
+        self.assertEqual(len(stdout), report.total_errors)
+        self.assertEqual(report.total_errors, 4)
+        self.assertFalse(sys.stderr)
+        self.reset()
+
+    def test_styleguide_options(self):
+        # Instanciate a simple checker
+        pep8style = pep8.StyleGuide(paths=[E11])
+
+        # Check style's attributes
+        self.assertEqual(pep8style.checker_class, pep8.Checker)
+        self.assertEqual(pep8style.paths, [E11])
+        self.assertEqual(pep8style.runner, pep8style.input_file)
+        self.assertEqual(pep8style.options.ignore_code, pep8style.ignore_code)
+        self.assertEqual(pep8style.options.paths, pep8style.paths)
+
+        # Check unset options
+        for o in ('benchmark', 'config', 'count', 'diff',
+                  'doctest', 'quiet', 'show_pep8', 'show_source',
+                  'statistics', 'testsuite', 'verbose'):
+            oval = getattr(pep8style.options, o)
+            self.assertTrue(oval in (None, False), msg='%s = %r' % (o, oval))
+
+        # Check default options
+        self.assertTrue(pep8style.options.repeat)
+        self.assertEqual(pep8style.options.benchmark_keys,
+                         ['directories', 'files',
+                          'logical lines', 'physical lines'])
+        self.assertEqual(pep8style.options.exclude,
+                         ['.svn', 'CVS', '.bzr', '.hg', '.git', '__pycache__'])
+        self.assertEqual(pep8style.options.filename, ['*.py'])
+        self.assertEqual(pep8style.options.format, 'default')
+        self.assertEqual(pep8style.options.select, ())
+        self.assertEqual(pep8style.options.ignore, ('E123', 'E226', 'E24'))
+        self.assertEqual(pep8style.options.max_line_length, 79)
+
+    def test_styleguide_ignore_code(self):
+        def parse_argv(argstring):
+            _saved_argv = sys.argv
+            sys.argv = shlex.split('pep8 %s /dev/null' % argstring)
+            try:
+                return pep8.StyleGuide(parse_argv=True)
+            finally:
+                sys.argv = _saved_argv
+
+        options = parse_argv('').options
+        self.assertEqual(options.select, ())
+        self.assertEqual(options.ignore, ('E123', 'E226', 'E24'))
+
+        options = parse_argv('--doctest').options
+        self.assertEqual(options.select, ())
+        self.assertEqual(options.ignore, ())
+
+        options = parse_argv('--ignore E,W').options
+        self.assertEqual(options.select, ())
+        self.assertEqual(options.ignore, ('E', 'W'))
+
+        options = parse_argv('--select E,W').options
+        self.assertEqual(options.select, ('E', 'W'))
+        self.assertEqual(options.ignore, ('',))
+
+        options = parse_argv('--select E --ignore E24').options
+        self.assertEqual(options.select, ('E',))
+        self.assertEqual(options.ignore, ('',))
+
+        options = parse_argv('--ignore E --select E24').options
+        self.assertEqual(options.select, ('E24',))
+        self.assertEqual(options.ignore, ('',))
+
+        options = parse_argv('--ignore W --select E24').options
+        self.assertEqual(options.select, ('E24',))
+        self.assertEqual(options.ignore, ('',))
+
+        pep8style = pep8.StyleGuide(paths=[E11])
+        self.assertFalse(pep8style.ignore_code('E112'))
+        self.assertFalse(pep8style.ignore_code('W191'))
+        self.assertTrue(pep8style.ignore_code('E241'))
+
+        pep8style = pep8.StyleGuide(select='E', paths=[E11])
+        self.assertFalse(pep8style.ignore_code('E112'))
+        self.assertTrue(pep8style.ignore_code('W191'))
+        self.assertFalse(pep8style.ignore_code('E241'))
+
+        pep8style = pep8.StyleGuide(select='W', paths=[E11])
+        self.assertTrue(pep8style.ignore_code('E112'))
+        self.assertFalse(pep8style.ignore_code('W191'))
+        self.assertTrue(pep8style.ignore_code('E241'))
+
+    def test_styleguide_excluded(self):
+        pep8style = pep8.StyleGuide(paths=[E11])
+
+        self.assertFalse(pep8style.excluded('./foo/bar'))
+        self.assertFalse(pep8style.excluded('./foo/bar/main.py'))
+
+        self.assertTrue(pep8style.excluded('./CVS'))
+        self.assertTrue(pep8style.excluded('./subdir/CVS'))
+        self.assertTrue(pep8style.excluded('__pycache__'))
+        self.assertTrue(pep8style.excluded('./__pycache__'))
+        self.assertTrue(pep8style.excluded('subdir/__pycache__'))
+
+        self.assertFalse(pep8style.excluded('draftCVS'))
+        self.assertFalse(pep8style.excluded('./CVSoup'))
+        self.assertFalse(pep8style.excluded('./CVS/subdir'))
+
+    def test_styleguide_checks(self):
+        pep8style = pep8.StyleGuide(paths=[E11])
+
+        # Default lists of checkers
+        self.assertTrue(len(pep8style.options.physical_checks) > 5)
+        self.assertTrue(len(pep8style.options.logical_checks) > 10)
+        self.assertEqual(len(pep8style.options.ast_checks), 0)
+
+        # Sanity check
+        for name, check, args in pep8style.options.physical_checks:
+            self.assertEqual(check.__name__, name)
+            self.assertEqual(args[0], 'physical_line')
+        for name, check, args in pep8style.options.logical_checks:
+            self.assertEqual(check.__name__, name)
+            self.assertEqual(args[0], 'logical_line')
+
+        # Do run E11 checks
+        options = pep8.StyleGuide().options
+        self.assertTrue(any(func == pep8.indentation
+                            for name, func, args in options.logical_checks))
+        options = pep8.StyleGuide(select=['E']).options
+        self.assertTrue(any(func == pep8.indentation
+                            for name, func, args in options.logical_checks))
+        options = pep8.StyleGuide(ignore=['W']).options
+        self.assertTrue(any(func == pep8.indentation
+                            for name, func, args in options.logical_checks))
+        options = pep8.StyleGuide(ignore=['E12']).options
+        self.assertTrue(any(func == pep8.indentation
+                            for name, func, args in options.logical_checks))
+
+        # Do not run E11 checks
+        options = pep8.StyleGuide(select=['W']).options
+        self.assertFalse(any(func == pep8.indentation
+                             for name, func, args in options.logical_checks))
+        options = pep8.StyleGuide(ignore=['E']).options
+        self.assertFalse(any(func == pep8.indentation
+                             for name, func, args in options.logical_checks))
+        options = pep8.StyleGuide(ignore=['E11']).options
+        self.assertFalse(any(func == pep8.indentation
+                             for name, func, args in options.logical_checks))
+
+    def test_styleguide_init_report(self):
+        pep8style = pep8.StyleGuide(paths=[E11])
+
+        self.assertEqual(pep8style.options.reporter, pep8.StandardReport)
+        self.assertEqual(type(pep8style.options.report), pep8.StandardReport)
+
+        class MinorityReport(pep8.BaseReport):
+            pass
+
+        report = pep8style.init_report(MinorityReport)
+        self.assertEqual(pep8style.options.report, report)
+        self.assertEqual(type(report), MinorityReport)
+
+        pep8style = pep8.StyleGuide(paths=[E11], reporter=MinorityReport)
+        self.assertEqual(type(pep8style.options.report), MinorityReport)
+        self.assertEqual(pep8style.options.reporter, MinorityReport)
+
+    def test_styleguide_check_files(self):
+        pep8style = pep8.StyleGuide(paths=[E11])
+
+        report = pep8style.check_files()
+        self.assertTrue(report.total_errors)
+
+        self.assertRaises(TypeError, pep8style.check_files, 42)
+        # < 3.3 raises TypeError; >= 3.3 raises AttributeError
+        self.assertRaises(Exception, pep8style.check_files, [42])
+
+    def test_check_unicode(self):
+        # Do not crash if lines are Unicode (Python 2.x)
+        pep8.register_check(DummyChecker, ['Z701'])
+        source = '#\n'
+        if hasattr(source, 'decode'):
+            source = source.decode('ascii')
+
+        pep8style = pep8.StyleGuide()
+        count_errors = pep8style.input_file('stdin', lines=[source])
+
+        self.assertFalse(sys.stdout)
+        self.assertFalse(sys.stderr)
+        self.assertEqual(count_errors, 0)
+
+    def test_check_nullbytes(self):
+        pep8.register_check(DummyChecker, ['Z701'])
+
+        pep8style = pep8.StyleGuide()
+        count_errors = pep8style.input_file('stdin', lines=['\x00\n'])
+
+        self.assertTrue(sys.stdout[0].startswith("stdin:1:1: E901 TypeError"))
+        self.assertFalse(sys.stderr)
+        self.assertEqual(count_errors, 1)
+
+        # TODO: runner
+        # TODO: input_file
new file mode 100644
--- /dev/null
+++ b/pep8/testsuite/test_shell.py
@@ -0,0 +1,188 @@
+# -*- coding: utf-8 -*-
+import os.path
+import sys
+import unittest
+
+import pep8
+from testsuite.support import ROOT_DIR, PseudoFile
+
+
+class ShellTestCase(unittest.TestCase):
+    """Test the usual CLI options and output."""
+
+    def setUp(self):
+        self._saved_argv = sys.argv
+        self._saved_stdout = sys.stdout
+        self._saved_stderr = sys.stderr
+        self._saved_pconfig = pep8.PROJECT_CONFIG
+        self._saved_cpread = pep8.RawConfigParser._read
+        self._saved_stdin_get_value = pep8.stdin_get_value
+        self._config_filenames = []
+        self.stdin = ''
+        sys.argv = ['pep8']
+        sys.stdout = PseudoFile()
+        sys.stderr = PseudoFile()
+
+        def fake_config_parser_read(cp, fp, filename):
+            self._config_filenames.append(filename)
+        pep8.RawConfigParser._read = fake_config_parser_read
+        pep8.stdin_get_value = self.stdin_get_value
+
+    def tearDown(self):
+        sys.argv = self._saved_argv
+        sys.stdout = self._saved_stdout
+        sys.stderr = self._saved_stderr
+        pep8.PROJECT_CONFIG = self._saved_pconfig
+        pep8.RawConfigParser._read = self._saved_cpread
+        pep8.stdin_get_value = self._saved_stdin_get_value
+
+    def stdin_get_value(self):
+        return self.stdin
+
+    def pep8(self, *args):
+        del sys.stdout[:], sys.stderr[:]
+        sys.argv[1:] = args
+        try:
+            pep8._main()
+            errorcode = None
+        except SystemExit:
+            errorcode = sys.exc_info()[1].code
+        return sys.stdout.getvalue(), sys.stderr.getvalue(), errorcode
+
+    def test_print_usage(self):
+        stdout, stderr, errcode = self.pep8('--help')
+        self.assertFalse(errcode)
+        self.assertFalse(stderr)
+        self.assertTrue(stdout.startswith("Usage: pep8 [options] input"))
+
+        stdout, stderr, errcode = self.pep8('--version')
+        self.assertFalse(errcode)
+        self.assertFalse(stderr)
+        self.assertEqual(stdout.count('\n'), 1)
+
+        stdout, stderr, errcode = self.pep8('--obfuscated')
+        self.assertEqual(errcode, 2)
+        self.assertEqual(stderr.splitlines(),
+                         ["Usage: pep8 [options] input ...", "",
+                          "pep8: error: no such option: --obfuscated"])
+        self.assertFalse(stdout)
+
+        self.assertFalse(self._config_filenames)
+
+    def test_check_simple(self):
+        E11 = os.path.join(ROOT_DIR, 'testsuite', 'E11.py')
+        stdout, stderr, errcode = self.pep8(E11)
+        stdout = stdout.splitlines()
+        self.assertEqual(errcode, 1)
+        self.assertFalse(stderr)
+        self.assertEqual(len(stdout), 4)
+        for line, num, col in zip(stdout, (3, 6, 9, 12), (3, 6, 1, 5)):
+            path, x, y, msg = line.split(':')
+            self.assertTrue(path.endswith(E11))
+            self.assertEqual(x, str(num))
+            self.assertEqual(y, str(col))
+            self.assertTrue(msg.startswith(' E11'))
+        # Config file read from the pep8's tox.ini
+        (config_filename,) = self._config_filenames
+        self.assertTrue(config_filename.endswith('tox.ini'))
+
+    def test_check_stdin(self):
+        pep8.PROJECT_CONFIG = ()
+        stdout, stderr, errcode = self.pep8('-')
+        self.assertFalse(errcode)
+        self.assertFalse(stderr)
+        self.assertFalse(stdout)
+
+        self.stdin = 'import os, sys\n'
+        stdout, stderr, errcode = self.pep8('-')
+        stdout = stdout.splitlines()
+        self.assertEqual(errcode, 1)
+        self.assertFalse(stderr)
+        self.assertEqual(stdout,
+                         ['stdin:1:10: E401 multiple imports on one line'])
+
+    def test_check_non_existent(self):
+        self.stdin = 'import os, sys\n'
+        stdout, stderr, errcode = self.pep8('fictitious.py')
+        self.assertEqual(errcode, 1)
+        self.assertFalse(stderr)
+        self.assertTrue(stdout.startswith('fictitious.py:1:1: E902 '))
+
+    def test_check_noarg(self):
+        # issue #170: do not read stdin by default
+        pep8.PROJECT_CONFIG = ()
+        stdout, stderr, errcode = self.pep8()
+        self.assertEqual(errcode, 2)
+        self.assertEqual(stderr.splitlines(),
+                         ["Usage: pep8 [options] input ...", "",
+                          "pep8: error: input not specified"])
+        self.assertFalse(self._config_filenames)
+
+    def test_check_diff(self):
+        pep8.PROJECT_CONFIG = ()
+        diff_lines = [
+            "--- testsuite/E11.py	2006-06-01 08:49:50 +0500",
+            "+++ testsuite/E11.py	2008-04-06 17:36:29 +0500",
+            "@@ -2,4 +2,7 @@",
+            " if x > 2:",
+            "   print x",
+            "+#: E111",
+            "+if True:",
+            "+     print",
+            " #: E112",
+            " if False:",
+            "",
+        ]
+
+        self.stdin = '\n'.join(diff_lines)
+        stdout, stderr, errcode = self.pep8('--diff')
+        stdout = stdout.splitlines()
+        self.assertEqual(errcode, 1)
+        self.assertFalse(stderr)
+        for line, num, col in zip(stdout, (3, 6), (3, 6)):
+            path, x, y, msg = line.split(':')
+            self.assertEqual(x, str(num))
+            self.assertEqual(y, str(col))
+            self.assertTrue(msg.startswith(' E11'))
+
+        diff_lines[:2] = ["--- a/testsuite/E11.py	2006-06-01 08:49 +0400",
+                          "+++ b/testsuite/E11.py	2008-04-06 17:36 +0400"]
+        self.stdin = '\n'.join(diff_lines)
+        stdout, stderr, errcode = self.pep8('--diff')
+        stdout = stdout.splitlines()
+        self.assertEqual(errcode, 1)
+        self.assertFalse(stderr)
+        for line, num, col in zip(stdout, (3, 6), (3, 6)):
+            path, x, y, msg = line.split(':')
+            self.assertEqual(x, str(num))
+            self.assertEqual(y, str(col))
+            self.assertTrue(msg.startswith(' E11'))
+
+        # issue #127, #137: one-line chunks
+        diff_lines[:-1] = ["diff --git a/testsuite/E11.py b/testsuite/E11.py",
+                           "index 8735e25..2ecb529 100644",
+                           "--- a/testsuite/E11.py",
+                           "+++ b/testsuite/E11.py",
+                           "@@ -5,0 +6 @@ if True:",
+                           "+     print"]
+        self.stdin = '\n'.join(diff_lines)
+        stdout, stderr, errcode = self.pep8('--diff')
+        (stdout,) = stdout.splitlines()
+        self.assertEqual(errcode, 1)
+        self.assertFalse(stderr)
+        self.assertTrue('testsuite/E11.py:6:6: E111 ' in stdout)
+
+        # missing '--diff'
+        self.stdin = '\n'.join(diff_lines)
+        stdout, stderr, errcode = self.pep8()
+        self.assertEqual(errcode, 2)
+        self.assertFalse(stdout)
+        self.assertTrue(stderr.startswith('Usage: pep8 [options] input ...'))
+
+        # no matching file in the diff
+        diff_lines[3] = "+++ b/testsuite/lost/E11.py"
+        self.stdin = '\n'.join(diff_lines)
+        stdout, stderr, errcode = self.pep8('--diff')
+        self.assertFalse(errcode)
+        self.assertFalse(stdout)
+        self.assertFalse(stderr)
new file mode 100644
--- /dev/null
+++ b/pep8/testsuite/utf-8-bom.py
@@ -0,0 +1,6 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+hello = 'こんにちわ'
+
+# EOF
new file mode 100644
--- /dev/null
+++ b/pep8/testsuite/utf-8.py
@@ -0,0 +1,52 @@
+# -*- coding: utf-8 -*-
+
+
+class Rectangle(Blob):
+
+        def __init__(self, width, height,
+                     color='black', emphasis=None, highlight=0):
+            if width == 0 and height == 0 and \
+                    color == 'red' and emphasis == 'strong' or \
+                    highlight > 100:
+                raise ValueError("sorry, you lose")
+            if width == 0 and height == 0 and (color == 'red' or
+                                               emphasis is None):
+                raise ValueError("I don't think so -- values are %s, %s" %
+                                 (width, height))
+            Blob.__init__(self, width, height,
+                          color, emphasis, highlight)
+
+
+# Some random text with multi-byte characters (utf-8 encoded)
+#
+# Εδώ μάτσο κειμένων τη, τρόπο πιθανό διευθυντές ώρα μη. Νέων απλό παράγει ροή
+# κι, το επί δεδομένη καθορίζουν. Πάντως ζητήσεις περιβάλλοντος ένα με, τη
+# ξέχασε αρπάζεις φαινόμενο όλη. Τρέξει εσφαλμένη χρησιμοποίησέ νέα τι. Θα όρο
+# πετάνε φακέλους, άρα με διακοπής λαμβάνουν εφαμοργής. Λες κι μειώσει
+# καθυστερεί.
+
+# 79 narrow chars
+# 01 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 [79]
+
+# 78 narrow chars (Na) + 1 wide char (W)
+# 01 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8情
+
+# 2 narrow chars (Na) + 40 wide chars (W)
+# 情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情
+
+# 2 narrow chars (Na) + 77 wide chars (W)
+# 情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情
+
+#
+#: E501
+# 80 narrow chars (Na)
+# 01 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6  [80]
+#
+#: E501
+# 78 narrow chars (Na) + 2 wide char (W)
+# 01 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8情情
+#
+#: E501
+# 2 narrow chars (Na) + 78 wide chars (W)
+# 情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情
+#