123456789101112131415161718 |
- #!/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
|