Skip to content

Commit

Permalink
Replace calls to deprecated inspect._is_type by inspect.isclass.
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandervsokol committed Sep 24, 2024
1 parent 7fe6b50 commit c713aef
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cl/runtime/primitive/primitive_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,15 @@ class PrimitiveUtil:
def is_primitive(cls, type_: Type | str) -> bool:
"""Check if the provided type is primitive."""

type_name = type_.__name__ if inspect._is_type(type_) else type_ # noqa
type_name = type_.__name__ if inspect.isclass(type_) else type_ # noqa
return type_name in cls.primitive_type_map

@classmethod
@cached
def get_runtime_name(cls, type_: Type | str) -> str:
"""Return type's Runtime name."""

type_name = type_.__name__ if inspect._is_type(type_) else type_ # noqa
type_name = type_.__name__ if inspect.isclass(type_) else type_ # noqa
if not cls.is_primitive(type_name):
raise RuntimeError(f"Primitive type {type_name} is not supported.")
return cls.primitive_type_map.get(type_name)

0 comments on commit c713aef

Please sign in to comment.