mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2024-11-26 04:02:11 +00:00
[utils] Add strip_or_none
This commit is contained in:
parent
46f59e89ea
commit
b72b44318c
1 changed files with 4 additions and 0 deletions
|
@ -1660,6 +1660,10 @@ def float_or_none(v, scale=1, invscale=1, default=None):
|
||||||
return default
|
return default
|
||||||
|
|
||||||
|
|
||||||
|
def strip_or_none(v):
|
||||||
|
return None if v is None else v.strip()
|
||||||
|
|
||||||
|
|
||||||
def parse_duration(s):
|
def parse_duration(s):
|
||||||
if not isinstance(s, compat_basestring):
|
if not isinstance(s, compat_basestring):
|
||||||
return None
|
return None
|
||||||
|
|
Loading…
Reference in a new issue