1
0
Fork 0
mirror of https://github.com/ytdl-org/youtube-dl.git synced 2024-11-22 02:01:50 +00:00

[utils] Introduce bool_or_none

This commit is contained in:
Sergey M․ 2017-09-10 19:08:39 +07:00
parent 48b813748d
commit c7e327c4d4
No known key found for this signature in database
GPG key ID: 2C393E0F18A9236D

View file

@ -1815,6 +1815,10 @@ def float_or_none(v, scale=1, invscale=1, default=None):
return default
def bool_or_none(v, default=None):
return v if isinstance(v, bool) else default
def strip_or_none(v):
return None if v is None else v.strip()