Files
clearpilot/common/utils.py
Comma Device 1ff14d346f wip
2024-05-14 08:21:27 +00:00

12 lines
271 B
Python
Executable File

class Freezable:
_frozen: bool = False
def freeze(self):
if not self._frozen:
self._frozen = True
def __setattr__(self, *args, **kwargs):
if self._frozen:
raise Exception("cannot modify frozen object")
super().__setattr__(*args, **kwargs)