diff --git a/monai/bundle/config_item.py b/monai/bundle/config_item.py index 98babfb225..34a390be5f 100644 --- a/monai/bundle/config_item.py +++ b/monai/bundle/config_item.py @@ -106,7 +106,7 @@ def get_component_module_name(self, name: str) -> Optional[Union[List[str], str] # init component and module mapping table self._components_table = self._find_classes_or_functions(self._find_module_names()) - mods: Optional[Union[List[str], str]] = self._components_table.get(name, None) + mods: Optional[Union[List[str], str]] = self._components_table.get(name) if isinstance(mods, list) and len(mods) == 1: mods = mods[0] return mods diff --git a/monai/data/dataloader.py b/monai/data/dataloader.py index e8ff23a5a3..f43211f184 100644 --- a/monai/data/dataloader.py +++ b/monai/data/dataloader.py @@ -76,7 +76,7 @@ def __init__(self, dataset: Dataset, num_workers: int = 0, **kwargs) -> None: # when num_workers > 0, random states are determined by worker_init_fn # this is to make the behavior consistent when num_workers == 0 # torch.int64 doesn't work well on some versions of windows - _g = torch.random.default_generator if kwargs.get("generator", None) is None else kwargs["generator"] + _g = torch.random.default_generator if kwargs.get("generator") is None else kwargs["generator"] init_seed = _g.initial_seed() _seed = torch.empty((), dtype=torch.int64).random_(generator=_g).item() set_rnd(dataset, int(_seed)) diff --git a/monai/utils/misc.py b/monai/utils/misc.py index ae62f26635..d4bea4d27c 100644 --- a/monai/utils/misc.py +++ b/monai/utils/misc.py @@ -397,7 +397,7 @@ class MONAIEnvVars: @staticmethod def data_dir() -> Optional[str]: - return os.environ.get("MONAI_DATA_DIRECTORY", None) + return os.environ.get("MONAI_DATA_DIRECTORY") @staticmethod def debug() -> bool: @@ -406,7 +406,7 @@ def debug() -> bool: @staticmethod def doc_images() -> Optional[str]: - return os.environ.get("MONAI_DOC_IMAGES", None) + return os.environ.get("MONAI_DOC_IMAGES") class ImageMetaKey: diff --git a/tests/test_gmm.py b/tests/test_gmm.py index f085dd916c..66bd6079e6 100644 --- a/tests/test_gmm.py +++ b/tests/test_gmm.py @@ -259,7 +259,7 @@ @skip_if_no_cuda class GMMTestCase(unittest.TestCase): def setUp(self): - self._var = os.environ.get("TORCH_EXTENSIONS_DIR", None) + self._var = os.environ.get("TORCH_EXTENSIONS_DIR") self.tempdir = tempfile.mkdtemp() os.environ["TORCH_EXTENSIONS_DIR"] = self.tempdir diff --git a/tests/test_monai_env_vars.py b/tests/test_monai_env_vars.py index 68d2755af7..663dcdd98d 100644 --- a/tests/test_monai_env_vars.py +++ b/tests/test_monai_env_vars.py @@ -19,7 +19,7 @@ class TestMONAIEnvVars(unittest.TestCase): @classmethod def setUpClass(cls): super(__class__, cls).setUpClass() - cls.orig_value = os.environ.get("MONAI_DEBUG", None) + cls.orig_value = os.environ.get("MONAI_DEBUG") @classmethod def tearDownClass(cls): diff --git a/tests/test_transform.py b/tests/test_transform.py index 9cf18b8dbd..a6c5001147 100644 --- a/tests/test_transform.py +++ b/tests/test_transform.py @@ -29,7 +29,7 @@ class TestTransform(unittest.TestCase): @classmethod def setUpClass(cls): super(__class__, cls).setUpClass() - cls.orig_value = os.environ.get("MONAI_DEBUG", None) + cls.orig_value = os.environ.get("MONAI_DEBUG") @classmethod def tearDownClass(cls):