Skip to content

Commit e75c353

Browse files
authored
Merge pull request #3189 from pajod/patch-py36
chore: eat Python 2 leftovers
2 parents 9357b28 + 4f77665 commit e75c353

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+68
-133
lines changed

docs/source/conf.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# -*- coding: utf-8 -*-
21
#
32
# Gunicorn documentation build configuration file
43
#

examples/alt_spec.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# -*- coding: utf-8 -
21
#
32
# An example of how to pass information from the command line to
43
# a WSGI app. Only applies to the native WSGI workers used by

examples/boot_fail.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
raise RuntimeError("Bad app!")
32

43
def app(environ, start_response):

examples/deep/test.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# -*- coding: utf-8 -
21
#
32
# This file is part of gunicorn released under the MIT license.
43
# See the NOTICE for more information.

examples/echo.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# -*- coding: utf-8 -
21
#
32
# This file is part of gunicorn released under the MIT license.
43
# See the NOTICE for more information.

examples/frameworks/cherryapp.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import cherrypy
22

33

4-
class Root(object):
4+
class Root:
55
@cherrypy.expose
66
def index(self):
77
return 'Hello World!'

examples/frameworks/django/testing/testing/apps/someapp/middleware.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ def child_process(queue):
88
requests.get('http://requestb.in/15s95oz1')
99

1010

11-
class GunicornSubProcessTestMiddleware(object):
11+
class GunicornSubProcessTestMiddleware:
1212
def __init__(self):
1313
super().__init__()
1414
self.queue = Queue()

examples/frameworks/tornadoapp.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# -*- coding: utf-8 -
21
#
32
# This file is part of gunicorn released under the MIT license.
43
# See the NOTICE for more information.

examples/longpoll.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# -*- coding: utf-8 -
21
#
32
# This file is part of gunicorn released under the MIT license.
43
# See the NOTICE for more information.
@@ -7,7 +6,7 @@
76
import sys
87
import time
98

10-
class TestIter(object):
9+
class TestIter:
1110

1211
def __iter__(self):
1312
lines = [b'line 1\n', b'line 2\n']

examples/multiapp.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# -*- coding: utf-8 -
21
#
32
# This file is part of gunicorn released under the MIT license.
43
# See the NOTICE for more information.
@@ -25,7 +24,7 @@
2524
from test import app as app2
2625

2726

28-
class Application(object):
27+
class Application:
2928
def __init__(self):
3029
self.map = Mapper()
3130
self.map.connect('app1', '/app1url', app=app1)

examples/multidomainapp.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# -*- coding: utf-8 -
21
#
32
# This file is part of gunicorn released under the MIT license.
43
# See the NOTICE for more information.

examples/readline_app.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# -*- coding: utf-8 -
21
#
32
# This file is part of gunicorn released under the MIT license.
43
# See the NOTICE for more information.

examples/sendfile.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# -*- coding: utf-8 -
21
#
32
# This file is part of gunicorn released under the MIT license.
43
# See the NOTICE for more information.

examples/slowclient.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# -*- coding: utf-8 -
21
#
32
# This file is part of gunicorn released under the MIT license.
43
# See the NOTICE for more information.

examples/standalone_app.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#!/usr/bin/env python
2-
# -*- coding: utf-8 -*-
32
#
43
# An example of a standalone application using the internal API of Gunicorn.
54
#

examples/test.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# -*- coding: utf-8 -
21
#
32
# This file is part of gunicorn released under the MIT license.
43
# See the NOTICE for more information.

examples/timeout.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# -*- coding: utf-8 -
21
#
32
# This file is part of gunicorn released under the MIT license.
43
# See the NOTICE for more information.

examples/websocket/gevent_websocket.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
import collections
32
import errno
43
import re
@@ -17,7 +16,7 @@
1716

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

20-
class WebSocketWSGI(object):
19+
class WebSocketWSGI:
2120
def __init__(self, handler):
2221
self.handler = handler
2322

@@ -118,7 +117,7 @@ def __call__(self, environ, start_response):
118117
# doesn't barf on the fact that we didn't call start_response
119118
return ALREADY_HANDLED
120119

