File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -593,7 +593,12 @@ def _field_metadata(
593
593
return attr .NOTHING
594
594
return val
595
595
elif "callable" in fld .metadata :
596
- call_args = inspect .getfullargspec (fld .metadata ["callable" ])
596
+ callable_ = fld .metadata ["callable" ]
597
+ if isinstance (callable_ , staticmethod ):
598
+ # In case callable is defined as a static method,
599
+ # retrieve the function wrapped in the descriptor.
600
+ callable_ = callable_ .__func__
601
+ call_args = inspect .getfullargspec (callable_ )
597
602
call_args_val = {}
598
603
for argnm in call_args .args :
599
604
if argnm == "field" :
@@ -615,7 +620,7 @@ def _field_metadata(
615
620
f"has to be in inputs or be field or output_dir, "
616
621
f"but { argnm } is used"
617
622
)
618
- return fld . metadata [ "callable" ] (** call_args_val )
623
+ return callable_ (** call_args_val )
619
624
else :
620
625
raise Exception ("(_field_metadata) is not a current valid metadata key." )
621
626
You can’t perform that action at this time.
0 commit comments