@@ -149,7 +149,7 @@ def add_arguments_to_parser(self, parser: ArgumentParser) -> None:
149149 parser .add_argument ("--metrics.image" , type = list [str ] | str | None , default = None )
150150 parser .add_argument ("--metrics.pixel" , type = list [str ] | str | None , default = None , required = False )
151151 parser .add_argument ("--logging.log_graph" , type = bool , help = "Log the model to the logger" , default = False )
152- if hasattr (parser , "subcommand" ) and parser .subcommand not in ( "export" , "predict" ) :
152+ if hasattr (parser , "subcommand" ) and parser .subcommand not in { "export" , "predict" } :
153153 parser .link_arguments ("task" , "data.init_args.task" )
154154 parser .add_argument (
155155 "--default_root_dir" ,
@@ -273,7 +273,7 @@ def _set_install_subcommand(self, action_subcommand: _ActionSubCommands) -> None
273273 def before_instantiate_classes (self ) -> None :
274274 """Modify the configuration to properly instantiate classes and sets up tiler."""
275275 subcommand = self .config ["subcommand" ]
276- if subcommand in ( * self .subcommands (), "train" , "predict" ) :
276+ if subcommand in { * self .subcommands (), "train" , "predict" } :
277277 self .config [subcommand ] = update_config (self .config [subcommand ])
278278
279279 def instantiate_classes (self ) -> None :
@@ -283,7 +283,7 @@ def instantiate_classes(self) -> None:
283283 But for subcommands we do not want to instantiate any trainer specific classes such as datamodule, model, etc
284284 This is because the subcommand is responsible for instantiating and executing code based on the passed config
285285 """
286- if self .config ["subcommand" ] in ( * self .subcommands (), "predict" ) : # trainer commands
286+ if self .config ["subcommand" ] in { * self .subcommands (), "predict" } : # trainer commands
287287 # since all classes are instantiated, the LightningCLI also creates an unused ``Trainer`` object.
288288 # the minor change here is that engine is instantiated instead of trainer
289289 self .config_init = self .parser .instantiate_classes (self .config )
@@ -296,7 +296,7 @@ def instantiate_classes(self) -> None:
296296 else :
297297 self .config_init = self .parser .instantiate_classes (self .config )
298298 subcommand = self .config ["subcommand" ]
299- if subcommand in ( "train" , "export" ) :
299+ if subcommand in { "train" , "export" } :
300300 self .instantiate_engine ()
301301 if "model" in self .config_init [subcommand ]:
302302 self .model = self ._get (self .config_init , "model" )
@@ -352,7 +352,7 @@ def _run_subcommand(self) -> None:
352352
353353 install_kwargs = self .config .get ("install" , {})
354354 anomalib_install (** install_kwargs )
355- elif self .config ["subcommand" ] in ( * self .subcommands (), "train" , "export" , "predict" ) :
355+ elif self .config ["subcommand" ] in { * self .subcommands (), "train" , "export" , "predict" } :
356356 fn = getattr (self .engine , self .subcommand )
357357 fn_kwargs = self ._prepare_subcommand_kwargs (self .subcommand )
358358 fn (** fn_kwargs )
0 commit comments