mirror of
https://github.com/dragonpilot/dragonpilot.git
synced 2026-06-20 13:32:04 +08:00
a5cee30aa6
date: 2024-06-25T13:13:17
commit: 69a099242f
12 lines
271 B
Python
12 lines
271 B
Python
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)
|