From 422b18aceae25f891920efb2630035056ff5a77f Mon Sep 17 00:00:00 2001 From: "Paul J. Dorn" Date: Sat, 9 Dec 2023 03:59:09 +0100 Subject: [PATCH] class Name(object): -> class Name: --- examples/frameworks/cherryapp.py | 2 +- .../django/testing/testing/apps/someapp/middleware.py | 2 +- examples/longpoll.py | 2 +- examples/multiapp.py | 2 +- examples/websocket/gevent_websocket.py | 4 ++-- examples/websocket/websocket.py | 4 ++-- gunicorn/app/base.py | 2 +- gunicorn/arbiter.py | 2 +- gunicorn/config.py | 4 ++-- gunicorn/debug.py | 2 +- gunicorn/glogging.py | 2 +- gunicorn/http/body.py | 8 ++++---- gunicorn/http/message.py | 2 +- gunicorn/http/parser.py | 2 +- gunicorn/http/unreader.py | 2 +- gunicorn/http/wsgi.py | 4 ++-- gunicorn/pidfile.py | 2 +- gunicorn/reloader.py | 2 +- gunicorn/sock.py | 2 +- gunicorn/workers/base.py | 2 +- gunicorn/workers/ggevent.py | 2 +- gunicorn/workers/gthread.py | 2 +- gunicorn/workers/workertmp.py | 2 +- tests/t.py | 4 ++-- tests/test_config.py | 4 ++-- tests/test_statsd.py | 2 +- tests/treq.py | 2 +- 27 files changed, 36 insertions(+), 36 deletions(-) diff --git a/examples/frameworks/cherryapp.py b/examples/frameworks/cherryapp.py index 5b97ce0b..fa9ea676 100644 --- a/examples/frameworks/cherryapp.py +++ b/examples/frameworks/cherryapp.py @@ -1,7 +1,7 @@ import cherrypy -class Root(object): +class Root: @cherrypy.expose def index(self): return 'Hello World!' diff --git a/examples/frameworks/django/testing/testing/apps/someapp/middleware.py b/examples/frameworks/django/testing/testing/apps/someapp/middleware.py index ddc667a9..74d10c34 100644 --- a/examples/frameworks/django/testing/testing/apps/someapp/middleware.py +++ b/examples/frameworks/django/testing/testing/apps/someapp/middleware.py @@ -8,7 +8,7 @@ def child_process(queue): requests.get('http://requestb.in/15s95oz1') -class GunicornSubProcessTestMiddleware(object): +class GunicornSubProcessTestMiddleware: def __init__(self): super().__init__() self.queue = Queue() diff --git a/examples/longpoll.py b/examples/longpoll.py index b1282090..4b453d49 100644 --- a/examples/longpoll.py +++ b/examples/longpoll.py @@ -6,7 +6,7 @@ import sys import time -class TestIter(object): +class TestIter: def __iter__(self): lines = [b'line 1\n', b'line 2\n'] diff --git a/examples/multiapp.py b/examples/multiapp.py index fdae7ecd..04edf08f 100644 --- a/examples/multiapp.py +++ b/examples/multiapp.py @@ -24,7 +24,7 @@ from test import app as app1 from test import app as app2 -class Application(object): +class Application: def __init__(self): self.map = Mapper() self.map.connect('app1', '/app1url', app=app1) diff --git a/examples/websocket/gevent_websocket.py b/examples/websocket/gevent_websocket.py index c1c541df..ff5109e5 100644 --- a/examples/websocket/gevent_websocket.py +++ b/examples/websocket/gevent_websocket.py @@ -16,7 +16,7 @@ logger = logging.getLogger(__name__) WS_KEY = b"258EAFA5-E914-47DA-95CA-C5AB0DC85B11" -class WebSocketWSGI(object): +class WebSocketWSGI: def __init__(self, handler): self.handler = handler @@ -117,7 +117,7 @@ class WebSocketWSGI(object): # doesn't barf on the fact that we didn't call start_response return ALREADY_HANDLED -class WebSocket(object): +class WebSocket: """A websocket object that handles the details of serialization/deserialization to the socket. diff --git a/examples/websocket/websocket.py b/examples/websocket/websocket.py index 11b5f715..0e8dffeb 100644 --- a/examples/websocket/websocket.py +++ b/examples/websocket/websocket.py @@ -17,7 +17,7 @@ logger = logging.getLogger(__name__) WS_KEY = b"258EAFA5-E914-47DA-95CA-C5AB0DC85B11" -class WebSocketWSGI(object): +class WebSocketWSGI: def __init__(self, handler): self.handler = handler @@ -118,7 +118,7 @@ class WebSocketWSGI(object): # doesn't barf on the fact that we didn't call start_response return ALREADY_HANDLED -class WebSocket(object): +class WebSocket: """A websocket object that handles the details of serialization/deserialization to the socket. diff --git a/gunicorn/app/base.py b/gunicorn/app/base.py index adb9fdb5..9bf7a4f0 100644 --- a/gunicorn/app/base.py +++ b/gunicorn/app/base.py @@ -13,7 +13,7 @@ from gunicorn.config import Config, get_default_config_file from gunicorn import debug -class BaseApplication(object): +class BaseApplication: """ An application interface for configuring and loading the various necessities for any given web framework. diff --git a/gunicorn/arbiter.py b/gunicorn/arbiter.py index 35c3b377..d0a0a582 100644 --- a/gunicorn/arbiter.py +++ b/gunicorn/arbiter.py @@ -17,7 +17,7 @@ from gunicorn import sock, systemd, util from gunicorn import __version__, SERVER_SOFTWARE -class Arbiter(object): +class Arbiter: """ Arbiter maintain the workers processes alive. It launches or kills them if needed. It also manages application reloading diff --git a/gunicorn/config.py b/gunicorn/config.py index 22b4a722..732f3eef 100644 --- a/gunicorn/config.py +++ b/gunicorn/config.py @@ -42,7 +42,7 @@ def auto_int(_, x): return int(x, 0) -class Config(object): +class Config: def __init__(self, usage=None, prog=None): self.settings = make_settings() @@ -252,7 +252,7 @@ class SettingMeta(type): setattr(cls, "short", desc.splitlines()[0]) -class Setting(object): +class Setting: name = None value = None section = None diff --git a/gunicorn/debug.py b/gunicorn/debug.py index a0aaa2bf..7db82639 100644 --- a/gunicorn/debug.py +++ b/gunicorn/debug.py @@ -15,7 +15,7 @@ __all__ = ['spew', 'unspew'] _token_spliter = re.compile(r'\W+') -class Spew(object): +class Spew: def __init__(self, trace_names=None, show_values=True): self.trace_names = trace_names diff --git a/gunicorn/glogging.py b/gunicorn/glogging.py index cb1fdabf..e34fcd5f 100644 --- a/gunicorn/glogging.py +++ b/gunicorn/glogging.py @@ -161,7 +161,7 @@ def parse_syslog_address(addr): return (socktype, (host, port)) -class Logger(object): +class Logger: LOG_LEVELS = { "critical": logging.CRITICAL, diff --git a/gunicorn/http/body.py b/gunicorn/http/body.py index e4ca73da..27f6605c 100644 --- a/gunicorn/http/body.py +++ b/gunicorn/http/body.py @@ -9,7 +9,7 @@ from gunicorn.http.errors import (NoMoreData, ChunkMissingTerminator, InvalidChunkSize) -class ChunkedReader(object): +class ChunkedReader: def __init__(self, req, unreader): self.req = req self.parser = self.parse_chunked(unreader) @@ -107,7 +107,7 @@ class ChunkedReader(object): buf.write(data) -class LengthReader(object): +class LengthReader: def __init__(self, unreader, length): self.unreader = unreader self.length = length @@ -137,7 +137,7 @@ class LengthReader(object): return ret -class EOFReader(object): +class EOFReader: def __init__(self, unreader): self.unreader = unreader self.buf = io.BytesIO() @@ -175,7 +175,7 @@ class EOFReader(object): return ret -class Body(object): +class Body: def __init__(self, reader): self.reader = reader self.buf = io.BytesIO() diff --git a/gunicorn/http/message.py b/gunicorn/http/message.py index 013bccb0..1e1d8d9e 100644 --- a/gunicorn/http/message.py +++ b/gunicorn/http/message.py @@ -29,7 +29,7 @@ METHOD_BADCHAR_RE = re.compile("[a-z#]") VERSION_RE = re.compile(r"HTTP/(\d)\.(\d)") -class Message(object): +class Message: def __init__(self, cfg, unreader, peer_addr): self.cfg = cfg self.unreader = unreader diff --git a/gunicorn/http/parser.py b/gunicorn/http/parser.py index 8e8d8b09..88da17ab 100644 --- a/gunicorn/http/parser.py +++ b/gunicorn/http/parser.py @@ -6,7 +6,7 @@ from gunicorn.http.message import Request from gunicorn.http.unreader import SocketUnreader, IterUnreader -class Parser(object): +class Parser: mesg_class = None diff --git a/gunicorn/http/unreader.py b/gunicorn/http/unreader.py index 987da464..9aadfbcf 100644 --- a/gunicorn/http/unreader.py +++ b/gunicorn/http/unreader.py @@ -9,7 +9,7 @@ import os # a given type of data source. -class Unreader(object): +class Unreader: def __init__(self): self.buf = io.BytesIO() diff --git a/gunicorn/http/wsgi.py b/gunicorn/http/wsgi.py index f8f6354e..419ac503 100644 --- a/gunicorn/http/wsgi.py +++ b/gunicorn/http/wsgi.py @@ -24,7 +24,7 @@ HEADER_VALUE_RE = re.compile(r'[ \t\x21-\x7e\x80-\xff]*') log = logging.getLogger(__name__) -class FileWrapper(object): +class FileWrapper: def __init__(self, filelike, blksize=8192): self.filelike = filelike @@ -197,7 +197,7 @@ def create(req, sock, client, server, cfg): return resp, environ -class Response(object): +class Response: def __init__(self, req, sock, cfg): self.req = req diff --git a/gunicorn/pidfile.py b/gunicorn/pidfile.py index 5b3d993d..06abb34e 100644 --- a/gunicorn/pidfile.py +++ b/gunicorn/pidfile.py @@ -7,7 +7,7 @@ import os import tempfile -class Pidfile(object): +class Pidfile: """\ Manage a PID file. If a specific name is provided it and '"%s.oldpid" % name' will be used. Otherwise diff --git a/gunicorn/reloader.py b/gunicorn/reloader.py index 671e0337..1c67f2a7 100644 --- a/gunicorn/reloader.py +++ b/gunicorn/reloader.py @@ -116,7 +116,7 @@ if has_inotify: else: - class InotifyReloader(object): + class InotifyReloader: def __init__(self, extra_files=None, callback=None): raise ImportError('You must have the inotify module installed to ' 'use the inotify reloader') diff --git a/gunicorn/sock.py b/gunicorn/sock.py index 231649e2..751e9c7a 100644 --- a/gunicorn/sock.py +++ b/gunicorn/sock.py @@ -13,7 +13,7 @@ import time from gunicorn import util -class BaseSocket(object): +class BaseSocket: def __init__(self, address, conf, log, fd=None): self.log = log diff --git a/gunicorn/workers/base.py b/gunicorn/workers/base.py index abdf911d..dc954698 100644 --- a/gunicorn/workers/base.py +++ b/gunicorn/workers/base.py @@ -25,7 +25,7 @@ from gunicorn.reloader import reloader_engines from gunicorn.workers.workertmp import WorkerTmp -class Worker(object): +class Worker: SIGNALS = [getattr(signal, "SIG%s" % x) for x in ( "ABRT HUP QUIT INT TERM USR1 USR2 WINCH CHLD".split() diff --git a/gunicorn/workers/ggevent.py b/gunicorn/workers/ggevent.py index 15552e87..42a6f21b 100644 --- a/gunicorn/workers/ggevent.py +++ b/gunicorn/workers/ggevent.py @@ -146,7 +146,7 @@ class GeventWorker(AsyncWorker): super().init_process() -class GeventResponse(object): +class GeventResponse: status = None headers = None diff --git a/gunicorn/workers/gthread.py b/gunicorn/workers/gthread.py index 8dd35a4d..9edb98b2 100644 --- a/gunicorn/workers/gthread.py +++ b/gunicorn/workers/gthread.py @@ -30,7 +30,7 @@ from .. import sock from ..http import wsgi -class TConn(object): +class TConn: def __init__(self, cfg, sock, client, server): self.cfg = cfg diff --git a/gunicorn/workers/workertmp.py b/gunicorn/workers/workertmp.py index 3252dd05..8ef00a56 100644 --- a/gunicorn/workers/workertmp.py +++ b/gunicorn/workers/workertmp.py @@ -13,7 +13,7 @@ PLATFORM = platform.system() IS_CYGWIN = PLATFORM.startswith('CYGWIN') -class WorkerTmp(object): +class WorkerTmp: def __init__(self, cfg): old_umask = os.umask(cfg.umask) diff --git a/tests/t.py b/tests/t.py index 60133721..4f1fcaf5 100644 --- a/tests/t.py +++ b/tests/t.py @@ -21,7 +21,7 @@ def data_source(fname): return buf -class request(object): +class request: def __init__(self, name): self.fname = os.path.join(dirname, "requests", name) @@ -33,7 +33,7 @@ class request(object): return run -class FakeSocket(object): +class FakeSocket: def __init__(self, data): self.tmp = tempfile.TemporaryFile() diff --git a/tests/test_config.py b/tests/test_config.py index ac2bb55c..7d07dd66 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -31,7 +31,7 @@ def paster_ini(): return os.path.join(dirname, "..", "examples", "frameworks", "pylonstest", "nose.ini") -class AltArgs(object): +class AltArgs: def __init__(self, args=None): self.args = args or [] self.orig = sys.argv @@ -97,7 +97,7 @@ def test_property_access(): # Not a config property pytest.raises(AttributeError, getattr, c, "foo") # Force to be not an error - class Baz(object): + class Baz: def get(self): return 3.14 c.settings["foo"] = Baz() diff --git a/tests/test_statsd.py b/tests/test_statsd.py index 6f7bf426..88adb004 100644 --- a/tests/test_statsd.py +++ b/tests/test_statsd.py @@ -15,7 +15,7 @@ class StatsdTestException(Exception): pass -class MockSocket(object): +class MockSocket: "Pretend to be a UDP socket" def __init__(self, failp): self.failp = failp diff --git a/tests/treq.py b/tests/treq.py index aeaae151..fbe54700 100644 --- a/tests/treq.py +++ b/tests/treq.py @@ -39,7 +39,7 @@ def load_py(fname): return vars(mod) -class request(object): +class request: def __init__(self, fname, expect): self.fname = fname self.name = os.path.basename(fname)