aboutcode-org / aboutcode-org/scancode-toolkit

TypeError: unhashable type: 'License'

Aberta
#3,425 0 comentários 0 reações 1 responsável Reivindicada por @AyanSinhaMahapatra Ver no GitHub
bug
Linguagem predominante
Python
Estrelas
2.6k
Forks
791
Merge médio
1d 12h
PRs com merge (30d)
5

Descrição

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

Guia de contribuição

Abrir o guia de contribuição

Avaliação

Esta issue ainda não foi avaliada.

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.