From a67d0f5ad412cadbe82b115086e0c6945f60f179 Mon Sep 17 00:00:00 2001 From: Erez Shinan Date: Sun, 31 Dec 2023 11:05:17 +0700 Subject: [PATCH] pytypes: Added Bool --- runtype/pytypes.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/runtype/pytypes.py b/runtype/pytypes.py index 5a3b004..d6b21d5 100644 --- a/runtype/pytypes.py +++ b/runtype/pytypes.py @@ -333,6 +333,8 @@ def validate_instance(self, obj, sampler=None): Literal = OneOf Type = TypeType(PythonDataType(type)) +class _Bool(PythonDataType): + pass class _Number(PythonDataType): def __call__(self, min=None, max=None): @@ -427,6 +429,7 @@ def cast_from(self, obj): String = _String(str) +Bool = _Bool(bool) Int = _Int(int) Float = _Float(float) NoneType = _NoneType() @@ -443,6 +446,7 @@ def cast_from(self, obj): frozenset: FrozenSet, dict: Dict, tuple: Tuple, + bool: Bool, int: Int, str: String, float: Float,