Skip to content

Commit f00f271

Browse files
authored
Merge pull request #2197 from mikedh/release/fstring
Release: fstring
2 parents 563690a + c512b2f commit f00f271

48 files changed

Lines changed: 116 additions & 108 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
run: |
2121
pip install ruff
2222
- name: Check Formatting
23-
run: ruff .
23+
run: ruff check .
2424
tests:
2525
name: Run Unit Tests
2626
needs: formatting

.github/workflows/test.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,9 @@ jobs:
1616
with:
1717
python-version: "3.11"
1818
- name: Install
19-
run: pip install ruff black
19+
run: pip install ruff
2020
- name: Run Ruff
21-
run: ruff .
22-
# - name: Run Black
23-
# run: black --check .
21+
run: ruff check .
2422

2523
tests:
2624
name: Run Unit Tests

pyproject.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ requires = ["setuptools >= 61.0", "wheel"]
55
[project]
66
name = "trimesh"
77
requires-python = ">=3.7"
8-
version = "4.2.2"
8+
version = "4.2.3"
99
authors = [{name = "Michael Dawson-Haggerty", email = "mikedh@kerfed.com"}]
1010
license = {file = "LICENSE.md"}
1111
description = "Import, export, process, analyze and view triangular meshes."
@@ -129,7 +129,7 @@ select = [
129129
"E", # style errors
130130
"F", # flakes
131131
"I", # import sorting
132-
"RUF100", # meta
132+
"RUF", # ruff specific rules
133133
"UP", # upgrade
134134
"W", # style warnings
135135
"YTT", # sys.version
@@ -143,6 +143,7 @@ ignore = [
143143
"E501", # Line too long ({width} > {limit} characters)
144144
"B904", # raise ... from err
145145
"B905", # zip() without an explicit strict= parameter
146+
"RUF005", # recommends non-type-aware expansion
146147
]
147148

148149
# don't allow implicit string concatenation

tests/test_align.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def test_align(self):
3737
unitized = g.trimesh.unitize(vectors)
3838
for unit_dest, dest in zip(unitized[-10:], vectors[-10:]):
3939
for unit, vector in zip(unitized, vectors):
40-
T, a = align(vector, dest, return_angle=True)
40+
T, _a = align(vector, dest, return_angle=True)
4141
assert is_rigid(T)
4242
assert g.np.isclose(g.np.linalg.det(T), 1.0)
4343
# rotate vector with transform
@@ -97,7 +97,7 @@ def test_rigid(self):
9797

9898
vector_1 = g.np.array([7.12106798e-07, -7.43194705e-08, 1.00000000e00])
9999
vector_2 = g.np.array([0, 0, -1])
100-
T, angle = align(vector_1, vector_2, return_angle=True)
100+
T, _angle = align(vector_1, vector_2, return_angle=True)
101101
assert g.np.isclose(g.np.linalg.det(T), 1.0)
102102

103103

tests/test_creation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ def test_triangulate(self):
267267
)
268268
except BaseException:
269269
g.log.error("failed to benchmark triangle", exc_info=True)
270-
g.log.info(f"benchmarked triangulation on {len(bench)} polygons: {str(times)}")
270+
g.log.info(f"benchmarked triangulation on {len(bench)} polygons: {times!s}")
271271

272272
def test_triangulate_plumbing(self):
273273
"""

tests/test_export.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ def test_parse_file_args(self):
312312

313313
def test_buffered_random(self):
314314
"""Test writing to non-standard file"""
315-
mesh = list(g.get_meshes(1))[0]
315+
mesh = next(iter(g.get_meshes(1)))
316316
with io.BufferedRandom(io.BytesIO()) as rw:
317317
mesh.export(rw, "STL")
318318
rw.seek(0)

tests/test_gltf.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ def to_integer(args):
433433
)
434434
assert len(reloaded.geometry) == 1
435435
# get meshes back
436-
sphere_b = list(reloaded.geometry.values())[0]
436+
sphere_b = next(iter(reloaded.geometry.values()))
437437
assert (sphere_b.visual.material.baseColorFactor == (255, 0, 0, 255)).all()
438438

439439
def test_material_hash(self):
@@ -1047,11 +1047,13 @@ def test_unitize_normals_null_values(self):
10471047

10481048
# Export the mesh
10491049
export = mesh.export(file_type="glb", unitize_normals=True)
1050-
reimported_mesh = list(
1051-
g.trimesh.load(
1052-
g.trimesh.util.wrap_as_stream(export), file_type="glb"
1053-
).geometry.values()
1054-
)[0]
1050+
reimported_mesh = next(
1051+
iter(
1052+
g.trimesh.load(
1053+
g.trimesh.util.wrap_as_stream(export), file_type="glb"
1054+
).geometry.values()
1055+
)
1056+
)
10551057

10561058
# Check that the normals are still null
10571059
assert g.np.allclose(reimported_mesh.vertex_normals[0], [0, 0, 0])

tests/test_obj.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ def test_obj_simple_order(self):
110110
m = g.trimesh.load(file_name, process=False)
111111
# use trivial loading to compare with fancy performant one
112112
with open(file_name) as f:
113-
f, v, vt = simple_load(f.read())
113+
f, v, _vt = simple_load(f.read())
114114
# trimesh loader should return the same face order
115115
assert g.np.allclose(f, m.faces)
116116
assert g.np.allclose(v, m.vertices)
@@ -123,7 +123,7 @@ def test_order_tex(self):
123123
m = g.trimesh.load(file_name, process=False, maintain_order=True)
124124
# use trivial loading to compare with fancy performant one
125125
with open(file_name) as f:
126-
f, v, vt = simple_load(f.read())
126+
f, v, _vt = simple_load(f.read())
127127
# trimesh loader should return the same face order
128128
assert g.np.allclose(f, m.faces)
129129
assert g.np.allclose(v, m.vertices)
@@ -448,7 +448,7 @@ def test_export_normals(self):
448448
def test_export_mtl_args(self):
449449
mesh = g.trimesh.creation.box()
450450
# check for a crash with no materials defined
451-
a, b = g.trimesh.exchange.obj.export_obj(
451+
_a, _b = g.trimesh.exchange.obj.export_obj(
452452
mesh, return_texture=True, mtl_name="hi.mtl"
453453
)
454454

tests/test_packing.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ def test_obb(self):
7272
from trimesh.path import packing
7373

7474
nestable = [g.Polygon(i) for i in g.data["nestable"]]
75-
inserted, transforms = packing.polygons(nestable)
75+
_inserted, _transforms = packing.polygons(nestable)
7676

7777
def test_image(self):
7878
from trimesh.path import packing
@@ -157,11 +157,11 @@ def test_3D(self):
157157
)
158158

159159
# try packing these 3D boxes
160-
bounds, consume = packing.rectangles_single(e)
160+
_bounds, consume = packing.rectangles_single(e)
161161
assert consume.all()
162162

163163
# try packing these 3D boxes
164-
bounds, consume = packing.rectangles_single(e, size=[14, 14, 1])
164+
_bounds, consume = packing.rectangles_single(e, size=[14, 14, 1])
165165
assert not consume.all()
166166

167167
def test_transform(self):

tests/test_paths.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ def test_section(self):
282282
)
283283

284284
# Path3D -> Path2D
285-
planar, T = section.to_planar()
285+
planar, _T = section.to_planar()
286286

287287
# tube should have one closed polygon
288288
assert len(planar.polygons_full) == 1

0 commit comments

Comments
 (0)