mirror of
https://github.com/maziggy/bambuddy.git
synced 2026-10-07 06:31:22 +02:00
ruff format changes
This commit is contained in:
@@ -252,7 +252,9 @@ async def sync_printer_ams(
|
||||
current_tray_uuids.add(spool_tag.upper())
|
||||
|
||||
try:
|
||||
sync_result = await client.sync_ams_tray(tray, printer.name, disable_weight_sync=disable_weight_sync)
|
||||
sync_result = await client.sync_ams_tray(
|
||||
tray, printer.name, disable_weight_sync=disable_weight_sync
|
||||
)
|
||||
if sync_result:
|
||||
synced += 1
|
||||
logger.info(f"Synced {tray.tray_sub_brands} from {printer.name} AMS {ams_id} tray {tray.tray_id}")
|
||||
|
||||
@@ -1101,6 +1101,7 @@ async def run_migrations(conn):
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
|
||||
async def seed_notification_templates():
|
||||
"""Seed default notification templates if they don't exist."""
|
||||
from sqlalchemy import select
|
||||
|
||||
+3
-8
@@ -527,8 +527,7 @@ async def _report_partial_spoolman_usage(printer_id: int, tracking, logger):
|
||||
# Convert string keys back to int (JSON serialization issue)
|
||||
# Both outer (layer) and inner (filament_id) keys need conversion
|
||||
layer_usage_int = {
|
||||
int(layer): {int(fid): mm for fid, mm in filaments.items()}
|
||||
for layer, filaments in layer_usage.items()
|
||||
int(layer): {int(fid): mm for fid, mm in filaments.items()} for layer, filaments in layer_usage.items()
|
||||
}
|
||||
|
||||
# Get cumulative usage at current layer
|
||||
@@ -558,9 +557,7 @@ async def _report_partial_spoolman_usage(printer_id: int, tracking, logger):
|
||||
tray_uuid = tray_info.get("tray_uuid", "")
|
||||
tag_uid = tray_info.get("tag_uid", "")
|
||||
spool_tag = (
|
||||
tray_uuid
|
||||
if tray_uuid and tray_uuid != "00000000000000000000000000000000"
|
||||
else tag_uid
|
||||
tray_uuid if tray_uuid and tray_uuid != "00000000000000000000000000000000" else tag_uid
|
||||
)
|
||||
|
||||
if not spool_tag:
|
||||
@@ -639,9 +636,7 @@ async def _report_partial_spoolman_usage(printer_id: int, tracking, logger):
|
||||
tray_uuid = tray_info.get("tray_uuid", "")
|
||||
tag_uid = tray_info.get("tag_uid", "")
|
||||
spool_tag = (
|
||||
tray_uuid
|
||||
if tray_uuid and tray_uuid != "00000000000000000000000000000000"
|
||||
else tag_uid
|
||||
tray_uuid if tray_uuid and tray_uuid != "00000000000000000000000000000000" else tag_uid
|
||||
)
|
||||
|
||||
if not spool_tag:
|
||||
|
||||
@@ -87,9 +87,7 @@ class TestSpoolmanClient:
|
||||
assert "TestPrinter" in call_kwargs["location"]
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_sync_ams_tray_new_spool_always_includes_weight(
|
||||
self, client, sample_tray, mock_filament
|
||||
):
|
||||
async def test_sync_ams_tray_new_spool_always_includes_weight(self, client, sample_tray, mock_filament):
|
||||
"""Verify new spool creation always includes remaining_weight even when disabled."""
|
||||
with (
|
||||
patch.object(client, "find_spool_by_tag", AsyncMock(return_value=None)),
|
||||
|
||||
Reference in New Issue
Block a user