Merge pull request #3189 from pajod/patch-py36

chore: eat Python 2 leftovers
This commit is contained in:
Benoit Chesneau 2024-08-10 10:40:40 +02:00 committed by GitHub
commit e75c3533e3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
68 changed files with 68 additions and 133 deletions

View File

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
#
# Gunicorn documentation build configuration file
#

View File

@ -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

View File

@ -1,4 +1,3 @@
raise RuntimeError("Bad app!")
def app(environ, start_response):

View File

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

View File

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

View File

@ -1,7 +1,7 @@
import cherrypy
class Root(object):
class Root:
@cherrypy.expose
def index(self):
return 'Hello World!'

View File

@ -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()

View File

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

View File

@ -1,4 +1,3 @@
# -*- coding: utf-8 -
#
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
@ -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']

View File

@ -1,4 +1,3 @@
# -*- coding: utf-8 -
#
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
@ -25,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)

View File

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

View File

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

View File

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

View File

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

View File

@ -1,5 +1,4 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# An example of a standalone application using the internal API of Gunicorn.
#

View File

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

View File

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

View File

@ -1,4 +1,3 @@
import collections
import errno
import re
@ -17,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
@ -118,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.

View File

@ -1,4 +1,3 @@
import collections
import errno
import re
@ -18,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
@ -119,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.

View File

@ -17,7 +17,7 @@ class MemoryWatch(threading.Thread):
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

View File

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

View File

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

View File

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

View File

@ -1,4 +1,3 @@
# -*- coding: utf-8 -
#
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
@ -14,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.

View File

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

View File

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

View File

