mlco2 / codecarbon

Track emissions from Compute and recommend ways to reduce their impact on the environment.
https://mlco2.github.io/codecarbon
MIT License
1.18k stars 178 forks source link

Added return type hints and removed redunant return statements in cpu.py #512

Closed MyGodItsFull0fStars closed 8 months ago

MyGodItsFull0fStars commented 9 months ago

Hi!

I modified a few things in the cpu.py file. First, I either added or changed the return type hints of function signatures depending on the actual return type possible, Optional[some type], if the return type might be None in some cases.

Next, a few dangling return keywords were at the end of a function definition. As they do not serve any purpose, I removed them.