fix: resolve Pylint errors in executor, data service, and odds call

Rename TimeoutError to PluginTimeoutError in plugin_executor.py to
avoid shadowing the built-in; no external callers affected.

Remove dead try/except in BackgroundDataService.shutdown: executor.shutdown()
never accepted a timeout kwarg so the try branch always raised TypeError.
Simplify to a direct shutdown(wait=wait) call.

Remove is_live kwarg from odds_manager.get_odds() call in sports.py;
BaseOddsManager.get_odds() has no such parameter. The live update interval
is already encoded in the update_interval_seconds argument passed alongside.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Chuck
2026-05-14 10:19:48 -04:00
parent 6a99fbdd90
commit 4c8dfeb48c
3 changed files with 7 additions and 18 deletions

View File

@@ -570,16 +570,6 @@ class BackgroundDataService:
for request_id in list(self.active_requests.keys()): for request_id in list(self.active_requests.keys()):
self.cancel_request(request_id) self.cancel_request(request_id)
# Shutdown executor with compatibility for older Python versions
try:
# Try with timeout parameter (Python 3.9+)
self.executor.shutdown(wait=wait, timeout=timeout)
except TypeError:
# Fallback for older Python versions that don't support timeout
if wait and timeout:
# For older versions, we can't specify timeout, so just wait
self.executor.shutdown(wait=True)
else:
self.executor.shutdown(wait=wait) self.executor.shutdown(wait=wait)
logger.info("BackgroundDataService shutdown complete") logger.info("BackgroundDataService shutdown complete")

View File

@@ -416,7 +416,6 @@ class SportsCore(ABC):
league=self.league, league=self.league,
event_id=game['id'], event_id=game['id'],
update_interval_seconds=update_interval, update_interval_seconds=update_interval,
is_live=is_live
) )
if odds_data: if odds_data:

View File

@@ -16,7 +16,7 @@ from src.logging_config import get_logger
from src.error_aggregator import record_error from src.error_aggregator import record_error
class TimeoutError(Exception): class PluginTimeoutError(Exception):
"""Raised when a plugin operation times out.""" """Raised when a plugin operation times out."""
pass pass
@@ -57,7 +57,7 @@ class PluginExecutor:
Result of operation Result of operation
Raises: Raises:
TimeoutError: If operation times out PluginTimeoutError: If operation times out
PluginError: If operation raises an exception PluginError: If operation raises an exception
""" """
timeout = timeout or self.default_timeout timeout = timeout or self.default_timeout
@@ -81,7 +81,7 @@ class PluginExecutor:
if not result_container['completed']: if not result_container['completed']:
error_msg = f"{plugin_context} operation timed out after {timeout}s" error_msg = f"{plugin_context} operation timed out after {timeout}s"
self.logger.error(error_msg) self.logger.error(error_msg)
timeout_error = TimeoutError(error_msg) timeout_error = PluginTimeoutError(error_msg)
record_error(timeout_error, plugin_id=plugin_id, operation="timeout") record_error(timeout_error, plugin_id=plugin_id, operation="timeout")
raise timeout_error raise timeout_error
@@ -128,7 +128,7 @@ class PluginExecutor:
) )
return True return True
except TimeoutError: except PluginTimeoutError:
self.logger.error("Plugin %s update() timed out", plugin_id) self.logger.error("Plugin %s update() timed out", plugin_id)
return False return False
except PluginError: except PluginError:
@@ -204,7 +204,7 @@ class PluginExecutor:
# For backward compatibility: if plugin returns None or something else, treat as success # For backward compatibility: if plugin returns None or something else, treat as success
self.logger.debug(f"Plugin {plugin_id} display() returned non-boolean: {result}, treating as True") self.logger.debug(f"Plugin {plugin_id} display() returned non-boolean: {result}, treating as True")
return True return True
except TimeoutError: except PluginTimeoutError:
self.logger.error("Plugin %s display() timed out", plugin_id) self.logger.error("Plugin %s display() timed out", plugin_id)
return False return False
except PluginError: except PluginError:
@@ -247,7 +247,7 @@ class PluginExecutor:
timeout=timeout, timeout=timeout,
plugin_id=plugin_id plugin_id=plugin_id
) )
except (TimeoutError, PluginError, Exception) as e: except (PluginTimeoutError, PluginError, Exception) as e:
self.logger.warning( self.logger.warning(
"Plugin %s %s failed, using default return: %s", "Plugin %s %s failed, using default return: %s",
plugin_id, plugin_id,