mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-12 08:16:06 -07:00
Bump cherrypy from 18.6.1 to 18.8.0 (#1796)
* Bump cherrypy from 18.6.1 to 18.8.0 Bumps [cherrypy](https://github.com/cherrypy/cherrypy) from 18.6.1 to 18.8.0. - [Release notes](https://github.com/cherrypy/cherrypy/releases) - [Changelog](https://github.com/cherrypy/cherrypy/blob/main/CHANGES.rst) - [Commits](https://github.com/cherrypy/cherrypy/compare/v18.6.1...v18.8.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.8.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>
This commit is contained in:
parent
e79da07973
commit
76cc56a215
75 changed files with 19150 additions and 1339 deletions
59
lib/autocommand/automain.py
Normal file
59
lib/autocommand/automain.py
Normal file
|
@ -0,0 +1,59 @@
|
|||
# Copyright 2014-2015 Nathan West
|
||||
#
|
||||
# This file is part of autocommand.
|
||||
#
|
||||
# autocommand is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Lesser General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# autocommand is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with autocommand. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import sys
|
||||
from .errors import AutocommandError
|
||||
|
||||
|
||||
class AutomainRequiresModuleError(AutocommandError, TypeError):
|
||||
pass
|
||||
|
||||
|
||||
def automain(module, *, args=(), kwargs=None):
|
||||
'''
|
||||
This decorator automatically invokes a function if the module is being run
|
||||
as the "__main__" module. Optionally, provide args or kwargs with which to
|
||||
call the function. If `module` is "__main__", the function is called, and
|
||||
the program is `sys.exit`ed with the return value. You can also pass `True`
|
||||
to cause the function to be called unconditionally. If the function is not
|
||||
called, it is returned unchanged by the decorator.
|
||||
|
||||
Usage:
|
||||
|
||||
@automain(__name__) # Pass __name__ to check __name__=="__main__"
|
||||
def main():
|
||||
...
|
||||
|
||||
If __name__ is "__main__" here, the main function is called, and then
|
||||
sys.exit called with the return value.
|
||||
'''
|
||||
|
||||
# Check that @automain(...) was called, rather than @automain
|
||||
if callable(module):
|
||||
raise AutomainRequiresModuleError(module)
|
||||
|
||||
if module == '__main__' or module is True:
|
||||
if kwargs is None:
|
||||
kwargs = {}
|
||||
|
||||
# Use a function definition instead of a lambda for a neater traceback
|
||||
def automain_decorator(main):
|
||||
sys.exit(main(*args, **kwargs))
|
||||
|
||||
return automain_decorator
|
||||
else:
|
||||
return lambda main: main
|
Loading…
Add table
Add a link
Reference in a new issue