diff options
author | Sergey M․ <[email protected]> | 2017-09-10 19:08:39 +0700 |
---|---|---|
committer | Sergey M․ <[email protected]> | 2017-09-10 19:08:39 +0700 |
commit | c7e327c4d46a9b72f3f707710194dccf6eee50d9 (patch) | |
tree | 0a7be96d54a4a45dc7654afe20e4406b68af5a5f | |
parent | 48b813748d91acc7e9efc15075079a03faea18ee (diff) | |
download | youtube-dl-c7e327c4d46a9b72f3f707710194dccf6eee50d9.tar.gz youtube-dl-c7e327c4d46a9b72f3f707710194dccf6eee50d9.zip |
[utils] Introduce bool_or_none
-rw-r--r-- | youtube_dl/utils.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/youtube_dl/utils.py b/youtube_dl/utils.py index 2554a2abd..c42dd4c3a 100644 --- a/youtube_dl/utils.py +++ b/youtube_dl/utils.py @@ -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() |