addded type hinting
import asyncio
from functools import wraps
-from typing import Optional, Union
+from typing import Optional, Union, Callable, Dict, Any
from graphql import GraphQLError, parse
@@ -27,9 +27,9 @@ def unwrap_graphql_error(
return error
-def convert_kwargs_to_snake_case(func):
- def convert_to_snake_case(d):
- converted = {}
+def convert_kwargs_to_snake_case(func: Callable) -> Callable:
+ def convert_to_snake_case(d: Dict) -> Dict:
+ converted: Dict = {}
for k, v in d.items():
if isinstance(v, dict):
v = convert_to_snake_case(v)
@@ -39,13 +39,13 @@ def convert_kwargs_to_snake_case(func):
if asyncio.iscoroutinefunction(func):
@wraps(func)
- async def async_wrapper(*args, **kwargs):
+ async def async_wrapper(*args: Any, **kwargs: Any) -> Any:
return await func(*args, **convert_to_snake_case(kwargs))
return async_wrapper
@wraps(func)
- def wrapper(*args, **kwargs):
+ def wrapper(*args: Any, **kwargs: Any) -> Any:
return func(*args, **convert_to_snake_case(kwargs))
return wrapper
