Skip to content

Commit e9d5393

Browse files
committed
fix(build): resolve mypyc signature generation error in portal.py
Refactor Portal.call() and PortalProvider.call() signatures to extract timeout from kwargs instead of using an explicit keyword-only parameter. The pattern `*args, timeout=300.0, **kwargs` is valid Python but mypyc's text signature generation fails on it.
1 parent dc89cfc commit e9d5393

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

sqlspec/utils/portal.py

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -149,9 +149,7 @@ async def _async_caller(
149149
result: _R = await func(*args, **kwargs)
150150
return result
151151

152-
def call(
153-
self, func: "Callable[..., Coroutine[Any, Any, _R]]", *args: Any, timeout: float = 300.0, **kwargs: Any
154-
) -> _R:
152+
def call(self, func: "Callable[..., Coroutine[Any, Any, _R]]", *args: Any, **kwargs: Any) -> _R:
155153
"""Call an async function from synchronous context.
156154
157155
Executes the async function in the background event loop and blocks
@@ -160,8 +158,7 @@ def call(
160158
Args:
161159
func: The async function to call.
162160
*args: Positional arguments to the function.
163-
timeout: Maximum seconds to wait for result (default 300).
164-
**kwargs: Keyword arguments to the function.
161+
**kwargs: Keyword arguments. Supports 'timeout' (float, default 300.0).
165162
166163
Returns:
167164
Result of the async function.
@@ -170,6 +167,7 @@ def call(
170167
ImproperConfigurationError: If portal provider not started or timeout reached.
171168
172169
"""
170+
timeout: float = float(kwargs.pop("timeout", 300.0))
173171
if self._loop is None or not self.is_running:
174172
msg = "Portal provider not running. Call start() first."
175173
raise ImproperConfigurationError(msg)
@@ -233,22 +231,19 @@ def __init__(self, provider: "PortalProvider") -> None:
233231
"""
234232
self._provider = provider
235233

236-
def call(
237-
self, func: "Callable[..., Coroutine[Any, Any, _R]]", *args: Any, timeout: float = 300.0, **kwargs: Any
238-
) -> _R:
234+
def call(self, func: "Callable[..., Coroutine[Any, Any, _R]]", *args: Any, **kwargs: Any) -> _R:
239235
"""Call an async function using the portal provider.
240236
241237
Args:
242238
func: The async function to call.
243239
*args: Positional arguments to the function.
244-
timeout: Maximum seconds to wait for result (default 300).
245-
**kwargs: Keyword arguments to the function.
240+
**kwargs: Keyword arguments. Supports 'timeout' (float, default 300.0).
246241
247242
Returns:
248243
Result of the async function.
249244
250245
"""
251-
return self._provider.call(func, *args, timeout=timeout, **kwargs)
246+
return self._provider.call(func, *args, **kwargs)
252247

253248

254249
class PortalManager(metaclass=SingletonMeta):

0 commit comments

Comments
 (0)