Skip to content

Commit

Permalink
Don't use a function for __version__
Browse files Browse the repository at this point in the history
  • Loading branch information
RundownRhino committed Aug 18, 2023
1 parent bdf726f commit 6d5c09f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
2 changes: 1 addition & 1 deletion aw_watcher_mpv_sender/sender.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class Sender:
last_sent_events: LRUSet[CurplayingHeartbeat] = field(default_factory=lambda: LRUSet(50))

def __post_init__(self):
logger.info(f"aw-watcher-mpv-sender initializing. Version is {__version__()}, platform is {sys.platform}.")
logger.info(f"aw-watcher-mpv-sender initializing. Version is {__version__}, platform is {sys.platform}.")
if self.last_heartbeat is None:
bucket_id = f"{self.client.client_name}-curplaying_{self.client.client_hostname}"
self.create_bucket_once(bucket_id, "curplaying")
Expand Down
14 changes: 6 additions & 8 deletions aw_watcher_mpv_sender/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import datetime as DT
import logging
from collections import deque
from functools import cache
from typing import Collection, Generic, Hashable, Iterator, TypeVar

HashableT = TypeVar("HashableT", bound=Hashable)
Expand Down Expand Up @@ -72,11 +71,10 @@ def __contains__(self, el: HashableT) -> bool:
return el in self._set


@cache
def __version__() -> str:
try:
import pkg_resources
__version__: str = "<unknown>"
try:
import pkg_resources

return pkg_resources.get_distribution("aw-watcher-mpv-sender").version
except (ImportError, TypeError):
return "<unknown>"
__version__ = pkg_resources.get_distribution("aw-watcher-mpv-sender").version
except (ImportError, TypeError):
pass

0 comments on commit 6d5c09f

Please sign in to comment.