aboutcode-org / aboutcode-org/scancode-toolkit

TypeError: unhashable type: 'License'

Aperta
#3,425 0 commenti 0 reazioni 1 assegnatario Rivendicata da @AyanSinhaMahapatra Vedi su GitHub
bug
Lingua principale
Python
Stelle
2.6k
Fork
791
Merge medio
1g 12h
PR unite (30g)
5

Descrizione

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'
```

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.