Skip to content

Commit 6d1df20

Browse files
chore(internal): updates to proxy helper (#264)
1 parent c969f5b commit 6d1df20

File tree

1 file changed

+2
-18
lines changed

1 file changed

+2
-18
lines changed

src/finch/_utils/_proxy.py

+2-18
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from abc import ABC, abstractmethod
44
from typing import Generic, TypeVar, Iterable, cast
5-
from typing_extensions import ClassVar, override
5+
from typing_extensions import override
66

77
T = TypeVar("T")
88

@@ -13,11 +13,6 @@ class LazyProxy(Generic[T], ABC):
1313
This includes forwarding attribute access and othe methods.
1414
"""
1515

16-
should_cache: ClassVar[bool] = False
17-
18-
def __init__(self) -> None:
19-
self.__proxied: T | None = None
20-
2116
# Note: we have to special case proxies that themselves return proxies
2217
# to support using a proxy as a catch-all for any random access, e.g. `proxy.foo.bar.baz`
2318

@@ -57,18 +52,7 @@ def __class__(self) -> type:
5752
return proxied.__class__
5853

5954
def __get_proxied__(self) -> T:
60-
if not self.should_cache:
61-
return self.__load__()
62-
63-
proxied = self.__proxied
64-
if proxied is not None:
65-
return proxied
66-
67-
self.__proxied = proxied = self.__load__()
68-
return proxied
69-
70-
def __set_proxied__(self, value: T) -> None:
71-
self.__proxied = value
55+
return self.__load__()
7256

7357
def __as_proxied__(self) -> T:
7458
"""Helper method that returns the current proxy, typed as the loaded object"""

0 commit comments

Comments
 (0)