Skip to content

Commit 05bb615

Browse files
authored
Merge pull request PyCQA#720 from jdufresne/pyreq
Remove support for EOL Python 2.6 and 3.3
2 parents 0364618 + bca3d89 commit 05bb615

File tree

7 files changed

+23
-39
lines changed

7 files changed

+23
-39
lines changed

.travis.yml

-4
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,8 @@ install:
66
script: tox
77
matrix:
88
include:
9-
- python: 2.6
10-
env: TOXENV=py26
119
- python: 2.7
1210
env: TOXENV=py27
13-
- python: 3.3
14-
env: TOXENV=py33
1511
- python: 3.4
1612
env: TOXENV=py34
1713
- python: 3.5

CHANGES.txt

+7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
Changelog
22
=========
33

4+
UNRELEASED / 3.0.0
5+
------------------
6+
7+
Changes:
8+
9+
* Remove support for EOL Python 2.6 and 3.3. PR #720.
10+
411
2.4.0 (2018-04-10)
512
------------------
613

docs/developer.rst

+1-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ conditions of the :ref:`Expat license <license>`. Fork away!
1414
* `Source code <https://github.com/pycqa/pycodestyle>`_ and
1515
`issue tracker <https://github.com/pycqa/pycodestyle/issues>`_ on GitHub.
1616
* `Continuous tests <http://travis-ci.org/pycqa/pycodestyle>`_ against Python
17-
2.6 through 3.6 as well as the nightly Python build and PyPy, on `Travis CI
17+
2.7 and 3.4+ as well as the nightly Python build and PyPy, on `Travis CI
1818
platform <https://docs.travis-ci.com//>`_.
1919

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

3837

pycodestyle.py

+9-26
Original file line numberDiff line numberDiff line change
@@ -156,11 +156,6 @@ def lru_cache(maxsize=128): # noqa as it's a fake implementation.
156156
)
157157
DUNDER_REGEX = re.compile(r'^__([^\s]+)__ = ')
158158

159-
# Work around Python < 2.6 behaviour, which does not generate NL after
160-
# a comment which is on a line by itself.
161-
COMMENT_WITH_NL = tokenize.generate_tokens(['#\n'].pop).send(None)[1] == '#\n'
162-
163-
164159
_checks = {'physical_line': {}, 'logical_line': {}, 'tree': {}}
165160

166161

@@ -1118,7 +1113,7 @@ def compound_statements(logical_line):
11181113
last_char = len(line) - 1
11191114
found = line.find(':')
11201115
prev_found = 0
1121-
counts = dict((char, 0) for char in '{}[]()')
1116+
counts = {char: 0 for char in '{}[]()'}
11221117
while -1 < found < last_char:
11231118
update_counts(line[prev_found:found], counts)
11241119
if ((counts['{'] <= counts['}'] and # {'a': 1} (dict)
@@ -1762,9 +1757,11 @@ def parse_udiff(diff, patterns=None, parent='.'):
17621757
if path[:2] in ('b/', 'w/', 'i/'):
17631758
path = path[2:]
17641759
rv[path] = set()
1765-
return dict([(os.path.join(parent, filepath), rows)
1766-
for (filepath, rows) in rv.items()
1767-
if rows and filename_match(filepath, patterns)])
1760+
return {
1761+
os.path.join(parent, filepath): rows
1762+
for (filepath, rows) in rv.items()
1763+
if rows and filename_match(filepath, patterns)
1764+
}
17681765

17691766

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

18091806

1810-
if COMMENT_WITH_NL:
1811-
def _is_eol_token(token, _eol_token=_is_eol_token):
1812-
return _eol_token(token) or (token[0] == tokenize.COMMENT and
1813-
token[1] == token[4])
1814-
18151807
########################################################################
18161808
# Framework to run all checks
18171809
########################################################################
@@ -2079,14 +2071,6 @@ def check_all(self, expected=None, line_offset=0):
20792071
del self.tokens[0]
20802072
else:
20812073
self.check_logical()
2082-
elif COMMENT_WITH_NL and token_type == tokenize.COMMENT:
2083-
if len(self.tokens) == 1:
2084-
# The comment also ends a physical line
2085-
token = list(token)
2086-
token[1] = text.rstrip('\r\n')
2087-
token[3] = (token[2][0], token[2][1] + len(token[1]))
2088-
self.tokens = [tuple(token)]
2089-
self.check_logical()
20902074
if self.tokens:
20912075
self.check_physical(self.lines[-1])
20922076
self.check_logical()
@@ -2154,8 +2138,8 @@ def get_file_results(self):
21542138

21552139
def get_count(self, prefix=''):
21562140
"""Return the total count of errors and warnings."""
2157-
return sum([self.counters[key]
2158-
for key in self.messages if key.startswith(prefix)])
2141+
return sum(self.counters[key]
2142+
for key in self.messages if key.startswith(prefix))
21592143

21602144
def get_statistics(self, prefix=''):
21612145
"""Get statistics for message codes that start with the prefix.
@@ -2503,8 +2487,7 @@ def read_config(options, args, arglist, parser):
25032487
warnings.warn('[pep8] section is deprecated. Use [pycodestyle].')
25042488

25052489
if pycodestyle_section:
2506-
option_list = dict([(o.dest, o.type or o.action)
2507-
for o in parser.option_list])
2490+
option_list = {o.dest: o.type or o.action for o in parser.option_list}
25082491

25092492
# First, read the default values
25102493
(new_options, __) = parser.parse_args([])

setup.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ def get_long_description():
3434
namespace_packages=[],
3535
include_package_data=True,
3636
zip_safe=False,
37+
python_requires='>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*',
3738
install_requires=[
3839
# Broken with Python 3: https://github.com/pypa/pip/issues/650
3940
# 'setuptools',
@@ -51,10 +52,8 @@ def get_long_description():
5152
'Operating System :: OS Independent',
5253
'Programming Language :: Python',
5354
'Programming Language :: Python :: 2',
54-
'Programming Language :: Python :: 2.6',
5555
'Programming Language :: Python :: 2.7',
5656
'Programming Language :: Python :: 3',
57-
'Programming Language :: Python :: 3.3',
5857
'Programming Language :: Python :: 3.4',
5958
'Programming Language :: Python :: 3.5',
6059
'Programming Language :: Python :: 3.6',

testsuite/test_api.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ def setUp(self):
2828
self._saved_checks = pycodestyle._checks
2929
sys.stdout = PseudoFile()
3030
sys.stderr = PseudoFile()
31-
pycodestyle._checks = dict(
32-
(k, dict((f, (vals[0][:], vals[1])) for (f, vals) in v.items()))
33-
for (k, v) in self._saved_checks.items()
34-
)
31+
pycodestyle._checks = {
32+
k: {f: (vals[0][:], vals[1]) for (f, vals) in v.items()}
33+
for k, v in self._saved_checks.items()
34+
}
3535

3636
def tearDown(self):
3737
sys.stdout = self._saved_stdout

tox.ini

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# and then run "tox" from this directory.
55

66
[tox]
7-
envlist = py26, py27, py32, py33, py34, py35, py36, pypy, pypy3, jython
7+
envlist = py27, py34, py35, py36, pypy, pypy3, jython
88
skipsdist = True
99
skip_missing_interpreters = True
1010

0 commit comments

Comments
 (0)