mirror of
https://github.com/frappe/gunicorn.git
synced 2026-01-14 11:09:11 +08:00
class Name(object): -> class Name:
This commit is contained in:
parent
4323027b1e
commit
422b18acea
@ -1,7 +1,7 @@
|
|||||||
import cherrypy
|
import cherrypy
|
||||||
|
|
||||||
|
|
||||||
class Root(object):
|
class Root:
|
||||||
@cherrypy.expose
|
@cherrypy.expose
|
||||||
def index(self):
|
def index(self):
|
||||||
return 'Hello World!'
|
return 'Hello World!'
|
||||||
|
|||||||
@ -8,7 +8,7 @@ def child_process(queue):
|
|||||||
requests.get('http://requestb.in/15s95oz1')
|
requests.get('http://requestb.in/15s95oz1')
|
||||||
|
|
||||||
|
|
||||||
class GunicornSubProcessTestMiddleware(object):
|
class GunicornSubProcessTestMiddleware:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self.queue = Queue()
|
self.queue = Queue()
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
|
|
||||||
class TestIter(object):
|
class TestIter:
|
||||||
|
|
||||||
def __iter__(self):
|
def __iter__(self):
|
||||||
lines = [b'line 1\n', b'line 2\n']
|
lines = [b'line 1\n', b'line 2\n']
|
||||||
|
|||||||
@ -24,7 +24,7 @@ from test import app as app1
|
|||||||
from test import app as app2
|
from test import app as app2
|
||||||
|
|
||||||
|
|
||||||
class Application(object):
|
class Application:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.map = Mapper()
|
self.map = Mapper()
|
||||||
self.map.connect('app1', '/app1url', app=app1)
|
self.map.connect('app1', '/app1url', app=app1)
|
||||||
|
|||||||
@ -16,7 +16,7 @@ logger = logging.getLogger(__name__)
|
|||||||
|
|
||||||
WS_KEY = b"258EAFA5-E914-47DA-95CA-C5AB0DC85B11"
|
WS_KEY = b"258EAFA5-E914-47DA-95CA-C5AB0DC85B11"
|
||||||
|
|
||||||
class WebSocketWSGI(object):
|
class WebSocketWSGI:
|
||||||
def __init__(self, handler):
|
def __init__(self, handler):
|
||||||
self.handler = handler
|
self.handler = handler
|
||||||
|
|
||||||
@ -117,7 +117,7 @@ class WebSocketWSGI(object):
|
|||||||
# doesn't barf on the fact that we didn't call start_response
|
# doesn't barf on the fact that we didn't call start_response
|
||||||
return ALREADY_HANDLED
|
return ALREADY_HANDLED
|
||||||
|
|
||||||
class WebSocket(object):
|
class WebSocket:
|
||||||
"""A websocket object that handles the details of
|
"""A websocket object that handles the details of
|
||||||
serialization/deserialization to the socket.
|
serialization/deserialization to the socket.
|
||||||
|
|
||||||
|
|||||||
@ -17,7 +17,7 @@ logger = logging.getLogger(__name__)
|
|||||||
|
|
||||||
WS_KEY = b"258EAFA5-E914-47DA-95CA-C5AB0DC85B11"
|
WS_KEY = b"258EAFA5-E914-47DA-95CA-C5AB0DC85B11"
|
||||||
|
|
||||||
class WebSocketWSGI(object):
|
class WebSocketWSGI:
|
||||||
def __init__(self, handler):
|
def __init__(self, handler):
|
||||||
self.handler = handler
|
self.handler = handler
|
||||||
|
|
||||||
@ -118,7 +118,7 @@ class WebSocketWSGI(object):
|
|||||||
# doesn't barf on the fact that we didn't call start_response
|
# doesn't barf on the fact that we didn't call start_response
|
||||||
return ALREADY_HANDLED
|
return ALREADY_HANDLED
|
||||||
|
|
||||||
class WebSocket(object):
|
class WebSocket:
|
||||||
"""A websocket object that handles the details of
|
"""A websocket object that handles the details of
|
||||||
serialization/deserialization to the socket.
|
serialization/deserialization to the socket.
|
||||||
|
|
||||||
|
|||||||
@ -13,7 +13,7 @@ from gunicorn.config import Config, get_default_config_file
|
|||||||
from gunicorn import debug
|
from gunicorn import debug
|
||||||
|
|
||||||
|
|
||||||
class BaseApplication(object):
|
class BaseApplication:
|
||||||
"""
|
"""
|
||||||
An application interface for configuring and loading
|
An application interface for configuring and loading
|
||||||
the various necessities for any given web framework.
|
the various necessities for any given web framework.
|
||||||
|
|||||||
@ -17,7 +17,7 @@ from gunicorn import sock, systemd, util
|
|||||||
from gunicorn import __version__, SERVER_SOFTWARE
|
from gunicorn import __version__, SERVER_SOFTWARE
|
||||||
|
|
||||||
|
|
||||||
class Arbiter(object):
|
class Arbiter:
|
||||||
"""
|
"""
|
||||||
Arbiter maintain the workers processes alive. It launches or
|
Arbiter maintain the workers processes alive. It launches or
|
||||||
kills them if needed. It also manages application reloading
|
kills them if needed. It also manages application reloading
|
||||||
|
|||||||
@ -42,7 +42,7 @@ def auto_int(_, x):
|
|||||||
return int(x, 0)
|
return int(x, 0)
|
||||||
|
|
||||||
|
|
||||||
class Config(object):
|
class Config:
|
||||||
|
|
||||||
def __init__(self, usage=None, prog=None):
|
def __init__(self, usage=None, prog=None):
|
||||||
self.settings = make_settings()
|
self.settings = make_settings()
|
||||||
@ -252,7 +252,7 @@ class SettingMeta(type):
|
|||||||
setattr(cls, "short", desc.splitlines()[0])
|
setattr(cls, "short", desc.splitlines()[0])
|
||||||
|
|
||||||
|
|
||||||
class Setting(object):
|
class Setting:
|
||||||
name = None
|
name = None
|
||||||
value = None
|
value = None
|
||||||
section = None
|
section = None
|
||||||
|
|||||||
@ -15,7 +15,7 @@ __all__ = ['spew', 'unspew']
|
|||||||
_token_spliter = re.compile(r'\W+')
|
_token_spliter = re.compile(r'\W+')
|
||||||
|
|
||||||
|
|
||||||
class Spew(object):
|
class Spew:
|
||||||
|
|
||||||
def __init__(self, trace_names=None, show_values=True):
|
def __init__(self, trace_names=None, show_values=True):
|
||||||
self.trace_names = trace_names
|
self.trace_names = trace_names
|
||||||
|
|||||||
@ -161,7 +161,7 @@ def parse_syslog_address(addr):
|
|||||||
return (socktype, (host, port))
|
return (socktype, (host, port))
|
||||||
|
|
||||||
|
|
||||||
class Logger(object):
|
class Logger:
|
||||||
|
|
||||||
LOG_LEVELS = {
|
LOG_LEVELS = {
|
||||||
"critical": logging.CRITICAL,
|
"critical": logging.CRITICAL,
|
||||||
|
|||||||
@ -9,7 +9,7 @@ from gunicorn.http.errors import (NoMoreData, ChunkMissingTerminator,
|
|||||||
InvalidChunkSize)
|
InvalidChunkSize)
|
||||||
|
|
||||||
|
|
||||||
class ChunkedReader(object):
|
class ChunkedReader:
|
||||||
def __init__(self, req, unreader):
|
def __init__(self, req, unreader):
|
||||||
self.req = req
|
self.req = req
|
||||||
self.parser = self.parse_chunked(unreader)
|
self.parser = self.parse_chunked(unreader)
|
||||||
@ -107,7 +107,7 @@ class ChunkedReader(object):
|
|||||||
buf.write(data)
|
buf.write(data)
|
||||||
|
|
||||||
|
|
||||||
class LengthReader(object):
|
class LengthReader:
|
||||||
def __init__(self, unreader, length):
|
def __init__(self, unreader, length):
|
||||||
self.unreader = unreader
|
self.unreader = unreader
|
||||||
self.length = length
|
self.length = length
|
||||||
@ -137,7 +137,7 @@ class LengthReader(object):
|
|||||||
return ret
|
return ret
|
||||||
|
|
||||||
|
|
||||||
class EOFReader(object):
|
class EOFReader:
|
||||||
def __init__(self, unreader):
|
def __init__(self, unreader):
|
||||||
self.unreader = unreader
|
self.unreader = unreader
|
||||||
self.buf = io.BytesIO()
|
self.buf = io.BytesIO()
|
||||||
@ -175,7 +175,7 @@ class EOFReader(object):
|
|||||||
return ret
|
return ret
|
||||||
|
|
||||||
|
|
||||||
class Body(object):
|
class Body:
|
||||||
def __init__(self, reader):
|
def __init__(self, reader):
|
||||||
self.reader = reader
|
self.reader = reader
|
||||||
self.buf = io.BytesIO()
|
self.buf = io.BytesIO()
|
||||||
|
|||||||
@ -29,7 +29,7 @@ METHOD_BADCHAR_RE = re.compile("[a-z#]")
|
|||||||
VERSION_RE = re.compile(r"HTTP/(\d)\.(\d)")
|
VERSION_RE = re.compile(r"HTTP/(\d)\.(\d)")
|
||||||
|
|
||||||
|
|
||||||
class Message(object):
|
class Message:
|
||||||
def __init__(self, cfg, unreader, peer_addr):
|
def __init__(self, cfg, unreader, peer_addr):
|
||||||
self.cfg = cfg
|
self.cfg = cfg
|
||||||
self.unreader = unreader
|
self.unreader = unreader
|
||||||
|
|||||||
@ -6,7 +6,7 @@ from gunicorn.http.message import Request
|
|||||||
from gunicorn.http.unreader import SocketUnreader, IterUnreader
|
from gunicorn.http.unreader import SocketUnreader, IterUnreader
|
||||||
|
|
||||||
|
|
||||||
class Parser(object):
|
class Parser:
|
||||||
|
|
||||||
mesg_class = None
|
mesg_class = None
|
||||||
|
|
||||||
|
|||||||
@ -9,7 +9,7 @@ import os
|
|||||||
# a given type of data source.
|
# a given type of data source.
|
||||||
|
|
||||||
|
|
||||||
class Unreader(object):
|
class Unreader:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.buf = io.BytesIO()
|
self.buf = io.BytesIO()
|
||||||
|
|
||||||
|
|||||||
@ -24,7 +24,7 @@ HEADER_VALUE_RE = re.compile(r'[ \t\x21-\x7e\x80-\xff]*')
|
|||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class FileWrapper(object):
|
class FileWrapper:
|
||||||
|
|
||||||
def __init__(self, filelike, blksize=8192):
|
def __init__(self, filelike, blksize=8192):
|
||||||
self.filelike = filelike
|
self.filelike = filelike
|
||||||
@ -197,7 +197,7 @@ def create(req, sock, client, server, cfg):
|
|||||||
return resp, environ
|
return resp, environ
|
||||||
|
|
||||||
|
|
||||||
class Response(object):
|
class Response:
|
||||||
|
|
||||||
def __init__(self, req, sock, cfg):
|
def __init__(self, req, sock, cfg):
|
||||||
self.req = req
|
self.req = req
|
||||||
|
|||||||
@ -7,7 +7,7 @@ import os
|
|||||||
import tempfile
|
import tempfile
|
||||||
|
|
||||||
|
|
||||||
class Pidfile(object):
|
class Pidfile:
|
||||||
"""\
|
"""\
|
||||||
Manage a PID file. If a specific name is provided
|
Manage a PID file. If a specific name is provided
|
||||||
it and '"%s.oldpid" % name' will be used. Otherwise
|
it and '"%s.oldpid" % name' will be used. Otherwise
|
||||||
|
|||||||
@ -116,7 +116,7 @@ if has_inotify:
|
|||||||
|
|
||||||
else:
|
else:
|
||||||
|
|
||||||
class InotifyReloader(object):
|
class InotifyReloader:
|
||||||
def __init__(self, extra_files=None, callback=None):
|
def __init__(self, extra_files=None, callback=None):
|
||||||
raise ImportError('You must have the inotify module installed to '
|
raise ImportError('You must have the inotify module installed to '
|
||||||
'use the inotify reloader')
|
'use the inotify reloader')
|
||||||
|
|||||||
@ -13,7 +13,7 @@ import time
|
|||||||
from gunicorn import util
|
from gunicorn import util
|
||||||
|
|
||||||
|
|
||||||
class BaseSocket(object):
|
class BaseSocket:
|
||||||
|
|
||||||
def __init__(self, address, conf, log, fd=None):
|
def __init__(self, address, conf, log, fd=None):
|
||||||
self.log = log
|
self.log = log
|
||||||
|
|||||||
@ -25,7 +25,7 @@ from gunicorn.reloader import reloader_engines
|
|||||||
from gunicorn.workers.workertmp import WorkerTmp
|
from gunicorn.workers.workertmp import WorkerTmp
|
||||||
|
|
||||||
|
|
||||||
class Worker(object):
|
class Worker:
|
||||||
|
|
||||||
SIGNALS = [getattr(signal, "SIG%s" % x) for x in (
|
SIGNALS = [getattr(signal, "SIG%s" % x) for x in (
|
||||||
"ABRT HUP QUIT INT TERM USR1 USR2 WINCH CHLD".split()
|
"ABRT HUP QUIT INT TERM USR1 USR2 WINCH CHLD".split()
|
||||||
|
|||||||
@ -146,7 +146,7 @@ class GeventWorker(AsyncWorker):
|
|||||||
super().init_process()
|
super().init_process()
|
||||||
|
|
||||||
|
|
||||||
class GeventResponse(object):
|
class GeventResponse:
|
||||||
|
|
||||||
status = None
|
status = None
|
||||||
headers = None
|
headers = None
|
||||||
|
|||||||
@ -30,7 +30,7 @@ from .. import sock
|
|||||||
from ..http import wsgi
|
from ..http import wsgi
|
||||||
|
|
||||||
|
|
||||||
class TConn(object):
|
class TConn:
|
||||||
|
|
||||||
def __init__(self, cfg, sock, client, server):
|
def __init__(self, cfg, sock, client, server):
|
||||||
self.cfg = cfg
|
self.cfg = cfg
|
||||||
|
|||||||
@ -13,7 +13,7 @@ PLATFORM = platform.system()
|
|||||||
IS_CYGWIN = PLATFORM.startswith('CYGWIN')
|
IS_CYGWIN = PLATFORM.startswith('CYGWIN')
|
||||||
|
|
||||||
|
|
||||||
class WorkerTmp(object):
|
class WorkerTmp:
|
||||||
|
|
||||||
def __init__(self, cfg):
|
def __init__(self, cfg):
|
||||||
old_umask = os.umask(cfg.umask)
|
old_umask = os.umask(cfg.umask)
|
||||||
|
|||||||
@ -21,7 +21,7 @@ def data_source(fname):
|
|||||||
return buf
|
return buf
|
||||||
|
|
||||||
|
|
||||||
class request(object):
|
class request:
|
||||||
def __init__(self, name):
|
def __init__(self, name):
|
||||||
self.fname = os.path.join(dirname, "requests", name)
|
self.fname = os.path.join(dirname, "requests", name)
|
||||||
|
|
||||||
@ -33,7 +33,7 @@ class request(object):
|
|||||||
return run
|
return run
|
||||||
|
|
||||||
|
|
||||||
class FakeSocket(object):
|
class FakeSocket:
|
||||||
|
|
||||||
def __init__(self, data):
|
def __init__(self, data):
|
||||||
self.tmp = tempfile.TemporaryFile()
|
self.tmp = tempfile.TemporaryFile()
|
||||||
|
|||||||
@ -31,7 +31,7 @@ def paster_ini():
|
|||||||
return os.path.join(dirname, "..", "examples", "frameworks", "pylonstest", "nose.ini")
|
return os.path.join(dirname, "..", "examples", "frameworks", "pylonstest", "nose.ini")
|
||||||
|
|
||||||
|
|
||||||
class AltArgs(object):
|
class AltArgs:
|
||||||
def __init__(self, args=None):
|
def __init__(self, args=None):
|
||||||
self.args = args or []
|
self.args = args or []
|
||||||
self.orig = sys.argv
|
self.orig = sys.argv
|
||||||
@ -97,7 +97,7 @@ def test_property_access():
|
|||||||
# Not a config property
|
# Not a config property
|
||||||
pytest.raises(AttributeError, getattr, c, "foo")
|
pytest.raises(AttributeError, getattr, c, "foo")
|
||||||
# Force to be not an error
|
# Force to be not an error
|
||||||
class Baz(object):
|
class Baz:
|
||||||
def get(self):
|
def get(self):
|
||||||
return 3.14
|
return 3.14
|
||||||
c.settings["foo"] = Baz()
|
c.settings["foo"] = Baz()
|
||||||
|
|||||||
@ -15,7 +15,7 @@ class StatsdTestException(Exception):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class MockSocket(object):
|
class MockSocket:
|
||||||
"Pretend to be a UDP socket"
|
"Pretend to be a UDP socket"
|
||||||
def __init__(self, failp):
|
def __init__(self, failp):
|
||||||
self.failp = failp
|
self.failp = failp
|
||||||
|
|||||||
@ -39,7 +39,7 @@ def load_py(fname):
|
|||||||
return vars(mod)
|
return vars(mod)
|
||||||
|
|
||||||
|
|
||||||
class request(object):
|
class request:
|
||||||
def __init__(self, fname, expect):
|
def __init__(self, fname, expect):
|
||||||
self.fname = fname
|
self.fname = fname
|
||||||
self.name = os.path.basename(fname)
|
self.name = os.path.basename(fname)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user