19 lines
449 B
Python
19 lines
449 B
Python
#!/usr/bin/env python
|
|
# -*- coding: utf-8 -*-
|
|
#
|
|
|
|
import inspect
|
|
|
|
|
|
class changed_value_indicator(dict):
|
|
def __init__(self):
|
|
super().__init__(self)
|
|
|
|
def changed_here(self, topic, key, value):
|
|
caller_name = inspect.getmodule(inspect.stack()[1][0]).__name__ + '.' + inspect.stack()[1][3]
|
|
key = '::'.join([caller_name, topic, key])
|
|
#
|
|
rv = self.get(key) != value
|
|
self[key] = value
|
|
return rv
|