Skip to content

refactor: improve code quality#179

Merged
QuBenhao merged 4 commits intomasterfrom
refactor/improve-code-quality
Mar 14, 2026
Merged

refactor: improve code quality#179
QuBenhao merged 4 commits intomasterfrom
refactor/improve-code-quality

Conversation

@QuBenhao
Copy link
Owner

No description provided.

QuBenhao and others added 4 commits March 14, 2026 18:11
- Replace unsafe eval() with ast.literal_eval() in question.py
- Add safe_literal_eval() function with fallback for edge cases
- Improve exception handling with specific exception types
- Add comprehensive type annotations to submission.py functions
- Implement exponential backoff retry strategy for submissions
- Extract CLI module with i18n, input utils, and cookie management

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Refactor leetcode.py to use new CLI modules
- Remove inline I18N dictionary (use cli.i18n module)
- Remove inline helper functions (use cli.input_utils module)
- Remove inline cookie functions (use cli.browser_cookie module)
- Add section comments for better code organization
- Extract helper functions for category and contest handling
- Fix import path in tools.py (daily_auto import)

The refactored leetcode.py is ~40% smaller while maintaining
all original functionality.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Remove unsafe eval() fallback in safe_literal_eval to prevent code injection
- Use contextvars for i18n language state to fix race condition in concurrent environments
- Replace broad Exception catches with specific exception types in browser_cookie.py

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@QuBenhao QuBenhao merged commit f843172 into master Mar 14, 2026
@QuBenhao QuBenhao deleted the refactor/improve-code-quality branch March 14, 2026 11:17
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.

1 participant