File tree Expand file tree Collapse file tree 1 file changed +10
-7
lines changed
Expand file tree Collapse file tree 1 file changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -91,14 +91,16 @@ def __getattr__(self, name):
9191 # Try autoloading and then delegate
9292 if name .startswith ("__" ): # avoid dunder recursion
9393 raise AttributeError (name )
94- with self ._lock :
95- if self .estimator is None and self .auto_load :
96- self ._load_inplace ()
97- if self .estimator is not None and hasattr (self .estimator , name ):
98- return getattr (self .estimator , name )
99- # Fallback to default behavior
100- raise AttributeError (f"{ type (self ).__name__ } has no attribute '{ name } '" )
10194
95+ if self .estimator is None and not self .auto_load :
96+ raise AttributeError (f"Trying to get a attribute of estimator, but the estimator can not be auto-loaded from the disk because auto_load=False." )
97+
98+ with self ._loaded_estimator () as est :
99+ if hasattr (est , name ):
100+ return getattr (est , name )
101+ else :
102+ raise AttributeError (f"{ type (est ).__name__ } has no attribute '{ name } '" )
103+
102104 # ---------- Persistence helpers ----------
103105 def _resolve_path (self ) -> Path :
104106 if self .dump_dir is None :
@@ -144,6 +146,7 @@ def dump(self) -> Path:
144146 tmp_dir .rmdir ()
145147 except Exception :
146148 pass
149+
147150 return path
148151
149152
You can’t perform that action at this time.
0 commit comments