本文整理汇总了Python中MyUtil.remove_dict_from_list方法的典型用法代码示例。如果您正苦于以下问题:Python MyUtil.remove_dict_from_list方法的具体用法?Python MyUtil.remove_dict_from_list怎么用?Python MyUtil.remove_dict_from_list使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MyUtil
的用法示例。
在下文中一共展示了MyUtil.remove_dict_from_list方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: make_perm_changes
# 需要导入模块: import MyUtil [as 别名]
# 或者: from MyUtil import remove_dict_from_list [as 别名]
def make_perm_changes(s, handle, permdata, removelist, changelist, addlist, **kwargs):
ask_flag = kwargs.get('Ask',True)
mod_flag = False
if ask_flag == True:
ans = MyUtil.get_all_none_indiv('Make Changes? All/None/Individual (A/N/I)?')
if ans == 'All':
ask_flag = False
elif ans == 'None':
return
for perm in removelist:
print('Remove?: ',end='')
DCC.print_perm(perm)
if ask_flag == False or MyUtil.get_yn(': (Y/N)?'):
if ask_flag == False: print()
mod_flag = True
MyUtil.remove_dict_from_list(permdata['perms'],'handle',perm['handle'])
for chperm in changelist:
print('Change?:', end='')
DCC.print_perm(chperm)
if ask_flag == False or MyUtil.get_yn(': (Y/N)?'):
if ask_flag == False: print()
mod_flag = True
for perm in permdata['perms']:
if perm['handle'] == chperm['handle']:
if 'Read' in perm: del(perm['Read'])
if 'Write'in perm: del(perm['Write'])
if 'Manage' in perm: del(perm['Manage'])
for key,val in chperm.items():
perm[key] = val
for addperm in addlist:
print('Add?:', end='')
DCC.print_perm(addperm)
if ask_flag == False or MyUtil.get_yn(': (Y/N)?'):
if ask_flag == False: print()
mod_flag = True
permdata['perms'].append(addperm)
if debug: DCC.print_perms(permdata)
if mod_flag:
# check ask_flag since it may have been modified from kwargs value
if ask_flag == False:
modify_dcc_perms(s, handle, permdata, Ask=False)
else:
modify_dcc_perms(s,handle,permdata, **kwargs)