| Conditions | 2 |
| Total Lines | 13 |
| Code Lines | 5 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 1 |
| CRAP Score | 4.048 |
| Changes | 0 | ||
| 1 | 1 | from __future__ import absolute_import |
|
| 24 | 1 | def get_cpu_count(): |
|
| 25 | """ |
||
| 26 | Returns the most likely estimate of the number of CPUs in the machine |
||
| 27 | for threading purposes, gracefully handling errors and possible |
||
| 28 | exceptions. |
||
| 29 | """ |
||
| 30 | |||
| 31 | try: |
||
| 32 | return max(1, multiprocessing.cpu_count()) |
||
| 33 | |||
| 34 | except NotImplementedError: |
||
| 35 | # 2 CPUs is the most probable |
||
| 36 | return 2 |
||
| 37 | |||
| 49 |
The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:
If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.