Skip to content

Commit 2be2dd2

Browse files
Handle conversions.bool
Again, pulled out of cloud-custodian#135.
1 parent 443a79f commit 2be2dd2

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

src/celpy/celtypes.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,12 @@ def __new__(cls: Type["BoolType"], source: Any) -> "BoolType":
398398
return source
399399
elif isinstance(source, MessageType):
400400
return super().__new__(cls, cast(int, source.get(StringType("value"))))
401+
elif isinstance(source, (str, StringType)):
402+
if source in ("False", "f", "FALSE", "false"):
403+
return super().__new__(cls, 0)
404+
elif source in ("True", "t", "TRUE", "true"):
405+
return super().__new__(cls, 1)
406+
return super().__new__(cls, source)
401407
else:
402408
return super().__new__(cls, source)
403409

tools/wip.toml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -225,16 +225,6 @@ not_ne_int_uint = "@wip"
225225
not_ne_uint_double = "@wip"
226226
not_ne_uint_double_nan = "@wip"
227227

228-
[conversions.bool]
229-
string_f = "@wip"
230-
string_false_lowercase = "@wip"
231-
string_false_pascalcase = "@wip"
232-
string_false_uppercase = "@wip"
233-
string_t = "@wip"
234-
string_true_lowercase = "@wip"
235-
string_true_pascalcase = "@wip"
236-
string_true_uppercase = "@wip"
237-
238228
[conversions.identity]
239229
timestamp = "@wip"
240230

0 commit comments

Comments
 (0)