Skip to content

Commit

Permalink
Merge pull request #3189 from pajod/patch-py36
Browse files Browse the repository at this point in the history
chore: eat Python 2 leftovers
  • Loading branch information
benoitc authored Aug 10, 2024
2 parents 9357b28 + 4f77665 commit e75c353
Show file tree
Hide file tree
Showing 68 changed files with 68 additions and 133 deletions.
1 change: 0 additions & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
#
# Gunicorn documentation build configuration file
#
Expand Down
1 change: 0 additions & 1 deletion examples/alt_spec.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -
#
# An example of how to pass information from the command line to
# a WSGI app. Only applies to the native WSGI workers used by
Expand Down
1 change: 0 additions & 1 deletion examples/boot_fail.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

raise RuntimeError("Bad app!")

def app(environ, start_response):
Expand Down
1 change: 0 additions & 1 deletion examples/deep/test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -
#
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
Expand Down
1 change: 0 additions & 1 deletion examples/echo.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -
#
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
Expand Down
2 changes: 1 addition & 1 deletion examples/frameworks/cherryapp.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import cherrypy


class Root(object):
class Root:
@cherrypy.expose
def index(self):
return 'Hello World!'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
1 change: 0 additions & 1 deletion examples/frameworks/tornadoapp.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -
#
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
Expand Down
3 changes: 1 addition & 2 deletions examples/longpoll.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -
#
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
Expand All @@ -7,7 +6,7 @@
import sys
import time

class TestIter(object):
class TestIter:

def __iter__(self):
lines = [b'line 1\n', b'line 2\n']
Expand Down
3 changes: 1 addition & 2 deletions examples/multiapp.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -
#
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
Expand All @@ -25,7 +24,7 @@
from test import app as app2


class Application(object):
class Application:
def __init__(self):
self.map = Mapper()
self.map.connect('app1', '/app1url', app=app1)
Expand Down
1 change: 0 additions & 1 deletion examples/multidomainapp.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -
#
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
Expand Down
1 change: 0 additions & 1 deletion examples/readline_app.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -
#
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
Expand Down
1 change: 0 additions & 1 deletion examples/sendfile.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -
#
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
Expand Down
1 change: 0 additions & 1 deletion examples/slowclient.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -
#
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
Expand Down
1 change: 0 additions & 1 deletion examples/standalone_app.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# An example of a standalone application using the internal API of Gunicorn.
#
Expand Down
1 change: 0 additions & 1 deletion examples/test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -
#
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
Expand Down
1 change: 0 additions & 1 deletion examples/timeout.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -
#
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
Expand Down
5 changes: 2 additions & 3 deletions examples/websocket/gevent_websocket.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

import collections
import errno
import re
Expand All @@ -17,7 +16,7 @@

WS_KEY = b"258EAFA5-E914-47DA-95CA-C5AB0DC85B11"

class WebSocketWSGI(object):
class WebSocketWSGI:
def __init__(self, handler):
self.handler = handler

Expand Down Expand Up @@ -118,7 +117,7 @@ def __call__(self, environ, start_response):
# 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.
Expand Down
5 changes: 2 additions & 3 deletions examples/websocket/websocket.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

import collections
import errno
import re
Expand All @@ -18,7 +17,7 @@

WS_KEY = b"258EAFA5-E914-47DA-95CA-C5AB0DC85B11"

class WebSocketWSGI(object):
class WebSocketWSGI:
def __init__(self, handler):
self.handler = handler

Expand Down Expand Up @@ -119,7 +118,7 @@ def __call__(self, environ, start_response):
# 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.
Expand Down
2 changes: 1 addition & 1 deletion examples/when_ready.conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def __init__(self, server, max_mem):
def memory_usage(self, pid):
try:
out = commands.getoutput("ps -o rss -p %s" % pid)
except IOError:
except OSError:
return -1
used_mem = sum(int(x) for x in out.split('\n')[1:])
return used_mem
Expand Down
1 change: 0 additions & 1 deletion gunicorn/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -
#
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
Expand Down
1 change: 0 additions & 1 deletion gunicorn/__main__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -
#
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
Expand Down
1 change: 0 additions & 1 deletion gunicorn/app/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -
#
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
3 changes: 1 addition & 2 deletions gunicorn/app/base.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -
#
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
Expand All @@ -14,7 +13,7 @@
from gunicorn import debug


