fix code quality issues
### Description

Hi :wave: I sent PR #8950 which has changes in a lot of files so sending this PR with fixes in few files so that it can be easily reviewed.

You can have a look at the various issues that were caught in the codebase [here](https://deepsource.io/gh/withshubh/transformers/issues/?category=recommended).

### Summary of changes

- Removed length check in favour of truthiness of the object
> Boosts minor performance, see the description [here](https://deepsource.io/gh/withshubh/transformers/issue/PYL-C1801/description/).
- Removed unnecessary comprehension
> boosts minor performance, see the description [here](https://deepsource.io/gh/withshubh/transformers/issue/PTC-W0016/description/).
- Removed unnecessary use of comprehension
> boosts minor performance, see the description [here](https://deepsource.io/gh/withshubh/transformers/issue/PTC-W0019/description/).
- Refactored the comparison involving `not`
> fixed [antipattern](https://deepsource.io/gh/withshubh/transformers/issue/PYL-C0113/description/)
- Removed unnecessary return statement
> removes [antipattern](https://deepsource.io/gh/withshubh/transformers/issue/PYL-R1711/description/)
- Iterated dictionary directly
> removes [antipattern](https://deepsource.io/gh/withshubh/transformers/issue/PYL-C0201/description/)
- Used literal syntax instead of function calls to create data structure
> boosts minor [performance](https://deepsource.io/gh/withshubh/transformers/issue/PYL-C1801/description/)
- Added .deepsource.toml
> config file to continuously analyze the repo for code quality issues
Hi @LysandreJik :wave: Please review this PR<|||||>Hi @withshubh, as said before in https://github.com/huggingface/transformers/pull/8950#issuecomment-781222459, we would like to stay with our current tooling for now. Thank you.