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