| 1234567891011121314151617181920212223242526272829303132 |
- from .model import model
- from .single_set_proxy import single_set_proxy
- class single_set_model(model):
- content = NotImplemented
- @classmethod
- def get_proxy(cls) -> single_set_proxy:
- class model_proxy(single_set_proxy, target_model = cls):
- pass
- return model_proxy
- def _single_validator(self) -> callable:
- raise NotImplementedError()
- def _validators(self) -> dict:
- return {
- "content": self._single_validator()
- }
- def __new__(cls, *args, **kwargs) -> object:
- if cls.content == NotImplemented:
- raise NotImplementedError("Attribute content must be field.")
- super().__new__(*args, **kwargs)
- def __repr__(self) -> str:
- return type(self).__name__ + ": \"" + str(self) + "\""
- def __str__(self) -> str:
- return self.content
|