mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-08-20 05:13:21 -07:00
Bump cherrypy from 18.9.0 to 18.10.0 (#2353)
* Bump cherrypy from 18.9.0 to 18.10.0 Bumps [cherrypy](https://github.com/cherrypy/cherrypy) from 18.9.0 to 18.10.0. - [Changelog](https://github.com/cherrypy/cherrypy/blob/main/CHANGES.rst) - [Commits](https://github.com/cherrypy/cherrypy/compare/v18.9.0...v18.10.0) --- updated-dependencies: - dependency-name: cherrypy dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * Update cherrypy==18.10.0 --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com> [skip ci]
This commit is contained in:
parent
5e977c044a
commit
a528f052b9
73 changed files with 1713 additions and 1008 deletions
|
@ -31,7 +31,6 @@ _module__file__base = os.getcwd()
|
|||
|
||||
|
||||
class SimplePlugin(object):
|
||||
|
||||
"""Plugin base class which auto-subscribes methods for known channels."""
|
||||
|
||||
bus = None
|
||||
|
@ -59,7 +58,6 @@ class SimplePlugin(object):
|
|||
|
||||
|
||||
class SignalHandler(object):
|
||||
|
||||
"""Register bus channels (and listeners) for system signals.
|
||||
|
||||
You can modify what signals your application listens for, and what it does
|
||||
|
@ -171,8 +169,8 @@ class SignalHandler(object):
|
|||
If the optional 'listener' argument is provided, it will be
|
||||
subscribed as a listener for the given signal's channel.
|
||||
|
||||
If the given signal name or number is not available on the current
|
||||
platform, ValueError is raised.
|
||||
If the given signal name or number is not available on the
|
||||
current platform, ValueError is raised.
|
||||
"""
|
||||
if isinstance(signal, text_or_bytes):
|
||||
signum = getattr(_signal, signal, None)
|
||||
|
@ -218,11 +216,10 @@ except ImportError:
|
|||
|
||||
|
||||
class DropPrivileges(SimplePlugin):
|
||||
|
||||
"""Drop privileges. uid/gid arguments not available on Windows.
|
||||
|
||||
Special thanks to `Gavin Baker
|
||||
<http://antonym.org/2005/12/dropping-privileges-in-python.html>`_
|
||||
<http://antonym.org/2005/12/dropping-privileges-in-python.html>`_.
|
||||
"""
|
||||
|
||||
def __init__(self, bus, umask=None, uid=None, gid=None):
|
||||
|
@ -234,7 +231,10 @@ class DropPrivileges(SimplePlugin):
|
|||
|
||||
@property
|
||||
def uid(self):
|
||||
"""The uid under which to run. Availability: Unix."""
|
||||
"""The uid under which to run.
|
||||
|
||||
Availability: Unix.
|
||||
"""
|
||||
return self._uid
|
||||
|
||||
@uid.setter
|
||||
|
@ -250,7 +250,10 @@ class DropPrivileges(SimplePlugin):
|
|||
|
||||
@property
|
||||
def gid(self):
|
||||
"""The gid under which to run. Availability: Unix."""
|
||||
"""The gid under which to run.
|
||||
|
||||
Availability: Unix.
|
||||
"""
|
||||
return self._gid
|
||||
|
||||
@gid.setter
|
||||
|
@ -332,7 +335,6 @@ class DropPrivileges(SimplePlugin):
|
|||
|
||||
|
||||
class Daemonizer(SimplePlugin):
|
||||
|
||||
"""Daemonize the running script.
|
||||
|
||||
Use this with a Web Site Process Bus via::
|
||||
|
@ -423,7 +425,6 @@ class Daemonizer(SimplePlugin):
|
|||
|
||||
|
||||
class PIDFile(SimplePlugin):
|
||||
|
||||
"""Maintain a PID file via a WSPBus."""
|
||||
|
||||
def __init__(self, bus, pidfile):
|
||||
|
@ -453,12 +454,11 @@ class PIDFile(SimplePlugin):
|
|||
|
||||
|
||||
class PerpetualTimer(threading.Timer):
|
||||
|
||||
"""A responsive subclass of threading.Timer whose run() method repeats.
|
||||
|
||||
Use this timer only when you really need a very interruptible timer;
|
||||
this checks its 'finished' condition up to 20 times a second, which can
|
||||
results in pretty high CPU usage
|
||||
this checks its 'finished' condition up to 20 times a second, which
|
||||
can results in pretty high CPU usage
|
||||
"""
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
|
@ -483,14 +483,14 @@ class PerpetualTimer(threading.Timer):
|
|||
|
||||
|
||||
class BackgroundTask(threading.Thread):
|
||||
|
||||
"""A subclass of threading.Thread whose run() method repeats.
|
||||
|
||||
Use this class for most repeating tasks. It uses time.sleep() to wait
|
||||
for each interval, which isn't very responsive; that is, even if you call
|
||||
self.cancel(), you'll have to wait until the sleep() call finishes before
|
||||
the thread stops. To compensate, it defaults to being daemonic, which means
|
||||
it won't delay stopping the whole process.
|
||||
Use this class for most repeating tasks. It uses time.sleep() to
|
||||
wait for each interval, which isn't very responsive; that is, even
|
||||
if you call self.cancel(), you'll have to wait until the sleep()
|
||||
call finishes before the thread stops. To compensate, it defaults to
|
||||
being daemonic, which means it won't delay stopping the whole
|
||||
process.
|
||||
"""
|
||||
|
||||
def __init__(self, interval, function, args=[], kwargs={}, bus=None):
|
||||
|
@ -525,7 +525,6 @@ class BackgroundTask(threading.Thread):
|
|||
|
||||
|
||||
class Monitor(SimplePlugin):
|
||||
|
||||
"""WSPBus listener to periodically run a callback in its own thread."""
|
||||
|
||||
callback = None
|
||||
|
@ -582,7 +581,6 @@ class Monitor(SimplePlugin):
|
|||
|
||||
|
||||
class Autoreloader(Monitor):
|
||||
|
||||
"""Monitor which re-executes the process when files change.
|
||||
|
||||
This :ref:`plugin<plugins>` restarts the process (via :func:`os.execv`)
|
||||
|
@ -699,20 +697,20 @@ class Autoreloader(Monitor):
|
|||
|
||||
|
||||
class ThreadManager(SimplePlugin):
|
||||
|
||||
"""Manager for HTTP request threads.
|
||||
|
||||
If you have control over thread creation and destruction, publish to
|
||||
the 'acquire_thread' and 'release_thread' channels (for each thread).
|
||||
This will register/unregister the current thread and publish to
|
||||
'start_thread' and 'stop_thread' listeners in the bus as needed.
|
||||
the 'acquire_thread' and 'release_thread' channels (for each
|
||||
thread). This will register/unregister the current thread and
|
||||
publish to 'start_thread' and 'stop_thread' listeners in the bus as
|
||||
needed.
|
||||
|
||||
If threads are created and destroyed by code you do not control
|
||||
(e.g., Apache), then, at the beginning of every HTTP request,
|
||||
publish to 'acquire_thread' only. You should not publish to
|
||||
'release_thread' in this case, since you do not know whether
|
||||
the thread will be re-used or not. The bus will call
|
||||
'stop_thread' listeners for you when it stops.
|
||||
'release_thread' in this case, since you do not know whether the
|
||||
thread will be re-used or not. The bus will call 'stop_thread'
|
||||
listeners for you when it stops.
|
||||
"""
|
||||
|
||||
threads = None
|
||||
|
|
|
@ -132,7 +132,6 @@ class Timeouts:
|
|||
|
||||
|
||||
class ServerAdapter(object):
|
||||
|
||||
"""Adapter for an HTTP server.
|
||||
|
||||
If you need to start more than one HTTP server (to serve on multiple
|
||||
|
@ -188,9 +187,7 @@ class ServerAdapter(object):
|
|||
|
||||
@property
|
||||
def description(self):
|
||||
"""
|
||||
A description about where this server is bound.
|
||||
"""
|
||||
"""A description about where this server is bound."""
|
||||
if self.bind_addr is None:
|
||||
on_what = 'unknown interface (dynamic?)'
|
||||
elif isinstance(self.bind_addr, tuple):
|
||||
|
@ -292,7 +289,6 @@ class ServerAdapter(object):
|
|||
|
||||
|
||||
class FlupCGIServer(object):
|
||||
|
||||
"""Adapter for a flup.server.cgi.WSGIServer."""
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
|
@ -316,7 +312,6 @@ class FlupCGIServer(object):
|
|||
|
||||
|
||||
class FlupFCGIServer(object):
|
||||
|
||||
"""Adapter for a flup.server.fcgi.WSGIServer."""
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
|
@ -362,7 +357,6 @@ class FlupFCGIServer(object):
|
|||
|
||||
|
||||
class FlupSCGIServer(object):
|
||||
|
||||
"""Adapter for a flup.server.scgi.WSGIServer."""
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
"""Windows service. Requires pywin32."""
|
||||
"""Windows service.
|
||||
|
||||
Requires pywin32.
|
||||
"""
|
||||
|
||||
import os
|
||||
import win32api
|
||||
|
@ -11,7 +14,6 @@ from cherrypy.process import wspbus, plugins
|
|||
|
||||
|
||||
class ConsoleCtrlHandler(plugins.SimplePlugin):
|
||||
|
||||
"""A WSPBus plugin for handling Win32 console events (like Ctrl-C)."""
|
||||
|
||||
def __init__(self, bus):
|
||||
|
@ -69,10 +71,10 @@ class ConsoleCtrlHandler(plugins.SimplePlugin):
|
|||
|
||||
|
||||
class Win32Bus(wspbus.Bus):
|
||||
|
||||
"""A Web Site Process Bus implementation for Win32.
|
||||
|
||||
Instead of time.sleep, this bus blocks using native win32event objects.
|
||||
Instead of time.sleep, this bus blocks using native win32event
|
||||
objects.
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
|
@ -120,7 +122,6 @@ class Win32Bus(wspbus.Bus):
|
|||
|
||||
|
||||
class _ControlCodes(dict):
|
||||
|
||||
"""Control codes used to "signal" a service via ControlService.
|
||||
|
||||
User-defined control codes are in the range 128-255. We generally use
|
||||
|
@ -152,7 +153,6 @@ def signal_child(service, command):
|
|||
|
||||
|
||||
class PyWebService(win32serviceutil.ServiceFramework):
|
||||
|
||||
"""Python Web Service."""
|
||||
|
||||
_svc_name_ = 'Python Web Service'
|
||||
|
|
|
@ -57,7 +57,6 @@ the new state.::
|
|||
| \ |
|
||||
| V V
|
||||
STARTED <-- STARTING
|
||||
|
||||
"""
|
||||
|
||||
import atexit
|
||||
|
@ -65,7 +64,7 @@ import atexit
|
|||
try:
|
||||
import ctypes
|
||||
except ImportError:
|
||||
"""Google AppEngine is shipped without ctypes
|
||||
"""Google AppEngine is shipped without ctypes.
|
||||
|
||||
:seealso: http://stackoverflow.com/a/6523777/70170
|
||||
"""
|
||||
|
@ -165,8 +164,8 @@ class Bus(object):
|
|||
All listeners for a given channel are guaranteed to be called even
|
||||
if others at the same channel fail. Each failure is logged, but
|
||||
execution proceeds on to the next listener. The only way to stop all
|
||||
processing from inside a listener is to raise SystemExit and stop the
|
||||
whole server.
|
||||
processing from inside a listener is to raise SystemExit and stop
|
||||
the whole server.
|
||||
"""
|
||||
|
||||
states = states
|
||||
|
@ -312,8 +311,9 @@ class Bus(object):
|
|||
def restart(self):
|
||||
"""Restart the process (may close connections).
|
||||
|
||||
This method does not restart the process from the calling thread;
|
||||
instead, it stops the bus and asks the main thread to call execv.
|
||||
This method does not restart the process from the calling
|
||||
thread; instead, it stops the bus and asks the main thread to
|
||||
call execv.
|
||||
"""
|
||||
self.execv = True
|
||||
self.exit()
|
||||
|
@ -327,10 +327,11 @@ class Bus(object):
|
|||
"""Wait for the EXITING state, KeyboardInterrupt or SystemExit.
|
||||
|
||||
This function is intended to be called only by the main thread.
|
||||
After waiting for the EXITING state, it also waits for all threads
|
||||
to terminate, and then calls os.execv if self.execv is True. This
|
||||
design allows another thread to call bus.restart, yet have the main
|
||||
thread perform the actual execv call (required on some platforms).
|
||||
After waiting for the EXITING state, it also waits for all
|
||||
threads to terminate, and then calls os.execv if self.execv is
|
||||
True. This design allows another thread to call bus.restart, yet
|
||||
have the main thread perform the actual execv call (required on
|
||||
some platforms).
|
||||
"""
|
||||
try:
|
||||
self.wait(states.EXITING, interval=interval, channel='main')
|
||||
|
@ -379,13 +380,14 @@ class Bus(object):
|
|||
def _do_execv(self):
|
||||
"""Re-execute the current process.
|
||||
|
||||
This must be called from the main thread, because certain platforms
|
||||
(OS X) don't allow execv to be called in a child thread very well.
|
||||
This must be called from the main thread, because certain
|
||||
platforms (OS X) don't allow execv to be called in a child
|
||||
thread very well.
|
||||
"""
|
||||
try:
|
||||
args = self._get_true_argv()
|
||||
except NotImplementedError:
|
||||
"""It's probably win32 or GAE"""
|
||||
"""It's probably win32 or GAE."""
|
||||
args = [sys.executable] + self._get_interpreter_argv() + sys.argv
|
||||
|
||||
self.log('Re-spawning %s' % ' '.join(args))
|
||||
|
@ -472,7 +474,7 @@ class Bus(object):
|
|||
c_ind = None
|
||||
|
||||
if is_module:
|
||||
"""It's containing `-m -m` sequence of arguments"""
|
||||
"""It's containing `-m -m` sequence of arguments."""
|
||||
if is_command and c_ind < m_ind:
|
||||
"""There's `-c -c` before `-m`"""
|
||||
raise RuntimeError(
|
||||
|
@ -481,7 +483,7 @@ class Bus(object):
|
|||
# Survive module argument here
|
||||
original_module = sys.argv[0]
|
||||
if not os.access(original_module, os.R_OK):
|
||||
"""There's no such module exist"""
|
||||
"""There's no such module exist."""
|
||||
raise AttributeError(
|
||||
"{} doesn't seem to be a module "
|
||||
'accessible by current user'.format(original_module))
|
||||
|
@ -489,7 +491,7 @@ class Bus(object):
|
|||
# ... and substitute it with the original module path:
|
||||
_argv.insert(m_ind, original_module)
|
||||
elif is_command:
|
||||
"""It's containing just `-c -c` sequence of arguments"""
|
||||
"""It's containing just `-c -c` sequence of arguments."""
|
||||
raise RuntimeError(
|
||||
"Cannot reconstruct command from '-c'. "
|
||||
'Ref: https://github.com/cherrypy/cherrypy/issues/1545')
|
||||
|
@ -512,13 +514,13 @@ class Bus(object):
|
|||
"""Prepend current working dir to PATH environment variable if needed.
|
||||
|
||||
If sys.path[0] is an empty string, the interpreter was likely
|
||||
invoked with -m and the effective path is about to change on
|
||||
re-exec. Add the current directory to $PYTHONPATH to ensure
|
||||
that the new process sees the same path.
|
||||
invoked with -m and the effective path is about to change on re-
|
||||
exec. Add the current directory to $PYTHONPATH to ensure that
|
||||
the new process sees the same path.
|
||||
|
||||
This issue cannot be addressed in the general case because
|
||||
Python cannot reliably reconstruct the
|
||||
original command line (http://bugs.python.org/issue14208).
|
||||
Python cannot reliably reconstruct the original command line (
|
||||
http://bugs.python.org/issue14208).
|
||||
|
||||
(This idea filched from tornado.autoreload)
|
||||
"""
|
||||
|
@ -536,10 +538,10 @@ class Bus(object):
|
|||
"""Set the CLOEXEC flag on all open files (except stdin/out/err).
|
||||
|
||||
If self.max_cloexec_files is an integer (the default), then on
|
||||
platforms which support it, it represents the max open files setting
|
||||
for the operating system. This function will be called just before
|
||||
the process is restarted via os.execv() to prevent open files
|
||||
from persisting into the new process.
|
||||
platforms which support it, it represents the max open files
|
||||
setting for the operating system. This function will be called
|
||||
just before the process is restarted via os.execv() to prevent
|
||||
open files from persisting into the new process.
|
||||
|
||||
Set self.max_cloexec_files to 0 to disable this behavior.
|
||||
"""
|
||||
|
@ -578,7 +580,10 @@ class Bus(object):
|
|||
return t
|
||||
|
||||
def log(self, msg='', level=20, traceback=False):
|
||||
"""Log the given message. Append the last traceback if requested."""
|
||||
"""Log the given message.
|
||||
|
||||
Append the last traceback if requested.
|
||||
"""
|
||||
if traceback:
|
||||
msg += '\n' + ''.join(_traceback.format_exception(*sys.exc_info()))
|
||||
self.publish('log', msg, level)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue