Skip to content

Commit dad310f

Browse files
committed
refact(conf) tri-state enables without args; doc
1 parent bae13da commit dad310f

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

graphtik/config.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ def _tristate_set(context_var, enabled):
5858

5959

6060
@contextmanager
61-
def _tristate_armed(context_var: ContextVar, enabled):
61+
def _tristate_armed(context_var: ContextVar, enabled=True):
62+
"""Assumes "enabled" if `enabled` flag is None."""
6263
resetter = context_var.set(enabled if enabled is None else bool(enabled))
6364
try:
6465
yield
@@ -70,7 +71,7 @@ def _tristate_armed(context_var: ContextVar, enabled):
7071
"""
7172
Like :func:`set_debug()` as a context-manager, resetting back to old value.
7273
73-
.. seealso:: disclaimer about context-managers the top of this :mod:`.config` module.
74+
.. seealso:: disclaimer about context-managers at the top of this :mod:`.config` module.
7475
"""
7576
is_debug = partial(_getter, _debug)
7677
"""
@@ -139,7 +140,7 @@ def is_abort():
139140
"""
140141
Like :func:`set_skip_evictions()` as a context-manager, resetting back to old value.
141142
142-
.. seealso:: disclaimer about context-managers the top of this :mod:`.config` module.
143+
.. seealso:: disclaimer about context-managers at the top of this :mod:`.config` module.
143144
"""
144145
is_skip_evictions = partial(_getter, _skip_evictions)
145146
"""see :func:`set_skip_evictions()`"""
@@ -158,7 +159,7 @@ def is_abort():
158159
"""
159160
Like :func:`set_layered_solution()` as a context-manager, resetting back to old value.
160161
161-
.. seealso:: disclaimer about context-managers the top of this :mod:`.config` module.
162+
.. seealso:: disclaimer about context-managers at the top of this :mod:`.config` module.
162163
"""
163164
is_layered_solution = partial(_getter, _layered_solution)
164165
"""see :func:`set_layered_solution()`"""
@@ -184,7 +185,7 @@ def execution_pool_plugged(pool: "Optional[Pool]"):
184185
"""
185186
Like :func:`set_execution_pool()` as a context-manager, resetting back to old value.
186187
187-
.. seealso:: disclaimer about context-managers the top of this :mod:`.config` module.
188+
.. seealso:: disclaimer about context-managers at the top of this :mod:`.config` module.
188189
"""
189190
resetter = _execution_pool.set(pool)
190191
try:
@@ -212,7 +213,7 @@ def get_execution_pool() -> "Optional[Pool]":
212213
"""
213214
(deprecated) Like :func:`set_parallel_tasks()` as a context-manager, resetting back to old value.
214215
215-
.. seealso:: disclaimer about context-managers the top of this :mod:`.config` module.
216+
.. seealso:: disclaimer about context-managers at the top of this :mod:`.config` module.
216217
"""
217218
is_parallel_tasks = partial(_getter, _parallel_tasks)
218219
"""see :func:`set_parallel_tasks()`"""
@@ -233,7 +234,7 @@ def get_execution_pool() -> "Optional[Pool]":
233234
"""
234235
(deprecated) Like :func:`set_marshal_tasks()` as a context-manager, resetting back to old value.
235236
236-
.. seealso:: disclaimer about context-managers the top of this :mod:`.config` module.
237+
.. seealso:: disclaimer about context-managers at the top of this :mod:`.config` module.
237238
"""
238239
is_marshal_tasks = partial(_getter, _marshal_tasks)
239240
"""(deprecated) see :func:`set_marshal_tasks()`"""
@@ -256,7 +257,7 @@ def get_execution_pool() -> "Optional[Pool]":
256257
"""
257258
Like :func:`set_endure_operations()` as a context-manager, resetting back to old value.
258259
259-
.. seealso:: disclaimer about context-managers the top of this :mod:`.config` module.
260+
.. seealso:: disclaimer about context-managers at the top of this :mod:`.config` module.
260261
"""
261262
is_endure_operations = partial(_getter, _endure_operations)
262263
"""see :func:`set_endure_operations()`"""
@@ -278,7 +279,7 @@ def get_execution_pool() -> "Optional[Pool]":
278279
"""
279280
Like :func:`set_reschedule_operations()` as a context-manager, resetting back to old value.
280281
281-
.. seealso:: disclaimer about context-managers the top of this :mod:`.config` module.
282+
.. seealso:: disclaimer about context-managers at the top of this :mod:`.config` module.
282283
"""
283284
is_reschedule_operations = partial(_getter, _reschedule_operations)
284285
"""see :func:`set_reschedule_operations()`"""

0 commit comments

Comments
 (0)