Skip to content

Commit

Permalink
fix has_operation False when backend module is missing
Browse files Browse the repository at this point in the history
  • Loading branch information
camriddell committed Jan 13, 2025
1 parent c9ae6c1 commit 4ce837b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion narwhals/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1165,7 +1165,11 @@ def has_operation(native_namespace: ModuleType, operation: Any) -> bool:
raise ValueError(msg) from e

_, _, module_name = nw_cls.__module__.partition(".")
module_ = import_module(f"narwhals.{backend}.{module_name}")
try:
module_ = import_module(f"narwhals.{backend}.{module_name}")
except ModuleNotFoundError:
return False

classes_ = getmembers(
module_,
predicate=lambda c: (
Expand Down

0 comments on commit 4ce837b

Please sign in to comment.