|
21 | 21 |
|
22 | 22 | """ |
23 | 23 |
|
24 | | -from typing import TYPE_CHECKING, Final |
| 24 | +from numexpr.interpreter import __BLOCK_SIZE1__, MAX_THREADS, use_vml |
25 | 25 |
|
26 | | -if TYPE_CHECKING: |
27 | | - import unittest |
28 | | - |
29 | | -# the `import _ as _` are needed for mypy to understand these are re-exports |
30 | | - |
31 | | -from numexpr.interpreter import __BLOCK_SIZE1__ as __BLOCK_SIZE1__ |
32 | | -from numexpr.interpreter import MAX_THREADS as MAX_THREADS |
33 | | -from numexpr.interpreter import use_vml as use_vml |
34 | | - |
35 | | -is_cpu_amd_intel: Final = False # DEPRECATION WARNING: WILL BE REMOVED IN FUTURE RELEASE |
| 26 | +is_cpu_amd_intel = False # DEPRECATION WARNING: WILL BE REMOVED IN FUTURE RELEASE |
36 | 27 |
|
37 | 28 | # cpuinfo imports were moved into the test submodule function that calls them |
38 | 29 | # to improve import times. |
39 | 30 |
|
40 | | -from numexpr.expressions import E as E |
41 | | -from numexpr.necompiler import NumExpr as NumExpr |
42 | | -from numexpr.necompiler import disassemble as disassemble |
43 | | -from numexpr.necompiler import evaluate as evaluate |
44 | | -from numexpr.necompiler import re_evaluate as re_evaluate |
45 | | -from numexpr.necompiler import validate as validate |
46 | | -from numexpr.utils import _init_num_threads |
47 | | -from numexpr.utils import detect_number_of_cores as detect_number_of_cores |
48 | | -from numexpr.utils import detect_number_of_threads as detect_number_of_threads |
49 | | -from numexpr.utils import get_num_threads as get_num_threads |
50 | | -from numexpr.utils import get_vml_version as get_vml_version |
51 | | -from numexpr.utils import set_num_threads as set_num_threads |
52 | | -from numexpr.utils import set_vml_accuracy_mode as set_vml_accuracy_mode |
53 | | -from numexpr.utils import set_vml_num_threads as set_vml_num_threads |
| 31 | +from numexpr.expressions import E |
| 32 | +from numexpr.necompiler import (NumExpr, disassemble, evaluate, re_evaluate, |
| 33 | + validate) |
| 34 | +from numexpr.utils import (_init_num_threads, detect_number_of_cores, |
| 35 | + detect_number_of_threads, get_num_threads, |
| 36 | + get_vml_version, set_num_threads, |
| 37 | + set_vml_accuracy_mode, set_vml_num_threads) |
54 | 38 |
|
55 | 39 | # Detect the number of cores |
56 | | -ncores: Final = detect_number_of_cores() |
| 40 | +ncores = detect_number_of_cores() |
57 | 41 | # Initialize the number of threads to be used |
58 | | -nthreads: Final = _init_num_threads() |
| 42 | +nthreads = _init_num_threads() |
59 | 43 | # The default for VML is 1 thread (see #39) |
60 | 44 | # set_vml_num_threads(1) |
61 | 45 |
|
62 | | -from . import version as version |
| 46 | +from . import version |
63 | 47 |
|
64 | | -__version__: Final = version.version |
| 48 | +__version__ = version.version |
65 | 49 |
|
66 | | -def print_versions() -> None: |
| 50 | +def print_versions(): |
67 | 51 | """Print the versions of software that numexpr relies on.""" |
68 | 52 | try: |
69 | 53 | import numexpr.tests |
70 | | - return numexpr.tests.print_versions() # type: ignore[no-untyped-call] |
| 54 | + return numexpr.tests.print_versions() |
71 | 55 | except ImportError: |
72 | 56 | # To maintain Python 2.6 compatibility we have simple error handling |
73 | 57 | raise ImportError('`numexpr.tests` could not be imported, likely it was excluded from the distribution.') |
74 | 58 |
|
75 | | -def test(verbosity: int = 1) -> "unittest.result.TestResult": |
| 59 | +def test(verbosity=1): |
76 | 60 | """Run all the tests in the test suite.""" |
77 | 61 | try: |
78 | 62 | import numexpr.tests |
79 | | - return numexpr.tests.test(verbosity=verbosity) # type: ignore[no-untyped-call] |
| 63 | + return numexpr.tests.test(verbosity=verbosity) |
80 | 64 | except ImportError: |
81 | 65 | # To maintain Python 2.6 compatibility we have simple error handling |
82 | 66 | raise ImportError('`numexpr.tests` could not be imported, likely it was excluded from the distribution.') |
0 commit comments