Repository: Project-MONAI/MONAI

Issue:
premerge flake8 B908
**Describe the bug**
all minor warnings from the test cases:
```
flake8
6.0.0 (flake8-bugbear: 23.5.9, flake8-comprehensions: 3.12.0, mccabe: 0.7.0,
pep8-naming: 0.13.3, pycodestyle: 2.10.0, pyflakes: 3.0.1) CPython 3.8.16 on
Linux
/home/runner/work/MONAI/MONAI/tests/test_affine_transform.py:127:9: B908 assertRaises-type context should not contains more than one top-level statement.
/home/runner/work/MONAI/MONAI/tests/test_affine_transform.py:291:9: B908 assertRaises-type context should not contains more than one top-level statement.
/home/runner/work/MONAI/MONAI/tests/test_affine_transform.py:298:9: B908 assertRaises-type context should not contains more than one top-level statement.
/home/runner/work/MONAI/MONAI/tests/test_affine_transform.py:306:9: B908 assertRaises-type context should not contains more than one top-level statement.
/home/runner/work/MONAI/MONAI/tests/test_affine_transform.py:315:9: B908 assertRaises-type context should not contains more than one top-level statement.
/home/runner/work/MONAI/MONAI/tests/test_affine_transform.py:325:9: B908 assertRaises-type context should not contains more than one top-level statement.
/home/runner/work/MONAI/MONAI/tests/test_affine_transform.py:335:9: B908 assertRaises-type context should not contains more than one top-level statement.
/home/runner/work/MONAI/MONAI/tests/test_affine_transform.py:341:9: B908 assertRaises-type context should not contains more than one top-level statement.
/home/runner/work/MONAI/MONAI/tests/test_avg_merger.py:154:9: B908 assertRaises-type context should not contains more than one top-level statement.
/home/runner/work/MONAI/MONAI/tests/test_compute_regression_metrics.py:128:9: B908 assertRaises-type context should not contains more than one top-level statement.
/home/runner/work/MONAI/MONAI/tests/test_compute_regression_metrics.py:134:9: B908 assertRaises-type context should not contains more than one top-level statement.
/home/runner/work/MONAI/MONAI/tests/test_config_parser.py:229:9: B908 assertRaises-type context should not contains more than one top-level statement.
/home/runner/work/MONAI/MONAI/tests/test_crop_foreground.py:142:9: B908 assertRaises-type context should not contains more than one top-level statement.
/home/runner/work/MONAI/MONAI/tests/test_cumulative.py:53:9: B908 assertRaises-type context should not contains more than one top-level statement.
/home/runner/work/MONAI/MONAI/tests/test_cumulative.py:57:9: B908 assertRaises-type context should not contains more than one top-level statement.
/home/runner/work/MONAI/MONAI/tests/test_deprecated.py:221:9: B908 assertRaises-type context should not contains more than one top-level statement.
/home/runner/work/MONAI/MONAI/tests/test_deprecated.py:303:9: B908 assertRaises-type context should not contains more than one top-level statement.
/home/runner/work/MONAI/MONAI/tests/test_deprecated.py:322:9: B908 assertRaises-type context should not contains more than one top-level statement.
/home/runner/work/MONAI/MONAI/tests/test_dice_ce_loss.py:94:9: B908 assertRaises-type context should not contains more than one top-level statement.
/home/runner/work/MONAI/MONAI/tests/test_dice_loss.py:179:9: B908 assertRaises-type context should not contains more than one top-level statement.
/home/runner/work/MONAI/MONAI/tests/test_dice_loss.py:182:9: B908 assertRaises-type context should not contains more than one top-level statement.
/home/runner/work/MONAI/MONAI/tests/test_dice_loss.py:185:9: B908 assertRaises-type context should not contains more than one top-level statement.
```


Discussion:

Resolving patch:
diff --git a/monai/apps/nnunet/nnunetv2_runner.py b/monai/apps/nnunet/nnunetv2_runner.py
--- a/monai/apps/nnunet/nnunetv2_runner.py
+++ b/monai/apps/nnunet/nnunetv2_runner.py
@@ -497,7 +497,6 @@ def train_single_model(self, config: Any, fold: int, gpu_id: tuple | list | int
         from nnunetv2.run.run_training import run_training
             kwargs: this optional parameter allows you to specify additional arguments in
                 ``nnunetv2.run.run_training.run_training``. Currently supported args are
-                    - trainer_class_name: name of the custom trainer class. Default: "nnUNetTrainer".
                     - plans_identifier: custom plans identifier. Default: "nnUNetPlans".
                     - pretrained_weights: path to nnU-Net checkpoint file to be used as pretrained model. Will only be
                         used when actually training. Beta. Use with caution. Default: False.
@@ -514,6 +513,14 @@ def train_single_model(self, config: Any, fold: int, gpu_id: tuple | list | int
             kwargs.pop("num_gpus")
             logger.warning("please use gpu_id to set the GPUs to use")
 
+        if "trainer_class_name" in kwargs:
+            kwargs.pop("trainer_class_name")
+            logger.warning("please specify the `trainer_class_name` in the __init__ of `nnUNetV2Runner`.")
+
+        if "export_validation_probabilities" in kwargs:
+            kwargs.pop("export_validation_probabilities")
+            logger.warning("please specify the `export_validation_probabilities` in the __init__ of `nnUNetV2Runner`.")
+
         if isinstance(gpu_id, tuple) or isinstance(gpu_id, list):
             if len(gpu_id) > 1:
                 gpu_ids_str = ""


Test patch:
diff --git a/tests/test_integration_nnunetv2_runner.py b/tests/test_integration_nnunetv2_runner.py
--- a/tests/test_integration_nnunetv2_runner.py
+++ b/tests/test_integration_nnunetv2_runner.py
@@ -81,11 +81,11 @@ def setUp(self) -> None:
 
     @skip_if_no_cuda
     def test_nnunetv2runner(self) -> None:
-        runner = nnUNetV2Runner(input_config=self.data_src_cfg)
+        runner = nnUNetV2Runner(input_config=self.data_src_cfg, trainer_class_name="nnUNetTrainer_1epoch")
         with skip_if_downloading_fails():
             runner.run(run_train=False, run_find_best_configuration=False, run_predict_ensemble_postprocessing=False)
-            runner.train(configs="3d_fullres", trainer_class_name="nnUNetTrainer_1epoch")
-            runner.find_best_configuration(configs="3d_fullres", trainers="nnUNetTrainer_1epoch")
+            runner.train(configs="3d_fullres")
+            runner.find_best_configuration(configs="3d_fullres")
             runner.predict_ensemble_postprocessing()
 
     def tearDown(self) -> None: