# Buggy code
def _init(self, **kwargs):
    global WANDB_ENABLED
    assert len(kwargs) == 0
    if WANDB_ENABLED:
        if self.monitoring_params is not None:
            self.checkpoints_glob: List[str] = self.monitoring_params.pop(
                "checkpoints_glob", ["best.pth", "last.pth"]
            )

            wandb.init(**self.monitoring_params)

            logdir_src = Path(self.logdir)
            logdir_dst = Path(wandb.run.dir)

            configs_src = logdir_src.joinpath("configs")
            os.makedirs(f"{logdir_dst}/{configs_src.name}", exist_ok=True)
            shutil.rmtree(f"{logdir_dst}/{configs_src.name}")
            shutil.copytree(
                f"{str(configs_src.absolute())}", f"{logdir_dst}/{configs_src.name}"
            )

            code_src = logdir_src.joinpath("code")
            if code_src.exists():
                os.makedirs(f"{logdir_dst}/{code_src.name}", exist_ok=True)
                shutil.rmtree(f"{logdir_dst}/{code_src.name}")
                shutil.copytree(
                    f"{str(code_src.absolute())}", f"{logdir_dst}/{code_src.name}"
                )
        else:
            WANDB_ENABLED = False
    self.wandb_mode = "trainer"


# Traceback (TypeError)
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-1-279a2ce060b8> in <module>
24     monitoring_params={
25         'project': "yt",
---> 26         'group': "aa"
27     }
28 )

~/.local/lib/python3.6/site-packages/catalyst/dl/runner/supervised.py in train(self, model, criterion, optimizer, loaders, logdir, callbacks, scheduler, resume, num_epochs, valid_loader, main_metric, minimize_metric, verbose, state_kwargs, checkpoint_data, fp16, monitoring_params, check)
204             monitoring_params=monitoring_params
205         )
--> 206         self.run_experiment(experiment, check=check)
207
208     def infer(

~/.local/lib/python3.6/site-packages/catalyst/contrib/dl/runner/wandb.py in run_experiment(self, experiment, check)
141         self._pre_experiment_hook(experiment=experiment)
142         super().run_experiment(experiment=experiment, check=check)
--> 143         self._post_experiment_hook(experiment=experiment)
144
145

~/.local/lib/python3.6/site-packages/catalyst/contrib/dl/runner/wandb.py in _post_experiment_hook(self, experiment)
104
105         checkpoint_paths = []
--> 106         for glob in self.checkpoints_glob:
107             checkpoint_paths.extend(list(checkpoints_src.glob(glob)))
108         checkpoint_paths = list(set(checkpoint_paths))

TypeError: 'NoneType' object is not iterable

# Fixed code
def _init(self, **kwargs):
    global WANDB_ENABLED
    assert len(kwargs) == 0
    if WANDB_ENABLED:
        if self.monitoring_params is not None:
            self.checkpoints_glob: List[str] = self.monitoring_params.pop(
                "checkpoints_glob", []
            )

            wandb.init(**self.monitoring_params)

            logdir_src = Path(self.logdir)
            logdir_dst = Path(wandb.run.dir)

            configs_src = logdir_src.joinpath("configs")
            os.makedirs(f"{logdir_dst}/{configs_src.name}", exist_ok=True)
            shutil.rmtree(f"{logdir_dst}/{configs_src.name}")
            shutil.copytree(
                f"{str(configs_src.absolute())}", f"{logdir_dst}/{configs_src.name}"
            )

            code_src = logdir_src.joinpath("code")
            if code_src.exists():
                os.makedirs(f"{logdir_dst}/{code_src.name}", exist_ok=True)
                shutil.rmtree(f"{logdir_dst}/{code_src.name}")
                shutil.copytree(
                    f"{str(code_src.absolute())}", f"{logdir_dst}/{code_src.name}"
                )
        else:
            WANDB_ENABLED = False
    self.wandb_mode = "trainer"