From e7e36704525f1a91995094f265cd24ccb23f95b7 Mon Sep 17 00:00:00 2001 From: mishaschwartz <4380924+mishaschwartz@users.noreply.github.com> Date: Thu, 15 Feb 2024 10:01:26 -0500 Subject: [PATCH] manually duplicate signature --- weaver/cli.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/weaver/cli.py b/weaver/cli.py index effa5f62f..61c5cd582 100644 --- a/weaver/cli.py +++ b/weaver/cli.py @@ -243,19 +243,18 @@ class RequestAuthHandler(AuthHandler, HTTPBasicAuth): Base class to send a request in order to retrieve an authorization token. """ - def __init__(self, token=None, **kwargs): - # type: (Any, **Any) -> None - AuthHandler.__init__(self, **kwargs) - HTTPBasicAuth.__init__(self, username=kwargs.get("username"), password=kwargs.get("password")) + def __init__(self, + identity=None, # Optional[str] + password=None, # Optional[str] + url=None, # Optional[str] + method="GET", # AnyRequestMethod + headers=None, # Optional[AnyHeadersContainer] + token=None): # Any + # type: (...) -> None + AuthHandler.__init__(self, identity=identity, password=password, url=url, method=method, headers=headers) + HTTPBasicAuth.__init__(self, username=identity, password=password) self.token = token - # Update __init__'s signature to include keyword arguments from AuthHandler's __init__. This is required because - # the CLI entrypoint inspects the auth class' signature in order to figure out which arguments to pass to it. - _signature_AuthHandler = inspect.signature(AuthHandler.__init__) - __init__.__signature__ = _signature_AuthHandler.replace( - parameters=(*_signature_AuthHandler.parameters.values(), inspect.signature(__init__).parameters["token"]) - ) - @property def auth_token_name(self): # type: () -> str @@ -2961,6 +2960,7 @@ def main(*args): except Exception as exc: msg = "Operation failed due to exception." err = fully_qualified_name(exc) + result = OperationResult(False, message=msg, body={"message": msg, "cause": str(exc), "error": err}) if result.success: LOGGER.info("%s successful. %s\n", oper.title(), result.message) print(result.text) # use print in case logger disabled or level error/warn