121-
class WebSocket(object):
120+
class WebSocket:
122121
"""A websocket object that handles the details of
123122
serialization/deserialization to the socket.
124123

examples/websocket/websocket.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
import collections
32
import errno
43
import re
@@ -18,7 +17,7 @@
1817

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

21-
class WebSocketWSGI(object):
20+
class WebSocketWSGI:
2221
def __init__(self, handler):
2322
self.handler = handler
2423

@@ -119,7 +118,7 @@ def __call__(self, environ, start_response):
119118
# doesn't barf on the fact that we didn't call start_response
120119
return ALREADY_HANDLED
121120

122-
class WebSocket(object):
121+
class WebSocket:
123122
"""A websocket object that handles the details of
124123
serialization/deserialization to the socket.
125124

examples/when_ready.conf.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def __init__(self, server, max_mem):
1717
def memory_usage(self, pid):
1818
try:
1919
out = commands.getoutput("ps -o rss -p %s" % pid)
20-
except IOError:
20+
except OSError:
2121
return -1
2222
used_mem = sum(int(x) for x in out.split('\n')[1:])
2323
return used_mem

gunicorn/__init__.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# -*- coding: utf-8 -
21
#
32
# This file is part of gunicorn released under the MIT license.
43
# See the NOTICE for more information.

gunicorn/__main__.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# -*- coding: utf-8 -
21
#
32
# This file is part of gunicorn released under the MIT license.
43
# See the NOTICE for more information.

gunicorn/app/__init__.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# -*- coding: utf-8 -
21
#
32
# This file is part of gunicorn released under the MIT license.
43
# See the NOTICE for more information.

gunicorn/app/base.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# -*- coding: utf-8 -
21
#
32
# This file is part of gunicorn released under the MIT license.
43
# See the NOTICE for more information.
@@ -14,7 +13,7 @@
1413
from gunicorn import debug
1514

1615

