mirror of
https://github.com/dragonpilot/dragonpilot.git
synced 2026-06-27 08:52:05 +08:00
5481370db3
date: 2024-03-12T10:58:15 commit: 1a6b7fc5410ebb87478d8bc0fc204d632e80e8c7
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)
|