flake8-2.1.0/ 0000755 0001750 0000144 00000000000 12233022416 013625 5 ustar icordasc users 0000000 0000000 flake8-2.1.0/CONTRIBUTORS.txt 0000644 0001750 0000144 00000000556 12161467632 016346 0 ustar icordasc users 0000000 0000000 Project created by Tarek Ziadé.
Contributors (by order of appearance) :
- Tamás Gulácsi
- Nicolas Dumazet
- Stefan Scherfke
- Chris Adams
- Ben Bass
- Ask Solem
- Steven Kryskalla
- Gustavo Picon
- Jannis Leidel
- Miki Tebeka
- David Cramer
- Peter Teichman
- Ian Cordasco
- Oleg Broytman
- Marc Labbé
- Bruno Miguel Custódio
- Florent Xicluna
- Austin Morton flake8-2.1.0/PKG-INFO 0000644 0001750 0000144 00000021316 12233022416 014725 0 ustar icordasc users 0000000 0000000 Metadata-Version: 1.1
Name: flake8
Version: 2.1.0
Summary: the modular source code checker: pep8, pyflakes and co
Home-page: http://bitbucket.org/tarek/flake8
Author: Ian Cordasco
Author-email: graffatcolmingov@gmail.com
License: MIT
Description: ======
Flake8
======
Flake8 is a wrapper around these tools:
- PyFlakes
- pep8
- Ned Batchelder's McCabe script
Flake8 runs all the tools by launching the single ``flake8`` script.
It displays the warnings in a per-file, merged output.
It also adds a few features:
- files that contain this line are skipped::
# flake8: noqa
- lines that contain a ``# noqa`` comment at the end will not issue warnings.
- a Git and a Mercurial hook.
- a McCabe complexity checker.
- extendable through ``flake8.extension`` entry points.
QuickStart
==========
::
pip install flake8
To run flake8 just invoke it against any directory or Python module::
$ flake8 coolproject
coolproject/mod.py:97:1: F401 'shutil' imported but unused
coolproject/mod.py:625:17: E225 missing whitespace around operato
coolproject/mod.py:729:1: F811 redefinition of function 'readlines' from line 723
coolproject/mod.py:1028:1: F841 local variable 'errors' is assigned to but never used
The outputs of PyFlakes *and* pep8 (and the optional plugins) are merged
and returned.
flake8 offers an extra option: --max-complexity, which will emit a warning if
the McCabe complexity of a function is higher than the value. By default it's
deactivated::
$ flake8 --max-complexity 12 coolproject
coolproject/mod.py:97:1: F401 'shutil' imported but unused
coolproject/mod.py:625:17: E225 missing whitespace around operator
coolproject/mod.py:729:1: F811 redefinition of unused 'readlines' from line 723
coolproject/mod.py:939:1: C901 'Checker.check_all' is too complex (12)
coolproject/mod.py:1028:1: F841 local variable 'errors' is assigned to but never used
coolproject/mod.py:1204:1: C901 'selftest' is too complex (14)
This feature is quite useful to detect over-complex code. According to McCabe,
anything that goes beyond 10 is too complex.
See https://en.wikipedia.org/wiki/Cyclomatic_complexity.
Questions or Feedback
=====================
If you have questions you'd like to ask the developers, or feedback you'd like
to provide, feel free to use the mailing list: code-quality@python.org We
would love to hear from you. Additionally, if you have a feature you'd like to
suggest, the mailing list would be the best place for it.
.. _links:
Links
=====
* `flake8 documentation `_
* `pep8 documentation `_
CHANGES
=======
2.1.0 - 2013-10-26
------------------
- Add FLAKE8_LAZY and FLAKE8_IGNORE environment variable support to git and
mercurial hooks
- Force git and mercurial hooks to repsect configuration in setup.cfg
- Only check staged files if that is specified
- Fix hook file permissions
- Fix the git hook on python 3
- Ignore non-python files when running the git hook
- Ignore .tox directories by default
- Flake8 now reports the column number for PyFlakes messages
2.0.0 - 2013-02-23
------------------
- Pyflakes errors are prefixed by an ``F`` instead of an ``E``
- McCabe complexity warnings are prefixed by a ``C`` instead of a ``W``
- Flake8 supports extensions through entry points
- Due to the above support, we **require** setuptools
- We publish the `documentation `_
- Fixes #13: pep8, pyflakes and mccabe become external dependencies
- Split run.py into main.py, engine.py and hooks.py for better logic
- Expose our parser for our users
- New feature: Install git and hg hooks automagically
- By relying on pyflakes (0.6.1), we also fixed #45 and #35
1.7.0 - 2012-12-21
------------------
- Fixes part of #35: Exception for no WITHITEM being an attribute of Checker
for Python 3.3
- Support stdin
- Incorporate @phd's builtins pull request
- Fix the git hook
- Update pep8.py to the latest version
1.6.2 - 2012-11-25
------------------
- fixed the NameError: global name 'message' is not defined (#46)
1.6.1 - 2012-11-24
------------------
- fixed the mercurial hook, a change from a previous patch was not properly
applied
- fixed an assumption about warnings/error messages that caused an exception
to be thrown when McCabe is used
1.6 - 2012-11-16
----------------
- changed the signatures of the ``check_file`` function in flake8/run.py,
``skip_warning`` in flake8/util.py and the ``check``, ``checkPath``
functions in flake8/pyflakes.py.
- fix ``--exclude`` and ``--ignore`` command flags (#14, #19)
- fix the git hook that wasn't catching files not already added to the index
(#29)
- pre-emptively includes the addition to pep8 to ignore certain lines.
Add ``# nopep8`` to the end of a line to ignore it. (#37)
- ``check_file`` can now be used without any special prior setup (#21)
- unpacking exceptions will no longer cause an exception (#20)
- fixed crash on non-existent file (#38)
1.5 - 2012-10-13
----------------
- fixed the stdin
- make sure mccabe catches the syntax errors as warnings
- pep8 upgrade
- added max_line_length default value
- added Flake8Command and entry points is setuptools is around
- using the setuptools console wrapper when available
1.4 - 2012-07-12
----------------
- git_hook: Only check staged changes for compliance
- use pep8 1.2
1.3.1 - 2012-05-19
------------------
- fixed support for Python 2.5
1.3 - 2012-03-12
----------------
- fixed false W402 warning on exception blocks.
1.2 - 2012-02-12
----------------
- added a git hook
- now Python 3 compatible
- mccabe and pyflakes have warning codes like pep8 now
1.1 - 2012-02-14
----------------
- fixed the value returned by --version
- allow the flake8: header to be more generic
- fixed the "hg hook raises 'physical lines'" bug
- allow three argument form of raise
- now uses setuptools if available, for 'develop' command
1.0 - 2011-11-29
----------------
- Deactivates by default the complexity checker
- Introduces the complexity option in the HG hook and the command line.
0.9 - 2011-11-09
----------------
- update pep8 version to 0.6.1
- mccabe check: gracefully handle compile failure
0.8 - 2011-02-27
----------------
- fixed hg hook
- discard unexisting files on hook check
0.7 - 2010-02-18
----------------
- Fix pep8 initialization when run through Hg
- Make pep8 short options work when run through the command line
- Skip duplicates when controlling files via Hg
0.6 - 2010-02-15
----------------
- Fix the McCabe metric on some loops
Platform: UNKNOWN
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Software Development :: Quality Assurance
flake8-2.1.0/LICENSE 0000644 0001750 0000144 00000002224 12165553306 014645 0 ustar icordasc users 0000000 0000000 == Flake8 License (MIT) ==
Copyright (C) 2011-2013 Tarek Ziade
Copyright (C) 2012-2013 Ian Cordasco
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.
flake8-2.1.0/README.rst 0000644 0001750 0000144 00000004571 12165553306 015336 0 ustar icordasc users 0000000 0000000 ======
Flake8
======
Flake8 is a wrapper around these tools:
- PyFlakes
- pep8
- Ned Batchelder's McCabe script
Flake8 runs all the tools by launching the single ``flake8`` script.
It displays the warnings in a per-file, merged output.
It also adds a few features:
- files that contain this line are skipped::
# flake8: noqa
- lines that contain a ``# noqa`` comment at the end will not issue warnings.
- a Git and a Mercurial hook.
- a McCabe complexity checker.
- extendable through ``flake8.extension`` entry points.
QuickStart
==========
::
pip install flake8
To run flake8 just invoke it against any directory or Python module::
$ flake8 coolproject
coolproject/mod.py:97:1: F401 'shutil' imported but unused
coolproject/mod.py:625:17: E225 missing whitespace around operato
coolproject/mod.py:729:1: F811 redefinition of function 'readlines' from line 723
coolproject/mod.py:1028:1: F841 local variable 'errors' is assigned to but never used
The outputs of PyFlakes *and* pep8 (and the optional plugins) are merged
and returned.
flake8 offers an extra option: --max-complexity, which will emit a warning if
the McCabe complexity of a function is higher than the value. By default it's
deactivated::
$ flake8 --max-complexity 12 coolproject
coolproject/mod.py:97:1: F401 'shutil' imported but unused
coolproject/mod.py:625:17: E225 missing whitespace around operator
coolproject/mod.py:729:1: F811 redefinition of unused 'readlines' from line 723
coolproject/mod.py:939:1: C901 'Checker.check_all' is too complex (12)
coolproject/mod.py:1028:1: F841 local variable 'errors' is assigned to but never used
coolproject/mod.py:1204:1: C901 'selftest' is too complex (14)
This feature is quite useful to detect over-complex code. According to McCabe,
anything that goes beyond 10 is too complex.
See https://en.wikipedia.org/wiki/Cyclomatic_complexity.
Questions or Feedback
=====================
If you have questions you'd like to ask the developers, or feedback you'd like
to provide, feel free to use the mailing list: code-quality@python.org We
would love to hear from you. Additionally, if you have a feature you'd like to
suggest, the mailing list would be the best place for it.
.. _links:
Links
=====
* `flake8 documentation `_
* `pep8 documentation `_
flake8-2.1.0/flake8.egg-info/ 0000755 0001750 0000144 00000000000 12233022416 016471 5 ustar icordasc users 0000000 0000000 flake8-2.1.0/flake8.egg-info/PKG-INFO 0000644 0001750 0000144 00000021316 12233022416 017571 0 ustar icordasc users 0000000 0000000 Metadata-Version: 1.1
Name: flake8
Version: 2.1.0
Summary: the modular source code checker: pep8, pyflakes and co
Home-page: http://bitbucket.org/tarek/flake8
Author: Ian Cordasco
Author-email: graffatcolmingov@gmail.com
License: MIT
Description: ======
Flake8
======
Flake8 is a wrapper around these tools:
- PyFlakes
- pep8
- Ned Batchelder's McCabe script
Flake8 runs all the tools by launching the single ``flake8`` script.
It displays the warnings in a per-file, merged output.
It also adds a few features:
- files that contain this line are skipped::
# flake8: noqa
- lines that contain a ``# noqa`` comment at the end will not issue warnings.
- a Git and a Mercurial hook.
- a McCabe complexity checker.
- extendable through ``flake8.extension`` entry points.
QuickStart
==========
::
pip install flake8
To run flake8 just invoke it against any directory or Python module::
$ flake8 coolproject
coolproject/mod.py:97:1: F401 'shutil' imported but unused
coolproject/mod.py:625:17: E225 missing whitespace around operato
coolproject/mod.py:729:1: F811 redefinition of function 'readlines' from line 723
coolproject/mod.py:1028:1: F841 local variable 'errors' is assigned to but never used
The outputs of PyFlakes *and* pep8 (and the optional plugins) are merged
and returned.
flake8 offers an extra option: --max-complexity, which will emit a warning if
the McCabe complexity of a function is higher than the value. By default it's
deactivated::
$ flake8 --max-complexity 12 coolproject
coolproject/mod.py:97:1: F401 'shutil' imported but unused
coolproject/mod.py:625:17: E225 missing whitespace around operator
coolproject/mod.py:729:1: F811 redefinition of unused 'readlines' from line 723
coolproject/mod.py:939:1: C901 'Checker.check_all' is too complex (12)
coolproject/mod.py:1028:1: F841 local variable 'errors' is assigned to but never used
coolproject/mod.py:1204:1: C901 'selftest' is too complex (14)
This feature is quite useful to detect over-complex code. According to McCabe,
anything that goes beyond 10 is too complex.
See https://en.wikipedia.org/wiki/Cyclomatic_complexity.
Questions or Feedback
=====================
If you have questions you'd like to ask the developers, or feedback you'd like
to provide, feel free to use the mailing list: code-quality@python.org We
would love to hear from you. Additionally, if you have a feature you'd like to
suggest, the mailing list would be the best place for it.
.. _links:
Links
=====
* `flake8 documentation `_
* `pep8 documentation `_
CHANGES
=======
2.1.0 - 2013-10-26
------------------
- Add FLAKE8_LAZY and FLAKE8_IGNORE environment variable support to git and
mercurial hooks
- Force git and mercurial hooks to repsect configuration in setup.cfg
- Only check staged files if that is specified
- Fix hook file permissions
- Fix the git hook on python 3
- Ignore non-python files when running the git hook
- Ignore .tox directories by default
- Flake8 now reports the column number for PyFlakes messages
2.0.0 - 2013-02-23
------------------
- Pyflakes errors are prefixed by an ``F`` instead of an ``E``
- McCabe complexity warnings are prefixed by a ``C`` instead of a ``W``
- Flake8 supports extensions through entry points
- Due to the above support, we **require** setuptools
- We publish the `documentation `_
- Fixes #13: pep8, pyflakes and mccabe become external dependencies
- Split run.py into main.py, engine.py and hooks.py for better logic
- Expose our parser for our users
- New feature: Install git and hg hooks automagically
- By relying on pyflakes (0.6.1), we also fixed #45 and #35
1.7.0 - 2012-12-21
------------------
- Fixes part of #35: Exception for no WITHITEM being an attribute of Checker
for Python 3.3
- Support stdin
- Incorporate @phd's builtins pull request
- Fix the git hook
- Update pep8.py to the latest version
1.6.2 - 2012-11-25
------------------
- fixed the NameError: global name 'message' is not defined (#46)
1.6.1 - 2012-11-24
------------------
- fixed the mercurial hook, a change from a previous patch was not properly
applied
- fixed an assumption about warnings/error messages that caused an exception
to be thrown when McCabe is used
1.6 - 2012-11-16
----------------
- changed the signatures of the ``check_file`` function in flake8/run.py,
``skip_warning`` in flake8/util.py and the ``check``, ``checkPath``
functions in flake8/pyflakes.py.
- fix ``--exclude`` and ``--ignore`` command flags (#14, #19)
- fix the git hook that wasn't catching files not already added to the index
(#29)
- pre-emptively includes the addition to pep8 to ignore certain lines.
Add ``# nopep8`` to the end of a line to ignore it. (#37)
- ``check_file`` can now be used without any special prior setup (#21)
- unpacking exceptions will no longer cause an exception (#20)
- fixed crash on non-existent file (#38)
1.5 - 2012-10-13
----------------
- fixed the stdin
- make sure mccabe catches the syntax errors as warnings
- pep8 upgrade
- added max_line_length default value
- added Flake8Command and entry points is setuptools is around
- using the setuptools console wrapper when available
1.4 - 2012-07-12
----------------
- git_hook: Only check staged changes for compliance
- use pep8 1.2
1.3.1 - 2012-05-19
------------------
- fixed support for Python 2.5
1.3 - 2012-03-12
----------------
- fixed false W402 warning on exception blocks.
1.2 - 2012-02-12
----------------
- added a git hook
- now Python 3 compatible
- mccabe and pyflakes have warning codes like pep8 now
1.1 - 2012-02-14
----------------
- fixed the value returned by --version
- allow the flake8: header to be more generic
- fixed the "hg hook raises 'physical lines'" bug
- allow three argument form of raise
- now uses setuptools if available, for 'develop' command
1.0 - 2011-11-29
----------------
- Deactivates by default the complexity checker
- Introduces the complexity option in the HG hook and the command line.
0.9 - 2011-11-09
----------------
- update pep8 version to 0.6.1
- mccabe check: gracefully handle compile failure
0.8 - 2011-02-27
----------------
- fixed hg hook
- discard unexisting files on hook check
0.7 - 2010-02-18
----------------
- Fix pep8 initialization when run through Hg
- Make pep8 short options work when run through the command line
- Skip duplicates when controlling files via Hg
0.6 - 2010-02-15
----------------
- Fix the McCabe metric on some loops
Platform: UNKNOWN
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Software Development :: Quality Assurance
flake8-2.1.0/flake8.egg-info/dependency_links.txt 0000644 0001750 0000144 00000000001 12233022416 022537 0 ustar icordasc users 0000000 0000000
flake8-2.1.0/flake8.egg-info/requires.txt 0000644 0001750 0000144 00000000057 12233022416 021073 0 ustar icordasc users 0000000 0000000 pyflakes >= 0.7.3
pep8 >= 1.4.6
mccabe >= 0.2.1 flake8-2.1.0/flake8.egg-info/entry_points.txt 0000644 0001750 0000144 00000000235 12233022416 021767 0 ustar icordasc users 0000000 0000000 [flake8.extension]
F = flake8._pyflakes:FlakesChecker
[console_scripts]
flake8 = flake8.main:main
[distutils.commands]
flake8 = flake8.main:Flake8Command
flake8-2.1.0/flake8.egg-info/SOURCES.txt 0000644 0001750 0000144 00000001451 12233022416 020356 0 ustar icordasc users 0000000 0000000 CHANGES.rst
CONTRIBUTORS.txt
LICENSE
MANIFEST.in
README.rst
setup.py
flake8/__init__.py
flake8/__init__.pyc
flake8/_pyflakes.py
flake8/_pyflakes.pyc
flake8/engine.py
flake8/engine.pyc
flake8/hooks.py
flake8/hooks.py.orig
flake8/hooks.pyc
flake8/main.py
flake8/main.pyc
flake8/run.py
flake8/util.py
flake8/util.pyc
flake8.egg-info/PKG-INFO
flake8.egg-info/SOURCES.txt
flake8.egg-info/dependency_links.txt
flake8.egg-info/entry_points.txt
flake8.egg-info/requires.txt
flake8.egg-info/top_level.txt
flake8/__pycache__/__init__.cpython-32.pyc
flake8/__pycache__/_pyflakes.cpython-32.pyc
flake8/__pycache__/engine.cpython-32.pyc
flake8/__pycache__/main.cpython-32.pyc
flake8/__pycache__/util.cpython-32.pyc
flake8/tests/__init__.py
flake8/tests/__init__.pyc
flake8/tests/test_engine.py
flake8/tests/test_engine.pyc flake8-2.1.0/flake8.egg-info/top_level.txt 0000644 0001750 0000144 00000000007 12233022416 021220 0 ustar icordasc users 0000000 0000000 flake8
flake8-2.1.0/CHANGES.rst 0000644 0001750 0000144 00000007574 12233022263 015444 0 ustar icordasc users 0000000 0000000 CHANGES
=======
2.1.0 - 2013-10-26
------------------
- Add FLAKE8_LAZY and FLAKE8_IGNORE environment variable support to git and
mercurial hooks
- Force git and mercurial hooks to repsect configuration in setup.cfg
- Only check staged files if that is specified
- Fix hook file permissions
- Fix the git hook on python 3
- Ignore non-python files when running the git hook
- Ignore .tox directories by default
- Flake8 now reports the column number for PyFlakes messages
2.0.0 - 2013-02-23
------------------
- Pyflakes errors are prefixed by an ``F`` instead of an ``E``
- McCabe complexity warnings are prefixed by a ``C`` instead of a ``W``
- Flake8 supports extensions through entry points
- Due to the above support, we **require** setuptools
- We publish the `documentation `_
- Fixes #13: pep8, pyflakes and mccabe become external dependencies
- Split run.py into main.py, engine.py and hooks.py for better logic
- Expose our parser for our users
- New feature: Install git and hg hooks automagically
- By relying on pyflakes (0.6.1), we also fixed #45 and #35
1.7.0 - 2012-12-21
------------------
- Fixes part of #35: Exception for no WITHITEM being an attribute of Checker
for Python 3.3
- Support stdin
- Incorporate @phd's builtins pull request
- Fix the git hook
- Update pep8.py to the latest version
1.6.2 - 2012-11-25
------------------
- fixed the NameError: global name 'message' is not defined (#46)
1.6.1 - 2012-11-24
------------------
- fixed the mercurial hook, a change from a previous patch was not properly
applied
- fixed an assumption about warnings/error messages that caused an exception
to be thrown when McCabe is used
1.6 - 2012-11-16
----------------
- changed the signatures of the ``check_file`` function in flake8/run.py,
``skip_warning`` in flake8/util.py and the ``check``, ``checkPath``
functions in flake8/pyflakes.py.
- fix ``--exclude`` and ``--ignore`` command flags (#14, #19)
- fix the git hook that wasn't catching files not already added to the index
(#29)
- pre-emptively includes the addition to pep8 to ignore certain lines.
Add ``# nopep8`` to the end of a line to ignore it. (#37)
- ``check_file`` can now be used without any special prior setup (#21)
- unpacking exceptions will no longer cause an exception (#20)
- fixed crash on non-existent file (#38)
1.5 - 2012-10-13
----------------
- fixed the stdin
- make sure mccabe catches the syntax errors as warnings
- pep8 upgrade
- added max_line_length default value
- added Flake8Command and entry points is setuptools is around
- using the setuptools console wrapper when available
1.4 - 2012-07-12
----------------
- git_hook: Only check staged changes for compliance
- use pep8 1.2
1.3.1 - 2012-05-19
------------------
- fixed support for Python 2.5
1.3 - 2012-03-12
----------------
- fixed false W402 warning on exception blocks.
1.2 - 2012-02-12
----------------
- added a git hook
- now Python 3 compatible
- mccabe and pyflakes have warning codes like pep8 now
1.1 - 2012-02-14
----------------
- fixed the value returned by --version
- allow the flake8: header to be more generic
- fixed the "hg hook raises 'physical lines'" bug
- allow three argument form of raise
- now uses setuptools if available, for 'develop' command
1.0 - 2011-11-29
----------------
- Deactivates by default the complexity checker
- Introduces the complexity option in the HG hook and the command line.
0.9 - 2011-11-09
----------------
- update pep8 version to 0.6.1
- mccabe check: gracefully handle compile failure
0.8 - 2011-02-27
----------------
- fixed hg hook
- discard unexisting files on hook check
0.7 - 2010-02-18
----------------
- Fix pep8 initialization when run through Hg
- Make pep8 short options work when run through the command line
- Skip duplicates when controlling files via Hg
0.6 - 2010-02-15
----------------
- Fix the McCabe metric on some loops
flake8-2.1.0/flake8/ 0000755 0001750 0000144 00000000000 12233022416 014777 5 ustar icordasc users 0000000 0000000 flake8-2.1.0/flake8/util.pyc 0000644 0001750 0000144 00000003636 12166066416 016516 0 ustar icordasc users 0000000 0000000
oQc @ s y d d l Z e j Z Wn\ e k
rw d d l Z d e j j k rk d e j _ e d e j _ n d Z n Xd e f d YZ
d Z d Z d S(
iNt decorator_listc C s | j S( N( t
decorators( t s( ( s ./flake8/util.pyt s c c s | j s
d Sxz | j D]o } t | | d } t | t j rI | Vq t | t r x+ | D] } t | t j r_ | Vq_ q_ Wq q Wd S( s
Yield all direct child nodes of *node*, that is, all fields that
are nodes and all items of fields that are lists of nodes.
N( t _fieldst getattrt Nonet
isinstancet astt ASTt list( t nodet namet fieldt item( ( s ./flake8/util.pyt iter_child_nodes s
t
OrderedSetc B s e Z d Z d Z d Z RS( s List without duplicates.c C s | | k r | j | n d S( N( t append( t selft value( ( s ./flake8/util.pyt add# s ( ( t __name__t
__module__t __doc__t __slots__R ( ( ( s ./flake8/util.pyR s c C s t | } | j d k S(
s, Guess if the value could be an on/off togglet 1t 0t Ft Tt TRUEt FALSEt ONt OFF( R R R R R R R R ( t strt upper( t val( ( s ./flake8/util.pyt is_flag( s c C s t | j d k S( s Return true if flag is onR R R R ( R R s TRUEs ON( R! R" ( R# ( ( s ./flake8/util.pyt flag_on. s ( (
R R t ImportErrort _astt ClassDefR R t propertyt FunctionDefR
R R$ R% ( ( ( s ./flake8/util.pyt s
flake8-2.1.0/flake8/tests/ 0000755 0001750 0000144 00000000000 12233022416 016141 5 ustar icordasc users 0000000 0000000 flake8-2.1.0/flake8/tests/__init__.py 0000644 0001750 0000144 00000000002 12161467632 020257 0 ustar icordasc users 0000000 0000000 #
flake8-2.1.0/flake8/tests/__init__.pyc 0000644 0001750 0000144 00000000161 12166032716 020424 0 ustar icordasc users 0000000 0000000
oQc @ s d S( N( ( ( ( s ./flake8/tests/__init__.pyt s flake8-2.1.0/flake8/tests/test_engine.py 0000644 0001750 0000144 00000005640 12166037044 021034 0 ustar icordasc users 0000000 0000000 from flake8 import engine, util, __version__
import pep8
import unittest
import mock
class TestEngine(unittest.TestCase):
def setUp(self):
self.patches = {}
def tearDown(self):
assert len(self.patches.items()) == 0
def start_patch(self, patch):
self.patches[patch] = mock.patch(patch)
return self.patches[patch].start()
def stop_patches(self):
patches = self.patches.copy()
for k, v in patches.items():
v.stop()
del(self.patches[k])
def test_get_style_guide(self):
with mock.patch('flake8.engine._register_extensions') as reg_ext:
reg_ext.return_value = ([], [], [])
g = engine.get_style_guide()
self.assertTrue(isinstance(g, engine.StyleGuide))
reg_ext.assert_called_once_with()
def test_get_style_guide_kwargs(self):
m = mock.Mock()
with mock.patch('flake8.engine.StyleGuide') as StyleGuide:
with mock.patch('flake8.engine.get_parser') as get_parser:
get_parser.return_value = (m, [])
engine.get_style_guide(foo='bar')
get_parser.assert_called_once_with()
StyleGuide.assert_called_once_with(**{'parser': m, 'foo': 'bar'})
def test_register_extensions(self):
with mock.patch('pep8.register_check') as register_check:
registered_extensions = engine._register_extensions()
self.assertTrue(isinstance(registered_extensions[0], util.OrderedSet))
self.assertTrue(len(registered_extensions[0]) > 0)
for i in registered_extensions[1:]:
self.assertTrue(isinstance(i, list))
register_check.assert_called()
def test_get_parser(self):
# setup
re = self.start_patch('flake8.engine._register_extensions')
gpv = self.start_patch('flake8.engine.get_python_version')
pgp = self.start_patch('pep8.get_parser')
m = mock.Mock()
re.return_value = ([('pyflakes', '0.7'), ('mccabe', '0.2')], [], [])
gpv.return_value = 'Python Version'
pgp.return_value = m
# actual call we're testing
parser, hooks = engine.get_parser()
# assertions
re.assert_called()
gpv.assert_called()
pgp.assert_called_once_with(
'flake8',
'%s (pyflakes: 0.7, mccabe: 0.2) Python Version' % __version__
)
m.remove_option.assert_called()
m.add_option.assert_called()
self.assertEqual(parser, m)
self.assertEqual(hooks, [])
# clean-up
self.stop_patches()
def test_get_python_version(self):
self.assertTrue('on' in engine.get_python_version())
# Silly test but it will provide 100% test coverage
# Also we can never be sure (without reconstructing the string
# ourselves) what system we may be testing on.
if __name__ == '__main__':
unittest.main()
flake8-2.1.0/flake8/tests/test_engine.pyc 0000644 0001750 0000144 00000007174 12166066402 021203 0 ustar icordasc users 0000000 0000000
$>Qc @ sv d d l m Z m Z m Z d d l Z d d l Z d d l Z d e j f d YZ e d k rr e j
n d S( i( t enginet utilt __version__Nt
TestEnginec B sY e Z d Z d Z d Z d Z d Z d Z d Z d Z d Z
RS( c C s
i | _ d S( N( t patches( t self( ( s ./flake8/tests/test_engine.pyt setUp s c C s% t | j j d k s! t d S( Ni ( t lenR t itemst AssertionError( R ( ( s ./flake8/tests/test_engine.pyt tearDown s c C s' t j | | j | <| j | j S( N( t mockt patchR t start( R R ( ( s ./flake8/tests/test_engine.pyt start_patch s c C sD | j j } x. | j D] \ } } | j | j | =q Wd S( N( R t copyR t stop( R R t kt v( ( s ./flake8/tests/test_engine.pyt stop_patches s
c C s] t j d H } g g g f | _ t j } | j t | t j | j Wd QXd S( Ns" flake8.engine._register_extensions( R R t return_valueR t get_style_guidet
assertTruet
isinstancet
StyleGuidet assert_called_once_with( R t reg_extt g( ( s ./flake8/tests/test_engine.pyt test_get_style_guide s
c C s t j } t j d c } t j d 0 } | g f | _ t j d d | j Wd QX| j i | d 6d d 6 Wd QXd S( Ns flake8.engine.StyleGuides flake8.engine.get_parsert foot bart parser( R t MockR R R R R ( R t mR t
get_parser( ( s ./flake8/tests/test_engine.pyt test_get_style_guide_kwargs s c C s t j d } t j } | j t | d t j | j t | d d k x( | d D] } | j t | t qc W| j
Wd QXd S( Ns pep8.register_checki i ( R R R t _register_extensionsR R R t
OrderedSetR t listt
assert_called( R t register_checkt registered_extensionst i( ( s ./flake8/tests/test_engine.pyt test_register_extensions( s c C s | j d } | j d } | j d } t j } d d g g g f | _ d | _ | | _ t j \ } } | j | j | j d d
t | j j | j
j | j | | | j | g | j d S(
Ns" flake8.engine._register_extensionss flake8.engine.get_python_versions pep8.get_parsert pyflakess 0.7t mccabes 0.2s Python Versiont flake8s. %s (pyflakes: 0.7, mccabe: 0.2) Python Version( R, s 0.7( R- s 0.2(
R R R R R R" R' R R t
remove_optiont
add_optiont assertEqualR ( R t ret gpvt pgpR! R t hooks( ( s ./flake8/tests/test_engine.pyt test_get_parser1 s$
c C s | j d t j k d S( Nt on( R R t get_python_version( R ( ( s ./flake8/tests/test_engine.pyt test_get_python_versionJ s ( t __name__t
__module__R R
R R R R# R+ R6 R9 ( ( ( s ./flake8/tests/test_engine.pyR s t __main__( R. R R R t pep8t unittestR t TestCaseR R: t main( ( ( s ./flake8/tests/test_engine.pyt s I flake8-2.1.0/flake8/hooks.py.orig 0000644 0001750 0000144 00000012265 12161467632 017456 0 ustar icordasc users 0000000 0000000 # -*- coding: utf-8 -*-
from __future__ import with_statement
import os
import sys
from subprocess import Popen, PIPE
try:
from mercurial import demandimport
demandimport.disable()
except ImportError:
pass
try:
from configparser import ConfigParser
except ImportError: # Python 2
from ConfigParser import ConfigParser
from flake8.engine import get_parser, get_style_guide
from flake8.main import DEFAULT_CONFIG
def git_hook(complexity=-1, strict=False, ignore=None, lazy=False):
"""This is the function used by the git hook.
:param int complexity: (optional), any value > 0 enables complexity
checking with mccabe
:param bool strict: (optional), if True, this returns the total number of
errors which will cause the hook to fail
:param str ignore: (optional), a comma-separated list of errors and
warnings to ignore
:param bool lazy: (optional), allows for the instances where you don't add
the files to the index before running a commit, e.g., git commit -a
:returns: total number of errors if strict is True, otherwise 0
"""
gitcmd = "git diff-index --cached --name-only HEAD"
if lazy:
# Catch all files, including those not added to the index
gitcmd = gitcmd.replace('--cached ', '')
if hasattr(ignore, 'split'):
ignore = ignore.split(',')
# Returns the exit code, list of files modified, list of error messages
_, files_modified, _ = run(gitcmd)
# Run the checks
flake8_style = get_style_guide(
config_file=DEFAULT_CONFIG, ignore=ignore, max_complexity=complexity)
report = flake8_style.check_files([f for f in files_modified if
f.endswith('.py')])
if strict:
return report.total_errors
return 0
def hg_hook(ui, repo, **kwargs):
"""This is the function executed directly by Mercurial as part of the
hook. This is never called directly by the user, so the parameters are
undocumented. If you would like to learn more about them, please feel free
to read the official Mercurial documentation.
"""
complexity = ui.config('flake8', 'complexity', default=-1)
strict = ui.configbool('flake8', 'strict', default=True)
config = ui.config('flake8', 'config', default=True)
if config is True:
config = DEFAULT_CONFIG
paths = _get_files(repo, **kwargs)
flake8_style = get_style_guide(
config_file=config, max_complexity=complexity)
report = flake8_style.check_files(paths)
if strict:
return report.total_errors
return 0
def run(command):
p = Popen(command.split(), stdout=PIPE, stderr=PIPE)
(stdout, stderr) = p.communicate()
return (p.returncode, [line.strip() for line in stdout.splitlines()],
[line.strip() for line in stderr.splitlines()])
def _get_files(repo, **kwargs):
seen = set()
for rev in range(repo[kwargs['node']], len(repo)):
for file_ in repo[rev].files():
file_ = os.path.join(repo.root, file_)
if file_ in seen or not os.path.exists(file_):
continue
seen.add(file_)
if file_.endswith('.py'):
yield file_
def find_vcs():
if os.path.isdir('.git'):
if not os.path.isdir('.git/hooks'):
os.mkdir('.git/hooks')
return '.git/hooks/pre-commit'
elif os.path.isdir('.hg'):
return '.hg/hgrc'
return ''
git_hook_file = """#!/usr/bin/env python
import sys
import os
from flake8.hooks import git_hook
COMPLEXITY = os.getenv('FLAKE8_COMPLEXITY', 10)
STRICT = os.getenv('FLAKE8_STRICT', False)
if __name__ == '__main__':
sys.exit(git_hook(complexity=COMPLEXITY, strict=STRICT))
"""
def _install_hg_hook(path):
if not os.path.isfile(path):
# Make the file so we can avoid IOError's
open(path, 'w+').close()
c = ConfigParser()
c.readfp(open(path, 'r'))
if not c.has_section('hooks'):
c.add_section('hooks')
if not c.has_option('hooks', 'commit'):
c.set('hooks', 'commit', 'python:flake8.hooks.hg_hook')
if not c.has_option('hooks', 'qrefresh'):
c.set('hooks', 'qrefresh', 'python:flake8.hooks.hg_hook')
if not c.has_section('flake8'):
c.add_section('flake8')
if not c.has_option('flake8', 'complexity'):
c.set('flake8', 'complexity', str(os.getenv('FLAKE8_COMPLEXITY', 10)))
if not c.has_option('flake8', 'strict'):
c.set('flake8', 'strict', os.getenv('FLAKE8_STRICT', False))
c.write(open(path, 'w+'))
def install_hook():
vcs = find_vcs()
if not vcs:
p = get_parser()
sys.stderr.write('Error: could not find either a git or mercurial '
'directory. Please re-run this in a proper '
'repository.')
p.print_help()
sys.exit(1)
status = 0
if 'git' in vcs:
with open(vcs, 'w+') as fd:
fd.write(git_hook_file)
# 0b111100100 == rwxr--r--
# Python 2.5 doesn't support 0b syntax so note that the above binary
# value is equivalent to 484 in decimal
os.chmod(vcs, 484)
elif 'hg' in vcs:
_install_hg_hook(vcs)
else:
status = 1
sys.exit(status)
flake8-2.1.0/flake8/util.py 0000644 0001750 0000144 00000002544 12161467632 016350 0 ustar icordasc users 0000000 0000000 # -*- coding: utf-8 -*-
try:
import ast
iter_child_nodes = ast.iter_child_nodes
except ImportError: # Python 2.5
import _ast as ast
if 'decorator_list' not in ast.ClassDef._fields:
# Patch the missing attribute 'decorator_list'
ast.ClassDef.decorator_list = ()
ast.FunctionDef.decorator_list = property(lambda s: s.decorators)
def iter_child_nodes(node):
"""
Yield all direct child nodes of *node*, that is, all fields that
are nodes and all items of fields that are lists of nodes.
"""
if not node._fields:
return
for name in node._fields:
field = getattr(node, name, None)
if isinstance(field, ast.AST):
yield field
elif isinstance(field, list):
for item in field:
if isinstance(item, ast.AST):
yield item
class OrderedSet(list):
"""List without duplicates."""
__slots__ = ()
def add(self, value):
if value not in self:
self.append(value)
def is_flag(val):
"""Guess if the value could be an on/off toggle"""
val = str(val)
return val.upper() in ('1', '0', 'F', 'T', 'TRUE', 'FALSE', 'ON', 'OFF')
def flag_on(val):
"""Return true if flag is on"""
return str(val).upper() in ('1', 'T', 'TRUE', 'ON')
flake8-2.1.0/flake8/hooks.py 0000644 0001750 0000144 00000020105 12233011206 016465 0 ustar icordasc users 0000000 0000000 # -*- coding: utf-8 -*-
from __future__ import with_statement
import os
import sys
import stat
from subprocess import Popen, PIPE
import shutil
from tempfile import mkdtemp
try:
# The 'demandimport' breaks pyflakes and flake8._pyflakes
from mercurial import demandimport
demandimport.disable()
except ImportError:
pass
try:
from configparser import ConfigParser
except ImportError: # Python 2
from ConfigParser import ConfigParser
from flake8.engine import get_parser, get_style_guide
from flake8.main import DEFAULT_CONFIG
def git_hook(complexity=-1, strict=False, ignore=None, lazy=False):
"""This is the function used by the git hook.
:param int complexity: (optional), any value > 0 enables complexity
checking with mccabe
:param bool strict: (optional), if True, this returns the total number of
errors which will cause the hook to fail
:param str ignore: (optional), a comma-separated list of errors and
warnings to ignore
:param bool lazy: (optional), allows for the instances where you don't add
the files to the index before running a commit, e.g., git commit -a
:returns: total number of errors if strict is True, otherwise 0
"""
gitcmd = "git diff-index --cached --name-only --diff-filter=ACMRTUXB HEAD"
if lazy:
# Catch all files, including those not added to the index
gitcmd = gitcmd.replace('--cached ', '')
if hasattr(ignore, 'split'):
ignore = ignore.split(',')
# Returns the exit code, list of files modified, list of error messages
_, files_modified, _ = run(gitcmd)
# We only want to pass ignore and max_complexity if they differ from the
# defaults so that we don't override a local configuration file
options = {}
if ignore:
options['ignore'] = ignore
if complexity > -1:
options['max_complexity'] = complexity
files_modified = [f for f in files_modified if f.endswith('.py')]
flake8_style = get_style_guide(
parse_argv=True,
config_file=DEFAULT_CONFIG,
**options
)
# Copy staged versions to temporary directory
tmpdir = mkdtemp()
files_to_check = []
try:
for file_ in files_modified:
# get the staged version of the file
gitcmd_getstaged = "git show :%s" % file_
_, out, _ = run(gitcmd_getstaged, raw_output=True, decode=False)
# write the staged version to temp dir with its full path to
# avoid overwriting files with the same name
dirname, filename = os.path.split(os.path.abspath(file_))
prefix = os.path.commonprefix([dirname, tmpdir])
dirname = os.path.relpath(dirname, start=prefix)
dirname = os.path.join(tmpdir, dirname)
if not os.path.isdir(dirname):
os.makedirs(dirname)
filename = os.path.join(dirname, filename)
# write staged version of file to temporary directory
with open(filename, "wb") as fh:
fh.write(out)
files_to_check.append(filename)
# Run the checks
report = flake8_style.check_files(files_to_check)
# remove temporary directory
finally:
shutil.rmtree(tmpdir, ignore_errors=True)
if strict:
return report.total_errors
return 0
def hg_hook(ui, repo, **kwargs):
"""This is the function executed directly by Mercurial as part of the
hook. This is never called directly by the user, so the parameters are
undocumented. If you would like to learn more about them, please feel free
to read the official Mercurial documentation.
"""
complexity = ui.config('flake8', 'complexity', default=-1)
strict = ui.configbool('flake8', 'strict', default=True)
ignore = ui.config('flake8', 'ignore', default=None)
config = ui.config('flake8', 'config', default=True)
if config is True:
config = DEFAULT_CONFIG
paths = _get_files(repo, **kwargs)
# We only want to pass ignore and max_complexity if they differ from the
# defaults so that we don't override a local configuration file
options = {}
if ignore:
options['ignore'] = ignore
if complexity > -1:
options['max_complexity'] = complexity
flake8_style = get_style_guide(parse_argv=True, config_file=config,
**options)
report = flake8_style.check_files(paths)
if strict:
return report.total_errors
return 0
def run(command, raw_output=False, decode=True):
p = Popen(command.split(), stdout=PIPE, stderr=PIPE)
(stdout, stderr) = p.communicate()
# On python 3, subprocess.Popen returns bytes objects which expect
# endswith to be given a bytes object or a tuple of bytes but not native
# string objects. This is simply less mysterious than using b'.py' in the
# endswith method. That should work but might still fail horribly.
if hasattr(stdout, 'decode'):
if decode:
stdout = stdout.decode()
if hasattr(stderr, 'decode'):
if decode:
stderr = stderr.decode()
if not raw_output:
stdout = [line.strip() for line in stdout.splitlines()]
stderr = [line.strip() for line in stderr.splitlines()]
return (p.returncode, stdout, stderr)
def _get_files(repo, **kwargs):
seen = set()
for rev in range(repo[kwargs['node']], len(repo)):
for file_ in repo[rev].files():
file_ = os.path.join(repo.root, file_)
if file_ in seen or not os.path.exists(file_):
continue
seen.add(file_)
if file_.endswith('.py'):
yield file_
def find_vcs():
_, git_dir, _ = run('git rev-parse --git-dir')
if git_dir and os.path.isdir(git_dir[0]):
if not os.path.isdir(os.path.join(git_dir[0], 'hooks')):
os.mkdir(os.path.join(git_dir[0], 'hooks'))
return os.path.join(git_dir[0], 'hooks', 'pre-commit')
_, hg_dir, _ = run('hg root')
if hg_dir and os.path.isdir(hg_dir[0]):
return os.path.join(hg_dir[0], '.hg', 'hgrc')
return ''
git_hook_file = """#!/usr/bin/env python
import sys
import os
from flake8.hooks import git_hook
COMPLEXITY = os.getenv('FLAKE8_COMPLEXITY', 10)
STRICT = os.getenv('FLAKE8_STRICT', False)
IGNORE = os.getenv('FLAKE8_IGNORE')
LAZY = os.getenv('FLAKE8_LAZY', False)
if __name__ == '__main__':
sys.exit(git_hook(
complexity=COMPLEXITY,
strict=STRICT,
ignore=IGNORE,
lazy=LAZY,
))
"""
def _install_hg_hook(path):
if not os.path.isfile(path):
# Make the file so we can avoid IOError's
open(path, 'w+').close()
c = ConfigParser()
c.readfp(open(path, 'r'))
if not c.has_section('hooks'):
c.add_section('hooks')
if not c.has_option('hooks', 'commit'):
c.set('hooks', 'commit', 'python:flake8.hooks.hg_hook')
if not c.has_option('hooks', 'qrefresh'):
c.set('hooks', 'qrefresh', 'python:flake8.hooks.hg_hook')
if not c.has_section('flake8'):
c.add_section('flake8')
if not c.has_option('flake8', 'complexity'):
c.set('flake8', 'complexity', str(os.getenv('FLAKE8_COMPLEXITY', 10)))
if not c.has_option('flake8', 'strict'):
c.set('flake8', 'strict', os.getenv('FLAKE8_STRICT', False))
if not c.has_option('flake8', 'ignore'):
c.set('flake8', 'ignore', os.getenv('FLAKE8_IGNORE'))
if not c.has_option('flake8', 'lazy'):
c.set('flake8', 'lazy', os.getenv('FLAKE8_LAZY', False))
c.write(open(path, 'w+'))
def install_hook():
vcs = find_vcs()
if not vcs:
p = get_parser()[0]
sys.stderr.write('Error: could not find either a git or mercurial '
'directory. Please re-run this in a proper '
'repository.')
p.print_help()
sys.exit(1)
status = 0
if 'git' in vcs:
with open(vcs, 'w+') as fd:
fd.write(git_hook_file)
# rwxr--r--
os.chmod(vcs, stat.S_IRWXU | stat.S_IRGRP | stat.S_IROTH)
elif 'hg' in vcs:
_install_hg_hook(vcs)
else:
status = 1
sys.exit(status)
flake8-2.1.0/flake8/main.py 0000644 0001750 0000144 00000010412 12224011525 016272 0 ustar icordasc users 0000000 0000000 # -*- coding: utf-8 -*-
import os
import sys
import setuptools
from flake8.engine import get_parser, get_style_guide
from flake8.util import is_flag, flag_on
if sys.platform.startswith('win'):
DEFAULT_CONFIG = os.path.expanduser(r'~\.flake8')
else:
DEFAULT_CONFIG = os.path.join(
os.getenv('XDG_CONFIG_HOME') or os.path.expanduser('~/.config'),
'flake8'
)
EXTRA_IGNORE = ['.tox']
def main():
"""Parse options and run checks on Python source."""
# Prepare
flake8_style = get_style_guide(parse_argv=True, config_file=DEFAULT_CONFIG)
options = flake8_style.options
if options.install_hook:
from flake8.hooks import install_hook
install_hook()
# Run the checkers
report = flake8_style.check_files()
exit_code = print_report(report, flake8_style)
raise SystemExit(exit_code > 0)
def print_report(report, flake8_style):
# Print the final report
options = flake8_style.options
if options.statistics:
report.print_statistics()
if options.benchmark:
report.print_benchmark()
if report.total_errors:
if options.count:
sys.stderr.write(str(report.total_errors) + '\n')
if not options.exit_zero:
return 1
return 0
def check_file(path, ignore=(), complexity=-1):
"""Checks a file using pep8 and pyflakes by default and mccabe
optionally.
:param str path: path to the file to be checked
:param tuple ignore: (optional), error and warning codes to be ignored
:param int complexity: (optional), enables the mccabe check for values > 0
"""
ignore = set(ignore).union(EXTRA_IGNORE)
flake8_style = get_style_guide(
config_file=DEFAULT_CONFIG, ignore=ignore, max_complexity=complexity)
return flake8_style.input_file(path)
def check_code(code, ignore=(), complexity=-1):
"""Checks code using pep8 and pyflakes by default and mccabe optionally.
:param str code: code to be checked
:param tuple ignore: (optional), error and warning codes to be ignored
:param int complexity: (optional), enables the mccabe check for values > 0
"""
ignore = set(ignore).union(EXTRA_IGNORE)
flake8_style = get_style_guide(
config_file=DEFAULT_CONFIG, ignore=ignore, max_complexity=complexity)
return flake8_style.input_file(None, lines=code.splitlines(True))
class Flake8Command(setuptools.Command):
"""The :class:`Flake8Command` class is used by setuptools to perform
checks on registered modules.
"""
description = "Run flake8 on modules registered in setuptools"
user_options = []
def initialize_options(self):
self.option_to_cmds = {}
parser = get_parser()[0]
for opt in parser.option_list:
cmd_name = opt._long_opts[0][2:]
option_name = cmd_name.replace('-', '_')
self.option_to_cmds[option_name] = cmd_name
setattr(self, option_name, None)
def finalize_options(self):
self.options_dict = {}
for (option_name, cmd_name) in self.option_to_cmds.items():
if option_name in ['help', 'verbose']:
continue
value = getattr(self, option_name)
if value is None:
continue
if is_flag(value):
value = flag_on(value)
self.options_dict[option_name] = value
def distribution_files(self):
if self.distribution.packages:
package_dirs = self.distribution.package_dir or {}
for package in self.distribution.packages:
pkg_dir = package
if package in package_dirs:
pkg_dir = package_dirs[package]
elif '' in package_dirs:
pkg_dir = package_dirs[''] + os.path.sep + pkg_dir
yield pkg_dir.replace('.', os.path.sep)
if self.distribution.py_modules:
for filename in self.distribution.py_modules:
yield "%s.py" % filename
def run(self):
flake8_style = get_style_guide(config_file=DEFAULT_CONFIG,
**self.options_dict)
paths = self.distribution_files()
report = flake8_style.check_files(paths)
exit_code = print_report(report, flake8_style)
raise SystemExit(exit_code > 0)
flake8-2.1.0/flake8/__init__.py 0000644 0001750 0000144 00000000026 12233022363 017107 0 ustar icordasc users 0000000 0000000 __version__ = '2.1.0'
flake8-2.1.0/flake8/__init__.pyc 0000644 0001750 0000144 00000000211 12166032716 017256 0 ustar icordasc users 0000000 0000000
oQc @ s
d Z d S( s 2.0N( t __version__( ( ( s ./flake8/__init__.pyt s flake8-2.1.0/flake8/__pycache__/ 0000755 0001750 0000144 00000000000 12233022416 017207 5 ustar icordasc users 0000000 0000000 flake8-2.1.0/flake8/__pycache__/_pyflakes.cpython-32.pyc 0000644 0001750 0000144 00000005614 12161467632 023631 0 ustar icordasc users 0000000 0000000 l
(Qc @ sE d d l Z d d l Z d Z e Gd d e j j Z d S( i Nc C s~ t d d D } xa t t j j D]J \ } } | d j r, | j r, d | j | d | j f | _ q, q, Wd S( u% Add error codes to Pyflakes messages.c S s) g | ] } | j d d d q S( Ni i( u split( u .0u line( ( u1 /home/icordasc/sandbox/flake8/flake8/_pyflakes.pyu
s u F401 UnusedImportu F402 ImportShadowedByLoopVaru F403 ImportStarUsedu F404 LateFutureImportu F810 Redefinedu F811 RedefinedWhileUnusedu F812 RedefinedInListCompu F821 UndefinedNameu F822 UndefinedExportu F823 UndefinedLocalu F831 DuplicateArgumentu F841 UnusedVariablei u %s %su F999N( u F401 UnusedImportu F402 ImportShadowedByLoopVaru F403 ImportStarUsedu F404 LateFutureImportu F810 Redefinedu F811 RedefinedWhileUnusedu F812 RedefinedInListCompu F821 UndefinedNameu F822 UndefinedExportu F823 UndefinedLocalu F831 DuplicateArgumentu F841 UnusedVariable( u dictu varsu pyflakesu messagesu itemsu isupperu messageu getu
flake8_msg( u codesu nameu obj( ( u1 /home/icordasc/sandbox/flake8/flake8/_pyflakes.pyu patch_pyflakes s
"c B sJ | Ee Z d Z d Z e j Z e d Z e d Z d Z
d S( u= Subclass the Pyflakes checker to conform with the flake8 API.u pyflakesc C s' | j d d d | j j d d S( Nu
--builtinsu helpu&