MCPcopy
hub / github.com/langroid/langroid / worker

Function worker

tests/main/test_global_settings.py:126–138  ·  view source on GitHub ↗
(index: int)

Source from the content-addressed store, hash-verified

124 results = [None, None]
125
126 def worker(index: int):
127 # Define a temporary override that forces quiet=True.
128 temp = Settings(quiet=True)
129 with temporary_settings(temp):
130 # While inside the context, the settings should be overridden.
131 assert settings.quiet is True
132 # Wait until both threads are here.
133 barrier.wait()
134 # Sleep briefly to let interleaving happen.
135 time.sleep(0.01)
136 # After the context, we expect the global setting to be restored.
137 results[index] = settings.quiet
138 # If a race occurred in the old implementation, the restored value may be wrong.
139
140 threads = []
141 for i in range(2):

Callers

nothing calls this directly

Calls 2

SettingsClass · 0.90
temporary_settingsFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…