[PATCH 05/15] Convert basestring to str

Łukasz Żarnowiecki dolohow at outlook.com
Tue May 10 00:18:27 BST 2016


Signed-off-by: Łukasz Żarnowiecki <dolohow at outlook.com>
---
 offlineimap/folder/Base.py     | 2 +-
 offlineimap/imaputil.py        | 2 +-
 offlineimap/repository/IMAP.py | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/offlineimap/folder/Base.py b/offlineimap/folder/Base.py
index 0d37c2f..5ac3eb2 100644
--- a/offlineimap/folder/Base.py
+++ b/offlineimap/folder/Base.py
@@ -1086,7 +1086,7 @@ class BaseFolder(object):
         MailDirFolder('foo') == MaildirFolder('foo') --> False
         """
 
-        if isinstance(other, basestring):
+        if isinstance(other, str):
             return other == self.name
         return id(self) == id(other)
 
diff --git a/offlineimap/imaputil.py b/offlineimap/imaputil.py
index 6a18732..1c0b495 100644
--- a/offlineimap/imaputil.py
+++ b/offlineimap/imaputil.py
@@ -101,7 +101,7 @@ def imapsplit(imapstring):
 
     ['(\\HasNoChildren)', '"."', '"INBOX.Sent"']"""
 
-    if not isinstance(imapstring, basestring):
+    if not isinstance(imapstring, str):
         __debug("imapsplit() got a non-string input; working around.")
         # Sometimes, imaplib will throw us a tuple if the input
         # contains a literal.  See Python bug
diff --git a/offlineimap/repository/IMAP.py b/offlineimap/repository/IMAP.py
index a76aadd..350384a 100644
--- a/offlineimap/repository/IMAP.py
+++ b/offlineimap/repository/IMAP.py
@@ -394,7 +394,7 @@ class IMAPRepository(BaseRepository):
             self.imapserver.releaseconnection(imapobj)
         for s in listresult:
             if s == None or \
-                   (isinstance(s, basestring) and s == ''):
+                   (isinstance(s, str) and s == ''):
                 # Bug in imaplib: empty strings in results from
                 # literals. TODO: still relevant?
                 continue
-- 
2.8.2





More information about the OfflineIMAP-project mailing list