Skip to content

Commit 140ed2c

Browse files
committed
Fix mypy warning
Our new type formatting lookup table dict is using `.get(val, str)` where `str` is the fallback class we'd use if no direct matches are found, but mypy finds it confusing returning a type constructor in place of everything else. Manual type override helps mypy be less confused about our usecase here.
1 parent 20badd6 commit 140ed2c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

ib_async/client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import struct
88
import time
99
from collections import deque
10-
from typing import Deque, List, Optional
10+
from typing import Deque, List, Optional, Callable, Any
1111

1212
from eventkit import Event
1313

@@ -252,7 +252,7 @@ def send(self, *fields, makeEmpty=True):
252252
raise ConnectionError("Not connected")
253253

254254
# fmt: off
255-
FORMAT_HANDLERS = {
255+
FORMAT_HANDLERS: dict[Any, Callable[[Any], str]] = {
256256
# Contracts are formatted in IBKR null delimiter format
257257
Contract: lambda c: "\0".join([
258258
str(f)

0 commit comments

Comments
 (0)