Fix mypy on MacOS

This commit is contained in:
Max R 2023-09-09 21:54:47 -04:00
parent 5f4b828999
commit da2b6e6cc4
2 changed files with 19 additions and 20 deletions

View file

@ -24,13 +24,11 @@ TRet = TypeVar('TRet')
def cpu_count() -> int:
try:
# On systems that support it, this will return a more accurate count of
# usable CPUs for the current process, which will take into account
# cgroup limits
# On systems that support it, this will return a more accurate count of
# usable CPUs for the current process, which will take into account
# cgroup limits
if hasattr(os, 'sched_getaffinity'):
return len(os.sched_getaffinity(0))
except AttributeError:
pass
try:
return multiprocessing.cpu_count()