lint: fix B904 raise-from in share session-resolve + drop unused importlib
CI ruff gate flagged 3 new violations: two api/routes.py KeyError re-raises in an except-KeyError block (add 'from None') + an unused importlib import in the share security test. All trivial.
This commit is contained in:
1 parent
55509e98c2
commit
8c9d3635e2
2 files changed
+3
-3
No files matched your search
+2
-2
@@ -5125,10 +5125,10 @@ def _resolve_share_session_pair(sid: str, handler):
|
|||||||
cli_meta = _lookup_cli_session_metadata(sid) or {}
|
cli_meta = _lookup_cli_session_metadata(sid) or {}
|
||||||
effective_profile = cli_meta.get("profile") or None
|
effective_profile = cli_meta.get("profile") or None
|
||||||
if not _session_visible_to_active_profile(effective_profile, handler):
|
if not _session_visible_to_active_profile(effective_profile, handler):
|
||||||
raise KeyError(sid)
|
raise KeyError(sid) from None
|
||||||
synth, reason = _claim_or_synthesize_cli_session(sid, cli_meta=cli_meta)
|
synth, reason = _claim_or_synthesize_cli_session(sid, cli_meta=cli_meta)
|
||||||
if reason == "was_webui" or synth is None:
|
if reason == "was_webui" or synth is None:
|
||||||
raise KeyError(sid)
|
raise KeyError(sid) from None
|
||||||
return synth, None, cli_meta
|
return synth, None, cli_meta
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ def test_share_action_buttons_are_not_duplicated():
|
|||||||
def test_share_snapshot_redaction_is_always_on_regardless_of_setting():
|
def test_share_snapshot_redaction_is_always_on_regardless_of_setting():
|
||||||
# The public-share boundary must redact credentials + local paths and drop
|
# The public-share boundary must redact credentials + local paths and drop
|
||||||
# non-text/tool/system content EVEN IF the operator disabled api_redact_enabled.
|
# non-text/tool/system content EVEN IF the operator disabled api_redact_enabled.
|
||||||
import os, tempfile, importlib
|
import os, tempfile
|
||||||
os.environ.setdefault("HERMES_WEBUI_STATE_DIR", tempfile.mkdtemp())
|
os.environ.setdefault("HERMES_WEBUI_STATE_DIR", tempfile.mkdtemp())
|
||||||
import api.config as config
|
import api.config as config
|
||||||
import api.shares as shares
|
import api.shares as shares
|
||||||
|
|||||||
Reference in new issue
Block a user