class BaseApplication(object):
class BaseApplication:
"""
An application interface for configuring and loading
the various necessities for any given web framework.
Expand Down
1 change: 0 additions & 1 deletion gunicorn/app/pasterapp.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -
#
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
Expand Down
1 change: 0 additions & 1 deletion gunicorn/app/wsgiapp.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -
#
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
Expand Down
7 changes: 3 additions & 4 deletions gunicorn/arbiter.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -
#
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
Expand All @@ -18,7 +17,7 @@
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
Expand Down Expand Up @@ -333,7 +332,7 @@ def wakeup(self):
"""
try:
os.write(self.PIPE[1], b'.')
except IOError as e:
except OSError as e:
if e.errno not in [errno.EAGAIN, errno.EINTR]:
raise

Expand Down Expand Up @@ -362,7 +361,7 @@ def sleep(self):
return
while os.read(self.PIPE[0], 1):
pass
except (select.error, OSError) as e:
except OSError as e:
# TODO: select.error is a subclass of OSError since Python 3.3.
error_number = getattr(e, 'errno', e.args[0])
if error_number not in [errno.EAGAIN, errno.EINTR]:
Expand Down
5 changes: 2 additions & 3 deletions gunicorn/config.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -
#
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
Expand Down Expand Up @@ -44,7 +43,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()
Expand Down Expand Up @@ -256,7 +255,7 @@ def fmt_desc(cls, desc):
setattr(cls, "short", desc.splitlines()[0])


class Setting(object):
class Setting:
name = None
value = None
section = None
Expand Down
5 changes: 2 additions & 3 deletions gunicorn/debug.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -
#
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
Expand All @@ -16,7 +15,7 @@
_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
Expand All @@ -37,7 +36,7 @@ def __call__(self, frame, event, arg):
try:
src = inspect.getsourcelines(frame)
line = src[lineno]
except IOError:
except OSError:
line = 'Unknown code named [%s]. VM instruction #%d' % (
frame.f_code.co_name, frame.f_lasti)
if self.trace_names is None or name in self.trace_names:
Expand Down
1 change: 0 additions & 1 deletion gunicorn/errors.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -
#
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
Expand Down
3 changes: 1 addition & 2 deletions gunicorn/glogging.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -
#
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
Expand Down Expand Up @@ -162,7 +161,7 @@ def parse_syslog_address(addr):
return (socktype, (host, port))


class Logger(object):
class Logger:

LOG_LEVELS = {
"critical": logging.CRITICAL,
Expand Down
1 change: 0 additions & 1 deletion gunicorn/http/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -
#
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
Expand Down
9 changes: 4 additions & 5 deletions gunicorn/http/body.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -
#
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
Expand All @@ -10,7 +9,7 @@
InvalidChunkSize)


class ChunkedReader(object):
class ChunkedReader:
def __init__(self, req, unreader):
self.req = req
self.parser = self.parse_chunked(unreader)
Expand Down Expand Up @@ -113,7 +112,7 @@ def get_data(self, unreader, buf):
buf.write(data)


class LengthReader(object):
class LengthReader:
def __init__(self, unreader, length):
self.unreader = unreader
self.length = length
Expand Down Expand Up @@ -143,7 +142,7 @@ def read(self, size):
return ret


class EOFReader(object):
class EOFReader:
def __init__(self, unreader):
self.unreader = unreader
self.buf = io.BytesIO()
Expand Down Expand Up @@ -181,7 +180,7 @@ def read(self, size):
return ret


class Body(object):
class Body:
def __init__(self, reader):
self.reader = reader
self.buf = io.BytesIO()
Expand Down
1 change: 0 additions & 1 deletion gunicorn/http/errors.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -
#
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
Expand Down
7 changes: 3 additions & 4 deletions gunicorn/http/message.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -
#
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
Expand Down Expand Up @@ -31,7 +30,7 @@
RFC9110_5_5_INVALID_AND_DANGEROUS = re.compile(r"[\0\r\n]")


class Message(object):
class Message:
def __init__(self, cfg, unreader, peer_addr):
self.cfg = cfg
self.unreader = unreader
Expand Down Expand Up @@ -376,13 +375,13 @@ def parse_proxy_protocol(self, line):
try:
socket.inet_pton(socket.AF_INET, s_addr)
socket.inet_pton(socket.AF_INET, d_addr)
except socket.error:
except OSError:
raise InvalidProxyLine(line)
elif proto == "TCP6":
try:
socket.inet_pton(socket.AF_INET6, s_addr)
socket.inet_pton(socket.AF_INET6, d_addr)
except socket.error:
except OSError:
raise InvalidProxyLine(line)

try:
Expand Down
3 changes: 1 addition & 2 deletions gunicorn/http/parser.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -
#
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
Expand All @@ -7,7 +6,7 @@
from gunicorn.http.unreader import SocketUnreader, IterUnreader


class Parser(object):
class Parser:

mesg_class = None

Expand Down
Loading

0 comments on commit e75c353

Please sign in to comment.