INNER CODE UNIT · Python
_is_class_member
google-antigravity/antigravity-sdk-python · google/antigravity/beta/__init__.py:187
def _is_class_member(obj: Any) -> bool:
"""Returns True if `obj` is a descriptor or method defined inside a class body."""
if isinstance(obj, (classmethod, staticmethod, property)):
return True
if isinstance(obj, type) or not callable(obj):
return False
qualname = getattr(obj, "__qualname__", "")
parent_scope, sep, _ = qualname.rpartition(".")
return bool(sep) and not parent_scope.endswith("<locals>")
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__", "")