check_kwarg

sconstool.util.check_kwarg(caller, key, allowed=None, forbidden=None)[source]

Checks a single key from keyword arguments against allowed and forbidden keys.

If key is not in allowed keys or it is in forbidden keys, throws TypeError.

Parameters:
  • caller (str) – name of the caller,
  • key (str) – the key to be examined,
  • allowed – sequence of allowed keys.
  • forbidden – sequence of forbidden keys.
Returns:

True