Exemple #1
0
def hashed_base(name, bases, scope):
    scope.setdefault("__hash__", reflective_hash('_hash'))
    slots = scope.get("__slots__", None)
    if slots is not None:
        if "_hash" not in slots:
            slots = scope["__slots__"] = slots + ("_hash",)
        scope.setdefault("__attr_comparison__", slots)
    return generic_equality(name, bases, scope)
Exemple #2
0
def hashed_base(name, bases, scope):
    scope.setdefault("__hash__", reflective_hash('_hash'))
    slots = scope.get("__slots__", None)
    if slots is not None:
        if "_hash" not in slots:
            slots = scope["__slots__"] = slots + ("_hash", )
        scope.setdefault("__attr_comparison__", slots)
    return generic_equality(name, bases, scope)