@@ -48,23 +48,24 @@ def to_common(self) -> Point:
4848 return Point (x = self .point .x , y = self .point .y )
4949
5050 @classmethod
51- def from_common (cls , point : Point ,
52- classifications : List [ClassificationAnnotation ], name : str ,
53- feature_schema_id : Cuid , extra : Dict [str , Any ],
51+ def from_common (cls ,
52+ point : Point ,
53+ classifications : List [ClassificationAnnotation ],
54+ name : str ,
55+ feature_schema_id : Cuid ,
56+ extra : Dict [str , Any ],
5457 data : Union [ImageData , TextData ],
55- confidence : Optional [float ] = None
56- ) -> "NDPoint" :
58+ confidence : Optional [float ] = None ) -> "NDPoint" :
5759 return cls (point = {
5860 'x' : point .x ,
5961 'y' : point .y
6062 },
61- dataRow = DataRow (id = data .uid ),
62- name = name ,
63- schema_id = feature_schema_id ,
64- uuid = extra .get ('uuid' ),
65- classifications = classifications ,
66- confidence = confidence
67- )
63+ dataRow = DataRow (id = data .uid ),
64+ name = name ,
65+ schema_id = feature_schema_id ,
66+ uuid = extra .get ('uuid' ),
67+ classifications = classifications ,
68+ confidence = confidence )
6869
6970
7071class NDFramePoint (VideoSupported ):
@@ -100,11 +101,11 @@ def from_common(cls, line: Line,
100101 'x' : pt .x ,
101102 'y' : pt .y
102103 } for pt in line .points ],
103- dataRow = DataRow (id = data .uid ),
104- name = name ,
105- schema_id = feature_schema_id ,
106- uuid = extra .get ('uuid' ),
107- classifications = classifications )
104+ dataRow = DataRow (id = data .uid ),
105+ name = name ,
106+ schema_id = feature_schema_id ,
107+ uuid = extra .get ('uuid' ),
108+ classifications = classifications )
108109
109110
110111class NDFrameLine (VideoSupported ):
@@ -136,23 +137,24 @@ def to_common(self) -> Polygon:
136137 return Polygon (points = [Point (x = pt .x , y = pt .y ) for pt in self .polygon ])
137138
138139 @classmethod
139- def from_common (cls , polygon : Polygon ,
140- classifications : List [ClassificationAnnotation ], name : str ,
141- feature_schema_id : Cuid , extra : Dict [str , Any ],
140+ def from_common (cls ,
141+ polygon : Polygon ,
142+ classifications : List [ClassificationAnnotation ],
143+ name : str ,
144+ feature_schema_id : Cuid ,
145+ extra : Dict [str , Any ],
142146 data : Union [ImageData , TextData ],
143- confidence : Optional [float ] = None
144- ) -> "NDPolygon" :
147+ confidence : Optional [float ] = None ) -> "NDPolygon" :
145148 return cls (polygon = [{
146149 'x' : pt .x ,
147150 'y' : pt .y
148151 } for pt in polygon .points ],
149- dataRow = DataRow (id = data .uid ),
150- name = name ,
151- schema_id = feature_schema_id ,
152- uuid = extra .get ('uuid' ),
153- classifications = classifications ,
154- confidence = confidence
155- )
152+ dataRow = DataRow (id = data .uid ),
153+ name = name ,
154+ schema_id = feature_schema_id ,
155+ uuid = extra .get ('uuid' ),
156+ classifications = classifications ,
157+ confidence = confidence )
156158
157159
158160class NDRectangle (NDBaseObject , ConfidenceMixin ):
@@ -164,9 +166,12 @@ def to_common(self) -> Rectangle:
164166 y = self .bbox .top + self .bbox .height ))
165167
166168 @classmethod
167- def from_common (cls , rectangle : Rectangle ,
168- classifications : List [ClassificationAnnotation ], name : str ,
169- feature_schema_id : Cuid , extra : Dict [str , Any ],
169+ def from_common (cls ,
170+ rectangle : Rectangle ,
171+ classifications : List [ClassificationAnnotation ],
172+ name : str ,
173+ feature_schema_id : Cuid ,
174+ extra : Dict [str , Any ],
170175 data : Union [ImageData , TextData ],
171176 confidence : Optional [float ] = None ) -> "NDRectangle" :
172177 return cls (bbox = Bbox (top = rectangle .start .y ,
@@ -180,8 +185,7 @@ def from_common(cls, rectangle: Rectangle,
180185 classifications = classifications ,
181186 page = extra .get ('page' ),
182187 unit = extra .get ('unit' ),
183- confidence = confidence
184- )
188+ confidence = confidence )
185189
186190
187191class NDFrameRectangle (VideoSupported ):
@@ -304,15 +308,17 @@ def to_common(self) -> Mask:
304308 return Mask (mask = MaskData .from_2D_arr (image ), color = (1 , 1 , 1 ))
305309
306310 @classmethod
307- def from_common (cls , mask : Mask ,
308- classifications : List [ClassificationAnnotation ], name : str ,
309- feature_schema_id : Cuid , extra : Dict [str , Any ],
311+ def from_common (cls ,
312+ mask : Mask ,
313+ classifications : List [ClassificationAnnotation ],
314+ name : str ,
315+ feature_schema_id : Cuid ,
316+ extra : Dict [str , Any ],
310317 data : Union [ImageData , TextData ],
311318 confidence : Optional [float ] = None ) -> "NDMask" :
312319
313320 if mask .mask .url is not None :
314- lbv1_mask = _URIMask (
315- instanceURI = mask .mask .url , colorRGB = mask .color )
321+ lbv1_mask = _URIMask (instanceURI = mask .mask .url , colorRGB = mask .color )
316322 else :
317323 binary = np .all (mask .mask .value == mask .color , axis = - 1 )
318324 im_bytes = BytesIO ()
@@ -326,8 +332,7 @@ def from_common(cls, mask: Mask,
326332 schema_id = feature_schema_id ,
327333 uuid = extra .get ('uuid' ),
328334 classifications = classifications ,
329- confidence = confidence
330- )
335+ confidence = confidence )
331336
332337
333338class Location (BaseModel ):
@@ -350,11 +355,11 @@ def from_common(cls, text_entity: TextEntity,
350355 start = text_entity .start ,
351356 end = text_entity .end ,
352357 ),
353- dataRow = DataRow (id = data .uid ),
354- name = name ,
355- schema_id = feature_schema_id ,
356- uuid = extra .get ('uuid' ),
357- classifications = classifications )
358+ dataRow = DataRow (id = data .uid ),
359+ name = name ,
360+ schema_id = feature_schema_id ,
361+ uuid = extra .get ('uuid' ),
362+ classifications = classifications )
358363
359364
360365class NDObject :
@@ -366,8 +371,8 @@ def to_common(annotation: "NDObjectType") -> ObjectAnnotation:
366371 NDSubclassification .to_common (annot )
367372 for annot in annotation .classifications
368373 ]
369- confidence = annotation .confidence if hasattr (
370- annotation , 'confidence' ) else None
374+ confidence = annotation .confidence if hasattr (annotation ,
375+ 'confidence' ) else None
371376 return ObjectAnnotation (value = common_annotation ,
372377 name = annotation .name ,
373378 feature_schema_id = annotation .schema_id ,
@@ -377,8 +382,7 @@ def to_common(annotation: "NDObjectType") -> ObjectAnnotation:
377382 'page' : annotation .page ,
378383 'unit' : annotation .unit
379384 },
380- confidence = confidence
381- )
385+ confidence = confidence )
382386
383387 @classmethod
384388 def from_common (
0 commit comments