[pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci
This commit is contained in:
pre-commit-ci[bot]
2025-05-19 22:45:21 +00:00
parent c8b53ed015
commit f594eecabe
4 changed files with 17 additions and 18 deletions

View File

@@ -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(

View File

@@ -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:

View File

@@ -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

View File

@@ -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)