Skip to content

Commit

Permalink
Merge pull request #720 from jdufresne/pyreq
Browse files Browse the repository at this point in the history
Remove support for EOL Python 2.6 and 3.3
  • Loading branch information
IanLee1521 committed Jun 3, 2018
2 parents 0364618 + bca3d89 commit 05bb615
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 39 deletions.
4 changes: 0 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,8 @@ install:
script: tox
matrix:
include:
- python: 2.6
env: TOXENV=py26
- python: 2.7
env: TOXENV=py27
- python: 3.3
env: TOXENV=py33
- python: 3.4
env: TOXENV=py34
- python: 3.5
Expand Down
7 changes: 7 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
Changelog
=========

UNRELEASED / 3.0.0
------------------

Changes:

* Remove support for EOL Python 2.6 and 3.3. PR #720.

2.4.0 (2018-04-10)
------------------

Expand Down
3 changes: 1 addition & 2 deletions docs/developer.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ conditions of the :ref:`Expat license <license>`. Fork away!
* `Source code <https://github.com/pycqa/pycodestyle>`_ and
`issue tracker <https://github.com/pycqa/pycodestyle/issues>`_ on GitHub.
* `Continuous tests <http://travis-ci.org/pycqa/pycodestyle>`_ against Python
2.6 through 3.6 as well as the nightly Python build and PyPy, on `Travis CI
2.7 and 3.4+ as well as the nightly Python build and PyPy, on `Travis CI
platform <https://docs.travis-ci.com//>`_.

.. _available on GitHub: https://github.com/pycqa/pycodestyle
Expand All @@ -32,7 +32,6 @@ Some high-level aims and directions to bear in mind for contributions:
* If you want to provide extensibility / plugins,
please see `flake8 <https://gitlab.com/pycqa/flake8>`_ -
``pycodestyle`` doesn't want or need a plugin architecture.
* Python 2.6 support is still deemed important.
* ``pycodestyle`` aims to have no external dependencies.


Expand Down
35 changes: 9 additions & 26 deletions pycodestyle.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,11 +156,6 @@ def lru_cache(maxsize=128): # noqa as it's a fake implementation.
)
DUNDER_REGEX = re.compile(r'^__([^\s]+)__ = ')

# 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'


_checks = {'physical_line': {}, 'logical_line': {}, 'tree': {}}


Expand Down Expand Up @@ -1118,7 +1113,7 @@ def compound_statements(logical_line):
last_char = len(line) - 1
found = line.find(':')
prev_found = 0
counts = dict((char, 0) for char in '{}[]()')
counts = {char: 0 for char in '{}[]()'}
while -1 < found < last_char:
update_counts(line[prev_found:found], counts)
if ((counts['{'] <= counts['}'] and # {'a': 1} (dict)
Expand Down Expand Up @@ -1762,9 +1757,11 @@ def parse_udiff(diff, patterns=None, parent='.'):
if path[:2] in ('b/', 'w/', 'i/'):
path = path[2:]
rv[path] = set()
return dict([(os.path.join(parent, filepath), rows)
for (filepath, rows) in rv.items()
if rows and filename_match(filepath, patterns)])
return {
os.path.join(parent, filepath): rows
for (filepath, rows) in rv.items()
if rows and filename_match(filepath, patterns)
}


def normalize_paths(value, parent=os.curdir):
Expand Down Expand Up @@ -1807,11 +1804,6 @@ def _is_eol_token(token):
return token[0] in NEWLINE or token[4][token[3][1]:].lstrip() == '\\\n'


if COMMENT_WITH_NL:
def _is_eol_token(token, _eol_token=_is_eol_token):
return _eol_token(token) or (token[0] == tokenize.COMMENT and
token[1] == token[4])

########################################################################
# Framework to run all checks
########################################################################
Expand Down Expand Up @@ -2079,14 +2071,6 @@ def check_all(self, expected=None, line_offset=0):
del self.tokens[0]
else:
self.check_logical()
elif COMMENT_WITH_NL and token_type == tokenize.COMMENT:
if len(self.tokens) == 1:
# The comment also ends a physical line
token = list(token)
token[1] = text.rstrip('\r\n')
token[3] = (token[2][0], token[2][1] + len(token[1]))
self.tokens = [tuple(token)]
self.check_logical()
if self.tokens:
self.check_physical(self.lines[-1])
self.check_logical()
Expand Down Expand Up @@ -2154,8 +2138,8 @@ def get_file_results(self):

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)])
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.
Expand Down Expand Up @@ -2503,8 +2487,7 @@ def read_config(options, args, arglist, parser):
warnings.warn('[pep8] section is deprecated. Use [pycodestyle].')

if pycodestyle_section:
option_list = dict([(o.dest, o.type or o.action)
for o in parser.option_list])
option_list = {o.dest: o.type or o.action for o in parser.option_list}

# First, read the default values
(new_options, __) = parser.parse_args([])
Expand Down
3 changes: 1 addition & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ def get_long_description():
namespace_packages=[],
include_package_data=True,
zip_safe=False,
python_requires='>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*',
install_requires=[
# Broken with Python 3: https://github.com/pypa/pip/issues/650
# 'setuptools',
Expand All @@ -51,10 +52,8 @@ def get_long_description():
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
Expand Down
8 changes: 4 additions & 4 deletions testsuite/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ def setUp(self):
self._saved_checks = pycodestyle._checks
sys.stdout = PseudoFile()
sys.stderr = PseudoFile()
pycodestyle._checks = dict(
(k, dict((f, (vals[0][:], vals[1])) for (f, vals) in v.items()))
for (k, v) in self._saved_checks.items()
)
pycodestyle._checks = {
k: {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
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# and then run "tox" from this directory.

[tox]
envlist = py26, py27, py32, py33, py34, py35, py36, pypy, pypy3, jython
envlist = py27, py34, py35, py36, pypy, pypy3, jython
skipsdist = True
skip_missing_interpreters = True

Expand Down

0 comments on commit 05bb615

Please sign in to comment.