Skip to content

Commit

Permalink
RFC: flatten logic tree
Browse files Browse the repository at this point in the history
  • Loading branch information
neutrinoceros committed Nov 25, 2024
1 parent 6505bdf commit d6970ec
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/idefix_cli/_commands/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,13 +146,12 @@ def get_cpu_count() -> int:
base_cpu_count: int | None
if sys.version_info >= (3, 13):
base_cpu_count = os.process_cpu_count()
elif hasattr(os, "sched_getaffinity"):
# this function isn't available on all platforms
base_cpu_count = len(os.sched_getaffinity(0))
else:
if hasattr(os, "sched_getaffinity"):
# this function isn't available on all platforms
base_cpu_count = len(os.sched_getaffinity(0))
else:
# this proxy is good enough in most situations
base_cpu_count = os.cpu_count()
# this proxy is good enough in most situations
base_cpu_count = os.cpu_count()
return base_cpu_count or 1


Expand Down

0 comments on commit d6970ec

Please sign in to comment.