from pyson.Deserializer import Deserializer ''' Deliberate mismatch between class and package name, we should be able to handle that. ''' class ValueDeserializer2(Deserializer): ''' Used in DeserializerTest ''' def __hash__(self): return hash(self.geta()) def deserialize(self, data:object, clas: object)-> object: if type(data)!=str: raise ValueError("Expected str starting with '$', got "+str(data)) # Note we can't create real object here because that would result # in circular import. This is why # custom Desearializers are usually defined in same module as the # target object return int(data[1:])