INNER CODE UNIT · Python

_extract_name

google-antigravity/antigravity-sdk-python · google/antigravity/beta/__init__.py:198

def _extract_name(obj: Any) -> str:
  """Extracts `__name__` from modules, functions, classes, classmethods, staticmethods, or properties."""
  if isinstance(obj, (classmethod, staticmethod)):
    return getattr(obj.__func__, "__name__", "")
  if isinstance(obj, property) and obj.fget is not None:
    return getattr(obj.fget, "__name__", "")
  name = getattr(obj, "__name__", "")
  if isinstance(obj, type(sys)):
    return name.rpartition(".")[-1]
  return name


@overload
def beta(obj_or_name: None = None, /) -> Callable[[T], T]:
  ...


@overload

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…