|
12 | 12 | 1024. |
13 | 13 | - remap: Remap a value from one range to another. |
14 | 14 | """ |
| 15 | + |
15 | 16 | # Ignoring all mypy errors because mypy doesn't understand many modern typing |
16 | 17 | # constructs... please, use pyright instead if you can. |
17 | 18 | from __future__ import annotations |
@@ -284,41 +285,41 @@ def scale_1024( |
284 | 285 |
|
285 | 286 | @typing.overload |
286 | 287 | def remap( |
287 | | - value: decimal.Decimal, |
288 | | - old_min: decimal.Decimal | float, |
289 | | - old_max: decimal.Decimal | float, |
290 | | - new_min: decimal.Decimal | float, |
291 | | - new_max: decimal.Decimal | float, |
| 288 | + value: decimal.Decimal, |
| 289 | + old_min: decimal.Decimal | float, |
| 290 | + old_max: decimal.Decimal | float, |
| 291 | + new_min: decimal.Decimal | float, |
| 292 | + new_max: decimal.Decimal | float, |
292 | 293 | ) -> decimal.Decimal: ... |
293 | 294 |
|
294 | 295 |
|
295 | 296 | @typing.overload |
296 | 297 | def remap( |
297 | | - value: decimal.Decimal| float, |
298 | | - old_min: decimal.Decimal, |
299 | | - old_max: decimal.Decimal| float, |
300 | | - new_min: decimal.Decimal| float, |
301 | | - new_max: decimal.Decimal| float, |
| 298 | + value: decimal.Decimal | float, |
| 299 | + old_min: decimal.Decimal, |
| 300 | + old_max: decimal.Decimal | float, |
| 301 | + new_min: decimal.Decimal | float, |
| 302 | + new_max: decimal.Decimal | float, |
302 | 303 | ) -> decimal.Decimal: ... |
303 | 304 |
|
304 | 305 |
|
305 | 306 | @typing.overload |
306 | 307 | def remap( |
307 | | - value: decimal.Decimal | float, |
308 | | - old_min: decimal.Decimal | float, |
309 | | - old_max: decimal.Decimal, |
310 | | - new_min: decimal.Decimal | float, |
311 | | - new_max: decimal.Decimal | float, |
| 308 | + value: decimal.Decimal | float, |
| 309 | + old_min: decimal.Decimal | float, |
| 310 | + old_max: decimal.Decimal, |
| 311 | + new_min: decimal.Decimal | float, |
| 312 | + new_max: decimal.Decimal | float, |
312 | 313 | ) -> decimal.Decimal: ... |
313 | 314 |
|
314 | 315 |
|
315 | 316 | @typing.overload |
316 | 317 | def remap( |
317 | | - value: decimal.Decimal | float, |
318 | | - old_min: decimal.Decimal | float, |
319 | | - old_max: decimal.Decimal | float, |
320 | | - new_min: decimal.Decimal, |
321 | | - new_max: decimal.Decimal | float, |
| 318 | + value: decimal.Decimal | float, |
| 319 | + old_min: decimal.Decimal | float, |
| 320 | + old_max: decimal.Decimal | float, |
| 321 | + new_min: decimal.Decimal, |
| 322 | + new_max: decimal.Decimal | float, |
322 | 323 | ) -> decimal.Decimal: ... |
323 | 324 |
|
324 | 325 |
|
@@ -459,10 +460,10 @@ def remap( # pyright: ignore[reportInconsistentOverload] |
459 | 460 | new_value = (value - old_min) * new_range # type: ignore[operator] # pyright: ignore[reportOperatorIssue, reportUnknownVariableType] |
460 | 461 |
|
461 | 462 | if type_ is int: |
462 | | - new_value //= old_range # pyright: ignore[reportUnknownVariableType] |
| 463 | + new_value //= old_range # pyright: ignore[reportUnknownVariableType] |
463 | 464 | else: |
464 | | - new_value /= old_range # pyright: ignore[reportUnknownVariableType] |
| 465 | + new_value /= old_range # pyright: ignore[reportUnknownVariableType] |
465 | 466 |
|
466 | | - new_value += new_min # type: ignore[operator] # pyright: ignore[reportOperatorIssue, reportUnknownVariableType] |
| 467 | + new_value += new_min # type: ignore[operator] # pyright: ignore[reportOperatorIssue, reportUnknownVariableType] |
467 | 468 |
|
468 | 469 | return types.cast(_TN, new_value) |
0 commit comments