From da6b40c8594e537e3b2c7a96bba107db25aedcc8 Mon Sep 17 00:00:00 2001 From: Julien Chaffraix Date: Fri, 1 May 2026 09:50:47 -0700 Subject: [PATCH] Type the return type of connect{Async} The type was omitted which causes issues downstream if the typechecker is set in strict mode. Since the return type references the class being created, we need to use forward references: https://peps.python.org/pep-0484/#forward-references --- ib_async/ib.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ib_async/ib.py b/ib_async/ib.py index 3edfb8d..05d43eb 100644 --- a/ib_async/ib.py +++ b/ib_async/ib.py @@ -347,7 +347,7 @@ def connect( account: str = "", raiseSyncErrors: bool = False, fetchFields: StartupFetch = StartupFetchALL, - ): + ) -> 'IB': """ Connect to a running TWS or IB gateway application. After the connection is made the client is fully synchronized @@ -2044,7 +2044,7 @@ async def connectAsync( account: str = "", raiseSyncErrors: bool = False, fetchFields: StartupFetch = StartupFetchALL, - ): + ) -> 'IB': clientId = int(clientId) self.wrapper.clientId = clientId timeout = timeout or None