File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -128,6 +128,25 @@ def __post_init__(self) -> None:
128128 self .__name__ = getattr (self .func , "__name__" , self .name )
129129 self .__doc__ = getattr (self .func , "__doc__" , None )
130130
131+ def __get__ (self , obj : t .Any , objtype : t .Any ) -> "Task[P, R]" :
132+ if obj is None :
133+ return self
134+
135+ bound_func = self .func .__get__ (obj , objtype )
136+
137+ return Task (
138+ tracer = self .tracer ,
139+ name = self .name ,
140+ label = self .label ,
141+ attributes = self .attributes ,
142+ func = bound_func ,
143+ scorers = [scorer .clone () for scorer in self .scorers ],
144+ tags = self .tags .copy (),
145+ log_params = self .log_params ,
146+ log_inputs = self .log_inputs ,
147+ log_output = self .log_output ,
148+ )
149+
131150 def _bind_args (self , * args : P .args , ** kwargs : P .kwargs ) -> dict [str , t .Any ]:
132151 signature = inspect .signature (self .func )
133152 bound_args = signature .bind (* args , ** kwargs )
You can’t perform that action at this time.
0 commit comments