X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=fba%2Fhelpers%2Fdicts.py;h=cd9ccbde4ae4c5c8f436719423cbf2a032351f0f;hb=21c7c13dcdf897008a7f340e606c947092ba51bd;hp=b3f2632386eb8526c7e385eef74fa482bc33cd17;hpb=aa6a95081bb9fd510eb1b838c7c929fbae92c300;p=fba.git diff --git a/fba/helpers/dicts.py b/fba/helpers/dicts.py index b3f2632..cd9ccbd 100644 --- a/fba/helpers/dicts.py +++ b/fba/helpers/dicts.py @@ -20,6 +20,7 @@ logger = logging.getLogger(__name__) def has_key(lists: list, key: str, value: any) -> bool: logger.debug("lists()=%d,key='%s',value[]='%s' - CALLED!", len(lists), key, type(value)) + if not isinstance(lists, list): raise ValueError(f"Parameter lists[]='{type(lists)}' is not of type 'list'") elif not isinstance(key, str): @@ -31,6 +32,7 @@ def has_key(lists: list, key: str, value: any) -> bool: logger.debug("Checking lists()=%d ...", len(lists)) for row in lists: logger.debug("row[%s]='%s", type(row), row) + if not isinstance(row, dict): raise ValueError(f"row[]='{type(row)}' is not of type 'dict'") elif not key in row: