Skip to content

Commit d6bc625

Browse files
committed
General cleanup
1 parent b112ba0 commit d6bc625

File tree

4 files changed

+117
-137
lines changed

4 files changed

+117
-137
lines changed

singlestoredb/functions/decorator.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,14 @@ def is_valid_callable(obj: Any) -> bool:
5858
return False
5959

6060

61-
def expand_types(args: Any) -> List[Any]:
61+
def expand_types(args: Any) -> Any:
6262
"""Expand the types for the function arguments / return values."""
6363
if args is None:
6464
return []
6565

66+
is_list = True
6667
if not isinstance(args, list):
68+
is_list = False
6769
args = [args]
6870

6971
new_args = []
@@ -74,6 +76,9 @@ def expand_types(args: Any) -> List[Any]:
7476
new_args.append(arg())
7577
else:
7678
new_args.append(arg)
79+
80+
if not is_list:
81+
return new_args[0]
7782
return new_args
7883

7984

@@ -87,6 +92,15 @@ def _func(
8792
) -> UDFType:
8893
"""Generic wrapper for UDF and TVF decorators."""
8994

95+
if isinstance(args, dict):
96+
raise TypeError(
97+
'The `args` parameter must be a list of data types, not a dict.',
98+
)
99+
if isinstance(returns, dict):
100+
raise TypeError(
101+
'The `returns` parameter must be a list of data types, not a dict.',
102+
)
103+
90104
_singlestoredb_attrs = { # type: ignore
91105
k: v for k, v in dict(
92106
name=name,

0 commit comments

Comments
 (0)