From 14bfc84fa6dd7f9f630ef72754a468010b06b50e Mon Sep 17 00:00:00 2001 From: mawen1250 Date: Thu, 4 Nov 2021 17:50:35 +0800 Subject: [PATCH] For arguments "clips", "planes", etc., accept all Sequence object besides list Remove the redundant backslash before double quotes LimitFilter: fix unused variable "_planes" in std.Lut implementation --- mvsfunc.py | 366 +++++++++++++++++++++++++++-------------------------- 1 file changed, 184 insertions(+), 182 deletions(-) diff --git a/mvsfunc.py b/mvsfunc.py index 2db83cb..9c4a5a6 100644 --- a/mvsfunc.py +++ b/mvsfunc.py @@ -56,6 +56,7 @@ from vapoursynth import core import functools import math +from collections.abc import Iterable, Sequence, MutableSequence ################################################################################################################################ @@ -124,7 +125,7 @@ def Depth(input, depth=None, sample=None, fulls=None, fulld=None, clip = input if not isinstance(input, vs.VideoNode): - raise type_error('\"input\" must be a clip!') + raise type_error('"input" must be a clip!') ## Default values for kwargs if 'ampn' not in kwargs: @@ -147,7 +148,7 @@ def Depth(input, depth=None, sample=None, fulls=None, fulld=None, # If not set, assume limited range for YUV and Gray input fulls = False if sIsYUV or sIsGRAY else True elif not isinstance(fulls, int): - raise type_error('\"fulls\" must be a bool!') + raise type_error('"fulls" must be a bool!') # Get properties of output clip lowDepth = False @@ -155,7 +156,7 @@ def Depth(input, depth=None, sample=None, fulls=None, fulld=None, if depth is None: dbitPS = sbitPS elif not isinstance(depth, int): - raise type_error('\"depth\" must be an int!') + raise type_error('"depth" must be an int!') else: if depth < 8: dbitPS = 8 @@ -169,9 +170,9 @@ def Depth(input, depth=None, sample=None, fulls=None, fulld=None, else: dSType = vs.FLOAT if dbitPS >= 32 else vs.INTEGER elif not isinstance(sample, int): - raise type_error('\"sample\" must be an int!') + raise type_error('"sample" must be an int!') elif sample != vs.INTEGER and sample != vs.FLOAT: - raise value_error('\"sample\" must be either 0 (vs.INTEGER) or 1 (vs.FLOAT)!') + raise value_error('"sample" must be either 0 (vs.INTEGER) or 1 (vs.FLOAT)!') else: dSType = sample if depth is None and sSType != vs.FLOAT and sample == vs.FLOAT: @@ -186,7 +187,7 @@ def Depth(input, depth=None, sample=None, fulls=None, fulld=None, if fulld is None: fulld = fulls elif not isinstance(fulld, int): - raise type_error('\"fulld\" must be a bool!') + raise type_error('"fulld" must be a bool!') # Low-depth support if lowDepth: @@ -207,7 +208,7 @@ def Depth(input, depth=None, sample=None, fulls=None, fulld=None, if useZ is None: useZ = False elif not isinstance(useZ, int): - raise type_error('\"useZ\" must be a bool!') + raise type_error('"useZ" must be a bool!') if sSType == vs.INTEGER and (sbitPS == 13 or sbitPS == 15): useZ = True if dSType == vs.INTEGER and (dbitPS == 11 or 13 <= dbitPS <= 15): @@ -217,23 +218,23 @@ def Depth(input, depth=None, sample=None, fulls=None, fulld=None, # Dithering type if kwargs['ampn'] is not None and not isinstance(kwargs['ampn'], (int, float)): - raise type_error('\"ampn\" must be an int or a float!') + raise type_error('"ampn" must be an int or a float!') if dither is None: if dbitPS == 32 or (dbitPS >= sbitPS and fulld == fulls and fulld == False): dither = "none" if useZ else 1 else: dither = "error_diffusion" if useZ else 3 - elif not isinstance(dither, int) and not isinstance(dither, str): - raise type_error('\"dither\" must be an int or a str!') + elif not isinstance(dither, (int, str)): + raise type_error('"dither" must be an int or a str!') else: if isinstance(dither, str): dither = dither.lower() if dither != "none" and dither != "ordered" and dither != "random" and dither != "error_diffusion": - raise value_error('Unsupported \"dither\" specified!') + raise value_error('Unsupported "dither" specified!') else: if dither < 0 or dither > 9: - raise value_error('Unsupported \"dither\" specified!') + raise value_error('Unsupported "dither" specified!') if useZ and isinstance(dither, int): if dither == 0: dither = "ordered" @@ -264,7 +265,7 @@ def Depth(input, depth=None, sample=None, fulls=None, fulld=None, if kwargs['ampo'] is None: kwargs['ampo'] = 1.5 if dither == 0 else 1 elif not isinstance(kwargs['ampo'], (int, float)): - raise type_error('\"ampo\" must be an int or a float!') + raise type_error('"ampo" must be an int or a float!') # Skip processing if not needed if dSType == sSType and dbitPS == sbitPS and (sSType == vs.FLOAT or fulld == fulls) and not lowDepth: @@ -327,7 +328,7 @@ def ToRGB(input, matrix=None, depth=None, sample=None, full=None, clip = input if not isinstance(input, vs.VideoNode): - raise type_error('\"input\" must be a clip!') + raise type_error('"input" must be a clip!') # Get string format parameter "matrix" matrix = GetMatrix(input, matrix, True) @@ -355,7 +356,7 @@ def ToRGB(input, matrix=None, depth=None, sample=None, full=None, else: fulls = False if sIsYUV or sIsGRAY else True elif not isinstance(full, int): - raise type_error('\"full\" must be a bool!') + raise type_error('"full" must be a bool!') else: fulls = full @@ -363,7 +364,7 @@ def ToRGB(input, matrix=None, depth=None, sample=None, full=None, if depth is None: dbitPS = sbitPS elif not isinstance(depth, int): - raise type_error('\"depth\" must be an int!') + raise type_error('"depth" must be an int!') else: dbitPS = depth if sample is None: @@ -372,9 +373,9 @@ def ToRGB(input, matrix=None, depth=None, sample=None, full=None, else: dSType = vs.FLOAT if dbitPS >= 32 else vs.INTEGER elif not isinstance(sample, int): - raise type_error('\"sample\" must be an int!') + raise type_error('"sample" must be an int!') elif sample != vs.INTEGER and sample != vs.FLOAT: - raise value_error('\"sample\" must be either 0 (vs.INTEGER) or 1 (vs.FLOAT)!') + raise value_error('"sample" must be either 0 (vs.INTEGER) or 1 (vs.FLOAT)!') else: dSType = sample if depth is None and sSType != vs.FLOAT and sample == vs.FLOAT: @@ -412,7 +413,7 @@ def ToRGB(input, matrix=None, depth=None, sample=None, full=None, a1 = 0 a2 = 0.5 elif not isinstance(kernel, str): - raise type_error('\"kernel\" must be a str!') + raise type_error('"kernel" must be a str!') # Conversion if sIsRGB: @@ -501,7 +502,7 @@ def ToYUV(input, matrix=None, css=None, depth=None, sample=None, full=None, clip = input if not isinstance(input, vs.VideoNode): - raise type_error('\"input\" must be a clip!') + raise type_error('"input" must be a clip!') # Get string format parameter "matrix" matrix = GetMatrix(input, matrix, False) @@ -532,7 +533,7 @@ def ToYUV(input, matrix=None, css=None, depth=None, sample=None, full=None, else: fulls = False if sIsYUV or sIsGRAY else True elif not isinstance(full, int): - raise type_error('\"full\" must be a bool!') + raise type_error('"full" must be a bool!') else: fulls = full @@ -540,7 +541,7 @@ def ToYUV(input, matrix=None, css=None, depth=None, sample=None, full=None, if depth is None: dbitPS = sbitPS elif not isinstance(depth, int): - raise type_error('\"depth\" must be an int!') + raise type_error('"depth" must be an int!') else: dbitPS = depth if sample is None: @@ -549,9 +550,9 @@ def ToYUV(input, matrix=None, css=None, depth=None, sample=None, full=None, else: dSType = vs.FLOAT if dbitPS >= 32 else vs.INTEGER elif not isinstance(sample, int): - raise type_error('\"sample\" must be an int!') + raise type_error('"sample" must be an int!') elif sample != vs.INTEGER and sample != vs.FLOAT: - raise value_error('\"sample\" must be either 0 (vs.INTEGER) or 1 (vs.FLOAT)!') + raise value_error('"sample" must be either 0 (vs.INTEGER) or 1 (vs.FLOAT)!') else: dSType = sample if depth is None and sSType != vs.FLOAT and sample == vs.FLOAT: @@ -571,7 +572,7 @@ def ToYUV(input, matrix=None, css=None, depth=None, sample=None, full=None, else: fulld = False elif not isinstance(full, int): - raise type_error('\"full\" must be a bool!') + raise type_error('"full" must be a bool!') else: fulld = full @@ -581,7 +582,7 @@ def ToYUV(input, matrix=None, css=None, depth=None, sample=None, full=None, dVSubS = sVSubS css = '{ssw}{ssh}'.format(ssw=dHSubS, ssh=dVSubS) elif not isinstance(css, str): - raise type_error('\"css\" must be a str!') + raise type_error('"css" must be a str!') else: if css == "444" or css == "4:4:4": css = "11" @@ -622,7 +623,7 @@ def ToYUV(input, matrix=None, css=None, depth=None, sample=None, full=None, a1 = 0 a2 = 0.5 elif not isinstance(kernel, str): - raise type_error('\"kernel\" must be a str!') + raise type_error('"kernel" must be a str!') # Conversion if sIsYUV: @@ -767,7 +768,7 @@ def BM3D(input, sigma=None, radius1=None, radius2=None, profile1=None, profile2= clip = input if not isinstance(input, vs.VideoNode): - raise type_error('\"input\" must be a clip!') + raise type_error('"input" must be a clip!') # Get string format parameter "matrix" matrix = GetMatrix(input, matrix, True) @@ -795,7 +796,7 @@ def BM3D(input, sigma=None, radius1=None, radius2=None, profile1=None, profile2= else: fulls = False if sIsYUV or sIsGRAY else True elif not isinstance(full, int): - raise type_error('\"full\" must be a bool!') + raise type_error('"full" must be a bool!') else: fulls = full @@ -803,9 +804,9 @@ def BM3D(input, sigma=None, radius1=None, radius2=None, profile1=None, profile2= if psample is None: psample = vs.FLOAT elif not isinstance(psample, int): - raise type_error('\"psample\" must be an int!') + raise type_error('"psample" must be an int!') elif psample != vs.INTEGER and psample != vs.FLOAT: - raise value_error('\"psample\" must be either 0 (vs.INTEGER) or 1 (vs.FLOAT)!') + raise value_error('"psample" must be either 0 (vs.INTEGER) or 1 (vs.FLOAT)!') pbitPS = 16 if psample == vs.INTEGER else 32 pSType = psample @@ -815,7 +816,7 @@ def BM3D(input, sigma=None, radius1=None, radius2=None, profile1=None, profile2= dVSubS = sVSubS css = '{ssw}{ssh}'.format(ssw=dHSubS, ssh=dVSubS) elif not isinstance(css, str): - raise type_error('\"css\" must be a str!') + raise type_error('"css" must be a str!') else: if css == "444" or css == "4:4:4": css = "11" @@ -856,54 +857,54 @@ def BM3D(input, sigma=None, radius1=None, radius2=None, profile1=None, profile2= if radius1 is None: radius1 = 0 elif not isinstance(radius1, int): - raise type_error('\"radius1\" must be an int!') + raise type_error('"radius1" must be an int!') elif radius1 < 0: - raise value_error('valid range of \"radius1\" is [0, +inf)!') + raise value_error('valid range of "radius1" is [0, +inf)!') if radius2 is None: radius2 = radius1 elif not isinstance(radius2, int): - raise type_error('\"radius2\" must be an int!') + raise type_error('"radius2" must be an int!') elif radius2 < 0: - raise value_error('valid range of \"radius2\" is [0, +inf)!') + raise value_error('valid range of "radius2" is [0, +inf)!') if profile1 is None: profile1 = "fast" elif not isinstance(profile1, str): - raise type_error('\"profile1\" must be a str!') + raise type_error('"profile1" must be a str!') if profile2 is None: profile2 = profile1 elif not isinstance(profile2, str): - raise type_error('\"profile2\" must be a str!') + raise type_error('"profile2" must be a str!') if refine is None: refine = 1 elif not isinstance(refine, int): - raise type_error('\"refine\" must be an int!') + raise type_error('"refine" must be an int!') elif refine < 0: - raise value_error('valid range of \"refine\" is [0, +inf)!') + raise value_error('valid range of "refine" is [0, +inf)!') if output is None: output = 0 elif not isinstance(output, int): - raise type_error('\"output\" must be an int!') + raise type_error('"output" must be an int!') elif output < 0 or output > 2: - raise value_error('valid values of \"output\" are 0, 1 and 2!') + raise value_error('valid values of "output" are 0, 1 and 2!') if pre is not None: if not isinstance(pre, vs.VideoNode): - raise type_error('\"pre\" must be a clip!') + raise type_error('"pre" must be a clip!') if pre.format.id != sFormat.id: - raise value_error('clip \"pre\" must be of the same format as the input clip!') + raise value_error('clip "pre" must be of the same format as the input clip!') if pre.width != input.width or pre.height != input.height: - raise value_error('clip \"pre\" must be of the same size as the input clip!') + raise value_error('clip "pre" must be of the same size as the input clip!') if ref is not None: if not isinstance(ref, vs.VideoNode): - raise type_error('\"ref\" must be a clip!') + raise type_error('"ref" must be a clip!') if ref.format.id != sFormat.id: - raise value_error('clip \"ref\" must be of the same format as the input clip!') + raise value_error('clip "ref" must be of the same format as the input clip!') if ref.width != input.width or ref.height != input.height: - raise value_error('clip \"ref\" must be of the same size as the input clip!') + raise value_error('clip "ref" must be of the same size as the input clip!') # Get properties of output clip if depth is None: @@ -912,7 +913,7 @@ def BM3D(input, sigma=None, radius1=None, radius2=None, profile1=None, profile2= else: dbitPS = pbitPS elif not isinstance(depth, int): - raise type_error('\"depth\" must be an int!') + raise type_error('"depth" must be an int!') else: dbitPS = depth if sample is None: @@ -924,9 +925,9 @@ def BM3D(input, sigma=None, radius1=None, radius2=None, profile1=None, profile2= else: dSType = vs.FLOAT if dbitPS >= 32 else vs.INTEGER elif not isinstance(sample, int): - raise type_error('\"sample\" must be an int!') + raise type_error('"sample" must be an int!') elif sample != vs.INTEGER and sample != vs.FLOAT: - raise value_error('\"sample\" must be either 0 (vs.INTEGER) or 1 (vs.FLOAT)!') + raise value_error('"sample" must be either 0 (vs.INTEGER) or 1 (vs.FLOAT)!') else: dSType = sample if depth is None and sSType != vs.FLOAT and sample == vs.FLOAT: @@ -1061,8 +1062,8 @@ def BM3D(input, sigma=None, radius1=None, radius2=None, profile1=None, profile2= ## Main function: VFRSplice() ################################################################################################################################ ## Splice multiple clips with different frame rate, and output timecode file. -## Each input clip is CFR(constant frame rate). -## The output clip is VFR(variational frame rate). +## Each input clip is of CFR (constant frame rate). +## The output clip is of VFR (variational frame rate). ################################################################################################################################ ## Basic parameters ## clips {clip}: any number of clips to splice @@ -1080,27 +1081,27 @@ def VFRSplice(clips, tcfile=None, v2=None, precision=None): # Arguments if isinstance(clips, vs.VideoNode): clips = [clips] - elif isinstance(clips, list): + elif isinstance(clips, Sequence): for clip in clips: if not isinstance(clip, vs.VideoNode): - raise type_error('each element in \"clips\" must be a clip!') + raise type_error('each element in "clips" must be a clip!') if clip.fps_num == 0 or clip.fps_den == 0: - raise value_error('each clip in \"clips\" must be CFR!') + raise value_error('each clip in "clips" must be CFR!') else: - raise type_error('\"clips\" must be a clip or a list of clips!') + raise type_error('"clips" must be a clip or a sequence of clips!') if tcfile is not None and not isinstance(tcfile, str): - raise type_error('\"tcfile\" must be a str!') + raise type_error('"tcfile" must be a str!') if v2 is None: v2 = True elif not isinstance(v2, int): - raise type_error('\"v2\" must be a bool!') + raise type_error('"v2" must be a bool!') if precision is None: precision = 6 elif not isinstance(precision, int): - raise type_error('\"precision\" must be an int!') + raise type_error('"precision" must be an int!') # Fraction to str function def frac2str(num, den, precision=6): @@ -1190,7 +1191,7 @@ def frac2str(num, den, precision=6): def PlaneStatistics(clip, plane=None, mean=True, mad=True, var=True, std=True, rms=True): # input clip if not isinstance(clip, vs.VideoNode): - raise type_error('\"clip\" must be a clip!') + raise type_error('"clip" must be a clip!') # Get properties of input clip sFormat = clip.format @@ -1205,9 +1206,9 @@ def PlaneStatistics(clip, plane=None, mean=True, mad=True, var=True, std=True, r if plane is None: plane = 0 elif not isinstance(plane, int): - raise type_error('\"plane\" must be an int!') + raise type_error('"plane" must be an int!') elif plane < 0 or plane > sNumPlanes: - raise value_error('valid range of \"plane\" is [0, sNumPlanes)!'.format(sNumPlanes=sNumPlanes)) + raise value_error('valid range of "plane" is [0, sNumPlanes)!'.format(sNumPlanes=sNumPlanes)) floatFormat = RegisterFormat(vs.GRAY, vs.FLOAT, 32, 0, 0) floatBlk = core.std.BlankClip(clip, format=floatFormat.id) @@ -1316,16 +1317,16 @@ def _PlaneRMSTransfer(n, f): def PlaneCompare(clip1, clip2, plane=None, mae=True, rmse=True, psnr=True, cov=True, corr=True): # input clip if not isinstance(clip1, vs.VideoNode): - raise type_error('\"clip1\" must be a clip!') + raise type_error('"clip1" must be a clip!') if not isinstance(clip2, vs.VideoNode): - raise type_error('\"clip2\" must be a clip!') + raise type_error('"clip2" must be a clip!') # Get properties of input clip sFormat = clip1.format if sFormat.id != clip2.format.id: - raise value_error('\"clip1\" and \"clip2\" must be of the same format!') + raise value_error('"clip1" and "clip2" must be of the same format!') if clip1.width != clip2.width or clip1.height != clip2.height: - raise value_error('\"clip1\" and \"clip2\" must be of the same width and height!') + raise value_error('"clip1" and "clip2" must be of the same width and height!') sSType = sFormat.sample_type sbitPS = sFormat.bits_per_sample @@ -1337,9 +1338,9 @@ def PlaneCompare(clip1, clip2, plane=None, mae=True, rmse=True, psnr=True, cov=T if plane is None: plane = 0 elif not isinstance(plane, int): - raise type_error('\"plane\" must be an int!') + raise type_error('"plane" must be an int!') elif plane < 0 or plane > sNumPlanes: - raise value_error('valid range of \"plane\" is [0, sNumPlanes)!'.format(sNumPlanes=sNumPlanes)) + raise value_error('valid range of "plane" is [0, sNumPlanes)!'.format(sNumPlanes=sNumPlanes)) floatFormat = RegisterFormat(vs.GRAY, vs.FLOAT, 32, 0, 0) floatBlk = core.std.BlankClip(clip1, format=floatFormat.id) @@ -1441,7 +1442,7 @@ def _PlaneCovTransfer(n, f): def ShowAverage(clip, alignment=None): # input clip if not isinstance(clip, vs.VideoNode): - raise type_error('\"clip\" must be a clip!') + raise type_error('"clip" must be a clip!') # Get properties of input clip sFormat = clip.format @@ -1497,21 +1498,21 @@ def _ShowAverageFrame(n, f): def FilterIf(src, flt, prop_name, props=None): # input clip if not isinstance(src, vs.VideoNode): - raise type_error('\"src\" must be a clip!') + raise type_error('"src" must be a clip!') if not isinstance(flt, vs.VideoNode): - raise type_error('\"flt\" must be a clip!') + raise type_error('"flt" must be a clip!') if props is not None and not isinstance(props, vs.VideoNode): - raise type_error('\"props\" must be a clip!') + raise type_error('"props" must be a clip!') # Get properties of input clip sFormat = src.format if sFormat.id != flt.format.id: - raise value_error('\"src\" and \"flt\" must be of the same format!') + raise value_error('"src" and "flt" must be of the same format!') if src.width != flt.width or src.height != flt.height: - raise value_error('\"src\" and \"flt\" must be of the same width and height!') + raise value_error('"src" and "flt" must be of the same width and height!') if prop_name is None or not isinstance(prop_name, str): - raise type_error('\"prop_name\" must be specified and must be a str!') + raise type_error('"prop_name" must be specified and must be a str!') else: prop_name = _check_arg_prop(prop_name, None, None, 'prop_name') @@ -1736,30 +1737,30 @@ def MaxFilter(src, flt1, flt2, planes=None): ## default is the same as "thr" ## force_expr {bool} ## - True: force to use the std.Expr implementation -## - False: use the std.Lut implementation if possible +## - False: use the std.Lut implementation if available ## default: True ################################################################################################################################ def LimitFilter(flt, src, ref=None, thr=None, elast=None, brighten_thr=None, thrc=None, force_expr=None, planes=None): # input clip if not isinstance(flt, vs.VideoNode): - raise type_error('\"flt\" must be a clip!') + raise type_error('"flt" must be a clip!') if not isinstance(src, vs.VideoNode): - raise type_error('\"src\" must be a clip!') + raise type_error('"src" must be a clip!') if ref is not None and not isinstance(ref, vs.VideoNode): - raise type_error('\"ref\" must be a clip!') + raise type_error('"ref" must be a clip!') # Get properties of input clip sFormat = flt.format if sFormat.id != src.format.id: - raise value_error('\"flt\" and \"src\" must be of the same format!') + raise value_error('"flt" and "src" must be of the same format!') if flt.width != src.width or flt.height != src.height: - raise value_error('\"flt\" and \"src\" must be of the same width and height!') + raise value_error('"flt" and "src" must be of the same width and height!') if ref is not None: if sFormat.id != ref.format.id: - raise value_error('\"flt\" and \"ref\" must be of the same format!') + raise value_error('"flt" and "ref" must be of the same format!') if flt.width != ref.width or flt.height != ref.height: - raise value_error('\"flt\" and \"ref\" must be of the same width and height!') + raise value_error('"flt" and "ref" must be of the same width and height!') sColorFamily = sFormat.color_family CheckColorFamily(sColorFamily) @@ -1774,38 +1775,38 @@ def LimitFilter(flt, src, ref=None, thr=None, elast=None, brighten_thr=None, thr thr = 1.0 elif isinstance(thr, int) or isinstance(thr, float): if thr < 0: - raise value_error('valid range of \"thr\" is [0, +inf)') + raise value_error('valid range of "thr" is [0, +inf)') else: - raise type_error('\"thr\" must be an int or a float!') + raise type_error('"thr" must be an int or a float!') if elast is None: elast = 2.0 elif isinstance(elast, int) or isinstance(elast, float): if elast < 1: - raise value_error('valid range of \"elast\" is [1, +inf)') + raise value_error('valid range of "elast" is [1, +inf)') else: - raise type_error('\"elast\" must be an int or a float!') + raise type_error('"elast" must be an int or a float!') if brighten_thr is None: brighten_thr = thr elif isinstance(brighten_thr, int) or isinstance(brighten_thr, float): if brighten_thr < 0: - raise value_error('valid range of \"brighten_thr\" is [0, +inf)') + raise value_error('valid range of "brighten_thr" is [0, +inf)') else: - raise type_error('\"brighten_thr\" must be an int or a float!') + raise type_error('"brighten_thr" must be an int or a float!') if thrc is None: thrc = thr elif isinstance(thrc, int) or isinstance(thrc, float): if thrc < 0: - raise value_error('valid range of \"thrc\" is [0, +inf)') + raise value_error('valid range of "thrc" is [0, +inf)') else: - raise type_error('\"thrc\" must be an int or a float!') + raise type_error('"thrc" must be an int or a float!') if force_expr is None: force_expr = True elif not isinstance(force_expr, int): - raise type_error('\"force_expr\" must be a bool!') + raise type_error('"force_expr" must be a bool!') if ref is not None or sSType != vs.INTEGER: force_expr = True @@ -1816,17 +1817,17 @@ def LimitFilter(flt, src, ref=None, thr=None, elast=None, brighten_thr=None, thr process = [1 for i in range(VSMaxPlaneNum)] elif isinstance(planes, int): if planes < 0 or planes >= VSMaxPlaneNum: - raise value_error('valid range of \"planes\" is [0, {VSMaxPlaneNum})!'.format(VSMaxPlaneNum=VSMaxPlaneNum)) + raise value_error('valid range of "planes" is [0, {VSMaxPlaneNum})!'.format(VSMaxPlaneNum=VSMaxPlaneNum)) process[planes] = 1 - elif isinstance(planes, list): + elif isinstance(planes, Sequence): for p in planes: if not isinstance(p, int): - raise type_error('\"planes\" must be a (list of) int!') + raise type_error('"planes" must be a (sequence of) int!') elif p < 0 or p >= VSMaxPlaneNum: - raise value_error('valid range of \"planes\" is [0, {VSMaxPlaneNum})!'.format(VSMaxPlaneNum=VSMaxPlaneNum)) + raise value_error('valid range of "planes" is [0, {VSMaxPlaneNum})!'.format(VSMaxPlaneNum=VSMaxPlaneNum)) process[p] = 1 else: - raise type_error('\"planes\" must be a (list of) int!') + raise type_error('"planes" must be a (sequence of) int!') # Process if thr <= 0 and brighten_thr <= 0: @@ -1873,7 +1874,7 @@ def LimitFilter(flt, src, ref=None, thr=None, elast=None, brighten_thr=None, thr _planes.append(1) if process[2]: _planes.append(2) - diff = _limit_diff_lut(diff, thrc, elast, thrc, [1, 2]) + diff = _limit_diff_lut(diff, thrc, elast, thrc, _planes) else: diff = _limit_diff_lut(diff, thr, elast, brighten_thr, planes) clip = core.std.MakeDiff(flt, diff, planes=planes) @@ -1901,22 +1902,22 @@ def LimitFilter(flt, src, ref=None, thr=None, elast=None, brighten_thr=None, thr def PointPower(clip, vpow=None, hpow=None): # input clip if not isinstance(clip, vs.VideoNode): - raise type_error('\"clip\" must be a clip!') + raise type_error('"clip" must be a clip!') # Parameters if vpow is None: vpow = 1 elif not isinstance(vpow, int): - raise type_error('\"vpow\" must be an int!') + raise type_error('"vpow" must be an int!') elif vpow < 0: - raise value_error('valid range of \"vpow\" is [0, +inf)!') + raise value_error('valid range of "vpow" is [0, +inf)!') if hpow is None: hpow = 0 elif not isinstance(hpow, int): - raise type_error('\"hpow\" must be an int!') + raise type_error('"hpow" must be an int!') elif hpow < 0: - raise value_error('valid range of \"hpow\" is [0, +inf)!') + raise value_error('valid range of "hpow" is [0, +inf)!') # Process if hpow > 0: @@ -1947,7 +1948,7 @@ def PointPower(clip, vpow=None, hpow=None): ## Basic parameters ## clip {clip}: clip to evaluate ## must be of YUV color family -## matrices {str[]}: specify a (list of) matrix to test +## matrices {str[]}: specify a (sequence of) matrix to test ## default: ['601', '709', '2020', '240', 'FCC', 'YCgCo'] ## full {bool}: define if input clip is of full range ## default: False for YUV input @@ -1959,7 +1960,7 @@ def PointPower(clip, vpow=None, hpow=None): def CheckMatrix(clip, matrices=None, full=None, lower=None, upper=None): # input clip if not isinstance(clip, vs.VideoNode): - raise type_error('\"clip\" must be a clip!') + raise type_error('"clip" must be a clip!') # Get properties of input clip sFormat = clip.format @@ -1970,8 +1971,10 @@ def CheckMatrix(clip, matrices=None, full=None, lower=None, upper=None): # Parameters if matrices is None: matrices = ['601', '709', '2020', '240', 'FCC', 'YCgCo'] - elif not isinstance(matrices, list) and isinstance(matrices, str): - raise type_error('\'matrices\' must be a (list of) str!') + elif isinstance(matrices, str): + matrices = [matrices] + elif not isinstance(matrices, Sequence): + raise type_error('\'matrices\' must be a (sequence of) str!') if full is None: full = False @@ -2110,7 +2113,7 @@ def remove_brackets(x): def SetColorSpace(clip, ChromaLocation=None, ColorRange=None, Primaries=None, Matrix=None, Transfer=None): # input clip if not isinstance(clip, vs.VideoNode): - raise type_error('\"clip\" must be a clip!') + raise type_error('"clip" must be a clip!') # Modify frame properties if ChromaLocation is None: @@ -2122,9 +2125,9 @@ def SetColorSpace(clip, ChromaLocation=None, ColorRange=None, Primaries=None, Ma if ChromaLocation >= 0 and ChromaLocation <=5: clip = core.std.SetFrameProp(clip, prop='_ChromaLocation', intval=ChromaLocation) else: - raise value_error('valid range of \"ChromaLocation\" is [0, 5]!') + raise value_error('valid range of "ChromaLocation" is [0, 5]!') else: - raise type_error('\"ChromaLocation\" must be an int or a bool!') + raise type_error('"ChromaLocation" must be an int or a bool!') if ColorRange is None: pass @@ -2135,9 +2138,9 @@ def SetColorSpace(clip, ChromaLocation=None, ColorRange=None, Primaries=None, Ma if ColorRange >= 0 and ColorRange <=1: clip = core.std.SetFrameProp(clip, prop='_ColorRange', intval=ColorRange) else: - raise value_error('valid range of \"ColorRange\" is [0, 1]!') + raise value_error('valid range of "ColorRange" is [0, 1]!') else: - raise type_error('\"ColorRange\" must be an int or a bool!') + raise type_error('"ColorRange" must be an int or a bool!') if Primaries is None: pass @@ -2147,7 +2150,7 @@ def SetColorSpace(clip, ChromaLocation=None, ColorRange=None, Primaries=None, Ma elif isinstance(Primaries, int): clip = core.std.SetFrameProp(clip, prop='_Primaries', intval=Primaries) else: - raise type_error('\"Primaries\" must be an int or a bool!') + raise type_error('"Primaries" must be an int or a bool!') if Matrix is None: pass @@ -2157,7 +2160,7 @@ def SetColorSpace(clip, ChromaLocation=None, ColorRange=None, Primaries=None, Ma elif isinstance(Matrix, int): clip = core.std.SetFrameProp(clip, prop='_Matrix', intval=Matrix) else: - raise type_error('\"Matrix\" must be an int or a bool!') + raise type_error('"Matrix" must be an int or a bool!') if Transfer is None: pass @@ -2167,7 +2170,7 @@ def SetColorSpace(clip, ChromaLocation=None, ColorRange=None, Primaries=None, Ma elif isinstance(Transfer, int): clip = core.std.SetFrameProp(clip, prop='_Transfer', intval=Transfer) else: - raise type_error('\"Transfer\" must be an int or a bool!') + raise type_error('"Transfer" must be an int or a bool!') # Output return clip @@ -2184,7 +2187,7 @@ def SetColorSpace(clip, ChromaLocation=None, ColorRange=None, Primaries=None, Ma def AssumeFrame(clip): # input clip if not isinstance(clip, vs.VideoNode): - raise type_error('\"clip\" must be a clip!') + raise type_error('"clip" must be a clip!') # Modify frame properties clip = core.std.SetFrameProp(clip, prop='_FieldBased', intval=0) @@ -2204,7 +2207,7 @@ def AssumeFrame(clip): def AssumeTFF(clip): # input clip if not isinstance(clip, vs.VideoNode): - raise type_error('\"clip\" must be a clip!') + raise type_error('"clip" must be a clip!') # Modify frame properties clip = core.std.SetFrameProp(clip, prop='_FieldBased', intval=2) @@ -2224,7 +2227,7 @@ def AssumeTFF(clip): def AssumeBFF(clip): # input clip if not isinstance(clip, vs.VideoNode): - raise type_error('\"clip\" must be a clip!') + raise type_error('"clip" must be a clip!') # Modify frame properties clip = core.std.SetFrameProp(clip, prop='_FieldBased', intval=1) @@ -2248,10 +2251,10 @@ def AssumeBFF(clip): def AssumeField(clip, top): # input clip if not isinstance(clip, vs.VideoNode): - raise type_error('\"clip\" must be a clip!') + raise type_error('"clip" must be a clip!') if not isinstance(top, int): - raise type_error('\"top\" must be a bool!') + raise type_error('"top" must be a bool!') # Modify frame properties clip = RemoveFrameProp(clip, '_FieldBased') @@ -2277,13 +2280,13 @@ def AssumeField(clip, top): def AssumeCombed(clip, combed=True): # input clip if not isinstance(clip, vs.VideoNode): - raise type_error('\"clip\" must be a clip!') + raise type_error('"clip" must be a clip!') # Modify frame properties if combed is None: clip = RemoveFrameProp(clip, '_Combed') elif not isinstance(combed, int): - raise type_error('\"combed\" must be a bool!') + raise type_error('"combed" must be a bool!') else: clip = core.std.SetFrameProp(clip, prop='_Combed', intval=combed) @@ -2362,7 +2365,7 @@ def CheckVersion(version, less=False, equal=True, greater=True): def GetMatrix(clip, matrix=None, dIsRGB=None, id=False): # input clip if not isinstance(clip, vs.VideoNode): - raise type_error('\"clip\" must be a clip!') + raise type_error('"clip" must be a clip!') # Get properties of input clip sFormat = clip.format @@ -2375,11 +2378,11 @@ def GetMatrix(clip, matrix=None, dIsRGB=None, id=False): if dIsRGB is None: dIsRGB = not sIsRGB elif not isinstance(dIsRGB, int): - raise type_error('\"dIsRGB\" must be a bool!') + raise type_error('"dIsRGB" must be a bool!') # id if not isinstance(id, int): - raise type_error('\"id\" must be a bool!') + raise type_error('"id" must be a bool!') # Resolution level noneD = False @@ -2399,8 +2402,8 @@ def GetMatrix(clip, matrix=None, dIsRGB=None, id=False): # Convert to string format if matrix is None: matrix = "Unspecified" - elif not isinstance(matrix, int) and not isinstance(matrix, str): - raise type_error('\"matrix\" must be an int or a str!') + elif not isinstance(matrix, (int, str)): + raise type_error('"matrix" must be an int or a str!') else: if isinstance(matrix, str): matrix = matrix.lower() @@ -2450,7 +2453,7 @@ def GetMatrix(clip, matrix=None, dIsRGB=None, id=False): def zDepth(clip, sample=None, depth=None, range=None, range_in=None, dither_type=None, cpu_type=None): # input clip if not isinstance(clip, vs.VideoNode): - raise type_error('\"clip\" must be a clip!') + raise type_error('"clip" must be a clip!') # Get properties of input clip sFormat = clip.format @@ -2459,12 +2462,12 @@ def zDepth(clip, sample=None, depth=None, range=None, range_in=None, dither_type if sample is None: sample = sFormat.sample_type elif not isinstance(sample, int): - raise type_error('\"sample\" must be an int!') + raise type_error('"sample" must be an int!') if depth is None: depth = sFormat.bits_per_sample elif not isinstance(depth, int): - raise type_error('\"depth\" must be an int!') + raise type_error('"depth" must be an int!') format = RegisterFormat(sFormat.color_family, sample, depth, sFormat.subsampling_w, sFormat.subsampling_h) @@ -2502,7 +2505,7 @@ def zDepth(clip, sample=None, depth=None, range=None, range_in=None, dither_type def PlaneAverage(clip, plane=None, prop=None): # input clip if not isinstance(clip, vs.VideoNode): - raise type_error('\"clip\" must be a clip!') + raise type_error('"clip" must be a clip!') # Get properties of input clip sFormat = clip.format @@ -2512,14 +2515,14 @@ def PlaneAverage(clip, plane=None, prop=None): if plane is None: plane = 0 elif not isinstance(plane, int): - raise type_error('\"plane\" must be an int!') + raise type_error('"plane" must be an int!') elif plane < 0 or plane > sNumPlanes: - raise value_error('valid range of \"plane\" is [0, {})!'.format(sNumPlanes)) + raise value_error('valid range of "plane" is [0, {})!'.format(sNumPlanes)) if prop is None: prop = 'PlaneAverage' elif not isinstance(prop, str): - raise type_error('\"prop\" must be a str!') + raise type_error('"prop" must be a str!') # Process if core.std.get_functions().__contains__('PlaneAverage'): @@ -2555,7 +2558,7 @@ def _PlaneAverageTransfer(n, f): def GetPlane(clip, plane=None): # input clip if not isinstance(clip, vs.VideoNode): - raise type_error('\"clip\" must be a clip!') + raise type_error('"clip" must be a clip!') # Get properties of input clip sFormat = clip.format @@ -2565,9 +2568,9 @@ def GetPlane(clip, plane=None): if plane is None: plane = 0 elif not isinstance(plane, int): - raise type_error('\"plane\" must be an int!') + raise type_error('"plane" must be an int!') elif plane < 0 or plane > sNumPlanes: - raise value_error('valid range of \"plane\" is [0, {})!'.format(sNumPlanes)) + raise value_error('valid range of "plane" is [0, {})!'.format(sNumPlanes)) # Process return core.std.ShufflePlanes(clip, plane, vs.GRAY) @@ -2587,7 +2590,7 @@ def GetPlane(clip, plane=None): def GrayScale(clip, matrix=None): # input clip if not isinstance(clip, vs.VideoNode): - raise type_error('\"clip\" must be a clip!') + raise type_error('"clip" must be a clip!') # Get properties of input clip sFormat = clip.format @@ -2631,19 +2634,19 @@ def Preview(clips, plane=None, matrix=None, full=None, depth=None, # input clip if isinstance(clips, vs.VideoNode): ref = clips - elif isinstance(clips, list): + elif isinstance(clips, Sequence): for c in clips: if not isinstance(c, vs.VideoNode): - raise type_error('\"clips\" must be a clip or a list of clips!') + raise type_error('"clips" must be a clip or a sequence of clips!') ref = clips[0] else: - raise type_error('\"clips\" must be a clip or a list of clips!') + raise type_error('"clips" must be a clip or a sequence of clips!') # Get properties of output clip if depth is None: depth = 8 elif not isinstance(depth, int): - raise type_error('\"depth\" must be an int!') + raise type_error('"depth" must be an int!') if depth >= 32: sample = vs.FLOAT else: @@ -2671,9 +2674,8 @@ def _Conv(clip): if isinstance(clips, vs.VideoNode): clip = _Conv(clips) - elif isinstance(clips, list): - for i in range(len(clips)): - clips[i] = _Conv(clips[i]) + elif isinstance(clips, Sequence): + clips = [_Conv(c) for c in clips] clip = core.std.Interleave(clips) # Output @@ -2769,7 +2771,7 @@ def _quantization_parameters(sample=None, depth=None, full=None, chroma=None): if depth is None: depth = 8 elif depth < 1: - raise value_error('\"depth\" should not be less than 1!', num_stacks=2) + raise value_error('"depth" should not be less than 1!', num_stacks=2) if full is None: full = True if chroma is None: @@ -2801,7 +2803,7 @@ def _quantization_parameters(sample=None, depth=None, full=None, chroma=None): qp['ceil'] = 1.0 qp['range'] = qp['ceil'] - qp['floor'] else: - raise value_error('Unsupported \"sample\" specified!', num_stacks=2) + raise value_error('Unsupported "sample" specified!', num_stacks=2) return qp ################################################################################################################################ @@ -2814,7 +2816,7 @@ def _quantization_conversion(clip, depths=None, depthd=None, sample=None, fulls= chroma=None, clamp=None, dbitPS=None, mode=None): # input clip if not isinstance(clip, vs.VideoNode): - raise type_error('\"clip\" must be a clip!', num_stacks=2) + raise type_error('"clip" must be a clip!', num_stacks=2) # Get properties of input clip sFormat = clip.format @@ -2830,18 +2832,18 @@ def _quantization_conversion(clip, depths=None, depthd=None, sample=None, fulls= if depths is None: depths = sbitPS elif not isinstance(depths, int): - raise type_error('\"depths\" must be an int!', num_stacks=2) + raise type_error('"depths" must be an int!', num_stacks=2) if fulls is None: # If not set, assume limited range for YUV and Gray input fulls = False if sIsYUV or sIsGRAY else True elif not isinstance(fulls, int): - raise type_error('\"fulls\" must be a bool!', num_stacks=2) + raise type_error('"fulls" must be a bool!', num_stacks=2) if chroma is None: chroma = False elif not isinstance(chroma, int): - raise type_error('\"chroma\" must be a bool!', num_stacks=2) + raise type_error('"chroma" must be a bool!', num_stacks=2) elif not sIsGRAY: chroma = False @@ -2849,7 +2851,7 @@ def _quantization_conversion(clip, depths=None, depthd=None, sample=None, fulls= if depthd is None: pass elif not isinstance(depthd, int): - raise type_error('\"depthd\" must be an int!', num_stacks=2) + raise type_error('"depthd" must be an int!', num_stacks=2) if sample is None: if depthd is None: dSType = sSType @@ -2857,9 +2859,9 @@ def _quantization_conversion(clip, depths=None, depthd=None, sample=None, fulls= else: dSType = vs.FLOAT if dbitPS >= 32 else vs.INTEGER elif not isinstance(sample, int): - raise type_error('\"sample\" must be an int!', num_stacks=2) + raise type_error('"sample" must be an int!', num_stacks=2) elif sample != vs.INTEGER and sample != vs.FLOAT: - raise value_error('\"sample\" must be either 0 (vs.INTEGER) or 1 (vs.FLOAT)!', num_stacks=2) + raise value_error('"sample" must be either 0 (vs.INTEGER) or 1 (vs.FLOAT)!', num_stacks=2) else: dSType = sample if dSType == vs.INTEGER and (dbitPS < 1 or dbitPS > 16): @@ -2870,12 +2872,12 @@ def _quantization_conversion(clip, depths=None, depthd=None, sample=None, fulls= if fulld is None: fulld = fulls elif not isinstance(fulld, int): - raise type_error('\"fulld\" must be a bool!', num_stacks=2) + raise type_error('"fulld" must be a bool!', num_stacks=2) if clamp is None: clamp = dSType == vs.INTEGER elif not isinstance(clamp, int): - raise type_error('\"clamp\" must be a bool!', num_stacks=2) + raise type_error('"clamp" must be a bool!', num_stacks=2) if dbitPS is None: if depthd < 8: @@ -2883,12 +2885,12 @@ def _quantization_conversion(clip, depths=None, depthd=None, sample=None, fulls= else: dbitPS = depthd elif not isinstance(dbitPS, int): - raise type_error('\"dbitPS\" must be an int!', num_stacks=2) + raise type_error('"dbitPS" must be an int!', num_stacks=2) if mode is None: mode = 0 elif not isinstance(mode, int): - raise type_error('\"mode\" must be an int!', num_stacks=2) + raise type_error('"mode" must be an int!', num_stacks=2) elif depthd >= 8: mode = 0 @@ -2962,11 +2964,11 @@ def _check_arg_prop(arg, default=None, defaultTrue=None, argName='arg'): elif isinstance(arg, str): if arg: if not arg.isidentifier(): - raise value_error('{argName}=\"{arg}\" is not a valid identifier!'.format(argName=argName, arg=arg), num_stacks=2) + raise value_error('{argName}="{arg}" is not a valid identifier!'.format(argName=argName, arg=arg), num_stacks=2) else: arg = False else: - raise type_error('\"{argName}\" must be a str or a bool!'.format(argName=argName), num_stacks=2) + raise type_error('"{argName}" must be a str or a bool!'.format(argName=argName), num_stacks=2) return arg ################################################################################################################################ @@ -2978,16 +2980,16 @@ def _check_arg_prop(arg, default=None, defaultTrue=None, argName='arg'): def _operator2(clip1, clip2, mode, neutral, name): # input clip if not isinstance(clip1, vs.VideoNode): - raise type_error('\"clip1\" must be a clip!', num_stacks=2) + raise type_error('"clip1" must be a clip!', num_stacks=2) if not isinstance(clip2, vs.VideoNode): - raise type_error('\"clip2\" must be a clip!', num_stacks=2) + raise type_error('"clip2" must be a clip!', num_stacks=2) # Get properties of input clip sFormat = clip1.format if sFormat.id != clip2.format.id: - raise value_error('\"clip1\" and \"clip2\" must be of the same format!', num_stacks=2) + raise value_error('"clip1" and "clip2" must be of the same format!', num_stacks=2) if clip1.width != clip2.width or clip1.height != clip2.height: - raise value_error('\"clip1\" and \"clip2\" must be of the same width and height!', num_stacks=2) + raise value_error('"clip1" and "clip2" must be of the same width and height!', num_stacks=2) sSType = sFormat.sample_type sbitPS = sFormat.bits_per_sample @@ -3001,17 +3003,17 @@ def _operator2(clip1, clip2, mode, neutral, name): elif isinstance(mode, list): for m in mode: if not isinstance(m, int): - raise type_error('\"mode\" must be a (list of) int!', num_stacks=2) + raise type_error('"mode" must be a (sequence of) int!', num_stacks=2) while len(mode) < VSMaxPlaneNum: mode.append(mode[len(mode) - 1]) else: - raise type_error('\"mode\" must be a (list of) int!', num_stacks=2) + raise type_error('"mode" must be a (sequence of) int!', num_stacks=2) # neutral if neutral is None: neutral = 1 << (sbitPS - 1) if sSType == vs.INTEGER else 0 elif not (isinstance(neutral, int) or isinstance(neutral, float)): - raise type_error('\"neutral\" must be an int or a float!', num_stacks=2) + raise type_error('"neutral" must be an int or a float!', num_stacks=2) # Process and output expr = [] @@ -3036,7 +3038,7 @@ def _operator2(clip1, clip2, mode, neutral, name): else: expr.append("") else: - raise value_error('Unknown \"name\" specified!', num_stacks=1) + raise value_error('Unknown "name" specified!', num_stacks=1) return core.std.Expr([clip1, clip2], expr) ################################################################################################################################ @@ -3048,18 +3050,18 @@ def _operator2(clip1, clip2, mode, neutral, name): def _min_max_filter(src, flt1, flt2, planes, name): # input clip if not isinstance(src, vs.VideoNode): - raise type_error('\"src\" must be a clip!', num_stacks=2) + raise type_error('"src" must be a clip!', num_stacks=2) if not isinstance(flt1, vs.VideoNode): - raise type_error('\"flt1\" must be a clip!', num_stacks=2) + raise type_error('"flt1" must be a clip!', num_stacks=2) if not isinstance(flt2, vs.VideoNode): - raise type_error('\"flt2\" must be a clip!', num_stacks=2) + raise type_error('"flt2" must be a clip!', num_stacks=2) # Get properties of input clip sFormat = src.format if sFormat.id != flt1.format.id or sFormat.id != flt2.format.id: - raise value_error('\"src\", \"flt1\" and \"flt2\" must be of the same format!', num_stacks=2) + raise value_error('"src", "flt1" and "flt2" must be of the same format!', num_stacks=2) if src.width != flt1.width or src.height != flt1.height or src.width != flt2.width or src.height != flt2.height: - raise value_error('\"src\", \"flt1\" and \"flt2\" must be of the same width and height!', num_stacks=2) + raise value_error('"src", "flt1" and "flt2" must be of the same width and height!', num_stacks=2) sNumPlanes = sFormat.num_planes @@ -3070,17 +3072,17 @@ def _min_max_filter(src, flt1, flt2, planes, name): process = [1 for i in range(VSMaxPlaneNum)] elif isinstance(planes, int): if planes < 0 or planes >= VSMaxPlaneNum: - raise value_error('valid range of \"planes\" is [0, {VSMaxPlaneNum})!'.format(VSMaxPlaneNum=VSMaxPlaneNum), num_stacks=2) + raise value_error('valid range of "planes" is [0, {VSMaxPlaneNum})!'.format(VSMaxPlaneNum=VSMaxPlaneNum), num_stacks=2) process[planes] = 1 - elif isinstance(planes, list): + elif isinstance(planes, Sequence): for p in planes: if not isinstance(p, int): - raise type_error('\"planes\" must be a (list of) int!') + raise type_error('"planes" must be a (sequence of) int!') elif p < 0 or p >= VSMaxPlaneNum: - raise value_error('valid range of \"planes\" is [0, {VSMaxPlaneNum})!'.format(VSMaxPlaneNum=VSMaxPlaneNum), num_stacks=2) + raise value_error('valid range of "planes" is [0, {VSMaxPlaneNum})!'.format(VSMaxPlaneNum=VSMaxPlaneNum), num_stacks=2) process[p] = 1 else: - raise type_error('\"planes\" must be a (list of) int!', num_stacks=2) + raise type_error('"planes" must be a (sequence of) int!', num_stacks=2) # Process and output expr = [] @@ -3091,7 +3093,7 @@ def _min_max_filter(src, flt1, flt2, planes, name): elif name == 'MaxFilter': expr.append("x z - abs x y - abs > z y ?") else: - raise value_error('Unknown \"name\" specified!', num_stacks=1) + raise value_error('Unknown "name" specified!', num_stacks=1) else: expr.append("") @@ -3162,7 +3164,7 @@ def _limit_filter_expr(defref, thr, elast, largen_thr, value_range): def _limit_diff_lut(diff, thr, elast, largen_thr, planes): # input clip if not isinstance(diff, vs.VideoNode): - raise type_error('\"diff\" must be a clip!', num_stacks=2) + raise type_error('"diff" must be a clip!', num_stacks=2) # Get properties of input clip sFormat = diff.format @@ -3176,7 +3178,7 @@ def _limit_diff_lut(diff, thr, elast, largen_thr, planes): else: neutral = 0 value_range = 1 - raise value_error('\"diff\" must be of integer format!', num_stacks=2) + raise value_error('"diff" must be an int!', num_stacks=2) # Process thr = thr * value_range / 255