[docs]def__init__(self,*args,**kwargs):super().__init__(*args,**kwargs)ifself.enabledisTrue:raiseValueError("Cannot set enabled to True in DisabledSettings")
def__setattr__(self,name,value):ifname=="enabled"andvalueisTrue:raiseValueError("Cannot set enabled to True in DisabledSettings")super().__setattr__(name,value)def__repr__(self):return"disabled"
[docs]def__new__(cls,**kwargs):_enabled=kwargs.pop("enabled",True)# todo better parsing of falsy valuesifisinstance(_enabled,str)and_enabled.lower()in{"no","false","0"}:_enabled=Falseifnot_enabled:returnDisabledSettings()returnsuper().__new__(cls)