@ -1,4 +1,3 @@
# -*- coding: utf-8 -
#
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
@ -18,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
@ -333,7 +332,7 @@ class Arbiter(object):
"""
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
@ -362,7 +361,7 @@ class Arbiter(object):
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]:

View File

@ -1,4 +1,3 @@
# -*- coding: utf-8 -
#
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
@ -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()
@ -256,7 +255,7 @@ class SettingMeta(type):
setattr(cls, "short", desc.splitlines()[0])
class Setting(object):
class Setting:
name = None
value = None
section = None

View File

@ -1,4 +1,3 @@
# -*- coding: utf-8 -
#
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
@ -16,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
@ -37,7 +36,7 @@ class Spew(object):
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:

View File

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

View File

@ -1,4 +1,3 @@
# -*- coding: utf-8 -
#
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
@ -162,7 +161,7 @@ def parse_syslog_address(addr):
return (socktype, (host, port))
class Logger(object):
class Logger:
LOG_LEVELS = {
"critical": logging.CRITICAL,

View File

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

View File

@ -1,4 +1,3 @@
# -*- coding: utf-8 -
#
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
@ -10,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)
@ -113,7 +112,7 @@ class ChunkedReader(object):
buf.write(data)
class LengthReader(object):
class LengthReader:
def __init__(self, unreader, length):
self.unreader = unreader
self.length = length
@ -143,7 +142,7 @@ class LengthReader(object):
return ret
class EOFReader(object):
class EOFReader:
def __init__(self, unreader):
self.unreader = unreader
self.buf = io.BytesIO()
@ -181,7 +180,7 @@ class EOFReader(object):
return ret
class Body(object):
class Body:
def __init__(self, reader):
self.reader = reader
self.buf = io.BytesIO()

View File

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

View File

@ -1,4 +1,3 @@
# -*- coding: utf-8 -
#
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
@ -31,7 +30,7 @@ VERSION_RE = re.compile(r"HTTP/(\d)\.(\d)")
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
@ -376,13 +375,13 @@ class Request(Message):
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:

View File

@ -1,4 +1,3 @@
# -*- coding: utf-8 -
#
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
@ -7,7 +6,7 @@ from gunicorn.http.message import Request
from gunicorn.http.unreader import SocketUnreader, IterUnreader
class Parser(object):
class Parser:
mesg_class = None

View File

@ -1,4 +1,3 @@
# -*- coding: utf-8 -
#
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
@ -10,7 +9,7 @@ import os
# a given type of data source.
class Unreader(object):
class Unreader:
def __init__(self):
self.buf = io.BytesIO()

View File

@ -1,4 +1,3 @@
# -*- coding: utf-8 -
#
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
@ -25,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
@ -198,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

View File

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

View File

@ -1,4 +1,3 @@
# -*- coding: utf-8 -
#
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
@ -8,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
@ -52,7 +51,7 @@ class Pidfile(object):
def unlink(self):
""" delete pidfile"""
try:
with open(self.fname, "r") as f:
with open(self.fname) as f:
pid1 = int(f.read() or 0)
if pid1 == self.pid:
@ -65,7 +64,7 @@ class Pidfile(object):
if not self.fname:
return
try:
with open(self.fname, "r") as f:
with open(self.fname) as f:
try:
wpid = int(f.read())
except ValueError:
@ -80,7 +79,7 @@ class Pidfile(object):
if e.args[0] == errno.ESRCH:
return
raise
except IOError as e:
except OSError as e:
if e.args[0] == errno.ENOENT:
return
raise

View File

@ -1,4 +1,3 @@
# -*- coding: utf-8 -
#
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
@ -117,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')

View File

@ -1,4 +1,3 @@
# -*- coding: utf-8 -
#
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
@ -14,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
@ -43,7 +42,7 @@ class BaseSocket(object):
and hasattr(socket, 'SO_REUSEPORT')): # pragma: no cover
try:
sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEPORT, 1)
except socket.error as err:
except OSError as err:
if err.errno not in (errno.ENOPROTOOPT, errno.EINVAL):
raise
if not bound:
@ -66,7 +65,7 @@ class BaseSocket(object):
try:
self.sock.close()
except socket.error as e:
except OSError as e:
self.log.info("Error while closing socket %s", str(e))
self.sock = None
@ -183,7 +182,7 @@ def create_sockets(conf, log, fds=None):
for i in range(5):
try:
sock = sock_type(addr, conf, log)
except socket.error as e:
except OSError as e:
if e.args[0] == errno.EADDRINUSE:
log.error("Connection in use: %s", str(addr))
if e.args[0] == errno.EADDRNOTAVAIL:

View File

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

View File

@ -1,4 +1,3 @@
# -*- coding: utf-8 -
#
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
@ -217,7 +216,7 @@ def unlink(filename):
def is_ipv6(addr):
try:
socket.inet_pton(socket.AF_INET6, addr)
except socket.error: # not a valid address
except OSError: # not a valid address
return False
except ValueError: # ipv6 not supported on this platform
return False
@ -269,7 +268,7 @@ def set_non_blocking(fd):
def close(sock):
try:
sock.close()
except socket.error:
except OSError:
pass
@ -566,7 +565,7 @@ def check_is_writable(path):
try:
with open(path, 'a') as f:
f.close()
except IOError as e:
except OSError as e:
raise RuntimeError("Error: '%s' isn't writable [%r]" % (path, e))
@ -587,7 +586,7 @@ def has_fileno(obj):
# check BytesIO case and maybe others
try:
obj.fileno()
except (AttributeError, IOError, io.UnsupportedOperation):
except (AttributeError, OSError, io.UnsupportedOperation):
return False
return True

View File

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

View File

@ -1,4 +1,3 @@
# -*- coding: utf-8 -
#
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
@ -28,7 +27,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()

View File

@ -1,4 +1,3 @@
# -*- coding: utf-8 -
#
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
@ -60,7 +59,7 @@ class AsyncWorker(base.Worker):
except ssl.SSLError:
# pass to next try-except level
util.reraise(*sys.exc_info())
except EnvironmentError:
except OSError:
# pass to next try-except level
util.reraise(*sys.exc_info())
except Exception as e:
@ -72,7 +71,7 @@ class AsyncWorker(base.Worker):
else:
self.log.debug("Error processing SSL request.")
self.handle_error(req, client, addr, e)
except EnvironmentError as e:
except OSError as e:
if e.errno not in (errno.EPIPE, errno.ECONNRESET, errno.ENOTCONN):
self.log.exception("Socket error processing request.")
else:
@ -124,7 +123,7 @@ class AsyncWorker(base.Worker):
raise StopIteration()
except StopIteration:
raise
except EnvironmentError:
except OSError:
# If the original exception was a socket.error we delegate
# handling it to the caller (where handle() might ignore it)
util.reraise(*sys.exc_info())
@ -136,7 +135,7 @@ class AsyncWorker(base.Worker):
try:
sock.shutdown(socket.SHUT_RDWR)
sock.close()
except EnvironmentError:
except OSError:
pass
raise StopIteration()
raise

View File

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

View File

@ -1,4 +1,3 @@
# -*- coding: utf-8 -
#
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
@ -147,7 +146,7 @@ class GeventWorker(AsyncWorker):
super().init_process()
class GeventResponse(object):
class GeventResponse:
status = None
headers = None

View File

@ -1,4 +1,3 @@
# -*- coding: utf-8 -
#
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
@ -31,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
@ -128,7 +127,7 @@ class ThreadWorker(base.Worker):
with self._lock:
self.poller.register(conn.sock, selectors.EVENT_READ,
partial(self.on_client_socket_readable, conn))
except EnvironmentError as e:
except OSError as e:
if e.errno not in (errno.EAGAIN, errno.ECONNABORTED,
errno.EWOULDBLOCK):
raise
@ -171,7 +170,7 @@ class ThreadWorker(base.Worker):
with self._lock:
try:
self.poller.unregister(conn.sock)
except EnvironmentError as e:
except OSError as e:
if e.errno != errno.EBADF:
raise
except KeyError:
@ -295,7 +294,7 @@ class ThreadWorker(base.Worker):
self.log.debug("Error processing SSL request.")
self.handle_error(req, conn.sock, conn.client, e)
except EnvironmentError as e:
except OSError as e:
if e.errno not in (errno.EPIPE, errno.ECONNRESET, errno.ENOTCONN):
self.log.exception("Socket error processing request.")
else:
@ -349,7 +348,7 @@ class ThreadWorker(base.Worker):
if resp.should_close():
self.log.debug("Closing connection.")
return False
except EnvironmentError:
except OSError:
# pass to next try-except level
util.reraise(*sys.exc_info())
except Exception:
@ -360,7 +359,7 @@ class ThreadWorker(base.Worker):
try:
conn.sock.shutdown(socket.SHUT_RDWR)
conn.sock.close()
except EnvironmentError:
except OSError:
pass
raise StopIteration()
raise

View File

@ -1,4 +1,3 @@
# -*- coding: utf-8 -
#
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
@ -135,7 +134,7 @@ class TornadoWorker(Worker):
def on_close(instance, server_conn):
self.handle_request()
super(_HTTPServer, instance).on_close(server_conn)
super().on_close(server_conn)
server_class = _HTTPServer

View File

@ -1,4 +1,3 @@
# -*- coding: utf-8 -
#
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
@ -40,7 +39,7 @@ class SyncWorker(base.Worker):
os.read(self.PIPE[0], 1)
return ret[0]
except select.error as e:
except OSError as e:
if e.args[0] == errno.EINTR:
return self.sockets
if e.args[0] == errno.EBADF:
@ -73,7 +72,7 @@ class SyncWorker(base.Worker):
# process.
continue
except EnvironmentError as e:
except OSError as e:
if e.errno not in (errno.EAGAIN, errno.ECONNABORTED,
errno.EWOULDBLOCK):
raise
@ -102,7 +101,7 @@ class SyncWorker(base.Worker):
try:
self.accept(listener)
except EnvironmentError as e:
except OSError as e:
if e.errno not in (errno.EAGAIN, errno.ECONNABORTED,
errno.EWOULDBLOCK):
raise
@ -144,7 +143,7 @@ class SyncWorker(base.Worker):
else:
self.log.debug("Error processing SSL request.")
self.handle_error(req, client, addr, e)
except EnvironmentError as e:
except OSError as e:
if e.errno not in (errno.EPIPE, errno.ECONNRESET, errno.ENOTCONN):
self.log.exception("Socket error processing request.")
else:
@ -188,7 +187,7 @@ class SyncWorker(base.Worker):
self.log.access(resp, req, environ, request_time)
if hasattr(respiter, "close"):
respiter.close()
except EnvironmentError:
except OSError:
# pass to next try-except level
util.reraise(*sys.exc_info())
except Exception:
@ -199,7 +198,7 @@ class SyncWorker(base.Worker):
try:
client.shutdown(socket.SHUT_RDWR)
client.close()
except EnvironmentError:
except OSError:
pass
raise StopIteration()
raise

View File

@ -1,4 +1,3 @@
# -*- coding: utf-8 -
#
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
@ -14,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)

View File

@ -1,4 +1,3 @@
# -*- coding: utf-8 -
# Copyright 2009 Paul J. Davis <paul.joseph.davis@gmail.com>
#
# This file is part of gunicorn released under the MIT license.
@ -22,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)
@ -34,7 +33,7 @@ class request(object):
return run
class FakeSocket(object):
class FakeSocket:
def __init__(self, data):
self.tmp = tempfile.TemporaryFile()

View File

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

View File

@ -1,4 +1,3 @@
# -*- coding: utf-8 -
#
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
@ -33,7 +32,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
@ -115,7 +114,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()

View File

@ -1,5 +1,3 @@
# -*- encoding: utf-8 -*-
import io
import t
import pytest

View File

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

View File

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

View File

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

View File

@ -1,5 +1,3 @@
# -*- coding: utf-8 -
# Copyright 2013 Dariusz Suchojad <dsuch at zato.io>
#
# This file is part of gunicorn released under the MIT license.

View File

@ -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

View File

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

View File

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

View File

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

View File

@ -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)

View File

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

View File

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