Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DATA-1813 Add method to get fromDataManagement value from extra map in python SDK #416

Merged
merged 2 commits into from
Aug 31, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/viam/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,3 +255,12 @@ async def to_thread(func: Callable[_P, _R], *args: _P.args, **kwargs: _P.kwargs)
ctx = contextvars.copy_context()
func_call = functools.partial(ctx.run, func, *args, **kwargs)
return await loop.run_in_executor(None, func_call) # type: ignore


def from_dm_from_extra(extra: Optional[Dict[str, Any]]) -> bool:
"""Used in modular filter components to get the 'fromDataManagement' value from an extra map.
"""
if extra is None:
return False

return bool(extra["fromDataManagement"])
Loading