From 0494119f57eb9e936ba7609d4f46b1fba1d81c7e Mon Sep 17 00:00:00 2001 From: Hugo Date: Mon, 14 May 2018 16:05:39 +0300 Subject: [PATCH] Remove redundant Python 2.6 and 3.3 code --- README.md | 2 +- setup.py | 2 -- test_requirements.txt | 1 - tests/config.py | 7 +------ tests/test_auth.py | 6 +----- tests/test_cursors.py | 9 +-------- tests/test_rate_limit.py | 9 ++------- tests/test_streaming.py | 10 ++-------- tests/test_utils.py | 8 ++------ tox.ini | 13 +------------ tweepy/utils.py | 10 +--------- 11 files changed, 12 insertions(+), 65 deletions(-) diff --git a/README.md b/README.md index ff59ed7..ac3ddc2 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ GitHub and install it manually: cd tweepy python setup.py install -Python 2.6 and 2.7, 3.3, 3.4, 3.5 & 3.6 are supported. +Python 2.7, 3.4, 3.5 & 3.6 are supported. Community --------- diff --git a/setup.py b/setup.py index 5688c2f..2f4647a 100644 --- a/setup.py +++ b/setup.py @@ -35,10 +35,8 @@ setup(name="tweepy", '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/test_requirements.txt b/test_requirements.txt index 5aa0689..0279dad 100644 --- a/test_requirements.txt +++ b/test_requirements.txt @@ -1,4 +1,3 @@ tox>=1.7.2 vcrpy==1.10.3 mock==1.0.1 -unittest2 # Comment this line out if using Python 3. diff --git a/tests/config.py b/tests/config.py index 165909d..9a33412 100644 --- a/tests/config.py +++ b/tests/config.py @@ -1,15 +1,10 @@ import os - +import unittest import vcr from tweepy.auth import OAuthHandler from tweepy.api import API -import six -if six.PY3: - import unittest -else: - import unittest2 as unittest username = os.environ.get('TWITTER_USERNAME', 'tweepytest') oauth_consumer_key = os.environ.get('CONSUMER_KEY', '') diff --git a/tests/test_auth.py b/tests/test_auth.py index 6211ebd..e09d0e3 100644 --- a/tests/test_auth.py +++ b/tests/test_auth.py @@ -3,13 +3,9 @@ from __future__ import absolute_import from .config import * from tweepy import API, OAuthHandler -import six import random +import unittest -if six.PY3: - import unittest -else: - import unittest2 as unittest class TweepyAuthTests(unittest.TestCase): diff --git a/tests/test_cursors.py b/tests/test_cursors.py index 5b409d0..29ca5a7 100644 --- a/tests/test_cursors.py +++ b/tests/test_cursors.py @@ -1,13 +1,6 @@ from tweepy import Cursor -from .config import create_auth -from .config import TweepyTestCase, username, use_replay, tape - -import six -if six.PY3: - import unittest -else: - import unittest2 as unittest +from .config import TweepyTestCase, username, tape class TweepyCursorTests(TweepyTestCase): diff --git a/tests/test_rate_limit.py b/tests/test_rate_limit.py index d5b14eb..0ce1515 100644 --- a/tests/test_rate_limit.py +++ b/tests/test_rate_limit.py @@ -1,14 +1,9 @@ -import unittest import os +import unittest -from tweepy import API, Cursor +from tweepy import API from tweepy.error import TweepError -import six -if six.PY3: - import unittest -else: - import unittest2 as unittest from .config import create_auth testratelimit = 'TEST_RATE_LIMIT' in os.environ diff --git a/tests/test_streaming.py b/tests/test_streaming.py index de91357..0ef286b 100644 --- a/tests/test_streaming.py +++ b/tests/test_streaming.py @@ -1,14 +1,8 @@ from __future__ import absolute_import, print_function -from .config import tape - import six -if six.PY3: - import unittest - from unittest.case import skip -else: - import unittest2 as unittest - from unittest2.case import skip +import unittest +from unittest.case import skip from tweepy.api import API from tweepy.auth import OAuthHandler diff --git a/tests/test_utils.py b/tests/test_utils.py index fa926a8..5ead6b8 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -1,13 +1,9 @@ -import six -if six.PY3: - import unittest -else: - import unittest2 as unittest - from tweepy.utils import * import random import string +import unittest + def mock_tweet(): """Generate some random tweet text.""" diff --git a/tox.ini b/tox.ini index 882bad2..1eb1481 100644 --- a/tox.ini +++ b/tox.ini @@ -4,7 +4,7 @@ # and then run "tox" from this directory. [tox] -envlist = py26, py27, py33, py34, py35, py36 +envlist = py27, py34, py35, py36 [base] deps = @@ -12,17 +12,6 @@ deps = vcrpy==1.0.2 mock==1.0.1 -[py2] -deps = - {[base]deps} - unittest2==0.5.1 - -[testenv:py27] -deps = {[py2]deps} - -[testenv:py26] -deps = {[py2]deps} - [testenv] commands = nosetests -v tests.test_cursors tests.test_api tests.test_utils deps = diff --git a/tweepy/utils.py b/tweepy/utils.py index 36d3402..e3843a7 100644 --- a/tweepy/utils.py +++ b/tweepy/utils.py @@ -7,7 +7,6 @@ from __future__ import print_function from datetime import datetime import six -from six.moves.urllib.parse import quote from email.utils import parsedate @@ -41,14 +40,7 @@ def import_simplejson(): try: import simplejson as json except ImportError: - try: - import json # Python 2.6+ - except ImportError: - try: - # Google App Engine - from django.utils import simplejson as json - except ImportError: - raise ImportError("Can't load a json library") + import json return json -- 2.25.1