style: fix pre-commit lint failures in anthropic_llms.py and global_piqa template (#3900)#3922
Open
Anai-Guo wants to merge 1 commit into
Open
style: fix pre-commit lint failures in anthropic_llms.py and global_piqa template (#3900)#3922Anai-Guo wants to merge 1 commit into
Anai-Guo wants to merge 1 commit into
Conversation
…newline Resolves the pre-commit failures flagged in EleutherAI#3900 for the files touched by recent main merges: - lm_eval/models/anthropic_llms.py: chain re-raises with `from exception` (B904), replace implicit Optional with `dict | None` (RUF013/UP045), modernize deprecated typing aliases (List/Dict/Tuple/Union -> builtins, UP006/UP035), and drop a now-unused `# noqa: F821`. - lm_eval/tasks/global_piqa/parallel_generation/_template: add missing final newline (end-of-file-fixer). All changes are behavior-preserving; `ruff check` and `ruff format` now pass on the touched files. The remaining B905/B020/TRY004 violations in sglang_causallms.py involve control-flow-sensitive rewrites and are left for a separate, carefully-reviewed change.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the pre-commit failures reported in #3900 for two of the files that recent
mainmerges left in a lint-failing state. Because the CI linter runspre-commit ... --from-ref <base> --to-ref HEAD, any PR that touches these files inherits unrelated lint errors and goes red.This PR makes the touched files fully
ruff check/ruff formatclean, with behavior-preserving changes only.lm_eval/models/anthropic_llms.pyModuleNotFoundErrorre-raises withraise ... from exceptionso the original cause is preserved.Optional(gen_kwargs: dict = None) withdict | None.List/Dict/Tuple/Union→ builtins /X | Y).# noqa: F821.lm_eval/tasks/global_piqa/parallel_generation/_templateend-of-file-fixer).Scope note
The remaining violations in
sglang_causallms.pyfrom #3900 includeB020(loop variable shadowing its iterable) andTRY004(exception-type change), which are not purely cosmetic and deserve a separate, carefully-reviewed change rather than a blanket auto-fix. Happy to follow up on that file in a dedicated PR.Closes part of #3900.
🤖 Generated with Claude Code