From: Harmon Date: Sat, 26 Dec 2020 08:07:47 +0000 (-0600) Subject: Replace six.text_type with str X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=c3d72c1b4aeb802a75e0c7ab960f4c9c40985cb9;p=tweepy.git Replace six.text_type with str --- diff --git a/tweepy/api.py b/tweepy/api.py index 398b823..72411b0 100644 --- a/tweepy/api.py +++ b/tweepy/api.py @@ -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' diff --git a/tweepy/auth.py b/tweepy/auth.py index 9e965d2..271c77c 100644 --- a/tweepy/auth.py +++ b/tweepy/auth.py @@ -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 diff --git a/tweepy/error.py b/tweepy/error.py index b9a3bb8..8541b8d 100644 --- a/tweepy/error.py +++ b/tweepy/error.py @@ -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) diff --git a/tweepy/streaming.py b/tweepy/streaming.py index 1384668..3bb54aa 100644 --- a/tweepy/streaming.py +++ b/tweepy/streaming.py @@ -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 diff --git a/tweepy/utils.py b/tweepy/utils.py index 36e7638..97c534f 100644 --- a/tweepy/utils.py +++ b/tweepy/utils.py @@ -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