Update to Python 2.3, getting rid of backward compatiblity crud.

This commit is contained in:
Barry Warsaw 2004-05-09 03:55:11 +00:00
parent 235c8eba62
commit 24f79762a1
5 changed files with 20 additions and 85 deletions

View file

@ -1,17 +1,16 @@
# Copyright (C) 2001,2002 Python Software Foundation
# Author: barry@zope.com (Barry Warsaw)
# Copyright (C) 2001-2004 Python Software Foundation
# Author: barry@python.org (Barry Warsaw)
"""Miscellaneous utilities.
"""
"""Miscellaneous utilities."""
import time
import socket
import re
import random
import os
import re
import time
import base64
import random
import socket
import warnings
from cStringIO import StringIO
from types import ListType
from email._parseaddr import quote
from email._parseaddr import AddressList as _AddressList
@ -21,30 +20,7 @@ from email._parseaddr import mktime_tz
from email._parseaddr import parsedate as _parsedate
from email._parseaddr import parsedate_tz as _parsedate_tz
try:
True, False
except NameError:
True = 1
False = 0
try:
from quopri import decodestring as _qdecode
except ImportError:
# Python 2.1 doesn't have quopri.decodestring()
def _qdecode(s):
import quopri as _quopri
if not s:
return s
infp = StringIO(s)
outfp = StringIO()
_quopri.decode(infp, outfp)
value = outfp.getvalue()
if not s.endswith('\n') and value.endswith('\n'):
return value[:-1]
return value
import base64
from quopri import decodestring as _qdecode
# Intrapackage imports
from email.Encoders import _bencode, _qencode
@ -140,7 +116,7 @@ def decode(s):
# Intra-package import here to avoid circular import problems.
from email.Header import decode_header
L = decode_header(s)
if not isinstance(L, ListType):
if not isinstance(L, list):
# s wasn't decoded
return s