File tree Expand file tree Collapse file tree 2 files changed +11
-1
lines changed
libs/labelbox/src/labelbox/data Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change 1
1
from typing import Union , Optional
2
- from pydantic import BaseModel
2
+ from pydantic import BaseModel , model_validator
3
3
from enum import Enum
4
+ import warnings
4
5
from labelbox .data .annotation_types .annotation import (
5
6
BaseAnnotation ,
6
7
ObjectAnnotation ,
@@ -18,6 +19,14 @@ class Type(Enum):
18
19
type : Type = Type .UNIDIRECTIONAL
19
20
readonly : Optional [bool ] = None
20
21
22
+ @model_validator (mode = 'after' )
23
+ def check_readonly (self ):
24
+ if self .readonly is True :
25
+ warnings .warn (
26
+ "Creating a relationship with readonly=True is in beta and its behavior may change in future releases." ,
27
+ )
28
+ return self
29
+
21
30
22
31
class RelationshipAnnotation (BaseAnnotation ):
23
32
value : Relationship
Original file line number Diff line number Diff line change @@ -31,6 +31,7 @@ def to_common(
31
31
source = source ,
32
32
target = target ,
33
33
type = Relationship .Type (annotation .relationship .type ),
34
+ readonly = annotation .relationship .readonly ,
34
35
),
35
36
extra = {"uuid" : annotation .uuid },
36
37
feature_schema_id = annotation .schema_id ,
You can’t perform that action at this time.
0 commit comments