util ¶
Classes:
-
ExprVars
–A helper class for generating variable names used in RPN expressions.
Functions:
ExprVars ¶
ExprVars(
stop: SupportsIndex | Self | HoldsVideoFormat | VideoFormatLike,
/,
*,
expr_src: bool = False,
)
ExprVars(
start: SupportsIndex,
stop: SupportsIndex,
step: SupportsIndex = 1,
/,
*,
expr_src: bool = False,
)
ExprVars(
start_stop: SupportsIndex | Self | HoldsVideoFormat | VideoFormatLike,
stop: SupportsIndex | MissingT = MISSING,
step: SupportsIndex = 1,
/,
*,
expr_src: bool = False,
)
A helper class for generating variable names used in RPN expressions.
Initialize an ExprVars instance.
Parameters:
-
start_stop
¶SupportsIndex | Self | HoldsVideoFormat | VideoFormatLike
) –A start index or an object from which to infer the number of variables (e.g., video format).
-
stop
¶SupportsIndex | MissingT
, default:MISSING
) –Stop index (exclusive). Required only if
start_stop
is a numeric start value. -
step
¶SupportsIndex
, default:1
) –Step size for iteration.
-
expr_src
¶bool
, default:False
) –Whether to use
srcX
naming or use alphabetic variables.
Raises:
-
CustomIndexError
–If
start
is negative orstop
is not greater thanstart
. -
CustomTypeError
–If invalid types are provided.
Methods:
-
__call__
–Allows an ExprVars instance to be called like a function to create a new instance with new parameters.
-
cycle
–An infinite generator of variable names, looping through
EXPR_VARS
then continuing withsrcX
style. -
get_var
–Get a variable name for a specific index.
Attributes:
-
curr
(int
) –Current index in iteration.
-
expr_src
(bool
) –If True, variables are named as
src0
,src1
, etc. Otherwise, "x", "y", "z", "a" and so on. -
start
(int
) –Starting index for variable generation (inclusive).
-
step
(int
) –Step size for iteration.
-
stop
(int
) –Ending index for variable generation (exclusive).
Source code in vsexprtools/util.py
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 |
|
expr_src instance-attribute
¶
If True, variables are named as src0
, src1
, etc. Otherwise, "x", "y", "z", "a" and so on.
__call__ ¶
__call__(
stop: SupportsIndex | Self | HoldsVideoFormat | VideoFormatLike,
/,
*,
expr_src: bool = False,
) -> Self
__call__(
start: SupportsIndex,
stop: SupportsIndex,
step: SupportsIndex = 1,
/,
*,
expr_src: bool = False,
) -> Self
__call__(
start_stop: SupportsIndex | Self | HoldsVideoFormat | VideoFormatLike,
stop: SupportsIndex | MissingT = MISSING,
step: SupportsIndex = 1,
/,
*,
expr_src: bool = False,
) -> Self
Allows an ExprVars instance to be called like a function to create a new instance with new parameters.
Parameters:
-
start_stop
¶SupportsIndex | Self | HoldsVideoFormat | VideoFormatLike
) –A start index or an object from which to infer the number of variables (e.g., video format).
-
stop
¶SupportsIndex | MissingT
, default:MISSING
) –Stop index (exclusive). Required only if
start_stop
is a numeric start value. -
step
¶SupportsIndex
, default:1
) –Step size for iteration.
-
expr_src
¶bool
, default:False
) –Whether to use
srcX
naming or use alphabetic variables.
Returns:
-
Self
–A new instance with the specified parameters.
Source code in vsexprtools/util.py
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 |
|
cycle classmethod
¶
An infinite generator of variable names, looping through EXPR_VARS
then continuing with srcX
style.
Returns:
Source code in vsexprtools/util.py
229 230 231 232 233 234 235 236 237 238 |
|
get_var classmethod
¶
get_var(value: SupportsIndex) -> str
Get a variable name for a specific index.
Parameters:
-
value
¶SupportsIndex
) –Index to convert to variable name.
Returns:
-
str
–The variable name.
Raises:
-
CustomIndexError
–If the index is negative.
Source code in vsexprtools/util.py
199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 |
|
bitdepth_aware_tokenize_expr ¶
bitdepth_aware_tokenize_expr(
clips: Sequence[VideoNode],
expr: str,
chroma: bool,
func: FuncExcept | None = None,
) -> str
Source code in vsexprtools/util.py
259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 |
|
extra_op_tokenize_expr ¶
Source code in vsexprtools/util.py
241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 |
|
norm_expr_planes ¶
norm_expr_planes(
clip: VideoNode,
expr: str | list[str],
planes: Planes = None,
**kwargs: Iterable[SupportsString] | SupportsString
) -> list[str]
Source code in vsexprtools/util.py
301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 |
|