util ¶
Classes:
-
ExprVars
–A helper class for generating variable names used in RPN expressions.
ExprVars ¶
ExprVars(
stop: SupportsIndex | ExprVars | HoldsVideoFormat | VideoFormatLike,
/,
*,
expr_src: bool = False,
)
ExprVars(
start: SupportsIndex,
stop: SupportsIndex,
step: SupportsIndex | None = 1,
/,
*,
expr_src: bool = False,
)
ExprVars(
start_stop: SupportsIndex | ExprVars | HoldsVideoFormat | VideoFormatLike,
stop: SupportsIndex | None = None,
step: SupportsIndex | None = None,
/,
*,
expr_src: bool = False,
)
Bases: Sequence[str]
, Iterator[str]
A helper class for generating variable names used in RPN expressions.
Initialize an ExprVars instance.
Parameters:
-
start_stop
¶SupportsIndex | ExprVars | HoldsVideoFormat | VideoFormatLike
) –A start index or an object from which to infer the number of variables (e.g., video format).
-
stop
¶SupportsIndex | None
, default:None
) –Stop index (exclusive). Required only if
start_stop
is a numeric start value. -
step
¶SupportsIndex | None
, default:None
) –Step size for iteration. Default to 1.
-
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:
-
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
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 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 |
|
expr_src instance-attribute
¶
If True, variables are named as src0
, src1
, etc. Otherwise, "x", "y", "z", "a" and so on.
cycle classmethod
¶
An infinite generator of variable names, looping through EXPR_VARS
then continuing with srcX
style.
Returns:
Source code in vsexprtools/util.py
181 182 183 184 185 186 187 188 189 190 |
|
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
151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 |
|