Coverage for sqlmodel/default.py: 100%
11 statements
« prev ^ index » next coverage.py v7.6.1, created at 2024-09-09 00:02 +0000
« prev ^ index » next coverage.py v7.6.1, created at 2024-09-09 00:02 +0000
1from typing import Any, TypeVar 1abcdef
4class _DefaultPlaceholder: 1abcdef
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): 1abcdef
13 self.value = value 1ghijklmnopqrstuvwxyzABCD
15 def __bool__(self) -> bool: 1abcdef
16 return bool(self.value) 1gkoswA
18 def __eq__(self, o: object) -> bool: 1abcdef
19 return isinstance(o, _DefaultPlaceholder) and o.value == self.value 1hijlmnpqrtuvxyzBCD
22_TDefaultType = TypeVar("_TDefaultType") 1abcdef
25def Default(value: _TDefaultType) -> _TDefaultType: 1abcdef
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 1ghijklmnopqrstuvwxyzABCD