File tree Expand file tree Collapse file tree 4 files changed +4
-8
lines changed
labelbox/data/annotation_types/geometry Expand file tree Collapse file tree 4 files changed +4
-8
lines changed Original file line number Diff line number Diff line change 1
- from __future__ import annotations
2
1
from typing import List , Optional , Union , Tuple
3
2
4
3
import geojson
@@ -28,7 +27,7 @@ def geometry(self) -> geojson.MultiLineString:
28
27
[[[point .x , point .y ] for point in self .points ]])
29
28
30
29
@classmethod
31
- def from_shapely (cls , shapely_obj : SLineString ) -> Line :
30
+ def from_shapely (cls , shapely_obj : SLineString ) -> " Line" :
32
31
"""Transforms a shapely object."""
33
32
if not isinstance (shapely_obj , SLineString ):
34
33
raise TypeError (
Original file line number Diff line number Diff line change 1
- from __future__ import annotations
2
1
from typing import Optional , Tuple , Union
3
2
4
3
import geojson
@@ -27,7 +26,7 @@ def geometry(self) -> geojson.Point:
27
26
return geojson .Point ((self .x , self .y ))
28
27
29
28
@classmethod
30
- def from_shapely (cls , shapely_obj : SPoint ) -> Point :
29
+ def from_shapely (cls , shapely_obj : SPoint ) -> " Point" :
31
30
"""Transforms a shapely object."""
32
31
if not isinstance (shapely_obj , SPoint ):
33
32
raise TypeError (
Original file line number Diff line number Diff line change 1
- from __future__ import annotations
2
1
from typing import List , Optional , Union , Tuple
3
2
4
3
import cv2
@@ -33,7 +32,7 @@ def geometry(self) -> geojson.Polygon:
33
32
return geojson .Polygon ([[(point .x , point .y ) for point in self .points ]])
34
33
35
34
@classmethod
36
- def from_shapely (cls , shapely_obj : SPolygon ) -> Polygon :
35
+ def from_shapely (cls , shapely_obj : SPolygon ) -> " Polygon" :
37
36
"""Transforms a shapely object."""
38
37
#we only consider 0th index because we only allow for filled polygons
39
38
if not isinstance (shapely_obj , SPolygon ):
Original file line number Diff line number Diff line change 1
- from __future__ import annotations
2
1
from typing import Optional , Type , Union , Tuple
3
2
4
3
import cv2
@@ -33,7 +32,7 @@ def geometry(self) -> geojson.geometry.Geometry:
33
32
]])
34
33
35
34
@classmethod
36
- def from_shapely (cls , shapely_obj : SPolygon ) -> Rectangle :
35
+ def from_shapely (cls , shapely_obj : SPolygon ) -> " Rectangle" :
37
36
"""Transforms a shapely object.
38
37
39
38
If the provided shape is a non-rectangular polygon, a rectangle will be
You can’t perform that action at this time.
0 commit comments