Skip to content

Commit f33a97f

Browse files
committed
Use isinstance to improve mypy compliance
And remove the now-unused `# type: ignore`s. Signed-off-by: Sahas Subramanian <[email protected]>
1 parent 5ae31f3 commit f33a97f

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

src/frequenz/client/electricity_trading/_client.py

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -638,23 +638,21 @@ async def update_gridpool_order(
638638
update_mask = field_mask_pb2.FieldMask(paths=paths)
639639

640640
update_order_fields = UpdateOrder(
641-
price=None if price is NO_VALUE else price, # type: ignore
642-
quantity=None if quantity is NO_VALUE else quantity, # type: ignore
643-
stop_price=None if stop_price is NO_VALUE else stop_price, # type: ignore
641+
price=None if isinstance(price, _Sentinel) else price,
642+
quantity=None if isinstance(quantity, _Sentinel) else quantity,
643+
stop_price=None if isinstance(stop_price, _Sentinel) else stop_price,
644644
peak_price_delta=(
645-
None if peak_price_delta is NO_VALUE else peak_price_delta # type: ignore
645+
None if isinstance(peak_price_delta, _Sentinel) else peak_price_delta
646646
),
647647
display_quantity=(
648-
None if display_quantity is NO_VALUE else display_quantity # type: ignore
648+
None if isinstance(display_quantity, _Sentinel) else display_quantity
649649
),
650650
execution_option=(
651-
None if execution_option is NO_VALUE else execution_option # type: ignore
651+
None if isinstance(execution_option, _Sentinel) else execution_option
652652
),
653-
valid_until=(
654-
None if valid_until is NO_VALUE else valid_until # type: ignore
655-
),
656-
payload=None if payload is NO_VALUE else payload, # type: ignore
657-
tag=None if tag is NO_VALUE else tag, # type: ignore
653+
valid_until=(None if isinstance(valid_until, _Sentinel) else valid_until),
654+
payload=None if isinstance(payload, _Sentinel) else payload,
655+
tag=None if isinstance(tag, _Sentinel) else tag,
658656
)
659657

660658
try:

0 commit comments

Comments
 (0)