Page MenuHomeSoftware Heritage

unbound type variables
Closed, MigratedEdits Locked

Description

KT = TypeVar("KT")
VT = TypeVar("VT")

def freeze_optional_dict(

d: Union[None, Dict[KT, VT], ImmutableDict[KT, VT]]
  1. ^swh/model/model.py:49: error: Type variable "swh.model.model.KT" is unbound
  2. swh/model/model.py:49: note: (Hint: Use "Generic[KT]" or "Protocol[KT]" base class to bind "KT" inside a class)
  3. swh/model/model.py:49: note: (Hint: Use "KT" in function signature to bind "KT" inside a function)
  4. swh/model/model.py:49: error: Type variable "swh.model.model.VT" is unbound
  5. swh/model/model.py:49: note: (Hint: Use "Generic[VT]" or "Protocol[VT]" base class to bind "VT" inside a class)
  6. swh/model/model.py:49: note: (Hint: Use "VT" in function signature to bind "VT" inside a function)

) -> Optional[ImmutableDict[KT, VT]]:

if isinstance(d, dict):
    return ImmutableDict(d)
else:
    return d

Related Objects

Event Timeline

vlorentz claimed this task.
vlorentz created this task.

oops, I wanted to make a paste

lol, do we open a new table for that kind of mistake (i think i also did that some time ago ;)

now plz help me on P714 D: