Coverage for sqlmodel/default.py: 100%
11 statements
« prev ^ index » next coverage.py v7.6.12, created at 2025-03-07 05:42 +0000
« prev ^ index » next coverage.py v7.6.12, created at 2025-03-07 05:42 +0000
1from typing import Any, TypeVar 1abcdefg
4class _DefaultPlaceholder: 1abcdefg
5 """
6 You shouldn't use this class directly.
8 It's used internally to recognize when a default value has been overwritten, even
9 if the overridden default value was truthy.
10 """
12 def __init__(self, value: Any): 1abcdefg
13 self.value = value 1hijklmnopqrstuvwxyzABCDEFGHI
15 def __bool__(self) -> bool: 1abcdefg
16 return bool(self.value) 1hlptxBF
18 def __eq__(self, o: object) -> bool: 1abcdefg
19 return isinstance(o, _DefaultPlaceholder) and o.value == self.value 1ijkmnoqrsuvwyzACDEGHI
22_TDefaultType = TypeVar("_TDefaultType") 1abcdefg
25def Default(value: _TDefaultType) -> _TDefaultType: 1abcdefg
26 """
27 You shouldn't use this function directly.
29 It's used internally to recognize when a default value has been overwritten, even
30 if the overridden default value was truthy.
31 """
32 return _DefaultPlaceholder(value) # type: ignore 1hijklmnopqrstuvwxyzABCDEFGHI