Skip to content

Utils.py throwing an error #1

Open
@dkxmen

Description

Hi, I tried using the utils.py file but I get the following error:

"TypeError: Too few parameters for typing.Dict; actual 1, expected 2"

The error comes on def inverse_dictionary.
I don't know where I went wrong with this one. Please advise.

**> Full Error:

TypeError Traceback (most recent call last)
in
----> 1 def inverse_dictionary(original_dict: Dict[Any], unique_values: bool = False) -> Dict[Any]:
2 """Swap keys and values in the dictionary
3 :param original_dict: the dictionary that will be inverted
4 :param unique_values: true if the values in the original dictionary are unique.
5 If false, the inverse dictionary will contain the list of original keys that were mapped to the same value, i.e:

C:\ProgramData\Anaconda3\lib\typing.py in inner(*args, **kwds)
249 except TypeError:
250 pass # All real errors (not unhashable args) are raised below.
--> 251 return func(*args, **kwds)
252 return inner
253

C:\ProgramData\Anaconda3\lib\typing.py in getitem(self, params)
625 msg = "Parameters to generic types must be types."
626 params = tuple(_type_check(p, msg) for p in params)
--> 627 _check_generic(self, params)
628 return _subs_tvars(self, self.parameters, params)
629

C:\ProgramData\Anaconda3\lib\typing.py in _check_generic(cls, parameters)
203 elen = len(cls.parameters)
204 if alen != elen:
--> 205 raise TypeError(f"Too {'many' if alen > elen else 'few'} parameters for {cls};"
206 f" actual {alen}, expected {elen}")
207

TypeError: Too few parameters for typing.Dict; actual 1, expected 2**

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions