MCPcopy Create free account
hub / github.com/dask/dask / _array_expr_enabled

Function _array_expr_enabled

dask/array/__init__.py:11–38  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

9
10
11def _array_expr_enabled() -> builtins.bool:
12 import dask
13
14 global ARRAY_EXPR_ENABLED
15
16 use_array_expr: builtins.bool | None = dask.config.get("array.query-planning")
17 if use_array_expr is None:
18 use_array_expr = False # Eventually, this default will flip to True
19 if not isinstance(use_array_expr, builtins.bool):
20 # Guard against "false" string in YAML config, which would evaluate to True
21 raise TypeError( # pragma: no cover
22 "The 'array.query-planning' config must be True, False, or None"
23 )
24
25 if ARRAY_EXPR_ENABLED is None:
26 ARRAY_EXPR_ENABLED = use_array_expr
27 return use_array_expr
28
29 if use_array_expr != ARRAY_EXPR_ENABLED:
30 warnings.warn(
31 "The 'array.query-planning' config is now set to "
32 f"{use_array_expr}, but query planning is already "
33 f"{'enabled' if ARRAY_EXPR_ENABLED else 'disabled'}. "
34 "The query-planning config can only be changed before "
35 "`dask.array` is first imported!",
36 RuntimeWarning,
37 )
38 return ARRAY_EXPR_ENABLED
39
40
41def array_expr_enabled() -> builtins.bool:

Callers 5

test_array_expr_enabledFunction · 0.90
test_flip_configFunction · 0.90
test_str_configFunction · 0.90
array_expr_enabledFunction · 0.85
__init__.pyFile · 0.85

Calls 1

getMethod · 0.45

Tested by 3

test_array_expr_enabledFunction · 0.72
test_flip_configFunction · 0.72
test_str_configFunction · 0.72