Replace six.text_type with str
authorHarmon <Harmon758@gmail.com>
Sat, 26 Dec 2020 08:07:47 +0000 (02:07 -0600)
committerHarmon <Harmon758@gmail.com>
Sat, 26 Dec 2020 08:07:47 +0000 (02:07 -0600)
tweepy/api.py
tweepy/auth.py
tweepy/error.py
tweepy/streaming.py
tweepy/utils.py

index 398b823db1f63f15c39594ce34d8fb1f11c80ab9..72411b06f2415ccdb8bb666e2d20b4a077837fe7 100644 (file)
@@ -6,8 +6,6 @@ import imghdr
 import mimetypes
 import os
 
-import six
-
 from tweepy.binder import bind_api, pagination
 from tweepy.error import TweepError
 from tweepy.parsers import ModelParser, Parser
@@ -1424,7 +1422,7 @@ class API(object):
         elif file_type not in ['image/gif', 'image/jpeg', 'image/png']:
             raise TweepError('Invalid file type for image: %s' % file_type)
 
-        if isinstance(filename, six.text_type):
+        if isinstance(filename, str):
             filename = filename.encode('utf-8')
 
         BOUNDARY = b'Tw3ePy'
index 9e965d266a4266c4c6cf1d6471fb306eda5a1c30..271c77cff3e36fae6c9b96c1c4430e27b4ba8660 100644 (file)
@@ -5,7 +5,6 @@
 import logging
 
 import requests
-import six
 from requests.auth import AuthBase
 from requests_oauthlib import OAuth1, OAuth1Session
 from urllib.parse import parse_qs
@@ -37,10 +36,10 @@ class OAuthHandler(AuthHandler):
     OAUTH_ROOT = '/oauth/'
 
     def __init__(self, consumer_key, consumer_secret, callback=None):
-        if type(consumer_key) == six.text_type:
+        if type(consumer_key) == str:
             consumer_key = consumer_key.encode('ascii')
 
-        if type(consumer_secret) == six.text_type:
+        if type(consumer_secret) == str:
             consumer_secret = consumer_secret.encode('ascii')
 
         self.consumer_key = consumer_key
index b9a3bb8c0929783d24c67eba85edd98ef3384d44..8541b8d6dd2758095bfb8d4db83e10323dacd9f1 100644 (file)
@@ -2,14 +2,12 @@
 # Copyright 2009-2020 Joshua Roesslein
 # See LICENSE for details.
 
-import six
-
 
 class TweepError(Exception):
     """Tweepy exception"""
 
     def __init__(self, reason, response=None, api_code=None):
-        self.reason = six.text_type(reason)
+        self.reason = str(reason)
         self.response = response
         self.api_code = api_code
         super(TweepError, self).__init__(reason)
index 1384668e93f332c18ecdd4b949c1c30c38be4c7f..3bb54aa03e5fe44d6dd4a7e3fbf0cb1e6631f0ff 100644 (file)
@@ -477,7 +477,7 @@ class Stream(object):
         if self.running:
             raise TweepError('Stream object already connected!')
         self.url = '/%s/site.json' % STREAM_VERSION
-        self.body['follow'] = ','.join(map(six.text_type, follow))
+        self.body['follow'] = ','.join(map(str, follow))
         self.body['delimited'] = 'length'
         if stall_warnings:
             self.body['stall_warnings'] = stall_warnings
index 36e7638075be3388a34e2992713a3295bfcb2b78..97c534fd26cea0d52ceb46194f496944746f93b9 100644 (file)
@@ -5,8 +5,6 @@
 from datetime import datetime
 from email.utils import parsedate
 
-import six
-
 
 def parse_datetime(string):
     return datetime(*(parsedate(string)[:6]))
@@ -24,10 +22,10 @@ def parse_a_href(atag):
 
 def convert_to_utf8_str(arg):
     # written by Michael Norton (http://docondev.blogspot.com/)
-    if isinstance(arg, six.text_type):
+    if isinstance(arg, str):
         arg = arg.encode('utf-8')
     elif not isinstance(arg, bytes):
-        arg = six.text_type(arg).encode('utf-8')
+        arg = str(arg).encode('utf-8')
     return arg