Commit 9a756f3f authored by Wout De Nolf's avatar Wout De Nolf
Browse files

allow inspecting class nonce data

parent f88f0c16
......@@ -105,6 +105,7 @@ class UniversalHashable:
"""
__CLASS_NONCE = None
__VERSION = None
MISSING_DATA = MissingData()
def __init__(self, uhash=None, uhash_nonce=None):
......@@ -119,11 +120,16 @@ class UniversalHashable:
def __init_subclass__(cls, version=None, **kwargs):
super().__init_subclass__(**kwargs)
cls.__CLASS_NONCE = str(uhash((cls.class_nonce(), classhashdata(cls), version)))
cls.__VERSION = version
cls.__CLASS_NONCE = str(uhash((cls.class_nonce(), ) + cls.class_nonce_data()))
@classmethod
def class_nonce(self):
return self.__CLASS_NONCE
def class_nonce(cls):
return cls.__CLASS_NONCE
@classmethod
def class_nonce_data(cls):
return qualname(cls), cls.__VERSION
def instance_nonce(self):
return self.__instance_nonce
......
......@@ -125,6 +125,10 @@ class Task(Registered, hashing.UniversalHashable, register=False):
def output_names(cls):
return cls._OUTPUT_NAMES
@classmethod
def class_nonce_data(cls):
return super().class_nonce_data() + (sorted(cls.input_names()), sorted(cls.output_names()))
@property
def input_variables(self):
return self._inputs
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment