Fixed more typing problems

This commit is contained in:
gumyr 2025-01-13 20:18:18 -05:00
parent e923f733e0
commit 60a4d24cd4
3 changed files with 20 additions and 18 deletions

View file

@ -1322,7 +1322,11 @@ class WorkplaneList:
points_per_workplane = []
workplane = WorkplaneList._get_context().workplanes[0]
localized_pts = [
workplane.from_local_coords(pt) if isinstance(pt, tuple) else pt
(
cast(Vector, workplane.from_local_coords(Vector(pt)))
if isinstance(pt, tuple)
else Vector(pt)
)
for pt in points
]
if len(localized_pts) == 1:

View file

@ -46,6 +46,7 @@ from ezdxf import zoom
from ezdxf.colors import RGB, aci2rgb
from ezdxf.math import Vec2
from OCP.BRepLib import BRepLib
from OCP.BRepTools import BRepTools_WireExplorer
from OCP.Geom import Geom_BezierCurve
from OCP.GeomConvert import GeomConvert
from OCP.GeomConvert import GeomConvert_BSplineCurveToBezierCurve
@ -1109,15 +1110,15 @@ class ExportSVG(Export2D):
@staticmethod
def _wire_edges(wire: Wire, reverse: bool) -> list[Edge]:
# edges = []
# explorer = BRepTools_WireExplorer(wire.wrapped)
# while explorer.More():
# topo_edge = explorer.Current()
# edges.append(Edge(topo_edge))
# explorer.Next()
edges = wire.edges()
if reverse:
edges.reverse()
edges = []
explorer = BRepTools_WireExplorer(wire.wrapped)
while explorer.More():
topo_edge = explorer.Current()
edges.append(Edge(topo_edge))
explorer.Next()
# edges = wire.edges()
# if reverse:
# edges.reverse()
return edges
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View file

@ -53,13 +53,10 @@ from abc import ABC, abstractmethod
from typing import (
cast as tcast,
Any,
Dict,
Generic,
Optional,
Protocol,
SupportsIndex,
Tuple,
Type,
TypeVar,
Union,
overload,
@ -70,7 +67,7 @@ from collections.abc import Callable, Iterable, Iterator
import OCP.GeomAbs as ga
import OCP.TopAbs as ta
from IPython.lib.pretty import pretty, PrettyPrinter
from IPython.lib.pretty import pretty, RepresentationPrinter
from OCP.Aspect import Aspect_TOL_SOLID
from OCP.BOPAlgo import BOPAlgo_GlueEnum
from OCP.BRep import BRep_Tool
@ -2204,7 +2201,9 @@ class GroupBy(Generic[T, K]):
"""Select group by shape"""
return self.group(self.key_f(shape))
def _repr_pretty_(self, printer: PrettyPrinter, cycle: bool = False) -> None:
def _repr_pretty_(
self, printer: RepresentationPrinter, cycle: bool = False
) -> None:
"""
Render a formatted representation of the object for pretty-printing in
interactive environments.
@ -2840,9 +2839,7 @@ def _topods_entities(shape: TopoDS_Shape, topo_type: Shapes) -> list[TopoDS_Shap
while explorer.More():
item = explorer.Current()
out[hash(item)] = (
item # needed to avoid pseudo-duplicate entities
)
out[hash(item)] = item # needed to avoid pseudo-duplicate entities
explorer.Next()
return list(out.values())