@@ -100,10 +100,7 @@ def _get_weights(weight_uri, weight_type, source, root, **kwargs):
100100
101101 elif weight_type == "onnx" :
102102 weights = model_spec .raw_nodes .OnnxWeightsEntry (
103- source = weight_source ,
104- sha256 = weight_hash ,
105- opset_version = kwargs .get ("opset_version" , 12 ),
106- ** attachments
103+ source = weight_source , sha256 = weight_hash , opset_version = kwargs .get ("opset_version" , 12 ), ** attachments
107104 )
108105 language = None
109106 framework = None
@@ -197,9 +194,7 @@ def _get_input_tensor(path, name, step, min_shape, data_range, axes, preprocessi
197194
198195 kwargs = {}
199196 if preprocessing is not None :
200- kwargs ["preprocessing" ] = [
201- {"name" : k , "kwargs" : v } for k , v in preprocessing .items ()
202- ]
197+ kwargs ["preprocessing" ] = [{"name" : k , "kwargs" : v } for k , v in preprocessing .items ()]
203198
204199 inputs = model_spec .raw_nodes .InputTensor (
205200 name = "input" if name is None else name ,
@@ -229,9 +224,7 @@ def _get_output_tensor(path, name, reference_tensor, scale, offset, axes, data_r
229224
230225 kwargs = {}
231226 if postprocessing is not None :
232- kwargs ["postprocessing" ] = [
233- {"name" : k , "kwargs" : v } for k , v in postprocessing .items ()
234- ]
227+ kwargs ["postprocessing" ] = [{"name" : k , "kwargs" : v } for k , v in postprocessing .items ()]
235228 if halo is not None :
236229 kwargs ["halo" ] = halo
237230
@@ -389,8 +382,9 @@ def build_model(
389382
390383 inputs = [
391384 _get_input_tensor (test_in , name , step , min_shape , axes , data_range , preproc )
392- for test_in , name , step , min_shape , axes , data_range , preproc in
393- zip (test_inputs , input_name , input_step , input_min_shape , input_axes , input_data_range , preprocessing )
385+ for test_in , name , step , min_shape , axes , data_range , preproc in zip (
386+ test_inputs , input_name , input_step , input_min_shape , input_axes , input_data_range , preprocessing
387+ )
394388 ]
395389
396390 n_outputs = len (test_outputs )
@@ -405,8 +399,7 @@ def build_model(
405399
406400 outputs = [
407401 _get_output_tensor (test_out , name , reference , scale , offset , axes , data_range , postproc , hal )
408- for test_out , name , reference , scale , offset , axes , data_range , postproc , hal in
409- zip (
402+ for test_out , name , reference , scale , offset , axes , data_range , postproc , hal in zip (
410403 test_outputs ,
411404 output_name ,
412405 output_reference ,
@@ -415,7 +408,7 @@ def build_model(
415408 output_axes ,
416409 output_data_range ,
417410 postprocessing ,
418- halo
411+ halo ,
419412 )
420413 ]
421414
@@ -449,7 +442,7 @@ def build_model(
449442 "source" : source ,
450443 "sha256" : source_hash ,
451444 "kwargs" : model_kwargs ,
452- "links" : links
445+ "links" : links ,
453446 }
454447 kwargs = {k : v for k , v in optional_kwargs .items () if v is not None }
455448 if dependencies is not None :
@@ -495,13 +488,13 @@ def add_weights(
495488 weight_uri : Union [str , Path ],
496489 weight_type : Optional [str ] = None ,
497490 output_path : Optional [Union [str , Path ]] = None ,
498- ** weight_kwargs
491+ ** weight_kwargs ,
499492):
500493 """Add weight entry to bioimage.io model."""
501494 # we need to patss the weight path as abs path to avoid confusion with different root directories
502- new_weights = _get_weights (
503- Path ( weight_uri ). absolute (), weight_type , source = None , root = Path ( "." ), ** weight_kwargs
504- )[ 0 ]
495+ new_weights = _get_weights (Path ( weight_uri ). absolute (), weight_type , source = None , root = Path ( "." ), ** weight_kwargs )[
496+ 0
497+ ]
505498 model .weights .update (new_weights )
506499 if output_path is not None :
507500 model_package = export_resource_package (model , output_path = output_path )
0 commit comments