compat.py passes pyflakes test

Drop support for Python 2.6 and 3.3
This commit is contained in:
cclauss 2018-01-24 20:26:44 +01:00
parent 2b56963f31
commit b569b19a7f
17 changed files with 45 additions and 117 deletions

View File

@ -1,32 +1,26 @@
language: python
matrix:
allow_failures:
- env: TOX_ENV=squeeze
include:
- python: 2.6
env: TOX_ENV=py26
- python: 2.7
env: TOX_ENV=py27
- python: 3.3
env: TOX_ENV=py33
- python: 3.4
env: TOX_ENV=py34
- python: 3.5
env: TOX_ENV=py35
- python: 3.6
env: TOX_ENV=py36
- python: 2.6
env: TOX_ENV=squeeze
- python: 2.7
env: TOX_ENV=wheezy
install:
- pip install -U pip
- pip install tox
- pip install pyflakes
- pip install flake8 tox
- sudo rm -rf /dev/shm && sudo ln -s /run/shm /dev/shm
script:
- tox -e $TOX_ENV
- python -m pyflakes.__main__ $(git ls-files | grep -E "^isso/.+.py$" | grep -v "^isso/compat.py")
# stop the build if there are Python syntax errors or undefined names
- flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
- flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
notifications:
irc:
channels:

View File

@ -79,7 +79,7 @@ Install from PyPi
Requirements
^^^^^^^^^^^^
- Python 2.6, 2.7 or 3.3+ (+ devel headers)
- Python 2.7 or 3.4+ (+ devel headers)
- SQLite 3.3.8 or later
- a working C compiler
@ -157,7 +157,7 @@ Install from Source
If you want to hack on Isso or track down issues, there's an alternate
way to set up Isso. It requires a lot more dependencies and effort:
- Python 2.6, 2.7 or 3.3+ (+ devel headers)
- Python 2.7 or 3.4+ (+ devel headers)
- Virtualenv
- SQLite 3.3.8 or later
- a working C compiler

View File

@ -1,28 +1,22 @@
# -*- encoding: utf-8 -*-
import sys
PY2K = sys.version_info[0] == 2
if not PY2K:
map, zip, filter = map, zip, filter
from functools import reduce
iteritems = lambda dikt: iter(dikt.items())
try:
text_type = unicode # Python 2
string_types = (str, unicode)
PY2K = True
except NameError: # Python 3
PY2K = False
text_type = str
string_types = (str, )
if not PY2K:
buffer = memoryview
filter, map, zip = filter, map, zip
iteritems = lambda dikt: iter(dikt.items()) # noqa: E731
from functools import reduce
else:
from itertools import imap, izip, ifilter
map, zip, filter = imap, izip, ifilter
reduce = reduce
iteritems = lambda dikt: dikt.iteritems()
text_type = unicode
string_types = (str, unicode)
buffer = buffer
from itertools import ifilter, imap, izip
filter, map, zip = ifilter, imap, izip
iteritems = lambda dikt: dikt.iteritems() # noqa: E731
reduce = reduce

View File

