Skip to content

Commit 0579b8b

Browse files
committed
Fix annotations for older versions of Python
1 parent 32c8420 commit 0579b8b

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

singlestoredb/functions/signature.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1089,7 +1089,7 @@ def get_signature(
10891089
Dict[str, Any]
10901090
10911091
'''
1092-
signature = inspect.signature(func, eval_str=True)
1092+
signature = inspect.signature(func)
10931093
args: List[Dict[str, Any]] = []
10941094
returns: List[Dict[str, Any]] = []
10951095

@@ -1106,6 +1106,8 @@ def get_signature(
11061106
elif p.kind == inspect.Parameter.VAR_KEYWORD:
11071107
raise TypeError('variable keyword arguments are not supported')
11081108

1109+
# TODO: Use typing.get_type_hints() for parameters / return values?
1110+
11091111
# Generate the parameter type and the corresponding SQL code for that parameter
11101112
args_schema = []
11111113
args_data_formats = []

singlestoredb/functions/typing.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
from typing import TypeVar
55

66
try:
7-
from typing import TypeVarTuple
8-
from typing import Unpack
7+
from typing import TypeVarTuple # type: ignore
8+
from typing import Unpack # type: ignore
99
except ImportError:
1010
# Python 3.8 and earlier do not have TypeVarTuple
1111
from typing_extensions import TypeVarTuple # type: ignore
@@ -37,5 +37,5 @@ def __new__(cls, *args: T) -> 'Masked[T]':
3737
class Table(Tuple[Unpack[Ts]]):
3838
"""Return type for a table valued function."""
3939

40-
def __new__(cls, *args: Unpack[Ts]) -> 'Table[Unpack[Ts]]':
40+
def __new__(cls, *args: Unpack[Ts]) -> 'Table[Tuple[Unpack[Ts]]]':
4141
return tuple.__new__(cls, args) # type: ignore

singlestoredb/tests/test_udf_returns.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
from __future__ import annotations
2-
1+
# from __future__ import annotations
32
import unittest
43
from typing import Any
54
from typing import Callable

0 commit comments

Comments
 (0)