Skip to content

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
EleutherAI:mainfrom
Anai-Guo:fix/lint-cleanup-anthropic-piqa
Open

style: fix pre-commit lint failures in anthropic_llms.py and global_piqa template (#3900)#3922
Anai-Guo wants to merge 1 commit into
EleutherAI:mainfrom
Anai-Guo:fix/lint-cleanup-anthropic-piqa

Conversation

@Anai-Guo

@Anai-Guo Anai-Guo commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes the pre-commit failures reported in #3900 for two of the files that recent main merges left in a lint-failing state. Because the CI linter runs pre-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 format clean, with behavior-preserving changes only.

lm_eval/models/anthropic_llms.py

  • B904 — chain the four ModuleNotFoundError re-raises with raise ... from exception so the original cause is preserved.
  • RUF013 / UP045 — replace the implicit Optional (gen_kwargs: dict = None) with dict | None.
  • UP006 / UP035 — modernize deprecated typing aliases (List/Dict/Tuple/Union → builtins / X | Y).
  • Drop a now-unused # noqa: F821.

lm_eval/tasks/global_piqa/parallel_generation/_template

  • Add the missing final newline (end-of-file-fixer).

Scope note

The remaining violations in sglang_causallms.py from #3900 include B020 (loop variable shadowing its iterable) and TRY004 (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

…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.
@Anai-Guo
Anai-Guo requested review from 0xSMT and baberabb as code owners July 9, 2026 13:16
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