Skip to content

Commit ac91670

Browse files
committed
Add a comment to create_relationship_annotations function
1 parent e4a9628 commit ac91670

File tree

1 file changed

+14
-0
lines changed
  • libs/labelbox/src/labelbox/data/serialization/ndjson

1 file changed

+14
-0
lines changed

libs/labelbox/src/labelbox/data/serialization/ndjson/label.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,20 @@ def _create_non_video_annotations(cls, label: Label):
188188
def _create_relationship_annotations(
189189
cls, label: Label
190190
) -> Generator[NDRelationship, None, None]:
191+
"""Creates relationship annotations following validation rules for source and target types.
192+
193+
Args:
194+
label: Label containing relationship annotations to be processed
195+
196+
Yields:
197+
NDRelationship: Validated relationship annotations in NDJSON format
198+
199+
Raises:
200+
TypeError: If source/target types violate the validation rules:
201+
- Invalid source type for PDF target
202+
- Non-ObjectAnnotation source for non-PDF target
203+
- Non-ObjectAnnotation target
204+
"""
191205
for annotation in label.annotations:
192206
if isinstance(annotation, RelationshipAnnotation):
193207
uuid1 = uuid4()

0 commit comments

Comments
 (0)