We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 30974f8 commit 8d334ceCopy full SHA for 8d334ce
plexapi/utils.py
@@ -59,15 +59,18 @@ def registerPlexObject(cls):
59
60
def cast(func, value):
61
""" Cast the specified value to the specified type (returned by func). Currently this
62
- only support int, float, bool. Should be extended if needed.
+ only support str, int, float, bool. Should be extended if needed.
63
64
Parameters:
65
func (func): Calback function to used cast to type (int, bool, float).
66
value (any): value to be cast and returned.
67
"""
68
if value is not None:
69
if func == bool:
70
- return bool(int(value))
+ try:
71
+ return bool(int(value))
72
+ except ValueError:
73
+ return bool(value)
74
elif func in (int, float):
75
try:
76
return func(value)
0 commit comments