Skip to content

Commit

Permalink
Fix mypy warning
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
mattsta committed Mar 20, 2024
1 parent 20badd6 commit 140ed2c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ib_async/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import struct
import time
from collections import deque
from typing import Deque, List, Optional
from typing import Deque, List, Optional, Callable, Any

from eventkit import Event

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

# fmt: off
FORMAT_HANDLERS = {
FORMAT_HANDLERS: dict[Any, Callable[[Any], str]] = {
# Contracts are formatted in IBKR null delimiter format
Contract: lambda c: "\0".join([
str(f)
Expand Down

0 comments on commit 140ed2c

Please sign in to comment.