17-
class BaseApplication(object):
16+
class BaseApplication:
1817
"""
1918
An application interface for configuring and loading
2019
the various necessities for any given web framework.

gunicorn/app/pasterapp.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# -*- coding: utf-8 -
21
#
32
# This file is part of gunicorn released under the MIT license.
43
# See the NOTICE for more information.

gunicorn/app/wsgiapp.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# -*- coding: utf-8 -
21
#
32
# This file is part of gunicorn released under the MIT license.
43
# See the NOTICE for more information.

gunicorn/arbiter.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# -*- coding: utf-8 -
21
#
32
# This file is part of gunicorn released under the MIT license.
43
# See the NOTICE for more information.
@@ -18,7 +17,7 @@
1817
from gunicorn import __version__, SERVER_SOFTWARE
1918

2019

21-
class Arbiter(object):
20+
class Arbiter:
2221
"""
2322
Arbiter maintain the workers processes alive. It launches or
2423
kills them if needed. It also manages application reloading
@@ -333,7 +332,7 @@ def wakeup(self):
333332
"""
334333
try:
335334
os.write(self.PIPE[1], b'.')
336-
except IOError as e:
335+
except OSError as e:
337336
if e.errno not in [errno.EAGAIN, errno.EINTR]:
338337
raise
339338

@@ -362,7 +361,7 @@ def sleep(self):
362361
return
363362
while os.read(self.PIPE[0], 1):
364363
pass
365-
except (select.error, OSError) as e:
364+
except OSError as e:
366365
# TODO: select.error is a subclass of OSError since Python 3.3.
367366
error_number = getattr(e, 'errno', e.args[0])
368367
if error_number not in [errno.EAGAIN, errno.EINTR]:

gunicorn/config.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# -*- coding: utf-8 -
21
#
32
# This file is part of gunicorn released under the MIT license.
43
# See the NOTICE for more information.
@@ -44,7 +43,7 @@ def auto_int(_, x):
4443
return int(x, 0)
4544

4645

47-
class Config(object):
46+
class Config:
4847

4948
def __init__(self, usage=None, prog=None):
5049
self.settings = make_settings()
@@ -256,7 +255,7 @@ def fmt_desc(cls, desc):
256255
setattr(cls, "short", desc.splitlines()[0])
257256

258257

259-
class Setting(object):
258+
class Setting:
260259
name = None
261260
value = None
262261
section = None

gunicorn/debug.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# -*- coding: utf-8 -
21
#
32
# This file is part of gunicorn released under the MIT license.
43
# See the NOTICE for more information.
@@ -16,7 +15,7 @@
1615
_token_spliter = re.compile(r'\W+')
1716

1817

19-
class Spew(object):
18+
class Spew:
2019

2120
def __init__(self, trace_names=None, show_values=True):
2221
self.trace_names = trace_names
@@ -37,7 +36,7 @@ def __call__(self, frame, event, arg):
3736
try:
3837
src = inspect.getsourcelines(frame)
3938
line = src[lineno]
40-
except IOError:
39+
except OSError:
4140
line = 'Unknown code named [%s]. VM instruction #%d' % (
4241
frame.f_code.co_name, frame.f_lasti)
4342
if self.trace_names is None or name in self.trace_names:

gunicorn/errors.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# -*- coding: utf-8 -
21
#
32
# This file is part of gunicorn released under the MIT license.
43
# See the NOTICE for more information.

gunicorn/glogging.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# -*- coding: utf-8 -
21
#
32
# This file is part of gunicorn released under the MIT license.
43
# See the NOTICE for more information.
@@ -162,7 +161,7 @@ def parse_syslog_address(addr):
162161
return (socktype, (host, port))
163162

164163

165-
class Logger(object):
164+
class Logger:
166165

167166
LOG_LEVELS = {
168167
"critical": logging.CRITICAL,

gunicorn/http/__init__.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# -*- coding: utf-8 -
21
#
32
# This file is part of gunicorn released under the MIT license.
43
# See the NOTICE for more information.

gunicorn/http/body.py

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# -*- coding: utf-8 -
21
#
32
# This file is part of gunicorn released under the MIT license.
43
# See the NOTICE for more information.
@@ -10,7 +9,7 @@
109
InvalidChunkSize)
1110

1211

13-
class ChunkedReader(object):
12+
class ChunkedReader:
1413
def __init__(self, req, unreader):
1514
self.req = req
1615
self.parser = self.parse_chunked(unreader)
@@ -113,7 +112,7 @@ def get_data(self, unreader, buf):
113112
buf.write(data)
114113

115114

116-
class LengthReader(object):
115+
class LengthReader:
117116
def __init__(self, unreader, length):
118117
self.unreader = unreader
119118
self.length = length
@@ -143,7 +142,7 @@ def read(self, size):
143142
return ret
144143

145144

146-
class EOFReader(object):
145+
class EOFReader:
147146
def __init__(self, unreader):
148147
self.unreader = unreader
149148
self.buf = io.BytesIO()
@@ -181,7 +180,7 @@ def read(self, size):
181180
return ret
182181

183182

184-
class Body(object):
183+
class Body:
185184
def __init__(self, reader):
186185
self.reader = reader
187186
self.buf = io.BytesIO()

gunicorn/http/errors.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# -*- coding: utf-8 -
21
#
32
# This file is part of gunicorn released under the MIT license.
43
# See the NOTICE for more information.

gunicorn/http/message.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# -*- coding: utf-8 -
21
#
32
# This file is part of gunicorn released under the MIT license.
43
# See the NOTICE for more information.
@@ -31,7 +30,7 @@
3130
RFC9110_5_5_INVALID_AND_DANGEROUS = re.compile(r"[\0\r\n]")
3231

3332

34-
class Message(object):
33+
class Message:
3534
def __init__(self, cfg, unreader, peer_addr):
3635
self.cfg = cfg
3736
self.unreader = unreader
@@ -376,13 +375,13 @@ def parse_proxy_protocol(self, line):
376375
try:
377376
socket.inet_pton(socket.AF_INET, s_addr)
378377
socket.inet_pton(socket.AF_INET, d_addr)
379-
except socket.error:
378+
except OSError:
380379
raise InvalidProxyLine(line)
381380
elif proto == "TCP6":
382381
try:
383382
socket.inet_pton(socket.AF_INET6, s_addr)
384383
socket.inet_pton(socket.AF_INET6, d_addr)
385-
except socket.error:
384+
except OSError:
386385
raise InvalidProxyLine(line)
387386

388387
try:

gunicorn/http/parser.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# -*- coding: utf-8 -
21
#
32
# This file is part of gunicorn released under the MIT license.
43
# See the NOTICE for more information.
@@ -7,7 +6,7 @@
76
from gunicorn.http.unreader import SocketUnreader, IterUnreader
87

98

10-
class Parser(object):
9+
class Parser:
1110

1211
mesg_class = None
1312

0 commit comments

Comments
 (0)