aboutcode-org / aboutcode-org/scancode-toolkit

TypeError: unhashable type: 'License'

未關閉
#3,425 0 則留言 0 個 reaction 已指派 1 人 已被 @AyanSinhaMahapatra 認領 在 GitHub 檢視
bug
主要語言
Python
星號
2.6k
分支
791
平均合併
1 天 12 小時
30 天內合併 PR
5

描述

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

貢獻指南

開啟貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。