normalize ¶
Functions:
-
flatten–Flatten an array of values.
-
invert_ranges– -
norm_display_name–Get a fancy name from any object.
-
norm_func_name–Normalize a class, function, or other object to obtain its name
-
normalize_list_to_ranges– -
normalize_range–Normalize ranges represented by a tuple to an iterable of frame numbers.
-
normalize_ranges–Normalize ranges to a list of positive ranges.
-
normalize_ranges_to_list– -
normalize_seq–Normalize a sequence of values.
-
to_arr–Normalize any value to a list.
flatten ¶
Flatten an array of values. Bytes and str are not considered iterable and will not be flattened..
Source code in jetpytools/functions/normalize.py
74 75 76 77 78 79 80 81 82 83 84 85 | |
invert_ranges ¶
invert_ranges(
ranges: SoftRangeN | SoftRangesN,
lengtha: int,
lengthb: int | None,
exclusive: bool = False,
) -> list[StrictRange]
Source code in jetpytools/functions/normalize.py
243 244 245 246 247 248 249 250 | |
norm_display_name ¶
Get a fancy name from any object.
Source code in jetpytools/functions/normalize.py
283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 | |
norm_func_name ¶
norm_func_name(func_name: SupportsString | Callable[..., Any]) -> str
Normalize a class, function, or other object to obtain its name
Source code in jetpytools/functions/normalize.py
260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 | |
normalize_list_to_ranges ¶
normalize_list_to_ranges(
flist: Iterable[int], min_length: int = 0, exclusive: bool = False
) -> list[StrictRange]
Source code in jetpytools/functions/normalize.py
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 | |
normalize_range ¶
Normalize ranges represented by a tuple to an iterable of frame numbers.
Parameters:
-
(ranges¶SoftRange) –Ranges to normalize.
-
(exclusive¶bool, default:False) –Whether to use exclusive (Python-style) ranges. Defaults to False.
Returns:
Source code in jetpytools/functions/normalize.py
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 | |
normalize_ranges ¶
normalize_ranges(
ranges: SoftRangeN | SoftRangesN,
length: int,
exclusive: bool = False,
*,
strict: bool = True
) -> list[StrictRange]
Normalize ranges to a list of positive ranges.
Frame ranges can include None and negative values. None will be converted to either 0 if it's the first value in a SoftRange, or the end if it's the second item. Negative values will be subtracted from the end.
- Examples:
>>> normalize_ranges((None, None), length=1000) [(0, 999)] >>> normalize_ranges((24, -24), length=1000) [(24, 975)] >>> normalize_ranges([(24, 100), (80, 150)], length=1000) [(24, 150)]
Parameters:
-
(ranges¶SoftRangeN | SoftRangesN) –Frame range or list of frame ranges.
-
(length¶int) –Number of frames.
-
(exclusive¶bool, default:False) –Whether to use exclusive (Python-style) ranges. Defaults to False.
-
(strict¶bool, default:True) –Whether to enforce strict checking for out-of-range values.
Returns:
-
list[StrictRange]–List of positive frame ranges.
Source code in jetpytools/functions/normalize.py
142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 | |
normalize_ranges_to_list ¶
Source code in jetpytools/functions/normalize.py
133 134 135 136 137 138 139 | |
normalize_seq ¶
Normalize a sequence of values.
Parameters:
-
(val¶T | Sequence[T]) –Input value.
-
(length¶int) –Amount of items in the output. If original sequence length is less that this, the last item will be repeated.
Returns:
-
list[T]–List of normalized values with a set amount of items.
Source code in jetpytools/functions/normalize.py
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | |
to_arr ¶
Normalize any value to a list. Bytes and str are not considered iterable and will not be flattened.
Source code in jetpytools/functions/normalize.py
58 59 60 61 62 63 | |