Get the number of CPUs.
()
| 2 | |
| 3 | |
| 4 | def cpu_count() -> int: |
| 5 | """Get the number of CPUs.""" |
| 6 | # Force sequential execution if NO_PARALLEL is set |
| 7 | no_parallel = os.environ.get("NO_PARALLEL", "0") in ["1", "true", "True"] |
| 8 | if no_parallel: |
| 9 | return 1 |
| 10 | return os.cpu_count() or 1 |
no test coverage detected