@ -17,11 +17,6 @@ from isso.compat import text_type as str
logger = logging.getLogger("isso")
# Python 2.6 compatibility
def total_seconds(td):
return (td.microseconds + (td.seconds + td.days * 24 * 3600) * 10**6) / 10**6
def timedelta(string):
"""
Parse :param string: into :class:`datetime.timedelta`, you can use any
@ -101,7 +96,7 @@ class IssoParser(ConfigParser):
try:
return int(delta.total_seconds())
except AttributeError:
return int(total_seconds(delta))
return int(delta.total_seconds())
def getlist(self, section, key):
return list(map(str.strip, self.get(section, key).split(',')))

View File

@ -5,11 +5,7 @@ from __future__ import unicode_literals
import os
import json
import tempfile
try:
import unittest2 as unittest
except ImportError:
import unittest
import unittest
try:
from urllib.parse import urlencode

View File

@ -1,10 +1,6 @@
# -*- encoding: utf-8 -*-
try:
import unittest2 as unittest
except ImportError:
import unittest
import unittest
import io
from isso import config

View File

@ -1,10 +1,7 @@
from __future__ import unicode_literals
try:
import unittest2 as unittest
except ImportError:
import unittest
import unittest
from werkzeug.test import Client
from werkzeug.wrappers import Response

View File

@ -1,10 +1,6 @@
# -*- encoding: utf-8 -*-
try:
import unittest2 as unittest
except ImportError:
import unittest
import unittest
import os
import sqlite3
import tempfile

View File

@ -2,11 +2,7 @@
from __future__ import unicode_literals
try:
import unittest2 as unittest
except ImportError:
import unittest
import unittest
import os
import json
import tempfile

View File

@ -1,10 +1,6 @@
# -*- encoding: utf-8 -*-
try:
import unittest2 as unittest
except ImportError:
import unittest
import unittest
import textwrap
from isso import config

View File

@ -2,11 +2,7 @@
from __future__ import unicode_literals
try:
import unittest2 as unittest
except ImportError:
import unittest
import unittest
import tempfile
from os.path import join, dirname

View File

@ -1,10 +1,6 @@
# -*- encoding: utf-8 -*-
try:
import unittest2 as unittest
except ImportError:
import unittest
import unittest
from isso import utils
from isso.utils import parse

View File

@ -2,10 +2,7 @@
from __future__ import unicode_literals
try:
import unittest2 as unittest
except ImportError:
import unittest
import unittest
from isso import config

View File

@ -4,11 +4,7 @@ from __future__ import unicode_literals
import os
import json
import tempfile
try:
import unittest2 as unittest
except ImportError:
import unittest
import unittest
from werkzeug.wrappers import Response

View File

@ -1,10 +1,6 @@
# -*- encoding: utf-8 -*-
try:
import unittest2 as unittest
except ImportError:
import unittest
import unittest
from isso import wsgi

View File

@ -5,10 +5,13 @@ import sys
from setuptools import setup, find_packages
requires = ['itsdangerous', 'misaka>=1.0,<2.0', 'html5lib==0.9999999', 'Jinja2']
requires = ['html5lib==0.9999999', 'itsdangerous', 'Jinja2',
'misaka>=1.0,<2.0', 'werkzeug>=0.9']
if (3, 0) <= sys.version_info < (3, 3):
raise SystemExit("Python 3.0, 3.1 and 3.2 are not supported")
if sys.version_info < (2, 7):
raise SystemExit("Python 2 versions < 2.7 are not supported.")
elif (3, 0) <= sys.version_info < (3, 4):
raise SystemExit("Python 3 versions < 3.4 are not supported.")
setup(
name='isso',
@ -27,16 +30,14 @@ setup(
"Topic :: Internet :: WWW/HTTP :: HTTP Servers",
"Topic :: Internet :: WWW/HTTP :: WSGI :: Application",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 2.6",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3.3",
"Programming Language :: Python :: 3.4"
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6"
],
install_requires=requires,
extras_require={
':python_version=="2.6"': ['argparse', 'ordereddict'],
':python_version=="2.6" or python_version=="2.7"': ['ipaddr>=2.1', 'configparser', 'werkzeug>=0.8'],
':python_version!="2.6" and python_version!="2.7"': ['werkzeug>=0.9']
':python_version=="2.7"': ['ipaddr>=2.1', 'configparser']
},
entry_points={
'console_scripts':

16
tox.ini
View File

@ -1,5 +1,5 @@
[tox]
envlist = py27,py33,py34,py35,py36
envlist = py27,py34,py35,py36
[testenv]
deps =
@ -8,14 +8,6 @@ deps =
commands =
python setup.py nosetests
[testenv:py26]
deps =
argparse
unittest2
ordereddict
configparser
{[testenv]deps}
[testenv:py27]
deps =
configparser
@ -30,12 +22,6 @@ deps=
passlib==1.5.3
werkzeug==0.8.3
[testenv:squeeze]
basepython=python2.6
deps=
{[testenv:py26]deps}
{[testenv:debian]deps}
[testenv:wheezy]
basepython=python2.7
deps =