PR#1807: util: rename "dict" arg

Merges #1807
https://pagure.io/koji/pull-request/1807

Fixes: #1812
util: rename "dict" arg
https://pagure.io/koji/issue/1812
This commit is contained in:
Tomas Kopecek 2019-11-19 12:37:16 +01:00
commit 1d42e444c6

View file

@ -190,19 +190,19 @@ def multi_fnmatch(s, patterns):
return False
def dslice(dict, keys, strict=True):
def dslice(dict_, keys, strict=True):
"""Returns a new dictionary containing only the specified keys"""
ret = {}
for key in keys:
if strict or key in dict:
if strict or key in dict_:
#for strict we skip the has_key check and let the dict generate the KeyError
ret[key] = dict[key]
ret[key] = dict_[key]
return ret
def dslice_ex(dict, keys, strict=True):
def dslice_ex(dict_, keys, strict=True):
"""Returns a new dictionary with only the specified keys removed"""
ret = dict.copy()
ret = dict_.copy()
for key in keys:
if strict or key in ret:
del ret[key]