Skip to content

Commit

Permalink
plugins.handlers: entrypoint starts with module version if available
Browse files Browse the repository at this point in the history
The other way to do this would be what was there before this change,
plus an added `if version is None:` that then calls on `super()`. I'm
just not convinced that that would be better, and it's more LoC. Plus,
in theory, an entrypoint's module could have its own separate version
number that differs from the package's version, and this order of
operations allows showing the more specific one if it's set.
  • Loading branch information
dgw committed Jul 3, 2022
1 parent f380fb9 commit 89f4aea
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions sopel/plugins/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -591,9 +591,9 @@ def get_version(self) -> Optional[str]:
:return: the plugin's version string
:rtype: Optional[str]
"""
version: Optional[str] = None
version: Optional[str] = super().get_version()

if hasattr(self._module, "__package__"):
if version is None and hasattr(self._module, "__package__"):
try:
version = importlib_metadata.version(self._module.__package__)
except ValueError:
Expand Down

0 comments on commit 89f4aea

Please sign in to comment.