INNER CODE UNIT · Python
__get__
google-antigravity/antigravity-sdk-python · google/antigravity/beta/__init__.py:142
def __get__(self, instance: Any, owner: type[Any] | None = None) -> Any:
if owner is None:
owner = type(instance)
if instance is None:
cached = owner.__dict__.get(_CLASS_NS_CACHE_ATTR)
if cached is None:
cached = _BoundBetaNamespace(None, owner)
setattr(owner, _CLASS_NS_CACHE_ATTR, cached)
return cached
if hasattr(instance, "__dict__"):
cached = instance.__dict__.get(_INSTANCE_NS_CACHE_ATTR)
if cached is not None and cached._instance is instance:
return cached
cached = _BoundBetaNamespace(instance, owner)
try:
object.__setattr__(instance, _INSTANCE_NS_CACHE_ATTR, cached)
except (AttributeError, TypeError):