Skip to content

Commit 4695340

Browse files
committed
fix: Clean up whitespace and improve readability in Q10 VacuumTrait test scripts
1 parent f3feeea commit 4695340

File tree

2 files changed

+38
-32
lines changed

2 files changed

+38
-32
lines changed

examples/Q10/test_q10_simple.py

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -43,30 +43,30 @@ async def get_or_create_session() -> UserParams:
4343
async def main():
4444
"""Test Q10 vacuum commands."""
4545
print("🔄 Initializing...")
46-
46+
4747
try:
4848
user_params = await get_or_create_session()
4949
cache = FileCache(CACHE_PATH)
50-
50+
5151
print("🔄 Creating device manager...")
5252
device_manager = await create_device_manager(user_params, cache=cache)
53-
53+
5454
print("🔄 Getting devices...")
5555
devices = await device_manager.get_devices()
56-
56+
5757
print(f"\n📱 Found {len(devices)} device(s)")
58-
58+
5959
# List all devices with their properties
6060
for idx, device in enumerate(devices, 1):
6161
print(f"\n Device {idx}: {device.name}")
6262
print(f" Product: {device.product.name} ({device.product.model})")
6363
print(f" Has v1_properties: {device.v1_properties is not None}")
6464
print(f" Has b01_q10_properties: {device.b01_q10_properties is not None}")
65-
65+
6666
# Check what attributes the device has
67-
attrs = [attr for attr in dir(device) if not attr.startswith('_') and 'properties' in attr.lower()]
67+
attrs = [attr for attr in dir(device) if not attr.startswith("_") and "properties" in attr.lower()]
6868
print(f" Available property APIs: {attrs}")
69-
69+
7070
# Select device
7171
if len(devices) == 1:
7272
device = devices[0]
@@ -75,31 +75,33 @@ async def main():
7575
device_idx = int(input("\nSelect device number: ")) - 1
7676
device = devices[device_idx]
7777
print(f"\n✅ Selected device: {device.name}")
78-
78+
7979
# Check if it's a Q10 device
8080
if device.b01_q10_properties is None:
8181
print("\n❌ This device doesn't have Q10 properties")
8282
print(f" Product: {device.product.name} ({device.product.model})")
8383
print("\n💡 Available properties:")
8484
if device.v1_properties:
8585
print(" - v1_properties (V1 API)")
86-
if hasattr(device, 'b01_q7_properties') and device.b01_q7_properties:
86+
if hasattr(device, "b01_q7_properties") and device.b01_q7_properties:
8787
print(" - b01_q7_properties (Q7 API)")
8888
await cache.flush()
8989
return
90-
91-
print(f"\n✅ Device has Q10 properties!")
92-
90+
91+
print("\n✅ Device has Q10 properties!")
92+
9393
# Check if vacuum trait exists
94-
if not hasattr(device.b01_q10_properties, 'vacuum'):
94+
if not hasattr(device.b01_q10_properties, "vacuum"):
9595
print("\n❌ Q10 properties don't have 'vacuum' trait")
96-
print(f" Available traits: {[attr for attr in dir(device.b01_q10_properties) if not attr.startswith('_')]}")
96+
print(
97+
f" Available traits: {[attr for attr in dir(device.b01_q10_properties) if not attr.startswith('_')]}"
98+
)
9799
await cache.flush()
98100
return
99-
101+
100102
vacuum = device.b01_q10_properties.vacuum
101103
print(f"✅ Vacuum trait found: {vacuum}")
102-
104+
103105
print("\n🤖 Q10 Vacuum Trait Test Menu")
104106
print("=" * 50)
105107
print("1. Start cleaning")
@@ -109,11 +111,11 @@ async def main():
109111
print("5. Return to dock")
110112
print("0. Exit")
111113
print("=" * 50)
112-
114+
113115
while True:
114116
try:
115117
choice = input("\nEnter your choice (0-5): ").strip()
116-
118+
117119
if choice == "0":
118120
print("👋 Exiting...")
119121
break
@@ -145,13 +147,15 @@ async def main():
145147
except Exception as e:
146148
print(f"❌ Error: {e}")
147149
import traceback
150+
148151
traceback.print_exc()
149-
152+
150153
await cache.flush()
151-
154+
152155
except Exception as e:
153156
print(f"\n❌ Fatal error: {e}")
154157
import traceback
158+
155159
traceback.print_exc()
156160

157161

examples/Q10/test_q10_vacuum.py

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -45,17 +45,17 @@ async def main():
4545
try:
4646
user_params = await get_or_create_session()
4747
cache = FileCache(CACHE_PATH)
48-
48+
4949
print("🔄 Connecting to devices...")
5050
device_manager = await create_device_manager(user_params, cache=cache)
5151
devices = await device_manager.get_devices()
52-
52+
5353
print(f"\n📱 Found {len(devices)} device(s)")
54-
54+
5555
# List all devices
5656
for idx, device in enumerate(devices, 1):
5757
print(f" {idx}. {device.name} ({device.product.model})")
58-
58+
5959
# Select device
6060
if len(devices) == 1:
6161
device = devices[0]
@@ -64,16 +64,16 @@ async def main():
6464
device_idx = int(input("\nSelect device number: ")) - 1
6565
device = devices[device_idx]
6666
print(f"\n✅ Selected device: {device.name}")
67-
67+
6868
# Check if it's a Q10 device
6969
if device.b01_q10_properties is None:
7070
print("\n❌ This device doesn't have Q10 properties")
7171
print(f" Model: {device.product.model}")
7272
await cache.flush()
7373
return
74-
74+
7575
vacuum = device.b01_q10_properties.vacuum
76-
76+
7777
print("\n🤖 Q10 Vacuum Trait Test Menu")
7878
print("=" * 50)
7979
print("1. Start cleaning")
@@ -83,11 +83,11 @@ async def main():
8383
print("5. Return to dock")
8484
print("0. Exit")
8585
print("=" * 50)
86-
86+
8787
while True:
8888
try:
8989
choice = input("\nEnter your choice (0-5): ").strip()
90-
90+
9191
if choice == "0":
9292
print("👋 Exiting...")
9393
break
@@ -119,13 +119,15 @@ async def main():
119119
except Exception as e:
120120
print(f"❌ Error: {e}")
121121
import traceback
122+
122123
traceback.print_exc()
123-
124+
124125
await cache.flush()
125-
126+
126127
except Exception as e:
127128
print(f"\n❌ Fatal error: {e}")
128129
import traceback
130+
129131
traceback.print_exc()
130132

131133

0 commit comments

Comments
 (0)