File tree Expand file tree Collapse file tree 3 files changed +36
-6
lines changed
labelbox/data/annotation_types Expand file tree Collapse file tree 3 files changed +36
-6
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 @@ -14,13 +14,15 @@ class Line(Geometry):
1414 Args:
1515 points (List[Point]): A list of `Point` geometries
1616
17+ >>> Line(points = [Point(x=3,y=4), Point(x=3,y=5)])
18+
1719 """
1820 points : List [Point ]
1921
2022 @property
2123 def geometry (self ) -> geojson .MultiLineString :
22- return geojson .MultiLineString (
23- [[[ point . x , point . y ] for point in self .points ]])
24+ return geojson .MultiLineString ([[[ point . x , point . y ]
25+ for point in self .points ]])
2426
2527 def draw (self ,
2628 height : Optional [int ] = None ,
@@ -47,3 +49,12 @@ def draw(self,
4749 False ,
4850 color = color ,
4951 thickness = thickness )
52+
53+ @validator ('points' )
54+ def is_geom_valid (cls , points ):
55+ if len (points ) < 2 :
56+ raise ValueError (
57+ f"A line must have at least 2 points to be valid. Found { points } "
58+ )
59+
60+ return points
You can’t perform that action at this time.
0 commit comments