Skip to content

Commit 1e11f23

Browse files
committed
blackify
1 parent 6ae7eee commit 1e11f23

File tree

2 files changed

+26
-8
lines changed

2 files changed

+26
-8
lines changed

sectionproperties/pre/geometry.py

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1248,7 +1248,7 @@ def from_points(
12481248
f"If materials are provided, the number of materials in the list must "
12491249
"match the number of control_points provided.\n"
12501250
f"len(materials)=={len(materials)}, len(control_points)=={len(control_points)}."
1251-
)
1251+
)
12521252

12531253
# First, generate all invidual polygons from points and facets
12541254
current_polygon_points = []
@@ -1307,14 +1307,22 @@ def from_points(
13071307
if materials is pre.DEFAULT_MATERIAL:
13081308
return CompoundGeometry(
13091309
[
1310-
Geometry(exterior, control_points=control_points[idx], material=materials)
1310+
Geometry(
1311+
exterior,
1312+
control_points=control_points[idx],
1313+
material=materials,
1314+
)
13111315
for idx, exterior in enumerate(exteriors)
13121316
]
13131317
)
13141318
else:
13151319
return CompoundGeometry(
13161320
[
1317-
Geometry(exterior, control_points=control_points[idx], material=materials[idx])
1321+
Geometry(
1322+
exterior,
1323+
control_points=control_points[idx],
1324+
material=materials[idx],
1325+
)
13181326
for idx, exterior in enumerate(exteriors)
13191327
]
13201328
)
@@ -1341,20 +1349,23 @@ def from_points(
13411349
if materials is pre.DEFAULT_MATERIAL:
13421350

13431351
exterior_geometry = Geometry(
1344-
punched_exterior, control_points=exterior_control_point, material=materials
1352+
punched_exterior,
1353+
control_points=exterior_control_point,
1354+
material=materials,
13451355
)
13461356
punched_exterior_geometries.append(exterior_geometry)
13471357

13481358
else:
13491359

13501360
exterior_geometry = Geometry(
1351-
punched_exterior, control_points=exterior_control_point, material=materials[idx]
1361+
punched_exterior,
1362+
control_points=exterior_control_point,
1363+
material=materials[idx],
13521364
)
13531365
punched_exterior_geometries.append(exterior_geometry)
13541366

13551367
return CompoundGeometry(punched_exterior_geometries)
13561368

1357-
13581369
@classmethod
13591370
def from_3dm(cls, filepath: Union[str, pathlib.Path], **kwargs) -> CompoundGeometry:
13601371
"""Class method to create a `CompoundGeometry` from the objects in a Rhino `3dm` file.

sectionproperties/tests/test_sections.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,9 @@ def test_compound_geometry_from_points():
192192
color="blue",
193193
)
194194
materials = [mat1, mat2]
195-
new_geom = CompoundGeometry.from_points(points, facets, control_points, materials=materials)
195+
new_geom = CompoundGeometry.from_points(
196+
points, facets, control_points, materials=materials
197+
)
196198
wkt_test_geom = shapely.wkt.loads(
197199
"MULTIPOLYGON (((-0.05 -2, 0.05 -2, 0.05 -0.05, 1 -0.05, 1 0.05, -0.05 0.05, -0.05 -2)), ((-1 -2, 1 -2, 1 -2.1, -1 -2.1, -1 -2)))"
198200
)
@@ -202,6 +204,7 @@ def test_compound_geometry_from_points():
202204
for idx, geom in enumerate(new_geom.geoms):
203205
assert geom.material == materials[idx]
204206

207+
205208
def test_multi_nested_compound_geometry_from_points():
206209
"""
207210
Testing a multi-nested section. This section contains three nested materials in concentric
@@ -274,7 +277,11 @@ def test_multi_nested_compound_geometry_from_points():
274277
)
275278
materials = [mat1, mat2, mat3]
276279
nested_compound = CompoundGeometry.from_points(
277-
points=points, facets=facets, control_points=control_points, holes=holes, materials=materials
280+
points=points,
281+
facets=facets,
282+
control_points=control_points,
283+
holes=holes,
284+
materials=materials,
278285
)
279286
wkt_test_geom = shapely.wkt.loads(
280287
"MULTIPOLYGON (((50 50, 50 -50, -50 -50, -50 50, 50 50), (12.5 12.5, -12.5 12.5, -12.5 -12.5, 12.5 -12.5, 12.5 12.5)), ((-37.5 -37.5, -37.5 37.5, 37.5 37.5, 37.5 -37.5, -37.5 -37.5), (12.5 12.5, -12.5 12.5, -12.5 -12.5, 12.5 -12.5, 12.5 12.5)), ((-25 -25, -25 25, 25 25, 25 -25, -25 -25), (12.5 12.5, -12.5 12.5, -12.5 -12.5, 12.5 -12.5, 12.5 12.5)))"

0 commit comments

Comments
 (0)