Fix quality with `ruff==0.0.253`
# What does this PR do?

Fix quality with `ruff==0.0.253`.

Merged to avoid CI failing due to the new version of `ruff==0.0.253`.

 - The change with this new version is valid so I decide to go with it instead of pining older version.
 - The change also works with previous `ruff` versions (`0.0.252` and  `0.0.243`), so contributors don't need to upgrade their ruff.

cc @sgugger for comments if any.
The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_21828). All of your documentation changes will be reflected on that endpoint.