diff --git a/docs/StyleGuide.txt b/docs/StyleGuide.txt
index b3072820..18f97874 100644
--- a/docs/StyleGuide.txt
+++ b/docs/StyleGuide.txt
@@ -64,7 +64,7 @@ Python Style Guide. Some things to take particular note of:
* Docstrings are good. They should look like::
- class AClass(object):
+ class AClass:
"""
doc string...
"""
diff --git a/docs/do-it-yourself-framework.txt b/docs/do-it-yourself-framework.txt
index 95b869b9..32d12aae 100644
--- a/docs/do-it-yourself-framework.txt
+++ b/docs/do-it-yourself-framework.txt
@@ -150,7 +150,7 @@ have to start with some root object, of course, which we'll pass in...
::
- class ObjectPublisher(object):
+ class ObjectPublisher:
def __init__(self, root):
self.root = root
@@ -222,7 +222,7 @@ class into a module ``objectpub``::
from objectpub import ObjectPublisher
- class Root(object):
+ class Root:
# The "index" method:
def __call__(self):
@@ -260,12 +260,12 @@ request is a little slim.
# insensitive keys:
from paste.response import HeaderDict
- class Request(object):
+ class Request:
def __init__(self, environ):
self.environ = environ
self.fields = parse_formvars(environ)
- class Response(object):
+ class Response:
def __init__(self):
self.headers = HeaderDict(
{'content-type': 'text/html'})
@@ -286,7 +286,7 @@ we'll attach the request and response objects here.
So, let's remind ourselves of what the ``__call__`` function looked
like::
- class ObjectPublisher(object):
+ class ObjectPublisher:
...
def __call__(self, environ, start_response):
@@ -301,7 +301,7 @@ Lets's update that::
import threading
webinfo = threading.local()
- class ObjectPublisher(object):
+ class ObjectPublisher:
...
def __call__(self, environ, start_response):
@@ -361,7 +361,7 @@ response).
To give an example of a really really simple middleware, here's one
that capitalizes the response::
- class Capitalizer(object):
+ class Capitalizer:
# We generally pass in the application to be wrapped to
# the middleware constructor:
@@ -391,7 +391,7 @@ is a somewhat more thorough implementation of this.
from webob import Request
- class Capitalizer(object):
+ class Capitalizer:
def __init__(self, app):
self.app = app
def __call__(self, environ, start_response):
@@ -402,7 +402,7 @@ is a somewhat more thorough implementation of this.
So here's some code that does something useful, authentication::
- class AuthMiddleware(object):
+ class AuthMiddleware:
def __init__(self, wrap_app):
self.wrap_app = wrap_app
@@ -450,7 +450,7 @@ So here's some code that does something useful, authentication::
from webob import Request, Response
- class AuthMiddleware(object):
+ class AuthMiddleware:
def __init__(self, app):
self.app = app
def __call__(self, environ, start_response):
diff --git a/docs/url-parsing-with-wsgi.txt b/docs/url-parsing-with-wsgi.txt
index 856971fa..1b7cb03e 100644
--- a/docs/url-parsing-with-wsgi.txt
+++ b/docs/url-parsing-with-wsgi.txt
@@ -69,7 +69,7 @@ request and responsibility for the response off to another object
(another actor, really). In the process we can actually retain some
control -- we can capture and transform the response, and we can
modify the request -- but that's not what the typical URL resolver will
-do.
+do.
Motivations
===========
@@ -80,7 +80,7 @@ Typically when a framework first supports WSGI or is integrated into
Paste, it is "monolithic" with respect to URLs. That is, you define
(in Paste, or maybe in Apache) a "root" URL, and everything under that
goes into the framework. What the framework does internally, Paste
-does not know -- it probably finds internal objects to dispatch to,
+does not know -- it probably finds internal objects to dispatch to,
but the framework is opaque to Paste. Not just to Paste, but to
any code that isn't in that framework.
@@ -171,7 +171,7 @@ in turn may delegate to yet another application.
Here's a very simple implementation of URLParser::
- class URLParser(object):
+ class URLParser:
def __init__(self, dir):
self.dir = dir
def __call__(self, environ, start_response):
@@ -217,7 +217,7 @@ handle it. This "application" might be a URLParser or similar system
::
- class GrabDate(object):
+ class GrabDate:
def __init__(self, subapp):
self.subapp = subapp
def __call__(self, environ, start_response):
@@ -249,12 +249,12 @@ well -- it usually just means use ``getattr`` with the popped
segments. But we'll implement a rough approximation of `Quixote's
`_ URL parsing::
- class ObjectApp(object):
+ class ObjectApp:
def __init__(self, obj):
self.obj = obj
def __call__(self, environ, start_response):
next = wsgilib.path_info_pop(environ)
- if next is None:
+ if next is None:
# This is the object, lets serve it...
return self.publish(obj, environ, start_response)
next = next or '_q_index' # the default index method
@@ -288,7 +288,7 @@ Things to note:
(when ``next`` is ``None``). This means ``_q_traverse`` has to
consume extra segments of the path. In this version ``_q_traverse``
is only given the next piece of the path; Quixote gives it the
- entire path (as a list of segments).
+ entire path (as a list of segments).
* ``publish`` is really a small and lame way to turn a Quixote object
into a WSGI application. For any serious framework you'd want to do
@@ -298,7 +298,7 @@ Things to note:
`_ to convert objects into
applications. This would include removing the explicit creation of
new ``ObjectApp`` instances, which could also be a kind of fall-back
- adaptation.
+ adaptation.
Anyway, this example is less complete, but maybe it will get you
thinking.
diff --git a/paste/auth/auth_tkt.py b/paste/auth/auth_tkt.py
index 4237fed5..17d3478f 100644
--- a/paste/auth/auth_tkt.py
+++ b/paste/auth/auth_tkt.py
@@ -52,7 +52,7 @@
DEFAULT_DIGEST = hashlib.md5
-class AuthTicket(object):
+class AuthTicket:
"""
This class represents an authentication token. You must pass in
@@ -221,7 +221,7 @@ def maybe_encode(s, encoding='utf8'):
return s
-class AuthTKTMiddleware(object):
+class AuthTKTMiddleware:
"""
Middleware that checks for signed cookies that match what
diff --git a/paste/auth/basic.py b/paste/auth/basic.py
index c61d26cc..6b1beabf 100644
--- a/paste/auth/basic.py
+++ b/paste/auth/basic.py
@@ -31,7 +31,7 @@
WWW_AUTHENTICATE,
)
-class AuthBasicAuthenticator(object):
+class AuthBasicAuthenticator:
"""
implements ``Basic`` authentication details
"""
@@ -59,7 +59,7 @@ def authenticate(self, environ):
__call__ = authenticate
-class AuthBasicHandler(object):
+class AuthBasicHandler:
"""
HTTP/1.0 ``Basic`` authentication middleware
diff --git a/paste/auth/cookie.py b/paste/auth/cookie.py
index 79b10a5c..2c36c2dc 100644
--- a/paste/auth/cookie.py
+++ b/paste/auth/cookie.py
@@ -79,7 +79,7 @@ def new_secret():
secret = secret.encode('utf8')
return secret
-class AuthCookieSigner(object):
+class AuthCookieSigner:
"""
save/restore ``environ`` entries via digially signed cookie
@@ -195,7 +195,7 @@ def append(self, value):
return
list.append(self, str(value))
-class AuthCookieHandler(object):
+class AuthCookieHandler:
"""
the actual handler that should be put in your middleware stack
diff --git a/paste/auth/digest.py b/paste/auth/digest.py
index e787fe8d..04dec155 100644
--- a/paste/auth/digest.py
+++ b/paste/auth/digest.py
@@ -54,7 +54,7 @@ def _split_auth_string(auth_string):
prev = "%s,%s" % (prev, item)
continue
except AttributeError:
- if prev == None:
+ if prev is None:
prev = item
continue
else:
@@ -78,7 +78,7 @@ def digest_password(realm, username, password):
content = content.encode('utf8')
return md5(content).hexdigest()
-class AuthDigestAuthenticator(object):
+class AuthDigestAuthenticator:
""" implementation of RFC 2617 - HTTP Digest Authentication """
def __init__(self, realm, authfunc):
self.nonce = {} # list to prevent replay attacks
@@ -156,7 +156,7 @@ def authenticate(self, environ):
if qop:
assert 'auth' == qop
assert nonce and nc
- except:
+ except Exception:
return self.build_authentication()
ha1 = self.authfunc(environ, realm, username)
return self.compute(ha1, username, response, method, authpath,
@@ -164,7 +164,7 @@ def authenticate(self, environ):
__call__ = authenticate
-class AuthDigestHandler(object):
+class AuthDigestHandler:
"""
middleware for HTTP Digest authentication (RFC 2617)
diff --git a/paste/auth/form.py b/paste/auth/form.py
index 9be82a29..9fc63f11 100644
--- a/paste/auth/form.py
+++ b/paste/auth/form.py
@@ -44,7 +44,7 @@