From 85e7fa3029fa9c24592a36effab7d1ac9cd391ce Mon Sep 17 00:00:00 2001 From: Aaron Pham <29749331+aarnphm@users.noreply.github.com> Date: Wed, 26 Oct 2022 02:27:01 -0700 Subject: [PATCH] chore: address __new__ Signed-off-by: Aaron Pham <29749331+aarnphm@users.noreply.github.com> --- src/bentoml/metrics.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/bentoml/metrics.py b/src/bentoml/metrics.py index bc91d85950f..83a7a71c45d 100644 --- a/src/bentoml/metrics.py +++ b/src/bentoml/metrics.py @@ -35,6 +35,8 @@ def __call__(self, *args: t.Any, **kwargs: t.Any) -> t.Any: return self def __getattr__(self, item: t.Any) -> t.Any: + if item in ("_attr", "_proxy", "_initialized", "_args", "_kwargs"): + raise AttributeError(f"Attribute {item} is private to {self}.") if self._proxy is None: self._load_proxy() assert self._initialized