コード例 #1
0
ファイル: values.py プロジェクト: den4ix/pkgcore
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)
コード例 #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)