Repository: Project-MONAI/MONAI

Issue:
New flake8-bugbear introduced check failures
**Is your feature request related to a problem? Please describe.**
As `flake8-bugbear` updated today, it introduced some new errors:
```
--------------------------------------------------------------------------------
flake8
4.0.1 (flake8-bugbear: 22.3.23, flake8-comprehensions: 3.8.0, flake8-executable: 2.1.1, flake8-pyi: 22.2.0, mccabe: 0.6.1, naming: 0.12.1, pycodestyle: 2.8.0, pyflakes: 2.4.0) CPython 3.8.12 on Linux
/workspace/data/medical/MONAI/tests/test_integration_workers.py:22:57: B008 Do not perform function calls in argument defaults.  The call is performed only once at function definition time. All calls to your function will reuse the result of that definition-time function call.  If this is intended, assign the function call to a module-level variable and use that variable as a default value.
/workspace/data/medical/MONAI/monai/utils/misc.py:228:27: B008 Do not perform function calls in argument defaults.  The call is performed only once at function definition time. All calls to your function will reuse the result of that definition-time function call.  If this is intended, assign the function call to a module-level variable and use that variable as a default value.
/workspace/data/medical/MONAI/monai/transforms/spatial/array.py:464:61: B008 Do not perform function calls in argument defaults.  The call is performed only once at function definition time. All calls to your function will reuse the result of that definition-time function call.  If this is intended, assign the function call to a module-level variable and use that variable as a default value.
/workspace/data/medical/MONAI/monai/transforms/spatial/dictionary.py:595:61: B008 Do not perform function calls in argument defaults.  The call is performed only once at function definition time. All calls to your function will reuse the result of that definition-time function call.  If this is intended, assign the function call to a module-level variable and use that variable as a default value.
4     B008 Do not perform function calls in argument defaults.  The call is performed only once at function definition time. All calls to your function will reuse the result of that definition-time function call.  If this is intended, assign the function call to a module-level variable and use that variable as a default value.
4
Check failed!
```
It blocks all the PRs to run CI tests.



Discussion:

Resolving patch:
diff --git a/monai/transforms/spatial/array.py b/monai/transforms/spatial/array.py
--- a/monai/transforms/spatial/array.py
+++ b/monai/transforms/spatial/array.py
@@ -461,7 +461,7 @@ def __init__(
         self,
         axcodes: Optional[str] = None,
         as_closest_canonical: bool = False,
-        labels: Optional[Sequence[Tuple[str, str]]] = tuple(zip("LPI", "RAS")),
+        labels: Optional[Sequence[Tuple[str, str]]] = (("L", "R"), ("P", "A"), ("I", "S")),
         image_only: bool = False,
     ) -> None:
         """
diff --git a/monai/transforms/spatial/dictionary.py b/monai/transforms/spatial/dictionary.py
--- a/monai/transforms/spatial/dictionary.py
+++ b/monai/transforms/spatial/dictionary.py
@@ -592,7 +592,7 @@ def __init__(
         keys: KeysCollection,
         axcodes: Optional[str] = None,
         as_closest_canonical: bool = False,
-        labels: Optional[Sequence[Tuple[str, str]]] = tuple(zip("LPI", "RAS")),
+        labels: Optional[Sequence[Tuple[str, str]]] = (("L", "R"), ("P", "A"), ("I", "S")),
         meta_keys: Optional[KeysCollection] = None,
         meta_key_postfix: str = DEFAULT_POST_FIX,
         allow_missing_keys: bool = False,
diff --git a/monai/utils/misc.py b/monai/utils/misc.py
--- a/monai/utils/misc.py
+++ b/monai/utils/misc.py
@@ -57,7 +57,8 @@
 _seed = None
 _flag_deterministic = torch.backends.cudnn.deterministic
 _flag_cudnn_benchmark = torch.backends.cudnn.benchmark
-MAX_SEED = np.iinfo(np.uint32).max + 1  # 2**32, the actual seed should be in [0, MAX_SEED - 1] for uint32
+NP_MAX = np.iinfo(np.uint32).max
+MAX_SEED = NP_MAX + 1  # 2**32, the actual seed should be in [0, MAX_SEED - 1] for uint32
 
 
 def zip_with(op, *vals, mapfunc=map):
@@ -225,7 +226,7 @@ def get_seed() -> Optional[int]:
 
 
 def set_determinism(
-    seed: Optional[int] = np.iinfo(np.uint32).max,
+    seed: Optional[int] = NP_MAX,
     use_deterministic_algorithms: Optional[bool] = None,
     additional_settings: Optional[Union[Sequence[Callable[[int], Any]], Callable[[int], Any]]] = None,
 ) -> None:
@@ -250,7 +251,7 @@ def set_determinism(
     """
     if seed is None:
         # cast to 32 bit seed for CUDA
-        seed_ = torch.default_generator.seed() % (np.iinfo(np.int32).max + 1)
+        seed_ = torch.default_generator.seed() % MAX_SEED
         torch.manual_seed(seed_)
     else:
         seed = int(seed) % MAX_SEED


Test patch:
diff --git a/tests/test_integration_workers.py b/tests/test_integration_workers.py
--- a/tests/test_integration_workers.py
+++ b/tests/test_integration_workers.py
@@ -19,9 +19,11 @@
 from tests.utils import DistTestCase, SkipIfBeforePyTorchVersion, TimedCall, skip_if_no_cuda, skip_if_quick
 
 
-def run_loading_test(num_workers=50, device="cuda:0" if torch.cuda.is_available() else "cpu", pw=False):
+def run_loading_test(num_workers=50, device=None, pw=False):
     """multi workers stress tests"""
     set_determinism(seed=0)
+    if device is None:
+        device = "cuda:0" if torch.cuda.is_available() else "cpu"
     train_ds = list(range(10000))
     train_loader = DataLoader(train_ds, batch_size=300, shuffle=True, num_workers=num_workers, persistent_workers=pw)
     answer = []