Remove tests for old Python versions.

This commit is contained in:
Bastian Kleineidam 2010-11-21 10:44:27 +01:00
parent fcc3e6dc03
commit b24086f1a0
2 changed files with 3 additions and 27 deletions

View file

@ -993,13 +993,9 @@ def from_file(f):
@raises linkcheck.dns.exception.DNSSyntaxError:
@rtype: linkcheck.dns.message.Message object"""
if sys.hexversion >= 0x02030000:
# allow Unicode filenames; turn on universal newline support
str_type = basestring
opts = 'rU'
else:
str_type = str
opts = 'r'
# allow Unicode filenames; turn on universal newline support
str_type = basestring
opts = 'rU'
if isinstance(f, str_type):
f = file(f, opts)
want_close = True

View file

@ -192,21 +192,6 @@ def _setup_hashes():
_hashes[HMAC_SHA1] = hashlib.sha1
_hashes[HMAC_MD5] = hashlib.md5
if sys.hexversion < 0x02050000:
# hashlib doesn't conform to PEP 247: API for
# Cryptographic Hash Functions, which hmac before python
# 2.5 requires, so add the necessary items.
class HashlibWrapper:
def __init__(self, basehash):
self.basehash = basehash
self.digest_size = self.basehash().digest_size
def new(self, *args, **kwargs):
return self.basehash(*args, **kwargs)
for name in _hashes:
_hashes[name] = HashlibWrapper(_hashes[name])
except ImportError:
import md5, sha
_hashes[HMAC_MD5] = md5
@ -227,11 +212,6 @@ def get_algorithm(algorithm):
if isinstance(algorithm, basestring):
algorithm = linkcheck.dns.name.from_text(algorithm)
if sys.hexversion < 0x02050200 and \
(algorithm == HMAC_SHA384 or algorithm == HMAC_SHA512):
raise NotImplementedError("TSIG algorithm " + str(algorithm) +
" requires Python 2.5.2 or later")
try:
return (algorithm.to_digestable(), _hashes[algorithm])
except KeyError: