From 8d7cd4c38aafb84bec89d66d75a7ea8d7ad5e803 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Thu, 20 Jan 2022 13:03:39 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=92=9A=20(hopefully)=20fix=20unit=20tests?= =?UTF-8?q?=20in=20Python=202.7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/octoprint/cli/common.py | 27 +++------------------------ 1 file changed, 3 insertions(+), 24 deletions(-) diff --git a/src/octoprint/cli/common.py b/src/octoprint/cli/common.py index ae37e1372..c25162bda 100644 --- a/src/octoprint/cli/common.py +++ b/src/octoprint/cli/common.py @@ -10,8 +10,6 @@ from importlib import import_module import click from werkzeug.utils import cached_property -# shared by https://github.com/indico/indico in pallets/click#945 - class LazyGroup(click.Group): """ @@ -21,9 +19,11 @@ class LazyGroup(click.Group): at import time. """ + # shared by https://github.com/indico/indico in pallets/click#945 + def __init__(self, import_name, **kwargs): self._import_name = import_name - super().__init__(**kwargs) + click.Group.__init__(self, **kwargs) @cached_property def _impl(self): @@ -44,24 +44,3 @@ class LazyGroup(click.Group): def get_params(self, ctx): return self._impl.get_params(ctx) - - -class LazyCommandCollection(click.CommandCollection): - def __init__(self, **kwargs): - super().__init__(**kwargs) - - def get_command(self, ctx, cmd_name): - pass - - def list_commands(self, ctx): - pass - - def group(self, *args, **kwargs): - from click.decorators import group - - def decorator(f): - cmd = group(*args, **kwargs)(f) - self.add_command(cmd) - return cmd - - return decorator