Skip to content

Commit be8de17

Browse files
committed
Pycodestyle fixes
Refactored string formatting for property descriptions and test assertions to improve readability. Adjusted indentation in import_3mf.py for consistency. No functional changes were made.
1 parent 319d7d4 commit be8de17

File tree

3 files changed

+17
-10
lines changed

3 files changed

+17
-10
lines changed

io_mesh_3mf/__init__.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ class ThreeMFPreferences(bpy.types.AddonPreferences):
4949
# Export defaults
5050
default_coordinate_precision: bpy.props.IntProperty(
5151
name="Default Coordinate Precision",
52-
description="Default number of decimal digits for coordinates in exported files. Higher values preserve more detail but increase file size",
52+
description=("Default number of decimal digits for coordinates in exported files. "
53+
"Higher values preserve more detail but increase file size"),
5354
default=9,
5455
min=0,
5556
max=12,
@@ -79,7 +80,7 @@ class ThreeMFPreferences(bpy.types.AddonPreferences):
7980

8081
def draw(self, context):
8182
layout = self.layout
82-
83+
8384
box = layout.box()
8485
box.label(text="Export Defaults:", icon='EXPORT')
8586
box.prop(self, "default_coordinate_precision")

io_mesh_3mf/import_3mf.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -616,10 +616,10 @@ def read_objects(self, root: xml.etree.ElementTree.Element) -> None:
616616
)
617617
if "name" in object_node.attrib and "Title" not in metadata:
618618
metadata["Title"] = MetadataEntry(
619-
name="Title",
620-
preserve=True,
621-
datatype="xs:string",
622-
value=object_node.attrib.get("name")
619+
name="Title",
620+
preserve=True,
621+
datatype="xs:string",
622+
value=object_node.attrib.get("name")
623623
)
624624

625625
metadata["3mf:object_type"] = MetadataEntry(

test/export_3mf.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,10 @@ def test_unit_scale_scene(self):
136136

137137
# With new logic: scale * (scene_scale / 0.001) where threemf_unit is millimeter (0.001 m)
138138
# = 1.0 * (0.9 / 0.001) = 1.0 * 900 = 900
139-
self.assertEqual(self.exporter.unit_scale(context), 900.0, "The scene scale of 0.9 divided by 3MF unit (0.001m) gives 900.")
139+
self.assertEqual(
140+
self.exporter.unit_scale(context),
141+
900.0,
142+
"The scene scale of 0.9 divided by 3MF unit (0.001m) gives 900.")
140143

141144
def test_unit_scale_conversion(self):
142145
"""
@@ -210,8 +213,8 @@ def test_unit_and_scene_scale_conversion(self):
210213
context.scene.unit_settings.length_unit = blender_unit
211214
# With new logic: scale * (SCENE_SCALE / 0.001) = scale * (0.001 / 0.001) = scale * 1.0
212215
self.assertAlmostEqual(
213-
self.exporter.unit_scale(context),
214-
correct_conversions[blender_unit])
216+
self.exporter.unit_scale(context),
217+
correct_conversions[blender_unit])
215218

216219
def test_write_materials_empty(self):
217220
"""
@@ -943,7 +946,10 @@ def test_format_transformation_identity(self):
943946
Tests formatting the identity matrix.
944947
"""
945948
identity_matrix = mathutils.Matrix.Identity(4)
946-
self.assertEqual(self.exporter.format_transformation(identity_matrix), "1.000000000 0.000000000 0.000000000 0.000000000 1.000000000 0.000000000 0.000000000 0.000000000 1.000000000 0.000000000 0.000000000 0.000000000")
949+
expected = ("1.000000000 0.000000000 0.000000000 0.000000000 "
950+
"1.000000000 0.000000000 0.000000000 0.000000000 "
951+
"1.000000000 0.000000000 0.000000000 0.000000000")
952+
self.assertEqual(self.exporter.format_transformation(identity_matrix), expected)
947953

948954
def test_format_transformation_coordinates(self):
949955
"""

0 commit comments

Comments
 (0)