Skip to content

Commit d354836

Browse files
TexasCodingclaude
andcommitted
fix(types): add type ignores for async decorators
- Add type: ignore comments for mypy compatibility - Mypy doesn't understand the runtime check for async functions - All 72 source files now pass type checking The decorators correctly use async_wrapper only for async functions at runtime, but mypy can't infer this from the code structure. 🤖 Generated with Claude Code Co-Authored-By: Claude <[email protected]>
1 parent 049c2c4 commit d354836

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/project_x_py/utils/error_handler.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ async def async_wrapper(*args: Any, **kwargs: Any) -> T:
6060
logger = logging.getLogger(func.__module__)
6161

6262
try:
63-
return await func(*args, **kwargs)
63+
return await func(*args, **kwargs) # type: ignore[misc,no-any-return]
6464
except ProjectXError as e:
6565
# Already a ProjectX error, just add context
6666
logger.error(
@@ -188,7 +188,7 @@ async def async_wrapper(*args: Any, **kwargs: Any) -> T:
188188

189189
for attempt in range(max_attempts):
190190
try:
191-
return await func(*args, **kwargs)
191+
return await func(*args, **kwargs) # type: ignore[misc,no-any-return]
192192
except retry_on as e:
193193
last_exception = e
194194

@@ -297,7 +297,7 @@ async def async_wrapper(*args: Any, **kwargs: Any) -> T:
297297
logger = logging.getLogger(func.__module__)
298298

299299
try:
300-
return await func(*args, **kwargs)
300+
return await func(*args, **kwargs) # type: ignore[misc,no-any-return]
301301
except ProjectXRateLimitError as e:
302302
# Check if we have a reset time in the response
303303
reset_time = None
@@ -331,7 +331,7 @@ async def async_wrapper(*args: Any, **kwargs: Any) -> T:
331331
await asyncio.sleep(delay)
332332

333333
# Retry once after waiting
334-
return await func(*args, **kwargs)
334+
return await func(*args, **kwargs) # type: ignore[misc,no-any-return]
335335

336336
@functools.wraps(func)
337337
def sync_wrapper(*args: Any, **kwargs: Any) -> T:
@@ -369,7 +369,7 @@ async def get_order(self, order_id: str):
369369
def decorator(func: Callable[..., T]) -> Callable[..., T]:
370370
@functools.wraps(func)
371371
async def async_wrapper(*args: Any, **kwargs: Any) -> T:
372-
result = await func(*args, **kwargs)
372+
result = await func(*args, **kwargs) # type: ignore[misc]
373373

374374
# Validate type
375375
if response_type is not None and not isinstance(result, response_type):
@@ -387,7 +387,7 @@ async def async_wrapper(*args: Any, **kwargs: Any) -> T:
387387
f"{', '.join(missing_fields)}"
388388
)
389389

390-
return result
390+
return result # type: ignore[no-any-return]
391391

392392
@functools.wraps(func)
393393
def sync_wrapper(*args: Any, **kwargs: Any) -> T:

0 commit comments

Comments
 (0)