♻️ Py3: Remove py2 specific sarge patch
This commit is contained in:
1 parent
d98a6da7b2
commit
e1d55e00af
2 files changed
-44
No files matched your search
@@ -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")
|
||||
|
||||
@@ -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)
|
||||
Reference in new issue
Block a user