Skip to content

Commit

Permalink
ruff: add RET502 - [*] Do not implicitly return None in function ab…
Browse files Browse the repository at this point in the history
…le to return non-`None` value
  • Loading branch information
giampaolo committed Dec 22, 2024
1 parent 3ad810d commit b42eccd
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion psutil/_psposix.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def sleep(interval):
# can't determine its exit status code.
while _pid_exists(pid):
interval = sleep(interval)
return
return None
else:
if retpid == 0:
# WNOHANG flag was used and PID is still running.
Expand Down
2 changes: 1 addition & 1 deletion psutil/tests/test_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ def test_per_cpu_times_2(self):
t1, t2 = psutil._cpu_busy_time(t1), psutil._cpu_busy_time(t2)
difference = t2 - t1
if difference >= 0.05:
return
return None

@pytest.mark.skipif(
CI_TESTING and OPENBSD, reason="unreliable on OPENBSD + CI"
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ select = [
"D301", # Use `r"""` if any backslashes in a docstring
"D403", # [*] First word of the first line should be capitalized
"PERF102", # [*] When using only the keys of a dict use the `keys()` method
"RET502", # [*] Do not implicitly `return None` in function able to return non-`None` value
"RET506", # [*] Unnecessary `else` after `raise` statement
"RET507", # Unnecessary `elif` after `continue` statement
"S113", # Probable use of requests call without timeout
Expand Down
2 changes: 1 addition & 1 deletion scripts/fans.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def main():
fans = psutil.sensors_fans()
if not fans:
print("no fans detected")
return
return None
for name, entries in fans.items():
print(name)
for entry in entries:
Expand Down

0 comments on commit b42eccd

Please sign in to comment.