|
11 | 11 | import abc |
12 | 12 | import itertools as itt |
13 | 13 | import logging |
| 14 | +import re |
14 | 15 | import textwrap |
15 | 16 | from collections import abc as cabc |
16 | 17 | from functools import wraps |
|
27 | 28 | Token, |
28 | 29 | aslist, |
29 | 30 | astuple, |
| 31 | + first_solid, |
30 | 32 | func_name, |
31 | 33 | jetsam, |
32 | 34 | ) |
33 | | -from .config import ( |
34 | | - first_solid, |
35 | | - is_debug, |
36 | | - is_endure_operations, |
37 | | - is_marshal_tasks, |
38 | | - is_parallel_tasks, |
39 | | - is_reschedule_operations, |
40 | | - reset_abort, |
41 | | -) |
42 | 35 | from .modifiers import ( |
43 | 36 | dep_singularized, |
44 | 37 | dep_stripped, |
@@ -352,6 +345,15 @@ def __repr__(self): |
352 | 345 | """ |
353 | 346 | Display more informative names for the Operation class |
354 | 347 | """ |
| 348 | + from .config import ( |
| 349 | + is_debug, |
| 350 | + is_endure_operations, |
| 351 | + is_marshal_tasks, |
| 352 | + is_parallel_tasks, |
| 353 | + is_reschedule_operations, |
| 354 | + reset_abort, |
| 355 | + ) |
| 356 | + |
355 | 357 | needs = aslist(self.needs, "needs") |
356 | 358 | provides = aslist(self.provides, "provides") |
357 | 359 | aliases = aslist(self.aliases, "aliases") |
@@ -386,6 +388,7 @@ def deps(self) -> Mapping[str, Collection]: |
386 | 388 |
|
387 | 389 | if not DEBUG, all deps are converted into lists, ready to be printed. |
388 | 390 | """ |
| 391 | + from .config import is_debug |
389 | 392 |
|
390 | 393 | return { |
391 | 394 | k: v if is_debug() else list(v) |
@@ -423,6 +426,8 @@ def _prepare_match_inputs_error( |
423 | 426 | varargs_bad: List, |
424 | 427 | named_inputs: Mapping, |
425 | 428 | ) -> ValueError: |
| 429 | + from .config import is_debug |
| 430 | + |
426 | 431 | errors = [ |
427 | 432 | f"Need({n}) failed due to: {type(nex).__name__}({nex})" |
428 | 433 | for n, nex in enumerate(exceptions, 1) |
@@ -498,6 +503,8 @@ def _match_inputs_with_fn_needs(self, named_inputs) -> Tuple[list, list, dict]: |
498 | 503 |
|
499 | 504 | def _zip_results_with_provides(self, results) -> dict: |
500 | 505 | """Zip results with expected "real" (without sideffects) `provides`.""" |
| 506 | + from .config import is_reschedule_operations |
| 507 | + |
501 | 508 | fn_expected: iset = self._fn_provides |
502 | 509 | rescheduled = first_solid(is_reschedule_operations(), self.rescheduled) |
503 | 510 | if self.returns_dict: |
@@ -936,6 +943,7 @@ def __repr__(self): |
936 | 943 | """ |
937 | 944 | Display more informative names for the Operation class |
938 | 945 | """ |
| 946 | + from .config import is_debug |
939 | 947 | from .network import yield_ops |
940 | 948 |
|
941 | 949 | clsname = type(self).__name__ |
@@ -1142,6 +1150,8 @@ def compute( |
1142 | 1150 |
|
1143 | 1151 | See also :meth:`.Operation.compute()`. |
1144 | 1152 | """ |
| 1153 | + from .config import reset_abort |
| 1154 | + |
1145 | 1155 | try: |
1146 | 1156 | if named_inputs is UNSET: |
1147 | 1157 | named_inputs = {} |
|
0 commit comments