MCPcopy
hub / github.com/python-attrs/attrs / _add_hash

Function _add_hash

src/attr/_make.py:1683–1694  ·  view source on GitHub ↗

Add a hash method to *cls*.

(cls: type, attrs: list[Attribute])

Source from the content-addressed store, hash-verified

1681
1682
1683def _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
1697def __ne__(self, other):

Callers 1

_make.pyFile · 0.85

Calls 3

_make_hash_scriptFunction · 0.85
_compile_and_evalFunction · 0.85

Tested by

no test coverage detected