Skip to content

Commit 88027e6

Browse files
committed
remove future annotations
1 parent 04efc7c commit 88027e6

File tree

11 files changed

+40
-57
lines changed

11 files changed

+40
-57
lines changed

src/compas_occ/brep/brep.py

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
from __future__ import annotations
2-
3-
from typing import Any, List, Optional
1+
from typing import List, Optional
42

53
import compas.geometry
64
import compas.datastructures
@@ -103,7 +101,7 @@ def shape(self) -> TopoDS_Shape:
103101
return self._shape
104102

105103
@shape.setter
106-
def shape(self, shape: Any[TopoDS_Shape]) -> None:
104+
def shape(self, shape: TopoDS_Shape) -> None:
107105
self._shape = shape
108106

109107
@property
@@ -187,7 +185,7 @@ def from_corners(cls,
187185
p1: compas.geometry.Point,
188186
p2: compas.geometry.Point,
189187
p3: compas.geometry.Point,
190-
p4: Optional[compas.geometry.Point] = None) -> BRep:
188+
p4: Optional[compas.geometry.Point] = None) -> 'BRep':
191189
"""Construct a BRep from 3 or 4 corner points."""
192190
if not p4:
193191
brep = BRep()
@@ -198,7 +196,7 @@ def from_corners(cls,
198196
return brep
199197

200198
@classmethod
201-
def from_polygons(cls, polygons: List[compas.geometry.Polygon]) -> BRep:
199+
def from_polygons(cls, polygons: List[compas.geometry.Polygon]) -> 'BRep':
202200
"""Construct a BRep from a set of polygons."""
203201
shell = TopoDS_Shell()
204202
builder = BRep_Builder()
@@ -215,11 +213,11 @@ def from_polygons(cls, polygons: List[compas.geometry.Polygon]) -> BRep:
215213
return brep
216214

217215
@classmethod
218-
def from_curves(cls, curves) -> BRep:
216+
def from_curves(cls, curves) -> 'BRep':
219217
raise NotImplementedError
220218

221219
@classmethod
222-
def from_box(cls, box: compas.geometry.Box) -> BRep:
220+
def from_box(cls, box: compas.geometry.Box) -> 'BRep':
223221
"""Construct a BRep from a COMPAS box."""
224222
xaxis = box.frame.xaxis.scaled(-0.5 * box.xsize)
225223
yaxis = box.frame.yaxis.scaled(-0.5 * box.ysize)
@@ -231,14 +229,14 @@ def from_box(cls, box: compas.geometry.Box) -> BRep:
231229
return brep
232230

233231
@classmethod
234-
def from_sphere(cls, sphere: compas.geometry.Sphere) -> BRep:
232+
def from_sphere(cls, sphere: compas.geometry.Sphere) -> 'BRep':
235233
"""Construct a BRep from a COMPAS sphere."""
236234
brep = BRep()
237235
brep.shape = BRepPrimAPI_MakeSphere(gp_Pnt(* sphere.point), sphere.radius).Shape()
238236
return brep
239237

240238
@classmethod
241-
def from_cylinder(cls, cylinder: compas.geometry.Cylinder) -> BRep:
239+
def from_cylinder(cls, cylinder: compas.geometry.Cylinder) -> 'BRep':
242240
"""Construct a BRep from a COMPAS cylinder."""
243241
plane = cylinder.circle.plane
244242
height = cylinder.height
@@ -251,17 +249,17 @@ def from_cylinder(cls, cylinder: compas.geometry.Cylinder) -> BRep:
251249
return brep
252250

253251
@classmethod
254-
def from_cone(cls, cone: compas.geometry.Cone) -> BRep:
252+
def from_cone(cls, cone: compas.geometry.Cone) -> 'BRep':
255253
"""Construct a BRep from a COMPAS cone."""
256254
raise NotImplementedError
257255

258256
@classmethod
259-
def from_torus(cls, torus: compas.geometry.Torus) -> BRep:
257+
def from_torus(cls, torus: compas.geometry.Torus) -> 'BRep':
260258
"""Construct a BRep from a COMPAS torus."""
261259
raise NotImplementedError
262260

263261
@classmethod
264-
def from_boolean_difference(cls, A: BRep, B: BRep) -> BRep:
262+
def from_boolean_difference(cls, A: 'BRep', B: 'BRep') -> 'BRep':
265263
"""Construct a BRep from the boolean difference of two other BReps."""
266264
cut = BRepAlgoAPI_Cut(A.shape, B.shape)
267265
if not cut.IsDone():
@@ -271,7 +269,7 @@ def from_boolean_difference(cls, A: BRep, B: BRep) -> BRep:
271269
return brep
272270

273271
@classmethod
274-
def from_boolean_intersection(cls, A: BRep, B: BRep) -> BRep:
272+
def from_boolean_intersection(cls, A: 'BRep', B: 'BRep') -> 'BRep':
275273
"""Construct a BRep from the boolean intersection of two other BReps."""
276274
common = BRepAlgoAPI_Common(A.shape, B.shape)
277275
if not common.IsDone():
@@ -281,7 +279,7 @@ def from_boolean_intersection(cls, A: BRep, B: BRep) -> BRep:
281279
return brep
282280

283281
@classmethod
284-
def from_boolean_union(cls, A, B) -> BRep:
282+
def from_boolean_union(cls, A, B) -> 'BRep':
285283
"""Construct a BRep from the boolean union of two other BReps."""
286284
fuse = BRepAlgoAPI_Fuse(A.shape, B.shape)
287285
if not fuse.IsDone():
@@ -291,7 +289,7 @@ def from_boolean_union(cls, A, B) -> BRep:
291289
return brep
292290

293291
@classmethod
294-
def from_mesh(cls, mesh: compas.datastructures.Mesh) -> BRep:
292+
def from_mesh(cls, mesh: compas.datastructures.Mesh) -> 'BRep':
295293
"""Construct a BRep from a COMPAS mesh."""
296294
shell = TopoDS_Shell()
297295
builder = BRep_Builder()

src/compas_occ/brep/brepedge.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
from __future__ import annotations
2-
31
from typing import List
42
from enum import Enum
53

src/compas_occ/brep/brepface.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
from __future__ import annotations
21
from typing import List
32

43
from OCC.Core.TopoDS import TopoDS_Face

src/compas_occ/brep/breploop.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
from __future__ import annotations
21
from typing import List
32

43
from OCC.Core.TopoDS import TopoDS_Wire, topods_Wire

src/compas_occ/brep/brepvertex.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
from __future__ import annotations
2-
31
from OCC.Core.TopoDS import TopoDS_Vertex
42
from OCC.Core.TopoDS import topods_Vertex
53

src/compas_occ/conversions/arrays.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
from __future__ import annotations
2-
31
from typing import List
42

53
from compas.geometry import Point

src/compas_occ/conversions/meshes.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
from __future__ import annotations
2-
from typing import List
1+
from typing import List, Union
32
from typing_extensions import Annotated
43

54
import compas.geometry
@@ -21,7 +20,7 @@
2120
from OCC.Extend.TopologyUtils import TopologyExplorer
2221

2322

24-
def triangle_to_face(points: List[compas.geometry.Point, Annotated[List[float], 3]]) -> TopoDS_Face:
23+
def triangle_to_face(points: Union[List[compas.geometry.Point], List[Annotated[List[float], 3]]]) -> TopoDS_Face:
2524
polygon = BRepBuilderAPI_MakePolygon()
2625
for point in points:
2726
polygon.Add(gp_Pnt(* point))
@@ -30,15 +29,15 @@ def triangle_to_face(points: List[compas.geometry.Point, Annotated[List[float],
3029
return BRepBuilderAPI_MakeFace(wire).Face()
3130

3231

33-
def quad_to_face(points: List[compas.geometry.Point, Annotated[List[float], 3]]) -> TopoDS_Face:
32+
def quad_to_face(points: Union[List[compas.geometry.Point], List[Annotated[List[float], 3]]]) -> TopoDS_Face:
3433
points = [Point(* point) for point in points]
3534
curve1 = GeomAPI_PointsToBSpline(array1_from_points1([points[0], points[1]])).Curve()
3635
curve2 = GeomAPI_PointsToBSpline(array1_from_points1([points[3], points[2]])).Curve()
3736
srf = geomfill_Surface(curve1, curve2)
3837
return BRepBuilderAPI_MakeFace(srf, 1e-6).Face()
3938

4039

41-
def ngon_to_face(points: List[compas.geometry.Point, Annotated[List[float], 3]]) -> TopoDS_Face:
40+
def ngon_to_face(points: Union[List[compas.geometry.Point], List[Annotated[List[float], 3]]]) -> TopoDS_Face:
4241
points = [gp_Pnt(* point) for point in points]
4342
poly = BRepBuilderAPI_MakePolygon()
4443
for point in points:

src/compas_occ/conversions/primitives.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
from __future__ import annotations
2-
31
from compas.geometry import Point
42
from compas.geometry import Vector
53
from compas.geometry import Line

src/compas_occ/conversions/shapes.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
from __future__ import annotations
2-
31
from compas.geometry import Box
42
from compas.geometry import Sphere
53
from compas.geometry import Translation

src/compas_occ/geometry/curves/nurbs.py

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
from __future__ import annotations
21
from math import sqrt
32

43
from typing import Dict, List
@@ -109,7 +108,7 @@ def __init__(self, name=None) -> None:
109108
super().__init__(name=name)
110109
self.occ_curve = None
111110

112-
def __eq__(self, other: NurbsCurve) -> bool:
111+
def __eq__(self, other: 'NurbsCurve') -> bool:
113112
return self.occ_curve.IsEqual(other.occ_curve)
114113

115114
def __str__(self):
@@ -162,7 +161,7 @@ def data(self, data: Dict):
162161
)
163162

164163
@classmethod
165-
def from_data(cls, data: Dict) -> NurbsCurve:
164+
def from_data(cls, data: Dict) -> 'NurbsCurve':
166165
"""Construct a NURBS curve from its data representation.
167166
168167
Parameters
@@ -189,7 +188,7 @@ def from_data(cls, data: Dict) -> NurbsCurve:
189188
# ==============================================================================
190189

191190
@classmethod
192-
def from_occ(cls, occ_curve: Geom_BSplineCurve) -> NurbsCurve:
191+
def from_occ(cls, occ_curve: Geom_BSplineCurve) -> 'NurbsCurve':
193192
"""Construct a NURBS curve from an existing OCC BSplineCurve."""
194193
curve = cls()
195194
curve.occ_curve = occ_curve
@@ -202,7 +201,7 @@ def from_parameters(cls,
202201
knots: List[float],
203202
multiplicities: List[int],
204203
degree: int,
205-
is_periodic: bool = False) -> NurbsCurve:
204+
is_periodic: bool = False) -> 'NurbsCurve':
206205
"""Construct a NURBS curve from explicit curve parameters."""
207206
curve = cls()
208207
curve.occ_curve = Geom_BSplineCurve(
@@ -216,7 +215,7 @@ def from_parameters(cls,
216215
return curve
217216

218217
@classmethod
219-
def from_points(cls, points: List[Point], degree: int = 3) -> NurbsCurve:
218+
def from_points(cls, points: List[Point], degree: int = 3) -> 'NurbsCurve':
220219
"""Construct a NURBS curve from control points.
221220
222221
This construction method is similar to the method ``Create`` of the Rhino API for NURBS curves [1]_.
@@ -249,7 +248,7 @@ def from_points(cls, points: List[Point], degree: int = 3) -> NurbsCurve:
249248
return curve
250249

251250
@classmethod
252-
def from_interpolation(cls, points: List[Point], precision: float = 1e-3) -> NurbsCurve:
251+
def from_interpolation(cls, points: List[Point], precision: float = 1e-3) -> 'NurbsCurve':
253252
"""Construct a NURBS curve by interpolating a set of points.
254253
255254
This construction method is similar to the method ``CreateHSpline`` of the Rhino API for NURBS curves [1]_.
@@ -267,12 +266,12 @@ def from_interpolation(cls, points: List[Point], precision: float = 1e-3) -> Nur
267266
return curve
268267

269268
@classmethod
270-
def from_step(cls, filepath: str) -> NurbsCurve:
269+
def from_step(cls, filepath: str) -> 'NurbsCurve':
271270
"""Load a NURBS curve from an STP file."""
272271
pass
273272

274273
@classmethod
275-
def from_edge(cls, edge: TopoDS_Edge) -> NurbsCurve:
274+
def from_edge(cls, edge: TopoDS_Edge) -> 'NurbsCurve':
276275
"""Construct a NURBS curve from an existing OCC TopoDS_Edge."""
277276
res = BRep_Tool_Curve(edge)
278277
if len(res) != 3:
@@ -284,7 +283,7 @@ def from_arc(cls, arc, degree, pointcount=None):
284283
pass
285284

286285
@classmethod
287-
def from_circle(cls, circle: Circle) -> NurbsCurve:
286+
def from_circle(cls, circle: Circle) -> 'NurbsCurve':
288287
"""Construct a NURBS curve from a circle.
289288
290289
This construction method is similar to the method ``CreateFromCircle`` of the Rhino API for NURBS curves [1]_.
@@ -486,7 +485,7 @@ def is_rational(self) -> bool:
486485
# Methods
487486
# ==============================================================================
488487

489-
def copy(self) -> NurbsCurve:
488+
def copy(self) -> 'NurbsCurve':
490489
"""Make an independent copy of the current curve."""
491490
return NurbsCurve.from_parameters(
492491
self.points,
@@ -503,7 +502,7 @@ def transform(self, T: Transformation) -> None:
503502
occ_T.SetValues(* T.list)
504503
self.occ_curve.Transform(occ_T)
505504

506-
def transformed(self, T: Transformation) -> NurbsCurve:
505+
def transformed(self, T: Transformation) -> 'NurbsCurve':
507506
"""Transform a copy of the curve."""
508507
copy = self.copy()
509508
copy.transform(T)

0 commit comments

Comments
 (0)