--- a/paste/lint.py +++ b/paste/lint.py @@ -111,7 +111,6 @@ import re import sys -from types import DictType, StringType, TupleType, ListType import warnings header_re = re.compile(r'^[a-zA-Z][a-zA-Z0-9\-_]*$') @@ -282,7 +281,7 @@ "Iterator garbage collected without being closed") def check_environ(environ): - assert type(environ) is DictType, ( + assert isinstance(environ,dict), ( "Environment is not of the right type: %r (environment: %r)" % (type(environ), environ)) @@ -309,11 +308,11 @@ if '.' in key: # Extension, we don't care about its type continue - assert type(environ[key]) is StringType, ( + assert isinstance(environ[key], str), ( "Environmental variable %s is not a string: %r (value: %r)" % (key, type(environ[key]), environ[key])) - assert type(environ['wsgi.version']) is TupleType, ( + assert isinstance(environ['wsgi.version'], tuple), ( "wsgi.version should be a tuple (%r)" % environ['wsgi.version']) assert environ['wsgi.url_scheme'] in ('http', 'https'), ( "wsgi.url_scheme unknown: %r" % environ['wsgi.url_scheme']) @@ -359,7 +358,7 @@ % (wsgi_errors, attr)) def check_status(status): - assert type(status) is StringType, ( + assert isinstance(status, str), ( "Status must be a string (not %r)" % status) # Implicitly check that we can turn it into an integer: status_code = status.split(None, 1)[0] @@ -374,12 +373,12 @@ % status, WSGIWarning) def check_headers(headers): - assert type(headers) is ListType, ( + assert isinstance(headers,list), ( "Headers (%r) must be of type list: %r" % (headers, type(headers))) header_names = {} for item in headers: - assert type(item) is TupleType, ( + assert isinstance(item, tuple), ( "Individual headers (%r) must be of type tuple: %r" % (item, type(item))) assert len(item) == 2