projects
/
youtube-dl
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
48b8137
)
[utils] Introduce bool_or_none
author
Sergey M․
<dstftw@gmail.com>
Sun, 10 Sep 2017 12:08:39 +0000
(19:08 +0700)
committer
Sergey M․
<dstftw@gmail.com>
Sun, 10 Sep 2017 12:08:39 +0000
(19:08 +0700)
youtube_dl/utils.py
patch
|
blob
|
history
diff --git
a/youtube_dl/utils.py
b/youtube_dl/utils.py
index 2554a2abd7e86eeac1c92dddf6e90a307f8b9c9f..c42dd4c3ae20d59b6646b64180720c4482a0e901 100644
(file)
--- 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()