Skip to content

Commit 04b5868

Browse files
authored
DATA-1813 Add method to get fromDataManagement value from extra map in python SDK (#416)
1 parent 93293e0 commit 04b5868

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/viam/utils.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,3 +255,12 @@ async def to_thread(func: Callable[_P, _R], *args: _P.args, **kwargs: _P.kwargs)
255255
ctx = contextvars.copy_context()
256256
func_call = functools.partial(ctx.run, func, *args, **kwargs)
257257
return await loop.run_in_executor(None, func_call) # type: ignore
258+
259+
260+
def from_dm_from_extra(extra: Optional[Dict[str, Any]]) -> bool:
261+
"""Used in modular filter components to get the 'fromDataManagement' value from an extra map.
262+
"""
263+
if extra is None:
264+
return False
265+
266+
return bool(extra["fromDataManagement"])

0 commit comments

Comments
 (0)