Add a hash method to *cls*.
(cls: type, attrs: list[Attribute])
| 1681 | |
| 1682 | |
| 1683 | def _add_hash(cls: type, attrs: list[Attribute]): |
| 1684 | """ |
| 1685 | Add a hash method to *cls*. |
| 1686 | """ |
| 1687 | script, globs = _make_hash_script( |
| 1688 | cls, attrs, frozen=False, cache_hash=False |
| 1689 | ) |
| 1690 | _compile_and_eval( |
| 1691 | script, globs, filename=_generate_unique_filename(cls, "__hash__") |
| 1692 | ) |
| 1693 | cls.__hash__ = globs["__hash__"] |
| 1694 | return cls |
| 1695 | |
| 1696 | |
| 1697 | def __ne__(self, other): |
no test coverage detected