Skip to content

Commit 864519d

Browse files
committed
[Python] Add documentation to the new context managers
1 parent 61d0b1b commit 864519d

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/controller/python/chip/ChipDeviceCtrl.py

+11
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,12 @@ def wrapper(*args, **kwargs):
227227

228228

229229
class CallbackContext:
230+
"""A context manager for handling callbacks that are expected to be called exactly once.
231+
232+
The context manager makes sure that no concurrent operations which use the same callback
233+
handlers are executed.
234+
"""
235+
230236
def __init__(self, lock: asyncio.Lock) -> None:
231237
self._lock = lock
232238
self._future = None
@@ -248,6 +254,11 @@ async def __aexit__(self, exc_type, exc_value, traceback):
248254

249255

250256
class CommissioningContext(CallbackContext):
257+
"""A context manager for handling commissioning callbacks that are expected to be called exactly once.
258+
259+
This context also resets commissioning related device controller state.
260+
"""
261+
251262
def __init__(self, devCtrl: ChipDeviceController, lock: asyncio.Lock) -> None:
252263
super().__init__(lock)
253264
self._devCtrl = devCtrl

0 commit comments

Comments
 (0)