From 4d52eaa4801df3f3169df8e58758bcccf22dc4de Mon Sep 17 00:00:00 2001 From: Helmut Grohne Date: Sat, 17 Jun 2023 19:35:21 +0200 Subject: drop support for Python 2.x --- wsgitools/filters.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'wsgitools/filters.py') diff --git a/wsgitools/filters.py b/wsgitools/filters.py index 2a97066..7f8543d 100644 --- a/wsgitools/filters.py +++ b/wsgitools/filters.py @@ -15,7 +15,7 @@ import io from wsgitools.internal import str2bytes __all__.append("CloseableIterator") -class CloseableIterator(object): +class CloseableIterator: """Concatenating iterator with close attribute.""" def __init__(self, close_function, *iterators): """If close_function is not C{None}, it will be the C{close} attribute @@ -40,8 +40,7 @@ class CloseableIterator(object): except StopIteration: self.iterators.pop(0) return next(self) - def next(self): - return self.__next__() + __all__.append("CloseableList") class CloseableList(list): @@ -61,7 +60,7 @@ class CloseableList(list): list.__iter__(self)) __all__.append("BaseWSGIFilter") -class BaseWSGIFilter(object): +class BaseWSGIFilter: """Generic WSGI filter class to be used with L{WSGIFilterMiddleware}. For each request a filter object gets created. @@ -138,7 +137,7 @@ class BaseWSGIFilter(object): """This method is invoked after the request has finished.""" __all__.append("WSGIFilterMiddleware") -class WSGIFilterMiddleware(object): +class WSGIFilterMiddleware: """This wsgi middleware can be used with specialized L{BaseWSGIFilter}s to modify wsgi requests and/or reponses.""" def __init__(self, app, filterclass): @@ -322,7 +321,7 @@ class TimerWSGIFilter(BaseWSGIFilter): @rtype: bytes """ if data == self.pattern: - return str2bytes("%8.3g" % (time.time() - self.start)) + return b"%8.3g" % (time.time() - self.start) return data __all__.append("EncodeWSGIFilter") -- cgit v1.2.3