本文整理匯總了Python中utils.AttributeDict.keys方法的典型用法代碼示例。如果您正苦於以下問題:Python AttributeDict.keys方法的具體用法?Python AttributeDict.keys怎麽用?Python AttributeDict.keys使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類utils.AttributeDict
的用法示例。
在下文中一共展示了AttributeDict.keys方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: load_and_log_params
# 需要導入模塊: from utils import AttributeDict [as 別名]
# 或者: from utils.AttributeDict import keys [as 別名]
def load_and_log_params(cli_params):
cli_params = AttributeDict(cli_params)
if cli_params.get('load_from'):
p = load_df(cli_params.load_from, 'params').to_dict()[0]
p = AttributeDict(p)
for key in cli_params.keys():
if key not in p:
p[key] = None
new_params = cli_params
loaded = True
else:
p = cli_params
new_params = {}
loaded = False
# Make dseed seed unless specified explicitly
if p.get('dseed') is None and p.get('seed') is not None:
p['dseed'] = p['seed']
logger.info('== COMMAND LINE ==')
logger.info(' '.join(sys.argv))
logger.info('== PARAMETERS ==')
for k, v in p.items():
if new_params.get(k) is not None:
p[k] = new_params[k]
replace_str = "<- " + str(new_params.get(k))
else:
replace_str = ""
logger.info(" {!s:20s}: {!s:<20s} {}".format(k, v, replace_str))
return p, loaded