Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ docs = [
]
lint = [
"pre-commit==4.1.0",
"pyright==1.1.389",
"pyright==1.1.396",
]
test = [
"pytest==8.3.5",
Expand Down
25 changes: 14 additions & 11 deletions src/sectionproperties/pre/geometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -428,13 +428,13 @@ def create_facets_and_control_points(self) -> None:
)

if not self.assigned_control_point:
self.control_points = list(self.geom.representative_point().coords)
self.control_points = list(self.geom.representative_point().coords) # pyright: ignore [reportAttributeAccessIssue]
else:
self.control_points = list(self.assigned_control_point.coords)
self.control_points = list(self.assigned_control_point.coords) # pyright: ignore [reportAttributeAccessIssue]

for hole in self.geom.interiors:
hole_polygon = Polygon(hole)
self.holes += tuple(hole_polygon.representative_point().coords)
self.holes += tuple(hole_polygon.representative_point().coords) # pyright: ignore [reportOperatorIssue]

def compile_geometry(self) -> None:
"""Alias for ``create_facets_and_control_points()``.
Expand Down Expand Up @@ -697,9 +697,10 @@ def shift_section(
new_ctrl_point: tuple[float, float] | None = None

if self.assigned_control_point:
new_ctrl_point = affinity.translate(
new_ctrl_point_geom = affinity.translate(
self.assigned_control_point, x_offset, y_offset
).coords[0]
)
new_ctrl_point = new_ctrl_point_geom.x, new_ctrl_point_geom.y

return Geometry(
geom=affinity.translate(self.geom, x_offset, y_offset),
Expand Down Expand Up @@ -751,12 +752,13 @@ def rotate_section(
else:
rotate_point = rot_point

new_ctrl_point = affinity.rotate(
new_ctrl_point_geom = affinity.rotate(
self.assigned_control_point,
angle,
rotate_point, # pyright: ignore [reportArgumentType]
use_radians,
).coords[0]
)
new_ctrl_point = new_ctrl_point_geom.x, new_ctrl_point_geom.y

return Geometry(
geom=affinity.rotate(self.geom, angle, rot_point, use_radians), # pyright: ignore [reportArgumentType]
Expand Down Expand Up @@ -821,13 +823,14 @@ def mirror_section(
new_ctrl_point: tuple[float, float] | None = None

if self.assigned_control_point:
new_ctrl_point = affinity.scale(
new_ctrl_point_geom = affinity.scale(
self.assigned_control_point,
xfact=y_mirror,
yfact=x_mirror,
zfact=1.0,
origin=mirror_point, # pyright: ignore [reportArgumentType]
).coords[0]
)
new_ctrl_point = new_ctrl_point_geom.x, new_ctrl_point_geom.y

return Geometry(
geom=mirrored_geom,
Expand Down Expand Up @@ -1270,7 +1273,7 @@ def calculate_centroid(self) -> tuple[float, float]:
Returns:
Geometry centroid
"""
return self.geom.centroid.coords[0]
return self.geom.centroid.x, self.geom.centroid.y

@property
def recovery_points(self) -> list[tuple[float, float]] | list[Point]:
Expand Down Expand Up @@ -2443,7 +2446,7 @@ def compile_geometry(self) -> None:
for interior in poly.interiors:
rp: Point = Polygon(interior).representative_point()
coords = rp.coords[0]
resultant_holes.append(coords)
resultant_holes.append(coords) # pyright: ignore [reportArgumentType]

elif isinstance(unionized_poly, Polygon): # pyright: ignore [reportUnnecessaryIsInstance]
if Geometry(unionized_poly).holes:
Expand Down
8 changes: 4 additions & 4 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.