Commit 62eb3da8 authored by Joshua Roesslein's avatar Joshua Roesslein Committed by GitHub

Merge pull request #1043 from hugovk/rm-eol

Remove redundant Python 2.6 and 3.3 code
parents 605da21f 8f62489d
......@@ -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
---------
......
......@@ -28,6 +28,7 @@ setup(name="tweepy",
"PySocks>=1.5.7",
],
keywords="twitter library",
python_requires='>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*',
classifiers=[
'Development Status :: 4 - Beta',
'Topic :: Software Development :: Libraries',
......@@ -35,10 +36,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',
......
tox>=1.7.2
vcrpy==1.10.3
mock==1.0.1
unittest2 # Comment this line out if using Python 3.
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', '')
......
......@@ -397,7 +397,7 @@ class TweepyAPITests(TweepyTestCase):
def testgeoapis(self):
def place_name_in_list(place_name, place_list):
"""Return True if a given place_name is in place_list."""
return any([x.full_name.lower() == place_name.lower() for x in place_list])
return any(x.full_name.lower() == place_name.lower() for x in place_list)
twitter_hq = self.api.geo_similar_places(lat='37.7821120598956',
long='-122.400612831116',
......
......@@ -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):
......
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):
......
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
......@@ -20,7 +15,7 @@ class TweepyRateLimitTests(unittest.TestCase):
self.api = API(create_auth())
self.api.retry_count = 2
self.api.retry_delay = 5
self.api.retry_errors = set([401, 404, 503])
self.api.retry_errors = {401, 404, 503}
self.api.wait_on_rate_limit = True
def testratelimit(self):
......@@ -31,7 +26,7 @@ class TweepyRateLimitTests(unittest.TestCase):
self.api.user_timeline(user_id=user_id, count=1, include_rts=True)
except TweepError as e:
# continue if we're not autherized to access the user's timeline or she doesn't exist anymore
if e.response is not None and e.response.status in set([401, 404]):
if e.response is not None and e.response.status in {401, 404}:
continue
raise e
......
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
......
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."""
......
......@@ -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 =
......
......@@ -1324,7 +1324,7 @@ class API(object):
filename = filename.encode("utf-8")
BOUNDARY = b'Tw3ePy'
body = list()
body = []
body.append(b'--' + BOUNDARY)
body.append('Content-Disposition: form-data; name="{0}";'
' filename="{1}"'.format(form_field, filename)
......
......@@ -6,6 +6,7 @@ from __future__ import print_function
import time
import datetime
import hashlib
import threading
import os
import logging
......@@ -15,12 +16,6 @@ try:
except ImportError:
import pickle
try:
import hashlib
except ImportError:
# python 2.4
import md5 as hashlib
try:
import fcntl
except ImportError:
......
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment