Skip to content

fix: replace bare except clauses with except Exception in llmcore.py#556

Closed
Kailigithub wants to merge 1 commit into
lsdefine:mainfrom
Kailigithub:fix/llmcore-e722-v2
Closed

fix: replace bare except clauses with except Exception in llmcore.py#556
Kailigithub wants to merge 1 commit into
lsdefine:mainfrom
Kailigithub:fix/llmcore-e722-v2

Conversation

@Kailigithub

Copy link
Copy Markdown
Contributor

Summary

Replace 17 bare except: clauses in llmcore.py with except Exception: to follow Python best practices and pass ruff E722 lint checks.

Changes

All bare except: in llmcore.py replaced with except Exception::

  • Line 32: reload_mykeys() fallback
  • Line 165/185: _stream Anthropic tool JSON parsing
  • Lines 197, 203: _try_parse_tool_args() JSON parsing fallback
  • Lines 222, 271: SSE stream line JSON parsing
  • Lines 328, 343: OpenAI response tool call JSON parsing
  • Line 364: retry-after header parsing
  • Line 377: HTTP response body extraction
  • Line 871: tool call JSON extraction in _parse_json_tool_calls
  • Lines 887, 895: _parse_text_tool_calls XML/JSON fallback
  • Lines 919, 922, 924: tryparse() multi-stage JSON parsing

Verification

  • python3 -m py_compile llmcore.py passes
  • ruff check llmcore.py --select E722 reports all checks passed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants