pinecone.openapi_support.cached_class_property

 1class cached_class_property:
 2    def __init__(self, func) -> None:
 3        self.func = func
 4        self.attr_name = f"__cached_{func.__name__}"
 5
 6    def __get__(self, instance, owner):
 7        # The value is stored on the owner (the class), not the instance.
 8        if hasattr(owner, self.attr_name):
 9            return getattr(owner, self.attr_name)
10        value = self.func(owner)
11        setattr(owner, self.attr_name, value)
12        return value
class cached_class_property:
 2class cached_class_property:
 3    def __init__(self, func) -> None:
 4        self.func = func
 5        self.attr_name = f"__cached_{func.__name__}"
 6
 7    def __get__(self, instance, owner):
 8        # The value is stored on the owner (the class), not the instance.
 9        if hasattr(owner, self.attr_name):
10            return getattr(owner, self.attr_name)
11        value = self.func(owner)
12        setattr(owner, self.attr_name, value)
13        return value
cached_class_property(func)
3    def __init__(self, func) -> None:
4        self.func = func
5        self.attr_name = f"__cached_{func.__name__}"
func
attr_name