Commit a6cf72ae authored by Barry Warsaw's avatar Barry Warsaw

Import python-flake8_2.6.0.orig.tar.gz

parent 5a9c8328
CHANGES
=======
2.6.0 - 2016-06-15
------------------
- **Requirements Change** Switch to pycodestyle as all future pep8 releases
will use that package name
- **Improvement** Allow for Windows users on *select* versions of Python to
use ``--jobs`` and multiprocessing
- **Improvement** Update bounds on McCabe
- **Improvement** Update bounds on PyFlakes and blacklist known broken
versions
- **Improvement** Handle new PyFlakes warning with a new error code: F405
2.5.5 - 2016-06-14
------------------
- **Bug** Fix setuptools integration when parsing config files
- **Bug** Don't pass the user's config path as the config_file when creating a
StyleGuide
2.5.4 - 2016-02-11
------------------
......@@ -105,7 +129,7 @@ CHANGES
.. _GitLab#35: https://gitlab.com/pycqa/flake8/issues/35
.. _GitLab!18: https://gitlab.com/pycqa/flake8/merge_requests/18
.. _GitLab!20: https://gitlab.com/pycqa/flake8/merge_requests/20
.. _VCS hooks docs: https://flake8.readthedocs.org/en/latest/vcs.html
.. _VCS hooks docs: https://flake8.readthedocs.io/en/latest/vcs.html
2.3.0 - 2015-01-04
------------------
......@@ -198,7 +222,7 @@ CHANGES
- 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 <https://flake8.readthedocs.org/>`_
- We publish the `documentation <https://flake8.readthedocs.io/>`_
- 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
......
......@@ -24,3 +24,4 @@ Contributors (by order of appearance) :
- Christian Long
- Tyrel Souza
- Corey Farwell
- Michael Penkov
Metadata-Version: 1.1
Name: flake8
Version: 2.5.4
Version: 2.6.0
Summary: the modular source code checker: pep8, pyflakes and co
Home-page: https://gitlab.com/pycqa/flake8
Author: Ian Cordasco
......@@ -100,14 +100,38 @@ Description: ======
Links
=====
* `flake8 documentation <http://flake8.readthedocs.org/en/latest/>`_
* `flake8 documentation <https://flake8.readthedocs.io/en/latest/>`_
* `pep8 documentation <http://pep8.readthedocs.org/en/latest/>`_
* `pep8 documentation <https://pep8.readthedocs.io/en/latest/>`_
CHANGES
=======
2.6.0 - 2016-06-15
------------------
- **Requirements Change** Switch to pycodestyle as all future pep8 releases
will use that package name
- **Improvement** Allow for Windows users on *select* versions of Python to
use ``--jobs`` and multiprocessing
- **Improvement** Update bounds on McCabe
- **Improvement** Update bounds on PyFlakes and blacklist known broken
versions
- **Improvement** Handle new PyFlakes warning with a new error code: F405
2.5.5 - 2016-06-14
------------------
- **Bug** Fix setuptools integration when parsing config files
- **Bug** Don't pass the user's config path as the config_file when creating a
StyleGuide
2.5.4 - 2016-02-11
------------------
......@@ -212,7 +236,7 @@ Description: ======
.. _GitLab#35: https://gitlab.com/pycqa/flake8/issues/35
.. _GitLab!18: https://gitlab.com/pycqa/flake8/merge_requests/18
.. _GitLab!20: https://gitlab.com/pycqa/flake8/merge_requests/20
.. _VCS hooks docs: https://flake8.readthedocs.org/en/latest/vcs.html
.. _VCS hooks docs: https://flake8.readthedocs.io/en/latest/vcs.html
2.3.0 - 2015-01-04
------------------
......@@ -305,7 +329,7 @@ Description: ======
- 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 <https://flake8.readthedocs.org/>`_
- We publish the `documentation <https://flake8.readthedocs.io/>`_
- 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
......
......@@ -92,6 +92,6 @@ suggest, the mailing list would be the best place for it.
Links
=====
* `flake8 documentation <http://flake8.readthedocs.org/en/latest/>`_
* `flake8 documentation <https://flake8.readthedocs.io/en/latest/>`_
* `pep8 documentation <http://pep8.readthedocs.org/en/latest/>`_
* `pep8 documentation <https://pep8.readthedocs.io/en/latest/>`_
Metadata-Version: 1.1
Name: flake8
Version: 2.5.4
Version: 2.6.0
Summary: the modular source code checker: pep8, pyflakes and co
Home-page: https://gitlab.com/pycqa/flake8
Author: Ian Cordasco
......@@ -100,14 +100,38 @@ Description: ======
Links
=====
* `flake8 documentation <http://flake8.readthedocs.org/en/latest/>`_
* `flake8 documentation <https://flake8.readthedocs.io/en/latest/>`_
* `pep8 documentation <http://pep8.readthedocs.org/en/latest/>`_
* `pep8 documentation <https://pep8.readthedocs.io/en/latest/>`_
CHANGES
=======
2.6.0 - 2016-06-15
------------------
- **Requirements Change** Switch to pycodestyle as all future pep8 releases
will use that package name
- **Improvement** Allow for Windows users on *select* versions of Python to
use ``--jobs`` and multiprocessing
- **Improvement** Update bounds on McCabe
- **Improvement** Update bounds on PyFlakes and blacklist known broken
versions
- **Improvement** Handle new PyFlakes warning with a new error code: F405
2.5.5 - 2016-06-14
------------------
- **Bug** Fix setuptools integration when parsing config files
- **Bug** Don't pass the user's config path as the config_file when creating a
StyleGuide
2.5.4 - 2016-02-11
------------------
......@@ -212,7 +236,7 @@ Description: ======
.. _GitLab#35: https://gitlab.com/pycqa/flake8/issues/35
.. _GitLab!18: https://gitlab.com/pycqa/flake8/merge_requests/18
.. _GitLab!20: https://gitlab.com/pycqa/flake8/merge_requests/20
.. _VCS hooks docs: https://flake8.readthedocs.org/en/latest/vcs.html
.. _VCS hooks docs: https://flake8.readthedocs.io/en/latest/vcs.html
2.3.0 - 2015-01-04
------------------
......@@ -305,7 +329,7 @@ Description: ======
- 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 <https://flake8.readthedocs.org/>`_
- We publish the `documentation <https://flake8.readthedocs.io/>`_
- 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
......
......@@ -29,7 +29,6 @@ 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/pbr.json
flake8.egg-info/requires.txt
flake8.egg-info/top_level.txt
flake8/__pycache__/__init__.cpython-34.pyc
......@@ -47,7 +46,6 @@ flake8/tests/_test_warnings.py
flake8/tests/_test_warnings.pyc
flake8/tests/test_engine.py
flake8/tests/test_engine.pyc
flake8/tests/test_git_hook.pyc
flake8/tests/test_hooks.py
flake8/tests/test_hooks.pyc
flake8/tests/test_integration.py
......
{"is_release": false, "git_version": "b827629"}
\ No newline at end of file
pyflakes >= 0.8.1, < 1.1
pep8 >= 1.5.7, != 1.6.0, != 1.6.1, != 1.6.2
mccabe >= 0.2.1, < 0.5
pyflakes >= 0.8.1, < 1.3, != 1.2.0, != 1.2.1, != 1.2.2
pycodestyle >= 2.0, < 2.1
mccabe >= 0.2.1, < 0.6
__version__ = '2.5.4'
__version__ = '2.6.0'
No preview for this file type
......@@ -8,7 +8,7 @@ else:
demandimport.disable()
import os
import pep8
import pycodestyle as pep8
import pyflakes
import pyflakes.checker
......@@ -20,6 +20,7 @@ def patch_pyflakes():
'F402 ImportShadowedByLoopVar',
'F403 ImportStarUsed',
'F404 LateFutureImport',
'F405 ImportStarUsage',
'F810 Redefined', # XXX Obsolete?
'F811 RedefinedWhileUnused',
'F812 RedefinedInListComp',
......
No preview for this file type
No preview for this file type
No preview for this file type
......@@ -6,7 +6,7 @@ import re
import sys
import warnings
import pep8
import pycodestyle as pep8
from flake8 import __version__
from flake8 import callbacks
......@@ -44,7 +44,7 @@ def _load_entry_point(entry_point, verify_requirements):
def _register_extensions():
"""Register all the extensions."""
extensions = util.OrderedSet()
extensions.add(('pep8', pep8.__version__))
extensions.add(('pycodestyle', pep8.__version__))
parser_hooks = []
options_hooks = []
ignored_hooks = []
......
No preview for this file type
# -*- coding: utf-8 -*-
from __future__ import with_statement
import os
import pep8
import pycodestyle as pep8
import sys
import stat
from subprocess import Popen, PIPE
......@@ -14,7 +14,6 @@ except ImportError: # Python 2
from flake8 import compat
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):
......@@ -51,8 +50,7 @@ def git_hook(complexity=-1, strict=False, ignore=None, lazy=False):
tmpdir = tempfile.mkdtemp()
flake8_style = get_style_guide(config_file=DEFAULT_CONFIG, paths=['.'],
**options)
flake8_style = get_style_guide(paths=['.'], **options)
filepatterns = flake8_style.options.filename
# Copy staged versions to temporary directory
......@@ -102,7 +100,7 @@ def hg_hook(ui, repo, **kwargs):
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=DEFAULT_CONFIG)
config = ui.config('flake8', 'config', default=None)
paths = _get_files(repo, **kwargs)
......
No preview for this file type
......@@ -3,26 +3,29 @@ import os
import re
import sys
import pycodestyle as pep8
import setuptools
from flake8.engine import get_parser, get_style_guide
from flake8.util import option_normalizer
if sys.platform.startswith('win'):
DEFAULT_CONFIG = os.path.expanduser(r'~\.flake8')
USER_CONFIG = os.path.expanduser(r'~\.flake8')
else:
DEFAULT_CONFIG = os.path.join(
USER_CONFIG = os.path.join(
os.getenv('XDG_CONFIG_HOME') or os.path.expanduser('~/.config'),
'flake8'
)
pep8.USER_CONFIG = USER_CONFIG
EXTRA_IGNORE = []
def main():
"""Parse options and run checks on Python source."""
# Prepare
flake8_style = get_style_guide(parse_argv=True, config_file=DEFAULT_CONFIG)
flake8_style = get_style_guide(parse_argv=True)
options = flake8_style.options
if options.install_hook:
......@@ -61,8 +64,7 @@ def check_file(path, ignore=(), complexity=-1):
: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)
flake8_style = get_style_guide(ignore=ignore, max_complexity=complexity)
return flake8_style.input_file(path)
......@@ -74,8 +76,7 @@ def check_code(code, ignore=(), complexity=-1):
: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)
flake8_style = get_style_guide(ignore=ignore, max_complexity=complexity)
return flake8_style.input_file(None, lines=code.splitlines(True))
......@@ -93,18 +94,18 @@ class Flake8Command(setuptools.Command):
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
self.option_to_cmds[option_name] = opt
setattr(self, option_name, None)
def finalize_options(self):
self.options_dict = {}
for (option_name, cmd_name) in self.option_to_cmds.items():
for (option_name, opt) in self.option_to_cmds.items():
if option_name in ['help', 'verbose']:
continue
value = getattr(self, option_name)
if value is None:
continue
value = option_normalizer(value)
value = option_normalizer(value, opt, option_name)
# Check if there's any values that need to be fixed.
if option_name == "include" and isinstance(value, str):
value = re.findall('[^,;\s]+', value)
......@@ -131,9 +132,7 @@ class Flake8Command(setuptools.Command):
def run(self):
# Prepare
paths = list(self.distribution_files())
flake8_style = get_style_guide(config_file=DEFAULT_CONFIG,
paths=paths,
**self.options_dict)
flake8_style = get_style_guide(paths=paths, **self.options_dict)
# Run the checkers
report = flake8_style.check_files()
......
No preview for this file type
......@@ -10,7 +10,7 @@ try:
except ImportError: # Python 2.5
multiprocessing = None
import pep8
import pycodestyle as pep8
__all__ = ['multiprocessing', 'BaseQReport', 'QueueReport']
......@@ -59,8 +59,8 @@ class BaseQReport(pep8.BaseReport):
def _process_main(self):
if not self._loaded:
# Windows needs to parse again the configuration
from flake8.main import get_style_guide, DEFAULT_CONFIG
get_style_guide(parse_argv=True, config_file=DEFAULT_CONFIG)
from flake8.main import get_style_guide
get_style_guide(parse_argv=True)
for filename in iter(self.task_queue.get, 'DONE'):
self.input_file(filename)
......
No preview for this file type
......@@ -280,7 +280,7 @@ class IntegrationTestCaseWarnings(unittest.TestCase):
with open(self.this_file(), "r") as f:
return f.read()
with mock.patch("pep8.stdin_get_value", fake_stdin):
with mock.patch("pycodestyle.stdin_get_value", fake_stdin):
(style_guide,
report,
collected_warnings,
......
......@@ -8,7 +8,7 @@ except ImportError:
import mock # < PY33
from flake8 import engine, util, __version__, reporter
import pep8
import pycodestyle as pep8
class TestEngine(unittest.TestCase):
......@@ -48,7 +48,7 @@ class TestEngine(unittest.TestCase):
StyleGuide.assert_called_once_with(**{'parser': m, 'foo': 'bar'})
def test_register_extensions(self):
with mock.patch('pep8.register_check') as register_check:
with mock.patch('pycodestyle.register_check') as register_check:
registered_exts = engine._register_extensions()
self.assertTrue(isinstance(registered_exts[0], util.OrderedSet))
self.assertTrue(len(registered_exts[0]) > 0)
......@@ -72,7 +72,7 @@ class TestEngine(unittest.TestCase):
# 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')
pgp = self.start_patch('pycodestyle.get_parser')
m = mock.Mock()
re.return_value = ([('pyflakes', '0.7'), ('mccabe', '0.2')], [], [],
[])
......
......@@ -64,7 +64,7 @@ class IntegrationTestCase(unittest.TestCase):
with open(self.this_file(), "r") as f:
return f.read()
with mock.patch("pep8.stdin_get_value", fake_stdin):
with mock.patch("pycodestyle.stdin_get_value", fake_stdin):
guide, report = self.check_files(arglist=['--jobs=4'],
explicit_stdin=True)
self.assertEqual(self.count, 1)
......@@ -72,7 +72,7 @@ class IntegrationTestCase(unittest.TestCase):
def test_stdin_fail(self):
def fake_stdin():
return "notathing\n"
with mock.patch("pep8.stdin_get_value", fake_stdin):
with mock.patch("pycodestyle.stdin_get_value", fake_stdin):
# only assert needed is in check_files
guide, report = self.check_files(arglist=['--jobs=4'],
explicit_stdin=True,
......
import optparse
import unittest
from flake8.util import option_normalizer
class TestOptionSerializer(unittest.TestCase):
class TestOptionSerializerParsesTrue(unittest.TestCase):
def setUp(self):
self.option = optparse.Option('--foo', action='store_true')
self.option_name = 'fake_option'
def test_1_is_true(self):
option = option_normalizer('1')
self.assertTrue(option)
value = option_normalizer('1', self.option, self.option_name)
self.assertTrue(value)
def test_T_is_true(self):
option = option_normalizer('T')
self.assertTrue(option)
value = option_normalizer('T', self.option, self.option_name)
self.assertTrue(value)
def test_TRUE_is_true(self):
option = option_normalizer('TRUE')
self.assertTrue(option, True)
value = option_normalizer('TRUE', self.option, self.option_name)
self.assertTrue(value, True)
def test_ON_is_true(self):
option = option_normalizer('ON')
self.assertTrue(option)
value = option_normalizer('ON', self.option, self.option_name)
self.assertTrue(value)
def test_t_is_true(self):
option = option_normalizer('t')
self.assertTrue(option)
value = option_normalizer('t', self.option, self.option_name)
self.assertTrue(value)
def test_true_is_true(self):
option = option_normalizer('true')
self.assertTrue(option)
value = option_normalizer('true', self.option, self.option_name)
self.assertTrue(value)
def test_on_is_true(self):
option = option_normalizer('on')
self.assertTrue(option)
value = option_normalizer('on', self.option, self.option_name)
self.assertTrue(value)
class TestOptionSerializerParsesFalse(unittest.TestCase):
def setUp(self):
self.option = optparse.Option('--foo', action='store_true')
self.option_name = 'fake_option'
def test_0_is_false(self):
option = option_normalizer('0')
self.assertFalse(option)
value = option_normalizer('0', self.option, self.option_name)
self.assertFalse(value)
def test_F_is_false(self):
option = option_normalizer('F')
self.assertFalse(option)
value = option_normalizer('F', self.option, self.option_name)
self.assertFalse(value)
def test_FALSE_is_false(self):
option = option_normalizer('FALSE')
self.assertFalse(option)
value = option_normalizer('FALSE', self.option, self.option_name)
self.assertFalse(value)
def test_OFF_is_false(self):
option = option_normalizer('OFF')
self.assertFalse(option)
value = option_normalizer('OFF', self.option, self.option_name)
self.assertFalse(value)
def test_f_is_false(self):
option = option_normalizer('f')
self.assertFalse(option)
value = option_normalizer('f', self.option, self.option_name)
self.assertFalse(value)
def test_false_is_false(self):
option = option_normalizer('false')
self.assertFalse(option)
value = option_normalizer('false', self.option, self.option_name)
self.assertFalse(value)
def test_off_is_false(self):
option = option_normalizer('off')
self.assertFalse(option)
value = option_normalizer('off', self.option, self.option_name)
self.assertFalse(value)
def test_parses_lists(self):
answer = ['F401', 'F402', 'F403', 'F404']
class TestOptionSerializerParsesLists(unittest.TestCase):
option = option_normalizer('F401,F402,F403,F404')
self.assertEqual(option, answer)
def setUp(self):
self.option = optparse.Option('--select')
self.option_name = 'select'
self.answer = ['F401', 'F402', 'F403', 'F404', 'F405']
option = option_normalizer('F401 ,F402 ,F403 ,F404')
self.assertEqual(option, answer)
def test_parses_simple_comma_separated_lists(self):
value = option_normalizer('F401,F402,F403,F404,F405', self.option,
self.option_name)
self.assertEqual(value, self.answer)
option = option_normalizer('F401, F402, F403, F404')
self.assertEqual(option, answer)
def test_parses_less_simple_comma_separated_lists(self):
value = option_normalizer('F401 ,F402 ,F403 ,F404, F405', self.option,
self.option_name)
self.assertEqual(value, self.answer)
option = option_normalizer('''\
value = option_normalizer('F401, F402, F403, F404, F405', self.option,
self.option_name)
self.assertEqual(value, self.answer)
def test_parses_comma_separated_lists_with_newlines(self):
value = option_normalizer('''\
F401,
F402,
F403,
F404,
''')
self.assertEqual(option, answer)
F405,
''', self.option, self.option_name)
self.assertEqual(value, self.answer)
class TestOptionSerializerParsesInts(unittest.TestCase):
def setUp(self):
self.option = optparse.Option('--max-complexity', type='int')
self.option_name = 'max_complexity'
def test_parses_an_int(self):
value = option_normalizer('2', self.option, self.option_name)
self.assertEqual(value, 2)
if __name__ == '__main__':
......
# -*- coding: utf-8 -*-
import os
import sys
try:
import ast
......@@ -54,16 +55,27 @@ def warn_when_using_jobs(options):
def force_disable_jobs(styleguide):
return is_windows() or is_using_stdin(styleguide.paths)
def option_normalizer(value):
if str(value).upper() in ('1', 'T', 'TRUE', 'ON'):
value = True
if str(value).upper() in ('0', 'F', 'FALSE', 'OFF'):
value = False
if isinstance(value, str):
value = [opt.strip() for opt in value.split(',') if opt.strip()]
affected_mp_version = (sys.version_info <= (2, 7, 11) or
(3, 0) <= sys.version_info < (3, 2))
return (is_windows() and affected_mp_version or
is_using_stdin(styleguide.paths))
INT_TYPES = ('int', 'count')
BOOL_TYPES = ('store_true', 'store_false')
LIST_OPTIONS = ('select', 'ignore', 'exclude', 'enable_extensions')
def option_normalizer(value, option, option_name):
if option.action in BOOL_TYPES:
if str(value).upper() in ('1', 'T', 'TRUE', 'ON'):
value = True
if str(value).upper() in ('0', 'F', 'FALSE', 'OFF'):
value = False
elif option.type in INT_TYPES:
value = int(value)
elif option_name in LIST_OPTIONS:
if isinstance(value, str):
value = [opt.strip() for opt in value.split(',') if opt.strip()]
return value
No preview for this file type
......@@ -2,7 +2,7 @@
universal = 1
[egg_info]
tag_svn_revision = 0
tag_date = 0
tag_build =
tag_date = 0
tag_svn_revision = 0
......@@ -49,9 +49,9 @@ setup(
url="https://gitlab.com/pycqa/flake8",
packages=["flake8", "flake8.tests"],
install_requires=[
"pyflakes >= 0.8.1, < 1.1",