Skip to content

Commit

Permalink
Merge pull request #476 from beer-garden/autobrew-any-kwargs
Browse files Browse the repository at this point in the history
Autobrew any kwargs
  • Loading branch information
1maple1 authored May 16, 2024
2 parents b07ae3a + 29629e8 commit 96078c0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Brewtils Changelog
------
TBD

- Added support for autobrew any kwargs
- Fixed cross-server url prefix comparison and handled case where there is no current request
- Added API support for Latest System, SystemClient will use Version `latest` instead of resolved version.
Allowing Beer Garden to resolve the latest version.
Expand Down
18 changes: 13 additions & 5 deletions brewtils/auto_decorator.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import inspect
from inspect import Parameter as InspectParameter # noqa
from inspect import signature


from brewtils.models import Command, Parameter

Expand Down Expand Up @@ -27,9 +29,15 @@ def addFunctions(self, client):
_wrapped = getattr(client, func)
if not hasattr(_wrapped, "_command") and not func.startswith("__"):
# decorators.py will handle all of the markings
if func.startswith("_"):
_wrapped._command = Command(hidden=True)
else:
_wrapped._command = Command()
has_kwargs = any(
[
True
for p in signature(_wrapped).parameters.values()
if p.kind == InspectParameter.VAR_KEYWORD
]
)
_wrapped._command = Command(
hidden=func.startswith("_"), allow_any_kwargs=has_kwargs
)

return client

0 comments on commit 96078c0

Please sign in to comment.