Coverage for sqlmodel / default.py: 100%
11 statements
« prev ^ index » next coverage.py v7.13.0, created at 2026-06-10 09:40 +0000
« prev ^ index » next coverage.py v7.13.0, created at 2026-06-10 09:40 +0000
1from typing import Any, TypeVar 1abcdefgh
4class _DefaultPlaceholder: 1abcdefgh
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): 1abcdefgh
13 self.value = value 1ijklmnopqrstuvwxyzABCDEFGHIJKLMN
15 def __bool__(self) -> bool: 1abcdefgh
16 return bool(self.value) 1imquyCGK
18 def __eq__(self, o: object) -> bool: 1abcdefgh
19 return isinstance(o, _DefaultPlaceholder) and o.value == self.value 1jklnoprstvwxzABDEFHIJLMN
22_TDefaultType = TypeVar("_TDefaultType") 1abcdefgh
25def Default(value: _TDefaultType) -> _TDefaultType: 1abcdefgh
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 1ijklmnopqrstuvwxyzABCDEFGHIJKLMN