summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lee <IanLee1521@gmail.com>2018-06-03 16:32:57 -0700
committerGitHub <noreply@github.com>2018-06-03 16:32:57 -0700
commit05bb61572824eb0b83f1186742318728d880d749 (patch)
tree9c0cf012a11f66cefe96087e2f8b17503a74480c
parent036461879fbfdb4ddbb689163e968d7f00ded66f (diff)
parentbca3d8980dab8e1a46b8a39bdb1b1788cd221b37 (diff)
downloadpep8-05bb61572824eb0b83f1186742318728d880d749.tar.gz
Merge pull request #720 from jdufresne/pyreq
Remove support for EOL Python 2.6 and 3.3
-rw-r--r--.travis.yml4
-rw-r--r--CHANGES.txt7
-rw-r--r--docs/developer.rst3
-rwxr-xr-xpycodestyle.py35
-rw-r--r--setup.py3
-rw-r--r--testsuite/test_api.py8
-rw-r--r--tox.ini2
7 files changed, 23 insertions, 39 deletions
diff --git a/.travis.yml b/.travis.yml
index 1ea5a73..511d670 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -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
diff --git a/CHANGES.txt b/CHANGES.txt
index ecfa609..19e2c34 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -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)
------------------
diff --git a/docs/developer.rst b/docs/developer.rst
index 8630edc..080d080 100644
--- a/docs/developer.rst
+++ b/docs/developer.rst
@@ -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
@@ -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.
diff --git a/pycodestyle.py b/pycodestyle.py
index 50149f1..bcf9933 100755
--- a/pycodestyle.py
+++ b/pycodestyle.py
@@ -156,11 +156,6 @@ STARTSWITH_INDENT_STATEMENT_REGEX = re.compile(
)
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': {}}
@@ -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)
@@ -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):
@@ -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
########################################################################
@@ -2079,14 +2071,6 @@ class Checker(object):
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()
@@ -2154,8 +2138,8 @@ class BaseReport(object):
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.
@@ -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([])
diff --git a/setup.py b/setup.py
index e68df56..83870f7 100644
--- a/setup.py
+++ b/setup.py
@@ -34,6 +34,7 @@ setup(
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',
@@ -51,10 +52,8 @@ setup(
'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',
diff --git a/testsuite/test_api.py b/testsuite/test_api.py
index ae83754..6342764 100644
--- a/testsuite/test_api.py
+++ b/testsuite/test_api.py
@@ -28,10 +28,10 @@ class APITestCase(unittest.TestCase):
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
diff --git a/tox.ini b/tox.ini
index 98df04f..29a9e14 100644
--- a/tox.ini
+++ b/tox.ini
@@ -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