Skip to content

A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.

fix: type opaque Python introspection inputs (#11513)

Shahmir Varqha98ada291d9a2
diff --git a/marimo/_utils/methods.py b/marimo/_utils/methods.py
index 58bada1ca0..bba73df468 100644
--- a/marimo/_utils/methods.py
+++ b/marimo/_utils/methods.py
@@ -7,7 +7,7 @@ from collections.abc import Callable
from typing import Any, cast
-def is_callable_method(obj: Any, attr: str) -> bool:
+def is_callable_method(obj: object, attr: str) -> bool:
"""Check if an attribute is a real callable method on an object.
Uses `inspect.getattr_static` so that attributes synthesized by
diff --git a/marimo/_utils/variable_name.py b/marimo/_utils/variable_name.py
index 42be9e5bfc..91b3cb5e32 100644
--- a/marimo/_utils/variable_name.py
+++ b/marimo/_utils/variable_name.py
@@ -2,14 +2,13 @@
from __future__ import annotations
import inspect
-from typing import Any
from marimo import _loggers
LOGGER = _loggers.marimo_logger()
-def infer_variable_name(value: Any, fallback: str) -> str:
+def infer_variable_name(value: object, fallback: str) -> str:
"""Infer the variable name that holds `value` in the caller's caller.
Walks up two frames (skipping this helper and the direct caller) and
diff --git a/marimo/_utils/with_skip.py b/marimo/_utils/with_skip.py
index 2a9a58e37a..40772328b9 100644
--- a/marimo/_utils/with_skip.py
+++ b/marimo/_utils/with_skip.py
@@ -4,7 +4,7 @@ from __future__ import annotations
import inspect
import sys
from abc import ABC, abstractmethod
-from typing import TYPE_CHECKING, Any, NoReturn
+from typing import TYPE_CHECKING, NoReturn
if TYPE_CHECKING:
from types import FrameType
@@ -39,7 +39,7 @@ class SkipContext(ABC):
return self
def _trace_wrapper(
- self, frame: FrameType, event: str, arg: Any
+ self, frame: FrameType, event: str, arg: object
) -> TraceFunction | None:
"""Wrapper function that ensures we do not break existing traces (e.g., code coverage)."""
result = None
@@ -55,7 +55,7 @@ class SkipContext(ABC):
raise SkipWithBlock()
def _trace(
- self, with_frame: FrameType, _event: str, _arg: Any
+ self, with_frame: FrameType, _event: str, _arg: object
) -> TraceFunction | None:
self._entered_trace = True