Skip to content

Commit

Permalink
feat: allow plugin.register to be used as a decorator
Browse files Browse the repository at this point in the history
  • Loading branch information
pwwang committed Jul 21, 2024
1 parent 135f1ba commit 1266e14
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions simplug.py
Original file line number Diff line number Diff line change
Expand Up @@ -831,6 +831,10 @@ def register(self, *plugins: Any) -> None:

self._batch_index += 1

if len(plugins) == 1 and callable(plugins[0]):
# allow to use as a decorator
return plugins[0]

def get_plugin(self, name: str, raw: bool = False) -> object:
"""Get the plugin wrapper or the raw plugin object
Expand Down

0 comments on commit 1266e14

Please sign in to comment.