2626extraction_method_defaults = {}
2727
2828
29- class ExtractionMethodConf (BaseModel ):
30- """STAC extraction method model."""
31-
32- method : str
33- inputs : Optional [dict [str , Any ]] = {}
34-
35- _extraction_methods : EntryPoints = entry_points (group = "extraction_methods" )
36-
37- def __repr__ (self ) -> Any :
38- return yaml .dump (self .model_dump ())
39-
40- def _run (self , body : dict [str , Any ]) -> dict [str , Any ]:
41- extraction_method = self ._extraction_methods [self .method ].load ()
42- extraction_method = extraction_method (self )
43-
44- return extraction_method ._run (body ) # type: ignore[no-any-return]
45-
46-
4729def update_input (
48- func : Callable [[Any , dict [str , Any ]], Any ]
30+ func : Callable [[Any , dict [str , Any ]], Any ],
4931) -> Callable [[Any , dict [str , Any ]], Any ]:
5032 """
5133 Wrapper to update inputs with body values before run.
@@ -64,7 +46,7 @@ def wrapper(self, body: dict[str, Any]) -> Any: # type: ignore[no-untyped-def]
6446 return wrapper
6547
6648
67- def set_extraction_method_defaults (conf_defaults : dict [ str , Any ]) -> None :
49+ def set_extraction_method_defaults (conf_defaults : dict ) :
6850 """
6951 Function to set global extraction_method_defaults variable.
7052 """
@@ -80,9 +62,7 @@ class SetInput:
8062 input_class : Any = Input
8163 dummy_input_class : Any = DummyInput
8264
83- def __init__ (
84- self , extraction_method_conf : ExtractionMethodConf , * args : Any , ** kwargs : Any
85- ) -> None :
65+ def __init__ (self , extraction_method_conf : dict , * args : Any , ** kwargs : Any ) -> None :
8666 """
8767 Set ``input`` attribute to instance of ``dummy_input_class`` with
8868 default values overrided by kwargs.
@@ -200,3 +180,21 @@ def run(self, body: dict[str, Any]) -> Iterator[dict[str, Any]]:
200180 :return: updated body dict
201181 :rtype: dict
202182 """
183+
184+
185+ class ExtractionMethodConf (BaseModel ):
186+ """STAC extraction method model."""
187+
188+ method : str
189+ inputs : Optional [dict ] = {}
190+
191+ _extraction_methods : EntryPoints = entry_points (group = "extraction_methods" )
192+
193+ def __repr__ (self ):
194+ return yaml .dump (self .model_dump ())
195+
196+ def _run (self , body : dict [str , Any ]) -> dict [str , Any ]:
197+ extraction_method = self ._extraction_methods [self .method ].load ()
198+ extraction_method = extraction_method (self )
199+
200+ return extraction_method ._run (body )
0 commit comments