Commit d9ec725f authored by Karel Koci's avatar Karel Koci 🤘

euci: improve exception when invalid keyword argument is passed

parent 4a110faa
Pipeline #48824 passed with stage
in 17 seconds
......@@ -84,7 +84,8 @@ class EUci(Uci):
"""
kwdiff = set(kwargs).difference({'default', 'list'})
if kwdiff:
raise TypeError("'{}' is an invalid keyword argument for this function".format(kwdiff))
raise TypeError("'{}' is an invalid keyword argument for this function"
.format(next(iter(kwdiff))))
try:
values = super().get(*args)
......@@ -114,7 +115,7 @@ class EUci(Uci):
# This implements handler for str and int type as well as fallback
return str(value)
def set(self, *args, **kwargs):
def set(self, *args):
"""Set configuration value.
Up to three positional arguments specifying configuration can be
......@@ -130,10 +131,6 @@ class EUci(Uci):
ensure correct type. That is in case of boolean for example:
set("foo", "fee", "faa", bool(value))
"""
kwdiff = set(kwargs).difference({})
if kwdiff:
raise TypeError("'{}' is an invalid keyword argument for this function".format(kwdiff))
dtype = type(args[-1])
if dtype == tuple or dtype == list:
# We consider first value as authoritative for type
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment