aboutcode-org / aboutcode-org/scancode-toolkit

TypeError: unhashable type: 'License'

Abierto
#3,425 0 comentarios 0 reacciones 1 asignado Reclamado por @AyanSinhaMahapatra Ver en GitHub
bug
Lenguaje dominante
Python
Estrellas
2.6k
Forks
791
Merge medio
1 d 12 h
PR fusionados (30 d)
5

Descripción

I would like to get a set of unique `licensedcode.models.License` objects but this model is missing the `__hash__` required for this purpose. Since the `key` field is unique, I'm guessing it could be use for the hash.

Note that this behavior is properly implemented for the `license_expression.LicenseSymbol` but not once we go down to the actual `License` objects.

```
>>> from licensedcode.models import License

>>> set([License(key="k1"), License(key="k1"), License(key="k2")])

Traceback (most recent call last):
File "", line 1, in
TypeError: unhashable type: 'License'
```

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.