TonieToolbox 0.5.0a1__py3-none-any.whl → 0.6.0a1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -18,15 +18,14 @@ CACHE_FILE = os.path.join(CACHE_DIR, "version_cache.json")
18
18
  CACHE_EXPIRY = 86400 # 24 hours in seconds
19
19
 
20
20
 
21
- def get_pypi_version(force_refresh=False):
21
+ def get_pypi_version(force_refresh: bool = False) -> tuple[str, str | None]:
22
22
  """
23
23
  Get the latest version of TonieToolbox from PyPI.
24
24
 
25
25
  Args:
26
- force_refresh: If True, ignore the cache and fetch directly from PyPI
27
-
26
+ force_refresh (bool): If True, ignore the cache and fetch directly from PyPI
28
27
  Returns:
29
- tuple: (latest_version, None) on success, (current_version, error_message) on failure
28
+ tuple[str, str | None]: (latest_version, None) on success, (current_version, error_message) on failure
30
29
  """
31
30
  logger = get_logger("version_handler")
32
31
  logger.debug("Checking for latest version (force_refresh=%s)", force_refresh)
@@ -88,14 +87,13 @@ def get_pypi_version(force_refresh=False):
88
87
  return __version__, f"Unexpected error checking for updates: {str(e)}"
89
88
 
90
89
 
91
- def compare_versions(v1, v2):
90
+ def compare_versions(v1: str, v2: str) -> int:
92
91
  """
93
92
  Compare two version strings according to PEP 440.
94
93
 
95
94
  Args:
96
- v1: First version string
97
- v2: Second version string
98
-
95
+ v1 (str): First version string
96
+ v2 (str): Second version string
99
97
  Returns:
100
98
  int: -1 if v1 < v2, 0 if v1 == v2, 1 if v1 > v2
101
99
  """
@@ -133,16 +131,15 @@ def compare_versions(v1, v2):
133
131
  return 1
134
132
 
135
133
 
136
- def check_for_updates(quiet=False, force_refresh=False):
134
+ def check_for_updates(quiet: bool = False, force_refresh: bool = False) -> tuple[bool, str, str, bool]:
137
135
  """
138
136
  Check if the current version of TonieToolbox is the latest.
139
137
 
140
138
  Args:
141
- quiet: If True, will not log any information messages and skip user confirmation
142
- force_refresh: If True, bypass cache and check PyPI directly
143
-
139
+ quiet (bool): If True, will not log any information messages and skip user confirmation
140
+ force_refresh (bool): If True, bypass cache and check PyPI directly
144
141
  Returns:
145
- tuple: (is_latest, latest_version, message, update_confirmed)
142
+ tuple[bool, str, str, bool]: (is_latest, latest_version, message, update_confirmed)
146
143
  is_latest: boolean indicating if the current version is the latest
147
144
  latest_version: string with the latest version
148
145
  message: string message about the update status or error
@@ -200,7 +197,7 @@ def check_for_updates(quiet=False, force_refresh=False):
200
197
  return is_latest, latest_version, message, update_confirmed
201
198
 
202
199
 
203
- def install_update():
200
+ def install_update() -> bool:
204
201
  """
205
202
  Try to install the update using pip, pip3, or pipx.
206
203
 
@@ -238,7 +235,7 @@ def install_update():
238
235
  return False
239
236
 
240
237
 
241
- def clear_version_cache():
238
+ def clear_version_cache() -> bool:
242
239
  """
243
240
  Clear the version cache file to force a refresh on next check.
244
241