From e1d55e00af6ad29203924eb08bb5902b39e3565e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Thu, 22 Oct 2020 14:30:40 +0200 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Py3:=20Remove=20py2=20spec?= =?UTF-8?q?ific=20sarge=20patch?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/octoprint/__init__.py | 4 ---- src/octoprint/util/fixes.py | 40 ------------------------------------- 2 files changed, 44 deletions(-) diff --git a/src/octoprint/__init__.py b/src/octoprint/__init__.py index 6f78ecb76..f20e191b3 100644 --- a/src/octoprint/__init__.py +++ b/src/octoprint/__init__.py @@ -744,10 +744,6 @@ def main(): # cut off stuff from the beginning args = args[-1 * sys_args_length :] if sys_args_length else [] - from octoprint.util.fixes import patch_sarge_async_on_py2 - - patch_sarge_async_on_py2() - from octoprint.cli import octo octo(args=args, prog_name="octoprint", auto_envvar_prefix="OCTOPRINT") diff --git a/src/octoprint/util/fixes.py b/src/octoprint/util/fixes.py index 21362375e..9a4781d91 100644 --- a/src/octoprint/util/fixes.py +++ b/src/octoprint/util/fixes.py @@ -2,43 +2,3 @@ This module contains a functions that monkey patch third party dependencies in the one or other way. """ __license__ = "GNU Affero General Public License http://www.gnu.org/licenses/agpl.html" - -import functools -import sys -import warnings - - -def patch_sarge_async_on_py2(): - if sys.version_info[0] >= 3: - return - - def move_async(f): - @functools.wraps(f) - def decorated_function(*args, **kwargs): - if "async" in kwargs: - warnings.warn( - 'sarge\'s "async" parameter is deprecated. Use "_async" instead.', - DeprecationWarning, - stacklevel=2, - ) - kwargs["async_"] = kwargs.pop("async") - return f(*args, **kwargs) - - return decorated_function - - import sarge - - # wrap helper - sarge.run = move_async(sarge.run) - - # wrap Command - sarge.Command.run = move_async(sarge.Command.run) - - # wrap Pipeline - sarge.Pipeline.run = move_async(sarge.Pipeline.run) - sarge.Pipeline.run_command_node = move_async(sarge.Pipeline.run_command_node) - sarge.Pipeline.run_list_node = move_async(sarge.Pipeline.run_list_node) - sarge.Pipeline.run_logical_node = move_async(sarge.Pipeline.run_logical_node) - sarge.Pipeline.run_node = move_async(sarge.Pipeline.run_node) - sarge.Pipeline.run_node_in_thread = move_async(sarge.Pipeline.run_node_in_thread) - sarge.Pipeline.run_pipeline_node = move_async(sarge.Pipeline.run_pipeline_node)