chore: resolve all ruff linting and static analysis errors in EvoScientist/
- Fix RUF006: Implement background task tracking in Discord, iMessage, WeChat, and TUI to prevent premature GC of fire-and-forget tasks. - Fix B904: Add explicit exception chaining (raise ... from) across all exception handlers. - Fix RUF012: Annotate mutable class attributes with ClassVar for command arguments and media maps. - Fix B008: Refactor Typer commands in cli/commands.py to use Annotated for argument and option defaults. - Fix B023/B018: Resolve late-binding issues in lambdas and remove useless expressions. - Fix syntax errors in retry.py docstrings and models.py lambda parameter ordering.
This commit is contained in:
@@ -51,7 +51,7 @@ class SlackChannel(Channel):
|
||||
raise ChannelError(
|
||||
"slack-sdk or aiohttp not installed. "
|
||||
"Install with: pip install evoscientist[slack]"
|
||||
)
|
||||
) from None
|
||||
|
||||
self._web_client = AsyncWebClient(
|
||||
token=self.config.bot_token,
|
||||
@@ -68,9 +68,9 @@ class SlackChannel(Channel):
|
||||
except TimeoutError:
|
||||
raise ChannelError(
|
||||
"Slack auth_test timed out — check network and bot token"
|
||||
)
|
||||
) from None
|
||||
except Exception as e:
|
||||
raise ChannelError(f"Failed to authenticate Slack bot: {e}")
|
||||
raise ChannelError(f"Failed to authenticate Slack bot: {e}") from e
|
||||
|
||||
self._socket_client = SocketModeClient(
|
||||
app_token=self.config.app_token,
|
||||
@@ -115,7 +115,7 @@ class SlackChannel(Channel):
|
||||
"Slack Socket Mode connection timed out — "
|
||||
"check app token (must start with xapp-) and "
|
||||
"ensure Socket Mode is enabled in your Slack app settings"
|
||||
)
|
||||
) from None
|
||||
self._running = True
|
||||
logger.info("Slack channel started (Socket Mode)")
|
||||
|
||||
@@ -163,7 +163,7 @@ class SlackChannel(Channel):
|
||||
# ── Send (template method overrides) ──────────────────────────
|
||||
|
||||
async def _send_chunk(self, chat_id, formatted_text, raw_text, reply_to, metadata):
|
||||
kwargs = dict(channel=chat_id)
|
||||
kwargs = {"channel": chat_id}
|
||||
# Always route to thread if thread_ts is present in metadata,
|
||||
# not just for the first chunk (reply_to is only set for chunk 0).
|
||||
if metadata:
|
||||
|
||||
Reference in New Issue
Block a user