Skip to content

Commit

Permalink
plugin: add capability.__str__
Browse files Browse the repository at this point in the history
  • Loading branch information
half-duplex committed Nov 27, 2023
1 parent 7693af3 commit f73e31a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions sopel/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,13 @@ def __init__(
self._cap_req: tuple[str, ...] = tuple(sorted(cap_req))
self._handler: Optional[CapabilityHandler] = handler

def __str__(self) -> str:
caps = ", ".join(repr(cap) for cap in self._cap_req)
handler = ""
if self._handler:
handler = " ({}())".format(self._handler.__name__)
return "<capability {}{}>".format(caps, handler)

@property
def cap_req(self) -> tuple[str, ...]:
"""Capability request as a sorted tuple.
Expand Down
2 changes: 1 addition & 1 deletion sopel/plugins/capabilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ def register(self, plugin_name: str, request: capability) -> None:
plugin_caps[plugin_name] = (
request, False,
)
LOGGER.debug('Capability Request registered: %s', str(request))
LOGGER.debug('Capability Request registered: %s', request)

def request_available(
self,
Expand Down

0 comments on commit f73e31a

Please sign in to comment.