[`ruff`] Make examples error out-of-the-box (`RUF026`, `RUF032`, `RUF039`, `RUF041`, `RUF045`, `RUF055`, `RUF064`) (#30581)
## Summary
While copying the rule examples and running Ruff on them, I noticed that
some examples were not triggering the intended lint violations. Ruff
reported `All checks passed!` because the examples were missing required
imports, preventing Ruff from recognizing symbols such as `Decimal`.
Added the missing imports to make the examples self-contained and ensure
that Ruff correctly detects the intended violations. Both the incorrect
and corrected examples were updated where necessary.
Rules updated: `RUF026`, `RUF032`, `RUF039`, `RUF041`, `RUF045`,
`RUF055`, `RUF064`
Part of #18972
## Test Plan
* Before: Running Ruff on the original examples reported `All checks
passed!`, even though the examples were intended to trigger lint
violations.
* After: Running `ruff check --select RUF032` on the updated `Decimal`
example correctly reports an `RUF032` violation.
* Changes are documentation-only; no linting logic was modified.