Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _do_pad(match):
"""
Substitutes padded for unpadded frames.
"""
result = list(match.groups())
result[1] = pad(result[1], zfill)
if result[4]:
result[4] = pad(result[4], zfill)
return ''.join((i for i in result if i))
return PAD_RE.sub(_do_pad, frange)
"""
Private method: builds a proper and padded
frame range string.
Args:
start (int): first frame
stop (int or None): last frame
stride (int or None): increment
zfill (int): width for zero padding
Returns:
str:
"""
if stop is None:
return ''
pad_start = pad(start, zfill)
pad_stop = pad(stop, zfill)
if stride is None or start == stop:
return '{0}'.format(pad_start)
elif abs(stride) == 1:
return '{0}-{1}'.format(pad_start, pad_stop)
else:
return '{0}-{1}x{2}'.format(pad_start, pad_stop, stride)
Args:
frames (collections.Iterable): sequence of frames to process
sort (bool): sort the sequence before processing
zfill (int): width for zero padding
compress (bool): remove any duplicates before processing
Returns:
str:
"""
if compress:
frames = unique(set(), frames)
frames = list(frames)
if not frames:
return ''
if len(frames) == 1:
return pad(frames[0], zfill)
if sort:
frames.sort()
ret = ','.join(FrameSet.framesToFrameRanges(frames, zfill))
return future.utils.native_str(ret)
Private method: builds a proper and padded
frame range string.
Args:
start (int): first frame
stop (int or None): last frame
stride (int or None): increment
zfill (int): width for zero padding
Returns:
str:
"""
if stop is None:
return ''
pad_start = pad(start, zfill)
pad_stop = pad(stop, zfill)
if stride is None or start == stop:
return '{0}'.format(pad_start)
elif abs(stride) == 1:
return '{0}-{1}'.format(pad_start, pad_stop)
else:
return '{0}-{1}x{2}'.format(pad_start, pad_stop, stride)
def _do_pad(match):
"""
Substitutes padded for unpadded frames.
"""
result = list(match.groups())
result[1] = pad(result[1], zfill)
if result[4]:
result[4] = pad(result[4], zfill)
return ''.join((i for i in result if i))
return PAD_RE.sub(_do_pad, frange)