From f594eecabe56f992e21f70a92aa33930ec6dabaa Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 19 May 2025 22:45:21 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/Mod/CAM/Path/Tool/assets/manager.py | 1 + src/Mod/CAM/Path/Tool/shape/models/base.py | 14 ++++++-------- src/Mod/CAM/Path/Tool/shape/ui/shapebutton.py | 8 +++++--- src/Mod/CAM/Path/Tool/toolbit/models/base.py | 12 +++++------- 4 files changed, 17 insertions(+), 18 deletions(-) diff --git a/src/Mod/CAM/Path/Tool/assets/manager.py b/src/Mod/CAM/Path/Tool/assets/manager.py index 3b02677f0b..0f8d88ec5f 100644 --- a/src/Mod/CAM/Path/Tool/assets/manager.py +++ b/src/Mod/CAM/Path/Tool/assets/manager.py @@ -528,6 +528,7 @@ class AssetManager: """ Returns True if the asset exists, False otherwise. """ + async def _exists_async(): asset_uri_obj = AssetUri(uri) if isinstance(uri, str) else uri logger.debug( diff --git a/src/Mod/CAM/Path/Tool/shape/models/base.py b/src/Mod/CAM/Path/Tool/shape/models/base.py index 9b72adf837..87ea1a925a 100644 --- a/src/Mod/CAM/Path/Tool/shape/models/base.py +++ b/src/Mod/CAM/Path/Tool/shape/models/base.py @@ -292,17 +292,18 @@ class ToolBitShape(Asset): shape_class = ToolBitShape.guess_subclass_from_name(id) if shape_class: Path.Log.warning( - f'{id}: failed to infer shape type from bytes,' + f"{id}: failed to infer shape type from bytes," f' guessing "{shape_class.name}". To fix, name' - f' the body in the shape file to one of: {shape_types}' + f" the body in the shape file to one of: {shape_types}" ) else: Path.Log.warning( - f'{id}: failed to infer shape type from bytes,' + f"{id}: failed to infer shape type from bytes," f' using "endmill". To fix, name' - f' the body in the shape file to one of: {shape_types}' + f" the body in the shape file to one of: {shape_types}" ) from .endmill import ToolBitShapeEndmill + shape_class = ToolBitShapeEndmill # Load properties from the temporary document @@ -457,10 +458,7 @@ class ToolBitShape(Asset): """ name = name.lower() for thecls in cls.__subclasses__(): - if ( - thecls.name.lower() in name - or thecls.__name__.lower() in name - ): + if thecls.name.lower() in name or thecls.__name__.lower() in name: return thecls for alias in thecls.aliases: if alias.lower() in name: diff --git a/src/Mod/CAM/Path/Tool/shape/ui/shapebutton.py b/src/Mod/CAM/Path/Tool/shape/ui/shapebutton.py index e39280e1cc..1b5979ded2 100644 --- a/src/Mod/CAM/Path/Tool/shape/ui/shapebutton.py +++ b/src/Mod/CAM/Path/Tool/shape/ui/shapebutton.py @@ -32,7 +32,9 @@ class ShapeButton(QtGui.QToolButton): # self.setText(f"{shape.label}\n{shape.id}") self.vbox = QtGui.QVBoxLayout(self) - self.vbox.setAlignment(QtCore.Qt.AlignHCenter | QtCore.Qt.AlignVCenter) # Align all items centrally + self.vbox.setAlignment( + QtCore.Qt.AlignHCenter | QtCore.Qt.AlignVCenter + ) # Align all items centrally self.vbox.setContentsMargins(0, 0, 0, 0) self.vbox.setSpacing(0) @@ -46,7 +48,7 @@ class ShapeButton(QtGui.QToolButton): self.id_widget.setAlignment(QtCore.Qt.AlignHCenter | QtCore.Qt.AlignVCenter) self.id_widget.setContentsMargins(0, 0, 0, 0) font = self.id_widget.font() - font.setPointSize(font.pointSize()*0.9) + font.setPointSize(font.pointSize() * 0.9) self.id_widget.setFont(font) # Add widgets to the new layout @@ -76,4 +78,4 @@ class ShapeButton(QtGui.QToolButton): pixmap = icon.get_qpixmap(self.icon_size) self.icon_widget.setPixmap(pixmap) else: - self.icon_widget.clear() # Clear pixmap if no icon + self.icon_widget.clear() # Clear pixmap if no icon diff --git a/src/Mod/CAM/Path/Tool/toolbit/models/base.py b/src/Mod/CAM/Path/Tool/toolbit/models/base.py index 02bd587eb7..96fdbb3514 100644 --- a/src/Mod/CAM/Path/Tool/toolbit/models/base.py +++ b/src/Mod/CAM/Path/Tool/toolbit/models/base.py @@ -111,15 +111,15 @@ class ToolBit(Asset, ABC): shape_class = ToolBitShape.guess_subclass_from_name(shape_id) if shape_class: Path.Log.warning( - f'failed to infer shape type from {shape_id},' + f"failed to infer shape type from {shape_id}," f' guessing "{shape_class.name}". To fix, name' - f' the body in the shape file to one of: {shape_types}' + f" the body in the shape file to one of: {shape_types}" ) else: Path.Log.warning( - f'failed to infer shape type from {shape_id},' + f"failed to infer shape type from {shape_id}," f' using "endmill". To fix, name' - f' the body in the shape file to one of: {shape_types}' + f" the body in the shape file to one of: {shape_types}" ) shape_class = ToolBitShapeEndmill shape_type = shape_class.name @@ -693,9 +693,7 @@ class ToolBit(Asset, ABC): current_shape_prop_names = set(self._get_props("Shape")) new_shape_param_names = self._tool_bit_shape.schema().keys() obsolete = current_shape_prop_names - new_shape_param_names - Path.Log.debug( - f"Removing obsolete shape properties: {obsolete} from {self.obj.Label}" - ) + Path.Log.debug(f"Removing obsolete shape properties: {obsolete} from {self.obj.Label}") # Gracefully skipping the deletion for now; # in future releases we may handle schema violations more strictly # self._remove_properties("Shape", obsolete)