From d190ce8d7f8800c575ca5503af6bb49346bece2b Mon Sep 17 00:00:00 2001 From: iclementine Date: Fri, 20 Nov 2020 15:21:06 +0800 Subject: [PATCH] use dict comprehension to exclude unspecified options --- parakeet/utils/conf.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/parakeet/utils/conf.py b/parakeet/utils/conf.py index 446dfb7..eff081c 100644 --- a/parakeet/utils/conf.py +++ b/parakeet/utils/conf.py @@ -25,11 +25,8 @@ class Config(attrdict.AttrDict): def merge_args(self, args): args_dict = vars(args) - # remove options that is not passed via CLI - for k, v in args_dict.items(): - if v is None: - args_dict.pop(k) args_dict.pop("config") # exclude config file path + args_dict = {k: v for k, v in args_dict.items() if v is not None} nested_dict = flatdict.FlatDict(args_dict, delimiter=".").as_dict() self.update(nested_dict)