Skip to content

Commit 49521d1

Browse files
kesmit13claude
andcommitted
Add type annotations to WASM numpy stub and UDF handler
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 73dcaad commit 49521d1

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

singlestoredb/functions/ext/wasm/numpy_stub.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ class _DtypeMeta(type):
1313

1414
class dtype(metaclass=_DtypeMeta):
1515
"""Stub dtype class."""
16-
def __init__(self, spec=None):
16+
def __init__(self, spec: object = None) -> None:
1717
self.spec = spec
1818

19-
def __repr__(self):
19+
def __repr__(self) -> str:
2020
return f'dtype({self.spec!r})'
2121

2222

singlestoredb/functions/ext/wasm/udf_handler.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,12 @@ class _TracingFormatter(logging.Formatter):
5858
'CRITICAL': '\033[31m', # red
5959
}
6060

61-
def formatTime(self, record, datefmt=None):
61+
def formatTime(self, record: logging.LogRecord, datefmt: str | None = None) -> str:
6262
from datetime import datetime, timezone
6363
dt = datetime.fromtimestamp(record.created, tz=timezone.utc)
6464
return dt.strftime('%Y-%m-%dT%H:%M:%S.') + f'{dt.microsecond:06d}Z'
6565

66-
def format(self, record):
66+
def format(self, record: logging.LogRecord) -> str:
6767
ts = self.formatTime(record)
6868
color = self._LEVEL_COLORS.get(record.levelname, '')
6969
level = f'{color}{self._BOLD}{record.levelname:>5}{self._RESET}'
@@ -101,7 +101,7 @@ def format(self, record):
101101
class FunctionRegistry:
102102
"""Registry of discovered UDF functions."""
103103

104-
def __init__(self):
104+
def __init__(self) -> None:
105105
self.functions: Dict[str, Dict[str, Any]] = {}
106106

107107
def initialize(self) -> None:
@@ -331,7 +331,7 @@ def create_function(
331331

332332
def _register_function(
333333
self,
334-
func: Callable,
334+
func: Callable[..., Any],
335335
func_name: str,
336336
sig: Dict[str, Any],
337337
) -> None:

0 commit comments

Comments
 (0)