Skip to content

Commit 7ed6813

Browse files
authored
Merge pull request #81 from hugovk/rm-2.6
Drop support for EOL Python 2.6
2 parents 3036cba + 1060ca1 commit 7ed6813

File tree

8 files changed

+16
-27
lines changed

8 files changed

+16
-27
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@
55
/dist
66
/docs/_build
77
/.coverage
8+
.idea

.travis.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
language: python
22
python:
3-
- '2.6'
43
- '2.7'
54
- '3.3'
65
- '3.4'

README.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ extracted as a stand-alone project.
1717
Quick facts:
1818

1919
* Free software: BSD licensed
20-
* Compatible with Python 2.6+ and 3.3+
20+
* Compatible with Python 2.7 and 3.3+
2121
* Latest documentation `on Read the Docs <https://cssselect.readthedocs.io/>`_
22-
* Source, issues and pull requests `on Github
22+
* Source, issues and pull requests `on GitHub
2323
<https://github.com/scrapy/cssselect>`_
2424
* Releases `on PyPI <http://pypi.python.org/pypi/cssselect>`_
2525
* Install with ``pip install cssselect``

cssselect/parser.py

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -358,8 +358,6 @@ def parse(css):
358358
# message = "%s at %s -> %r" % (
359359
# e, stream.used, stream.peek())
360360
# e.msg = message
361-
# if sys.version_info < (2,6):
362-
# e.message = message
363361
# e.args = tuple([message])
364362
# raise
365363

@@ -554,14 +552,14 @@ def parse_series(tokens):
554552
raise ValueError('String tokens not allowed in series.')
555553
s = ''.join(token.value for token in tokens).strip()
556554
if s == 'odd':
557-
return (2, 1)
555+
return 2, 1
558556
elif s == 'even':
559-
return (2, 0)
557+
return 2, 0
560558
elif s == 'n':
561-
return (1, 0)
559+
return 1, 0
562560
if 'n' not in s:
563561
# Just b
564-
return (0, int(s))
562+
return 0, int(s)
565563
a, b = s.split('n', 1)
566564
if not a:
567565
a = 1
@@ -573,7 +571,7 @@ def parse_series(tokens):
573571
b = 0
574572
else:
575573
b = int(b)
576-
return (a, b)
574+
return a, b
577575

578576

579577
#### Token objects
@@ -630,12 +628,7 @@ def _compile(pattern):
630628
_sub_newline_escape =re.compile(r'\\(?:\n|\r\n|\r|\f)').sub
631629

632630
# Same as r'\1', but faster on CPython
633-
if hasattr(operator, 'methodcaller'):
634-
# Python 2.6+
635-
_replace_simple = operator.methodcaller('group', 1)
636-
else:
637-
def _replace_simple(match):
638-
return match.group(1)
631+
_replace_simple = operator.methodcaller('group', 1)
639632

640633
def _replace_unicode(match):
641634
codepoint = int(match.group(1), 16)

cssselect/xpath.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,7 @@ def xpath_nth_child_function(self, xpath, function, last=False,
490490
b_neg = (-b_min_1) % abs(a)
491491

492492
if b_neg != 0:
493-
b_neg = '+%s' % (b_neg)
493+
b_neg = '+%s' % b_neg
494494
left = '(%s %s)' % (left, b_neg)
495495

496496
expr.append('%s mod %s = 0' % (left, a))

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@
2929
url='https://github.com/scrapy/cssselect',
3030
license='BSD',
3131
packages=['cssselect'],
32+
python_requires='>=2.7, !=3.0.*, !=3.1.*, !=3.2.*',
3233
classifiers=[
3334
'Development Status :: 4 - Beta',
3435
'Intended Audience :: Developers',
3536
'License :: OSI Approved :: BSD License',
3637
'Programming Language :: Python :: 2',
37-
'Programming Language :: Python :: 2.6',
3838
'Programming Language :: Python :: 2.7',
3939
'Programming Language :: Python :: 3',
4040
'Programming Language :: Python :: 3.3',

tests/test_cssselect.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -288,12 +288,12 @@ def get_error(css):
288288
"Expected string or ident, got <DELIM '#' at 5>")
289289
assert get_error('[href]a') == (
290290
"Expected selector, got <IDENT 'a' at 6>")
291-
assert get_error('[rel=stylesheet]') == None
291+
assert get_error('[rel=stylesheet]') is None
292292
assert get_error('[rel:stylesheet]') == (
293293
"Operator expected, got <DELIM ':' at 4>")
294294
assert get_error('[rel=stylesheet') == (
295295
"Expected ']', got <EOF at 15>")
296-
assert get_error(':lang(fr)') == None
296+
assert get_error(':lang(fr)') is None
297297
assert get_error(':lang(fr') == (
298298
"Expected an argument, got <EOF at 8>")
299299
assert get_error(':contains("foo') == (
@@ -586,8 +586,8 @@ def series(css):
586586
assert series('+n') == (1, 0)
587587
assert series('-n') == (-1, 0)
588588
assert series('5') == (0, 5)
589-
assert series('foo') == None
590-
assert series('n+') == None
589+
assert series('foo') is None
590+
assert series('n+') is None
591591

592592
def test_lang(self):
593593
document = etree.fromstring(XMLLANG_IDS)

tox.ini

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[tox]
2-
envlist = py25,py26,py27,py32,py33
2+
envlist = py27,py33,py34,py35,py36
33

44
[testenv]
55
deps=
@@ -9,7 +9,3 @@ deps=
99

1010
commands =
1111
py.test --cov-report term --cov=cssselect
12-
13-
[testenv:py25]
14-
setenv =
15-
PIP_INSECURE = 1

0 commit comments

Comments
 (0)