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

feat: allow specifying sourceless markers from dsrc #274

Merged
merged 1 commit into from
Feb 8, 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
17 changes: 17 additions & 0 deletions labsdk/raptor/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,23 @@ def feature(
if not isinstance(keys, List):
keys = [keys]

if data_source is not None:
if hasattr(data_source, 'raptor_spec'):
if not isinstance(data_source.raptor_spec, DataSourceSpec):
raise Exception(
'data_source decorator must be used on a class that extends typing_extensions.TypedDict')
elif not isinstance(data_source, str):
raise Exception('data_source must be a string or a DataSource class')

if sourceless_markers_df is not None:
if hasattr(sourceless_markers_df, 'raptor_spec'):
if isinstance(sourceless_markers_df.raptor_spec, DataSourceSpec):
sourceless_markers_df = sourceless_markers_df.raptor_spec.local_df
else:
raise Exception('sourceless_markers_df must be a pandas.DataFrame or a DataSource class')
elif not isinstance(sourceless_markers_df, DataFrame):
raise Exception('sourceless_markers_df must be a pandas.DataFrame or a DataSource class')

@_wrap_decorator_err
def decorator(func):
nonlocal name
Expand Down