File tree Expand file tree Collapse file tree 2 files changed +5
-9
lines changed
libs/labelbox/src/labelbox Expand file tree Collapse file tree 2 files changed +5
-9
lines changed Original file line number Diff line number Diff line change 7
7
from packaging import version
8
8
import numpy as np
9
9
10
- from pydantic import Field
10
+ from pydantic import ValidationInfo
11
11
12
12
Cuid = Annotated [str , StringConstraints (min_length = 25 , max_length = 25 )]
13
13
@@ -22,14 +22,11 @@ def __get_validators__(cls):
22
22
yield cls .validate
23
23
24
24
@classmethod
25
- def validate (cls , val , field : pydantic_compat . ModelField ):
25
+ def validate (cls , val , field : ValidationInfo ):
26
26
if not isinstance (val , np .ndarray ):
27
27
raise TypeError (f"Expected numpy array. Found { type (val )} " )
28
28
29
- if sys .version_info .minor > 6 :
30
- actual_dtype = field .sub_fields [- 1 ].type_ .__args__ [0 ]
31
- else :
32
- actual_dtype = field .sub_fields [- 1 ].type_ .__values__ [0 ]
29
+ actual_dtype = field .sub_fields [- 1 ].type_ .__args__ [0 ]
33
30
34
31
if val .dtype != actual_dtype :
35
32
raise TypeError (
Original file line number Diff line number Diff line change @@ -40,9 +40,8 @@ class DataRowMetadataSchema(BaseModel):
40
40
41
41
DataRowMetadataSchema .update_forward_refs ()
42
42
43
- Embedding : Type [List [float ]] = Annotated [List [float ], Field (
44
- min_items = 128 ,
45
- max_items = 128 )]
43
+ Embedding : Type [List [float ]] = Annotated [List [float ],
44
+ Field (min_items = 128 , max_items = 128 )]
46
45
String : Type [str ] = Annotated [List [str ], Field (max_length = 4096 )]
47
46
48
47
You can’t perform that action at this time.
0 commit comments