File tree Expand file tree Collapse file tree 3 files changed +35
-4
lines changed
labelbox/data/annotation_types Expand file tree Collapse file tree 3 files changed +35
-4
lines changed Original file line number Diff line number Diff line change @@ -29,18 +29,30 @@ class ClassificationAnswer(FeatureSchema):
2929
3030
3131class Radio (BaseModel ):
32- """ A classification with only one selected option allowed """
32+ """ A classification with only one selected option allowed
33+
34+ >>> Radio(answer = ClassificationAnswer(name = "dog"))
35+
36+ """
3337 answer : ClassificationAnswer
3438
3539
3640class Checklist (_TempName ):
37- """ A classification with many selected options allowed """
41+ """ A classification with many selected options allowed
42+
43+ >>> Checklist(answer = [ClassificationAnswer(name = "cloudy")])
44+
45+ """
3846 name : Literal ["checklist" ] = "checklist"
3947 answer : List [ClassificationAnswer ]
4048
4149
4250class Text (BaseModel ):
43- """ Free form text """
51+ """ Free form text
52+
53+ >>> Text(answer = "some text answer")
54+
55+ """
4456 answer : str
4557
4658
Original file line number Diff line number Diff line change 99
1010class TextData (BaseData ):
1111 """
12- Represents text data
12+ Represents text data. Requires arg file_path, text, or url
13+
14+ >>> TextData(text="")
15+
16+ Args:
17+ file_path (str)
18+ text (str)
19+ url (str)
1320 """
1421 file_path : Optional [str ] = None
1522 text : Optional [str ] = None
Original file line number Diff line number Diff line change 33import geojson
44import numpy as np
55import cv2
6+ from pydantic import validator
67
78from .point import Point
89from .geometry import Geometry
@@ -14,6 +15,8 @@ class Line(Geometry):
1415 Args:
1516 points (List[Point]): A list of `Point` geometries
1617
18+ >>> Line(points = [Point(x=3,y=4), Point(x=3,y=5)])
19+
1720 """
1821 points : List [Point ]
1922
@@ -47,3 +50,12 @@ def draw(self,
4750 False ,
4851 color = color ,
4952 thickness = thickness )
53+
54+ @validator ('points' )
55+ def is_geom_valid (cls , points ):
56+ if len (points ) < 2 :
57+ raise ValueError (
58+ f"A line must have at least 2 points to be valid. Found { points } "
59+ )
60+
61+ return points
You can’t perform that action at this time.
0 commit comments